/*
* Copyright 2025 coze-dev Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React, { type ReactNode } from 'react';
import { I18n } from '@coze-arch/i18n';
import { IconCozCross } from '@coze-arch/coze-design/icons';
import { Divider, Typography, Tag } from '@coze-arch/coze-design';
import { InteractiveType } from '@coze-common/mouse-pad-selector';
import { getIsIPad } from '../utils';
import { SHORTCUTS } from './constants';
import s from './index.module.less';
interface ShortcutItemProps {
title: ReactNode;
children?: ReactNode;
}
function ShortcutItem({ title, children }: ShortcutItemProps) {
return (
);
}
function DividerWithMargin() {
return ;
}
function ShortcutTag({ children }: { children: ReactNode }) {
return (
{children}
);
}
interface FlowShortcutsHelpProps {
closable?: boolean;
onClose?: () => void;
isAgentFlow?: boolean;
interactiveType?: InteractiveType;
}
const isIPad = getIsIPad();
function FlowShortcutsHelp(props: FlowShortcutsHelpProps) {
const {
closable = false,
onClose,
isAgentFlow = false,
interactiveType,
} = props;
const isMouseFriendly = interactiveType === InteractiveType.Mouse;
return (
<>
{closable ? (
onClose?.()}>
) : null}
{I18n.t('flowcanvas_shortcuts_shortcuts')}
{isMouseFriendly ? (
<>
{I18n.t('flowcanvas_shortcuts_drag')}
>
) : (
<>
{I18n.t('flowcanvas_shortcuts_space')}
{I18n.t('flowcanvas_shortcuts_drag')}
>
)}
{isMouseFriendly ? (
<>
{SHORTCUTS.SHIFT}
{I18n.t('flowcanvas_shortcuts_drag')}
>
) : (
<>
{I18n.t('flowcanvas_shortcuts_drag')}
>
)}
{I18n.t('flowcanvas_shortcuts_multiple_select')}/
{I18n.t('flowcanvas_shortcuts_multiple_deselect')}
>
}
>
{SHORTCUTS.CTRL}/{SHORTCUTS.SHIFT}
{I18n.t('flowcanvas_shortcuts_click')}
{SHORTCUTS.CTRL}
+
{I18n.t('flowcanvas_shortcuts_or')}
{!isMouseFriendly ? {SHORTCUTS.CTRL} : null}
{I18n.t('flowcanvas_shortcuts_scroll')}
{SHORTCUTS.CTRL}
-
{I18n.t('flowcanvas_shortcuts_or')}
{!isMouseFriendly ? {SHORTCUTS.CTRL} : null}
{I18n.t('flowcanvas_shortcuts_scroll')}
{isIPad || isAgentFlow ? null : (
<>
{SHORTCUTS.ALT}
{I18n.t('flowcanvas_shortcuts_drag')}
>
)}
{SHORTCUTS.CTRL}
C
{SHORTCUTS.CTRL}
V
{I18n.t('flowcanvas_shortcuts_backspace')}
>
);
}
function UndoRedoShortcuts() {
return (
<>
{SHORTCUTS.CTRL}
Z
{SHORTCUTS.CTRL}
{SHORTCUTS.SHIFT}
Z
>
);
}
export { FlowShortcutsHelp };