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,
|
||||
setShowVideoDownload,
|
||||
setShowDictate,
|
||||
hiddenForced,
|
||||
} = fileBrowserManager;
|
||||
|
||||
return (
|
||||
@@ -123,10 +124,11 @@ export const Toolbar = ({ fileBrowserManager }: ToolbarProps) => {
|
||||
</div>
|
||||
<button
|
||||
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'}`}
|
||||
title={showHidden ? 'Hide hidden files' : 'Show hidden files'}
|
||||
disabled={hiddenForced}
|
||||
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>
|
||||
<div className="flex items-center border border-duck-dark/20 rounded-md overflow-hidden">
|
||||
<button
|
||||
|
||||
@@ -55,7 +55,8 @@ export const useFileBrowserApp = (basePath: string, rootOverride?: string, initi
|
||||
filesRef.current = files;
|
||||
const currentPathRef = useRef(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 selectedPaths = () => Array.from(selected).map(entryPath);
|
||||
@@ -665,7 +666,7 @@ export const useFileBrowserApp = (basePath: string, rootOverride?: string, initi
|
||||
visibleEntries, loading, refresh,
|
||||
// View
|
||||
viewMode, setViewMode, defaultSort,
|
||||
showHidden, setShowHidden,
|
||||
showHidden, setShowHidden, hiddenForced,
|
||||
// Selection
|
||||
selected, setSelected,
|
||||
clipboard,
|
||||
|
||||
Reference in New Issue
Block a user