mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 02:37:05 +02:00
Merge pull request #280 from Hitjack007/filter-defaults
This commit is contained in:
4 files changed
+16
-7
No files matched your search
@@ -789,6 +789,7 @@ function OwnershipFilterInternal(props: FlexProps) {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
TankFilters.mutate((draft) => {
|
TankFilters.mutate((draft) => {
|
||||||
draft.showOwned = !draft.showOwned;
|
draft.showOwned = !draft.showOwned;
|
||||||
|
if (draft.showOwned) draft.showUnowned = false;
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -808,6 +809,7 @@ function OwnershipFilterInternal(props: FlexProps) {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
TankFilters.mutate((draft) => {
|
TankFilters.mutate((draft) => {
|
||||||
draft.showUnowned = !draft.showUnowned;
|
draft.showUnowned = !draft.showUnowned;
|
||||||
|
if (draft.showUnowned) draft.showOwned = false;
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -834,6 +836,7 @@ function TestFilter() {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
TankFilters.mutate((draft) => {
|
TankFilters.mutate((draft) => {
|
||||||
draft.showNonTesting = !draft.showNonTesting;
|
draft.showNonTesting = !draft.showNonTesting;
|
||||||
|
if (draft.showNonTesting) draft.showTesting = false;
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -854,6 +857,7 @@ function TestFilter() {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
TankFilters.mutate((draft) => {
|
TankFilters.mutate((draft) => {
|
||||||
draft.showTesting = !draft.showTesting;
|
draft.showTesting = !draft.showTesting;
|
||||||
|
if (draft.showTesting) draft.showNonTesting = false;
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -16,13 +16,15 @@ export async function filterTank(
|
|||||||
owned: number[] = [],
|
owned: number[] = [],
|
||||||
) {
|
) {
|
||||||
return (
|
return (
|
||||||
((filters.showOwned && owned.includes(tank.id)) ||
|
((!filters.showOwned && !filters.showUnowned) ||
|
||||||
|
(filters.showOwned && owned.includes(tank.id)) ||
|
||||||
(filters.showUnowned && !owned.includes(tank.id))) &&
|
(filters.showUnowned && !owned.includes(tank.id))) &&
|
||||||
(filters.tiers.length === 0 || filters.tiers.includes(tank.tier)) &&
|
(filters.tiers.length === 0 || filters.tiers.includes(tank.tier)) &&
|
||||||
(filters.nations.length === 0 || filters.nations.includes(tank.nation)) &&
|
(filters.nations.length === 0 || filters.nations.includes(tank.nation)) &&
|
||||||
(filters.classes.length === 0 || filters.classes.includes(tank.class)) &&
|
(filters.classes.length === 0 || filters.classes.includes(tank.class)) &&
|
||||||
(filters.types.length === 0 || filters.types.includes(tank.type)) &&
|
(filters.types.length === 0 || filters.types.includes(tank.type)) &&
|
||||||
((filters.showTesting && tank.testing) ||
|
((!filters.showTesting && !filters.showNonTesting) ||
|
||||||
|
(filters.showTesting && tank.testing) ||
|
||||||
(filters.showNonTesting && !tank.testing)) &&
|
(filters.showNonTesting && !tank.testing)) &&
|
||||||
(filters.gunType.length === 0 ||
|
(filters.gunType.length === 0 ||
|
||||||
(filters.gunType.includes("regular") &&
|
(filters.gunType.includes("regular") &&
|
||||||
|
|||||||
@@ -17,7 +17,10 @@ export function Page({
|
|||||||
}: Props & MaybeSkeletonComponentProps) {
|
}: Props & MaybeSkeletonComponentProps) {
|
||||||
const generated = Playlist.use((state) => state.list !== undefined);
|
const generated = Playlist.use((state) => state.list !== undefined);
|
||||||
|
|
||||||
if (App.state.logins.wargaming) TankFilters.state.showUnowned = false;
|
if (App.state.logins.wargaming) {
|
||||||
|
TankFilters.state.showOwned = true;
|
||||||
|
TankFilters.state.showUnowned = false;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<LocaleProvider locale={locale}>
|
<LocaleProvider locale={locale}>
|
||||||
|
|||||||
@@ -46,8 +46,8 @@ export const TankFilters = new Varuna<TankFilters>({
|
|||||||
abilities: [],
|
abilities: [],
|
||||||
powers: [],
|
powers: [],
|
||||||
|
|
||||||
showTesting: true,
|
showTesting: false,
|
||||||
showNonTesting: true,
|
showNonTesting: false,
|
||||||
showOwned: true,
|
showOwned: false,
|
||||||
showUnowned: true,
|
showUnowned: false,
|
||||||
});
|
});
|
||||||
Reference in new issue
Block a user