-
Notifications
You must be signed in to change notification settings - Fork 23
feat(#3622): home page redesign #3642
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
Merged
MSzalowski
merged 1 commit into
develop
from
feat/3622-updated-dashboard-with-all-inclusive-features
May 22, 2025
Merged
Changes from all commits
Commits
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 hidden or 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 hidden or 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,34 @@ | ||
| import { Card } from "./Card"; | ||
| import { Typography } from "../atoms"; | ||
|
|
||
| type Props = { | ||
| title: string; | ||
| description: string; | ||
| onCardClick?: () => void; | ||
| }; | ||
|
|
||
| export const HomeCard = ({ title, description, onCardClick }: Props) => ( | ||
| <Card | ||
|
Ciabas marked this conversation as resolved.
|
||
| sx={{ | ||
| flexBasis: 0, | ||
| boxShadow: "2px 2px 20px 0px rgba(47, 98, 220, 0.20)", | ||
| boxSizing: "border-box", | ||
| display: "flex", | ||
| flexDirection: "column", | ||
| gap: 1, | ||
| border: "none", | ||
| cursor: onCardClick ? "pointer" : "default", | ||
| outline: "none", | ||
| "&:focus": { | ||
| boxShadow: "0 0 0 3px rgba(47, 98, 220, 0.5)", | ||
| }, | ||
| }} | ||
| onCardClick={onCardClick} | ||
| component="button" | ||
| role="button" | ||
| aria-label={`${title}. ${description}`} | ||
| > | ||
| <Typography component="h3">{title}</Typography> | ||
| <Typography variant="caption">{description}</Typography> | ||
| </Card> | ||
| ); | ||
This file was deleted.
Oops, something went wrong.
142 changes: 142 additions & 0 deletions
142
govtool/frontend/src/components/organisms/Home/ConnectWalletTo.tsx
This file contains hidden or 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,142 @@ | ||
| import { Box } from "@mui/material"; | ||
| import { useTranslation } from "react-i18next"; | ||
| import { useNavigate } from "react-router-dom"; | ||
|
|
||
| import I18n from "@/i18n"; | ||
| import { BUDGET_DISCUSSION_PATHS, PATHS, PDF_PATHS } from "@/consts"; | ||
| import { useCardano, useModal } from "@/context"; | ||
|
|
||
| import { Typography, Button } from "../../atoms"; | ||
| import { HomeCard } from "../../molecules/HomeCard"; | ||
|
|
||
| const isProposalDiscussionForumEnabled = JSON.parse( | ||
| import.meta.env.VITE_IS_PROPOSAL_DISCUSSION_FORUM_ENABLED || false, | ||
| ); | ||
|
|
||
| const CONNECT_WALLET_TO_CARDS = [ | ||
| ...(isProposalDiscussionForumEnabled | ||
| ? [ | ||
| { | ||
| title: I18n.t( | ||
| "home.connectWalletTo.cards.discussBudgetProposals.title", | ||
| ), | ||
| description: I18n.t( | ||
| "home.connectWalletTo.cards.discussBudgetProposals.description", | ||
| ), | ||
| path: BUDGET_DISCUSSION_PATHS.budgetDiscussion, | ||
| }, | ||
| { | ||
| title: I18n.t( | ||
| "home.connectWalletTo.cards.createBudgetProposal.title", | ||
| ), | ||
| description: I18n.t( | ||
| "home.connectWalletTo.cards.createBudgetProposal.description", | ||
| ), | ||
| path: BUDGET_DISCUSSION_PATHS.budgetDiscussion, | ||
| }, | ||
| { | ||
| title: I18n.t( | ||
| "home.connectWalletTo.cards.discussGovernanceActions.title", | ||
| ), | ||
| description: I18n.t( | ||
| "home.connectWalletTo.cards.discussGovernanceActions.description", | ||
| ), | ||
| path: PDF_PATHS.proposalDiscussion, | ||
| }, | ||
| { | ||
| title: I18n.t( | ||
| "home.connectWalletTo.cards.proposeGovernanceAction.title", | ||
| ), | ||
| description: I18n.t( | ||
| "home.connectWalletTo.cards.proposeGovernanceAction.description", | ||
| ), | ||
| path: PDF_PATHS.proposalDiscussionPropose, | ||
| }, | ||
| ] | ||
| : []), | ||
| { | ||
| title: I18n.t("home.connectWalletTo.cards.registerToVote.title"), | ||
| description: I18n.t( | ||
| "home.connectWalletTo.cards.registerToVote.description", | ||
| ), | ||
| path: PATHS.registerAsDirectVoter, | ||
| }, | ||
| { | ||
| title: I18n.t("home.connectWalletTo.cards.delegateVote.title"), | ||
| description: I18n.t("home.connectWalletTo.cards.delegateVote.description"), | ||
| path: PATHS.dRepDirectory, | ||
| }, | ||
| { | ||
| title: I18n.t("home.connectWalletTo.cards.becomeDRep.title"), | ||
| description: I18n.t("home.connectWalletTo.cards.becomeDRep.description"), | ||
| path: PATHS.registerAsdRep, | ||
| }, | ||
| { | ||
| title: I18n.t("home.connectWalletTo.cards.voteOnGovernanceActions.title"), | ||
| description: I18n.t( | ||
| "home.connectWalletTo.cards.voteOnGovernanceActions.description", | ||
| ), | ||
| path: PATHS.dashboardGovernanceActions, | ||
| }, | ||
| ]; | ||
|
|
||
| export const ConnectWalletTo = () => { | ||
| const { t } = useTranslation(); | ||
| const { openModal } = useModal(); | ||
| const { isEnabled, stakeKey } = useCardano(); | ||
| const navigate = useNavigate(); | ||
|
|
||
| const handleCardClick = ({ path }: { path?: string }) => { | ||
| if (!path) return; | ||
| openModal({ | ||
| type: "chooseWallet", | ||
| state: { | ||
| pathToNavigate: path, | ||
| }, | ||
| }); | ||
| }; | ||
|
|
||
| const onClickConnectButton = () => { | ||
| if (isEnabled && stakeKey) { | ||
| navigate(PATHS.dashboard); | ||
| } | ||
| openModal({ type: "chooseWallet" }); | ||
| }; | ||
|
|
||
| return ( | ||
| <Box my={4} component="section" data-testid="connect-wallet-to-section"> | ||
| <Box display="flex" justifyContent="space-between" alignItems="center"> | ||
| <Typography variant="title2"> | ||
| {t("home.connectWalletTo.section.title")} | ||
| </Typography> | ||
| <Button | ||
| data-testid="connect-wallet-button" | ||
| onClick={onClickConnectButton} | ||
| size="extraLarge" | ||
| variant="contained" | ||
| > | ||
| {t("wallet.connectWallet")} | ||
| </Button> | ||
| </Box> | ||
| <Box | ||
| display="grid" | ||
| gridTemplateColumns={{ | ||
| xxs: "repeat(1, 1fr)", | ||
| sm: "repeat(2, 1fr)", | ||
| lg: "repeat(3, 1fr)", | ||
| }} | ||
| gap={4} | ||
| mt={4} | ||
| > | ||
| {CONNECT_WALLET_TO_CARDS.map(({ title, description, path }) => ( | ||
| <HomeCard | ||
| key={title} | ||
| title={title} | ||
| description={description} | ||
| onCardClick={path ? () => handleCardClick({ path }) : undefined} | ||
| /> | ||
| ))} | ||
| </Box> | ||
| </Box> | ||
| ); | ||
| }; |
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.
Uh oh!
There was an error while loading. Please reload this page.