Files
Mastodon/app/javascript/flavours/glitch/hooks/useCustomEmojis.ts
T
2026-06-16 21:52:32 +02:00

26 lines
603 B
TypeScript

import { createAppSelector, useAppSelector } from '@/flavours/glitch/store';
import type { ExtraCustomEmojiMap } from '../features/emoji/types';
const selectCustomEmojis = createAppSelector(
[(state) => state.emojis.custom],
(custom) => {
const emojis: ExtraCustomEmojiMap = {};
for (const shortcode in custom) {
const emoji = custom[shortcode];
if (!emoji) {
continue;
}
emojis[shortcode] = {
shortcode,
...emoji,
};
}
return emojis;
},
);
export function useCustomEmojis() {
return useAppSelector(selectCustomEmojis);
}