"use client"; import { ActionButton } from "@/components/ui/action-button"; import { FullPageSpinner } from "@/components/ui/full-page-spinner"; import { toast } from "@/components/ui/sonner"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "@/components/ui/table"; import { useQuery, useQueryClient } from "@tanstack/react-query"; import { RefreshCw, Trash2 } from "lucide-react"; import { useTranslation } from "react-i18next"; import { useDeleteBookmark, useRecrawlBookmark, } from "@karakeep/shared-react/hooks/bookmarks"; import { useTRPC } from "@karakeep/shared-react/trpc"; export default function BrokenLinksPage() { const api = useTRPC(); const { t } = useTranslation(); const queryClient = useQueryClient(); const { data, isPending } = useQuery( api.bookmarks.getBrokenLinks.queryOptions(), ); const { mutate: deleteBookmark, isPending: isDeleting } = useDeleteBookmark({ onSuccess: () => { toast({ description: t("toasts.bookmarks.deleted"), }); queryClient.invalidateQueries(api.bookmarks.getBrokenLinks.pathFilter()); }, onError: () => { toast({ description: t("common.something_went_wrong"), variant: "destructive", }); }, }); const { mutate: recrawlBookmark, isPending: isRecrawling } = useRecrawlBookmark({ onSuccess: () => { toast({ description: t("toasts.bookmarks.refetch"), }); queryClient.invalidateQueries( api.bookmarks.getBrokenLinks.pathFilter(), ); }, onError: () => { toast({ description: t("common.something_went_wrong"), variant: "destructive", }); }, }); return (
No broken links found
)} {!isPending && data && data.bookmarks.length > 0 && (