Documentation
¶
Overview ¶
Package ui provides the terminal user interface using Bubble Tea.
Index ¶
- Constants
- Variables
- func DoRestart() error
- func RenderCurrentElevation(info *dsn.VisibilityInfo) string
- func RenderSunSeparation(visibility map[dsn.Complex]*dsn.VisibilityInfo) string
- func RenderVisibilityBar(visibility map[dsn.Complex]*dsn.VisibilityInfo) string
- func RenderVisibilityPanel(visibility map[dsn.Complex]*dsn.VisibilityInfo) string
- func SendDataUpdate(snapshot state.Snapshot) tea.Cmd
- func SendError(err error) tea.Cmd
- type AnimTickMsg
- type DashboardModel
- func (m DashboardModel) GetSelectedSpacecraft() *dsn.SpacecraftView
- func (m DashboardModel) Init() tea.Cmd
- func (m DashboardModel) SetError(err error) DashboardModel
- func (m DashboardModel) SetSize(width, height int) DashboardModel
- func (m DashboardModel) Update(msg tea.Msg) (DashboardModel, tea.Cmd)
- func (m DashboardModel) UpdateData(snapshot state.Snapshot) DashboardModel
- func (m DashboardModel) View() string
- type DashboardOpenMissionMsg
- type DataUpdateMsg
- type ErrorMsg
- type LabelMode
- type MissionDetailModel
- func (m MissionDetailModel) GetEphemEstimate(spacecraftID int) (ephem.EphemerisPoint, dsn.Complex, bool)
- func (m MissionDetailModel) NeedsEphemRefresh(spacecraftID int, complex dsn.Complex) bool
- func (m MissionDetailModel) SelectedSpacecraftID() int
- func (m MissionDetailModel) SetAnimTick(tick int) MissionDetailModel
- func (m MissionDetailModel) SetEphemLoading(loading bool) MissionDetailModel
- func (m *MissionDetailModel) SetSelectedSpacecraft(id int)
- func (m MissionDetailModel) SetSize(width, height int) MissionDetailModel
- func (m MissionDetailModel) ShowPassPanel() bool
- func (m MissionDetailModel) Update(msg tea.Msg) (MissionDetailModel, tea.Cmd)
- func (m MissionDetailModel) UpdateData(snapshot state.Snapshot) MissionDetailModel
- func (m MissionDetailModel) UpdateEphemEstimate(spacecraftID int, complex dsn.Complex, point ephem.EphemerisPoint, ...) MissionDetailModel
- func (m MissionDetailModel) UpdatePassPlan(plan *dsn.PassPlan) MissionDetailModel
- func (m MissionDetailModel) View() string
- type Model
- type PathMode
- type SkyViewModel
- func (m SkyViewModel) Init() tea.Cmd
- func (m SkyViewModel) SetPathProvider(provider ephem.Provider) SkyViewModel
- func (m SkyViewModel) SetSize(width, height int) SkyViewModel
- func (m SkyViewModel) SyncFromDashboard(dash DashboardModel, snapshot state.Snapshot) SkyViewModel
- func (m SkyViewModel) Update(msg tea.Msg) (SkyViewModel, tea.Cmd)
- func (m SkyViewModel) UpdateData(snapshot state.Snapshot) SkyViewModel
- func (m SkyViewModel) View() string
- type SolarSystemModel
- func (m SolarSystemModel) FocusedBody() *dsn.EclipticBody
- func (m *SolarSystemModel) SetFocusByCode(code string)
- func (m SolarSystemModel) SetSize(width, height int) SolarSystemModel
- func (m SolarSystemModel) ShowStars() bool
- func (m SolarSystemModel) Update(msg tea.Msg) (SolarSystemModel, tea.Cmd)
- func (m SolarSystemModel) UpdateData(snapshot state.Snapshot, solarSnap dsn.SolarSystemSnapshot) SolarSystemModel
- func (m SolarSystemModel) View() string
- type SpacecraftChangedMsg
- type TickMsg
- type ViewMode
- type VisibilityMode
Constants ¶
const EphemCacheTTL = 60 * time.Second
EphemCacheTTL is how long to use cached ephemeris data before refetching.
const PropagationAnimPeriod = 31
PropagationAnimPeriod is the number of animation ticks for one full pulse traversal. At 80ms per tick, 31 ticks ≈ 2.5 seconds.
const SparklineWidth = 48
SparklineWidth is the fixed width of the elevation sparkline.
const SpotlightHighlightTicks = 25
SpotlightHighlightTicks is how many animation ticks (80ms each) a phase-change highlight lasts. 25 ticks ≈ 2 seconds.
Variables ¶
var RestartPending bool
RestartPending indicates the app should restart after quitting.
Functions ¶
func DoRestart ¶ added in v0.7.0
func DoRestart() error
DoRestart replaces the current process with a fresh instance. On Unix, this uses syscall.Exec for seamless restart. Call this from main() after Bubble Tea has exited.
func RenderCurrentElevation ¶ added in v0.4.0
func RenderCurrentElevation(info *dsn.VisibilityInfo) string
RenderCurrentElevation renders the current elevation status for one complex.
func RenderSunSeparation ¶ added in v0.4.0
func RenderSunSeparation(visibility map[dsn.Complex]*dsn.VisibilityInfo) string
RenderSunSeparation renders the sun separation angle with appropriate styling.
func RenderVisibilityBar ¶ added in v0.4.0
func RenderVisibilityBar(visibility map[dsn.Complex]*dsn.VisibilityInfo) string
RenderVisibilityBar renders a compact horizontal bar showing visibility at all sites. Format: GDS ████ CDS ░░░░ MDS ██░░
func RenderVisibilityPanel ¶ added in v0.4.0
func RenderVisibilityPanel(visibility map[dsn.Complex]*dsn.VisibilityInfo) string
RenderVisibilityPanel renders the visibility information for all DSN complexes. Format:
GDS Rise 22:14 Peak 23:02 @ 58° Set 23:49 CDS Below horizon MDS Rise 02:15 Peak 03:01 @ 12° Set 03:48
func SendDataUpdate ¶
SendDataUpdate creates a command that sends a data update message.
Types ¶
type AnimTickMsg ¶ added in v0.4.0
AnimTickMsg triggers fast animation updates.
type DashboardModel ¶
type DashboardModel struct {
// contains filtered or unexported fields
}
DashboardModel is the control room dashboard view.
func NewDashboardModel ¶
func NewDashboardModel() DashboardModel
NewDashboardModel creates a new dashboard model.
func (DashboardModel) GetSelectedSpacecraft ¶
func (m DashboardModel) GetSelectedSpacecraft() *dsn.SpacecraftView
GetSelectedSpacecraft returns the currently selected spacecraft, if any.
func (DashboardModel) Init ¶
func (m DashboardModel) Init() tea.Cmd
Init implements the Bubble Tea model interface.
func (DashboardModel) SetError ¶
func (m DashboardModel) SetError(err error) DashboardModel
SetError sets the last error for display.
func (DashboardModel) SetSize ¶
func (m DashboardModel) SetSize(width, height int) DashboardModel
SetSize updates the viewport size.
func (DashboardModel) Update ¶
func (m DashboardModel) Update(msg tea.Msg) (DashboardModel, tea.Cmd)
Update handles messages.
func (DashboardModel) UpdateData ¶
func (m DashboardModel) UpdateData(snapshot state.Snapshot) DashboardModel
UpdateData updates the model with new data.
type DashboardOpenMissionMsg ¶ added in v0.4.0
type DashboardOpenMissionMsg struct {
SpacecraftID int
}
DashboardOpenMissionMsg requests opening Mission view for a spacecraft.
type DataUpdateMsg ¶
DataUpdateMsg signals new DSN data is available.
type MissionDetailModel ¶
type MissionDetailModel struct {
// contains filtered or unexported fields
}
MissionDetailModel shows detailed info for a selected spacecraft.
func NewMissionDetailModel ¶
func NewMissionDetailModel() MissionDetailModel
NewMissionDetailModel creates a new mission detail model.
func (MissionDetailModel) GetEphemEstimate ¶ added in v0.8.0
func (m MissionDetailModel) GetEphemEstimate(spacecraftID int) (ephem.EphemerisPoint, dsn.Complex, bool)
GetEphemEstimate returns the cached ephemeris estimate if valid for the given spacecraft.
func (MissionDetailModel) NeedsEphemRefresh ¶ added in v0.8.0
func (m MissionDetailModel) NeedsEphemRefresh(spacecraftID int, complex dsn.Complex) bool
NeedsEphemRefresh returns true if we should fetch new ephemeris data. Conditions: different spacecraft/complex, or cache expired, and not currently loading.
func (MissionDetailModel) SelectedSpacecraftID ¶
func (m MissionDetailModel) SelectedSpacecraftID() int
SelectedSpacecraftID returns the currently selected spacecraft ID.
func (MissionDetailModel) SetAnimTick ¶ added in v0.4.0
func (m MissionDetailModel) SetAnimTick(tick int) MissionDetailModel
SetAnimTick updates the animation tick for shimmer effects and spotlight tracking.
func (MissionDetailModel) SetEphemLoading ¶ added in v0.8.0
func (m MissionDetailModel) SetEphemLoading(loading bool) MissionDetailModel
SetEphemLoading sets the loading state for ephemeris fetch.
func (*MissionDetailModel) SetSelectedSpacecraft ¶
func (m *MissionDetailModel) SetSelectedSpacecraft(id int)
SetSelectedSpacecraft sets the selected spacecraft by ID.
func (MissionDetailModel) SetSize ¶
func (m MissionDetailModel) SetSize(width, height int) MissionDetailModel
SetSize updates the viewport size.
func (MissionDetailModel) ShowPassPanel ¶ added in v0.4.0
func (m MissionDetailModel) ShowPassPanel() bool
ShowPassPanel returns whether the pass panel is visible.
func (MissionDetailModel) Update ¶
func (m MissionDetailModel) Update(msg tea.Msg) (MissionDetailModel, tea.Cmd)
Update handles messages.
func (MissionDetailModel) UpdateData ¶
func (m MissionDetailModel) UpdateData(snapshot state.Snapshot) MissionDetailModel
UpdateData updates with new data snapshot.
func (MissionDetailModel) UpdateEphemEstimate ¶ added in v0.8.0
func (m MissionDetailModel) UpdateEphemEstimate(spacecraftID int, complex dsn.Complex, point ephem.EphemerisPoint, fetchedAt time.Time, err error) MissionDetailModel
UpdateEphemEstimate updates the cached ephemeris estimate.
func (MissionDetailModel) UpdatePassPlan ¶ added in v0.4.0
func (m MissionDetailModel) UpdatePassPlan(plan *dsn.PassPlan) MissionDetailModel
UpdatePassPlan updates the pass plan data.
func (MissionDetailModel) View ¶
func (m MissionDetailModel) View() string
View renders the mission detail view.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the root Bubble Tea model.
func (Model) GetSelectedSpacecraft ¶
GetSelectedSpacecraft returns the currently selected spacecraft ID (for mission detail).
func (*Model) SetSelectedSpacecraft ¶
SetSelectedSpacecraft sets the selected spacecraft for mission detail view.
type SkyViewModel ¶
type SkyViewModel struct {
// contains filtered or unexported fields
}
SkyViewModel renders the sky dome with spacecraft positions.
func NewSkyViewModel ¶
func NewSkyViewModel() SkyViewModel
NewSkyViewModel creates a new sky view model.
func (SkyViewModel) SetPathProvider ¶
func (m SkyViewModel) SetPathProvider(provider ephem.Provider) SkyViewModel
SetPathProvider sets the ephemeris provider for trajectory paths.
func (SkyViewModel) SetSize ¶
func (m SkyViewModel) SetSize(width, height int) SkyViewModel
SetSize updates the viewport size.
func (SkyViewModel) SyncFromDashboard ¶
func (m SkyViewModel) SyncFromDashboard(dash DashboardModel, snapshot state.Snapshot) SkyViewModel
SyncFromDashboard initializes sky view focus from dashboard selection.
func (SkyViewModel) Update ¶
func (m SkyViewModel) Update(msg tea.Msg) (SkyViewModel, tea.Cmd)
Update handles messages.
func (SkyViewModel) UpdateData ¶
func (m SkyViewModel) UpdateData(snapshot state.Snapshot) SkyViewModel
UpdateData updates with new data snapshot.
type SolarSystemModel ¶ added in v0.4.0
type SolarSystemModel struct {
// contains filtered or unexported fields
}
SolarSystemModel renders a top-down view of the solar system.
func NewSolarSystemModel ¶ added in v0.4.0
func NewSolarSystemModel() SolarSystemModel
NewSolarSystemModel creates a new solar system view model.
func (SolarSystemModel) FocusedBody ¶ added in v0.4.0
func (m SolarSystemModel) FocusedBody() *dsn.EclipticBody
FocusedBody returns the currently focused body, or nil for Sun.
func (*SolarSystemModel) SetFocusByCode ¶ added in v0.4.0
func (m *SolarSystemModel) SetFocusByCode(code string)
SetFocusByCode sets focus to a body by its code.
func (SolarSystemModel) SetSize ¶ added in v0.4.0
func (m SolarSystemModel) SetSize(width, height int) SolarSystemModel
SetSize updates the viewport size.
func (SolarSystemModel) ShowStars ¶ added in v0.4.0
func (m SolarSystemModel) ShowStars() bool
ShowStars returns whether the starfield is visible.
func (SolarSystemModel) Update ¶ added in v0.4.0
func (m SolarSystemModel) Update(msg tea.Msg) (SolarSystemModel, tea.Cmd)
Update handles input messages.
func (SolarSystemModel) UpdateData ¶ added in v0.4.0
func (m SolarSystemModel) UpdateData(snapshot state.Snapshot, solarSnap dsn.SolarSystemSnapshot) SolarSystemModel
UpdateData updates the model with new data.
func (SolarSystemModel) View ¶ added in v0.4.0
func (m SolarSystemModel) View() string
View renders the solar system view.
type SpacecraftChangedMsg ¶ added in v0.4.0
type SpacecraftChangedMsg struct {
SpacecraftID int
}
SpacecraftChangedMsg signals the selected spacecraft changed.
type VisibilityMode ¶ added in v0.4.0
type VisibilityMode int
VisibilityMode controls whether visibility data is displayed.
const ( VisibilityOff VisibilityMode = iota // No visibility display VisibilityOn // Show visibility data )