PageSourceSearch

https://sabhia.ai/assets/illustrator-landing-BcfRrLIl.js

js sabhia.ai collected 2026-10-05 12:33:52 UTC 9,860 bytes, 1 lines download raw bytes

1import{j as e}from"./vendor-motion-CPxq9Xvn.js";import{a1 as T,a2 as _,a3 as q,u as L,an as R,ar as $,z as x,a7 as f,f as v,B as w,I as N,p as F,a4 as m,aJ as G,A as V}from"./index-CFAvyuXu.js";import{B as o}from"./badge-B9GAfHbC.js";import{S as O}from"./store-announcement-banner-D6oK4znf.js";import{r as s}from"./vendor-i18n-CO3kK2bH.js";import{A as y}from"./arrow-left-DY50GvQQ.js";import{U as P}from"./upload-BKNIN1AN.js";import"./vendor-react-CQmBMThG.js";function Y(){const[,r]=T(),{user:U}=_(),{toast:h}=q(),[u,p]=s.useState("choice"),[l,C]=s.useState(""),[n,k]=s.useState(""),[d,I]=s.useState(""),[i,E]=s.useState(""),[g,b]=s.useState(!1),{data:S,isLoading:A}=L({queryKey:["/api/books"]}),j=(S||[]).filter(t=>!t.isExternal),c=l.trim().length>0&&i.trim().length>0,z=s.useCallback(async()=>{if(c){b(!0);try{const a=await(await R("POST","/api/external-books",{title:l.trim(),author:n.trim()||void 0,genre:d.trim()||void 0,content:i.trim()})).json();r(`/ilustrar/${a.id}`)}catch(t){h({title:"Erro ao criar livro",description:t.message||"Tente novamente.",variant:"destructive"})}finally{b(!1)}}},[l,n,d,i,c,h,r]);return e.jsx($,{children:e.jsxs("div",{className:"min-h-screen",children:[u==="choice"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"sticky top-0 z-40 border-b border-white/10 bg-background/80 backdrop-blur-xl",children:e.jsxs("div",{className:"max-w-4xl mx-auto px-4 py-3 flex items-center justify-between gap-3",children:[e.jsxs("button",{onClick:()=>r("/dashboard"),className:"flex items-center gap-2 text-muted-foreground hover:text-white transition-colors text-sm","data-testid":"landing-back-dashboard",children:[e.jsx(y,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Voltar ao painel"}),e.jsx("span",{className:"sm:hidden",children:"Voltar"})]}),e.jsxs(o,{className:"bg-primary/20 text-primary border-primary/20 text-xs",children:[e.jsx(x,{className:"w-3 h-3 mr-1"}),"Ilustrações"]})]})}),e.jsx("div",{className:"max-w-4xl mx-auto px-4 py-6 space-y-6 pb-24",children:e.jsxs("section",{"data-testid":"landing-choice-section",children:[e.jsx(O,{}),e.jsx("div",{className:"flex flex-col md:flex-row justify-between items-start md:items-center gap-4 mt-6 mb-6",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl md:text-3xl font-heading font-bold text-white mb-1","data-testid":"landing-title",children:"Ilustrações"}),e.jsx("p",{className:"text-muted-foreground","data-testid":"landing-subtitle",children:"Crie ilustrações para dar vida ao seu livro"})]})}),A?e.jsxs("div",{className:"flex flex-col items-center justify-center py-16",children:[e.jsx(f,{className:"w-10 h-10 text-primary animate-spin mb-4"}),e.jsx("p",{className:"text-lg text-muted-foreground",children:"Carregando seus livros..."})]}):j.length===0?e.jsxs("div",{className:"glass-card rounded-2xl border border-white/10 p-8 text-center","data-testid":"landing-no-books",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-amber-500/10 flex items-center justify-center mx-auto mb-4",children:e.jsx(v,{className:"w-8 h-8 text-amber-400"})}),e.jsx("h3",{className:"text-xl font-bold text-white mb-2",children:"Nenhum livro encontrado"}),e.jsx("p",{className:"text-base text-muted-foreground mb-6",children:"Crie um livro primeiro para poder criar ilustrações."}),e.jsx(w,{onClick:()=>r("/book/new"),className:"gap-2 bg-gradient-to-r from-emerald-600 to-teal-600 hover:from-emerald-500 hover:to-teal-500 text-white rounded-xl","data-testid":"button-create-new-book",children:"Criar novo livro"})]}):e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-5 max-w-4xl mx-auto",children:j.map(t=>{const a=t.status==="writing"||t.status==="completed";return e.jsxs("button",{onClick:()=>r(a?`/ilustrar/${t.id}`:`/book/${t.id}`),className:`group relative h-[260px] glass-card rounded-2xl border transition-all duration-300 overflow-hidden text-left ${a?"border-white/5 hover:border-primary/30 hover:shadow-[0_10px_40px_-10px_hsl(178_86%_39%_/_0.15)]":"border-white/5 opacity-70"}`,"data-testid":`landing-book-${t.id}`,children:[t.coverImage&&e.jsx(N,{src:t.coverImage,alt:"",widths:[160,200,260,320],sizes:"(max-width: 768px) 50vw, 240px",quality:65,className:"absolute inset-0 w-full h-full object-cover opacity-60 group-hover:opacity-75 transition-all duration-500 group-hover:scale-105 transform-gpu z-[1]",onError:B=>{B.target.style.display="none"}}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/90 via-black/40 to-transparent z-[2]"}),e.jsxs("div",{className:"relative z-10 h-full flex flex-col justify-between p-5",children:[e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsx("div",{className:"w-16 h-22 rounded-lg shadow-xl overflow-hidden border border-white/10 bg-gradient-to-b from-[#1a1a2e] to-[#0f0f1a] flex flex-col items-center justify-center",children:t.coverImage?e.jsx(N,{src:t.coverImage,alt:t.title,widths:[96,128,160],sizes:"96px",className:"w-full h-full object-cover"}):e.jsx(v,{className:"w-6 h-6 text-primary/60"})}),!a&&e.jsx(o,{className:"bg-amber-500/20 text-amber-400 border-amber-500/30 text-xs backdrop-blur-sm",children:"Finalize a escrita"}),a&&t.chapters?.length>0&&e.jsxs(o,{className:"bg-white/10 text-white/80 border-white/10 text-xs backdrop-blur-sm",children:[t.chapters.length," cap."]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-bold text-white leading-tight line-clamp-2 mb-1 drop-shadow-lg",children:t.title}),t.author&&e.jsx("p",{className:"text-sm text-white/70 truncate drop-shadow-md",children:t.author}),e.jsxs("div",{className:`mt-3 flex items-center gap-2 text-sm font-semibold transition-colors ${a?"text-primary group-hover:text-primary/80":"text-amber-400"}`,children:[e.jsx("span",{children:a?"Criar ilustrações":"Continuar escrita"}),e.jsx(F,{className:"w-4 h-4 group-hover:translate-x-1 transition-transform"})]})]})]})]},t.id)})}),e.jsx("div",{className:"text-center mt-8",children:e.jsxs("button",{onClick:()=>p("external-form"),className:"text-sm text-muted-foreground hover:text-primary transition-colors inline-flex items-center gap-1.5","data-testid":"landing-outro-livro",children:[e.jsx(P,{className:"w-3.5 h-3.5"}),"Tem um livro de fora da plataforma? Clique aqui"]})})]})})]}),u==="external-form"&&e.jsxs("section",{"data-testid":"landing-external-section",children:[e.jsx("div",{className:"sticky top-0 z-40 border-b border-white/10 bg-background/80 backdrop-blur-xl",children:e.jsxs("div",{className:"max-w-4xl mx-auto px-4 py-3 flex items-center justify-between gap-3",children:[e.jsxs("button",{onClick:()=>p("choice"),className:"flex items-center gap-2 text-muted-foreground hover:text-white transition-colors text-sm","data-testid":"landing-external-back",children:[e.jsx(y,{className:"w-4 h-4"}),e.jsx("span",{children:"Voltar"})]}),e.jsxs(o,{className:"bg-primary/20 text-primary border-primary/20 text-xs",children:[e.jsx(x,{className:"w-3 h-3 mr-1"}),"Ilustrações"]})]})}),e.jsxs("div",{className:"max-w-4xl mx-auto px-4 py-8 space-y-10 pb-24",children:[e.jsxs("div",{className:"text-center space-y-3 mb-8",children:[e.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-white","data-testid":"text-external-title",children:"Informações do livro"}),e.jsx("p",{className:"text-lg text-muted-foreground",children:"Preencha os dad
1os do seu livro para criar ilustrações"})]}),e.jsxs("div",{className:"glass-card rounded-2xl border border-white/10 p-6 md:p-8 max-w-2xl mx-auto space-y-5",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"text-sm font-medium text-white",children:["Título do livro ",e.jsx("span",{className:"text-red-400",children:"*"})]}),e.jsx(m,{value:l,onChange:t=>C(t.target.value),placeholder:"Ex: A Grande Aventura",className:"bg-white/5 border-white/10 text-white placeholder:text-muted-foreground/50 h-12 rounded-xl","data-testid":"input-ext-title"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-white",children:"Autor"}),e.jsx(m,{value:n,onChange:t=>k(t.target.value),placeholder:"Nome do autor",className:"bg-white/5 border-white/10 text-white placeholder:text-muted-foreground/50 h-12 rounded-xl","data-testid":"input-ext-author"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-white",children:"Gênero"}),e.jsx(m,{value:d,onChange:t=>I(t.target.value),placeholder:"Ex: Ficção, Romance...",className:"bg-white/5 border-white/10 text-white placeholder:text-muted-foreground/50 h-12 rounded-xl","data-testid":"input-ext-genre"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"text-sm font-medium text-white",children:["Conteúdo do livro ",e.jsx("span",{className:"text-red-400",children:"*"})]}),e.jsx(G,{value:i,onChange:t=>E(t.target.value),placeholder:"Cole aqui o texto do seu livro...",rows:10,className:"bg-white/5 border-white/10 text-white placeholder:text-muted-foreground/50 rounded-xl resize-none","data-testid":"input-ext-content"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Cole o conteúdo completo do seu livro para que a SÁBHIA possa criar ilustrações contextualizadas."})]}),e.jsx(w,{onClick:z,disabled:!c||g,className:"w-full h-12 text-base gap-2 bg-gradient-to-r from-emerald-600 to-teal-600 hover:from-emerald-500 hover:to-teal-500 text-white font-semibold rounded-xl shadow-lg transition-all hover:scale-[1.01]","data-testid":"button-submit-external",children:g?e.jsxs(e.Fragment,{children:[e.jsx(f,{className:"w-5 h-5 animate-spin"}),"Criando livro..."]}):e.jsxs(e.Fragment,{children:[e.jsx(x,{className:"w-5 h-5"}),"Continuar para ilustrações",e.jsx(V,{className:"w-4 h-4"})]})})]})]})]})]})})}export{Y as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.