11<script setup lang="ts">
2- import type { DropdownMenuItem , SelectItem , TableColumn } from ' @nuxt/ui'
2+ import type { SelectItem , TableColumn } from ' @nuxt/ui'
33import type { ColumnFiltersState , RowSelectionState , SortingState } from ' @tanstack/vue-table'
44
55import {
@@ -71,7 +71,7 @@ usePageLoading(loadingItems)
7171
7272const flatItems = ref <ItemFlat []>([])
7373watch (items , () => {
74- flatItems .value = createItemIndex (items .value , true )
74+ flatItems .value = createItemIndex (items .value , false )
7575})
7676
7777const [buyItem] = useAsyncCallback (async (item : ItemFlat ) => {
@@ -130,6 +130,7 @@ const itemType = computed({
130130 resetCompareMode ()
131131 },
132132})
133+
133134const itemTypes = computed (() => getFacetsByItemType (flatItems .value .map (item => item .type )))
134135
135136const isUpgradableItemType = computed (() => canUpgradeItem (itemType .value ))
@@ -142,7 +143,9 @@ const weaponClass = computed({
142143 return getWeaponClassesByItemType (itemType .value ).at (0 ) ?? null
143144 },
144145 set(weaponClass : WeaponClass | null ) {
145- table .value ?.tableApi .setColumnFilters ([{ id: ' weaponClass' , value: weaponClass }])
146+ table .value ?.tableApi .setColumnFilters ([
147+ { id: ' weaponClass' , value: weaponClass },
148+ ])
146149 router .replace ({
147150 query: {
148151 type: itemType .value ,
@@ -163,7 +166,7 @@ const weaponClasses = computed(() => getFacetsByWeaponClass(flatItems.value
163166function getInitialColumnFiltersState(): ColumnFiltersState {
164167 return [
165168 { id: ' type' , value: itemType .value },
166- { id: ' weaponUsage' , value: [WEAPON_USAGE .Primary ] }, // TODO: FIXME:
169+ // { id: 'weaponUsage', value: [WEAPON_USAGE.Primary] }, // TODO: FIXME:
167170 ... (weaponClass .value ? [{ id: ' weaponClass' , value: weaponClass .value }] : []),
168171 ]
169172}
@@ -429,7 +432,6 @@ const columns = computed<TableColumn<ItemFlat>[]>(() => {
429432 h (UButton , {
430433 label: ` New (${_count }) ` ,
431434 color: ' success' ,
432- size: ' xl' ,
433435 variant: ' soft' ,
434436 activeVariant: ' solid' ,
435437 active: _value ,
@@ -446,24 +448,6 @@ const columns = computed<TableColumn<ItemFlat>[]>(() => {
446448 ... objectEntries (currentAggregations .value ).map (([key , options ]) => createTableColumn (key , options ! )),
447449 ]
448450})
449-
450- // const nonPrimaryWeaponModeFilter = computed((): DropdownMenuItem | null => {
451- // const _column = table.value?.tableApi.getColumn('weaponUsage')
452- // const _count = _column ? getFacets(_column.getFacetedUniqueValues())?.[WEAPON_USAGE.Secondary] || 0 : 0
453- // // if (!_count) {
454- // // return null
455- // // }
456- // return {
457- // label: `${t(`shop.nonPrimaryWeaponMode.title`)}${_count ? ` (${_count})` : ''}`,
458- // type: 'checkbox' as const,
459- // ...(_column && {
460- // checked: isEqual((_column.getFilterValue() || []), [WEAPON_USAGE.Secondary, WEAPON_USAGE.Primary]),
461- // onUpdateChecked(value) {
462- // _column.setFilterValue(value ? [WEAPON_USAGE.Secondary, WEAPON_USAGE.Primary] : [WEAPON_USAGE.Primary])
463- // },
464- // }),
465- // }
466- // })
467451 </script >
468452
469453<template >
0 commit comments