Restore favorites for local wallpapers - #126
Open
jrwhip wants to merge 1 commit into
Open
Conversation
Local favorites were lost in the 4.0.0 rewrite: the Go favorites service still handles type "local" and FavoritesView still renders them, but LocalBrowser never exposed a way to add one. - Add a favorites store so heart state comes from one reactive list instead of an IsFavorite IPC call per card - Give WallpaperTile the same heart button as WallpaperCard; drop the topRight snippet that only existed for the Favorites remove button - Wire the heart in LocalBrowser; FavoritesView and WallpaperCard read and toggle through the shared store
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Local wallpapers can't be favorited since the 4.0.0 rewrite. The Go favorites service still handles
type: "local"andFavoritesViewstill renders them (its empty state even says "Tap the heart on any wallpaper in Wallhaven or Local"), butLocalBrowsernever got a heart button.stores/favorites.svelte.ts: one reactive favorites list;isFavorite()/toggleFavorite()/refreshFavorites(). Lets the Local grid show heart state without anIsFavoriteIPC call per card (relevant at 10k+ wallpapers).WallpaperTilegetsisFavorited/onfavoriteprops and renders the same heart asWallpaperCard. ThetopRightsnippet, which only existed for the Favorites remove button, is dropped.LocalBrowserwires the heart (ToggleFavorite(path, "local", {name})).FavoritesViewandWallpaperCardread/toggle through the store so all three tabs stay in sync.FavoritesViewstill refreshes from the backend on mount.No Go changes.
Testing
svelte-check: 0 errorswails dev: hearted a local wallpaper, confirmed it appears in Favorites, removed it from Favorites, confirmed the Local heart cleared; persists across restart