style: clean up code formatting and remove trailing whitespace
refactor: reorganize imports and fix type imports
This commit is contained in:
1 parent
d3704602fd
commit
47c04de6fe
232 files changed
+7140
-4798
No files matched your search
@@ -1,8 +1,8 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { ArrowLeft } from "lucide-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { AdminItemForm, type ItemFormPayload } from "./AdminItemForm";
|
||||
import { ItemAiAssistant, type ItemAiPrefill } from "./ItemAiAssistant";
|
||||
@@ -13,7 +13,11 @@ interface AdminItemCreatePageProps {
|
||||
serverOptions: string[];
|
||||
}
|
||||
|
||||
export function AdminItemCreatePage({ locale, categories, serverOptions }: AdminItemCreatePageProps) {
|
||||
export function AdminItemCreatePage({
|
||||
locale,
|
||||
categories,
|
||||
serverOptions,
|
||||
}: AdminItemCreatePageProps) {
|
||||
const router = useRouter();
|
||||
const [submitting, setSubmitting] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
@@ -54,14 +58,20 @@ export function AdminItemCreatePage({ locale, categories, serverOptions }: Admin
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const data = await response.json().catch(() => ({ error: "Erro ao criar item" }));
|
||||
const data = await response
|
||||
.json()
|
||||
.catch(() => ({ error: "Erro ao criar item" }));
|
||||
throw new Error(data?.error || data?.message || "Falha ao criar item");
|
||||
}
|
||||
|
||||
goBackToList();
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
setError(err instanceof Error ? err.message : "Erro ao criar item. Tente novamente.");
|
||||
setError(
|
||||
err instanceof Error
|
||||
? err.message
|
||||
: "Erro ao criar item. Tente novamente.",
|
||||
);
|
||||
} finally {
|
||||
setSubmitting(false);
|
||||
}
|
||||
@@ -73,8 +83,9 @@ export function AdminItemCreatePage({ locale, categories, serverOptions }: Admin
|
||||
<div className="space-y-1">
|
||||
<h1 className="text-3xl font-bold tracking-tight">Novo item</h1>
|
||||
<p className="text-muted-foreground max-w-2xl">
|
||||
Utilize a seção de IA abaixo para gerar automaticamente campos sugeridos a partir de prints e descrições.
|
||||
Ajuste o que for necessário antes de publicar.
|
||||
Utilize a seção de IA abaixo para gerar automaticamente campos
|
||||
sugeridos a partir de prints e descrições. Ajuste o que for
|
||||
necessário antes de publicar.
|
||||
</p>
|
||||
</div>
|
||||
<Button variant="outline" onClick={goBackToList} className="gap-2">
|
||||
@@ -120,4 +131,3 @@ export function AdminItemCreatePage({ locale, categories, serverOptions }: Admin
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user