-
Notifications
You must be signed in to change notification settings - Fork 9
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
[#119] Add registration as a sole voter #308
Merged
MSzalowski
merged 26 commits into
develop
from
feat/119-i-want-to-vote-on-behalf-of-myself-become-a-drep
Feb 27, 2024
Merged
Changes from 21 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
e58ccbf
Sole voter information page, without footer
JanJaroszczak d0d520c
add image for sole voter
Sworzen1 57e7ba9
change props and dashabord card sizes
Sworzen1 5ac760b
add sole voter into IMAGES
Sworzen1 ec7cc02
sort IMAGES asc
Sworzen1 f0a0991
add translations for sole voter card
Sworzen1 b556540
change way to display cards on dashboard/ add sole voter card
Sworzen1 8bef9a8
delete unnecessary code
Sworzen1 5de9636
add feat to changelog
Sworzen1 69b4925
add sole voter into IMAGES
Sworzen1 130594e
add retire as sole voter screen
Sworzen1 a36bc81
add retirement to changelog
Sworzen1 2e3f63b
update home cards
Sworzen1 d2dc424
Sole Voter transactions added and UI components unification
JanJaroszczak 6c1a1a4
Minor refactor
JanJaroszczak 42c194a
[#119] Fixes after CR
JanJaroszczak 011f585
[#210] Sole voter wallet logic for registration and retirement
JanJaroszczak 9530e5a
[#210] Sole voter wallet logic for registration and retirement - part 2
JanJaroszczak c435bc9
[#210] 'user' changed to 'voter'
JanJaroszczak 2119010
[#210] 'UserInfo' changed to 'VoterInfo'
JanJaroszczak 0d4c1e4
[#119] add registration as sole voter
MSzalowski 449761d
[#119] Duplicated lines removed
JanJaroszczak 17d9230
[#119] Make voting on governance actions possible
MSzalowski 5c6659e
[#119] Post code review adjustments
MSzalowski 924e8eb
[#212] provide sole voter information in drep/info
jankun4 991c18d
[#212] udpate CHANGELOG.md
jankun4 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
govtool/frontend/src/components/molecules/CenteredBoxBottomButtons.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { useMemo } from "react"; | ||
import { Box } from "@mui/material"; | ||
|
||
import { Button, LoadingButton } from "@atoms"; | ||
import { useScreenDimension, useTranslation } from "@hooks"; | ||
|
||
interface Props { | ||
onBackButton: () => void; | ||
onActionButton: () => void; | ||
isLoading?: boolean; | ||
backButtonText?: string; | ||
actionButtonText?: string; | ||
} | ||
|
||
export const CenteredBoxBottomButtons = ({ | ||
onBackButton, | ||
onActionButton, | ||
isLoading, | ||
backButtonText, | ||
actionButtonText, | ||
}: Props) => { | ||
const { isMobile } = useScreenDimension(); | ||
const { t } = useTranslation(); | ||
|
||
const renderBackButton = useMemo(() => { | ||
return ( | ||
<Button | ||
data-testid={"back-button"} | ||
onClick={onBackButton} | ||
size="extraLarge" | ||
sx={{ | ||
px: 6, | ||
}} | ||
variant="outlined" | ||
> | ||
{backButtonText ?? t("cancel")} | ||
</Button> | ||
); | ||
}, [isMobile]); | ||
|
||
const renderActionButton = useMemo(() => { | ||
return ( | ||
<LoadingButton | ||
data-testid={"register-button"} | ||
isLoading={isLoading} | ||
onClick={onActionButton} | ||
sx={{ | ||
px: 6, | ||
height: 48, | ||
fontSize: 16, | ||
}} | ||
variant="contained" | ||
> | ||
{actionButtonText ?? t("continue")} | ||
</LoadingButton> | ||
); | ||
}, [isLoading, isMobile]); | ||
|
||
return ( | ||
<Box | ||
display="flex" | ||
flexDirection={isMobile ? "column-reverse" : "row"} | ||
justifyContent="space-around" | ||
mt={6} | ||
> | ||
{renderBackButton} | ||
<Box px={2} py={isMobile ? 1.5 : 0} /> | ||
{renderActionButton} | ||
</Box> | ||
); | ||
}; |
108 changes: 108 additions & 0 deletions
108
govtool/frontend/src/components/molecules/CenteredBoxPageWrapper.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
import { FC, PropsWithChildren } from "react"; | ||
import { Box, Link } from "@mui/material"; | ||
|
||
import { Background, Typography } from "@atoms"; | ||
import { ICONS } from "@consts"; | ||
import { DashboardTopNav } from "@organisms"; | ||
import { useScreenDimension } from "@hooks"; | ||
import { useNavigate } from "react-router-dom"; | ||
import { theme } from "@/theme"; | ||
|
||
interface Props { | ||
pageTitle: string; | ||
backButtonText: string; | ||
backButtonPath: string; | ||
isVotingPowerHidden?: boolean; | ||
} | ||
export const CenteredBoxPageWrapper: FC<PropsWithChildren<Props>> = ({ | ||
pageTitle, | ||
backButtonText, | ||
backButtonPath, | ||
isVotingPowerHidden, | ||
children, | ||
}) => { | ||
const { isMobile, screenWidth, pagePadding } = useScreenDimension(); | ||
const navigate = useNavigate(); | ||
const { | ||
palette: { boxShadow2 }, | ||
} = theme; | ||
|
||
return ( | ||
<Background isReverted> | ||
<Box display={"flex"} minHeight={"100vh"} flexDirection="column"> | ||
<DashboardTopNav | ||
imageSRC={ICONS.appLogoIcon} | ||
imageWidth={isMobile ? undefined : 42} | ||
imageHeight={isMobile ? 24 : 35} | ||
title={pageTitle} | ||
isVotingPowerHidden={isVotingPowerHidden} | ||
/> | ||
<Box | ||
display={"flex"} | ||
justifyContent={"center"} | ||
flexDirection={"column"} | ||
mt={isMobile ? 0 : 7} | ||
height={isMobile ? "100%" : "auto"} | ||
sx={{ marginTop: "97px" }} | ||
> | ||
{isMobile && ( | ||
<Box borderBottom={1} borderColor={"#fff"}> | ||
<Typography | ||
variant="body2" | ||
sx={{ | ||
ml: 2, | ||
my: "26px", | ||
fontSize: "24px", | ||
fontWeight: 400, | ||
}} | ||
> | ||
{pageTitle} | ||
</Typography> | ||
</Box> | ||
)} | ||
<Link | ||
data-testid={"back-button"} | ||
sx={{ | ||
cursor: "pointer", | ||
display: "flex", | ||
textDecoration: "none", | ||
my: 3, | ||
marginLeft: isMobile ? 2 : "40px", | ||
}} | ||
onClick={() => navigate(backButtonPath)} | ||
> | ||
<img | ||
src={ICONS.arrowLeftThinIcon} | ||
alt="arrow" | ||
style={{ marginRight: "4px" }} | ||
/> | ||
<Typography | ||
variant="body2" | ||
color="primary" | ||
sx={{ | ||
fontWeight: 400, | ||
paddingTop: "1px", | ||
}} | ||
> | ||
{backButtonText} | ||
MSzalowski marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</Typography> | ||
</Link> | ||
<Box display={"flex"} justifyContent={"center"}> | ||
<Box | ||
width={screenWidth < 768 ? "auto" : "52vw"} | ||
boxShadow={isMobile ? "" : `2px 2px 20px 0px ${boxShadow2}`} | ||
px={pagePadding} | ||
py={isMobile ? 3 : 8} | ||
borderRadius={"20px"} | ||
height="auto" | ||
> | ||
<Box display="flex" flexDirection="column"> | ||
{children} | ||
</Box> | ||
</Box> | ||
</Box> | ||
</Box> | ||
</Box> | ||
</Background> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,9 +18,7 @@ type DashboardActionCardProps = { | |
firstButtonIsLoading?: boolean; | ||
firstButtonLabel?: string; | ||
firstButtonVariant?: ButtonProps["variant"]; | ||
imageHeight?: number; | ||
imageURL?: string; | ||
imageWidth?: number; | ||
inProgress?: boolean; | ||
isLoading?: boolean; | ||
secondButtonAction?: () => void; | ||
|
@@ -62,17 +60,15 @@ export const DashboardActionCard: FC<DashboardActionCardProps> = ({ | |
|
||
return ( | ||
<Box | ||
mb={3} | ||
p={3} | ||
sx={{ boxShadow: `5px 5px 15px 5px ${boxShadow2}` }} | ||
border={inProgress && !isLoading ? 1 : 0} | ||
borderColor="accentOrange" | ||
borderRadius={3} | ||
flex={1} | ||
display="flex" | ||
flex={1} | ||
flexDirection="column" | ||
border={inProgress && !isLoading ? 1 : 0} | ||
borderColor="accentOrange" | ||
p={3} | ||
position="relative" | ||
maxWidth={440} | ||
sx={{ boxShadow: `5px 5px 15px 5px ${boxShadow2}` }} | ||
> | ||
{inProgress && !isLoading && ( | ||
<Box | ||
|
@@ -116,7 +112,7 @@ export const DashboardActionCard: FC<DashboardActionCardProps> = ({ | |
) : null} | ||
{inProgress && !isLoading ? ( | ||
<Typography variant="title2" fontWeight={700}> | ||
in progress | ||
In Progress | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use t() |
||
</Typography> | ||
) : null} | ||
{description ? ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ export const VoteActionForm = ({ | |
const [isContext, setIsContext] = useState<boolean>(false); | ||
const { isMobile, screenWidth } = useScreenDimension(); | ||
const { openModal } = useModal(); | ||
const { dRep } = useCardano(); | ||
const { voter } = useCardano(); | ||
const { t } = useTranslation(); | ||
|
||
const { | ||
|
@@ -142,7 +142,7 @@ export const VoteActionForm = ({ | |
/> | ||
</Box> | ||
</Box> | ||
{dRep?.isRegistered && ( | ||
{voter?.isRegisteredAsDRep && ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. || sole voter |
||
<Button | ||
data-testid="show-votes-button" | ||
variant="text" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why padding top 1px ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JanJaroszczak