-
Notifications
You must be signed in to change notification settings - Fork 0
feat: harvest the v1 vault browser read path over the snapshot adapter #971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import { Fragment } from 'react'; | ||
| import type { BreadcrumbDescriptor } from '@cipherbox/client'; | ||
| import { toHex } from '@cipherbox/client'; | ||
|
|
||
| interface BreadcrumbsProps { | ||
| /** Root-first trail, ending at the folder on screen. */ | ||
| crumbs: BreadcrumbDescriptor[]; | ||
| onNavigate: (node: Uint8Array) => void; | ||
| } | ||
|
|
||
| /** The vault's current location as a terminal path: `~/root/documents`. */ | ||
| export function Breadcrumbs({ crumbs, onNavigate }: BreadcrumbsProps) { | ||
| return ( | ||
| <nav className="breadcrumb-nav" aria-label="Current location" data-testid="breadcrumbs"> | ||
| <span className="breadcrumb-prefix">~</span> | ||
| {crumbs.map((crumb, index) => { | ||
| const isCurrent = index === crumbs.length - 1; | ||
| return ( | ||
| <Fragment key={toHex(crumb.id)}> | ||
| <span className="breadcrumb-separator">/</span> | ||
| <button | ||
| type="button" | ||
| className={isCurrent ? 'breadcrumb-item breadcrumb-item--current' : 'breadcrumb-item'} | ||
| onClick={() => onNavigate(crumb.id)} | ||
| aria-current={isCurrent ? 'page' : undefined} | ||
| > | ||
| {/* The vault root carries no name of its own. */} | ||
| {crumb.name === '' ? 'root' : crumb.name} | ||
| </button> | ||
| </Fragment> | ||
| ); | ||
| })} | ||
| </nav> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| /** Terminal window running `ls -la` over nothing, in box-drawing characters. */ | ||
| const TERMINAL_ART = `┌──────────────────────┐ | ||
| │ $ ls -la │ | ||
| │ total 0 │ | ||
| │ $ █ │ | ||
| └──────────────────────┘`; | ||
|
|
||
| /** What a folder with no children shows. */ | ||
| export function EmptyState() { | ||
| return ( | ||
| <div className="empty-state" data-testid="empty-state"> | ||
| <div className="empty-state-content"> | ||
| <pre className="empty-state-ascii" aria-hidden="true"> | ||
| {TERMINAL_ART} | ||
| </pre> | ||
| <p className="empty-state-text">// EMPTY DIRECTORY</p> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| import { useFolderNavigation } from '../../vault/useFolderNavigation'; | ||
| import { Breadcrumbs } from './Breadcrumbs'; | ||
| import { EmptyState } from './EmptyState'; | ||
| import { FileList } from './FileList'; | ||
|
|
||
| /** The vault browser: where you are, what is in it, and how to move. */ | ||
| export function FileBrowser() { | ||
| const { rows, breadcrumbs, isLoading, isRoot, error, navigateTo, navigateUp } = | ||
| useFolderNavigation(); | ||
| const settled = !isLoading && error === null; | ||
|
|
||
| return ( | ||
| <div className="file-browser" data-testid="file-browser"> | ||
| <Breadcrumbs crumbs={breadcrumbs} onNavigate={navigateTo} /> | ||
| {error && ( | ||
| <p className="file-browser-error" role="alert" data-testid="file-browser-error"> | ||
| {error.message} | ||
| </p> | ||
| )} | ||
| {isLoading && ( | ||
| <p className="file-browser-loading" data-testid="file-browser-loading"> | ||
| {'// LOADING VAULT...'} | ||
| </p> | ||
| )} | ||
| {/* An empty non-root folder still lists, so `[..]` remains reachable. */} | ||
| {settled && (rows.length > 0 || !isRoot) && ( | ||
| <FileList | ||
| rows={rows} | ||
| showParentRow={!isRoot} | ||
| onOpen={navigateTo} | ||
| onNavigateUp={navigateUp} | ||
| /> | ||
| )} | ||
| {settled && rows.length === 0 && <EmptyState />} | ||
| </div> | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import type { ListingRow } from '../../vault/listing'; | ||
| import { FileListItem } from './FileListItem'; | ||
| import { ParentDirRow } from './ParentDirRow'; | ||
|
|
||
| interface FileListProps { | ||
| rows: ListingRow[]; | ||
| /** False at the vault root, which has no parent to step up to. */ | ||
| showParentRow: boolean; | ||
| onOpen: (node: Uint8Array) => void; | ||
| onNavigateUp: () => void; | ||
| } | ||
|
|
||
| /** The routed folder's direct children, in columns. */ | ||
| export function FileList({ rows, showParentRow, onOpen, onNavigateUp }: FileListProps) { | ||
| return ( | ||
| <div className="file-list" role="grid" data-testid="file-list"> | ||
| <div className="file-list-header" role="row"> | ||
| <div className="file-list-header-name" role="columnheader"> | ||
| [NAME] | ||
| </div> | ||
| <div className="file-list-header-size" role="columnheader"> | ||
| [SIZE] | ||
| </div> | ||
| <div className="file-list-header-date" role="columnheader"> | ||
| [MODIFIED] | ||
| </div> | ||
| </div> | ||
| <div className="file-list-body" role="rowgroup"> | ||
| {showParentRow && <ParentDirRow onActivate={onNavigateUp} />} | ||
| {rows.map((row) => ( | ||
| <FileListItem key={row.key} row={row} onOpen={onOpen} /> | ||
| ))} | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| import type { ListingRow } from '../../vault/listing'; | ||
|
|
||
| interface FileListItemProps { | ||
| row: ListingRow; | ||
| /** Opens a folder. Files have no read action until #808 lands. */ | ||
| onOpen: (node: Uint8Array) => void; | ||
| } | ||
|
|
||
| /** One direct child: kind marker, name, size, mtime, and its queue status. */ | ||
| export function FileListItem({ row, onOpen }: FileListItemProps) { | ||
| const isFolder = row.kind === 'folder'; | ||
| const open = () => { | ||
| if (isFolder) onOpen(row.id); | ||
| }; | ||
|
|
||
| return ( | ||
| <div | ||
| className="file-list-item" | ||
| data-node-id={row.key} | ||
| data-testid="file-list-item" | ||
| role="row" | ||
| tabIndex={0} | ||
| onDoubleClick={open} | ||
| onKeyDown={(event) => { | ||
| if (event.key !== 'Enter' && event.key !== ' ') return; | ||
| event.preventDefault(); | ||
| open(); | ||
| }} | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| > | ||
| <div className="file-list-item-row-top" role="gridcell"> | ||
| <span className="file-list-item-icon" aria-hidden="true"> | ||
| {row.icon} | ||
| </span> | ||
| <span className="file-list-item-name">{row.name}</span> | ||
| <ItemStatus row={row} /> | ||
| </div> | ||
| <div className="file-list-item-row-bottom"> | ||
| <span className="file-list-item-size" role="gridcell"> | ||
| {row.size} | ||
| </span> | ||
| <span className="file-list-item-date" role="gridcell"> | ||
| {row.modified} | ||
| </span> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| /** The engine's per-node queue flags, rendered as the engine reports them. */ | ||
| function ItemStatus({ row }: { row: ListingRow }) { | ||
| if (row.deadLetter) { | ||
| return ( | ||
| <span className="file-list-item-status file-list-item-status--dead" title="will not publish"> | ||
| [!] | ||
| </span> | ||
| ); | ||
| } | ||
| if (row.pending === 'none') return null; | ||
| return ( | ||
| <span className="file-list-item-status" title={`${row.pending} change not published yet`}> | ||
| [~] | ||
| </span> | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| interface ParentDirRowProps { | ||
| onActivate: () => void; | ||
| } | ||
|
|
||
| /** The `[..]` row that opens the parent folder, first in every non-root list. */ | ||
| export function ParentDirRow({ onActivate }: ParentDirRowProps) { | ||
| return ( | ||
| <div | ||
| className="file-list-item file-list-item--parent" | ||
| role="row" | ||
| tabIndex={0} | ||
| onDoubleClick={onActivate} | ||
| onKeyDown={(event) => { | ||
| if (event.key !== 'Enter' && event.key !== ' ') return; | ||
| event.preventDefault(); | ||
| onActivate(); | ||
| }} | ||
| data-testid="parent-dir-row" | ||
| > | ||
| <div className="file-list-item-row-top" role="gridcell"> | ||
| <span className="file-list-item-icon" aria-hidden="true"> | ||
| [..] | ||
| </span> | ||
| <span className="file-list-item-name">PARENT_DIR</span> | ||
| </div> | ||
| <div className="file-list-item-row-bottom"> | ||
| <span className="file-list-item-size" role="gridcell"> | ||
| - | ||
| </span> | ||
| <span className="file-list-item-date" role="gridcell"> | ||
| - | ||
| </span> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import { StatusIndicator } from './StatusIndicator'; | ||
|
|
||
| /** Chrome: attribution, outbound links, and the staleness rung. */ | ||
| export function AppFooter() { | ||
| return ( | ||
| <footer className="app-footer" data-testid="app-footer"> | ||
| <div className="footer-left"> | ||
| <span className="footer-copyright">(c) 2026 CipherBox</span> | ||
| </div> | ||
| <div className="footer-center"> | ||
| <a | ||
| href="https://github.com/fsm1/cipher-box" | ||
| className="footer-link" | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| > | ||
| [github] | ||
| </a> | ||
| </div> | ||
| <div className="footer-right"> | ||
| <StatusIndicator /> | ||
| </div> | ||
| </footer> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import { UserMenu } from './UserMenu'; | ||
|
|
||
| /** Wordmark and account menu. */ | ||
| export function AppHeader() { | ||
| return ( | ||
| <header className="app-header" data-testid="app-header"> | ||
| <div className="header-left"> | ||
| <span className="header-prompt">></span> | ||
| <span className="header-logo">CIPHERBOX</span> | ||
| </div> | ||
| <div className="header-right"> | ||
| <UserMenu /> | ||
| </div> | ||
| </header> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import type { ReactNode } from 'react'; | ||
| import { StagingBanner } from '../StagingBanner'; | ||
| import { AppFooter } from './AppFooter'; | ||
| import { AppHeader } from './AppHeader'; | ||
| import { AppSidebar } from './AppSidebar'; | ||
|
|
||
| interface AppShellProps { | ||
| children: ReactNode; | ||
| } | ||
|
|
||
| /** The signed-in frame: header, sidebar, scrollable main, footer. */ | ||
| export function AppShell({ children }: AppShellProps) { | ||
| return ( | ||
| <div className="app-frame"> | ||
| <StagingBanner /> | ||
| <div className="app-shell" data-testid="app-shell"> | ||
| <AppHeader /> | ||
| <AppSidebar /> | ||
| <main className="app-main">{children}</main> | ||
| <AppFooter /> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import { useLocation } from 'react-router-dom'; | ||
| import { NavItem } from './NavItem'; | ||
|
|
||
| /** Vault navigation. Only `/files` is served in this build; the rest is #643. */ | ||
| export function AppSidebar() { | ||
| const { pathname } = useLocation(); | ||
|
|
||
| return ( | ||
| <aside className="app-sidebar" data-testid="app-sidebar"> | ||
| <nav className="sidebar-nav"> | ||
| <NavItem to="/files" icon="folder" label="Files" active={pathname.startsWith('/files')} /> | ||
| <NavItem to="/shared" icon="shared" label="Shared" active={false} comingSoon /> | ||
| <NavItem to="/bin" icon="bin" label="Bin" active={false} comingSoon /> | ||
| <NavItem to="/settings" icon="settings" label="Settings" active={false} comingSoon /> | ||
| </nav> | ||
| </aside> | ||
| ); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.