-
Notifications
You must be signed in to change notification settings - Fork 1
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 #135 from IntersectMBO/feature/my-actions-page-UI
Feature: My actions page UI and mocked data
- Loading branch information
Showing
32 changed files
with
1,087 additions
and
269 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
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.
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,35 @@ | ||
import React, { Suspense } from "react"; | ||
|
||
import { unstable_setRequestLocale } from "next-intl/server"; | ||
import { Footer, TopNav, GovernanceActions } from "@organisms"; | ||
import { Loading } from "@molecules"; | ||
import { decodeUserToken, getGovernanceActions } from "@/lib/api"; | ||
import { ContentWrapper } from "@atoms"; | ||
|
||
export default async function GovernanceActionsPage({ | ||
params: { locale }, | ||
searchParams, | ||
}) { | ||
unstable_setRequestLocale(locale); // Sets the locale for the request. Use cautiously due to its unstable nature. | ||
const user = await decodeUserToken(); | ||
|
||
const actions = await getGovernanceActions({ | ||
search: searchParams?.search, | ||
govActionType: searchParams?.govActionType, | ||
status: searchParams?.status, | ||
sortBy: searchParams?.sortBy, | ||
userId: user?.userId, | ||
}); | ||
|
||
return ( | ||
<main> | ||
<TopNav /> | ||
<ContentWrapper> | ||
<Suspense fallback={<Loading />}> | ||
<GovernanceActions actions={actions} /> | ||
</Suspense> | ||
</ContentWrapper> | ||
<Footer /> | ||
</main> | ||
); | ||
} |
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,49 @@ | ||
import { Box, Typography } from "@mui/material"; | ||
import { GovActionStatus } from "../organisms"; | ||
|
||
export const GovActionStatusPill = ({ | ||
status, | ||
width, | ||
maxWidth, | ||
}: { | ||
status: GovActionStatus; | ||
width?: number; | ||
maxWidth?: number; | ||
}) => { | ||
const STATUS = status.toLowerCase(); | ||
return ( | ||
<Box | ||
py={0.75} | ||
px={2.25} | ||
border={1} | ||
borderColor={ | ||
STATUS === "voted" | ||
? "#C0E4BA" | ||
: STATUS === "unvoted" | ||
? "#EDACAC" | ||
: "#99ADDE" | ||
} | ||
bgcolor={ | ||
STATUS === "voted" | ||
? "#F0F9EE" | ||
: STATUS === "unvoted" | ||
? "#FBEBEB" | ||
: "#E6EBF7" | ||
} | ||
borderRadius={100} | ||
textAlign="center" | ||
minWidth="50px" | ||
maxWidth={maxWidth ? `${maxWidth}px` : "auto"} | ||
width={width ? `${width}px` : "auto"} | ||
> | ||
<Typography | ||
textTransform="uppercase" | ||
fontSize={12} | ||
fontWeight={400} | ||
lineHeight="16px" | ||
> | ||
{status} | ||
</Typography> | ||
</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
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
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
26 changes: 26 additions & 0 deletions
26
frontend/src/components/organisms/GovActionTable/GovActionTable.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,26 @@ | ||
import React from "react"; | ||
import { Grid } from "@mui/material"; | ||
import { GovernanceActionTableI } from "../types"; | ||
import { GovActionTableRow } from "./GovActionTableRow"; | ||
|
||
interface Props { | ||
govActions: GovernanceActionTableI[]; | ||
} | ||
|
||
export const GovActionTable = ({ govActions }: Props) => { | ||
return ( | ||
<Grid container direction="column" gap={0}> | ||
{govActions.map((data, index) => { | ||
return ( | ||
<Grid | ||
key={index} | ||
item | ||
data-testid={`governance-actions-${data.gov_action_proposal_id}-card`} | ||
> | ||
<GovActionTableRow govActions={data} /> | ||
</Grid> | ||
); | ||
})} | ||
</Grid> | ||
); | ||
}; |
Oops, something went wrong.