Skip to content

Commit

Permalink
[#119] Make voting on governance actions possible
Browse files Browse the repository at this point in the history
  • Loading branch information
MSzalowski committed Mar 1, 2024
1 parent ad166a9 commit 6d048cb
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 26 deletions.
2 changes: 1 addition & 1 deletion govtool/frontend/src/components/organisms/BgCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const BgCard = ({
{actionButtonLabel}
</LoadingButton>
);
}, [isLoadingActionButton, isMobile]);
}, [isLoadingActionButton, isMobile, actionButtonLabel]);

return (
<Box
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export const DashboardGovernanceActionDetails = () => {
? formatDisplayDate(state.expiryDate)
: formatDisplayDate(data.proposal.expiryDate)
}
isDRep={voter?.isRegisteredAsDRep}
isDRep={voter?.isRegisteredAsDRep || voter?.isRegisteredAsSoleVoter}
noVotes={state ? state.noVotes : data.proposal.noVotes}
type={
state
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export const DashboardGovernanceActions = () => {
sortingActive={Boolean(chosenSorting)}
sortOpen={sortOpen}
/>
{voter?.isRegisteredAsDRep && (
{(voter?.isRegisteredAsDRep || voter?.isRegisteredAsSoleVoter) && (
<Tabs
sx={{
marginTop: 3,
Expand Down
5 changes: 3 additions & 2 deletions govtool/frontend/src/components/organisms/DashboardTopNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const DashboardTopNav = ({
alignItems={"center"}
justifyContent={"space-between"}
borderBottom={1}
borderColor={"#D6E2FF"}
borderColor="#D6E2FF"
position="fixed"
zIndex={100}
flex={1}
Expand Down Expand Up @@ -168,7 +168,8 @@ export const DashboardTopNav = ({
</Grid>
</Grid>
</Box>
{voter?.isRegisteredAsDRep && <DRepInfoCard />}
{(voter?.isRegisteredAsDRep ||
voter?.isRegisteredAsSoleVoter) && <DRepInfoCard />}
<Box py={2} />
<WalletInfoCard />
</Box>
Expand Down
42 changes: 23 additions & 19 deletions govtool/frontend/src/components/organisms/DelegateTodRepStepOne.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export const DelegateTodRepStepOne = ({ setStep }: DelegateProps) => {
chosenOption,
delegate,
voter?.isRegisteredAsDRep,
voter?.isRegisteredAsSoleVoter,
dRepID,
isDelegationLoading,
isMobile,
Expand Down Expand Up @@ -177,9 +178,9 @@ export const DelegateTodRepStepOne = ({ setStep }: DelegateProps) => {
<Box
border={1}
borderColor="#D6E2FF"
py={"12px"}
px={"24px"}
mb={"32px"}
py="12px"
px="24px"
mb="32px"
borderRadius={3}
>
<Box sx={{ display: "flex", alignItems: "center" }}>
Expand Down Expand Up @@ -211,24 +212,27 @@ export const DelegateTodRepStepOne = ({ setStep }: DelegateProps) => {
<Grid
container
columns={1}
display={"flex"}
flexDirection={"column"}
display="flex"
flexDirection="column"
rowGap={3}
>
{voter?.isRegisteredAsDRep && currentDelegation !== dRepID && (
<Grid item>
<ActionRadio
onChange={setChosenOption}
tooltipTitle={t("tooltips.delegateTodRep.toMyself.heading")}
tooltipText={t("tooltips.delegateTodRep.toMyself.paragraphOne")}
isChecked={chosenOption === dRepID}
subtitle={t("delegation.toMyself.subtitle")}
title={t("delegation.toMyself.title")}
value={dRepID}
dataTestId="delegate-to-myself-card"
/>
</Grid>
)}
{(voter?.isRegisteredAsDRep || voter?.isRegisteredAsSoleVoter) &&
currentDelegation !== dRepID && (
<Grid item>
<ActionRadio
onChange={setChosenOption}
tooltipTitle={t("tooltips.delegateTodRep.toMyself.heading")}
tooltipText={t(
"tooltips.delegateTodRep.toMyself.paragraphOne"
)}
isChecked={chosenOption === dRepID}
subtitle={t("delegation.toMyself.subtitle")}
title={t("delegation.toMyself.title")}
value={dRepID}
dataTestId="delegate-to-myself-card"
/>
</Grid>
)}
<Grid item>
<ActionRadio
onChange={setChosenOption}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ interface Props {
export const RegisterAsdRepStepTwo = ({ setStep }: Props) => {
const { t } = useTranslation();
const { isMobile } = useScreenDimension();
const { control, errors } = useRegisterAsdRepFormContext();
const { showSubmitButton, control, errors } = useRegisterAsdRepFormContext();

const onClickContinue = useCallback(() => setStep(3), []);

const onClickBackButton = useCallback(() => setStep(1), []);

return (
<BgCard
actionButtonLabel={t("skip")}
actionButtonLabel={showSubmitButton ? t("continue") : t("skip")}
onClickActionButton={onClickContinue}
onClickBackButton={onClickBackButton}
>
Expand Down
1 change: 1 addition & 0 deletions govtool/frontend/src/i18n/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ export const en = {
ok: "Ok",
select: "Select",
seeTransaction: "See transaction",
submit: "Submit",
skip: "Skip",
sortBy: "Sort by",
thisLink: "this link",
Expand Down

0 comments on commit 6d048cb

Please sign in to comment.