diff --git a/public/images/bk_maintenance.png b/public/images/bk_maintenance.png new file mode 100644 index 000000000..ba9e40756 Binary files /dev/null and b/public/images/bk_maintenance.png differ diff --git a/src/i18n/en-US/index.ts b/src/i18n/en-US/index.ts index 1fdaf3b89..4fe6d2b85 100644 --- a/src/i18n/en-US/index.ts +++ b/src/i18n/en-US/index.ts @@ -435,6 +435,11 @@ export default { warningLeaveMinAmount: 'Account must hold greater than {amount}{symbol} in transferrable when you stake.', }, + maintenance: { + switching: 'Switching to', + willBeBack: 'We will be back', + verySoon: 'very soon', + }, }, assets: { astarNativeAccount: 'Astar Native Account', diff --git a/src/layouts/DashboardLayout.vue b/src/layouts/DashboardLayout.vue index 51ee344b5..6e5428d84 100644 --- a/src/layouts/DashboardLayout.vue +++ b/src/layouts/DashboardLayout.vue @@ -64,6 +64,7 @@ export default defineComponent({ diff --git a/src/router/index.ts b/src/router/index.ts index 48cd8c9f6..5c925fc72 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -6,8 +6,8 @@ import { createWebHistory, } from 'vue-router'; import { StateInterface } from 'src/store'; -import routes from 'src/router/routes'; - +import routes, { Path } from 'src/router/routes'; +import { $api } from '../boot/api'; export { Path } from 'src/router/routes'; export { getHeaderName, buildTransferPageLink } from 'src/router/utils'; @@ -38,5 +38,22 @@ export default route(function (/* { store, ssrContext } */) { history: createHistory(process.env.MODE === 'ssr' ? void 0 : process.env.VUE_ROUTER_BASE), }); + // TODO - remove after the portal v3 is live. + Router.beforeEach((to, from, next) => { + // Prevent accessing to dApp staking pages if v3 is deployed to a node, but not supported by UI + const networksSupportV3 = ['development']; + const isStakingV3 = $api?.query.hasOwnProperty('dappStaking'); + const dontNavigateToDappStaking = + to.path.includes('/dapp-staking') && + !to.path.includes('/maintenance') && + !networksSupportV3.includes(to.params?.network?.toString()); + + if (isStakingV3 && dontNavigateToDappStaking) { + next({ path: Path.DappStaking + Path.Maintenance }); + } else { + next(); + } + }); + return Router; }); diff --git a/src/router/routes.ts b/src/router/routes.ts index b7365d826..a9ed3f071 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -13,6 +13,7 @@ import Dashboard from 'src/pages/Dashboard.vue'; import RegisterDapp from 'src/pages/RegisterDapp.vue'; import StakeManage from 'src/pages/StakeManage.vue'; import DappPage from 'src/pages/DappPage.vue'; +import MaintenanceMode from 'src/staking-v3/components/MaintenanceMode.vue'; import { RouteRecordRaw } from 'vue-router'; export { @@ -40,6 +41,7 @@ export enum Path { Transfer = '/transfer', XvmTransfer = '/xvm-transfer', Register = '/register', + Maintenance = '/maintenance', } const routes: RouteRecordRaw[] = [ @@ -68,6 +70,10 @@ const routes: RouteRecordRaw[] = [ path: Path.DappStaking + Path.Discover, redirect: networkParam + Path.DappStaking + Path.Discover, }, + { + path: Path.DappStaking + Path.Maintenance, + redirect: networkParam + Path.DappStaking + Path.Maintenance, + }, { path: '/store/discover-dapps', redirect: networkParam + Path.DappStaking + Path.Discover, @@ -156,6 +162,10 @@ const routes: RouteRecordRaw[] = [ path: 'register', component: RegisterDapp, }, + { + path: 'maintenance', + component: MaintenanceMode, + }, ], }, diff --git a/src/staking-v3/components/MaintenanceMode.vue b/src/staking-v3/components/MaintenanceMode.vue new file mode 100644 index 000000000..e52e7c4bd --- /dev/null +++ b/src/staking-v3/components/MaintenanceMode.vue @@ -0,0 +1,50 @@ + + +