1 line
5.8 KiB
JavaScript
1 line
5.8 KiB
JavaScript
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[702],{8462:function(e,n,i){Promise.resolve().then(i.bind(i,1720))},1720:function(e,n,i){"use strict";i.r(n),i.d(n,{default:function(){return a}});var t=i(7437),r=i(2265),o=i(9376);function a(){let e=(0,o.useRouter)(),[n,i]=(0,r.useState)(null),[a,c]=(0,r.useState)(!0),[d,l]=(0,r.useState)(!1);async function u(){try{await fetch("/api/auth/logout",{method:"POST",credentials:"same-origin"}),e.push("/")}catch(n){console.error("Logout error:",n),e.push("/")}}async function p(){let e=await fetch("/api/auth/csrf",{credentials:"same-origin"});return(await e.json()).csrfToken||""}async function x(){l(!0);try{let n=await p(),i=await fetch("/api/scenario/uniqueizer/start",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","x-csrf-token":n}});if(i.ok){let n=await i.json();e.push("/uniqueizer?generationUuid=".concat(n.generationUuid))}else{let e=await i.json();alert("Ошибка запуска сценария: "+(e.message||i.statusText))}}catch(e){alert("Ошибка: "+(e instanceof Error?e.message:String(e)))}finally{l(!1)}}return((0,r.useEffect)(()=>{(async function(){try{let n=await fetch("/api/auth/me",{credentials:"same-origin"});if(!n.ok){e.push("/");return}let t=await n.json();i(t.user)}catch(n){e.push("/")}finally{c(!1)}})()},[e]),a)?(0,t.jsx)("div",{style:s.loading,children:"Загрузка..."}):(0,t.jsx)("div",{style:s.page,children:(0,t.jsxs)("div",{style:s.container,children:[(0,t.jsxs)("div",{style:s.header,children:[(0,t.jsx)("h1",{style:s.headerTitle,children:"Uno Click"}),(0,t.jsx)("button",{onClick:u,style:s.logoutBtn,children:"Выйти"})]}),(0,t.jsxs)("div",{style:s.welcome,children:[(0,t.jsxs)("h2",{style:s.welcomeTitle,children:["Добро пожаловать, ",(null==n?void 0:n.displayName)||(null==n?void 0:n.email),"!"]}),(0,t.jsx)("p",{style:s.welcomeText,children:"Выберите сценарий для запуска"})]}),(0,t.jsxs)("div",{style:s.scenariosGrid,children:[(0,t.jsxs)("div",{style:s.scenarioCard,children:[(0,t.jsx)("div",{style:{...s.scenarioIcon,...s.scenarioIconBlue},children:"\uD83C\uDFA8"}),(0,t.jsx)("div",{style:s.scenarioName,children:"Nano Banana"}),(0,t.jsx)("div",{style:s.scenarioDesc,children:"Генерация изображений по текстовому описанию. Введите промпт и получите уникальную иллюстрацию."}),(0,t.jsx)("a",{href:"/prompt?scenario=nano-banana",style:s.btnPrimary,children:"Запустить"})]}),(0,t.jsxs)("div",{style:s.scenarioCard,children:[(0,t.jsx)("div",{style:{...s.scenarioIcon,...s.scenarioIconGreen},children:"\uD83E\uDDEA"}),(0,t.jsx)("div",{style:s.scenarioName,children:"Demo Scenario"}),(0,t.jsx)("div",{style:s.scenarioDesc,children:"Тестовый сценарий для проверки функциональности. Многоступенчатая генерация с подтверждением."}),(0,t.jsx)("a",{href:"/prompt?scenario=demo-scenario",style:s.btnSecondary,children:"Запустить"})]}),(0,t.jsxs)("div",{style:s.scenarioCard,children:[(0,t.jsx)("div",{style:{...s.scenarioIcon,...s.scenarioIconBlue},children:"✨"}),(0,t.jsx)("div",{style:s.scenarioName,children:"Уникализация"}),(0,t.jsx)("div",{style:s.scenarioDesc,children:"Запуск сценария уникализации контента."}),(0,t.jsx)("button",{onClick:x,disabled:d,style:{...s.btnPrimary,...d?s.btnDisabled:{}},children:d?"Запуск...":"Запустить"})]})]})]})})}let s={page:{minHeight:"100vh",padding:"40px 20px",background:"#f5f5f5"},container:{maxWidth:"800px",margin:"0 auto"},header:{background:"white",padding:"20px 30px",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0,0,0,0.1)",marginBottom:"20px",display:"flex",justifyContent:"space-between",alignItems:"center"},headerTitle:{fontSize:"20px",fontWeight:600,color:"#333"},logoutBtn:{background:"none",border:"1px solid #ddd",padding:"8px 16px",borderRadius:"6px",cursor:"pointer",fontSize:"14px",color:"#666"},welcome:{background:"white",padding:"20px 30px",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0,0,0,0.1)",marginBottom:"20px"},welcomeTitle:{fontSize:"18px",fontWeight:600,color:"#333",marginBottom:"8px"},welcomeText:{color:"#666",fontSize:"14px"},scenariosGrid:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(300px, 1fr))",gap:"20px"},scenarioCard:{background:"white",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0,0,0,0.1)",padding:"24px",transition:"box-shadow 0.2s"},scenarioIcon:{width:"48px",height:"48px",borderRadius:"10px",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"24px",marginBottom:"16px"},scenarioIconBlue:{background:"linear-gradient(135deg, #667eea 0%, #764ba2 100%)"},scenarioIconGreen:{background:"linear-gradient(135deg, #11998e 0%, #38ef7d 100%)"},scenarioName:{fontSize:"16px",fontWeight:600,color:"#333",marginBottom:"8px"},scenarioDesc:{fontSize:"14px",color:"#666",marginBottom:"20px",lineHeight:1.5},btnPrimary:{width:"100%",padding:"12px",background:"#007bff",color:"white",border:"none",borderRadius:"6px",fontSize:"14px",fontWeight:500,cursor:"pointer",textAlign:"center",textDecoration:"none",display:"inline-block"},btnSecondary:{width:"100%",padding:"12px",background:"#f5f5f5",color:"#333",border:"1px solid #ddd",borderRadius:"6px",fontSize:"14px",fontWeight:500,cursor:"pointer",textAlign:"center",textDecoration:"none",display:"inline-block"},btnDisabled:{background:"#ccc",cursor:"not-allowed"},loading:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"100vh",fontSize:"18px",color:"#666"}}},9376:function(e,n,i){"use strict";var t=i(5475);i.o(t,"useRouter")&&i.d(n,{useRouter:function(){return t.useRouter}}),i.o(t,"useSearchParams")&&i.d(n,{useSearchParams:function(){return t.useSearchParams}})}},function(e){e.O(0,[971,117,744],function(){return e(e.s=8462)}),_N_E=e.O()}]); |