mirror of https://github.com/msgbyte/tailchat
parent
b3e4359920
commit
f5d36de237
@ -1,16 +1,28 @@
|
|||||||
import { EmojiPanel } from '@/components/EmojiPanel';
|
import { EmojiPanel } from '@/components/EmojiPanel';
|
||||||
import React, { useCallback } from 'react';
|
import { useTcPopoverContext } from '@/components/TcPopover';
|
||||||
import type { ChatMessage } from 'tailchat-shared';
|
import type { RenderFunction } from 'antd/lib/_util/getRenderPropValue';
|
||||||
|
import React, { useCallback, useMemo } from 'react';
|
||||||
|
import { ChatMessage, useUpdateRef } from 'tailchat-shared';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 消息的反应信息操作
|
* 消息的反应信息操作
|
||||||
*/
|
*/
|
||||||
export function useChatMessageReaction(
|
export function useChatMessageReaction(payload: ChatMessage): RenderFunction {
|
||||||
payload: ChatMessage
|
const payloadRef = useUpdateRef(payload);
|
||||||
): React.ReactElement {
|
const Component = useMemo(
|
||||||
|
() =>
|
||||||
|
(() => {
|
||||||
|
const { closePopover } = useTcPopoverContext();
|
||||||
|
|
||||||
const handleSelect = useCallback((code: string) => {
|
const handleSelect = useCallback((code: string) => {
|
||||||
console.log('code', code);
|
console.log('code', code, payloadRef.current);
|
||||||
|
closePopover();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return <EmojiPanel onSelect={handleSelect} />;
|
return <EmojiPanel onSelect={handleSelect} />;
|
||||||
|
}) as RenderFunction,
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
|
return Component;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,10 @@
|
|||||||
|
.emoji-picker {
|
||||||
|
.emoji-mart-anchors {
|
||||||
|
justify-content: flex-start;
|
||||||
|
gap: 6px;
|
||||||
|
|
||||||
|
.emoji-mart-anchor {
|
||||||
|
flex: initial;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
import type { Data } from 'emoji-mart';
|
||||||
|
import data from 'emoji-mart/data/twitter.json';
|
||||||
|
|
||||||
|
export const emojiData: Data = {
|
||||||
|
compressed: true,
|
||||||
|
categories: [
|
||||||
|
{
|
||||||
|
id: 'people',
|
||||||
|
name: 'Smileys & People',
|
||||||
|
emojis: data.categories[0].emojis,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'nature',
|
||||||
|
name: 'Animals & Nature',
|
||||||
|
emojis: data.categories[1].emojis,
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// id: 'foods',
|
||||||
|
// name: 'Food & Drink',
|
||||||
|
// emojis: data.categories[2].emojis,
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: 'activity',
|
||||||
|
// name: 'Activities',
|
||||||
|
// emojis: data.categories[3].emojis,
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: 'places',
|
||||||
|
// name: 'Travel & Places',
|
||||||
|
// emojis: data.categories[4].emojis,
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: 'objects',
|
||||||
|
// name: 'Objects',
|
||||||
|
// emojis: data.categories[5].emojis,
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: 'symbols',
|
||||||
|
// name: 'Symbols',
|
||||||
|
// emojis: data.categories[6].emojis,
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: 'flags',
|
||||||
|
// name: 'Flags',
|
||||||
|
// emojis: data.categories[7].emojis,
|
||||||
|
// },
|
||||||
|
],
|
||||||
|
emojis: data.emojis,
|
||||||
|
aliases: data.aliases,
|
||||||
|
};
|
Loading…
Reference in New Issue