Skip to content

Commit

Permalink
add ability to modify council without existent
Browse files Browse the repository at this point in the history
  • Loading branch information
vladjdk committed Nov 23, 2023
1 parent 74cb3d0 commit 786081b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { ResponsiveView } from 'lib/ui/ResponsiveView';
import { VStack } from 'lib/ui/Stack';
import { MobileCreateProposalHeader } from './MobileCreateProposalHeader';
import { PrimarySelect } from 'lib/ui/inputs/PrimarySelect';
import { without } from 'lodash';
import { DAO } from 'types';
import { Text } from 'lib/ui/Text';
import { useMyVotingPower } from 'dao/components/MyVotingPowerProvider';
Expand Down Expand Up @@ -53,7 +52,7 @@ export const proposalDescription: Record<ProposalType, ReactNode> = {
metadata: 'Update the metadata of your DAO.',
undelegate: 'Undelegate LUNA from a validator that you have delegated to.',
redelegate: 'Redelegate LUNA from your current validator to a new validator.',
council: '',
council: 'AAAA1',
mintNft:
'Mint a new DAO NFT to the specified addresses. This proposal will only work if the minter on the NFT contract is the DAO treasury address.',
minWeightForRewards: 'Update the minimum weight required to receive rewards.',
Expand Down Expand Up @@ -114,7 +113,7 @@ const getProposalOptions = ({ type, council }: DAO, proposalVotingType: Proposal
}
}

return without(options, 'council');
return options;
};

export const SelectProposalType = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import { toUpdateCouncilMsg } from './toUpdateCouncilMsg';
import { QuorumInput } from 'pages/create-dao/gov-config/QuorumInput';
import { ThresholdInput } from 'pages/create-dao/gov-config/ThresholdInput';
import { terraAddressRegex } from 'chain/utils/validators';
import { assertDefined } from 'lib/shared/utils/assertDefined';
import { AddButton } from 'lib/ui/buttons/AddButton';
import { DeleteButton } from 'lib/ui/buttons/DeleteButton';
import { Text } from 'lib/ui/Text';

interface CouncilFormSchema {
members: CouncilMember[];
Expand Down Expand Up @@ -45,7 +45,7 @@ const councilFormSchema: z.ZodType<CouncilFormSchema> = z.object({

export const CouncilForm = () => {
const dao = useCurrentDao();
const council = assertDefined(dao.dao_council);
const council = dao.dao_council;

const {
register,
Expand All @@ -56,10 +56,10 @@ export const CouncilForm = () => {
mode: 'all',
resolver: zodResolver(councilFormSchema),
defaultValues: {
members: council.members.map((address) => ({ address })),
allowedProposalTypes: council.allowed_proposal_action_types || [],
threshold: Number(council.threshold),
quorum: Number(council.quorum),
members: council?.members.map((address) => ({ address })) || [],
allowedProposalTypes: council?.allowed_proposal_action_types || [],
threshold: Number(council?.threshold) || 0.51,
quorum: Number(council?.quorum) || 0.3,
},
});

Expand Down Expand Up @@ -115,6 +115,7 @@ export const CouncilForm = () => {
</VStack>
<Line />
<VStack gap={8}>
<Text>Modify Council Members</Text>
{fields.map((member, index) => (
<HStack gap={16} alignItems="center">
<TextInput
Expand All @@ -126,7 +127,7 @@ export const CouncilForm = () => {
<DeleteButton size="l" onClick={() => remove(index)} />
</HStack>
))}
{isValid && <AddButton size="l" onClick={() => append({ address: '' })} />}
{<AddButton size="l" onClick={() => append({ address: '' })} />}
</VStack>
</VStack>
</ProposalForm>
Expand Down

0 comments on commit 786081b

Please sign in to comment.