()
| 3 | import appIcon from '../assets/zennotes-app-icon.png' |
| 4 | |
| 5 | export function EmptyVault(): JSX.Element { |
| 6 | const openVaultPicker = useStore((s) => s.openVaultPicker) |
| 7 | const connectRemoteWorkspace = useStore((s) => s.connectRemoteWorkspace) |
| 8 | const workspaceSetupError = useStore((s) => s.workspaceSetupError) |
| 9 | const capabilities = window.zen.getCapabilities() |
| 10 | const appInfo = window.zen.getAppInfo() |
| 11 | const isServerVaultSetup = |
| 12 | appInfo.runtime === 'web' && !capabilities.supportsLocalFilesystemPickers |
| 13 | const canConnectRemote = appInfo.runtime === 'desktop' && capabilities.supportsRemoteWorkspace |
| 14 | |
| 15 | return ( |
| 16 | <div className="flex h-[calc(100vh-2.75rem)] items-center justify-center"> |
| 17 | <div className="flex max-w-md flex-col items-center gap-5 text-center"> |
| 18 | <img |
| 19 | src={appIcon} |
| 20 | alt="ZenNotes app icon" |
| 21 | className="h-[72px] w-[72px] rounded-2xl shadow-panel" |
| 22 | /> |
| 23 | <div> |
| 24 | <h1 className="font-serif text-2xl font-semibold text-ink-900">Welcome to ZenNotes</h1> |
| 25 | <p className="mt-2 text-sm text-ink-600"> |
| 26 | {isServerVaultSetup |
| 27 | ? 'Choose the vault directory on the server running ZenNotes. The normal self-hosted path is `make up`, which serves the browser app and server together.' |
| 28 | : 'Choose a folder on your computer to use as your vault. ZenNotes will store your notes there as plain markdown files — yours to keep, back up, and sync any way you like.'} |
| 29 | </p> |
| 30 | {isServerVaultSetup && ( |
| 31 | <p className="mt-2 text-xs text-ink-500"> |
| 32 | If you are using the web dev server, you also need{' '} |
| 33 | <code className="rounded bg-paper-200 px-1 py-0.5">npm run dev:server</code>. You can |
| 34 | also preconfigure the vault on the server with{' '} |
| 35 | <code className="rounded bg-paper-200 px-1 py-0.5">ZENNOTES_VAULT_PATH</code>. |
| 36 | </p> |
| 37 | )} |
| 38 | {canConnectRemote && ( |
| 39 | <p className="mt-2 text-xs text-ink-500"> |
| 40 | You can open a local vault on this machine or connect the desktop app to a ZenNotes |
| 41 | server. |
| 42 | </p> |
| 43 | )} |
| 44 | </div> |
| 45 | <div className="flex flex-wrap items-center justify-center gap-3"> |
| 46 | <Button |
| 47 | variant="primary" |
| 48 | size="md" |
| 49 | onClick={() => void openVaultPicker()} |
| 50 | className="shadow-panel" |
| 51 | > |
| 52 | {isServerVaultSetup ? 'Connect to server vault' : 'Choose vault folder'} |
| 53 | </Button> |
| 54 | {canConnectRemote && ( |
| 55 | <Button |
| 56 | variant="secondary" |
| 57 | size="md" |
| 58 | onClick={() => void connectRemoteWorkspace()} |
| 59 | className="shadow-panel" |
| 60 | > |
| 61 | Connect to ZenNotes Server |
| 62 | </Button> |
nothing calls this directly
no test coverage detected