mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-23 23:17:14 +00:00
feat(share): show right sidebar toggle in public share topnav and make collapse state local
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -23,6 +23,8 @@ export interface TopNavProjectState {
|
||||
isPublic?: boolean
|
||||
shareId?: string
|
||||
onFolderClick?: (folderId: string) => void
|
||||
isRightSidebarCollapsed?: boolean
|
||||
onRightSidebarToggle?: () => void
|
||||
}
|
||||
|
||||
interface TopNavStore {
|
||||
|
||||
Reference in New Issue
Block a user