Documentation
¶
Overview ¶
Package header renders the two-line page header: line one names the app, the active-symbol count, and a right-aligned key/base-URL (with a terminal-size warning chip beside it when the parent flags a cramped terminal); line two is the active symbol's ticker summary (last/bid/ask/24h range/volume) or a loading line. It is a pure view component — Model.View is a function of its explicit Key and Data, owns no shared state, and caches its render via uikit.Memo keyed on Key. The parent supplies the data and a Key whose ticker revision stands in for "did the ticker change", so an unrelated frame reuses the cached render.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AcctChipSpan ¶
AcctChipSpan reports the screen column span [start, start+width) of the acct chip on the header's first line, so a click on it can be hit-tested (the TUI opens the sub-account switcher on such a click). ok is false when there is no chip or it is clipped off the right edge. It mirrors render's alignment (the same left/right/gap math) so the drawn chip and the hit-test can't drift.
Types ¶
type Data ¶
Data is what the component renders on a cache miss. HasTicker mirrors the store's "ok" return and TickerReady gates the loading state; the ticker first arriving bumps TickerRev, so the Key still decides the hit.
type Key ¶
type Key struct {
TickerRev uint64
Symbol string
MarketCount int
KeyName string
BaseURL string
// AccountSeq is the active sub-account, shown as an "accountSeq:N" chip beside
// the key (0 = public/none, chip omitted). AccountCount is how many sub-accounts
// the session subscribed; when >1 the chip renders underlined as a clickable
// switch target, else dim.
AccountSeq int
AccountCount int
Cramped string
W int
Style uikit.StyleID
}
Key is the comparable cache key: equal Keys render identically. TickerRev is the store's ticker section revision (ticker change ⇒ rev change ⇒ re-render); Symbol is the active market; MarketCount is the number of subscribed symbols; KeyName and BaseURL feed the right-aligned identity; Cramped is the parent's terminal-size warning ("" = none), shown as a chip beside the identity; W is the line width the right side is aligned against; Style is the palette identity.