Shared components
The two components every feature may use, Avatar and StatusLine, both defined in ui.contract.

Two named components are shared by the whole app. They live in ui.contract, a 31 line file that every feature file imports from, and they carry two of the app's principles: people appear as a face or a coloured initial, never as a key (Names, not identifiers), and a failure is always a sentence with a way out (Honest state).

The two components

Component

What it is

Props

Calls in code

Avatar

A round picture of a person, or a green disc with their initial

name, url, size

9

StatusLine

A failure message with a "Retry" button

message, retry

4

Source: ui.contract L1-L31. The file also holds the one function avatarHue, which picks the disc colour.

Who imports them

File

Imports

Calls

read.contract

Avatar, StatusLine

Avatar 3, StatusLine 3

discuss.contract

Avatar, StatusLine

Avatar 1, StatusLine 1

activity.contract

Avatar

Avatar 1

agents.contract

Avatar

Avatar 1

me.contract

Avatar

Avatar 3

vault.contract

Avatar

none (imported, never called)

app.contract

Avatar, StatusLine

none (imported, never called)

Why only two

DESIGN.md planned four shared components (Avatar, DocRow, CommentBubble, StatusLine). In the built app the document row and the comment bubble moved into the features that own them, as DocItemRow and DiscussBubble. What stayed shared is what several tabs draw. Inferred from the file comments: ui.contract is owned by the lead and changed only on request, so features kept their own parts close and the shared file stayed small.

The Agents tab does not use StatusLine. It has its own red variant, AgentError, and the Activity, Me, Profile and Vault screens write their failure rows inline. The catalogue of all failure treatments is in Loading, failure and empty states.

Related

Do you like what you are reading? Subscribe to receive updates.

Unsubscribe anytime

Comments