Module ui

Module ui 

Source
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 formatting module
  • 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