Skip to content

Commit

Permalink
Further changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JanJaroszczak committed Mar 24, 2024
1 parent db43b31 commit 9f74b25
Show file tree
Hide file tree
Showing 34 changed files with 507 additions and 433 deletions.
3 changes: 3 additions & 0 deletions govtool/frontend/public/icons/Separator.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const ExternalModalButton = ({
}}
disableRipple
variant="text"
data-testid="external-modal-button"
>
<Typography variant="body1" fontWeight={500} color="primary">
{label}
Expand Down
13 changes: 11 additions & 2 deletions govtool/frontend/src/components/atoms/Radio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,17 @@ export const Radio = ({ ...props }: RadioProps) => {
p={isChecked ? "2px" : 0}
border={isChecked ? 2 : 0}
borderColor={isChecked ? "specialCyanBorder" : undefined}
sx={[{ "&:hover": { color: "blue", cursor: "pointer" } }]}
boxShadow="0px 1px 2px 0px rgba(0, 51, 173, 0.08), 0px 1px 6px 1px rgba(0, 51, 173, 0.15)"
sx={[
{
boxShadow:
"0px 1px 2px 0px rgba(0, 51, 173, 0.08), 0px 1px 6px 1px rgba(0, 51, 173, 0.15)",

"&:hover": {
color: "blue",
cursor: disabled ? "default" : "pointer",
},
},
]}
>
<input
type="radio"
Expand Down
9 changes: 7 additions & 2 deletions govtool/frontend/src/components/atoms/SliderArrow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import ChevronRightIcon from "@mui/icons-material/ChevronRight";

import { theme } from "@/theme";

interface Props {
interface SliderArrowProps {
disabled: boolean;
onClick: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
left?: boolean;
}

export const SliderArrow = ({ disabled, onClick, left }: Props) => {
export const SliderArrow = ({ disabled, onClick, left }: SliderArrowProps) => {
const {
palette: { primaryBlue, arcticWhite, lightBlue },
} = theme;
Expand All @@ -27,6 +27,11 @@ export const SliderArrow = ({ disabled, onClick, left }: Props) => {
justifyContent: "center",
alignItems: "center",
cursor: "pointer",
transition: "0.3s",

"&:hover": {
boxShadow: disabled ? 0 : 2,
},
}}
>
<ChevronRightIcon
Expand Down
57 changes: 57 additions & 0 deletions govtool/frontend/src/components/molecules/Breadcrumbs.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { NavLink, To } from "react-router-dom";
import { Box } from "@mui/material";

import { ICONS } from "@consts";
import { useScreenDimension, useTranslation } from "@hooks";
import { Typography } from "@atoms";

type BreadcrumbsProps = {
elementOne: string;
elementOnePath: To;
elementTwo: string;
isDataMissing: boolean;
};

export const Breadcrumbs = ({
elementOne,
elementOnePath,
elementTwo,
isDataMissing,
}: BreadcrumbsProps) => {
const { t } = useTranslation();
const { isMobile } = useScreenDimension();

return (
<Box
sx={{
display: "flex",
alignItems: "center",
margin: `2px 0 ${isMobile ? "44px" : "24px"}`,
}}
>
<NavLink to={elementOnePath} style={{ textDecorationColor: "#0033AD" }}>
<Typography
color="primary"
variant="caption"
sx={{
whiteSpace: "nowrap",
}}
>
{elementOne}
</Typography>
</NavLink>
<img src={ICONS.separator} alt="separator" style={{ margin: "0 6px" }} />
<Typography
variant="caption"
sx={{
fontWeight: 500,
whiteSpace: "nowrap",
overflow: "hidden",
textOverflow: "ellipsis",
}}
>
{isDataMissing ? t("govActions.dataMissing") : elementTwo}
</Typography>
</Box>
);
};
3 changes: 1 addition & 2 deletions govtool/frontend/src/components/molecules/DataActionsBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ import { Dispatch, FC, SetStateAction } from "react";
import { Box, InputBase } from "@mui/material";
import Search from "@mui/icons-material/Search";

import { GovernanceActionsFilters, GovernanceActionsSorting } from ".";
import { GovernanceActionsFilters, GovernanceActionsSorting } from "@molecules";
import { OrderActionsChip } from "./OrderActionsChip";
import { ClickOutside } from "../atoms";

import { theme } from "@/theme";

type DataActionsBarProps = {
Expand Down
25 changes: 14 additions & 11 deletions govtool/frontend/src/components/molecules/GovernanceActionCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Button } from "@atoms";
import {
GovernanceActionCardElement,
GovernanceActionCardHeader,
GovernanceActionCardStatePill,
GovernanceActionsDatesBox,
} from "@molecules";

Expand All @@ -13,6 +14,7 @@ import {
formatDisplayDate,
getFullGovActionId,
getProposalTypeLabel,
getProposalTypeNoEmptySpaces,
} from "@utils";

const mockedLongText =
Expand All @@ -31,17 +33,17 @@ interface ActionTypeProps
| "txHash"
| "index"
> {
onClick?: () => void;
// inProgress?: boolean;
txHash: string;
index: number;
isDataMissing: boolean;
onClick?: () => void;
inProgress?: boolean;
}

export const GovernanceActionCard: FC<ActionTypeProps> = ({ ...props }) => {
const {
type,
// inProgress = false,
inProgress = false,
expiryDate,
onClick,
createdDate,
Expand All @@ -53,10 +55,6 @@ export const GovernanceActionCard: FC<ActionTypeProps> = ({ ...props }) => {
const { t } = useTranslation();

const govActionId = getFullGovActionId(txHash, index);
const proposalTypeNoEmptySpaces = getProposalTypeLabel(type).replace(
/ /g,
"",
);

return (
<Box
Expand All @@ -75,16 +73,21 @@ export const GovernanceActionCard: FC<ActionTypeProps> = ({ ...props }) => {
...(isDataMissing && {
border: "1px solid #F6D5D5",
}),
...(inProgress && {
border: "1px solid #FFCBAD",
}),
}}
data-testid={`govaction-${proposalTypeNoEmptySpaces}-card`}
data-testid={`govaction-${getProposalTypeNoEmptySpaces(type)}-card`}
>
{inProgress && <GovernanceActionCardStatePill variant="inProgress" />}
<Box
sx={{
padding: "40px 24px 0",
}}
>
<GovernanceActionCardHeader
title={mockedLongText}
// TODO: Add real title from props when BE is ready
title="Fund our project"
isDataMissing={isDataMissing}
/>
<GovernanceActionCardElement
Expand All @@ -98,7 +101,7 @@ export const GovernanceActionCard: FC<ActionTypeProps> = ({ ...props }) => {
label={t("govActions.governanceActionType")}
text={getProposalTypeLabel(type)}
textVariant="pill"
dataTestId={`${proposalTypeNoEmptySpaces}-type`}
dataTestId={`${getProposalTypeNoEmptySpaces(type)}-type`}
isSliderCard
/>
<GovernanceActionsDatesBox
Expand All @@ -125,7 +128,7 @@ export const GovernanceActionCard: FC<ActionTypeProps> = ({ ...props }) => {
>
<Button
onClick={onClick}
variant="contained"
variant={inProgress ? "outlined" : "contained"}
size="large"
sx={{
width: "100%",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import InfoOutlinedIcon from "@mui/icons-material/InfoOutlined";
import { Tooltip, Typography } from "@atoms";
import { useTranslation } from "@hooks";

const mockedLongText =
"Lorem ipsum dolor sit, amet consectetur adipisicing elit. Sit, distinctio culpa minus eaque illo quidem voluptates quisquam mollitia consequuntur ex, sequi saepe? Ad ex adipisci molestiae sed.";

type GovernanceActionCardHeaderProps = {
title: string;
isDataMissing: boolean;
Expand All @@ -25,6 +22,7 @@ export const GovernanceActionCardHeader = ({
alignItems: "center",
mb: "20px",
}}
data-testid="governance-action-card-header"
>
<Typography
sx={{
Expand All @@ -43,8 +41,8 @@ export const GovernanceActionCardHeader = ({
</Typography>
{isDataMissing && (
<Tooltip
heading="Data Missing"
paragraphOne={mockedLongText}
heading={t("govActions.dataMissing")}
paragraphOne={t("govActions.dataMissingTooltipExplanation")}
placement="bottom-end"
arrow
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const GovernanceActionCardStatePill = ({
return (
<Box
sx={{
// TODO: To decide on final state pill design
position: "absolute",
top: -15,
right: 30,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const GovernanceActionDetailsCardHeader = ({
alignItems: "center",
mb: 2,
}}
data-testid="governance-action-details-card-header"
>
<Box
sx={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ import { Box } from "@mui/material";
import { IconLink, Typography } from "@atoms";
import { useScreenDimension, useTranslation } from "@hooks";

// TODO: When BE is ready, pass links as props
const LINKS = [
"https://www.google.com",
"https://www.google.com",
"https://www.google.com",
"https://www.google.com",
"https://docs.sanchogov.tools/support/get-help-in-discord",
"https://docs.sanchogov.tools/how-to-use-the-govtool/prerequsites",
"https://docs.sanchogov.tools/faqs",
"https://docs.sanchogov.tools/",
];

export const GovernanceActionDetailsCardLinks = () => {
Expand All @@ -27,6 +28,7 @@ export const GovernanceActionDetailsCardLinks = () => {
whiteSpace: "nowrap",
mb: 2,
}}
data-testid="supporting-links"
>
{t("govActions.supportingLinks")}
</Typography>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const GovernanceActionDetailsCardOnChainData = ({
const { t } = useTranslation();

return (
<Box mb="32px">
<Box mb="32px" data-testid="governance-action-on-chain-data">
<Box
sx={{
display: "flex",
Expand All @@ -40,6 +40,7 @@ export const GovernanceActionDetailsCardOnChainData = ({
</Box>
{data.map(({ label, content }) => (
<Box
key={label}
sx={{
display: "flex",
alignItems: "center",
Expand All @@ -56,8 +57,7 @@ export const GovernanceActionDetailsCardOnChainData = ({
textOverflow: "ellipsis",
}}
>
{label}
:
{label}:
</Typography>
<Typography
sx={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export const GovernanceActionsDatesBox = ({
fontSize: isFontSizeSmaller ? 11 : 12,
fontWeight: 300,
}}
data-testid="submission-date"
>
<Trans
i18nKey="govActions.submittedDateWithEpoch"
Expand Down Expand Up @@ -92,6 +93,7 @@ export const GovernanceActionsDatesBox = ({
fontSize: isFontSizeSmaller ? 11 : 12,
fontWeight: 300,
}}
data-testid="expiry-date"
>
<Trans
i18nKey="govActions.expiresDateWithEpoch"
Expand Down
Loading

0 comments on commit 9f74b25

Please sign in to comment.