дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-09 11:15:40 +02:00
- workbench/messages: one promise-based ask/confirm/confirmChecked/showError host replaces the per-feature confirm dialogs (app, services, vcs, project tree, keymap, run, database, find, LSP choice popup). - Commit tool window: Commit | Shelf | Stash tabs as the title, IDEA's toolbar (Update Project, View Options, Select Opened File), Unversioned collapsed, Commit / Commit and Push on one row, empty-message error. - Commit Options popup: author, sign-off, before-commit checks, Git hooks; vcs_commit takes CommitOptions (--author, --no-verify). - Remove from Recent Projects asks first; refused history rewrites show an error dialog. Claude-Session: https://claude.ai/code/session_01B65qLEKnkeYTGdbwhLpjCu
62 рядки
1.7 KiB
TypeScript
62 рядки
1.7 KiB
TypeScript
/** Small modal dialogs of the Keymap page: keymap name (Duplicate / Rename) and confirmations. */
|
|
import { useId, useState } from "react";
|
|
import { Dialog, Input, T } from "@/ui";
|
|
import { validateKeymapName, type CustomKeymaps } from "./model";
|
|
import styles from "./Keymap.module.css";
|
|
|
|
export function KeymapNameDialog({
|
|
title,
|
|
initial,
|
|
customs,
|
|
ownId,
|
|
onCancel,
|
|
onSubmit,
|
|
}: {
|
|
title: string;
|
|
initial: string;
|
|
customs: CustomKeymaps;
|
|
ownId?: string;
|
|
onCancel: () => void;
|
|
onSubmit: (name: string) => void;
|
|
}) {
|
|
const [name, setName] = useState(initial);
|
|
const id = useId();
|
|
const error = validateKeymapName(name, customs, ownId);
|
|
const submit = () => !error && onSubmit(name.trim());
|
|
return (
|
|
<Dialog
|
|
open
|
|
onClose={onCancel}
|
|
title={title}
|
|
width={380}
|
|
buttons={[
|
|
{ label: "OK", role: "default", disabled: !!error, onClick: submit },
|
|
{ label: "Cancel", role: "cancel" },
|
|
]}
|
|
>
|
|
<div className={styles.recordBody}>
|
|
<div className={styles.recordRow}>
|
|
<label className={styles.recordLabel} htmlFor={id}>
|
|
<T>Name:</T>
|
|
</label>
|
|
<Input
|
|
id={id}
|
|
autoFocus
|
|
value={name}
|
|
invalid={!!error}
|
|
onChange={(e) => setName(e.target.value)}
|
|
onFocus={(e) => e.currentTarget.select()}
|
|
onKeyDown={(e) => {
|
|
if (e.key === "Enter") {
|
|
e.preventDefault();
|
|
submit();
|
|
}
|
|
}}
|
|
/>
|
|
</div>
|
|
{error && name.trim() !== "" && <div className={styles.nameError}>{error}</div>}
|
|
</div>
|
|
</Dialog>
|
|
);
|
|
}
|