diff --git a/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/FileBrowserApp.tsx b/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/FileBrowserApp.tsx index 3945ee43..e5de9918 100644 --- a/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/FileBrowserApp.tsx +++ b/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/FileBrowserApp.tsx @@ -8,20 +8,13 @@ import { VideoDownloadDialog } from './components/VideoDownloadDialog'; import { DictateDialog } from './components/DictateDialog'; import { useFileBrowserApp } from './useFileBrowserApp'; -type DefaultSort = { - field: 'name' | 'size' | 'type' | 'date'; - direction: 'asc' | 'desc'; -}; - type FileBrowserAppProps = { basePath?: string; rootOverride?: string; - initialPath?: string; - defaultSort?: DefaultSort; }; -export const FileBrowserApp = ({ basePath = '/', rootOverride, initialPath, defaultSort }: FileBrowserAppProps) => { - const fileBrowserManager = useFileBrowserApp(basePath, rootOverride, initialPath, defaultSort); +export const FileBrowserApp = ({ basePath = '/', rootOverride }: FileBrowserAppProps) => { + const fileBrowserManager = useFileBrowserApp(basePath, rootOverride); const { handleNavigate } = fileBrowserManager; return ( diff --git a/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/components/FileGrid.tsx b/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/components/FileGrid.tsx index 54acb2fe..892c7f3f 100644 --- a/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/components/FileGrid.tsx +++ b/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/components/FileGrid.tsx @@ -76,10 +76,9 @@ export const FileGrid = ({ fileBrowserManager }: FileGridProps) => { setSearchQuery, searchInputRef, } = fileBrowserManager; - const { defaultSort } = fileBrowserManager; const lastClickedIdx = useRef(-1); - const [sortField, setSortField] = useState(defaultSort?.field ?? 'name'); - const [sortDirection, setSortDirection] = useState(defaultSort?.direction ?? 'asc'); + const [sortField, setSortField] = useState('name'); + const [sortDirection, setSortDirection] = useState('asc'); const sorted = (() => { const compare = (a: DirEntry, b: DirEntry): number => { diff --git a/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/useFileBrowserApp.ts b/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/useFileBrowserApp.ts index e9cdca34..a9fcc0f2 100644 --- a/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/useFileBrowserApp.ts +++ b/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/useFileBrowserApp.ts @@ -8,31 +8,20 @@ import { useUserState } from 'state/useUserState'; import { useAuth } from 'hooks/useAuth'; import { usePanelChannel } from 'hooks/usePanelChannel'; -type DefaultSort = { - field: 'name' | 'size' | 'type' | 'date'; - direction: 'asc' | 'desc'; -}; - -export const useFileBrowserApp = ( - basePath: string, - rootOverride?: string, - initialPath?: string, - defaultSort?: DefaultSort, -) => { +export const useFileBrowserApp = (basePath: string, rootOverride?: string) => { const { user } = useAuth(); const navigate = useNavigate(); const [searchParams, setSearchParams] = useSearchParams(); const homeRoot = 'home'; const [, setGlobalPath] = useUserState('files/currentPath', '/'); - const [currentPath, setLocalPath] = useState(initialPath ?? basePath); + const [currentPath, setLocalPath] = useState(basePath); const scoped = basePath !== '/'; - const isolated = !!initialPath; // Navigation is session-local — the browser always opens at home, never restoring the // last path. The main (unscoped) browser still mirrors its folder into files/currentPath // so the Create Dashboard flow can default a new dashboard's cwd to it. const setCurrentPath = (path: string) => { setLocalPath(path); - if (!scoped && !isolated) setGlobalPath(path); + if (!scoped) setGlobalPath(path); }; const [entries, setEntries] = useState([]); const [rootDir, setRootDir] = useState(''); @@ -639,7 +628,6 @@ export const useFileBrowserApp = ( // View viewMode, setViewMode, - defaultSort, showHidden, setShowHidden, hiddenForced,