Files
plugins/packages/day-card/page/index.html
T
yetone 7d5a68700e day-card: the card is a receipt, a Daily AI statement on paper (0.1.1)
A user installed the Day card and found it looked nothing like the
receipt in https://x.com/jasonaxb/status/2119432517170430196, and asked
for the same look. The card is now that receipt, with magpie's words in
place of the original's own:

- cream paper over a teal-to-mint ground, a zigzag torn bottom edge
  and a soft shadow; heavy monospace, letter-spaced labels and dashed
  rules;
- DATE and ISSUED, then the TOTAL API COST (API-equivalent, not an
  invoice), then STREAK, REQUESTS, ERRORS (only when there were any)
  and VS AVERAGE DAY (cost against the mean of the active days before
  this one; tokens when nothing was priced);
- AGENT / MODEL with logos printed in ink, by cost; then TOTAL TOKENS,
  INPUT, OUTPUT and CACHE HIT RATE;
- the original's tagline and App Store footer are magpie's own lines,
  and its RANK is left out: magpie has no ranking to read.

The frame can't fetch a font file (sandboxed, opaque origin), so the
face is a subset of JetBrains Mono 2.304 (OFL, license beside it) as
woff2 data in page/fonts.js, loaded with FontFace. About 13.5KB per
weight, 400/700/800.

The average now leaves out the day itself, and money(0) reads $0.00.

Run, on mote at this tree:
- bun test packages/day-card: 12 pass (tests rewritten for the receipt:
  fields, cost order, versus, dates with a held clock, fonts.js is
  woff2 and loads before app.js, only usage:day is read).
- bun test scripts: 22 pass; bun scripts/check.mjs: exit 0.
- The page in a sandboxed frame under the page CSP, with the
  reference's numbers and real magpie icons, in Chromium and WebKit
  (Playwright 1.62.0), en, zh, de and ja: all three weights load, no
  page errors, the long German title shrinks to fit; the English card
  checked side by side with the tweet's image.

Not tried: the real magpie app's WKWebView, and Copy/Save from it.
2026-11-10 01:35:35 +08:00

33 lines
1.4 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Day card</title>
<link rel="stylesheet" href="style.css">
<script src="_magpie/bridge.js"></script>
<script src="fonts.js"></script>
<script src="view.js"></script>
<script src="app.js" defer></script>
</head>
<body>
<header>
<div class="days">
<button type="button" class="step" id="prev" aria-label="Previous day" data-t-label="prev"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M10 3.5 5.5 8l4.5 4.5"/></svg></button>
<div class="pick">
<button type="button" id="date" aria-haspopup="listbox" aria-expanded="false"><span id="date-text"></span><svg viewBox="0 0 16 16" aria-hidden="true"><path d="m4.5 6.5 3.5 3.5 3.5-3.5"/></svg></button>
<ul id="menu" role="listbox" hidden></ul>
</div>
<button type="button" class="step" id="next" aria-label="Next day" data-t-label="next"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M6 3.5 10.5 8 6 12.5"/></svg></button>
<button type="button" id="today" data-t="today">Today</button>
</div>
<div class="share">
<button type="button" id="copy" data-t="copy" disabled>Copy image</button>
<button type="button" id="save" data-t="save" disabled>Save PNG</button>
</div>
</header>
<p class="status" id="status" role="status"></p>
<main><canvas id="card"></canvas></main>
</body>
</html>