|
17 | 17 | getInfo, |
18 | 18 | toggleHiddenFiles, |
19 | 19 | setViewMode, |
| 20 | + getWindowTitle, |
20 | 21 | } from '$lib/tauri-commands' |
21 | 22 | import { loadSettings, saveSettings } from '$lib/settings-store' |
22 | 23 | import { hideExpirationModal, loadLicenseStatus, triggerValidationIfNeeded } from '$lib/licensing-store.svelte' |
|
48 | 49 | let showAboutWindow = $state(false) |
49 | 50 | let showCommandPalette = $state(false) |
50 | 51 | let explorerRef: ExplorerAPI | undefined = $state() |
| 52 | + let windowTitle = $state('Cmdr') |
51 | 53 |
|
52 | 54 | // Event handlers stored for cleanup |
53 | 55 | let handleKeyDown: ((e: KeyboardEvent) => void) | undefined |
|
56 | 58 | let unlistenCommandPalette: UnlistenFn | undefined |
57 | 59 | let unlistenSwitchPane: UnlistenFn | undefined |
58 | 60 |
|
| 61 | + /** Start window drag when title bar is clicked */ |
| 62 | + async function handleTitleBarMouseDown(e: MouseEvent) { |
| 63 | + if (e.buttons === 1) { |
| 64 | + // Left mouse button |
| 65 | + try { |
| 66 | + const { getCurrentWindow } = await import('@tauri-apps/api/window') |
| 67 | + await getCurrentWindow().startDragging() |
| 68 | + } catch { |
| 69 | + // Not in Tauri environment |
| 70 | + } |
| 71 | + } |
| 72 | + } |
| 73 | +
|
59 | 74 | onMount(async () => { |
60 | 75 | // Hide loading screen |
61 | 76 | const loadingScreen = document.getElementById('loading-screen') |
|
79 | 94 | expiredOrgName = licenseStatus.organizationName |
80 | 95 | expiredAt = licenseStatus.expiredAt |
81 | 96 | } |
| 97 | +
|
| 98 | + // Load window title based on license status |
| 99 | + windowTitle = await getWindowTitle() |
82 | 100 | } catch { |
83 | 101 | // License check failed (expected in E2E tests without Tauri backend) |
84 | 102 | // App continues without license features |
|
476 | 494 | } |
477 | 495 | </script> |
478 | 496 |
|
479 | | -{#if showAboutWindow} |
480 | | - <AboutWindow onClose={handleAboutClose} /> |
481 | | -{/if} |
| 497 | +<div class="page-container"> |
| 498 | + <!-- svelte-ignore a11y_no_static_element_interactions --> |
| 499 | + <div class="title-bar" onmousedown={handleTitleBarMouseDown}> |
| 500 | + <span class="title-text">{windowTitle}</span> |
| 501 | + </div> |
| 502 | + |
| 503 | + <div class="main-content"> |
| 504 | + {#if showAboutWindow} |
| 505 | + <AboutWindow onClose={handleAboutClose} /> |
| 506 | + {/if} |
| 507 | + |
| 508 | + {#if showCommandPalette} |
| 509 | + <CommandPalette onExecute={handleCommandExecute} onClose={handleCommandPaletteClose} /> |
| 510 | + {/if} |
| 511 | + |
| 512 | + {#if showExpiredModal} |
| 513 | + <ExpirationModal organizationName={expiredOrgName} {expiredAt} onClose={handleExpirationModalClose} /> |
| 514 | + {/if} |
| 515 | + |
| 516 | + {#if showFdaPrompt} |
| 517 | + <FullDiskAccessPrompt onComplete={handleFdaComplete} wasRevoked={fdaWasRevoked} /> |
| 518 | + {:else if showApp} |
| 519 | + <DualPaneExplorer bind:this={explorerRef} /> |
| 520 | + {/if} |
| 521 | + </div> |
| 522 | +</div> |
| 523 | + |
| 524 | +<style> |
| 525 | + .page-container { |
| 526 | + display: flex; |
| 527 | + flex-direction: column; |
| 528 | + flex: 1; |
| 529 | + min-height: 0; |
| 530 | + } |
482 | 531 |
|
483 | | -{#if showCommandPalette} |
484 | | - <CommandPalette onExecute={handleCommandExecute} onClose={handleCommandPaletteClose} /> |
485 | | -{/if} |
| 532 | + .title-bar { |
| 533 | + height: 27px; |
| 534 | + display: flex; |
| 535 | + align-items: center; |
| 536 | + justify-content: center; |
| 537 | + padding-top: 2px; |
| 538 | + background-color: var(--color-bg-secondary); |
| 539 | + flex-shrink: 0; |
| 540 | + } |
486 | 541 |
|
487 | | -{#if showExpiredModal} |
488 | | - <ExpirationModal organizationName={expiredOrgName} {expiredAt} onClose={handleExpirationModalClose} /> |
489 | | -{/if} |
| 542 | + .title-text { |
| 543 | + font-size: var(--font-size-xs); |
| 544 | + color: var(--color-text-secondary); |
| 545 | + font-weight: 500; |
| 546 | + } |
490 | 547 |
|
491 | | -{#if showFdaPrompt} |
492 | | - <FullDiskAccessPrompt onComplete={handleFdaComplete} wasRevoked={fdaWasRevoked} /> |
493 | | -{:else if showApp} |
494 | | - <DualPaneExplorer bind:this={explorerRef} /> |
495 | | -{/if} |
| 548 | + .main-content { |
| 549 | + flex: 1; |
| 550 | + display: flex; |
| 551 | + flex-direction: column; |
| 552 | + overflow: hidden; |
| 553 | + min-height: 0; |
| 554 | + } |
| 555 | +</style> |
0 commit comments