diff --git a/src/client/pages/HostPage.tsx b/src/client/pages/HostPage.tsx index a26ea03..77fd44a 100644 --- a/src/client/pages/HostPage.tsx +++ b/src/client/pages/HostPage.tsx @@ -247,6 +247,8 @@ export function HostPage({ onAuthorizationRequired }: HostPageProps = {}) { creationProfileRef.current = creationProfile; }, [creationProfile]); const [viewerPasswordDraft, setViewerPasswordDraft] = useState(""); + const [viewerPasswordEditorOpen, setViewerPasswordEditorOpen] = + useState(false); const [viewerPasswordUpdating, setViewerPasswordUpdating] = useState(false); const [maxViewers, setMaxViewers] = useState(null); const [peerSnapshots, setPeerSnapshots] = useState>( @@ -532,6 +534,8 @@ export function HostPage({ onAuthorizationRequired }: HostPageProps = {}) { clearHostRoom(); setRoom(null); setCopied(false); + setViewerPasswordEditorOpen(false); + setViewerPasswordDraft(""); } function endSharing(message: string, notifyServer = true): void { @@ -1234,6 +1238,7 @@ export function HostPage({ onAuthorizationRequired }: HostPageProps = {}) { setViewerPasswordUpdating(false); setViewerPasswordDraft(""); if (action !== undefined) { + setViewerPasswordEditorOpen(false); setNotice( action === null ? "房间密码已移除" : "房间密码已更新", ); @@ -2405,67 +2410,102 @@ export function HostPage({ onAuthorizationRequired }: HostPageProps = {}) { ))} -
{ - event.preventDefault(); - changeViewerPassword(viewerPasswordDraft); - }} - > - - - - - {viewerPasswordEnabled && ( + + + - )} -
+ + + ) : ( +
+ + +
+ + {viewerPasswordEnabled && + activeCodeEntryPolicy !== "password" && ( + + )} +
+
+ )} )} diff --git a/src/client/styles.css b/src/client/styles.css index c43ea0c..3915ad3 100644 --- a/src/client/styles.css +++ b/src/client/styles.css @@ -877,6 +877,40 @@ h3 { border-top: 1px solid var(--border); } +.room-password-summary { + display: flex; + min-width: 0; + align-items: center; + justify-content: space-between; + gap: 8px; + margin-top: 10px; + padding-top: 10px; + border-top: 1px solid var(--border); +} + +.room-password-state, +.room-password-actions { + display: flex; + min-width: 0; + align-items: center; +} + +.room-password-state { + gap: 6px; + color: var(--muted); + font-size: 12px; +} + +.room-password-actions { + flex: 0 0 auto; + gap: 6px; +} + +.room-password-edit-action { + min-height: 40px; + padding: 7px 10px; +} + .viewer-password-control > label { grid-column: 1 / -1; color: var(--muted);