Expand description
Terminal user interface rendering.
This module handles all UI rendering using the Ratatui framework. It provides functions to draw the splash screen, main screen with tabs, and all UI components including message history with date separators.
§Layout
The main screen consists of:
- Tab bar at the top
- Tab content area
- Status bar at the bottom
§Available Tabs
- Chat: User list and message history with infinite scrolling
- Admin: Administrative functions
- Status: Connection and system status
- Help: Keyboard shortcuts and help
§Message Display
Messages are rendered with:
- Date separators (“Today”, “Yesterday”, or formatted dates)
- Timestamps in 12-hour format (HH:MM AM/PM)
- Emoji and markdown formatting via the
formattingmodule - Loading indicators for history pagination
- Scroll position indicators
Functions§
- draw
- Main drawing function - delegates to splash or main screen.
- format_
message_ 🔒date - Format timestamp as a date label for message grouping. Returns “Today”, “Yesterday”, or “Mon, Jan 15, 2025”
- format_
message_ 🔒time - Format timestamp as time for individual messages. Returns “10:23 AM” format
- format_
timestamp 🔒 - Format unix timestamp to human-readable string
- format_
uptime 🔒 - Format uptime from microseconds to human-readable string
- line_
display_ 🔒height - Estimate how many terminal rows a line will occupy once wrapped.
- render_
admin_ 🔒certificates - render_
admin_ 🔒form - render_
admin_ 🔒menu - render_
admin_ 🔒reactivate - render_
admin_ 🔒register - render_
admin_ 🔒revoke - render_
admin_ 🔒suspend - render_
admin_ 🔒tab - render_
chat_ 🔒area - render_
chat_ 🔒tab - render_
help_ 🔒tab - render_
messages 🔒 - render_
splash 🔒 - render_
status_ 🔒bar - render_
status_ 🔒tab - render_
tabs 🔒 - render_
user_ 🔒list - truncate_
string 🔒 - Truncate a string to a maximum length, adding “…” if needed