lighter type info
This commit is contained in:
@@ -26,6 +26,7 @@ interface Props {
|
|||||||
items?: AcquiredType[];
|
items?: AcquiredType[];
|
||||||
infoOnly?: boolean;
|
infoOnly?: boolean;
|
||||||
showAll?: boolean;
|
showAll?: boolean;
|
||||||
|
ignoredColums?: string[] | string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Emits {
|
interface Emits {
|
||||||
@@ -36,15 +37,25 @@ interface Emits {
|
|||||||
const props = withDefaults(defineProps<Props>(), {
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
items: () => [],
|
items: () => [],
|
||||||
infoOnly: false,
|
infoOnly: false,
|
||||||
showAll: false
|
showAll: false,
|
||||||
|
ignoredColums: () => []
|
||||||
});
|
});
|
||||||
defineEmits<Emits>();
|
defineEmits<Emits>();
|
||||||
|
|
||||||
|
const columnsToIgnore = computed(() => {
|
||||||
|
const ic = typeof props.ignoredColums === 'string' ? [props.ignoredColums] : props.ignoredColums;
|
||||||
|
|
||||||
|
if (props.infoOnly && !ic.includes('buttons')) {
|
||||||
|
return [...ic, 'buttons'];
|
||||||
|
}
|
||||||
|
return ic;
|
||||||
|
});
|
||||||
|
|
||||||
const marketTaxStore = useMarketTaxStore();
|
const marketTaxStore = useMarketTaxStore();
|
||||||
|
|
||||||
const threshold = useStorage('market-acquisition-threshold', 10);
|
const threshold = useStorage('market-acquisition-threshold', 10);
|
||||||
const filter = ref("");
|
const filter = ref("");
|
||||||
const { sortedArray, headerProps } = useSort<Result>(computed(() => {
|
const { sortedArray, headerProps, showColumn } = useSort<Result>(computed(() => {
|
||||||
const filteredItems = props.items.filter(r => r.type.name.toLowerCase().includes(filter.value.toLowerCase()));
|
const filteredItems = props.items.filter(r => r.type.name.toLowerCase().includes(filter.value.toLowerCase()));
|
||||||
|
|
||||||
if (props.showAll) {
|
if (props.showAll) {
|
||||||
@@ -99,7 +110,8 @@ const { sortedArray, headerProps } = useSort<Result>(computed(() => {
|
|||||||
return list;
|
return list;
|
||||||
}), {
|
}), {
|
||||||
defaultSortKey: 'precentProfit',
|
defaultSortKey: 'precentProfit',
|
||||||
defaultSortDirection: 'desc'
|
defaultSortDirection: 'desc',
|
||||||
|
ignoredColums: columnsToIgnore
|
||||||
})
|
})
|
||||||
const getLineColor = (result: Result) => {
|
const getLineColor = (result: Result) => {
|
||||||
if (result.precentProfit >= (threshold.value / 100)) {
|
if (result.precentProfit >= (threshold.value / 100)) {
|
||||||
@@ -135,24 +147,24 @@ const getLineColor = (result: Result) => {
|
|||||||
<SortableHeader v-bind="headerProps" sortKey="remaining">Remaining Amount</SortableHeader>
|
<SortableHeader v-bind="headerProps" sortKey="remaining">Remaining Amount</SortableHeader>
|
||||||
<SortableHeader v-bind="headerProps" sortKey="precentProfit">Profit (%)</SortableHeader>
|
<SortableHeader v-bind="headerProps" sortKey="precentProfit">Profit (%)</SortableHeader>
|
||||||
<SortableHeader v-bind="headerProps" sortKey="iskProfit">Profit (ISK)</SortableHeader>
|
<SortableHeader v-bind="headerProps" sortKey="iskProfit">Profit (ISK)</SortableHeader>
|
||||||
<th v-if="!infoOnly" />
|
<SortableHeader v-bind="headerProps" sortKey="buttons" unsortable />
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="r in sortedArray" :key="r.id" :class="getLineColor(r)">
|
<tr v-for="r in sortedArray" :key="r.id" :class="getLineColor(r)">
|
||||||
<td>
|
<td v-if="showColumn('name')">
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<MarketTypeLabel :id="r.type.id" :name="r.name" />
|
<MarketTypeLabel :id="r.type.id" :name="r.name" />
|
||||||
<AcquisitionQuantilsTooltip :id="r.type.id" :buy="r.buy" :sell="r.sell" />
|
<AcquisitionQuantilsTooltip :id="r.type.id" :buy="r.buy" :sell="r.sell" />
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="text-right">{{ formatIsk(r.buy) }}</td>
|
<td v-if="showColumn('buy')" class="text-right">{{ formatIsk(r.buy) }}</td>
|
||||||
<td class="text-right">{{ formatIsk(r.sell) }}</td>
|
<td v-if="showColumn('sell')" class="text-right">{{ formatIsk(r.sell) }}</td>
|
||||||
<td class="text-right">{{ formatIsk(r.price) }}</td>
|
<td v-if="showColumn('price')" class="text-right">{{ formatIsk(r.price) }}</td>
|
||||||
<td class="text-right">{{ r.remaining }}/{{ r.quantity }}</td>
|
<td v-if="showColumn('remaining')" class="text-right">{{ r.remaining }}/{{ r.quantity }}</td>
|
||||||
<td class="text-right">{{ percentFormater.format(r.precentProfit) }}</td>
|
<td v-if="showColumn('precentProfit')" class="text-right">{{ percentFormater.format(r.precentProfit) }}</td>
|
||||||
<td class="text-right">{{ formatIsk(r.iskProfit) }}</td>
|
<td v-if="showColumn('iskProfit')" class="text-right">{{ formatIsk(r.iskProfit) }}</td>
|
||||||
<td class="text-right" v-if="!infoOnly">
|
<td v-if="showColumn('buttons')" class="text-right">
|
||||||
<button class="btn-icon me-1" @click="$emit('buy', r.acquisitions, r.price, r.buy, r.sell)"><PlusIcon /></button>
|
<button class="btn-icon me-1" @click="$emit('buy', r.acquisitions, r.price, r.buy, r.sell)"><PlusIcon /></button>
|
||||||
<button class="btn-icon me-1" @click="$emit('sell', r.acquisitions)"><MinusIcon /></button>
|
<button class="btn-icon me-1" @click="$emit('sell', r.acquisitions)"><MinusIcon /></button>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ type Result = {
|
|||||||
interface Props {
|
interface Props {
|
||||||
items?: TrackingResult[];
|
items?: TrackingResult[];
|
||||||
infoOnly?: boolean;
|
infoOnly?: boolean;
|
||||||
ignoredColums?: string[];
|
ignoredColums?: string[] | string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Emits {
|
interface Emits {
|
||||||
@@ -50,10 +50,12 @@ const threshold = useStorage('market-tracking-threshold', 10);
|
|||||||
const filter = ref("");
|
const filter = ref("");
|
||||||
const onlyCheap = ref(false);
|
const onlyCheap = ref(false);
|
||||||
const columnsToIgnore = computed(() => {
|
const columnsToIgnore = computed(() => {
|
||||||
if (props.infoOnly && !props.ignoredColums.includes('buttons')) {
|
const ic = typeof props.ignoredColums === 'string' ? [props.ignoredColums] : props.ignoredColums;
|
||||||
return [...props.ignoredColums, 'buttons'];
|
|
||||||
|
if (props.infoOnly && !ic.includes('buttons')) {
|
||||||
|
return [...ic, 'buttons'];
|
||||||
}
|
}
|
||||||
return props.ignoredColums;
|
return ic;
|
||||||
});
|
});
|
||||||
const { sortedArray, headerProps, showColumn } = useSort<Result>(computed(() => props.items
|
const { sortedArray, headerProps, showColumn } = useSort<Result>(computed(() => props.items
|
||||||
.filter(r => r.type.name.toLowerCase().includes(filter.value.toLowerCase()))
|
.filter(r => r.type.name.toLowerCase().includes(filter.value.toLowerCase()))
|
||||||
@@ -125,7 +127,7 @@ const getLineColor = (result: Result) => {
|
|||||||
<SortableHeader v-bind="headerProps" sortKey="q3">Q3</SortableHeader>
|
<SortableHeader v-bind="headerProps" sortKey="q3">Q3</SortableHeader>
|
||||||
<SortableHeader v-bind="headerProps" sortKey="profit">Profit</SortableHeader>
|
<SortableHeader v-bind="headerProps" sortKey="profit">Profit</SortableHeader>
|
||||||
<SortableHeader v-bind="headerProps" sortKey="score">Score</SortableHeader>
|
<SortableHeader v-bind="headerProps" sortKey="score">Score</SortableHeader>
|
||||||
<SortableHeader v-bind="headerProps" sortKey="buttons" unsortable></SortableHeader>
|
<SortableHeader v-bind="headerProps" sortKey="buttons" unsortable />
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|||||||
@@ -103,11 +103,11 @@ watch(useRoute(), async route => {
|
|||||||
</div>
|
</div>
|
||||||
<div v-if="result" class="mb-4">
|
<div v-if="result" class="mb-4">
|
||||||
<span>Market Info:</span>
|
<span>Market Info:</span>
|
||||||
<TrackingResultTable :items="[result]" infoOnly />
|
<TrackingResultTable :items="[result]" infoOnly ignoredColums="name" />
|
||||||
</div>
|
</div>
|
||||||
<div v-if="acquisitions && acquisitions.length > 0">
|
<div v-if="acquisitions && acquisitions.length > 0">
|
||||||
<span>Acquisitions:</span>
|
<span>Acquisitions:</span>
|
||||||
<AcquisitionResultTable :items="acquisitions" infoOnly showAll />
|
<AcquisitionResultTable :items="acquisitions" infoOnly showAll :ignoredColums="['name', 'buy', 'sell']" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<BuyModal ref="buyModal" />
|
<BuyModal ref="buyModal" />
|
||||||
|
|||||||
Reference in New Issue
Block a user