refactor(aumate-app): apply DDD architecture for window vibrancy#12
refactor(aumate-app): apply DDD architecture for window vibrancy#12
Conversation
Rust Backend (4-Layer DDD): - Add WindowVibrancyPort trait and VibrancyEffect enum in Domain Layer - Implement WindowVibrancyAdapter using Tauri v2 WindowEffects API - Create SetWindowVibrancyUseCase in Application Layer - Refactor set_window_vibrancy command to use Use Case - Remove window-vibrancy crate, use built-in Tauri v2 windowEffects Frontend (3-Layer Architecture): - Create services/window.ts as API Layer for Tauri commands - Add useWindowResize hook with HTML-based animations - Refactor lib/window.ts to re-export from services (backward compat) - Add CSS animation classes for smooth window resize transitions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
This PR is being reviewed by Cursor Bugbot
Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| } | ||
| }; | ||
| initSize(); | ||
| }, []); |
There was a problem hiding this comment.
Bug: Initial window size is zero causing wrong animation
The hook initializes currentSizeRef to { width: 0, height: 0 } and asynchronously fetches the actual window size via getWindowSize(). However, the consuming component's useEffect immediately calls resizeTo on mount, racing with the initialization. Since getWindowSize() involves IPC calls, resizeTo typically executes before initialization completes. This causes isGrowing to always be true (since any positive dimension exceeds 0), resulting in unnecessary vibrancy toggling and potentially the wrong animation direction on first load when the window may actually be shrinking.
- Set windowEffects.radius to 12px in tauri.conf.json for settings and commandpalette - Update WindowVibrancyAdapter to apply DEFAULT_WINDOW_RADIUS (12px) when enabling vibrancy - Change CSS border-radius from rounded-lg (8px) to rounded-xl (12px) to match native window - Fixes visible white edges in corners caused by mismatch between CSS and native window radius 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…dius - Remove rounded-xl from App.tsx and SettingsApp.tsx containers - Let windowEffects.radius handle corner clipping at native level - Fixes gray acrylic showing through CSS rounded corners 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
On Windows 11, undecorated windows need shadow: true to have rounded corners. The settings window had shadow enabled (default) and showed rounded corners, while commandpalette had shadow: false causing square corners. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1. Move windowEffects from tauri.conf.json to runtime initialization
- Remove static windowEffects config (was Windows-only "acrylic")
- Apply platform-specific effects in lib.rs setup:
- Windows: Acrylic with radius 12px
- macOS: HudWindow with radius 12px
- Linux: No effects (fallback)
2. Fix useWindowResize hook issues:
- Add isAnimatingRef guard to prevent concurrent resize calls
- Handle uninitialized size (0,0) by treating as growing animation
- Only update currentSizeRef on successful resize
- Export isInitialized state for consumers
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
| // Guard against concurrent calls | ||
| if (isAnimatingRef.current) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
Bug: Dropped resize requests cause incorrect window dimensions
The resizeTo function silently returns early when isAnimatingRef.current is true, dropping the resize request entirely. When combined with the React effect that calls resizeTo when mode changes, this creates a race condition: if the user switches modes (via Tab key) while an animation is in progress, the new resize request is discarded and the effect won't re-run after the animation completes because mode hasn't changed again. The window remains at the previous mode's dimensions instead of the current mode's dimensions.
Rust Backend (4-Layer DDD):
Frontend (3-Layer Architecture):
🤖 Generated with Claude Code
Note
Implements DDD-based window vibrancy via Tauri v2 window effects and adds an HTML/CSS resize flow, replacing the window-vibrancy crate and wiring a new API/adapter/use cases end-to-end.
VibrancyEffectandWindowVibrancyPort; implementSetWindowVibrancyUseCaseandGetWindowVibrancyStateUseCase.WindowVibrancyAdapterusing Tauri v2set_effects; tracks window registration/state.set_window_vibrancyTauri command; wire adapter/use cases intoAppStateandsetup.WindowEffectsConfigtosettingsandcommandpaletteinlib.rs.window-vibrancycrate; rely on built-in Tauri effects.services/window.ts(resizeAndCenter,animateResizeAndCenter,setWindowSizeImmediate,setVibrancy,getWindowSize);lib/window.tsre-exports for compatibility.useWindowResizehook for smooth HTML-based resize; temporarily disables vibrancy during animation; updateCommandPaletteto use it..window-contentanimation classes inindex.css; remove rounded corners from app/settings wrappers.tauri.conf.json: enable"shadow": trueforcommandpalettewindow.Written by Cursor Bugbot for commit 8ca2b79. This will update automatically on new commits. Configure here.