Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wallet validator unstaking1 #7403

Merged
merged 16 commits into from
Jan 17, 2023
Prev Previous commit
Next Next commit
update
  • Loading branch information
Jibz1 committed Jan 17, 2023
commit e7de444fb357191382eea294d35e76efb58b5a10
4 changes: 4 additions & 0 deletions apps/wallet/src/shared/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useLocation } from 'react-router-dom';
import Browser from 'webextension-polyfill';

import { trackPageview, trackEvent } from '../plausible';
import { growthbook } from '_app/experimentation/feature-gating';
import { useAppSelector } from '_hooks';
import { growthbook } from '_src/ui/app/experimentation/feature-gating';

Expand Down Expand Up @@ -35,6 +36,9 @@ export function usePageView() {
url: location.pathname,
});

growthbook.setAttributes({
Jibz1 marked this conversation as resolved.
Show resolved Hide resolved
network: activeNetwork,
});
// Send a network event to Plausible with the page and url params
trackEvent('PageByNetwork', {
props: {
Expand Down
9 changes: 7 additions & 2 deletions apps/wallet/src/ui/app/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

import { useFeature } from '@growthbook/growthbook-react';
import { useEffect } from 'react';
import { Navigate, Route, Routes, useLocation } from 'react-router-dom';

Expand Down Expand Up @@ -30,6 +31,7 @@ import SelectPage from '_pages/initialize/select';
import SiteConnectPage from '_pages/site-connect';
import WelcomePage from '_pages/welcome';
import { setNavVisibility } from '_redux/slices/app';
import { FEATURES } from '_src/shared/experimentation/features';

const HIDDEN_MENU_PATHS = [
'/nft-details',
Expand All @@ -50,12 +52,13 @@ const App = () => {
document.body.classList.remove('app-initializing');
}, [isPopup]);
const location = useLocation();
const stakingEnabled = useFeature(FEATURES.STAKING_ENABLED).on;
useEffect(() => {
const menuVisible = !HIDDEN_MENU_PATHS.some((aPath) =>
location.pathname.startsWith(aPath)
);
dispatch(setNavVisibility(menuVisible));
}, [location, dispatch]);
}, [location, dispatch, stakingEnabled]);

return (
<Routes>
Expand All @@ -71,7 +74,9 @@ const App = () => {
<Route path="transactions" element={<TransactionsPage />} />
<Route path="send" element={<TransferCoinPage />} />
<Route path="send/select" element={<CoinsSelectorPage />} />
<Route path="stake/*" element={<Staking />} />
{stakingEnabled ? (
<Route path="stake/*" element={<Staking />} />
) : null}
<Route
path="tx/:txDigest"
element={<TransactionDetailsPage />}
Expand Down
9 changes: 1 addition & 8 deletions apps/wallet/src/ui/app/staking/home/index.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

import { useFeature } from '@growthbook/growthbook-react';
import { Route, Routes } from 'react-router-dom';

import { DelegationDetail } from '../delegation-detail';
import StakePage from '../stake';
import { Validators } from '../validators';
import { FEATURES } from '_src/shared/experimentation/features';

export function Staking() {
const stakingEnabled = useFeature(FEATURES.STAKING_ENABLED).on;

return (
<Routes>
<Route path="/*" element={<Validators />} />
<Route path="/delegation-detail" element={<DelegationDetail />} />
{stakingEnabled ? (
<Route path="/new" element={<StakePage />} />
) : null}
<Route path="/new" element={<StakePage />} />
</Routes>
);
}