Task 18: Main layout: guild rail, channel sidebar, header, member list (#18) #57
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "task/18-ui-main-layout"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What this builds
screens::main::model(&App) -> MainModel { home, guilds: Vec<GuildRailItem { id, name, icon_url, acronym, selected, unread, mentions, unavailable }>, sidebar: SidebarModel, user, header: HeaderModel { channel_name, topic, kind, has_members, members_open }, members: Option<Vec<MemberGroupModel>> }, computed through the core selectors (guild_order,channel_tree,dm_list,member_list,unread,mention_count,display_name). With no guild selected the sidebar is the DM list.membersisNonewhen the list is toggled off or the DM list is open.screens::main::view(&MainModel, &Local) -> Element<main::Message>: guild rail (72 px, DM button, unread pill / selected bar on the left edge, red mention badge on the icon's corner, name tooltip), channel sidebar (guild name, categories, channel rows with type icon, unread pill and mention badge, user area with the settings gear), header (56 px: icon, name, topic, member list toggle), member list (264 px: groups with counts, presence dot, owner crown, offline rows dimmed) and an empty chat surface for Task 20. Sizes come fromTokens::layoutand the web app's CSS modules (each constant names its rule); colours are tokens only.enum main::Message { SelectGuild(Option<Snowflake>), SelectChannel(Snowflake), SidebarResized(u16), ToggleMembers, OpenSettings }withMessage::into_action() -> UserAction; the shell sends it asCoreEvent::User.acronym(name): the web app'sgetGuildAcronymrule (initials of words, possessive'sdropped, punctuation kept), capped at 4,?when empty.badge::mention/badge::format_count(MentionBadge.module.css, "99+", "2K"),tooltip::tooltip_for(Tooltip.module.css),resizable_split::resizable_split(custom widget: reports the width asked for while its edge is dragged, keeps none itself; core clamps to 200..=480).app.rs: a logged-in session shows the main screen instead of Task 17's placeholder.How it was tested
crates/fluxer-ui/tests/main_model.rs(9 tests), written first and seen failing: the three the plan names (main_model_marks_selected_guild_and_channel,acronym_for_guild_without_icon,member_list_hidden_when_toggled_off) plus the channel tree with kinds, unread/mentions on rail and sidebar, the DM list, a guild coming back from an outage, a logged-out store, and the message-to-UserActionmapping. They drive the real store throughApp::applywith theREADY/GUILD_CREATEfixtures.format_countand for the split'srequested_width(clamping, NaN, inverted range).fluxer --devserverlogs in and shows the DM list; clicking the guild and#generalselects them; dragging the sidebar edge resizes it (320 to 240); the header button hides the member list; hovering a guild shows its tooltip; Ctrl-C exits with status 0.FLUXER_SCREENSHOT_TESTS=1 cargo xtask ciis green locally.Screenshots of the native client:
docs/screenshots/main-empty.png(after login, DM list) anddocs/screenshots/main-channel.png(guild and channel selected). There is no Electron side-by-side: it needs a session on the live instance, which this task may not touch.Deviations from the plan
GuildsLayout.module.cssin the fork checkout says (.guildIconSelected { border-radius: 30% }), and the plan gives the web app as its source. One constant (SELECTED_RADIUS_RATIO) if 16 px is wanted.--layout-sidebar-width: 20rem) is used.acronymcaps at 4 as the plan says; the web app does not cap (it shrinks the font).MainModelhas more than the plan lists:home(the DM button),user(user area), and extra fields onHeaderModel,GuildRailItem(unavailable),SidebarModel(title,width,sections). The plan's names and fields are unchanged.GuildRailItem::icon_url({media}/icons/{guild}/{hash}.webp?size=96) is ready for it.ChatTeardropicon; the web app shows the Fluxer logo there, which is not in the bundled icon set.OpenSettings(None), which nothing draws yet.crates/fluxer-ui/Cargo.toml(fluxer-protomoved from dev-dependencies to dependencies forSnowflake/UserStatusin the model; no new crate),src/app.rs,src/screens/mod.rs,src/widgets/mod.rs,README.md,docs/screenshots/.Stacked on: task/17-ui-shell-login, task/9-core-guilds-channels, task/10-core-messages-readstate, task/11-core-presence-ui
Closes #18
🤖 Generated with Claude Code
Review: Task 18 (ui-main-layout), commit
f9183efReviewed
9e1bc0a..f9183efcold. LocalFLUXER_SCREENSHOT_TESTS=1 cargo xtask ci: green (exit 0;tests/main_model.rs9/9; remote runners not checked).Checks
main_model_marks_selected_guild_and_channel,acronym_for_guild_without_icon(initials, max 4: "the quick brown fox jumps" -> "tqbf"),member_list_hidden_when_toggled_offall exist and assert what the plan says.main::model(&App) -> MainModel,GuildRailItem { id, name, icon_url: Option<Url>, acronym, selected, unread, mentions },SidebarModel,HeaderModel { channel_name, topic },members: Option<Vec<MemberGroupModel>>,view(&MainModel, &Local) -> Element<Message>,Message { SelectGuild(Option<Snowflake>), SelectChannel(Snowflake), SidebarResized(u16), ToggleMembers, OpenSettings }are present as written; extra fields are additive. The selectors named in Consumes are all used.ACRONYM_SIZESindex clamped,requested_widthhandles NaN and inverted ranges, layout tolerates a missing child tree).Findings (all minor, none blocking)
widgets/resizable_split.rs: everyCursorMovedof a drag publishesSidebarResized, andfluxer-core/src/persist.rsturns each changed width intoEffect::Persist(SaveSettings). One drag is therefore up to ~280 settings writes. Publish on release (or debounce in the runtime) — follow-up.widgets/resizable_split.rs: a drag ends only onButtonReleased(Left)seen by the widget. If the button is released outside the window (or the window loses focus mid-drag),grab_offsetstays set and the next pointer movement resizes the sidebar without a button held, and panes get noCursorMoveduntil the next click. Also end the drag onCursorLeft/window unfocus, or check the button state.widgets/resizable_split.rs: the 8 px grab strip takes presses from the rightmost 4 px of the sidebar (where its scrollbar is) and the leftmost 4 px of the content pane. Acceptable, but worth knowing for Task 20.screens/main/model.rs:model()runs on everyviewcall and callschannel_treeonce per guild (plus once for the selected one) andmember_list; this is O(all channels) per frame. Fine for the fixtures, will want caching in the snapshot for large accounts.screens/main/model.rsacronym: diverges from the web app'sgetGuildAcronymfor decomposed combining marks (documented) and by capping at 4 chars where punctuation counts toward the cap ("a-b-c" -> "a-b-"). The cap is the plan's; the trailing punctuation is cosmetic.screens/main/guild_rail.rs: selected radius is 30% (13.2 px), not the plan's 16 px. It matches the fork's.guildIconSelected { border-radius: 30% }, which CLAUDE.md ("clone, do not reinterpret") favours; needs Charles's nod since the plan says 16.app.rs: the Task 17 "Log out" button is removed and the gear emitsOpenSettings(None), which nothing draws, so there is no way to log out from the UI until Task 22. Not a plan violation, but a regression for manual testing in between.main-empty.pngvs Electron; only the native screenshots are attached, no side-by-side (needs the live instance).README.md/Cargo.toml/app.rs/screens/mod.rs/widgets/mod.rsare outside the task's Files list; the changes are the necessary wiring. The Cargo.toml hunk may conflict mechanically with Tasks 19/21.Verdict: APPROVE — zero blocking findings, local ci green.