Compare commits
3 Commits
20defc5b0f
...
5cce3e6eca
| Author | SHA1 | Date | |
|---|---|---|---|
| 5cce3e6eca | |||
| 2b80724692 | |||
| 3ac39dcd45 |
@@ -1,13 +1,24 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { formatIsk, percentFormater } from '@/formaters';
|
import { formatIsk, percentFormater } from '@/formaters';
|
||||||
import { SortableHeader, useSort } from '@/table';
|
import { SortableHeader, useSort } from '@/table';
|
||||||
import { copyToClipboard } from '@/utils';
|
|
||||||
import { ArrowPathIcon } from '@heroicons/vue/24/outline';
|
import { ArrowPathIcon } from '@heroicons/vue/24/outline';
|
||||||
import { useStorage } from '@vueuse/core';
|
import { useStorage } from '@vueuse/core';
|
||||||
import { computed, ref } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import { MarketResult, getHistoryQuartils } from ".";
|
import { MarketResult, getHistoryQuartils } from ".";
|
||||||
import { MarketType, MarketTypeLabel } from "./type";
|
import { MarketType, MarketTypeLabel } from "./type";
|
||||||
|
|
||||||
|
type Result = {
|
||||||
|
type: MarketType;
|
||||||
|
typeID: number;
|
||||||
|
name: string;
|
||||||
|
buy: number;
|
||||||
|
sell: number;
|
||||||
|
q1: number;
|
||||||
|
mmedian: number;
|
||||||
|
q3: number;
|
||||||
|
percent: number;
|
||||||
|
}
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
items?: MarketResult[];
|
items?: MarketResult[];
|
||||||
}
|
}
|
||||||
@@ -24,7 +35,7 @@ defineEmits<Emits>();
|
|||||||
|
|
||||||
const days = useStorage('market-days', 365);
|
const days = useStorage('market-days', 365);
|
||||||
const filter = ref("");
|
const filter = ref("");
|
||||||
const { sortedArray, headerProps } = useSort(computed(() => props.items
|
const { sortedArray, headerProps } = 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()))
|
||||||
.map(r => {
|
.map(r => {
|
||||||
const quartils = getHistoryQuartils(r.history, days.value);
|
const quartils = getHistoryQuartils(r.history, days.value);
|
||||||
@@ -44,6 +55,16 @@ const { sortedArray, headerProps } = useSort(computed(() => props.items
|
|||||||
defaultSortKey: 'name',
|
defaultSortKey: 'name',
|
||||||
defaultSortDirection: 'asc'
|
defaultSortDirection: 'asc'
|
||||||
})
|
})
|
||||||
|
const getLineColor = (result: Result) => {
|
||||||
|
if (result.percent < 1.1) {
|
||||||
|
return 'line-red';
|
||||||
|
} else if (result.sell <= result.q1) {
|
||||||
|
return 'line-blue';
|
||||||
|
} else if (result.buy <= result.q1) {
|
||||||
|
return 'line-green';
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -76,7 +97,7 @@ const { sortedArray, headerProps } = useSort(computed(() => props.items
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="r in sortedArray" :key="r.typeID" class="cursor-pointer" :class="{'bg-emerald-500': r.percent >= 1.1 && r.buy <= r.q1, 'bg-amber-900': r.percent < 1.1 }" @click="copyToClipboard(r.name)">
|
<tr v-for="r in sortedArray" :key="r.typeID" :class="getLineColor(r)">
|
||||||
<td>
|
<td>
|
||||||
<MarketTypeLabel :id="r.typeID" :name="r.name" />
|
<MarketTypeLabel :id="r.typeID" :name="r.name" />
|
||||||
</td>
|
</td>
|
||||||
@@ -87,7 +108,7 @@ const { sortedArray, headerProps } = useSort(computed(() => props.items
|
|||||||
<td class="text-right">{{ formatIsk(r.q3) }}</td>
|
<td class="text-right">{{ formatIsk(r.q3) }}</td>
|
||||||
<td class="text-right">{{ percentFormater.format(r.percent) }}</td>
|
<td class="text-right">{{ percentFormater.format(r.percent) }}</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
<button class="btn-icon" @click="$emit('relaod', r.type)"><ArrowPathIcon class="stroke-slate-100 hover:stroke-slate-400"/></button>
|
<button class="btn-icon-stroke" @click="$emit('relaod', r.type)"><ArrowPathIcon /></button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { copyToClipboard } from '@/utils';
|
||||||
|
import { ClipboardIcon } from '@heroicons/vue/24/outline';
|
||||||
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
name?: string;
|
name?: string;
|
||||||
@@ -15,5 +18,6 @@ withDefaults(defineProps<Props>(), {
|
|||||||
<img v-if="id" :src="`https://images.evetech.net/types/${id}/icon`" class="inline-block w-5 h-5" />
|
<img v-if="id" :src="`https://images.evetech.net/types/${id}/icon`" class="inline-block w-5 h-5" />
|
||||||
<template v-if="name">
|
<template v-if="name">
|
||||||
{{ name }}
|
{{ name }}
|
||||||
|
<button class="btn-icon-stroke" @click="copyToClipboard(name)"><ClipboardIcon class="relative top-0.5 !w-4 !h-4" /></button>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
import { formatIsk, percentFormater } from '@/formaters';
|
import { formatIsk, percentFormater } from '@/formaters';
|
||||||
import { MarketTypeLabel } from '@/market/type';
|
import { MarketTypeLabel } from '@/market/type';
|
||||||
import { SortableHeader, useSort } from '@/table';
|
import { SortableHeader, useSort } from '@/table';
|
||||||
import { copyToClipboard } from '@/utils';
|
|
||||||
import { useStorage } from '@vueuse/core';
|
import { useStorage } from '@vueuse/core';
|
||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
import BuySellSlider from './BuySellSlider.vue';
|
import BuySellSlider from './BuySellSlider.vue';
|
||||||
@@ -49,7 +48,7 @@ const { sortedArray, headerProps } = useSort(computed(() => props.result.map(r =
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="r in sortedArray" :key="r.typeID" class="cursor-pointer" :class="{'bg-emerald-500': (useSellOrder ? r.sell_ratio : r.buy_ratio) >= threshold / 100 }" @click="copyToClipboard(r.name)">
|
<tr v-for="r in sortedArray" :key="r.typeID" :class="{'line-green': (useSellOrder ? r.sell_ratio : r.buy_ratio) >= threshold / 100 }">
|
||||||
<td>
|
<td>
|
||||||
<MarketTypeLabel :id="r.typeID" :name="r.name" />
|
<MarketTypeLabel :id="r.typeID" :name="r.name" />
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -23,13 +23,27 @@
|
|||||||
|
|
||||||
table {
|
table {
|
||||||
@apply table-auto border-collapse border-slate-500 w-full;
|
@apply table-auto border-collapse border-slate-500 w-full;
|
||||||
}
|
|
||||||
th {
|
th {
|
||||||
@apply border bg-slate-600 px-1;
|
@apply border bg-slate-600 px-1;
|
||||||
}
|
}
|
||||||
td {
|
td {
|
||||||
@apply border px-1;
|
@apply border px-1;
|
||||||
}
|
}
|
||||||
|
tr {
|
||||||
|
@apply hover:bg-slate-700;
|
||||||
|
|
||||||
|
&.line-red {
|
||||||
|
@apply bg-amber-900 hover:bg-amber-800;
|
||||||
|
}
|
||||||
|
&.line-blue {
|
||||||
|
@apply bg-sky-600 hover:bg-sky-500;
|
||||||
|
}
|
||||||
|
&.line-green {
|
||||||
|
@apply bg-emerald-500 hover:bg-emerald-400;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
::-webkit-scrollbar {
|
::-webkit-scrollbar {
|
||||||
@apply w-3;
|
@apply w-3;
|
||||||
@@ -50,4 +64,10 @@
|
|||||||
@apply w-6 h-6 hover:text-slate-400;
|
@apply w-6 h-6 hover:text-slate-400;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.btn-icon-stroke {
|
||||||
|
@apply btn-icon;
|
||||||
|
> svg {
|
||||||
|
@apply stroke-slate-100 hover:stroke-slate-400;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user