Skip to content

Commit

Permalink
Rename NoteForm
Browse files Browse the repository at this point in the history
  • Loading branch information
pkirilin committed Oct 24, 2024
1 parent ddcb2c4 commit 596d03e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
2 changes: 0 additions & 2 deletions src/frontend/src/features/addNote/model/addNoteSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ export const addNoteSlice = createSlice({
}
},

// TODO: productEdited

productSaved: (state, { payload }: PayloadAction<ProductFormValues>) => {
if (state.draft) {
state.draft.product = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { zodResolver } from '@hookform/resolvers/zod';
import BackspaceIcon from '@mui/icons-material/Backspace';
import CancelIcon from '@mui/icons-material/Cancel';
import { IconButton, InputAdornment, TextField } from '@mui/material';
import { type FC } from 'react';
import { Controller, useForm } from 'react-hook-form';
Expand All @@ -15,7 +15,7 @@ const schema = z.object({

type FormValues = z.infer<typeof schema>;

export const QuantityForm: FC = () => {
export const NoteForm: FC = () => {
const { control, formState, handleSubmit } = useForm<FormValues>({
mode: 'onChange',
resolver: zodResolver(schema),
Expand Down Expand Up @@ -52,10 +52,9 @@ export const QuantityForm: FC = () => {
slotProps={{
input: {
readOnly: true,
// TODO: drop
endAdornment: (
<IconButton edge="end" onClick={() => dispatch(actions.productDiscarded())}>
<BackspaceIcon />
<CancelIcon />
</IconButton>
),
},
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/src/features/addNote/ui/NoteInputFlow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { type productModel } from '@/entities/product';
import { type SelectOption } from '@/shared/types';
import { actions } from '../model';
import { type ProductFormValues } from '../model/productForm';
import { NoteForm } from './NoteForm';
import { ProductForm } from './ProductForm';
import { QuantityForm } from './QuantityForm';
import { SearchProducts } from './SearchProducts';

const toProductFormValues = (
Expand Down Expand Up @@ -39,5 +39,5 @@ export const NoteInputFlow: FC = () => {
);
}

return <QuantityForm />;
return <NoteForm />;
};

0 comments on commit 596d03e

Please sign in to comment.