"use client"
import type { ReactNode } from "react"
import { Clock } from "lucide-react"
import {
ContextMenuItem,
ContextMenuSeparator,
} from "@/components/ui/context-menu"
import {
DropdownMenuItem,
DropdownMenuSeparator,
} from "@/components/ui/dropdown-menu"
import type { MoveTarget } from "@/components/gmail/move-to-menu-items"
export type MoveToTargets = {
recents: MoveTarget[]
system: MoveTarget[]
folders: MoveTarget[]
}
function MoveToSectionHeader({ children }: { children: ReactNode }) {
return (
{children}
)
}
export function MoveToDropdownItems({
targets,
onMoveTo,
}: {
targets: MoveToTargets
onMoveTo: (targetId: string) => void
}) {
return (
<>
{targets.recents.length > 0 && (
<>
Récents
{targets.recents.map((t) => (
onMoveTo(t.id)}>
{t.icon}
{t.label}
))}
>
)}
{targets.system.map((t) => (
onMoveTo(t.id)}>
{t.icon}
{t.label}
))}
{targets.folders.length > 0 && (
<>
Dossiers
{targets.folders.map((t) => (
onMoveTo(t.id)}
style={{ paddingLeft: `${12 + t.depth * 16}px` }}
>
{t.icon}
{t.label}
))}
>
)}
>
)
}
export function MoveToContextMenuItems({
targets,
onMoveTo,
}: {
targets: MoveToTargets
onMoveTo: (targetId: string) => void
}) {
return (
<>
{targets.recents.length > 0 && (
<>
Récents
{targets.recents.map((t) => (
onMoveTo(t.id)}>
{t.icon}
{t.label}
))}
>
)}
{targets.system.map((t) => (
onMoveTo(t.id)}>
{t.icon}
{t.label}
))}
{targets.folders.length > 0 && (
<>
Dossiers
{targets.folders.map((t) => (
onMoveTo(t.id)}
style={{ paddingLeft: `${12 + t.depth * 16}px` }}
>
{t.icon}
{t.label}
))}
>
)}
>
)
}