diff --git a/src/App.tsx b/src/App.tsx index d079f7d..5b8274b 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -7,6 +7,7 @@ import TagTemplate from "./templates/TagTemplate" import EntryTemplate from "./templates/EntryTemplate" import Settings from "./pages/settings" import About from "./pages/about" +import Diagnostics from "./pages/diagnostics" const queryClient = new QueryClient({ defaultOptions: { @@ -27,6 +28,7 @@ export default function App() { } /> } /> + } /> } /> } /> } /> diff --git a/src/containers/AppSidebar.tsx b/src/containers/AppSidebar.tsx index 7ddff84..a049389 100644 --- a/src/containers/AppSidebar.tsx +++ b/src/containers/AppSidebar.tsx @@ -1,57 +1,72 @@ -import { Info, FileText, Waypoints, SquareLibrary, Settings, ChevronRight } from "lucide-react" +import { + Info, + FileText, + Waypoints, + SquareLibrary, + Settings, + ChevronRight, + TestTubeDiagonal, + TestTube2, + FlaskConical, +} from "lucide-react" import { - Sidebar, - SidebarContent, - SidebarGroup, - SidebarGroupContent, - SidebarMenu, - SidebarMenuButton, - SidebarMenuItem, - SidebarHeader, - SidebarFooter, + Sidebar, + SidebarContent, + SidebarGroup, + SidebarGroupContent, + SidebarMenu, + SidebarMenuButton, + SidebarMenuItem, + SidebarHeader, + SidebarFooter, } from "@/components/ui/sidebar" import TagListSidebar from "@/components/TagListSidebar" import EntriesListSidebar from "@/components/EntriesListSidebar" import { Link } from "react-router" const footerMenu = [ - { - title: "About", - url: "/about", - icon: Info, - }, + { + title: "About", + url: "/about", + icon: Info, + }, + { + title: "Diagnostics", + url: "/diagnostics", + icon: FlaskConical, + }, - { - title: "Settings", - url: "/settings", - icon: Settings, - }, + { + title: "Settings", + url: "/settings", + icon: Settings, + }, ] export function AppSidebar() { - return ( - - - - - - - - Eólas - - - - - - - - - - {/* + return ( + + + + + + + + Eólas + + + + + + + + + + {/* @@ -62,38 +77,38 @@ export function AppSidebar() { */} - - - - - - - - - - - {footerMenu.map((item) => ( - - - - - {item.title} - + + + + + + + + + + + {footerMenu.map((item) => ( + + + + + {item.title} + - {/* + {/* {item.title} */} - - - ))} - - - - - - ) + + + ))} + + + + + + ) } diff --git a/src/pages/diagnostics.tsx b/src/pages/diagnostics.tsx new file mode 100644 index 0000000..d8ef2f4 --- /dev/null +++ b/src/pages/diagnostics.tsx @@ -0,0 +1,77 @@ +import { Button } from "@/components/ui/button" +import PageTemplate from "@/templates/PageTemplate" +import api from "@/api/eolas-api" +import { useQuery } from "@tanstack/react-query" +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from "@/components/ui/table" +import { Link } from "react-router" + +const PageBody = () => { + const { data, refetch, isLoading, error } = useQuery({ + queryKey: ["diagnostics_broken-link"], + queryFn: () => api.get("/diagnostics/broken-links").then((res) => res.data), + enabled: false, + }) + data?.data.sort((a, b) => a.source_entry_title.localeCompare(b.source_entry_title)) + + return ( +
+
+

Broken links

+ +
+ {isLoading ? ( +

Generating list...

+ ) : error ? ( +
+
+ Error fetching broken links +
{" "} +
+ ) : ( + data && ( + <> +

+ There are {data?.count} broken links. +

+ + + + Source entry + Broken link + + + + {data?.data.map((link, i) => ( + + + + {link?.source_entry_title.replace(/_/g, " ")}{" "} + {" "} + + {link?.broken_link_title} + + ))} + +
+ + ) + )} +
+ ) +} + +export default function Diagnostics() { + return } /> +}