diff --git a/components/plus/VouchesList.tsx b/components/plus/VouchesList.tsx new file mode 100644 index 000000000..65d854e1b --- /dev/null +++ b/components/plus/VouchesList.tsx @@ -0,0 +1,43 @@ +import { Button } from "@chakra-ui/button"; +import { Box, Grid } from "@chakra-ui/layout"; +import MyLink from "components/common/MyLink"; +import { Fragment, useState } from "react"; +import { PlusStatuses } from "services/plus"; +import { getFullUsername } from "utils/strings"; + +const VouchesList = ({ vouches }: { vouches: PlusStatuses }) => { + const [show, setShow] = useState(false); + + return ( + <> + + + {show && + vouches.map((vouch) => { + return ( + + + {getFullUsername(vouch.user)} + + to +{vouch.vouchTier} by + + {getFullUsername(vouch.voucher!)} + + + ); + })} + + + ); +}; + +export default VouchesList; diff --git a/hooks/plus.ts b/hooks/plus.ts index 53e537f91..163a4910a 100644 --- a/hooks/plus.ts +++ b/hooks/plus.ts @@ -28,6 +28,9 @@ export function usePlusHomePage() { plusStatusData: plusStatusData?.find( (status) => status.user.id === user?.id ), + vouchStatuses: plusStatusData + ?.filter((status) => status.voucher) + .sort((a, b) => a.vouchTier! - b.vouchTier!), vouchedPlusStatusData: plusStatusData?.find( (status) => status.voucher?.id === user?.id ), diff --git a/pages/plus/index.tsx b/pages/plus/index.tsx index 5aceaa45f..4cee2a976 100644 --- a/pages/plus/index.tsx +++ b/pages/plus/index.tsx @@ -13,6 +13,7 @@ import SubText from "components/common/SubText"; import Suggestion from "components/plus/Suggestion"; import SuggestionModal from "components/plus/SuggestionModal"; import VotingInfoHeader from "components/plus/VotingInfoHeader"; +import VouchesList from "components/plus/VouchesList"; import VouchModal from "components/plus/VouchModal"; import { useUser } from "hooks/common"; import { usePlusHomePage } from "hooks/plus"; @@ -25,6 +26,7 @@ const PlusHomePage = () => { const [user] = useUser(); const { plusStatusData, + vouchStatuses, suggestionsData, ownSuggestion, suggestionCounts, @@ -194,6 +196,13 @@ const PlusHomePage = () => { + {!getVotingRange().isHappening && + vouchStatuses && + vouchStatuses.length > 0 && ( + + + + )} {suggestionCounts.ONE + suggestionCounts.TWO + suggestionCounts.THREE === 0 ? ( No suggestions yet for this month