From f26ded34f380031e559fcbb1c78eac5ea9d2601b Mon Sep 17 00:00:00 2001 From: tobinio Date: Tue, 1 Oct 2024 15:08:50 +0200 Subject: [PATCH] init new ui --- app/components/Charts.vue | 23 +++--------- app/components/navigation/FilterItem.vue | 22 ++++++++++++ app/composables/useFilterItem.ts | 19 ++++++++++ app/composables/useVersionRange.ts | 10 +++--- app/layouts/default.vue | 5 ++- app/pages/charts.vue | 45 ++++++++++++++++++++++++ app/pages/index.vue | 5 +++ 7 files changed, 104 insertions(+), 25 deletions(-) create mode 100644 app/components/navigation/FilterItem.vue create mode 100644 app/composables/useFilterItem.ts create mode 100644 app/pages/charts.vue diff --git a/app/components/Charts.vue b/app/components/Charts.vue index b89da8f..fbdf747 100644 --- a/app/components/Charts.vue +++ b/app/components/Charts.vue @@ -2,25 +2,11 @@ import { Bar } from "vue-chartjs"; const props = defineProps<{ - stat: string; - type: string; - explanation: string; + data: StatExport | undefined; }>(); -const { version, exclusive, versionFrom, versionTo } = useSettings(); - -const { data } = useFetch("/api/stats", { - query: { - mode: version, - exclusive: exclusive, - type: props.type, - stat: props.stat, - versionTo: versionTo, - versionFrom: versionFrom, - }, -}); const chartData = computed(() => { - if (!data.value) { + if (!props.data) { return { labels: [], datasets: [], @@ -28,8 +14,8 @@ const chartData = computed(() => { } return { - labels: data.value.labels, - datasets: data.value.data.map((value) => { + labels: props.data.labels, + datasets: props.data.data.map((value) => { return { ...value, borderRadius: 3, @@ -74,6 +60,7 @@ const chartOptions = ref({