-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Single dialog button with tabs for note input (#112)
* Added input method tabs for NoteInputDialog * Hotfix eslint microsoft/vscode-eslint#1856 * Refactor NoteInputDialog in a new component * Add reusable AddOrEditNoteFlow component * Setup tests and dsl for AddOrEditNoteFlow * Fixed act warning in AddOrEditNoteFlow tests * Moved tests from NoteInputDialog to AddOrEditNoteFlow * Use AddOrEditNoteFlow in EditNote * Added aider * Added reset for add/edit note mutations * Remove old NoteInputDialog * Upload and preview photo in AddOrEditNoteFlow * Merge repeated note props into FormValues prop * Hide tabs for edit note dialog * Implement recognize note in "From photo" tab * Remove unused components and hooks * Use type alias for productAutocompleteInput * Fix dialog and tab paddings * WIP: Fix clear note form after successful edit * Fixed focus trap issue * Fixed paddings
- Loading branch information
Showing
41 changed files
with
1,384 additions
and
1,366 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.DS_Store | ||
.env | ||
!tests/.env | ||
.aider* |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { useCallback, useMemo, useState } from 'react'; | ||
import { type FormValues } from '../model'; | ||
|
||
interface Result { | ||
values: FormValues; | ||
setValues: (values: FormValues) => void; | ||
clearValues: () => void; | ||
} | ||
|
||
export const useFormValues = (initialValues: FormValues): Result => { | ||
const [values, setValues] = useState<FormValues>(initialValues); | ||
|
||
const clearValues = useCallback(() => { | ||
setValues(initialValues); | ||
}, [initialValues]); | ||
|
||
return useMemo<Result>( | ||
() => ({ | ||
values, | ||
setValues, | ||
clearValues, | ||
}), | ||
[clearValues, values], | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
export * from './types'; | ||
export * from './mapping'; | ||
export * from './useAddProductIfNotExists'; | ||
export * from './useNoteDialog'; | ||
export * from './useProductDialog'; | ||
export * from './useRecognizeNotes'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { type productLib, type productModel } from '@/entities/product'; | ||
import { type Note } from '../model'; | ||
|
||
export interface RenderContentProps { | ||
submitLoading: boolean; | ||
submitDisabled: boolean; | ||
productAutocompleteInput: productLib.AutocompleteInput; | ||
productAutocompleteData: productLib.AutocompleteData; | ||
productFormValues: productModel.FormValues; | ||
onClose: () => void; | ||
onSubmit: (note: Note) => Promise<void>; | ||
onSubmitDisabledChange: (disabled: boolean) => void; | ||
onProductChange: (value: productModel.AutocompleteOption | null) => void; | ||
onProductFormValuesChange: (values: productModel.FormValues) => void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 0 additions & 99 deletions
99
src/frontend/src/features/note/addEdit/lib/useNoteDialog.tsx
This file was deleted.
Oops, something went wrong.
59 changes: 0 additions & 59 deletions
59
src/frontend/src/features/note/addEdit/lib/useProductDialog.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.