refactor(public-chat-snapshots-manager): extract info alert into a constant for improved readability and reuse

This commit is contained in:
Anish Sarkar 2026-07-24 01:13:46 +05:30
parent 9ec89f94de
commit 81e8c353f0

View file

@ -17,6 +17,16 @@ interface PublicChatSnapshotsManagerProps {
workspaceId: number;
}
const infoAlert = (
<Alert>
<Info />
<AlertDescription>
Public chats allow anyone with the URL to view a snapshot of a chat. They do not update when
the original chat changes.
</AlertDescription>
</Alert>
);
export function PublicChatSnapshotsManager({
workspaceId: _workspaceId,
}: PublicChatSnapshotsManagerProps) {
@ -81,14 +91,7 @@ export function PublicChatSnapshotsManager({
if (isLoading) {
return (
<div className="space-y-4 md:space-y-5">
<Alert>
<Info />
<AlertDescription>
<div className="flex min-h-[1.625em] items-center">
<Skeleton className="h-4 w-60 bg-accent-foreground/15" />
</div>
</AlertDescription>
</Alert>
{infoAlert}
{/* Cards grid skeleton */}
<div className="grid gap-3 grid-cols-1 sm:grid-cols-2">
@ -135,13 +138,7 @@ export function PublicChatSnapshotsManager({
return (
<div className="space-y-4 md:space-y-5">
<Alert>
<Info />
<AlertDescription>
Public chats allow anyone with the URL to view a snapshot of a chat. They do not update
when the original chat changes.
</AlertDescription>
</Alert>
{infoAlert}
<PublicChatSnapshotsList
snapshots={snapshots}