Skip to content

The open-source full-stack studio for Opus 5.5 motion video. Reverse engineering for any video. Code video with HTML: recreate, edit and render. BYOA + BYOK · Motion.md · Images, Video, Music & Voice.

1.5 KB
Raw Blame
import { useI18n } from "../../i18n/I18n";
import { editabilityForProvenance, type GsapProvenance } from "@hyperframes/core/gsap-parser-acorn";

/**
 * Notice shown for computed tweens: helper/loop tweens offer an "unroll to
 * edit" action; runtime-computed values point to the Code tab. Literal tweens
 * render nothing.
 */
export function ComputedTweenNotice({
  provenance,
  onUnroll,
}: {
  provenance?: GsapProvenance;
  onUnroll?: () => void;
}) {
  const { t } = useI18n();
  const editability = editabilityForProvenance(provenance);
  if (editability === "direct") return null;
  if (editability === "source") {
    return (
      <div className="rounded-md border border-neutral-800 bg-neutral-900/50 px-2 py-1.5 text-[9px] text-neutral-400">
        {t("Computed value. Edit it in the Code tab.")}</div>
    );
  }
  const source = provenance?.fn ? `${provenance.fn}()` : "a loop";
  return (
    <div className="flex items-center justify-between gap-2 rounded-md border border-neutral-800 bg-neutral-900/50 px-2 py-1.5 text-[9px] text-neutral-400">
      <span>{t("Generated by")}{" "}{source}{t(", not directly editable.")}</span>
      {onUnroll && (
        <button
          type="button"
          onClick={onUnroll}
          className="shrink-0 rounded-sm px-1.5 py-0.5 text-[9px] font-medium text-accent-ink hover:bg-neutral-800"
          title={t("Rewrite the helper/loop into explicit tweens so this keyframe edits directly")}
        >
          {t("Unroll to edit")}</button>
      )}
    </div>
  );
}