New eveal #32
@@ -24,5 +24,5 @@ export const useCharactersStore = defineStore('characters', () => {
|
||||
|
||||
refresh();
|
||||
|
||||
return {characters, findById, reloadActivities, refresh};
|
||||
return {characters, findById, reloadActivities};
|
||||
})
|
||||
@@ -74,7 +74,7 @@ export const useLedgersStore = defineStore('ledgers', () => {
|
||||
|
||||
onActivitiesProcessed(refresh);
|
||||
|
||||
return {ledgers, findById, findAllById, createMain, createCombined, updateMain, updateCombined, refresh};
|
||||
return {ledgers, findById, findAllById, createMain, createCombined, updateMain, updateCombined};
|
||||
})
|
||||
|
||||
const getLedgerId = (ledger: Ledger | string): string => typeof ledger == 'string' ? ledger : ledger.ledgerId;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import {SliderCheckbox} from '@/components';
|
||||
import {SortableHeader, useSort, VirtualScrollTable} from '@/components/table';
|
||||
import {MarketType, MarketTypeLabel, TaxInput, useMarketOrdersStore, useMarketTaxStore} from "@/market";
|
||||
import {getListedSellTypeIds, MarketType, MarketTypeLabel, TaxInput, useMarketTaxStore} from "@/market";
|
||||
import {MinusIcon, PlusIcon} from '@heroicons/vue/24/outline';
|
||||
import {useStorage} from '@vueuse/core';
|
||||
import {computedAsync, useStorage} from '@vueuse/core';
|
||||
import {computed, ref} from 'vue';
|
||||
import {AcquiredType} from './AcquiredType';
|
||||
import AcquisitionQuartilesTooltip from './AcquisitionQuartilesTooltip.vue';
|
||||
@@ -66,14 +66,15 @@ const columnsToIgnore = computed(() => {
|
||||
|
||||
const marketTaxStore = useMarketTaxStore();
|
||||
const ledgersStore = useLedgersStore();
|
||||
const marketOrdersStore = useMarketOrdersStore();
|
||||
|
||||
const listedTypeIds = computedAsync(getListedSellTypeIds, new Set<number>());
|
||||
|
||||
const threshold = useStorage('market-acquisition-threshold', 10);
|
||||
const filter = ref("");
|
||||
const unlistedOnly = ref(false);
|
||||
const matchesFilter = (r: AcquiredType) =>
|
||||
r.type.name.toLowerCase().includes(filter.value.toLowerCase())
|
||||
&& (!unlistedOnly.value || !marketOrdersStore.listedTypeIds.has(r.type.id));
|
||||
&& (!unlistedOnly.value || !listedTypeIds.value.has(r.type.id));
|
||||
const { sortedArray, headerProps, showColumn } = useSort<Result>(computed(() => {
|
||||
const filteredItems = props.items.filter(matchesFilter);
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ const sellModal = ref<typeof SellModal>();
|
||||
const apraisalStore = useApraisalStore();
|
||||
const enriched = ref<AcquiredType[]>([]);
|
||||
|
||||
watch(() => props.items, async itms => {
|
||||
const refresh = async (itms: RawAcquiredType[] = props.items) => {
|
||||
if (itms.length === 0) {
|
||||
enriched.value = [];
|
||||
return;
|
||||
@@ -40,7 +40,11 @@ watch(() => props.items, async itms => {
|
||||
sell: price.sell
|
||||
};
|
||||
});
|
||||
}, {immediate: true});
|
||||
};
|
||||
|
||||
watch(() => props.items, refresh, {immediate: true});
|
||||
|
||||
defineExpose({refresh});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -69,5 +69,5 @@ export const useAcquiredTypesStore = defineStore('market-acquisition', () => {
|
||||
|
||||
onActivitiesProcessed(refresh);
|
||||
|
||||
return { acquiredTypes: types, addAcquiredType, removeAcquiredType, processNewActivities, refresh };
|
||||
return { acquiredTypes: types, addAcquiredType, removeAcquiredType, processNewActivities };
|
||||
});
|
||||
|
||||
@@ -1,21 +1,7 @@
|
||||
import {defineStore} from "pinia";
|
||||
import {computed, ref} from "vue";
|
||||
import {marketApi} from "@/mammon";
|
||||
import {MarketOrderResponse, MarketOrderResponseDirectionEnum} from "@/generated/mammon";
|
||||
import {MarketOrderResponseDirectionEnum} from "@/generated/mammon";
|
||||
|
||||
export const useMarketOrdersStore = defineStore('market-orders', () => {
|
||||
const orders = ref<MarketOrderResponse[]>([]);
|
||||
|
||||
const listedTypeIds = computed(() => new Set(
|
||||
orders.value
|
||||
.filter(o => o.direction === MarketOrderResponseDirectionEnum.Sell)
|
||||
.map(o => o.marketTypeId)
|
||||
));
|
||||
|
||||
const refresh = () => marketApi.findAllMarketOrders()
|
||||
.then(response => orders.value = response.data);
|
||||
|
||||
refresh();
|
||||
|
||||
return {orders, listedTypeIds, refresh};
|
||||
});
|
||||
export const getListedSellTypeIds = (): Promise<Set<number>> => marketApi.findAllMarketOrders()
|
||||
.then(response => new Set(response.data
|
||||
.filter(o => o.direction === MarketOrderResponseDirectionEnum.Sell)
|
||||
.map(o => o.marketTypeId)));
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
import {AcquisitionsPanel, useAcquiredTypesStore} from '@/market/acquisition';
|
||||
import {ArrowPathIcon} from '@heroicons/vue/24/outline';
|
||||
import {useAutoRefresh} from '@/composables';
|
||||
import {ref} from 'vue';
|
||||
|
||||
const acquiredTypesStore = useAcquiredTypesStore();
|
||||
const panel = ref<InstanceType<typeof AcquisitionsPanel>>();
|
||||
|
||||
const refresh = async () => {
|
||||
await acquiredTypesStore.refresh();
|
||||
await panel.value?.refresh();
|
||||
}
|
||||
|
||||
const {active: autoRefresh, toggle: toggleAutoRefresh} = useAutoRefresh(refresh, 5 * 60 * 1000);
|
||||
@@ -22,6 +24,6 @@ const {active: autoRefresh, toggle: toggleAutoRefresh} = useAutoRefresh(refresh,
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<AcquisitionsPanel :items="acquiredTypesStore.acquiredTypes" ignoredColums="date" />
|
||||
<AcquisitionsPanel ref="panel" :items="acquiredTypesStore.acquiredTypes" ignoredColums="date" />
|
||||
</div>
|
||||
</template>
|
||||
+1
-1
@@ -24,7 +24,7 @@ export const useRuleBookStore = defineStore('rule-book', () => {
|
||||
|
||||
refresh();
|
||||
|
||||
return {ruleBook, refresh, update};
|
||||
return {ruleBook, update};
|
||||
})
|
||||
|
||||
export const fetchScriptDefinitions = (): Promise<string> =>
|
||||
|
||||
Reference in New Issue
Block a user