"use client"; import { Message, User } from "revolt-api"; import { Avatar, AvatarImage } from "../ui/avatar"; import { Image as ImageIcon, Pencil } from "lucide-react"; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from "../ui/alert-dialog"; import dayjs from "dayjs"; import { decodeTime } from "ulid"; import calendarPlugin from "dayjs/plugin/calendar"; import Link from "next/link"; import { AUTUMN_URL } from "@/lib/constants"; dayjs.extend(calendarPlugin); export function CompactMessage({ message, users, hideUser, }: { message: Message; users?: Record; hideUser?: boolean; }) { const user = users?.[message.author]; return (
e.button === 1 && window.open(`/panel/inspect/message/${message._id}`, "_blank") } >
{dayjs(decodeTime(message._id)).format("HH:mm")}
{!hideUser && (
{user?.avatar && ( )} {user?.username}{" "} {message.edited && ( )}
)}
{(message.attachments || message.embeds) && ( )}{" "} {message.content ?? No text.}
{user?.avatar && ( )}{" "} {user?.username}#{user?.discriminator} {message.content && {message.content}} {message.attachments?.map((attachment) => attachment.metadata.type === "Image" ? ( ) : ( "unsupported" ) )} {message.embeds?.map((embed, index) => (
                {JSON.stringify(embed, null, 2)}
              
))}
Inspect Close
); }