disable portfolio tab in symbol mode

This commit is contained in:
Emil Lerch 2026-06-26 08:46:49 -07:00
parent 128085eefc
commit ce5d787083
Signed by: lobo
GPG key ID: A7B62D657EF764F8
2 changed files with 13 additions and 9 deletions

View file

@ -1634,10 +1634,9 @@ pub const App = struct {
}
/// Whether the given tab should be treated as disabled in
/// the current App context. All migrated tabs are consulted
/// via their framework-contract `isDisabled` hook. (Portfolio
/// is the only remaining unmigrated tab; it has no disabled
/// predicate today.)
/// the current App context. All tabs are consulted via their
/// framework-contract `isDisabled` hook (tabs without one
/// default to always-enabled).
fn isDisabled(self: *App, t: Tab) bool {
return self.appPredicate(t, "isDisabled");
}

View file

@ -330,6 +330,16 @@ pub const tab = struct {
pub const deactivate = framework.noopDeactivate(State);
/// Disabled only when the TUI was opened on a specific symbol
/// (`zfin AAPL`) with no portfolio loaded: there's nothing to show
/// here, so it greys out and becomes unselectable to match the
/// other portfolio-backed tabs (analysis, review, projections,
/// history). A plain `zfin` launch with no portfolio keeps the tab
/// enabled so it can show the welcome screen (`drawWelcomeScreen`).
pub fn isDisabled(app: *App) bool {
return app.portfolio.file == null and app.has_explicit_symbol;
}
/// Manual refresh (r/F5): re-value the portfolio with live
/// intraday quotes, then rebuild the summary. `r` means "give me
/// current prices now" - it does NOT force candle work. Candle
@ -466,11 +476,6 @@ pub const tab = struct {
}
}
/// Portfolio is always enabled (the tab itself; data may be
/// empty if no portfolio file is loaded - that's a separate
/// concern handled by `drawWelcomeScreen`).
pub const isDisabled = framework.alwaysEnabled();
/// Drop UI state that referenced the previous portfolio.
///
/// `account_list` holds borrowed strings into the old