Daily use 34a: Invite cards and the accept modal (#523) #562

Closed
charles wants to merge 0 commits from dailyuse-34a-ui-invite-cards-accept into dailyuse
Owner

Stacked on: dailyuse-16a-core-invite-links

What

  • widgets/message_content/invite.rs: invite cards under a message, one per code of fluxer_core::invites::cards (InviteEmbed.tsx on EmbedCard.module.css: 22.5 rem max, 12 px corners, 48 px icon in a 56 px slot, 0.85 rem padding, the divider and full-width button). States: loading skeleton, "Unknown invite" / "Try asking for a new invite." / disabled "Invite unavailable", guild ("{n} online", "{n} members", "Join community" / "Go to community" / "Invites disabled" with the paused or raid notice; "Join community" where the original says "Preview", spec §17 Q11), group DM (inviter avatar, "Join group" / "Already joined"). The button sends InviteAction::Accept (joins at once, no modal); the title opens the guild channel or group DM when the user is in it.
  • screens/main/modals/invite_accept.rs: the accept modal (InviteAcceptModal.{tsx,module.css}, InviteHeader.tsx, AuthPageStyles.module.css): 65 rem x 48.75 rem on --brand-primary, the 35 rem card, header variants (guild, group DM "You've been invited to join a group DM by" + inviter, loading, "Invite not found" / "This invite may have expired or been deleted."), notice under the header, the inset X (disabled while accepting); the accept error modal over it (all InviteErrors, incl. "This community is for adults only.").
  • A click on the link text goes through the existing UserAction::OpenExternal, which Task 16a turns into the modal.
  • Wiring (small additions outside the Files list): message_row.rs (a Message::Invite variant + pushing the cards under the content), messages.rs (variant, row mapping, update arm), screens/main/mod.rs (Message::InviteAccept, into_action, the modal layer under the external-link warning), app.rs (after every snapshot, InviteAction::Resolve for the open channel's codes the store has not asked for: invite::unresolved). Test helper tests/common/dailyuse.rs (dailyuse READY + history, invite answers in the devserver's invite_json shape).

Tests

  • crates/fluxer-ui/tests/invites.rs: card_button_states, card_button_joins_link_opens_modal, accept_modal_header_variants (failing first, then passing).
  • Goldens invite_card_guild, invite_card_unknown, invite_accept_modal against the dailyuse scenario data, drawn on lavapipe in fluxer-native-shots:u2204 with UPDATE_GOLDEN=1; references in docs/screenshots/invite-*.png; README table rows added. No Electron capture: dimensions come from the CSS files named above.
  • FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci green locally. No FLUXER_DESKTOP_TESTS tests apply.

Deviations

  • Adults-only: the invite's guild carries no nsfw (proto InviteGuild), so "This community is for adults only." shows as the error modal of GUILD_VISIT_AGE_RESTRICTED, not before the accept.
  • Pictures are not loaded: guild icons are acronyms (as the crosspost card), inviters show their default avatar, no splash behind the modal (brand colour, no pattern), no guild badge, no card context menu.
  • The dedicated error modals (invites disabled, at capacity, max guilds, feature disabled) are drawn as the generic alert with the core's title and text.
  • The message row height estimate does not count invite cards (the list measures real heights).

Closes #523

🤖 Generated with Claude Code

Stacked on: dailyuse-16a-core-invite-links ## What - `widgets/message_content/invite.rs`: invite cards under a message, one per code of `fluxer_core::invites::cards` (`InviteEmbed.tsx` on `EmbedCard.module.css`: 22.5 rem max, 12 px corners, 48 px icon in a 56 px slot, 0.85 rem padding, the divider and full-width button). States: loading skeleton, "Unknown invite" / "Try asking for a new invite." / disabled "Invite unavailable", guild ("{n} online", "{n} members", "Join community" / "Go to community" / "Invites disabled" with the paused or raid notice; "Join community" where the original says "Preview", spec §17 Q11), group DM (inviter avatar, "Join group" / "Already joined"). The button sends `InviteAction::Accept` (joins at once, no modal); the title opens the guild channel or group DM when the user is in it. - `screens/main/modals/invite_accept.rs`: the accept modal (`InviteAcceptModal.{tsx,module.css}`, `InviteHeader.tsx`, `AuthPageStyles.module.css`): 65 rem x 48.75 rem on `--brand-primary`, the 35 rem card, header variants (guild, group DM "You've been invited to join a group DM by" + inviter, loading, "Invite not found" / "This invite may have expired or been deleted."), notice under the header, the inset X (disabled while accepting); the accept error modal over it (all `InviteError`s, incl. "This community is for adults only."). - A click on the link text goes through the existing `UserAction::OpenExternal`, which Task 16a turns into the modal. - Wiring (small additions outside the Files list): `message_row.rs` (a `Message::Invite` variant + pushing the cards under the content), `messages.rs` (variant, row mapping, update arm), `screens/main/mod.rs` (`Message::InviteAccept`, `into_action`, the modal layer under the external-link warning), `app.rs` (after every snapshot, `InviteAction::Resolve` for the open channel's codes the store has not asked for: `invite::unresolved`). Test helper `tests/common/dailyuse.rs` (dailyuse READY + history, invite answers in the devserver's `invite_json` shape). ## Tests - `crates/fluxer-ui/tests/invites.rs`: `card_button_states`, `card_button_joins_link_opens_modal`, `accept_modal_header_variants` (failing first, then passing). - Goldens `invite_card_guild`, `invite_card_unknown`, `invite_accept_modal` against the dailyuse scenario data, drawn on lavapipe in `fluxer-native-shots:u2204` with `UPDATE_GOLDEN=1`; references in `docs/screenshots/invite-*.png`; README table rows added. No Electron capture: dimensions come from the CSS files named above. - `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` green locally. No `FLUXER_DESKTOP_TESTS` tests apply. ## Deviations - Adults-only: the invite's guild carries no `nsfw` (proto `InviteGuild`), so "This community is for adults only." shows as the error modal of `GUILD_VISIT_AGE_RESTRICTED`, not before the accept. - Pictures are not loaded: guild icons are acronyms (as the crosspost card), inviters show their default avatar, no splash behind the modal (brand colour, no pattern), no guild badge, no card context menu. - The dedicated error modals (invites disabled, at capacity, max guilds, feature disabled) are drawn as the generic alert with the core's title and text. - The message row height estimate does not count invite cards (the list measures real heights). Closes #523 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Refs #495

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every UserAction, CoreEvent, Effect, ApiRequest/ApiResult and chat::Confirm
variant of the Daily use plan (Task 11a), plus the menu types (menus::MenuModel,
MenuItem, MenuItemKind, MenuItemId, MenuModel::flatten). New actions and events
do nothing yet; the runtime answers each new request with 501 CLIENT_NOT_WIRED
and logs Effect::Window until Daily use 28. MessageUser and CloseDm take a
confirmed flag and act as before; Notification gains icon (always None).

Refs #495

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #496

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
New domains notif_settings, social, invites, switcher, keynav and report with
their state, Default and stub reducers wired into App::apply; stub menu
builders (channel, category, guild, user, dm, mute::item); OwnPresence, profile
notes and modal state. Relationships move from chat::dms to app.social and are
read through social::relationship.

Refs #496

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Fixtures used: fixtures/rest/invite_guild.json, invite_group_dm.json (shaped as
fork:packages/schema/src/domains/invite/InviteSchemas.ts:42-91, Daily use 2).

Refs #501

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #501

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The invite answers in tests/common/dailyuse.rs follow the devserver's
invite_json (crates/fluxer-devserver/src/invites.rs:316-389), itself the
server's InviteResponse (packages/schema/src/domains/invite/InviteSchemas.ts:42-91).

Refs #523

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Invite cards under messages (InviteEmbed.tsx, EmbedCard.module.css) from
fluxer_core::invites::cards, the card button joining directly, the title
opening what the user is in; the accept modal (InviteAcceptModal.tsx,
InviteHeader.tsx) and its error modal from invite_accept_modal. The shell
asks the store for every invite code of the open channel once.
Goldens invite_card_guild, invite_card_unknown, invite_accept_modal drawn
on lavapipe (fluxer-native-shots:u2204).

Refs #523

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Owner

Independent review: Daily use 34a (diff 995e64a..dailyuse-34a-ui-invite-cards-accept)

Local gate: FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci ran in a fresh review worktree. Every step passed: fmt, clippy, deny, core-isolation, parity, test, vendored-tests and screenshot-tests. livekit-interop was skipped because FLUXER_LIVEKIT_TESTS is not set.

What I checked

  1. Tests the plan names: card_button_states, card_button_joins_link_opens_modal and accept_modal_header_variants exist in crates/fluxer-ui/tests/invites.rs, and the goldens invite_card_guild, invite_card_unknown and invite_accept_modal exist in screenshots.rs, fixtures/golden/ and docs/screenshots/ (with README rows). The tests assert the spec §3.6 strings exactly: "Go to community", "Join community", "Already joined", "Invite unavailable", "Unknown invite", "Try asking for a new invite.", "Invites disabled" with the paused notice, "You've been invited to join", "You've been invited to join a group DM by", "Join group DM", "Invite not found", "This invite may have expired or been deleted.", and "This community is for adults only." through the GUILD_VISIT_AGE_RESTRICTED error modal.
  2. Interfaces: the card button sends InviteAction::Accept directly and no modal opens. A click on the link text goes through UserAction::OpenExternal, and 16a's chat/links.rs turns it into the accept modal. Both are tested. The modal wraps invites::invite_accept_modal. The work consumes the 16a core API (cards, invite_codes, InviteAction::*) as it exists.
  3. Invariants: no new I/O in fluxer-ui. Pictures are not loaded (default avatar or acronym), so no new image path was added. Server data is used only through core models, with no indexing or unwrap on it. The test helper common/dailyuse.rs builds invite answers in the same shape as the devserver's invites.rs::invite_json (guild partial fields, group DM recipients as usernames only, 404 UNKNOWN_INVITE). I found no tokens, URLs with secrets or paths.
  4. Parity spot-checks against the fork: EmbedCard.module.css matches (max-width 22.5rem, grid gap 0.9rem and padding 0.85rem at ≥640 px, icon slot 3.5rem, icon 3rem). The InviteEmbed.tsx strings at L69-106 match. InviteAcceptModal.module.css matches (root min(65rem)/min(48.75rem), card 35rem with a 1.125rem radius, padding 1.875rem, state min-height 22.5rem). The title's navigation targets come from InviteEmbed.tsx L212/L292.
  5. Review Focus 7 (invite answers for unknown guilds must not panic) belongs to the 16a proptests. The UI side draws InviteCard::Unknown and AcceptBody::NotFound without panicking, and the tests cover both.

Findings

  • minor — card order (widgets/message_row.rs, near L691): the cards are pushed after attachments, embeds and stickers. The original renders message.invites before stickers, attachments and embeds (MessageAttachments.tsx L617 vs L659/680/707). "Under the message" holds either way, but a message with both an invite link and an embed or attachment shows them in a different order from the original.
  • minor — title click (widgets/message_content/invite.rs, update): the original's title always calls RouterUtils.transitionTo(guildPath / groupDMPath). Here a click does nothing when the user is not in the guild or group. It is harmless, since the client cannot show a guild it is not in, but it is a small divergence that should be noted.
  • minor — per-snapshot scan (app.rs + invite::unresolved): every snapshot runs the invite regex over every loaded message of the open channel. It is correct because the core deduplicates with the cache's Loading entry, but it costs O(messages) on each snapshot. A per-channel memo would avoid that. This is a follow-up candidate.
  • minor — documented deviations: adults-only appears only as the server error (the proto InviteGuild has no nsfw field, which is 16a's design). Other gaps: no invite pictures, splash, guild badge or card context menu; the dedicated error modals are drawn as the generic alert with the core's title and text; and the message row height estimate does not count the cards. I accept these, but each should get a follow-up issue linked from this PR, and the missing badge and menu need later rows in docs/parity/dailyuse.md.

Verdict: APPROVED. No blocking findings and the local CI is green.

## Independent review: Daily use 34a (diff 995e64a..dailyuse-34a-ui-invite-cards-accept) **Local gate:** `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` ran in a fresh review worktree. Every step passed: fmt, clippy, deny, core-isolation, parity, test, vendored-tests and screenshot-tests. livekit-interop was skipped because FLUXER_LIVEKIT_TESTS is not set. **What I checked** 1. **Tests the plan names:** `card_button_states`, `card_button_joins_link_opens_modal` and `accept_modal_header_variants` exist in `crates/fluxer-ui/tests/invites.rs`, and the goldens `invite_card_guild`, `invite_card_unknown` and `invite_accept_modal` exist in `screenshots.rs`, `fixtures/golden/` and `docs/screenshots/` (with README rows). The tests assert the spec §3.6 strings exactly: "Go to community", "Join community", "Already joined", "Invite unavailable", "Unknown invite", "Try asking for a new invite.", "Invites disabled" with the paused notice, "You've been invited to join", "You've been invited to join a group DM by", "Join group DM", "Invite not found", "This invite may have expired or been deleted.", and "This community is for adults only." through the `GUILD_VISIT_AGE_RESTRICTED` error modal. 2. **Interfaces:** the card button sends `InviteAction::Accept` directly and no modal opens. A click on the link text goes through `UserAction::OpenExternal`, and 16a's `chat/links.rs` turns it into the accept modal. Both are tested. The modal wraps `invites::invite_accept_modal`. The work consumes the 16a core API (`cards`, `invite_codes`, `InviteAction::*`) as it exists. 3. **Invariants:** no new I/O in fluxer-ui. Pictures are not loaded (default avatar or acronym), so no new image path was added. Server data is used only through core models, with no indexing or unwrap on it. The test helper `common/dailyuse.rs` builds invite answers in the same shape as the devserver's `invites.rs::invite_json` (guild partial fields, group DM `recipients` as usernames only, 404 `UNKNOWN_INVITE`). I found no tokens, URLs with secrets or paths. 4. **Parity spot-checks against the fork:** `EmbedCard.module.css` matches (max-width 22.5rem, grid gap 0.9rem and padding 0.85rem at ≥640 px, icon slot 3.5rem, icon 3rem). The `InviteEmbed.tsx` strings at L69-106 match. `InviteAcceptModal.module.css` matches (root min(65rem)/min(48.75rem), card 35rem with a 1.125rem radius, padding 1.875rem, state min-height 22.5rem). The title's navigation targets come from `InviteEmbed.tsx` L212/L292. 5. **Review Focus 7** (invite answers for unknown guilds must not panic) belongs to the 16a proptests. The UI side draws `InviteCard::Unknown` and `AcceptBody::NotFound` without panicking, and the tests cover both. **Findings** - **minor — card order** (`widgets/message_row.rs`, near L691): the cards are pushed after attachments, embeds and stickers. The original renders `message.invites` before stickers, attachments and embeds (`MessageAttachments.tsx` L617 vs L659/680/707). "Under the message" holds either way, but a message with both an invite link and an embed or attachment shows them in a different order from the original. - **minor — title click** (`widgets/message_content/invite.rs`, `update`): the original's title always calls `RouterUtils.transitionTo(guildPath / groupDMPath)`. Here a click does nothing when the user is not in the guild or group. It is harmless, since the client cannot show a guild it is not in, but it is a small divergence that should be noted. - **minor — per-snapshot scan** (`app.rs` + `invite::unresolved`): every snapshot runs the invite regex over every loaded message of the open channel. It is correct because the core deduplicates with the cache's `Loading` entry, but it costs O(messages) on each snapshot. A per-channel memo would avoid that. This is a follow-up candidate. - **minor — documented deviations:** adults-only appears only as the server error (the proto `InviteGuild` has no nsfw field, which is 16a's design). Other gaps: no invite pictures, splash, guild badge or card context menu; the dedicated error modals are drawn as the generic alert with the core's title and text; and the message row height estimate does not count the cards. I accept these, but each should get a `follow-up` issue linked from this PR, and the missing badge and menu need `later` rows in `docs/parity/dailyuse.md`. **Verdict: APPROVED.** No blocking findings and the local CI is green.
Author
Owner

Independent review: Daily use 34a (invite cards and accept modal)

I reviewed 995e64a..1221c1a cold.

Tests and interfaces. The plan's tests card_button_states, card_button_joins_link_opens_modal and accept_modal_header_variants exist in crates/fluxer-ui/tests/invites.rs. They assert the spec §3.6 strings: "Go to community", "Join community", "Already joined", "Invite unavailable", "Unknown invite", "Try asking for a new invite.", "Invites disabled" with "Invites are paused for this community.", "You've been invited to join (a group DM by)", "Join group DM", "Invite not found" and "This invite may have expired or been deleted.". They also check that the card button sends InviteAction::Accept and opens no modal, that a link click goes through OpenExternal to the modal with no link warning, that the X is disabled while an accept is in flight, and that the error modal closes first. The goldens invite_card_guild, invite_card_unknown and invite_accept_modal are in fixtures/golden/ and docs/screenshots/. The cards are built from invites::cards, and the modal from invite_accept_modal.

Invariants. The UI adds no I/O. Server data reaches the views only through core selectors. There are no secrets or tokens. The test helper builds invite answers in the shape the devserver serves them (invite_json).

Parity spot checks against the fork:

  • EmbedCard.module.css has max-width: 22.5rem, gap: 0.9rem, padding: 0.85rem and .iconSlot 3.5rem. These match.
  • The strings in InviteEmbed.tsx:69-106 and InviteAcceptModal.tsx:46-68 match.
  • The title opens the guild or group with RouterUtils.transitionTo (InviteEmbed.tsx:212,292). This matches.
  • The adults-only deviation is justified. The fork shows the notice only when invite.guild.nsfw === true, but the server's packages/schema/src/domains/invite/InviteSchemas.ts has no nsfw field, so the original never shows it from the invite.
  • §17 Q11: visits join, with the label "Join community". This is correct.

Review Focus #7. Unknown invite answers render as the Unknown or Loading card states. Nothing panics.

Findings:

  • minor: the auto-resolve hook in app.rs calls invite::unresolved, which runs on every snapshot. Each run scans every loaded message of the open channel with the invite regex. message_row also re-runs invite_codes on every draw. This is correct, because a code is asked for only once (resolve inserts Loading), but it does extra work on every gateway event. A follow-up could cache the codes per message.
  • minor: unresolved covers only ui.selected_channel. A row drawn from another channel, such as a thread's starter message from the parent channel, keeps its skeleton until that channel is opened.
  • minor: this PR touches files outside its Files list: message_row.rs and messages.rs, which Tasks 31 and 38 also list; app.rs, which Tasks 28 and 35 also list; and screens/main/mod.rs, which is a registration file. Those tasks are not started, and the additions are small, so later rebases should be mechanical. The PR discloses this.
  • minor: the row height estimate does not count the invite cards (disclosed), so a list with cards may jump slightly while it scrolls.

CI. FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci passed every step in the review worktree, EXIT=0.

Verdict: approve. There are no blocking findings.

🤖 Generated with Claude Code

## Independent review: Daily use 34a (invite cards and accept modal) I reviewed `995e64a..1221c1a` cold. **Tests and interfaces.** The plan's tests `card_button_states`, `card_button_joins_link_opens_modal` and `accept_modal_header_variants` exist in `crates/fluxer-ui/tests/invites.rs`. They assert the spec §3.6 strings: "Go to community", "Join community", "Already joined", "Invite unavailable", "Unknown invite", "Try asking for a new invite.", "Invites disabled" with "Invites are paused for this community.", "You've been invited to join (a group DM by)", "Join group DM", "Invite not found" and "This invite may have expired or been deleted.". They also check that the card button sends `InviteAction::Accept` and opens no modal, that a link click goes through `OpenExternal` to the modal with no link warning, that the X is disabled while an accept is in flight, and that the error modal closes first. The goldens `invite_card_guild`, `invite_card_unknown` and `invite_accept_modal` are in `fixtures/golden/` and `docs/screenshots/`. The cards are built from `invites::cards`, and the modal from `invite_accept_modal`. **Invariants.** The UI adds no I/O. Server data reaches the views only through core selectors. There are no secrets or tokens. The test helper builds invite answers in the shape the devserver serves them (`invite_json`). **Parity spot checks against the fork:** - `EmbedCard.module.css` has `max-width: 22.5rem`, `gap: 0.9rem`, `padding: 0.85rem` and `.iconSlot` `3.5rem`. These match. - The strings in `InviteEmbed.tsx:69-106` and `InviteAcceptModal.tsx:46-68` match. - The title opens the guild or group with `RouterUtils.transitionTo` (`InviteEmbed.tsx:212,292`). This matches. - The adults-only deviation is justified. The fork shows the notice only when `invite.guild.nsfw === true`, but the server's `packages/schema/src/domains/invite/InviteSchemas.ts` has no `nsfw` field, so the original never shows it from the invite. - §17 Q11: visits join, with the label "Join community". This is correct. **Review Focus #7.** Unknown invite answers render as the Unknown or Loading card states. Nothing panics. **Findings:** - *minor*: the auto-resolve hook in `app.rs` calls `invite::unresolved`, which runs on every snapshot. Each run scans every loaded message of the open channel with the invite regex. `message_row` also re-runs `invite_codes` on every draw. This is correct, because a code is asked for only once (`resolve` inserts `Loading`), but it does extra work on every gateway event. A follow-up could cache the codes per message. - *minor*: `unresolved` covers only `ui.selected_channel`. A row drawn from another channel, such as a thread's starter message from the parent channel, keeps its skeleton until that channel is opened. - *minor*: this PR touches files outside its Files list: `message_row.rs` and `messages.rs`, which Tasks 31 and 38 also list; `app.rs`, which Tasks 28 and 35 also list; and `screens/main/mod.rs`, which is a registration file. Those tasks are not started, and the additions are small, so later rebases should be mechanical. The PR discloses this. - *minor*: the row height estimate does not count the invite cards (disclosed), so a list with cards may jump slightly while it scrolls. **CI.** `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` passed every step in the review worktree, `EXIT=0`. **Verdict: approve.** There are no blocking findings. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

Merged into dailyuse at f7972c3 (combined merge of 23 Daily use tasks plus textchat).

Merged into `dailyuse` at f7972c3 (combined merge of 23 Daily use tasks plus `textchat`).
charles closed this pull request 2026-11-15 06:08:52 +00:00

Pull request closed

Sign in to join this conversation.
No description provided.