~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0

The console reads well on a phone

Merged chadtmiller.com asked to merge into main from chadtmiller.com/group-host:console/phone
.claude/skills/ui/SKILL.md+8−2
@@ -81,7 +81,7 @@ harness/layers.mjs` holds each to its layer:
- `atoms`: one element (`Avatar`, `Tag`, `Copy`).
- `molecules`: a few atoms that mean something together (`Section`,
`Empty`, `Dialog`, `FormDialog`, `ConfirmDialog`, `Tabs`, `UserMenu`,
`MemberRow`, `Person`, `GroupRow`, `HandleInput`).
`MemberRow`, `Person`, `GroupRow`, `HandleInput`, `ActionMenu`).
- `organisms`: a part of a page (`MemberList`, `GroupCard`,
`SiteHeader`, `RulesEditor`).
- `templates`: a page's layout, without its data (`Page`, `GroupPage`,
@@ -203,7 +203,13 @@ controls.
card: its `Avatar`, `ordinal` or picture first; its name, and under it
what is said about it (`.row-main` with `.what`); its acts at the
row's end in `.row-actions`, `small`, quiet ones before the one that
acts. A person is `MemberRow`, a group `GroupRow`. Times by
acts. A list whose every row carries the same acts (a group's
members: change roles, remove) puts them in an `ActionMenu`, the "⋯"
at the row's end, rather than the same buttons down every row; a row
waiting on one act (approving a request) keeps it as a button. A
button beside a row's name says its verb alone ("Change", "Remove"),
the row saying what of, its `aria-label` in full. A person is
`MemberRow`, a group `GroupRow`. Times by
`#lib/dates.ts`, never as a record holds them. The empty state in the
rows' place; a quiet "Show more" under the last row while there are
more, a page at a time, never every row at once.
harness/e2e/flows.spec.mjs+5−2
@@ -314,7 +314,9 @@ test('a member with nothing to change sees no settings', async () => {
test('giving roles, and putting someone out', async () => {
const row = () => page.locator('.member', { hasText: 'bob.test' });
// His roles in a dialog, those she may give to tick.
await row().getByRole('button', { name: "Change bob.test's roles" }).click();
// From the "⋯" at the end of his row.
await row().getByLabel('More for bob.test').click();
await row().getByRole('button', { name: 'Change roles' }).click();
const roles = page.getByRole('dialog', { name: 'Change roles' }).filter({ visible: true });
await expect(roles.getByRole('checkbox', { name: 'member' })).toBeChecked();
// Saved in place: the dialog closes, and the page stays where it was.
@@ -325,7 +327,8 @@ test('giving roles, and putting someone out', async () => {
await expect(row()).toContainText('member');
expect(await page.evaluate(() => scrollY)).toBe(at);
// Removed, once she is sure.
await row().getByRole('button', { name: 'Remove bob.test' }).click();
await row().getByLabel('More for bob.test').click();
await row().getByRole('button', { name: 'Remove from the group' }).click();
const sure = page.getByRole('dialog', { name: 'Remove this member?' }).filter({ visible: true });
await expect(sure).toContainText('bob.test');
await expect(sure.getByText('They can ask to join again.')).toBeVisible();
web/src/lib/atoms/Address.sveltenew+10−0
@@ -0,0 +1,10 @@
<script lang="ts">
/**
* A web address as text, breaking where it must after a `/` or a `.`,
* never inside a word between them.
*/
let { address }: { address: string } = $props();
const parts = $derived(address.match(/[^/.]*(?:[/.]+|$)/g)?.filter(Boolean) ?? [address]);
</script>
{#each parts as part, i (i)}{part}<wbr />{/each}
web/src/lib/atoms/Icon.svelte+4−1
@@ -18,7 +18,8 @@
| 'book'
| 'badge'
| 'users'
| 'check';
| 'check'
| 'more';
lg?: boolean;
} = $props();
</script>
@@ -68,6 +69,8 @@
<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" /><circle cx="9" cy="7" r="4" /><path
d="M22 21v-2a4 4 0 0 0-3-3.87"
/><path d="M16 3.13a4 4 0 0 1 0 7.75" />
{:else if name === 'more'}
<circle cx="12" cy="12" r="1" /><circle cx="19" cy="12" r="1" /><circle cx="5" cy="12" r="1" />
{:else}
<path d="M20 6 9 17l-5-5" />
{/if}
web/src/lib/molecules/ActionMenu.sveltenew+36−0
@@ -0,0 +1,36 @@
<script lang="ts">
import Icon from '#lib/atoms/Icon.svelte';
/**
* A "⋯" menu of what can be done about the row it ends, for a list
* whose every row carries the same acts: each a button opening the
* dialog `opens` names. `label` names the menu for those who cannot see
* it ("More for @bob.test"). It closes on a pick, a click elsewhere, and
* Escape.
*/
let { actions, label }: { actions: { text: string; opens: string }[]; label: string } = $props();
let menu = $state<HTMLDetailsElement>();
function away(e: Event) {
if (menu?.open && !menu.contains(e.target as Node)) menu.open = false;
}
function key(e: KeyboardEvent) {
if (e.key === 'Escape' && menu?.open) {
menu.open = false;
menu.querySelector('summary')?.focus();
}
}
</script>
<svelte:document onclick={away} onkeydown={key} />
{#if actions.length}
<details class="action-menu" bind:this={menu}>
<summary aria-label={label} title={label}><Icon name="more" /></summary>
<div class="menu">
{#each actions as a (a.opens)}<button
type="button"
popovertarget={a.opens}
onclick={() => menu && (menu.open = false)}>{a.text}</button
>{/each}
</div>
</details>
{/if}
web/src/lib/molecules/MemberRow.svelte+4−3
@@ -5,8 +5,9 @@
/**
* Someone in a list of a group's people: their picture; their handle (or
* DID, when no handle is known), and under it the roles they hold beyond
* being a member, which all do, and `note`, what they said; then
* `children`, what may be done about them, at the row's end.
* being a member, which all do; `children`, what may be done about
* them, at the row's end; and under it all, `note`, what they said, as
* wide as the row, lined up with their handle.
*/
let {
actor,
@@ -28,6 +29,6 @@
{#if held.length}<span class="tags"
>{#each held as role (role)}<Tag text={role} />{/each}</span
>{/if}
{#if note}<span class="what">{note}</span>{/if}
</span>
{#if children}<span class="row-actions">{@render children()}</span>{/if}
{#if note}<p class="what note">{note}</p>{/if}
web/src/lib/molecules/Tabs.svelte+4−1
@@ -1,7 +1,10 @@
<script lang="ts">
import { scrollRow } from '#lib/rows.ts';
/**
* The parts of a page, each a page of its own, in a row: `current`, the
* address of the one shown. `label` names the row for a screen reader.
* Wider than the screen, the row scrolls sideways, the one shown in
* view, faded at an edge with more past it.
*/
let {
tabs,
@@ -10,7 +13,7 @@
}: { tabs: { href: string; text: string }[]; current: string; label: string } = $props();
</script>
<nav class="tabs" aria-label={label}>
<nav class="tabs" aria-label={label} {@attach scrollRow(current)}>
{#each tabs as t (t.href)}<a href={t.href} aria-current={t.href === current ? 'page' : undefined}
>{t.text}</a
>{/each}
web/src/lib/organisms/LinksEditor.svelte+4−1
@@ -3,6 +3,7 @@
import { inPlace } from '#lib/forms.ts';
import Empty from '#lib/molecules/Empty.svelte';
import FormDialog from '#lib/molecules/FormDialog.svelte';
import Address from '#lib/atoms/Address.svelte';
import LinkIcon from '#lib/atoms/LinkIcon.svelte';
/**
* Where else a group is, as its profile lists them, each by its site's
@@ -21,7 +22,9 @@
<li>
<LinkIcon src={l.icon} />
<span class="row-main"
><strong>{l.title ?? shown(l.url)}</strong><span class="what">{l.url}</span></span
><strong
>{#if l.title}{l.title}{:else}<Address address={shown(l.url)} />{/if}</strong
><span class="what"><Address address={l.url} /></span></span
>
<form class="row-actions" method="post" action="?/unlink" use:enhance={inPlace}>
<input type="hidden" name="index" value={i} />
web/src/lib/organisms/MemberList.svelte+10−17
@@ -1,5 +1,6 @@
<script lang="ts">
import { goto } from '$app/navigation';
import ActionMenu from '#lib/molecules/ActionMenu.svelte';
import ConfirmDialog from '#lib/molecules/ConfirmDialog.svelte';
import Empty from '#lib/molecules/Empty.svelte';
import FormDialog from '#lib/molecules/FormDialog.svelte';
@@ -11,7 +12,8 @@
* (`q`), with more to show while there are (`more`); and their roles:
* for one who may give roles, the ones they may give, to give or take,
* in a dialog; for one who may remove people, the way to, asked to be
* sure of. Their own row they leave from, not here.
* sure of; both from a "⋯" menu at the row's end, as every row has them.
* Their own row they leave from, not here.
*/
let {
members,
@@ -55,22 +57,13 @@
{#each members as m, i (m.actor.did)}
<li class="member">
<MemberRow actor={m.actor} roles={m.roles.map((r) => r.role)}>
{#if m.actor.did !== me && assignable.length}
<button
class="quiet small"
type="button"
popovertarget={`roles-${i}`}
aria-label={`Change ${named(m)}'s roles`}>Roles</button
>
{/if}
{#if m.actor.did !== me && canEject}
<button
class="quiet small"
type="button"
popovertarget={`eject-${i}`}
aria-label={`Remove ${named(m)}`}>Remove</button
>
{/if}
{#if m.actor.did !== me}<ActionMenu
label={`More for ${named(m)}`}
actions={[
...(assignable.length ? [{ text: 'Change roles', opens: `roles-${i}` }] : []),
...(canEject ? [{ text: 'Remove from the group', opens: `eject-${i}` }] : [])
]}
/>{/if}
</MemberRow>
{#if m.actor.did !== me && assignable.length}
<FormDialog id={`roles-${i}`} title="Change roles" action="?/roles" submit="Save">
web/src/lib/organisms/NewGroupForm.svelte+1−1
@@ -91,7 +91,7 @@
<label class="field">
How people join
<select name="joinPolicy">
<option value="approval">People ask to join, and an admin approves them</option>
<option value="approval">An admin approves who joins</option>
<option value="open">Anyone can join right away</option>
<option value="invite">Only people who are invited</option>
</select>
web/src/lib/organisms/ProfileForm.svelte+1−1
web/src/lib/organisms/ProfilePictures.svelte+15−9
web/src/lib/dates.ts+7−2
web/src/lib/rows.tsnew+31−0
web/src/app.css+96−8
web/src/tokens.css+5−0