2026-01-19 16:50:51 -08:00
|
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
import { MessageSquare } from "lucide-react";
|
2026-01-22 16:07:06 +05:30
|
|
|
import {
|
|
|
|
|
Drawer,
|
|
|
|
|
DrawerContent,
|
|
|
|
|
DrawerHandle,
|
|
|
|
|
DrawerHeader,
|
|
|
|
|
DrawerTitle,
|
|
|
|
|
} from "@/components/ui/drawer";
|
2026-01-20 00:32:31 -08:00
|
|
|
import { Sheet, SheetContent, SheetHeader, SheetTitle } from "@/components/ui/sheet";
|
2026-01-19 16:50:51 -08:00
|
|
|
import { cn } from "@/lib/utils";
|
|
|
|
|
import { CommentPanelContainer } from "../comment-panel-container/comment-panel-container";
|
|
|
|
|
import type { CommentSheetProps } from "./types";
|
|
|
|
|
|
|
|
|
|
export function CommentSheet({
|
|
|
|
|
messageId,
|
|
|
|
|
isOpen,
|
|
|
|
|
onOpenChange,
|
|
|
|
|
commentCount = 0,
|
|
|
|
|
side = "bottom",
|
|
|
|
|
}: CommentSheetProps) {
|
|
|
|
|
const isBottomSheet = side === "bottom";
|
|
|
|
|
|
2026-01-22 04:02:32 +05:30
|
|
|
// Use Drawer for mobile (bottom), Sheet for medium screens (right)
|
|
|
|
|
if (isBottomSheet) {
|
|
|
|
|
return (
|
|
|
|
|
<Drawer open={isOpen} onOpenChange={onOpenChange} shouldScaleBackground={false}>
|
|
|
|
|
<DrawerContent className="h-[85vh] max-h-[85vh] z-80" overlayClassName="z-80">
|
|
|
|
|
<DrawerHandle />
|
|
|
|
|
<DrawerHeader className="px-4 pb-3 pt-2">
|
|
|
|
|
<DrawerTitle className="flex items-center gap-2 text-base font-semibold">
|
|
|
|
|
<MessageSquare className="size-5" />
|
|
|
|
|
Comments
|
|
|
|
|
{commentCount > 0 && (
|
|
|
|
|
<span className="rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary">
|
|
|
|
|
{commentCount}
|
|
|
|
|
</span>
|
|
|
|
|
)}
|
|
|
|
|
</DrawerTitle>
|
|
|
|
|
</DrawerHeader>
|
|
|
|
|
<div className="min-h-0 flex-1 overflow-y-auto scrollbar-thin">
|
|
|
|
|
<CommentPanelContainer messageId={messageId} isOpen={true} variant="mobile" />
|
|
|
|
|
</div>
|
|
|
|
|
</DrawerContent>
|
|
|
|
|
</Drawer>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Use Sheet for medium screens (right side)
|
2026-01-19 16:50:51 -08:00
|
|
|
return (
|
|
|
|
|
<Sheet open={isOpen} onOpenChange={onOpenChange}>
|
|
|
|
|
<SheetContent
|
|
|
|
|
side={side}
|
2026-01-22 04:02:32 +05:30
|
|
|
className={cn("flex flex-col gap-0 overflow-hidden p-0 h-full w-full max-w-md")}
|
2026-01-19 16:50:51 -08:00
|
|
|
>
|
2026-01-22 04:02:32 +05:30
|
|
|
<SheetHeader className="flex-shrink-0 px-4 py-4">
|
2026-01-19 16:50:51 -08:00
|
|
|
<SheetTitle className="flex items-center gap-2 text-base font-semibold">
|
|
|
|
|
<MessageSquare className="size-5" />
|
|
|
|
|
Comments
|
|
|
|
|
{commentCount > 0 && (
|
|
|
|
|
<span className="rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary">
|
|
|
|
|
{commentCount}
|
|
|
|
|
</span>
|
|
|
|
|
)}
|
|
|
|
|
</SheetTitle>
|
|
|
|
|
</SheetHeader>
|
2026-01-20 19:49:34 +05:30
|
|
|
<div className="min-h-0 flex-1 overflow-y-auto scrollbar-thin">
|
2026-01-20 00:32:31 -08:00
|
|
|
<CommentPanelContainer messageId={messageId} isOpen={true} variant="mobile" />
|
2026-01-19 16:50:51 -08:00
|
|
|
</div>
|
|
|
|
|
</SheetContent>
|
|
|
|
|
</Sheet>
|
|
|
|
|
);
|
|
|
|
|
}
|