Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bugfix] remember option for map and playlist sorting #600

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[bugfix] remember option for playlist sorting
  • Loading branch information
silentrald committed Oct 5, 2024
commit 3d6a9b59bf4229f3469bb20623a051e93818d71a
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,17 @@ import BeatConflict from "../../../../../../../assets/images/apngs/beat-conflict
import { cn } from "renderer/helpers/css-class.helpers"
import { VirtualScroll } from "renderer/components/shared/virtual-scroll/virtual-scroll.component"
import { useTranslation } from "renderer/hooks/use-translation.hook"
import { ConfigurationService } from "renderer/services/configuration.service"

export const DownloadPlaylistModal: ModalComponent<void, {version: BSVersion, ownedPlaylists$: Observable<LocalBPListsDetails[]>, ownedMaps$: Observable<BsmLocalMap[]>}> = (
{ options: { data: { version, ownedPlaylists$, ownedMaps$ }} }
) => {

const t = useTranslation();

const modal = useService(ModalService);
const beatSaver = useService(BeatSaverService);
const config = useService(ConfigurationService);
const modal = useService(ModalService);
const playlistDownloader = useService(PlaylistDownloaderService);

const [playlists, setPlaylists] = useState<BsvPlaylist[]>(null);
Expand All @@ -41,7 +43,7 @@ export const DownloadPlaylistModal: ModalComponent<void, {version: BSVersion, ow
const [error, setError] = useState(false);
const [searchParams, setSearchParams] = useState<PlaylistSearchParams>({
q: "",
sortOrder: BsvSearchOrder.Relevance,
sortOrder: config.get("playlist-sort-order") || BsvSearchOrder.Relevance,
page: 0,
});

Expand All @@ -63,6 +65,7 @@ export const DownloadPlaylistModal: ModalComponent<void, {version: BSVersion, ow

const handleNewSearch = (value: Omit<PlaylistSearchParams, "page">) => {
setPlaylists(() => undefined);
config.set("playlist-sort-order", value.sortOrder);
setSearchParams(() => ({ ...value, page: 0}));
};

Expand Down
2 changes: 1 addition & 1 deletion src/renderer/config/default-configuration.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ export const defaultConfiguration: { [key in DefaultConfigKey]: any } = {
],
};

export type DefaultConfigKey = "first-color" | "second-color" | "theme" | "language" | "supported_languages" | "default_mods" | "default-shared-folders";
export type DefaultConfigKey = "first-color" | "second-color" | "theme" | "language" | "supported_languages" | "default_mods" | "default-shared-folders" | "playlist-sort-order";

export type ThemeConfig = "dark" | "light" | "os";