From 9ff11c997c7c5c3dcbb6e4b4b2ee5856208dd945 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Rafael=20Siqueira?= Date: Mon, 10 Nov 2025 15:33:23 -0300 Subject: [PATCH] update saladeaul.adigitaltw --- .../worker-configuration.d.ts | 4 +- apps/saladeaula.digital/app/routes/certs.tsx | 44 +++ apps/saladeaula.digital/app/routes/layout.tsx | 98 +++++-- apps/studio.saladeaula.digital/app/app.css | 142 +--------- .../app/components/logo.svg | 43 --- .../app/components/nav-user.tsx | 140 ---------- .../app/components/search-form.tsx | 47 ---- .../app/components/skeleton.tsx | 19 -- .../app/components/ui/avatar.tsx | 51 ---- .../app/components/ui/breadcrumb.tsx | 109 -------- .../app/components/ui/button.tsx | 60 ----- .../app/components/ui/card.tsx | 92 ------- .../app/components/ui/checkbox.tsx | 30 --- .../app/components/ui/dropdown-menu.tsx | 255 ------------------ .../app/components/ui/empty.tsx | 104 ------- .../app/components/ui/form.tsx | 167 ------------ .../app/components/ui/input-group.tsx | 168 ------------ .../app/components/ui/input.tsx | 21 -- .../app/components/ui/kbd.tsx | 28 -- .../app/components/ui/label.tsx | 22 -- .../app/components/ui/separator.tsx | 28 -- .../app/components/ui/skeleton.tsx | 13 - .../app/components/ui/spinner.tsx | 16 -- .../app/components/ui/textarea.tsx | 18 -- .../app/components/ui/tooltip.tsx | 59 ---- .../app/hooks/use-keypress.tsx | 22 -- .../studio.saladeaula.digital/app/lib/auth.ts | 43 --- .../app/lib/request.ts | 5 +- .../app/lib/session.ts | 15 -- .../app/middleware/auth.ts | 69 ----- apps/studio.saladeaula.digital/app/root.tsx | 24 +- .../app/routes/api.ts | 4 +- .../app/routes/auth/login.ts | 4 +- .../app/routes/auth/logout.ts | 4 +- .../app/routes/edit.tsx | 52 ++-- .../app/routes/index.tsx | 27 +- .../app/routes/layout.tsx | 18 +- apps/studio.saladeaula.digital/package.json | 21 +- .../worker-configuration.d.ts | 7 +- package-lock.json | 57 ++-- packages/ui/package.json | 2 + packages/ui/src/components/dark-mode.tsx | 7 +- .../ui/src}/components/ui/alert.tsx | 0 .../ui/src/components/ui/navigation-menu.tsx | 42 +-- packages/ui/src/components/ui/sonner.tsx | 40 +++ .../ui/src}/components/ui/switch.tsx | 2 + 46 files changed, 302 insertions(+), 1941 deletions(-) create mode 100644 apps/saladeaula.digital/app/routes/certs.tsx delete mode 100644 apps/studio.saladeaula.digital/app/components/logo.svg delete mode 100644 apps/studio.saladeaula.digital/app/components/nav-user.tsx delete mode 100644 apps/studio.saladeaula.digital/app/components/search-form.tsx delete mode 100644 apps/studio.saladeaula.digital/app/components/skeleton.tsx delete mode 100644 apps/studio.saladeaula.digital/app/components/ui/avatar.tsx delete mode 100644 apps/studio.saladeaula.digital/app/components/ui/breadcrumb.tsx delete mode 100644 apps/studio.saladeaula.digital/app/components/ui/button.tsx delete mode 100644 apps/studio.saladeaula.digital/app/components/ui/card.tsx delete mode 100644 apps/studio.saladeaula.digital/app/components/ui/checkbox.tsx delete mode 100644 apps/studio.saladeaula.digital/app/components/ui/dropdown-menu.tsx delete mode 100644 apps/studio.saladeaula.digital/app/components/ui/empty.tsx delete mode 100644 apps/studio.saladeaula.digital/app/components/ui/form.tsx delete mode 100644 apps/studio.saladeaula.digital/app/components/ui/input-group.tsx delete mode 100644 apps/studio.saladeaula.digital/app/components/ui/input.tsx delete mode 100644 apps/studio.saladeaula.digital/app/components/ui/kbd.tsx delete mode 100644 apps/studio.saladeaula.digital/app/components/ui/label.tsx delete mode 100644 apps/studio.saladeaula.digital/app/components/ui/separator.tsx delete mode 100644 apps/studio.saladeaula.digital/app/components/ui/skeleton.tsx delete mode 100644 apps/studio.saladeaula.digital/app/components/ui/spinner.tsx delete mode 100644 apps/studio.saladeaula.digital/app/components/ui/textarea.tsx delete mode 100644 apps/studio.saladeaula.digital/app/components/ui/tooltip.tsx delete mode 100644 apps/studio.saladeaula.digital/app/hooks/use-keypress.tsx delete mode 100644 apps/studio.saladeaula.digital/app/lib/auth.ts delete mode 100644 apps/studio.saladeaula.digital/app/lib/session.ts delete mode 100644 apps/studio.saladeaula.digital/app/middleware/auth.ts rename {apps/studio.saladeaula.digital/app => packages/ui/src}/components/ui/alert.tsx (100%) create mode 100644 packages/ui/src/components/ui/sonner.tsx rename {apps/studio.saladeaula.digital/app => packages/ui/src}/components/ui/switch.tsx (98%) diff --git a/apps/id.saladeaula.digital/worker-configuration.d.ts b/apps/id.saladeaula.digital/worker-configuration.d.ts index 35103cd..381ba8d 100644 --- a/apps/id.saladeaula.digital/worker-configuration.d.ts +++ b/apps/id.saladeaula.digital/worker-configuration.d.ts @@ -1,12 +1,12 @@ /* eslint-disable */ -// Generated by Wrangler by running `wrangler types` (hash: 564589b5fae9d7cbc52b477d517d8e7f) +// Generated by Wrangler by running `wrangler types` (hash: 20d12d2cb42a565d117b277533ca85a9) // Runtime types generated with workerd@1.20251011.0 2025-04-04 declare namespace Cloudflare { interface GlobalProps { mainModule: typeof import("./workers/app"); } interface Env { - ISSUER_URL: "https://duiolq49qn25e.cloudfront.net"; + ISSUER_URL: "https://58tkjsb308.execute-api.sa-east-1.amazonaws.com"; } } interface Env extends Cloudflare.Env {} diff --git a/apps/saladeaula.digital/app/routes/certs.tsx b/apps/saladeaula.digital/app/routes/certs.tsx new file mode 100644 index 0000000..691ccbd --- /dev/null +++ b/apps/saladeaula.digital/app/routes/certs.tsx @@ -0,0 +1,44 @@ +import type { Route } from './+types' + +import { Link } from 'react-router' + +import { + Breadcrumb, + BreadcrumbItem, + BreadcrumbLink, + BreadcrumbList, + BreadcrumbPage, + BreadcrumbSeparator +} from '@repo/ui/components/ui/breadcrumb' + +export function meta({}: Route.MetaArgs) { + return [{ title: 'Certificados' }] +} + +export default function Component() { + return ( +
+ + + + + Meus cursos + + + + + Certificados + + + + +
+

