Files
uno-click/site/.next/static/chunks/app/result/page-7096d0d3c33dfb7f.js
T
2026-05-13 14:20:41 +00:00

1 line
8.9 KiB
JavaScript

(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[609],{4273:function(e,t,i){Promise.resolve().then(i.bind(i,4437))},4437:function(e,t,i){"use strict";i.r(t),i.d(t,{default:function(){return a}});var r=i(7437),n=i(2265),s=i(9376);function d(){var e,t;(0,s.useRouter)();let i=(0,s.useSearchParams)().get("generationUuid"),[d,a]=(0,n.useState)(null),[o,p]=(0,n.useState)(!0),[c,x]=(0,n.useState)(""),[h,f]=(0,n.useState)(!1);async function u(){if(i)try{let e=await fetch("/api/result/".concat(i),{credentials:"same-origin"}),t=await e.json();if(!e.ok)throw Error(t.message||"Ошибка загрузки результата");a(t.result),x(""),p(!1),"running"===t.result.status||"waiting_for_input"===t.result.status?(f(!0),setTimeout(u,3e3)):f(!1)}catch(e){x(e instanceof Error?e.message:"Ошибка загрузки"),p(!1)}}return((0,n.useEffect)(()=>(i?u():(x("Не указан generationUuid"),p(!1)),()=>{}),[i]),o)?(0,r.jsx)("div",{style:l.page,children:(0,r.jsxs)("div",{style:l.container,children:[(0,r.jsxs)("div",{style:l.header,children:[(0,r.jsx)("h1",{style:l.headerTitle,children:"Результат"}),(0,r.jsx)("a",{href:"/dashboard",style:l.btnSmall,children:"К сценариям"})]}),(0,r.jsx)("div",{style:l.card,children:(0,r.jsxs)("div",{style:l.emptyState,children:[(0,r.jsx)("div",{style:l.emptyStateIcon,children:(0,r.jsx)("span",{style:l.spinnerLarge})}),(0,r.jsx)("div",{style:l.emptyStateText,children:"Загружаем результат..."})]})})]})}):c&&!d?(0,r.jsx)("div",{style:l.page,children:(0,r.jsxs)("div",{style:l.container,children:[(0,r.jsxs)("div",{style:l.header,children:[(0,r.jsx)("h1",{style:l.headerTitle,children:"Результат"}),(0,r.jsx)("a",{href:"/dashboard",style:l.btnSmall,children:"К сценариям"})]}),(0,r.jsx)("div",{style:l.card,children:(0,r.jsx)("div",{style:l.error,children:c})})]})}):(0,r.jsx)("div",{style:l.page,children:(0,r.jsxs)("div",{style:l.container,children:[(0,r.jsxs)("div",{style:l.header,children:[(0,r.jsx)("h1",{style:l.headerTitle,children:"Результат"}),(0,r.jsx)("div",{style:l.headerActions,children:(0,r.jsx)("a",{href:"/dashboard",style:l.btnSmall,children:"К сценариям"})})]}),(0,r.jsxs)("div",{style:l.card,children:[(0,r.jsxs)("div",{style:l.cardHeader,children:[(0,r.jsx)("span",{style:l.cardTitle,children:(null==d?void 0:d.scenarioName)||"Загрузка..."}),(0,r.jsx)("span",{style:{...l.statusBadge,...(null==d?void 0:d.status)==="completed"?l.statusCompleted:(null==d?void 0:d.status)==="failed"?l.statusFailed:l.statusRunning},children:d?({running:"Генерация...",completed:"Готово",failed:"Ошибка",waiting_for_input:"Ожидание...",created:"Создано"})[t=d.status]||t:"Загрузка..."})]}),(0,r.jsxs)("div",{style:l.cardBody,children:[c&&(0,r.jsx)("div",{style:l.error,children:c}),(null==d?void 0:null===(e=d.requestPayload)||void 0===e?void 0:e.prompt)&&(0,r.jsxs)("div",{style:l.promptInfo,children:[(0,r.jsx)("div",{style:l.promptLabel,children:"Промпт"}),(0,r.jsx)("div",{style:l.promptText,children:d.requestPayload.prompt})]}),(null==d?void 0:d.files)&&d.files.length>0?(0,r.jsx)("div",{style:l.fileContainer,children:d.files.map((e,t)=>(function(e,t){var i;let n="video"===e.contentType?(0,r.jsx)("video",{src:e.url,controls:!0,style:l.previewMedia}):(0,r.jsx)("img",{src:e.url,alt:"Result ".concat(t+1),style:l.previewMedia});return(0,r.jsxs)("div",{style:l.fileCard,children:[(0,r.jsx)("div",{style:l.filePreview,children:n}),(0,r.jsxs)("div",{style:l.fileInfo,children:[(0,r.jsxs)("div",{style:l.fileMeta,children:[e.format&&(0,r.jsxs)("span",{style:l.fileMetaItem,children:[(0,r.jsx)("strong",{children:"Формат:"})," ",e.format.toUpperCase()]}),e.width&&e.height&&(0,r.jsxs)("span",{style:l.fileMetaItem,children:[(0,r.jsx)("strong",{children:"Размер:"})," ",e.width,"\xd7",e.height]}),e.duration&&(0,r.jsxs)("span",{style:l.fileMetaItem,children:[(0,r.jsx)("strong",{children:"Длительность:"})," ",(i=e.duration,"".concat(Math.floor(i/60),":").concat(Math.floor(i%60).toString().padStart(2,"0")))]})]}),(0,r.jsxs)("div",{style:l.fileActions,children:[(0,r.jsx)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",style:l.btnPrimary,children:"\uD83D\uDC41 Открыть"}),(0,r.jsx)("a",{href:e.url,download:!0,style:l.btnSecondary,children:"⬇ Скачать"})]})]})]},t)})(e,t))}):(null==d?void 0:d.status)==="completed"?(0,r.jsxs)("div",{style:l.emptyState,children:[(0,r.jsx)("div",{style:l.emptyStateIcon,children:"⏳"}),(0,r.jsx)("div",{style:l.emptyStateText,children:"Результат получен, но файлы не найдены"})]}):(null==d?void 0:d.status)==="failed"?(0,r.jsxs)("div",{style:l.emptyState,children:[(0,r.jsx)("div",{style:l.emptyStateIcon,children:"❌"}),(0,r.jsx)("div",{style:l.emptyStateText,children:"Произошла ошибка при генерации"})]}):(0,r.jsxs)("div",{style:l.emptyState,children:[(0,r.jsx)("div",{style:l.emptyStateIcon,children:"⏳"}),(0,r.jsx)("div",{style:l.emptyStateText,children:"Результат ещё не готов"}),(0,r.jsxs)("button",{onClick:u,style:l.refreshBtn,children:[(0,r.jsx)("span",{style:{...l.spinner,display:h?"inline-block":"none"}}),(0,r.jsx)("span",{children:"Проверить снова"})]})]})]})]})]})})}function a(){return(0,r.jsx)(n.Suspense,{fallback:(0,r.jsx)("div",{style:l.page,children:(0,r.jsx)("div",{style:l.container,children:(0,r.jsx)("div",{style:l.emptyState,children:"Загрузка..."})})}),children:(0,r.jsx)(d,{})})}let l={page:{minHeight:"100vh",padding:"40px 20px",background:"#f5f5f5"},container:{maxWidth:"900px",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"},headerActions:{display:"flex",gap:"10px"},btnSmall:{padding:"8px 16px",borderRadius:"6px",fontSize:"13px",cursor:"pointer",border:"1px solid #ddd",background:"white",color:"#666",textDecoration:"none"},card:{background:"white",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0,0,0,0.1)",overflow:"hidden"},cardHeader:{padding:"20px 30px",borderBottom:"1px solid #eee",display:"flex",alignItems:"center"},cardTitle:{fontSize:"16px",fontWeight:600,color:"#333"},cardBody:{padding:"30px"},statusBadge:{display:"inline-block",padding:"4px 12px",borderRadius:"20px",fontSize:"12px",fontWeight:500,marginLeft:"10px"},statusRunning:{background:"#fff3cd",color:"#856404"},statusCompleted:{background:"#d4edda",color:"#155724"},statusFailed:{background:"#f8d7da",color:"#721c24"},emptyState:{textAlign:"center",padding:"60px 20px",color:"#666"},emptyStateIcon:{fontSize:"48px",marginBottom:"16px"},emptyStateText:{fontSize:"16px",marginBottom:"24px"},refreshBtn:{display:"inline-flex",alignItems:"center",gap:"8px",padding:"12px 24px",background:"#007bff",color:"white",border:"none",borderRadius:"6px",fontSize:"14px",fontWeight:500,cursor:"pointer"},spinner:{display:"inline-block",width:"16px",height:"16px",border:"2px solid rgba(255,255,255,0.3)",borderTopColor:"white",borderRadius:"50%",animation:"spin 1s linear infinite"},spinnerLarge:{width:"32px",height:"32px",border:"2px solid rgba(0,123,255,0.3)",borderTopColor:"#007bff",borderRadius:"50%",animation:"spin 1s linear infinite"},error:{background:"#fee",color:"#c00",padding:"12px",borderRadius:"6px",marginBottom:"20px",fontSize:"14px"},promptInfo:{background:"#f8f9fa",padding:"16px 20px",borderRadius:"6px",marginBottom:"20px"},promptLabel:{fontSize:"12px",color:"#666",marginBottom:"4px"},promptText:{fontSize:"14px",color:"#333"},fileContainer:{display:"flex",flexDirection:"column",gap:"20px"},fileCard:{border:"1px solid #eee",borderRadius:"8px",overflow:"hidden"},filePreview:{width:"100%",background:"#f5f5f5",display:"flex",alignItems:"center",justifyContent:"center",minHeight:"300px",maxHeight:"600px"},previewMedia:{maxWidth:"100%",maxHeight:"600px",objectFit:"contain"},fileInfo:{padding:"16px 20px",background:"#fafafa",display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:"12px"},fileMeta:{display:"flex",gap:"16px",flexWrap:"wrap"},fileMetaItem:{fontSize:"13px",color:"#666"},fileActions:{display:"flex",gap:"10px"},btnPrimary:{padding:"10px 20px",borderRadius:"6px",fontSize:"13px",fontWeight:500,cursor:"pointer",textDecoration:"none",border:"none",display:"inline-flex",alignItems:"center",gap:"6px",background:"#007bff",color:"white"},btnSecondary:{padding:"10px 20px",borderRadius:"6px",fontSize:"13px",fontWeight:500,cursor:"pointer",textDecoration:"none",border:"1px solid #ddd",display:"inline-flex",alignItems:"center",gap:"6px",background:"#f5f5f5",color:"#333"}}},9376:function(e,t,i){"use strict";var r=i(5475);i.o(r,"useRouter")&&i.d(t,{useRouter:function(){return r.useRouter}}),i.o(r,"useSearchParams")&&i.d(t,{useSearchParams:function(){return r.useSearchParams}})}},function(e){e.O(0,[971,117,744],function(){return e(e.s=4273)}),_N_E=e.O()}]);