Skip to content
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

Staging: #161 #349 #301 #291 #198 #143 #240 #121 #119 #210 #152 #246 #214 #141 #144 #212 #239 #316 #338 #356

Merged
merged 86 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
29069b3
fix get drep voting power
Sworzen1 Feb 23, 2024
2e3a764
add keys
Sworzen1 Feb 23, 2024
7ac847f
[#280] Fix get drep voting power request
MSzalowski Feb 23, 2024
965c021
fix get drep voting power
Sworzen1 Feb 23, 2024
602c083
add keys
Sworzen1 Feb 23, 2024
e18baa1
[#280] Fix get drep voting power request
MSzalowski Feb 23, 2024
3d96d83
[#265] make button disabled when tries to connect
Sworzen1 Feb 26, 2024
c17c0c0
[#301] Add Michał Szałowski to SSH access list for environment manage…
placek Feb 26, 2024
1a27c09
Sole voter information page, without footer
JanJaroszczak Feb 14, 2024
119471f
add image for sole voter
Sworzen1 Feb 16, 2024
441d028
change props and dashabord card sizes
Sworzen1 Feb 16, 2024
19ef0be
add sole voter into IMAGES
Sworzen1 Feb 16, 2024
88273fc
sort IMAGES asc
Sworzen1 Feb 16, 2024
9070153
add translations for sole voter card
Sworzen1 Feb 16, 2024
a6a72c5
change way to display cards on dashboard/ add sole voter card
Sworzen1 Feb 16, 2024
18ff224
delete unnecessary code
Sworzen1 Feb 16, 2024
d1151f9
add feat to changelog
Sworzen1 Feb 16, 2024
75be3bf
add sole voter into IMAGES
Sworzen1 Feb 16, 2024
b6b5737
add retire as sole voter screen
Sworzen1 Feb 19, 2024
dc10121
add retirement to changelog
Sworzen1 Feb 19, 2024
b515b26
update home cards
Sworzen1 Feb 19, 2024
a06abb4
Sole Voter transactions added and UI components unification
JanJaroszczak Feb 20, 2024
7c1a049
Minor refactor
JanJaroszczak Feb 21, 2024
2b8aac7
[#119] Fixes after CR
JanJaroszczak Feb 26, 2024
f1c9257
[#210] Sole voter wallet logic for registration and retirement
JanJaroszczak Feb 22, 2024
2367be0
[#210] Sole voter wallet logic for registration and retirement - part 2
JanJaroszczak Feb 26, 2024
e230b78
[#210] 'user' changed to 'voter'
JanJaroszczak Feb 26, 2024
df64c45
[#210] 'UserInfo' changed to 'VoterInfo'
JanJaroszczak Feb 26, 2024
c6a4704
[#119] add registration as sole voter
MSzalowski Feb 27, 2024
abdbfe4
[#119] Duplicated lines removed
JanJaroszczak Feb 27, 2024
c716ea7
[#119] Make voting on governance actions possible
MSzalowski Feb 27, 2024
1769960
[#119] Post code review adjustments
MSzalowski Feb 27, 2024
b39916f
[#212] provide sole voter information in drep/info
jankun4 Feb 21, 2024
a9de520
[#212] udpate CHANGELOG.md
jankun4 Feb 21, 2024
dafe401
[#212] fix swagger drep info example
jankun4 Feb 26, 2024
41875b5
[#212] fix drep/info sql query
jankun4 Feb 27, 2024
66d60af
[#291] Allow Sentry error reporting in CSP settings across environments
placek Feb 26, 2024
7304dfa
Updated CHANGELOG.md to include recent enhancements
placek Feb 26, 2024
804f906
Add environment-specific warning to .env.example for clarity and safety
placek Feb 26, 2024
198b2de
[#333] fix drep type detection
jankun4 Feb 27, 2024
eb7eb45
fix get drep voting power
Sworzen1 Feb 23, 2024
e23b868
[#280] Fix get drep voting power request
MSzalowski Feb 23, 2024
5e2df20
[#265] make button disabled when tries to connect
Sworzen1 Feb 26, 2024
36b8202
[#301] Add Michał Szałowski to SSH access list for environment manage…
placek Feb 26, 2024
314d71e
Sole voter information page, without footer
JanJaroszczak Feb 14, 2024
0d9915c
add image for sole voter
Sworzen1 Feb 16, 2024
53b7d98
change props and dashabord card sizes
Sworzen1 Feb 16, 2024
5b4ede4
add sole voter into IMAGES
Sworzen1 Feb 16, 2024
bf8a0fa
sort IMAGES asc
Sworzen1 Feb 16, 2024
6b55765
add translations for sole voter card
Sworzen1 Feb 16, 2024
928b20b
change way to display cards on dashboard/ add sole voter card
Sworzen1 Feb 16, 2024
1849e03
delete unnecessary code
Sworzen1 Feb 16, 2024
249df28
add feat to changelog
Sworzen1 Feb 16, 2024
50514fa
add sole voter into IMAGES
Sworzen1 Feb 16, 2024
1331782
add retire as sole voter screen
Sworzen1 Feb 19, 2024
82077a9
add retirement to changelog
Sworzen1 Feb 19, 2024
cf3a111
update home cards
Sworzen1 Feb 19, 2024
2336e45
Sole Voter transactions added and UI components unification
JanJaroszczak Feb 20, 2024
758b83c
Minor refactor
JanJaroszczak Feb 21, 2024
b0b5c87
[#119] Fixes after CR
JanJaroszczak Feb 26, 2024
60b6744
[#210] Sole voter wallet logic for registration and retirement
JanJaroszczak Feb 22, 2024
680e9ef
[#210] Sole voter wallet logic for registration and retirement - part 2
JanJaroszczak Feb 26, 2024
78b7c0d
[#210] 'user' changed to 'voter'
JanJaroszczak Feb 26, 2024
e4d8f1b
[#210] 'UserInfo' changed to 'VoterInfo'
JanJaroszczak Feb 26, 2024
d65b44b
[#119] add registration as sole voter
MSzalowski Feb 27, 2024
ebe8130
[#119] Duplicated lines removed
JanJaroszczak Feb 27, 2024
62bbe04
[#119] Make voting on governance actions possible
MSzalowski Feb 27, 2024
4bef8d1
[#119] Post code review adjustments
MSzalowski Feb 27, 2024
8b58407
[#212] provide sole voter information in drep/info
jankun4 Feb 21, 2024
c8f9a26
[#212] udpate CHANGELOG.md
jankun4 Feb 21, 2024
c7c65df
[#212] fix swagger drep info example
jankun4 Feb 26, 2024
669dfe1
[#212] fix drep/info sql query
jankun4 Feb 27, 2024
39318e6
[#291] Allow Sentry error reporting in CSP settings across environments
placek Feb 26, 2024
83145c6
Updated CHANGELOG.md to include recent enhancements
placek Feb 26, 2024
f3f8080
Add environment-specific warning to .env.example for clarity and safety
placek Feb 26, 2024
1a8c4cf
[#333] fix drep type detection
jankun4 Feb 27, 2024
21b5a78
Post sync test with develop
MSzalowski Feb 28, 2024
76913d5
[#239 #240 #338] DRep can become Sole Voter, Sole Voter can become DRep
JanJaroszczak Feb 28, 2024
81df058
[#239 #240 #338] Fixes after CR
JanJaroszczak Feb 28, 2024
d2cd92f
Merge pull request #342 from IntersectMBO/240-sole-voter-can-become-a…
JanJaroszczak Feb 28, 2024
79c618e
Merge pull request #343 from IntersectMBO/develop
SandraRodziewicz Feb 28, 2024
9b2f2bc
[#152] change step 3 components
Sworzen1 Feb 28, 2024
554222e
[#152] improve form
Sworzen1 Feb 28, 2024
fc27fbd
[#152] fix inprogress copy
Sworzen1 Feb 28, 2024
63fc880
[#152] change continue on register/ reset store data agreement when b…
Sworzen1 Feb 28, 2024
9ae8d87
Merge pull request #348 from IntersectMBO/develop
SandraRodziewicz Feb 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,19 @@ As a minor extension, we also keep a semantic version for the `UNRELEASED`
changes.

## [Unreleased]
- Change step 3 components [Issue 152](https://github.com/intersectMBO/govtool/issues/152)
- Add possibility to vote on behalf of myself - Sole Voter [Issue 119](https://github.com/IntersectMBO/govtool/issues/119)
- Create DRep registration page about roles [Issue 205](https://github.com/IntersectMBO/govtool/issues/205)
- Create Checkbox component. Improve Field and ControlledField [Issue 177](https://github.com/IntersectMBO/govtool/pull/177)
- Vitest unit tests added for utils functions [Issue 81](https://github.com/IntersectMBO/govtool/issues/81)
- i18next library added to FE [Issue 80](https://github.com/IntersectMBO/govtool/issues/80)

### Added
- Added `isRegisteredAsSoleVoter` and `wasRegisteredAsSoleVoter` fields to the drep/info response [Issue 212](https://github.com/IntersectMBO/govtool/issues/212)

### Fixed
- Fix drep type detection when changing metadata [Issue 333](https://github.com/IntersectMBO/govtool/issues/333)
- Fix make button disble when wallet tries connect [Issue 265](https://github.com/IntersectMBO/govtool/issues/265)
- Fix drep voting power calculation [Issue 231](https://github.com/IntersectMBO/govtool/issues/231)
- Fix proposal/list and network/metrics bug that appeared when noone has delegated their funds either to drep_always_abstain or drep_always_no_confidence [Issue 231](https://github.com/IntersectMBO/govtool/issues/231)
- Fix GA details [Issue 272](https://github.com/IntersectMBO/govtool/issues/272)
Expand All @@ -23,15 +30,20 @@ changes.
- Fixed vote calculation problems related to NoConfidence DRep [Issue 59](https://github.com/IntersectMBO/govtool/issues/59)
- Fixed ada-holder/get-current-delegation error when delegated to NoConfidence or AlwaysAbstain dreps. [Issue 82](https://github.com/IntersectMBO/govtool/issues/82)
- Fixed deployment scripts to address [Issue 171](https://github.com/IntersectMBO/govtool/issues/171).
- Fixed get drep voting power incorrectly executed endpoint [Issue 280](https://github.com/IntersectMBO/govtool/issues/280).
- Fixed CSP settings to allow error reports with Sentry [Issue 291](https://github.com/IntersectMBO/govtool/issues/291).

### Changed
- `isRegistered` and `wasRegistered` fields in the drep/info endpoint changed to `isRegisteredAsDRep` and `wasRegisteredAsDRep` respectively [Issue 212](https://github.com/IntersectMBO/govtool/issues/212)
- Update Cardano-Serialization-Lib to 12.0.0-alpha.16 [Issue 156](https://github.com/IntersectMBO/govtool/issues/156)
- Changed and improved working conventions docs, PR template and codeowners file, addressing [Issue 88](https://github.com/IntersectMBO/govtool/issues/88).
- Changed Node version from 8.7.1-pre to 8.8.0-pre and DbSync version from sancho-2-3-0 to sancho-4-0-0-fix-config, addressing also [Issue 181](https://github.com/IntersectMBO/govtool/issues/181).
- Reorganized repository to fit new conventions [Issue 85](https://github.com/IntersectMBO/govtool/issues/85).
- Renamed project from VVA to GovTool [Issue 97](https://github.com/IntersectMBO/govtool/issues/97).
- (`docs/update-working-conventions`) Addressing [Issue 25](https://github.com/IntersectMBO/govtool/issues/25) changed working conventions documentation to improve intended flows.
- Adjusted Nix configuration to meet projects needs [Issue 187](https://github.com/IntersectMBO/govtool/issues/187).
- Integrated OAuth to securely notify about deployment status in Slack [Issue 194](https://github.com/IntersectMBO/govtool/issues/194).
- Streamlined the application build and deployment process, thereby accelerating continuous delivery (CD) and reducing the resource burden [Issue 246](https://github.com/IntersectMBO/govtool/issues/246).

### Removed
-
Expand Down
108 changes: 83 additions & 25 deletions govtool/backend/sql/get-drep-info.sql
Original file line number Diff line number Diff line change
@@ -1,28 +1,86 @@
WITH DRepId AS (
SELECT decode(?, 'hex') as raw
), IsRegistered AS (
SELECT (deposit>0) as value,
deposit as deposit
FROM drep_registration
JOIN drep_hash
ON drep_hash.id = drep_registration.drep_hash_id
CROSS JOIN DRepId
WHERE drep_hash.raw = DRepId.raw
and deposit is not null
ORDER BY drep_registration.tx_id DESC
SELECT
decode(?, 'hex') AS raw
),
LatestRegistrationEntry AS (
SELECT
drep_registration.voting_anchor_id AS voting_anchor_id,
deposit AS deposit
FROM
drep_registration
CROSS JOIN DrepId
JOIN drep_hash ON drep_hash.id = drep_registration.drep_hash_id
WHERE
drep_hash.raw = DRepId.raw
ORDER BY
drep_registration.tx_id DESC
LIMIT 1
), WasRegistered AS (
select (EXISTS (
SELECT *
FROM drep_registration
JOIN drep_hash
ON drep_hash.id = drep_registration.drep_hash_id
CROSS JOIN DRepId
WHERE drep_hash.raw = DRepId.raw
and drep_registration.deposit > 0
)) as value
),
IsRegisteredAsDRep AS (
SELECT
(LatestRegistrationEntry.deposit is null or LatestRegistrationEntry.deposit > 0)
AND LatestRegistrationEntry.voting_anchor_id IS NOT NULL AS value
FROM
LatestRegistrationEntry
),
IsRegisteredAsSoleVoter AS (
SELECT
(LatestRegistrationEntry.deposit is null or LatestRegistrationEntry.deposit > 0)
AND LatestRegistrationEntry.voting_anchor_id IS NULL AS value
FROM
LatestRegistrationEntry
),
CurrentDeposit AS (
SELECT
GREATEST(drep_registration.deposit, 0) AS value
FROM
drep_registration
join drep_hash
on drep_hash.id = drep_registration.drep_hash_id
cross join DRepId

WHERE
drep_registration.deposit IS NOT NULL
and drep_hash.raw = DRepId.raw
ORDER BY
drep_registration.tx_id DESC
LIMIT 1
),
WasRegisteredAsDRep AS (
SELECT
(EXISTS (
SELECT
*
FROM
drep_registration
JOIN drep_hash ON drep_hash.id = drep_registration.drep_hash_id
CROSS JOIN DRepId
WHERE
drep_hash.raw = DRepId.raw
AND drep_registration.voting_anchor_id IS NOT NULL)) AS value
),
WasRegisteredAsSoleVoter AS (
SELECT
(EXISTS (
SELECT
*
FROM
drep_registration
JOIN drep_hash ON drep_hash.id = drep_registration.drep_hash_id
CROSS JOIN DRepId
WHERE
drep_hash.raw = DRepId.raw
AND drep_registration.voting_anchor_id IS NULL)) AS value
)
SELECT IsRegistered.value, WasRegistered.value, IsRegistered.deposit
FROM WasRegistered
LEFT JOIN IsRegistered
ON 1=1
SELECT
IsRegisteredAsDRep.value,
WasRegisteredAsDRep.value,
IsRegisteredAsSoleVoter.value,
WasRegisteredAsSoleVoter.value,
CurrentDeposit.value
FROM
IsRegisteredAsDRep
CROSS JOIN IsRegisteredAsSoleVoter
CROSS JOIN WasRegisteredAsDRep
CROSS JOIN WasRegisteredAsSoleVoter
CROSS JOIN CurrentDeposit
6 changes: 4 additions & 2 deletions govtool/backend/src/VVA/API.hs
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,10 @@ drepInfo (unHexText -> dRepId) = do
CacheEnv {dRepInfoCache} <- asks vvaCache
Types.DRepInfo {..} <- cacheRequest dRepInfoCache dRepId $ DRep.getDRepInfo dRepId
return $ DRepInfoResponse
{ dRepInfoResponseIsRegistered = dRepInfoIsRegistered
, dRepInfoResponseWasRegistered = dRepInfoWasRegistered
{ dRepInfoResponseIsRegisteredAsDRep = dRepInfoIsRegisteredAsDRep
, dRepInfoResponseWasRegisteredAsDRep = dRepInfoWasRegisteredAsDRep
, dRepInfoResponseIsRegisteredAsSoleVoter = dRepInfoIsRegisteredAsSoleVoter
, dRepInfoResponseWasRegisteredAsSoleVoter = dRepInfoWasRegisteredAsSoleVoter
, dRepInfoResponseDeposit = dRepInfoDeposit
}

Expand Down
12 changes: 8 additions & 4 deletions govtool/backend/src/VVA/API/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -375,17 +375,21 @@ instance ToSchema VoteResponse where
?~ toJSON exampleVoteResponse

data DRepInfoResponse = DRepInfoResponse
{ dRepInfoResponseIsRegistered :: Bool
, dRepInfoResponseWasRegistered :: Bool
{ dRepInfoResponseIsRegisteredAsDRep :: Bool
, dRepInfoResponseWasRegisteredAsDRep :: Bool
, dRepInfoResponseIsRegisteredAsSoleVoter :: Bool
, dRepInfoResponseWasRegisteredAsSoleVoter :: Bool
, dRepInfoResponseDeposit :: Maybe Integer
} deriving (Generic, Show)

deriveJSON (jsonOptions "dRepInfoResponse") ''DRepInfoResponse

exampleDRepInfoResponse :: Text
exampleDRepInfoResponse =
"{\"isRegistered\": false,"
<> "\"wasRegistered\": true,"
"{\"isRegisteredAsDRep\": false,"
<> "\"wasRegisteredAsDRep\": true,"
<> "\"isRegisteredAsSoleVoter\": true,"
<> "\"wasRegisteredAsSoleVoter\": true,"
<> "\"deposit\": 2000000}"

instance ToSchema DRepInfoResponse where
Expand Down
10 changes: 6 additions & 4 deletions govtool/backend/src/VVA/DRep.hs
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,12 @@ getDRepInfo
getDRepInfo drepId = withPool $ \conn -> do
result <- liftIO $ SQL.query conn getDRepInfoSql (SQL.Only drepId)
case result of
[(isRegistered, wasRegistered, deposit)] ->
[(isRegisteredAsDRep, wasRegisteredAsDRep, isRegisteredAsSoleVoter, wasRegisteredAsSoleVoter, deposit)] ->
return $ DRepInfo
{ dRepInfoIsRegistered = fromMaybe False isRegistered
, dRepInfoWasRegistered = fromMaybe False wasRegistered
{ dRepInfoIsRegisteredAsDRep = fromMaybe False isRegisteredAsDRep
, dRepInfoWasRegisteredAsDRep = fromMaybe False wasRegisteredAsDRep
, dRepInfoIsRegisteredAsSoleVoter = fromMaybe False isRegisteredAsSoleVoter
, dRepInfoWasRegisteredAsSoleVoter = fromMaybe False wasRegisteredAsSoleVoter
, dRepInfoDeposit = deposit
}
[] -> return $ DRepInfo False False Nothing
[] -> return $ DRepInfo False False False False Nothing
6 changes: 4 additions & 2 deletions govtool/backend/src/VVA/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@ data Vote = Vote
}

data DRepInfo = DRepInfo
{ dRepInfoIsRegistered :: Bool
, dRepInfoWasRegistered :: Bool
{ dRepInfoIsRegisteredAsDRep :: Bool
, dRepInfoWasRegisteredAsDRep :: Bool
, dRepInfoIsRegisteredAsSoleVoter :: Bool
, dRepInfoWasRegisteredAsSoleVoter :: Bool
, dRepInfoDeposit :: Maybe Integer
}

Expand Down
5 changes: 5 additions & 0 deletions govtool/frontend/public/icons/ArrowLeftThin.svg
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.
17 changes: 12 additions & 5 deletions govtool/frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
UpdatedRepMetadata,
GovernanceActionsCategory,
DashboardGovernanceActionsCategory,
RetireAsSoleVoter,
} from "@pages";
import {
callAll,
Expand All @@ -29,12 +30,13 @@ import {
removeItemFromLocalStorage,
} from "@utils";
import { SetupInterceptors } from "./services";
import { useGetDRepInfo, useWalletConnectionListener } from "./hooks";
import { useGetVoterInfo, useWalletConnectionListener } from "./hooks";
import { RegisterAsSoleVoter } from "./pages/RegisterAsSoleVoter";

export default function App() {
const { enable, setDRep, setIsDrepLoading } = useCardano();
const { enable, setVoter, setIsDrepLoading } = useCardano();
const navigate = useNavigate();
const { data } = useGetDRepInfo();
const { data } = useGetVoterInfo();
const { modal, openModal, modals } = useModal();

useWalletConnectionListener();
Expand All @@ -45,11 +47,11 @@ export default function App() {

useEffect(() => {
setIsDrepLoading(true);
setDRep(data);
setVoter(data);
const timer = setTimeout(() => setIsDrepLoading(false), 1000);

return () => clearTimeout(timer);
}, [data?.isRegistered]);
}, [data?.isRegisteredAsDRep, data?.isRegisteredAsSoleVoter]);

const checkTheWalletIsActive = useCallback(() => {
const hrefCondition =
Expand Down Expand Up @@ -115,6 +117,11 @@ export default function App() {
</Route>
<Route path={PATHS.delegateTodRep} element={<DelegateTodRep />} />
<Route path={PATHS.registerAsdRep} element={<RegisterAsdRep />} />
<Route
path={PATHS.registerAsSoleVoter}
element={<RegisterAsSoleVoter />}
/>
<Route path={PATHS.retireAsSoleVoter} element={<RetireAsSoleVoter />} />
<Route path={PATHS.stakeKeys} element={<ChooseStakeKey />} />
<Route path={PATHS.updateMetadata} element={<UpdatedRepMetadata />} />
<Route path="*" element={<ErrorPage />} />
Expand Down
10 changes: 5 additions & 5 deletions govtool/frontend/src/components/atoms/VotingPowerChips.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { correctAdaFormat } from "@utils";
import { Tooltip } from "@atoms";

export const VotingPowerChips = () => {
const { dRep, stakeKey, isDrepLoading } = useCardano();
const { voter, stakeKey, isDrepLoading } = useCardano();
const { dRepVotingPower, isDRepVotingPowerLoading } =
useGetDRepVotingPowerQuery();
const { votingPower, powerIsLoading } =
Expand All @@ -33,7 +33,7 @@ export const VotingPowerChips = () => {
alignItems="center"
maxHeight={isMobile ? undefined : 48}
>
{dRep?.isRegistered && (
{voter?.isRegisteredAsDRep && (
<Tooltip
heading={t("tooltips.votingPower.heading")}
paragraphOne={t("tooltips.votingPower.paragraphOne")}
Expand All @@ -55,8 +55,8 @@ export const VotingPowerChips = () => {
{t("votingPower")}
</Typography>
)}
{(dRep?.isRegistered && isDRepVotingPowerLoading) ||
(!dRep?.isRegistered && powerIsLoading) ||
{(voter?.isRegisteredAsDRep && isDRepVotingPowerLoading) ||
(!voter?.isRegisteredAsDRep && powerIsLoading) ||
isDrepLoading ? (
<CircularProgress size={20} color="primary" />
) : (
Expand All @@ -67,7 +67,7 @@ export const VotingPowerChips = () => {
sx={{ whiteSpace: "nowrap" }}
>
₳{" "}
{dRep?.isRegistered
{voter?.isRegisteredAsDRep
? correctAdaFormat(dRepVotingPower) ?? 0
: correctAdaFormat(votingPower) ?? 0}
</Typography>
Expand Down
1 change: 0 additions & 1 deletion govtool/frontend/src/components/molecules/ActionCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ export const ActionCard: FC<ActionCardProps> = ({ ...props }) => {
<Button
data-testid={dataTestIdFirstButton}
onClick={firstButtonAction}
size="large"
sx={{
width: MOBILE_AND_WIDE_CONDITION ? "100%" : "auto",
}}
Expand Down
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>
);
};
Loading
Loading