diff --git a/apps/desktop/src-tauri/capabilities/default.json b/apps/desktop/src-tauri/capabilities/default.json index f971178..adcaaf6 100644 --- a/apps/desktop/src-tauri/capabilities/default.json +++ b/apps/desktop/src-tauri/capabilities/default.json @@ -3,5 +3,14 @@ "identifier": "default", "description": "Main window", "windows": ["main"], - "permissions": ["core:default", "core:window:allow-start-dragging", "dialog:default"] + "permissions": [ + "core:default", + "core:window:allow-start-dragging", + "core:window:allow-minimize", + "core:window:allow-toggle-maximize", + "core:window:allow-close", + "core:window:allow-set-theme", + "core:window:allow-set-background-color", + "dialog:default" + ] } diff --git a/apps/desktop/src-tauri/tauri.conf.json b/apps/desktop/src-tauri/tauri.conf.json index 490e959..6e81dca 100644 --- a/apps/desktop/src-tauri/tauri.conf.json +++ b/apps/desktop/src-tauri/tauri.conf.json @@ -18,7 +18,7 @@ "height": 760, "minWidth": 900, "minHeight": 600, - "backgroundColor": "#000000", + "backgroundColor": "#08090c", "titleBarStyle": "Overlay", "hiddenTitle": true } diff --git a/apps/desktop/src-tauri/tauri.windows.conf.json b/apps/desktop/src-tauri/tauri.windows.conf.json new file mode 100644 index 0000000..7b5cab1 --- /dev/null +++ b/apps/desktop/src-tauri/tauri.windows.conf.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://schema.tauri.app/config/2", + "app": { + "windows": [ + { + "label": "main", + "title": "BeaconSync", + "width": 1180, + "height": 760, + "minWidth": 900, + "minHeight": 600, + "backgroundColor": "#08090c", + "decorations": false + } + ] + } +} diff --git a/apps/desktop/src/App.tsx b/apps/desktop/src/App.tsx index 11a15df..3d34b31 100644 --- a/apps/desktop/src/App.tsx +++ b/apps/desktop/src/App.tsx @@ -1,13 +1,32 @@ import { useQuery, useQueryClient } from '@tanstack/react-query' import { listen } from '@tauri-apps/api/event' -import { useEffect } from 'react' -import logo from './assets/logo.svg' +import { useEffect, useState, type ReactNode } from 'react' +import { CommandPalette } from './components/CommandPalette' import { Conflicts } from './components/Conflicts' +import { + AlertIcon, + CheckIcon, + CloseIcon, + DownloadIcon, + LibraryIcon, + LinkCodeIcon, + MonitorIcon, + MoonIcon, + PlayIcon, + PlusIcon, + SearchIcon, + SettingsIcon, + SunIcon, + UserIcon, +} from './components/Icons' +import { InstanceIcon } from './components/InstanceIcon' import { Button, Dialog, ProgressBar, Select } from './components/ui' import { UpdateButton, useUpdate } from './components/UpdateButton' +import { WindowControls } from './components/WindowControls' import { call } from './lib/api' import { askConfirm, keys, useAction, useApp, type View } from './lib/store' -import type { GameFailure, Progress, UpdateView } from './lib/types' +import { useTheme, type ThemeMode } from './lib/theme' +import type { GameFailure, LibraryItem, Progress, UpdateView } from './lib/types' import { ImportView } from './views/Import' import { JoinView } from './views/Join' import { LibraryView } from './views/Library' @@ -19,6 +38,7 @@ export function App() { const view = useApp((s) => s.view) const set = useApp((s) => s.set) const qc = useQueryClient() + const [paletteOpen, setPaletteOpen] = useState(false) useEffect(() => { const offs = [ @@ -36,15 +56,31 @@ export function App() { return () => offs.forEach((off) => void off.then((f) => f())) }, [set, qc]) + useEffect(() => { + const onKey = (e: KeyboardEvent) => { + if (e.repeat || e.altKey || e.shiftKey) return + const mod = isMac ? e.metaKey && !e.ctrlKey : e.ctrlKey && !e.metaKey + if (!mod || e.code !== 'KeyK') return + // Don't open over an existing modal dialog (e.g. Rename, Publish, Delete confirm). + if (!paletteOpen && document.querySelector('[role="dialog"]')) return + e.preventDefault() + setPaletteOpen((v) => !v) + } + window.addEventListener('keydown', onKey) + return () => window.removeEventListener('keydown', onKey) + }, [paletteOpen]) + return ( -
-
- -
+
+ setPaletteOpen(true)} /> +
+ +
+
- + setPaletteOpen(false)} /> @@ -67,75 +103,247 @@ function Page({ view }: { view: View }) { } } -function Sidebar() { +/** Unified top chrome doubling as the title bar: brand + version left, quick command bar center, + * accounts & theme right, then caption buttons on Windows. */ +function TopBar({ onOpenPalette }: { onOpenPalette: () => void }) { const view = useApp((s) => s.view) const go = useApp((s) => s.go) const library = useQuery({ queryKey: keys.library, queryFn: () => call('list_instances') }) const settings = useQuery({ queryKey: keys.settings, queryFn: () => call('get_settings') }) const version = useUpdate()?.current - const tracked = library.data?.filter((i) => i.tracked) ?? [] - const nav = (name: 'library' | 'join' | 'settings', label: string) => ( - - ) + const activePack = view.name === 'pack' ? library.data?.find((i) => i.path === view.path) : undefined + const locationLabel = + view.name === 'pack' + ? activePack?.name ?? 'Pack' + : view.name === 'library' + ? 'Library' + : view.name === 'import' + ? 'Import' + : view.name === 'join' + ? 'Join with code' + : 'Settings' return ( -