Skip to content

Commit 8e81a53

Browse files
committed
changes text area
1 parent 2e0db3f commit 8e81a53

File tree

7 files changed

+67
-10
lines changed

7 files changed

+67
-10
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from fastapi import

frontend/src/components/Admin/AddUser.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const AddUser = () => {
6767
password: "",
6868
confirm_password: "",
6969
is_superuser: false,
70-
is_active: false,
70+
is_active: true,
7171
},
7272
})
7373

@@ -89,8 +89,15 @@ const AddUser = () => {
8989
mutation.mutate(data)
9090
}
9191

92+
const handleOpenChange = (open: boolean) => {
93+
setIsOpen(open)
94+
if (!open) {
95+
form.reset()
96+
}
97+
}
98+
9299
return (
93-
<Dialog open={isOpen} onOpenChange={setIsOpen}>
100+
<Dialog open={isOpen} onOpenChange={handleOpenChange}>
94101
<DialogTrigger asChild>
95102
<Button className="my-4">
96103
<Plus className="mr-2" />

frontend/src/components/Admin/DeleteUser.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ const DeleteUser = ({ id, onSuccess }: DeleteUserProps) => {
6161
<Trash2 />
6262
Delete User
6363
</DropdownMenuItem>
64-
<DialogContent className="sm:max-w-md">
64+
<DialogContent className="sm:max-w-md" aria-describedby="delete-user-description">
6565
<form onSubmit={handleSubmit(onSubmit)}>
6666
<DialogHeader>
6767
<DialogTitle>Delete User</DialogTitle>
68-
<DialogDescription>
68+
<DialogDescription id="delete-user-description">
6969
All items associated with this user will also be{" "}
7070
<strong>permanently deleted.</strong> Are you sure? You will not
7171
be able to undo this action.

frontend/src/components/Items/AddItem.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
FormMessage,
2727
} from "@/components/ui/form"
2828
import { Input } from "@/components/ui/input"
29+
import { Textarea } from "@/components/ui/textarea"
2930
import { LoadingButton } from "@/components/ui/loading-button"
3031
import useCustomToast from "@/hooks/useCustomToast"
3132
import { handleError } from "@/utils"
@@ -70,8 +71,15 @@ const AddItem = () => {
7071
mutation.mutate(data)
7172
}
7273

74+
const handleOpenChange = (open: boolean) => {
75+
setIsOpen(open)
76+
if (!open) {
77+
form.reset()
78+
}
79+
}
80+
7381
return (
74-
<Dialog open={isOpen} onOpenChange={setIsOpen}>
82+
<Dialog open={isOpen} onOpenChange={handleOpenChange}>
7583
<DialogTrigger asChild>
7684
<Button className="my-4">
7785
<Plus className="mr-2" />
@@ -116,7 +124,12 @@ const AddItem = () => {
116124
<FormItem>
117125
<FormLabel>Description</FormLabel>
118126
<FormControl>
119-
<Input placeholder="Description" type="text" {...field} />
127+
<Textarea
128+
placeholder="Enter a description for your item"
129+
className="resize-none"
130+
rows={3}
131+
{...field}
132+
/>
120133
</FormControl>
121134
<FormMessage />
122135
</FormItem>

frontend/src/components/Items/DeleteItem.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ const DeleteItem = ({ id, onSuccess }: DeleteItemProps) => {
6161
<Trash2 />
6262
Delete Item
6363
</DropdownMenuItem>
64-
<DialogContent className="sm:max-w-md">
64+
<DialogContent className="sm:max-w-md" aria-describedby="delete-item-description">
6565
<form onSubmit={handleSubmit(onSubmit)}>
6666
<DialogHeader>
6767
<DialogTitle>Delete Item</DialogTitle>
68-
<DialogDescription>
68+
<DialogDescription id="delete-item-description">
6969
This item will be permanently deleted. Are you sure? You will not
7070
be able to undo this action.
7171
</DialogDescription>

frontend/src/components/Items/EditItem.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
FormMessage,
2727
} from "@/components/ui/form"
2828
import { Input } from "@/components/ui/input"
29+
import { Textarea } from "@/components/ui/textarea"
2930
import { LoadingButton } from "@/components/ui/loading-button"
3031
import useCustomToast from "@/hooks/useCustomToast"
3132
import { handleError } from "@/utils"
@@ -75,8 +76,15 @@ const EditItem = ({ item, onSuccess }: EditItemProps) => {
7576
mutation.mutate(data)
7677
}
7778

79+
const handleOpenChange = (open: boolean) => {
80+
setIsOpen(open)
81+
if (!open) {
82+
form.reset()
83+
}
84+
}
85+
7886
return (
79-
<Dialog open={isOpen} onOpenChange={setIsOpen}>
87+
<Dialog open={isOpen} onOpenChange={handleOpenChange}>
8088
<DropdownMenuItem
8189
onSelect={(e) => e.preventDefault()}
8290
onClick={() => setIsOpen(true)}
@@ -117,7 +125,12 @@ const EditItem = ({ item, onSuccess }: EditItemProps) => {
117125
<FormItem>
118126
<FormLabel>Description</FormLabel>
119127
<FormControl>
120-
<Input placeholder="Description" type="text" {...field} />
128+
<Textarea
129+
placeholder="Enter a description for your item"
130+
className="resize-none"
131+
rows={3}
132+
{...field}
133+
/>
121134
</FormControl>
122135
<FormMessage />
123136
</FormItem>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import * as React from "react"
2+
3+
import { cn } from "@/lib/utils"
4+
5+
function Textarea({
6+
className,
7+
...props
8+
}: React.ComponentProps<"textarea">) {
9+
return (
10+
<textarea
11+
data-slot="textarea"
12+
className={cn(
13+
"placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input w-full min-w-0 rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
14+
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
15+
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
16+
className
17+
)}
18+
{...props}
19+
/>
20+
)
21+
}
22+
23+
export { Textarea }

0 commit comments

Comments
 (0)