From 84584c8bed61a44eefb8ce25b0a3dac99cd427c0 Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Fri, 3 Feb 2023 17:46:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=AF=9D=E9=A2=98=E5=8D=A1=E7=89=87?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=B7=B2=E8=AF=BB=E6=9C=AA=E8=AF=BB=E5=AE=B9?= =?UTF-8?q?=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/web/src/plugin/component/index.tsx | 1 + client/web/tailchat.d.ts | 14 ++ .../src/components/TopicCard.tsx | 86 ++++++------ .../com.msgbyte.topic/types/tailchat.d.ts | 123 +++++++++++++++--- 4 files changed, 165 insertions(+), 59 deletions(-) diff --git a/client/web/src/plugin/component/index.tsx b/client/web/src/plugin/component/index.tsx index 41ddba6e..971939aa 100644 --- a/client/web/src/plugin/component/index.tsx +++ b/client/web/src/plugin/component/index.tsx @@ -29,6 +29,7 @@ export { } from 'tailchat-design'; export { Link } from 'react-router-dom'; +export { MessageAckContainer } from '@/components/ChatBox/ChatMessageList/MessageAckContainer'; export { Image } from '@/components/Image'; export { IconBtn } from '@/components/IconBtn'; export { PillTabs, PillTabPane } from '@/components/PillTabs'; diff --git a/client/web/tailchat.d.ts b/client/web/tailchat.d.ts index 29b85e70..ceefa1fe 100644 --- a/client/web/tailchat.d.ts +++ b/client/web/tailchat.d.ts @@ -110,6 +110,10 @@ declare module '@capital/common' { export const getCachedConverseInfo: any; + export const getCachedBaseGroupInfo: any; + + export const getCachedUserSettings: any; + /** * 本地翻译 * @example @@ -166,6 +170,8 @@ declare module '@capital/common' { export const joinArray: any; + export const navigate: any; + export const useLocation: any; export const useNavigate: any; @@ -302,6 +308,10 @@ declare module '@capital/common' { export const regUserExtraInfo: any; + export const pluginSettings: any; + + export const regPluginSettings: any; + export const useGroupIdContext: () => string; export const useGroupPanelContext: () => { @@ -380,6 +390,10 @@ declare module '@capital/component' { export const metaFormFieldSchema: any; + export const Link: any; + + export const MessageAckContainer: any; + export const Image: any; export const IconBtn: React.FC<{ diff --git a/server/plugins/com.msgbyte.topic/web/plugins/com.msgbyte.topic/src/components/TopicCard.tsx b/server/plugins/com.msgbyte.topic/web/plugins/com.msgbyte.topic/src/components/TopicCard.tsx index 33bf829a..105d6430 100644 --- a/server/plugins/com.msgbyte.topic/web/plugins/com.msgbyte.topic/src/components/TopicCard.tsx +++ b/server/plugins/com.msgbyte.topic/web/plugins/com.msgbyte.topic/src/components/TopicCard.tsx @@ -5,7 +5,13 @@ import { showSuccessToasts, useAsyncRequest, } from '@capital/common'; -import { IconBtn, Input, UserName, UserAvatar } from '@capital/component'; +import { + IconBtn, + Input, + UserName, + UserAvatar, + MessageAckContainer, +} from '@capital/component'; import styled from 'styled-components'; import type { GroupTopic } from '../types'; import { Translate } from '../translate'; @@ -32,7 +38,7 @@ const Root = styled.div` flex: 1; user-select: text; - .header {· + .header { display: flex; line-height: 32px; @@ -85,49 +91,51 @@ export const TopicCard: React.FC<{ }, [topic.groupId, topic.panelId, topic._id, comment]); return ( - -
- -
- -
-
-
- -
-
{showMessageTime(topic.createdAt)}
+ + +
+
-
-
{getMessageRender(topic.content)}
+
+
+
+ +
+
{showMessageTime(topic.createdAt)}
+
- {Array.isArray(topic.comments) && topic.comments.length > 0 && ( - - )} -
+
+
{getMessageRender(topic.content)}
-
- -
+ {Array.isArray(topic.comments) && topic.comments.length > 0 && ( + + )} +
- {showReply && ( - - setComment(e.target.value)} - onPressEnter={handleComment} +
+ - - )} -
- +
+ + {showReply && ( + + setComment(e.target.value)} + onPressEnter={handleComment} + /> + + )} +
+ + ); }); TopicCard.displayName = 'TopicCard'; diff --git a/server/plugins/com.msgbyte.topic/web/plugins/com.msgbyte.topic/types/tailchat.d.ts b/server/plugins/com.msgbyte.topic/web/plugins/com.msgbyte.topic/types/tailchat.d.ts index 1ab8bc10..ceefa1fe 100644 --- a/server/plugins/com.msgbyte.topic/web/plugins/com.msgbyte.topic/types/tailchat.d.ts +++ b/server/plugins/com.msgbyte.topic/web/plugins/com.msgbyte.topic/types/tailchat.d.ts @@ -110,6 +110,10 @@ declare module '@capital/common' { export const getCachedConverseInfo: any; + export const getCachedBaseGroupInfo: any; + + export const getCachedUserSettings: any; + /** * 本地翻译 * @example @@ -123,14 +127,20 @@ declare module '@capital/common' { export const sharedEvent: any; - export const useAsync: any; + export const useAsync: Promise>( + fn: T, + deps?: React.DependencyList + ) => { loading: boolean; value?: any; error?: Error }; - export const useAsyncFn: any; + export const useAsyncFn: Promise>( + fn: T, + deps?: React.DependencyList + ) => [{ loading: boolean; value?: any; error?: Error }, T]; export const useAsyncRefresh: Promise>( fn: T, deps?: React.DependencyList - ) => [{ loading: boolean; value?: any; error?: Error }, T]; + ) => { loading: boolean; value?: any; error?: Error; refresh: () => void }; export const useAsyncRequest: Promise>( fn: T, @@ -158,12 +168,22 @@ declare module '@capital/common' { export const showMessageTime: any; + export const joinArray: any; + + export const navigate: any; + export const useLocation: any; export const useNavigate: any; + /** + * @deprecated please use createMetaFormSchema from @capital/component + */ export const createFastFormSchema: any; + /** + * @deprecated please use metaFormFieldSchema from @capital/component + */ export const fieldSchema: any; export const useCurrentUserInfo: any; @@ -183,13 +203,21 @@ declare module '@capital/common' { export const regGroupPanel: any; - export const messageInterpreter: any; + export const messageInterpreter: { + name?: string; + explainMessage: (message: string) => React.ReactNode; + }[]; - export const regMessageInterpreter: any; + export const regMessageInterpreter: (interpreter: { + name?: string; + explainMessage: (message: string) => React.ReactNode; + }) => void; - export const getMessageRender: any; + export const getMessageRender: (message: string) => React.ReactNode; - export const regMessageRender: any; + export const regMessageRender: ( + render: (message: string) => React.ReactNode + ) => void; export const getMessageTextDecorators: any; @@ -224,7 +252,23 @@ declare module '@capital/common' { export const pluginPanelActions: any; - export const regPluginPanelAction: any; + export const regPluginPanelAction: ( + action: + | { + name: string; + label: string; + icon: string; + position: 'group'; + onClick: (ctx: { groupId: string; panelId: string }) => void; + } + | { + name: string; + label: string; + icon: string; + position: 'dm'; + onClick: (ctx: { converseId: string }) => void; + } + ) => void; export const pluginPermission: any; @@ -260,6 +304,14 @@ declare module '@capital/common' { export const regPluginGroupTextPanelExtraMenu: any; + export const pluginUserExtraInfo: any; + + export const regUserExtraInfo: any; + + export const pluginSettings: any; + + export const regPluginSettings: any; + export const useGroupIdContext: () => string; export const useGroupPanelContext: () => { @@ -308,15 +360,41 @@ declare module '@capital/component' { }> >; + export const TextArea: any; + export const Avatar: any; export const SensitiveText: React.FC<{ className?: string; text: string }>; - export const TextArea: any; + export const Icon: React.FC<{ icon: string } & React.SVGProps>; - export const Image: any; + export const CopyableText: React.FC<{ + className?: string; + style?: React.CSSProperties; + config?: + | boolean + | { + text?: string; + onCopy?: (event?: React.MouseEvent) => void; + icon?: React.ReactNode; + tooltips?: boolean | React.ReactNode; + format?: 'text/plain' | 'text/html'; + }; + }>; - export const Icon: React.FC<{ icon: string } & React.SVGProps>; + export const WebFastForm: any; + + export const WebMetaForm: any; + + export const createMetaFormSchema: any; + + export const metaFormFieldSchema: any; + + export const Link: any; + + export const MessageAckContainer: any; + + export const Image: any; export const IconBtn: React.FC<{ icon: string; @@ -325,6 +403,9 @@ declare module '@capital/component' { size?: 'small' | 'middle' | 'large'; shape?: 'circle' | 'square'; title?: string; + danger?: boolean; + active?: boolean; + disabled?: boolean; onClick?: React.MouseEventHandler; }>; @@ -334,14 +415,6 @@ declare module '@capital/component' { export const LoadingSpinner: React.FC<{ tip?: string }>; - export const WebFastForm: any; - - export const WebMetaForm: any; - - export const createMetaFormSchema: any; - - export const metaFormFieldSchema: any; - export const FullModalField: any; export const DefaultFullModalInputEditorRender: any; @@ -408,12 +481,22 @@ declare module '@capital/component' { export const ErrorBoundary: any; - export const UserAvatar: any; + export const UserAvatar: React.FC<{ + userId: string; + className?: string; + style?: React.CSSProperties; + size?: 'large' | 'small' | 'default' | number; + }>; export const UserName: React.FC<{ userId: string; className?: string; + style?: React.CSSProperties; }>; export const Markdown: any; + + export const Webview: any; + + export const WebviewKeepAlive: any; }