import { useState, type ReactNode } from "react"; import { tx } from "@/platform/i18n"; import { IconButton, SplitGroup, SplitHandle, SplitPanel, lazyComponent } from "@/ui"; import { diffInput } from "./diffInput"; import type { LogChange } from "./logChanges"; import styles from "./common.module.css"; const DiffEditor = lazyComponent(() => import("./DiffEditor").then((m) => m.DiffEditor)); const PUSH_DIFF_SPLIT_KEY = "openidea.vcs.push.diffSplit"; export function usePushDiff(shownKey: string) { const [state, setState] = useState<{ key: string; change: LogChange } | null>(null); return { diff: state?.key === shownKey ? state.change : null, show: (change: LogChange | null) => setState(change ? { key: shownKey, change } : null), close: () => setState(null), }; } interface PushDiffSplitProps { diff: LogChange | null; onClose: () => void; children: ReactNode; } export function PushDiffSplit({ diff, onClose, children }: PushDiffSplitProps) { return ( {children} {diff && ( <> )} ); } function PushDiff({ change, onClose }: { change: LogChange; onClose: () => void }) { const input = diffInput(change.diff); return (
{change.path}
); }