diff --git a/frontend/.vscode/settings.json b/frontend/.vscode/settings.json index 791ee7419..ee603394d 100644 --- a/frontend/.vscode/settings.json +++ b/frontend/.vscode/settings.json @@ -33,6 +33,7 @@ "NotificationsNetworkTable", "NotificationsOverview", "NotificationsTableEmpty", + "SlotVizViewer", "a11y", "checkout", "ci", diff --git a/frontend/components/dashboard/creation/DashboardCreationController.vue b/frontend/components/dashboard/creation/DashboardCreationController.vue index 5fa64eea8..eca17db0e 100644 --- a/frontend/components/dashboard/creation/DashboardCreationController.vue +++ b/frontend/components/dashboard/creation/DashboardCreationController.vue @@ -8,7 +8,6 @@ import type { ChainIDs } from '~/types/network' const userDashboardStore = useUserDashboardStore() const { - createAccountDashboard, createValidatorDashboard, } = userDashboardStore @@ -27,36 +26,23 @@ interface Props { } const props = defineProps() -const showInDevelopment = Boolean(useRuntimeConfig().public.showInDevelopment) - const visible = ref(false) const state = ref('') const type = ref<'' | DashboardType>('') const name = ref('') const network = ref(0) const forcedDashboardType = ref<'' | DashboardType>('') -let forcedNetworkIfValidatorDashboard = 0 const { dashboardKey, publicEntities, } = useDashboardKey() const { fetch } = useCustomFetch() -const route = useRoute() const maxDashboards = computed(() => { // TODO: currently there is no value for "amount of account dashboards", using // "amount of validator dashboards" instead for now return user.value?.premium_perks.validator_dashboards ?? 1 }) -const accountsDisabled = computed(() => { - // TODO: Once account dashboards are being tackled, use something like - // return !showInDevelopment || (dashboards.value?.account_dashboards?.length ?? 0) >= maxDashboards.value - // || (!!forcedDashboardType.value && forcedDashboardType.value !== 'account') - return ( - !showInDevelopment - || (!!forcedDashboardType.value && forcedDashboardType.value !== 'account') - ) -}) const validatorsDisabled = computed(() => { return ( (dashboards.value?.validator_dashboards?.length ?? 0) @@ -67,20 +53,15 @@ const validatorsDisabled = computed(() => { function show( forcedType: '' | DashboardType = '', - forcedNetwork: ChainIDs = 0, ) { visible.value = true - forcedNetworkIfValidatorDashboard = forcedNetwork type.value = forcedDashboardType.value = forcedType if (!type.value) { if (!validatorsDisabled.value) { type.value = 'validator' } - else if (!accountsDisabled.value) { - type.value = 'account' - } } - network.value = forcedNetwork || currentNetwork.value + network.value = currentNetwork.value ?? 1 state.value = 'type' name.value = isLoggedIn.value ? '' : 'cookie' } @@ -92,74 +73,37 @@ if (props.initiallyVisible) { async function createDashboard() { visible.value = false - const matchingType - = route.name === 'dashboard-id' && type.value === 'validator' const publicKey - = matchingType && !isLoggedIn.value ? dashboardKey.value : undefined - if (type.value === 'account') { - if (!name.value) { - return - } - const response = await createAccountDashboard(name.value, publicKey) + = !isLoggedIn.value ? dashboardKey.value : undefined - await navigateTo( - `/account-dashboard/${response?.key ?? response?.id ?? 1}`, - ) + if (!name.value || !network.value) { + return } - else if (type.value === 'validator') { - if (!name.value || !network.value) { - return - } - const response = await createValidatorDashboard( - name.value, - network.value, - publicKey, - ) - if ( - matchingType - && publicEntities.value?.length - && response?.id - && response.id > 0 - ) { - await fetch( - 'DASHBOARD_VALIDATOR_MANAGEMENT', - { - body: { - group_id: '0', - validators: publicEntities.value, - }, - method: 'POST', + const response = await createValidatorDashboard( + name.value, + network.value, + publicKey, + ) + if ( + publicEntities.value?.length + && response?.id + && response.id > 0 + ) { + await fetch( + 'DASHBOARD_VALIDATOR_MANAGEMENT', + { + body: { + group_id: '0', + validators: publicEntities.value, }, - { dashboardKey: response.id }, - ) - } - await navigateTo(`/dashboard/${response?.key ?? response?.id ?? 1}`) - } -} - -function onBack() { - if (state.value === 'network') { - state.value = 'type' - } -} - -function onNext() { - if (state.value === 'type') { - if (type.value === 'account') { - createDashboard() - } - else if (forcedNetworkIfValidatorDashboard) { - createDashboard() - } - else { - state.value = 'network' - } - } - else if (state.value === 'network') { - createDashboard() + method: 'POST', + }, + { dashboardKey: response.id }, + ) } + await navigateTo(`/dashboard/${response?.key ?? response?.id ?? 1}`) } @@ -173,16 +117,9 @@ function onNext() { v-model:state="state" v-model:type="type" v-model:name="name" - :accounts-disabled :validators-disabled - @next="onNext()" - /> -
@@ -192,16 +129,8 @@ function onNext() { v-model:state="state" v-model:type="type" v-model:name="name" - :accounts-disabled :validators-disabled - @next="onNext()" - /> -
diff --git a/frontend/components/dashboard/creation/DashboardCreationNetworkMask.vue b/frontend/components/dashboard/creation/DashboardCreationNetworkMask.vue deleted file mode 100644 index 37ffa1aff..000000000 --- a/frontend/components/dashboard/creation/DashboardCreationNetworkMask.vue +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - - diff --git a/frontend/components/dashboard/creation/DashboardCreationTypeMask.vue b/frontend/components/dashboard/creation/DashboardCreationTypeMask.vue index ebd0b1ebc..133b65552 100644 --- a/frontend/components/dashboard/creation/DashboardCreationTypeMask.vue +++ b/frontend/components/dashboard/creation/DashboardCreationTypeMask.vue @@ -8,7 +8,6 @@ const { t: $t } = useTranslation() const { isLoggedIn } = useUserStore() interface Props { - accountsDisabled: boolean, validatorsDisabled: boolean, } const props = defineProps() @@ -24,7 +23,7 @@ const typeButtons = [ }, { component: IconAccount, - disabled: props.accountsDisabled, + disabled: true, subText: $t('common.coming_soon'), text: $t('dashboard.creation.type.accounts'), value: 'account', diff --git a/frontend/components/slot/viz/SlotVizViewer.vue b/frontend/components/slot/viz/SlotVizViewer.vue index 9e467fda0..d72e0f9d8 100644 --- a/frontend/components/slot/viz/SlotVizViewer.vue +++ b/frontend/components/slot/viz/SlotVizViewer.vue @@ -153,9 +153,12 @@ watch( :buttons="icons" /> -

+ {{ networkInfo?.name }} -

+
@@ -199,6 +202,8 @@ watch( .header-row { display: grid; justify-content: center; + justify-items: center; + align-items: center; padding: var(--padding-large) var(--padding-large) var(--padding) 9px; gap: var(--padding); grid-template: [row1-start] "info filter-row network header-right" [row1-end] / max-content max-content 1fr max-content; diff --git a/frontend/utils/mock.ts b/frontend/utils/mock.ts index 50d57d16b..19f0a05f9 100644 --- a/frontend/utils/mock.ts +++ b/frontend/utils/mock.ts @@ -38,18 +38,22 @@ export function simulateAPIresponseAboutNetworkList(): ApiDataResponse< ApiChainInfo[] > { const result = { data: [] } as ApiDataResponse - result.data.push( - { - chain_id: Number(useRuntimeConfig().public.chainIdByDefault), - name: 'ehtereum', - }, - ) + const currentChainId = Number(useRuntimeConfig().public.chainIdByDefault) + const isGnosis = currentChainId === 100 + // hotfix: make gnosis work -> we have to get rid of the `loadAvailableNetworks()` and this mock + if (!isGnosis) { + result.data.push( + { + chain_id: currentChainId, + name: 'ethereum', + }, + ) + } result.data.push( { chain_id: 100, name: 'gnosis', }, ) - return result }