Skip to content

Commit 611a874

Browse files
committed
🎨 Format
1 parent da5a6b4 commit 611a874

File tree

8 files changed

+36
-24
lines changed

8 files changed

+36
-24
lines changed

frontend/src/components/Admin/AddUser.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,8 @@ const AddUser = () => {
169169
render={({ field }) => (
170170
<FormItem>
171171
<FormLabel>
172-
Confirm Password <span className="text-destructive">*</span>
172+
Confirm Password{" "}
173+
<span className="text-destructive">*</span>
173174
</FormLabel>
174175
<FormControl>
175176
<Input

frontend/src/components/Admin/DeleteUser.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ const DeleteUser = ({ id, onSuccess }: DeleteUserProps) => {
2828
const [isOpen, setIsOpen] = useState(false)
2929
const queryClient = useQueryClient()
3030
const { showSuccessToast, showErrorToast } = useCustomToast()
31-
const {
32-
handleSubmit,
33-
} = useForm()
31+
const { handleSubmit } = useForm()
3432

3533
const deleteUser = async (id: string) => {
3634
await UsersService.deleteUser({ userId: id })

frontend/src/components/Admin/EditUser.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ const EditUser = ({ user, onSuccess }: EditUserProps) => {
8989

9090
const onSubmit = (data: FormData) => {
9191
// exclude confirm_password from submission data and remove password if empty
92-
const { confirm_password, ...submitData } = data
92+
const { confirm_password: _, ...submitData } = data
9393
if (!submitData.password) {
9494
delete submitData.password
9595
}
@@ -124,7 +124,12 @@ const EditUser = ({ user, onSuccess }: EditUserProps) => {
124124
Email <span className="text-destructive">*</span>
125125
</FormLabel>
126126
<FormControl>
127-
<Input placeholder="Email" type="email" {...field} required />
127+
<Input
128+
placeholder="Email"
129+
type="email"
130+
{...field}
131+
required
132+
/>
128133
</FormControl>
129134
<FormMessage />
130135
</FormItem>

frontend/src/components/Admin/columns.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import type { ColumnDef } from "@tanstack/react-table"
2+
23
import type { UserPublic } from "@/client"
34
import { Badge } from "@/components/ui/badge"
5+
import { cn } from "@/lib/utils"
46
import { UserActionsMenu } from "./UserActionsMenu"
57

68
export type UserTableData = UserPublic & {
@@ -16,7 +18,7 @@ export const columns: ColumnDef<UserTableData>[] = [
1618
return (
1719
<div className="flex items-center gap-2">
1820
<span
19-
className={`font-medium ${!fullName ? "text-muted-foreground" : ""}`}
21+
className={cn("font-medium", !fullName && "text-muted-foreground")}
2022
>
2123
{fullName || "N/A"}
2224
</span>
@@ -51,7 +53,10 @@ export const columns: ColumnDef<UserTableData>[] = [
5153
cell: ({ row }) => (
5254
<div className="flex items-center gap-2">
5355
<span
54-
className={`size-2 rounded-full ${row.original.is_active ? "bg-green-500" : "bg-gray-400"}`}
56+
className={cn(
57+
"size-2 rounded-full",
58+
row.original.is_active ? "bg-green-500" : "bg-gray-400",
59+
)}
5560
/>
5661
<span className={row.original.is_active ? "" : "text-muted-foreground"}>
5762
{row.original.is_active ? "Active" : "Inactive"}

frontend/src/components/Common/DataTable.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ export function DataTable<TData, TValue>({
5757
{header.isPlaceholder
5858
? null
5959
: flexRender(
60-
header.column.columnDef.header,
61-
header.getContext(),
62-
)}
60+
header.column.columnDef.header,
61+
header.getContext(),
62+
)}
6363
</TableHead>
6464
)
6565
})}
@@ -69,9 +69,7 @@ export function DataTable<TData, TValue>({
6969
<TableBody>
7070
{table.getRowModel().rows.length ? (
7171
table.getRowModel().rows.map((row) => (
72-
<TableRow
73-
key={row.id}
74-
>
72+
<TableRow key={row.id}>
7573
{row.getVisibleCells().map((cell) => (
7674
<TableCell key={cell.id}>
7775
{flexRender(cell.column.columnDef.cell, cell.getContext())}
@@ -103,7 +101,7 @@ export function DataTable<TData, TValue>({
103101
to{" "}
104102
{Math.min(
105103
(table.getState().pagination.pageIndex + 1) *
106-
table.getState().pagination.pageSize,
104+
table.getState().pagination.pageSize,
107105
data.length,
108106
)}{" "}
109107
of{" "}

frontend/src/components/Items/AddItem.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,12 @@ const AddItem = () => {
9797
Title <span className="text-destructive">*</span>
9898
</FormLabel>
9999
<FormControl>
100-
<Input placeholder="Title" type="text" {...field} required />
100+
<Input
101+
placeholder="Title"
102+
type="text"
103+
{...field}
104+
required
105+
/>
101106
</FormControl>
102107
<FormMessage />
103108
</FormItem>
@@ -125,10 +130,7 @@ const AddItem = () => {
125130
Cancel
126131
</Button>
127132
</DialogClose>
128-
<LoadingButton
129-
type="submit"
130-
loading={mutation.isPending}
131-
>
133+
<LoadingButton type="submit" loading={mutation.isPending}>
132134
Save
133135
</LoadingButton>
134136
</DialogFooter>

frontend/src/components/Items/DeleteItem.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ const DeleteItem = ({ id, onSuccess }: DeleteItemProps) => {
2828
const [isOpen, setIsOpen] = useState(false)
2929
const queryClient = useQueryClient()
3030
const { showSuccessToast, showErrorToast } = useCustomToast()
31-
const {
32-
handleSubmit,
33-
} = useForm()
31+
const { handleSubmit } = useForm()
3432

3533
const deleteItem = async (id: string) => {
3634
await ItemsService.deleteItem({ id: id })

frontend/src/components/Items/columns.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import type { ColumnDef } from "@tanstack/react-table"
22
import { Check, Copy } from "lucide-react"
3+
34
import type { ItemPublic } from "@/client"
45
import { Button } from "@/components/ui/button"
56
import { useCopyToClipboard } from "@/hooks/useCopyToClipboard"
7+
import { cn } from "@/lib/utils"
68
import { ItemActionsMenu } from "./ItemActionsMenu"
79

810
function CopyId({ id }: { id: string }) {
@@ -49,7 +51,10 @@ export const columns: ColumnDef<ItemPublic>[] = [
4951
const description = row.original.description
5052
return (
5153
<span
52-
className={`max-w-xs truncate block ${!description ? "text-muted-foreground italic" : "text-muted-foreground"}`}
54+
className={cn(
55+
"max-w-xs truncate block text-muted-foreground",
56+
!description && "italic",
57+
)}
5358
>
5459
{description || "No description"}
5560
</span>

0 commit comments

Comments
 (0)