From 0698cff8cf13dd89df576bf471ed47f4eace2eae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Rafael=20Siqueira?= Date: Wed, 5 Nov 2025 16:26:01 -0300 Subject: [PATCH] update --- .../app/components/logo-dark.svg | 43 --- .../app/components/logo-light.svg | 43 --- .../app/components/skeleton.tsx | 19 -- .../app/hooks/use-mobile.ts | 19 -- .../app/lib/request.ts | 5 +- apps/admin.saladeaula.digital/app/root.tsx | 4 +- .../routes/_.$orgid.courses._index/route.tsx | 5 +- .../_.$orgid.enrollments._index/route.tsx | 34 +-- .../routes/_.$orgid.orders._index/route.tsx | 2 +- .../_.$orgid.users.$id.emails/route.tsx | 2 +- .../routes/_.$orgid.users.$id.orgs/route.tsx | 2 +- .../routes/_.$orgid.users._index/route.tsx | 7 +- .../routes/_.$orgid.webhooks._index/route.tsx | 3 - .../app/routes/_.$orgid/route.tsx | 11 +- .../app/routes/_index/route.tsx | 4 +- .../app/routes/login._index/route.ts | 6 +- .../app/routes/logout._index/route.ts | 4 +- .../app/routes/~.api.$/route.ts | 6 +- apps/admin.saladeaula.digital/package.json | 8 +- apps/insights.saladeaula.digital/README.md | 4 +- apps/insights.saladeaula.digital/package.json | 1 + .../postcss.config.mjs | 1 - apps/saladeaula.digital/app/app.css | 142 +--------- .../app/components/faceted-filter.tsx | 10 +- .../app/components/logo.svg | 43 --- .../app/components/nav-user.tsx | 141 ---------- .../app/components/search-form.tsx | 2 +- .../app/components/ui/avatar.tsx | 51 ---- .../app/components/ui/badge.tsx | 46 ---- .../app/components/ui/breadcrumb.tsx | 109 -------- .../app/components/ui/button.tsx | 60 ----- .../app/components/ui/card.tsx | 92 ------- .../app/components/ui/command.tsx | 184 ------------- .../app/components/ui/dialog.tsx | 141 ---------- .../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/popover.tsx | 46 ---- .../app/components/ui/progress.tsx | 29 -- .../app/components/ui/select.tsx | 185 ------------- .../app/components/ui/separator.tsx | 28 -- .../app/components/ui/skeleton.tsx | 13 - .../app/components/ui/spinner.tsx | 16 -- .../app/components/ui/textarea.tsx | 18 -- .../saladeaula.digital/app/middleware/auth.ts | 65 ----- apps/saladeaula.digital/app/root.tsx | 25 +- .../app/routes/auth/login.ts | 11 +- .../app/routes/auth/logout.ts | 9 +- apps/saladeaula.digital/app/routes/index.tsx | 146 +++++----- apps/saladeaula.digital/app/routes/layout.tsx | 18 +- .../app/routes/payments.tsx | 2 +- .../app/routes/settings.tsx | 18 +- apps/saladeaula.digital/package.json | 26 +- .../worker-configuration.d.ts | 9 +- package-lock.json | 102 +++---- packages/auth/package.json | 22 ++ .../app/lib => packages/auth/src}/auth.ts | 2 +- packages/auth/src/context.ts | 5 + .../auth/src}/middleware/auth.ts | 4 +- .../auth/src}/middleware/logging.ts | 0 .../app/lib => packages/auth/src}/session.ts | 2 +- packages/auth/tsconfig.json | 11 + packages/ui/package.json | 11 +- .../ui/src}/components/dark-mode.tsx | 8 +- .../ui/src}/components/faceted-filter.tsx | 0 .../ui/src}/components/nav-user.tsx | 83 ++++-- .../ui/src}/components/search-form.tsx | 2 +- .../ui/src}/components/skeleton.tsx | 2 +- .../ui/src/hooks/use-keypress.ts | 0 packages/ui/src/hooks/use-mobile.ts | 6 +- packages/ui/tsconfig.json | 8 + packages/ui/vite.config.ts | 3 +- 76 files changed, 374 insertions(+), 2580 deletions(-) delete mode 100644 apps/admin.saladeaula.digital/app/components/logo-dark.svg delete mode 100644 apps/admin.saladeaula.digital/app/components/logo-light.svg delete mode 100644 apps/admin.saladeaula.digital/app/components/skeleton.tsx delete mode 100644 apps/admin.saladeaula.digital/app/hooks/use-mobile.ts delete mode 100644 apps/insights.saladeaula.digital/postcss.config.mjs delete mode 100644 apps/saladeaula.digital/app/components/logo.svg delete mode 100644 apps/saladeaula.digital/app/components/nav-user.tsx delete mode 100644 apps/saladeaula.digital/app/components/ui/avatar.tsx delete mode 100644 apps/saladeaula.digital/app/components/ui/badge.tsx delete mode 100644 apps/saladeaula.digital/app/components/ui/breadcrumb.tsx delete mode 100644 apps/saladeaula.digital/app/components/ui/button.tsx delete mode 100644 apps/saladeaula.digital/app/components/ui/card.tsx delete mode 100644 apps/saladeaula.digital/app/components/ui/command.tsx delete mode 100644 apps/saladeaula.digital/app/components/ui/dialog.tsx delete mode 100644 apps/saladeaula.digital/app/components/ui/dropdown-menu.tsx delete mode 100644 apps/saladeaula.digital/app/components/ui/empty.tsx delete mode 100644 apps/saladeaula.digital/app/components/ui/form.tsx delete mode 100644 apps/saladeaula.digital/app/components/ui/input-group.tsx delete mode 100644 apps/saladeaula.digital/app/components/ui/input.tsx delete mode 100644 apps/saladeaula.digital/app/components/ui/kbd.tsx delete mode 100644 apps/saladeaula.digital/app/components/ui/label.tsx delete mode 100644 apps/saladeaula.digital/app/components/ui/popover.tsx delete mode 100644 apps/saladeaula.digital/app/components/ui/progress.tsx delete mode 100644 apps/saladeaula.digital/app/components/ui/select.tsx delete mode 100644 apps/saladeaula.digital/app/components/ui/separator.tsx delete mode 100644 apps/saladeaula.digital/app/components/ui/skeleton.tsx delete mode 100644 apps/saladeaula.digital/app/components/ui/spinner.tsx delete mode 100644 apps/saladeaula.digital/app/components/ui/textarea.tsx delete mode 100644 apps/saladeaula.digital/app/middleware/auth.ts create mode 100644 packages/auth/package.json rename {apps/admin.saladeaula.digital/app/lib => packages/auth/src}/auth.ts (96%) create mode 100644 packages/auth/src/context.ts rename {apps/admin.saladeaula.digital/app => packages/auth/src}/middleware/auth.ts (95%) rename {apps/admin.saladeaula.digital/app => packages/auth/src}/middleware/logging.ts (100%) rename {apps/admin.saladeaula.digital/app/lib => packages/auth/src}/session.ts (87%) create mode 100644 packages/auth/tsconfig.json rename {apps/admin.saladeaula.digital/app => packages/ui/src}/components/dark-mode.tsx (93%) rename {apps/admin.saladeaula.digital/app => packages/ui/src}/components/faceted-filter.tsx (100%) rename {apps/admin.saladeaula.digital/app => packages/ui/src}/components/nav-user.tsx (67%) rename {apps/admin.saladeaula.digital/app => packages/ui/src}/components/search-form.tsx (96%) rename {apps/saladeaula.digital/app => packages/ui/src}/components/skeleton.tsx (89%) rename apps/admin.saladeaula.digital/app/hooks/use-keypress.tsx => packages/ui/src/hooks/use-keypress.ts (100%) diff --git a/apps/admin.saladeaula.digital/app/components/logo-dark.svg b/apps/admin.saladeaula.digital/app/components/logo-dark.svg deleted file mode 100644 index 30500d5..0000000 --- a/apps/admin.saladeaula.digital/app/components/logo-dark.svg +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/apps/admin.saladeaula.digital/app/components/logo-light.svg b/apps/admin.saladeaula.digital/app/components/logo-light.svg deleted file mode 100644 index fad8611..0000000 --- a/apps/admin.saladeaula.digital/app/components/logo-light.svg +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/apps/admin.saladeaula.digital/app/components/skeleton.tsx b/apps/admin.saladeaula.digital/app/components/skeleton.tsx deleted file mode 100644 index 115815a..0000000 --- a/apps/admin.saladeaula.digital/app/components/skeleton.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { Skeleton as XSkeleton } from '@repo/ui/components/ui/skeleton' - -export function Skeleton() { - return ( -
-
- - - - - - - - - -
-
- ) -} diff --git a/apps/admin.saladeaula.digital/app/hooks/use-mobile.ts b/apps/admin.saladeaula.digital/app/hooks/use-mobile.ts deleted file mode 100644 index 4331d5c..0000000 --- a/apps/admin.saladeaula.digital/app/hooks/use-mobile.ts +++ /dev/null @@ -1,19 +0,0 @@ -import * as React from 'react' - -const MOBILE_BREAKPOINT = 768 - -export function useIsMobile() { - const [isMobile, setIsMobile] = React.useState(undefined) - - React.useEffect(() => { - const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`) - const onChange = () => { - setIsMobile(window.innerWidth < MOBILE_BREAKPOINT) - } - mql.addEventListener('change', onChange) - setIsMobile(window.innerWidth < MOBILE_BREAKPOINT) - return () => mql.removeEventListener('change', onChange) - }, []) - - return !!isMobile -} diff --git a/apps/admin.saladeaula.digital/app/lib/request.ts b/apps/admin.saladeaula.digital/app/lib/request.ts index c63f60c..4ed785f 100644 --- a/apps/admin.saladeaula.digital/app/lib/request.ts +++ b/apps/admin.saladeaula.digital/app/lib/request.ts @@ -1,5 +1,6 @@ -import { requestIdContext, userContext } from '@/context' -import type { User } from '@/lib/auth' +import type { User } from '@repo/auth/auth' +import { requestIdContext, userContext } from '@repo/auth/context' + import type { LoaderFunctionArgs } from 'react-router' export enum HttpMethod { diff --git a/apps/admin.saladeaula.digital/app/root.tsx b/apps/admin.saladeaula.digital/app/root.tsx index b6b6e65..3260479 100644 --- a/apps/admin.saladeaula.digital/app/root.tsx +++ b/apps/admin.saladeaula.digital/app/root.tsx @@ -9,9 +9,9 @@ import { ScrollRestoration } from 'react-router' +import { loggingMiddleware } from '@repo/auth/middleware/logging' import { ThemeProvider } from '@repo/ui/components/theme-provider' import './app.css' -import { loggingMiddleware } from './middleware/logging' export const middleware: Route.MiddlewareFunction[] = [loggingMiddleware] @@ -22,7 +22,7 @@ export function Layout({ children }: { children: React.ReactNode }) { - saladeaula.digital + admin.saladeaula.digital diff --git a/apps/admin.saladeaula.digital/app/routes/_.$orgid.courses._index/route.tsx b/apps/admin.saladeaula.digital/app/routes/_.$orgid.courses._index/route.tsx index f287599..5968693 100644 --- a/apps/admin.saladeaula.digital/app/routes/_.$orgid.courses._index/route.tsx +++ b/apps/admin.saladeaula.digital/app/routes/_.$orgid.courses._index/route.tsx @@ -6,10 +6,11 @@ import { Suspense, useMemo } from 'react' import { Await, useSearchParams } from 'react-router' import placeholder from '@/assets/placeholder.webp' -import { SearchForm } from '@/components/search-form' -import { Skeleton } from '@/components/skeleton' import { createSearch } from '@/lib/meili' import { request as req } from '@/lib/request' + +import { SearchForm } from '@repo/ui/components/search-form' +import { Skeleton } from '@repo/ui/components/skeleton' import { Card, CardFooter, diff --git a/apps/admin.saladeaula.digital/app/routes/_.$orgid.enrollments._index/route.tsx b/apps/admin.saladeaula.digital/app/routes/_.$orgid.enrollments._index/route.tsx index 0008d7e..9b6ece1 100644 --- a/apps/admin.saladeaula.digital/app/routes/_.$orgid.enrollments._index/route.tsx +++ b/apps/admin.saladeaula.digital/app/routes/_.$orgid.enrollments._index/route.tsx @@ -7,11 +7,12 @@ import { Suspense, useState } from 'react' import { Await, Link, useSearchParams } from 'react-router' import { CustomizeColumns, DataTable } from '@/components/data-table' -import { FacetedFilter } from '@/components/faceted-filter' import { RangeCalendarFilter } from '@/components/range-calendar-filter' -import { SearchForm } from '@/components/search-form' -import { Skeleton } from '@/components/skeleton' import { createSearch } from '@/lib/meili' + +import { FacetedFilter } from '@repo/ui/components/faceted-filter' +import { SearchForm } from '@repo/ui/components/search-form' +import { Skeleton } from '@repo/ui/components/skeleton' import { Button } from '@repo/ui/components/ui/button' import { Kbd } from '@repo/ui/components/ui/kbd' import { @@ -128,33 +129,6 @@ export default function Route({ loaderData: { data } }) {
- { - setSearchParams((searchParams) => { - searchParams.delete('courses') - searchParams.delete('p') - - if (statuses.length) { - courses.forEach((s) => - searchParams.has('courses', s) - ? null - : searchParams.append('courses', s) - ) - } - - return searchParams - }) - }} - title="Cursos" - options={Object.entries(statuses).map(([key, value]) => ({ - value: key, - ...value - }))} - /> - { diff --git a/apps/saladeaula.digital/app/components/logo.svg b/apps/saladeaula.digital/app/components/logo.svg deleted file mode 100644 index 30500d5..0000000 --- a/apps/saladeaula.digital/app/components/logo.svg +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/apps/saladeaula.digital/app/components/nav-user.tsx b/apps/saladeaula.digital/app/components/nav-user.tsx deleted file mode 100644 index 11846c3..0000000 --- a/apps/saladeaula.digital/app/components/nav-user.tsx +++ /dev/null @@ -1,141 +0,0 @@ -'use client' - -import { - CirclePlayIcon, - DollarSignIcon, - 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 - - - )} - - {grantIfHas(['apps:admin'], scopes) && ( - <> - - - - Administrador - - - - )} - - {grantIfHas(['apps:studio'], scopes) && ( - <> - - - - EDUSEG® Estúdio - - - - )} - - - - - - - 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/saladeaula.digital/app/components/search-form.tsx b/apps/saladeaula.digital/app/components/search-form.tsx index 38ec93c..8bac56e 100644 --- a/apps/saladeaula.digital/app/components/search-form.tsx +++ b/apps/saladeaula.digital/app/components/search-form.tsx @@ -2,7 +2,7 @@ import { InputGroup, InputGroupAddon, InputGroupInput -} from '@/components/ui/input-group' +} from '@repo/ui/components/ui/input-group' import { useKeyPress } from '@/hooks/use-keypress' import clsx from 'clsx' import { debounce } from 'lodash' diff --git a/apps/saladeaula.digital/app/components/ui/avatar.tsx b/apps/saladeaula.digital/app/components/ui/avatar.tsx deleted file mode 100644 index b7224f0..0000000 --- a/apps/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/saladeaula.digital/app/components/ui/badge.tsx b/apps/saladeaula.digital/app/components/ui/badge.tsx deleted file mode 100644 index 0205413..0000000 --- a/apps/saladeaula.digital/app/components/ui/badge.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import * as React from "react" -import { Slot } from "@radix-ui/react-slot" -import { cva, type VariantProps } from "class-variance-authority" - -import { cn } from "@/lib/utils" - -const badgeVariants = cva( - "inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden", - { - variants: { - variant: { - default: - "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90", - secondary: - "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90", - destructive: - "border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60", - outline: - "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground", - }, - }, - defaultVariants: { - variant: "default", - }, - } -) - -function Badge({ - className, - variant, - asChild = false, - ...props -}: React.ComponentProps<"span"> & - VariantProps & { asChild?: boolean }) { - const Comp = asChild ? Slot : "span" - - return ( - - ) -} - -export { Badge, badgeVariants } diff --git a/apps/saladeaula.digital/app/components/ui/breadcrumb.tsx b/apps/saladeaula.digital/app/components/ui/breadcrumb.tsx deleted file mode 100644 index eb88f32..0000000 --- a/apps/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