File size: 1,189 Bytes
872046b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { Archive, Copy, Flag, Pencil, Star } from "lucide-react";

import { RowMenu, type RowMenuItem } from "../../pages/manage/_shared";
import type { Project } from "../../types";

interface ProjectRowMenuProps {
  project: Project;
  onEditDetails: () => void;
  onMilestones: () => void;
  onToggleTentative: () => void;
  onArchive: () => void;
  onRestore?: () => void;
}

export function ProjectRowMenu({
  project,
  onEditDetails,
  onMilestones,
  onToggleTentative,
  onArchive,
  onRestore,
}: ProjectRowMenuProps) {
  const items: RowMenuItem[] = [
    { label: "Edit Details", icon: Pencil, onClick: onEditDetails },
    { label: "Milestones", icon: Flag, onClick: onMilestones },
    {
      label: project.is_tentative ? "Set Confirmed" : "Set Tentative",
      icon: Star,
      onClick: onToggleTentative,
    },
    {
      label: "Duplicate",
      icon: Copy,
      onClick: () => window.alert("Duplicate is not available yet."),
    },
    project.is_active
      ? { label: "Archive", icon: Archive, danger: true, onClick: onArchive }
      : { label: "Restore", icon: Archive, onClick: onRestore ?? (() => undefined) },
  ];

  return <RowMenu items={items} />;
}