'use client'
import { Chevron02LeftIcon, ClockHistoryIcon, XmarkIcon } from '../icons-v2-generated'
import { Button } from '../ui/button'
import { ActionsMenuDropdown, type ActionsMenuItem } from '../ui/actions-menu'
import { cn } from '../../utils/cn'
import type { ChatPanelHeaderProps } from './chat-panel-header'
export interface ChatPanelHeaderMobileProps extends ChatPanelHeaderProps {
className?: string
}
/**
* Mobile chat panel header — Figma node `7363:85532`. A distinct layout from
* the desktop bar (which packs full-height divider cells into a fixed `h-14`):
*
* - Surface: `ods-card` with a bottom border; generous `l` side padding,
* `l` bottom padding, and `xl` top padding on the title block (so the row
* bottom-aligns under a tall header).
* - Title: `text-h2` (vs the desktop `h3`/`h4`), truncated.
* - Actions: 44px outlined icon buttons (`Button variant="outline"
* size="icon"`) — a back chevron (when applicable), a trailing `⋯` menu
* carrying the view-dependent actions (hidden when no action applies),
* and an X Close. The X is REQUIRED here: on mobile the drawer is
* full-screen (`w-screen`), so there is no visible backdrop to tap —
* without it the panel cannot be dismissed at all.
*
* Same prop contract as `ChatPanelHeader`; the orchestrator renders this on
* mobile and the desktop bar on `md+`.
*/
export function ChatPanelHeaderMobile({
showBack = false,
title,
backAriaLabel = 'Back',
isArchivedView = false,
onBack,
onClose,
onRestore,
onRename,
onArchive,
onCopyLink,
onOpenArchive,
className,
}: ChatPanelHeaderMobileProps) {
// The right-hand ⋯ menu carries the view-dependent actions. Close is not
// listed (the panel is dismissed elsewhere); the trigger is hidden entirely
// when no action applies (e.g. the archive list view).
const menuItems = [
!showBack && onOpenArchive && { id: 'open-archive', label: 'Chat archive', icon:
{title}