Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

3.6 KB
Raw Blame
import type { ReactNode } from "react";
import { X } from "./icons";
import { cn } from "./lib/utils";
import { BRAND_GLASS_SURFACE } from "./ui/gradientCircle";

interface MeetingNotificationCardProps {
  title: string;
  body: string;
  startLabel: string;
  onStart?: () => void;
  picker?: ReactNode;
  busy?: boolean;
  dismissLabel?: string;
  onDismiss?: () => void;
  /** Controls the close button's hover fade. Ignored when `onDismiss` is absent. */
  closeVisible?: boolean;
  className?: string;
  onMouseEnter?: () => void;
  onMouseLeave?: () => void;
}

/**
 * Presentational only — shared by the live always-on-top overlay
 * (`MeetingNotificationOverlay`) and the onboarding preview so the two never
 * drift. Behaviour (slide animation, IPC, hover) is layered on by the caller
 * via `className` and the handler props.
 */
export function MeetingNotificationCard({
  title,
  body,
  startLabel,
  onStart,
  picker,
  busy = false,
  dismissLabel,
  onDismiss,
  closeVisible = true,
  className = "",
  onMouseEnter,
  onMouseLeave,
}: MeetingNotificationCardProps) {
  return (
    <div
      className={[
        "relative",
        "bg-card/95 dark:bg-surface-2/95 backdrop-blur-xl",
        "border border-border/70 dark:border-border-subtle/60",
        "rounded-xl shadow-lg p-2.5",
        picker ? "min-h-[60px] flex flex-col justify-center" : "",
        className,
      ].join(" ")}
      onMouseEnter={onMouseEnter}
      onMouseLeave={onMouseLeave}
    >
      {onDismiss && (
        <button
          data-meeting-region="dismiss"
          onClick={onDismiss}
          disabled={busy}
          aria-label={dismissLabel}
          className={[
            "absolute -left-2.5 -top-2.5 z-10 size-6 rounded-full",
            "flex items-center justify-center",
            "bg-card dark:bg-surface-2 border border-border/70 dark:border-border-subtle/60 shadow-sm",
            "text-muted-foreground/70 hover:text-foreground hover:bg-muted",
            "transition-all duration-150",
            closeVisible ? "opacity-100 scale-100" : "opacity-0 scale-75 pointer-events-none",
          ].join(" ")}
        >
          <X className="size-3" />
        </button>
      )}

      <div className="flex items-center gap-2.5">
        <div className="shrink-0 bg-primary/10 rounded-md p-1">
          <svg viewBox="0 0 1024 1024" className="w-4.5 h-4.5">
            <rect width="1024" height="1024" rx="241" fill="#2056DF" />
            <circle cx="512" cy="512" r="314" fill="#2056DF" stroke="white" strokeWidth="74" />
            <path d="M512 383V641" stroke="white" strokeWidth="74" strokeLinecap="round" />
            <path d="M627 457V568" stroke="white" strokeWidth="74" strokeLinecap="round" />
            <path d="M397 457V568" stroke="white" strokeWidth="74" strokeLinecap="round" />
          </svg>
        </div>

        <div className="flex-1 min-w-0">
          <p className="truncate text-[12px] font-semibold text-foreground leading-tight">
            {title}
          </p>
          <p className="text-[11px] text-muted-foreground leading-tight mt-0.5 break-words">
            {body}
          </p>
        </div>

        <div
          className={cn(
            BRAND_GLASS_SURFACE,
            "meeting-folder-compound shrink-0 inline-flex items-stretch rounded-full"
          )}
        >
          <button
            onClick={onStart}
            disabled={busy}
            className="whitespace-nowrap rounded-full px-2.5 py-1 text-[11px] font-medium hover:brightness-110 active:brightness-95 disabled:opacity-60"
          >
            {startLabel}
          </button>
          {picker}
        </div>
      </div>
    </div>
  );
}