update saladeaul.adigitaltw
This commit is contained in:
@@ -10,10 +10,20 @@ import {
|
||||
import { Suspense, useState, type ReactNode } from 'react'
|
||||
import { useForm } from 'react-hook-form'
|
||||
import { Await, useAsyncValue, useFetcher } from 'react-router'
|
||||
import { toast } from 'sonner'
|
||||
import { z } from 'zod'
|
||||
|
||||
import { Skeleton } from '@/components/skeleton'
|
||||
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert'
|
||||
import { HttpMethod, request as req } from '@/lib/request'
|
||||
|
||||
import type { User } from '@repo/auth/auth'
|
||||
import { userContext } from '@repo/auth/context'
|
||||
|
||||
import { Skeleton } from '@repo/ui/components/skeleton'
|
||||
import {
|
||||
Alert,
|
||||
AlertDescription,
|
||||
AlertTitle
|
||||
} from '@repo/ui/components/ui/alert'
|
||||
import {
|
||||
Breadcrumb,
|
||||
BreadcrumbItem,
|
||||
@@ -21,22 +31,22 @@ import {
|
||||
BreadcrumbList,
|
||||
BreadcrumbPage,
|
||||
BreadcrumbSeparator
|
||||
} from '@/components/ui/breadcrumb'
|
||||
import { Button } from '@/components/ui/button'
|
||||
} from '@repo/ui/components/ui/breadcrumb'
|
||||
import { Button } from '@repo/ui/components/ui/button'
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
CardTitle
|
||||
} from '@/components/ui/card'
|
||||
import { Checkbox } from '@/components/ui/checkbox'
|
||||
} from '@repo/ui/components/ui/card'
|
||||
import { Checkbox } from '@repo/ui/components/ui/checkbox'
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuTrigger
|
||||
} from '@/components/ui/dropdown-menu'
|
||||
} from '@repo/ui/components/ui/dropdown-menu'
|
||||
import {
|
||||
Form,
|
||||
FormControl,
|
||||
@@ -45,19 +55,16 @@ import {
|
||||
FormItem,
|
||||
FormLabel,
|
||||
FormMessage
|
||||
} from '@/components/ui/form'
|
||||
import { Input } from '@/components/ui/input'
|
||||
} from '@repo/ui/components/ui/form'
|
||||
import { Input } from '@repo/ui/components/ui/input'
|
||||
import {
|
||||
InputGroup,
|
||||
InputGroupAddon,
|
||||
InputGroupButton,
|
||||
InputGroupInput
|
||||
} from '@/components/ui/input-group'
|
||||
import { Spinner } from '@/components/ui/spinner'
|
||||
import { Switch } from '@/components/ui/switch'
|
||||
import { userContext } from '@/context'
|
||||
import type { User } from '@/lib/auth'
|
||||
import { HttpMethod, request as req } from '@/lib/request'
|
||||
} from '@repo/ui/components/ui/input-group'
|
||||
import { Spinner } from '@repo/ui/components/ui/spinner'
|
||||
import { Switch } from '@repo/ui/components/ui/switch'
|
||||
|
||||
const schema = z
|
||||
.object({
|
||||
@@ -207,22 +214,13 @@ function Editing() {
|
||||
method: 'post',
|
||||
encType: 'multipart/form-data'
|
||||
})
|
||||
|
||||
toast.success('O curso foi atualizado')
|
||||
}
|
||||
|
||||
return (
|
||||
<Form {...form}>
|
||||
<form onSubmit={handleSubmit(onSubmit)} className="space-y-4">
|
||||
{formState.isSubmitSuccessful ? (
|
||||
<Alert variant="default">
|
||||
<CircleCheckIcon />
|
||||
<AlertTitle>Curso atualizado!</AlertTitle>
|
||||
<AlertDescription>
|
||||
Tudo pronto! As mudanças foram salvas e seu curso já está
|
||||
atualizado.
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
) : null}
|
||||
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle className="text-2xl">Editar curso</CardTitle>
|
||||
@@ -413,7 +411,7 @@ function Editing() {
|
||||
<div className="flex justify-end">
|
||||
<Button
|
||||
type="submit"
|
||||
className="bg-lime-400 cursor-pointer"
|
||||
className="cursor-pointer"
|
||||
disabled={formState.isSubmitting}
|
||||
>
|
||||
{formState.isSubmitting && <Spinner />}
|
||||
|
||||
Reference in New Issue
Block a user