added icon, toast sonner and also new window opening#4
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds UI-driven folder-opening via Tauri dialogs and WebviewWindow(s), integrates Sonner toasts across the app (theme changes, game events, folder actions), registers the Tauri dialog plugin and related capability permissions, and introduces an /app route and app shell that reads a path search param for folder display. ChangesFolder Webview + Toast Integration
Sequence DiagramsequenceDiagram
participant User as User
participant Frontend as Frontend UI
participant FileDialog as Tauri File Dialog
participant WindowAPI as WebviewWindow API
participant AppWindow as /app Webview
participant Toast as Toast System
User->>Frontend: Click "Open Folder"
Frontend->>FileDialog: openDialog({ directory: true })
FileDialog-->>Frontend: returns folderPath
Frontend->>WindowAPI: new WebviewWindow("/app?path=<encoded>")
WindowAPI->>AppWindow: create & load /app with path param
AppWindow->>AppWindow: read search param, render folderName/path
Frontend->>Toast: show success/error toasts for actions/events
Toast->>User: displays notification
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (5)
src-tauri/icons/android/values/ic_launcher_background.xml (1)
3-3: ⚡ Quick winConsider using a brand color instead of pure white for better visibility.
Pure white (
#fff) as the launcher icon background may reduce visibility on launchers with light themes, making the icon harder to locate. Android's adaptive icon guidelines recommend using brand colors to improve recognition and ensure the icon stands out across different launcher backgrounds.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src-tauri/icons/android/values/ic_launcher_background.xml` at line 3, Replace the pure white background color for the launcher by updating the color resource named "ic_launcher_background" to a branded color (e.g., your primary brand hex or a reference like `@color/brand_primary`) so the adaptive launcher icon stands out on light themes; locate the <color name="ic_launcher_background"> entry and change "#fff" to your chosen brand hex (or a color resource reference) and verify contrast across light/dark launchers.src/routes/layout.css (1)
10-13: ⚡ Quick winScope the scroll lock to the custom window route.
Lines 10-13 live in the app-wide stylesheet imported by
src/routes/+layout.svelte, so this disables document scrolling for every route, not just the new folder window. If the intent is only to hide root scrollbars in/app, moveoverflow: hiddenbehind a route-scoped layout or wrapper instead of making it global.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/routes/layout.css` around lines 10 - 13, The global rule targeting html, body with overflow: hidden is applied app-wide; restrict the scroll lock to only the custom window route by removing or changing the html, body { overflow: hidden } rule and instead placing overflow: hidden on a route-scoped wrapper (e.g., the custom window container element or the route's +layout component) that wraps the /app window. Update the selector in the route-scoped layout or the custom window component (the wrapper class/ID used to render that route) so only that element disables scrolling, leaving the global html/body styles untouched.src/routes/+page.svelte (1)
10-10: ⚡ Quick winUnused import:
invokeis imported but never used.The
invokefunction from@tauri-apps/api/coreis not referenced anywhere in this file. Since theopenFolder()function creates windows directly viaWebviewWindowrather than invoking the Rust command, this import can be removed.🧹 Proposed fix
- import { invoke } from "@tauri-apps/api/core";🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/routes/`+page.svelte at line 10, Remove the unused import of invoke from "@tauri-apps/api/core" since it is never referenced; locate the import statement (import { invoke } from "@tauri-apps/api/core") at the top of the file and delete it—leave the openFolder() function and WebviewWindow usage unchanged.src/routes/app/+layout.svelte (2)
35-36: 💤 Low valueConsider using
$derivedfor reactive path values.
$state(params.path)captures the initial value and won't update ifparams.pathchanges. If the query param could change during the component's lifetime, these should be derived:♻️ Proposed fix
- let folderPath = $state(params.path); - let folderName = $state(folderPath.split(/[\\/]/).filter(Boolean).pop() ?? "Project"); + let folderPath = $derived(params.path); + let folderName = $derived(folderPath.split(/[\\/]/).filter(Boolean).pop() ?? "Project");🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/routes/app/`+layout.svelte around lines 35 - 36, The current code uses let folderPath = $state(params.path) and let folderName = $state(folderPath.split(/[\\/]/).filter(Boolean).pop() ?? "Project"), which reads a snapshot and won't update when params.path changes; replace these with derived stores so folderPath and folderName react to updates: create a derived store from state(params.path) (using $derived or derived(state, ...)) for folderPath, then derive folderName from that derived folderPath (splitting and defaulting to "Project") so both update automatically when params.path changes.
21-23: ⚡ Quick winUnused function:
isWindowsPlatformis defined but never called.This function duplicates the logic already performed in
onMount. Consider removing it.🧹 Proposed fix
- async function isWindowsPlatform(params) { - return (await platform()) === "windows"; - }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/routes/app/`+layout.svelte around lines 21 - 23, The function isWindowsPlatform is unused and duplicates logic already in the onMount block; remove the isWindowsPlatform function declaration to eliminate dead code (or alternatively replace the inline platform check in onMount with a call to isWindowsPlatform if you prefer DRY, referencing the function name isWindowsPlatform and the onMount usage) — update imports/usages accordingly and run tests/lint to ensure no remaining references.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src-tauri/capabilities/folder-windows.json`:
- Around line 6-17: The folder-window capabilities JSON currently grants
privileged APIs that the folder route (+page.svelte) does not use; remove the
unnecessary entries "dialog:allow-open" and
"core:webview:allow-create-webview-window" from the permissions array in
folder-windows.json (keep core:default, core:window/* and other non-privileged
entries), and verify no other privileged APIs remain so only the main window
retains dialog/Webview permissions.
In `@src-tauri/src/lib.rs`:
- Around line 21-22: The current manual encoding using path.replace(' ', "%20")
only handles spaces and breaks on special characters; replace that logic by
using the urlencoding crate to percent-encode the full path (use
urlencoding::encode on the path variable) and then use the returned encoded
string when building the url variable (the encoded/local variables in this code
snippet are encoded and url). Ensure you call to_string() or otherwise convert
the encoded result into a String before passing it to format! so the final url
is fully percent-encoded.
In `@src/routes/`+page.svelte:
- Around line 69-74: Replace the console-only error handling in the window
creation path with user-facing notifications: in the win.once("tauri://error",
...) handler and in the catch block that logs "Failed to open window:", invoke
the app's toast/notification API or dispatch a Svelte store update to show a
concise, user-friendly error toast (include a short message and optional
sanitized error detail for support). Ensure you reference the same win.once
handler and the catch block around the window-opening call so both async error
events and thrown exceptions surface a visible toast to the user.
---
Nitpick comments:
In `@src-tauri/icons/android/values/ic_launcher_background.xml`:
- Line 3: Replace the pure white background color for the launcher by updating
the color resource named "ic_launcher_background" to a branded color (e.g., your
primary brand hex or a reference like `@color/brand_primary`) so the adaptive
launcher icon stands out on light themes; locate the <color
name="ic_launcher_background"> entry and change "#fff" to your chosen brand hex
(or a color resource reference) and verify contrast across light/dark launchers.
In `@src/routes/`+page.svelte:
- Line 10: Remove the unused import of invoke from "@tauri-apps/api/core" since
it is never referenced; locate the import statement (import { invoke } from
"@tauri-apps/api/core") at the top of the file and delete it—leave the
openFolder() function and WebviewWindow usage unchanged.
In `@src/routes/app/`+layout.svelte:
- Around line 35-36: The current code uses let folderPath = $state(params.path)
and let folderName = $state(folderPath.split(/[\\/]/).filter(Boolean).pop() ??
"Project"), which reads a snapshot and won't update when params.path changes;
replace these with derived stores so folderPath and folderName react to updates:
create a derived store from state(params.path) (using $derived or derived(state,
...)) for folderPath, then derive folderName from that derived folderPath
(splitting and defaulting to "Project") so both update automatically when
params.path changes.
- Around line 21-23: The function isWindowsPlatform is unused and duplicates
logic already in the onMount block; remove the isWindowsPlatform function
declaration to eliminate dead code (or alternatively replace the inline platform
check in onMount with a call to isWindowsPlatform if you prefer DRY, referencing
the function name isWindowsPlatform and the onMount usage) — update
imports/usages accordingly and run tests/lint to ensure no remaining references.
In `@src/routes/layout.css`:
- Around line 10-13: The global rule targeting html, body with overflow: hidden
is applied app-wide; restrict the scroll lock to only the custom window route by
removing or changing the html, body { overflow: hidden } rule and instead
placing overflow: hidden on a route-scoped wrapper (e.g., the custom window
container element or the route's +layout component) that wraps the /app window.
Update the selector in the route-scoped layout or the custom window component
(the wrapper class/ID used to render that route) so only that element disables
scrolling, leaving the global html/body styles untouched.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 13e1f442-abf3-403d-b542-c9232535bd36
⛔ Files ignored due to path filters (55)
app-icon.pngis excluded by!**/*.pngbun.lockis excluded by!**/*.locksrc-tauri/Cargo.lockis excluded by!**/*.locksrc-tauri/icons/128x128.pngis excluded by!**/*.pngsrc-tauri/icons/128x128@2x.pngis excluded by!**/*.pngsrc-tauri/icons/32x32.pngis excluded by!**/*.pngsrc-tauri/icons/64x64.pngis excluded by!**/*.pngsrc-tauri/icons/Square107x107Logo.pngis excluded by!**/*.pngsrc-tauri/icons/Square142x142Logo.pngis excluded by!**/*.pngsrc-tauri/icons/Square150x150Logo.pngis excluded by!**/*.pngsrc-tauri/icons/Square284x284Logo.pngis excluded by!**/*.pngsrc-tauri/icons/Square30x30Logo.pngis excluded by!**/*.pngsrc-tauri/icons/Square310x310Logo.pngis excluded by!**/*.pngsrc-tauri/icons/Square44x44Logo.pngis excluded by!**/*.pngsrc-tauri/icons/Square71x71Logo.pngis excluded by!**/*.pngsrc-tauri/icons/Square89x89Logo.pngis excluded by!**/*.pngsrc-tauri/icons/StoreLogo.pngis excluded by!**/*.pngsrc-tauri/icons/android/mipmap-hdpi/ic_launcher.pngis excluded by!**/*.pngsrc-tauri/icons/android/mipmap-hdpi/ic_launcher_foreground.pngis excluded by!**/*.pngsrc-tauri/icons/android/mipmap-hdpi/ic_launcher_round.pngis excluded by!**/*.pngsrc-tauri/icons/android/mipmap-mdpi/ic_launcher.pngis excluded by!**/*.pngsrc-tauri/icons/android/mipmap-mdpi/ic_launcher_foreground.pngis excluded by!**/*.pngsrc-tauri/icons/android/mipmap-mdpi/ic_launcher_round.pngis excluded by!**/*.pngsrc-tauri/icons/android/mipmap-xhdpi/ic_launcher.pngis excluded by!**/*.pngsrc-tauri/icons/android/mipmap-xhdpi/ic_launcher_foreground.pngis excluded by!**/*.pngsrc-tauri/icons/android/mipmap-xhdpi/ic_launcher_round.pngis excluded by!**/*.pngsrc-tauri/icons/android/mipmap-xxhdpi/ic_launcher.pngis excluded by!**/*.pngsrc-tauri/icons/android/mipmap-xxhdpi/ic_launcher_foreground.pngis excluded by!**/*.pngsrc-tauri/icons/android/mipmap-xxhdpi/ic_launcher_round.pngis excluded by!**/*.pngsrc-tauri/icons/android/mipmap-xxxhdpi/ic_launcher.pngis excluded by!**/*.pngsrc-tauri/icons/android/mipmap-xxxhdpi/ic_launcher_foreground.pngis excluded by!**/*.pngsrc-tauri/icons/android/mipmap-xxxhdpi/ic_launcher_round.pngis excluded by!**/*.pngsrc-tauri/icons/icon.icois excluded by!**/*.icosrc-tauri/icons/icon.pngis excluded by!**/*.pngsrc-tauri/icons/ios/AppIcon-20x20@1x.pngis excluded by!**/*.pngsrc-tauri/icons/ios/AppIcon-20x20@2x-1.pngis excluded by!**/*.pngsrc-tauri/icons/ios/AppIcon-20x20@2x.pngis excluded by!**/*.pngsrc-tauri/icons/ios/AppIcon-20x20@3x.pngis excluded by!**/*.pngsrc-tauri/icons/ios/AppIcon-29x29@1x.pngis excluded by!**/*.pngsrc-tauri/icons/ios/AppIcon-29x29@2x-1.pngis excluded by!**/*.pngsrc-tauri/icons/ios/AppIcon-29x29@2x.pngis excluded by!**/*.pngsrc-tauri/icons/ios/AppIcon-29x29@3x.pngis excluded by!**/*.pngsrc-tauri/icons/ios/AppIcon-40x40@1x.pngis excluded by!**/*.pngsrc-tauri/icons/ios/AppIcon-40x40@2x-1.pngis excluded by!**/*.pngsrc-tauri/icons/ios/AppIcon-40x40@2x.pngis excluded by!**/*.pngsrc-tauri/icons/ios/AppIcon-40x40@3x.pngis excluded by!**/*.pngsrc-tauri/icons/ios/AppIcon-512@2x.pngis excluded by!**/*.pngsrc-tauri/icons/ios/AppIcon-60x60@2x.pngis excluded by!**/*.pngsrc-tauri/icons/ios/AppIcon-60x60@3x.pngis excluded by!**/*.pngsrc-tauri/icons/ios/AppIcon-76x76@1x.pngis excluded by!**/*.pngsrc-tauri/icons/ios/AppIcon-76x76@2x.pngis excluded by!**/*.pngsrc-tauri/icons/ios/AppIcon-83.5x83.5@2x.pngis excluded by!**/*.pngstatic/svelte.svgis excluded by!**/*.svgstatic/tauri.svgis excluded by!**/*.svgstatic/vite.svgis excluded by!**/*.svg
📒 Files selected for processing (17)
.gitignorepackage.jsonsrc-tauri/Cargo.tomlsrc-tauri/capabilities/default.jsonsrc-tauri/capabilities/folder-windows.jsonsrc-tauri/icons/android/mipmap-anydpi-v26/ic_launcher.xmlsrc-tauri/icons/android/values/ic_launcher_background.xmlsrc-tauri/icons/icon.icnssrc-tauri/src/lib.rssrc/lib/components/themetoggle.sveltesrc/lib/components/ui/sonner/index.jssrc/lib/components/ui/sonner/sonner.sveltesrc/routes/+layout.sveltesrc/routes/+page.sveltesrc/routes/app/+layout.sveltesrc/routes/app/+page.sveltesrc/routes/layout.css
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/routes/`+page.svelte:
- Line 60: The title expression can return an empty string for paths ending with
separators; update the title assignment that currently uses the "selected"
variable (the title: selected.split(/[/\\]/).pop() ?? "Project" line) to ensure
a truthy fallback by removing empty path segments before taking the last element
(e.g., filter(Boolean) on the split result) or by coalescing with || instead of
?? so an empty string falls back to "Project"; modify the title property
accordingly.
- Around line 47-53: The call to openDialog in async function openFolder can
reject before the existing try/catch runs; move the await openDialog({...})
invocation inside the existing try block in openFolder so any rejection is
caught and the catch block (which shows the user-facing toast) executes; update
control flow to return early if selected is falsy after the try so behavior is
unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 8a843107-f32e-4959-a99a-c4228904cf3a
📒 Files selected for processing (2)
src-tauri/src/lib.rssrc/routes/+page.svelte
🚧 Files skipped from review as they are similar to previous changes (1)
- src-tauri/src/lib.rs
Summary by CodeRabbit
New Features
Style