Skip to content

Commit

Permalink
Add empty state for no benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
hieungo89 committed Nov 3, 2023
1 parent dd7d070 commit ddcd7c2
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/components/table/table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,9 @@ export default function EnhancedTable<
}}
gap={1.5}
>
<Image src={emptyState} alt="empty roster image" width={250} />
<p style={{ fontWeight: "semibold" }}>You have no students yet</p>
<p style={{ color: "var(--grey-20)" }}>
<Image src={emptyState} alt="empty roster" width={250} />
<p>You have no students yet</p>
<p style={{ color: "var(--grey-20)", textAlign: "center" }}>
Start building your class roster by adding a student.
</p>
<button
Expand Down
43 changes: 34 additions & 9 deletions src/pages/benchmarks/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,49 @@ import React from "react";
import TaskCard from "@/components/taskCard/taskCard";
import { trpc } from "@/client/lib/trpc";
import $typo from "@/styles/Typography.module.css";
import { Container, Box } from "@mui/material";
import Image from "next/image";
import noBenchmarks from "../../public/img/no-benchmarks.png";

function Benchmarks() {
const { data: tasks, isLoading } = trpc.para.getMyTasks.useQuery();
console.log("tasks ", tasks);

if (isLoading) {
return <div>Loading...</div>;
}

return (
<ul>
{tasks?.map((task) => {
return (
<li key={task.task_id} className={$typo.noDecoration}>
<TaskCard task={task} />
</li>
);
})}
</ul>
<>
{tasks?.length === 0 ? (
<Container sx={{ marginTop: "4rem" }}>
<Box
sx={{
display: "flex",
flexDirection: "column",
alignItems: "center",
}}
gap={1.5}
>
<Image src={noBenchmarks} alt="empty benchmark" width={250} />
<p>No assigned benchmarks yet!</p>
<p style={{ color: "var(--grey-20)", textAlign: "center" }}>
Contact your case manager for your assignment.
</p>
</Box>
</Container>
) : (
<ul>
{tasks?.map((task) => {
return (
<li key={task.task_id} className={$typo.noDecoration}>
<TaskCard task={task} />
</li>
);
})}
</ul>
)}
</>
);
}

Expand Down
Binary file added src/public/img/no-benchmarks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ddcd7c2

Please sign in to comment.