mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-03-13 06:30:01 +01:00
fix merge issues in image pack file
This commit is contained in:
parent
6bfd6e39bc
commit
6b77c4dd40
1 changed files with 0 additions and 51 deletions
|
@ -21,9 +21,6 @@ import { useMatrixClient } from '../../hooks/useMatrixClient';
|
||||||
import { useMediaAuthentication } from '../../hooks/useMediaAuthentication';
|
import { useMediaAuthentication } from '../../hooks/useMediaAuthentication';
|
||||||
import { getStateEvent } from '../../utils/room';
|
import { getStateEvent } from '../../utils/room';
|
||||||
|
|
||||||
const renameImagePackItem = (shortcode) =>
|
|
||||||
new Promise((resolve) => {
|
|
||||||
let isCompleted = false;
|
|
||||||
const renameImagePackItem = (shortcode) =>
|
const renameImagePackItem = (shortcode) =>
|
||||||
new Promise((resolve) => {
|
new Promise((resolve) => {
|
||||||
let isCompleted = false;
|
let isCompleted = false;
|
||||||
|
@ -57,35 +54,6 @@ const renameImagePackItem = (shortcode) =>
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
openReusableDialog(
|
|
||||||
<Text variant="s1" weight="medium">
|
|
||||||
Rename
|
|
||||||
</Text>,
|
|
||||||
(requestClose) => (
|
|
||||||
<div style={{ padding: 'var(--sp-normal)' }}>
|
|
||||||
<form
|
|
||||||
onSubmit={(e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
const sc = e.target.shortcode.value;
|
|
||||||
if (sc.trim() === '') return;
|
|
||||||
isCompleted = true;
|
|
||||||
resolve(sc.trim());
|
|
||||||
requestClose();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Input value={shortcode} name="shortcode" label="Shortcode" autoFocus required />
|
|
||||||
<div style={{ height: 'var(--sp-normal)' }} />
|
|
||||||
<Button variant="primary" type="submit">
|
|
||||||
Rename
|
|
||||||
</Button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
),
|
|
||||||
() => {
|
|
||||||
if (!isCompleted) resolve(null);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
function getUsage(usage) {
|
function getUsage(usage) {
|
||||||
if (usage.includes('emoticon') && usage.includes('sticker')) return 'both';
|
if (usage.includes('emoticon') && usage.includes('sticker')) return 'both';
|
||||||
|
@ -135,13 +103,6 @@ function useUserImagePack() {
|
||||||
images: {},
|
images: {},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
return ImagePackBuilder.parsePack(
|
|
||||||
mx.getUserId(),
|
|
||||||
packEvent?.getContent() ?? {
|
|
||||||
pack: { display_name: 'Personal' },
|
|
||||||
images: {},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}, [mx]);
|
}, [mx]);
|
||||||
|
|
||||||
const sendPackContent = (content) => {
|
const sendPackContent = (content) => {
|
||||||
|
@ -162,7 +123,6 @@ function useImagePackHandles(pack, sendPackContent) {
|
||||||
let newKey = key?.replace(/\s/g, '_');
|
let newKey = key?.replace(/\s/g, '_');
|
||||||
if (pack.getImages().get(newKey)) {
|
if (pack.getImages().get(newKey)) {
|
||||||
newKey = suffixRename(newKey, (suffixedKey) => pack.getImages().get(suffixedKey));
|
newKey = suffixRename(newKey, (suffixedKey) => pack.getImages().get(suffixedKey));
|
||||||
newKey = suffixRename(newKey, (suffixedKey) => pack.getImages().get(suffixedKey));
|
|
||||||
}
|
}
|
||||||
return newKey;
|
return newKey;
|
||||||
};
|
};
|
||||||
|
@ -298,7 +258,6 @@ function ImagePack({ roomId, stateKey, handlePackDelete }) {
|
||||||
`Are you sure that you want to delete "${pack.displayName}"?`,
|
`Are you sure that you want to delete "${pack.displayName}"?`,
|
||||||
'Delete',
|
'Delete',
|
||||||
'danger'
|
'danger'
|
||||||
'danger'
|
|
||||||
);
|
);
|
||||||
if (!isConfirmed) return;
|
if (!isConfirmed) return;
|
||||||
handlePackDelete(stateKey);
|
handlePackDelete(stateKey);
|
||||||
|
@ -330,8 +289,6 @@ function ImagePack({ roomId, stateKey, handlePackDelete }) {
|
||||||
onEditProfile={canChange ? handleEditProfile : null}
|
onEditProfile={canChange ? handleEditProfile : null}
|
||||||
/>
|
/>
|
||||||
{canChange && <ImagePackUpload onUpload={handleAddItem} />}
|
{canChange && <ImagePackUpload onUpload={handleAddItem} />}
|
||||||
{images.length === 0 ? null : (
|
|
||||||
{canChange && <ImagePackUpload onUpload={handleAddItem} />}
|
|
||||||
{images.length === 0 ? null : (
|
{images.length === 0 ? null : (
|
||||||
<div>
|
<div>
|
||||||
<div className="image-pack__header">
|
<div className="image-pack__header">
|
||||||
|
@ -373,11 +330,6 @@ function ImagePack({ roomId, stateKey, handlePackDelete }) {
|
||||||
{viewMore ? 'View less' : `View ${pack.images.size - 2} more`}
|
{viewMore ? 'View less' : `View ${pack.images.size - 2} more`}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
{handlePackDelete && (
|
|
||||||
<Button variant="danger" onClick={handleDeletePack}>
|
|
||||||
Delete Pack
|
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className="image-pack__global">
|
<div className="image-pack__global">
|
||||||
|
@ -443,7 +395,6 @@ function ImagePackUser() {
|
||||||
onEditProfile={handleEditProfile}
|
onEditProfile={handleEditProfile}
|
||||||
/>
|
/>
|
||||||
<ImagePackUpload onUpload={handleAddItem} />
|
<ImagePackUpload onUpload={handleAddItem} />
|
||||||
{images.length === 0 ? null : (
|
|
||||||
{images.length === 0 ? null : (
|
{images.length === 0 ? null : (
|
||||||
<div>
|
<div>
|
||||||
<div className="image-pack__header">
|
<div className="image-pack__header">
|
||||||
|
@ -472,12 +423,10 @@ function ImagePackUser() {
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{pack.images.size > 2 && (
|
|
||||||
{pack.images.size > 2 && (
|
{pack.images.size > 2 && (
|
||||||
<div className="image-pack__footer">
|
<div className="image-pack__footer">
|
||||||
<Button onClick={() => setViewMore(!viewMore)}>
|
<Button onClick={() => setViewMore(!viewMore)}>
|
||||||
{viewMore ? 'View less' : `View ${pack.images.size - 2} more`}
|
{viewMore ? 'View less' : `View ${pack.images.size - 2} more`}
|
||||||
{viewMore ? 'View less' : `View ${pack.images.size - 2} more`}
|
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
Loading…
Reference in a new issue