Skip to content

Commit 1d7799f

Browse files
committed
refactor(react/settings): add names to all form groups
1 parent 51291a6 commit 1d7799f

29 files changed

+144
-154
lines changed

apps/client/src/widgets/dialogs/add_link.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ function AddLinkDialogComponent() {
107107
}}
108108
show={shown}
109109
>
110-
<FormGroup label={t("add_link.note")}>
110+
<FormGroup label={t("add_link.note")} name="note">
111111
<NoteAutocomplete
112112
inputRef={autocompleteRef}
113113
onChange={setSuggestion}

apps/client/src/widgets/dialogs/branch_prefix.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function BranchPrefixDialogComponent() {
6464
footer={<Button text={t("branch_prefix.save")} />}
6565
show={shown}
6666
>
67-
<FormGroup label={t("branch_prefix.prefix")}>
67+
<FormGroup label={t("branch_prefix.prefix")} name="prefix">
6868
<div class="input-group">
6969
<input class="branch-prefix-input form-control" value={prefix} ref={branchInput}
7070
onChange={(e) => setPrefix((e.target as HTMLInputElement).value)} />

apps/client/src/widgets/dialogs/clone_to.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ function CloneToDialogComponent() {
6969
>
7070
<h5>{t("clone_to.notes_to_clone")}</h5>
7171
<NoteList style={{ maxHeight: "200px", overflow: "auto" }} noteIds={clonedNoteIds} />
72-
<FormGroup label={t("clone_to.target_parent_note")}>
72+
<FormGroup name="target-parent-note" label={t("clone_to.target_parent_note")}>
7373
<NoteAutocomplete
7474
placeholder={t("clone_to.search_for_note_by_its_name")}
7575
onChange={setSuggestion}
7676
inputRef={autoCompleteRef}
7777
/>
7878
</FormGroup>
79-
<FormGroup label={t("clone_to.prefix_optional")} title={t("clone_to.cloned_note_prefix_title")}>
80-
<FormTextBox name="clone-prefix" onChange={setPrefix} />
79+
<FormGroup name="clone-prefix" label={t("clone_to.prefix_optional")} title={t("clone_to.cloned_note_prefix_title")}>
80+
<FormTextBox onChange={setPrefix} />
8181
</FormGroup>
8282
</Modal>
8383
)

apps/client/src/widgets/dialogs/import.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import tree from "../../services/tree";
44
import Button from "../react/Button";
55
import FormCheckbox from "../react/FormCheckbox";
66
import FormFileUpload from "../react/FormFileUpload";
7-
import FormGroup from "../react/FormGroup";
7+
import FormGroup, { FormMultiGroup } from "../react/FormGroup";
88
import Modal from "../react/Modal";
99
import RawHtml from "../react/RawHtml";
1010
import ReactBasicWidget from "../react/ReactBasicWidget";
@@ -55,11 +55,11 @@ function ImportDialogComponent() {
5555
footer={<Button text={t("import.import")} primary disabled={!files} />}
5656
show={shown}
5757
>
58-
<FormGroup label={t("import.chooseImportFile")} description={<>{t("import.importDescription")} <strong>{ noteTitle }</strong></>}>
58+
<FormGroup name="files" label={t("import.chooseImportFile")} description={<>{t("import.importDescription")} <strong>{ noteTitle }</strong></>}>
5959
<FormFileUpload multiple onChange={setFiles} />
6060
</FormGroup>
6161

62-
<FormGroup label={t("import.options")}>
62+
<FormMultiGroup label={t("import.options")}>
6363
<FormCheckbox
6464
name="safe-import" hint={t("import.safeImportTooltip")} label={t("import.safeImport")}
6565
currentValue={safeImport} onChange={setSafeImport}
@@ -84,7 +84,7 @@ function ImportDialogComponent() {
8484
name="replace-underscores-with-spaces" label={t("import.replaceUnderscoresWithSpaces")}
8585
currentValue={replaceUnderscoresWithSpaces} onChange={setReplaceUnderscoresWithSpaces}
8686
/>
87-
</FormGroup>
87+
</FormMultiGroup>
8888
</Modal>
8989
);
9090
}

apps/client/src/widgets/dialogs/include_note.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function IncludeNoteDialogComponent() {
4343
footer={<Button text={t("include_note.button_include")} keyboardShortcut="Enter" />}
4444
show={shown}
4545
>
46-
<FormGroup label={t("include_note.label_note")}>
46+
<FormGroup name="note" label={t("include_note.label_note")}>
4747
<NoteAutocomplete
4848
placeholder={t("include_note.placeholder_search")}
4949
onChange={setSuggestion}
@@ -55,8 +55,9 @@ function IncludeNoteDialogComponent() {
5555
/>
5656
</FormGroup>
5757

58-
<FormGroup label={t("include_note.box_size_prompt")}>
59-
<FormRadioGroup name="include-note-box-size"
58+
<FormGroup name="include-note-box-size" label={t("include_note.box_size_prompt")}>
59+
<FormRadioGroup
60+
name="include-note-box-size"
6061
currentValue={boxSize} onChange={setBoxSize}
6162
values={[
6263
{ label: t("include_note.box_size_small"), value: "small" },

apps/client/src/widgets/dialogs/move_to.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function MoveToDialogComponent() {
5757
<h5>{t("move_to.notes_to_move")}</h5>
5858
<NoteList branchIds={movedBranchIds} />
5959

60-
<FormGroup label={t("move_to.target_parent_note")}>
60+
<FormGroup name="parent-note" label={t("move_to.target_parent_note")}>
6161
<NoteAutocomplete
6262
onChange={setSuggestion}
6363
inputRef={autoCompleteRef}

apps/client/src/widgets/dialogs/note_type_chooser.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ function NoteTypeChooserDialogComponent() {
8383
show={shown}
8484
stackable
8585
>
86-
<FormGroup label={t("note_type_chooser.change_path_prompt")}>
86+
<FormGroup name="parent-note" label={t("note_type_chooser.change_path_prompt")}>
8787
<NoteAutocomplete
8888
onChange={setParentNote}
8989
placeholder={t("note_type_chooser.search_placeholder")}
@@ -95,7 +95,7 @@ function NoteTypeChooserDialogComponent() {
9595
/>
9696
</FormGroup>
9797

98-
<FormGroup label={t("note_type_chooser.modal_body")}>
98+
<FormGroup name="note-type" label={t("note_type_chooser.modal_body")}>
9999
<FormList onSelect={onNoteTypeSelected}>
100100
{noteTypes.map((_item) => {
101101
if (_item.title === "----") {

apps/client/src/widgets/dialogs/prompt.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,8 @@ function PromptDialogComponent() {
7474
show={shown}
7575
stackable
7676
>
77-
<FormGroup label={opts.current?.message} labelRef={labelRef}>
77+
<FormGroup name="prompt-dialog-answer" label={opts.current?.message} labelRef={labelRef}>
7878
<FormTextBox
79-
name="prompt-dialog-answer"
8079
inputRef={answerRef}
8180
currentValue={value} onChange={setValue}
8281
readOnly={opts.current?.readOnly}

apps/client/src/widgets/dialogs/sort_child_notes.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,8 @@ function SortChildNotesDialogComponent() {
8383
label={t("sort_child_notes.sort_with_respect_to_different_character_sorting")}
8484
currentValue={sortNatural} onChange={setSortNatural}
8585
/>
86-
<FormGroup className="form-check" label={t("sort_child_notes.natural_sort_language")} description={t("sort_child_notes.the_language_code_for_natural_sort")}>
87-
<FormTextBox
88-
name="sort-locale"
89-
currentValue={sortLocale} onChange={setSortLocale}
90-
/>
86+
<FormGroup name="sort-locale" className="form-check" label={t("sort_child_notes.natural_sort_language")} description={t("sort_child_notes.the_language_code_for_natural_sort")}>
87+
<FormTextBox currentValue={sortLocale} onChange={setSortLocale} />
9188
</FormGroup>
9289
</Modal>
9390
)

apps/client/src/widgets/dialogs/upload_attachments.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,12 @@ function UploadAttachmentsDialogComponent() {
5151
onHidden={() => setShown(false)}
5252
show={shown}
5353
>
54-
<FormGroup label={t("upload_attachments.choose_files")} description={description}>
54+
<FormGroup name="files" label={t("upload_attachments.choose_files")} description={description}>
5555
<FormFileUpload onChange={setFiles} multiple />
5656
</FormGroup>
5757

58-
<FormGroup label={t("upload_attachments.options")}>
59-
<FormCheckbox
60-
name="shrink-images"
58+
<FormGroup name="shrink-images" label={t("upload_attachments.options")}>
59+
<FormCheckbox
6160
hint={t("upload_attachments.tooltip")} label={t("upload_attachments.shrink_images")}
6261
currentValue={shrinkImages} onChange={setShrinkImages}
6362
/>

0 commit comments

Comments
 (0)