Compare commits

..

4 Commits

Author SHA1 Message Date
2d57345634 draft pref 2024-05-29 12:49:19 +02:00
0a82fca6d3 open in a new tab 2024-05-28 12:54:21 +02:00
1e57e7c33e fix cache 2024-05-27 19:21:38 +02:00
c484948a5e tracking item by item 2024-05-27 17:52:47 +02:00
6 changed files with 37 additions and 14 deletions

View File

@@ -1,5 +1,5 @@
import log from "loglevel";
import { Log, User, UserManager } from "oidc-client-ts";
import { Log, User, UserManager, WebStorageStateStore } from "oidc-client-ts";
import { defineStore } from "pinia";
import { computed, ref } from "vue";
@@ -11,7 +11,9 @@ 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
scope: import.meta.env.VITE_AUTH_SCOPE,
stateStore: new WebStorageStateStore({ store: window.localStorage }),
userStore: new WebStorageStateStore({ store: window.localStorage })
});
const user = ref<User>();

View File

@@ -16,8 +16,8 @@ export type EsiMarketOrderHistory = {
const historyCache: RegionalMarketCache<EsiMarketOrderHistory[]> = new RegionalMarketCache(() => {
const date = new Date();
if (date.getUTCHours() < 11) {
date.setUTCDate(date.getUTCDate() - 1);
if (date.getUTCHours() >= 11) {
date.setUTCDate(date.getUTCDate() + 1);
}
date.setUTCHours(11, 0, 0, 0);
return date;

View File

@@ -17,14 +17,12 @@ withDefaults(defineProps<Props>(), {
</script>
<template>
<div v-if="id || name">
<img v-if="id" :src="`https://images.evetech.net/types/${id}/icon?size=32`" class="inline-block w-5 h-5 me-1" alt="" />
<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="" />
<template v-if="name">
{{ name }}
<RouterLink v-if="id" :to="{ name: 'market-types', params: { type: id } }" custom #default="{ navigate }">
<button class="btn-icon me-1" title="Show item info" @click="navigate">
<InformationCircleIcon />
</button>
<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>
@@ -32,7 +30,7 @@ withDefaults(defineProps<Props>(), {
</template>
<style scoped lang="postcss">
button:deep(>svg) {
@apply relative top-0.5 !w-4 !h-4;
button:deep(>svg), .button:deep(>svg) {
@apply !w-4 !h-4;
}
</style>

View File

@@ -57,9 +57,10 @@ watch(() => marketTrackingStore.types, async t => {
const prices = await apraisalStore.getPrices(await getMarketTypes(typesToLoad));
items.value = [
...items.value,
...(await Promise.all(typesToLoad.map(i => createResult(i, prices.find(p => p.type.id === i) as MarketTypePrice))))
...items.value
];
typesToLoad.forEach(async i => items.value.push(await createResult(i, prices.find(p => p.type.id === i) as MarketTypePrice)));
}, { immediate: true });
</script>

View File

@@ -0,0 +1,22 @@
export class Preference<T> {
private key: string;
private description: string;
private value?: T;
private defaultValue?: T;
constructor(key: string, description: string, defaultValue?: T) {
this.key = key;
this.description = description;
this.defaultValue = defaultValue;
this.value = this.load();
}
private load() {
const value = localStorage.getItem(this.key);
if (value) {
return JSON.parse(value);
}
return this.defaultValue;
}
}

0
src/preferences/index.ts Normal file
View File