hide dotfiles in super admin home directory, disable toggle
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+5
-3
@@ -23,6 +23,7 @@ export const Toolbar = ({ fileBrowserManager }: ToolbarProps) => {
|
|||||||
setViewMode,
|
setViewMode,
|
||||||
setShowVideoDownload,
|
setShowVideoDownload,
|
||||||
setShowDictate,
|
setShowDictate,
|
||||||
|
hiddenForced,
|
||||||
} = fileBrowserManager;
|
} = fileBrowserManager;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -123,10 +124,11 @@ export const Toolbar = ({ fileBrowserManager }: ToolbarProps) => {
|
|||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
onClick={() => setShowHidden((v) => !v)}
|
onClick={() => setShowHidden((v) => !v)}
|
||||||
className={`hidden md:block p-1.5 rounded-md cursor-pointer transition-colors ${showHidden ? 'bg-duck-teal text-duck-yellow' : 'text-duck-teal hover:bg-duck-dark/5'}`}
|
disabled={hiddenForced}
|
||||||
title={showHidden ? 'Hide hidden files' : 'Show hidden files'}
|
className={`hidden md:block p-1.5 rounded-md transition-colors ${hiddenForced ? 'opacity-30 cursor-not-allowed' : `cursor-pointer ${showHidden && !hiddenForced ? 'bg-duck-teal text-duck-yellow' : 'text-duck-teal hover:bg-duck-dark/5'}`}`}
|
||||||
|
title={hiddenForced ? 'Hidden files not shown in home directory' : showHidden ? 'Hide hidden files' : 'Show hidden files'}
|
||||||
>
|
>
|
||||||
{showHidden ? <Eye className="h-4 w-4" /> : <EyeOff className="h-4 w-4" />}
|
{showHidden && !hiddenForced ? <Eye className="h-4 w-4" /> : <EyeOff className="h-4 w-4" />}
|
||||||
</button>
|
</button>
|
||||||
<div className="flex items-center border border-duck-dark/20 rounded-md overflow-hidden">
|
<div className="flex items-center border border-duck-dark/20 rounded-md overflow-hidden">
|
||||||
<button
|
<button
|
||||||
|
|||||||
@@ -55,7 +55,8 @@ export const useFileBrowserApp = (basePath: string, rootOverride?: string, initi
|
|||||||
filesRef.current = files;
|
filesRef.current = files;
|
||||||
const currentPathRef = useRef(currentPath);
|
const currentPathRef = useRef(currentPath);
|
||||||
currentPathRef.current = currentPath;
|
currentPathRef.current = currentPath;
|
||||||
const visibleEntries = showHidden ? entries : entries.filter((e) => !e.name.startsWith('.'));
|
const hiddenForced = user?.role === 'Super Admin' && currentPath === '/';
|
||||||
|
const visibleEntries = showHidden && !hiddenForced ? entries : entries.filter((e) => !e.name.startsWith('.'));
|
||||||
|
|
||||||
const entryPath = (name: string) => (currentPath === '/' ? `/${name}` : `${currentPath}/${name}`);
|
const entryPath = (name: string) => (currentPath === '/' ? `/${name}` : `${currentPath}/${name}`);
|
||||||
const selectedPaths = () => Array.from(selected).map(entryPath);
|
const selectedPaths = () => Array.from(selected).map(entryPath);
|
||||||
@@ -665,7 +666,7 @@ export const useFileBrowserApp = (basePath: string, rootOverride?: string, initi
|
|||||||
visibleEntries, loading, refresh,
|
visibleEntries, loading, refresh,
|
||||||
// View
|
// View
|
||||||
viewMode, setViewMode, defaultSort,
|
viewMode, setViewMode, defaultSort,
|
||||||
showHidden, setShowHidden,
|
showHidden, setShowHidden, hiddenForced,
|
||||||
// Selection
|
// Selection
|
||||||
selected, setSelected,
|
selected, setSelected,
|
||||||
clipboard,
|
clipboard,
|
||||||
|
|||||||
Reference in New Issue
Block a user