Expand description
Modern terminal UI built on ratatui + crossterm.
Design principles:
- Dashboard layout: header bar, main panel, status line
- Keyboard-first: arrow keys + Enter/Esc, no mouse dependency
Terminal UI rendering for NotAlterra.
Uses ratatui + crossterm to draw menu screens, picker lists, dialogs,
metadata inspectors, and the animated whale separator. All rendering
is stateless β callers pass in an AppState snapshot.
StructsΒ§
- AppState
- Global application state passed through every frame.
- Input
Dialog State - State for the text-input dialog used to enter a save-folder path.
EnumsΒ§
FunctionsΒ§
- centered_
rect π - Create a centered rectangle for modal overlays.
Return a rectangle centered in
rby the given width and height percentages. Return a rectangle centered inrby the given width and height percentages. - centered_
rect_ πsize - Return a rectangle centered in
rby the given width and height percentages. Shrink a rectangle to the given absolute width and height, centered. Return a rectangle centered inrby the given width and height percentages. - draw_
confirm_ popup - Draw a simple confirmation popup with [ Yes ] [ No ] buttons.
- draw_
disclaimer_ popup - Draw the disclaimer popup with full warning text.
- draw_
header π - Render the title bar with version information.
- draw_
info_ dialog - Render a non-interactive info dialog β no buttons, renders once, caller
is expected to return to the event loop (the dialog stays visible until
the next
terminal.draw()replaces it). - draw_
input_ dialog - Draw the text input dialog for entering a custom save-folder path.
- draw_
main_ menu - Draw the main menu.
- draw_
ok_ dialog - Render an informational dialog with a plain-text message and OK button. Auto-sizes to fit content. Title is displayed in cyan, message in gray, whale separator at the bottom. Press Enter or Space to dismiss.
- draw_
ok_ dialog_ styled - Render a dialog with styled content lines. Supports inline formatting
(colors, bold) via [
Line] slices. Use for metadata displays, help text, or any content that needs per-span styling. - draw_
picker - Draw a file/folder picker list.
pinned_headerrenders items[0] as a fixed header above the scrollable list. - draw_
picker_ split - Draw the file picker with a horizontal split: pip-style file list on the left, live metadata preview on the right. Used by the .bak recover flow.
- draw_
picker_ with_ info - Draw a file/folder picker list with an extra selected-item info line
(e.g. showing the full filename of the highlighted .bak file).
pinned_headerrenders items[0] as a fixed header above the scrollable list. - draw_
right_ πpane - Render the right-hand metadata pane in the split file picker.
Shows the filename header, a dim separator, then the provided content lines.
When
meta_linesis empty, shows a placeholder message. - draw_
select_ πlist - Render a scrollable picker list with description and prompt.
- draw_
select_ πlist_ pip - Render a compact pip-list without description line or prompt. The pip (βΊ) replaces the full-row background highlight.
- draw_
select_ πlist_ with_ info - Render a picker list with description and prompt.
- draw_
status_ πbar - Render the status bar at the bottom of the screen.
- draw_
status_ πdashboard - Render the status dashboard beneath the header.
- draw_
sub_ menu - Draw a sub-menu (e.g. Config management).
- draw_
text_ screen - Draw a full-screen text display with a βpress any keyβ prompt at the bottom. Used for status messages during long operations (scanning, backing up) and for displaying scan results.
- draw_
whale_ separator - Draw the bottom status bar with an animated whale patrolling right-to-left. The whale moves one position every 180ms. After reaching the left edge, it disappears for ~5.4s (30 cooldown ticks) before reappearing on the right. Two variants alternate every 400ms.
- inner π
- Shrink a rect by a margin on all sides.
- standard_
layout π - truncate_
path_ πtail - Truncate a filesystem path to show only the most specific directories. Walks forward to the first path separator after the truncation point to avoid splitting mid-component.