diff --git a/frontend/src/api/hooks.ts b/frontend/src/api/hooks.ts index 3048488..bf0164d 100644 --- a/frontend/src/api/hooks.ts +++ b/frontend/src/api/hooks.ts @@ -596,9 +596,11 @@ export function useCorporateDecisions(ticker: string | undefined) { // --------------------------------------------------------------------------- export interface CompetitiveStatus { - enabled: boolean; + enabled?: boolean; + competitive_enabled?: boolean; toggled_at: string | null; toggled_by: string | null; + source?: string; } export function useCompetitiveStatus() { @@ -720,9 +722,11 @@ export function useTrendProjection(trendId: string | undefined) { // --------------------------------------------------------------------------- export interface MacroStatus { - enabled: boolean; + enabled?: boolean; + macro_enabled?: boolean; toggled_at: string | null; toggled_by: string | null; + source?: string; } export function useMacroStatus() { diff --git a/frontend/src/pages/Trading.tsx b/frontend/src/pages/Trading.tsx index 8ed84ef..c766614 100644 --- a/frontend/src/pages/Trading.tsx +++ b/frontend/src/pages/Trading.tsx @@ -22,6 +22,10 @@ export function TradingPage() { const reviewApproval = useReviewApproval(); const toggleMacro = useToggleMacro(); const toggleCompetitive = useToggleCompetitive(); + + // Normalize API field names (API returns macro_enabled/competitive_enabled, not enabled) + const macroEnabled = macroStatus?.enabled ?? macroStatus?.macro_enabled ?? false; + const competitiveEnabled = competitiveStatus?.enabled ?? competitiveStatus?.competitive_enabled ?? false; const [confirmMode, setConfirmMode] = useState(null); const [confirmMacroToggle, setConfirmMacroToggle] = useState(false); const [confirmCompetitiveToggle, setConfirmCompetitiveToggle] = useState(false); @@ -90,20 +94,20 @@ export function TradingPage() { - {macroStatus?.enabled ? 'Enabled' : 'Disabled'} + {macroEnabled ? 'Enabled' : 'Disabled'} {macroStatus?.toggled_at && ( @@ -117,15 +121,15 @@ export function TradingPage() { {confirmMacroToggle && (

- Are you sure you want to {macroStatus?.enabled ? 'disable' : 'enable'} the macro signal layer? - {macroStatus?.enabled + Are you sure you want to {macroEnabled ? 'disable' : 'enable'} the macro signal layer? + {macroEnabled ? ' Disabling will exclude macro signals from trend summaries and recommendations.' : ' Enabling will include global event macro signals in trend summaries and recommendations.'}

- {competitiveStatus?.enabled ? 'Enabled' : 'Disabled'} + {competitiveEnabled ? 'Enabled' : 'Disabled'} {competitiveStatus?.toggled_at && ( @@ -177,15 +181,15 @@ export function TradingPage() { {confirmCompetitiveToggle && (

- Are you sure you want to {competitiveStatus?.enabled ? 'disable' : 'enable'} the competitive signal layer? - {competitiveStatus?.enabled + Are you sure you want to {competitiveEnabled ? 'disable' : 'enable'} the competitive signal layer? + {competitiveEnabled ? ' Disabling will exclude historical pattern and competitive signals from trend summaries and recommendations.' : ' Enabling will include historical pattern and competitive signals in trend summaries and recommendations.'}