router

package
v0.0.0-...-01ca449 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Module("router",
	fx.Provide(
		NewRouter,
	),
)

Module provides routing services

Functions

This section is empty.

Types

type BackMsg

type BackMsg struct{}
type NavigateMsg struct {
	Route Route
}

Navigation message types that views can send to trigger routing

type Route

type Route string

Route represents a navigation destination

const (
	RouteInit             Route = "init"
	RouteLive             Route = "live"
	RouteMonitor          Route = "monitor"
	RouteBacktest         Route = "backtest"
	RouteAnalyze          Route = "analyze"
	RouteMenu             Route = "menu"
	RouteStrategyList     Route = "strategy-list"
	RouteStrategyDetail   Route = "strategy-detail"
	RouteStrategyCompile  Route = "strategy-compile"
	RouteStrategyBacktest Route = "strategy-backtest"
	RouteStrategyEdit     Route = "strategy-edit"
	RouteStrategyDelete   Route = "strategy-delete"
	RouteSettingsList     Route = "settings-list"
	RouteSettingsEdit     Route = "settings-edit"
	RouteSettingsCreate   Route = "settings-create"
	RouteSettingsDelete   Route = "settings-delete"
)

type Router

type Router interface {
	tea.Model

	// RegisterRoute associates a path with a view factory
	RegisterRoute(route Route, factory ViewFactory)

	// NavigateTo pushes a new view onto the stack by route name
	NavigateTo(route Route) tea.Cmd

	// Back pops the current view off the stack
	Back() tea.Cmd

	// SetInitialView sets the starting view
	SetInitialView(view tea.Model)
}

Router manages navigation between views using path-based routing

func NewRouter

func NewRouter() (Router, error)

NewRouter creates a router with route registration

type ViewFactory

type ViewFactory func() tea.Model

ViewFactory creates a view for a given route

Jump to

Keyboard shortcuts

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