mirror of
https://github.com/mastodon/mastodon.git
synced 2025-11-29 10:53:39 +00:00
skip component group
This commit is contained in:
parent
09a3a2a97d
commit
b9fc383f03
|
|
@ -1,4 +1,4 @@
|
||||||
import type { GroupMessage } from 'emojibase';
|
import type { GroupKey, GroupMessage } from 'emojibase';
|
||||||
import groupData from 'emojibase-data/meta/groups.json';
|
import groupData from 'emojibase-data/meta/groups.json';
|
||||||
|
|
||||||
import type { CustomEmojiData } from '@/mastodon/features/emoji/types';
|
import type { CustomEmojiData } from '@/mastodon/features/emoji/types';
|
||||||
|
|
@ -7,6 +7,8 @@ type CustomGroupMessage = Omit<GroupMessage, 'key'> & {
|
||||||
key: string;
|
key: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const groupsToHide: readonly GroupKey[] = ['component'];
|
||||||
|
|
||||||
export const groupKeysToNumber = Object.fromEntries(
|
export const groupKeysToNumber = Object.fromEntries(
|
||||||
Object.entries(groupData.groups).map(([number, key]) => [
|
Object.entries(groupData.groups).map(([number, key]) => [
|
||||||
key,
|
key,
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ import { CustomEmojiProvider } from '../context';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
groupKeysToNumber,
|
groupKeysToNumber,
|
||||||
|
groupsToHide,
|
||||||
mockCustomEmojis,
|
mockCustomEmojis,
|
||||||
mockCustomGroups,
|
mockCustomGroups,
|
||||||
} from './constants';
|
} from './constants';
|
||||||
|
|
@ -58,11 +59,17 @@ export const MockEmojiPicker: FC<MockEmojiPickerProps> = ({ onSelect }) => {
|
||||||
`../../../../../../node_modules/emojibase-data/${currentLocale}/messages.json`
|
`../../../../../../node_modules/emojibase-data/${currentLocale}/messages.json`
|
||||||
)
|
)
|
||||||
.then((module: { default: MessagesDataset }) => {
|
.then((module: { default: MessagesDataset }) => {
|
||||||
setGroups(module.default.groups);
|
setGroups(
|
||||||
|
module.default.groups.filter(
|
||||||
|
(group) => !groupsToHide.includes(group.key),
|
||||||
|
),
|
||||||
|
);
|
||||||
})
|
})
|
||||||
.catch((err: unknown) => {
|
.catch((err: unknown) => {
|
||||||
console.warn('fell back to en messages', err);
|
console.warn('fell back to en messages', err);
|
||||||
setGroups(messages.groups);
|
setGroups(
|
||||||
|
messages.groups.filter((group) => !groupsToHide.includes(group.key)),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user