skip component group

This commit is contained in:
ChaosExAnima 2025-11-13 14:15:35 +01:00
parent 09a3a2a97d
commit b9fc383f03
No known key found for this signature in database
GPG Key ID: 8F2B333100FB6117
2 changed files with 12 additions and 3 deletions

View File

@ -1,4 +1,4 @@
import type { GroupMessage } from 'emojibase';
import type { GroupKey, GroupMessage } from 'emojibase';
import groupData from 'emojibase-data/meta/groups.json';
import type { CustomEmojiData } from '@/mastodon/features/emoji/types';
@ -7,6 +7,8 @@ type CustomGroupMessage = Omit<GroupMessage, 'key'> & {
key: string;
};
export const groupsToHide: readonly GroupKey[] = ['component'];
export const groupKeysToNumber = Object.fromEntries(
Object.entries(groupData.groups).map(([number, key]) => [
key,

View File

@ -16,6 +16,7 @@ import { CustomEmojiProvider } from '../context';
import {
groupKeysToNumber,
groupsToHide,
mockCustomEmojis,
mockCustomGroups,
} from './constants';
@ -58,11 +59,17 @@ export const MockEmojiPicker: FC<MockEmojiPickerProps> = ({ onSelect }) => {
`../../../../../../node_modules/emojibase-data/${currentLocale}/messages.json`
)
.then((module: { default: MessagesDataset }) => {
setGroups(module.default.groups);
setGroups(
module.default.groups.filter(
(group) => !groupsToHide.includes(group.key),
),
);
})
.catch((err: unknown) => {
console.warn('fell back to en messages', err);
setGroups(messages.groups);
setGroups(
messages.groups.filter((group) => !groupsToHide.includes(group.key)),
);
});
}