From ba1f59eef7c902d8d8be650642752053a3771466 Mon Sep 17 00:00:00 2001 From: Jan Michek <15363559+janmichek@users.noreply.github.com> Date: Mon, 6 May 2024 15:26:48 +0200 Subject: [PATCH] feat: Transactions chart page (#719) --- src/components/AppSelect.vue | 56 +++++++++------ src/components/ChartControls.vue | 62 ++++++++--------- src/components/ContractsChartPanel.vue | 30 ++++---- src/components/LineChart.vue | 45 +++++++++--- src/components/NamesChartPanel.vue | 32 +++++---- src/components/RangePicker.vue | 10 +-- src/components/TheNavigation.vue | 10 +++ src/components/TransactionsChartPanel.vue | 84 +++++++++++++++-------- src/components/TransactionsSelect.vue | 5 ++ src/pages/charts/index.vue | 54 +++++++++++++++ src/pages/names/index.vue | 4 +- src/pages/transactions/index.vue | 4 +- src/stores/charts.js | 30 ++++++++ src/stores/contracts.js | 8 +-- src/stores/names.js | 8 +-- src/stores/status.js | 2 +- src/stores/transactions.js | 13 ---- src/utils/constants.js | 7 ++ src/utils/hints/chartsHints.js | 3 + 19 files changed, 321 insertions(+), 146 deletions(-) create mode 100644 src/pages/charts/index.vue create mode 100644 src/stores/charts.js create mode 100644 src/utils/hints/chartsHints.js diff --git a/src/components/AppSelect.vue b/src/components/AppSelect.vue index c17a5e19f..1ba761896 100644 --- a/src/components/AppSelect.vue +++ b/src/components/AppSelect.vue @@ -9,7 +9,10 @@ :disabled="disabled" :searchable="searchable" :hide-selected="hideSelected" - :preselect-first="preselectFirst"> + :preselect-first="preselectFirst" + :class="[ + size ? `multiselect--${size}` : null, + ]"> diff --git a/src/components/NamesChartPanel.vue b/src/components/NamesChartPanel.vue index 09d509db4..9b9a463d2 100644 --- a/src/components/NamesChartPanel.vue +++ b/src/components/NamesChartPanel.vue @@ -5,40 +5,48 @@
+ :data="namesStatistics" + :interval="selectedRange.interval"/>
+ v-model="selectedRange" + class="names-chart-panel__chart__controls u-hidden-desktop"/> diff --git a/src/components/RangePicker.vue b/src/components/RangePicker.vue index 1114a0345..0b5b12b0e 100644 --- a/src/components/RangePicker.vue +++ b/src/components/RangePicker.vue @@ -13,7 +13,7 @@ :enable-time-picker="false" :prevent-min-max-navigation="true" placeholder="CUSTOM" - :input-class-name="`range-picker__input ${isActive ? 'range-picker__input--active' : ''}`" + :input-class-name="`range-picker__input ${isRangeSelected ? 'range-picker__input--active' : ''}`" @update:model-value="$emit('updated', date)"/> @@ -27,11 +27,7 @@ import { STATISTICS_DATA_BEGINNING } from '@/utils/constants' const date = ref() const datepicker = ref(null) const props = defineProps({ - isActive: { - type: String, - required: true, - }, - isRangeSet: { + isRangeSelected: { type: Boolean, required: true, }, @@ -39,7 +35,7 @@ const props = defineProps({ const today = DateTime.now().toFormat('yyyy-MM-dd') -watch(() => props.isRangeSet, (newVal, oldVal) => { +watch(() => props.isRangeSelected, (newVal, oldVal) => { if (!newVal && oldVal) { closeDatepicker() } diff --git a/src/components/TheNavigation.vue b/src/components/TheNavigation.vue index df92005c3..f9c719ff8 100644 --- a/src/components/TheNavigation.vue +++ b/src/components/TheNavigation.vue @@ -71,6 +71,16 @@ const menuOptions = ref([{ path: '/contract-verification', }, ], +}, +{ + name: 'Charts', + isActive: false, + submenu: [ + { + name: 'Charts', + path: '/charts', + }, + ], }]) function open(name) { diff --git a/src/components/TransactionsChartPanel.vue b/src/components/TransactionsChartPanel.vue index 5cec3c72e..495733407 100644 --- a/src/components/TransactionsChartPanel.vue +++ b/src/components/TransactionsChartPanel.vue @@ -4,55 +4,83 @@ TRANSACTIONS TREND -
- -
+ + v-model="selectedRange" + class="transactions-chart-panel__controls u-hidden-desktop"/> + diff --git a/src/components/TransactionsSelect.vue b/src/components/TransactionsSelect.vue index 50d9a34c5..889db8569 100644 --- a/src/components/TransactionsSelect.vue +++ b/src/components/TransactionsSelect.vue @@ -5,6 +5,7 @@ track-by="typeQuery" label="label" placeholder="Select Tx Type" + :size="size" :hide-selected="true"/> @@ -18,6 +19,10 @@ const props = defineProps({ type: Object, required: true, }, + size: { + type: String, + default: null, + }, }) const emit = defineEmits(['update:modelValue']) diff --git a/src/pages/charts/index.vue b/src/pages/charts/index.vue new file mode 100644 index 000000000..5094ea879 --- /dev/null +++ b/src/pages/charts/index.vue @@ -0,0 +1,54 @@ + + + + + diff --git a/src/pages/names/index.vue b/src/pages/names/index.vue index 8e47983ae..c6261acc8 100644 --- a/src/pages/names/index.vue +++ b/src/pages/names/index.vue @@ -15,7 +15,7 @@