Improve p2p-transfer UI (#38)#41
Conversation
Redesigns the entire UI appearance of p2p-transfer using the dark color palette and layout from the Stitch-generated mockups. No functionality was changed — only visual presentation. Key changes: - Apply Stitch dark color palette (navy bg, indigo primary, emerald secondary) - Replace double top-panel with a single slim 54px header bar - Add home screen with two mode cards (Send / Receive) shown when idle - Style file info, shared files, and connection status as proper cards - Make the shareable URL prominent with a Copy Link button and green status dot - Extract receive panel into a clean card with labeled fields - Collapse terminal to a slim 44px footer bar (latest log only) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Code reviewFound 3 issues:
syncoxiders/p2p-transfer/src/app.rs Lines 2345 to 2354 in fed8dd4
syncoxiders/p2p-transfer/src/app.rs Lines 2690 to 2699 in fed8dd4
syncoxiders/p2p-transfer/src/app.rs Lines 2453 to 2457 in fed8dd4 |
Code review (full)Findings from OverviewPure UI/visual refactor of Strengths
Bugs & correctness
UX issues
Convention / minor nits
Pre-existing (not introduced by this PR, but visible)
RiskVisual-only PR; low blast radius. The theme/contrast bugs are the only items that change observable behavior across themes — the rest is cosmetic. Run |
radumarias
left a comment
There was a problem hiding this comment.
Inline notes from /review. See the full writeup in the issue comment above.
| ui.label(RichText::new("Paste a share link to download directly").color(tc.on_surface_var).size(14.0)); | ||
| ui.add_space(20.0); | ||
| if ui.add( | ||
| Button::new(RichText::new("Receive").color(Color32::from_rgb(0, 56, 36)).strong().size(15.0)) |
There was a problem hiding this comment.
Hardcoded Color32::from_rgb(0, 56, 36) matches Tc::dark().on_secondary but Tc::light().on_secondary is (255, 255, 255). With a light-mode tc.secondary background of (0, 108, 74) (dark green), this text becomes unreadable dark-green-on-green. Use tc.on_secondary (the sibling Send button correctly uses tc.on_primary).
| ui.label("Link/Hash:"); | ||
| ui.text_edit_singleline(&mut self.receive_hash_input); | ||
| }); | ||
| Self::apply_theme(ctx); |
There was a problem hiding this comment.
Self::apply_theme(ctx) runs every frame and calls ctx.set_visuals(v) unconditionally, triggering an egui style rebuild at the frame rate. Track theme state on &mut self (or compare ctx.style().visuals.dark_mode with a cached value) and only call when it actually flips.
| ui.group(|ui| { | ||
| let size_str = self.format_size(size); | ||
| #[cfg(target_arch = "wasm32")] | ||
| web_sys::console::log_1(&format!("============{:?}", size).into()); |
There was a problem hiding this comment.
Stray debug print — fires every frame in the WASM build whenever show_file_info renders. Drop it.
| let card = egui::Frame::new() | ||
| .fill(tc.surface_low) | ||
| .rounding(CornerRadius::same(10)) | ||
| .stroke(Stroke::new(1.0, Color32::from_rgba_unmultiplied(78, 222, 163, 60))) |
There was a problem hiding this comment.
Tinted border RGB (78, 222, 163, 60) is the dark-mode secondary base color with alpha. In light mode tc.secondary is #006c4a, so the border doesn't match the active theme. Use let c = tc.secondary; Color32::from_rgba_unmultiplied(c.r(), c.g(), c.b(), 60).
| ui.set_min_height(200.0); | ||
| ui.vertical_centered(|ui| { | ||
| let (ico_rect, _) = ui.allocate_exact_size(Vec2::splat(56.0), egui::Sense::hover()); | ||
| ui.painter().circle_filled(ico_rect.center(), 28.0, Color32::from_rgba_unmultiplied(192, 193, 255, 30)); |
There was a problem hiding this comment.
Same theme-mismatch as the active-share border: (192, 193, 255, 30) is dark-mode primary with alpha. In light mode tc.primary is #4143c7, so this halo doesn't follow the theme. Derive from tc.primary channels instead of a literal.
| ui.label("Easily share files with a secure peer-to-peer connection"); | ||
| ui.add_space(5.0); | ||
| let (ico_rect, _) = ui.allocate_exact_size(Vec2::splat(56.0), egui::Sense::hover()); | ||
| ui.painter().circle_filled(ico_rect.center(), 28.0, Color32::from_rgba_unmultiplied(78, 222, 163, 30)); |
There was a problem hiding this comment.
Same as the Send icon halo — (78, 222, 163, 30) is dark-mode secondary. Derive from tc.secondary channels so the halo follows the active theme.
| ui.add_space(5.0); | ||
|
|
||
| if ui.button("📋 Copy").clicked() { | ||
| if !self.magnet_input.is_empty() { |
There was a problem hiding this comment.
magnet_input is initialized to String::new() in Default::default() and I can't find any writer in this file. If this Copy URI box is dead UI, delete it; otherwise leave a TODO referencing the intended wiring.
| ); | ||
| share_btn.clone().on_hover_text("Start accepting connections and share all files"); | ||
|
|
||
| share_btn.clone().on_hover_text("Start sharing all files"); |
There was a problem hiding this comment.
share_btn.clone().on_hover_text(...) discards the cloned response. The tooltip still registers via the response id so it works, but share_btn.on_hover_text("…").clicked() reads cleaner.
Signed-off-by: Stefan Bisti <stefbisti@gmail.com>
Signed-off-by: Stefan Bisti <stefbisti@gmail.com>
Signed-off-by: Stefan Bisti <stefbisti@gmail.com>
Signed-off-by: Stefan Bisti <stefbisti@gmail.com>
…hover Signed-off-by: Stefan Bisti <stefbisti@gmail.com>
…F newline - Drop stale `#[cfg(not(target_arch = "wasm32"))]` on `show_received_files`. The body is pure egui and `ReceivedFile` is platform-agnostic; the gate caused `cargo check --target wasm32-unknown-unknown` to fail because the function is called unconditionally from the central dispatcher (and from `show_receive_panel` after c03b04c). - Add a "🏠 Home" button in the header (shown only when not already on the idle home screen) that exits the receive dialog and reuses `stop_accepting()` to clear node, share URL, shared files, and picked-file state. Closes the "no path back to home" gap flagged in the /review. - Add the missing trailing newline at EOF so `cargo fmt --check` no longer reports `\ No newline at end of file` on this file. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
p2p-transferusing generated dark design systemChanges
Assisted by Stitch and Claude Code