Skip to content

Commit

Permalink
Merge pull request #2733 from decentdao/release/v0.7.0
Browse files Browse the repository at this point in the history
Release/v0.7.0
  • Loading branch information
johnqh authored Feb 18, 2025
2 parents 07530e1 + 8227c5d commit c08fcf7
Show file tree
Hide file tree
Showing 9 changed files with 366 additions and 258 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "decent-interface",
"version": "0.6.0",
"version": "0.7.0",
"private": true,
"dependencies": {
"@amplitude/analytics-browser": "^2.11.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { Button } from '@chakra-ui/react';
import { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import useSnapshotProposal from '../../../hooks/DAO/loaders/snapshot/useSnapshotProposal';
import { useFractal } from '../../../providers/App/AppProvider';
import { AzoriusProposal, FractalProposalState, SnapshotProposal } from '../../../types';
import { useVoteContext } from '../ProposalVotes/context/VoteContext';
import { CastVote } from './CastVote';
Expand All @@ -22,15 +19,9 @@ function ProposalActions({ proposal }: { proposal: AzoriusProposal | SnapshotPro

export function AzoriusOrSnapshotProposalAction({
proposal,
expandedView,
}: {
proposal: AzoriusProposal | SnapshotProposal;
expandedView?: boolean;
}) {
const {
governance: { isAzorius },
} = useFractal();
const { t } = useTranslation();
const { snapshotProposal } = useSnapshotProposal(proposal);
const { canVote } = useVoteContext();

Expand All @@ -46,33 +37,11 @@ export function AzoriusOrSnapshotProposalAction({
proposal.state === FractalProposalState.TIMELOCKABLE ||
proposal.state === FractalProposalState.TIMELOCKED;

const label = useMemo(() => {
if (snapshotProposal) {
return t('details');
}

if (isActiveProposal) {
if (!canVote) {
return t('details');
}
return t(isAzorius ? 'vote' : 'sign');
}
return t('details');
}, [snapshotProposal, t, canVote, isAzorius, isActiveProposal]);

if (!showActionButton) {
if (!expandedView) {
return <Button variant="secondary">{t('details')}</Button>;
}
// This means that Proposal in state where there's no action to perform
return null;
}

if (expandedView) {
if (!snapshotProposal && isActiveProposal && !canVote) return null;

return <ProposalActions proposal={proposal} />;
}
if (!snapshotProposal && isActiveProposal && !canVote) return null;

return <Button variant={showActionButton && canVote ? 'primary' : 'secondary'}>{label}</Button>;
return <ProposalActions proposal={proposal} />;
}
10 changes: 7 additions & 3 deletions src/components/Proposals/ProposalActions/CastVote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,10 @@ export function CastVote({ proposal }: { proposal: FractalProposal }) {
: undefined
}
>
<RadioGroup>
<RadioGroup
mt={6}
mx={-2}
>
{VOTE_CHOICES.map(choice => (
<Radio
key={choice.value}
Expand All @@ -194,14 +197,15 @@ export function CastVote({ proposal }: { proposal: FractalProposal }) {
color: 'lilac--3',
borderWidth: '6px',
}}
mb={2}
>
{t(choice.label, { ns: 'common' })}
</Radio>
))}
<Button
marginTop={5}
padding="1.5rem 6rem"
height="auto"
padding="3"
height="3.25rem"
width="full"
isDisabled={disabled}
onClick={() => selectedVoteChoice !== undefined && castVote(selectedVoteChoice)}
Expand Down
Loading

0 comments on commit c08fcf7

Please sign in to comment.