Me: screens and components
The five components in me.contract with their props and testIds, the shapes they declare, the pkg:me state, resources, mutations and actions in app.contract, and the Contract tests that drive them.

me.contract declares the Me tab's interface in Contract. The components hold no data of their own: every value and action arrives as a prop from the root component, where the pkg:me blocks of app.contract declare the state and resources (Package conventions and ownership blocks).

Shapes and helpers

Shapes: MeIdentity (accountId, keyName, shortId, createdAt), MeProfile (accountId, name, icon), MeWords (mnemonic, words), MeReply (ok, error, value), MeCheck (kind, valid, message, count), MeExport (ok, error, text). They match the answers in Me: sources and import logic.

Functions: meDisplayName picks profile name, then key name, then short id ("names, never a bare z6Mk… as the label"); meIcon picks the profile icon; meHost strips the scheme from a URL.

Components

Component

Route

Renders

Main testIds

MeScreen

me

Identities section (current identity as a link with a 56 pt Avatar, others as buttons with swipe to delete), Create and Import buttons, Connections (Server, Agent server, Vault), About, and the me-remove alert dialog

me-list, me-empty, me-failed, me-retry, me-current, me-current-name, me-current-id, me-id-<name or short id>, me-create, me-import, me-server, me-server-host, me-agent-server, me-vault, me-remove-confirm

MeIdentityScreen

identity

Header card, Edit profile link, Use this identity, Account ID with copy and share, Key name, Backup (export key file), Remove, and three dialogs (me-rename, me-export, me-remove-detail)

me-identity, me-identity-missing, me-identity-name, me-identity-id, me-identity-copy-id, me-identity-share-id, me-identity-rename, me-identity-keyname, me-rename-input, me-rename-confirm, me-rename-status, me-export, me-export-confirm, me-export-text, me-export-copy, me-export-share, me-export-hide, me-identity-remove, me-identity-remove-confirm

MeCreateScreen

create (modal)

Optional name, the 12 numbered words, Copy, a confirmation switch, and Create (disabled until confirmed)

me-create-cancel, me-create-save, me-create-name, me-words, me-word-1 to me-word-12, me-words-copy, me-create-confirm, me-create-error

MeImportScreen

import (modal)

A text area for a phrase or key file, a live status line, optional name, Import (disabled until the check is valid)

me-import-cancel, me-import-save, me-import-text, me-import-status, me-import-name

MeServerScreen

server

Radio rows for hyper.media and dev.hyper.media, a row for an unsaved custom server, Saved servers with swipe to remove, and an address field with Connect

me-server-list, me-server-hyper, me-server-dev, me-server-custom, me-saved-<i>, me-saved-<i>-host, me-server-input, me-server-connect, me-server-status

MeIdentityScreen declares two local actions, copyId (copies and plays a success haptic) and shareId (opens the share sheet). Avatar comes from Shared components.

Root declarations

Kind

Names

State

meName, meConfirmed, meImportText, meServerDraft, meAimed, meExportFor

Persisted state

meImportName, meRenameDraft, meServers (custom servers connected to before)

Resources

meIds = meIdentities(), meProfiles = meProfileNames(server, ids), meImportCheck = meCheckImport(meImportText)

Mutations

meWords; meCreated (refreshes meIds, then meAfterAdd); meImported (then meAfterImport); meRemoved (then meAfterRemove); meServerChecked (then meAfterServer); meExported; meRenamed (refreshes meIds)

Derived

meCreateError, meImportError, meServerError, meWordList, meMnemonic, meRenameError, meExportText

The comment on meImportName records a deliberate choice: name drafts survive a reload, "never the import text: it may be a recovery phrase or key".

The shared server and currentAccount are declared just above the package blocks at lines 76 to 77.

Actions

pkg:me actions, grouped by flow:

    Create: meOpenCreate resets the form, sends meWords = meNewWords() and pushes /me/create. meCreate sends meCreateIdentity(meMnemonic, name, time.epochAtZero + performanceNow()). meAfterAdd sets currentAccount, clears the words and pops the sheet.

    Import: meOpenImport, meEditImport, meEditImportName, meImport, meAfterImport, with the same pattern.

    Switch and remove: meSwitch sets currentAccount and clears any shown export. meAskRemove stores the target in meAimed and opens me-remove-detail on the identity screen or me-remove elsewhere. meRemove sends meRemoveIdentity(meAimed, currentAccount); meAfterRemove adopts the returned account.

    Rename: meAskRename, meEditRename, meRename.

    Export: meAskExport, meReveal (records meExportFor and sends meExportKey), meHideExport, meCopyExport, meShareExport. The view passes the export text only when the route's uid equals meExportFor, so "an export is displayed only on that identity's screen".

    Server: mePickServer, meEditServer, meConnect, meAfterServer (adopts the checked origin and appends it to meServers unless it is a preset), meForgetServer (falls back to https://hyper.media when the removed server was in use), meRetry.

The time argument follows the rule in State, refresh and stale-reply patterns: the data module has no clock of its own.

The view switch renders one component per stack entry. Error props are blanked while their mutation is pending, for example error=(pending(meCreated) ? "" : meCreateError).

Contract tests

me.test.contract has 13 tests, using "Throwaway keys only": public BIP-39 test phrases and a key file with a fixed public seed.

Area

Tests

Empty state

1

Create: 12 words, confirmation required, listed and current, survives reload

1

Import: invalid phrase reasons; phrase then key file then switch then remove; duplicate name refused

3

Identity detail: export after asking, remove; rename with a bad name refused; export shown only on its own screen; unnamed identity, copy and share

4

Server: persists across relaunch; bad address refused; a custom server must pass its config check; saved servers

4

The saved-server test points the app at http://127.0.0.1:4790, the local test server. How these files run is in Contract UI tests.

User stories

The code described here exists to deliver these stories. Each story lists this page in its Trace (traceability).

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

Unsubscribe anytime

Connections0
Linked document · Outgoing linkLinked document · Outgoing linkLinked document · Outgoing linkLinked document · Outgoing linkLinked document · Outgoing linkLinked document · Outgoing linkLinked document · Outgoing linkLinked document · Outgoing linkLinked document · Outgoing linkLinked document · Outgoing linkLinked document · Outgoing linkLinked document · Outgoing linkLinked document · Outgoing linkLinked document · Outgoing linkLinked document · Outgoing linkLinked document · Outgoing linkLinked document · Outgoing linkLinked document · Outgoing linkLinked document · Outgoing linkLinked document · Outgoing linkLinked document · Outgoing linkLinked document · Outgoing linkLinked document · Outgoing linkLinked document · Outgoing linkLinked document · Outgoing linkLinked document · Outgoing linkLinked document · Outgoing linkLinked document · Outgoing linkLinked document · Outgoing linkLinked document · Outgoing linkLinked document · Outgoing linkMe: screens and componentsMe: screens and components
Citations 0Children & links 31

Loading child documents…

Connections show where other documents or comments link to this document.

Related documents

Loading connections…