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

Dc/upgrade fixed #1356

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions app/create/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { useTranslation } from 'react-i18next';
import { toast } from 'react-toastify';
import DaoCreator from '../../src/components/DaoCreator';
import { DAOCreateMode } from '../../src/components/DaoCreator/formComponents/EstablishEssentials';
import ClientOnly from '../../src/components/ui/utils/ClientOnly';
import { BASE_ROUTES, DAO_ROUTES } from '../../src/constants/routes';
import { useAccountFavorites } from '../../src/hooks/DAO/loaders/useFavorites';
import useDeployDAO from '../../src/hooks/DAO/useDeployDAO';
Expand Down Expand Up @@ -55,12 +54,10 @@ export default function DaoCreatePage() {
};

return (
<ClientOnly>
<DaoCreator
pending={pending || redirectPending}
deployDAO={deployDAO}
mode={DAOCreateMode.ROOTDAO}
/>
</ClientOnly>
<DaoCreator
pending={pending || redirectPending}
deployDAO={deployDAO}
mode={DAOCreateMode.ROOTDAO}
/>
);
}
5 changes: 2 additions & 3 deletions app/daos/[daoAddress]/hierarchy/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { useTranslation } from 'react-i18next';
import { DaoNode } from '../../../../src/components/pages/DaoHierarchy/DaoNode';
import { BarLoader } from '../../../../src/components/ui/loaders/BarLoader';
import PageHeader from '../../../../src/components/ui/page/Header/PageHeader';
import ClientOnly from '../../../../src/components/ui/utils/ClientOnly';
import { HEADER_HEIGHT } from '../../../../src/constants/common';
import { useFractal } from '../../../../src/providers/App/AppProvider';

Expand All @@ -24,7 +23,7 @@ export default function HierarchyPage() {
}

