2024-01-21 02:39:52 +00:00
|
|
|
import * as Misskey from 'misskey-js';
|
|
|
|
|
2024-02-01 11:59:30 +00:00
|
|
|
export type GridItem = {
|
2024-01-21 02:39:52 +00:00
|
|
|
readonly id?: string;
|
2024-01-27 03:02:50 +00:00
|
|
|
readonly fileId?: string;
|
|
|
|
readonly url: string;
|
|
|
|
|
2024-02-01 11:59:30 +00:00
|
|
|
checked: boolean;
|
2024-01-27 03:02:50 +00:00
|
|
|
name: string;
|
|
|
|
category: string;
|
|
|
|
aliases: string;
|
|
|
|
license: string;
|
|
|
|
isSensitive: boolean;
|
|
|
|
localOnly: boolean;
|
|
|
|
roleIdsThatCanBeUsedThisEmojiAsReaction: string;
|
|
|
|
}
|
|
|
|
|
2024-02-01 11:59:30 +00:00
|
|
|
export function fromEmojiDetailed(it: Misskey.entities.EmojiDetailed): GridItem {
|
|
|
|
return {
|
|
|
|
id: it.id,
|
|
|
|
fileId: undefined,
|
|
|
|
url: it.url,
|
|
|
|
checked: false,
|
|
|
|
name: it.name,
|
|
|
|
category: it.category ?? '',
|
|
|
|
aliases: it.aliases.join(', '),
|
|
|
|
license: it.license ?? '',
|
|
|
|
isSensitive: it.isSensitive,
|
|
|
|
localOnly: it.localOnly,
|
|
|
|
roleIdsThatCanBeUsedThisEmojiAsReaction: it.roleIdsThatCanBeUsedThisEmojiAsReaction.join(', '),
|
|
|
|
};
|
|
|
|
}
|
2024-01-22 01:37:44 +00:00
|
|
|
|
2024-02-01 11:59:30 +00:00
|
|
|
export function fromDriveFile(it: Misskey.entities.DriveFile): GridItem {
|
|
|
|
return {
|
|
|
|
id: undefined,
|
|
|
|
fileId: it.id,
|
|
|
|
url: it.url,
|
|
|
|
checked: false,
|
|
|
|
name: it.name.replace(/\.[a-zA-Z0-9]+$/, ''),
|
|
|
|
category: '',
|
|
|
|
aliases: '',
|
|
|
|
license: '',
|
|
|
|
isSensitive: it.isSensitive,
|
|
|
|
localOnly: false,
|
|
|
|
roleIdsThatCanBeUsedThisEmojiAsReaction: '',
|
|
|
|
};
|
2024-01-21 02:39:52 +00:00
|
|
|
}
|