Skip to content

Commit

Permalink
Merge pull request #1840 from decentdao/smol-update
Browse files Browse the repository at this point in the history
Smol update
  • Loading branch information
adamgall authored May 21, 2024
2 parents a82f33d + 20e9f08 commit beb3e96
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 82 deletions.
2 changes: 1 addition & 1 deletion src/hooks/utils/useUpdateTimer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const useUpdateTimer = (safeAddress?: string | null) => {

// Clear intervals based on the safeAddress value and testing environment
useEffect(() => {
if (!safeAddress || import.meta.env.VITE_APP_TESTING_ENVIRONMENT) {
if (!safeAddress) {
timers.current.forEach(timer => clearInterval(timer));
}
}, [safeAddress]);
Expand Down
72 changes: 33 additions & 39 deletions src/pages/404.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { AbsoluteCenter, Button, ChakraProvider, Icon, Text, VStack } from '@chakra-ui/react';
import { AbsoluteCenter, Button, Icon, Text, VStack } from '@chakra-ui/react';
import { DecentLogo } from '@decent-org/fractal-ui';
import { I18nextProvider, useTranslation } from 'react-i18next';
import { useTranslation } from 'react-i18next';
import { useNavigate } from 'react-router-dom';
import { theme } from '../assets/theme';
import { BASE_ROUTES } from '../constants/routes';
import i18n from '../i18n';

export default function FourOhFourPage() {
const { t } = useTranslation('common');
Expand All @@ -13,40 +11,36 @@ export default function FourOhFourPage() {
navigate(BASE_ROUTES.landing);
};
return (
<ChakraProvider theme={theme}>
<I18nextProvider i18n={i18n}>
<AbsoluteCenter>
<VStack>
<Icon
as={DecentLogo}
width={20}
height={20}
/>
<Text
paddingTop="3.25rem"
data-testid="404-pageCode"
textStyle="display-3xl"
color="neutral-6"
>
404
</Text>
<Text
data-testid="404-pageTitle"
color="neutral-7"
marginTop="0.5rem"
paddingBottom="3.25rem"
>
{t('404Title')}
</Text>
<Button
onClick={home}
data-testid={'404-linkHome'}
>
{t('404Button')}
</Button>
</VStack>
</AbsoluteCenter>
</I18nextProvider>
</ChakraProvider>
<AbsoluteCenter>
<VStack>
<Icon
as={DecentLogo}
width={20}
height={20}
/>
<Text
paddingTop="3.25rem"
data-testid="404-pageCode"
textStyle="display-3xl"
color="neutral-6"
>
404
</Text>
<Text
data-testid="404-pageTitle"
color="neutral-7"
marginTop="0.5rem"
paddingBottom="3.25rem"
>
{t('404Title')}
</Text>
<Button
onClick={home}
data-testid={'404-linkHome'}
>
{t('404Button')}
</Button>
</VStack>
</AbsoluteCenter>
);
}
38 changes: 3 additions & 35 deletions src/pages/DAOController.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { ChakraProvider, extendTheme } from '@chakra-ui/react';
import { theme } from '@decent-org/fractal-ui';
import { useEffect, useMemo } from 'react';
import { useEffect } from 'react';
import { Outlet } from 'react-router-dom';
import useDAOController from '../hooks/DAO/useDAOController';
import useDAOMetadata from '../hooks/DAO/useDAOMetadata';
import { useFractal } from '../providers/App/AppProvider';
import LoadingProblem from './LoadingProblem';

Expand All @@ -12,29 +9,6 @@ export default function DAOController() {
const {
node: { daoName },
} = useFractal();
const daoMetadata = useDAOMetadata();
const activeTheme = useMemo(() => {
if (daoMetadata && daoMetadata.bodyBackground) {
return extendTheme({
...theme,
styles: {
...theme.styles,
global: {
...theme.styles.global,
html: {
...theme.styles.global.html,
background: daoMetadata.bodyBackground,
},
body: {
...theme.styles.global.body,
background: 'none',
},
},
},
});
}
return theme;
}, [daoMetadata]);

useEffect(() => {
if (daoName) {
Expand All @@ -48,14 +22,8 @@ export default function DAOController() {

let display;

if (import.meta.env.VITE_APP_TESTING_ENVIRONMENT) {
display = (
<ChakraProvider theme={activeTheme}>
<Outlet />
</ChakraProvider>
);
// the order of the if blocks of these next three error states matters
} else if (invalidQuery) {
// the order of the if blocks of these next three error states matters
if (invalidQuery) {
display = <LoadingProblem type="badQueryParam" />;
} else if (wrongNetwork) {
display = <LoadingProblem type="wrongNetwork" />;
Expand Down
9 changes: 2 additions & 7 deletions src/providers/NetworkConfig/web3-modal.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,12 @@ import { createWeb3Modal } from '@web3modal/wagmi/react';
import { defaultWagmiConfig } from '@web3modal/wagmi/react/config';
import { HttpTransport } from 'viem';
import { http } from 'wagmi';
import { Chain, hardhat } from 'wagmi/chains';
import { Chain } from 'wagmi/chains';
import { NetworkConfig } from '../../types/network';
import { supportedNetworks } from './NetworkConfigProvider';

const supportedWagmiChains = supportedNetworks.map(network => network.chain);

// allows connection to localhost only in development mode.
if (import.meta.env.VITE_APP_TESTING_ENVIRONMENT) {
supportedWagmiChains.unshift(hardhat);
}

export const walletConnectProjectId = import.meta.env.VITE_APP_WALLET_CONNECT_PROJECT_ID;
export const queryClient = new QueryClient();

Expand All @@ -22,7 +17,7 @@ const wagmiMetadata = {
description:
'Are you outgrowing your Multisig? Decent extends Safe treasuries into on-chain hierarchies of permissions, token flows, and governance.',
url: import.meta.env.VITE_APP_SITE_URL,
icons: [`${import.meta.env.VITE_APP_SITE_URL}/favicon.ico`],
icons: [`${import.meta.env.VITE_APP_SITE_URL}/favicon-96x96.png`],
};

const transportsReducer = (accumulator: Record<string, HttpTransport>, network: NetworkConfig) => {
Expand Down

0 comments on commit beb3e96

Please sign in to comment.