add scorm
This commit is contained in:
14
apps/saladeaula.digital/app/components/container.tsx
Normal file
14
apps/saladeaula.digital/app/components/container.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import { cn } from '@repo/ui/lib/utils'
|
||||
|
||||
type ContainerProps = {
|
||||
children: React.ReactNode
|
||||
className?: string
|
||||
}
|
||||
|
||||
export function Container({ children, className }: ContainerProps) {
|
||||
return (
|
||||
<main>
|
||||
<div className={cn('container mx-auto', className)}>{children}</div>
|
||||
</main>
|
||||
)
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
import { clsx, type ClassValue } from 'clsx'
|
||||
import { twMerge } from 'tailwind-merge'
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs))
|
||||
}
|
||||
|
||||
export function initials(s: string): string {
|
||||
const initials = s
|
||||
.split(' ')
|
||||
.map((word) => word.charAt(0).toUpperCase()) as string[]
|
||||
|
||||
if (initials.length == 0) {
|
||||
return ''
|
||||
}
|
||||
|
||||
const first = initials[0]
|
||||
const last = initials[initials.length - 1]
|
||||
return first + last
|
||||
}
|
||||
@@ -17,7 +17,7 @@ export const middleware: Route.MiddlewareFunction[] = [loggingMiddleware]
|
||||
|
||||
export function Layout({ children }: { children: React.ReactNode }) {
|
||||
return (
|
||||
<html lang="pt-br" suppressHydrationWarning>
|
||||
<html lang="pt-br" className="h-full" suppressHydrationWarning>
|
||||
<head>
|
||||
<meta charSet="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
@@ -26,7 +26,7 @@ export function Layout({ children }: { children: React.ReactNode }) {
|
||||
<Meta />
|
||||
<Links />
|
||||
</head>
|
||||
<body>
|
||||
<body className="h-full">
|
||||
<ThemeProvider
|
||||
attribute="class"
|
||||
defaultTheme="system"
|
||||
|
||||
@@ -11,13 +11,15 @@ import {
|
||||
BreadcrumbSeparator
|
||||
} from '@repo/ui/components/ui/breadcrumb'
|
||||
|
||||
import { Container } from '@/components/container'
|
||||
|
||||
export function meta({}: Route.MetaArgs) {
|
||||
return [{ title: 'Certificados' }]
|
||||
}
|
||||
|
||||
export default function Component() {
|
||||
return (
|
||||
<div className="space-y-2.5">
|
||||
<Container className="space-y-2.5">
|
||||
<Breadcrumb>
|
||||
<BreadcrumbList>
|
||||
<BreadcrumbItem>
|
||||
@@ -39,6 +41,6 @@ export default function Component() {
|
||||
acompanhe seus cursos concluídos.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Container>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import { Await, useSearchParams } from 'react-router'
|
||||
import placeholder from '@/assets/placeholder.webp'
|
||||
import { createSearch } from '@/lib/meili'
|
||||
|
||||
import { Container } from '@/components/container'
|
||||
import type { User } from '@repo/auth/auth'
|
||||
import { userContext } from '@repo/auth/context'
|
||||
import { FacetedFilter } from '@repo/ui/components/faceted-filter'
|
||||
@@ -102,7 +103,7 @@ export default function Component({
|
||||
const term = searchParams.get('term') as string
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<Container className="space-y-4">
|
||||
<div className="space-y-0.5 mb-8">
|
||||
<h1 className="text-2xl font-bold tracking-tight">Meus cursos</h1>
|
||||
<p className="text-muted-foreground">
|
||||
@@ -164,7 +165,7 @@ export default function Component({
|
||||
</Await>
|
||||
</div>
|
||||
</Suspense>
|
||||
</div>
|
||||
</Container>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ export default function Component({ loaderData }: Route.ComponentProps) {
|
||||
const [isOpen, { toggle }] = useToggle()
|
||||
|
||||
return (
|
||||
<div className="relative flex flex-col flex-1 min-w-0">
|
||||
<div className="relative flex flex-col flex-1 min-w-0 h-full">
|
||||
<header
|
||||
className="bg-background/15 backdrop-blur-sm
|
||||
px-4 py-2 lg:py-4 sticky top-0 z-5"
|
||||
@@ -118,11 +118,7 @@ export default function Component({ loaderData }: Route.ComponentProps) {
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main className="p-4">
|
||||
<div className="container mx-auto">
|
||||
<Outlet />
|
||||
</div>
|
||||
</main>
|
||||
<Outlet />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -11,13 +11,15 @@ import {
|
||||
BreadcrumbSeparator
|
||||
} from '@repo/ui/components/ui/breadcrumb'
|
||||
|
||||
import { Container } from '@/components/container'
|
||||
|
||||
export function meta({}: Route.MetaArgs) {
|
||||
return [{ title: 'Histórico de compras' }]
|
||||
}
|
||||
|
||||
export default function Component() {
|
||||
return (
|
||||
<div className="space-y-2.5">
|
||||
<Container className="space-y-2.5">
|
||||
<Breadcrumb>
|
||||
<BreadcrumbList>
|
||||
<BreadcrumbItem>
|
||||
@@ -41,6 +43,6 @@ export default function Component() {
|
||||
o controle financeiro.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Container>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -4,16 +4,18 @@ import { ScormPlayer } from '@/components/scorm-player'
|
||||
import { useLocalStorage } from '@/hooks/useLocalStorage'
|
||||
import SHA256 from 'crypto-js/sha256'
|
||||
|
||||
import { data } from './index'
|
||||
|
||||
export function meta({ params }: Route.MetaArgs) {
|
||||
const course = data.find((course) => course.id === params.course)
|
||||
|
||||
return [{ title: course.courseName }]
|
||||
return [{ title: '' }]
|
||||
}
|
||||
|
||||
export default function Home({ params }: Route.ComponentProps) {
|
||||
const course = data.find((course) => course.id === params.course)
|
||||
export default function Route({ params }: Route.ComponentProps) {
|
||||
const course = {
|
||||
id: 'fbad867a-0022-4605-814f-db8ebe2b17fb',
|
||||
courseName: 'All Golf',
|
||||
scormContentPath:
|
||||
'nr-33-espacos-confinados-conteudo-de-demonstracao-scorm12/scormdriver/indexAPI.html'
|
||||
}
|
||||
// const course = data.find((course) => course.id === params.course)
|
||||
const hash = SHA256(course.scormContentPath).toString()
|
||||
const [scormState] = useLocalStorage(`scormState.${hash}`, {})
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import { Link } from 'react-router'
|
||||
|
||||
import { request as req } from '@/lib/request'
|
||||
|
||||
import { Container } from '@/components/container'
|
||||
import type { User } from '@repo/auth/auth'
|
||||
import { userContext } from '@repo/auth/context'
|
||||
import {
|
||||
@@ -48,7 +49,7 @@ export async function loader({ context, request }: Route.ActionArgs) {
|
||||
return { user: await r.json() }
|
||||
}
|
||||
|
||||
export default function Component({ loaderData: { user } }) {
|
||||
export default function Route({ loaderData: { user } }) {
|
||||
const form = useForm({ defaultValues: user })
|
||||
const { handleSubmit, control, formState } = form
|
||||
|
||||
@@ -57,7 +58,7 @@ export default function Component({ loaderData: { user } }) {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-2.5">
|
||||
<Container className="space-y-2.5">
|
||||
<Breadcrumb>
|
||||
<BreadcrumbList>
|
||||
<BreadcrumbItem>
|
||||
@@ -144,7 +145,7 @@ export default function Component({ loaderData: { user } }) {
|
||||
<div className="flex justify-end">
|
||||
<Button
|
||||
type="submit"
|
||||
className="bg-lime-400 cursor-pointer"
|
||||
className="cursor-pointer"
|
||||
disabled={formState.isSubmitting}
|
||||
>
|
||||
{formState.isSubmitting && <Spinner />}
|
||||
@@ -154,6 +155,6 @@ export default function Component({ loaderData: { user } }) {
|
||||
</form>
|
||||
</Form>
|
||||
</div>
|
||||
</div>
|
||||
</Container>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user