import Link from "next/link";
import { Suspense } from "react";
import CopyButton from "@/components/CopyButton";
import NextCard, { NextCardShell } from "@/components/piece/NextCard";
import { ProjectDecisions } from "@/components/projects/report/OverviewTab";
import { PILE_WHAT } from "@/components/tools/ToolList";
import { CUT_NAMES, type Song } from "@/lib/browse";
import { decisionsForProject } from "@/lib/projects";
import { fmtBytes } from "@/lib/format";
import { cutHref, findHref, mixHref, pileHref, projectHref, songToolsHref, sourcesHref, trimHref } from "@/lib/hrefs";
import { Markdown } from "@/lib/markdown";
import type { PieceFrame } from "@/lib/pieces/frame";
import type { ProjectRef } from "@/lib/project-types";
import { readSpec } from "@/lib/spec";
import { MODES } from "@/lib/types";
import type { ThumbView } from "@/lib/thumbs";
// The Overview tab of a song piece (P4a-3; canvas "Piece · Overview" in a
// song's words): the Next card -- the song's top Inbox call, an unjudged
// variant, a missing cut, a stale recipe -- then the song's decisions and its
// four cut slots beside what the song is, the paste ("copy this song", from
// SongProject's head row), and the song tools, which stay in Tools (the four
// judging piles, find, mix, sources, the hook trimmer). The README is
// SongProject's, unchanged.
export default async function OverviewTab({
project,
song,
frame,
covers,
}: {
project: ProjectRef;
song: Song;
frame: PieceFrame;
covers: ThumbView;
}) {
const [decisions, spec] = await Promise.all([decisionsForProject(project), readSpec(song.id)]);
const looksDone = (frame.piece?.looksDone ?? []).map((w) => w.replace(`${project.id}: `, ""));
if (!looksDone.length && song.present === CUT_NAMES.length) looksDone.push("every cut shipped");
const trimSet = spec.hooks?.trimSet ?? null;
return (
<>
song piles find mix sources