Files
CatoandClaude Opus 5.5 6e5bbf3483 feat(markets): a company page that reads like a markets product (#259)
* feat(markets): a company page that reads like a markets product

The owner, 2026-10-25: "I don't see any beautiful charts on stock
performance … think Bloomberg, think Yahoo Finance", and on NVIDIA's
holders, "'other' is 87%. We have a vague idea of what that means."

Every company page now carries one market frame, in one order, whatever
the company is (docs/design/company-page.md): a header quote (ticker,
exchange, currency, last close, 1-day change, date, "delayed end-of-day ·
Yahoo Finance"), then share price, key statistics, revenue and net income
by year, who owns it, how it does business, and peers. A section with no
data stays and says what source would fill it, with a Send-evidence link.

- Share price: a line chart with one row of six equal range cells
  (1M·3M·6M·YTD·1Y·5Y), the page's only client island. Every range is
  computed on the server, along with its return, span and largest fall,
  the 52-week range, a returns table and the 50/200-day averages
  (prices/compute.ts).
- Key statistics: eight equal cells. Market value is computed only where
  close × cover shares is the value; otherwise "Not computed" with the
  reason. Each annual figure shows its fiscal year, growth and filing.
- Financials: chartkit's new ColumnChart (0.2.0) for five fiscal years
  from XBRL, plus rows with growth and margin computed in code.
- Who owns it: holders from 13G/13D/proxy. The remainder is labelled
  "Others, each below 5%" in the legend (chartkit's new ShareBars
  otherLabel) and explained in its row. A company with no listing shows
  the owners the relation graph states.
- How it does business: customers, suppliers, competitors (always), and
  stakes, sites and partners from lib/graph, one row anatomy. An empty
  group names the filings that would fill it, and points to the quoted
  dependency rows where they exist.
- Peers: the same chain step (tier A) or the same theme (tier B), with
  last close, 1Y return and a sparkline.

Tier B companies get prices, financials and holders: lib/market-data/company.ts
joins a slug to a listing. It tries the seed first, then the universe
ticker on a venue the price source serves. New venues (US composite,
London, Hong Kong, Korea, Taiwan, Toronto, SIX) are added to Yahoo's
suffixes. Ambiguous venue codes are not guessed. Sections stream in their
own Suspense boundaries, with reads deduplicated per request, so a slow
price source never delays the header. Ask charts link "Open <Company>" to
the page, and the holders bar in answers carries the remainder label.

Verified: pnpm run verify; pnpm run build; test/company-page.test.ts;
scripts/ux/company-layout.mjs at 320/390/768/1440 on NVIDIA, Oklo,
SpaceX, NAC Kazatomprom and a stub, against live Yahoo and SEC.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

* docs(design): the header's quote lives in price-view.ts

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-27 13:43:25 +01:00

167 lines
4.0 KiB
CSS

/*
* A table under an answer (components/portal/chat/AnswerTables.tsx).
*
* The frame is a size container: where the answer column is wide, a real
* table; where it is narrow (a phone, and the right-hand panel on a desktop),
* the same rows as cards, each cell under its own label. Nothing scrolls
* sideways and no word is cut — the 2026-10-24 answer that pasted sixteen
* ventures as one paragraph is what this replaces.
*/
.answer-table {
display: grid;
gap: 0.5rem;
margin: 0.25rem 0 0.5rem;
color: var(--color-fg-primary);
}
.answer-table figcaption {
font-weight: 600;
font-size: 0.9rem;
}
.answer-table-frame {
container-type: inline-size;
min-width: 0;
}
.answer-table table {
width: 100%;
border-collapse: collapse;
font-size: 0.85rem;
line-height: 1.4;
}
.answer-table th {
text-align: left;
font-weight: 600;
font-size: 0.75rem;
color: var(--color-fg-secondary);
border-bottom: 1px solid var(--color-border-strong);
padding: 0.35rem 0.5rem 0.35rem 0;
vertical-align: bottom;
}
.answer-table td {
padding: 0.45rem 0.5rem 0.45rem 0;
border-bottom: 1px solid var(--color-border-subtle);
vertical-align: top;
overflow-wrap: break-word;
}
.answer-table td[data-col='operator'] {
font-weight: 600;
}
.answer-table-none {
color: var(--color-fg-tertiary);
}
/* Narrow: one card per row, each cell under its label. */
@container (width < 34rem) {
.answer-table thead {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip-path: inset(50%);
}
.answer-table table,
.answer-table tbody,
.answer-table tr,
.answer-table td {
display: block;
}
.answer-table tbody {
display: grid;
gap: 0.5rem;
}
.answer-table tr {
padding: 0.6rem 0.75rem;
border: 1px solid var(--color-border-subtle);
border-radius: 0.5rem;
background: var(--color-surface-raised);
}
.answer-table td {
padding: 0.15rem 0;
border: 0;
}
/* A card does not list what its row leaves blank; the shared note says where it is. */
.answer-table td[data-empty] {
display: none;
}
.answer-table td:not([data-col='operator'])::before {
content: attr(data-label);
display: block;
font-size: 0.75rem;
color: var(--color-fg-tertiary);
}
}
.answer-table summary {
min-height: var(--size-target);
display: flex;
align-items: center;
cursor: pointer;
color: var(--color-fg-secondary);
}
.answer-table summary:hover {
color: var(--color-fg-primary);
}
.answer-table-place summary {
color: var(--color-fg-primary);
text-decoration: underline dotted;
text-underline-offset: 0.2em;
}
.answer-table-shared {
font-size: 0.85rem;
}
.answer-table-shared p {
margin: 0 0 0.5rem;
color: var(--color-fg-secondary);
}
.answer-table-more {
justify-self: start;
min-height: var(--size-target);
padding: 0 1rem;
border: 1px solid var(--color-border-strong);
border-radius: 999px;
font-size: 0.85rem;
color: var(--color-fg-primary);
cursor: pointer;
}
.answer-table-more:hover {
background: var(--color-surface-raised);
}
.answer-table-source {
margin: 0;
font-size: 0.75rem;
color: var(--color-fg-tertiary);
}
.answer-table-source a {
color: var(--color-fg-secondary);
text-decoration: underline;
text-underline-offset: 0.2em;
}
/* Charts an answer carries (components/portal/chat/AnswerCharts.tsx): chartkit draws the figure. */
.answer-chart {
margin: 0 0 1rem;
min-width: 0;
}
.answer-chart-source {
margin-top: 0.375rem;
font-size: 0.75rem;
line-height: 1.5;
color: var(--color-fg-tertiary);
}
.answer-chart-source a {
color: var(--color-fg-secondary);
text-decoration: underline;
text-underline-offset: 0.2em;
}
/* The company page the chart's figures belong on (lib/market-data/present.ts). */
.answer-chart-open {
display: inline-flex;
align-items: center;
min-height: var(--size-target);
font-size: 0.875rem;
color: var(--color-fg-primary);
text-underline-offset: 0.2em;
}
.answer-chart-open:hover {
text-decoration: underline;
}