feat: add public chat links settings page

This commit is contained in:
CREDO23 2026-02-02 16:40:11 +02:00
parent ea2dd20a78
commit 67f797232e
4 changed files with 29 additions and 2 deletions

View file

@ -1,7 +1,7 @@
"use client";
import { useAtomValue } from "jotai";
import { Globe, Info } from "lucide-react";
import { AlertCircle, Globe, Info } from "lucide-react";
import { useCallback, useMemo, useState } from "react";
import { toast } from "sonner";
import { deletePublicChatSnapshotMutationAtom } from "@/atoms/public-chat-snapshots/public-chat-snapshots-mutation.atoms";
@ -23,7 +23,7 @@ export function PublicChatSnapshotsManager({
const [deletingId, setDeletingId] = useState<number | undefined>();
// Data fetching
const { data: snapshotsData, isLoading, refetch } = useAtomValue(publicChatSnapshotsAtom);
const { data: snapshotsData, isLoading, isError, refetch } = useAtomValue(publicChatSnapshotsAtom);
// Permissions
const { data: access } = useAtomValue(myAccessAtom);
@ -84,6 +84,18 @@ export function PublicChatSnapshotsManager({
);
}
// Error state
if (isError) {
return (
<Alert variant="destructive">
<AlertCircle className="h-4 w-4" />
<AlertDescription>
Failed to load public chat links. Please try again later.
</AlertDescription>
</Alert>
);
}
// Permission denied
if (!canView) {
return (