From d55df77455f26c7c33d582ba00b10964ffaddbbf Mon Sep 17 00:00:00 2001 From: Jamie Pine <32987599+jamiepine@users.noreply.github.com> Date: Sat, 20 May 2023 17:17:27 -0700 Subject: [PATCH] [ENG-631] TopBar improvements & misc fixes (#837) * fix things * added back/forward buttons to settings * split top bar context into left and right * hook up path * fix background jobs hidden from job manager * core * fix type + quick preview transition * fix selected item color contrast * fix close button on quick preview * clean up job ui for light theme * Improve media view overscan --------- Co-authored-by: Brendan Allan --- .../src/renderer/_default.page.server.tsx | 1 - core/src/job/job_manager.rs | 4 +- core/src/location/mod.rs | 37 +++++++------ .../app/$libraryId/Explorer/GridView.tsx | 2 +- .../app/$libraryId/Explorer/MediaView.tsx | 6 +- .../app/$libraryId/Explorer/QuickPreview.tsx | 20 ++++--- interface/app/$libraryId/Explorer/View.tsx | 5 +- interface/app/$libraryId/Explorer/index.tsx | 2 + .../Layout/Sidebar/JobManager/Job.scss | 20 +++++-- .../Layout/Sidebar/JobManager/Job.tsx | 29 +++++----- .../Layout/Sidebar/JobManager/JobGroup.tsx | 6 +- .../Layout/Sidebar/JobManager/index.tsx | 6 +- .../Layout/Sidebar/LibrariesDropdown.tsx | 2 +- .../app/$libraryId/Layout/Sidebar/index.tsx | 8 +-- interface/app/$libraryId/TopBar/Layout.tsx | 24 +++++--- .../$libraryId/TopBar}/NavigationButtons.tsx | 25 +++++---- interface/app/$libraryId/TopBar/Portal.tsx | 18 ++++++ .../app/$libraryId/TopBar/TopBarMobile.tsx | 2 +- .../{TopBarChildren.tsx => TopBarOptions.tsx} | 55 ++++++++++--------- interface/app/$libraryId/TopBar/index.tsx | 34 +++++------- interface/app/$libraryId/location/$id.tsx | 35 ++++++++++-- .../$libraryId/overview/CategoryButton.tsx | 2 +- interface/app/$libraryId/overview/index.tsx | 25 ++++++--- interface/app/$libraryId/search.tsx | 19 ++++--- interface/app/$libraryId/settings/Sidebar.tsx | 6 +- interface/components/index.ts | 1 - interface/hooks/useExplorerStore.tsx | 8 +-- interface/hooks/useExplorerTopBarOptions.tsx | 12 +++- packages/client/src/core.ts | 34 ++++++------ packages/ui/style/colors.scss | 4 +- packages/ui/style/tailwind.js | 1 + 31 files changed, 270 insertions(+), 183 deletions(-) rename interface/{components => app/$libraryId/TopBar}/NavigationButtons.tsx (56%) create mode 100644 interface/app/$libraryId/TopBar/Portal.tsx rename interface/app/$libraryId/TopBar/{TopBarChildren.tsx => TopBarOptions.tsx} (75%) diff --git a/apps/landing/src/renderer/_default.page.server.tsx b/apps/landing/src/renderer/_default.page.server.tsx index 3c52b91f4..fe1899f09 100644 --- a/apps/landing/src/renderer/_default.page.server.tsx +++ b/apps/landing/src/renderer/_default.page.server.tsx @@ -1,6 +1,5 @@ import ReactDOMServer from 'react-dom/server'; import { Helmet } from 'react-helmet'; -// @ts-expect-error import { dangerouslySkipEscape, escapeInject } from 'vite-plugin-ssr/server'; import type { PageContextBuiltIn } from 'vite-plugin-ssr/types'; import App from '../App'; diff --git a/core/src/job/job_manager.rs b/core/src/job/job_manager.rs index d18e7d1e3..ef9b6d319 100644 --- a/core/src/job/job_manager.rs +++ b/core/src/job/job_manager.rs @@ -167,9 +167,7 @@ impl JobManager { for worker in self.running_workers.read().await.values() { let report = worker.lock().await.report(); - if !report.is_background { - ret.push(report); - } + ret.push(report); } ret } diff --git a/core/src/location/mod.rs b/core/src/location/mod.rs index 2ce20c91a..dc361070a 100644 --- a/core/src/location/mod.rs +++ b/core/src/location/mod.rs @@ -428,25 +428,26 @@ pub async fn light_scan_location( } let location_base_data = location::Data::from(&location); - + // removed grouping for background jobs, they don't need to be grouped as only running ones are shown to the user library - .spawn_job( - Job::new_with_action( - ShallowIndexerJobInit { - location, - sub_path: sub_path.clone(), - }, - "light_scan_location", - ) - .queue_next(ShallowFileIdentifierJobInit { - location: location_base_data.clone(), - sub_path: sub_path.clone(), - }) - .queue_next(ShallowThumbnailerJobInit { - location: location_base_data, - sub_path, - }), - ) + .spawn_job(ShallowIndexerJobInit { + location, + sub_path: sub_path.clone(), + }) + .await + .unwrap_or(()); + library + .spawn_job(ShallowFileIdentifierJobInit { + location: location_base_data.clone(), + sub_path: sub_path.clone(), + }) + .await + .unwrap_or(()); + library + .spawn_job(ShallowThumbnailerJobInit { + location: location_base_data.clone(), + sub_path: sub_path.clone(), + }) .await } diff --git a/interface/app/$libraryId/Explorer/GridView.tsx b/interface/app/$libraryId/Explorer/GridView.tsx index caed43c04..1b5ca8242 100644 --- a/interface/app/$libraryId/Explorer/GridView.tsx +++ b/interface/app/$libraryId/Explorer/GridView.tsx @@ -37,7 +37,7 @@ const GridViewItem = memo(({ data, selected, index, ...props }: GridViewItemProp className={clsx( 'mb-1 flex items-center justify-center justify-items-center rounded-lg border-2 border-transparent text-center active:translate-y-[1px]', { - 'bg-app-selected/20': selected + 'bg-app-selectedItem': selected } )} > diff --git a/interface/app/$libraryId/Explorer/MediaView.tsx b/interface/app/$libraryId/Explorer/MediaView.tsx index ea64e2c8e..41db058a8 100644 --- a/interface/app/$libraryId/Explorer/MediaView.tsx +++ b/interface/app/$libraryId/Explorer/MediaView.tsx @@ -32,8 +32,8 @@ const MediaViewItem = memo(({ data, index }: MediaViewItemProps) => { >
{ measureElement: () => itemSize, paddingStart: gridPadding, paddingEnd: gridPadding, - overscan: !dismissibleNoticeStore.mediaView ? 2 : 1 + overscan: !dismissibleNoticeStore.mediaView ? 8 : 4 }); const columnVirtualizer = useVirtualizer({ diff --git a/interface/app/$libraryId/Explorer/QuickPreview.tsx b/interface/app/$libraryId/Explorer/QuickPreview.tsx index 754dc682c..40545e518 100644 --- a/interface/app/$libraryId/Explorer/QuickPreview.tsx +++ b/interface/app/$libraryId/Explorer/QuickPreview.tsx @@ -1,11 +1,12 @@ import * as Dialog from '@radix-ui/react-dialog'; import { animated, useTransition } from '@react-spring/web'; -import { XCircle } from 'phosphor-react'; +import { X, XCircle } from 'phosphor-react'; import { useEffect, useRef, useState } from 'react'; import { subscribeKey } from 'valtio/utils'; import { ExplorerItem } from '@sd/client'; import { getExplorerStore } from '~/hooks'; import FileThumb from './File/Thumb'; +import { Button } from '@sd/ui'; const AnimatedDialogOverlay = animated(Dialog.Overlay); const AnimatedDialogContent = animated(Dialog.Content); @@ -42,12 +43,12 @@ export function QuickPreview({ transformOrigin }: QuickPreviewProps) { const transitions = useTransition(isOpen, { from: { opacity: 0, - transform: `translateY(20px)`, - transformOrigin: transformOrigin || 'bottom' + transform: `translateY(20px) scale(0.9)`, + transformOrigin: transformOrigin || 'center top' }, - enter: { opacity: 1, transform: `translateY(0px)` }, - leave: { opacity: 0, transform: `translateY(20px)` }, - config: { mass: 0.4, tension: 200, friction: 10, bounce: 0 } + enter: { opacity: 1, transform: `translateY(0px) scale(1)` }, + leave: { opacity: 0, transform: `translateY(40px) scale(0.9)` }, + config: { mass: 0.2, tension: 300, friction: 20, bounce: 0 } }); return ( @@ -80,10 +81,13 @@ export function QuickPreview({ transformOrigin }: QuickPreviewProps) {