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