Skip to content

Commit

Permalink
[#1442] Add redirect to dashboard cards after connect
Browse files Browse the repository at this point in the history
  • Loading branch information
j-dyczka committed Jul 29, 2024
1 parent 78ba78b commit cf2ed10
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ changes.
- Add redirect to the connected DRep Directory page if a connected user enters a non-connected DRep Directory url [Issue 1117](https://github.com/IntersectMBO/govtool/issues/1117)
- Add PDF_API_URL to the frontend config [Issue 1575](https://github.com/IntersectMBO/govtool/issues/1575)
- Provide DB-Sync Postgres envs to the backend config
- Add redirects to cards on Home after user connects [Issue 1442](https://github.com/IntersectMBO/govtool/issues/1442)

### Fixed

Expand Down
24 changes: 16 additions & 8 deletions govtool/frontend/src/components/organisms/HomeCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,17 @@ export const HomeCards = () => {
const { screenWidth } = useScreenDimension();
const { t } = useTranslation();

const openWalletModal = useCallback(() => {
openModal({ type: "chooseWallet" });
}, [openModal]);
const openWalletModal = useCallback(
(pathToNavigate: string) => {
openModal({
type: "chooseWallet",
state: {
pathToNavigate,
},
});
},
[openModal],
);

const onClickLearnMoreAboutDelegation = () =>
openInNewTab(
Expand Down Expand Up @@ -97,7 +105,7 @@ export const HomeCards = () => {
dataTestIdFirstButton="register-connect-wallet-button"
dataTestIdSecondButton="register-learn-more-button"
description={t("home.cards.registerAsDRep.description")}
firstButtonAction={openWalletModal}
firstButtonAction={() => openWalletModal(PATHS.registerAsdRep)}
firstButtonLabel={t("home.cards.registerAsDRep.firstButtonLabel")}
imageHeight={80}
imageURL={IMAGES.govActionRegisterImage}
Expand All @@ -107,12 +115,12 @@ export const HomeCards = () => {
title={t("home.cards.registerAsDRep.title")}
/>
{/* REGISTER AS DREP CARD END */}
{/* REGISTER AS SOLE VOTER CARD */}
{/* REGISTER AS DIRECT VOTER CARD */}
<ActionCard
dataTestIdFirstButton="register-as-sole-voter-button"
dataTestIdSecondButton="lear-more-about-sole-voter-button"
description={t("home.cards.registerAsDirectVoter.description")}
firstButtonAction={openWalletModal}
firstButtonAction={() => openWalletModal(PATHS.registerAsDirectVoter)}
firstButtonLabel={t(
"home.cards.registerAsDirectVoter.firstButtonLabel",
)}
Expand All @@ -123,7 +131,7 @@ export const HomeCards = () => {
secondButtonLabel={t("learnMore")}
title={t("home.cards.registerAsDirectVoter.title")}
/>
{/* REGISTER AS SOLE VOTER CARD END */}
{/* REGISTER AS DIRECT VOTER CARD END */}
{/* GOV ACTIONS CARD */}
<ActionCard
dataTestIdFirstButton="move-to-governance-actions-button"
Expand All @@ -140,7 +148,7 @@ export const HomeCards = () => {
<ActionCard
dataTestIdFirstButton="propose-a-governance-action-button"
description={t("home.cards.proposeAGovernanceAction.description")}
firstButtonAction={openWalletModal}
firstButtonAction={() => openWalletModal(PATHS.createGovernanceAction)}
firstButtonLabel={t(
"home.cards.proposeAGovernanceAction.firstButtonLabel",
)}
Expand Down

0 comments on commit cf2ed10

Please sign in to comment.