diff --git a/client/shared/i18n/langs/en-US/translation.json b/client/shared/i18n/langs/en-US/translation.json index dd0af815..ee9312a8 100644 --- a/client/shared/i18n/langs/en-US/translation.json +++ b/client/shared/i18n/langs/en-US/translation.json @@ -266,6 +266,7 @@ "kaefc1e64": "Password reset successful, now back to login page", "kaf403ef0": "Light Mode", "kaf51d834": "Reset to default", + "kb01f8383": "Learn More", "kb030fbd1": "Member List", "kb0584341": "Usage Count", "kb07659b0": "Repeat password", @@ -357,7 +358,6 @@ "ke3d797fd": "Drop files to send into current converse", "ke59ffe49": "Muted, there are {{remain}} left", "ke6da074f": "The message was withdrawn successfully", - "kea977d95": "The following users are offline", "kec46a57f": "Add members", "kecb51e2c": "Old password", "kecbb0e45": "System", diff --git a/client/shared/i18n/langs/zh-CN/translation.json b/client/shared/i18n/langs/zh-CN/translation.json index 4e124aea..16a989a6 100644 --- a/client/shared/i18n/langs/zh-CN/translation.json +++ b/client/shared/i18n/langs/zh-CN/translation.json @@ -266,6 +266,7 @@ "kaefc1e64": "密码重置成功,现在回到登录页", "kaf403ef0": "亮色模式", "kaf51d834": "重置为默认值", + "kb01f8383": "了解更多", "kb030fbd1": "成员列表", "kb0584341": "使用次数", "kb07659b0": "重复密码", @@ -357,7 +358,6 @@ "ke3d797fd": "拖放文件以发送到当前会话", "ke59ffe49": "禁言中, 还剩 {{remain}}", "ke6da074f": "消息撤回成功", - "kea977d95": "以下用户已离线", "kec46a57f": "添加成员", "kecb51e2c": "旧密码", "kecbb0e45": "系统", diff --git a/client/shared/model/config.ts b/client/shared/model/config.ts index d98fcfb2..a5206749 100644 --- a/client/shared/model/config.ts +++ b/client/shared/model/config.ts @@ -50,6 +50,14 @@ export interface GlobalConfig { * 是否禁用添加好友功能 */ disableAddFriend?: boolean; + + announcement?: + | false + | { + id: string; + text: string; + link?: string; + }; } export function getGlobalConfig(): GlobalConfig { diff --git a/client/shared/utils/consts.ts b/client/shared/utils/consts.ts index f2c102b6..f0a9e8ad 100644 --- a/client/shared/utils/consts.ts +++ b/client/shared/utils/consts.ts @@ -27,4 +27,5 @@ export const defaultGlobalConfig: GlobalConfig = { disableCreateGroup: false, disablePluginStore: false, disableAddFriend: false, + announcement: false, }; diff --git a/client/web/src/components/GlobalAnnouncementBar.tsx b/client/web/src/components/GlobalAnnouncementBar.tsx new file mode 100644 index 00000000..8f405e31 --- /dev/null +++ b/client/web/src/components/GlobalAnnouncementBar.tsx @@ -0,0 +1,43 @@ +import { useLocalStorageState } from '@/hooks/useLocalStorage'; +import { Button } from 'antd'; +import React from 'react'; +import { Icon } from 'tailchat-design'; +import { t, useGlobalConfigStore } from 'tailchat-shared'; + +export const GlobalAnnouncementBar: React.FC = React.memo(() => { + const announcementInfo = useGlobalConfigStore((state) => state.announcement); + const [ackId, setAckId] = useLocalStorageState('ackGlobalAnnouncement'); + + if (!announcementInfo) { + return null; + } + + if (ackId === announcementInfo.id) { + // 如果该公告已读,也不展示 + return null; + } + + return ( +