From b048959e18321aadf02540863b185ebd00b53c0c Mon Sep 17 00:00:00 2001 From: janmichek Date: Thu, 14 Nov 2024 11:57:18 +0100 Subject: [PATCH 01/55] add basic UI --- src/components/HashrateChartPanel.vue | 3 ++- src/components/TransactionsPanel.vue | 34 ++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/src/components/HashrateChartPanel.vue b/src/components/HashrateChartPanel.vue index 37c55bf28..2e10ee967 100644 --- a/src/components/HashrateChartPanel.vue +++ b/src/components/HashrateChartPanel.vue @@ -22,6 +22,7 @@ From 6fd2312847268d12951d02f67052c257d8558f83 Mon Sep 17 00:00:00 2001 From: janmichek Date: Thu, 14 Nov 2024 13:44:58 +0100 Subject: [PATCH 02/55] watch selected range value --- src/components/TransactionsPanel.vue | 9 +++- src/components/TransactionsRangePicker.vue | 62 ++++++++++++++++++++++ 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 src/components/TransactionsRangePicker.vue diff --git a/src/components/TransactionsPanel.vue b/src/components/TransactionsPanel.vue index 0d5b9d62e..ee8575fa1 100644 --- a/src/components/TransactionsPanel.vue +++ b/src/components/TransactionsPanel.vue @@ -11,7 +11,7 @@ @@ -29,6 +29,7 @@ import { computed } from 'vue' import { storeToRefs } from 'pinia' import { useRoute, useRouter } from 'nuxt/app' +import { DateTime } from 'luxon' import { useTransactionsStore } from '@/stores/transactions' import { CHART_INTERVALS_OPTIONS, TX_TYPES_OPTIONS } from '@/utils/constants' import { isDesktop } from '@/utils/screen' @@ -73,7 +74,13 @@ if (process.client) { // }) watch([selectedRange], async() => { + const aaa = DateTime.fromISO(selectedRange.value.customInterval.maxStart).toMillis() + const bbb = DateTime.fromISO(selectedRange.value.customInterval.minStart).toMillis() + console.log('selectedRange.value', selectedRange.value.customInterval.maxStart) + // https://mainnet.aeternity.io/mdw/v3/transactions?scope=time:1543375246-1543375247 + const url = `/v3/transactions?scope=time:${aaa / 1000}-${bbb / 1000}` + console.log('url', url) }) watch(selectedTxType, () => { diff --git a/src/components/TransactionsRangePicker.vue b/src/components/TransactionsRangePicker.vue new file mode 100644 index 000000000..6a201dd18 --- /dev/null +++ b/src/components/TransactionsRangePicker.vue @@ -0,0 +1,62 @@ + + + + + From 00fb5974ec51f1b9f9480b6eaa3a0dec6573ed29 Mon Sep 17 00:00:00 2001 From: janmichek Date: Thu, 14 Nov 2024 14:17:09 +0100 Subject: [PATCH 03/55] concat url string for combined parameter --- src/components/TransactionsPanel.vue | 37 ++++++++++++++++++---------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/src/components/TransactionsPanel.vue b/src/components/TransactionsPanel.vue index ee8575fa1..8de4186cb 100644 --- a/src/components/TransactionsPanel.vue +++ b/src/components/TransactionsPanel.vue @@ -73,20 +73,31 @@ if (process.client) { // await loadHashratetatistics() // }) - watch([selectedRange], async() => { - const aaa = DateTime.fromISO(selectedRange.value.customInterval.maxStart).toMillis() - const bbb = DateTime.fromISO(selectedRange.value.customInterval.minStart).toMillis() - - console.log('selectedRange.value', selectedRange.value.customInterval.maxStart) - // https://mainnet.aeternity.io/mdw/v3/transactions?scope=time:1543375246-1543375247 - const url = `/v3/transactions?scope=time:${aaa / 1000}-${bbb / 1000}` - console.log('url', url) - }) + watch([selectedRange, selectedTxType], async() => { + console.log('selectedRange.value', selectedRange.value) + console.log('selectedTxType.value', selectedTxType.value) + const hasInterval = !!selectedRange.value?.customInterval // todo not sure if correct + const hasType = !!selectedTxType.value?.typeQuery + console.log('hasInterval', hasInterval) + console.log('hasType', hasType) + let string = '' + + if (hasType) { + const from = DateTime.fromISO(selectedRange.value.customInterval.maxStart).toMillis() + const to = DateTime.fromISO(selectedRange.value.customInterval.minStart).toMillis() + string = string + `?scope=time:${from / 1000}-${to / 1000}` + } + + if (hasInterval) { + console.log('insideInterval') + const typeQuery = selectedTxType.value?.typeQuery + const slug = `${typeQuery ? '?txType=' + typeQuery : ''}` + string = string + '&' + slug + } + + console.log('string', string) - watch(selectedTxType, () => { - const typeQuery = selectedTxType.value?.typeQuery - const slug = `${typeQuery ? '?txType=' + typeQuery : ''}` - push(`/transactions${slug}`) + push(`/transactions${string}`) }) if (!isHydrated?.value) { From e216c2fb0b8ff540e66558441913941f20b44f5b Mon Sep 17 00:00:00 2001 From: janmichek Date: Thu, 14 Nov 2024 15:17:29 +0100 Subject: [PATCH 04/55] style UI --- src/components/TransactionsPanel.vue | 59 ++++++++-------------- src/components/TransactionsRangePicker.vue | 11 ++-- 2 files changed, 26 insertions(+), 44 deletions(-) diff --git a/src/components/TransactionsPanel.vue b/src/components/TransactionsPanel.vue index 8de4186cb..6da02ee11 100644 --- a/src/components/TransactionsPanel.vue +++ b/src/components/TransactionsPanel.vue @@ -9,11 +9,13 @@ @prev-clicked="loadPrevTransactions" @next-clicked="loadNextTransactions"> route.fullPath, () => { loadTransactions() }) - // - // todo merge like this - // watch([selectedRange, selectedTxType], async() => { - // await loadHashratetatistics() - // }) watch([selectedRange, selectedTxType], async() => { - console.log('selectedRange.value', selectedRange.value) - console.log('selectedTxType.value', selectedTxType.value) const hasInterval = !!selectedRange.value?.customInterval // todo not sure if correct const hasType = !!selectedTxType.value?.typeQuery - console.log('hasInterval', hasInterval) - console.log('hasType', hasType) - let string = '' + let string = '?' - if (hasType) { - const from = DateTime.fromISO(selectedRange.value.customInterval.maxStart).toMillis() - const to = DateTime.fromISO(selectedRange.value.customInterval.minStart).toMillis() - string = string + `?scope=time:${from / 1000}-${to / 1000}` + if (hasInterval) { + const from = DateTime.fromISO(selectedRange.value?.customInterval?.maxStart).toMillis() + const to = DateTime.fromISO(selectedRange.value?.customInterval?.minStart).toMillis() + string = string + `scope=time:${from / 1000}-${to / 1000}?` } - if (hasInterval) { - console.log('insideInterval') + if (hasType) { const typeQuery = selectedTxType.value?.typeQuery - const slug = `${typeQuery ? '?txType=' + typeQuery : ''}` - string = string + '&' + slug + const slug = `${typeQuery ? 'txType=' + typeQuery : ''}` // todo not necessary condition + string = string + slug } console.log('string', string) @@ -105,18 +96,10 @@ if (process.client) { } } -// -// await useAsyncData(async() => { -// await loadHashratetatistics() -// return true -// }) -// -// -// -// async function loadHashratetatistics() { -// await fetchHashrateStatistics( -// selectedRange.value.interval, -// selectedRange.value.limit, -// selectedRange.value.customInterval) -// } + + diff --git a/src/components/TransactionsRangePicker.vue b/src/components/TransactionsRangePicker.vue index 6a201dd18..aaf163227 100644 --- a/src/components/TransactionsRangePicker.vue +++ b/src/components/TransactionsRangePicker.vue @@ -1,10 +1,8 @@ @@ -19,6 +17,7 @@ const props = defineProps({ default: 0, }, }) +// todo minimalize const selectedRange = useVModel(props, 'modelValue', emit) From 2dfaa39561c95a1833a8d76dab70feab94b89b2c Mon Sep 17 00:00:00 2001 From: janmichek Date: Fri, 15 Nov 2024 14:05:16 +0100 Subject: [PATCH 05/55] fix combining queries --- src/components/TransactionsPanel.vue | 57 +++++++++++++++------------- src/stores/transactions.js | 24 +++++++++++- 2 files changed, 53 insertions(+), 28 deletions(-) diff --git a/src/components/TransactionsPanel.vue b/src/components/TransactionsPanel.vue index 6da02ee11..f9cd0afae 100644 --- a/src/components/TransactionsPanel.vue +++ b/src/components/TransactionsPanel.vue @@ -44,51 +44,56 @@ const { push } = useRouter() const limit = computed(() => process.client && isDesktop() ? 10 : 3) +const selectedRange = ref(CHART_INTERVALS_OPTIONS[4]) + +// todo differrent value + async function loadPrevTransactions() { - await fetchTransactions(transactions.value.prev) + await loadTransactions(transactions.value.prev) } async function loadNextTransactions() { - await fetchTransactions(transactions.value.next) + await loadTransactions(transactions.value.next) } -async function loadTransactions() { +async function loadTransactions(queryParameters) { const { txType } = route.query + const { customInterval } = route.query const txTypeOption = TX_TYPES_OPTIONS.find(option => option.typeQuery === txType) + setSelectedTxType(txTypeOption || TX_TYPES_OPTIONS[0]) - await fetchTransactions(`/v3/transactions?limit=${limit.value}${selectedTxType.value.typeQuery ? '&type=' + selectedTxType.value.typeQuery : ''}`) + await fetchTransactions({ + queryParameters, + range: customInterval, + type: selectedTxType.value.typeQuery, + limit: limit.value, + }) await fetchTransactionsCount(selectedTxType.value.typeQuery) setPageIndex(1) } -const selectedRange = ref(CHART_INTERVALS_OPTIONS[4]) -// todo differrent value +function changeRoute(selectedRange, selectedTxType) { + const hasInterval = !!selectedRange.value.customInterval + const hasType = !!selectedTxType.value.typeQuery + + const from = hasInterval ? DateTime.fromISO(selectedRange.value.customInterval.maxStart).toSeconds() : null + const to = hasInterval ? DateTime.fromISO(selectedRange.value.customInterval.minStart).toSeconds() : null + const intervalString = hasInterval ? `scope=time:${from}-${to}` : null + const typeString = hasType ? `${'txType=' + selectedTxType.value.typeQuery}` : null + + const array = [intervalString, typeString] + const slug = array ? `?${array.join('&')}` : null + + push(`/transactions${slug}`) +} if (process.client) { watch(() => route.fullPath, () => { loadTransactions() }) - watch([selectedRange, selectedTxType], async() => { - const hasInterval = !!selectedRange.value?.customInterval // todo not sure if correct - const hasType = !!selectedTxType.value?.typeQuery - let string = '?' - - if (hasInterval) { - const from = DateTime.fromISO(selectedRange.value?.customInterval?.maxStart).toMillis() - const to = DateTime.fromISO(selectedRange.value?.customInterval?.minStart).toMillis() - string = string + `scope=time:${from / 1000}-${to / 1000}?` - } - - if (hasType) { - const typeQuery = selectedTxType.value?.typeQuery - const slug = `${typeQuery ? 'txType=' + typeQuery : ''}` // todo not necessary condition - string = string + slug - } - - console.log('string', string) - - push(`/transactions${string}`) + watch([selectedRange, selectedTxType], () => { + changeRoute(selectedRange, selectedTxType) }) if (!isHydrated?.value) { diff --git a/src/stores/transactions.js b/src/stores/transactions.js index 1b7a722a2..17d5de450 100644 --- a/src/stores/transactions.js +++ b/src/stores/transactions.js @@ -27,9 +27,29 @@ export const useTransactionsStore = defineStore('transactions', () => { : null, ) - async function fetchTransactions(queryParameters = null) { + async function fetchTransactions({ queryParameters, range, type, limit } = {}) { rawTransactions.value = null - const { data } = await axios.get(`${MIDDLEWARE_URL}${queryParameters || '/v3/transactions?limit=10'}`) + if (queryParameters) { + const { data } = await axios.get(`${MIDDLEWARE_URL}${queryParameters}`) + isHydrated.value = true + rawTransactions.value = data + return + } + + const transactionsUrl = new URL(`${MIDDLEWARE_URL}/v3/transactions`) + + transactionsUrl.searchParams.append('limit', limit ?? 10) + + if (range) { + transactionsUrl.searchParams.append('range', range) + } + + if (type) { + transactionsUrl.searchParams.append('type', type) + } + + const { data } = await axios.get(transactionsUrl.toString()) + isHydrated.value = true rawTransactions.value = data } From 338560f91cccb247116e7be38c3e9294da38c9b4 Mon Sep 17 00:00:00 2001 From: janmichek Date: Fri, 15 Nov 2024 20:59:17 +0100 Subject: [PATCH 06/55] fix passing parameter --- hamster.aes | 73 +++++++++++ src/components/DexTradesTable.vue | 183 ++++++++++++++------------- src/components/TransactionsPanel.vue | 5 +- src/stores/transactions.js | 4 +- src/utils/adapters.js | 2 - 5 files changed, 170 insertions(+), 97 deletions(-) create mode 100644 hamster.aes diff --git a/hamster.aes b/hamster.aes new file mode 100644 index 000000000..cf96cbc9d --- /dev/null +++ b/hamster.aes @@ -0,0 +1,73 @@ +include "String.aes" + +contract CryptoHamster = + + record state = { + index : int, + map_hamsters : map(string, hamster), + testvalue: int} + + record hamster = { + id : int, + name : string, + dna : int} + + stateful entrypoint init() = + { index = 1, + map_hamsters = {}, + testvalue = 42} + + public entrypoint read_test_value() : int = + state.testvalue + + public entrypoint return_caller() : address = + Call.caller + + public entrypoint cause_error() : unit = + require(2 == 1, "require failed") + + public stateful entrypoint add_test_value(one: int, two: int) : int = + put(state{testvalue = one + two}) + one + two + + public entrypoint locally_add_two(one: int, two: int) : int = + one + two + + public stateful entrypoint statefully_add_two(one: int, two: int) : int= + put(state{testvalue = one + two}) + state.testvalue + + stateful entrypoint create_hamster(hamster_name: string) = + require(!name_exists(hamster_name), "Name is already taken") + let dna : int = generate_random_dna(hamster_name) + create_hamster_by_name_dna(hamster_name, dna) + + entrypoint name_exists(name: string) : bool = + Map.member(name, state.map_hamsters) + + entrypoint get_hamster_dna(name: string, test: option(int)) : int = + require(name_exists(name), "There is no hamster with that name!") + + let needed_hamster : hamster = state.map_hamsters[name] + + needed_hamster.dna + + private stateful function create_hamster_by_name_dna(name: string, dna: int) = + let new_hamster : hamster = { + id = state.index, + name = name, + dna = dna} + + put(state{map_hamsters[name] = new_hamster}) + put(state{index = (state.index + 1)}) + + private function generate_random_dna(name: string) : int = + get_block_hash_bytes_as_int() - Chain.timestamp + state.index + + private function get_block_hash_bytes_as_int() : int = + switch(Chain.block_hash(Chain.block_height - 1)) + None => abort("blockhash not found") + Some(bytes) => Bytes.to_int(bytes) + + entrypoint test(name: string) : hash = + String.sha3(name) diff --git a/src/components/DexTradesTable.vue b/src/components/DexTradesTable.vue index 241517f70..c50fccdb2 100644 --- a/src/components/DexTradesTable.vue +++ b/src/components/DexTradesTable.vue @@ -1,97 +1,100 @@ diff --git a/src/components/TransactionsPanel.vue b/src/components/TransactionsPanel.vue index f9cd0afae..e1835dbc8 100644 --- a/src/components/TransactionsPanel.vue +++ b/src/components/TransactionsPanel.vue @@ -57,14 +57,13 @@ async function loadNextTransactions() { } async function loadTransactions(queryParameters) { - const { txType } = route.query - const { customInterval } = route.query + const { txType, scope } = route.query const txTypeOption = TX_TYPES_OPTIONS.find(option => option.typeQuery === txType) setSelectedTxType(txTypeOption || TX_TYPES_OPTIONS[0]) await fetchTransactions({ queryParameters, - range: customInterval, + range: scope, type: selectedTxType.value.typeQuery, limit: limit.value, }) diff --git a/src/stores/transactions.js b/src/stores/transactions.js index 17d5de450..a7c744483 100644 --- a/src/stores/transactions.js +++ b/src/stores/transactions.js @@ -39,9 +39,9 @@ export const useTransactionsStore = defineStore('transactions', () => { const transactionsUrl = new URL(`${MIDDLEWARE_URL}/v3/transactions`) transactionsUrl.searchParams.append('limit', limit ?? 10) - + // todo range vs scope if (range) { - transactionsUrl.searchParams.append('range', range) + transactionsUrl.searchParams.append('scope', range) } if (type) { diff --git a/src/utils/adapters.js b/src/utils/adapters.js index 85e530a2e..cab40bbd2 100644 --- a/src/utils/adapters.js +++ b/src/utils/adapters.js @@ -438,8 +438,6 @@ export function adaptTokenEvents(events) { } export function adaptTokenHolders(tokenHolders, tokenDetails) { - console.log('tokenDetails', tokenDetails) - console.log('tokenHolders', tokenHolders) const formattedData = tokenHolders.data .map(holder => { const percentage = (new BigNumber(holder.amount) From e2b964068bbffe8c527a61d5c822c1bef89fd75c Mon Sep 17 00:00:00 2001 From: janmichek Date: Mon, 18 Nov 2024 09:39:43 +0100 Subject: [PATCH 07/55] style UI --- src/components/RangePicker.vue | 10 +++++++--- src/components/TransactionsPanel.vue | 14 +++++++++++--- src/components/TransactionsRangePicker.vue | 4 +++- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/components/RangePicker.vue b/src/components/RangePicker.vue index 399dd0ac9..057f6bd13 100644 --- a/src/components/RangePicker.vue +++ b/src/components/RangePicker.vue @@ -12,7 +12,7 @@ :clearable="false" :enable-time-picker="false" :prevent-min-max-navigation="true" - placeholder="CUSTOM" + :placeholder="placeholder" :ui="{input: `range-picker__input ${isRangeSelected ? 'range-picker__input--active' : ''}`}" @update:model-value="$emit('updated', date)"/> @@ -31,6 +31,10 @@ const props = defineProps({ type: Boolean, required: true, }, + placeholder: { + type: String, + default: 'CUSTOM', + }, }) const today = DateTime.now().toFormat('yyyy-MM-dd') @@ -74,8 +78,8 @@ defineEmits(['updated']) padding: var(--space-0) var(--space-1); @media (--desktop) { - width: 68px; - height: 32px; + width: 208px; + height: 40px; font-size: 14px; padding: var(--space-0) var(--space-1); } diff --git a/src/components/TransactionsPanel.vue b/src/components/TransactionsPanel.vue index e1835dbc8..8b7d53bd9 100644 --- a/src/components/TransactionsPanel.vue +++ b/src/components/TransactionsPanel.vue @@ -10,7 +10,9 @@ @next-clicked="loadNextTransactions"> @@ -20,10 +21,11 @@ const props = defineProps({ // todo minimalize const selectedRange = useVModel(props, 'modelValue', emit) - const isCustomIntervalSelected = computed(() => Object.keys(selectedRange.value).includes('customInterval')) +// const isSelected = computed(() => !!selectedRange.value) + function selectCustomInterval(dateCustomInterval) { const customInterval = { customInterval: { From f4a94219f498679d4315ea60a0878afbcf6416ae Mon Sep 17 00:00:00 2001 From: janmichek Date: Tue, 19 Nov 2024 12:57:27 +0100 Subject: [PATCH 08/55] todo move solution to store --- src/components/TransactionsPanel.vue | 81 +++++++++---------------- src/stores/transactions.js | 91 +++++++++++++++++++++++++--- 2 files changed, 112 insertions(+), 60 deletions(-) diff --git a/src/components/TransactionsPanel.vue b/src/components/TransactionsPanel.vue index 8b7d53bd9..cb246cf51 100644 --- a/src/components/TransactionsPanel.vue +++ b/src/components/TransactionsPanel.vue @@ -32,74 +32,51 @@ diff --git a/src/stores/transactions.js b/src/stores/transactions.js index a7c744483..005b922be 100644 --- a/src/stores/transactions.js +++ b/src/stores/transactions.js @@ -1,5 +1,5 @@ import { defineStore } from 'pinia' -import { useRuntimeConfig } from 'nuxt/app' +import { useRoute, useRuntimeConfig } from 'nuxt/app' import { ref } from 'vue' import useAxios from '@/composables/useAxios' import { adaptTransactions } from '@/utils/adapters' @@ -9,6 +9,8 @@ import { TX_TYPES_OPTIONS } from '@/utils/constants' export const useTransactionsStore = defineStore('transactions', () => { const { MIDDLEWARE_URL } = useRuntimeConfig().public const axios = useAxios() + const route = useRoute() + const { push } = useRouter() const rawTransactions = ref(null) const transactionsCount = ref(null) @@ -17,9 +19,39 @@ export const useTransactionsStore = defineStore('transactions', () => { const last24hsTransactionsTrend = ref(null) const last24hsAverageTransactionFees = ref(null) const feesTrend = ref(null) - const isHydrated = ref(null) + const isHydrated = ref(false) const pageIndex = ref(1) - const selectedTxType = ref(TX_TYPES_OPTIONS[0]) + const selectedTxType = ref(null) + const selectedRange = ref(null) // todo default + // const selectedTxType = ref(TX_TYPES_OPTIONS[0]) + // const selectedRange = ref('time:1731106800-1731020400') // todo default + // + const slug = computed(() => { + console.log('selectedRange.value', selectedRange.value) + console.log('selectedTxType.value', selectedTxType.value) + const hasInterval = !!selectedRange.value?.customInterval + const hasType = !!selectedTxType.value?.typeQuery + console.info('slug') + + console.log('hasInterval', hasInterval) + console.log('hasType', hasType) + console.log('selectedRange.value', selectedRange.value) + console.log('selectedTxType.value.typeQuery', selectedTxType.value.typeQuery) + + if (hasInterval || hasType) { + const from = hasInterval ? DateTime.fromISO(selectedRange.value.customInterval.maxStart).toSeconds() : null + const to = hasInterval ? DateTime.fromISO(selectedRange.value.customInterval.minStart).toSeconds() : null + const intervalString = hasInterval ? `scope=time:${from}-${to}` : null + const typeString = hasType ? `${'txType=' + selectedTxType.value.typeQuery}` : null + + const array = [intervalString, typeString] + const slug = array ? `?${array.join('&')}` : null + + return slug + } else { + return null + } + }) const transactions = computed(() => rawTransactions.value @@ -27,6 +59,50 @@ export const useTransactionsStore = defineStore('transactions', () => { : null, ) + function changeRoute() { + console.log(' changeRoute to slug.value', slug.value) + // todo otaznicek sem + push(`/transactions${slug.value}`) + } + + function getParams() { + // todo typestr here + const { txType, scope } = route.query + console.info('getparams') + console.log(' txType ', txType) + console.log(' scope', scope) + const txTypeOption = TX_TYPES_OPTIONS.find(option => option.typeQuery === txType) + console.log('txTypeOption', txTypeOption) + console.log('---') + + return [txTypeOption, scope] + } + + async function loadTransactions(queryParameters) { + // todo now i can use selected + const [txTypeOption, scope] = getParams() + console.info('loadTransactions') + console.log('txTypeOption', txTypeOption) + console.log('scope', scope) + + selectedTxType.value = txTypeOption + selectedRange.value = scope + console.log('txTypeOption, scope', txTypeOption, scope) + const typestr = selectedTxType?.value?.typeQuery + + console.log('typestr', typestr) + + await fetchTransactions({ + queryParameters, + range: scope, + type: txTypeOption, + limit: 10, + }) + // todo unhardcode + await fetchTransactionsCount(typestr) + setPageIndex(1) // todo resolve page index + } + async function fetchTransactions({ queryParameters, range, type, limit } = {}) { rawTransactions.value = null if (queryParameters) { @@ -52,6 +128,7 @@ export const useTransactionsStore = defineStore('transactions', () => { isHydrated.value = true rawTransactions.value = data + // todo atse to neduplikuje } async function fetchTransactionsCount(txType = null) { @@ -74,10 +151,6 @@ export const useTransactionsStore = defineStore('transactions', () => { pageIndex.value = index } - function setSelectedTxType(txType) { - selectedTxType.value = txType - } - return { transactionsCount, transactions, @@ -88,11 +161,13 @@ export const useTransactionsStore = defineStore('transactions', () => { last24hsTransactionsCount, last24hsTransactionsTrend, last24hsAverageTransactionFees, + loadTransactions, + changeRoute, feesTrend, isHydrated, pageIndex, selectedTxType, + selectedRange, setPageIndex, - setSelectedTxType, } }) From bdae4252afcdddf7d3b8d71611a89ac4981eb5c4 Mon Sep 17 00:00:00 2001 From: janmichek Date: Tue, 19 Nov 2024 12:57:27 +0100 Subject: [PATCH 09/55] todo move solution to store --- src/stores/transactions.js | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/src/stores/transactions.js b/src/stores/transactions.js index 005b922be..a364baea6 100644 --- a/src/stores/transactions.js +++ b/src/stores/transactions.js @@ -1,6 +1,7 @@ import { defineStore } from 'pinia' import { useRoute, useRuntimeConfig } from 'nuxt/app' import { ref } from 'vue' +import { DateTime } from 'luxon' import useAxios from '@/composables/useAxios' import { adaptTransactions } from '@/utils/adapters' import { formatAePrice, formatAettosToAe } from '@/utils/format' @@ -27,16 +28,8 @@ export const useTransactionsStore = defineStore('transactions', () => { // const selectedRange = ref('time:1731106800-1731020400') // todo default // const slug = computed(() => { - console.log('selectedRange.value', selectedRange.value) - console.log('selectedTxType.value', selectedTxType.value) const hasInterval = !!selectedRange.value?.customInterval const hasType = !!selectedTxType.value?.typeQuery - console.info('slug') - - console.log('hasInterval', hasInterval) - console.log('hasType', hasType) - console.log('selectedRange.value', selectedRange.value) - console.log('selectedTxType.value.typeQuery', selectedTxType.value.typeQuery) if (hasInterval || hasType) { const from = hasInterval ? DateTime.fromISO(selectedRange.value.customInterval.maxStart).toSeconds() : null @@ -44,7 +37,8 @@ export const useTransactionsStore = defineStore('transactions', () => { const intervalString = hasInterval ? `scope=time:${from}-${to}` : null const typeString = hasType ? `${'txType=' + selectedTxType.value.typeQuery}` : null - const array = [intervalString, typeString] + const array = [intervalString, typeString].filter(Boolean) + console.log('array', array) const slug = array ? `?${array.join('&')}` : null return slug @@ -68,30 +62,18 @@ export const useTransactionsStore = defineStore('transactions', () => { function getParams() { // todo typestr here const { txType, scope } = route.query - console.info('getparams') - console.log(' txType ', txType) - console.log(' scope', scope) const txTypeOption = TX_TYPES_OPTIONS.find(option => option.typeQuery === txType) - console.log('txTypeOption', txTypeOption) - console.log('---') - return [txTypeOption, scope] } async function loadTransactions(queryParameters) { // todo now i can use selected const [txTypeOption, scope] = getParams() - console.info('loadTransactions') - console.log('txTypeOption', txTypeOption) - console.log('scope', scope) selectedTxType.value = txTypeOption selectedRange.value = scope - console.log('txTypeOption, scope', txTypeOption, scope) const typestr = selectedTxType?.value?.typeQuery - console.log('typestr', typestr) - await fetchTransactions({ queryParameters, range: scope, From 6d5e3c2ad3d294d23889bdea2c1eb072687c831c Mon Sep 17 00:00:00 2001 From: janmichek Date: Tue, 19 Nov 2024 13:56:56 +0100 Subject: [PATCH 10/55] todo move solution to store --- src/components/TransactionsPanel.vue | 2 +- src/stores/transactions.js | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/components/TransactionsPanel.vue b/src/components/TransactionsPanel.vue index cb246cf51..ef4e5841a 100644 --- a/src/components/TransactionsPanel.vue +++ b/src/components/TransactionsPanel.vue @@ -60,7 +60,7 @@ if (process.client) { await loadTransactions() } - watch([selectedRange, selectedTxType], () => { + watch([selectedTxType, selectedRange], () => { // console.log('selectedRange or selectedTxType changed to', selectedRange.value, selectedTxType.value) changeRoute() }) diff --git a/src/stores/transactions.js b/src/stores/transactions.js index a364baea6..43b9cfd6c 100644 --- a/src/stores/transactions.js +++ b/src/stores/transactions.js @@ -69,15 +69,14 @@ export const useTransactionsStore = defineStore('transactions', () => { async function loadTransactions(queryParameters) { // todo now i can use selected const [txTypeOption, scope] = getParams() - + // selectedTxType.value = txTypeOption selectedRange.value = scope - const typestr = selectedTxType?.value?.typeQuery - + const typestr = selectedTxType.value?.typeQuery await fetchTransactions({ queryParameters, range: scope, - type: txTypeOption, + type: typestr, limit: 10, }) // todo unhardcode From 1296b4cd78c74146f38cd93b869bc0e37f347b27 Mon Sep 17 00:00:00 2001 From: janmichek Date: Wed, 20 Nov 2024 08:46:13 +0100 Subject: [PATCH 11/55] fix combine filtering --- src/components/TransactionsPanel.vue | 3 ++- src/components/TransactionsRangePicker.vue | 11 +++++++++-- src/stores/transactions.js | 18 +++++++++++++----- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/components/TransactionsPanel.vue b/src/components/TransactionsPanel.vue index ef4e5841a..ae9a02bb7 100644 --- a/src/components/TransactionsPanel.vue +++ b/src/components/TransactionsPanel.vue @@ -10,6 +10,7 @@ @next-clicked="loadNextTransactions"> + :interval="selectedScope.interval"/> @@ -29,13 +29,13 @@ const { contractsStatistics } = storeToRefs(chartsStore) const { fetchContractsStatistics } = chartsStore const props = defineProps({ - range: { + scope: { required: true, type: Object, }, }) -const selectedRange = ref(props.range) +const selectedScope = ref(props.scope) await useAsyncData(async() => { await loadContractsStatistics() @@ -43,16 +43,16 @@ await useAsyncData(async() => { }) if (process.client) { - watch(selectedRange, async() => { + watch(selectedScope, async() => { await loadContractsStatistics() }) } async function loadContractsStatistics() { await fetchContractsStatistics( - selectedRange.value.interval, - selectedRange.value.limit, - selectedRange.value.customInterval) + selectedScope.value.interval, + selectedScope.value.limit, + selectedScope.value.customInterval) } diff --git a/src/components/DifficultyChartPanel.vue b/src/components/DifficultyChartPanel.vue index 9c04beda3..0d1c9123c 100644 --- a/src/components/DifficultyChartPanel.vue +++ b/src/components/DifficultyChartPanel.vue @@ -5,16 +5,16 @@ + :interval="selectedScope.interval"/> @@ -32,13 +32,13 @@ const props = defineProps({ required: true, type: Boolean, }, - range: { + scope: { required: true, type: Object, }, }) -const selectedRange = ref(props.range) +const selectedScope = ref(props.scope) const selectedTxType = ref(TX_TYPES_OPTIONS[0]) await useAsyncData(async() => { @@ -47,16 +47,16 @@ await useAsyncData(async() => { }) if (process.client) { - watch([selectedRange, selectedTxType], async() => { + watch([selectedScope, selectedTxType], async() => { await loadDifficultytatistics() }) } async function loadDifficultytatistics() { await fetchDifficultyStatistics( - selectedRange.value.interval, - selectedRange.value.limit, - selectedRange.value.customInterval) + selectedScope.value.interval, + selectedScope.value.limit, + selectedScope.value.customInterval) } diff --git a/src/components/HashrateChartPanel.vue b/src/components/HashrateChartPanel.vue index 2e10ee967..509ed4628 100644 --- a/src/components/HashrateChartPanel.vue +++ b/src/components/HashrateChartPanel.vue @@ -5,16 +5,16 @@ + :interval="selectedScope.interval"/> @@ -33,13 +33,13 @@ const props = defineProps({ required: true, type: Boolean, }, - range: { + scope: { required: true, type: Object, }, }) -const selectedRange = ref(CHART_INTERVALS_OPTIONS[4]) +const selectedScope = ref(CHART_INTERVALS_OPTIONS[4]) const selectedTxType = ref(TX_TYPES_OPTIONS[0]) await useAsyncData(async() => { @@ -48,16 +48,16 @@ await useAsyncData(async() => { }) if (process.client) { - watch([selectedRange, selectedTxType], async() => { + watch([selectedScope, selectedTxType], async() => { await loadHashratetatistics() }) } async function loadHashratetatistics() { await fetchHashrateStatistics( - selectedRange.value.interval, - selectedRange.value.limit, - selectedRange.value.customInterval) + selectedScope.value.interval, + selectedScope.value.limit, + selectedScope.value.customInterval) } diff --git a/src/components/KeyblocksChartPanel.vue b/src/components/KeyblocksChartPanel.vue index 4129ca42c..9e82d4191 100644 --- a/src/components/KeyblocksChartPanel.vue +++ b/src/components/KeyblocksChartPanel.vue @@ -5,16 +5,16 @@ + :interval="selectedScope.interval"/> @@ -28,7 +28,7 @@ const chartsStore = useChartsStore() const { keyblocksStatistics } = storeToRefs(chartsStore) const { fetchKeyblocksStatistics } = chartsStore -const selectedRange = ref(CHART_INTERVALS_OPTIONS[4]) +const selectedScope = ref(CHART_INTERVALS_OPTIONS[4]) await useAsyncData(async() => { await loadKeyblockStatistics() @@ -36,16 +36,16 @@ await useAsyncData(async() => { }) if (process.client) { - watch(selectedRange, async() => { + watch(selectedScope, async() => { await loadKeyblockStatistics() }) } async function loadKeyblockStatistics() { await fetchKeyblocksStatistics( - selectedRange.value.interval, - selectedRange.value.limit, - selectedRange.value.customInterval) + selectedScope.value.interval, + selectedScope.value.limit, + selectedScope.value.customInterval) } diff --git a/src/components/NamesChartPanel.vue b/src/components/NamesChartPanel.vue index ddd1a9c05..a55956966 100644 --- a/src/components/NamesChartPanel.vue +++ b/src/components/NamesChartPanel.vue @@ -5,16 +5,16 @@ + :interval="selectedScope.interval"/> @@ -28,13 +28,13 @@ const { namesStatistics } = storeToRefs(chartsStore) const { fetchNamesStatistics } = chartsStore const props = defineProps({ - range: { + scope: { required: true, type: Object, }, }) -const selectedRange = ref(props.range) +const selectedScope = ref(props.scope) await useAsyncData(async() => { await loadNamesStatistics() @@ -42,16 +42,16 @@ await useAsyncData(async() => { }) if (process.client) { - watch(selectedRange, async() => { + watch(selectedScope, async() => { await loadNamesStatistics() }) } async function loadNamesStatistics() { await fetchNamesStatistics( - selectedRange.value.interval, - selectedRange.value.limit, - selectedRange.value.customInterval) + selectedScope.value.interval, + selectedScope.value.limit, + selectedScope.value.customInterval) } diff --git a/src/components/RangePicker.vue b/src/components/ScopePicker.vue similarity index 90% rename from src/components/RangePicker.vue rename to src/components/ScopePicker.vue index 057f6bd13..403b29e5a 100644 --- a/src/components/RangePicker.vue +++ b/src/components/ScopePicker.vue @@ -1,5 +1,5 @@ @@ -27,7 +27,7 @@ import { STATISTICS_DATA_BEGINNING } from '@/utils/constants' const date = ref() const datepicker = ref(null) const props = defineProps({ - isRangeSelected: { + isScopeSelected: { type: Boolean, required: true, }, @@ -39,7 +39,7 @@ const props = defineProps({ const today = DateTime.now().toFormat('yyyy-MM-dd') -watch(() => props.isRangeSelected, (newVal, oldVal) => { +watch(() => props.isScopeSelected, (newVal, oldVal) => { if (!newVal && oldVal) { closeDatepicker() } @@ -56,7 +56,7 @@ defineEmits(['updated']) diff --git a/src/stores/transactions.js b/src/stores/transactions.js index 419838abc..8e9ce1a35 100644 --- a/src/stores/transactions.js +++ b/src/stores/transactions.js @@ -13,7 +13,6 @@ export const useTransactionsStore = defineStore('transactions', () => { const route = useRoute() const { push } = useRouter() - const params = ref(null) const isHydrated = ref(false) const pageIndex = ref(1) const rawTransactions = ref(null) @@ -23,9 +22,10 @@ export const useTransactionsStore = defineStore('transactions', () => { const last24hsTransactionsTrend = ref(null) const last24hsAverageTransactionFees = ref(null) const feesTrend = ref(null) - const selectedTxType = ref(null) - const selectedScope = ref(null) + const selectedTxType = ref(undefined) + const selectedScope = ref(undefined) const pageLimit = ref(null) + const params = ref(null) const transactions = computed(() => rawTransactions.value @@ -33,10 +33,22 @@ export const useTransactionsStore = defineStore('transactions', () => { : null, ) + const hasInterval = computed(() => + !!params.value?.scope, + ) + const hasType = computed(() => + !!params.value?.txType, + ) + const slug = computed(() => { // todo condition // todo has parameters - if (hasInterval.value || hasType.value) { + console.log('params.value?.txType', params.value?.txType) + console.log('selectedTxType', selectedTxType) + const isTyp = hasType.value || !!selectedTxType.value + const isInt = hasInterval.value || !!selectedScope.value + + if (isInt || isTyp) { const array = [ intervalSlug.value, typeSlug.value, @@ -49,28 +61,23 @@ export const useTransactionsStore = defineStore('transactions', () => { }) const typeSlug = computed(() => - hasType.value ? `${'txType=' + selectedTxType.value.typeQuery}` : null, + hasType.value || !!selectedTxType.value ? `${'txType=' + selectedTxType.value.typeQuery}` : null, ) const intervalSlug = computed(() => { // todo condition - if (hasInterval.value) { + console.log('3 hasInterval.value', hasInterval.value) + console.log('3 !!selectedScope.value', selectedScope.value) + if (hasInterval.value || !!selectedScope.value) { return formatDateToParameters( - selectedScope.value.customInterval.maxStart, - selectedScope.value.customInterval.minStart, + selectedScope.value?.customInterval?.maxStart, + selectedScope.value?.customInterval?.minStart, ) } else { return null } }) - const hasInterval = computed(() => - !!params.value?.scope, - ) - const hasType = computed(() => - !!params.value?.txType, - ) - function changeRoute() { push(`/transactions${slug.value}`) } From b75c564942320b64dd35c4bd666c39605d599dee Mon Sep 17 00:00:00 2001 From: janmichek Date: Mon, 16 Dec 2024 09:44:00 +0100 Subject: [PATCH 20/55] increase test timeout --- .github/workflows/stg-pipeline-testnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stg-pipeline-testnet.yml b/.github/workflows/stg-pipeline-testnet.yml index 518267dc9..9878d4b1e 100644 --- a/.github/workflows/stg-pipeline-testnet.yml +++ b/.github/workflows/stg-pipeline-testnet.yml @@ -149,7 +149,7 @@ jobs: needs: main runs-on: ubuntu-22.04 name: E2E Tests - timeout-minutes: 10 + timeout-minutes: 20 steps: - name: Check the PR deployment status before run E2E tests. uses: aeternity/ae-github-actions/deploy-status@v7.1.0 From 86f1e092f362cfe9e5aba6ee523480c2b859a51e Mon Sep 17 00:00:00 2001 From: janmichek Date: Tue, 17 Dec 2024 12:53:44 +0100 Subject: [PATCH 21/55] fix setting time parameters from url --- cypress/e2e/app/transactions.cy.js | 2 ++ src/components/ScopePicker.vue | 11 ++++++-- src/components/TransactionsPanel.vue | 9 +++++- src/components/TransactionsScopePicker.vue | 19 ++++++------- src/stores/transactions.js | 33 +++++++++++++--------- 5 files changed, 47 insertions(+), 27 deletions(-) diff --git a/cypress/e2e/app/transactions.cy.js b/cypress/e2e/app/transactions.cy.js index b7442d139..ed0936817 100644 --- a/cypress/e2e/app/transactions.cy.js +++ b/cypress/e2e/app/transactions.cy.js @@ -8,6 +8,8 @@ describe('transactions', () => { cy.get('.transaction-statistics__panel .chip').should('be.visible') }) + // todo add multiple tests + it('should display same transactions after going back from detail', () => { cy.visit('/transactions') diff --git a/src/components/ScopePicker.vue b/src/components/ScopePicker.vue index 998d8b8af..a7b5f5f9f 100644 --- a/src/components/ScopePicker.vue +++ b/src/components/ScopePicker.vue @@ -49,8 +49,10 @@ const props = defineProps({ const emit = defineEmits(['update:modelValue']) const date = useVModel(props, 'modelValue', emit) -const aaa = [date.value?.customInterval.minStart, date.value?.customInterval.maxStart] -console.log('aaa', aaa) +const aaa = computed(() => { + // todo this is how formatting look like + return [date.value?.customInterval.minStart, date.value?.customInterval.maxStart] +}) const today = DateTime.now().toFormat('yyyy-MM-dd') watch(() => props.isScopeSelected, (newVal, oldVal) => { @@ -58,6 +60,11 @@ watch(() => props.isScopeSelected, (newVal, oldVal) => { closeDatepicker() } }) +// +watch(date.value, (newModel, oldModel) => { + console.log('newModel', newModel) + console.log('oldModel', oldModel) +}) const alertFn = () => { date.value = null diff --git a/src/components/TransactionsPanel.vue b/src/components/TransactionsPanel.vue index cc2a98afc..11942d48c 100644 --- a/src/components/TransactionsPanel.vue +++ b/src/components/TransactionsPanel.vue @@ -16,10 +16,12 @@ + class="u-hidden-mobile" + @updated="updateId"/> + process.client && isDesktop() ? 10 : 3) +function updateId(it) { + console.log('it', it) + selectedScope.value = it +} + if (process.client) { if (!isHydrated?.value) { setPageLimit(limit) diff --git a/src/components/TransactionsScopePicker.vue b/src/components/TransactionsScopePicker.vue index b764d44e7..43cc46d8f 100644 --- a/src/components/TransactionsScopePicker.vue +++ b/src/components/TransactionsScopePicker.vue @@ -1,7 +1,7 @@ @@ -19,15 +20,14 @@ const props = defineProps({ }, }) -const emit = defineEmits(['update:modelValue']) -const scope = useVModel(props, 'modelValue', emit) +const model = useVModel(props, 'modelValue', null) -const isCustomIntervalSelected = computed(() => { - return !!scope.value?.customInterval +const isScopeSelected = computed(() => { + return !!model.value }) function selectScope(interval) { - scope.value = interval + model.value = interval ? { customInterval: { minStart: interval[0].toISOString().split('T')[0], @@ -35,13 +35,10 @@ function selectScope(interval) { }, } : null - // todo no need sanitize } -// todo null handling need sanitize? -// todo this is how formatting look like // todo move formating to store? -const formattedScope = computed(() => scope.value?.customInterval - ? [scope.value.customInterval.minStart, scope.value.customInterval.maxStart] +const formattedScope = computed(() => model.value + ? [model.value.customInterval.minStart, model.value.customInterval.maxStart] : []) diff --git a/src/stores/transactions.js b/src/stores/transactions.js index 38ce4a030..36eb17ce1 100644 --- a/src/stores/transactions.js +++ b/src/stores/transactions.js @@ -60,17 +60,16 @@ export const useTransactionsStore = defineStore('transactions', () => { // todo naming scope vs interval function setUrlParametersToStore() { - // todo as parameters, does not have to be store - params.value = route.query - const hasInterval = !!params.value?.scope - const hasType = !!params.value?.txType + const { scope, txType } = route.query + const hasInterval = !!scope + const hasType = !!txType // todo mozna konverze uz tady selectedTxType.value = hasType - ? TX_TYPES_OPTIONS.find(option => option.typeQuery === params.value.txType) + ? TX_TYPES_OPTIONS.find(option => option.typeQuery === txType) : TX_TYPES_OPTIONS[0] selectedScope.value = hasInterval - ? formatParametersToScopeObject(params.value.scope) + ? formatParametersToScopeObject(scope) : null } @@ -78,7 +77,6 @@ export const useTransactionsStore = defineStore('transactions', () => { setUrlParametersToStore() const ddd = scopeSlug.value ? scopeSlug.value.substring(6) : null - console.log('ddd', ddd) await fetchTransactions({ queryParameters, diff --git a/src/utils/constants.js b/src/utils/constants.js index 5a745e08c..1f92d1104 100644 --- a/src/utils/constants.js +++ b/src/utils/constants.js @@ -3,7 +3,7 @@ export const MARKET_STATS_COINSTORE_ADDRESS = 'https://api.coinstore.com/api/v1/ export const MARKET_STATS_HOTCOIN_ADDRESS = 'https://api.hotcoinfin.com/v1/market/ticker' export const MINUTES_PER_BLOCK = 3 export const TX_TYPES_OPTIONS = [ - { typeQuery: null, label: 'All types' }, + { typeQuery: null, label: 'All Types' }, { typeQuery: 'spend', label: 'SpendTx' }, { typeQuery: 'contract_call', label: 'ContractCallTx' }, { typeQuery: 'contract_create', label: 'ContractCreateTx' }, From 16f51f5f8cf5c3f57fd803d3112cb68a99fddd6e Mon Sep 17 00:00:00 2001 From: janmichek Date: Sat, 21 Dec 2024 11:58:16 +0100 Subject: [PATCH 36/55] move formatting to store --- src/components/TransactionsScopePicker.vue | 23 +++---- src/stores/transactions.js | 78 ++++++++++++++-------- 2 files changed, 60 insertions(+), 41 deletions(-) diff --git a/src/components/TransactionsScopePicker.vue b/src/components/TransactionsScopePicker.vue index 139d2c907..e99fcbba8 100644 --- a/src/components/TransactionsScopePicker.vue +++ b/src/components/TransactionsScopePicker.vue @@ -12,6 +12,14 @@ diff --git a/src/stores/transactions.js b/src/stores/transactions.js index 36eb17ce1..470ed9e0a 100644 --- a/src/stores/transactions.js +++ b/src/stores/transactions.js @@ -1,6 +1,6 @@ import { defineStore } from 'pinia' import { useRoute, useRuntimeConfig } from 'nuxt/app' -import { ref } from 'vue' +import { computed, ref } from 'vue' import { DateTime } from 'luxon' import useAxios from '@/composables/useAxios' import { adaptTransactions } from '@/utils/adapters' @@ -61,32 +61,71 @@ export const useTransactionsStore = defineStore('transactions', () => { function setUrlParametersToStore() { const { scope, txType } = route.query - const hasInterval = !!scope - const hasType = !!txType + // todo mozna konverze uz tady - selectedTxType.value = hasType + selectedTxType.value = txType ? TX_TYPES_OPTIONS.find(option => option.typeQuery === txType) : TX_TYPES_OPTIONS[0] - selectedScope.value = hasInterval + selectedScope.value = scope ? formatParametersToScopeObject(scope) : null } + function formatParametersToScopeObject(scopeString) { + const parameters = scopeString.split(':')[1].split('-') + + return { + customInterval: { + minStart: DateTime.fromSeconds(parseInt(parameters[0])), + maxStart: DateTime.fromSeconds(parseInt(parameters[1])), + }, + } + } + + function formatScopeToParameters(minStart, maxStart) { + if (minStart && maxStart) { + const from = DateTime.fromISO(maxStart).toSeconds() + const to = DateTime.fromISO(minStart).toSeconds() + return `scope=time:${from}-${to}` + } else { + return null + } + } + + function formatStoreObjectToDatePickerObject(mod) { + return mod + ? [mod.customInterval.minStart, mod.customInterval.maxStart] + : [] + } + + function formatPickerObjectToStoreObject(interval) { + if (interval) { + return { + customInterval: { + minStart: interval[0].toISOString().split('T')[0], + maxStart: interval[1].toISOString().split('T')[0], + }, + } + } else { + return null + } + } + async function loadTransactions(queryParameters) { setUrlParametersToStore() - const ddd = scopeSlug.value ? scopeSlug.value.substring(6) : null + const scopeString = scopeSlug.value ? scopeSlug.value.substring(6) : null await fetchTransactions({ queryParameters, - scope: ddd, + scope: scopeString, type: selectedTxType.value?.typeQuery, limit: pageLimit.value, }) await fetchTransactionsCount({ - scope: ddd, + scope: scopeString, type: selectedTxType.value?.typeQuery, }) @@ -162,27 +201,6 @@ export const useTransactionsStore = defineStore('transactions', () => { pageLimit.value = value } - function formatParametersToScopeObject(scopeString) { - const parameters = scopeString.split(':')[1].split('-') - - return { - customInterval: { - minStart: DateTime.fromSeconds(parseInt(parameters[0])), - maxStart: DateTime.fromSeconds(parseInt(parameters[1])), - }, - } - } - - function formatScopeToParameters(minStart, maxStart) { - if (minStart && maxStart) { - const from = DateTime.fromISO(maxStart).toSeconds() - const to = DateTime.fromISO(minStart).toSeconds() - return `scope=time:${from}-${to}` - } else { - return null - } - } - return { transactionsCount, transactions, @@ -202,5 +220,7 @@ export const useTransactionsStore = defineStore('transactions', () => { selectedScope, setPageIndex, setPageLimit, + formatStoreObjectToDatePickerObject, + formatPickerObjectToStoreObject, } }) From 4e1bd02496a68c87232dc1a67b80e1fbecc39e45 Mon Sep 17 00:00:00 2001 From: janmichek Date: Sat, 21 Dec 2024 12:04:54 +0100 Subject: [PATCH 37/55] move formatting to store --- src/components/ScopePicker.vue | 3 +++ src/components/TransactionsPanel.vue | 4 ---- src/stores/transactions.js | 35 ++++++++++++++-------------- 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/src/components/ScopePicker.vue b/src/components/ScopePicker.vue index 437e85132..6d06b25ce 100644 --- a/src/components/ScopePicker.vue +++ b/src/components/ScopePicker.vue @@ -158,4 +158,7 @@ function close() { } } } + + + diff --git a/src/components/TransactionsPanel.vue b/src/components/TransactionsPanel.vue index 271acc6a9..fde7194ad 100644 --- a/src/components/TransactionsPanel.vue +++ b/src/components/TransactionsPanel.vue @@ -17,10 +17,6 @@ - - - - { const selectedTxType = ref(TX_TYPES_OPTIONS[0]) const selectedScope = ref(null) const pageLimit = ref(null) - const params = ref(null) const transactions = computed(() => rawTransactions.value @@ -47,8 +46,8 @@ export const useTransactionsStore = defineStore('transactions', () => { const scopeSlug = computed(() => { return selectedScope.value ? formatScopeToParameters( - selectedScope.value?.maxStart ?? selectedScope.value?.customInterval?.maxStart, - selectedScope.value?.minStart ?? selectedScope.value?.customInterval?.minStart, + selectedScope.value?.customInterval?.maxStart, + selectedScope.value?.customInterval?.minStart, ) : null }) @@ -72,17 +71,6 @@ export const useTransactionsStore = defineStore('transactions', () => { : null } - function formatParametersToScopeObject(scopeString) { - const parameters = scopeString.split(':')[1].split('-') - - return { - customInterval: { - minStart: DateTime.fromSeconds(parseInt(parameters[0])), - maxStart: DateTime.fromSeconds(parseInt(parameters[1])), - }, - } - } - function formatScopeToParameters(minStart, maxStart) { if (minStart && maxStart) { const from = DateTime.fromISO(maxStart).toSeconds() @@ -93,10 +81,15 @@ export const useTransactionsStore = defineStore('transactions', () => { } } - function formatStoreObjectToDatePickerObject(mod) { - return mod - ? [mod.customInterval.minStart, mod.customInterval.maxStart] - : [] + function formatParametersToScopeObject(scopeString) { + const parameters = scopeString.split(':')[1].split('-') + + return { + customInterval: { + minStart: DateTime.fromSeconds(parseInt(parameters[0])), + maxStart: DateTime.fromSeconds(parseInt(parameters[1])), + }, + } } function formatPickerObjectToStoreObject(interval) { @@ -112,6 +105,12 @@ export const useTransactionsStore = defineStore('transactions', () => { } } + function formatStoreObjectToDatePickerObject(mod) { + return mod + ? [mod.customInterval.minStart, mod.customInterval.maxStart] + : [] + } + async function loadTransactions(queryParameters) { setUrlParametersToStore() From dfd2010f3fc6099622a1fb415a168aeff5e2979c Mon Sep 17 00:00:00 2001 From: janmichek Date: Wed, 25 Dec 2024 11:16:27 +0100 Subject: [PATCH 38/55] format datetime value inside component --- src/components/ChartControls.vue | 8 ++-- src/components/ScopePicker.vue | 8 +++- src/components/TransactionsScopePicker.vue | 16 ++----- src/stores/charts.js | 3 ++ src/stores/transactions.js | 49 ++++++---------------- 5 files changed, 30 insertions(+), 54 deletions(-) diff --git a/src/components/ChartControls.vue b/src/components/ChartControls.vue index a920a48ba..a8ca2bec3 100644 --- a/src/components/ChartControls.vue +++ b/src/components/ChartControls.vue @@ -44,13 +44,13 @@ function selectInterval(option) { } function selectCustomInterval(dateCustomInterval) { - const customInterval = { + console.log('dateCustomInterval', dateCustomInterval) + selectedScope.value = { customInterval: { - minStart: dateCustomInterval[0].toISOString().split('T')[0], - maxStart: dateCustomInterval[1].toISOString().split('T')[0], + minStart: dateCustomInterval[0], + maxStart: dateCustomInterval[1], }, } - selectedScope.value = customInterval } diff --git a/src/components/ScopePicker.vue b/src/components/ScopePicker.vue index 6d06b25ce..cc1f5192b 100644 --- a/src/components/ScopePicker.vue +++ b/src/components/ScopePicker.vue @@ -3,6 +3,7 @@
@@ -12,14 +13,6 @@ diff --git a/src/stores/charts.js b/src/stores/charts.js index bc6dea672..904047762 100644 --- a/src/stores/charts.js +++ b/src/stores/charts.js @@ -80,6 +80,9 @@ export const useChartsStore = defineStore('charts', () => { } async function fetchHashrateStatistics(interval, limit, customInterval) { + // todo expand parameters + // todo refactor + console.log('customInterval', customInterval) hashrateStatistics.value = null const intervalSlug = customInterval diff --git a/src/stores/transactions.js b/src/stores/transactions.js index f9addc749..c5abade7a 100644 --- a/src/stores/transactions.js +++ b/src/stores/transactions.js @@ -1,7 +1,6 @@ import { defineStore } from 'pinia' import { useRoute, useRuntimeConfig } from 'nuxt/app' import { computed, ref } from 'vue' -import { DateTime } from 'luxon' import useAxios from '@/composables/useAxios' import { adaptTransactions } from '@/utils/adapters' import { formatAePrice, formatAettosToAe } from '@/utils/format' @@ -33,7 +32,9 @@ export const useTransactionsStore = defineStore('transactions', () => { ) const slug = computed(() => { + console.log('scopeSlug.value', scopeSlug.value) const slugParts = [scopeSlug.value, typeSlug.value].filter(Boolean) + console.log('slugParts', slugParts) return slugParts.length ? `?${slugParts.join('&')}` : '' }) @@ -43,16 +44,19 @@ export const useTransactionsStore = defineStore('transactions', () => { : null }) + // todo do i need return const scopeSlug = computed(() => { + // todo swapped params fix! return selectedScope.value ? formatScopeToParameters( - selectedScope.value?.customInterval?.maxStart, - selectedScope.value?.customInterval?.minStart, + selectedScope.value[1], + selectedScope.value[0], ) : null }) function changeRoute() { + console.log('slug.value', slug.value) push(`/transactions${slug.value}`) } @@ -71,10 +75,12 @@ export const useTransactionsStore = defineStore('transactions', () => { : null } + // todo check params are not swapped function formatScopeToParameters(minStart, maxStart) { + console.log('formatScopeToParameters', minStart, maxStart) if (minStart && maxStart) { - const from = DateTime.fromISO(maxStart).toSeconds() - const to = DateTime.fromISO(minStart).toSeconds() + const from = maxStart + const to = minStart return `scope=time:${from}-${to}` } else { return null @@ -83,39 +89,12 @@ export const useTransactionsStore = defineStore('transactions', () => { function formatParametersToScopeObject(scopeString) { const parameters = scopeString.split(':')[1].split('-') - - return { - customInterval: { - minStart: DateTime.fromSeconds(parseInt(parameters[0])), - maxStart: DateTime.fromSeconds(parseInt(parameters[1])), - }, - } - } - - function formatPickerObjectToStoreObject(interval) { - if (interval) { - return { - customInterval: { - minStart: interval[0].toISOString().split('T')[0], - maxStart: interval[1].toISOString().split('T')[0], - }, - } - } else { - return null - } - } - - function formatStoreObjectToDatePickerObject(mod) { - return mod - ? [mod.customInterval.minStart, mod.customInterval.maxStart] - : [] + return [parameters[0], parameters[1]] } async function loadTransactions(queryParameters) { setUrlParametersToStore() - const scopeString = scopeSlug.value ? scopeSlug.value.substring(6) : null - await fetchTransactions({ queryParameters, scope: scopeString, @@ -132,8 +111,6 @@ export const useTransactionsStore = defineStore('transactions', () => { } async function fetchTransactions({ queryParameters, scope, type, limit } = {}) { - console.log('fetchTransactions scope', scope) - rawTransactions.value = null if (queryParameters) { @@ -219,7 +196,5 @@ export const useTransactionsStore = defineStore('transactions', () => { selectedScope, setPageIndex, setPageLimit, - formatStoreObjectToDatePickerObject, - formatPickerObjectToStoreObject, } }) From b911c1408d64e3803fb8df9ea014c533d8a5d335 Mon Sep 17 00:00:00 2001 From: janmichek Date: Wed, 25 Dec 2024 11:55:17 +0100 Subject: [PATCH 39/55] rename variable --- src/components/ChartControls.vue | 2 +- src/components/HashrateChartPanel.vue | 4 ++-- src/components/KeyblocksChartPanel.vue | 4 ++-- src/pages/charts/contracts.vue | 4 ++-- src/pages/charts/difficulty.vue | 4 ++-- src/pages/charts/hashrate.vue | 4 ++-- src/pages/charts/names.vue | 4 ++-- src/pages/charts/transactions.vue | 4 ++-- src/pages/contracts/index.vue | 4 ++-- src/pages/names/index.vue | 4 ++-- src/pages/transactions/index.vue | 4 ++-- src/utils/constants.js | 2 +- 12 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/components/ChartControls.vue b/src/components/ChartControls.vue index a8ca2bec3..10ed7c8b3 100644 --- a/src/components/ChartControls.vue +++ b/src/components/ChartControls.vue @@ -2,7 +2,7 @@
import { storeToRefs } from 'pinia' import { useChartsStore } from '@/stores/charts' -import { CHART_INTERVALS_OPTIONS } from '~/utils/constants' +import { CHART_INTERVALS_PRESETS_OPTIONS } from '~/utils/constants' const chartsStore = useChartsStore() const { hashrateStatistics } = storeToRefs(chartsStore) @@ -39,7 +39,7 @@ const props = defineProps({ }, }) -const selectedScope = ref(CHART_INTERVALS_OPTIONS[4]) +const selectedScope = ref(CHART_INTERVALS_PRESETS_OPTIONS[4]) const selectedTxType = ref(TX_TYPES_OPTIONS[0]) await useAsyncData(async() => { diff --git a/src/components/KeyblocksChartPanel.vue b/src/components/KeyblocksChartPanel.vue index 9e82d4191..f31146be3 100644 --- a/src/components/KeyblocksChartPanel.vue +++ b/src/components/KeyblocksChartPanel.vue @@ -22,13 +22,13 @@ diff --git a/src/pages/charts/difficulty.vue b/src/pages/charts/difficulty.vue index 1932af474..709061a02 100644 --- a/src/pages/charts/difficulty.vue +++ b/src/pages/charts/difficulty.vue @@ -15,12 +15,12 @@ diff --git a/src/pages/charts/hashrate.vue b/src/pages/charts/hashrate.vue index 3cf0b1670..46e3ac526 100644 --- a/src/pages/charts/hashrate.vue +++ b/src/pages/charts/hashrate.vue @@ -15,12 +15,12 @@ diff --git a/src/pages/charts/names.vue b/src/pages/charts/names.vue index c983daa93..e88a7e7c5 100644 --- a/src/pages/charts/names.vue +++ b/src/pages/charts/names.vue @@ -15,12 +15,12 @@ diff --git a/src/pages/charts/transactions.vue b/src/pages/charts/transactions.vue index b8cd2e32f..5c7d03c15 100644 --- a/src/pages/charts/transactions.vue +++ b/src/pages/charts/transactions.vue @@ -17,12 +17,12 @@ diff --git a/src/pages/contracts/index.vue b/src/pages/contracts/index.vue index 188d7dbdc..6bafc9dd8 100644 --- a/src/pages/contracts/index.vue +++ b/src/pages/contracts/index.vue @@ -18,7 +18,7 @@ @@ -28,7 +28,7 @@ import ContractsPanel from '@/components/ContractsPanel' import PageHeader from '@/components/PageHeader' import { contractsHints } from '@/utils/hints/contractsHints' -import { CHART_INTERVALS_OPTIONS } from '@/utils/constants' +import { CHART_INTERVALS_PRESETS_OPTIONS } from '@/utils/constants' const { isLoading } = useLoading() diff --git a/src/pages/names/index.vue b/src/pages/names/index.vue index 1442b220a..286ba44e5 100644 --- a/src/pages/names/index.vue +++ b/src/pages/names/index.vue @@ -17,7 +17,7 @@ @@ -22,7 +22,7 @@ diff --git a/src/utils/constants.js b/src/utils/constants.js index 1f92d1104..66e02bfac 100644 --- a/src/utils/constants.js +++ b/src/utils/constants.js @@ -29,7 +29,7 @@ export const TX_TYPES_OPTIONS = [ { typeQuery: 'ga_meta', label: 'GAMetaTx' }, { typeQuery: 'paying_for', label: 'PayingForTx' }, ] -export const CHART_INTERVALS_OPTIONS = [ +export const CHART_INTERVALS_PRESETS_OPTIONS = [ { interval: 'day', limit: '7', label: '1W' }, { interval: 'day', limit: '30', label: '1M' }, { interval: 'day', limit: '90', label: '3M' }, From be3902d67c44c2440a25fac8d280517b9b709e79 Mon Sep 17 00:00:00 2001 From: janmichek Date: Wed, 25 Dec 2024 12:26:56 +0100 Subject: [PATCH 40/55] simplify formatting --- src/components/AccountsChartPanel.vue | 20 +++--- src/components/ChartControls.vue | 29 ++++---- src/components/ContractsChartPanel.vue | 9 +-- src/components/DifficultyChartPanel.vue | 12 +--- src/components/HashrateChartPanel.vue | 19 ++--- src/components/KeyblocksChartPanel.vue | 10 +-- src/components/LineChart.vue | 4 +- src/components/NamesChartPanel.vue | 8 +-- src/components/ScopePicker.vue | 1 - src/components/TransactionsChartPanel.vue | 6 +- src/pages/accounts/index.vue | 2 +- src/pages/charts/hashrate.vue | 2 +- src/pages/charts/transactions.vue | 4 +- src/pages/contracts/index.vue | 4 +- src/pages/names/index.vue | 4 +- src/pages/transactions/index.vue | 4 +- src/stores/charts.js | 85 +++++++++++------------ src/stores/transactions.js | 50 ++++++------- src/utils/constants.js | 12 ++-- 19 files changed, 134 insertions(+), 151 deletions(-) diff --git a/src/components/AccountsChartPanel.vue b/src/components/AccountsChartPanel.vue index a5a82e366..b4b3acf38 100644 --- a/src/components/AccountsChartPanel.vue +++ b/src/components/AccountsChartPanel.vue @@ -8,16 +8,16 @@ + :interval-by="selectedScope.intervalBy"/> @@ -31,29 +31,31 @@ const chartsStore = useChartsStore() const { accountsStatistics } = storeToRefs(chartsStore) const { fetchAccountsStatistics } = chartsStore -const selectedRange = ref(CHART_INTERVALS_PRESETS_OPTIONS[4]) +const selectedScope = ref(CHART_SCOPE_PRESETS_OPTIONS[4]) await useAsyncData(async() => { await loadHashrateStatistics() return true }) +// todo check charts if (process.client) { - watch([selectedRange], async() => { + watch([selectedScope], async() => { await loadHashrateStatistics() + // todo fix }) } async function loadHashrateStatistics() { await fetchAccountsStatistics( - selectedRange.value.interval, - selectedRange.value.limit, - selectedRange.value.customInterval) + selectedScope.value.intervalBy, + selectedScope.value.limit, + selectedScope.value.scope) } diff --git a/src/components/ChartControls.vue b/src/components/ChartControls.vue index ec80ac0d6..30dec0614 100644 --- a/src/components/ChartControls.vue +++ b/src/components/ChartControls.vue @@ -2,7 +2,7 @@
+ :is-scope-selected="isCustomScopeSelected" + @updated="selectCustomScope"/>
@@ -32,8 +32,17 @@ const props = defineProps({ const selectedScope = useVModel(props, 'modelValue', emit) -const isCustomIntervalSelected = computed(() => - Object.keys(selectedScope.value).includes('customInterval')) +const isCustomScopeSelected = computed(() => + Object.keys(selectedScope.value).includes('scope')) + +function selectCustomScope(scope) { + selectedScope.value = { + scope: { + minStart: scope[0], + maxStart: scope[1], + }, + } +} function isPresetSelected(option) { return selectedScope.value.label === option.label @@ -43,16 +52,6 @@ function selectPreset(option) { selectedScope.value = option } -function selectCustomInterval(dateCustomInterval) { - console.log('dateCustomInterval', dateCustomInterval) - selectedScope.value = { - customInterval: { - minStart: dateCustomInterval[0], - maxStart: dateCustomInterval[1], - }, - } -} - diff --git a/src/components/KeyblocksChartPanel.vue b/src/components/KeyblocksChartPanel.vue index f31146be3..d63a1c079 100644 --- a/src/components/KeyblocksChartPanel.vue +++ b/src/components/KeyblocksChartPanel.vue @@ -11,7 +11,7 @@ + :interval-by="selectedScope.intervalBy"/> import { storeToRefs } from 'pinia' import { useChartsStore } from '@/stores/charts' -import { CHART_INTERVALS_PRESETS_OPTIONS } from '@/utils/constants' +import { CHART_SCOPE_PRESETS_OPTIONS } from '@/utils/constants' const chartsStore = useChartsStore() const { keyblocksStatistics } = storeToRefs(chartsStore) const { fetchKeyblocksStatistics } = chartsStore -const selectedScope = ref(CHART_INTERVALS_PRESETS_OPTIONS[4]) +const selectedScope = ref(CHART_SCOPE_PRESETS_OPTIONS[4]) await useAsyncData(async() => { await loadKeyblockStatistics() @@ -43,9 +43,9 @@ if (process.client) { async function loadKeyblockStatistics() { await fetchKeyblocksStatistics( - selectedScope.value.interval, + selectedScope.value.preset, selectedScope.value.limit, - selectedScope.value.customInterval) + selectedScope.value.scope) } diff --git a/src/components/LineChart.vue b/src/components/LineChart.vue index a997c8a46..3ad715796 100644 --- a/src/components/LineChart.vue +++ b/src/components/LineChart.vue @@ -35,7 +35,7 @@ const props = defineProps({ type: Array, default: null, }, - interval: { + intervalBy: { type: String, required: true, }, @@ -55,7 +55,7 @@ const labels = computed(() => { function formatDate(label) { const date = DateTime.fromISO(label) - if (props.interval === 'month') { + if (props.intervalBy === 'month') { return date.toFormat('yyyy/MM') } diff --git a/src/components/NamesChartPanel.vue b/src/components/NamesChartPanel.vue index ab65050ca..ecd90b8bd 100644 --- a/src/components/NamesChartPanel.vue +++ b/src/components/NamesChartPanel.vue @@ -11,7 +11,7 @@ + :interval-by="selectedScope.intervalBy"/> import { storeToRefs } from 'pinia' import { useChartsStore } from '@/stores/charts' -import { CHART_INTERVALS_PRESETS_OPTIONS } from '@/utils/constants' const chartsStore = useChartsStore() const { namesStatistics } = storeToRefs(chartsStore) @@ -37,7 +36,6 @@ const props = defineProps({ const selectedScope = ref(props.scope) - await useAsyncData(async() => { await loadNamesStatistics() return true @@ -51,9 +49,9 @@ if (process.client) { async function loadNamesStatistics() { await fetchNamesStatistics( - selectedScope.value.interval, + selectedScope.value.preset, selectedScope.value.limit, - selectedScope.value.customInterval) + selectedScope.value.scope) } diff --git a/src/components/ScopePicker.vue b/src/components/ScopePicker.vue index cc1f5192b..f78078249 100644 --- a/src/components/ScopePicker.vue +++ b/src/components/ScopePicker.vue @@ -26,7 +26,6 @@ import VueDatePicker from '@vuepic/vue-datepicker' import '@vuepic/vue-datepicker/dist/main.css' import { STATISTICS_DATA_BEGINNING } from '@/utils/constants' -// todo pass clearable const props = defineProps({ scope: { type: Array, diff --git a/src/components/TransactionsChartPanel.vue b/src/components/TransactionsChartPanel.vue index 5e925789d..5aac13f65 100644 --- a/src/components/TransactionsChartPanel.vue +++ b/src/components/TransactionsChartPanel.vue @@ -19,7 +19,7 @@ + :interval-by="selectedScope.intervalBy"/> diff --git a/src/pages/accounts/index.vue b/src/pages/accounts/index.vue index 5d082774f..7dd365160 100644 --- a/src/pages/accounts/index.vue +++ b/src/pages/accounts/index.vue @@ -19,7 +19,7 @@ diff --git a/src/pages/charts/hashrate.vue b/src/pages/charts/hashrate.vue index 47d7c67ac..0128c1891 100644 --- a/src/pages/charts/hashrate.vue +++ b/src/pages/charts/hashrate.vue @@ -22,5 +22,5 @@ diff --git a/src/pages/charts/transactions.vue b/src/pages/charts/transactions.vue index 5c7d03c15..1ecd45505 100644 --- a/src/pages/charts/transactions.vue +++ b/src/pages/charts/transactions.vue @@ -17,12 +17,12 @@ diff --git a/src/pages/contracts/index.vue b/src/pages/contracts/index.vue index 6bafc9dd8..e87c6a0b6 100644 --- a/src/pages/contracts/index.vue +++ b/src/pages/contracts/index.vue @@ -18,7 +18,7 @@ @@ -28,7 +28,7 @@ import ContractsPanel from '@/components/ContractsPanel' import PageHeader from '@/components/PageHeader' import { contractsHints } from '@/utils/hints/contractsHints' -import { CHART_INTERVALS_PRESETS_OPTIONS } from '@/utils/constants' +import { CHART_SCOPE_PRESETS_OPTIONS } from '@/utils/constants' const { isLoading } = useLoading() diff --git a/src/pages/names/index.vue b/src/pages/names/index.vue index 286ba44e5..d0de8df4c 100644 --- a/src/pages/names/index.vue +++ b/src/pages/names/index.vue @@ -17,7 +17,7 @@ From 16343fd42fa06497b815647d8002f00144bded5e Mon Sep 17 00:00:00 2001 From: janmichek Date: Thu, 26 Dec 2024 15:04:12 +0100 Subject: [PATCH 46/55] fix styles --- src/components/AppSelect.vue | 4 ++-- src/components/ChartControls.vue | 3 +-- src/components/ScopePicker.vue | 20 +++++++++++++------- src/components/TransactionsPanel.vue | 2 -- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/components/AppSelect.vue b/src/components/AppSelect.vue index 4a22e1ece..9245414be 100644 --- a/src/components/AppSelect.vue +++ b/src/components/AppSelect.vue @@ -184,7 +184,7 @@ const selectedValue = useVModel(props, 'modelValue', emit) &--sm { .multiselect__tags { - min-height: 28px; + min-height: 31px; padding: 0 var(--space-6) 0 var(--space-1); } @@ -199,7 +199,7 @@ const selectedValue = useVModel(props, 'modelValue', emit) } .multiselect__select { - height: 29px; + height: 32px; } } } diff --git a/src/components/ChartControls.vue b/src/components/ChartControls.vue index 16dc1f0ca..d8b723062 100644 --- a/src/components/ChartControls.vue +++ b/src/components/ChartControls.vue @@ -29,11 +29,10 @@ const props = defineProps({ }, }) -// todo fix buttons -// todo fix select height // todo reset custom after selecting preset const selectedScope = useVModel(props, 'modelValue', emit) +// todo move inside const isCustomScopeSelected = computed(() => Object.keys(selectedScope.value).includes('scope')) function selectCustomScope(scope) { diff --git a/src/components/ScopePicker.vue b/src/components/ScopePicker.vue index 6a92d6cc3..5edafed43 100644 --- a/src/components/ScopePicker.vue +++ b/src/components/ScopePicker.vue @@ -90,9 +90,9 @@ const inputClassNames = computed(() => ({