mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-02-20 15:43:58 -05: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>
38 lines
1.0 KiB
TypeScript
38 lines
1.0 KiB
TypeScript
import { useEffect } from 'react';
|
|
import { useNavigate } from 'react-router';
|
|
|
|
import { KeybindEvent } from '../util/keybind';
|
|
import { getWindowState } from './useWindowState';
|
|
|
|
export const useKeybindEventHandler = (libraryId?: string) => {
|
|
const navigate = useNavigate();
|
|
const windowState = getWindowState();
|
|
|
|
useEffect(() => {
|
|
const handler = (e: KeybindEvent) => {
|
|
e.preventDefault();
|
|
|
|
switch (e.detail.action) {
|
|
case 'open_settings':
|
|
libraryId && navigate(`/${libraryId}/settings/client/general`);
|
|
break;
|
|
case 'open_overview':
|
|
libraryId && navigate(`/${libraryId}/overview`);
|
|
break;
|
|
case 'open_search':
|
|
// somehow emit ctrl/cmd+f
|
|
break;
|
|
case 'window_fullscreened':
|
|
windowState.isFullScreen = true;
|
|
break;
|
|
case 'window_not_fullscreened':
|
|
windowState.isFullScreen = false;
|
|
break;
|
|
}
|
|
};
|
|
|
|
document.addEventListener('keybindexec', handler);
|
|
return () => document.removeEventListener('keybindexec', handler);
|
|
}, [navigate, libraryId, windowState]);
|
|
};
|