feat(ui): confirm ending a show and surface help

End-session buttons, Escape, and window close share one confirm. Help is a question-mark icon on the control panel and after the version. About opens directly. Scene editor follows the UI language.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Ivan Fontosh
2026-10-02 08:10:54 +08:00
parent d228b9aab7
commit 060bbd471a
12 changed files with 245 additions and 176 deletions
+7 -5
View File
@@ -2,6 +2,7 @@ import React, { useEffect, useRef, useState } from 'react';
import { createPortal } from 'react-dom';
import type { AppToken } from '../../shared/types';
import { useEditorI18n } from '../editor/i18n/EditorI18nContext';
import { useTokenImageUrl } from '../shared/tokens/useTokenImageUrl';
import styles from './SceneEditorApp.module.css';
@@ -15,6 +16,7 @@ type Props = {
};
export function TokenTile({ token, onEdit, onDelete }: Props) {
const { t } = useEditorI18n();
const url = useTokenImageUrl(token.id);
const menuBtnRef = useRef<HTMLButtonElement | null>(null);
const menuRef = useRef<HTMLDivElement | null>(null);
@@ -63,7 +65,7 @@ export function TokenTile({ token, onEdit, onDelete }: Props) {
e.dataTransfer.setData(TOKEN_DND_MIME, token.id);
e.dataTransfer.effectAllowed = 'copy';
}}
title="Перетащите на карту"
title={t('sceneEditor.dragToMap')}
>
<div className={styles.tokenThumb}>
{url ? <img src={url} alt="" draggable={false} /> : null}
@@ -74,10 +76,10 @@ export function TokenTile({ token, onEdit, onDelete }: Props) {
ref={menuBtnRef}
type="button"
className={styles.tokenTileMore}
aria-label="Действия"
aria-label={t('sceneEditor.actions')}
aria-haspopup="menu"
aria-expanded={menu !== null}
title="Действия"
title={t('sceneEditor.actions')}
onClick={openMenu}
onPointerDown={(e) => e.stopPropagation()}
>
@@ -102,7 +104,7 @@ export function TokenTile({ token, onEdit, onDelete }: Props) {
onEdit();
}}
>
Изменить
{t('sceneEditor.edit')}
</button>
<button
type="button"
@@ -113,7 +115,7 @@ export function TokenTile({ token, onEdit, onDelete }: Props) {
onDelete();
}}
>
Удалить
{t('common.delete')}
</button>
</div>,
document.body,