Skip to content
This repository was archived by the owner on Jan 19, 2025. It is now read-only.

Commit 1f731b2

Browse files
authored
feat(gui): descriptions of annotations (#803)
* feat(gui): link to user guide * feat(gui): short help texts in annotation forms * style: apply automatic fixes of linters * chore: shorten help text Co-authored-by: lars-reimann <[email protected]>
1 parent e9c0540 commit 1f731b2

30 files changed

+100
-20
lines changed

api-editor/gui/src/features/annotations/AnnotationView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ import {
6565
showTodoAnnotationForm,
6666
} from '../ui/uiSlice';
6767
import { truncate } from '../../common/util/stringOperations';
68-
import { wrongAnnotationURL } from '../reporting/issueURLBuilder';
68+
import { wrongAnnotationURL } from '../externalLinks/urlBuilder';
6969

7070
interface AnnotationViewProps {
7171
target: string;

api-editor/gui/src/features/annotations/MissingAnnotationButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { IconButton } from '@chakra-ui/react';
22
import React from 'react';
33
import { FaFlag } from 'react-icons/fa';
4-
import { missingAnnotationURL } from '../reporting/issueURLBuilder';
4+
import { missingAnnotationURL } from '../externalLinks/urlBuilder';
55

66
interface MissingAnnotationButtonProps {
77
target: string;

api-editor/gui/src/features/annotations/batchforms/AnnotationBatchForm.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,30 @@
1-
import { Button, Heading, HStack, Stack } from '@chakra-ui/react';
1+
import { Button, Heading, HStack, Stack, Text as ChakraText } from '@chakra-ui/react';
22
import React from 'react';
33

44
interface AnnotationFormProps {
55
heading: string;
6+
description: string;
67
onConfirm: React.MouseEventHandler<HTMLButtonElement>;
78
onCancel: React.MouseEventHandler<HTMLButtonElement>;
89
children: React.ReactNode;
910
}
1011

1112
export const AnnotationBatchForm: React.FC<AnnotationFormProps> = function ({
1213
heading,
14+
description,
1315
onCancel,
1416
onConfirm,
1517
children,
1618
}) {
1719
return (
1820
<Stack spacing={8} p={4}>
19-
<Heading as="h3" size="lg">
20-
{heading}
21-
</Heading>
21+
<Stack spacing={4}>
22+
<Heading as="h3" size="lg">
23+
{heading}
24+
</Heading>
25+
26+
<ChakraText fontStyle="italic">{description}</ChakraText>
27+
</Stack>
2228

2329
<Stack spacing={4}>{children}</Stack>
2430

api-editor/gui/src/features/annotations/batchforms/ConstantBatchForm.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export const ConstantBatchForm: React.FC<ConstantBatchFormProps> = function ({ t
3737
<TypeValueBatchForm
3838
targets={filteredTargets}
3939
annotationType="constant"
40+
description="Delete matched parameters and replace references to them with a constant value."
4041
onUpsertAnnotation={handleUpsertAnnotation}
4142
/>
4243
);

api-editor/gui/src/features/annotations/batchforms/DestinationBatchForm.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { ConfirmAnnotations } from './ConfirmAnnotations';
1010
interface DestinationBatchFormProps {
1111
targets: PythonDeclaration[];
1212
annotationType: string;
13+
description: string;
1314
onUpsertAnnotation: (data: DestinationBatchFormState) => void;
1415
}
1516

@@ -20,6 +21,7 @@ export interface DestinationBatchFormState {
2021
export const DestinationBatchForm: React.FC<DestinationBatchFormProps> = function ({
2122
targets,
2223
annotationType,
24+
description,
2325
onUpsertAnnotation,
2426
}) {
2527
const dispatch = useAppDispatch();
@@ -60,6 +62,7 @@ export const DestinationBatchForm: React.FC<DestinationBatchFormProps> = functio
6062
<>
6163
<AnnotationBatchForm
6264
heading={`Add @${annotationType} Annotations`}
65+
description={description}
6366
onConfirm={handleSubmit(handleConfirm)}
6467
onCancel={handleCancel}
6568
>

api-editor/gui/src/features/annotations/batchforms/EmptyBatchForm.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ import { ConfirmAnnotations } from './ConfirmAnnotations';
99
interface EmptyBatchFormProps {
1010
targets: PythonDeclaration[];
1111
annotationType: string;
12+
description: string;
1213
onUpsertAnnotation: () => void;
1314
targetLabel: string;
1415
}
1516

1617
export const EmptyBatchForm: React.FC<EmptyBatchFormProps> = function ({
1718
targets,
1819
annotationType,
20+
description,
1921
onUpsertAnnotation,
2022
targetLabel,
2123
}) {
@@ -45,6 +47,7 @@ export const EmptyBatchForm: React.FC<EmptyBatchFormProps> = function ({
4547
<>
4648
<AnnotationBatchForm
4749
heading={`Add @${annotationType} Annotations`}
50+
description={description}
4851
onConfirm={handleConfirm}
4952
onCancel={handleCancel}
5053
>

api-editor/gui/src/features/annotations/batchforms/MoveBatchForm.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export const MoveBatchForm: React.FC<MoveBatchFormProps> = function ({ targets }
3838
<DestinationBatchForm
3939
targets={filteredTargets}
4040
annotationType="move"
41+
description="Move matched global declarations to another module."
4142
onUpsertAnnotation={handleUpsertAnnotation}
4243
/>
4344
);

api-editor/gui/src/features/annotations/batchforms/OldNewBatchForm.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { ConfirmAnnotations } from './ConfirmAnnotations';
1010
interface OldNewBatchFormProps {
1111
targets: PythonDeclaration[];
1212
annotationType: string;
13+
description: string;
1314
onUpsertAnnotation: (data: OldNewBatchFormState) => void;
1415
}
1516

@@ -21,6 +22,7 @@ export interface OldNewBatchFormState {
2122
export const OldNewBatchForm: React.FC<OldNewBatchFormProps> = function ({
2223
targets,
2324
annotationType,
25+
description,
2426
onUpsertAnnotation,
2527
}) {
2628
const dispatch = useAppDispatch();
@@ -65,6 +67,7 @@ export const OldNewBatchForm: React.FC<OldNewBatchFormProps> = function ({
6567
<>
6668
<AnnotationBatchForm
6769
heading={`Add @${annotationType} Annotations`}
70+
description={description}
6871
onConfirm={handleSubmit(handleConfirm)}
6972
onCancel={handleCancel}
7073
>

api-editor/gui/src/features/annotations/batchforms/OptionalBatchForm.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export const OptionalBatchForm: React.FC<OptionalBatchFormProps> = function ({ t
3737
<TypeValueBatchForm
3838
targets={filteredTargets}
3939
annotationType="optional"
40+
description="Make matched parameters optional and set their default value."
4041
onUpsertAnnotation={handleUpsertAnnotation}
4142
/>
4243
);

api-editor/gui/src/features/annotations/batchforms/RemoveBatchForm.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export const RemoveBatchForm: React.FC<RemoveBatchFormProps> = function ({ targe
3535
<EmptyBatchForm
3636
targets={filteredTargets}
3737
annotationType="remove"
38+
description="Remove matched classes and functions."
3839
onUpsertAnnotation={handleUpsertAnnotation}
3940
targetLabel="This will annotate classes and functions."
4041
/>

0 commit comments

Comments
 (0)