Skip to content

Commit

Permalink
fix: format lock file, add missing props type, fix echart dark mode c…
Browse files Browse the repository at this point in the history
…olor
  • Loading branch information
uier committed Oct 18, 2023
1 parent cf506a4 commit b82c62a
Show file tree
Hide file tree
Showing 3 changed files with 6,062 additions and 2,638 deletions.
1 change: 1 addition & 0 deletions components/LatestTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { TRADE_TYPES, CONDITIONS } from "~/types/constants";
import { Price } from "~/types";
defineProps<{
modelValue: string;
data: Price[];
page: number;
pageCount: number;
Expand Down
14 changes: 12 additions & 2 deletions components/PriceTrend.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,16 @@ const props = defineProps<{
data: Trend[];
}>();
const isDark = useDark({
selector: "html",
attribute: "data-theme",
valueDark: "dracula",
valueLight: "light",
});
const option = computed(() => {
return {
backgroundColor: isDark.value ? "#272A34" : "transparent",
tooltip: { trigger: "axis" },
legend: { show: true },
grid: {
Expand All @@ -25,7 +33,7 @@ const option = computed(() => {
bottom: 0,
containLabel: true,
},
xAxis: { type: "time" },
xAxis: { type: "time", axisLabel: { formatter: "{MM}/{dd}" } },
yAxis: { type: "value" },
series: [
{
Expand All @@ -35,6 +43,7 @@ const option = computed(() => {
.filter(({ condition }) => condition === CONDITIONS.USED)
.map(({ price, posted_at, ptt_article_id }) => [+new Date(posted_at || ""), price, ptt_article_id]),
symbol: "circle",
symbolSize: 7,
smooth: 0.2,
},
{
Expand All @@ -44,6 +53,7 @@ const option = computed(() => {
.filter(({ condition }) => condition === CONDITIONS.NEW)
.map(({ price, posted_at, ptt_article_id }) => [+new Date(posted_at || ""), price, ptt_article_id]),
symbol: "circle",
symbolSize: 7,
smooth: 0.2,
},
],
Expand All @@ -60,6 +70,6 @@ function handleClick(args: ECElementEvent) {

<template>
<div class="h-[300px]">
<v-chart :option="option" autoresize @click="handleClick" />
<v-chart :option="option" :theme="isDark ? 'dark' : ''" autoresize @click="handleClick" />
</div>
</template>
Loading

0 comments on commit b82c62a

Please sign in to comment.