1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41import { createFileRoute, Link } from '@tanstack/react-router'
import AuditDashboard from '../../components/AuditDashboard';
import { fetchAllAudits } from '../../api/api';
import Footer from '../../components/Footer';
export const Route = createFileRoute('/audits/')({
component: RouteComponent,
})
const NewAudit: React.FC = () => {
if (!fetchAllAudits()) {
return (
<section>
<h2>Get Started</h2>
<Link to="/audits/new">Build Audit</Link>
</section>
)
}
return (
<nav aria-label="Audits Page">
<Link to="/audits/new">New Audit</Link>
</nav>
);
}
function RouteComponent() {
return (
<>
<main>
<h1>Audits</h1>
<NewAudit />
<article>
<AuditDashboard />
</article>
</main>
</>
)
}