From 6ac17ea7ca1629afa08a45dc6ee02534392b39ab Mon Sep 17 00:00:00 2001 From: Dominik Zborowski Date: Wed, 21 Aug 2024 08:17:41 +0200 Subject: [PATCH 001/121] feat: grid tab and routing (#395) --- components/ProfileTabs.vue | 4 +- components/ProfileTabsItem.vue | 2 +- composables/useFilters.ts | 4 +- domains/graph/components/ProfileViewGraph.vue | 67 ++++++++----------- pages/[profileAddress]/index/assets.vue | 44 ++++++++++++ pages/[profileAddress]/index/index.vue | 5 ++ shared/routes.ts | 5 ++ translations/en_US.json | 1 + types/filters.ts | 2 +- 9 files changed, 89 insertions(+), 45 deletions(-) create mode 100644 pages/[profileAddress]/index/assets.vue create mode 100644 pages/[profileAddress]/index/index.vue diff --git a/components/ProfileTabs.vue b/components/ProfileTabs.vue index fabadb8c..a604f434 100644 --- a/components/ProfileTabs.vue +++ b/components/ProfileTabs.vue @@ -9,7 +9,7 @@ type Props = { activeTab?: ProfileViewTabName } -type Emits = (event: 'activate-tab', value: ProfileViewTabName) => void +type Emits = (event: 'activate-tab', value: ProfileViewTab) => void defineProps() const emits = defineEmits() @@ -26,7 +26,7 @@ const { formatMessage } = useIntl() :label="formatMessage(`profile_tab_${tab.id}`)" :count="tab.count" :is-active="tab.id === activeTab" - @click="emits('activate-tab', tab.id)" + @click="emits('activate-tab', tab)" /> diff --git a/components/ProfileTabsItem.vue b/components/ProfileTabsItem.vue index d747dab4..c23650f9 100644 --- a/components/ProfileTabsItem.vue +++ b/components/ProfileTabsItem.vue @@ -3,8 +3,8 @@ import { tv } from 'tailwind-variants' type Props = { label: string - count: number isActive: boolean + count?: number } const props = defineProps() diff --git a/composables/useFilters.ts b/composables/useFilters.ts index 3a61287f..55952466 100644 --- a/composables/useFilters.ts +++ b/composables/useFilters.ts @@ -154,9 +154,9 @@ export const useFilters = (assets?: ComputedRef) => { ]) //--- setters - const setFilters = (filters: Partial) => { + const setFilters = (filters: Partial, path?: string) => { navigateTo({ - path: route.path, + path: path || route.path, query: { ...route.query, ...filters, diff --git a/domains/graph/components/ProfileViewGraph.vue b/domains/graph/components/ProfileViewGraph.vue index 7a624c22..adcfd69b 100644 --- a/domains/graph/components/ProfileViewGraph.vue +++ b/domains/graph/components/ProfileViewGraph.vue @@ -1,44 +1,20 @@