diff options
| author | Tyler Hoang <tyler@tylerhoang.xyz> | 2026-05-17 14:13:56 -0700 |
|---|---|---|
| committer | Tyler Hoang <tyler@tylerhoang.xyz> | 2026-05-17 14:13:56 -0700 |
| commit | 8a6a55d6dc9d0da59c626e532ce18161b40707a0 (patch) | |
| tree | 1b32d24af61608c856baafcf1ddc6d89acf493dc /frontend | |
| parent | 007b63cfeef0a6206dcfb5208c9222c6c5d977b3 (diff) | |
Filter null rows from ShortInterestCard, hide card when all null
Mirrors the adaptive Reference card approach: only visible items are
rendered, with a note when some are suppressed. Card returns null when
nothing is available. Also updates next-env.d.ts path and ignores
.superpowers/.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'frontend')
| -rw-r--r-- | frontend/app/page.tsx | 20 | ||||
| -rw-r--r-- | frontend/next-env.d.ts | 2 |
2 files changed, 17 insertions, 5 deletions
diff --git a/frontend/app/page.tsx b/frontend/app/page.tsx index 013b93d..44428aa 100644 --- a/frontend/app/page.tsx +++ b/frontend/app/page.tsx @@ -472,6 +472,16 @@ function ProfileCard({ overview }: { overview: TickerOverview }) { function ShortInterestCard({ overview }: { overview: TickerOverview }) { const short = overview.short_interest; + const items = [ + { label: "Short Float", value: fmtPct(short.short_percent_of_float), missing: short.short_percent_of_float == null }, + { label: "Days Cover", value: fmtNumber(short.short_ratio), missing: short.short_ratio == null }, + { label: "Shares Short", value: fmtNumber(short.shares_short, 0), missing: short.shares_short == null }, + { label: "Prior Delta", value: fmtPct(short.shares_short_delta_pct, 1, true), missing: short.shares_short_delta_pct == null } + ]; + const visibleItems = items.filter((i) => !i.missing); + if (!visibleItems.length) return null; + const suppressed = items.length - visibleItems.length; + return ( <section className="psm-card"> <div className="psm-card-head"> @@ -481,11 +491,13 @@ function ShortInterestCard({ overview }: { overview: TickerOverview }) { </div> </div> <div className="psm-detail-grid"> - <DetailItem label="Short Float" value={fmtPct(short.short_percent_of_float)} missing={short.short_percent_of_float == null} /> - <DetailItem label="Days Cover" value={fmtNumber(short.short_ratio)} missing={short.short_ratio == null} /> - <DetailItem label="Shares Short" value={fmtNumber(short.shares_short, 0)} missing={short.shares_short == null} /> - <DetailItem label="Prior Delta" value={fmtPct(short.shares_short_delta_pct, 1, true)} missing={short.shares_short_delta_pct == null} /> + {visibleItems.map((item) => ( + <DetailItem key={item.label} label={item.label} value={item.value} missing={false} /> + ))} </div> + {suppressed > 0 && ( + <p className="psm-muted-copy" style={{ marginTop: "var(--sp-3)" }}>ยท Short interest data incomplete</p> + )} </section> ); } diff --git a/frontend/next-env.d.ts b/frontend/next-env.d.ts index 9edff1c..c4b7818 100644 --- a/frontend/next-env.d.ts +++ b/frontend/next-env.d.ts @@ -1,6 +1,6 @@ /// <reference types="next" /> /// <reference types="next/image-types/global" /> -import "./.next/types/routes.d.ts"; +import "./.next/dev/types/routes.d.ts"; // NOTE: This file should not be edited // see https://nextjs.org/docs/app/api-reference/config/typescript for more information. |
