Compare commits

..

17 Commits

Author SHA1 Message Date
9b469155c4 integration with marbas 2024-05-17 22:54:27 +02:00
08b28a83be type tracking 2024-05-17 19:15:15 +02:00
719dc60027 cleanup tests 2024-05-17 18:52:38 +02:00
314380097a Add some tests 2024-05-17 17:52:57 +02:00
77b1c485d3 cleanup 2024-05-17 14:19:57 +02:00
2143fc83f1 transition 2024-05-17 10:55:46 +02:00
fa664ecd1b add alt 2024-05-16 22:22:28 +02:00
4df171e6f6 annimation 2024-05-16 12:02:30 +02:00
6d67e92749 User dropdown
User id in acquisition
about
2024-05-16 10:41:12 +02:00
0e4f1103d4 fix forgotten file 2024-05-16 08:54:42 +02:00
584dcaa4fd cleanup 2024-05-16 08:52:44 +02:00
61e1227a1a cleanup 2024-05-15 16:44:14 +02:00
d6b51ff1a7 auth persistance 2024-05-15 16:43:52 +02:00
4012dded66 cleanup routes 2024-05-15 16:11:17 +02:00
2eea436641 rework login to wor with authentik
rework env handling a runtime
remove oketbase
2024-05-15 16:00:56 +02:00
206bdd0e55 don't delete acquisitions 2024-05-14 21:21:17 +02:00
7332e145f4 draft acquisition 2024-05-14 21:21:17 +02:00
55 changed files with 1609 additions and 2108 deletions

2325
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -15,8 +15,6 @@
"@vueuse/core": "^10.2.1",
"@vueuse/integrations": "^10.2.1",
"axios": "^1.4.0",
"axios-rate-limit": "^1.3.1",
"gemory": "file:",
"loglevel": "^1.8.1",
"loglevel-plugin-prefix": "^0.8.4",
"oidc-client-ts": "^3.0.1",
@@ -31,9 +29,9 @@
"postcss": "^8.4.27",
"tailwindcss": "^3.3.3",
"typescript": "^5.0.2",
"vite": "^6.3.5",
"vite": "^5.2.11",
"vite-plugin-runtime-env": "^0.1.1",
"vitest": "^3.1.3",
"vitest": "^1.6.0",
"vue-tsc": "^2.0.18"
}
}

View File

@@ -1,5 +1,5 @@
import log from "loglevel";
import { Log, User, UserManager, WebStorageStateStore } from "oidc-client-ts";
import { Log, User, UserManager } from "oidc-client-ts";
import { defineStore } from "pinia";
import { computed, ref } from "vue";
@@ -11,13 +11,11 @@ export const useAuthStore = defineStore('auth', () => {
client_id: import.meta.env.VITE_AUTH_CLIENT_ID,
client_secret: import.meta.env.VITE_AUTH_CLIENT_SECRET,
redirect_uri: import.meta.env.VITE_AUTH_REDIRECT_URI,
scope: import.meta.env.VITE_AUTH_SCOPE,
stateStore: new WebStorageStateStore({ store: window.localStorage }),
userStore: new WebStorageStateStore({ store: window.localStorage })
scope: import.meta.env.VITE_AUTH_SCOPE
});
const user = ref<User>();
const isLoggedIn = computed(() => user.value?.expired === false);
const isLoggedIn = computed(() => !!user.value);
const accessToken = computed(() => user.value?.access_token);
const username = computed(() => user.value?.profile.name ?? "");
const userId = computed(() => user.value?.profile.sub ?? "");

View File

