mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-25 00:07:09 +00:00
* fix(studio): text in Studio reads without em or en dashes * fix(studio): the dash check also catches HTML entities, and peak reads Unavailable * test(studio): the dash check test covers every entity form * fix(studio): messages Studio shows from lint, sdk, core and the renderer drop dashes too * fix(producer): the gate check stops early on the engine's new fallback wording
75 lines
2.7 KiB
TypeScript
75 lines
2.7 KiB
TypeScript
import { useCallback, useState } from "react";
|
|
import { createPortal } from "react-dom";
|
|
import { LinkSimple } from "@phosphor-icons/react";
|
|
import { useContextMenuDismiss } from "../hooks/useContextMenuDismiss";
|
|
import { useMenuKeyboardNav } from "../player/components/menuKeyboardNav";
|
|
import { useLinkedClipPreferences } from "../utils/linkedClipPreferences";
|
|
import { Tooltip } from "./ui";
|
|
import { flatActive, flatIdle } from "./timelineToolbarStyles";
|
|
import { menuClasses } from "./ui/menuStyle";
|
|
|
|
function SyncIndicatorMenu({ x, y, onClose }: { x: number; y: number; onClose: () => void }) {
|
|
const menuRef = useContextMenuDismiss(onClose);
|
|
useMenuKeyboardNav(menuRef);
|
|
const visible = useLinkedClipPreferences((s) => s.syncIndicatorsVisible);
|
|
const setVisible = useLinkedClipPreferences((s) => s.setSyncIndicatorsVisible);
|
|
return createPortal(
|
|
<div
|
|
ref={menuRef}
|
|
role="menu"
|
|
aria-label="Linked clips"
|
|
className={`${menuClasses.panel} fixed z-200 min-w-[200px]`}
|
|
style={{ left: x, top: y }}
|
|
>
|
|
<button
|
|
type="button"
|
|
role="menuitemcheckbox"
|
|
aria-checked={visible}
|
|
className={`${menuClasses.row} ${menuClasses.rowEnabled} flex items-center gap-2`}
|
|
onClick={() => {
|
|
setVisible(!visible);
|
|
onClose();
|
|
}}
|
|
>
|
|
<span className="w-3 text-studio-accent">{visible ? "✓" : ""}</span>
|
|
Show out-of-sync indicators
|
|
</button>
|
|
</div>,
|
|
document.body,
|
|
);
|
|
}
|
|
|
|
/** Premiere's Linked Selection; right-click holds the out-of-sync indicator preference. */
|
|
export function LinkedSelectionToggle() {
|
|
const linkedSelection = useLinkedClipPreferences((s) => s.linkedSelection);
|
|
const setLinkedSelection = useLinkedClipPreferences((s) => s.setLinkedSelection);
|
|
const [menuAt, setMenuAt] = useState<{ x: number; y: number } | null>(null);
|
|
const closeMenu = useCallback(() => setMenuAt(null), []);
|
|
return (
|
|
<>
|
|
<Tooltip
|
|
label={
|
|
linkedSelection
|
|
? "Linked Selection on: a click selects both halves (⌥-click for one)"
|
|
: "Linked Selection off: a click selects one clip"
|
|
}
|
|
>
|
|
<button
|
|
type="button"
|
|
onClick={() => setLinkedSelection(!linkedSelection)}
|
|
onContextMenu={(e) => {
|
|
e.preventDefault();
|
|
setMenuAt({ x: e.clientX, y: e.clientY });
|
|
}}
|
|
aria-label="Linked Selection"
|
|
aria-pressed={linkedSelection}
|
|
className={linkedSelection ? flatActive : flatIdle}
|
|
>
|
|
<LinkSimple size={16} weight="bold" aria-hidden="true" />
|
|
</button>
|
|
</Tooltip>
|
|
{menuAt && <SyncIndicatorMenu x={menuAt.x} y={menuAt.y} onClose={closeMenu} />}
|
|
</>
|
|
);
|
|
}
|