PageSourceSearch

https://createwithdub.ai/assets/PresentationHubPage-CRZ1Q34q.js

js createwithdub.ai collected 2026-10-05 15:21:04 UTC 9,034 bytes, 1 lines download raw bytes

1import{a as M,u as L,r as d,j as e,y as I,T as W,h as Y,f as N}from"./index-BBi1xAC0.js";import{u as q,A as z}from"./AttachmentChips-B9Y9fImV.js";import{u as G,n as V}from"./presentationStore-CObFc9hJ.js";import{listPresentations as J,generatePresentation as Q,createPresentation as X,getPresentation as Z,addSlide as ee,uploadSlideImage as te}from"./presentationApi-BDT-Km53.js";import{n as v}from"./notify-CMIHhz8B.js";import{h as se}from"./subscriptionAccess-COtutouY.js";/* empty css                    */import"./upload-Bl82i0tP.js";import"./s3Upload-8ajO3Oyp.js";import"./uploadImage-WRdXTz6N.js";import"./announce-RF2QjsJU.js";function ae(t){return t.layout==="media_card"&&t.content?.image?.status!=="ready"&&!t.content?.image?.url}function ne(t){return t.find(ae)}function oe(t=crypto.randomUUID()){return{id:t,layout:"media_card",content:{kicker:"YOUR PHOTO",title:"Look closely",subtitle:"A photo you added."}}}function ie(t){const a=ne(t);if(a)return{slides:t,slide:a,added:!1};const o=oe(),i=[...t],l=i.length>1?i.length-1:i.length;return i.splice(l,0,o),{slides:i,slide:o,added:!0}}const $="Presentations are included with Creator and above.";function je(){const{accessToken:t,isHydrating:a,user:o}=M(),i=M(y=>y.hydrate),l=L(),[p,_]=d.useState(!1);return d.useEffect(()=>{queueMicrotask(()=>_(!0)),i()},[i]),d.useEffect(()=>{!t&&!a&&l("/alpha/login")},[t,a,l]),p&&!a&&t&&o?e.jsx(re,{}):e.jsx("div",{className:"app-shell-loading","aria-live":"polite",children:e.jsx("span",{className:"app-shell-loading__text",children:"Loading…"})})}function re(){const t=I(o=>o.isMobile),a=I(o=>o.setSidebarOpen);return e.jsxs("div",{className:`code-hub ${t?"code-hub--mobile":""}`,children:[t&&e.jsxs("header",{className:"code-hub__mobile-header",children:[e.jsx("button",{type:"button",className:"code-hub__hamburger",onClick:()=>a(!0),"aria-label":"Open sidebar",children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:e.jsx("path",{d:"M3 5h14M3 10h14M3 15h14",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),e.jsx("span",{className:"code-hub__mobile-title",children:"Presentations"}),e.jsx("div",{style:{width:44}})]}),e.jsx("div",{className:"code-hub__main",children:e.jsx(ce,{})}),e.jsx(W,{})]})}function ce(){const t=L(),a=Y(s=>s.activeProjectId),o=G(s=>s.upsertPresentation),i=N(s=>s.tier),l=N(s=>s.subscriptionStatus),p=N(s=>s.hasFetched),_=N(s=>s.ensureSubscription),[m,y]=d.useState([]),[n,h]=d.useState(!0),[g,f]=d.useState(""),[u,r]=d.useState(!1),{attachments:b,isUploading:x,uploadError:P,isDragOver:w,fileInputRef:D,removeAttachment:C,clearAttachments:A,onFileInputChange:F,onDragOver:T,onDragLeave:B,onDrop:H}=q();d.useEffect(()=>{_()},[_]),d.useEffect(()=>{window.location.hash==="#my-decks"&&document.getElementById("my-decks")?.scrollIntoView({behavior:"smooth",block:"start"})},[n,m.length]);const S=p&&se(i,l),k=u||!p||!S,O=p?S?void 0:$:"Checking your plan…";d.useEffect(()=>{let s=!1;return h(!0),J().then(c=>{s||y(c)}).catch(()=>{s||v("Could not load presentations — try again")}).finally(()=>{s||h(!1)}),()=>{s=!0}},[]);const E=d.useCallback(async()=>{const s=g.trim();if(!(!s||k)){r(!0);try{const{presentation:c}=await Q({prompt:s,project_id:a??void 0,...b.length>0?{attachments:b.map(({handle:j,kind:R,url:K})=>({handle:j,kind:R,url:K}))}:{}});A(),o(c),t(`/presentations/${c.id}/edit`)}catch(c){v(c.message||"Could not start the deck — try again"),r(!1)}}},[g,k,a,t,o,b,A]),U=d.useCallback(async()=>{if(!u){r(!0);try{const s=await X({project_id:a??void 0});o(s),t(`/presentations/${s.id}/edit`)}catch(s){v(s.message||"Could not create the presentation — try again"),r(!1)}}},[u,a,t,o]);return e.jsxs("div",{className:"code-hub-content",children:[e.jsxs("div",{className:"code-hub-content__header",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"code-hub-content__title",children:"Presentations"}),e.jsx("p",{className:"code-hub-content__tagline",children:"Describe a deck — a pitch, a treatment, a lookbook — and it builds slides with poster art. Present it, or download a PDF."})]}),e.jsxs("button",{type:"button",className:"code-hub-content__new-btn",onClick:U,disabled:u,children:[e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M12 5v14M5 12h14"})}),u?"Creating…":"New blank deck"]})]}),e.jsxs("div",{className:`code-hub-content__composer${w?" code-hub-content__composer--dragover":""}`,onDragOver:T,onDragLeave:B,onDrop:H,children:[(b.length>0||x)&&e.jsx(z,{attachments:b,isUploading:x,onChipClick:s=>{const c=`@${s}`;f(j=>j.includes(c)?j:`${j.trim()} ${c}`.trim())},onRemove:C}),P&&e.jsx("div",{className:"code-hub-content__upload-error",role:"alert",children:P}),e.jsx("textarea",{className:"code-hub-content__prompt",value:g,onChange:s=>
1f(s.target.value),placeholder:'Try "an 8-slide pitch for the album rollout" — add photos with +',rows:3,"aria-label":"Describe the presentation to build",onKeyDown:s=>{s.key==="Enter"&&(s.metaKey||s.ctrlKey)&&E()}}),e.jsxs("div",{className:"code-hub-content__composer-row",children:[e.jsxs("label",{className:`code-hub-content__attach composer-file-hit${b.length>0?" code-hub-content__attach--active":""}`,title:"Add photos for this presentation",children:[e.jsx("input",{ref:D,type:"file",className:"composer-file-input",accept:"image/png,image/jpeg,image/webp,image/heic,image/heif,image/*",multiple:!0,disabled:u||x,"aria-label":"Add files",onChange:F}),e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round","aria-hidden":"true",children:e.jsx("path",{d:"M12 5v14M5 12h14"})}),e.jsx("span",{children:"Add photos"})]}),!S&&p&&e.jsx("span",{className:"code-hub-content__tier-copy",children:$}),e.jsx("button",{type:"button",className:"code-hub-content__generate-btn",onClick:E,disabled:k||!g.trim()||x,title:O,children:u?"Starting…":"Build my deck"})]})]}),n&&m.length===0?e.jsx("div",{className:"code-hub-content__loading",id:"my-decks",children:e.jsx("div",{className:"code-hub-content__spinner"})}):m.length===0?e.jsxs("div",{className:"code-hub-content__empty",id:"my-decks",children:[e.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"14",rx:"2"}),e.jsx("path",{d:"M2 8h20"}),e.jsx("path",{d:"M8 18v2M16 18v2M7 22h10"})]}),e.jsx("h3",{children:"No presentations yet"}),e.jsx("p",{children:"Describe your first deck above, then Present it or download a PDF."})]}):e.jsx("div",{className:"code-hub-content__grid",id:"my-decks",children:m.map(s=>e.jsx(de,{deck:s,onOpen:c=>t(`/presentations/${c}/edit`),onPresent:c=>t(`/presentations/${c}/present`)},s.id))})]})}function de({deck:t,onOpen:a,onPresent:o}){const[i,l]=d.useState(!1),p=t.status==="generating"?"Writing slides…":t.status==="failed"?"Failed":"Ready",_=t.status==="ready"&&t.slide_count>0,m=t.status==="ready"&&t.slide_count>0;async function y(n){if(!m||i||n.length===0)return;l(!0);let h=0;try{let f=(await Z(t.id)).slides??[];for(const u of n)try{const r=ie(f);if(r.added){const w=r.slides.findIndex(C=>C.id===r.slide.id);f=(await ee(t.id,{slide:r.slide,at:w})).slides??r.slides}const b=r.slide,x=await V(u);f=(await te(t.id,b.id,x)).slides??f,h+=1}catch(r){v(r instanceof Error?r.message:"Could not add that photo. Try again.");break}h>0&&a(t.id)}catch(g){v(g instanceof Error?g.message:"Could not add that photo. Try again."),h>0&&a(t.id)}finally{l(!1)}}return e.jsxs("div",{className:"code-hub-card",role:"button",tabIndex:0,onClick:()=>a(t.id),onKeyDown:n=>{(n.key==="Enter"||n.key===" ")&&a(t.id)},children:[e.jsxs("div",{className:"code-hub-card__info",children:[e.jsx("span",{className:"code-hub-card__title",children:t.title||"Untitled presentation"}),e.jsxs("div",{className:"code-hub-card__meta",children:[e.jsx("span",{className:`code-hub-card__status code-hub-card__status--${t.status}`,children:p}),t.slide_count>0&&e.jsxs("span",{children:[t.slide_count," ",t.slide_count===1?"slide":"slides"]}),t.updated_at&&e.jsx("span",{className:"code-hub-card__date",children:new Date(t.updated_at).toLocaleDateString()})]}),t.status==="failed"&&t.status_message&&e.jsx("p",{className:"code-hub-card__error",children:t.status_message})]}),e.jsxs("div",{className:"code-hub-card__actions",children:[m&&e.jsxs("label",{className:"code-hub-card__copy-btn composer-file-hit",onClick:n=>n.stopPropagation(),onKeyDown:n=>n.stopPropagation(),children:[e.jsx("input",{type:"file",className:"composer-file-input",accept:"image/png,image/jpeg,image/webp,image/heic,image/heif,image/*",multiple:!0,disabled:i,"aria-label":`Add photos to ${t.title||"this presentation"}`,onChange:n=>{const h=Array.from(n.target.files??[]);n.target.value="",h.length>0&&y(h)}}),i?"Adding…":"+ Add photos"]}),_&&e.jsx("button",{type:"button",className:"code-hub-card__copy-btn",onClick:n=>{n.stopPropagation(),o(t.id)},children:"Present"})]})]})}export{je 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.