fix: fixing download sources migration

This commit is contained in:
Chubby Granny Chaser 2024-12-22 23:42:49 +00:00
parent 32032e1c8a
commit 496924b2a4
No known key found for this signature in database
2 changed files with 19 additions and 15 deletions

View File

@ -403,23 +403,27 @@ export default function Catalogue() {
color={filterCategoryColors.tags}
onClear={() => dispatch(setSearch({ tags: [] }))}
onSelect={(value) => {
if (filters.tags.includes(value)) {
if (filters.tags.includes(Number(value))) {
dispatch(
setSearch({
tags: filters.tags.filter((tag) => tag !== value),
tags: filters.tags.filter((tag) => tag !== Number(value)),
})
);
} else {
dispatch(setSearch({ tags: [...filters.tags, value] }));
dispatch(
setSearch({ tags: [...filters.tags, Number(value)] })
);
}
}}
items={Object.entries(steamUserTags)
.sort(([keyA], [keyB]) => keyA.localeCompare(keyB))
.map(([key, value]) => ({
label: key,
value: value,
checked: filters.tags.includes(value),
}))}
items={
Object.entries(steamUserTags)
.sort(([keyA], [keyB]) => keyA.localeCompare(keyB))
.map(([key, value]) => ({
label: key,
value: value,
checked: filters.tags.includes(value as number),
})) as any
}
/>
<FilterSection

View File

@ -4,25 +4,25 @@ import { useCallback, useMemo, useState } from "react";
import List from "rc-virtual-list";
export interface FilterSectionProps<T extends string | number> {
export interface FilterSectionProps {
title: string;
items: {
label: string;
value: T;
value: string;
checked: boolean;
}[];
onSelect: (value: T) => void;
onSelect: (value: string) => void;
color: string;
onClear: () => void;
}
export function FilterSection<T extends string | number>({
export function FilterSection({
title,
items,
color,
onSelect,
onClear,
}: FilterSectionProps<T>) {
}: FilterSectionProps) {
const [search, setSearch] = useState("");
const filteredItems = useMemo(() => {