feat: progress on tankopedia search

This commit is contained in:
TrèsAbhi committed 2024-09-17 20:23:22 -05:00
1 parent c873c32d09
commit eebc33581c
20 files changed
+260 -232

No files matched your search

+4 -2
View File
@@ -11,7 +11,7 @@ export interface TankFilters {
searching: boolean;
}
export const $tankFilters = map<TankFilters>({
export const initialTankFilters : TankFilters = {
tiers: [],
nations: [],
classes: [],
@@ -19,4 +19,6 @@ export const $tankFilters = map<TankFilters>({
testing: 'include',
search: undefined,
searching: false,
});
}
export const $tankFilters = map<TankFilters>(initialTankFilters);
@@ -1,9 +1,5 @@
import { TankClass, Tier, TreeType } from '@blitzkit/core';
import lodash from 'lodash-es';
import { create } from 'zustand';
import { persist, subscribeWithSelector } from 'zustand/middleware';
import { ENVIRONMENTS } from '../../app/tools/tankopedia/[id]/components/Lighting';
import { createContextualSafeStore } from '../../core/zustand/createContextualSafeStore';
import type { TankClass, Tier, TreeType } from '@blitzkit/core';
import type { ENVIRONMENTS } from '../../components/Sandbox/components/Lighting';
import { SORT_NAMES, TankopediaDisplay } from './constants';
export type TankopediaSortBy = keyof typeof SORT_NAMES;
@@ -38,39 +34,39 @@ export interface TankopediaPersistent {
display: TankopediaDisplay;
}
export const { Provider, use, useMutation, useStore } =
createContextualSafeStore(() =>
create<TankopediaPersistent>()(
persist(
subscribeWithSelector<TankopediaPersistent>(() => ({
model: {
visual: {
showSpacedArmor: true,
showExternalModules: true,
showPrimaryArmor: true,
wireframe: false,
opaque: false,
environment: ENVIRONMENTS[0],
showGrid: true,
greenPenetration: false,
showEnvironment: false,
},
},
sort: {
by: 'meta.none',
direction: 'descending',
},
filters: {
tiers: [],
types: [],
treeTypes: [],
nations: [],
test: 'include',
page: 0,
},
display: TankopediaDisplay.Model,
})),
{ name: 'tankopedia', merge: (a, b) => lodash.merge(b, a) },
),
),
);
// export const { Provider, use, useMutation, useStore } =
// createContextualSafeStore(() =>
// create<TankopediaPersistent>()(
// persist(
// subscribeWithSelector<TankopediaPersistent>(() => ({
// model: {
// visual: {
// showSpacedArmor: true,
// showExternalModules: true,
// showPrimaryArmor: true,
// wireframe: false,
// opaque: false,
// environment: ENVIRONMENTS[0],
// showGrid: true,
// greenPenetration: false,
// showEnvironment: false,
// },
// },
// sort: {
// by: 'meta.none',
// direction: 'descending',
// },
// filters: {
// tiers: [],
// types: [],
// treeTypes: [],
// nations: [],
// test: 'include',
// page: 0,
// },
// display: TankopediaDisplay.Model,
// })),
// { name: 'tankopedia', merge: (a, b) => lodash.merge(b, a) },
// ),
// ),
// );