Skip to content

Commit

Permalink
Do naming refactor
Browse files Browse the repository at this point in the history
From Offchain voying to Gasless voting and
from executive committee to execution multisig
  • Loading branch information
selankon committed Oct 31, 2023
1 parent 11d6510 commit b5219e1
Show file tree
Hide file tree
Showing 23 changed files with 161 additions and 157 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@tiptap/pm": "^2.0.3",
"@tiptap/react": "^2.0.3",
"@tiptap/starter-kit": "^2.0.3",
"@vocdoni/gasless-voting": "./vocdoni-gasless-voting-v0.0.1-rc3.tgz",
"@vocdoni/gasless-voting": "./vocdoni-gasless-voting-v0.0.1-rc4.tgz",
"@vocdoni/gasless-voting-ethers": "./vocdoni-gasless-voting-ethers-v0.0.1-rc1.tgz",
"@vocdoni/react-providers": "^0.1.10",
"@vocdoni/sdk": "^0.3.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type ValueOfControllerRenderProps<T> = T extends ControllerRenderProps<any, any>
* It has a logic to show a `Comming Soon` label when the chainId is not compatible with vocdoni census3 service.
* @constructor
*/
const OffChainSelector = ({
const GaslessSelector = ({
onChange,
value,
}: {
Expand All @@ -34,22 +34,22 @@ const OffChainSelector = ({
<div className="flex flex-row-reverse gap-1">
<Tag
colorScheme="warning"
label={t('createDAO.step3.votingType.offChain.soon')}
label={t('createDAO.step3.votingType.gasless.soon')}
/>
</div>
)}
<CheckboxListItem
label={t('createDAO.step3.votingType.offChain.title')}
helptext={t('createDAO.step3.votingType.offChain.subtitle')}
label={t('createDAO.step3.votingType.gasless.title')}
helptext={t('createDAO.step3.votingType.gasless.subtitle')}
onClick={() => {
onChange('offChain');
onChange('gasless');
}}
multiSelect={false}
disabled={!isSupported}
{...(value === 'offChain' ? {type: 'active'} : {})}
{...(value === 'gasless' ? {type: 'active'} : {})}
/>
</>
);
};

export default OffChainSelector;
export default GaslessSelector;
2 changes: 1 addition & 1 deletion src/containers/configureCommunity/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ const ConfigureCommunity: React.FC<ConfigureCommunityProps> = ({
</FormItem>

{/* Early execution */}
{votingType !== 'offChain' && (
{votingType !== 'gasless' && (
<>
<FormItem>
<Label
Expand Down
4 changes: 2 additions & 2 deletions src/containers/defineCommittee/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ const DefineCommittee: React.FC = () => {
{/*Executive committee members*/}
<FormItem>
<Label
label={t('labels.executiveCommitteeMembers')}
helpText={t('createDAO.step5.executiveCommitteeMembersSubtitle')}
label={t('labels.executionMultisigMembers')}
helpText={t('createDAO.step5.executionMultisigMembersSubtitle')}
/>
<AddCommitteeMembers />
</FormItem>
Expand Down
4 changes: 2 additions & 2 deletions src/containers/editSettings/majorityVoting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ export const EditMvSettings: React.FC<EditMvSettingsProps> = ({daoDetails}) => {
const setCurrentGasless = useCallback(() => {
if (!isGasless) return;

setValue('votingType', 'offchain');
setValue('votingType', 'gasless');
setValue('executionExpirationMinutes', approvalMinutes);
setValue('executionExpirationHours', approvalHours);
setValue('executionExpirationDays', approvalDays);
Expand Down Expand Up @@ -518,7 +518,7 @@ export const EditMvSettings: React.FC<EditMvSettingsProps> = ({daoDetails}) => {
{/*<AccordionItem*/}
{/* type="action-builder"*/}
{/* name="committee"*/}
{/* methodName={t('createDAO.review.executiveCommittee')}*/}
{/* methodName={t('createDAO.review.executionMultisig')}*/}
{/* alertLabel={*/}
{/* isGaslessChanged ? t('settings.newSettings') : undefined*/}
{/* }*/}
Expand Down
2 changes: 1 addition & 1 deletion src/containers/goLive/committee.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const Committee = () => {
}}
render={({field: {onChange, value}}) => (
<DescriptionListContainer
title={t('createDAO.review.executiveCommittee')}
title={t('createDAO.review.executionMultisig')}
onEditClick={() => setStep(6)}
checkBoxErrorMessage={t('createDAO.review.acceptContent')}
checkedState={
Expand Down
2 changes: 1 addition & 1 deletion src/containers/goLive/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const GoLive: React.FC = () => {
<DaoMetadata />
<Community />
<Governance />
{votingType === 'offChain' && <Committee />}
{votingType === 'gasless' && <Committee />}
<AlertCard title={t('createDAO.review.daoUpdates')} />
</Container>
);
Expand Down
2 changes: 1 addition & 1 deletion src/containers/settings/gaslessVoting/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const GaslessVotingSettings: React.FC<IPluginSettings> = ({daoDetails}) => {
return (
<>
{/* COMMUNITY SECTION */}
<SettingsCard title={t('navLinks.executiveCommittee')}>
<SettingsCard title={t('navLinks.executionMultisig')}>
<DescriptionPair>
<Term>{t('labels.review.members')}</Term>
<Definition>
Expand Down
8 changes: 4 additions & 4 deletions src/containers/setupCommunity/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,13 @@ const SetupCommunityForm: React.FC = () => {
/>

<CheckboxListItem
label={t('createDAO.step3.votingType.offChain.title')}
helptext={t('createDAO.step3.votingType.offChain.subtitle')}
label={t('createDAO.step3.votingType.gasless.title')}
helptext={t('createDAO.step3.votingType.gasless.subtitle')}
onClick={() => {
onChange('offChain');
onChange('gasless');
}}
multiSelect={false}
{...(value === 'offChain' ? {type: 'active'} : {})}
{...(value === 'gasless' ? {type: 'active'} : {})}
/>
</>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import {useTranslation} from 'react-i18next';

import {useNetwork} from 'context/network';
import {OffchainProposalStepId} from '../../context/createOffchainProposal';
import {OffchainProposalStepId} from '../../context/createGaslessProposal';
import {StepperLabels} from '../../components/StepperProgress';
import {GenericKeyEnum, StepStatus} from '../../hooks/useFunctionStepper';
import StepperModal, {
Expand All @@ -15,34 +15,34 @@ export type OffChainProposalModalProps<X extends OffchainProposalStepId> = Omit<
'stepLabels' | 'buttonLabels'
>;

const OffchainProposalModal = <X extends OffchainProposalStepId>(
const GaslessProposalModal = <X extends OffchainProposalStepId>(
props: OffChainProposalModalProps<X>
): JSX.Element => {
const {t} = useTranslation();
const {network} = useNetwork();

const btnLabel: BtnLabels = {
[StepStatus.WAITING]: t('offChainProposalCreation.publishProposal'),
[StepStatus.WAITING]: t('gaslessProposalCreation.publishProposal'),
[StepStatus.LOADING]: undefined,
[StepStatus.SUCCESS]: t('offChainProposalCreation.gotoProposal'),
[StepStatus.ERROR]: t('offChainProposalCreation.tryAgain'),
[StepStatus.SUCCESS]: t('gaslessProposalCreation.gotoProposal'),
[StepStatus.ERROR]: t('gaslessProposalCreation.tryAgain'),
};

const labels: StepperLabels<OffchainProposalStepId> = {
REGISTER_VOCDONI_ACCOUNT: {
title: t('offChainProposalCreation.createVocdoniAccount.title'),
helper: t('offChainProposalCreation.createVocdoniAccount.helper'),
title: t('gaslessProposalCreation.createVocdoniAccount.title'),
helper: t('gaslessProposalCreation.createVocdoniAccount.helper'),
},
CREATE_VOCDONI_ELECTION: {
title: t('offChainProposalCreation.createVocdoniElection.title'),
helper: t('offChainProposalCreation.createVocdoniElection.helper'),
title: t('gaslessProposalCreation.createVocdoniElection.title'),
helper: t('gaslessProposalCreation.createVocdoniElection.helper'),
},
CREATE_ONCHAIN_PROPOSAL: {
title: t('offChainProposalCreation.createOnChainProposal.title'),
helper: t('offChainProposalCreation.createOnChainProposal.helper'),
title: t('gaslessProposalCreation.createOnChainProposal.title'),
helper: t('gaslessProposalCreation.createOnChainProposal.helper'),
},
PROPOSAL_IS_READY: {
title: t('offChainProposalCreation.proposalReady.title'),
title: t('gaslessProposalCreation.proposalReady.title'),
},
};

Expand All @@ -51,4 +51,4 @@ const OffchainProposalModal = <X extends OffchainProposalStepId>(
);
};

export default OffchainProposalModal;
export default GaslessProposalModal;
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import React, {useCallback} from 'react';
import {useTranslation} from 'react-i18next';
import StepperModal, {BtnLabels} from '../../context/stepperModal';
import {StepStatus} from '../../hooks/useFunctionStepper';
import useOffchainVoting, {
OffchainVotingStepId,
} from '../../context/useOffchainVoting';
import useGaslessVoting, {
GaslessVotingStepId,
} from '../../context/useGaslessVoting';
import {StepperLabels} from '../../components/StepperProgress';
import {VoteProposalParams, VoteValues} from '@aragon/sdk-client';
import {useWallet} from '../../hooks/useWallet';
import {ProposalId} from '../../utils/types';
const OffchainVotingModal = ({
const GaslessVotingModal = ({
vote,
showVoteModal,
setShowVoteModal,
Expand All @@ -33,30 +33,30 @@ JSX.Element => {

const {
vote: submitOffchainVote,
steps: offchainSteps,
globalState: offchainGlobalState,
} = useOffchainVoting();
steps: gaslessSteps,
globalState: gaslessGlobalState,
} = useGaslessVoting();

const btnLabel: BtnLabels = {
[StepStatus.WAITING]: t('offChainVoting.stepperBtn.confirmVote'),
[StepStatus.WAITING]: t('gaslessVoting.stepperBtn.confirmVote'),
[StepStatus.LOADING]: undefined,
[StepStatus.SUCCESS]: t('offChainVoting.stepperBtn.seeYourVote'),
[StepStatus.ERROR]: t('offChainVoting.stepperBtn.tryAgain'),
[StepStatus.SUCCESS]: t('gaslessVoting.stepperBtn.seeYourVote'),
[StepStatus.ERROR]: t('gaslessVoting.stepperBtn.tryAgain'),
};

const labels: StepperLabels<OffchainVotingStepId> = {
[OffchainVotingStepId.CREATE_VOTE_ID]: {
title: t('offChainVoting.createVoteId.title'),
helper: t('offChainVoting.createVoteId.helper'),
const labels: StepperLabels<GaslessVotingStepId> = {
[GaslessVotingStepId.CREATE_VOTE_ID]: {
title: t('gaslessVoting.createVoteId.title'),
helper: t('gaslessVoting.createVoteId.helper'),
},
[OffchainVotingStepId.PUBLISH_VOTE]: {
title: t('offChainVoting.publishVote.title'),
helper: t('offChainVoting.publishVote.helper'),
[GaslessVotingStepId.PUBLISH_VOTE]: {
title: t('gaslessVoting.publishVote.title'),
helper: t('gaslessVoting.publishVote.helper'),
},
};

const handleCloseVoteModal = useCallback(() => {
switch (offchainGlobalState) {
switch (gaslessGlobalState) {
case StepStatus.LOADING:
break;
case StepStatus.SUCCESS:
Expand All @@ -66,10 +66,10 @@ JSX.Element => {
setShowVoteModal(false);
}
}
}, [offchainGlobalState, setShowVoteModal]);
}, [gaslessGlobalState, setShowVoteModal]);

const handleVoteExecution = useCallback(async () => {
if (offchainGlobalState === StepStatus.SUCCESS) {
if (gaslessGlobalState === StepStatus.SUCCESS) {
handleCloseVoteModal();
return;
}
Expand Down Expand Up @@ -97,7 +97,7 @@ JSX.Element => {
}, [
handleCloseVoteModal,
isConnected,
offchainGlobalState,
gaslessGlobalState,
onVoteSubmitted,
setVoteSubmitted,
submitOffchainVote,
Expand All @@ -108,20 +108,20 @@ JSX.Element => {
<StepperModal
buttonLabels={btnLabel}
stepLabels={labels}
steps={offchainSteps}
globalState={offchainGlobalState}
steps={gaslessSteps}
globalState={gaslessGlobalState}
isOpen={showVoteModal}
onClose={handleCloseVoteModal}
callback={handleVoteExecution}
closeOnDrag={offchainGlobalState !== StepStatus.LOADING}
closeOnDrag={gaslessGlobalState !== StepStatus.LOADING}
// todo(kon): implementent free cost gas component
maxFee={BigInt(0)}
averageFee={BigInt(0)}
gasEstimationError={undefined}
tokenPrice={0}
title={t('offChainVoting.title')}
title={t('gaslessVoting.title')}
/>
);
};

export default OffchainVotingModal;
export default GaslessVotingModal;
9 changes: 4 additions & 5 deletions src/containers/votingTerminal/committeeVotingTerminal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import styled from 'styled-components';
import {AccordionItem} from '../../components/accordionMethod';
import {Accordion} from '@radix-ui/react-accordion';
import {GaslessVotingProposal} from '@vocdoni/gasless-voting';
import {useGaslessCommiteVotes} from '../../context/useOffchainVoting';
import {ProposalId} from '../../utils/types';
import {useGaslessCommiteVotes} from '../../context/useGaslessVoting';
import {useWallet} from '../../hooks/useWallet';
import {useProposalTransactionContext} from '../../context/proposalTransaction';
import {VoteValues} from '@aragon/sdk-client';
Expand Down Expand Up @@ -77,7 +76,7 @@ export const CommitteeVotingTerminal = ({
if (!proposal) return;

const endDate = `${format(
proposal.parameters.expirationDate,
proposal.parameters.expirationDate!,
KNOWN_FORMATS.proposals
)} ${getFormattedUtcOffset()}`;

Expand Down Expand Up @@ -196,7 +195,7 @@ export const CommitteeVotingTerminal = ({
// alert message, only shown when not eligible to vote
const alertMessage = useMemo(() => {
if (!isApprovalPeriod) {
return t('offchainVotingTerminal.alerts.cannotApproveYet');
return t('gaslessVotingTerminal.alerts.cannotApproveYet');
} else if (
proposal &&
isApprovalPeriod && // active proposal
Expand All @@ -205,7 +204,7 @@ export const CommitteeVotingTerminal = ({
!canApprove && // cannot vote
!approved // Already voted
) {
return t('offchainVotingTerminal.alerts.notInCommittee');
return t('gaslessVotingTerminal.alerts.notInCommittee');
}
}, [canApprove, isApprovalPeriod, isOnWrongNetwork, proposal, t, address]);

Expand Down
8 changes: 4 additions & 4 deletions src/context/createDao.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -339,11 +339,11 @@ const CreateDaoProvider: React.FC<{children: ReactNode}> = ({children}) => {
case 'token': {
const [votingSettings, network] = getVoteSettings();

if (votingType === 'offChain') {
if (votingType === 'gasless') {
const params = getOffchainPluginInstallParams(votingSettings);
const offChainPlugin =
const gaslessPlugin =
GaslessVotingClient.encoding.getPluginInstallItem(params, network);
plugins.push(offChainPlugin);
plugins.push(gaslessPlugin);
break;
}
const tokenVotingPlugin =
Expand Down Expand Up @@ -495,7 +495,7 @@ const CreateDaoProvider: React.FC<{children: ReactNode}> = ({children}) => {
},
}),
]).then(async () => {
if (votingType === 'offChain' && membership === 'token') {
if (votingType === 'gasless' && membership === 'token') {
await createToken(step.pluginAddresses[0]);
}
});
Expand Down
Loading

0 comments on commit b5219e1

Please sign in to comment.