Skip to content

Commit afa55cc

Browse files
committed
WIP: feat(#3622): home page redesign
1 parent 7adbc19 commit afa55cc

14 files changed

Lines changed: 520 additions & 307 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { Card } from "./Card";
2+
import { Typography } from "../atoms";
3+
4+
type Props = {
5+
title: string;
6+
description: string;
7+
onCardClick?: () => void;
8+
};
9+
10+
export const HomeCard = ({ title, description, onCardClick }: Props) => (
11+
<Card
12+
sx={{
13+
flexBasis: 0,
14+
boxShadow: "2px 2px 20px 0px rgba(47, 98, 220, 0.20)",
15+
boxSizing: "border-box",
16+
display: "flex",
17+
flexDirection: "column",
18+
gap: 1,
19+
}}
20+
onCardClick={onCardClick}
21+
>
22+
<Typography>{title}</Typography>
23+
<Typography variant="caption">{description}</Typography>
24+
</Card>
25+
);

govtool/frontend/src/components/organisms/Hero.tsx

Lines changed: 0 additions & 109 deletions
This file was deleted.
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
import { Box } from "@mui/material";
2+
import { useTranslation } from "react-i18next";
3+
4+
import I18n from "@/i18n";
5+
import { BUDGET_DISCUSSION_PATHS, PATHS, PDF_PATHS } from "@/consts";
6+
7+
import { Typography } from "../../atoms";
8+
import { HomeCard } from "../../molecules/HomeCard";
9+
import { useModal } from "@/context";
10+
11+
const CONNECT_WALLET_TO_CARDS = [
12+
{
13+
title: I18n.t("home.connectWalletTo.cards.discussBudgetProposals.title"),
14+
description: I18n.t(
15+
"home.connectWalletTo.cards.discussBudgetProposals.description",
16+
),
17+
path: BUDGET_DISCUSSION_PATHS.budgetDiscussion,
18+
},
19+
{
20+
title: I18n.t("home.connectWalletTo.cards.createBudgetProposal.title"),
21+
description: I18n.t(
22+
"home.connectWalletTo.cards.createBudgetProposal.description",
23+
),
24+
path: BUDGET_DISCUSSION_PATHS.budgetDiscussion,
25+
},
26+
{
27+
title: I18n.t("home.connectWalletTo.cards.discussGovernanceActions.title"),
28+
description: I18n.t(
29+
"home.connectWalletTo.cards.discussGovernanceActions.description",
30+
),
31+
path: PDF_PATHS.proposalDiscussion,
32+
},
33+
{
34+
title: I18n.t("home.connectWalletTo.cards.proposeGovernanceAction.title"),
35+
description: I18n.t(
36+
"home.connectWalletTo.cards.proposeGovernanceAction.description",
37+
),
38+
path: PDF_PATHS.proposalDiscussionPropose,
39+
},
40+
{
41+
title: I18n.t("home.connectWalletTo.cards.registerToVote.title"),
42+
description: I18n.t(
43+
"home.connectWalletTo.cards.registerToVote.description",
44+
),
45+
path: PATHS.registerAsDirectVoter,
46+
},
47+
{
48+
title: I18n.t("home.connectWalletTo.cards.delegateVote.title"),
49+
description: I18n.t("home.connectWalletTo.cards.delegateVote.description"),
50+
path: PATHS.dRepDirectory,
51+
},
52+
{
53+
title: I18n.t("home.connectWalletTo.cards.becomeDRep.title"),
54+
description: I18n.t("home.connectWalletTo.cards.becomeDRep.description"),
55+
path: PATHS.registerAsdRep,
56+
},
57+
{
58+
title: I18n.t("home.connectWalletTo.cards.voteOnGovernanceActions.title"),
59+
description: I18n.t(
60+
"home.connectWalletTo.cards.voteOnGovernanceActions.description",
61+
),
62+
path: PATHS.dashboardGovernanceActions,
63+
},
64+
];
65+
66+
export const ConnectWalletTo = () => {
67+
const { t } = useTranslation();
68+
const { openModal } = useModal();
69+
70+
const handleCardClick = ({ path }: { path?: string }) => {
71+
if (!path) return;
72+
openModal({
73+
type: "chooseWallet",
74+
state: {
75+
pathToNavigate: path,
76+
},
77+
});
78+
};
79+
80+
return (
81+
<Box my={4} component="section" data-testid="connect-wallet-to-section">
82+
<Typography variant="title2">
83+
{t("home.connectWalletTo.section.title")}
84+
</Typography>
85+
<Box
86+
display="grid"
87+
gridTemplateColumns={{
88+
xxs: "repeat(1, 1fr)",
89+
sm: "repeat(2, 1fr)",
90+
lg: "repeat(3, 1fr)",
91+
}}
92+
gap={4}
93+
mt={4}
94+
>
95+
{CONNECT_WALLET_TO_CARDS.map(({ title, description, path }) => (
96+
<HomeCard
97+
key={title}
98+
title={title}
99+
description={description}
100+
onCardClick={() => handleCardClick({ path })}
101+
/>
102+
))}
103+
</Box>
104+
</Box>
105+
);
106+
};
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import { Box } from "@mui/material";
2+
import { useTranslation } from "react-i18next";
3+
4+
import I18n from "@/i18n";
5+
import { GOVTOOL_URLS } from "@/consts";
6+
7+
import { Typography } from "../../atoms";
8+
import { HomeCard } from "../../molecules/HomeCard";
9+
import { openInNewTab } from "@/utils";
10+
11+
const GOVTOOL_CARD_LINKS = [
12+
{
13+
title: I18n.t("home.helpBuildGovTool.cards.githubRepo.title"),
14+
description: I18n.t("home.helpBuildGovTool.cards.githubRepo.description"),
15+
url: GOVTOOL_URLS.githubRepo,
16+
},
17+
{
18+
title: I18n.t("home.helpBuildGovTool.cards.documentation.title"),
19+
description: I18n.t(
20+
"home.helpBuildGovTool.cards.documentation.description",
21+
),
22+
url: GOVTOOL_URLS.documentation,
23+
},
24+
{
25+
title: I18n.t("home.helpBuildGovTool.cards.telegram.title"),
26+
description: I18n.t("home.helpBuildGovTool.cards.telegram.description"),
27+
url: GOVTOOL_URLS.telegram,
28+
},
29+
];
30+
31+
export const HelpBuildGovTool = () => {
32+
const { t } = useTranslation();
33+
34+
const handleCardClick = ({ url }: { url?: string }) => {
35+
if (!url) return;
36+
openInNewTab(url);
37+
};
38+
39+
return (
40+
<Box my={4} component="section" data-testid="help-build-govtool-section">
41+
<Typography variant="title2">
42+
{t("home.helpBuildGovTool.section.title")}
43+
</Typography>
44+
<Box
45+
display="grid"
46+
gridTemplateColumns={{
47+
xxs: "repeat(1, 1fr)",
48+
sm: "repeat(2, 1fr)",
49+
lg: "repeat(3, 1fr)",
50+
}}
51+
gap={4}
52+
mt={4}
53+
>
54+
{GOVTOOL_CARD_LINKS.map(({ title, description, url }) => (
55+
<HomeCard
56+
key={title}
57+
title={title}
58+
description={description}
59+
onCardClick={() => handleCardClick({ url })}
60+
/>
61+
))}
62+
</Box>
63+
</Box>
64+
);
65+
};

0 commit comments

Comments
 (0)