153 lines · 4.7 KB
import { useState } from "react";
import { setIssueAssignees, setIssueLabels, setIssueLock } from "~/fns/labels";
import { useAction } from "~/hooks/use-action";
import { Avatar } from "~/ui/Avatar";
import { LabelChip } from "~/ui/LabelChip";
import { Button } from "~/ui/Button";
import { ThreadSubscription } from "./ThreadSubscription";
import { SidebarSection } from "~/ui/Heading";

type Props = {
  owner: string;
  repo: string;
  number: number;
  canMaintain: boolean;
  locked: boolean;
  labels: Array<{ id: string; name: string; color: string }>;
  allLabels: Array<{ id: string; name: string; color: string }>;
  assignees: Array<{ name: string }>;
  assignable: string[];
  children?: React.ReactNode;
};

function Section({ title, onEdit, children }: { title: string; onEdit?: () => void; children: React.ReactNode }) {
  return (
    <SidebarSection
      title={title}
      action={
        onEdit && (
          <button type="button" onClick={onEdit} className="text-xs text-kumo-subtle hover:text-accent-400">
            Edit
          </button>
        )
      }
    >
      {children}
    </SidebarSection>
  );
}

function Picker({