feat(share): show right sidebar toggle in public share topnav and make collapse state local

This commit is contained in:
yiling
2026-06-19 10:53:01 +08:00
parent 2a611f9b5a
commit 3f27439733
4 changed files with 26 additions and 17 deletions
+1 -1
View File
@@ -240,7 +240,7 @@ export function BreadcrumbNav({
)}
</div>
{!fileId && (
{(!fileId || isPublic) && (
<div className="flex flex-shrink-0 items-center gap-1 rounded-md border border-border bg-background p-1">
{/* Left Sidebar Toggle */}
{!isPublic && onLeftSidebarToggle && (
@@ -2,7 +2,6 @@
import { client } from '@/ui/api/client'
import { useTopNavStore } from '@/ui/stores/top-nav'
import { useUiStore } from '@/ui/stores/ui'
import { useInfiniteQuery, useQuery } from '@tanstack/react-query'
import { useEffect, useState, useMemo, useRef } from 'react'
import { TopNav } from './top-nav'
@@ -91,10 +90,7 @@ export function PublicShareManager({
const [selectedIds, setSelectedIds] = useState<Set<string>>(new Set())
const [rightSidebarWidth, setRightSidebarWidth] = useState(360)
const { fileViewRightSidebarCollapsed, shareConfigRightSidebarCollapsed } = useUiStore()
const isRightSidebarCollapsed = viewingFileId
? fileViewRightSidebarCollapsed
: shareConfigRightSidebarCollapsed
const [isRightSidebarCollapsed, setIsRightSidebarCollapsed] = useState(false)
const videoRef = useRef<Player | null>(null)
const [annotations, setAnnotations] = useState<Annotation[]>([])
const [currentTime, setCurrentTime] = useState(0)
@@ -322,6 +318,8 @@ export function PublicShareManager({
shareId: shareInfo.id,
fileId: viewingFileId || undefined,
onFolderClick: handleBreadcrumbClick,
isRightSidebarCollapsed,
onRightSidebarToggle: () => setIsRightSidebarCollapsed((prev) => !prev),
})
}
@@ -336,6 +334,7 @@ export function PublicShareManager({
ancestorFolders,
setProjectState,
clearProjectState,
isRightSidebarCollapsed,
])
let content
+19 -11
View File
@@ -43,17 +43,25 @@ export function TopNav() {
? uiStore.setShareConfigLeftSidebarCollapsed(!uiStore.shareConfigLeftSidebarCollapsed)
: uiStore.setFileListLeftSidebarCollapsed(!uiStore.fileListLeftSidebarCollapsed)
const isRightSidebarCollapsed = isFileView
? uiStore.fileViewRightSidebarCollapsed
: isShareConfig
? uiStore.shareConfigRightSidebarCollapsed
: uiStore.fileListRightSidebarCollapsed
const onRightSidebarToggle = () =>
isFileView
? uiStore.setFileViewRightSidebarCollapsed(!uiStore.fileViewRightSidebarCollapsed)
: isShareConfig
? uiStore.setShareConfigRightSidebarCollapsed(!uiStore.shareConfigRightSidebarCollapsed)
: uiStore.setFileListRightSidebarCollapsed(!uiStore.fileListRightSidebarCollapsed)
const isRightSidebarCollapsed =
isPublic && projectState.isRightSidebarCollapsed !== undefined
? projectState.isRightSidebarCollapsed
: isFileView
? uiStore.fileViewRightSidebarCollapsed
: isShareConfig
? uiStore.shareConfigRightSidebarCollapsed
: uiStore.fileListRightSidebarCollapsed
const onRightSidebarToggle =
isPublic && projectState.onRightSidebarToggle
? projectState.onRightSidebarToggle
: () =>
isFileView
? uiStore.setFileViewRightSidebarCollapsed(!uiStore.fileViewRightSidebarCollapsed)
: isShareConfig
? uiStore.setShareConfigRightSidebarCollapsed(
!uiStore.shareConfigRightSidebarCollapsed,
)
: uiStore.setFileListRightSidebarCollapsed(!uiStore.fileListRightSidebarCollapsed)
const displayStyle = projectId ? (uiStore.viewModes[projectId] ?? 'card') : 'card'
const onDisplayStyleChange = isPublic
+2
View File
@@ -23,6 +23,8 @@ export interface TopNavProjectState {
isPublic?: boolean
shareId?: string
onFolderClick?: (folderId: string) => void
isRightSidebarCollapsed?: boolean
onRightSidebarToggle?: () => void
}
interface TopNavStore {