Skip to content

Commit 727dd89

Browse files
committed
feat: update lockfile, add vercel analytics, add missing props, fix echart style in dark mode
1 parent 836d510 commit 727dd89

File tree

5 files changed

+771
-1976
lines changed

5 files changed

+771
-1976
lines changed

components/LatestTable.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { TRADE_TYPES, CONDITIONS } from "~/types/constants";
33
import { Price } from "~/types";
44
55
defineProps<{
6+
modelValue: string;
67
data: Price[];
78
page: number;
89
pageCount: number;

components/PriceTrend.vue

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,16 @@ const props = defineProps<{
1515
data: Trend[];
1616
}>();
1717
18+
const isDark = useDark({
19+
selector: "html",
20+
attribute: "data-theme",
21+
valueDark: "dracula",
22+
valueLight: "light",
23+
});
24+
1825
const option = computed(() => {
1926
return {
27+
backgroundColor: isDark.value ? "#272A34" : "transparent",
2028
tooltip: { trigger: "axis" },
2129
legend: { show: true },
2230
grid: {
@@ -25,7 +33,7 @@ const option = computed(() => {
2533
bottom: 0,
2634
containLabel: true,
2735
},
28-
xAxis: { type: "time" },
36+
xAxis: { type: "time", axisLabel: { formatter: "{MM}/{dd}" } },
2937
yAxis: { type: "value" },
3038
series: [
3139
{
@@ -35,6 +43,7 @@ const option = computed(() => {
3543
.filter(({ condition }) => condition === CONDITIONS.USED)
3644
.map(({ price, posted_at, ptt_article_id }) => [+new Date(posted_at || ""), price, ptt_article_id]),
3745
symbol: "circle",
46+
symbolSize: 7,
3847
smooth: 0.2,
3948
},
4049
{
@@ -44,6 +53,7 @@ const option = computed(() => {
4453
.filter(({ condition }) => condition === CONDITIONS.NEW)
4554
.map(({ price, posted_at, ptt_article_id }) => [+new Date(posted_at || ""), price, ptt_article_id]),
4655
symbol: "circle",
56+
symbolSize: 7,
4757
smooth: 0.2,
4858
},
4959
],
@@ -60,6 +70,6 @@ function handleClick(args: ECElementEvent) {
6070

6171
<template>
6272
<div class="h-[300px]">
63-
<v-chart :option="option" autoresize @click="handleClick" />
73+
<v-chart :option="option" :theme="isDark ? 'dark' : ''" autoresize @click="handleClick" />
6474
</div>
6575
</template>

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
},
3333
"dependencies": {
3434
"@headlessui/vue": "^1.7.14",
35+
"@vercel/analytics": "^1.1.1",
3536
"echarts": "^5.4.3",
3637
"vue-echarts": "^6.6.1",
3738
"zod": "^3.22.4"

plugins/analytics.client.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { inject } from "@vercel/analytics";
2+
3+
export default defineNuxtPlugin(() => {
4+
inject();
5+
});

0 commit comments

Comments
 (0)