Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 9 additions & 0 deletions docs/design/wizard-design-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 …", "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" |

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

Expand Down
11 changes: 3 additions & 8 deletions mobile/app/(tabs)/receive.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
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';
import { Art } from '../../src/art';
import {
Address,
Button,
CodeTile,
CopyText,
Notice,
Screen,
ScreenHeader,
Expand Down Expand Up @@ -48,12 +48,7 @@ export default function Receive() {
caption={`Send only ${testnet ? 'test ' : ''}ZEC to this address.`}
/>
{address && (
<CopyText
value={address}
display={grouped(address)}
hint="Copies your address"
center
/>
<Address value={address} form="full" copy hint="Copies your address" center />
)}
{error ? (
<>
Expand Down
19 changes: 3 additions & 16 deletions mobile/app/contacts/[address].tsx
Original file line number Diff line number Diff line change
@@ -1,18 +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 {
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';
Expand Down Expand Up @@ -96,12 +88,7 @@ export default function ContactPage() {
/>
</View>
)}
<CopyText
label="Address"
value={c.address}
display={grouped(c.address)}
hint="Copies the address"
/>
<Address value={c.address} form="full" label="Address" copy />
<View style={s.history}>
{(() => {
// What you're waiting on from them (issue #15, mock R6), newest first.
Expand Down
25 changes: 14 additions & 11 deletions mobile/app/contacts/add.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ import {
CONTACT_NAME_MAX,
contactFor,
errorText,
grouped,
normaliseName,
type Recipient,
resolveRecipient,
shortAddress,
spokenAddress,
suggestedName,
useWallet,
when,
Expand All @@ -15,7 +14,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';

Expand Down Expand Up @@ -121,9 +129,7 @@ export default function AddContact() {
<View style={s.who}>
<Avatar name={name || found.zcashName} address={found.address} size={56} />
{found.zcashName ? <T>{found.zcashName}</T> : null}
<T kind="mono" style={s.address}>
{grouped(found.address)}
</T>
<Address value={found.address} form="full" center />
</View>
<T kind="label">Their name</T>
<TextField
Expand Down Expand Up @@ -185,17 +191,15 @@ export default function AddContact() {
{r.name ? (
<T numberOfLines={1}>{full(r.name)}</T>
) : (
<T kind="mono" numberOfLines={1}>
{shortAddress(r.address)}
</T>
<Address value={r.address} />
)}
<T kind="dust" numberOfLines={1}>
{`Paid ${paidWhen(r.at)}`}
</T>
</View>
<Pressable
accessibilityRole="button"
accessibilityLabel={`Save ${r.name ? full(r.name) : shortAddress(r.address)}`}
accessibilityLabel={`Save ${r.name ? full(r.name) : spokenAddress(r.address)}`}
hitSlop={{ top: 4, bottom: 4 }}
onPress={() => {
setError(null);
Expand Down Expand Up @@ -227,7 +231,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 },
Expand Down
11 changes: 3 additions & 8 deletions mobile/app/contacts/edit.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
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';
import {
Address,
Avatar,
Button,
HeaderLink,
Expand Down Expand Up @@ -173,7 +168,7 @@ export default function EditContact() {
) : null}
<View style={s.cardRow}>
<T kind="dust">Address</T>
<T kind="mono">{shortAddress(c.address)}</T>
<Address value={c.address} />
</View>
<T kind="label">To pay a different address, delete this contact and add it again.</T>
</View>
Expand Down
25 changes: 16 additions & 9 deletions mobile/app/contacts/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {
errorText,
resolveRecipient,
searchContacts,
shortAddress,
sortContacts,
useWallet,
} from '@wizard/wallet-native';
Expand All @@ -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,
Expand Down Expand Up @@ -110,7 +111,7 @@ export default function Contacts() {
<Art name="sign/plus" width={18} />
</View>
<T numberOfLines={1} style={s.offerText}>
{`Add ${short(offer)} as a contact`}
Add <Offered input={offer} /> as a contact
</T>
</Pressable>
<Pressable
Expand All @@ -122,7 +123,9 @@ export default function Contacts() {
<View style={s.offerSign}>
<Art name="sign/forward" width={18} />
</View>
<T numberOfLines={1} style={s.offerText}>{`Pay ${short(offer)}`}</T>
<T numberOfLines={1} style={s.offerText}>
Pay <Offered input={offer} />
</T>
{paying ? <ActivityIndicator color={c.muted} /> : null}
</Pressable>
</View>
Expand All @@ -146,9 +149,13 @@ export default function Contacts() {
<Avatar name={c.name} address={c.address} size={44} />
<View style={{ flex: 1 }}>
<T numberOfLines={1}>{c.name}</T>
<T kind="dust" numberOfLines={1}>
{c.zcashName ?? shortAddress(c.address)}
</T>
{c.zcashName ? (
<T kind="dust" numberOfLines={1}>
{c.zcashName}
</T>
) : (
<Address value={c.address} detail />
)}
</View>
</Pressable>
)}
Expand All @@ -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 <AddressInline value={input.replace(/^zcash:/i, '').split('?')[0]} />;
}

const useStyles = themed((c) =>
Expand Down
9 changes: 5 additions & 4 deletions mobile/app/exchange-address.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +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,
Expand Down Expand Up @@ -41,9 +41,10 @@ export default function ExchangeAddress() {
caption={`Send only ${testnet ? 'test ' : ''}ZEC to this address.`}
/>
{address ? (
<CopyText
<Address
value={address}
display={grouped(address)}
form="full"
copy
hint="Copies your public exchange address"
center
/>
Expand Down
14 changes: 9 additions & 5 deletions mobile/app/pay/amount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
recipientKind,
replyId,
sendPayment,
shortAddress,
stripReply,
usd,
usdText,
Expand All @@ -23,6 +22,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,
Expand Down Expand Up @@ -185,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' : '',
Expand All @@ -206,9 +206,13 @@ export default function Amount() {
{to ? (
<View style={s.chip}>
<Avatar name={shown} address={to.address} size={28} />
<T numberOfLines={1} style={{ maxWidth: 200 }}>
{shown ?? shortAddress(to.address)}
</T>
{shown ? (
<T numberOfLines={1} style={{ maxWidth: 200 }}>
{shown}
</T>
) : (
<Address value={to.address} />
)}
</View>
) : (
<T kind="dust">Request from anyone</T>
Expand Down
10 changes: 6 additions & 4 deletions mobile/app/sent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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 ? (
Expand All @@ -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>
Expand Down
Loading
Loading