From d77c3d2ea22678a7a7d844af2e40b024d2f396cb Mon Sep 17 00:00:00 2001 From: Lucas Oliveira Date: Thu, 18 Sep 2025 15:32:00 -0300 Subject: [PATCH 01/12] Added new label input component --- frontend/components/label-input.tsx | 40 +++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 frontend/components/label-input.tsx diff --git a/frontend/components/label-input.tsx b/frontend/components/label-input.tsx new file mode 100644 index 00000000..568b69fe --- /dev/null +++ b/frontend/components/label-input.tsx @@ -0,0 +1,40 @@ +import { Info } from "lucide-react"; +import { Input } from "./ui/input"; +import { Label } from "./ui/label"; +import { Tooltip, TooltipContent, TooltipTrigger } from "./ui/tooltip"; + +export function LabelInput({ + label, + helperText, + id, + required, + ...props +}: { + label: string; + helperText: string; + id: string; + required: boolean; +} & React.InputHTMLAttributes) { + return ( +
+ +
+ +
+
+ ); +} From 91b9d0d2c9faa63528cd43b3059987d27912a4eb Mon Sep 17 00:00:00 2001 From: Lucas Oliveira Date: Thu, 18 Sep 2025 15:32:13 -0300 Subject: [PATCH 02/12] Added tooltip from shadcn --- frontend/components/ui/tooltip.tsx | 30 +++++++++++++++++++++++++ frontend/package-lock.json | 35 ++++++++++++++++++++++++++++++ frontend/package.json | 1 + 3 files changed, 66 insertions(+) create mode 100644 frontend/components/ui/tooltip.tsx diff --git a/frontend/components/ui/tooltip.tsx b/frontend/components/ui/tooltip.tsx new file mode 100644 index 00000000..d7ca7125 --- /dev/null +++ b/frontend/components/ui/tooltip.tsx @@ -0,0 +1,30 @@ +"use client"; + +import * as TooltipPrimitive from "@radix-ui/react-tooltip"; +import * as React from "react"; + +import { cn } from "@/lib/utils"; + +const TooltipProvider = TooltipPrimitive.Provider; + +const Tooltip = TooltipPrimitive.Root; + +const TooltipTrigger = TooltipPrimitive.Trigger; + +const TooltipContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, sideOffset = 4, ...props }, ref) => ( + +)); +TooltipContent.displayName = TooltipPrimitive.Content.displayName; + +export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }; diff --git a/frontend/package-lock.json b/frontend/package-lock.json index ff4d5249..724ba48b 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -23,6 +23,7 @@ "@radix-ui/react-slot": "^1.2.3", "@radix-ui/react-switch": "^1.2.5", "@radix-ui/react-tabs": "^1.1.13", + "@radix-ui/react-tooltip": "^1.2.8", "@tailwindcss/forms": "^0.5.10", "@tailwindcss/typography": "^0.5.16", "@tanstack/react-query": "^5.86.0", @@ -1968,6 +1969,40 @@ } } }, + "node_modules/@radix-ui/react-tooltip": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@radix-ui/react-tooltip/-/react-tooltip-1.2.8.tgz", + "integrity": "sha512-tY7sVt1yL9ozIxvmbtN5qtmH2krXcBCfjEiCgKGLqunJHvgvZG2Pcl2oQ3kbcZARb1BGEHdkLzcYGO8ynVlieg==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.1.3", + "@radix-ui/react-compose-refs": "1.1.2", + "@radix-ui/react-context": "1.1.2", + "@radix-ui/react-dismissable-layer": "1.1.11", + "@radix-ui/react-id": "1.1.1", + "@radix-ui/react-popper": "1.2.8", + "@radix-ui/react-portal": "1.1.9", + "@radix-ui/react-presence": "1.1.5", + "@radix-ui/react-primitive": "2.1.3", + "@radix-ui/react-slot": "1.2.3", + "@radix-ui/react-use-controllable-state": "1.2.2", + "@radix-ui/react-visually-hidden": "1.2.3" + }, + "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 + } + } + }, "node_modules/@radix-ui/react-use-callback-ref": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@radix-ui/react-use-callback-ref/-/react-use-callback-ref-1.1.1.tgz", diff --git a/frontend/package.json b/frontend/package.json index 6ee29a28..0fbc5f3d 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -24,6 +24,7 @@ "@radix-ui/react-slot": "^1.2.3", "@radix-ui/react-switch": "^1.2.5", "@radix-ui/react-tabs": "^1.1.13", + "@radix-ui/react-tooltip": "^1.2.8", "@tailwindcss/forms": "^0.5.10", "@tailwindcss/typography": "^0.5.16", "@tanstack/react-query": "^5.86.0", From 74d746b0c2501da5721c197a2d0679b3f299783a Mon Sep 17 00:00:00 2001 From: Lucas Oliveira Date: Thu, 18 Sep 2025 15:32:21 -0300 Subject: [PATCH 03/12] changed layout of some UI components --- frontend/components/ui/card.tsx | 112 +++++++++++++++++++------------ frontend/components/ui/input.tsx | 24 ++++++- frontend/components/ui/tabs.tsx | 2 +- 3 files changed, 92 insertions(+), 46 deletions(-) diff --git a/frontend/components/ui/card.tsx b/frontend/components/ui/card.tsx index e70e64bb..210e2f19 100644 --- a/frontend/components/ui/card.tsx +++ b/frontend/components/ui/card.tsx @@ -1,52 +1,73 @@ import * as React from "react"; import { cn } from "@/lib/utils"; -const Card = React.forwardRef>( - ({ className, ...props }, ref) => ( -
- ) -); +const Card = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)); -const CardHeader = React.forwardRef>( - ({ className, ...props }, ref) => ( -
- ) -); +const CardHeader = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)); -const CardTitle = React.forwardRef>( - ({ className, ...props }, ref) => ( -

- ) -); +const CardTitle = React.forwardRef< + HTMLParagraphElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +

+)); -const CardDescription = React.forwardRef>( - ({ className, ...props }, ref) => ( -
- ) -); +const CardDescription = React.forwardRef< + HTMLParagraphElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)); -const CardContent = React.forwardRef>( - ({ className, ...props }, ref) => ( -
- ) -); +const CardContent = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)); -const CardFooter = React.forwardRef>( - ({ className, ...props }, ref) => ( -
- ) -); +const CardFooter = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)); Card.displayName = "Card"; CardHeader.displayName = "CardHeader"; @@ -55,4 +76,11 @@ CardDescription.displayName = "CardDescription"; CardContent.displayName = "CardContent"; CardFooter.displayName = "CardFooter"; -export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle }; +export { + Card, + CardContent, + CardDescription, + CardFooter, + CardHeader, + CardTitle, +}; diff --git a/frontend/components/ui/input.tsx b/frontend/components/ui/input.tsx index 3dc0b5f0..5248e526 100644 --- a/frontend/components/ui/input.tsx +++ b/frontend/components/ui/input.tsx @@ -1,15 +1,32 @@ import * as React from "react"; import { cn } from "@/lib/utils"; -export interface InputProps extends React.InputHTMLAttributes { +export interface InputProps + extends React.InputHTMLAttributes { icon?: React.ReactNode; inputClassName?: string; } const Input = React.forwardRef( ({ className, inputClassName, icon, type, placeholder, ...props }, ref) => { + const [hasValue, setHasValue] = React.useState( + Boolean(props.value || props.defaultValue), + ); + + const handleChange = (e: React.ChangeEvent) => { + setHasValue(e.target.value.length > 0); + if (props.onChange) { + props.onChange(e); + } + }; + return ( -