ui

package
v0.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package ui provides the terminal user interface using Bubble Tea.

Index

Constants

View Source
const EphemCacheTTL = 60 * time.Second

EphemCacheTTL is how long to use cached ephemeris data before refetching.

View Source
const PropagationAnimPeriod = 31

PropagationAnimPeriod is the number of animation ticks for one full pulse traversal. At 80ms per tick, 31 ticks ≈ 2.5 seconds.

View Source
const SparklineWidth = 48

SparklineWidth is the fixed width of the elevation sparkline.

View Source
const SpotlightHighlightTicks = 25

SpotlightHighlightTicks is how many animation ticks (80ms each) a phase-change highlight lasts. 25 ticks ≈ 2 seconds.

Variables

View Source
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

func SendDataUpdate(snapshot state.Snapshot) tea.Cmd

SendDataUpdate creates a command that sends a data update message.

func SendError

func SendError(err error) tea.Cmd

SendError creates a command that sends an error message.

Types

type AnimTickMsg added in v0.4.0

type AnimTickMsg time.Time

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.

func (DashboardModel) View

func (m DashboardModel) View() string

View renders the dashboard.

type DashboardOpenMissionMsg added in v0.4.0

type DashboardOpenMissionMsg struct {
	SpacecraftID int
}

DashboardOpenMissionMsg requests opening Mission view for a spacecraft.

type DataUpdateMsg

type DataUpdateMsg struct {
	Snapshot state.Snapshot
}

DataUpdateMsg signals new DSN data is available.

type ErrorMsg

type ErrorMsg struct {
	Error error
}

ErrorMsg signals a fetch error.

type LabelMode

type LabelMode int

LabelMode controls how spacecraft labels are displayed.

const (
	LabelNone    LabelMode = iota // No labels
	LabelFocused                  // Only focused spacecraft
	LabelAll                      // All spacecraft
)

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

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 New

func New(stateMgr *state.Manager, ephemProvider ephem.Provider) Model

New creates a new root UI model.

func (Model) GetSelectedSpacecraft

func (m Model) GetSelectedSpacecraft() int

GetSelectedSpacecraft returns the currently selected spacecraft ID (for mission detail).

func (Model) Init

func (m Model) Init() tea.Cmd

Init implements tea.Model.

func (*Model) SetSelectedSpacecraft

func (m *Model) SetSelectedSpacecraft(id int)

SetSelectedSpacecraft sets the selected spacecraft for mission detail view.

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update implements tea.Model.

func (Model) View

func (m Model) View() string

View implements tea.Model.

type PathMode

type PathMode int

PathMode controls whether trajectory path is displayed.

const (
	PathOff PathMode = iota // No path display
	PathOn                  // Show trajectory arc
)

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) Init

func (m SkyViewModel) Init() tea.Cmd

Init returns nil cmd

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.

func (SkyViewModel) View

func (m SkyViewModel) View() string

View renders the sky view.

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 TickMsg

type TickMsg time.Time

TickMsg triggers periodic UI updates.

type ViewMode

type ViewMode int

ViewMode represents the current UI view.

const (
	ViewDashboard ViewMode = iota
	ViewMissionDetail
	ViewSky
	ViewSolarSystem
)

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
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL