Compare commits
2
Commits
new-runner
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
617650929a | ||
|
|
fb9567eee5 |
@@ -1,7 +1,7 @@
|
|||||||
<script setup lang="ts" generic="T">
|
<script setup lang="ts" generic="T">
|
||||||
import {vOnClickOutside} from '@vueuse/components';
|
import {vOnClickOutside} from '@vueuse/components';
|
||||||
import {useVirtualList} from '@vueuse/core';
|
import {useVirtualList} from '@vueuse/core';
|
||||||
import {computed, ref} from 'vue';
|
import {computed, ref, watch} from 'vue';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
items: T[];
|
items: T[];
|
||||||
@@ -15,6 +15,12 @@ const props = withDefaults(defineProps<Props>(), {
|
|||||||
const modelValue = defineModel<T>();
|
const modelValue = defineModel<T>();
|
||||||
|
|
||||||
const isOpen = ref(false);
|
const isOpen = ref(false);
|
||||||
|
|
||||||
|
watch(() => props.items, items => {
|
||||||
|
if (items.length > 0) {
|
||||||
|
isOpen.value = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
const currentIndex = ref(-1);
|
const currentIndex = ref(-1);
|
||||||
const {list, scrollTo, containerProps, wrapperProps} = useVirtualList(computed(() => props.items), {
|
const {list, scrollTo, containerProps, wrapperProps} = useVirtualList(computed(() => props.items), {
|
||||||
itemHeight: () => props.itemHeight,
|
itemHeight: () => props.itemHeight,
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import {getMarketTypes, getPrices, MarketTypePrice} from "@/market";
|
|||||||
import {ref, watch} from 'vue';
|
import {ref, watch} from 'vue';
|
||||||
import {ArrowPathIcon} from '@heroicons/vue/24/outline';
|
import {ArrowPathIcon} from '@heroicons/vue/24/outline';
|
||||||
import {useAutoRefresh} from '@/composables';
|
import {useAutoRefresh} from '@/composables';
|
||||||
|
import {MarketLocationInput, useMarketLocationStore} from '@/market/location';
|
||||||
import {AcquiredType} from './AcquiredType';
|
import {AcquiredType} from './AcquiredType';
|
||||||
import {RawAcquiredType} from './acquisition';
|
import {RawAcquiredType} from './acquisition';
|
||||||
import AcquisitionResultTable from './AcquisitionResultTable.vue';
|
import AcquisitionResultTable from './AcquisitionResultTable.vue';
|
||||||
@@ -20,6 +21,7 @@ const props = defineProps<Props>();
|
|||||||
const buyModal = ref<typeof BuyModal>();
|
const buyModal = ref<typeof BuyModal>();
|
||||||
const sellModal = ref<typeof SellModal>();
|
const sellModal = ref<typeof SellModal>();
|
||||||
|
|
||||||
|
const marketLocationStore = useMarketLocationStore();
|
||||||
const enriched = ref<AcquiredType[]>([]);
|
const enriched = ref<AcquiredType[]>([]);
|
||||||
|
|
||||||
const refresh = async (itms: RawAcquiredType[] = props.items) => {
|
const refresh = async (itms: RawAcquiredType[] = props.items) => {
|
||||||
@@ -29,7 +31,7 @@ const refresh = async (itms: RawAcquiredType[] = props.items) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const types = await getMarketTypes([...new Set(itms.map(i => i.type))]);
|
const types = await getMarketTypes([...new Set(itms.map(i => i.type))]);
|
||||||
const prices = await getPrices(types);
|
const prices = await getPrices(types, marketLocationStore.location.id);
|
||||||
|
|
||||||
enriched.value = itms.map(i => {
|
enriched.value = itms.map(i => {
|
||||||
const price = prices.find(p => p.type.id === i.type) as MarketTypePrice;
|
const price = prices.find(p => p.type.id === i.type) as MarketTypePrice;
|
||||||
@@ -43,18 +45,21 @@ const refresh = async (itms: RawAcquiredType[] = props.items) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
watch(() => props.items, refresh, {immediate: true});
|
watch([() => props.items, () => marketLocationStore.location], ([itms]) => refresh(itms), {immediate: true});
|
||||||
|
|
||||||
const {active: autoRefresh, toggle: toggleAutoRefresh} = useAutoRefresh(() => refresh(), 5 * 60 * 1000);
|
const {active: autoRefresh, toggle: toggleAutoRefresh} = useAutoRefresh(() => refresh(), 5 * 60 * 1000);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<div class="ms-auto flex">
|
<div class="ms-auto flex items-center gap-2">
|
||||||
<button class="rounded-e-none" @click="refresh()">Refresh</button>
|
<MarketLocationInput v-model="marketLocationStore.location" />
|
||||||
<button class="rounded-s-none border-s-0 flex items-center" :class="{ 'bg-slate-700': autoRefresh }" title="Auto refresh" @click="toggleAutoRefresh">
|
<div class="flex">
|
||||||
<ArrowPathIcon class="w-5 h-5" :class="{ 'animate-spin': autoRefresh }" />
|
<button class="rounded-e-none" @click="refresh()">Refresh</button>
|
||||||
</button>
|
<button class="rounded-s-none border-s-0 flex items-center" :class="{ 'bg-slate-700': autoRefresh }" title="Auto refresh" @click="toggleAutoRefresh">
|
||||||
|
<ArrowPathIcon class="w-5 h-5" :class="{ 'animate-spin': autoRefresh }" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<template v-if="enriched.length > 0">
|
<template v-if="enriched.length > 0">
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
|
export * from './location';
|
||||||
export * from './MarketLocation';
|
export * from './MarketLocation';
|
||||||
export { default as MarketLocationInput } from './MarketLocationInput.vue';
|
export { default as MarketLocationInput } from './MarketLocationInput.vue';
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import {useLocalStorage} from "@vueuse/core";
|
||||||
|
import {defineStore} from "pinia";
|
||||||
|
import type {MarketLocation} from "./MarketLocation";
|
||||||
|
|
||||||
|
const defaultLocation: MarketLocation = {
|
||||||
|
id: 60003760,
|
||||||
|
name: 'Jita IV - Moon 4 - Caldari Navy Assembly Plant',
|
||||||
|
systemId: 30000142,
|
||||||
|
systemName: 'Jita',
|
||||||
|
regionId: 10000002,
|
||||||
|
regionName: 'The Forge',
|
||||||
|
};
|
||||||
|
|
||||||
|
export const useMarketLocationStore = defineStore("marketLocation", () => {
|
||||||
|
const location = useLocalStorage<MarketLocation>("market-location", defaultLocation);
|
||||||
|
|
||||||
|
return {location};
|
||||||
|
});
|
||||||
@@ -3,9 +3,11 @@ import {RouterLink, RouterView} from 'vue-router';
|
|||||||
import {appraiseItemBalances, getLedgerBalance, isMain, LedgerLabel, useLedgerParam} from "@/ledger";
|
import {appraiseItemBalances, getLedgerBalance, isMain, LedgerLabel, useLedgerParam} from "@/ledger";
|
||||||
import {routeNames} from "@/routes.ts";
|
import {routeNames} from "@/routes.ts";
|
||||||
import {getMarketTypes, getPrices, IskLabel} from "@/market";
|
import {getMarketTypes, getPrices, IskLabel} from "@/market";
|
||||||
|
import {useMarketLocationStore} from '@/market/location';
|
||||||
import {computedAsync} from "@vueuse/core";
|
import {computedAsync} from "@vueuse/core";
|
||||||
|
|
||||||
const {ledgerId, ledger} = useLedgerParam();
|
const {ledgerId, ledger} = useLedgerParam();
|
||||||
|
const marketLocationStore = useMarketLocationStore();
|
||||||
|
|
||||||
const itemAppraisal = computedAsync(async () => {
|
const itemAppraisal = computedAsync(async () => {
|
||||||
if (!ledgerId.value) {
|
if (!ledgerId.value) {
|
||||||
@@ -19,7 +21,7 @@ const itemAppraisal = computedAsync(async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const types = await getMarketTypes([...new Set(itemBalances.map(i => i.typeId))]);
|
const types = await getMarketTypes([...new Set(itemBalances.map(i => i.typeId))]);
|
||||||
const prices = await getPrices(types);
|
const prices = await getPrices(types, marketLocationStore.location.id);
|
||||||
const appraisal = appraiseItemBalances(itemBalances, prices);
|
const appraisal = appraiseItemBalances(itemBalances, prices);
|
||||||
|
|
||||||
return appraisal.buy === 0 && appraisal.sell === 0 ? undefined : appraisal;
|
return appraisal.buy === 0 && appraisal.sell === 0 ? undefined : appraisal;
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {Dropdown} from '@/components';
|
import {Dropdown} from '@/components';
|
||||||
import {AppraisalItemValue, AppraisalResultTable, appraise} from '@/market/appraisal';
|
import {AppraisalItemValue, AppraisalResultTable, appraise} from '@/market/appraisal';
|
||||||
|
import {MarketLocationInput, useMarketLocationStore} from '@/market/location';
|
||||||
import {ref} from 'vue';
|
import {ref} from 'vue';
|
||||||
|
|
||||||
const items = ref('');
|
const items = ref('');
|
||||||
const showInputs = ref(true);
|
const showInputs = ref(true);
|
||||||
|
|
||||||
|
const marketLocationStore = useMarketLocationStore();
|
||||||
const result = ref<AppraisalItemValue[]>([]);
|
const result = ref<AppraisalItemValue[]>([]);
|
||||||
|
|
||||||
const send = async () => result.value = await appraise(items.value);
|
const send = async () => result.value = await appraise(items.value, marketLocationStore.location.id);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -20,6 +22,12 @@ const send = async () => result.value = await appraise(items.value);
|
|||||||
<textarea class="mt-1" v-model="items" placeholder="Paste an EVE inventory listing" />
|
<textarea class="mt-1" v-model="items" placeholder="Paste an EVE inventory listing" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="mx-1 mt-2">
|
||||||
|
<span>Location</span>
|
||||||
|
<div class="mt-1">
|
||||||
|
<MarketLocationInput v-model="marketLocationStore.location" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="grid my-2">
|
<div class="grid my-2">
|
||||||
<button class="justify-self-end" @click="send" :disabled="!items.trim()">Send</button>
|
<button class="justify-self-end" @click="send" :disabled="!items.trim()">Send</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import {ClipboardButton} from '@/components';
|
import {ClipboardButton} from '@/components';
|
||||||
import {getMarketType, getPrice, MarketType, MarketTypeInput, useMarketTaxStore} from "@/market";
|
import {getMarketType, getPrice, MarketType, MarketTypeInput, useMarketTaxStore} from "@/market";
|
||||||
import {AcquisitionResultTable, BuyModal} from '@/market/acquisition';
|
import {AcquisitionResultTable, BuyModal} from '@/market/acquisition';
|
||||||
|
import {MarketLocationInput, useMarketLocationStore} from '@/market/location';
|
||||||
import {ScanResultTable, toScanResult} from '@/market/scan';
|
import {ScanResultTable, toScanResult} from '@/market/scan';
|
||||||
import {acquisitionApi, marketApi} from "@/mammon";
|
import {acquisitionApi, marketApi} from "@/mammon";
|
||||||
import {ShoppingCartIcon} from '@heroicons/vue/24/outline';
|
import {ShoppingCartIcon} from '@heroicons/vue/24/outline';
|
||||||
@@ -19,8 +20,9 @@ const item = ref<MarketType>();
|
|||||||
const inputItem = ref<MarketType>();
|
const inputItem = ref<MarketType>();
|
||||||
|
|
||||||
const marketTaxStore = useMarketTaxStore();
|
const marketTaxStore = useMarketTaxStore();
|
||||||
|
const marketLocationStore = useMarketLocationStore();
|
||||||
const days = useStorage('market-scan-days', 365);
|
const days = useStorage('market-scan-days', 365);
|
||||||
const price = computedAsync(() => item.value ? getPrice(item.value) : undefined);
|
const price = computedAsync(() => item.value ? getPrice(item.value, marketLocationStore.location.id) : undefined);
|
||||||
const result = computedAsync(async () => {
|
const result = computedAsync(async () => {
|
||||||
if (!item.value) {
|
if (!item.value) {
|
||||||
return undefined;
|
return undefined;
|
||||||
@@ -83,10 +85,11 @@ watch(useRoute(), async route => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="grid mb-2 mt-4">
|
<div class="grid mb-2 mt-4">
|
||||||
<div class="w-auto flex">
|
<div class="w-auto flex items-center">
|
||||||
<span>Item: </span>
|
<span>Item: </span>
|
||||||
<MarketTypeInput class="ms-2" v-model="inputItem" @submit="view"/>
|
<MarketTypeInput class="ms-2" v-model="inputItem" @submit="view"/>
|
||||||
<button class="justify-self-end ms-2" @click="view">View</button>
|
<button class="justify-self-end ms-2" @click="view">View</button>
|
||||||
|
<MarketLocationInput class="ms-auto" v-model="marketLocationStore.location" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<template v-if="item">
|
<template v-if="item">
|
||||||
|
|||||||
Reference in New Issue
Block a user