From 7712959d4e921fb3ea6bbe6d64a5dd0a63fa80df Mon Sep 17 00:00:00 2001 From: MatheusNevs Date: Thu, 22 Aug 2024 19:42:28 -0300 Subject: [PATCH 1/5] feat: forms componente not ready --- package.json | 1 + pnpm-lock.yaml | 47 +++++++-- src/app/page.tsx | 8 +- src/components/formComponent/example.tsx | 78 ++++++++++++++ src/components/formComponent/index.tsx | 126 +++++++++++++++++++++++ src/components/ui/checkbox.tsx | 30 ++++++ 6 files changed, 276 insertions(+), 14 deletions(-) create mode 100644 src/components/formComponent/example.tsx create mode 100644 src/components/formComponent/index.tsx create mode 100644 src/components/ui/checkbox.tsx diff --git a/package.json b/package.json index fef3323..d1e1e00 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "@hookform/resolvers": "^3.9.0", "@next-auth/prisma-adapter": "^1.0.7", "@prisma/client": "^5.18.0", + "@radix-ui/react-checkbox": "^1.1.1", "@radix-ui/react-dropdown-menu": "^2.1.1", "@radix-ui/react-icons": "^1.3.0", "@radix-ui/react-label": "^2.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a14fb6c..dae5cad 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -10,14 +10,16 @@ importers: dependencies: '@hookform/resolvers': specifier: ^3.9.0 - - version: 3.9.0(react-hook-form@7.52.1(react@18.3.1)) + version: 3.9.0(react-hook-form@7.52.2(react@18.3.1)) '@next-auth/prisma-adapter': specifier: ^1.0.7 - version: 1.0.7(@prisma/client@5.16.1(prisma@5.16.1))(next-auth@4.24.7(next@14.2.4(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)) + version: 1.0.7(@prisma/client@5.18.0(prisma@5.18.0))(next-auth@4.24.7(next@14.2.4(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)) '@prisma/client': specifier: ^5.18.0 version: 5.18.0(prisma@5.18.0) + '@radix-ui/react-checkbox': + specifier: ^1.1.1 + version: 1.1.1(@types/react-dom@18.3.0)(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@radix-ui/react-dropdown-menu': specifier: ^2.1.1 version: 2.1.1(@types/react-dom@18.3.0)(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -519,6 +521,19 @@ packages: '@types/react-dom': optional: true + '@radix-ui/react-checkbox@1.1.1': + resolution: {integrity: sha512-0i/EKJ222Afa1FE0C6pNJxDq1itzcl3HChE9DwskA4th4KRse8ojx8a1nVcOjwJdbpDLcz7uol77yYnQNMHdKw==} + peerDependencies: + '@types/react': '*' + '@types/react-dom': '*' + react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc + react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc + peerDependenciesMeta: + '@types/react': + optional: true + '@types/react-dom': + optional: true + '@radix-ui/react-collection@1.1.0': resolution: {integrity: sha512-GZsZslMJEyo1VKm5L1ZJY8tGDxZNPAoUeQUIbKeJfoi7Q4kmig5AsgLMYYuyYbfjd8fBmFORAIwYAkXMnXZgZw==} peerDependencies: @@ -2714,12 +2729,6 @@ snapshots: '@floating-ui/utils@0.2.7': {} - '@hapi/hoek@9.3.0': {} - - '@hapi/topo@5.1.0': - dependencies: - '@hapi/hoek': 9.3.0 - '@hookform/resolvers@3.9.0(react-hook-form@7.52.2(react@18.3.1))': dependencies: react-hook-form: 7.52.2(react@18.3.1) @@ -2762,9 +2771,9 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.4.15 - '@next-auth/prisma-adapter@1.0.7(@prisma/client@5.16.1(prisma@5.16.1))(next-auth@4.24.7(next@14.2.4(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1))': + '@next-auth/prisma-adapter@1.0.7(@prisma/client@5.18.0(prisma@5.18.0))(next-auth@4.24.7(next@14.2.4(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1))': dependencies: - '@prisma/client': 5.16.1(prisma@5.16.1) + '@prisma/client': 5.18.0(prisma@5.18.0) next-auth: 4.24.7(next@14.2.4(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@next/env@14.2.4': {} @@ -2855,6 +2864,22 @@ snapshots: '@types/react': 18.3.3 '@types/react-dom': 18.3.0 + '@radix-ui/react-checkbox@1.1.1(@types/react-dom@18.3.0)(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': + dependencies: + '@radix-ui/primitive': 1.1.0 + '@radix-ui/react-compose-refs': 1.1.0(@types/react@18.3.3)(react@18.3.1) + '@radix-ui/react-context': 1.1.0(@types/react@18.3.3)(react@18.3.1) + '@radix-ui/react-presence': 1.1.0(@types/react-dom@18.3.0)(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@radix-ui/react-primitive': 2.0.0(@types/react-dom@18.3.0)(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@radix-ui/react-use-controllable-state': 1.1.0(@types/react@18.3.3)(react@18.3.1) + '@radix-ui/react-use-previous': 1.1.0(@types/react@18.3.3)(react@18.3.1) + '@radix-ui/react-use-size': 1.1.0(@types/react@18.3.3)(react@18.3.1) + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) + optionalDependencies: + '@types/react': 18.3.3 + '@types/react-dom': 18.3.0 + '@radix-ui/react-collection@1.1.0(@types/react-dom@18.3.0)(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: '@radix-ui/react-compose-refs': 1.1.0(@types/react@18.3.3)(react@18.3.1) diff --git a/src/app/page.tsx b/src/app/page.tsx index fea693e..a22d001 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,9 +1,11 @@ -import { NavBarEstoque } from "./_components/navBarEstoque"; +import { FormsExample } from "@/components/formComponent/example"; +// import { NavBarEstoque } from "./_components/navBarEstoque"; export default async function Home() { return (
- + {/* */} +
); -} \ No newline at end of file +} diff --git a/src/components/formComponent/example.tsx b/src/components/formComponent/example.tsx new file mode 100644 index 0000000..a092cb4 --- /dev/null +++ b/src/components/formComponent/example.tsx @@ -0,0 +1,78 @@ +"use client"; +import { Form } from "."; +import { useState } from "react"; + +export const FormsExample = () => { + const [name, setName] = useState(""); + const [email, setEmail] = useState(""); + const [password, setPassword] = useState(""); + const [confirmPassword, setConfirmPassword] = useState(""); + const [checked1, setChecked1] = useState(false); + const [checked2, setChecked2] = useState(false); + + return ( +
+
+ Criar Usuário + + + Digite o nome do funcionário + + + + + Digite o email de acesso + + + + + Digite a senha + + + + + Confirme a senha + + + + + + Este usuário vai poder: + + + Texto1 + + + + Texto2 + + + +
+
+ ); +}; diff --git a/src/components/formComponent/index.tsx b/src/components/formComponent/index.tsx new file mode 100644 index 0000000..8a4da66 --- /dev/null +++ b/src/components/formComponent/index.tsx @@ -0,0 +1,126 @@ +import { cn } from "@/lib/utils"; +import React, { HTMLInputTypeAttribute, InputHTMLAttributes } from "react"; +import { Checkbox } from "../ui/checkbox"; +import { check } from "prettier"; + +type FormProps = { + className?: string; + children: React.ReactNode[]; +}; + +export const Form = (props: FormProps) => { + const style = cn( + "px-[55px] pt-[90px] pb-[40px] gap-[30px] flex flex-col justify-around border-[#E0E0E0] border-[2px] rounded-[20px]", + props.className, + ); + return
{props.children}
; +}; + +type FormTitleProps = { + className?: string; + children: string; +}; + +Form.Title = function FormTitle(props: FormTitleProps) { + const style = cn("font-inter font-semibold text-[24px]", props.className); + return

{props.children}

; +}; + +type FormContentProps = { + className?: string; + children: React.ReactNode[]; +}; + +Form.Content = function FormContent(props: FormContentProps) { + const style = cn("flex flex-col w-full gap-[15px]", props.className); + return
{props.children}
; +}; + +type FormFieldProps = { + className?: string; + children: React.ReactNode[]; +}; + +Form.Field = function FormField(props: FormFieldProps) { + const style = cn( + "flex flex-col justify-start items-start w-full gap-[10px] ", + props.className, + ); + return
{props.children}
; +}; + +type FormLabelProps = { + className?: string; + children: string; +}; + +Form.Label = function FormLabel(props: FormLabelProps) { + const style = cn( + "justify-start font-inter font-regular text-[16px]", + props.className, + ); + return

{props.children}

; +}; + +type FormInputProps = { + className?: string; + placeholder: string; + value: string; + setValue: (value: string) => void; + type: HTMLInputTypeAttribute; +}; + +Form.Input = function FormInput(props: FormInputProps) { + const style = cn( + "w-full px-[10px] py-[3px] rounded-[8px] border-[2px] border-[#E0E0E0] font-inter font-medium text-[20px] placeholder-text-[#828282]", + props.className, + ); + return ( + props.setValue(event.target.value)} + type={props.type} + className={style} + /> + ); +}; + +type FormBoxSelectProps = { + className?: string; + children: string; + checked: boolean; + setChecked: (value: boolean) => void; +}; + +Form.BoxSelect = function FormBoxSelect(props: FormBoxSelectProps) { + const style = cn( + "font-inter font-regular text-[15px] leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70", + props.className, + ); + return ( +
+ { + if (typeof checked === "boolean") props.setChecked(checked); + }} + /> + +
+ ); +}; + +type FormButtonProps = { + className?: string; + placeholder: string; + /* eslint-disable @typescript-eslint/no-explicit-any */ + onClick: (data: any) => void; +}; + +// Fazer Label e Value (Input, Select, Box Select) +// Fazer Button diff --git a/src/components/ui/checkbox.tsx b/src/components/ui/checkbox.tsx new file mode 100644 index 0000000..df61a13 --- /dev/null +++ b/src/components/ui/checkbox.tsx @@ -0,0 +1,30 @@ +"use client" + +import * as React from "react" +import * as CheckboxPrimitive from "@radix-ui/react-checkbox" +import { Check } from "lucide-react" + +import { cn } from "@/lib/utils" + +const Checkbox = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + + + + + +)) +Checkbox.displayName = CheckboxPrimitive.Root.displayName + +export { Checkbox } From ea4ba730a242f124570c8ab079e81e674f076fcd Mon Sep 17 00:00:00 2001 From: MatheusNevs Date: Thu, 22 Aug 2024 23:26:07 -0300 Subject: [PATCH 2/5] feat: form button --- src/components/formComponent/example.tsx | 9 ++++++++- src/components/formComponent/index.tsx | 19 ++++++++++++++----- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/components/formComponent/example.tsx b/src/components/formComponent/example.tsx index a092cb4..f14c41d 100644 --- a/src/components/formComponent/example.tsx +++ b/src/components/formComponent/example.tsx @@ -33,7 +33,7 @@ export const FormsExample = () => { placeholder="email" value={email} setValue={setEmail} - type="text" + type="email" > @@ -72,6 +72,13 @@ export const FormsExample = () => { + console.log("criar usuario")} + className="border-none bg-[#34A853] text-white" + > + Criar Usuário + ); diff --git a/src/components/formComponent/index.tsx b/src/components/formComponent/index.tsx index 8a4da66..ceb6bfe 100644 --- a/src/components/formComponent/index.tsx +++ b/src/components/formComponent/index.tsx @@ -1,7 +1,6 @@ import { cn } from "@/lib/utils"; -import React, { HTMLInputTypeAttribute, InputHTMLAttributes } from "react"; +import React, { type HTMLInputTypeAttribute } from "react"; import { Checkbox } from "../ui/checkbox"; -import { check } from "prettier"; type FormProps = { className?: string; @@ -117,10 +116,20 @@ Form.BoxSelect = function FormBoxSelect(props: FormBoxSelectProps) { type FormButtonProps = { className?: string; - placeholder: string; + children: string; /* eslint-disable @typescript-eslint/no-explicit-any */ onClick: (data: any) => void; + type?: "button" | "submit" | "reset" | undefined; }; -// Fazer Label e Value (Input, Select, Box Select) -// Fazer Button +Form.Button = function FormButton(props: FormButtonProps) { + const style = cn( + "rounded-[8px] border-[2px] border-[#D9D9D9] py-[10px] items-center justify-center font-inter font-medium text-[16px] text-white bg-primary", + props.className, + ); + return ( + + ); +}; From 1a980f4c2a8b2fe40e9af7fa3a2c916646beef53 Mon Sep 17 00:00:00 2001 From: MatheusNevs Date: Fri, 23 Aug 2024 16:26:39 -0300 Subject: [PATCH 3/5] feat: example2 almost ready and form image --- src/app/page.tsx | 6 +- src/components/formComponent/example.tsx | 28 ++++- src/components/formComponent/example2.tsx | 121 ++++++++++++++++++++++ src/components/formComponent/index.tsx | 55 ++++++++-- 4 files changed, 199 insertions(+), 11 deletions(-) create mode 100644 src/components/formComponent/example2.tsx diff --git a/src/app/page.tsx b/src/app/page.tsx index a22d001..52a7f9e 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,11 +1,11 @@ -import { FormsExample } from "@/components/formComponent/example"; +import { FormsExample2 } from "@/components/formComponent/example2"; // import { NavBarEstoque } from "./_components/navBarEstoque"; - +import { FormsExample } from "@/components/formComponent/example"; export default async function Home() { return (
{/* */} - +
); } diff --git a/src/components/formComponent/example.tsx b/src/components/formComponent/example.tsx index f14c41d..046fecb 100644 --- a/src/components/formComponent/example.tsx +++ b/src/components/formComponent/example.tsx @@ -10,9 +10,33 @@ export const FormsExample = () => { const [checked1, setChecked1] = useState(false); const [checked2, setChecked2] = useState(false); + const onCancel = () => { + setName(""); + setEmail(""); + setPassword(""); + setConfirmPassword(""); + setChecked1(false); + setChecked2(false); + }; + + const onSave = (data: { + name: string; + email: string; + password: string; + confirmPassword: string; + cheked1: string; + cheked2: string; + }) => { + console.log(data); + }; + return (
-
+ Criar Usuário @@ -75,7 +99,7 @@ export const FormsExample = () => { console.log("criar usuario")} - className="border-none bg-[#34A853] text-white" + className="border-none bg-[#34A853]" > Criar Usuário diff --git a/src/components/formComponent/example2.tsx b/src/components/formComponent/example2.tsx new file mode 100644 index 0000000..390818a --- /dev/null +++ b/src/components/formComponent/example2.tsx @@ -0,0 +1,121 @@ +"use client"; +import { Form } from "."; +import { useState } from "react"; + +export const FormsExample2 = () => { + const [supplier, setSupplier] = useState(""); + const [category, setCategory] = useState(""); + const [name, setName] = useState(""); + const [manufactureDate, setManufactureDate] = useState(""); + const [currentQuantity, setCurrentQuantity] = useState("0"); + const [idealQuantity, setIdealQuantity] = useState("0"); + + const onCancel = () => { + setSupplier(""); + setCategory(""); + setName(""); + setManufactureDate(""); + setCurrentQuantity(""); + setIdealQuantity(""); + }; + + const onSave = (data: { + supplier: string; + category: string; + name: string; + manufactureDate: string; + currentQuantity: string; + idealQuantity: string; + }) => { + console.log(data); + }; + + return ( +
+ + console.log("editou foto")} + publicId="cld-sample-5" + > + Nome do Produto - Código do Produto + +
+ + Fornecedor + + + + + Nome + + + + + Data de Fabricação + setManufactureDate(value)} + type="date" + > + + + + Cancelar + +
+ +
+ + Categoria: + + + + + Quantidade ideal: + + + + + Situação: + + + + + Salvar + +
+
+ +
+ ); +}; diff --git a/src/components/formComponent/index.tsx b/src/components/formComponent/index.tsx index ceb6bfe..00b176e 100644 --- a/src/components/formComponent/index.tsx +++ b/src/components/formComponent/index.tsx @@ -1,18 +1,27 @@ import { cn } from "@/lib/utils"; import React, { type HTMLInputTypeAttribute } from "react"; import { Checkbox } from "../ui/checkbox"; +import CldImage from "../app/cldImage"; +import type { CldImageProps } from "next-cloudinary"; +/* eslint-disable @typescript-eslint/no-explicit-any */ type FormProps = { className?: string; children: React.ReactNode[]; + onCancel: () => void; + onSave: (data: any) => void; }; export const Form = (props: FormProps) => { const style = cn( - "px-[55px] pt-[90px] pb-[40px] gap-[30px] flex flex-col justify-around border-[#E0E0E0] border-[2px] rounded-[20px]", + "flex flex-col justify-around border-[#E0E0E0] border-[2px] rounded-[20px]", props.className, ); - return
{props.children}
; + return ( +
+ {props.children} +
+ ); }; type FormTitleProps = { @@ -63,10 +72,10 @@ Form.Label = function FormLabel(props: FormLabelProps) { type FormInputProps = { className?: string; - placeholder: string; + placeholder?: string; value: string; setValue: (value: string) => void; - type: HTMLInputTypeAttribute; + type?: HTMLInputTypeAttribute; }; Form.Input = function FormInput(props: FormInputProps) { @@ -117,8 +126,7 @@ Form.BoxSelect = function FormBoxSelect(props: FormBoxSelectProps) { type FormButtonProps = { className?: string; children: string; - /* eslint-disable @typescript-eslint/no-explicit-any */ - onClick: (data: any) => void; + onClick?: (data: any) => void; type?: "button" | "submit" | "reset" | undefined; }; @@ -133,3 +141,38 @@ Form.Button = function FormButton(props: FormButtonProps) { ); }; + +type FormImageProps = { + className?: string; + publicId: string; + onImageInput: (image: any) => void; + imageProps?: CldImageProps; +}; + +Form.Image = function FormImage(props: FormImageProps) { + const style = cn( + "w-fit h-fit rounded-[8px] border-[2px] border-[#D9D9D9] flex items-start justify-center relative", + props.className, + ); + return ( +
+ props.onImageInput(file)} + > + +
+ ); +}; + +// Arrumar input de imagem +// Fazer select From 0cff1b4c9f2e0dd6520bf69f8669fbdf704ea515 Mon Sep 17 00:00:00 2001 From: MatheusNevs Date: Sat, 24 Aug 2024 20:00:03 -0300 Subject: [PATCH 4/5] feat: forms component ready --- src/app/page.tsx | 8 +++----- src/components/formComponent/index.tsx | 19 +++++++++++-------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/app/page.tsx b/src/app/page.tsx index 52a7f9e..067aaa3 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,11 +1,9 @@ -import { FormsExample2 } from "@/components/formComponent/example2"; -// import { NavBarEstoque } from "./_components/navBarEstoque"; -import { FormsExample } from "@/components/formComponent/example"; +import { NavBarEstoque } from "./_components/navBarEstoque"; + export default async function Home() { return (
- {/* */} - +
); } diff --git a/src/components/formComponent/index.tsx b/src/components/formComponent/index.tsx index 00b176e..761f88b 100644 --- a/src/components/formComponent/index.tsx +++ b/src/components/formComponent/index.tsx @@ -3,6 +3,7 @@ import React, { type HTMLInputTypeAttribute } from "react"; import { Checkbox } from "../ui/checkbox"; import CldImage from "../app/cldImage"; import type { CldImageProps } from "next-cloudinary"; +import { Edit } from "lucide-react"; /* eslint-disable @typescript-eslint/no-explicit-any */ type FormProps = { @@ -156,11 +157,16 @@ Form.Image = function FormImage(props: FormImageProps) { ); return (
- props.onImageInput(file)} - > + + ); }; - -// Arrumar input de imagem -// Fazer select From 01d0a2819f81ee48a8fd02cf8452c494935dfbe8 Mon Sep 17 00:00:00 2001 From: MatheusNevs Date: Sat, 24 Aug 2024 20:26:56 -0300 Subject: [PATCH 5/5] fix: eslint problems --- .../estoque/_components/products/productsCard.tsx | 2 +- src/app/(admin)/historico/page.tsx | 2 +- src/app/(admin)/historico/users-actions-columns.tsx | 3 +-- src/app/_components/data-table-pagination.tsx | 2 +- src/app/_components/data-table.tsx | 5 +++-- src/app/_components/navBarEstoque.tsx | 11 ++++------- 6 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/app/(admin)/estoque/_components/products/productsCard.tsx b/src/app/(admin)/estoque/_components/products/productsCard.tsx index 8a59e29..41b9eb9 100644 --- a/src/app/(admin)/estoque/_components/products/productsCard.tsx +++ b/src/app/(admin)/estoque/_components/products/productsCard.tsx @@ -1,4 +1,4 @@ -import { CldImage } from "@/components/app/cldImage"; +import CldImage from "@/components/app/cldImage"; import { CardComponent } from "@/components/cardComponent"; import { cn } from "@/lib/utils"; import React from "react"; diff --git a/src/app/(admin)/historico/page.tsx b/src/app/(admin)/historico/page.tsx index cf3c9a6..1d43f6d 100644 --- a/src/app/(admin)/historico/page.tsx +++ b/src/app/(admin)/historico/page.tsx @@ -1,5 +1,5 @@ import { DataTable } from "@/app/_components/data-table"; -import { UsersAction, columns } from "./users-actions-columns"; +import { type UsersAction, columns } from "./users-actions-columns"; async function getData(): Promise { return [ diff --git a/src/app/(admin)/historico/users-actions-columns.tsx b/src/app/(admin)/historico/users-actions-columns.tsx index 5f6bd7a..b826895 100644 --- a/src/app/(admin)/historico/users-actions-columns.tsx +++ b/src/app/(admin)/historico/users-actions-columns.tsx @@ -1,6 +1,5 @@ "use client"; - -import { ColumnDef } from "@tanstack/react-table"; +import type { ColumnDef } from "@tanstack/react-table"; import { ArrowUpDown } from "lucide-react"; import { Button } from "@/components/ui/button"; diff --git a/src/app/_components/data-table-pagination.tsx b/src/app/_components/data-table-pagination.tsx index 3bf0928..453d866 100644 --- a/src/app/_components/data-table-pagination.tsx +++ b/src/app/_components/data-table-pagination.tsx @@ -4,7 +4,7 @@ import { DoubleArrowLeftIcon, DoubleArrowRightIcon, } from "@radix-ui/react-icons"; -import { Table } from "@tanstack/react-table"; +import type { Table } from "@tanstack/react-table"; import { Button } from "@/components//ui/button"; import { diff --git a/src/app/_components/data-table.tsx b/src/app/_components/data-table.tsx index cb1ef3e..6983efa 100644 --- a/src/app/_components/data-table.tsx +++ b/src/app/_components/data-table.tsx @@ -31,7 +31,7 @@ import { } from "@/components/ui/table"; import { DataTablePagination } from "./data-table-pagination"; -const columnTranslations = { +const columnTranslations: Record = { name: "Nome", action: "Ação", product: "Nome do Produto", @@ -95,8 +95,9 @@ export function DataTable({ .getAllColumns() .filter((column) => column.getCanHide()) .map((column) => { + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const translatedName = - columnTranslations[column.id] || column.id; + columnTranslations[column.id] ?? column.id; return (
- + ffff
- + {tabValue}