251 lines · 9.3 KB
import { useState } from "react";
import { Link, useNavigate } from "@tanstack/react-router";
import { listTransferTargets, setIssuePinned, setIssuePlanning, setSubIssue, transferIssueTo } from "~/fns/planning";
import { convertIssueToDiscussion } from "~/fns/discussion-admin";
import { useAction } from "~/hooks/use-action";
import type { getIssuePlanning } from "~/fns/planning";
import { ProgressBar } from "./ProgressBar";
import { Button } from "./ui/Button";
import { inputClass } from "./ui/Field";
import { LabelChip } from "./ui/Primitives";
import { cn } from "~/utils/cn";

type Planning = Awaited<ReturnType<typeof getIssuePlanning>>;
type Props = { owner: string; repo: string; number: number; planning: Planning };

function Section({ title, children }: { title: string; children: React.ReactNode }) {
  return (
    <section className="space-y-2 border-b border-gray-800 pb-4">
      <h3 className="label-caps text-gray-500">{title}</h3>
      {children}
    </section>
  );
}

function Choice({
  label,
  value,
  options,
  disabled,
  onChange,
}: {
  label: string;
  value: string;
  options: Array<{ id: string; name: string }>;
  disabled: boolean;
  onChange: (value: string | null) => void;
}) {
  return (
    <select
      aria-label={label}