mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-04-22 07:28:43 -04:00
* fix(UI): remove the swift code that was causing the top bar to show when the window is maximized * fix(UI): limit the keybind handler to the `$libraryId` layout The keybind handler is how we get MacOS menu bar events to the front-end, and to navigate to the settings page correctly we need the current library UUID. We should hide/disable the settings button (and any future buttons that require a library/certain state - e.g. during onboarding) from the menu bar. * chore(swift): remove unused function * fix(UI): git didn't detect hook rename * fix(deps): revert tauri version downgrade Was probably caused by a bad merge * fix(UI): remove rounding of window borders on macos This was allowing the borders to still show on MacOS, despite the app being fully maximized. This doesn't impact non-maximized styling of the app, as we have native window decorations enabled within the Tauri config (well, that's my best guess as to why this fixes the issue). * fix(UI): conditionally enable/disable menu items on macos This is dependent on whether a library is present or not. If there's no library, we disable things such as copy/paste/select all. * fix(UI): try and conditionally show the border radius I think some cached files aren't being rebuilt correctly as this *should* work fine, it uses the same conditions as the traffic lights do to determine if we're fullscreen or not. * remove copy/select all/paste as they have uses outside of the explorer * feat(UI): overhaul native macos menu * fix: add toast for quick rescan and free up the ctrl+r keybind * more menu rearrangements * update menu further * add comment about rounded edges * some polish * add working overview redirect * fix(UI): correct border edges when non-maximized, and full corners when maximized * cleanup event handling * add media view and disable non-working buttons * fix(UI): raise sidebar on fullscreen to prevent empty corner * adjust settings padding when maximized on macos * failed sidebar animation * rm old stuff * fix(UI): better transitions (i'm learning!) * add comment about why new library is disabled during onboarding * make the settings page static and `pt-6` * add mock-up library selector in menu * `maximized` -> `fullScreen` * fix animation when fullscreening * clippy * change animation to 300ms --------- Co-authored-by: ameer2468 <33054370+ameer2468@users.noreply.github.com>
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import { useEffect, useRef } from 'react';
|
|
import { useRspcLibraryContext } from '@sd/client';
|
|
import { toast } from '@sd/ui';
|
|
|
|
import { useExplorerContext } from '../app/$libraryId/Explorer/Context';
|
|
import { useExplorerSearchParams } from '../app/$libraryId/Explorer/util';
|
|
|
|
export const useQuickRescan = () => {
|
|
// subscription so that we can cancel it if in progress
|
|
const quickRescanSubscription = useRef<() => void | undefined>();
|
|
|
|
// gotta clean up any rescan subscriptions if the exist
|
|
useEffect(() => () => quickRescanSubscription.current?.(), []);
|
|
const { client } = useRspcLibraryContext();
|
|
const { parent } = useExplorerContext();
|
|
const [{ path }] = useExplorerSearchParams();
|
|
|
|
const rescan = () => {
|
|
if (parent?.type === 'Location') {
|
|
quickRescanSubscription.current?.();
|
|
quickRescanSubscription.current = client.addSubscription(
|
|
[
|
|
'locations.quickRescan',
|
|
{
|
|
location_id: parent.location.id,
|
|
sub_path: path ?? ''
|
|
}
|
|
],
|
|
{ onData() {} }
|
|
);
|
|
|
|
toast.success({
|
|
title: `Quick rescan started`
|
|
});
|
|
}
|
|
};
|
|
|
|
return rescan;
|
|
};
|