2026-06-01 21:44:29 +07:00
|
|
|
|
import {
|
|
|
|
|
|
AlertCircle,
|
|
|
|
|
|
CheckCircle2,
|
2026-06-02 12:17:51 +07:00
|
|
|
|
ChevronDown,
|
|
|
|
|
|
ChevronUp,
|
2026-06-01 21:44:29 +07:00
|
|
|
|
Image as ImageIcon,
|
|
|
|
|
|
Pencil,
|
|
|
|
|
|
RotateCw,
|
|
|
|
|
|
Smile,
|
|
|
|
|
|
Trash2,
|
|
|
|
|
|
} from "lucide-react";
|
|
|
|
|
|
import { Fragment, useMemo, useState } from "react";
|
2026-06-03 03:21:20 +07:00
|
|
|
|
import { parseMetadata } from "../../../entities/message/types";
|
2026-06-01 16:42:36 +07:00
|
|
|
|
import type { MessageRecord } from "../../../shared/api/client";
|
|
|
|
|
|
import { Badge, Button, Skeleton } from "../../../shared/ui";
|
2026-05-14 21:01:57 +07:00
|
|
|
|
|
2026-06-01 17:23:46 +07:00
|
|
|
|
const CUSTOM_EMOJI_REGEX = /<(a)?:([a-zA-Z0-9_]+):(\d+)>/g;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Renders message content with Discord custom emojis displayed as images
|
|
|
|
|
|
* instead of raw text like `<:name:id>`.
|
|
|
|
|
|
*/
|
|
|
|
|
|
function renderContentWithCustomEmojis(content: string): React.ReactNode {
|
|
|
|
|
|
const parts: React.ReactNode[] = [];
|
|
|
|
|
|
const regex = new RegExp(CUSTOM_EMOJI_REGEX.source, "g");
|
|
|
|
|
|
let lastIndex = 0;
|
|
|
|
|
|
let match: RegExpExecArray | null;
|
|
|
|
|
|
|
|
|
|
|
|
while ((match = regex.exec(content)) !== null) {
|
|
|
|
|
|
// Text before the emoji
|
|
|
|
|
|
if (match.index > lastIndex) {
|
|
|
|
|
|
parts.push(content.slice(lastIndex, match.index));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const [, animated, name, id] = match;
|
|
|
|
|
|
const ext = animated ? "gif" : "png";
|
|
|
|
|
|
const url = `https://cdn.discordapp.com/emojis/${id}.${ext}?size=128`;
|
|
|
|
|
|
|
|
|
|
|
|
parts.push(
|
|
|
|
|
|
<img
|
|
|
|
|
|
key={`${id}-${match.index}`}
|
|
|
|
|
|
src={url}
|
|
|
|
|
|
alt={name}
|
|
|
|
|
|
className="inline-block h-[22px] w-[22px] align-middle object-contain"
|
|
|
|
|
|
loading="lazy"
|
|
|
|
|
|
draggable={false}
|
|
|
|
|
|
title={`:${name}:`}
|
|
|
|
|
|
/>,
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
lastIndex = regex.lastIndex;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Remaining text after last emoji
|
|
|
|
|
|
if (lastIndex < content.length) {
|
|
|
|
|
|
parts.push(content.slice(lastIndex));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// If no emojis were found, just return the raw content
|
|
|
|
|
|
if (parts.length === 0) {
|
|
|
|
|
|
return content;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return <Fragment>{parts}</Fragment>;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-01 16:42:36 +07:00
|
|
|
|
interface MessageCardProps {
|
2026-05-14 21:01:57 +07:00
|
|
|
|
message: MessageRecord;
|
2026-06-01 16:42:36 +07:00
|
|
|
|
onReanalyze: (id: string) => Promise<void>;
|
2026-06-02 12:17:51 +07:00
|
|
|
|
compact?: boolean;
|
2026-06-01 16:42:36 +07:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-30 01:02:51 +07:00
|
|
|
|
function parseStringList(value?: string | null): string[] {
|
|
|
|
|
|
if (!value) return [];
|
|
|
|
|
|
try {
|
|
|
|
|
|
const parsed = JSON.parse(value) as unknown;
|
2026-06-01 21:44:29 +07:00
|
|
|
|
return Array.isArray(parsed)
|
|
|
|
|
|
? parsed.filter((item): item is string => typeof item === "string")
|
|
|
|
|
|
: [];
|
2026-05-30 01:02:51 +07:00
|
|
|
|
} catch {
|
2026-06-01 21:44:29 +07:00
|
|
|
|
return value
|
|
|
|
|
|
.split(",")
|
|
|
|
|
|
.map((item) => item.trim())
|
|
|
|
|
|
.filter(Boolean);
|
2026-05-30 01:02:51 +07:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-30 16:13:09 +07:00
|
|
|
|
function aiVariant(status: string) {
|
|
|
|
|
|
if (status === "clean") return "success";
|
|
|
|
|
|
if (status === "flagged" || status === "error") return "destructive";
|
|
|
|
|
|
return "secondary";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function severityColor(severity: string) {
|
|
|
|
|
|
switch (severity) {
|
2026-06-01 21:44:29 +07:00
|
|
|
|
case "critical":
|
2026-06-03 03:18:04 +07:00
|
|
|
|
return "bg-red-100 text-red-700 border-red-200";
|
2026-06-01 21:44:29 +07:00
|
|
|
|
case "high":
|
2026-06-03 03:18:04 +07:00
|
|
|
|
return "bg-orange-100 text-orange-700 border-orange-200";
|
2026-06-01 21:44:29 +07:00
|
|
|
|
case "medium":
|
2026-06-03 03:18:04 +07:00
|
|
|
|
return "bg-yellow-100 text-yellow-700 border-yellow-200";
|
2026-06-01 21:44:29 +07:00
|
|
|
|
case "low":
|
2026-06-03 03:18:04 +07:00
|
|
|
|
return "bg-blue-100 text-blue-700 border-blue-200";
|
2026-06-01 21:44:29 +07:00
|
|
|
|
default:
|
|
|
|
|
|
return "bg-muted text-muted-foreground border-border";
|
2026-05-30 16:13:09 +07:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function formatTimeAgo(ts: number): string {
|
|
|
|
|
|
const seconds = Math.floor((Date.now() - ts) / 1000);
|
|
|
|
|
|
if (seconds < 60) return `${seconds}s ago`;
|
|
|
|
|
|
if (seconds < 3600) return `${Math.floor(seconds / 60)}m ago`;
|
|
|
|
|
|
if (seconds < 86400) return `${Math.floor(seconds / 3600)}h ago`;
|
|
|
|
|
|
return new Date(ts).toLocaleDateString();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-02 12:17:51 +07:00
|
|
|
|
export function MessageCard({
|
|
|
|
|
|
message,
|
|
|
|
|
|
onReanalyze,
|
|
|
|
|
|
compact,
|
|
|
|
|
|
}: MessageCardProps) {
|
2026-06-01 21:44:29 +07:00
|
|
|
|
const metadata = useMemo(
|
|
|
|
|
|
() => parseMetadata(message.metadata),
|
|
|
|
|
|
[message.metadata],
|
|
|
|
|
|
);
|
2026-05-14 21:01:57 +07:00
|
|
|
|
const displayContent = message.edited_content ?? message.content;
|
|
|
|
|
|
const aiStatus = message.ai_status ?? "pending";
|
2026-05-30 16:13:09 +07:00
|
|
|
|
const categories = useMemo(() => {
|
2026-06-01 21:44:29 +07:00
|
|
|
|
const list = parseStringList(
|
|
|
|
|
|
message.ai_categories ?? message.ai_moderation_flags,
|
|
|
|
|
|
);
|
2026-05-30 16:13:09 +07:00
|
|
|
|
return list.filter((c) => c !== "analysis_incomplete");
|
|
|
|
|
|
}, [message.ai_categories, message.ai_moderation_flags]);
|
2026-06-01 21:44:29 +07:00
|
|
|
|
const confidence =
|
|
|
|
|
|
message.ai_confidence ?? message.ai_moderation_score ?? null;
|
2026-05-18 06:39:12 +07:00
|
|
|
|
const [isReanalyzing, setIsReanalyzing] = useState(false);
|
2026-06-03 03:21:20 +07:00
|
|
|
|
const [showAnalysis, setShowAnalysis] = useState(aiStatus === "flagged");
|
2026-06-02 12:17:51 +07:00
|
|
|
|
|
|
|
|
|
|
// Build a human-readable analysis summary from categories + confidence + severity
|
|
|
|
|
|
const analysisSummary = useMemo(() => {
|
|
|
|
|
|
const parts: string[] = [];
|
|
|
|
|
|
if (categories.length > 0) {
|
|
|
|
|
|
parts.push(categories.slice(0, 3).join(", "));
|
|
|
|
|
|
if (categories.length > 3) parts.push(`+${categories.length - 3} more`);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (message.ai_severity && message.ai_severity !== "none") {
|
|
|
|
|
|
parts.push(message.ai_severity);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (confidence != null) {
|
|
|
|
|
|
parts.push(`${Math.round(confidence * 100)}% confidence`);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (parts.length === 0) return "View AI analysis";
|
|
|
|
|
|
return parts.join(" · ");
|
|
|
|
|
|
}, [categories, message.ai_severity, confidence]);
|
2026-05-18 06:39:12 +07:00
|
|
|
|
|
2026-05-30 16:13:09 +07:00
|
|
|
|
const stickers = metadata.stickers ?? [];
|
|
|
|
|
|
const attachments = metadata.attachments ?? [];
|
|
|
|
|
|
const imageAttachments = attachments.filter(
|
2026-06-01 21:44:29 +07:00
|
|
|
|
(a) =>
|
|
|
|
|
|
a.contentType?.startsWith("image/") ||
|
|
|
|
|
|
/\.(png|jpe?g|gif|webp)$/i.test(a.name),
|
2026-05-30 16:13:09 +07:00
|
|
|
|
);
|
|
|
|
|
|
const hasImages = imageAttachments.length > 0;
|
|
|
|
|
|
|
2026-05-18 06:39:12 +07:00
|
|
|
|
const handleReanalyze = async () => {
|
|
|
|
|
|
setIsReanalyzing(true);
|
|
|
|
|
|
try {
|
2026-06-01 16:42:36 +07:00
|
|
|
|
await onReanalyze(message.id);
|
2026-05-18 06:39:12 +07:00
|
|
|
|
} finally {
|
|
|
|
|
|
setIsReanalyzing(false);
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
2026-05-14 21:01:57 +07:00
|
|
|
|
|
|
|
|
|
|
return (
|
2026-06-01 21:44:29 +07:00
|
|
|
|
<article
|
2026-06-03 03:18:04 +07:00
|
|
|
|
className={`group rounded-2xl border bg-white shadow-sm transition-all hover:border-primary/30 hover:shadow-md ${
|
|
|
|
|
|
compact ? "px-4 py-1.5" : "p-4"
|
|
|
|
|
|
} ${
|
2026-06-03 03:21:20 +07:00
|
|
|
|
message.deleted_at ? "border-red-200 opacity-60" : "border-primary/20"
|
2026-06-03 03:18:04 +07:00
|
|
|
|
}`}
|
2026-06-01 21:44:29 +07:00
|
|
|
|
>
|
2026-06-02 12:17:51 +07:00
|
|
|
|
<div className={`flex ${compact ? "gap-2" : "gap-3"}`}>
|
|
|
|
|
|
{!compact && (
|
|
|
|
|
|
<img
|
|
|
|
|
|
src={
|
|
|
|
|
|
message.avatar_url ??
|
|
|
|
|
|
"https://cdn.discordapp.com/embed/avatars/0.png"
|
|
|
|
|
|
}
|
|
|
|
|
|
alt=""
|
2026-06-03 03:18:04 +07:00
|
|
|
|
className="h-10 w-10 shrink-0 rounded-full object-cover ring-2 ring-primary/30"
|
2026-06-02 12:17:51 +07:00
|
|
|
|
/>
|
|
|
|
|
|
)}
|
|
|
|
|
|
<div
|
|
|
|
|
|
className={`min-w-0 flex-1 ${compact ? "space-y-1" : "space-y-2.5"}`}
|
|
|
|
|
|
>
|
|
|
|
|
|
{!compact && (
|
|
|
|
|
|
<div className="flex flex-wrap items-center gap-x-2 gap-y-1">
|
|
|
|
|
|
<span className="font-semibold text-foreground">
|
|
|
|
|
|
{message.username || message.user_id}
|
2026-05-30 16:13:09 +07:00
|
|
|
|
</span>
|
2026-06-02 12:17:51 +07:00
|
|
|
|
<span
|
|
|
|
|
|
className="text-xs text-muted-foreground"
|
|
|
|
|
|
title={new Date(message.created_at).toLocaleString()}
|
2026-06-01 21:44:29 +07:00
|
|
|
|
>
|
2026-06-02 12:17:51 +07:00
|
|
|
|
{formatTimeAgo(message.created_at)}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
{message.edited_at && (
|
|
|
|
|
|
<span className="flex items-center gap-1 text-xs text-muted-foreground">
|
|
|
|
|
|
<Pencil className="h-3 w-3" /> edited
|
|
|
|
|
|
</span>
|
|
|
|
|
|
)}
|
|
|
|
|
|
{message.deleted_at && (
|
|
|
|
|
|
<span className="flex items-center gap-1 text-xs text-destructive">
|
|
|
|
|
|
<Trash2 className="h-3 w-3" /> deleted
|
|
|
|
|
|
</span>
|
|
|
|
|
|
)}
|
|
|
|
|
|
<div className="ml-auto flex items-center gap-1.5">
|
2026-06-01 21:44:29 +07:00
|
|
|
|
<Badge
|
2026-06-02 12:17:51 +07:00
|
|
|
|
variant={aiVariant(aiStatus)}
|
|
|
|
|
|
className="flex items-center gap-1 text-xs"
|
2026-06-01 21:44:29 +07:00
|
|
|
|
>
|
2026-06-02 12:17:51 +07:00
|
|
|
|
{aiStatus === "clean" && (
|
|
|
|
|
|
<CheckCircle2 className="h-3.5 w-3.5" />
|
|
|
|
|
|
)}
|
|
|
|
|
|
{aiStatus === "flagged" && (
|
|
|
|
|
|
<AlertCircle className="h-3.5 w-3.5" />
|
|
|
|
|
|
)}
|
|
|
|
|
|
{aiStatus === "error" && (
|
|
|
|
|
|
<AlertCircle className="h-3.5 w-3.5" />
|
|
|
|
|
|
)}
|
|
|
|
|
|
{aiStatus}
|
2026-05-30 16:13:09 +07:00
|
|
|
|
</Badge>
|
2026-06-02 12:17:51 +07:00
|
|
|
|
{message.ai_severity && message.ai_severity !== "none" && (
|
|
|
|
|
|
<Badge
|
|
|
|
|
|
className={`text-xs ${severityColor(message.ai_severity)}`}
|
|
|
|
|
|
>
|
|
|
|
|
|
{message.ai_severity}
|
|
|
|
|
|
</Badge>
|
|
|
|
|
|
)}
|
|
|
|
|
|
{confidence != null && (
|
|
|
|
|
|
<Badge variant="outline" className="text-xs tabular-nums">
|
|
|
|
|
|
{Math.round(confidence * 100)}%
|
|
|
|
|
|
</Badge>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</div>
|
2026-05-30 16:13:09 +07:00
|
|
|
|
</div>
|
2026-06-02 12:17:51 +07:00
|
|
|
|
)}
|
2026-05-30 16:13:09 +07:00
|
|
|
|
|
|
|
|
|
|
{displayContent ? (
|
|
|
|
|
|
<p className="whitespace-pre-wrap break-words text-sm leading-6 text-foreground/90">
|
2026-06-01 17:23:46 +07:00
|
|
|
|
{renderContentWithCustomEmojis(displayContent)}
|
2026-05-30 16:13:09 +07:00
|
|
|
|
</p>
|
|
|
|
|
|
) : null}
|
|
|
|
|
|
|
|
|
|
|
|
{stickers.length > 0 && (
|
|
|
|
|
|
<div className="flex flex-wrap gap-3">
|
|
|
|
|
|
{stickers.map((sticker) => (
|
2026-06-01 21:44:29 +07:00
|
|
|
|
<div
|
|
|
|
|
|
key={sticker.name || sticker.url}
|
|
|
|
|
|
className="flex items-center gap-2"
|
|
|
|
|
|
>
|
2026-05-30 16:13:09 +07:00
|
|
|
|
{sticker.url ? (
|
2026-06-01 21:44:29 +07:00
|
|
|
|
<img
|
|
|
|
|
|
src={sticker.url}
|
|
|
|
|
|
alt={sticker.name || "sticker"}
|
|
|
|
|
|
className="h-16 w-16 rounded-xl border border-border object-contain bg-muted/50"
|
|
|
|
|
|
loading="lazy"
|
|
|
|
|
|
/>
|
2026-05-30 16:13:09 +07:00
|
|
|
|
) : (
|
|
|
|
|
|
<div className="flex h-16 w-16 items-center justify-center rounded-xl border border-border bg-muted/50">
|
|
|
|
|
|
<Smile className="h-8 w-8 text-muted-foreground" />
|
|
|
|
|
|
</div>
|
|
|
|
|
|
)}
|
2026-06-01 21:44:29 +07:00
|
|
|
|
<span
|
|
|
|
|
|
className="text-xs text-muted-foreground max-w-[120px] truncate"
|
|
|
|
|
|
title={sticker.name}
|
|
|
|
|
|
>
|
2026-05-30 16:13:09 +07:00
|
|
|
|
{sticker.name}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
))}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
|
|
{hasImages && (
|
|
|
|
|
|
<div className="flex gap-2 overflow-x-auto">
|
|
|
|
|
|
{imageAttachments.slice(0, 4).map((img) => (
|
2026-06-01 21:44:29 +07:00
|
|
|
|
<a
|
|
|
|
|
|
key={img.url}
|
|
|
|
|
|
href={img.url}
|
|
|
|
|
|
target="_blank"
|
|
|
|
|
|
rel="noreferrer"
|
|
|
|
|
|
className="shrink-0 overflow-hidden rounded-xl border border-border"
|
|
|
|
|
|
>
|
|
|
|
|
|
<img
|
|
|
|
|
|
src={img.url}
|
|
|
|
|
|
alt={img.name}
|
|
|
|
|
|
className="h-20 w-20 object-cover transition-transform hover:scale-105"
|
|
|
|
|
|
loading="lazy"
|
|
|
|
|
|
/>
|
2026-05-30 16:13:09 +07:00
|
|
|
|
</a>
|
|
|
|
|
|
))}
|
|
|
|
|
|
{imageAttachments.length > 4 && (
|
|
|
|
|
|
<div className="flex h-20 w-20 items-center justify-center rounded-xl border border-border bg-muted text-xs text-muted-foreground">
|
2026-06-01 21:44:29 +07:00
|
|
|
|
+{imageAttachments.length - 4}{" "}
|
|
|
|
|
|
<ImageIcon className="ml-1 h-3 w-3" />
|
2026-05-30 16:13:09 +07:00
|
|
|
|
</div>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
|
|
{categories.length > 0 && (
|
|
|
|
|
|
<div className="flex flex-wrap gap-1.5">
|
|
|
|
|
|
{categories.map((category) => (
|
2026-06-01 21:44:29 +07:00
|
|
|
|
<Badge key={category} variant="secondary" className="text-xs">
|
|
|
|
|
|
{category}
|
|
|
|
|
|
</Badge>
|
2026-05-30 16:13:09 +07:00
|
|
|
|
))}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
2026-05-18 06:39:12 +07:00
|
|
|
|
{message.ai_analysis ? (
|
2026-06-02 12:17:51 +07:00
|
|
|
|
<div
|
2026-06-03 03:18:04 +07:00
|
|
|
|
className={`rounded-xl border-l-4 p-3 ${
|
2026-06-02 12:17:51 +07:00
|
|
|
|
aiStatus === "flagged"
|
2026-06-03 03:18:04 +07:00
|
|
|
|
? "border-l-pink-400 bg-pink-50/50"
|
|
|
|
|
|
: "border-l-emerald-400 bg-emerald-50/50"
|
2026-06-02 12:17:51 +07:00
|
|
|
|
}`}
|
|
|
|
|
|
>
|
|
|
|
|
|
<button
|
|
|
|
|
|
type="button"
|
|
|
|
|
|
onClick={() => setShowAnalysis(!showAnalysis)}
|
|
|
|
|
|
className="flex w-full items-center justify-between gap-2 text-left text-xs"
|
|
|
|
|
|
>
|
|
|
|
|
|
<span className="font-medium text-foreground/80">
|
2026-06-03 03:18:04 +07:00
|
|
|
|
{aiStatus === "flagged" ? "🚨 " : "ℹ️ "}
|
2026-06-02 12:17:51 +07:00
|
|
|
|
{analysisSummary}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
{showAnalysis ? (
|
|
|
|
|
|
<ChevronUp className="h-4 w-4 shrink-0 text-muted-foreground" />
|
|
|
|
|
|
) : (
|
|
|
|
|
|
<ChevronDown className="h-4 w-4 shrink-0 text-muted-foreground" />
|
|
|
|
|
|
)}
|
|
|
|
|
|
</button>
|
|
|
|
|
|
{showAnalysis && (
|
|
|
|
|
|
<div className="mt-2 border-t border-border pt-2 text-sm text-muted-foreground leading-relaxed whitespace-pre-wrap">
|
|
|
|
|
|
{message.ai_analysis}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
)}
|
2026-05-18 06:39:12 +07:00
|
|
|
|
</div>
|
|
|
|
|
|
) : null}
|
2026-05-30 16:13:09 +07:00
|
|
|
|
|
2026-05-18 06:39:12 +07:00
|
|
|
|
{message.ai_error ? (
|
2026-06-03 03:18:04 +07:00
|
|
|
|
<div className="rounded-xl bg-pink-50/50 p-3 text-sm text-pink-700">
|
2026-05-18 06:39:12 +07:00
|
|
|
|
AI error: {message.ai_error}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
) : null}
|
2026-05-30 16:13:09 +07:00
|
|
|
|
|
|
|
|
|
|
<div className="flex items-center gap-2 pt-1">
|
2026-05-18 06:39:12 +07:00
|
|
|
|
<Button
|
|
|
|
|
|
size="sm"
|
|
|
|
|
|
variant={aiStatus === "error" ? "destructive" : "outline"}
|
|
|
|
|
|
onClick={handleReanalyze}
|
|
|
|
|
|
disabled={aiStatus === "pending" || isReanalyzing}
|
2026-05-30 16:13:09 +07:00
|
|
|
|
className="text-xs"
|
2026-05-18 06:39:12 +07:00
|
|
|
|
>
|
2026-06-01 21:44:29 +07:00
|
|
|
|
<RotateCw
|
|
|
|
|
|
className={`h-3.5 w-3.5 ${isReanalyzing ? "animate-spin" : ""}`}
|
|
|
|
|
|
/>
|
2026-05-18 06:39:12 +07:00
|
|
|
|
{isReanalyzing ? "Reanalyzing..." : "Re-analyze"}
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
{aiStatus === "error" && (
|
2026-06-03 03:18:04 +07:00
|
|
|
|
<span className="text-xs text-pink-600/80">
|
2026-06-01 21:44:29 +07:00
|
|
|
|
Click to retry analysis
|
|
|
|
|
|
</span>
|
2026-05-18 06:39:12 +07:00
|
|
|
|
)}
|
|
|
|
|
|
</div>
|
2026-05-14 21:01:57 +07:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2026-05-16 19:17:34 +07:00
|
|
|
|
</article>
|
2026-05-14 21:01:57 +07:00
|
|
|
|
);
|
|
|
|
|
|
}
|
2026-06-01 16:42:36 +07:00
|
|
|
|
|
|
|
|
|
|
export function MessageCardSkeleton() {
|
|
|
|
|
|
return (
|
2026-06-03 03:18:04 +07:00
|
|
|
|
<article className="rounded-2xl border border-primary/20 bg-white p-4 shadow-sm">
|
2026-06-01 16:42:36 +07:00
|
|
|
|
<div className="flex gap-3">
|
|
|
|
|
|
<Skeleton className="h-10 w-10 shrink-0 rounded-full" />
|
|
|
|
|
|
<div className="min-w-0 flex-1 space-y-3">
|
|
|
|
|
|
<Skeleton className="h-5 w-48" />
|
|
|
|
|
|
<Skeleton className="h-4 w-full" />
|
|
|
|
|
|
<Skeleton className="h-4 w-3/4" />
|
|
|
|
|
|
<div className="flex gap-2">
|
|
|
|
|
|
<Skeleton className="h-6 w-16 rounded-full" />
|
|
|
|
|
|
<Skeleton className="h-6 w-20 rounded-full" />
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</article>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|