Skip to content

Commit

Permalink
chore: mx panel [skip cypress] (#2144)
Browse files Browse the repository at this point in the history
  • Loading branch information
foodaka authored Aug 5, 2024
1 parent 9dde336 commit 758414b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 14 deletions.
15 changes: 8 additions & 7 deletions pages/_app.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { GasStationProvider } from 'src/components/transactions/GasStation/GasSt
import { AppDataProvider } from 'src/hooks/app-data-provider/useAppDataProvider';
import { ModalContextProvider } from 'src/hooks/useModal';
import { Web3ContextProvider } from 'src/libs/web3-data-provider/Web3Provider';
import { useRootStore } from 'src/store/root';
import { SharedDependenciesProvider } from 'src/ui-config/SharedDependenciesProvider';

import createEmotionCache from '../src/createEmotionCache';
Expand Down Expand Up @@ -102,7 +103,7 @@ interface MyAppProps extends AppProps {
export default function MyApp(props: MyAppProps) {
const { Component, emotionCache = clientSideEmotionCache, pageProps } = props;
const getLayout = Component.getLayout ?? ((page: ReactNode) => page);
// const initializeMixpanel = useRootStore((store) => store.initializeMixpanel);
const initializeMixpanel = useRootStore((store) => store.initializeMixpanel);
const [queryClient] = useState(
() =>
new QueryClient({
Expand All @@ -114,13 +115,13 @@ export default function MyApp(props: MyAppProps) {
})
);

// const MIXPANEL_TOKEN = process.env.NEXT_PUBLIC_MIXPANEL;
const MIXPANEL_TOKEN = process.env.NEXT_PUBLIC_MIXPANEL;
useEffect(() => {
// if (MIXPANEL_TOKEN) {
// initializeMixpanel();
// } else {
console.log('no analytics tracking');
// }
if (MIXPANEL_TOKEN) {
initializeMixpanel();
} else {
console.log('no analytics tracking');
}
}, []);

return (
Expand Down
11 changes: 5 additions & 6 deletions src/modules/dashboard/DashboardContentWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { StyledTxModalToggleGroup } from 'src/components/StyledToggleButtonGroup
import { useWeb3Context } from 'src/libs/hooks/useWeb3Context';
import { useRootStore } from 'src/store/root';
import { CustomMarket } from 'src/utils/marketsAndNetworksConfig';
import { AUTH } from 'src/utils/mixPanelEvents';
import { AUTH, DASHBOARD } from 'src/utils/mixPanelEvents';

import { BorrowAssetsList } from './lists/BorrowAssetsList/BorrowAssetsList';
import { BorrowedPositionsList } from './lists/BorrowedPositionsList/BorrowedPositionsList';
Expand Down Expand Up @@ -63,10 +63,9 @@ export const DashboardContentWrapper = ({ isBorrow }: DashboardContentWrapperPro
currentMarket === ('fork_proto_mainnet_v3' as string)) ||
(!currentNetworkConfig.isFork && currentMarket === 'proto_mainnet_v3')
}
// Todo tracking?
// onClick={() =>
// trackEvent(WITHDRAW_MODAL.SWITCH_WITHDRAW_TYPE, { withdrawType: 'Withdraw' })
// }
onClick={() =>
trackEvent(DASHBOARD.SELECT_V3_ETH_MARKET, { market: 'Ethereum Main' })
}
>
<TokenIcon sx={{ mr: 2 }} symbol="eth-round" />

Expand All @@ -86,7 +85,7 @@ export const DashboardContentWrapper = ({ isBorrow }: DashboardContentWrapperPro
value={currentNetworkConfig.isFork ? 'fork_proto_lido_v3' : 'proto_lido_v3'}
// disabled={currentMarket === 'proto_lido_v3' || 'fork_proto_lido_v3' ? true : false}

// Todo tracking?
onClick={() => trackEvent(DASHBOARD.SELECT_V3_ETH_MARKET, { market: 'Lido' })}
>
<TokenIcon sx={{ mr: 2 }} symbol="ldo" />

Expand Down
7 changes: 6 additions & 1 deletion src/modules/markets/MarketsTopPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { StyledTxModalToggleButton } from 'src/components/StyledToggleButton';
import { StyledTxModalToggleGroup } from 'src/components/StyledToggleButtonGroup';
import { useRootStore } from 'src/store/root';
import { CustomMarket } from 'src/utils/marketsAndNetworksConfig';
import { MARKETS } from 'src/utils/mixPanelEvents';

import { FormattedNumber } from '../../components/primitives/FormattedNumber';
import { TopInfoPanel } from '../../components/TopInfoPanel/TopInfoPanel';
Expand All @@ -21,6 +22,7 @@ export const MarketsTopPanel = () => {
store.currentMarket,
store.setCurrentMarket,
]);
const trackEvent = useRootStore((store) => store.trackEvent);

const [currentNetworkConfig] = useRootStore((state) => [
state.currentNetworkConfig,
Expand Down Expand Up @@ -110,6 +112,9 @@ export const MarketsTopPanel = () => {
currentMarket === ('fork_proto_mainnet_v3' as string)) ||
(!currentNetworkConfig.isFork && currentMarket === 'proto_mainnet_v3')
}
onClick={() =>
trackEvent(MARKETS.SELECT_V3_ETH_MARKET, { market: 'Ethereum Main' })
}
>
<TokenIcon sx={{ mr: 2 }} symbol="eth-round" />

Expand Down Expand Up @@ -142,7 +147,7 @@ export const MarketsTopPanel = () => {
(!currentNetworkConfig.isFork && currentMarket === 'proto_lido_v3')
}
value={currentNetworkConfig.isFork ? 'fork_proto_lido_v3' : 'proto_lido_v3'}
// Todo tracking?
onClick={() => trackEvent(MARKETS.SELECT_V3_ETH_MARKET, { market: 'Lido' })}
>
<TokenIcon sx={{ mr: 2 }} symbol="ldo" />

Expand Down
2 changes: 2 additions & 0 deletions src/utils/mixPanelEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ export const DASHBOARD = {
NOTIFY_DASHBOARD: 'Notify dashboard', // done
TILE_VISBILITY: 'Tile visibility',
SHOW_ASSETS_0_BALANCE: 'Show assets with zero balance dashboard', // done
SELECT_V3_ETH_MARKET: 'Clicks a V3 ETH market from dashboard', // done
};

export const MARKETS = {
DETAILS_NAVIGATION: 'View reserve details markets',
SEARCH_ASSET: 'Search asset markets', // how to handle
SORT: 'Sort',
SELECT_V3_ETH_MARKET: 'Clicks a V3 ETH market from markets', // done
};

export const RESERVE_DETAILS = {
Expand Down

3 comments on commit 758414b

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit was deployed on ipfs

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit was deployed on ipfs

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit was deployed on ipfs

Please sign in to comment.