Skip to content

Commit 68a7173

Browse files
committed
feat(frontend): Added scan status indicator to audits card and table view
1 parent fd4c5c9 commit 68a7173

4 files changed

Lines changed: 60 additions & 0 deletions

File tree

apps/frontend/src/components/AuditsTable.module.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
@use "../global-styles/variables.module.scss";
22
@use "../global-styles/fonts.scss";
33

4+
@keyframes spin {
5+
from { transform: rotate(0deg); }
6+
to { transform: rotate(360deg); }
7+
}
8+
9+
.spinning {
10+
animation: spin 1s linear infinite;
11+
color: variables.$green;
12+
}
13+
414
.AuditsTable {
515
margin-top:variables.$spacing;
616
margin-bottom:calc(variables.$spacing*2);

apps/frontend/src/components/AuditsTable.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { StyledLabeledInput } from "./StyledLabeledInput";
1717
import { formatId } from "../utils";
1818
import { Link } from "react-router-dom";
1919
import { FaArrowDown, FaArrowUp } from "react-icons/fa";
20+
import { GrPowerCycle } from "react-icons/gr";
2021
import React from "react";
2122

2223
interface Audit {
@@ -57,6 +58,22 @@ export const AuditsTable = ({ audits, isLoading }: auditsTableProps) => {
5758
}
5859
const columns = useMemo<ColumnDef<Audit>[]>(
5960
() => [
61+
{
62+
accessorFn: (row) => row.scans[0]?.status,
63+
id: "status",
64+
header: "Status",
65+
cell: ({ getValue }) => {
66+
const status = getValue() as string | undefined;
67+
if (status === "processing") {
68+
return (
69+
<span role="img" aria-label="Processing">
70+
<GrPowerCycle className={styles.spinning} />
71+
</span>
72+
);
73+
}
74+
return null;
75+
},
76+
},
6077
{
6178
accessorKey: "name",
6279
header: "Name",

apps/frontend/src/routes/Audits.module.scss

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,38 @@
11
@use "../global-styles/variables.module.scss";
22
@use "../global-styles/fonts.scss";
33

4+
@keyframes spin {
5+
from { transform: rotate(0deg); }
6+
to { transform: rotate(360deg); }
7+
}
8+
9+
.spinning {
10+
animation: spin 1s linear infinite;
11+
}
12+
13+
.processing-icon {
14+
display: flex;
15+
margin-left: auto;
16+
17+
svg {
18+
color: variables.$green;
19+
}
20+
}
21+
422
.Audits {
523
h2 {
624
margin-bottom: calc(variables.$spacing);
725
line-height: 1.1em;
826
svg {
927
color: variables.$black;
1028
}
29+
.processing-icon svg {
30+
color: variables.$green;
31+
min-width: 17px;
32+
min-height: 17px;
33+
width: 17px;
34+
height: 17px;
35+
}
1136
}
1237

1338
.audits-header {

apps/frontend/src/routes/Audits.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import * as API from "aws-amplify/api";
44
import { Link, useNavigate } from "react-router-dom";
55
import { StyledButton } from "#src/components/StyledButton.tsx";
66
import { LuClipboard, LuClipboardPlus, LuZap } from "react-icons/lu";
7+
import { GrPowerCycle } from "react-icons/gr";
78
import { Card } from "#src/components/Card.tsx";
89
const apiClient = API.generateClient();
910
import styles from "./Audits.module.scss";
@@ -25,6 +26,7 @@ export interface Scan {
2526
};
2627
percentage: number;
2728
updated_at: string;
29+
status: string;
2830
}
2931
/*
3032
export interface Audit {
@@ -73,6 +75,7 @@ export const Audits = () => {
7375
count
7476
}
7577
}
78+
status
7679
percentage
7780
updated_at
7881
}
@@ -182,6 +185,11 @@ export const Audits = () => {
182185
<h2>
183186
<LuClipboard className="icon-small" />
184187
{row.name}
188+
{row.scans[0]?.status === "processing" && (
189+
<span role="img" aria-label="Processing" className={styles["processing-icon"]}>
190+
<GrPowerCycle className={`icon-small ${styles.spinning}`} />
191+
</span>
192+
)}
185193
</h2>
186194
</Link>
187195
<div className={styles["dataRow-list"]}>

0 commit comments

Comments
 (0)