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