feat: Implement sidebar collapse and expand functionality
- Add CSS for collapsed sidebar state and transitions - Introduce SidebarToggle class for managing collapse/expand logic - Integrate SidebarToggle initialization in main script - Add toggle button to navbar and make mini sidebar clickable - Store sidebar collapsed state in localStorage - Filter image files and directories in view mode via FileTree - Make navbar brand clickable to navigate to collection root or home
This commit is contained in:
@@ -103,6 +103,31 @@ const PathUtils = {
|
||||
return binaryExtensions.includes(extension);
|
||||
},
|
||||
|
||||
/**
|
||||
* Check if a directory is an image directory based on its name
|
||||
* @param {string} path - The directory path
|
||||
* @returns {boolean} True if the directory is for images
|
||||
* @example PathUtils.isImageDirectory('images') // true
|
||||
* @example PathUtils.isImageDirectory('assets/images') // true
|
||||
* @example PathUtils.isImageDirectory('docs') // false
|
||||
*/
|
||||
isImageDirectory(path) {
|
||||
const dirName = PathUtils.getFileName(path).toLowerCase();
|
||||
const imageDirectoryNames = [
|
||||
'images',
|
||||
'image',
|
||||
'img',
|
||||
'imgs',
|
||||
'pictures',
|
||||
'pics',
|
||||
'photos',
|
||||
'assets',
|
||||
'media',
|
||||
'static'
|
||||
];
|
||||
return imageDirectoryNames.includes(dirName);
|
||||
},
|
||||
|
||||
/**
|
||||
* Get a human-readable file type description
|
||||
* @param {string} path - The file path
|
||||
|
||||
Reference in New Issue
Block a user