Skip to content

Commit

Permalink
fix(dashboard): misc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
seaerchin committed Oct 3, 2022
1 parent b274b3b commit ec35f9f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/layouts/ReviewRequest/Dashboard.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const Template = ReviewRequestDashboard

export const Playground: Story<ReviewRequestDashboardProps> = Template.bind({})
Playground.args = {
siteName: "MOCK_ADMINS",
reviewRequestedTime: new Date(),
reviewUrl: "Copied to your clipboard kekw",
title: "Update STCCED hyperlink, customs duty",
requestor: "seaerchin",
Expand Down
30 changes: 20 additions & 10 deletions src/layouts/ReviewRequest/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,29 @@ import {
PopoverContent,
PopoverBody,
PopoverArrow,
IconButton,
} from "@chakra-ui/react"
import { IconButton } from "@opengovsg/design-system-react"
import {
MenuDropdownButton,
MenuDropdownItem,
} from "components/MenuDropdownButton"
import { useState } from "react"
import { BiLink } from "react-icons/bi"
import { BiLink, BiPlus } from "react-icons/bi"

import { extractInitials, getDateTimeFromUnixTime } from "utils"

import { RequestOverview, EditedItemProps } from "./components/RequestOverview"

export interface ReviewRequestDashboardProps {
siteName: string
reviewUrl: string
title: string
requestor: string
reviewers: string[]
reviewRequestedTime: Date
changedItems: EditedItemProps[]
}
export const ReviewRequestDashboard = ({
siteName,
reviewRequestedTime,
reviewUrl,
title,
requestor,
Expand Down Expand Up @@ -89,7 +89,7 @@ export const ReviewRequestDashboard = ({
<SecondaryDetails
requestor={requestor}
reviewers={reviewers}
reviewRequestedTime={new Date()}
reviewRequestedTime={reviewRequestedTime}
/>
</VStack>
<Box pl="9.25rem" pr="2rem">
Expand Down Expand Up @@ -133,9 +133,7 @@ const SecondaryDetails = ({
reviewers,
reviewRequestedTime,
}: SecondaryDetailsProps) => {
const { date, time } = getDateTimeFromUnixTime(
reviewRequestedTime.getTime() / 1000
)
const { date, time } = getDateTimeFromUnixTime(reviewRequestedTime.getTime())
return (
<VStack spacing="0.5rem" align="flex-start">
<Text textStyle="caption-2" textColor="text.helper">
Expand All @@ -146,12 +144,13 @@ const SecondaryDetails = ({
Reviewers
</Text>
<Box>
{reviewers.map((name) => {
{reviewers.map((name, index) => {
const initials = extractInitials(name)
return (
<Avatar
zIndex={reviewers.length - index}
border="1px solid white"
mr="-0.25rem"
ml="-0.25rem"
bg="primary.100"
name={initials}
textStyle="caption-1"
Expand All @@ -160,6 +159,17 @@ const SecondaryDetails = ({
/>
)
})}
{/* NOTE: Not using design system IconButton as we require sm size */}
<IconButton
icon={<BiPlus />}
aria-label="Add Reviewer"
variant="outline"
borderRadius="50%"
fontSize="1rem"
size="sm"
ml="-0.25rem"
bg="blue.50"
/>
</Box>
</HStack>
</VStack>
Expand Down

0 comments on commit ec35f9f

Please sign in to comment.