return (
<ClientOnly>
<>
<PageHeader
title={t('headerTitle', {
daoName,
Expand All @@ -41,6 +40,6 @@ export default function HierarchyPage() {
daoAddress={nodeHierarchy.parentAddress || daoAddress}
depth={0}
/>
</ClientOnly>
</>
);
}
7 changes: 3 additions & 4 deletions app/daos/[daoAddress]/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
'use client';

import { Button, Center, Text, VStack, ChakraProvider, extendTheme } from '@chakra-ui/react';
import { Button, Center, Text, VStack, ChakraProvider, extendTheme, Box } from '@chakra-ui/react';
import { theme } from '@decent-org/fractal-ui';
import Script from 'next/script';
import { ReactNode, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { useChainId, useClient } from 'wagmi';
import ClientOnly from '../../../src/components/ui/utils/ClientOnly';
import { APP_NAME } from '../../../src/constants/common';
import useDAOController from '../../../src/hooks/DAO/useDAOController';
import useDAOMetadata from '../../../src/hooks/DAO/useDAOMetadata';
Expand Down Expand Up @@ -125,7 +124,7 @@ export default function DaoPageLayout({
}

return (
<ClientOnly>
<Box>
<title>{node?.daoName ? `${node.daoName} | ${APP_NAME}` : APP_NAME}</title>
{node && node.daoAddress === '0x167bE4073f52aD2Aa0D6d6FeddF0F1f79a82B98e' && (
<Script
Expand All @@ -143,6 +142,6 @@ export default function DaoPageLayout({
</Script>
)}
{display}
</ClientOnly>
</Box>
);
}
15 changes: 6 additions & 9 deletions app/daos/[daoAddress]/new/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { useRouter } from 'next/navigation';
import { useState } from 'react';
import DaoCreator from '../../../../src/components/DaoCreator';
import { DAOCreateMode } from '../../../../src/components/DaoCreator/formComponents/EstablishEssentials';
import ClientOnly from '../../../../src/components/ui/utils/ClientOnly';
import { DAO_ROUTES } from '../../../../src/constants/routes';
import { useCreateSubDAOProposal } from '../../../../src/hooks/DAO/useCreateSubDAOProposal';
import { useFractal } from '../../../../src/providers/App/AppProvider';
Expand All @@ -30,13 +29,11 @@ export default function SubDaoCreate() {
};

return (
<ClientOnly>
<DaoCreator
pending={pendingCreateTx || redirectPending}
deployDAO={proposeSubDAO}
isSubDAO={true}
mode={DAOCreateMode.SUBDAO}
/>
</ClientOnly>
<DaoCreator
pending={pendingCreateTx || redirectPending}
deployDAO={proposeSubDAO}
isSubDAO={true}
mode={DAOCreateMode.SUBDAO}
/>
);
}
6 changes: 3 additions & 3 deletions app/daos/[daoAddress]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use client';

import { Box } from '@chakra-ui/react';
import { Activities } from '../../../src/components/pages/DaoDashboard/Activities';
import { ERCO20Claim } from '../../../src/components/pages/DaoDashboard/ERC20Claim';
import { Info } from '../../../src/components/pages/DaoDashboard/Info';
import InfoHeader from '../../../src/components/pages/DaoDashboard/Info/InfoHeader';
import ClientOnly from '../../../src/components/ui/utils/ClientOnly';
import useDAOMetadata from '../../../src/hooks/DAO/useDAOMetadata';

export default function DaoDashboardPage() {
Expand All @@ -13,11 +13,11 @@ export default function DaoDashboardPage() {
return (
<>
<InfoHeader />
<ClientOnly mt={!!daoMetadata ? 40 : 12}>
<Box mt={!!daoMetadata ? 40 : 12}>
<Info />
<ERCO20Claim />
<Activities />
</ClientOnly>
</Box>
</>
);
}
223 changes: 110 additions & 113 deletions app/daos/[daoAddress]/proposal-templates/new/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import ProposalTemplateTransactionsForm from '../../../../../src/components/Crea
import { DEFAULT_PROPOSAL_TEMPLATE } from '../../../../../src/components/CreateProposalTemplate/constants';
import { CustomNonceInput } from '../../../../../src/components/ui/forms/CustomNonceInput';
import PageHeader from '../../../../../src/components/ui/page/Header/PageHeader';
import ClientOnly from '../../../../../src/components/ui/utils/ClientOnly';
import { BACKGROUND_SEMI_TRANSPARENT } from '../../../../../src/constants/common';
import { BASE_ROUTES, DAO_ROUTES } from '../../../../../src/constants/routes';
import { logError } from '../../../../../src/helpers/errorLogging';
Expand Down Expand Up @@ -96,123 +95,121 @@ export default function CreateProposalTemplatePage() {
}, [defaultProposalTemplatesHash, defaultProposalTemplateIndex, ipfsClient]);

return (
<ClientOnly>
<Formik<CreateProposalTemplateForm>
validationSchema={createProposalTemplateValidation}
initialValues={initialProposalTemplate}
enableReinitialize
onSubmit={async values => {
if (canUserCreateProposal) {
const proposalData = await prepareProposalTemplateProposal(values);
if (proposalData) {
submitProposal({
proposalData,
nonce: values?.nonce,
pendingToastMessage: t('proposalCreatePendingToastMessage', { ns: 'proposal' }),
successToastMessage: t('proposalCreateSuccessToastMessage', { ns: 'proposal' }),
failedToastMessage: t('proposalCreateFailureToastMessage', { ns: 'proposal' }),
successCallback,
});
}
<Formik<CreateProposalTemplateForm>
validationSchema={createProposalTemplateValidation}
initialValues={initialProposalTemplate}
enableReinitialize
onSubmit={async values => {
if (canUserCreateProposal) {
const proposalData = await prepareProposalTemplateProposal(values);
if (proposalData) {
submitProposal({
proposalData,
nonce: values?.nonce,
pendingToastMessage: t('proposalCreatePendingToastMessage', { ns: 'proposal' }),
successToastMessage: t('proposalCreateSuccessToastMessage', { ns: 'proposal' }),
failedToastMessage: t('proposalCreateFailureToastMessage', { ns: 'proposal' }),
successCallback,
});
}
}}
>
{(formikProps: FormikProps<CreateProposalTemplateForm>) => {
const { handleSubmit } = formikProps;
}
}}
>
{(formikProps: FormikProps<CreateProposalTemplateForm>) => {
const { handleSubmit } = formikProps;

return (
<form onSubmit={handleSubmit}>
<Box>
<PageHeader
title={t('createProposalTemplate')}
breadcrumbs={[
{
terminus: t('proposalTemplates', { ns: 'breadcrumbs' }),
path: DAO_ROUTES.proposalTemplates.relative(daoAddress),
},
{
terminus: t('proposalTemplateNew', { ns: 'breadcrumbs' }),
path: '',
},
]}
ButtonIcon={Trash}
buttonVariant="secondary"
buttonClick={() =>
push(
daoAddress
? DAO_ROUTES.proposalTemplates.relative(daoAddress)
: BASE_ROUTES.landing
)
}
isButtonDisabled={pendingCreateTx}
/>
<Grid
gap={4}
templateColumns={{ base: '1fr', lg: '2fr 1fr' }}
gridTemplateRows={{ base: '1fr', lg: '5.1em 1fr' }}
templateAreas={{
base: templateAreaSingleCol,
lg: templateAreaTwoCol,
}}
>
<GridItem area="content">
<Flex
flexDirection="column"
align="left"
return (
<form onSubmit={handleSubmit}>
<Box>
<PageHeader
title={t('createProposalTemplate')}
breadcrumbs={[
{
terminus: t('proposalTemplates', { ns: 'breadcrumbs' }),
path: DAO_ROUTES.proposalTemplates.relative(daoAddress),
},
{
terminus: t('proposalTemplateNew', { ns: 'breadcrumbs' }),
path: '',
},
]}
ButtonIcon={Trash}
buttonVariant="secondary"
buttonClick={() =>
push(
daoAddress
? DAO_ROUTES.proposalTemplates.relative(daoAddress)
: BASE_ROUTES.landing
)
}
isButtonDisabled={pendingCreateTx}
/>
<Grid
gap={4}
templateColumns={{ base: '1fr', lg: '2fr 1fr' }}
gridTemplateRows={{ base: '1fr', lg: '5.1em 1fr' }}
templateAreas={{
base: templateAreaSingleCol,
lg: templateAreaTwoCol,
}}
>
<GridItem area="content">
<Flex
flexDirection="column"
align="left"
>
<Box
marginBottom="2rem"
rounded="lg"
p="1rem"
bg={BACKGROUND_SEMI_TRANSPARENT}
>
<Box
marginBottom="2rem"
rounded="lg"
p="1rem"
bg={BACKGROUND_SEMI_TRANSPARENT}
>
{formState === CreateProposalTemplateFormState.METADATA_FORM ? (
<ProposalTemplateMetadata
{formState === CreateProposalTemplateFormState.METADATA_FORM ? (
<ProposalTemplateMetadata
setFormState={setFormState}
{...formikProps}
/>
) : (
<>
<Flex
alignItems="center"
justifyContent="space-between"
>
<Text
textStyle="text-xl-mono-medium"
mb={4}
>
{formikProps.values.proposalTemplateMetadata.title}
</Text>
<CustomNonceInput
nonce={formikProps.values.nonce}
onChange={newNonce => formikProps.setFieldValue('nonce', newNonce)}
align="end"
/>
</Flex>
<ProposalTemplateTransactionsForm
setFormState={setFormState}
canUserCreateProposal={canUserCreateProposal}
pendingTransaction={pendingCreateTx}
safeNonce={safe?.nonce}
{...formikProps}
/>
) : (
<>
<Flex
alignItems="center"
justifyContent="space-between"
>
<Text
textStyle="text-xl-mono-medium"
mb={4}
>
{formikProps.values.proposalTemplateMetadata.title}
</Text>
<CustomNonceInput
nonce={formikProps.values.nonce}
onChange={newNonce => formikProps.setFieldValue('nonce', newNonce)}
align="end"
/>
</Flex>
<ProposalTemplateTransactionsForm
setFormState={setFormState}
canUserCreateProposal={canUserCreateProposal}
pendingTransaction={pendingCreateTx}
safeNonce={safe?.nonce}
{...formikProps}
/>
</>
)}
</Box>
</Flex>
</GridItem>
<GridItem
area="details"
w="100%"
>
<ProposalTemplateDetails {...formikProps} />
</GridItem>
</Grid>
</Box>
</form>
);
}}
</Formik>
</ClientOnly>
</>
)}
</Box>
</Flex>
</GridItem>
<GridItem
area="details"
w="100%"
>
<ProposalTemplateDetails {...formikProps} />
</GridItem>
</Grid>
</Box>
</form>
);
}}
</Formik>
);
}
Loading
Loading