import type { WorkRecord, WorkspaceState } from "@/lib/workspace/types";

import { WorkCard } from "./work-card";

export const WorkFeed = ({
  onSourceSelect,
  works,
  workspace,
}: {
  readonly onSourceSelect: (rawText: string) => void;
  readonly works: readonly WorkRecord[];
  readonly workspace: WorkspaceState;
}) => (
  <div className="space-y-3">
    {works.length === 0 ? (
      <p className="py-12 text-center text-sm text-[#747168]">
        Actionable messages will appear here.
      </p>
    ) : null}
    {works.map((work) => (
      <WorkCard
        key={work._id}
        onSourceSelect={onSourceSelect}
        work={work}
        workspace={workspace}
      />
    ))}
  </div>
);
