-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update BenchmarkListElement to show current task assignment status
- Loading branch information
Showing
6 changed files
with
116 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
import { createTRPCReact } from "@trpc/react-query"; | ||
import { | ||
createTRPCReact, | ||
type inferReactQueryProcedureOptions, | ||
} from "@trpc/react-query"; | ||
import type { inferRouterInputs, inferRouterOutputs } from "@trpc/server"; | ||
import { AppRouter } from "@/backend/routers/_app"; | ||
|
||
export type ReactQueryOptions = inferReactQueryProcedureOptions<AppRouter>; | ||
export type RouterInputs = inferRouterInputs<AppRouter>; | ||
export type RouterOutputs = inferRouterOutputs<AppRouter>; | ||
|
||
export const trpc = createTRPCReact<AppRouter>(); |
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,55 @@ | ||
import { Box, Button, Stack } from "@mui/material"; | ||
import { BenchmarkWithAssignees } from "@/types/global"; | ||
import { format } from "date-fns"; | ||
|
||
import $button from "@/components/design_system/button/Button.module.css"; | ||
|
||
const BenchmarkAssignees = ({ | ||
benchmark, | ||
onAssign, | ||
}: { | ||
benchmark: BenchmarkWithAssignees; | ||
onAssign: () => void; | ||
}) => { | ||
const { assignees, due_date, trial_count } = benchmark; | ||
|
||
return ( | ||
<> | ||
{assignees.length === 0 && ( | ||
<Button | ||
className={$button.secondary} | ||
onClick={() => onAssign()} | ||
sx={{ | ||
paddingTop: ".4rem !important", | ||
paddingBottom: ".4rem !important", | ||
paddingLeft: ".4rem !important", | ||
paddingRight: ".4rem !important", | ||
}} | ||
> | ||
Assign staff | ||
</Button> | ||
)} | ||
{!!assignees.length && ( | ||
<Stack direction="row"> | ||
<Stack> | ||
{assignees.map((u) => ( | ||
<Box key={u.user_id} fontWeight="bold" textAlign="left"> | ||
{u.first_name} {u.last_name} | ||
</Box> | ||
))} | ||
{due_date && <Box>Until {format(new Date(due_date), "MMM d")}</Box>} | ||
{!due_date && !!trial_count && <Box>{trial_count} times</Box>} | ||
{!due_date && !trial_count && <Box>Until unassigned</Box>} | ||
</Stack> | ||
<Box> | ||
<Button className={$button.tertiary} onClick={() => onAssign()}> | ||
Change | ||
</Button> | ||
</Box> | ||
</Stack> | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
export default BenchmarkAssignees; |
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