Skip to content
This repository was archived by the owner on Jan 19, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Button, Heading, HStack, Stack, Text as ChakraText } from '@chakra-ui/react';
import { Button, Heading, HStack, Stack, Text as ChakraText, Tooltip } from '@chakra-ui/react';
import React from 'react';
import { useKeyboardShortcut } from '../../../app/hooks';

interface AnnotationFormProps {
heading: string;
description: string;
onConfirm: React.MouseEventHandler<HTMLButtonElement>;
onCancel: React.MouseEventHandler<HTMLButtonElement>;
onConfirm: () => void;
onCancel: () => void;
children: React.ReactNode;
}

Expand All @@ -16,6 +17,9 @@ export const AnnotationBatchForm: React.FC<AnnotationFormProps> = function ({
onConfirm,
children,
}) {
useKeyboardShortcut(false, true, false, 'Enter', onConfirm);
useKeyboardShortcut(false, false, false, 'Escape', onCancel);

return (
<Stack spacing={8} p={4}>
<Stack spacing={4}>
Expand All @@ -29,12 +33,16 @@ export const AnnotationBatchForm: React.FC<AnnotationFormProps> = function ({
<Stack spacing={4}>{children}</Stack>

<HStack>
<Button colorScheme="blue" onClick={onConfirm}>
Confirm
</Button>
<Button colorScheme="red" onClick={onCancel}>
Cancel
</Button>
<Tooltip label="Preview the elements changed by this batch operation. (Ctrl+Enter)">
<Button colorScheme="blue" onClick={onConfirm}>
Start Dry Run
</Button>
</Tooltip>
<Tooltip label="Stop the batch operation. (Esc)">
<Button colorScheme="red" onClick={onCancel}>
Cancel
</Button>
</Tooltip>
</HStack>
</Stack>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Button, Heading, HStack, Stack, Text as ChakraText } from '@chakra-ui/react';
import { Button, Heading, HStack, Stack, Text as ChakraText, Tooltip } from '@chakra-ui/react';
import React from 'react';
import { useKeyboardShortcut } from '../../../app/hooks';

interface AnnotationFormProps {
heading: string;
description: string;
onSave: React.MouseEventHandler<HTMLButtonElement>;
onCancel: React.MouseEventHandler<HTMLButtonElement>;
onSave: () => void;
onCancel: () => void;
children: React.ReactNode;
}

Expand All @@ -16,6 +17,9 @@ export const AnnotationForm: React.FC<AnnotationFormProps> = function ({
onSave,
children,
}) {
useKeyboardShortcut(false, true, false, 'Enter', onSave);
useKeyboardShortcut(false, false, false, 'Escape', onCancel);

return (
<Stack spacing={8} p={4}>
<Stack spacing={4}>
Expand All @@ -29,12 +33,16 @@ export const AnnotationForm: React.FC<AnnotationFormProps> = function ({
<Stack spacing={4}>{children}</Stack>

<HStack>
<Button colorScheme="blue" onClick={onSave}>
Save
</Button>
<Button colorScheme="red" onClick={onCancel}>
Cancel
</Button>
<Tooltip label="Confirm the change. (Ctrl+Enter)">
<Button colorScheme="blue" onClick={onSave}>
Save
</Button>
</Tooltip>
<Tooltip label="Drop the change. (Esc)">
<Button colorScheme="red" onClick={onCancel}>
Cancel
</Button>
</Tooltip>
</HStack>
</Stack>
);
Expand Down