From aaadcee23dcae285dedbcbdfbc7d49a212d552c1 Mon Sep 17 00:00:00 2001 From: AAA <35992542+TNTcraftHIM@users.noreply.github.com> Date: Tue, 10 Nov 2026 07:23:03 -0400 Subject: [PATCH] refactor(ui): reuse room settings and clarify connection controls --- docs/guide/room-tools.md | 2 +- docs/guide/room-tools.zh-CN.md | 2 +- .../channel/components/ChannelRoomControls.tsx | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/guide/room-tools.md b/docs/guide/room-tools.md index 6d02a31ae..dcd66be45 100644 --- a/docs/guide/room-tools.md +++ b/docs/guide/room-tools.md @@ -20,7 +20,7 @@ in place. The tabs show the tasks available to you: - **Invitation:** Copy the private-room invitation or open its QR code. Under **Users with access**, **Remove room access** ends that user's access and activities in this room; they need a new grant to return. -- **My forwarding:** Choose how many people this device helps forward to in this room. +- **Connection settings:** Choose how many people this device helps forward to in this room. - **Records and backups:** Export chat, or export a room backup when you manage its host. To restore, select **Restore backup**, choose the ZIP and read the replacement notice before **Confirm**. Restoration replaces this room's diff --git a/docs/guide/room-tools.zh-CN.md b/docs/guide/room-tools.zh-CN.md index cb24571c7..7502bb231 100644 --- a/docs/guide/room-tools.zh-CN.md +++ b/docs/guide/room-tools.zh-CN.md @@ -15,7 +15,7 @@ - **房间:** 修改名称、图片或访问方式,再点**保存**。**对未获准的用户隐藏房间**会让尚未获准的人看不到该私密房间。 - **邀请:** 复制私密房间邀请或打开二维码。在**已获准的用户**中,**移除房间资格**会结束该用户在此房间的访问和活动;再次进入需要重新获准。 -- **我的转发:** 选择这台设备在本房间最多帮多少人转发。 +- **连接设置:** 选择这台设备在本房间最多帮多少人转发。 - **记录与备份:** 导出聊天;管理房间托管端时还可导出房间备份。恢复时点**从备份恢复**,选择 ZIP,阅读替换提示后再点**确认**。恢复会替换此房间的设置和消息。 更换邀请不会撤销已获准用户的资格。需要换新链接时,展开**重置房间邀请**,再点**生成新邀请**。 diff --git a/src/client/channel/components/ChannelRoomControls.tsx b/src/client/channel/components/ChannelRoomControls.tsx index f53f16ed4..ea2c0d07a 100644 --- a/src/client/channel/components/ChannelRoomControls.tsx +++ b/src/client/channel/components/ChannelRoomControls.tsx @@ -46,7 +46,7 @@ function RelayLimit({ value, min, label, note, disabled, onChange }: { ; } -function PersonalRelay({ channel, room, disabled, run }: { channel: ChannelController; room: ChannelRoom; disabled: boolean; run: SettingsAction }) { +export function PersonalRelay({ channel, room, disabled, run }: { channel: ChannelController; room: ChannelRoom; disabled: boolean; run: SettingsAction }) { const { lang } = useCopy(), zh = lang === "zh"; const host = room.delivery?.hostSessionId === channel.sessionId; const following = room.relayOverride === null; @@ -64,13 +64,13 @@ function PersonalRelay({ channel, room, disabled, run }: { channel: ChannelContr ; } -type RoomDraft = Pick & { password: string; removePassword: boolean; relayCapacity: number }; -function roomDraft(room?: ChannelRoom): RoomDraft { +export type RoomDraft = Pick & { password: string; removePassword: boolean; relayCapacity: number }; +export function roomDraft(room?: ChannelRoom): RoomDraft { return { name: room?.name ?? "", icon: room?.icon ?? "couch", access: room?.access ?? "public", hidden: room?.hidden ?? false, password: "", removePassword: false, relayCapacity: room?.relayCapacity ?? DEFAULT_RELAY_CAPACITY }; } -function RoomForm({ room, value, onChange, appHosted, disabled, busy, onSave, onCancel }: { +export function RoomForm({ room, value, onChange, appHosted, disabled, busy, onSave, onCancel }: { room?: ChannelRoom; value: RoomDraft; onChange(value: Partial): void; appHosted: boolean; disabled: boolean; busy: boolean; onSave: (settings: RoomSettings) => Promise; onCancel(): void; }) { @@ -206,7 +206,7 @@ function RoomSettings({ channel, room, onClose }: { const tasks = [ ...(room.canManage ? [{ value: "room", label: zh ? "房间" : "Room", icon: "couch", hint: "hint-advanced" } as const] : []), { value: "invitation", label: zh ? "邀请" : "Invitation", icon: "link", hint: "hint-copy-invite" } as const, - ...(room.authorized ? [{ value: "relay", label: zh ? "我的转发" : "My forwarding", icon: "branch", hint: "hint-relay-volunteer" } as const] : []), + ...(room.authorized ? [{ value: "relay", label: zh ? "连接设置" : "Connection settings", icon: "branch", hint: "hint-relay-volunteer" } as const] : []), ...(room.authorized || room.canManage ? [{ value: "data", label: zh ? "记录与备份" : "Records and backups", icon: "save", hint: "hint-chat-export" } as const] : []), ]; const selected = tasks.some(value => value.value === task) ? task : "invitation"; @@ -258,7 +258,7 @@ function RoomSettings({ channel, room, onClose }: { } {room.authorized && } {(room.authorized || room.canManage) &&