Port 963a54664804e60ea8e30795090a0f20de7a48dc to glitch-soc Signed-off-by: Claire <claire.github-309c@sitedethib.com>
26 lines
603 B
TypeScript
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);
|
|
}
|