Skip to content

The platform for continuously improving AI agents.

3.1 KB
Raw Blame
import type { ReactNode } from "react";

import { ConnectionBackground } from "@/components/connection-scene";
import { Button } from "@/components/ui/button";
import { Icon } from "@/components/ui/icons";
import { PageHeader } from "@/components/ui/page-header";
import { PageShell } from "@/components/ui/page-shell";
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";

export function WorkshopLanding({
  title,
  label,
  collection,
  focused,
  onFocusChange,
  composer,
  trailing,
  toolbar,
  children,
}: {
  title: string;
  label: string;
  collection: string;
  focused: boolean;
  onFocusChange: (focused: boolean) => void;
  composer: ReactNode;
  trailing?: ReactNode;
  toolbar: ReactNode;
  children: ReactNode;
}) {
  return (
    <PageShell className="workshop-stage relative isolate gap-0" header={null} variant="full">
      <section
        aria-hidden={focused}
        aria-label={label}
        className="workshop-hero absolute inset-0 overflow-hidden"
        id="workshop-composer"
        inert={focused}
      >
        <ConnectionBackground />
        <div className="workshop-hero-content relative flex min-h-0 flex-col items-center justify-center gap-5 px-6 pb-6 pt-4 sm:gap-7 sm:px-8 sm:pb-10">
          <PageHeader
            className="justify-center [&_h1]:text-4xl [&_h1]:leading-none sm:[&_h1]:text-5xl"
            title={
              <span className="inline-flex items-center gap-2">
                {title}
                <span
                  aria-hidden="true"
                  className="workshop-cursor h-[0.8em] w-[0.24em] bg-foreground"
                />
              </span>
            }
          />
          <div className="w-full max-w-3xl">{composer}</div>
        </div>
      </section>
      <section
        aria-label={`Available ${collection.toLowerCase()}`}
        className="workshop-datasets absolute inset-x-0 bottom-0 z-10 flex min-h-0 flex-col border-t border-border bg-card"
        data-expanded={focused}
        id="workshop-datasets"
      >
        <Tooltip>
          <TooltipTrigger asChild>
            <Button
              aria-controls="workshop-datasets"
              aria-expanded={focused}
              aria-label={focused ? "Show composer" : `Focus ${collection.toLowerCase()}`}
              className="workshop-dataset-handle absolute left-1/2 z-10 w-12 border border-border bg-card hover:bg-control"
              onClick={() => onFocusChange(!focused)}
              size="icon-xs"
              variant="ghost"
            >
              <Icon.chevronUp
                className={`size-3 transition-transform duration-300 motion-reduce:transition-none ${focused ? "rotate-180" : ""}`}
              />
            </Button>
          </TooltipTrigger>
          <TooltipContent>
            {focused ? "Show composer" : `Focus ${collection.toLowerCase()}`}
          </TooltipContent>
        </Tooltip>
        <div className="flex min-h-0 flex-1 flex-col gap-3 px-4 pb-4 pt-6 md:px-6 md:pb-6">
          {trailing && <div className="flex shrink-0 items-center gap-2">{trailing}</div>}
          {toolbar}
          {children}
        </div>
      </section>
    </PageShell>
  );
}