@@ -18,6 +18,6 @@ const doCopy = () => {
<template>
<button class="btn-icon" title="Copy to clipboard" @click="doCopy">
<ClipboardIcon />
<ClipboardIcon />
</button>
</template>

View File

@@ -1,11 +1,24 @@
<script setup lang="ts">
import { vOnClickOutside } from '@vueuse/components';
import { useEventListener } from '@vueuse/core';
import { useEventListener, useVModel } from '@vueuse/core';
import { watch } from 'vue';
const open = defineModel('open', { default: false });
interface Props {
open: boolean;
}
watch(open, value => {
interface Emit {
(e: 'update:open', value: boolean): void;
}
const props = withDefaults(defineProps<Props>(), {
open: false,
});
const emit = defineEmits<Emit>();
const isOpen = useVModel(props, 'open', emit, {passive: true});
watch(isOpen, value => {
if (value) {
document.body.classList.add('overflow-hidden');
} else {
@@ -14,18 +27,18 @@ watch(open, value => {
});
useEventListener('keyup', e => {
if (e.key === 'Escape') {
open.value = false;
isOpen.value = false;
}
});
</script>
<template>
<Transition name="fade">
<template v-if="open">
<div class="fixed inset-0 z-10">
<template v-if="isOpen">
<div class="fixed inset-0">
<div class="absolute bg-black opacity-80 inset-0 z-0" />
<div class="absolute grid inset-0">
<div class="justify-self-center m-auto" v-on-click-outside="() => open = false">
<div class="justify-self-center m-auto" v-on-click-outside="() => isOpen = false">
<slot />
</div>
</div>
@@ -35,11 +48,13 @@ useEventListener('keyup', e => {
</template>
<style scoped lang="postcss">
.fade-enter-from, .fade-leave-to {
@apply opacity-0;
opacity: 0;
}
.fade-enter-active, .fade-leave-active {
@apply transition-opacity;
}
</style>

View File

@@ -1,19 +0,0 @@
<script setup lang="ts">
import { computed } from 'vue';
interface Props {
value: number;
total: number;
}
const props = defineProps<Props>();
const percentage = computed(() => (props.value / props.total) * 100);
</script>
<template>
<div class="w-full bg-gray-600 rounded-full h-2.5">
<div class="bg-emerald-600 h-2.5 rounded-full" :style="{ width: percentage + '%'}" />
</div>
</template>

View File

@@ -1,11 +1,24 @@
<script setup lang="ts">
import { useVModel } from '@vueuse/core';
const modelValue = defineModel({ default: false });
interface Props {
modelValue?: boolean;
}
interface Emits {
(e: 'update:modelValue', value: boolean): void;
}
const props = withDefaults(defineProps<Props>(), {
modelValue: false
});
const emit = defineEmits<Emits>();
const value = useVModel(props, 'modelValue', emit);
</script>
<template>
<label class="flex items-center relative w-max cursor-pointer select-none">
<input type="checkbox" class="appearance-none transition-colors cursor-pointer w-10 h-5 rounded-full checked:bg-emerald-500 peer" v-model="modelValue" />
<input type="checkbox" class="appearance-none transition-colors cursor-pointer w-10 h-5 rounded-full checked:bg-emerald-500 peer" v-model="value" />
<span class="w-5 h-5 right-5 absolute rounded-full transform transition-transform bg-slate-100 peer-checked:bg-emerald-200" />
</label>
</template>

View File

@@ -0,0 +1,33 @@
<script setup lang="ts">
import { vElementHover } from '@vueuse/components';
import { useVModel } from '@vueuse/core';
interface Props {
open: boolean;
}
interface Emit {
(e: 'update:open', value: boolean): void;
}
const props = withDefaults(defineProps<Props>(), {
open: false,
});
const emit = defineEmits<Emit>();
const isOpen = useVModel(props, 'open', emit, {passive: true});
</script>
<template>
<div clas="flex flex-col items-center justify-center" :class="{'open': isOpen}">
<div v-element-hover="(h: boolean) => isOpen = h" class="m-auto header">
<slot name="header" />
</div>
<div v-if="isOpen" class="m-auto">
<div class="z-10 absolute">
<slot />
</div>
</div>
</div>
</template>

View File

@@ -2,7 +2,6 @@ export { default as ClipboardButton } from './ClipboardButton.vue';
export { default as Dropdown } from './Dropdown.vue';
export { default as LoadingSpinner } from './LoadingSpinner.vue';
export { default as Modal } from './Modal.vue';
export { default as ProgressBar } from './ProgressBar.vue';
export { default as SliderCheckbox } from './SliderCheckbox.vue';
export { default as Tooltip } from './tooltip/Tooltip.vue';
export { default as Tooltip } from './Tooltip.vue';

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { HeaderComponent, SortDirection } from './sort';
import { SortDirection } from './sort';
interface Props {
currentSortKey: string | null;
@@ -7,7 +7,6 @@ interface Props {
showColumn?: (k: string) => boolean;
unsortable?: boolean;
sortKey: string;
headerComponent?: HeaderComponent;
}
interface Emit {
(e: 'sort', key: string, direction: SortDirection): void;
@@ -15,25 +14,24 @@ interface Emit {
withDefaults(defineProps<Props>(), {
showColumn: () => () => true,
unsortable: false,
headerComponent: 'th',
unsortable: false
});
const emit = defineEmits<Emit>();
</script>
<template>
<component v-if="showColumn(sortKey)" :is="headerComponent" class="sort-header">
<th v-if="showColumn(sortKey)">
<slot />
<template v-if="!unsortable">
<span class="asc" :class="{'opacity-20': (currentSortKey != sortKey || sortDirection != 'asc')}" @click="emit('sort', sortKey, 'asc')"></span>
<span class="desc" :class="{'opacity-20': (currentSortKey != sortKey || sortDirection != 'desc')}" @click="emit('sort', sortKey, 'desc')"></span>
</template>
</component>
</th>
</template>
<style scoped lang="postcss">
.sort-header {
th {
@apply relative h-8 pe-3;
}
span.asc, span.desc {

View File

@@ -1,95 +0,0 @@
<script setup lang="ts">
import { useElementBounding, useVirtualList } from '@vueuse/core';
import { computed, ref } from 'vue';
interface Props {
list?: any[];
itemHeight: number;
headerHeight?: number;
footerHeight?: number;
bottom?: string; // FIXME: use css variable
}
const props = withDefaults(defineProps<Props>(), {
list: () => [],
});
const { list: values, containerProps, wrapperProps } = useVirtualList(computed(() => props.list), {
itemHeight: () => props.itemHeight,
overscan: 3
})
const tableTop = ref<HTMLSpanElement | null>(null);
const { bottom: offset } = useElementBounding(tableTop);
const ypx = computed(() => {
let y = (offset.value ?? 0) + 'px';
if (props.bottom) {
y = `calc(${y} + ${props.bottom})`;
}
return y;
})
const computedHeaderHeight = computed(() => {
const h = props.headerHeight ?? props.itemHeight ?? 0;
return h + 'px';
})
const computedFooterHeight = computed(() => {
const h = props.footerHeight ?? 0;
return h + 'px';
})
const computedWrapperProps = computed(() => ({
...wrapperProps.value,
style: {
...wrapperProps.value.style,
height: `calc(${wrapperProps.value.style.height} + ${computedHeaderHeight.value} + ${computedFooterHeight.value} + 1px)`
}
}))
const itemHeightStyle = computed(() => {
const h = props.itemHeight ?? 0;
return h + 'px';
})
</script>
<template>
<span ref="tableTop" class="h-0" />
<div v-if="list.length > 0" v-bind="containerProps" class="table-container">
<div v-bind="computedWrapperProps">
<table>
<slot :list="values" />
</table>
</div>
</div>
<slot v-else name="empty" />
</template>
<style scoped lang="postcss">
div.table-container {
@apply bg-slate-600;
max-height: calc(100vh - v-bind(ypx));
:deep(>div) {
@apply bg-slate-800;
>table {
>thead {
@apply sticky z-10;
top: -1px;
}
>tfoot {
@apply bg-slate-600 sticky z-10;
bottom: -1px;
}
>*>tr, >*>tr>td {
height: v-bind(itemHeightStyle);
}
}
}
&::-webkit-scrollbar-track {
margin-top: v-bind(computedHeaderHeight);
margin-bottom: v-bind(computedFooterHeight);
}
}
</style>

View File

@@ -1,6 +1,3 @@
export { default as SortableHeader } from './SortableHeader.vue';
export * from './sort';
export { default as SortableHeader } from './SortableHeader.vue';
export { default as VirtualScrollTable } from './VirtualScrollTable.vue';

View File

@@ -1,12 +1,10 @@
import { Component, DefineComponent, MaybeRefOrGetter, computed, ref, toValue } from "vue";
import { MaybeRefOrGetter, computed, ref, toValue } from "vue";
export type HeaderComponent = Component | DefineComponent | string;
export type SortDirection = "asc" | "desc";
export type UseSortOptions = {
defaultSortKey?: string;
defaultSortDirection?: SortDirection;
ignoredColums?: MaybeRefOrGetter<string[]>;
headerComponent?: HeaderComponent;
};
export const useSort = <T>(array: MaybeRefOrGetter<T[]>, options?: UseSortOptions) => {
@@ -21,11 +19,10 @@ export const useSort = <T>(array: MaybeRefOrGetter<T[]>, options?: UseSortOption
onSort: sortBy,
showColumn,
currentSortKey: sortKey.value,
sortDirection: sortDirection.value,
headerComponent: options?.headerComponent,
sortDirection: sortDirection.value
}));
const sortedArray = computed(() => toValue(array).toSorted((a, b) => {
const sortedArray = computed(() => toValue(array).sort((a, b) => {
if (sortKey.value === null || sortDirection.value === null) {
return 0;
}

View File

@@ -1,46 +0,0 @@
<script setup lang="ts">
import { vElementHover } from '@vueuse/components';
import { useElementBounding } from '@vueuse/core';
import { computed, ref } from 'vue';
import { useSharedWindowSize } from './tooltip';
const open = defineModel('open', { default: false });
const { width, height } = useSharedWindowSize();
const mainDiv = ref<HTMLDivElement | null>(null);
const { top, left } = useElementBounding(mainDiv);
const positions = computed(() => {
if (top.value < height.value / 2) {
if (left.value < width.value / 2) {
return ['top', 'left'];
}
return ['top', 'right'];
}
if (left.value < width.value / 2) {
return ['bottom', 'left'];
}
return ['bottom', 'right'];
})
</script>
<template>
<div ref="mainDiv" clas="flex flex-col items-center justify-center" :class="{
'open': open,
'tooltip-top': positions.includes('top'),
'tooltip-bottom': positions.includes('bottom'),
'tooltip-left': positions.includes('left'),
'tooltip-right': positions.includes('right')
}">
<div v-element-hover="(h: boolean) => open = h" class="m-auto header">
<slot name="header" />
</div>
<div v-if="open" class="m-auto">
<div class="z-10 relative">
<div class="absolute">
<slot />
</div>
</div>
</div>
</div>
</template>

View File

@@ -1,3 +0,0 @@
import { createSharedComposable, useWindowSize } from "@vueuse/core";
export const useSharedWindowSize = createSharedComposable(useWindowSize);

View File

@@ -1,23 +0,0 @@
import { describe, expect, test } from 'vitest'
import { formatEveDate, formatIsk } from './formaters'
describe('formatIsk', () => {
test('Formats ISK correctly', () => {
expect(formatIsk(123456789)).toBe('123.456.789,00 ISK')
})
})
describe('formatEveDate', () => {
test('Formats EVE date correctly', () => {
const date = new Date(Date.UTC(2022, 0, 1, 0, 0))
expect(formatEveDate(date)).toBe('2022.01.01 00:00')
})
test('Returns empty string for undefined date', () => {
expect(formatEveDate()).toBe('')
})
test('Returns empty string for null date', () => {
expect(formatEveDate(null)).toBe('')
})
})

View File

@@ -10,12 +10,3 @@ export const percentFormater = new Intl.NumberFormat("en-US", {
minimumFractionDigits: 0,
maximumFractionDigits: 0
});
const timeFormat = new Intl.NumberFormat("en-US", {
minimumFractionDigits: 0,
maximumFractionDigits: 0,
minimumIntegerDigits: 2
});
export const formatEveDate = (date?: Date | null) => !date ? '' : `${date.getUTCFullYear()}.${timeFormat.format(date.getUTCMonth() + 1)}.${timeFormat.format(date.getUTCDate())} ${timeFormat.format(date.getUTCHours())}:${timeFormat.format(date.getUTCMinutes())}`;

View File

@@ -2,7 +2,7 @@ import log from "loglevel";
import { apply, reg } from "loglevel-plugin-prefix";
export function initLogger() {
log.setLevel(import.meta.env.VITE_LOG_LEVEL);
log.setLevel(process.env.NODE_ENV === 'production' ? 'info' : 'trace');
reg(log);
apply(log, {template: '[%t] %l:'});
}

View File

@@ -1,3 +0,0 @@
export type MarbasObject = {
id: number;
}

View File

@@ -1,3 +0,0 @@
export * from './MarbasObject';
export * from './marbasService';

View File

@@ -1,56 +0,0 @@
import { useAuthStore } from "@/auth";
import { logResource } from "@/service";
import axios from "axios";
export const marbasAxiosInstance = axios.create({
baseURL: import.meta.env.VITE_MARBAS_URL,
headers: {
'Accept': 'application/json',
"Content-Type": "application/json",
},
})
const authStore = useAuthStore();
marbasAxiosInstance.interceptors.request.use(async r => {
if (!authStore.isLoggedIn) {
await authStore.redirect();
}
const accessToken = authStore.accessToken;
if (accessToken) {
r.headers.Authorization = `Bearer ${accessToken}`;
}
if (!r.params?.page_size) {
r.params = { ...r.params, page_size: 250 };
}
return r;
})
logResource(marbasAxiosInstance)
marbasAxiosInstance.interceptors.response.use(async r => {
if (r.status === 401) {
await authStore.redirect();
return marbasAxiosInstance.request(r.config);
}
let next: string = r.data?.next;
let results = r.data?.results;
if (next) {
if (!next.startsWith(import.meta.env.VITE_MARBAS_URL)) { // FIME remove once the API is fixed
next = import.meta.env.VITE_MARBAS_URL + next.replace(/http(s)?:\/\/[^/]+\//g, '');
}
results = results.concat((await marbasAxiosInstance.request({
...r.config,
url: next,
baseURL: '',
})).data);
}
if (results) {
r.data = results;
}
return r;
})

View File

@@ -0,0 +1,13 @@
import { esiAxiosInstance } from "@/service";
export type MarketOrderHistory = {
average: number;
date: string;
highest: number;
lowest: number;
order_count: number;
volume: number;
}
export const getHistory = async (regionId: number, tyeId: number): Promise<MarketOrderHistory[]> => (await esiAxiosInstance.get(`/markets/${regionId}/history/`, { params: { type_id: tyeId } })).data;

View File

@@ -1,35 +0,0 @@
import { describe, expect, test } from 'vitest'
import { RegionalMarketCache } from './RegionalMarketCache'
describe('RegionalMarketCache', () => {
test('should cache and retrieve values', async () => {
const cache = new RegionalMarketCache<string>(1000)
cache.set(1, 1, 'test')
expect(cache.get(1, 1)).toBe('test')
})
test('should remove values', async () => {
const cache = new RegionalMarketCache<string>(1000)
cache.set(1, 1, 'test')
cache.remove(1, 1)
expect(cache.get(1, 1)).toBeUndefined()
})
test('should compute values if absent', async () => {
const cache = new RegionalMarketCache<string>(1000)
const value = await cache.computeIfAbsent(1, 1, () => Promise.resolve('test'))
expect(value).toBe('test')
expect(cache.get(1, 1)).toBe('test')
})
test('should expire values', async () => {
const cache = new RegionalMarketCache<string>(1)
cache.set(1, 1, 'test')
await new Promise(resolve => setTimeout(resolve, 10))
expect(cache.get(1, 1)).toBeUndefined()
})
})

View File

@@ -1,50 +0,0 @@
class CacheEntry<T> {
public value: T;
public expiration: Date;
constructor(value: T, expiration: Date) {
this.value = value;
this.expiration = expiration;
}
}
export type ExpirationSupplier<T> = (v: T) => Date;
export class RegionalMarketCache<T> {
private cache: Record<number, Record<number, CacheEntry<T>>>;
private expirationSupplier: (v: T) => Date;
constructor(expiration: ExpirationSupplier<T> | number) {
this.cache = {};
this.expirationSupplier = expiration instanceof Function ? expiration : () => new Date(Date.now() + expiration);
}
public get(regionId: number, typeId: number): T | undefined {
const entry = this.cache[regionId]?.[typeId];
if (entry && entry.expiration > new Date()) {
return entry.value;
}
this.remove(regionId, typeId);
return undefined;
}
public set(regionId: number, typeId: number, value: T): void {
this.cache[regionId] = this.cache[regionId] ?? {};
this.cache[regionId][typeId] = new CacheEntry(value, this.expirationSupplier(value));
}
public remove(regionId: number, typeId: number): void {
delete this.cache[regionId]?.[typeId];
}
public async computeIfAbsent(regionId: number, typeId: number, supplier: () => (Promise<T> | T)): Promise<T> {
let value = this.get(regionId, typeId);
if (!value) {
value = await supplier();
this.set(regionId, typeId, value);
}
return value;
}
};

View File

@@ -1,10 +1,8 @@
import { MarketType } from "..";
import { MarbasAcquiredType } from "./acquisition";
import { AcquiredMarketType } from "./acquisition";
export type AcquiredType = Omit<MarbasAcquiredType, 'type'> & {
export type AcquiredType = Omit<AcquiredMarketType, 'type'> & {
type: MarketType,
buy: number,
sell: number
}
export const acquiredTypesToSorted = <T extends {date: Date} = AcquiredType>(array: T[], reverse?: boolean) => array.toSorted((a, b) => reverse ? b.date.getTime() - a.date.getTime() : a.date.getTime() - b.date.getTime())
}

View File

@@ -1,7 +1,8 @@
<script setup lang="ts">
import { LoadingSpinner, Tooltip } from '@/components';
import { formatIsk } from '@/formaters';
import { getHistory, getHistoryQuartils } from '@/market';
import { getHistory, jitaId } from '@/market';
import { getHistoryQuartils } from '@/market/tracking';
import { ArrowTrendingDownIcon, ArrowTrendingUpIcon } from '@heroicons/vue/24/outline';
import { computedAsync } from '@vueuse/core';
import { ref, watchEffect } from 'vue';
@@ -22,7 +23,7 @@ const q1 = ref(0);
const median = ref(0);
const q3 = ref(0);
const lineColor = ref('');
const history = computedAsync(() => getHistory(props.id), []);
const history = computedAsync(() => getHistory(jitaId, props.id), []);
watchEffect(async () => {
if (!open.value || !props.id) {
@@ -52,7 +53,7 @@ watchEffect(async () => {
<ArrowTrendingDownIcon v-else />
</template>
<template #default>
<div class="bg-slate-500 -left-1/2 relative tooltip-content" v-if="history.length > 0">
<div class="bg-slate-500 -left-1/2 relative" v-if="history.length > 0">
<table>
<thead>
<tr>
@@ -63,9 +64,9 @@ watchEffect(async () => {
</thead>
<tbody>
<tr :class="lineColor">
<td class="text-right text-nowrap">{{ formatIsk(q1) }}</td>
<td class="text-right text-nowrap">{{ formatIsk(median) }}</td>
<td class="text-right text-nowrap">{{ formatIsk(q3) }}</td>
<td class="text-right">{{ formatIsk(q1) }}</td>
<td class="text-right">{{ formatIsk(median) }}</td>
<td class="text-right">{{ formatIsk(q3) }}</td>
</tr>
</tbody>
</table>
@@ -80,18 +81,8 @@ watchEffect(async () => {
>:deep(div.header) {
@apply btn-icon px-2;
}
&.open {
&.tooltip-top>:deep(div.header) {
@apply rounded-t-md bg-slate-600;
}
&.tooltip-bottom {
.tooltip-content {
bottom: 79px;
}
>:deep(div.header) {
@apply rounded-b-md bg-slate-600;
}
}
&.open>:deep(div.header) {
@apply rounded-t-md bg-slate-600;
}
}
</style>
</style>@/market/tracking

View File

@@ -1,6 +1,6 @@
<script setup lang="ts">
import { SortableHeader, useSort, VirtualScrollTable } from '@/components/table';
import { formatEveDate, formatIsk, percentFormater } from '@/formaters';
import { SortableHeader, useSort } from '@/components/table';
import { formatIsk, percentFormater } from '@/formaters';
import { MarketType, MarketTypeLabel, TaxInput, useMarketTaxStore } from "@/market";
import { MinusIcon, PlusIcon } from '@heroicons/vue/24/outline';
import { useStorage } from '@vueuse/core';
@@ -9,154 +9,67 @@ import { AcquiredType } from './AcquiredType';
import AcquisitionQuantilsTooltip from './AcquisitionQuantilsTooltip.vue';
type Result = {
id: number;
type: MarketType;
typeID: number;
name: string;
buy: number;
sell: number;
price: number;
remaining: number;
quantity: number;
count: number;
precentProfit: number;
iskProfit: number;
date: Date;
acquisitions: AcquiredType[];
}
interface Props {
items?: AcquiredType[];
infoOnly?: boolean;
showAll?: boolean;
ignoredColums?: string[] | string;
defaultSortKey?: string;
}
interface Emits {
(e: 'buy', type: AcquiredType[], price: number, buy: number, sell: number): void;
(e: 'sell', type: AcquiredType[]): void;
(e: 'buy', type: MarketType, price: number, buy: number, sell: number): void;
(e: 'sell', type: MarketType): void;
}
const props = withDefaults(defineProps<Props>(), {
items: () => [],
infoOnly: false,
showAll: false,
ignoredColums: () => [],
defaultSortKey: 'precentProfit',
items: () => []
});
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 threshold = useStorage('market-acquisition-threshold', 10);
const filter = ref("");
const { sortedArray, headerProps, showColumn } = useSort<Result>(computed(() => {
const filteredItems = props.items.filter(r => r.type.name.toLowerCase().includes(filter.value.toLowerCase()));
const { sortedArray, headerProps } = useSort<Result>(computed(() => props.items
.filter(r => r.type.name.toLowerCase().includes(filter.value.toLowerCase()))
.map(r => {
const precentProfit = marketTaxStore.calculateProfit(r.price, r.sell);
if (props.showAll) {
return filteredItems.map(r => {
const precentProfit = marketTaxStore.calculateProfit(r.price, r.sell);
return {
id: r.id,
type: r.type,
name: r.type.name,
buy: r.buy,
sell: r.sell,
price: r.price,
remaining: r.remaining,
quantity: r.quantity,
precentProfit,
iskProfit: r.price * precentProfit * r.remaining,
date: r.date,
acquisitions: [r]
};
});
}
const list: Result[] = [];
const groups = Map.groupBy(filteredItems, r => r.type.id);
groups.forEach((group, typeID) => {
const first = group[0];
if (!first) {
return;
}
const total = group.reduce((acc, r) => acc + r.quantity, 0);
const totalRemaining = group.reduce((acc, r) => acc + r.remaining, 0);
const price = group.reduce((acc, r) => acc + r.price * r.remaining, 0) / totalRemaining;
const precentProfit = marketTaxStore.calculateProfit(price, first.sell);
list.push({
id: typeID,
type: first.type,
name: first.type.name,
buy: first.buy,
sell: first.sell,
price: price,
remaining: totalRemaining,
quantity: total,
return {
type: r.type,
typeID: r.type.id,
name: r.type.name,
buy: r.buy,
sell: r.sell,
price: r.price,
count: r.remaining,
precentProfit,
iskProfit: price * precentProfit * totalRemaining,
date: first.date,
acquisitions: group
});
});
return list;
}), {
defaultSortKey: props.defaultSortKey,
defaultSortDirection: 'desc',
ignoredColums: columnsToIgnore
})
iskProfit: r.price * precentProfit * r.remaining
};
})), {
defaultSortKey: 'precentProfit',
defaultSortDirection: 'desc'
})
const getLineColor = (result: Result) => {
if (result.precentProfit >= (threshold.value / 100)) {
return 'line-green';
return 'line-green';
} else if (result.precentProfit < 0) {
return 'line-red';
}
return '';
}
const total = computed(() => {
if (sortedArray.value.length <= 1) {
return null;
}
const first = sortedArray.value[0];
if (!first) {
return null;
}
const sameItem = sortedArray.value.every(r => r.type.id === first.type.id);
const quantity = sameItem ? sortedArray.value.reduce((acc, r) => acc + r.quantity, 0) : 0;
const totalRemaining = sameItem ? sortedArray.value.reduce((acc, r) => acc + r.remaining, 0) : 0;
const price = sortedArray.value.reduce((acc, r) => acc + r.price * r.remaining, 0) / totalRemaining;
const precentProfit = marketTaxStore.calculateProfit(price, first.sell);
const iskProfit = sortedArray.value.reduce((acc, r) => acc + r.iskProfit, 0);
return {
sameItem,
price,
remaining: totalRemaining,
quantity,
precentProfit,
iskProfit
};
});
</script>
<template>
<div class="flex" v-if="!infoOnly">
<div class="flex">
<div class="flex justify-self-end mb-2 mt-4 ms-auto">
<TaxInput />
<div class="end">
@@ -165,88 +78,48 @@ const total = computed(() => {
</div>
<div class="end">
<span>Filter: </span>
<input type="search" class="w-96" v-model="filter" />
<input type="search" class="w-96" v-model="filter" >
</div>
</div>
</div>
<VirtualScrollTable :list="sortedArray" :itemHeight="33" :footerHeight="!!total ? 33 : 0" bottom="1rem">
<template #default="{ list }">
<thead>
<tr>
<SortableHeader v-bind="headerProps" sortKey="name">Item</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="buy">Buy</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="sell">Sell</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="date">Bought at</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="price">Bought Price</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="remaining">Remaining Amount</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="precentProfit">Profit (%)</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="iskProfit">Profit (ISK)</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="buttons" unsortable />
</tr>
</thead>
<tbody>
<tr v-for="r in list" :key="r.index" :class="getLineColor(r.data)">
<td v-if="showColumn('name')">
<div class="flex">
<MarketTypeLabel :id="r.data.type.id" :name="r.data.name" />
<AcquisitionQuantilsTooltip :id="r.data.type.id" :buy="r.data.buy" :sell="r.data.sell" />
</div>
</td>
<td v-if="showColumn('buy')" class="text-right">{{ formatIsk(r.data.buy) }}</td>
<td v-if="showColumn('sell')" class="text-right">{{ formatIsk(r.data.sell) }}</td>
<td v-if="showColumn('date')" class="text-right">{{ formatEveDate(r.data.date) }}</td>
<td v-if="showColumn('price')" class="text-right">{{ formatIsk(r.data.price) }}</td>
<td v-if="showColumn('remaining')" class="text-right">{{ r.data.remaining }}/{{ r.data.quantity }}</td>
<td v-if="showColumn('precentProfit')" class="text-right">{{ percentFormater.format(r.data.precentProfit) }}</td>
<td v-if="showColumn('iskProfit')" class="text-right">{{ formatIsk(r.data.iskProfit) }}</td>
<td v-if="showColumn('buttons')" class="text-right">
<button class="btn-icon me-1" @click="$emit('buy', r.data.acquisitions, r.data.price, r.data.buy, r.data.sell)"><PlusIcon /></button>
<button class="btn-icon me-1" @click="$emit('sell', r.data.acquisitions)"><MinusIcon /></button>
</td>
</tr>
</tbody>
<tfoot v-if="!!total">
<tr>
<td v-if="showColumn('name')">Total</td>
<td v-if="showColumn('buy')">
<template v-if="!showColumn('name')">Total</template>
</td>
<td v-if="showColumn('sell')">
<template v-if="!showColumn('name') && !showColumn('buy')">Total</template>
</td>
<td v-if="showColumn('date')">
<template v-if="!showColumn('name') && !showColumn('buy') && !showColumn('sell')">Total</template>
</td>
<td v-if="showColumn('price')" class="text-right">
<template v-if="total.sameItem">
{{ formatIsk(total.price) }}
</template>
</td>
<td v-if="showColumn('remaining')" class="text-right">
<template v-if="total.sameItem">
{{ total.remaining }}/{{ total.quantity }}
</template>
</td>
<td v-if="showColumn('precentProfit')" class="text-right">
<template v-if="total.sameItem">
{{ percentFormater.format(total.precentProfit) }}
</template>
</td>
<td v-if="showColumn('iskProfit')" class="text-right">{{ formatIsk(total.iskProfit) }}</td>
<td v-if="showColumn('buttons')" />
</tr>
</tfoot>
</template>
<template #empty>
<div class="text-center mt-4">
<span>No items found</span>
</div>
</template>
</VirtualScrollTable>
<table>
<thead>
<tr>
<SortableHeader v-bind="headerProps" sortKey="name">Item</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="buy">Buy</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="sell">Sell</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="price">Bought Price</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="count">Bought Amount</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="precentProfit">Profit (%)</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="iskProfit">Profit (ISK)</SortableHeader>
<th></th>
</tr>
</thead>
<tbody>
<tr v-for="r in sortedArray" :key="r.typeID" :class="getLineColor(r)">
<td>
<div class="flex">
<MarketTypeLabel :id="r.typeID" :name="r.name" />
<AcquisitionQuantilsTooltip :id="r.typeID" :buy="r.buy" :sell="r.sell" />
</div>
</td>
<td class="text-right">{{ formatIsk(r.buy) }}</td>
<td class="text-right">{{ formatIsk(r.sell) }}</td>
<td class="text-right">{{ formatIsk(r.price) }}</td>
<td class="text-right">{{ r.count }}</td>
<td class="text-right">{{ percentFormater.format(r.precentProfit) }}</td>
<td class="text-right">{{ formatIsk(r.iskProfit) }}</td>
<td class="text-right">
<button class="btn-icon me-1" @click="$emit('buy', r.type, r.price, r.buy, r.sell)"><PlusIcon /></button>
<button class="btn-icon me-1" @click="$emit('sell', r.type)"><MinusIcon /></button>
</td>
</tr>
</tbody>
</table>
</template>
<style scoped lang="postcss">
div.end {
@apply justify-self-end ms-2;
}
</style>
</style>@/components/table

View File

@@ -38,7 +38,7 @@ const add = () => {
return;
}
acquiredTypesStore.addAcquiredType(id, count.value, price.value);
acquiredTypesStore.addType(id, count.value, price.value);
modalOpen.value = false;
}
@@ -66,4 +66,4 @@ defineExpose({ open });
</div>
</div>
</Modal>
</template>
</template>./acquisitions

View File

@@ -2,7 +2,6 @@
import { Modal } from '@/components';
import { MarketType, MarketTypeLabel } from '@/market';
import { ref } from 'vue';
import { AcquiredType, acquiredTypesToSorted } from './AcquiredType';
import { useAcquiredTypesStore } from './acquisition';
@@ -11,35 +10,21 @@ const acquiredTypesStore = useAcquiredTypesStore();
const modalOpen = ref<boolean>(false);
const type = ref<MarketType>();
const count = ref(1);
const types = ref<AcquiredType[]>([]);
const open = (t: AcquiredType[]) => {
if (t.length === 0) {
return;
}
types.value = acquiredTypesToSorted(t);
type.value = t[0].type;
const open = (t: MarketType) => {
type.value = t;
count.value = 1;
modalOpen.value = true;
}
const remove = async () => {
if (!types.value) {
const remove = () => {
const id = type.value?.id;
if (!id) {
modalOpen.value = false;
return;
}
let c = count.value;
for (const type of types.value) {
const remaining = type.remaining;
await acquiredTypesStore.removeAcquiredType(type.id, c);
c -= remaining;
if (c <= 0) {
break;
}
}
acquiredTypesStore.removeType(id, count.value);
modalOpen.value = false;
}
@@ -54,15 +39,10 @@ defineExpose({ open });
<div class="flex p-4">
<div class="flex me-2 mb-auto">
<span>Count: </span>
<div class="ms-2">
<input type="number" min="0" step="1" v-model="count" @keyup.enter="remove" />
<div>
<button class="px-2 mt-2 bg-slate-600 hover:bg-slate-700 border rounded cursor-pointer" @click="count = types.reduce((acc, t) => acc + t.remaining, 0)">All</button>
</div>
</div>
<input class="ms-2" type="number" min="0" step="1" v-model="count" @keyup.enter="remove" />
</div>
<button class="mb-auto" @click="remove">Remove</button>
</div>
</div>
</Modal>
</template>
</template>./acquisitions

View File

@@ -1,75 +1,63 @@
import { marbasAxiosInstance, MarbasObject } from "@/marbas";
import { AxiosResponse } from "axios";
import log from "loglevel";
import { marbasAxiosInstance } from "@/service";
import { defineStore } from "pinia";
import { computed, ref } from "vue";
export type AcquiredTypeSource = 'bo' | 'so' | 'prod' | 'misc';
export type MarbasAcquiredType = MarbasObject & {
export type AcquiredMarketType = {
id: number;
type: number;
quantity: number;
remaining: number;
price: number;
date: Date;
source: AcquiredTypeSource;
source: 'bo' | 'so' | 'prod';
user: number;
}
type RawMarbasAcquiredType = Omit<MarbasAcquiredType, 'date'> & {
date: string;
}
type InsertableRawMarbasAcquiredType = Omit<MarbasAcquiredType, 'id' | 'date'>;
const mapRawMarbasAcquiredType = (raw: RawMarbasAcquiredType): MarbasAcquiredType => ({
...raw,
date: raw.date ? new Date(raw.date) : new Date()
});
const endpoint = '/api/acquisitions/';
export const useAcquiredTypesStore = defineStore('market-acquisition', () => {
const acquiredTypes = ref<MarbasAcquiredType[]>([]);
const acquiredTypes = ref<AcquiredMarketType[]>([]);
const types = computed(() => acquiredTypes.value.filter(item => item.remaining > 0));
const addAcquiredType = async (type: number, quantity: number, price: number, source?: AcquiredTypeSource) => {
const newItem = mapRawMarbasAcquiredType((await marbasAxiosInstance.post<RawMarbasAcquiredType, AxiosResponse<RawMarbasAcquiredType>, InsertableRawMarbasAcquiredType>(endpoint, {
const types = computed(() => acquiredTypes.value);
const addType = async (type: number, quantity: number, price: number) => {
acquiredTypes.value = [...acquiredTypes.value, (await marbasAxiosInstance.post<AcquiredMarketType>(endpoint, {
type: type,
quantity: quantity,
remaining: quantity,
price: price,
source: source ?? 'misc',
})).data);
acquiredTypes.value = [...acquiredTypes.value, newItem];
log.info(`Acquired type ${newItem.id} with quantity ${newItem.quantity} and price ${newItem.price}`, newItem);
date: new Date(),
source: 'bo'
})).data];
};
const removeAcquiredType = async (id: number, quantity: number) => {
const found = acquiredTypes.value.find(t => t.id === id);
const removeType = async (type: number, quantity: number) => {
const found = acquiredTypes.value.find(item => item.type === type);
if (!found) {
return 0;
return;
}
if (found.remaining <= 0) {
acquiredTypes.value = acquiredTypes.value.filter(i => i.type !== type);
} else {
acquiredTypes.value = acquiredTypes.value.map(i => {
if (i.type === item.type) {
return item;
} else {
return i;
}
});
}
const item = {
...found,
remaining: Math.max(0, found.remaining - quantity)
remaining: found.remaining - quantity
};
acquiredTypes.value = acquiredTypes.value.map(i => {
if (i.id === item.id) {
return item;
} else {
return i;
}
});
await marbasAxiosInstance.put(`${endpoint}${item.id}/`, item);
log.info(`Acquired type ${item.id} remaining: ${item.remaining}`, item);
await marbasAxiosInstance.put(`${endpoint}${item.id}`, item);
};
marbasAxiosInstance.get<AcquiredMarketType[]>(endpoint).then(res => acquiredTypes.value = res.data.filter(item => item.remaining > 0));
const refresh = () => marbasAxiosInstance.get<RawMarbasAcquiredType[]>(endpoint).then(res => acquiredTypes.value = res.data.map(mapRawMarbasAcquiredType));
refresh();
return { acquiredTypes: types, addAcquiredType, removeAcquiredType, refresh };
return { types, addType, removeType };
});

View File

@@ -1,11 +1,15 @@
import { defineStore } from 'pinia';
import { RegionalMarketCache } from '../RegionalMarketCache';
import { jitaId } from '../market';
import { ref } from 'vue';
import { MarketType } from "../type";
import { MarketTypePrice } from './MarketTypePrice';
import { getEvepraisalPrices } from './evepraisal';
import { getfuzzworkPrices } from './fuzzwork';
type MarketTypePriceCache = {
price: MarketTypePrice,
date: Date
}
const cacheDuration = 1000 * 60 * 5; // 5 minutes
const priceGetters = {
evepraisal: getEvepraisalPrices,
@@ -13,21 +17,21 @@ const priceGetters = {
}
export const useApraisalStore = defineStore('appraisal', () => {
const cache: RegionalMarketCache<MarketTypePrice> = new RegionalMarketCache(cacheDuration);
const cache = ref<Record<number, MarketTypePriceCache>>({});
const getPricesUncached = priceGetters.fuzzwork;
const getPrice = async (type: MarketType, regionId?: number): Promise<MarketTypePrice> => (await getPrices([type], regionId))[0];
const getPrices = async (types: MarketType[], regionId?: number): Promise<MarketTypePrice[]> => {
const getPrice = async (type: MarketType): Promise<MarketTypePrice> => (await getPrices([type]))[0];
const getPrices = async (types: MarketType[]): Promise<MarketTypePrice[]> => {
const now = new Date();
const cached: MarketTypePrice[] = [];
const uncached: MarketType[] = [];
const rId = regionId ?? jitaId;
types.forEach(t => {
const cachedPrice = cache.get(rId, t.id);
const cachedPrice = cache.value[t.id];
if (cachedPrice) {
cached.push(cachedPrice);
if (cachedPrice && now.getTime() - cachedPrice.date.getTime() < cacheDuration) {
cached.push(cachedPrice.price);
} else {
uncached.push(t);
}
@@ -36,8 +40,8 @@ export const useApraisalStore = defineStore('appraisal', () => {
if (uncached.length > 0) {
const prices = await getPricesUncached(uncached);
prices.forEach(p => cache.set(rId, p.type.id, p));
return [ ...cached, ...prices ];
prices.forEach(p => cache.value[p.type.id] = { price: p, date: now });
return [...cached, ...prices];
}
return cached;
};

View File

@@ -1,30 +0,0 @@
import { esiAxiosInstance } from "@/service";
import { RegionalMarketCache } from '../RegionalMarketCache';
import { jitaId } from "../market";
export type EsiMarketOrderHistory = {
average: number;
date: string;
highest: number;
lowest: number;
order_count: number;
volume: number;
}
// TODO use pinia store
const historyCache: RegionalMarketCache<EsiMarketOrderHistory[]> = new RegionalMarketCache(() => {
const date = new Date();
if (date.getUTCHours() >= 11) {
date.setUTCDate(date.getUTCDate() + 1);
}
date.setUTCHours(11, 0, 0, 0);
return date;
});
export const getHistory = async (typeId: number, regionId?: number): Promise<EsiMarketOrderHistory[]> => {
const rId = regionId ?? jitaId;
return historyCache.computeIfAbsent(rId, typeId, async () => (await esiAxiosInstance.get(`/markets/${rId}/history/`, { params: { type_id: typeId } })).data);
}

View File

@@ -1,2 +0,0 @@
export * from './EsiMarketOrderHistory';
export * from './HistoryQuartils';

View File

@@ -1,8 +1,7 @@
export * from './RegionalMarketCache';
export * from './history';
export * from './tax';
export * from './type';
export * from './MarketOrderHistory';
export * from './appraisal';
export * from './market';

View File

@@ -1 +1,3 @@
export const jitaId = 10000002;

View File

@@ -1,4 +1,4 @@
import { EsiMarketOrderHistory } from "@/market";
import { MarketOrderHistory } from "@/market";
export type HistoryQuartils = {
totalVolume: number,
@@ -7,7 +7,7 @@ export type HistoryQuartils = {
q3: number,
}
export const getHistoryQuartils = (history: EsiMarketOrderHistory[], days?: number): HistoryQuartils => {
export const getHistoryQuartils = (history: MarketOrderHistory[], days?: number): HistoryQuartils => {
const now = Date.now();
const volumes = history
@@ -51,7 +51,7 @@ export const getHistoryQuartils = (history: EsiMarketOrderHistory[], days?: numb
};
}
const estimateVolume = (history: EsiMarketOrderHistory): number => {
const estimateVolume = (history: MarketOrderHistory): number => {
if (history.volume === 0) {
return 0;
}

View File

@@ -1,13 +1,12 @@
<script setup lang="ts">
import { SliderCheckbox } from '@/components';
import { SortableHeader, useSort, VirtualScrollTable } from '@/components/table';
import { SortableHeader, useSort } from '@/components/table';
import { formatIsk, percentFormater } from '@/formaters';
import { getHistoryQuartils, MarketType, MarketTypeLabel, TaxInput, useMarketTaxStore } from "@/market";
import { MarketType, MarketTypeLabel, TaxInput, useMarketTaxStore } from "@/market";
import { BookmarkSlashIcon, ShoppingCartIcon } from '@heroicons/vue/24/outline';
import { useStorage } from '@vueuse/core';
import { computed, ref } from 'vue';
import { useAcquiredTypesStore } from '../acquisition';
import { TrackingResult } from './tracking';
import { TrackingResult, getHistoryQuartils } from '.';
type Result = {
type: MarketType;
@@ -18,7 +17,6 @@ type Result = {
q1: number;
median: number;
q3: number;
acquisitions: number;
profit: number;
score: number;
}
@@ -26,7 +24,7 @@ type Result = {
interface Props {
items?: TrackingResult[];
infoOnly?: boolean;
ignoredColums?: string[] | string;
ignoredColums?: string[];
}
interface Emits {
@@ -46,19 +44,16 @@ const props = withDefaults(defineProps<Props>(), {
defineEmits<Emits>();
const marketTaxStore = useMarketTaxStore();
const acquiredTypesStore = useAcquiredTypesStore();
const days = useStorage('market-tracking-days', 365);
const threshold = useStorage('market-tracking-threshold', 10);
const filter = ref("");
const onlyCheap = ref(false);
const columnsToIgnore = computed(() => {
const ic = typeof props.ignoredColums === 'string' ? [props.ignoredColums] : props.ignoredColums;
if (props.infoOnly && !ic.includes('buttons')) {
return [...ic, 'buttons'];
if (props.infoOnly && !props.ignoredColums.includes('buttons')) {
return [...props.ignoredColums, 'buttons'];
}
return ic;
return props.ignoredColums;
});
const { sortedArray, headerProps, showColumn } = useSort<Result>(computed(() => props.items
.filter(r => r.type.name.toLowerCase().includes(filter.value.toLowerCase()))
@@ -66,9 +61,6 @@ const { sortedArray, headerProps, showColumn } = useSort<Result>(computed(() =>
const quartils = getHistoryQuartils(r.history, days.value);
const profit = quartils.q1 === 0 || quartils.q3 === 0 ? 0 : marketTaxStore.calculateProfit(quartils.q1, quartils.q3);
const score = profit <= 0 ? 0 : Math.sqrt((Math.pow(quartils.totalVolume, 1.1) * Math.pow(quartils.q1, 1.2) * Math.pow(profit, 0.5) * Math.pow(Math.max(1, r.orderCount), -0.7)) / days.value);
const acquisitions = columnsToIgnore.value.includes('acquisitions') ? 0 : acquiredTypesStore.acquiredTypes
.filter(t => t.type === r.type.id)
.reduce((a, b) => a + b.remaining, 0);
return {
type: r.type,
@@ -79,7 +71,6 @@ const { sortedArray, headerProps, showColumn } = useSort<Result>(computed(() =>
q1: quartils.q1,
median: quartils.median,
q3: quartils.q3,
acquisitions,
profit,
score
};
@@ -119,56 +110,47 @@ const getLineColor = (result: Result) => {
</div>
<div class="end">
<span>Filter: </span>
<input type="search" class="w-96" v-model="filter" />
<input type="search" class="w-96" v-model="filter" >
</div>
</div>
</div>
<VirtualScrollTable :list="sortedArray" :itemHeight="33" bottom="1rem">
<template #default="{ list }">
<thead>
<tr>
<SortableHeader v-bind="headerProps" sortKey="name">Item</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="buy">Buy</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="sell">Sell</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="q1">Q1</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="median">Median</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="q3">Q3</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="profit">Profit</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="score">Score</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="acquisitions">Acquisitions</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="buttons" unsortable />
</tr>
</thead>
<tbody>
<tr v-for="r in list" :key="r.data.typeID" :class="getLineColor(r.data)">
<td v-if="showColumn('name')">
<MarketTypeLabel :id="r.data.typeID" :name="r.data.name" />
</td>
<td v-if="showColumn('buy')" class="text-right">{{ formatIsk(r.data.buy) }}</td>
<td v-if="showColumn('sell')" class="text-right">{{ formatIsk(r.data.sell) }}</td>
<td v-if="showColumn('q1')" class="text-right">{{ formatIsk(r.data.q1) }}</td>
<td v-if="showColumn('median')" class="text-right">{{ formatIsk(r.data.median) }}</td>
<td v-if="showColumn('q3')" class="text-right">{{ formatIsk(r.data.q3) }}</td>
<td v-if="showColumn('profit')" class="text-right">{{ percentFormater.format(r.data.profit) }}</td>
<td v-if="showColumn('score')" class="text-right">{{ scoreFormater.format(r.data.score) }}</td>
<td v-if="showColumn('acquisitions')" class="text-right">{{ r.data.acquisitions }}</td>
<td v-if="showColumn('buttons')" class="text-right">
<button class="btn-icon me-1" title="Add acquisitions" @click="$emit('buy', r.data.type, r.data.buy, r.data.sell)"><ShoppingCartIcon /></button>
<button class="btn-icon me-1" title="Untrack" @click="$emit('remove', r.data.type)"><BookmarkSlashIcon /></button>
</td>
</tr>
</tbody>
</template>
<template #empty>
<div class="text-center mt-4">
<span>No items found</span>
</div>
</template>
</VirtualScrollTable>
<table>
<thead>
<tr>
<SortableHeader v-bind="headerProps" sortKey="name">Item</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="buy">Buy</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="sell">Sell</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="q1">Q1</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="median">Median</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="q3">Q3</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="profit">Profit</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="score">Score</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="buttons" unsortable></SortableHeader>
</tr>
</thead>
<tbody>
<tr v-for="r in sortedArray" :key="r.typeID" :class="getLineColor(r)">
<td v-if="showColumn('name')">
<MarketTypeLabel :id="r.typeID" :name="r.name" />
</td>
<td v-if="showColumn('buy')" class="text-right">{{ formatIsk(r.buy) }}</td>
<td v-if="showColumn('sell')" class="text-right">{{ formatIsk(r.sell) }}</td>
<td v-if="showColumn('q1')" class="text-right">{{ formatIsk(r.q1) }}</td>
<td v-if="showColumn('median')" class="text-right">{{ formatIsk(r.median) }}</td>
<td v-if="showColumn('q3')" class="text-right">{{ formatIsk(r.q3) }}</td>
<td v-if="showColumn('profit')" class="text-right">{{ percentFormater.format(r.profit) }}</td>
<td v-if="showColumn('score')" class="text-right">{{ scoreFormater.format(r.score) }}</td>
<td v-if="showColumn('buttons')" class="text-right">
<button class="btn-icon me-1" @click="$emit('buy', r.type, r.buy, r.sell)"><ShoppingCartIcon /></button>
<button class="btn-icon me-1" @click="$emit('remove', r.type)"><BookmarkSlashIcon /></button>
</td>
</tr>
</tbody>
</table>
</template>
<style scoped lang="postcss">
div.end {
@apply justify-self-end ms-2;
}
</style>../history/HistoryQuartils
</style>@/components/table

View File

@@ -1,3 +1,4 @@
export * from './HistoryQuartils';
export * from './tracking';
export { default as TrackingResultTable } from './TrackingResultTable.vue';

View File

@@ -1,50 +1,41 @@
import { marbasAxiosInstance, MarbasObject } from "@/marbas";
import { EsiMarketOrderHistory, getHistory, MarketType, MarketTypePrice } from "@/market";
import log from "loglevel";
import { MarketOrderHistory, MarketType, MarketTypePrice, getHistory, jitaId } from "@/market";
import { marbasAxiosInstance } from "@/service";
import { defineStore } from "pinia";
import { computed, ref } from "vue";
export type TrackingResult = {
type: MarketType;
history: EsiMarketOrderHistory[];
history: MarketOrderHistory[];
buy: number,
sell: number,
orderCount: number,
}
export type MarbasTrackedType = MarbasObject & {
type MarketTracking = {
id: number,
type: number
};
const endpoint = '/api/types_tracking/';
export const useMarketTrackingStore = defineStore('marketTracking', () => {
const trackedTypes = ref<MarbasTrackedType[]>([]);
const trackedTypes = ref<number[]>([]);
const types = computed(() => trackedTypes.value.map(item => item.type) ?? []);
const types = computed(() => trackedTypes.value ?? []);
const addType = async (type: number) => {
const found = trackedTypes.value.find(item => item.type === type);
if (!found) {
trackedTypes.value = [...trackedTypes.value, (await marbasAxiosInstance.post<MarbasTrackedType>(endpoint, { type })).data];
log.info(`Tracking type ${type}`);
if (!trackedTypes.value.includes(type)) {
await marbasAxiosInstance.post(endpoint, { type });
}
}
const removeType = async (type: number) => {
const found = trackedTypes.value.find(item => item.type === type);
if (!found) {
return;
if (trackedTypes.value.includes(type)) {
await marbasAxiosInstance.delete(`${endpoint}${type}`);
}
trackedTypes.value = trackedTypes.value.filter(t => t.id !== found.id);
await marbasAxiosInstance.delete(`${endpoint}${found.id}`);
log.info(`Stopped tracking type ${type}`);
}
marbasAxiosInstance.get<MarbasTrackedType[]>(endpoint).then(res => trackedTypes.value = res.data);
marbasAxiosInstance.get<MarketTracking[]>(endpoint).then(res => trackedTypes.value = res.data.map(item => item.type));
return { types, addType, removeType };
});
export const createResult = async (id: number, price: MarketTypePrice): Promise<TrackingResult> => ({ history: await getHistory(id), ...price });
export const createResult = async (id: number, price: MarketTypePrice): Promise<TrackingResult> => ({ history: await getHistory(jitaId, id), ...price });

View File

@@ -1,4 +1,4 @@
import { marbasAxiosInstance } from "@/marbas";
import { marbasAxiosInstance } from "@/service";
export type MarketType = {
id: number;

View File

@@ -1,18 +1,25 @@
<script setup lang="ts">
import { vOnClickOutside } from '@vueuse/components';
import { useVirtualList } from '@vueuse/core';
import { useVirtualList, useVModel } from '@vueuse/core';
import log from 'loglevel';
import { nextTick, ref, watch, watchEffect } from 'vue';
import { MarketType, searchMarketTypes } from './MarketType';
import MarketTypeLabel from "./MarketTypeLabel.vue";
interface Props {
modelValue?: MarketType;
}
interface Emits {
(e: 'update:modelValue', value?: MarketType): void;
(e: 'submit'): void;
}
const modelValue = defineModel<MarketType>();
const props = defineProps<Props>();
const emit = defineEmits<Emits>();
const value = useVModel(props, 'modelValue', emit);
const isOpen = ref(false);
const name = ref('');
const suggestions = ref<MarketType[]>([]);
@@ -40,7 +47,7 @@ const moveUp = () => {
}
const select = (type?: MarketType) => {
log.debug('Select:', type);
modelValue.value = type;
value.value = type;
currentIndex.value = -1;
suggestions.value = [];
isOpen.value = false;
@@ -55,18 +62,18 @@ const submit = async () => {
select(v);
await nextTick();
} else if (modelValue.value === undefined && suggestions.value.length > 0) {
} else if (props.modelValue === undefined && suggestions.value.length > 0) {
select(suggestions.value[0]);
await nextTick();
}
if (modelValue.value === undefined) {
if (value.value === undefined) {
return;
}
emit('submit');
}
watch(() => modelValue.value, async v => {
watch(() => props.modelValue, async v => {
if (v === undefined) {
name.value = '';
} else {
@@ -89,10 +96,10 @@ watchEffect(async () => {
<template>
<div @click="() => isOpen = true" v-on-click-outside="() => isOpen = false">
<div class="fake-input">
<img v-if="modelValue?.id" :src="`https://images.evetech.net/types/${modelValue.id}/icon?size=32`" alt="" />
<img v-if="value?.id" :src="`https://images.evetech.net/types/${value.id}/icon`" alt="" />
<input type="text" v-model="name" @keyup.enter="submit" @keyup.down="moveDown" @keyup.up="moveUp" />
</div>
<div v-if="suggestions.length > 1" class="z-20 absolute w-96">
<div v-if="suggestions.length > 1" class="z-10 absolute w-96">
<div v-bind="containerProps" class="rounded-b" style="height: 300px">
<div v-bind="wrapperProps">
<div v-for="s in list" :key="s.index" class="hover:bg-slate-700" :class="{'bg-slate-500': s.index !== currentIndex, 'bg-emerald-500': s.index === currentIndex}" @click="select(s.data)">

View File

@@ -1,6 +1,5 @@
<script setup lang="ts">
import { ClipboardButton } from '@/components';
import { InformationCircleIcon } from '@heroicons/vue/24/outline';
interface Props {
@@ -17,20 +16,17 @@ withDefaults(defineProps<Props>(), {
</script>
<template>
<div v-if="id || name" class="flex flex-row">
<img v-if="id" :src="`https://images.evetech.net/types/${id}/icon?size=32`" class="inline-block w-5 h-5 me-1 mt-1" alt="" />
<div v-if="id || name">
<img v-if="id" :src="`https://images.evetech.net/types/${id}/icon`" class="inline-block w-5 h-5 me-1" alt="" />
<template v-if="name">
{{ name }}
<RouterLink v-if="id" :to="{ name: 'market-types', params: { type: id } }" class="button btn-icon ms-1 me-1 mt-1" title="Show item info">
<InformationCircleIcon />
</RouterLink>
<ClipboardButton v-if="!hideCopy" :value="name" />
</template>
</div>
</template>
<style scoped lang="postcss">
button:deep(>svg), .button:deep(>svg) {
@apply !w-4 !h-4;
button:deep(>svg) {
@apply relative top-0.5 !w-4 !h-4;
}
</style>

View File

@@ -1,11 +0,0 @@
<script setup lang="ts">
const addCharacter = () => {
// TODO
}
</script>
<template>
<div class="grid mb-2 mt-4">
<button class="justify-self-end" @click="addCharacter">Add chacarcter</button>
</div>
</template>

View File

@@ -6,13 +6,12 @@ import { ref, watch } from 'vue';
const buyModal = ref<typeof BuyModal>();
const sellModal = ref<typeof SellModal>();
const apraisalStore = useApraisalStore();
const acquiredTypesStore = useAcquiredTypesStore();
const items = ref<AcquiredType[]>([]);
const refresh = async () => await acquiredTypesStore.refresh();
watch(() => acquiredTypesStore.acquiredTypes, async itms => {
watch(() => acquiredTypesStore.types, async itms => {
if (itms.length === 0) {
return;
}
@@ -35,13 +34,10 @@ watch(() => acquiredTypesStore.acquiredTypes, async itms => {
<template>
<div class="mt-4">
<div class="flex">
<button class="ms-auto" @click="refresh">Refresh</button>
</div>
<template v-if="items.length > 0">
<AcquisitionResultTable :items="items" @buy="(types, price, buy, sell) => buyModal?.open(types[0].type, { 'Price': price, 'Buy': buy, 'Sell': sell })" @sell="types => sellModal?.open(types)" ignoredColums="date" />
<AcquisitionResultTable :items="items" @buy="(type, price, buy, sell) => buyModal?.open(type, { 'Price': price, 'Buy': buy, 'Sell': sell })" @sell="type => sellModal?.open(type)" />
<BuyModal ref="buyModal" />
<SellModal ref="sellModal" />
</template>
</div>
</template>
</template>@/market/acquisition

View File

@@ -1,6 +1,5 @@
<script setup lang="ts">
import { Modal, ProgressBar } from "@/components";
import { MarketType, MarketTypeInput, MarketTypePrice, getHistory, getMarketTypes, useApraisalStore } from "@/market";
import { MarketType, MarketTypeInput, MarketTypePrice, getHistory, getMarketTypes, jitaId, useApraisalStore } from "@/market";
import { BuyModal } from '@/market/acquisition';
import { TrackingResult, TrackingResultTable, createResult, useMarketTrackingStore } from '@/market/tracking';
import { ref, watch } from 'vue';
@@ -16,7 +15,7 @@ const items = ref<TrackingResult[]>([]);
const addOrRelaod = async (type: MarketType) => {
const typeID = type.id;
const [history, price] = await Promise.all([
getHistory(typeID),
getHistory(jitaId, typeID),
apraisalStore.getPrice(type)
]);
const itm = {
@@ -57,7 +56,10 @@ watch(() => marketTrackingStore.types, async t => {
const prices = await apraisalStore.getPrices(await getMarketTypes(typesToLoad));
typesToLoad.forEach(async i => items.value.push(await createResult(i, prices.find(p => p.type.id === i) as MarketTypePrice)));
items.value = [
...items.value,
...(await Promise.all(typesToLoad.map(i => createResult(i, prices.find(p => p.type.id === i) as MarketTypePrice))))
];
}, { immediate: true });
</script>
@@ -73,10 +75,5 @@ watch(() => marketTrackingStore.types, async t => {
<hr />
<TrackingResultTable :items="items" @buy="(type, buy, sell) => buyModal?.open(type, { 'Buy': buy, 'Sell': sell })" @remove="removeItem" />
<BuyModal ref="buyModal" />
<Modal :open="items.length > 0 && items.length < marketTrackingStore.types.length">
<div class="ms-auto me-auto mb-2 w-96">
<ProgressBar :value="items.length" :total="marketTrackingStore.types.length" />
</div>
</Modal>
</template>
</template>
</template>@/market/tracking

View File

@@ -1,7 +1,7 @@
<script setup lang="ts">
import { ClipboardButton } from '@/components';
import { MarketType, MarketTypeInput, getMarketType, useApraisalStore } from "@/market";
import { AcquisitionResultTable, BuyModal, useAcquiredTypesStore } from '@/market/acquisition';
import { BuyModal } from '@/market/acquisition';
import { TrackingResultTable, createResult, useMarketTrackingStore } from '@/market/tracking';
import { BookmarkIcon, BookmarkSlashIcon, ShoppingCartIcon } from '@heroicons/vue/24/outline';
import { computedAsync } from '@vueuse/core/index.cjs';
@@ -20,21 +20,8 @@ const apraisalStore = useApraisalStore();
const price = computedAsync(() => item.value ? apraisalStore.getPrice(item.value) : undefined);
const marketTrackingStore = useMarketTrackingStore();
const result = computedAsync(async () => item.value && price.value ? await createResult(item.value?.id, price.value) : undefined);
const acquiredTypesStore = useAcquiredTypesStore();
const isTracked = computed(() => item.value ? marketTrackingStore.types.includes(item.value.id) : false);
const acquisitions = computed(() => {
const p = price.value;
return !p ?[] : acquiredTypesStore.acquiredTypes
.filter(t => t.type === item.value?.id)
.map(i => ({
...i,
type: p.type,
buy: p.buy,
sell: p.sell
}));
});
const toogleTracking = () => {
if (!item.value) {
return;
@@ -91,7 +78,7 @@ watch(useRoute(), async route => {
<span class="text-lg font-semibold">{{ item.name }}</span>
<div class="ms-auto">
<ClipboardButton class="ms-1" :value="item.name" />
<button v-if="price" class="btn-icon ms-1" title="Add acquisitions" @click="buyModal?.open(item, { 'Buy': price.buy, 'Sell': price.sell })"><ShoppingCartIcon /></button>
<button v-if="price" class="btn-icon ms-1" @click="buyModal?.open(item, { 'Buy': price.buy, 'Sell': price.sell })"><ShoppingCartIcon /></button>
<button class="btn-icon ms-1" :title="isTracked ? 'Untrack' : 'Track'" @click="toogleTracking">
<BookmarkSlashIcon v-if="isTracked" />
<BookmarkIcon v-else />
@@ -101,14 +88,7 @@ watch(useRoute(), async route => {
<p v-if="item.description" class="text-sm">{{ item.description }}</p>
</div>
</div>
<div v-if="result" class="mb-4">
<span>Market Info:</span>
<TrackingResultTable :items="[result]" infoOnly :ignoredColums="['name', 'acquisitions']" />
</div>
<div v-if="acquisitions && acquisitions.length > 0">
<span>Acquisitions:</span>
<AcquisitionResultTable :items="acquisitions" infoOnly showAll :ignoredColums="['name', 'buy', 'sell']" defaultSortKey="date"/>
</div>
<TrackingResultTable v-if="result" :items="[result]" infoOnly />
</template>
<BuyModal ref="buyModal" />
</template>
@@ -118,4 +98,4 @@ img.type-image {
width: 64px;
height: 64px;
}
</style>
</style>@/market/tracking

View File

@@ -1,11 +1,24 @@
<script setup lang="ts">
import { useVModel } from '@vueuse/core';
const modelValue = defineModel({ default: false });
interface Props {
modelValue?: boolean;
}
interface Emits {
(e: 'update:modelValue', value: boolean): void;
}
const props = withDefaults(defineProps<Props>(), {
modelValue: false
});
const emit = defineEmits<Emits>();
const value = useVModel(props, 'modelValue', emit);
</script>
<template>
<label class="flex items-center relative w-max cursor-pointer select-none">
<input type="checkbox" class="appearance-none transition-colors cursor-pointer w-14 h-7 rounded-full" v-model="modelValue" />
<input type="checkbox" class="appearance-none transition-colors cursor-pointer w-14 h-7 rounded-full" v-model="value" />
<span class="absolute font-medium text-xs right-1"> Buy </span>
<span class="absolute font-medium text-xs right-8"> Sell </span>
<span class="w-7 h-7 right-7 absolute rounded-full transform transition-transform bg-slate-100" />

View File

@@ -1,12 +1,22 @@
<script setup lang="ts">
import { evepraisalAxiosInstance } from '@/market/appraisal/evepraisal';
import { useVModel } from '@vueuse/core';
interface Props {
name: string;
modelValue?: string;
}
const modelValue = defineModel({ default: '' });
defineProps<Props>();
interface Emits {
(e: 'update:modelValue', value: string): void;
}
const props = withDefaults(defineProps<Props>(), {
modelValue: ''
});
const emit = defineEmits<Emits>();
const value = useVModel(props, 'modelValue', emit);
const loadFromId = async (e: Event) => {
const input = e.target as HTMLInputElement;
@@ -21,7 +31,7 @@ const loadFromId = async (e: Event) => {
return;
}
modelValue.value = JSON.stringify(response.data);
value.value = JSON.stringify(response.data);
input.value = '';
}
</script>
@@ -29,6 +39,6 @@ const loadFromId = async (e: Event) => {
<template>
<div class="flex-1 mx-1">
<span>{{ name }}</span><input type="text" class="ms-2" @change="loadFromId" placeholder="id evepraisal" />
<textarea class="mt-1" v-model="modelValue" />
<textarea class="mt-1" v-model="value" />
</div>
</template>

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { SortableHeader, useSort, VirtualScrollTable } from '@/components/table';
import { SortableHeader, useSort } from '@/components/table';
import { formatIsk, percentFormater } from '@/formaters';
import { MarketTypeLabel } from '@/market/type';
import { useStorage } from '@vueuse/core';
@@ -46,31 +46,24 @@ const { sortedArray, headerProps } = useSort(computed(() => props.result.map(r =
<input type="number" min="-100" max="100" step="1" v-model="threshold" />
</div>
</div>
<VirtualScrollTable :list="sortedArray" :itemHeight="33" bottom="1rem">
<template #default="{ list }">
<thead>
<tr>
<SortableHeader v-bind="headerProps" sortKey="name">Item</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="market">Market</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="materials">Materials</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="ratio">Percent</SortableHeader>
</tr>
</thead>
<tbody>
<tr v-for="r in list" :key="r.data.typeID" :class="{'line-green': r.data.ratio >= threshold / 100 }">
<td>
<MarketTypeLabel :id="r.data.typeID" :name="r.data.name" />
</td>
<td class="text-right">{{ formatIsk(r.data.market) }}</td>
<td class="text-right">{{ formatIsk(r.data.materials) }}</td>
<td class="text-right">{{ percentFormater.format(r.data.ratio) }}</td>
</tr>
</tbody>
</template>
<template #empty>
<div class="text-center mt-4">
<span>No items found</span>
</div>
</template>
</VirtualScrollTable>
<table>
<thead>
<tr>
<SortableHeader v-bind="headerProps" sortKey="name">Item</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="market">Market</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="materials">Materials</SortableHeader>
<SortableHeader v-bind="headerProps" sortKey="ratio">Percent</SortableHeader>
</tr>
</thead>
<tbody>
<tr v-for="r in sortedArray" :key="r.typeID" :class="{'line-green': r.ratio >= threshold / 100 }">
<td>
<MarketTypeLabel :id="r.typeID" :name="r.name" />
</td>
<td class="text-right">{{ formatIsk(r.market) }}</td>
<td class="text-right">{{ formatIsk(r.materials) }}</td>
<td class="text-right">{{ percentFormater.format(r.ratio) }}</td>
</tr>
</tbody>
</table>
</template>

View File

@@ -1,4 +1,4 @@
import { marbasAxiosInstance } from "@/marbas";
import { marbasAxiosInstance } from "@/service";
export type ReprocessItemValues = {
typeID: number;

View File

@@ -11,6 +11,5 @@ export const routes: RouteRecordRaw[] = [
{ path: 'acquisitions', component: () => import('@/pages/market/Acquisitions.vue') },
] },
{ path: '/tools', component: () => import('@/pages/Tools.vue') },
{ path: '/characters', component: () => import('@/pages/Characters.vue') },
{ path: '/about', name: 'about', component: () => import('@/pages/About.vue') },
];

View File

@@ -1,5 +1,5 @@
import { useAuthStore } from '@/auth';
import axios, { AxiosInstance } from 'axios';
import rateLimit from 'axios-rate-limit';
import log from 'loglevel';
export const logResource = (a: AxiosInstance) => {
@@ -15,11 +15,53 @@ export const logResource = (a: AxiosInstance) => {
});
}
export const esiAxiosInstance = rateLimit(axios.create({
export const marbasAxiosInstance = axios.create({
baseURL: import.meta.env.VITE_MARBAS_URL,
headers: {
'Accept': 'application/json',
"Content-Type": "application/json",
},
})
marbasAxiosInstance.interceptors.request.use(r => {
const authStore = useAuthStore();
if (!authStore.isLoggedIn) {
throw new Error("Not logged in");
}
const accessToken = authStore.accessToken;
if (accessToken) {
r.headers.Authorization = `Bearer ${accessToken}`;
}
if (!r.params?.page_size) {
r.params = { ...r.params, page_size: 250 };
}
return r;
})
logResource(marbasAxiosInstance)
marbasAxiosInstance.interceptors.response.use(async r => {
const next = r.data?.next;
let results = r.data?.results;
if (next) {
results = results.concat((await marbasAxiosInstance.request({
...r.config,
url: next,
baseURL: '',
})).data);
}
if (results) {
r.data = results;
}
return r;
})
export const esiAxiosInstance = axios.create({
baseURL: import.meta.env.VITE_ESI_URL,
headers: {
'Accept': 'application/json',
"Content-Type": "application/json"
},
}), { maxRPS: 10 })
})
logResource(esiAxiosInstance)

View File

@@ -25,9 +25,6 @@ const logout = async () => {
<span>{{ authStore.username }}</span>
</template>
<ul>
<li>
<RouterLink class="sidebar-button py-0.5 px-2" to="/characters">Characters</RouterLink>
</li>
<li>
<RouterLink class="sidebar-button py-0.5 px-2" :to="{name: 'about'}">About EVE Online</RouterLink>
</li>

View File

@@ -21,38 +21,29 @@
@apply border rounded bg-slate-500 w-full;
}
table, .table {
table {
@apply table-auto border-collapse border-slate-500 w-full;
}
.table-header {
@apply table-cell;
}
.table-cell {
@apply pt-px pb-px;
}
th, .table-header {
@apply border bg-slate-600 px-1;
}
td, .table-cell {
@apply border px-1;
}
tr, .table-row {
@apply hover:bg-slate-900;
&.line-red {
@apply bg-amber-900 hover:bg-amber-950;
th {
@apply border bg-slate-600 px-1;
}
&.line-blue {
@apply bg-sky-600 hover:bg-sky-800;
td {
@apply border px-1;
}
&.line-green {
@apply bg-emerald-500 hover:bg-emerald-600;
}
}
tfoot>tr>td {
@apply font-semibold;
}
tr {
@apply hover:bg-slate-900;
&.line-red {
@apply bg-amber-900 hover:bg-amber-950;
}
&.line-blue {
@apply bg-sky-600 hover:bg-sky-800;
}
&.line-green {
@apply bg-emerald-500 hover:bg-emerald-600;
}
}
}
::-webkit-scrollbar {
@apply w-3;

View File

@@ -1,9 +1,9 @@
{
"compilerOptions": {
"target": "ESNext",
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,
/* Bundler mode */