From 5f6064473d029956d95e6e911630ce4537ce910c Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Wed, 20 Apr 2022 19:31:02 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E8=BA=AB=E4=BB=BD?= =?UTF-8?q?=E7=BB=84=E5=9F=BA=E6=9C=AC=E6=A1=86=E6=9E=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shared/i18n/langs/en-US/translation.json | 4 ++ shared/i18n/langs/zh-CN/translation.json | 4 ++ .../GroupDetail/Role/PermissionItem.tsx | 28 +++++++++ .../modals/GroupDetail/Role/RoleItem.tsx | 20 +++++++ .../modals/GroupDetail/Role/index.tsx | 59 +++++++++++++++++++ .../components/modals/GroupDetail/index.tsx | 7 +++ web/src/routes/Panel/index.tsx | 11 ++++ 7 files changed, 133 insertions(+) create mode 100644 web/src/components/modals/GroupDetail/Role/PermissionItem.tsx create mode 100644 web/src/components/modals/GroupDetail/Role/RoleItem.tsx create mode 100644 web/src/components/modals/GroupDetail/Role/index.tsx diff --git a/shared/i18n/langs/en-US/translation.json b/shared/i18n/langs/en-US/translation.json index 72ccdf9c..ab3b40b4 100644 --- a/shared/i18n/langs/en-US/translation.json +++ b/shared/i18n/langs/en-US/translation.json @@ -16,6 +16,7 @@ "k1bd56481": "Close independent window", "k1cbe2507": "Confirm", "k206eff71": "Nickname can not be blank", + "k21ee7a1f": "Roles", "k23a3bd72": "Abnormal", "k2426e452": "Friend Service", "k2488f9ee": "Friend Request", @@ -88,7 +89,9 @@ "k68283d04": "Application sent", "k685a1e78": "Copied to clipboard", "k6b5e7ffe": "The current panel has been opened in a separate window", + "k6c29eece": "Allows members to send message in text channels", "k6c75d61f": "Modify group avatar success", + "k6eac768d": "Add Members", "k6fb230da": "Pending friend request", "k6fc3abcd": "Enter now", "k7173d09e": "Account", @@ -155,6 +158,7 @@ "kb2217aa7": "Currently using a temporary account, <2>claim now", "kb3390ae7": "Are you sure you want to leave the group?", "kb47a9aa4": "Password can not be empty", + "kb488372f": "All", "kb55c8dba": "Invite Member", "kb5a17e73": "Leave group", "kb6f1c83f": "What do you want to call you?", diff --git a/shared/i18n/langs/zh-CN/translation.json b/shared/i18n/langs/zh-CN/translation.json index 53cd4a06..d71dcc4b 100644 --- a/shared/i18n/langs/zh-CN/translation.json +++ b/shared/i18n/langs/zh-CN/translation.json @@ -16,6 +16,7 @@ "k1bd56481": "关闭独立窗口", "k1cbe2507": "确认", "k206eff71": "昵称不能为空", + "k21ee7a1f": "身份组", "k23a3bd72": "异常", "k2426e452": "好友服务", "k2488f9ee": "申请好友", @@ -88,7 +89,9 @@ "k68283d04": "已发送申请", "k685a1e78": "已复制到剪切板", "k6b5e7ffe": "当前面板已在独立窗口打开", + "k6c29eece": "允许成员在文字频道发送消息", "k6c75d61f": "修改群组头像成功", + "k6eac768d": "添加角色", "k6fb230da": "等待处理的好友请求", "k6fc3abcd": "立即进入", "k7173d09e": "账户信息", @@ -155,6 +158,7 @@ "kb2217aa7": "当前使用的是一个临时账号, <2>立即认领", "kb3390ae7": "确定要退出群组么?", "kb47a9aa4": "密码不能为空", + "kb488372f": "所有人", "kb55c8dba": "邀请成员", "kb5a17e73": "退出群组", "kb6f1c83f": "想要让大家如何称呼你", diff --git a/web/src/components/modals/GroupDetail/Role/PermissionItem.tsx b/web/src/components/modals/GroupDetail/Role/PermissionItem.tsx new file mode 100644 index 00000000..cd8d1820 --- /dev/null +++ b/web/src/components/modals/GroupDetail/Role/PermissionItem.tsx @@ -0,0 +1,28 @@ +import { Col, Row, Switch } from 'antd'; +import React from 'react'; + +interface PermissionItemProps { + title: string; + desc?: string; +} + +export const PermissionItem: React.FC = React.memo( + (props) => { + return ( +
+ + + {props.title} + + + + + + + +
{props.desc}
+
+ ); + } +); +PermissionItem.displayName = 'PermissionItem'; diff --git a/web/src/components/modals/GroupDetail/Role/RoleItem.tsx b/web/src/components/modals/GroupDetail/Role/RoleItem.tsx new file mode 100644 index 00000000..95fffb3f --- /dev/null +++ b/web/src/components/modals/GroupDetail/Role/RoleItem.tsx @@ -0,0 +1,20 @@ +import clsx from 'clsx'; +import React from 'react'; + +export const RoleItem: React.FC<{ + active: boolean; +}> = React.memo((props) => { + return ( +
+ {props.children} +
+ ); +}); +RoleItem.displayName = 'RoleItem'; diff --git a/web/src/components/modals/GroupDetail/Role/index.tsx b/web/src/components/modals/GroupDetail/Role/index.tsx new file mode 100644 index 00000000..6f3f24e0 --- /dev/null +++ b/web/src/components/modals/GroupDetail/Role/index.tsx @@ -0,0 +1,59 @@ +import { IconBtn } from '@/components/IconBtn'; +import { PillTabPane, PillTabs } from '@/components/PillTabs'; +import { UserListItem } from '@/components/UserListItem'; +import { Button } from 'antd'; +import React, { useCallback } from 'react'; +import { t, useGroupInfo } from 'tailchat-shared'; +import { PermissionItem } from './PermissionItem'; +import { RoleItem } from './RoleItem'; + +interface GroupPermissionProps { + groupId: string; +} +export const GroupRole: React.FC = React.memo((props) => { + const { groupId } = props; + const groupInfo = useGroupInfo(groupId); + const members = groupInfo?.members ?? []; + + const handleAddMember = useCallback(() => {}, []); + + return ( +
+
+ {/* 角色列表 */} + {t('所有人')} + + {t('添加角色')} +
+ +
+ + + {/* 权限详情 */} + + + + {/* 管理成员 */} +
+ +
+ + {members.map((m) => ( + ]} + /> + ))} +
+
+
+
+ ); +}); +GroupRole.displayName = 'GroupRole'; diff --git a/web/src/components/modals/GroupDetail/index.tsx b/web/src/components/modals/GroupDetail/index.tsx index e5b6248d..4875c902 100644 --- a/web/src/components/modals/GroupDetail/index.tsx +++ b/web/src/components/modals/GroupDetail/index.tsx @@ -9,6 +9,7 @@ import { pluginCustomPanel } from '@/plugin/common'; import React, { useCallback, useMemo } from 'react'; import { t } from 'tailchat-shared'; import { GroupPanel } from './Panel'; +import { GroupRole } from './Role'; import { GroupSummary } from './Summary'; interface SettingsViewProps { @@ -43,6 +44,12 @@ export const GroupDetail: React.FC = React.memo((props) => { title: t('面板'), content: , }, + { + type: 'item', + title: t('身份组'), + isDev: true, + content: , + }, ], }, ]; diff --git a/web/src/routes/Panel/index.tsx b/web/src/routes/Panel/index.tsx index cb4bb61f..d6748766 100644 --- a/web/src/routes/Panel/index.tsx +++ b/web/src/routes/Panel/index.tsx @@ -5,6 +5,7 @@ import { MainProvider } from '../Main/Provider'; import { t } from 'tailchat-shared'; import { PersonalConverse } from '../Main/Content/Personal/Converse'; import { GroupPanelRoute } from '../Main/Content/Group/Panel'; +import { GroupDetail } from '@/components/modals/GroupDetail'; const PanelRoute: React.FC = React.memo(() => { useRecordMeasure('AppRouteRenderStart'); @@ -18,6 +19,16 @@ const PanelRoute: React.FC = React.memo(() => { path="/panel/personal/converse/:converseId" component={PersonalConverse} /> + ( + {}} + /> + )} + />