From 1bbaf0aaee26a3472b7def256410acb380734b79 Mon Sep 17 00:00:00 2001 From: david Date: Sun, 12 Apr 2026 19:28:26 +0200 Subject: [PATCH] Arreglos layout --- .../core/src/web/components/page-header.tsx | 4 +- .../src/components/form/select-field.tsx | 37 +- packages/rdx-ui/src/components/index.ts | 1 + .../rdx-ui/src/components/initials-avatar.tsx | 65 ++ .../src/components/layout/app-breadcrumb.tsx | 30 +- .../src/components/layout/app-header.tsx | 4 +- .../src/components/layout/app-layout.tsx | 16 +- .../src/components/layout/app-sidebar.tsx | 13 +- .../src/components/layout/app-topbar.tsx | 37 + .../layout/chart-area-interactive.tsx | 263 ------ .../src/components/layout/data-table.tsx | 751 ------------------ .../components/layout/dropdown-profile.tsx | 95 +++ .../rdx-ui/src/components/layout/index.ts | 1 - .../src/components/layout/nav-documents.tsx | 76 -- .../rdx-ui/src/components/layout/nav-main.tsx | 95 +-- .../src/components/layout/nav-projects.tsx | 82 -- .../rdx-ui/src/components/layout/nav-user.tsx | 83 +- .../src/components/layout/search-form.tsx | 38 - .../src/components/layout/section-cards.tsx | 97 --- .../src/components/layout/site-header.tsx | 237 ------ .../src/components/layout/team-switcher.tsx | 74 +- 21 files changed, 371 insertions(+), 1728 deletions(-) create mode 100644 packages/rdx-ui/src/components/initials-avatar.tsx create mode 100644 packages/rdx-ui/src/components/layout/app-topbar.tsx delete mode 100644 packages/rdx-ui/src/components/layout/chart-area-interactive.tsx delete mode 100644 packages/rdx-ui/src/components/layout/data-table.tsx create mode 100644 packages/rdx-ui/src/components/layout/dropdown-profile.tsx delete mode 100644 packages/rdx-ui/src/components/layout/nav-documents.tsx delete mode 100644 packages/rdx-ui/src/components/layout/nav-projects.tsx delete mode 100644 packages/rdx-ui/src/components/layout/search-form.tsx delete mode 100644 packages/rdx-ui/src/components/layout/section-cards.tsx delete mode 100644 packages/rdx-ui/src/components/layout/site-header.tsx diff --git a/modules/core/src/web/components/page-header.tsx b/modules/core/src/web/components/page-header.tsx index 9c1ac7f5..2050c1dc 100644 --- a/modules/core/src/web/components/page-header.tsx +++ b/modules/core/src/web/components/page-header.tsx @@ -21,7 +21,7 @@ export function PageHeader({ className, }: PageHeaderProps) { return ( -
+
{/* Lado izquierdo */}
@@ -36,7 +36,7 @@ export function PageHeader({ )} -
+

{title}

diff --git a/packages/rdx-ui/src/components/form/select-field.tsx b/packages/rdx-ui/src/components/form/select-field.tsx index 4b9bf1f4..87fc5a0a 100644 --- a/packages/rdx-ui/src/components/form/select-field.tsx +++ b/packages/rdx-ui/src/components/form/select-field.tsx @@ -2,7 +2,6 @@ import { Field, FieldDescription, FieldError, - FormControl, Select, SelectContent, SelectItem, @@ -90,25 +89,23 @@ export function SelectField({ onValueChange={field.onChange} value={field.value ?? undefined} > - - - - - + + + {normalizedItems.map((item) => ( diff --git a/packages/rdx-ui/src/components/index.ts b/packages/rdx-ui/src/components/index.ts index 241f5018..8be5ddf3 100644 --- a/packages/rdx-ui/src/components/index.ts +++ b/packages/rdx-ui/src/components/index.ts @@ -7,6 +7,7 @@ export * from "./error-overlay.tsx"; export * from "./form/index.ts"; export * from "./full-screen-modal.tsx"; export * from "./grid/index.ts"; +export * from "./initials-avatar.tsx"; export * from "./layout/index.ts"; export * from "./loading-overlay/index.ts"; export * from "./logo-verifactu.tsx"; diff --git a/packages/rdx-ui/src/components/initials-avatar.tsx b/packages/rdx-ui/src/components/initials-avatar.tsx new file mode 100644 index 00000000..2845df20 --- /dev/null +++ b/packages/rdx-ui/src/components/initials-avatar.tsx @@ -0,0 +1,65 @@ +import { Avatar, AvatarFallback } from "@repo/shadcn-ui/components"; +import { cn } from "@repo/shadcn-ui/lib/utils"; +import type * as React from "react"; + +type InitialsProps = { + name?: string | null; + maxParts?: number; + fallback?: string; +}; + +export const getInitials = ({ name, maxParts = 2, fallback = "?" }: InitialsProps): string => { + if (!name?.trim()) return fallback; + + return ( + name + .trim() + .split(/\s+/) + .filter(Boolean) + .slice(0, maxParts) + .map((p) => p[0]?.toUpperCase() ?? "") + .join("") || fallback + ); +}; + +export const Initials = (props: InitialsProps) => { + return <>{getInitials(props)}; +}; + +const VARIANT_CLASSES: Record = { + primary: "bg-primary/10 text-primary", + muted: "bg-muted text-muted-foreground", +}; + +type InitialsAvatarProps = React.ComponentProps & { + name?: string | null; + variant?: "primary" | "muted"; + maxParts?: number; + fallback?: string; + fallbackClassName?: string; +}; + +export const InitialsAvatar = ({ + name, + variant = "muted", + maxParts = 2, + fallback = "?", + className, + fallbackClassName, + ...props +}: InitialsAvatarProps) => { + return ( + + + + + + ); +}; diff --git a/packages/rdx-ui/src/components/layout/app-breadcrumb.tsx b/packages/rdx-ui/src/components/layout/app-breadcrumb.tsx index 88d8e3bb..94e90ae7 100644 --- a/packages/rdx-ui/src/components/layout/app-breadcrumb.tsx +++ b/packages/rdx-ui/src/components/layout/app-breadcrumb.tsx @@ -5,28 +5,20 @@ import { BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, - Separator, - SidebarTrigger, } from "@repo/shadcn-ui/components"; export const AppBreadcrumb = () => { return ( -
-
- - - - - - Building Your Application - - - - Data Fetching - - - -
-
+ + + + Building Your Application + + + + Data Fetching + + + ); }; diff --git a/packages/rdx-ui/src/components/layout/app-header.tsx b/packages/rdx-ui/src/components/layout/app-header.tsx index 35515a17..feffec43 100644 --- a/packages/rdx-ui/src/components/layout/app-header.tsx +++ b/packages/rdx-ui/src/components/layout/app-header.tsx @@ -7,8 +7,8 @@ export const AppHeader = ({ ...props }: PropsWithChildren<{ className?: string }>) => { return ( -
+
{children} -
+ ); }; diff --git a/packages/rdx-ui/src/components/layout/app-layout.tsx b/packages/rdx-ui/src/components/layout/app-layout.tsx index b93c12cb..4b85b6bc 100644 --- a/packages/rdx-ui/src/components/layout/app-layout.tsx +++ b/packages/rdx-ui/src/components/layout/app-layout.tsx @@ -2,26 +2,24 @@ import { SidebarInset, SidebarProvider } from "@repo/shadcn-ui/components"; import { Outlet } from "react-router"; import { AppSidebar } from "./app-sidebar.tsx"; -import { SiteHeader } from "./site-header.tsx"; +import { AppTopbar } from "./app-topbar.tsx"; export const AppLayout = () => { return ( - + {/* Aquí está el MAIN */} - -
-
- -
+ +
+
diff --git a/packages/rdx-ui/src/components/layout/app-sidebar.tsx b/packages/rdx-ui/src/components/layout/app-sidebar.tsx index e3ada0fb..c9450dda 100644 --- a/packages/rdx-ui/src/components/layout/app-sidebar.tsx +++ b/packages/rdx-ui/src/components/layout/app-sidebar.tsx @@ -1,4 +1,10 @@ -import { Sidebar, SidebarContent, SidebarFooter, SidebarHeader } from "@repo/shadcn-ui/components"; +import { + Sidebar, + SidebarContent, + SidebarFooter, + SidebarHeader, + SidebarRail, +} from "@repo/shadcn-ui/components"; import { CameraIcon, CircleIcon, @@ -140,8 +146,8 @@ const data = { export function AppSidebar({ ...props }: React.ComponentProps) { return ( - - + + @@ -151,6 +157,7 @@ export function AppSidebar({ ...props }: React.ComponentProps) { + ); } diff --git a/packages/rdx-ui/src/components/layout/app-topbar.tsx b/packages/rdx-ui/src/components/layout/app-topbar.tsx new file mode 100644 index 00000000..904f007c --- /dev/null +++ b/packages/rdx-ui/src/components/layout/app-topbar.tsx @@ -0,0 +1,37 @@ +import { + Avatar, + AvatarFallback, + AvatarImage, + Button, + Separator, + SidebarTrigger, +} from "@repo/shadcn-ui/components"; + +import { AppBreadcrumb } from "./app-breadcrumb.tsx"; +import { ProfileDropdown } from "./dropdown-profile.tsx"; + +export function AppTopbar() { + return ( +
+
+
+ + + +
+
+ + + + JD + + + } + /> +
+
+
+ ); +} diff --git a/packages/rdx-ui/src/components/layout/chart-area-interactive.tsx b/packages/rdx-ui/src/components/layout/chart-area-interactive.tsx deleted file mode 100644 index 59a89a7d..00000000 --- a/packages/rdx-ui/src/components/layout/chart-area-interactive.tsx +++ /dev/null @@ -1,263 +0,0 @@ -"use client"; - -import * as React from "react"; -import { Area, AreaChart, CartesianGrid, XAxis } from "recharts"; - -import { - Card, - CardContent, - CardDescription, - CardHeader, - CardTitle, - ChartConfig, - ChartContainer, - ChartTooltip, - ChartTooltipContent, - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue, - ToggleGroup, - ToggleGroupItem, -} from "@repo/shadcn-ui/components"; -import { useIsMobile } from "@repo/shadcn-ui/hooks/"; - -const chartData = [ - { date: "2024-04-01", desktop: 222, mobile: 150 }, - { date: "2024-04-02", desktop: 97, mobile: 180 }, - { date: "2024-04-03", desktop: 167, mobile: 120 }, - { date: "2024-04-04", desktop: 242, mobile: 260 }, - { date: "2024-04-05", desktop: 373, mobile: 290 }, - { date: "2024-04-06", desktop: 301, mobile: 340 }, - { date: "2024-04-07", desktop: 245, mobile: 180 }, - { date: "2024-04-08", desktop: 409, mobile: 320 }, - { date: "2024-04-09", desktop: 59, mobile: 110 }, - { date: "2024-04-10", desktop: 261, mobile: 190 }, - { date: "2024-04-11", desktop: 327, mobile: 350 }, - { date: "2024-04-12", desktop: 292, mobile: 210 }, - { date: "2024-04-13", desktop: 342, mobile: 380 }, - { date: "2024-04-14", desktop: 137, mobile: 220 }, - { date: "2024-04-15", desktop: 120, mobile: 170 }, - { date: "2024-04-16", desktop: 138, mobile: 190 }, - { date: "2024-04-17", desktop: 446, mobile: 360 }, - { date: "2024-04-18", desktop: 364, mobile: 410 }, - { date: "2024-04-19", desktop: 243, mobile: 180 }, - { date: "2024-04-20", desktop: 89, mobile: 150 }, - { date: "2024-04-21", desktop: 137, mobile: 200 }, - { date: "2024-04-22", desktop: 224, mobile: 170 }, - { date: "2024-04-23", desktop: 138, mobile: 230 }, - { date: "2024-04-24", desktop: 387, mobile: 290 }, - { date: "2024-04-25", desktop: 215, mobile: 250 }, - { date: "2024-04-26", desktop: 75, mobile: 130 }, - { date: "2024-04-27", desktop: 383, mobile: 420 }, - { date: "2024-04-28", desktop: 122, mobile: 180 }, - { date: "2024-04-29", desktop: 315, mobile: 240 }, - { date: "2024-04-30", desktop: 454, mobile: 380 }, - { date: "2024-05-01", desktop: 165, mobile: 220 }, - { date: "2024-05-02", desktop: 293, mobile: 310 }, - { date: "2024-05-03", desktop: 247, mobile: 190 }, - { date: "2024-05-04", desktop: 385, mobile: 420 }, - { date: "2024-05-05", desktop: 481, mobile: 390 }, - { date: "2024-05-06", desktop: 498, mobile: 520 }, - { date: "2024-05-07", desktop: 388, mobile: 300 }, - { date: "2024-05-08", desktop: 149, mobile: 210 }, - { date: "2024-05-09", desktop: 227, mobile: 180 }, - { date: "2024-05-10", desktop: 293, mobile: 330 }, - { date: "2024-05-11", desktop: 335, mobile: 270 }, - { date: "2024-05-12", desktop: 197, mobile: 240 }, - { date: "2024-05-13", desktop: 197, mobile: 160 }, - { date: "2024-05-14", desktop: 448, mobile: 490 }, - { date: "2024-05-15", desktop: 473, mobile: 380 }, - { date: "2024-05-16", desktop: 338, mobile: 400 }, - { date: "2024-05-17", desktop: 499, mobile: 420 }, - { date: "2024-05-18", desktop: 315, mobile: 350 }, - { date: "2024-05-19", desktop: 235, mobile: 180 }, - { date: "2024-05-20", desktop: 177, mobile: 230 }, - { date: "2024-05-21", desktop: 82, mobile: 140 }, - { date: "2024-05-22", desktop: 81, mobile: 120 }, - { date: "2024-05-23", desktop: 252, mobile: 290 }, - { date: "2024-05-24", desktop: 294, mobile: 220 }, - { date: "2024-05-25", desktop: 201, mobile: 250 }, - { date: "2024-05-26", desktop: 213, mobile: 170 }, - { date: "2024-05-27", desktop: 420, mobile: 460 }, - { date: "2024-05-28", desktop: 233, mobile: 190 }, - { date: "2024-05-29", desktop: 78, mobile: 130 }, - { date: "2024-05-30", desktop: 340, mobile: 280 }, - { date: "2024-05-31", desktop: 178, mobile: 230 }, - { date: "2024-06-01", desktop: 178, mobile: 200 }, - { date: "2024-06-02", desktop: 470, mobile: 410 }, - { date: "2024-06-03", desktop: 103, mobile: 160 }, - { date: "2024-06-04", desktop: 439, mobile: 380 }, - { date: "2024-06-05", desktop: 88, mobile: 140 }, - { date: "2024-06-06", desktop: 294, mobile: 250 }, - { date: "2024-06-07", desktop: 323, mobile: 370 }, - { date: "2024-06-08", desktop: 385, mobile: 320 }, - { date: "2024-06-09", desktop: 438, mobile: 480 }, - { date: "2024-06-10", desktop: 155, mobile: 200 }, - { date: "2024-06-11", desktop: 92, mobile: 150 }, - { date: "2024-06-12", desktop: 492, mobile: 420 }, - { date: "2024-06-13", desktop: 81, mobile: 130 }, - { date: "2024-06-14", desktop: 426, mobile: 380 }, - { date: "2024-06-15", desktop: 307, mobile: 350 }, - { date: "2024-06-16", desktop: 371, mobile: 310 }, - { date: "2024-06-17", desktop: 475, mobile: 520 }, - { date: "2024-06-18", desktop: 107, mobile: 170 }, - { date: "2024-06-19", desktop: 341, mobile: 290 }, - { date: "2024-06-20", desktop: 408, mobile: 450 }, - { date: "2024-06-21", desktop: 169, mobile: 210 }, - { date: "2024-06-22", desktop: 317, mobile: 270 }, - { date: "2024-06-23", desktop: 480, mobile: 530 }, - { date: "2024-06-24", desktop: 132, mobile: 180 }, - { date: "2024-06-25", desktop: 141, mobile: 190 }, - { date: "2024-06-26", desktop: 434, mobile: 380 }, - { date: "2024-06-27", desktop: 448, mobile: 490 }, - { date: "2024-06-28", desktop: 149, mobile: 200 }, - { date: "2024-06-29", desktop: 103, mobile: 160 }, - { date: "2024-06-30", desktop: 446, mobile: 400 }, -]; - -const chartConfig = { - visitors: { - label: "Visitors", - }, - desktop: { - label: "Desktop", - color: "hsl(var(--chart-1))", - }, - mobile: { - label: "Mobile", - color: "hsl(var(--chart-2))", - }, -} satisfies ChartConfig; - -export function ChartAreaInteractive() { - const isMobile = useIsMobile(); - const [timeRange, setTimeRange] = React.useState("30d"); - - React.useEffect(() => { - if (isMobile) { - setTimeRange("7d"); - } - }, [isMobile]); - - const filteredData = chartData.filter((item) => { - const date = new Date(item.date); - const referenceDate = new Date("2024-06-30"); - let daysToSubtract = 90; - if (timeRange === "30d") { - daysToSubtract = 30; - } else if (timeRange === "7d") { - daysToSubtract = 7; - } - const startDate = new Date(referenceDate); - startDate.setDate(startDate.getDate() - daysToSubtract); - return date >= startDate; - }); - - return ( - - - Total Visitors - - Total for the last 3 months - Last 3 months - -
- - - Last 3 months - - - Last 30 days - - - Last 7 days - - - -
-
- - - - - - - - - - - - - - - { - const date = new Date(value); - return date.toLocaleDateString("en-US", { - month: "short", - day: "numeric", - }); - }} - /> - { - return new Date(value).toLocaleDateString("en-US", { - month: "short", - day: "numeric", - }); - }} - indicator='dot' - /> - } - /> - - - - - -
- ); -} diff --git a/packages/rdx-ui/src/components/layout/data-table.tsx b/packages/rdx-ui/src/components/layout/data-table.tsx deleted file mode 100644 index 55e7d0f1..00000000 --- a/packages/rdx-ui/src/components/layout/data-table.tsx +++ /dev/null @@ -1,751 +0,0 @@ -"use client"; - -import { - DndContext, - type DragEndEvent, - KeyboardSensor, - MouseSensor, - TouchSensor, - type UniqueIdentifier, - closestCenter, - useSensor, - useSensors, -} from "@dnd-kit/core"; -import { restrictToVerticalAxis } from "@dnd-kit/modifiers"; -import { - SortableContext, - arrayMove, - useSortable, - verticalListSortingStrategy, -} from "@dnd-kit/sortable"; -import { CSS } from "@dnd-kit/utilities"; -import { Badge } from "@repo/shadcn-ui/components/badge"; -import { Button } from "@repo/shadcn-ui/components/button"; -import { - type ChartConfig, - ChartContainer, - ChartTooltip, - ChartTooltipContent, -} from "@repo/shadcn-ui/components/chart"; -import { Checkbox } from "@repo/shadcn-ui/components/checkbox"; -import { - DropdownMenu, - DropdownMenuCheckboxItem, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuSeparator, - DropdownMenuTrigger, -} from "@repo/shadcn-ui/components/dropdown-menu"; -import { Input } from "@repo/shadcn-ui/components/input"; -import { Label } from "@repo/shadcn-ui/components/label"; -import { - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue, -} from "@repo/shadcn-ui/components/select"; -import { Separator } from "@repo/shadcn-ui/components/separator"; -import { - Sheet, - SheetClose, - SheetContent, - SheetDescription, - SheetFooter, - SheetHeader, - SheetTitle, - SheetTrigger, -} from "@repo/shadcn-ui/components/sheet"; -import { - Table, - TableBody, - TableCell, - TableHead, - TableHeader, - TableRow, -} from "@repo/shadcn-ui/components/table"; -import { Tabs, TabsContent, TabsList, TabsTrigger } from "@repo/shadcn-ui/components/tabs"; -import { useIsMobile } from "@repo/shadcn-ui/hooks"; -import { - type ColumnDef, - type ColumnFiltersState, - type Row, - type SortingState, - type VisibilityState, - flexRender, - getCoreRowModel, - getFacetedRowModel, - getFacetedUniqueValues, - getFilteredRowModel, - getPaginationRowModel, - getSortedRowModel, - useReactTable, -} from "@tanstack/react-table"; -import { - CheckCircle2Icon, - ChevronDownIcon, - ChevronLeftIcon, - ChevronRightIcon, - ChevronsLeftIcon, - ChevronsRightIcon, - ColumnsIcon, - GripVerticalIcon, - LoaderIcon, - MoreVerticalIcon, - PlusIcon, - TrendingUpIcon, -} from "lucide-react"; -import * as React from "react"; -import { Area, AreaChart, CartesianGrid, XAxis } from "recharts"; -import { toast } from "sonner"; -import { z } from "zod/v4"; - -export const schema = z.object({ - id: z.number(), - header: z.string(), - type: z.string(), - status: z.string(), - target: z.string(), - limit: z.string(), - reviewer: z.string(), -}); - -// Create a separate component for the drag handle -function DragHandle({ id }: { id: number }) { - const { attributes, listeners } = useSortable({ - id, - }); - - return ( - - ); -} - -const columns: ColumnDef>[] = [ - { - id: "drag", - header: () => null, - cell: ({ row }) => , - }, - { - id: "select", - header: ({ table }) => ( -
- table.toggleAllPageRowsSelected(!!value)} - /> -
- ), - cell: ({ row }) => ( -
- row.toggleSelected(!!value)} - /> -
- ), - enableSorting: false, - enableHiding: false, - }, - { - accessorKey: "header", - header: "Header", - cell: ({ row }) => { - return ; - }, - enableHiding: false, - }, - { - accessorKey: "type", - header: "Section Type", - cell: ({ row }) => ( -
- - {row.original.type} - -
- ), - }, - { - accessorKey: "status", - header: "Status", - cell: ({ row }) => ( - - {row.original.status === "Done" ? ( - - ) : ( - - )} - {row.original.status} - - ), - }, - { - accessorKey: "target", - header: () =>
Target
, - cell: ({ row }) => ( -
{ - e.preventDefault(); - toast.promise(new Promise((resolve) => setTimeout(resolve, 1000)), { - loading: `Saving ${row.original.header}`, - success: "Done", - error: "Error", - }); - }} - > - - -
- ), - }, - { - accessorKey: "limit", - header: () =>
Limit
, - cell: ({ row }) => ( -
{ - e.preventDefault(); - toast.promise(new Promise((resolve) => setTimeout(resolve, 1000)), { - loading: `Saving ${row.original.header}`, - success: "Done", - error: "Error", - }); - }} - > - - -
- ), - }, - { - accessorKey: "reviewer", - header: "Reviewer", - cell: ({ row }) => { - const isAssigned = row.original.reviewer !== "Assign reviewer"; - - if (isAssigned) { - return row.original.reviewer; - } - - return ( - <> - - - - ); - }, - }, - { - id: "actions", - cell: () => ( - - - - - - Edit - Make a copy - Favorite - - Delete - - - ), - }, -]; - -function DraggableRow({ row }: { row: Row> }) { - const { transform, transition, setNodeRef, isDragging } = useSortable({ - id: row.original.id, - }); - - return ( - - {row.getVisibleCells().map((cell) => ( - - {flexRender(cell.column.columnDef.cell, cell.getContext())} - - ))} - - ); -} - -export function DataTable({ data: initialData }: { data: z.infer[] }) { - const [data, setData] = React.useState(() => initialData); - const [rowSelection, setRowSelection] = React.useState({}); - const [columnVisibility, setColumnVisibility] = React.useState({}); - const [columnFilters, setColumnFilters] = React.useState([]); - const [sorting, setSorting] = React.useState([]); - const [pagination, setPagination] = React.useState({ - pageIndex: 0, - pageSize: 10, - }); - const sortableId = React.useId(); - const sensors = useSensors( - useSensor(MouseSensor, {}), - useSensor(TouchSensor, {}), - useSensor(KeyboardSensor, {}) - ); - - const dataIds = React.useMemo(() => data?.map(({ id }) => id) || [], [data]); - - const table = useReactTable({ - data, - columns, - state: { - sorting, - columnVisibility, - rowSelection, - columnFilters, - pagination, - }, - getRowId: (row) => row.id.toString(), - enableRowSelection: true, - onRowSelectionChange: setRowSelection, - onSortingChange: setSorting, - onColumnFiltersChange: setColumnFilters, - onColumnVisibilityChange: setColumnVisibility, - onPaginationChange: setPagination, - getCoreRowModel: getCoreRowModel(), - getFilteredRowModel: getFilteredRowModel(), - getPaginationRowModel: getPaginationRowModel(), - getSortedRowModel: getSortedRowModel(), - getFacetedRowModel: getFacetedRowModel(), - getFacetedUniqueValues: getFacetedUniqueValues(), - }); - - function handleDragEnd(event: DragEndEvent) { - const { active, over } = event; - if (active && over && active.id !== over.id) { - setData((data) => { - const oldIndex = dataIds.indexOf(active.id); - const newIndex = dataIds.indexOf(over.id); - return arrayMove(data, oldIndex, newIndex); - }); - } - } - - return ( - -
- - - - Outline - - Past Performance{" "} - - 3 - - - - Key Personnel{" "} - - 2 - - - Focus Documents - -
- - - - - - {table - .getAllColumns() - .filter((column) => typeof column.accessorFn !== "undefined" && column.getCanHide()) - .map((column) => { - return ( - column.toggleVisibility(!!value)} - > - {column.id} - - ); - })} - - - -
-
- -
- - - - {table.getHeaderGroups().map((headerGroup) => ( - - {headerGroup.headers.map((header) => { - return ( - - {header.isPlaceholder - ? null - : flexRender(header.column.columnDef.header, header.getContext())} - - ); - })} - - ))} - - - {table.getRowModel().rows?.length ? ( - - {table.getRowModel().rows.map((row) => ( - - ))} - - ) : ( - - - No results. - - - )} - -
-
-
-
-
- {table.getFilteredSelectedRowModel().rows.length} of{" "} - {table.getFilteredRowModel().rows.length} row(s) selected. -
-
-
- - -
-
- Page {table.getState().pagination.pageIndex + 1} of {table.getPageCount()} -
-
- - - - -
-
-
-
- -
- - -
- - -
- - - ); -} - -const chartData = [ - { month: "January", desktop: 186, mobile: 80 }, - { month: "February", desktop: 305, mobile: 200 }, - { month: "March", desktop: 237, mobile: 120 }, - { month: "April", desktop: 73, mobile: 190 }, - { month: "May", desktop: 209, mobile: 130 }, - { month: "June", desktop: 214, mobile: 140 }, -]; - -const chartConfig = { - desktop: { - label: "Desktop", - color: "var(--primary)", - }, - mobile: { - label: "Mobile", - color: "var(--primary)", - }, -} satisfies ChartConfig; - -function TableCellViewer({ item }: { item: z.infer }) { - const isMobile = useIsMobile(); - - return ( - - - - - - - {item.header} - Showing total visitors for the last 6 months - -
- {!isMobile && ( - <> - - - - value.slice(0, 3)} - tickLine={false} - tickMargin={8} - /> - } cursor={false} /> - - - - - -
-
- Trending up by 5.2% this month -
-
- Showing total visitors for the last 6 months. This is just some random text to - test the layout. It spans multiple lines and should wrap around. -
-
- - - )} -
-
- - -
-
-
- - -
-
- - -
-
-
-
- - -
-
- - -
-
-
- - -
-
-
- - - - - - -
-
- ); -} diff --git a/packages/rdx-ui/src/components/layout/dropdown-profile.tsx b/packages/rdx-ui/src/components/layout/dropdown-profile.tsx new file mode 100644 index 00000000..ed0b4741 --- /dev/null +++ b/packages/rdx-ui/src/components/layout/dropdown-profile.tsx @@ -0,0 +1,95 @@ +import { + Avatar, + AvatarFallback, + AvatarImage, + DropdownMenu, + DropdownMenuContent, + DropdownMenuGroup, + DropdownMenuItem, + DropdownMenuLabel, + DropdownMenuSeparator, + DropdownMenuTrigger, +} from "@repo/shadcn-ui/components"; +import { + CirclePlusIcon, + CreditCardIcon, + LogOutIcon, + SettingsIcon, + SquarePenIcon, + UserIcon, + UsersIcon, +} from "lucide-react"; +import type { ReactNode } from "react"; + +type Props = { + trigger: ReactNode; + defaultOpen?: boolean; + align?: "start" | "center" | "end"; +}; + +export const ProfileDropdown = ({ trigger, defaultOpen, align = "end" }: Props) => { + return ( + + {trigger} + + + +
+ + + JD + + +
+
+ John Doe + john.doe@example.com +
+
+ + + + + + My account + + + + Settings + + + + Billing + +
+ + + + + + + Manage team + + + + Customization + + + + Add team account + + + + + + + + Logout + +
+
+ ); +}; diff --git a/packages/rdx-ui/src/components/layout/index.ts b/packages/rdx-ui/src/components/layout/index.ts index 6af15182..a1ea1a6e 100644 --- a/packages/rdx-ui/src/components/layout/index.ts +++ b/packages/rdx-ui/src/components/layout/index.ts @@ -1,4 +1,3 @@ -export * from "./app-breadcrumb.tsx"; export * from "./app-content.tsx"; export * from "./app-header.tsx"; export * from "./app-layout.tsx"; diff --git a/packages/rdx-ui/src/components/layout/nav-documents.tsx b/packages/rdx-ui/src/components/layout/nav-documents.tsx deleted file mode 100644 index f86e1fa7..00000000 --- a/packages/rdx-ui/src/components/layout/nav-documents.tsx +++ /dev/null @@ -1,76 +0,0 @@ -"use client"; - -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuTrigger, -} from "@repo/shadcn-ui/components/dropdown-menu"; -import { - SidebarGroup, - SidebarGroupLabel, - SidebarMenu, - SidebarMenuAction, - SidebarMenuButton, - SidebarMenuItem, - useSidebar, -} from "@repo/shadcn-ui/components/sidebar"; -import { FolderIcon, type LucideIcon, MoreHorizontalIcon, ShareIcon } from "lucide-react"; - -export function NavDocuments({ - items, -}: { - items: { - name: string; - url: string; - icon: LucideIcon; - }[]; -}) { - const { isMobile } = useSidebar(); - - return ( - - Documents - - {items.map((item) => ( - - - - - {item.name} - - - - - - - More - - - - - - Open - - - - Share - - - - - ))} - - - - More - - - - - ); -} diff --git a/packages/rdx-ui/src/components/layout/nav-main.tsx b/packages/rdx-ui/src/components/layout/nav-main.tsx index e65b432f..82075c4c 100644 --- a/packages/rdx-ui/src/components/layout/nav-main.tsx +++ b/packages/rdx-ui/src/components/layout/nav-main.tsx @@ -3,7 +3,7 @@ import { CollapsibleContent, CollapsibleTrigger, SidebarGroup, - SidebarGroupContent, + SidebarGroupLabel, SidebarMenu, SidebarMenuButton, SidebarMenuItem, @@ -11,66 +11,53 @@ import { SidebarMenuSubButton, SidebarMenuSubItem, } from "@repo/shadcn-ui/components"; -import { ChevronRightIcon, type LucideIcon, PlusCircleIcon } from "lucide-react"; -import { useNavigate } from "react-router"; +import { ChevronRightIcon, type LucideIcon } from "lucide-react"; -type NavMainItem = { - title: string; - url?: string; - icon?: LucideIcon; - isActive?: boolean; - items?: { +export function NavMain({ + items, +}: { + items: { title: string; - url: string; + url?: string; + icon?: LucideIcon; + isActive?: boolean; + items?: { + title: string; + url: string; + }[]; }[]; -}; - -export function NavMain({ items }: { items: NavMainItem[] }) { - const navigate = useNavigate(); - +}) { return ( - - - - - - Quick Create - - - - - {items.map((item) => ( - - - - - {item.icon && } - {item.title} - - - - - - {item.items?.map((subItem) => ( - - - + Módulos + + {items.map((item) => ( + + + }> + {item.icon && } + {item.title} + + + + + {item.items?.map((subItem) => ( + + {subItem.title} - - - ))} - - - - - ))} - - + } + /> + + ))} + + + + + ))} + ); } diff --git a/packages/rdx-ui/src/components/layout/nav-projects.tsx b/packages/rdx-ui/src/components/layout/nav-projects.tsx deleted file mode 100644 index eaa0d8a8..00000000 --- a/packages/rdx-ui/src/components/layout/nav-projects.tsx +++ /dev/null @@ -1,82 +0,0 @@ -"use client"; - -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuSeparator, - DropdownMenuTrigger, -} from "@repo/shadcn-ui/components/dropdown-menu"; -import { - SidebarGroup, - SidebarGroupLabel, - SidebarMenu, - SidebarMenuAction, - SidebarMenuButton, - SidebarMenuItem, - useSidebar, -} from "@repo/shadcn-ui/components/sidebar"; -import { Folder, Forward, type LucideIcon, MoreHorizontal, Trash2 } from "lucide-react"; - -export function NavProjects({ - projects, -}: { - projects: { - name: string; - url: string; - icon: LucideIcon; - }[]; -}) { - const { isMobile } = useSidebar(); - - return ( - - Projects - - {projects.map((item) => ( - - - - - {item.name} - - - - - - - More - - - - - - View Project - - - - Share Project - - - - - Delete Project - - - - - ))} - - - - More - - - - - ); -} diff --git a/packages/rdx-ui/src/components/layout/nav-user.tsx b/packages/rdx-ui/src/components/layout/nav-user.tsx index f7d27237..27195da9 100644 --- a/packages/rdx-ui/src/components/layout/nav-user.tsx +++ b/packages/rdx-ui/src/components/layout/nav-user.tsx @@ -16,13 +16,7 @@ import { SidebarMenuItem, useSidebar, } from "@repo/shadcn-ui/components/sidebar"; -import { - BellIcon, - CreditCardIcon, - LogOutIcon, - MoreVerticalIcon, - UserCircleIcon, -} from "lucide-react"; +import { BadgeCheck, Bell, ChevronsUpDownIcon, CreditCard, LogOut, Sparkles } from "lucide-react"; export function NavUser({ user, @@ -34,63 +28,72 @@ export function NavUser({ }; }) { const { isMobile } = useSidebar(); - return ( - - - - - CN - -
- {user.name} - {user.email} -
- -
-
- - -
- + + CN
{user.name} - {user.email} + {user.email}
-
-
+ + + } + /> + + + + +
+ + + CN + +
+ {user.name} + {user.email} +
+
+
+ + + + Upgrade to Pro + +
- + Account - + Billing - + Notifications - + Log out
diff --git a/packages/rdx-ui/src/components/layout/search-form.tsx b/packages/rdx-ui/src/components/layout/search-form.tsx deleted file mode 100644 index e78e3aa0..00000000 --- a/packages/rdx-ui/src/components/layout/search-form.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import { - Button, - Label, - SidebarGroup, - SidebarGroupContent, - SidebarInput, - SidebarMenu, - SidebarMenuItem, -} from "@repo/shadcn-ui/components"; -import { BinocularsIcon, SearchIcon } from "lucide-react"; - -export function SearchForm({ ...props }: React.ComponentProps<"form">) { - return ( -
- - - - - - - - - - - - -
- ); -} diff --git a/packages/rdx-ui/src/components/layout/section-cards.tsx b/packages/rdx-ui/src/components/layout/section-cards.tsx deleted file mode 100644 index 47efa451..00000000 --- a/packages/rdx-ui/src/components/layout/section-cards.tsx +++ /dev/null @@ -1,97 +0,0 @@ -import { TrendingDownIcon, TrendingUpIcon } from "lucide-react"; - -import { - Card, - CardDescription, - CardFooter, - CardHeader, - CardTitle, -} from "@repo/shadcn-ui/components"; -import { Badge } from "@repo/shadcn-ui/components/badge"; - -export function SectionCards() { - return ( -
- - - Total Revenue - - $1,250.00 - -
- - - +12.5% - -
-
- -
- Trending up this month -
-
Visitors for the last 6 months
-
-
- - - New Customers - - 1,234 - -
- - - -20% - -
-
- -
- Down 20% this period -
-
Acquisition needs attention
-
-
- - - Active Accounts - - 45,678 - -
- - - +12.5% - -
-
- -
- Strong user retention -
-
Engagement exceed targets
-
-
- - - Growth Rate - - 4.5% - -
- - - +4.5% - -
-
- -
- Steady performance -
-
Meets growth projections
-
-
-
- ); -} diff --git a/packages/rdx-ui/src/components/layout/site-header.tsx b/packages/rdx-ui/src/components/layout/site-header.tsx deleted file mode 100644 index 3a0706ce..00000000 --- a/packages/rdx-ui/src/components/layout/site-header.tsx +++ /dev/null @@ -1,237 +0,0 @@ -import { Button, Separator, SidebarTrigger } from "@repo/shadcn-ui/components"; -import { Link } from "react-router-dom"; - -export function SiteHeader() { - return ( -
-
- - -
-
- - - -
- - k -
-
-
- -
- -
-

- Command Palette -

-

- Search for a command to run... -

-
-
-
- -
- -
- - Get Pro - - - - -
- -
-
-
- ); -} diff --git a/packages/rdx-ui/src/components/layout/team-switcher.tsx b/packages/rdx-ui/src/components/layout/team-switcher.tsx index 5495fe16..3eb5cc4b 100644 --- a/packages/rdx-ui/src/components/layout/team-switcher.tsx +++ b/packages/rdx-ui/src/components/layout/team-switcher.tsx @@ -3,6 +3,7 @@ import { DropdownMenu, DropdownMenuContent, + DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, @@ -36,48 +37,53 @@ export function TeamSwitcher({ - - -
- -
-
- {activeTeam.name} - {activeTeam.plan} -
- -
-
+ +
+ +
+
+ {activeTeam.name} + {activeTeam.plan} +
+ + + } + /> + - Teams - {teams.map((team, index) => ( - setActiveTeam(team)} - > -
- + + Teams + {teams.map((team, index) => ( + setActiveTeam(team)} + > +
+ +
+ {team.name} + ⌘{index + 1} +
+ ))} + + +
+
- {team.name} - ⌘{index + 1} +
Add team
- ))} - - -
- -
-
Add team
-
+