From daec8fe7f3f2ed031fa0d268083478b1cd182624 Mon Sep 17 00:00:00 2001 From: Gregory Fong Date: Mon, 16 Nov 2026 15:20:51 -0800 Subject: [PATCH 1/7] feat(app): one Address component for every address on screen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Addresses were drawn four ways: CopyText with grouped(), raw mono T, shortAddress() in the body face, and a hand-styled mono span in the transaction title. Half the short forms were in Figtree, not Plex Mono. Address has two forms. Short (first 10…last 6, mono 15) stands in for a name; with `detail` it is mono 13 in Muted under a name. Full (groups of 4, mono 13) is for checking and copying; `copy` makes it tap-to-copy. AddressInline puts a short address inside a sentence. Screen readers hear a short address as "address ending" plus its last 6 characters (spokenAddress), not letters and an ellipsis. No part of an address is dimmed or highlighted, because address poisoning copies the ends. The rule is now in design guide §5. Co-Authored-By: Claude Opus 5.5 --- docs/design/wizard-design-guide.md | 9 +++ mobile/app/(tabs)/receive.tsx | 8 +-- mobile/app/contacts/[address].tsx | 8 +-- mobile/app/contacts/add.tsx | 23 +++++--- mobile/app/contacts/edit.tsx | 3 +- mobile/app/contacts/index.tsx | 25 +++++--- mobile/app/exchange-address.tsx | 6 +- mobile/app/pay/amount.tsx | 11 +++- mobile/app/tx/[txid].tsx | 19 ++---- mobile/src/activity-row.tsx | 21 ++++++- mobile/src/activity.test.ts | 6 +- mobile/src/activity.ts | 8 ++- mobile/src/components/address.tsx | 94 ++++++++++++++++++++++++++++++ mobile/src/components/index.ts | 1 + mobile/src/components/text.tsx | 9 ++- mobile/src/pay-contact.tsx | 15 ++++- mobile/src/pay-people.test.ts | 2 +- mobile/src/pay-people.ts | 10 ++-- mobile/src/theme.ts | 2 + mobile/src/who.tsx | 18 +++--- wallet-native/src/format.test.ts | 5 ++ wallet-native/src/format.ts | 9 +++ 22 files changed, 239 insertions(+), 73 deletions(-) create mode 100644 mobile/src/components/address.tsx diff --git a/docs/design/wizard-design-guide.md b/docs/design/wizard-design-guide.md index 9e6b7f0..ad76f7d 100644 --- a/docs/design/wizard-design-guide.md +++ b/docs/design/wizard-design-guide.md @@ -142,6 +142,15 @@ Screens name the role, never the theme's colour (`c.text`, not `color.star`). - Sizes: balance 56, amount entry 64, title 28, body 16, label 13, mono 13. Body never under 15. - Sentence case everywhere. No all-caps labels except the Testnet badge. - Addresses are shown in groups of 4 characters. Truncated form: first 10, an ellipsis, last 6. +- **Every address goes through `Address`** (`src/components/address.tsx`), so it looks the same everywhere. Two forms: + + | Form | Looks like | Where | + |---|---|---| + | **Short** | `utest1abcd…456789`, mono 15 in Text, one line | In a name's place: a list row, the amount screen's chip, a title. Inside a sentence ("You paid …") it is `AddressInline`, mono in the sentence's colour | + | **Short, under a name** (`detail`) | Mono 13 in Muted | The line under a contact's or person's name, when there is no `.zcash` name to show instead | + | **Full** | Every character in groups of 4, mono 13, wrapping only between groups | Where someone checks or copies it: Receive, the exchange address, a contact page, Technical details, Add a contact. With `copy`, tapping anywhere on it copies the whole address and its label says "Copied" | + + No part of an address is dimmed or highlighted. Someone can make an address that starts and ends like yours (address poisoning), so the full form asks for every group to be read, not just the ends. Screen readers hear a short address as "address ending" and its last 6 characters one by one, the same ones the short form ends with; the full form is read group by group. The native confirmation and contact sheets draw the full form the same way (`Format.grouped`, mono, selectable). ## 6. Shape, space and motion diff --git a/mobile/app/(tabs)/receive.tsx b/mobile/app/(tabs)/receive.tsx index e0a2e84..dc38d42 100644 --- a/mobile/app/(tabs)/receive.tsx +++ b/mobile/app/(tabs)/receive.tsx @@ -4,6 +4,7 @@ import { useCallback, useRef } from 'react'; import { Pressable, ScrollView, Share, StyleSheet, View } from 'react-native'; import { Art } from '../../src/art'; import { + Address, Button, CodeTile, CopyText, @@ -48,12 +49,7 @@ export default function Receive() { caption={`Send only ${testnet ? 'test ' : ''}ZEC to this address.`} /> {address && ( - +
)} {error ? ( <> diff --git a/mobile/app/contacts/[address].tsx b/mobile/app/contacts/[address].tsx index 4b82783..42023ee 100644 --- a/mobile/app/contacts/[address].tsx +++ b/mobile/app/contacts/[address].tsx @@ -5,6 +5,7 @@ import { Pressable, ScrollView, StyleSheet, View } from 'react-native'; import { sentTo } from '../../src/activity'; import { ActivityRow, RowSeparator, useFresh } from '../../src/activity-row'; import { + Address, Avatar, Button, CopyText, @@ -96,12 +97,7 @@ export default function ContactPage() { /> )} - +
{(() => { // What you're waiting on from them (issue #15, mock R6), newest first. diff --git a/mobile/app/contacts/add.tsx b/mobile/app/contacts/add.tsx index 4597b30..3a56726 100644 --- a/mobile/app/contacts/add.tsx +++ b/mobile/app/contacts/add.tsx @@ -7,6 +7,7 @@ import { type Recipient, resolveRecipient, shortAddress, + spokenAddress, suggestedName, useWallet, when, @@ -15,7 +16,16 @@ import { router, useLocalSearchParams } from 'expo-router'; import { useEffect, useMemo, useRef, useState } from 'react'; import { Pressable, ScrollView, StyleSheet, View } from 'react-native'; import { NOTHING_TO_PASTE, pasteText } from '../../src/clipboard'; -import { Avatar, Button, Notice, Screen, ScreenHeader, T, TextField } from '../../src/components'; +import { + Address, + Avatar, + Button, + Notice, + Screen, + ScreenHeader, + T, + TextField, +} from '../../src/components'; import { scanFor } from '../../src/navigation'; import { themed } from '../../src/use-theme'; @@ -121,9 +131,7 @@ export default function AddContact() { {found.zcashName ? {found.zcashName} : null} - - {grouped(found.address)} - +
Their name {full(r.name)} ) : ( - - {shortAddress(r.address)} - +
)} {`Paid ${paidWhen(r.at)}`} @@ -195,7 +201,7 @@ export default function AddContact() { { setError(null); @@ -227,7 +233,6 @@ const useStyles = themed((c) => StyleSheet.create({ body: { gap: 12, paddingBottom: 40 }, who: { alignItems: 'center', gap: 8, marginVertical: 12 }, - address: { textAlign: 'center' }, buttons: { flexDirection: 'row', gap: 10 }, people: { marginTop: 16, gap: 4 }, person: { flexDirection: 'row', alignItems: 'center', gap: 12, paddingVertical: 10 }, diff --git a/mobile/app/contacts/edit.tsx b/mobile/app/contacts/edit.tsx index a86f375..8939fd0 100644 --- a/mobile/app/contacts/edit.tsx +++ b/mobile/app/contacts/edit.tsx @@ -9,6 +9,7 @@ import { router, useLocalSearchParams } from 'expo-router'; import { useState } from 'react'; import { Alert, Pressable, ScrollView, StyleSheet, View } from 'react-native'; import { + Address, Avatar, Button, HeaderLink, @@ -173,7 +174,7 @@ export default function EditContact() { ) : null} Address - {shortAddress(c.address)} +
To pay a different address, delete this contact and add it again. diff --git a/mobile/app/contacts/index.tsx b/mobile/app/contacts/index.tsx index 53e2bdb..c93e0d8 100644 --- a/mobile/app/contacts/index.tsx +++ b/mobile/app/contacts/index.tsx @@ -2,7 +2,6 @@ import { errorText, resolveRecipient, searchContacts, - shortAddress, sortContacts, useWallet, } from '@wizard/wallet-native'; @@ -11,6 +10,8 @@ import { useState } from 'react'; import { ActivityIndicator, FlatList, Pressable, StyleSheet, View } from 'react-native'; import { Art } from '../../src/art'; import { + Address, + AddressInline, Avatar, Button, Notice, @@ -110,7 +111,7 @@ export default function Contacts() { - {`Add ${short(offer)} as a contact`} + Add as a contact - {`Pay ${short(offer)}`} + + Pay + {paying ? : null} @@ -146,9 +149,13 @@ export default function Contacts() { {c.name} - - {c.zcashName ?? shortAddress(c.address)} - + {c.zcashName ? ( + + {c.zcashName} + + ) : ( +
+ )} )} @@ -170,10 +177,10 @@ function noMatch(q: string) { return `None of your contacts is called “${t}”.`; } -/** A name as typed; an address or link shortened so the line fits. */ -function short(input: string) { +/** A name as typed; an address or link's address short, in mono, so the line fits. */ +function Offered({ input }: { input: string }) { if (input.endsWith('.zcash')) return input; - return shortAddress(input.replace(/^zcash:/i, '').split('?')[0]); + return ; } const useStyles = themed((c) => diff --git a/mobile/app/exchange-address.tsx b/mobile/app/exchange-address.tsx index 6fe6a15..1b48ce3 100644 --- a/mobile/app/exchange-address.tsx +++ b/mobile/app/exchange-address.tsx @@ -2,6 +2,7 @@ import { grouped, useWallet } from '@wizard/wallet-native'; import { router } from 'expo-router'; import { ScrollView, Share, StyleSheet, View } from 'react-native'; import { + Address, Button, CodeTile, CopyText, @@ -41,9 +42,10 @@ export default function ExchangeAddress() { caption={`Send only ${testnet ? 'test ' : ''}ZEC to this address.`} /> {address ? ( - diff --git a/mobile/app/pay/amount.tsx b/mobile/app/pay/amount.tsx index f5bfaaf..2cd8103 100644 --- a/mobile/app/pay/amount.tsx +++ b/mobile/app/pay/amount.tsx @@ -23,6 +23,7 @@ import { useEffect, useMemo, useReducer, useState } from 'react'; import { Animated, Keyboard, Pressable, StyleSheet, Text, View } from 'react-native'; import { Art } from '../../src/art'; import { + Address, Avatar, Button, NetworkBadge, @@ -206,9 +207,13 @@ export default function Amount() { {to ? ( - - {shown ?? shortAddress(to.address)} - + {shown ? ( + + {shown} + + ) : ( +
+ )} ) : ( Request from anyone diff --git a/mobile/app/tx/[txid].tsx b/mobile/app/tx/[txid].tsx index 3d95e6b..4af0b0d 100644 --- a/mobile/app/tx/[txid].tsx +++ b/mobile/app/tx/[txid].tsx @@ -26,6 +26,8 @@ import { } from '../../src/activity'; import { Art } from '../../src/art'; import { + Address, + AddressInline, Amount, Avatar, Button, @@ -300,7 +302,7 @@ function Title({ {name ? ( {name} ) : ( - {shortAddress(to)} + )} ); @@ -444,12 +446,7 @@ function Technical({ return { key: `to-${a}`, node: ( - +
), }; }); @@ -457,12 +454,7 @@ function Technical({ rows.push({ key: 'on', node: ( - +
), }); rows.push({ @@ -526,7 +518,6 @@ const useStyles = themed((c) => title: { fontSize: 17, marginTop: 12, marginBottom: 2, textAlign: 'center' }, titleTap: { minHeight: 48, justifyContent: 'center' }, titleName: { fontFamily: font.textBold }, - titleMono: { fontFamily: font.mono, fontSize: 15 }, struck: { textDecorationLine: 'line-through' }, statusBlock: { alignItems: 'center', marginTop: 14, gap: 4, paddingHorizontal: 24 }, status: { flexDirection: 'row', alignItems: 'center', gap: 8 }, diff --git a/mobile/src/activity-row.tsx b/mobile/src/activity-row.tsx index d93458a..bafcc45 100644 --- a/mobile/src/activity-row.tsx +++ b/mobile/src/activity-row.tsx @@ -1,9 +1,9 @@ -import { type Tx, usePastPrice, useWallet } from '@wizard/wallet-native'; +import { shortAddress, type Tx, usePastPrice, useWallet } from '@wizard/wallet-native'; import { router } from 'expo-router'; import { useEffect, useRef, useState } from 'react'; import { Animated, Pressable, StyleSheet, View } from 'react-native'; import { describe, notesOf } from './activity'; -import { Amount, Avatar, T } from './components'; +import { AddressInline, Amount, Avatar, T } from './components'; import { useFade } from './motion'; import { useRequestMatch } from './requests'; import { space } from './theme'; @@ -65,7 +65,9 @@ export function ActivityRow({ ) ) : ( <> - {d.title} + + + </T> {note ? ( <T kind="dust" numberOfLines={1}> {note} @@ -86,6 +88,19 @@ export function ActivityRow({ ); } +/** A row's title, with a bare address in it drawn in mono. */ +function Title({ title, bare }: { title: string; bare?: string }) { + const at = bare ? title.indexOf(shortAddress(bare)) : -1; + if (!bare || at < 0) return title; + return ( + <> + {title.slice(0, at)} + <AddressInline value={bare} /> + {title.slice(at + shortAddress(bare).length)} + </> + ); +} + /** The hairline between rows, starting after the avatar (`noWho`: at the text). */ export function RowSeparator({ noWho }: { noWho?: boolean } = {}) { const s = useStyles(); diff --git a/mobile/src/activity.test.ts b/mobile/src/activity.test.ts index 6b965d0..159ca8f 100644 --- a/mobile/src/activity.test.ts +++ b/mobile/src/activity.test.ts @@ -50,7 +50,11 @@ group('describe', () => { }); it('falls back to a short address for someone without a name', () => { - expect(describe(tx({}), () => null).title).toMatch(/^You paid utest1/); + const d = describe(tx({}), () => null); + expect(d.title).toMatch(/^You paid utest1\S{4}…\S{6}$/); + expect(d.bare).toMatch(/^utest1/); + // Screen readers hear its last characters, not the ellipsis. + expect(d.spoken).toMatch(/^You paid address ending( \S){6},/); }); it('shows a receipt as it arrived', () => { diff --git a/mobile/src/activity.ts b/mobile/src/activity.ts index 408df0a..8f51a59 100644 --- a/mobile/src/activity.ts +++ b/mobile/src/activity.ts @@ -3,6 +3,7 @@ import { paidAmount, parseRequestMemo, shortAddress, + spokenAddress, stripReply, type Tx, usd, @@ -18,6 +19,8 @@ export type Described = { /** The other side's address, for the avatar. */ who?: string; name: string | null; + /** The address the title names, short, when there's no name: the row draws it in mono. */ + bare?: string; /** Signed zatoshis, as `paidAmount` reads them. */ amount: number; /** Where the payment stands, for a row ("2 min ago", "Confirming"). */ @@ -68,6 +71,7 @@ export function describe( title: sentRequest ? `You sent ${them} a request` : `You paid ${them}`, who: to, name, + bare: name || !to ? undefined : to, }; } else if (tx.kind === 'received') { // A private payment doesn't say who sent it, but a request's own address does (issue #15). @@ -84,7 +88,9 @@ export function describe( const first = notesOf(tx)[0]; const note = first ? ` Note: ${first}` : ''; const amounts = bothAmounts(amount, price, dollarsFirst, ', '); - return { ...d, spoken: `${d.title}, ${amounts}, ${status}.${note}` }; + // "You paid address ending 4 5 6 7 8 9", not the short form's letters and ellipsis. + const said = d.bare ? d.title.replace(shortAddress(d.bare), spokenAddress(d.bare)) : d.title; + return { ...d, spoken: `${said}, ${amounts}, ${status}.${note}` }; } /** Money that arrived at an exchange address (#53): public, and not in the balance until made private. */ diff --git a/mobile/src/components/address.tsx b/mobile/src/components/address.tsx new file mode 100644 index 0000000..843c479 --- /dev/null +++ b/mobile/src/components/address.tsx @@ -0,0 +1,94 @@ +import { grouped, shortAddress, spokenAddress } from '@wizard/wallet-native'; +import { type StyleProp, StyleSheet, Text, type TextStyle } from 'react-native'; +import { font, size } from '../theme'; +import { themed } from '../use-theme'; +import { CopyText } from './copy'; +import { T } from './text'; + +/** + * An address, drawn the same way everywhere (design guide §5): always in + * Plex Mono, never moving, never under art. Two forms: + * + * - **short** (the default): first 10, an ellipsis, last 6, on one line. It + * stands in for a name in a list row, a chip or a title. With `detail` it is + * the small muted line under a name (§3.1). + * - **full**: every character in groups of four, wrapping only between + * groups. For the places someone checks or copies it. With `copy`, tapping + * anywhere on it copies the whole address. + * + * No part is dimmed or picked out: an address can be made to share its first + * and last characters with someone else's, so the full form is read whole. + * Screen readers hear a short address by its last 6 characters, one by one. + */ +export function Address({ + value, + form = 'short', + detail, + label, + copy, + hint = 'Copies the address', + center, + style, +}: { + value: string; + form?: 'short' | 'full'; + /** Short form under a name: mono 13 in Muted. */ + detail?: boolean; + /** Full form: a label above it, such as "Address" or "Ana’s address". */ + label?: string; + /** Full form: tap to copy, and the label says "Copied" for a moment. */ + copy?: boolean; + hint?: string; + center?: boolean; + style?: StyleProp<TextStyle>; +}) { + const a = useStyles(); + if (form === 'short') { + return ( + <T + kind="mono" + numberOfLines={1} + accessibilityLabel={spokenAddress(value)} + style={[detail ? a.detail : a.name, center && a.center, style]} + > + {shortAddress(value)} + </T> + ); + } + if (copy) + return ( + <CopyText label={label} value={value} display={grouped(value)} hint={hint} center={center} /> + ); + return ( + <> + {label ? <T kind="label">{label}</T> : null} + <T kind="mono" style={[a.full, center && a.center, style]}> + {grouped(value)} + </T> + </> + ); +} + +/** + * A short address inside a sentence, such as "You paid utest1abcd…456789": + * the mono face at 15, in the sentence's colour. Put it inside a `T`. + */ +export function AddressInline({ value }: { value: string }) { + return ( + <Text style={inline.mono} accessibilityLabel={spokenAddress(value)}> + {shortAddress(value)} + </Text> + ); +} + +const inline = StyleSheet.create({ mono: { fontFamily: font.mono, fontSize: size.monoName } }); + +const useStyles = themed((c) => + StyleSheet.create({ + name: { fontSize: size.monoName }, + detail: { color: c.muted }, + // The same line height as CopyText's, so a full address reads alike everywhere. + full: { lineHeight: 20 }, + center: { textAlign: 'center' }, + }), +); diff --git a/mobile/src/components/index.ts b/mobile/src/components/index.ts index d151a97..e28a9a9 100644 --- a/mobile/src/components/index.ts +++ b/mobile/src/components/index.ts @@ -1,5 +1,6 @@ // Shared pieces, after docs/design/wizard-design-guide.md §6–§7. One file // per family; import them from here. +export { Address, AddressInline } from './address'; export { Amount } from './amount'; export { Button, HeaderLink, SignButton, touch } from './buttons'; export { CodeTile } from './code-tile'; diff --git a/mobile/src/components/text.tsx b/mobile/src/components/text.tsx index e7f1af8..1330d4f 100644 --- a/mobile/src/components/text.tsx +++ b/mobile/src/components/text.tsx @@ -16,16 +16,23 @@ export function T({ kind = 'body', selectable, numberOfLines, + accessibilityLabel, }: { children: ReactNode; style?: StyleProp<TextStyle>; kind?: 'body' | 'label' | 'title' | 'mono' | 'dust'; selectable?: boolean; numberOfLines?: number; + accessibilityLabel?: string; }) { const t = useTextStyles(); return ( - <Text style={[t[kind], style]} selectable={selectable} numberOfLines={numberOfLines}> + <Text + style={[t[kind], style]} + selectable={selectable} + numberOfLines={numberOfLines} + accessibilityLabel={accessibilityLabel} + > {children} </Text> ); diff --git a/mobile/src/pay-contact.tsx b/mobile/src/pay-contact.tsx index ae97a7a..2f4cb72 100644 --- a/mobile/src/pay-contact.tsx +++ b/mobile/src/pay-contact.tsx @@ -8,7 +8,12 @@ import { } from '@wizard/wallet-native'; import { useState } from 'react'; import { StyleSheet, View } from 'react-native'; -import { Button, Notice, T } from './components'; +import { + AddressInline, + Button, + Notice, + T, +} from './components'; import { goToAmount } from './navigation'; /** An amount and note to start the amount screen with (Pay again, Try again). */ @@ -97,8 +102,12 @@ export function DriftChoice({ <View style={s.box}> <Notice tone="warning">{`${drift.contact.zcashName} now points to a different address.`}</Notice> <View style={s.rows}> - <T kind="dust">Saved: {shortAddress(drift.contact.address)}</T> - <T kind="dust">Now: {shortAddress(drift.address)}</T> + <T kind="dust"> + Saved: <AddressInline value={drift.contact.address} /> + </T> + <T kind="dust"> + Now: <AddressInline value={drift.address} /> + </T> </View> {drift.error ? <Notice>{drift.error}</Notice> : null} <Button title="Keep paying the saved address" kind="secondary" onPress={onKeep} /> diff --git a/mobile/src/pay-people.test.ts b/mobile/src/pay-people.test.ts index 363a658..9b8e7bd 100644 --- a/mobile/src/pay-people.test.ts +++ b/mobile/src/pay-people.test.ts @@ -16,7 +16,7 @@ group('payPeople', () => { const p = payPeople([bo, ana], recents, ''); if (p.typing) throw new Error('typing'); expect(p.recent.map((x) => x.name)).toEqual(['Ana', null]); - expect(p.recent[0].detail).toBe('ana.zcash'); + expect(p.recent[0].zcashName).toBe('ana.zcash'); expect(p.contacts.map((x) => x.name)).toEqual(['Bo']); }); diff --git a/mobile/src/pay-people.ts b/mobile/src/pay-people.ts index cc3d162..6cf2fa9 100644 --- a/mobile/src/pay-people.ts +++ b/mobile/src/pay-people.ts @@ -1,11 +1,11 @@ -import { type Contact, type Recent, shortAddress } from '@wizard/wallet-native'; +import type { Contact, Recent } from '@wizard/wallet-native'; /** One person on Pay's first screen: a contact, or someone paid recently. */ export type PayPerson = { address: string; name: string | null; - /** The `.zcash` name or short address under the name. */ - detail: string | null; + /** A contact's `.zcash` name, shown under its name instead of the address. */ + zcashName: string | null; contact: Contact | null; }; @@ -22,7 +22,7 @@ function fromContact(c: Contact): PayPerson { return { address: c.address, name: c.name, - detail: c.zcashName ?? shortAddress(c.address), + zcashName: c.zcashName, contact: c, }; } @@ -42,7 +42,7 @@ export function payPeople(contacts: Contact[], recents: Recent[], typed: string) : { address: r.address, name: r.name, - detail: r.name ? shortAddress(r.address) : null, + zcashName: null, contact: null, }; }); diff --git a/mobile/src/theme.ts b/mobile/src/theme.ts index 6b5c41c..787de44 100644 --- a/mobile/src/theme.ts +++ b/mobile/src/theme.ts @@ -125,6 +125,8 @@ export const size = { dust: 15, label: 13, mono: 13, + /** An address in a name's place: a list row, a chip, a sentence (Address). */ + monoName: 15, /** A recovery-phrase word, and what is typed into a secret field. */ monoLarge: 16, /** Button words, and a strong value such as a total. */ diff --git a/mobile/src/who.tsx b/mobile/src/who.tsx index 86a8c9c..42b9f55 100644 --- a/mobile/src/who.tsx +++ b/mobile/src/who.tsx @@ -5,28 +5,28 @@ import { errorText, type Recipient, resolveRecipient, - shortAddress, useWallet, } from '@wizard/wallet-native'; import { router, useNavigation } from 'expo-router'; import { useEffect, useRef, useState } from 'react'; import { Pressable, ScrollView, StyleSheet, View } from 'react-native'; import { NOTHING_TO_PASTE, pasteText } from './clipboard'; -import { Avatar, Button, Notice, Screen, ScreenHeader, T, TextField } from './components'; +import { Address, Avatar, Button, Notice, Screen, ScreenHeader, T, TextField } from './components'; import { goToAmount } from './navigation'; import { DriftChoice, usePayContact } from './pay-contact'; import { type PayPerson, payPeople } from './pay-people'; import { themed } from './use-theme'; +/** A name with its `.zcash` name or short address beneath; a bare address alone. */ function Person({ name, - detail, + zcashName, address, busy, onPress, }: { name: string | null; - detail: string | null; + zcashName: string | null; address: string; busy?: boolean; onPress: () => void; @@ -42,11 +42,13 @@ function Person({ > <Avatar name={name} address={address} size={40} /> <View style={{ flex: 1 }}> - <T numberOfLines={1}>{name ?? shortAddress(address)}</T> - {detail ? ( + {name ? <T numberOfLines={1}>{name}</T> : <Address value={address} />} + {name && zcashName ? ( <T kind="dust" numberOfLines={1}> - {detail} + {zcashName} </T> + ) : name ? ( + <Address value={address} detail /> ) : null} </View> </Pressable> @@ -133,7 +135,7 @@ export function Who({ ask = false }: { ask?: boolean }) { <Person key={p.address} name={p.name} - detail={p.detail} + zcashName={p.zcashName} address={p.address} busy={payer.checking === p.address} onPress={() => pick(p)} diff --git a/wallet-native/src/format.test.ts b/wallet-native/src/format.test.ts index d7f454b..c62b5ab 100644 --- a/wallet-native/src/format.test.ts +++ b/wallet-native/src/format.test.ts @@ -16,6 +16,7 @@ import { requestPageLink, requestShareText, shortAddress, + spokenAddress, signedUsd, signedZec, usd, @@ -89,6 +90,10 @@ describe('addresses', () => { expect(grouped('abcdefghij')).toBe('abcd efgh ij'); expect(grouped(a).replace(/ /g, '')).toBe(a); }); + it('speaks the last 6 characters one by one', () => { + expect(spokenAddress(a)).toBe('address ending 4 5 6 7 8 9'); + expect(spokenAddress('short')).toBe('s h o r t'); + }); }); describe('aboutMinutes', () => { diff --git a/wallet-native/src/format.ts b/wallet-native/src/format.ts index 2d42bda..8a6a476 100644 --- a/wallet-native/src/format.ts +++ b/wallet-native/src/format.ts @@ -124,6 +124,15 @@ export function grouped(a: string): string { return a.replace(/(.{4})/g, '$1 ').trim(); } +/** + * What a screen reader says for an address: its last 6 characters one by one, + * the same ones the short form ends with, so they can be compared by ear. + * Reading a whole address aloud takes over a minute. + */ +export function spokenAddress(a: string): string { + return a.length <= 18 ? a.split('').join(' ') : `address ending ${a.slice(-6).split('').join(' ')}`; +} + /** "about 4 min" from blocks left; "under a minute" for one or two blocks. */ export function aboutMinutes(blocks: number): string { const min = Math.ceil((blocks * BLOCK_SECONDS) / 60); From ed0155109efbdc4b9921ebd32fb5f0ca6f2a6560 Mon Sep 17 00:00:00 2001 From: Gregory Fong <gf5901@gmail.com> Date: Mon, 16 Nov 2026 15:25:49 -0800 Subject: [PATCH 2/7] feat(app): every other group of a full address in Muted A full address is ~36 groups over 5-7 lines. Alternating Text and Muted helps someone keep their place while comparing it group by group. Every group weighs the same, so it doesn't favour the ends the way a highlight would. Spaces stay, so colour is never the only separator. Muted passes AA on every ground (6.6-8.3:1). The same in the native confirm and contact sheets (AddressText in Kit.swift, Kit.address in Kit.kt). The short form stays one colour. Also drops imports and formatting left over from the first commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- mobile/app/(tabs)/receive.tsx | 3 +- mobile/app/contacts/[address].tsx | 13 +------ mobile/app/contacts/add.tsx | 2 - mobile/app/contacts/edit.tsx | 8 +--- mobile/app/exchange-address.tsx | 3 +- mobile/app/tx/[txid].tsx | 16 ++------ mobile/src/components/address.tsx | 38 +++++++++++++++---- mobile/src/components/copy.tsx | 7 +++- mobile/src/pay-contact.tsx | 8 +--- .../wizard/wallet/ConfirmSheet.kt | 2 +- .../wizard/wallet/ContactSheet.kt | 3 +- .../principlezerolabs/wizard/wallet/Kit.kt | 24 ++++++++++++ wallet-native/ios/ConfirmSheet.swift | 10 ++--- wallet-native/ios/ContactSheet.swift | 4 +- wallet-native/ios/Kit.swift | 17 +++++++++ wallet-native/src/format.test.ts | 2 +- wallet-native/src/format.ts | 4 +- 17 files changed, 98 insertions(+), 66 deletions(-) diff --git a/mobile/app/(tabs)/receive.tsx b/mobile/app/(tabs)/receive.tsx index dc38d42..6d273c7 100644 --- a/mobile/app/(tabs)/receive.tsx +++ b/mobile/app/(tabs)/receive.tsx @@ -1,4 +1,4 @@ -import { grouped, useWallet } from '@wizard/wallet-native'; +import { useWallet } from '@wizard/wallet-native'; import { router, useFocusEffect } from 'expo-router'; import { useCallback, useRef } from 'react'; import { Pressable, ScrollView, Share, StyleSheet, View } from 'react-native'; @@ -7,7 +7,6 @@ import { Address, Button, CodeTile, - CopyText, Notice, Screen, ScreenHeader, diff --git a/mobile/app/contacts/[address].tsx b/mobile/app/contacts/[address].tsx index 42023ee..b67062b 100644 --- a/mobile/app/contacts/[address].tsx +++ b/mobile/app/contacts/[address].tsx @@ -1,19 +1,10 @@ -import { contactFor, contactRecipient, grouped, useNames, useWallet } from '@wizard/wallet-native'; +import { contactFor, contactRecipient, useNames, useWallet } from '@wizard/wallet-native'; import { router, useLocalSearchParams } from 'expo-router'; import { Fragment, useMemo } from 'react'; import { Pressable, ScrollView, StyleSheet, View } from 'react-native'; import { sentTo } from '../../src/activity'; import { ActivityRow, RowSeparator, useFresh } from '../../src/activity-row'; -import { - Address, - Avatar, - Button, - CopyText, - HeaderLink, - Screen, - ScreenHeader, - T, -} from '../../src/components'; +import { Address, Avatar, Button, HeaderLink, Screen, ScreenHeader, T } from '../../src/components'; import { goToAmount, goToEditContact } from '../../src/navigation'; import { DriftChoice, usePayContact } from '../../src/pay-contact'; import { RequestRow } from '../../src/request-row'; diff --git a/mobile/app/contacts/add.tsx b/mobile/app/contacts/add.tsx index 3a56726..fffe55d 100644 --- a/mobile/app/contacts/add.tsx +++ b/mobile/app/contacts/add.tsx @@ -2,11 +2,9 @@ import { CONTACT_NAME_MAX, contactFor, errorText, - grouped, normaliseName, type Recipient, resolveRecipient, - shortAddress, spokenAddress, suggestedName, useWallet, diff --git a/mobile/app/contacts/edit.tsx b/mobile/app/contacts/edit.tsx index 8939fd0..5505e23 100644 --- a/mobile/app/contacts/edit.tsx +++ b/mobile/app/contacts/edit.tsx @@ -1,10 +1,4 @@ -import { - CONTACT_NAME_MAX, - contactFor, - errorText, - shortAddress, - useWallet, -} from '@wizard/wallet-native'; +import { CONTACT_NAME_MAX, contactFor, errorText, useWallet } from '@wizard/wallet-native'; import { router, useLocalSearchParams } from 'expo-router'; import { useState } from 'react'; import { Alert, Pressable, ScrollView, StyleSheet, View } from 'react-native'; diff --git a/mobile/app/exchange-address.tsx b/mobile/app/exchange-address.tsx index 1b48ce3..56df6c1 100644 --- a/mobile/app/exchange-address.tsx +++ b/mobile/app/exchange-address.tsx @@ -1,11 +1,10 @@ -import { grouped, useWallet } from '@wizard/wallet-native'; +import { useWallet } from '@wizard/wallet-native'; import { router } from 'expo-router'; import { ScrollView, Share, StyleSheet, View } from 'react-native'; import { Address, Button, CodeTile, - CopyText, Notice, Screen, ScreenHeader, diff --git a/mobile/app/tx/[txid].tsx b/mobile/app/tx/[txid].tsx index 4af0b0d..712be56 100644 --- a/mobile/app/tx/[txid].tsx +++ b/mobile/app/tx/[txid].tsx @@ -1,10 +1,8 @@ import { type Contact, contactFor, - grouped, type PastPrice, parseRequestMemo, - shortAddress, type Tx, usd, useNames, @@ -299,11 +297,7 @@ function Title({ const line = ( <T style={s.title}> {lead} - {name ? ( - <Text style={s.titleName}>{name}</Text> - ) : ( - <AddressInline value={to} /> - )} + {name ? <Text style={s.titleName}>{name}</Text> : <AddressInline value={to} />} </T> ); if (!contact) return line; @@ -445,17 +439,13 @@ function Technical({ const n = nameOf(a); return { key: `to-${a}`, - node: ( - <Address value={a} form="full" label={n ? `${n}’s address` : 'Their address'} copy /> - ), + node: <Address value={a} form="full" label={n ? `${n}’s address` : 'Their address'} copy />, }; }); if (tx.receivedOn) rows.push({ key: 'on', - node: ( - <Address value={tx.receivedOn} form="full" label="Received on your address" copy /> - ), + node: <Address value={tx.receivedOn} form="full" label="Received on your address" copy />, }); rows.push({ key: 'id', diff --git a/mobile/src/components/address.tsx b/mobile/src/components/address.tsx index 843c479..6f7faa4 100644 --- a/mobile/src/components/address.tsx +++ b/mobile/src/components/address.tsx @@ -13,11 +13,12 @@ import { T } from './text'; * stands in for a name in a list row, a chip or a title. With `detail` it is * the small muted line under a name (§3.1). * - **full**: every character in groups of four, wrapping only between - * groups. For the places someone checks or copies it. With `copy`, tapping - * anywhere on it copies the whole address. + * groups, every other group in Muted. For the places someone checks or + * copies it. With `copy`, tapping anywhere on it copies the whole address. * - * No part is dimmed or picked out: an address can be made to share its first - * and last characters with someone else's, so the full form is read whole. + * The ends are never picked out: an address can be made to share its first + * and last characters with someone else's, so the full form is read whole, + * and its alternating groups weigh every part the same. * Screen readers hear a short address by its last 6 characters, one by one. */ export function Address({ @@ -55,20 +56,43 @@ export function Address({ </T> ); } + const groups = <Groups value={value} />; if (copy) return ( - <CopyText label={label} value={value} display={grouped(value)} hint={hint} center={center} /> + <CopyText label={label} value={value} display={grouped(value)} hint={hint} center={center}> + {groups} + </CopyText> ); return ( <> {label ? <T kind="label">{label}</T> : null} - <T kind="mono" style={[a.full, center && a.center, style]}> - {grouped(value)} + <T + kind="mono" + accessibilityLabel={grouped(value)} + style={[a.full, center && a.center, style]} + > + {groups} </T> </> ); } +/** + * The full form's groups of four, every other one in Muted (both pass AA on + * every ground), so a long address keeps its place when compared. The spaces + * stay, so the colour is never the only thing that separates them. + */ +function Groups({ value }: { value: string }) { + const a = useStyles(); + const groups = grouped(value).split(' '); + return groups.map((g, i) => ( + // biome-ignore lint/suspicious/noArrayIndexKey: groups repeat, and their order never changes. + <Text key={i} style={i % 2 === 1 && a.detail}> + {i < groups.length - 1 ? `${g} ` : g} + </Text> + )); +} + /** * A short address inside a sentence, such as "You paid utest1abcd…456789": * the mono face at 15, in the sentence's colour. Put it inside a `T`. diff --git a/mobile/src/components/copy.tsx b/mobile/src/components/copy.tsx index 2b86b29..6f74497 100644 --- a/mobile/src/components/copy.tsx +++ b/mobile/src/components/copy.tsx @@ -1,5 +1,5 @@ import * as Clipboard from 'expo-clipboard'; -import { useCallback, useEffect, useRef, useState } from 'react'; +import { type ReactNode, useCallback, useEffect, useRef, useState } from 'react'; import { AccessibilityInfo, Animated, Pressable, StyleSheet } from 'react-native'; import { haptic } from '../haptics'; import { duration, useFade } from '../motion'; @@ -36,6 +36,7 @@ export function CopyText({ display = value, hint = 'Copies it', center, + children, }: { label?: string; value: string; @@ -43,6 +44,8 @@ export function CopyText({ display?: string; hint?: string; center?: boolean; + /** Draws the value instead of `display` in plain mono, such as an address's coloured groups. */ + children?: ReactNode; }) { const [copied, copy] = useCopy(); const shown = label ? (copied ? `${label} · Copied` : label) : copied ? 'Copied' : null; @@ -56,7 +59,7 @@ export function CopyText({ > {shown ? <Label key={copied ? 'copied' : 'label'} text={shown} fade={copied} /> : null} <T kind="mono" style={[cx.value, center && cx.centerText]}> - {display} + {children ?? display} </T> </Pressable> ); diff --git a/mobile/src/pay-contact.tsx b/mobile/src/pay-contact.tsx index 2f4cb72..f23d4ec 100644 --- a/mobile/src/pay-contact.tsx +++ b/mobile/src/pay-contact.tsx @@ -3,17 +3,11 @@ import { checkContact, contactRecipient, errorText, - shortAddress, useWallet, } from '@wizard/wallet-native'; import { useState } from 'react'; import { StyleSheet, View } from 'react-native'; -import { - AddressInline, - Button, - Notice, - T, -} from './components'; +import { AddressInline, Button, Notice, T } from './components'; import { goToAmount } from './navigation'; /** An amount and note to start the amount screen with (Pay again, Try again). */ diff --git a/wallet-native/android/src/main/java/com/principlezerolabs/wizard/wallet/ConfirmSheet.kt b/wallet-native/android/src/main/java/com/principlezerolabs/wizard/wallet/ConfirmSheet.kt index e690a29..66a6156 100644 --- a/wallet-native/android/src/main/java/com/principlezerolabs/wizard/wallet/ConfirmSheet.kt +++ b/wallet-native/android/src/main/java/com/principlezerolabs/wizard/wallet/ConfirmSheet.kt @@ -128,7 +128,7 @@ object ConfirmSheet { } else { val to = LinearLayout(activity).apply { orientation = LinearLayout.VERTICAL } if (label != null) to.addView(text(label, TextKind.STRONG)) - for (a in proposal.to) to.addView(text(Format.grouped(a), TextKind.MONO).apply { setTextIsSelectable(true) }) + for (a in proposal.to) to.addView(Kit.address(activity, a)) // A public address says so (#54). when (proposal.recipient) { WalletRecipientKind.PUBLIC -> "Public address" diff --git a/wallet-native/android/src/main/java/com/principlezerolabs/wizard/wallet/ContactSheet.kt b/wallet-native/android/src/main/java/com/principlezerolabs/wizard/wallet/ContactSheet.kt index c0cb5f7..93447ad 100644 --- a/wallet-native/android/src/main/java/com/principlezerolabs/wizard/wallet/ContactSheet.kt +++ b/wallet-native/android/src/main/java/com/principlezerolabs/wizard/wallet/ContactSheet.kt @@ -29,8 +29,7 @@ object ContactSheet { // Who the user pays: the sheet keeps it out of the recent-apps preview. val (dialog, body) = Kit.bottomSheet(activity) fun add(v: View, top: Int = 12) = Kit.add(body, v, top) - fun mono(s: String) = - Kit.text(activity, Format.grouped(s), TextKind.MONO).apply { setTextIsSelectable(true) } + fun mono(s: String) = Kit.address(activity, s) var done = false fun finish(ok: Boolean) { diff --git a/wallet-native/android/src/main/java/com/principlezerolabs/wizard/wallet/Kit.kt b/wallet-native/android/src/main/java/com/principlezerolabs/wizard/wallet/Kit.kt index 6a2112e..c89f7e3 100644 --- a/wallet-native/android/src/main/java/com/principlezerolabs/wizard/wallet/Kit.kt +++ b/wallet-native/android/src/main/java/com/principlezerolabs/wizard/wallet/Kit.kt @@ -6,6 +6,9 @@ import android.app.Dialog import android.graphics.Color import android.graphics.drawable.GradientDrawable import android.graphics.drawable.InsetDrawable +import android.text.SpannableString +import android.text.Spanned +import android.text.style.ForegroundColorSpan import android.view.Gravity import android.view.View import android.view.ViewGroup.LayoutParams.MATCH_PARENT @@ -126,6 +129,27 @@ object Kit { setTextColor(color ?: if (kind.muted) Theme.muted else Theme.text) } + /** + * A full address, as React Native's `Address form="full"` (design guide §5): + * groups of four in Plex Mono 13, every other group in Muted so a long + * address keeps its place when compared. Selectable; copies without colour. + */ + fun address(activity: Activity, address: String) = + text(activity, "", TextKind.MONO).apply { + val shown = SpannableString(Format.grouped(address)) + for (i in 1 until (address.length + 3) / 4 step 2) { + val start = i * 5 + shown.setSpan( + ForegroundColorSpan(Theme.muted), + start, + minOf(start + 4, shown.length), + Spanned.SPAN_EXCLUSIVE_EXCLUSIVE, + ) + } + text = shown + setTextIsSelectable(true) + } + /** * React Native's `Button`: a 52dp capsule in Figtree SemiBold 17. * PRIMARY is the one filled button on a screen. SECONDARY has a hairline diff --git a/wallet-native/ios/ConfirmSheet.swift b/wallet-native/ios/ConfirmSheet.swift index fe98867..9018433 100644 --- a/wallet-native/ios/ConfirmSheet.swift +++ b/wallet-native/ios/ConfirmSheet.swift @@ -30,11 +30,11 @@ enum Format { } /// The whole address in groups of four, so every character is visible. - static func grouped(_ address: String) -> String { - var out = "" + static func groups(_ address: String) -> [String] { + var out: [String] = [] for (i, c) in address.enumerated() { - if i > 0 && i % 4 == 0 { out.append(" ") } - out.append(c) + if i % 4 == 0 { out.append("") } + out[out.count - 1].append(c) } return out } @@ -150,7 +150,7 @@ struct ConfirmSheet: View { VStack(alignment: .leading, spacing: 4) { if let label { Text(label).kit(.strong) } ForEach(proposal.to, id: \.self) { a in - Text(Format.grouped(a)).kit(.mono).textSelection(.enabled) + AddressText(a) } if let kind = publicKind { Text(kind).font(Face.labelStrong).foregroundColor(Palette.accent) diff --git a/wallet-native/ios/ContactSheet.swift b/wallet-native/ios/ContactSheet.swift index c476ba9..3c9faad 100644 --- a/wallet-native/ios/ContactSheet.swift +++ b/wallet-native/ios/ContactSheet.swift @@ -45,7 +45,5 @@ struct ContactSheet: View { } } - private func mono(_ address: String) -> some View { - Text(Format.grouped(address)).kit(.mono).textSelection(.enabled) - } + private func mono(_ address: String) -> some View { AddressText(address) } } diff --git a/wallet-native/ios/Kit.swift b/wallet-native/ios/Kit.swift index 7222c7b..f70fcdc 100644 --- a/wallet-native/ios/Kit.swift +++ b/wallet-native/ios/Kit.swift @@ -171,6 +171,23 @@ struct KitPage<Content: View>: View { } } +/// A full address, as React Native's `Address form="full"` (design guide §5): +/// groups of four in Plex Mono 13, every other group in Muted so a long +/// address keeps its place when compared. Selectable; copies without colour. +struct AddressText: View { + let address: String + init(_ address: String) { self.address = address } + + var body: some View { + Format.groups(address).enumerated().reduce(Text("")) { line, g in + line + Text(g.offset == 0 ? g.element : " \(g.element)") + .foregroundColor(g.offset % 2 == 0 ? Palette.text : Palette.muted) + } + .font(Face.mono) + .textSelection(.enabled) + } +} + /// A named value on a review sheet: the name in a label, the value under it. struct DetailRow<Value: View>: View { let name: String diff --git a/wallet-native/src/format.test.ts b/wallet-native/src/format.test.ts index c62b5ab..bb1e894 100644 --- a/wallet-native/src/format.test.ts +++ b/wallet-native/src/format.test.ts @@ -16,9 +16,9 @@ import { requestPageLink, requestShareText, shortAddress, - spokenAddress, signedUsd, signedZec, + spokenAddress, usd, usdText, usdToZats, diff --git a/wallet-native/src/format.ts b/wallet-native/src/format.ts index 8a6a476..80dbe41 100644 --- a/wallet-native/src/format.ts +++ b/wallet-native/src/format.ts @@ -130,7 +130,9 @@ export function grouped(a: string): string { * Reading a whole address aloud takes over a minute. */ export function spokenAddress(a: string): string { - return a.length <= 18 ? a.split('').join(' ') : `address ending ${a.slice(-6).split('').join(' ')}`; + return a.length <= 18 + ? a.split('').join(' ') + : `address ending ${a.slice(-6).split('').join(' ')}`; } /** "about 4 min" from blocks left; "under a minute" for one or two blocks. */ From 2a5964ca091e4691cc612f17888c68062f6ab798 Mon Sep 17 00:00:00 2001 From: Gregory Fong <gf5901@gmail.com> Date: Mon, 16 Nov 2026 15:25:56 -0800 Subject: [PATCH 3/7] docs(design): full addresses alternate Text and Muted groups Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- docs/design/wizard-design-guide.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/design/wizard-design-guide.md b/docs/design/wizard-design-guide.md index ad76f7d..cac2988 100644 --- a/docs/design/wizard-design-guide.md +++ b/docs/design/wizard-design-guide.md @@ -148,9 +148,9 @@ Screens name the role, never the theme's colour (`c.text`, not `color.star`). |---|---|---| | **Short** | `utest1abcd…456789`, mono 15 in Text, one line | In a name's place: a list row, the amount screen's chip, a title. Inside a sentence ("You paid …") it is `AddressInline`, mono in the sentence's colour | | **Short, under a name** (`detail`) | Mono 13 in Muted | The line under a contact's or person's name, when there is no `.zcash` name to show instead | - | **Full** | Every character in groups of 4, mono 13, wrapping only between groups | Where someone checks or copies it: Receive, the exchange address, a contact page, Technical details, Add a contact. With `copy`, tapping anywhere on it copies the whole address and its label says "Copied" | + | **Full** | Every character in groups of 4, mono 13, wrapping only between groups; every other group in Muted | Where someone checks or copies it: Receive, the exchange address, a contact page, Technical details, Add a contact. With `copy`, tapping anywhere on it copies the whole address and its label says "Copied" | - No part of an address is dimmed or highlighted. Someone can make an address that starts and ends like yours (address poisoning), so the full form asks for every group to be read, not just the ends. Screen readers hear a short address as "address ending" and its last 6 characters one by one, the same ones the short form ends with; the full form is read group by group. The native confirmation and contact sheets draw the full form the same way (`Format.grouped`, mono, selectable). + No part of an address is dimmed or highlighted. Someone can make an address that starts and ends like yours (address poisoning), so the full form asks for every group to be read, not just the ends. The alternating groups help with that: a full address runs to about 36 groups over five to seven lines, and the change of colour keeps your place while comparing it with another screen. Every group weighs the same, and the spaces stay, so colour is never the only thing that separates them. Muted passes AA on every ground (6.6–8.3:1). The short form stays one colour. Screen readers hear a short address as "address ending" and its last 6 characters one by one, the same ones the short form ends with; the full form is read group by group. The native confirmation and contact sheets draw the full form the same way (`AddressText` in `Kit.swift`, `Kit.address` in `Kit.kt`; mono, selectable). ## 6. Shape, space and motion From efe8bef3aca6c23275921c5e0e29e4cfc404fbc9 Mon Sep 17 00:00:00 2001 From: Gregory Fong <gf5901@gmail.com> Date: Mon, 16 Nov 2026 15:46:13 -0800 Subject: [PATCH 4/7] feat(app): a full address stands in columns, each with its own colour Alternating per group checkerboarded once text wrapped wherever it ran out of room, and centred lines shifted sideways. Now a full address is laid out in lines of as many groups as fit (8, 6, 4 or 2: always even), sharing one left edge, so the groups stand in columns: odd ones in Text, even ones in Muted. Larger text gets fewer columns, never a wrapped line. RN measures its width (groupsPerRow, addressRows in format.ts), iOS picks the widest layout with ViewThatFits, and Android re-lines its TextView once laid out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- docs/design/wizard-design-guide.md | 4 +- mobile/src/components/address.tsx | 98 ++++++++++++++----- mobile/src/components/copy.tsx | 10 +- .../wizard/wallet/ConfirmSheet.kt | 16 ++- .../principlezerolabs/wizard/wallet/Kit.kt | 40 +++++--- wallet-native/ios/ConfirmSheet.swift | 15 +-- wallet-native/ios/Kit.swift | 25 ++++- wallet-native/src/format.test.ts | 15 +++ wallet-native/src/format.ts | 21 ++++ 9 files changed, 186 insertions(+), 58 deletions(-) diff --git a/docs/design/wizard-design-guide.md b/docs/design/wizard-design-guide.md index cac2988..7dffdd7 100644 --- a/docs/design/wizard-design-guide.md +++ b/docs/design/wizard-design-guide.md @@ -148,9 +148,9 @@ Screens name the role, never the theme's colour (`c.text`, not `color.star`). |---|---|---| | **Short** | `utest1abcd…456789`, mono 15 in Text, one line | In a name's place: a list row, the amount screen's chip, a title. Inside a sentence ("You paid …") it is `AddressInline`, mono in the sentence's colour | | **Short, under a name** (`detail`) | Mono 13 in Muted | The line under a contact's or person's name, when there is no `.zcash` name to show instead | - | **Full** | Every character in groups of 4, mono 13, wrapping only between groups; every other group in Muted | Where someone checks or copies it: Receive, the exchange address, a contact page, Technical details, Add a contact. With `copy`, tapping anywhere on it copies the whole address and its label says "Copied" | + | **Full** | Every character in groups of 4, mono 13, in lines of as many groups as fit (8, 6, 4 or 2, always even) so the groups stand in columns: odd columns in Text, even ones in Muted. Lines share one left edge, even when the block is centred | Where someone checks or copies it: Receive, the exchange address, a contact page, Technical details, Add a contact. With `copy`, tapping anywhere on it copies the whole address and its label says "Copied" | - No part of an address is dimmed or highlighted. Someone can make an address that starts and ends like yours (address poisoning), so the full form asks for every group to be read, not just the ends. The alternating groups help with that: a full address runs to about 36 groups over five to seven lines, and the change of colour keeps your place while comparing it with another screen. Every group weighs the same, and the spaces stay, so colour is never the only thing that separates them. Muted passes AA on every ground (6.6–8.3:1). The short form stays one colour. Screen readers hear a short address as "address ending" and its last 6 characters one by one, the same ones the short form ends with; the full form is read group by group. The native confirmation and contact sheets draw the full form the same way (`AddressText` in `Kit.swift`, `Kit.address` in `Kit.kt`; mono, selectable). + No part of an address is dimmed or highlighted. Someone can make an address that starts and ends like yours (address poisoning), so the full form asks for every group to be read, not just the ends. The columns help with that: a full address runs to about 36 groups over five to seven lines, and a column's colour keeps your place, across and down, while comparing it with another screen. Every column weighs the same, and the spaces stay, so colour is never the only thing that separates the groups. Larger text gets fewer columns, never a wrapped line, so the columns hold at every text size. Muted passes AA on every ground (6.6–8.3:1). The short form stays one colour. Screen readers hear a short address as "address ending" and its last 6 characters one by one, the same ones the short form ends with; the full form is read group by group. The native confirmation and contact sheets draw the full form the same way (`AddressText` in `Kit.swift`, `Kit.address` in `Kit.kt`; mono, selectable). ## 6. Shape, space and motion diff --git a/mobile/src/components/address.tsx b/mobile/src/components/address.tsx index 6f7faa4..6a9794f 100644 --- a/mobile/src/components/address.tsx +++ b/mobile/src/components/address.tsx @@ -1,6 +1,21 @@ -import { grouped, shortAddress, spokenAddress } from '@wizard/wallet-native'; -import { type StyleProp, StyleSheet, Text, type TextStyle } from 'react-native'; -import { font, size } from '../theme'; +import { + addressRows, + grouped, + groupsPerRow, + shortAddress, + spokenAddress, +} from '@wizard/wallet-native'; +import { Fragment, useState } from 'react'; +import { + PixelRatio, + type StyleProp, + StyleSheet, + Text, + type TextStyle, + useWindowDimensions, + View, +} from 'react-native'; +import { font, size, space } from '../theme'; import { themed } from '../use-theme'; import { CopyText } from './copy'; import { T } from './text'; @@ -12,13 +27,14 @@ import { T } from './text'; * - **short** (the default): first 10, an ellipsis, last 6, on one line. It * stands in for a name in a list row, a chip or a title. With `detail` it is * the small muted line under a name (§3.1). - * - **full**: every character in groups of four, wrapping only between - * groups, every other group in Muted. For the places someone checks or + * - **full**: every character in groups of four, in lines of as many groups + * as fit (an even number, at most 8), so the groups stand in columns: + * odd columns in Text, even ones in Muted. For the places someone checks or * copies it. With `copy`, tapping anywhere on it copies the whole address. * * The ends are never picked out: an address can be made to share its first * and last characters with someone else's, so the full form is read whole, - * and its alternating groups weigh every part the same. + * and its columns weigh every part the same. * Screen readers hear a short address by its last 6 characters, one by one. */ export function Address({ @@ -56,41 +72,67 @@ export function Address({ </T> ); } - const groups = <Groups value={value} />; + const columns = <Columns value={value} center={center} style={style} />; if (copy) return ( <CopyText label={label} value={value} display={grouped(value)} hint={hint} center={center}> - {groups} + {columns} </CopyText> ); return ( <> {label ? <T kind="label">{label}</T> : null} - <T - kind="mono" - accessibilityLabel={grouped(value)} - style={[a.full, center && a.center, style]} - > - {groups} - </T> + {columns} </> ); } +/** Plex Mono's advance: every character is 0.6 of the font size wide. */ +const MONO_ADVANCE = 0.6; + /** - * The full form's groups of four, every other one in Muted (both pass AA on - * every ground), so a long address keeps its place when compared. The spaces - * stay, so the colour is never the only thing that separates them. + * The full form as columns of groups (design guide §5): lines start at the + * same edge, so each column keeps its colour down the address. Odd columns in + * Text, even ones in Muted (both pass AA on every ground). The spaces stay, so + * colour is never the only thing that separates the groups. The width is + * measured, and guessed from the window until it is, so larger text gets + * fewer columns instead of a line that wraps. */ -function Groups({ value }: { value: string }) { +function Columns({ + value, + center, + style, +}: { + value: string; + center?: boolean; + style?: StyleProp<TextStyle>; +}) { const a = useStyles(); - const groups = grouped(value).split(' '); - return groups.map((g, i) => ( - // biome-ignore lint/suspicious/noArrayIndexKey: groups repeat, and their order never changes. - <Text key={i} style={i % 2 === 1 && a.detail}> - {i < groups.length - 1 ? `${g} ` : g} - </Text> - )); + const { width: window } = useWindowDimensions(); + const [width, setWidth] = useState(window - 2 * space.gutter); + const charWidth = size.mono * MONO_ADVANCE * PixelRatio.getFontScale(); + const rows = addressRows(value, groupsPerRow(width, charWidth)); + return ( + <View + onLayout={(e) => setWidth(e.nativeEvent.layout.width)} + style={[a.box, center && a.centered]} + > + <T kind="mono" accessibilityLabel={grouped(value)} style={[a.full, style]}> + {rows.map((row, r) => ( + // biome-ignore lint/suspicious/noArrayIndexKey: lines repeat, and their order never changes. + <Fragment key={r}> + {r > 0 ? '\n' : null} + {row.map((g, c) => ( + // biome-ignore lint/suspicious/noArrayIndexKey: as above. + <Text key={c} style={c % 2 === 1 && a.detail}> + {c > 0 ? ` ${g}` : g} + </Text> + ))} + </Fragment> + ))} + </T> + </View> + ); } /** @@ -114,5 +156,9 @@ const useStyles = themed((c) => // The same line height as CopyText's, so a full address reads alike everywhere. full: { lineHeight: 20 }, center: { textAlign: 'center' }, + // Its parent's full width, measured for the columns; centred, the block + // sits in the middle while its lines keep one left edge. + box: { alignSelf: 'stretch', alignItems: 'flex-start' }, + centered: { alignItems: 'center' }, }), ); diff --git a/mobile/src/components/copy.tsx b/mobile/src/components/copy.tsx index 6f74497..7db9a9b 100644 --- a/mobile/src/components/copy.tsx +++ b/mobile/src/components/copy.tsx @@ -44,7 +44,7 @@ export function CopyText({ display?: string; hint?: string; center?: boolean; - /** Draws the value instead of `display` in plain mono, such as an address's coloured groups. */ + /** Drawn instead of `display` in plain mono, such as an address's columns; it centres itself. */ children?: ReactNode; }) { const [copied, copy] = useCopy(); @@ -58,9 +58,11 @@ export function CopyText({ style={({ pressed }) => [cx.block, center && cx.center, pressed && touch.pressed]} > {shown ? <Label key={copied ? 'copied' : 'label'} text={shown} fade={copied} /> : null} - <T kind="mono" style={[cx.value, center && cx.centerText]}> - {children ?? display} - </T> + {children ?? ( + <T kind="mono" style={[cx.value, center && cx.centerText]}> + {display} + </T> + )} </Pressable> ); } diff --git a/wallet-native/android/src/main/java/com/principlezerolabs/wizard/wallet/ConfirmSheet.kt b/wallet-native/android/src/main/java/com/principlezerolabs/wizard/wallet/ConfirmSheet.kt index 66a6156..e117546 100644 --- a/wallet-native/android/src/main/java/com/principlezerolabs/wizard/wallet/ConfirmSheet.kt +++ b/wallet-native/android/src/main/java/com/principlezerolabs/wizard/wallet/ConfirmSheet.kt @@ -31,8 +31,20 @@ object Format { fun usd(zatoshis: ULong, usdPerZec: Double): String = String.format(Locale.US, "$%,.2f", zatoshis.toDouble() / 100_000_000.0 * usdPerZec) - /** The whole address in groups of four, so every character is visible. */ - fun grouped(address: String): String = address.chunked(4).joinToString(" ") + /** + * The whole address in groups of four, `perRow` to a line, so every character + * is visible and the groups stand in columns. + */ + fun rows(address: String, perRow: Int): List<List<String>> = address.chunked(4).chunked(perRow) + + /** + * As many groups as fit on a line of `width`, at most 8, always even so each + * column keeps its colour; one character kept spare (format.ts `groupsPerRow`). + */ + fun groupsPerRow(width: Float, charWidth: Float): Int { + val fit = (width / charWidth).toInt() / 5 + return (fit - fit % 2).coerceIn(2, 8) + } } /** diff --git a/wallet-native/android/src/main/java/com/principlezerolabs/wizard/wallet/Kit.kt b/wallet-native/android/src/main/java/com/principlezerolabs/wizard/wallet/Kit.kt index c89f7e3..b65b49f 100644 --- a/wallet-native/android/src/main/java/com/principlezerolabs/wizard/wallet/Kit.kt +++ b/wallet-native/android/src/main/java/com/principlezerolabs/wizard/wallet/Kit.kt @@ -6,7 +6,7 @@ import android.app.Dialog import android.graphics.Color import android.graphics.drawable.GradientDrawable import android.graphics.drawable.InsetDrawable -import android.text.SpannableString +import android.text.SpannableStringBuilder import android.text.Spanned import android.text.style.ForegroundColorSpan import android.view.Gravity @@ -131,22 +131,36 @@ object Kit { /** * A full address, as React Native's `Address form="full"` (design guide §5): - * groups of four in Plex Mono 13, every other group in Muted so a long - * address keeps its place when compared. Selectable; copies without colour. + * groups of four in Plex Mono 13, in lines of as many groups as fit (an even + * number, at most 8), so the groups stand in columns, odd ones in Text and + * even ones in Muted. It re-lines itself once its width is known, so larger + * text gets fewer columns, never a wrapped line. Selectable; copies without colour. */ fun address(activity: Activity, address: String) = text(activity, "", TextKind.MONO).apply { - val shown = SpannableString(Format.grouped(address)) - for (i in 1 until (address.length + 3) / 4 step 2) { - val start = i * 5 - shown.setSpan( - ForegroundColorSpan(Theme.muted), - start, - minOf(start + 4, shown.length), - Spanned.SPAN_EXCLUSIVE_EXCLUSIVE, - ) + var perRow = 0 + fun show(n: Int) { + if (n == perRow) return + perRow = n + val shown = SpannableStringBuilder() + Format.rows(address, n).forEachIndexed { r, row -> + if (r > 0) shown.append("\n") + row.forEachIndexed { c, g -> + if (c > 0) shown.append(" ") + val start = shown.length + shown.append(g) + if (c % 2 == 1) { + shown.setSpan(ForegroundColorSpan(Theme.muted), start, shown.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE) + } + } + } + text = shown + } + show(6) + addOnLayoutChangeListener { _, left, _, right, _, _, _, _, _ -> + val width = right - left - paddingLeft - paddingRight + if (width > 0) post { show(Format.groupsPerRow(width.toFloat(), paint.measureText("0"))) } } - text = shown setTextIsSelectable(true) } diff --git a/wallet-native/ios/ConfirmSheet.swift b/wallet-native/ios/ConfirmSheet.swift index 9018433..3f44796 100644 --- a/wallet-native/ios/ConfirmSheet.swift +++ b/wallet-native/ios/ConfirmSheet.swift @@ -29,14 +29,17 @@ enum Format { return f.string(from: NSNumber(value: value)) ?? String(format: "$%.2f", value) } - /// The whole address in groups of four, so every character is visible. - static func groups(_ address: String) -> [String] { - var out: [String] = [] + /// The whole address in groups of four, `perRow` groups to a line, so every + /// character is visible and the groups stand in columns. + static func rows(_ address: String, _ perRow: Int) -> [[String]] { + var groups: [String] = [] for (i, c) in address.enumerated() { - if i % 4 == 0 { out.append("") } - out[out.count - 1].append(c) + if i % 4 == 0 { groups.append("") } + groups[groups.count - 1].append(c) + } + return stride(from: 0, to: groups.count, by: perRow).map { + Array(groups[$0..<min($0 + perRow, groups.count)]) } - return out } } diff --git a/wallet-native/ios/Kit.swift b/wallet-native/ios/Kit.swift index f70fcdc..f296543 100644 --- a/wallet-native/ios/Kit.swift +++ b/wallet-native/ios/Kit.swift @@ -172,18 +172,33 @@ struct KitPage<Content: View>: View { } /// A full address, as React Native's `Address form="full"` (design guide §5): -/// groups of four in Plex Mono 13, every other group in Muted so a long -/// address keeps its place when compared. Selectable; copies without colour. +/// groups of four in Plex Mono 13, in lines of as many groups as fit (8, 6, 4 +/// or 2: always even), so the groups stand in columns, odd ones in Text and +/// even ones in Muted. Larger text gets fewer columns, never a wrapped line. +/// Selectable; copies without colour. struct AddressText: View { let address: String init(_ address: String) { self.address = address } var body: some View { - Format.groups(address).enumerated().reduce(Text("")) { line, g in - line + Text(g.offset == 0 ? g.element : " \(g.element)") - .foregroundColor(g.offset % 2 == 0 ? Palette.text : Palette.muted) + ViewThatFits(in: .horizontal) { + lines(8) + lines(6) + lines(4) + lines(2) + } + } + + private func lines(_ perRow: Int) -> some View { + Format.rows(address, perRow).enumerated().reduce(Text("")) { text, row in + row.element.enumerated().reduce(row.offset == 0 ? text : text + Text("\n")) { line, g in + line + Text(g.offset == 0 ? g.element : " \(g.element)") + .foregroundColor(g.offset % 2 == 0 ? Palette.text : Palette.muted) + } } .font(Face.mono) + // Its natural width, so ViewThatFits can tell whether the lines fit. + .fixedSize() .textSelection(.enabled) } } diff --git a/wallet-native/src/format.test.ts b/wallet-native/src/format.test.ts index bb1e894..6ae4886 100644 --- a/wallet-native/src/format.test.ts +++ b/wallet-native/src/format.test.ts @@ -1,9 +1,11 @@ import { describe, expect, it } from 'vitest'; import { aboutMinutes, + addressRows, dayChange, errorText, grouped, + groupsPerRow, looksLikeName, MAX_ZATOSHIS, memoParam, @@ -90,6 +92,19 @@ describe('addresses', () => { expect(grouped('abcdefghij')).toBe('abcd efgh ij'); expect(grouped(a).replace(/ /g, '')).toBe(a); }); + it('fits an even number of groups on a line, 2 to 8', () => { + // A group and its space are 5 characters; one is kept spare. + expect(groupsPerRow(10 * 29, 10)).toBe(4); // 28 usable: 5 fit, rounded down to 4 + expect(groupsPerRow(10 * 30, 10)).toBe(6); // 29 usable: 6 groups take exactly 29 + expect(groupsPerRow(10 * 100, 10)).toBe(8); + expect(groupsPerRow(10 * 5, 10)).toBe(2); + }); + it('splits the address into lines of whole groups', () => { + const rows = addressRows(a, 4); + expect(rows[0]).toEqual(['utes', 't1ab', 'cdef', 'ghij']); + expect(rows.flat().join('')).toBe(a); + expect(rows.at(-1)?.length).toBeLessThanOrEqual(4); + }); it('speaks the last 6 characters one by one', () => { expect(spokenAddress(a)).toBe('address ending 4 5 6 7 8 9'); expect(spokenAddress('short')).toBe('s h o r t'); diff --git a/wallet-native/src/format.ts b/wallet-native/src/format.ts index 80dbe41..d9c8169 100644 --- a/wallet-native/src/format.ts +++ b/wallet-native/src/format.ts @@ -124,6 +124,27 @@ export function grouped(a: string): string { return a.replace(/(.{4})/g, '$1 ').trim(); } +/** + * How many groups of four go on each line of a full address (design guide §5), + * given the width and one character's width: as many as fit, at most 8, and + * always an even number so each column keeps its colour from line to line. + * One character of the width is kept spare for rounding. + */ +export function groupsPerRow(width: number, charWidth: number): number { + // n groups and the spaces between them take 5n − 1 characters. + const spare = Math.floor(width / charWidth) - 1; + const fit = Math.floor((spare + 1) / 5); + return Math.max(2, Math.min(8, fit - (fit % 2))); +} + +/** A full address as lines of `perRow` groups of four. */ +export function addressRows(a: string, perRow: number): string[][] { + const groups = a.match(/.{1,4}/g) ?? []; + const rows: string[][] = []; + for (let i = 0; i < groups.length; i += perRow) rows.push(groups.slice(i, i + perRow)); + return rows; +} + /** * What a screen reader says for an address: its last 6 characters one by one, * the same ones the short form ends with, so they can be compared by ear. From 15b3a82a7e10b061709b3c2b9b1f2f02edd58424 Mon Sep 17 00:00:00 2001 From: Gregory Fong <gf5901@gmail.com> Date: Mon, 16 Nov 2026 15:49:44 -0800 Subject: [PATCH 5/7] feat(app): an address inside a sentence is Muted, so the words scan first Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- docs/design/wizard-design-guide.md | 2 +- mobile/src/components/address.tsx | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/design/wizard-design-guide.md b/docs/design/wizard-design-guide.md index 7dffdd7..36acb3c 100644 --- a/docs/design/wizard-design-guide.md +++ b/docs/design/wizard-design-guide.md @@ -146,7 +146,7 @@ Screens name the role, never the theme's colour (`c.text`, not `color.star`). | Form | Looks like | Where | |---|---|---| - | **Short** | `utest1abcd…456789`, mono 15 in Text, one line | In a name's place: a list row, the amount screen's chip, a title. Inside a sentence ("You paid …") it is `AddressInline`, mono in the sentence's colour | + | **Short** | `utest1abcd…456789`, mono 15 in Text, one line | In a name's place: a list row, the amount screen's chip, a title. Inside a sentence ("You paid …", "Add … as a contact") it is `AddressInline`: mono 15 in Muted, so the words scan first | | **Short, under a name** (`detail`) | Mono 13 in Muted | The line under a contact's or person's name, when there is no `.zcash` name to show instead | | **Full** | Every character in groups of 4, mono 13, in lines of as many groups as fit (8, 6, 4 or 2, always even) so the groups stand in columns: odd columns in Text, even ones in Muted. Lines share one left edge, even when the block is centred | Where someone checks or copies it: Receive, the exchange address, a contact page, Technical details, Add a contact. With `copy`, tapping anywhere on it copies the whole address and its label says "Copied" | diff --git a/mobile/src/components/address.tsx b/mobile/src/components/address.tsx index 6a9794f..97bf6c0 100644 --- a/mobile/src/components/address.tsx +++ b/mobile/src/components/address.tsx @@ -137,11 +137,13 @@ function Columns({ /** * A short address inside a sentence, such as "You paid utest1abcd…456789": - * the mono face at 15, in the sentence's colour. Put it inside a `T`. + * the mono face at 15 in Muted, so the sentence's words scan first and the + * address reads as the detail it is. Put it inside a `T`. */ export function AddressInline({ value }: { value: string }) { + const a = useStyles(); return ( - <Text style={inline.mono} accessibilityLabel={spokenAddress(value)}> + <Text style={[inline.mono, a.detail]} accessibilityLabel={spokenAddress(value)}> {shortAddress(value)} </Text> ); From 12b466bd8cb4af076f4d3ddf06438af6bae8b127 Mon Sep 17 00:00:00 2001 From: Gregory Fong <gf5901@gmail.com> Date: Mon, 16 Nov 2026 15:56:25 -0800 Subject: [PATCH 6/7] fix(app): Receive's address keeps its columns; rows and Sent keep the address's end On Receive the centred copy block shrank to its content, so the columns measured themselves and spiralled down to two (14 lines, buttons off screen). CopyText now stretches when centred. An Activity row whose title holds an address may take two lines, so the last characters, the ones people compare, aren't cut. Sent shows the address inline in mono instead of a pre-shortened name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- mobile/app/pay/amount.tsx | 3 +-- mobile/app/sent.tsx | 10 ++++++---- mobile/src/activity-row.tsx | 3 ++- mobile/src/components/address.tsx | 4 +++- mobile/src/components/copy.tsx | 5 ++++- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/mobile/app/pay/amount.tsx b/mobile/app/pay/amount.tsx index 2cd8103..dd83354 100644 --- a/mobile/app/pay/amount.tsx +++ b/mobile/app/pay/amount.tsx @@ -9,7 +9,6 @@ import { recipientKind, replyId, sendPayment, - shortAddress, stripReply, usd, usdText, @@ -186,7 +185,7 @@ export default function Amount() { pathname: '/sent', params: { zatoshis: String(zats), - name: shown ?? shortAddress(to.address), + name: shown ?? '', address: to.address, zcashName: to.name ? normaliseName(to.name) : '', pending: r.status === 'pending' ? '1' : '', diff --git a/mobile/app/sent.tsx b/mobile/app/sent.tsx index 9255cda..a0b0912 100644 --- a/mobile/app/sent.tsx +++ b/mobile/app/sent.tsx @@ -3,7 +3,7 @@ import { router, useLocalSearchParams } from 'expo-router'; import { useEffect } from 'react'; import { Animated, StyleSheet, useWindowDimensions, View } from 'react-native'; import { Art, TracedArt } from '../src/art'; -import { Button, NetworkBadge, Screen, T } from '../src/components'; +import { AddressInline, Button, NetworkBadge, Screen, T } from '../src/components'; import { isSentPreview } from '../src/flow-preview'; import { haptic } from '../src/haptics'; import { useBoth } from '../src/money'; @@ -40,6 +40,8 @@ export default function Sent() { }, [pending, preview]); const { contacts } = useWallet(); const both = useBoth(); + // Who it went to: their name, or their address short in mono (design guide §5). + const who = p.name ? p.name : p.address ? <AddressInline value={p.address} /> : null; const canSave = !!p.address && !contactFor(contacts, p.address); const { width, height } = useWindowDimensions(); // The scene shrinks on short screens so Done never leaves the screen. @@ -72,10 +74,10 @@ export default function Sent() { <Animated.View style={[s.words, words]}> <NetworkBadge /> <T style={s.sent}>{pending ? 'Not sent yet.' : request ? 'Request sent.' : 'Sent.'}</T> - {request && p.name ? <T kind="dust">To {p.name}</T> : null} + {request && who ? <T kind="dust">To {who}</T> : null} {p.zatoshis ? ( <T kind="dust"> - {both(Number(p.zatoshis))} to {p.name} + {both(Number(p.zatoshis))} to {who} </T> ) : null} {pending && request ? ( @@ -92,7 +94,7 @@ export default function Sent() { </T> ) : request ? ( <T kind="dust" style={s.pending}> - {`${p.name || 'They'} will see it once it’s confirmed, in about a minute.`} + {who ?? 'They'} will see it once it’s confirmed, in about a minute. </T> ) : ( <T kind="dust">Confirming, about 1 min</T> diff --git a/mobile/src/activity-row.tsx b/mobile/src/activity-row.tsx index bafcc45..30378ab 100644 --- a/mobile/src/activity-row.tsx +++ b/mobile/src/activity-row.tsx @@ -65,7 +65,8 @@ export function ActivityRow({ ) ) : ( <> - <T numberOfLines={1}> + {/* Two lines for an address, so its ending, the part people compare, isn't cut. */} + <T numberOfLines={d.bare ? 2 : 1}> <Title title={d.title} bare={d.bare} /> </T> {note ? ( diff --git a/mobile/src/components/address.tsx b/mobile/src/components/address.tsx index 97bf6c0..9ca131b 100644 --- a/mobile/src/components/address.tsx +++ b/mobile/src/components/address.tsx @@ -96,7 +96,9 @@ const MONO_ADVANCE = 0.6; * Text, even ones in Muted (both pass AA on every ground). The spaces stay, so * colour is never the only thing that separates the groups. The width is * measured, and guessed from the window until it is, so larger text gets - * fewer columns instead of a line that wraps. + * fewer columns instead of a line that wraps. Its parent's width must not + * come from its content (CopyText stretches for this), or the columns + * would measure themselves and shrink. */ function Columns({ value, diff --git a/mobile/src/components/copy.tsx b/mobile/src/components/copy.tsx index 7db9a9b..5ec2837 100644 --- a/mobile/src/components/copy.tsx +++ b/mobile/src/components/copy.tsx @@ -76,7 +76,10 @@ function Label({ text, fade }: { text: string; fade: boolean }) { const cx = StyleSheet.create({ block: { gap: 4 }, - center: { alignItems: 'center' }, + // Full width, so what it holds (an address's columns) measures the space it + // has, not its own content: a centred block that shrank to fit would pick + // fewer columns, shrink again, and end at two. + center: { alignItems: 'center', alignSelf: 'stretch' }, value: { lineHeight: 20 }, centerText: { textAlign: 'center' }, }); From 17f4c354b0f70c89a07bb221e712affe6720cba4 Mon Sep 17 00:00:00 2001 From: Gregory Fong <gf5901@gmail.com> Date: Mon, 16 Nov 2026 16:19:49 -0800 Subject: [PATCH 7/7] fix(app): an unlabelled address keeps its label line, so Copied doesn't move it On Receive and the exchange address, "Copied" appeared above the address and pushed it down about 20 pt. The line now stays, empty until copied. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- mobile/src/components/copy.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/mobile/src/components/copy.tsx b/mobile/src/components/copy.tsx index 5ec2837..6a361f5 100644 --- a/mobile/src/components/copy.tsx +++ b/mobile/src/components/copy.tsx @@ -28,7 +28,8 @@ export function useCopy(): [copied: boolean, copy: (text: string) => Promise<voi /** * A long value people copy: an address or a transaction id, in monospace under * its label. Tapping anywhere on it copies, and the label says "Copied" for a - * moment. Copies only when tapped, never on its own. + * moment (without a label, "Copied" appears in the line kept for it). Copies + * only when tapped, never on its own. */ export function CopyText({ label, @@ -57,7 +58,13 @@ export function CopyText({ onPress={() => copy(value)} style={({ pressed }) => [cx.block, center && cx.center, pressed && touch.pressed]} > - {shown ? <Label key={copied ? 'copied' : 'label'} text={shown} fade={copied} /> : null} + {shown ? ( + <Label key={copied ? 'copied' : 'label'} text={shown} fade={copied} /> + ) : ( + // No label: its line stays, empty, so "Copied" fades in without moving + // the value (design guide §6: an address never moves). + <Label text=" " fade={false} /> + )} {children ?? ( <T kind="mono" style={[cx.value, center && cx.centerText]}> {display}