-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #639 from IntersectMBO/feat/99-drep-directory
[#99] feat: Drep directory
- Loading branch information
Showing
40 changed files
with
1,291 additions
and
56 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Box, BoxProps } from "@mui/material"; | ||
import { FC } from "react"; | ||
|
||
export const ContentBox: FC<BoxProps> = ({ children, ...props }) => ( | ||
<Box maxWidth={1290} mx="auto" {...props}> | ||
{children} | ||
</Box> | ||
); |
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,8 @@ | ||
import { Box, BoxProps } from "@mui/material"; | ||
import { FC } from "react"; | ||
|
||
export const PagePaddingBox: FC<BoxProps> = ({ children, ...props }) => ( | ||
<Box px={{ xxs: 2, md: 5 }} {...props}> | ||
{children} | ||
</Box> | ||
); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { Chip, ChipProps, styled } from "@mui/material"; | ||
import { cyan, errorRed, successGreen } from "@/consts"; | ||
import { DRepStatus } from "@/models"; | ||
|
||
interface StatusPillProps { | ||
status: DRepStatus; | ||
label?: string; | ||
size?: 'small' | 'medium'; | ||
sx?: ChipProps['sx']; | ||
} | ||
|
||
export const StatusPill = ({ | ||
status, | ||
label = status, | ||
size = 'small', | ||
sx | ||
}: StatusPillProps) => ( | ||
<StyledChip | ||
status={status} | ||
size={size} | ||
label={label} | ||
sx={sx} | ||
/> | ||
); | ||
|
||
const bgColor = { | ||
[DRepStatus.Active]: successGreen.c200, | ||
[DRepStatus.Inactive]: cyan.c100, | ||
[DRepStatus.Retired]: errorRed.c100, | ||
}; | ||
|
||
const textColor = { | ||
[DRepStatus.Active]: successGreen.c700, | ||
[DRepStatus.Inactive]: cyan.c500, | ||
[DRepStatus.Retired]: errorRed.c500, | ||
}; | ||
|
||
const StyledChip = styled(Chip)<{ status: DRepStatus }>(({ theme, status }) => ({ | ||
backgroundColor: bgColor[status], | ||
color: textColor[status], | ||
border: `2px solid ${theme.palette.neutralWhite}`, | ||
fontSize: '0.75rem', | ||
textTransform: 'capitalize', | ||
})); |
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
128 changes: 128 additions & 0 deletions
128
govtool/frontend/src/components/molecules/AutomatedVotingCard.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,128 @@ | ||
import { Box, Divider } from "@mui/material"; | ||
|
||
import { Button, Typography } from "@atoms"; | ||
import { useScreenDimension, useTranslation } from "@hooks"; | ||
import { AutomatedVotingCardProps } from "./types"; | ||
import { Card } from "./Card"; | ||
import { primaryBlue } from "@/consts"; | ||
import { useModal } from "@/context"; | ||
|
||
export const AutomatedVotingCard = ({ | ||
description, | ||
inProgress, | ||
isConnected, | ||
isSelected, | ||
onClickDelegate, | ||
onClickInfo, | ||
title, | ||
votingPower, | ||
}: AutomatedVotingCardProps) => { | ||
const { isMobile, screenWidth } = useScreenDimension(); | ||
const { openModal } = useModal(); | ||
const { t } = useTranslation(); | ||
|
||
return ( | ||
<Card | ||
{...(inProgress && { | ||
variant: "warning", | ||
label: t("inProgress"), | ||
})} | ||
{...(isSelected && { | ||
variant: "primary", | ||
label: "Selected", | ||
})} | ||
sx={{ | ||
alignItems: "center", | ||
bgcolor: (theme) => `${theme.palette.neutralWhite}40`, | ||
boxShadow: `0px 4px 15px 0px ${primaryBlue.c100}`, | ||
display: "flex", | ||
flex: 1, | ||
flexDirection: screenWidth < 1440 ? "column" : "row", | ||
justifyContent: "space-between", | ||
mt: inProgress || isSelected ? 2 : 0, | ||
py: 2.25, | ||
}} | ||
> | ||
<Box | ||
sx={{ | ||
flex: 1, | ||
mb: screenWidth < 1440 ? 1.5 : 0, | ||
width: screenWidth < 1440 ? "100%" : "auto", | ||
}} | ||
> | ||
<Typography>{title}</Typography> | ||
<Typography fontWeight={400} sx={{ mt: 0.5 }} variant="body2"> | ||
{description} | ||
</Typography> | ||
</Box> | ||
<Divider | ||
flexItem | ||
orientation={screenWidth < 1440 ? "horizontal" : "vertical"} | ||
sx={{ ml: screenWidth < 1440 ? 0 : 1 }} | ||
variant={screenWidth < 1440 ? "fullWidth" : "middle"} | ||
/> | ||
<Box | ||
sx={{ | ||
alignContent: "flex-start", | ||
display: "flex", | ||
flexDirection: "column", | ||
px: screenWidth < 1440 ? 0 : 4.25, | ||
py: screenWidth < 1440 ? 1 : 0, | ||
width: screenWidth < 1440 ? "100%" : "auto", | ||
}} | ||
> | ||
<Typography color="neutralGray" fontWeight={500} variant="caption"> | ||
{t("dRepDirectory.votingPower")} | ||
</Typography> | ||
<Typography sx={{ display: "flex", flexDirection: "row", mt: 0.5 }}> | ||
{'₳ '} | ||
{votingPower} | ||
</Typography> | ||
</Box> | ||
<Divider | ||
flexItem | ||
orientation={screenWidth < 1440 ? "horizontal" : "vertical"} | ||
sx={{ mr: screenWidth < 1440 ? 0 : 1 }} | ||
variant={screenWidth < 1440 ? "fullWidth" : "middle"} | ||
/> | ||
<Box | ||
sx={{ | ||
display: "flex", | ||
flexDirection: "row", | ||
gap: 2.5, | ||
mt: screenWidth < 1440 ? 3 : 0, | ||
width: screenWidth < 1440 ? "100%" : "auto", | ||
}} | ||
> | ||
<Button | ||
// TODO handle button click | ||
onClick={onClickInfo} | ||
size={isMobile ? "medium" : "large"} | ||
sx={{ flex: screenWidth < 768 ? 1 : undefined }} | ||
variant="outlined" | ||
> | ||
{t("info")} | ||
</Button> | ||
{!isConnected | ||
? ( | ||
<Button | ||
onClick={() => openModal({ type: "chooseWallet" })} | ||
size={isMobile ? "medium" : "large"} | ||
sx={{ flex: screenWidth < 768 ? 1 : undefined }} | ||
> | ||
{t("connectToDelegate")} | ||
</Button> | ||
) | ||
: !isSelected && ( | ||
<Button | ||
onClick={onClickDelegate} | ||
size={isMobile ? "medium" : "large"} | ||
sx={{ flex: screenWidth < 768 ? 1 : undefined }} | ||
> | ||
{t("delegate")} | ||
</Button> | ||
)} | ||
</Box> | ||
</Card> | ||
); | ||
}; |
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,24 @@ | ||
import { useScreenDimension } from "@hooks"; | ||
import { FC } from "react"; | ||
import { Typography, PagePaddingBox, ContentBox } from "@/components/atoms"; | ||
|
||
interface PageTitleProps { | ||
title: string; | ||
} | ||
|
||
export const PageTitle: FC<PageTitleProps> = ({ title }) => { | ||
const { isMobile } = useScreenDimension(); | ||
|
||
return ( | ||
<PagePaddingBox | ||
borderBottom={(theme) => `1px solid ${theme.palette.neutralWhite}`} | ||
py={3} | ||
> | ||
<ContentBox> | ||
<Typography variant={isMobile ? "title1" : "headline5"}> | ||
{title} | ||
</Typography> | ||
</ContentBox> | ||
</PagePaddingBox> | ||
); | ||
}; |
Oops, something went wrong.