fix: fix a few typos
This commit is contained in:
@@ -37,7 +37,7 @@ describe('useSort', () => {
|
||||
})
|
||||
|
||||
test('Hides ignored columns', () => {
|
||||
const { showColumn } = useSort(array, { ignoredColums: ['key1'] })
|
||||
const { showColumn } = useSort(array, { ignoredColumns: ['key1'] })
|
||||
|
||||
expect(showColumn('key1')).toBe(false)
|
||||
})
|
||||
|
||||
@@ -5,7 +5,7 @@ export type SortDirection = "asc" | "desc";
|
||||
export type UseSortOptions = {
|
||||
defaultSortKey?: string;
|
||||
defaultSortDirection?: SortDirection;
|
||||
ignoredColums?: MaybeRefOrGetter<string[]>;
|
||||
ignoredColumns?: MaybeRefOrGetter<string[]>;
|
||||
headerComponent?: HeaderComponent;
|
||||
};
|
||||
|
||||
@@ -16,7 +16,7 @@ export const useSort = <T>(array: MaybeRefOrGetter<T[]>, options?: UseSortOption
|
||||
sortKey.value = key;
|
||||
sortDirection.value = direction;
|
||||
};
|
||||
const showColumn = (sortKey: string) => !toValue(options?.ignoredColums)?.includes(sortKey);
|
||||
const showColumn = (sortKey: string) => !toValue(options?.ignoredColumns)?.includes(sortKey);
|
||||
const headerProps = computed(() => ({
|
||||
onSort: sortBy,
|
||||
showColumn,
|
||||
|
||||
@@ -31,7 +31,7 @@ interface Props {
|
||||
items?: AcquiredType[];
|
||||
infoOnly?: boolean;
|
||||
showAll?: boolean;
|
||||
ignoredColums?: string[] | string;
|
||||
ignoredColumns?: string[] | string;
|
||||
defaultSortKey?: string;
|
||||
}
|
||||
|
||||
@@ -44,24 +44,24 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
items: () => [],
|
||||
infoOnly: false,
|
||||
showAll: false,
|
||||
ignoredColums: () => [],
|
||||
ignoredColumns: () => [],
|
||||
defaultSortKey: 'precentProfit',
|
||||
});
|
||||
defineEmits<Emits>();
|
||||
|
||||
const columnsToIgnore = computed(() => {
|
||||
const ignoredColums = typeof props.ignoredColums === 'string' ? [props.ignoredColums] : [...props.ignoredColums];
|
||||
const ignoredColumns = typeof props.ignoredColumns === 'string' ? [props.ignoredColumns] : [...props.ignoredColumns];
|
||||
|
||||
if (props.infoOnly && !ignoredColums.includes('buttons')) {
|
||||
ignoredColums.push('buttons');
|
||||
if (props.infoOnly && !ignoredColumns.includes('buttons')) {
|
||||
ignoredColumns.push('buttons');
|
||||
}
|
||||
if (!props.showAll && !ignoredColums.includes('ledger')) {
|
||||
ignoredColums.push('ledger');
|
||||
if (!props.showAll && !ignoredColumns.includes('ledger')) {
|
||||
ignoredColumns.push('ledger');
|
||||
}
|
||||
if (ignoredColums.includes('ledger')) {
|
||||
ignoredColums.push('ledgerName');
|
||||
if (ignoredColumns.includes('ledger')) {
|
||||
ignoredColumns.push('ledgerName');
|
||||
}
|
||||
return ignoredColums;
|
||||
return ignoredColumns;
|
||||
});
|
||||
|
||||
const marketTaxStore = useMarketTaxStore();
|
||||
@@ -136,7 +136,7 @@ const { sortedArray, headerProps, showColumn } = useSort<Result>(computed(() =>
|
||||
}), {
|
||||
defaultSortKey: props.defaultSortKey,
|
||||
defaultSortDirection: 'desc',
|
||||
ignoredColums: columnsToIgnore
|
||||
ignoredColumns: columnsToIgnore
|
||||
})
|
||||
const getLineColor = (result: Result) => {
|
||||
if (result.precentProfit >= (threshold.value / 100)) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import {getMarketTypes, MarketTypePrice, useApraisalStore} from "@/market";
|
||||
import {getMarketTypes, MarketTypePrice, useAppraisalStore} from "@/market";
|
||||
import {ref, watch} from 'vue';
|
||||
import {AcquiredType} from './AcquiredType';
|
||||
import {RawAcquiredType} from './acquisition';
|
||||
@@ -9,7 +9,7 @@ import SellModal from './SellModal.vue';
|
||||
|
||||
interface Props {
|
||||
items: RawAcquiredType[];
|
||||
ignoredColums?: string[] | string;
|
||||
ignoredColumns?: string[] | string;
|
||||
ledgerId?: string;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ const props = defineProps<Props>();
|
||||
const buyModal = ref<typeof BuyModal>();
|
||||
const sellModal = ref<typeof SellModal>();
|
||||
|
||||
const apraisalStore = useApraisalStore();
|
||||
const appraisalStore = useAppraisalStore();
|
||||
const enriched = ref<AcquiredType[]>([]);
|
||||
|
||||
const refresh = async (itms: RawAcquiredType[] = props.items) => {
|
||||
@@ -28,7 +28,7 @@ const refresh = async (itms: RawAcquiredType[] = props.items) => {
|
||||
}
|
||||
|
||||
const types = await getMarketTypes([...new Set(itms.map(i => i.type))]);
|
||||
const prices = await apraisalStore.getPrices(types);
|
||||
const prices = await appraisalStore.getPrices(types);
|
||||
|
||||
enriched.value = itms.map(i => {
|
||||
const price = prices.find(p => p.type.id === i.type) as MarketTypePrice;
|
||||
@@ -49,7 +49,7 @@ defineExpose({refresh});
|
||||
|
||||
<template>
|
||||
<template v-if="enriched.length > 0">
|
||||
<AcquisitionResultTable :items="enriched" :ignoredColums="ignoredColums" @buy="(types, price, buy, sell) => buyModal?.open(types[0].type, { 'Price': price, 'Buy': buy, 'Sell': sell }, props.ledgerId)" @sell="types => sellModal?.open(types, props.ledgerId)" />
|
||||
<AcquisitionResultTable :items="enriched" :ignoredColumns="ignoredColumns" @buy="(types, price, buy, sell) => buyModal?.open(types[0].type, { 'Price': price, 'Buy': buy, 'Sell': sell }, props.ledgerId)" @sell="types => sellModal?.open(types, props.ledgerId)" />
|
||||
<BuyModal ref="buyModal" />
|
||||
<SellModal ref="sellModal" />
|
||||
</template>
|
||||
|
||||
@@ -8,7 +8,7 @@ import {getMammonPrices} from './mammon';
|
||||
const CACHE_DURATION = 1000 * 60 * 5; // 5 minutes
|
||||
const BATCH_SIZE = 100;
|
||||
|
||||
export const useApraisalStore = defineStore('appraisal', () => {
|
||||
export const useAppraisalStore = defineStore('appraisal', () => {
|
||||
const cache: RegionalMarketCache<MarketTypePrice> = new RegionalMarketCache(CACHE_DURATION);
|
||||
|
||||
const getPricesUncached = getMammonPrices;
|
||||
|
||||
@@ -27,7 +27,7 @@ type Result = {
|
||||
interface Props {
|
||||
items?: ScanResult[];
|
||||
infoOnly?: boolean;
|
||||
ignoredColums?: string[] | string;
|
||||
ignoredColumns?: string[] | string;
|
||||
}
|
||||
|
||||
const scoreFormater = new Intl.NumberFormat("en-US", {
|
||||
@@ -40,7 +40,7 @@ const volumeFormater = new Intl.NumberFormat("en-US", {
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
items: () => [],
|
||||
infoOnly: false,
|
||||
ignoredColums: () => []
|
||||
ignoredColumns: () => []
|
||||
});
|
||||
|
||||
const acquiredTypesStore = useAcquiredTypesStore();
|
||||
@@ -54,7 +54,7 @@ const trackedTrends = useStorage<MarketTrend[]>('market-scan-trends', [
|
||||
MarketTrends.Down,
|
||||
]);
|
||||
const columnsToIgnore = computed(() =>
|
||||
typeof props.ignoredColums === 'string' ? [props.ignoredColums] : props.ignoredColums
|
||||
typeof props.ignoredColumns === 'string' ? [props.ignoredColumns] : props.ignoredColumns
|
||||
);
|
||||
const { sortedArray, headerProps, showColumn } = useSort<Result>(computed(() => props.items
|
||||
.filter(r => r.type.name.toLowerCase().includes(filter.value.toLowerCase()))
|
||||
@@ -82,7 +82,7 @@ const { sortedArray, headerProps, showColumn } = useSort<Result>(computed(() =>
|
||||
}).filter(r => !onlyCheap.value || (r.buy <= r.q1 && r.profit >= (threshold.value / 100)))), {
|
||||
defaultSortKey: 'score',
|
||||
defaultSortDirection: 'desc',
|
||||
ignoredColums: columnsToIgnore
|
||||
ignoredColumns: columnsToIgnore
|
||||
})
|
||||
const getLineColor = (result: Result) => {
|
||||
if (props.infoOnly) {
|
||||
|
||||
@@ -19,6 +19,6 @@ const items = useProcessedResource<RawAcquiredType[]>(async () => {
|
||||
|
||||
<template>
|
||||
<div class="mt-4">
|
||||
<AcquisitionsPanel :items="items" :ledgerId="ledgerId" :ignoredColums="['date', 'ledger']" />
|
||||
<AcquisitionsPanel :items="items" :ledgerId="ledgerId" :ignoredColumns="['date', 'ledger']" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -24,6 +24,6 @@ const {active: autoRefresh, toggle: toggleAutoRefresh} = useAutoRefresh(refresh,
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<AcquisitionsPanel ref="panel" :items="acquiredTypesStore.acquiredTypes" ignoredColums="date" />
|
||||
<AcquisitionsPanel ref="panel" :items="acquiredTypesStore.acquiredTypes" ignoredColumns="date" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import {ClipboardButton} from '@/components';
|
||||
import {getMarketType, MarketType, MarketTypeInput, useApraisalStore, useMarketTaxStore} from "@/market";
|
||||
import {getMarketType, MarketType, MarketTypeInput, useAppraisalStore, useMarketTaxStore} from "@/market";
|
||||
import {AcquisitionResultTable, BuyModal} from '@/market/acquisition';
|
||||
import {ScanResultTable, toScanResult} from '@/market/scan';
|
||||
import {acquisitionApi, marketApi} from "@/mammon";
|
||||
@@ -18,10 +18,10 @@ const router = useRouter();
|
||||
const item = ref<MarketType>();
|
||||
const inputItem = ref<MarketType>();
|
||||
|
||||
const apraisalStore = useApraisalStore();
|
||||
const appraisalStore = useAppraisalStore();
|
||||
const marketTaxStore = useMarketTaxStore();
|
||||
const days = useStorage('market-scan-days', 365);
|
||||
const price = computedAsync(() => item.value ? apraisalStore.getPrice(item.value) : undefined);
|
||||
const price = computedAsync(() => item.value ? appraisalStore.getPrice(item.value) : undefined);
|
||||
const result = computedAsync(async () => {
|
||||
if (!item.value) {
|
||||
return undefined;
|
||||
@@ -107,11 +107,11 @@ watch(useRoute(), async route => {
|
||||
</div>
|
||||
<div v-if="result" class="mb-4">
|
||||
<span>Market Info:</span>
|
||||
<ScanResultTable :items="[result]" infoOnly :ignoredColums="['name', 'acquisitions']" />
|
||||
<ScanResultTable :items="[result]" infoOnly :ignoredColumns="['name', 'acquisitions']" />
|
||||
</div>
|
||||
<div v-if="acquisitions && acquisitions.length > 0">
|
||||
<span>Acquisitions:</span>
|
||||
<AcquisitionResultTable :items="acquisitions" infoOnly showAll :ignoredColums="['name', 'buy', 'sell']" defaultSortKey="date"/>
|
||||
<AcquisitionResultTable :items="acquisitions" infoOnly showAll :ignoredColumns="['name', 'buy', 'sell']" defaultSortKey="date"/>
|
||||
</div>
|
||||
</template>
|
||||
<BuyModal ref="buyModal" />
|
||||
|
||||
Reference in New Issue
Block a user