From fab88de8bfbc16854cd5bed17f3e8752e63a3ff0 Mon Sep 17 00:00:00 2001 From: ameer2468 <33054370+ameer2468@users.noreply.github.com> Date: Wed, 27 Sep 2023 17:49:01 +0300 Subject: [PATCH] [ENG-1142] Path bar shortcut (#1377) * Path bar shortcut * Add option to popover and tweak UI * increase size of folder icon + frame thumbs * view adjustments * truncate --------- Co-authored-by: nikec --- .../$libraryId/Explorer/FilePath/Thumb.tsx | 2 + .../app/$libraryId/Explorer/OptionsPanel.tsx | 72 +++++++++++-------- .../$libraryId/Explorer/View/ExplorerPath.tsx | 29 +++++--- .../app/$libraryId/Explorer/View/GridList.tsx | 28 +++++--- .../Explorer/View/ListView/index.tsx | 64 ++++++++++------- .../app/$libraryId/Explorer/View/index.tsx | 21 ++++-- .../app/$libraryId/Explorer/View/util.ts | 17 +++++ .../app/$libraryId/Explorer/ViewContext.ts | 5 +- interface/app/$libraryId/Explorer/index.tsx | 31 +++++--- .../settings/client/keybindings.tsx | 4 ++ interface/app/style.scss | 4 +- interface/components/GridList.tsx | 32 +++++---- packages/client/src/hooks/index.ts | 1 + .../src/hooks/useExplorerLayoutStore.ts | 14 ++++ 14 files changed, 223 insertions(+), 101 deletions(-) create mode 100644 interface/app/$libraryId/Explorer/View/util.ts create mode 100644 packages/client/src/hooks/useExplorerLayoutStore.ts diff --git a/interface/app/$libraryId/Explorer/FilePath/Thumb.tsx b/interface/app/$libraryId/Explorer/FilePath/Thumb.tsx index 685cb939a..8e49083db 100644 --- a/interface/app/$libraryId/Explorer/FilePath/Thumb.tsx +++ b/interface/app/$libraryId/Explorer/FilePath/Thumb.tsx @@ -42,6 +42,7 @@ export interface ThumbProps { mediaControls?: boolean; pauseVideo?: boolean; className?: string; + frameClassName?: string; childClassName?: string | ((type: ThumbType | `${ThumbType}`) => string | undefined); } @@ -62,6 +63,7 @@ export const FileThumb = memo((props: ThumbProps) => { const childClassName = 'max-h-full max-w-full object-contain'; const frameClassName = clsx( 'rounded-sm border-2 border-app-line bg-app-darkBox', + props.frameClassName, isDark ? classes.checkers : classes.checkersLight ); diff --git a/interface/app/$libraryId/Explorer/OptionsPanel.tsx b/interface/app/$libraryId/Explorer/OptionsPanel.tsx index 7bd33b294..fd086d6c2 100644 --- a/interface/app/$libraryId/Explorer/OptionsPanel.tsx +++ b/interface/app/$libraryId/Explorer/OptionsPanel.tsx @@ -1,4 +1,5 @@ import { RadixCheckbox, Select, SelectOption, Slider, tw, z } from '@sd/ui'; +import { getExplorerLayoutStore, useExplorerLayoutStore } from '~/../packages/client/src'; import { SortOrderSchema } from '~/app/route-schemas'; import { useExplorerContext } from './Context'; @@ -15,6 +16,7 @@ const Subheading = tw.div`text-ink-dull mb-1 text-xs font-medium`; export default () => { const explorerStore = useExplorerStore(); const explorer = useExplorerContext(); + const layoutStore = useExplorerLayoutStore(); const settings = explorer.useSettingsSnapshot(); @@ -117,44 +119,58 @@ export default () => { )} -
- {settings.layoutMode === 'grid' && ( +
+ Explorer +
{ + if (typeof value !== 'boolean') return; + getExplorerLayoutStore().showPathBar = value; + }} + /> + + {settings.layoutMode === 'grid' && ( + { + if (typeof value !== 'boolean') return; + + explorer.settingsStore.showBytesInGridView = value; + }} + /> + )} + + { if (typeof value !== 'boolean') return; - explorer.settingsStore.showBytesInGridView = value; + explorer.settingsStore.showHiddenFiles = value; }} /> - )} - { - if (typeof value !== 'boolean') return; + {settings.layoutMode === 'media' && ( + { + if (typeof value !== 'boolean') return; - explorer.settingsStore.showHiddenFiles = value; - }} - /> + explorer.settingsStore.mediaAspectSquare = value; + }} + /> + )} +
- {settings.layoutMode === 'media' && ( - { - if (typeof value !== 'boolean') return; - - explorer.settingsStore.mediaAspectSquare = value; - }} - /> - )}
Double click action