Certificados

+

+ Gerencie seus certificados com facilidade! Visualize suas conquistas e + acompanhe seus cursos concluídos. +

+
+
+ ) +} diff --git a/apps/saladeaula.digital/app/routes/layout.tsx b/apps/saladeaula.digital/app/routes/layout.tsx index 4c03961..b401e8b 100644 --- a/apps/saladeaula.digital/app/routes/layout.tsx +++ b/apps/saladeaula.digital/app/routes/layout.tsx @@ -1,18 +1,27 @@ import type { Route } from './+types' +import { useToggle } from 'ahooks' +import { MenuIcon } from 'lucide-react' import { Link, NavLink, Outlet } from 'react-router' import { userContext } from '@repo/auth/context' import { authMiddleware } from '@repo/auth/middleware/auth' + import { ModeToggle, ThemedImage } from '@repo/ui/components/dark-mode' import { NavUser } from '@repo/ui/components/nav-user' +import { Button } from '@repo/ui/components/ui/button' import { NavigationMenu, - NavigationMenuItem, NavigationMenuLink, NavigationMenuList } from '@repo/ui/components/ui/navigation-menu' -import { useIsMobile } from '@repo/ui/hooks/use-mobile' +import { + Sheet, + SheetContent, + SheetHeader, + SheetTitle, + SheetTrigger +} from '@repo/ui/components/ui/sheet' export const middleware: Route.MiddlewareFunction[] = [authMiddleware] @@ -21,9 +30,24 @@ export async function loader({ context }: Route.ActionArgs) { return Response.json({ user }) } +const navMain = [ + { + title: 'Meus cursos', + url: '/' + }, + { + title: 'Certificados', + url: '/certs' + }, + { + title: 'Histórico de compras', + url: '/payments' + } +] + export default function Component({ loaderData }: Route.ComponentProps) { - const isMobile = useIsMobile() const { user } = loaderData + const [isOpen, { toggle }] = useToggle() return (
@@ -32,26 +56,61 @@ export default function Component({ loaderData }: Route.ComponentProps) { px-4 py-2 lg:py-4 sticky top-0 z-5" >
-
+ {/* Desktop Menu */} +
- + - - Meus cursos - - - Certificados - - - Histórico de compras - + {navMain.map(({ url, title }, key) => ( + + {title} + + ))}
+ {/* Mobile Menu */} +
+ + + + + + + + + + + + + +
    + {navMain.map(({ url, title }, key) => ( +
  • + + {title} + +
  • + ))} +
+
+
+
+
@@ -67,14 +126,3 @@ export default function Component({ loaderData }: Route.ComponentProps) {
) } - -function NavMenuLink({ children, ...props }) { - return ( - - {children} - - ) -} diff --git a/apps/studio.saladeaula.digital/app/app.css b/apps/studio.saladeaula.digital/app/app.css index 11be65b..0836ac0 100644 --- a/apps/studio.saladeaula.digital/app/app.css +++ b/apps/studio.saladeaula.digital/app/app.css @@ -1,133 +1,11 @@ -@import 'tailwindcss' source('.'); -@import 'tw-animate-css'; +@import 'tailwindcss'; +@import '@repo/ui/globals.css'; -@custom-variant dark (&:is(.dark *)); - -@theme { - --font-sans: - 'Inter', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', - 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; -} - -html, -body { - @media (prefers-color-scheme: dark) { - color-scheme: dark; - } -} - -@theme inline { - --radius-sm: calc(var(--radius) - 4px); - --radius-md: calc(var(--radius) - 2px); - --radius-lg: var(--radius); - --radius-xl: calc(var(--radius) + 4px); - --color-background: var(--background); - --color-foreground: var(--foreground); - --color-card: var(--card); - --color-card-foreground: var(--card-foreground); - --color-popover: var(--popover); - --color-popover-foreground: var(--popover-foreground); - --color-primary: var(--primary); - --color-primary-foreground: var(--primary-foreground); - --color-secondary: var(--secondary); - --color-secondary-foreground: var(--secondary-foreground); - --color-muted: var(--muted); - --color-muted-foreground: var(--muted-foreground); - --color-accent: var(--accent); - --color-accent-foreground: var(--accent-foreground); - --color-destructive: var(--destructive); - --color-border: var(--border); - --color-input: var(--input); - --color-ring: var(--ring); - --color-chart-1: var(--chart-1); - --color-chart-2: var(--chart-2); - --color-chart-3: var(--chart-3); - --color-chart-4: var(--chart-4); - --color-chart-5: var(--chart-5); - --color-sidebar: var(--sidebar); - --color-sidebar-foreground: var(--sidebar-foreground); - --color-sidebar-primary: var(--sidebar-primary); - --color-sidebar-primary-foreground: var(--sidebar-primary-foreground); - --color-sidebar-accent: var(--sidebar-accent); - --color-sidebar-accent-foreground: var(--sidebar-accent-foreground); - --color-sidebar-border: var(--sidebar-border); - --color-sidebar-ring: var(--sidebar-ring); -} - -:root { - --radius: 0.625rem; - --background: oklch(1 0 0); - --foreground: oklch(0.145 0 0); - --card: oklch(1 0 0); - --card-foreground: oklch(0.145 0 0); - --popover: oklch(1 0 0); - --popover-foreground: oklch(0.145 0 0); - --primary: oklch(0.205 0 0); - --primary-foreground: oklch(0.985 0 0); - --secondary: oklch(0.97 0 0); - --secondary-foreground: oklch(0.205 0 0); - --muted: oklch(0.97 0 0); - --muted-foreground: oklch(0.556 0 0); - --accent: oklch(0.97 0 0); - --accent-foreground: oklch(0.205 0 0); - --destructive: oklch(0.577 0.245 27.325); - --border: oklch(0.922 0 0); - --input: oklch(0.922 0 0); - --ring: oklch(0.708 0 0); - --chart-1: oklch(0.646 0.222 41.116); - --chart-2: oklch(0.6 0.118 184.704); - --chart-3: oklch(0.398 0.07 227.392); - --chart-4: oklch(0.828 0.189 84.429); - --chart-5: oklch(0.769 0.188 70.08); - --sidebar: oklch(0.985 0 0); - --sidebar-foreground: oklch(0.145 0 0); - --sidebar-primary: oklch(0.205 0 0); - --sidebar-primary-foreground: oklch(0.985 0 0); - --sidebar-accent: oklch(0.97 0 0); - --sidebar-accent-foreground: oklch(0.205 0 0); - --sidebar-border: oklch(0.922 0 0); - --sidebar-ring: oklch(0.708 0 0); -} - -.dark { - --background: oklch(0.145 0 0); - --foreground: oklch(0.985 0 0); - --card: oklch(0.205 0 0); - --card-foreground: oklch(0.985 0 0); - --popover: oklch(0.205 0 0); - --popover-foreground: oklch(0.985 0 0); - --primary: oklch(0.922 0 0); - --primary-foreground: oklch(0.205 0 0); - --secondary: oklch(0.269 0 0); - --secondary-foreground: oklch(0.985 0 0); - --muted: oklch(0.269 0 0); - --muted-foreground: oklch(0.708 0 0); - --accent: oklch(0.269 0 0); - --accent-foreground: oklch(0.985 0 0); - --destructive: oklch(0.704 0.191 22.216); - --border: oklch(1 0 0 / 10%); - --input: oklch(1 0 0 / 15%); - --ring: oklch(0.556 0 0); - --chart-1: oklch(0.488 0.243 264.376); - --chart-2: oklch(0.696 0.17 162.48); - --chart-3: oklch(0.769 0.188 70.08); - --chart-4: oklch(0.627 0.265 303.9); - --chart-5: oklch(0.645 0.246 16.439); - --sidebar: oklch(0.205 0 0); - --sidebar-foreground: oklch(0.985 0 0); - --sidebar-primary: oklch(0.488 0.243 264.376); - --sidebar-primary-foreground: oklch(0.985 0 0); - --sidebar-accent: oklch(0.269 0 0); - --sidebar-accent-foreground: oklch(0.985 0 0); - --sidebar-border: oklch(1 0 0 / 10%); - --sidebar-ring: oklch(0.556 0 0); -} - -@layer base { - * { - @apply border-border outline-ring/50; - } - body { - @apply bg-background text-foreground; - } -} +/** + * This is necessary to load the @repo/ui package when moving from + * @tailwindcss/vite v4.0.7 to v4.0.8. + * + * For more details, see: + * https://github.com/tailwindlabs/tailwindcss/issues/16733 + */ +@source '../../../packages/ui'; diff --git a/apps/studio.saladeaula.digital/app/components/logo.svg b/apps/studio.saladeaula.digital/app/components/logo.svg deleted file mode 100644 index 30500d5..0000000 --- a/apps/studio.saladeaula.digital/app/components/logo.svg +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/apps/studio.saladeaula.digital/app/components/nav-user.tsx b/apps/studio.saladeaula.digital/app/components/nav-user.tsx deleted file mode 100644 index 1b82ff1..0000000 --- a/apps/studio.saladeaula.digital/app/components/nav-user.tsx +++ /dev/null @@ -1,140 +0,0 @@ -'use client' - -import { - DollarSignIcon, - GraduationCapIcon, - LayoutDashboardIcon, - LogOutIcon, - UserIcon -} from 'lucide-react' -import { Link } from 'react-router' - -import { Avatar, AvatarFallback } from '@/components/ui/avatar' -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuGroup, - DropdownMenuItem, - DropdownMenuLabel, - DropdownMenuSeparator, - DropdownMenuTrigger -} from '@/components/ui/dropdown-menu' -import { initials } from '@/lib/utils' - -export function NavUser({ - user -}: { - user: { - name: string - email: string - scope: string - } -}) { - const scopes = user.scope.split(' ') - - return ( - - - - {initials(user.name)} - - - - -
- - {initials(user.name)} - -
- {user.name} - - {user.email} - -
-
-
- - - - - - - Minha conta - - - - - - Histórico de compras - - - - - - {grantIfHas(['apps:admin', 'apps:studio'], scopes, 'any') && ( - <> - - - Aplicações - - - )} - - - - - Sala de aula - - - - {grantIfHas(['apps:admin'], scopes) && ( - <> - - - - Administrador - - - - )} - - - - - - - Sair - - -
-
- ) -} - -function grantIfHas( - required: string[], - granted: string[], - mode: 'all' | 'any' = 'all' -): boolean { - const grantedSet: Set = new Set(granted) - - if (mode === 'all') { - return required.every((scope) => grantedSet.has(scope)) - } - - return required.some((scope) => grantedSet.has(scope)) -} diff --git a/apps/studio.saladeaula.digital/app/components/search-form.tsx b/apps/studio.saladeaula.digital/app/components/search-form.tsx deleted file mode 100644 index db9c5f9..0000000 --- a/apps/studio.saladeaula.digital/app/components/search-form.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import { debounce } from 'lodash' -import { SearchIcon } from 'lucide-react' -import { useRef } from 'react' - -import { - InputGroup, - InputGroupAddon, - InputGroupInput -} from '@/components/ui/input-group' - -import { useKeyPress } from '@/hooks/use-keypress' -import { cn } from '@/lib/utils' - -export function SearchForm({ - placeholder, - className, - onChange, - ...props -}: { - placeholder?: React.ReactNode - className?: string - onChange?: (e: React.ChangeEvent) => void -} & React.HTMLAttributes) { - const inputRef = useRef(null) - - useKeyPress('/', () => { - inputRef.current?.focus() - }) - - return ( - - - - - - - {placeholder} - - - ) -} diff --git a/apps/studio.saladeaula.digital/app/components/skeleton.tsx b/apps/studio.saladeaula.digital/app/components/skeleton.tsx deleted file mode 100644 index c86dd3d..0000000 --- a/apps/studio.saladeaula.digital/app/components/skeleton.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { Skeleton as XSkeleton } from '@/components/ui/skeleton' - -export function Skeleton() { - return ( -
-
- - - - - - - - - -
-
- ) -} diff --git a/apps/studio.saladeaula.digital/app/components/ui/avatar.tsx b/apps/studio.saladeaula.digital/app/components/ui/avatar.tsx deleted file mode 100644 index b7224f0..0000000 --- a/apps/studio.saladeaula.digital/app/components/ui/avatar.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import * as React from "react" -import * as AvatarPrimitive from "@radix-ui/react-avatar" - -import { cn } from "@/lib/utils" - -function Avatar({ - className, - ...props -}: React.ComponentProps) { - return ( - - ) -} - -function AvatarImage({ - className, - ...props -}: React.ComponentProps) { - return ( - - ) -} - -function AvatarFallback({ - className, - ...props -}: React.ComponentProps) { - return ( - - ) -} - -export { Avatar, AvatarImage, AvatarFallback } diff --git a/apps/studio.saladeaula.digital/app/components/ui/breadcrumb.tsx b/apps/studio.saladeaula.digital/app/components/ui/breadcrumb.tsx deleted file mode 100644 index eb88f32..0000000 --- a/apps/studio.saladeaula.digital/app/components/ui/breadcrumb.tsx +++ /dev/null @@ -1,109 +0,0 @@ -import * as React from "react" -import { Slot } from "@radix-ui/react-slot" -import { ChevronRight, MoreHorizontal } from "lucide-react" - -import { cn } from "@/lib/utils" - -function Breadcrumb({ ...props }: React.ComponentProps<"nav">) { - return