fix fallback
This commit is contained in:
@@ -48,7 +48,7 @@ export default function Route({ loaderData: { data } }: Route.ComponentProps) {
|
|||||||
<Await resolve={data}>
|
<Await resolve={data}>
|
||||||
{(resolved) => (
|
{(resolved) => (
|
||||||
<>
|
<>
|
||||||
<Empty className="border border-dasheds">
|
<Empty className="border border-dashed">
|
||||||
<EmptyHeader>
|
<EmptyHeader>
|
||||||
<EmptyMedia variant="icon">
|
<EmptyMedia variant="icon">
|
||||||
<UploadIcon />
|
<UploadIcon />
|
||||||
|
|||||||
@@ -5,12 +5,21 @@ import {
|
|||||||
CheckCircle2Icon,
|
CheckCircle2Icon,
|
||||||
ClockIcon,
|
ClockIcon,
|
||||||
CalendarIcon,
|
CalendarIcon,
|
||||||
UserIcon
|
UserIcon,
|
||||||
|
BanIcon,
|
||||||
|
PlusIcon
|
||||||
} from 'lucide-react'
|
} from 'lucide-react'
|
||||||
import { Link } from 'react-router'
|
import { Link } from 'react-router'
|
||||||
import { Suspense } from 'react'
|
import { Suspense } from 'react'
|
||||||
import { ErrorBoundary } from 'react-error-boundary'
|
|
||||||
|
|
||||||
|
import {
|
||||||
|
Empty,
|
||||||
|
EmptyContent,
|
||||||
|
EmptyDescription,
|
||||||
|
EmptyHeader,
|
||||||
|
EmptyMedia,
|
||||||
|
EmptyTitle
|
||||||
|
} from '@repo/ui/components/ui/empty'
|
||||||
import {
|
import {
|
||||||
Card,
|
Card,
|
||||||
CardContent,
|
CardContent,
|
||||||
@@ -36,6 +45,7 @@ import { request as req } from '@repo/util/request'
|
|||||||
import { Skeleton } from '@repo/ui/components/skeleton'
|
import { Skeleton } from '@repo/ui/components/skeleton'
|
||||||
import { Await } from 'react-router'
|
import { Await } from 'react-router'
|
||||||
import { Abbr } from '@repo/ui/components/abbr'
|
import { Abbr } from '@repo/ui/components/abbr'
|
||||||
|
import { Button } from '@repo/ui/components/ui/button'
|
||||||
|
|
||||||
export function meta({}: Route.MetaArgs) {
|
export function meta({}: Route.MetaArgs) {
|
||||||
return [{ title: 'Relatório de matrículas' }]
|
return [{ title: 'Relatório de matrículas' }]
|
||||||
@@ -78,7 +88,7 @@ export default function Route({ loaderData: { data } }: Route.ComponentProps) {
|
|||||||
</BreadcrumbList>
|
</BreadcrumbList>
|
||||||
</Breadcrumb>
|
</Breadcrumb>
|
||||||
|
|
||||||
<Await resolve={data} errorElement={<div>Algo deu errado</div>}>
|
<Await resolve={data} errorElement={<NotFound />}>
|
||||||
{({ enrolled, scheduled, sk, created_by }) => {
|
{({ enrolled, scheduled, sk, created_by }) => {
|
||||||
const succeed = enrolled.filter(
|
const succeed = enrolled.filter(
|
||||||
({ status }) => status === 'success'
|
({ status }) => status === 'success'
|
||||||
@@ -188,3 +198,28 @@ const formatted = new Intl.DateTimeFormat('pt-BR', {
|
|||||||
hour: '2-digit',
|
hour: '2-digit',
|
||||||
minute: '2-digit'
|
minute: '2-digit'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function NotFound() {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Empty className="border border-dashed">
|
||||||
|
<EmptyHeader>
|
||||||
|
<EmptyMedia variant="icon">
|
||||||
|
<BanIcon />
|
||||||
|
</EmptyMedia>
|
||||||
|
<EmptyTitle>Nenhum relatório aqui</EmptyTitle>
|
||||||
|
<EmptyDescription>
|
||||||
|
Matricule colaboradores de forma rápida e acompanhe seu progresso.
|
||||||
|
</EmptyDescription>
|
||||||
|
</EmptyHeader>
|
||||||
|
<EmptyContent>
|
||||||
|
<Button asChild>
|
||||||
|
<Link to="../enrollments/add">
|
||||||
|
<PlusIcon /> Matricular
|
||||||
|
</Link>
|
||||||
|
</Button>
|
||||||
|
</EmptyContent>
|
||||||
|
</Empty>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|||||||
@@ -27,7 +27,6 @@
|
|||||||
"meilisearch-helper": "github:sergiors/meilisearch-helper",
|
"meilisearch-helper": "github:sergiors/meilisearch-helper",
|
||||||
"react": "^19.2.1",
|
"react": "^19.2.1",
|
||||||
"react-dom": "^19.2.1",
|
"react-dom": "^19.2.1",
|
||||||
"react-error-boundary": "^6.0.0",
|
|
||||||
"react-router": "^7.10.1",
|
"react-router": "^7.10.1",
|
||||||
"unique-names-generator": "^4.7.1",
|
"unique-names-generator": "^4.7.1",
|
||||||
"zod": "^4.1.13"
|
"zod": "^4.1.13"
|
||||||
|
|||||||
13
package-lock.json
generated
13
package-lock.json
generated
@@ -40,7 +40,6 @@
|
|||||||
"meilisearch-helper": "github:sergiors/meilisearch-helper",
|
"meilisearch-helper": "github:sergiors/meilisearch-helper",
|
||||||
"react": "^19.2.1",
|
"react": "^19.2.1",
|
||||||
"react-dom": "^19.2.1",
|
"react-dom": "^19.2.1",
|
||||||
"react-error-boundary": "^6.0.0",
|
|
||||||
"react-router": "^7.10.1",
|
"react-router": "^7.10.1",
|
||||||
"unique-names-generator": "^4.7.1",
|
"unique-names-generator": "^4.7.1",
|
||||||
"zod": "^4.1.13"
|
"zod": "^4.1.13"
|
||||||
@@ -5793,18 +5792,6 @@
|
|||||||
"react": "^19.2.1"
|
"react": "^19.2.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/react-error-boundary": {
|
|
||||||
"version": "6.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/react-error-boundary/-/react-error-boundary-6.0.0.tgz",
|
|
||||||
"integrity": "sha512-gdlJjD7NWr0IfkPlaREN2d9uUZUlksrfOx7SX62VRerwXbMY6ftGCIZua1VG1aXFNOimhISsTq+Owp725b9SiA==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@babel/runtime": "^7.12.5"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"react": ">=16.13.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/react-fast-compare": {
|
"node_modules/react-fast-compare": {
|
||||||
"version": "3.2.2",
|
"version": "3.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/react-fast-compare/-/react-fast-compare-3.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/react-fast-compare/-/react-fast-compare-3.2.2.tgz",
|
||||||
|
|||||||
Reference in New Issue
Block a user