Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
b358b15
fix(#70): give the shells the section 08 breakpoints
Nabil-Aufa Oct 19, 2026
d8f2d28
fix(#70): add the section 08 type roles, and let panel buttons wrap w…
Nabil-Aufa Oct 19, 2026
a5e0ae8
fix(#70): lay out 2a for the tablet and keep it inside the window fro…
Nabil-Aufa Oct 19, 2026
e2120a3
fix(#70): lay out 2b for the tablet and let its figures wrap on a nar…
Nabil-Aufa Oct 19, 2026
b13f78c
fix(#70): give onboarding, 2c, 2d and the shared parts their tablet form
Nabil-Aufa Oct 19, 2026
5a80781
fix(#70): lay out 3a for the tablet and let its rows and chips wrap
Nabil-Aufa Oct 19, 2026
09d7994
fix(#70): lay out 3b for the tablet
Nabil-Aufa Oct 19, 2026
e209d75
test(#70): check every app screen at the six widths of section 08
Nabil-Aufa Oct 19, 2026
30c0b12
feat(#70): build Repayment and History before the first advance as drawn
Nabil-Aufa Oct 19, 2026
fea5eba
fix(#70): word a failed row as #16 defines it, with its receipt
Nabil-Aufa Oct 19, 2026
01a4f79
docs(#70): say where 2a's revenue window really comes from
Nabil-Aufa Oct 19, 2026
ca58545
fix(#70): end at once on a send refused after leaving /advance
Nabil-Aufa Oct 19, 2026
bb681b1
fix(#70): widen the side column to 360 from a 1200 window, as claimed
Nabil-Aufa Oct 19, 2026
44a6015
fix(#70): keep the wordmark whole in the top nav from 768
Nabil-Aufa Oct 19, 2026
8a98fd1
fix(#70): stack a panel's two buttons under 768 unless the pair fits …
Nabil-Aufa Oct 19, 2026
66ba524
fix(#70): give the repay chips equal widths and the balance circles t…
Nabil-Aufa Oct 19, 2026
dd775d9
fix(#70): let 2a's side cards keep their own heights on a tablet
Nabil-Aufa Oct 19, 2026
0d11d17
docs(#70): list the forepay.mock.ledger states in the README
Nabil-Aufa Oct 19, 2026
a65544c
fix(#70): let a transaction's title wrap instead of cutting it at 320
Nabil-Aufa Oct 19, 2026
a57c2ed
fix(#70): let the History figure tiles keep their size and wrap at 320
Nabil-Aufa Oct 19, 2026
3fb5b28
test(#70): walk the six widths for proving, sending, 2d and a loading…
Nabil-Aufa Oct 19, 2026
ddc15dd
fix(#70): show the pointer on everything clickable, and not-allowed w…
Nabil-Aufa Oct 20, 2026
a2306dc
test(#21): find the new repayment's Today in its own row
Nabil-Aufa Oct 20, 2026
3253b1b
fix(#70): put every amount's unit under its figure below 360, so the …
Nabil-Aufa Oct 20, 2026
e8834ce
fix(#70): set the touched screens' type in the section 08 roles
Nabil-Aufa Oct 20, 2026
deb0ee9
fix(#70): keep a disabled button, quick action or chip still on hover…
Nabil-Aufa Oct 20, 2026
6eae97c
fix(#70): set the repay amount in the Input amount role (32, 36, 36)
Nabil-Aufa Oct 20, 2026
fb91a0a
fix(#70): never cut a typed repay amount; the chips and a long label …
Nabil-Aufa Oct 20, 2026
83a490e
chore(#70): keep any .next-* build output out of lint
Nabil-Aufa Oct 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions fe/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,16 @@ The mock reads two localStorage keys. Set them in the browser and reload:
Every other state on the board (each contract code, signing, pending, timed out) needs the stubbed
RPC and is exercised in `tests/e2e/advance.spec.ts`.

While `NEXT_PUBLIC_API_URL` is empty, Repayment and History read fixtures instead of the #16 API.
One more key picks their state:

| Key | Value | What happens |
| --- | --- | --- |
| `forepay.mock.ledger` | `active` (or unset) | Advance 1: 30.00 of 90.00 USDC repaid, with the 3a and 3b frames' transactions |
| `forepay.mock.ledger` | `none` | "No advance yet" on both pages |
| `forepay.mock.ledger` | `repaid` | the advance fully repaid, with a last 60.00 repayment |
| `forepay.mock.ledger` | `error` | "We cannot read your balance right now" |

## A wallet to test with

1. Install the Freighter browser extension and create an account.
Expand Down
2 changes: 2 additions & 0 deletions fe/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const eslintConfig = defineConfig([
// Default ignores of eslint-config-next:
".next/**",
".next-e2e/**",
// Any other build output a dev server was pointed at (NEXT_DIST_DIR), so a stray one cannot fail lint.
".next-*/**",
"out/**",
"build/**",
"next-env.d.ts",
Expand Down
20 changes: 20 additions & 0 deletions fe/src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,23 @@ body {
/* The design's text layers use the font's own line height unless they set one. */
line-height: normal;
}

/*
* Tailwind 4's preflight gives <button> the default cursor (Tailwind 3 gave it the pointer), so every
* button showed the arrow while links showed the pointer. One rule for everything clickable (#70).
*/
@layer base {
button:not(:disabled),
[role="button"]:not([aria-disabled="true"]),
[role="menuitem"],
[role="tab"],
label[for],
summary,
select {
cursor: pointer;
}
button:disabled,
[aria-disabled="true"] {
cursor: not-allowed;
}
}
114 changes: 75 additions & 39 deletions fe/src/app/tokens.css
Original file line number Diff line number Diff line change
Expand Up @@ -97,45 +97,16 @@
--radius-hero: 28px;
--radius-pill: 999px;

/* Type scale (Geist). text-display, text-page, text-amount, text-card-title, ... */
--text-display: 4rem;
--text-display--line-height: 1;
--text-display--letter-spacing: -0.03em;
--text-display--font-weight: 600;

--text-page: 2.5rem;
--text-page--line-height: 1.1;
--text-page--letter-spacing: -0.03em;
--text-page--font-weight: 600;

--text-amount: 2.25rem;
--text-amount--line-height: 1.1;
--text-amount--letter-spacing: -0.03em;
--text-amount--font-weight: 600;

--text-card-title: 1.125rem;
--text-card-title--line-height: 1.3;
--text-card-title--letter-spacing: -0.01em;
--text-card-title--font-weight: 600;

--text-body: 0.9375rem;
--text-body--line-height: 1.5;

--text-body-sm: 0.875rem;
--text-body-sm--line-height: 1.5;

--text-caption: 0.8125rem;
--text-caption--line-height: 1.4;

--text-label: 0.75rem;
--text-label--line-height: 1.3;
--text-label--font-weight: 500;

/* Status chips: pair with `uppercase`. */
--text-overline: 0.6875rem;
--text-overline--line-height: 1.3;
--text-overline--letter-spacing: 0.08em;
--text-overline--font-weight: 600;
/*
* Section 08: the side column widens from 320 to 360 at a 1200 window. In rem like Tailwind's own
* breakpoints, so `wide:` sorts after `lg:` (a px breakpoint would sort before it and never win).
*/
--breakpoint-wide: 75rem;
/*
* Where the top nav fits as the 834 tablet frame draws it (wordmark 179, tabs 318, chips 248, 12
* apart). Narrower, from 768, the tabs take 10 of side padding instead of 20.
*/
--breakpoint-nav: 52.125rem;

/*
* Shadows. Not used by the orange design, which is flat: surfaces separate
Expand All @@ -147,3 +118,68 @@
--shadow-nav: 0 10px 30px rgb(28 22 18 / 0.18);
--shadow-glow: 0 10px 24px rgb(28 22 18 / 0.16);
}

/*
* Type roles, from "Type scale per breakpoint" in section 08 of the pen.dev design: each steps at the
* tablet (768) and desktop (1024) breakpoints, in rem so the reader's text size setting still applies.
* Weights and line heights as in 02 Typography. Use these, not a pixel size written for one screen.
*/
@utility text-hero {
font-size: 3.5rem;
line-height: 1;
letter-spacing: -0.03em;
font-weight: 600;
@media (width >= 48rem) { font-size: 4.5rem; }
@media (width >= 64rem) { font-size: 5.5rem; }
}
@utility text-amount {
font-size: 3rem;
line-height: 1;
letter-spacing: -0.03em;
font-weight: 600;
@media (width >= 48rem) { font-size: 3.5rem; }
@media (width >= 64rem) { font-size: 4rem; }
}
@utility text-page-title {
font-size: 1.75rem;
/* 30 on 28 and 46 on 44, as the onboarding titles are drawn. */
line-height: 1.05;
letter-spacing: -0.03em;
font-weight: 600;
@media (width >= 48rem) { font-size: 2.25rem; }
@media (width >= 64rem) { font-size: 2.75rem; }
}
@utility text-card-title {
font-size: 1.25rem;
line-height: 1.2;
letter-spacing: -0.015em;
font-weight: 600;
@media (width >= 48rem) { font-size: 1.375rem; }
@media (width >= 64rem) { font-size: 1.5rem; }
}
/* The amount typed in a field (the 3a repay input): added by @AncungAulia on #71 (#84). */
@utility text-input-amount {
font-size: 2rem;
line-height: 1;
letter-spacing: -0.03em;
font-weight: 600;
@media (width >= 48rem) { font-size: 2.25rem; }
}
/* Figures in tiles and breakdowns (History, "Your advance"): added by @AncungAulia on #71. */
@utility text-figure {
font-size: 1.25rem;
line-height: 1.1;
letter-spacing: -0.03em;
font-weight: 600;
@media (width >= 48rem) { font-size: 1.75rem; }
@media (width >= 64rem) { font-size: 2rem; }
}
@utility text-body {
font-size: 1rem;
line-height: 1.5;
}
@utility text-small {
font-size: 0.8125rem;
line-height: 1.5;
@media (width >= 64rem) { font-size: 0.875rem; }
}
14 changes: 7 additions & 7 deletions fe/src/components/elements/AdvanceStepper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@ const BAR: Record<State, string> = { done: "bg-action", current: "bg-brand", nex
/** Desktop: one column per step, the bar on top, then "Step 2", its name and Done, You are here or Next. */
export function AdvanceStepper({ current }: { current: number }) {
return (
<ol className="hidden w-full gap-3 lg:flex" aria-label="Advance progress">
<ol className="hidden w-full gap-3 md:flex" aria-label="Advance progress">
{ADVANCE_STEPS.map((name, i) => {
const state = stateOf(i, current);
return (
<li key={name} className="flex flex-1 flex-col gap-3" aria-current={state === "current" ? "step" : undefined}>
<span className={cn("h-1 w-full rounded-[2px]", BAR[state])} />
<span className="flex flex-col gap-0.5">
<span className={cn("text-[12px]", state === "current" ? "text-brand-strong" : "text-fg-subtle")}>
<span className={cn("text-small", state === "current" ? "text-brand-strong" : "text-fg-subtle")}>
Step {i + 1}
</span>
<span className={cn("text-[15px] font-medium", state === "next" ? "text-fg-subtle" : "text-fg")}>
<span className={cn("text-body font-medium", state === "next" ? "text-fg-subtle" : "text-fg")}>
{name}
</span>
<span
className={cn(
"text-[12px]",
"text-small",
state === "done" && "text-success",
state === "current" && "text-brand",
state === "next" && "text-fg-subtle",
Expand All @@ -51,12 +51,12 @@ export function AdvanceStepper({ current }: { current: number }) {
export function AdvanceProgress({ current }: { current: number }) {
const allDone = current >= ADVANCE_STEPS.length;
return (
<div className="flex w-full items-center gap-4 rounded-tile bg-surface px-[18px] py-4 lg:hidden">
<div className="flex w-full items-center gap-4 rounded-tile bg-surface px-[18px] py-4 md:hidden">
<div className="flex flex-1 flex-col gap-0.5">
<p className="text-[12px] text-fg-muted">
<p className="text-small text-fg-muted">
{allDone ? "All steps done" : `Step ${current + 1} of ${ADVANCE_STEPS.length}`}
</p>
<p className="text-[16px] font-semibold text-fg">{allDone ? "USDC received" : ADVANCE_STEPS[current]}</p>
<p className="text-body font-semibold text-fg">{allDone ? "USDC received" : ADVANCE_STEPS[current]}</p>
</div>
<div className="flex items-center gap-1.5" aria-hidden>
{ADVANCE_STEPS.map((name, i) => {
Expand Down
9 changes: 5 additions & 4 deletions fe/src/components/elements/EmptyState.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type { ReactNode } from "react";

// Empty state from "05 Product components": a white card with a spot illustration, a centred title and
// body, and one action under them.
// body, and one action under them. As placed on the "No advance yet" frames: 400 wide with 24 padding,
// the full column on a phone.
export function EmptyState({
illustration,
title,
Expand All @@ -14,10 +15,10 @@ export function EmptyState({
action: ReactNode;
}) {
return (
<section className="flex w-full max-w-[440px] flex-col items-center gap-4 rounded-card bg-surface px-7 py-10">
<section className="flex w-full max-w-[400px] flex-col items-center gap-4 rounded-card bg-surface p-6">
<div className="flex w-full justify-center">{illustration}</div>
<h2 className="text-[20px] font-semibold tracking-[-0.3px] text-fg">{title}</h2>
<p className="w-full max-w-[320px] text-center text-[15px] leading-[23px] text-fg-muted">{body}</p>
<h2 className="text-card-title text-fg">{title}</h2>
<p className="w-full max-w-[320px] text-center text-body text-fg-muted">{body}</p>
{action}
</section>
);
Expand Down
23 changes: 19 additions & 4 deletions fe/src/components/elements/ErrorPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export function ErrorPanel({
actions,
centered = false,
stacked = false,
row = false,
className,
}: {
illustration: ReactNode;
Expand All @@ -18,8 +19,13 @@ export function ErrorPanel({
actions: ReactNode;
/** Most panels on the board centre their title; "Wrong network" and "Wallet locked" do not. */
centered?: boolean;
/** Actions one above the other, for labels too long to share a row. */
/** Actions one above the other at every width, as the board draws some panels. */
stacked?: boolean;
/**
* Two actions side by side on a phone too. Only for a pair whose labels fit on one line at 320, such
* as "Try again" and "Back" (section 08).
*/
row?: boolean;
className?: string;
}) {
return (
Expand All @@ -32,9 +38,18 @@ export function ErrorPanel({
)}
>
<div className="flex w-full justify-center">{illustration}</div>
<h2 className="text-[19px] font-semibold tracking-[-0.3px] text-fg">{title}</h2>
<p className="w-full text-[14px] leading-[21px] text-fg-muted">{body}</p>
<div className={cn("flex w-full gap-2.5", stacked ? "flex-col" : "[&>*]:flex-1")}>{actions}</div>
<h2 className="text-card-title text-fg">{title}</h2>
<p className="w-full text-body text-fg-muted">{body}</p>
{/* Section 08: under 768 two buttons sit one under the other, the main one (passed first) on top,
unless the pair fits at 320 (`row`). */}
<div
className={cn(
"flex w-full gap-2.5",
stacked ? "flex-col" : row ? "[&>*]:flex-1" : "flex-col md:flex-row md:[&>*]:flex-1",
)}
>
{actions}
</div>
</section>
);
}
2 changes: 1 addition & 1 deletion fe/src/components/elements/LedgerNote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function LedgerNote({ className }: { className?: string }) {
<span className="flex size-9 shrink-0 items-center justify-center rounded-[12px] bg-surface">
<BookOpenCheck className="size-[18px] text-icon" aria-hidden />
</span>
<p className="flex-1 text-[14px] leading-[20px] text-brand-strong">
<p className="flex-1 text-small text-brand-strong">
Every number on this page comes straight from Stellar, not from your browser.
</p>
</aside>
Expand Down
21 changes: 14 additions & 7 deletions fe/src/components/elements/LedgerRow.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
import { TransactionRow } from "@/components/elements/TransactionRow";
import { formatUsdCents, formatUsdc } from "@/lib/format";
import { formatUsdCents, usdcParts } from "@/lib/format";
import { rowDate, type Row } from "@/lib/ledger";
import { explorerTxUrl } from "@/lib/stellar/network";

// One line of 3a "Transactions" and 3b "All transactions", in the frames' words. Money leaving the
// wallet is written with a real minus sign (U+2212), money arriving with a plus, in emerald.
const MINUS = "−";

/** A signed USDC amount, its unit apart (see `Label`). */
function usdc(sign: string, stroops: bigint) {
const { whole, decimals } = usdcParts(stroops);
return { text: `${sign}${whole}${decimals}`, unit: "USDC" };
}

const completed = { status: { text: "Completed" }, statusTone: "success" as const };
// A failed row reached the ledger and failed there (#16): the network fee was spent and no USDC moved.
// It is on chain, so it has a receipt. A transaction that never reached a ledger is not listed.
const failed = {
status: { text: "Failed, not charged", short: "Not charged" },
status: { text: "Failed, no USDC moved", short: "Failed" },
statusTone: "danger" as const,
noReceipt: { text: "No transaction", short: "Not sent" },
};

export function LedgerRow({ row }: { row: Row }) {
Expand All @@ -24,18 +31,18 @@ export function LedgerRow({ row }: { row: Row }) {
status={{ text: "Pending" }}
statusTone="pending"
date="Just now"
amount={{ text: `${MINUS}${formatUsdc(row.amount)}` }}
amount={usdc(MINUS, row.amount)}
amountTone="fg"
receiptHref={row.hash ? explorerTxUrl(row.hash) : undefined}
/>
);
case "advance":
case "repayment": {
const advance = row.kind === "advance";
const amount = { text: `${advance ? "+" : MINUS}${formatUsdc(row.amount)}` };
const amount = usdc(advance ? "+" : MINUS, row.amount);
const title = { text: advance ? "Advance received" : "Repayment" };
if (row.failed) {
return <TransactionRow icon="failed" title={title} date={rowDate(row.at)} amount={amount} amountTone="subtle" {...failed} />;
return <TransactionRow icon="failed" title={title} date={rowDate(row.at)} amount={amount} amountTone="subtle" receiptHref={explorerTxUrl(row.hash)} {...failed} />;
}
return (
<TransactionRow
Expand Down Expand Up @@ -65,7 +72,7 @@ export function LedgerRow({ row }: { row: Row }) {
const title = { text: "USDC allowed in wallet", short: "USDC allowed" };
const amount = { text: "Network fee only", short: "Fee only" };
if (row.failed) {
return <TransactionRow icon="failed" title={title} date={rowDate(row.at)} amount={amount} amountTone="subtle" {...failed} />;
return <TransactionRow icon="failed" title={title} date={rowDate(row.at)} amount={amount} amountTone="subtle" receiptHref={explorerTxUrl(row.hash)} {...failed} />;
}
return (
<TransactionRow
Expand Down
Loading