PageSourceSearch

https://brightarena.com/assets/update-detail-DJyM7WRG.js

js brightarena.com collected 2026-10-09 03:50:39 UTC 15,083 bytes, 1 lines download raw bytes

1import{Z as e,aB as U,ag as o,aa as B,ad as R,e as P,aD as $,aE as q,az as K,w as b,h as I}from"./index-BbzIpGd1.js";import{L as G}from"./LoadError-CrC1Bnfx.js";import{B as T}from"./BottomSheet-DxClqWSO.js";import{C as M}from"./ConfirmDelete-DD3__03m.js";import{C as V}from"./ConfettiBurst-Bvg188gn.js";import{n as Z}from"./X.es-BR2HFzON.js";import{F as J,P as O,A as Q,U as X}from"./Feed-C328GQjl.js";import{u as ee}from"./use-load-BdR0LknS.js";import"./index-Dj_wEDBw.js";import"./CaretDown.es-CWSwnq6d.js";import"./FeedCommentSheet-CGHR9AW9.js";import"./ReactionGlyph-Cf9E66cr.js";import"./mood-music-BhsfhXUc.js";import"./Comments-DotTjI4x.js";import"./AudienceChip-uTqYrc-7.js";import"./PencilSimple.es-B4O6TODb.js";import"./ReplyingTo-O34rKXtK.js";import"./DotsThree.es-CgLAGm1D.js";import"./Trash.es-BQhYMtVJ.js";import"./BookmarkSimple.es-Bv6sTo4X.js";import"./MoodPicker-BU4Z9n9S.js";import"./TextComposer-C9rvb2Vg.js";import"./use-mood-track-o5AjD4ws.js";import"./Check.es-CXkOHafE.js";import"./Copy.es-Ci4UebEd.js";import"./MilestoneMedia-BjinEMoF.js";import"./ImageMedia-CsfJ6TTT.js";import"./structure-labels-C1nltfsc.js";import"./vertical-colors-B0QLmqsQ.js";import"./project-accent-O3QgENRQ.js";import"./palette-Bkoplzjb.js";function te({visibility:t,profileSlug:i,onDismiss:l}){const d=se(t);return e.jsxs(e.Fragment,{children:[e.jsx(V,{}),e.jsxs("section",{className:"relative mb-6 overflow-hidden rounded-lg border border-warning-border bg-gradient-to-br from-warning-soft via-surface-raised to-success-soft p-6",children:[e.jsx("button",{type:"button",onClick:l,className:"absolute top-3 right-3 text-ink-faint hover:text-ink-secondary text-sm","aria-label":"Dismiss",children:"✕"}),e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"text-3xl leading-none mt-0.5","aria-hidden":!0,children:"✨"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-[0.15em] text-ink-muted font-medium",children:"A first"}),e.jsx("h2",{className:"mt-0.5 text-lg font-semibold text-ink",children:"Your first update is live."}),e.jsx("p",{className:"mt-1.5 text-sm text-ink-secondary leading-relaxed",children:d}),t==="public"&&i&&e.jsxs("p",{className:"mt-3 text-[12px] text-ink-secondary",children:["It now appears on your public profile at"," ",e.jsxs("a",{href:`/p/${i}`,target:"_blank",rel:"noreferrer",className:"underline decoration-dotted hover:text-ink",children:["/p/",i]}),"."]})]})]})]})]})}function se(t){switch(t){case"public":return"It's public. Anyone can see it.";case"org":return"Everyone at your organisation will see it in their feed.";case"project":return"Your project team will see it in their feed.";case"private":return"Held private for now. Share it whenever you're ready."}}function re({item:t,openComments:i,highlightCommentId:l,onClose:d}){const g=U(),r=d??(()=>{window.history.length>1?g(-1):g("/feed")});return o.useEffect(()=>{const s=a=>{a.key==="Escape"&&r()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[]),e.jsxs("div",{className:"fixed inset-0 z-50 bg-surface",children:[e.jsx("button",{type:"button",onClick:r,"aria-label":"Close",className:"ba-safe-top absolute right-3 top-3 z-[60] flex h-10 w-10 items-center justify-center rounded-full bg-black/55 text-white backdrop-blur-sm hover:bg-black/75",children:e.jsx(Z,{size:20,weight:"bold"})}),e.jsx(J,{load:async()=>({items:[t],projects:[],last_seen_at:null}),updateLinkFor:s=>`/updates/${s.id}`,projectLinkFor:s=>R(s.project_id??""),researcherLinkFor:s=>B(s.author_id),trackCardInUrl:!1,openCommentsFor:i?{updateId:t.id,highlightCommentId:l}:null})]})}function ne({open:t,onClose:i,update:l,onSaved:d,onPublish:g,onSchedule:r,publishing:s=!1,error:a=null}){const[c,u]=o.useState(null),[y,m]=o.useState(!1),j=!!c&&(c.places.some(p=>p.selected)||c.fixed.length>0);return e.jsx(T,{open:t,onClose:i,title:"Location",closeLabel:"Close",footer:e.jsxs("div",{children:[c&&e.jsx(Q,{places:c,className:"mb-2"}),e.jsx(P,{text:a,className:"mb-2"}),e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[r&&e.jsxs("div",{className:"relative",children:[e.jsx("button",{type:"button",onClick:()=>m(p=>!p),disabled:!j||s,className:"text-sm px-3 py-2 rounded-md border border-border-strong text-ink-secondary hover:border-border-heavy disabled:opacity-50",children:"Later ▾"}),y&&e.jsxs("div",{className:"absolute right-0 bottom-full mb-1 w-44 rounded-md border border-border bg-surface-raised shadow-lg py-1 z-10",children:[e.jsxs("button",{type:"button",onClick:()=>{m(!1),r(ie())},className:"flex w-full items-baseline justify-between px-3 py-2 text-sm text-ink hover:bg-surface-sunken",children:["Tomorrow ",e.jsx("span",{className:"text-[11px] text-ink-muted",children:"9am"})]}),e.jsxs("button",{type:"button",onClick:()=>{m(!1),r(ae())},className:"flex w-full items-baseline justify-between px-3 py-2 text-sm text-ink hover:bg-surface-sunken",children:["Next week ",e.jsx("span",{className:"text-[11px] text-ink-muted",children:"Mon 9am"})]})]})]}),e.jsx("button",{type:"button",onClick:()=>{g()},disabled:!j||s,className:"text-sm px-5 py-2 rounded-md bg-surface-inverse text-ink-on-inverse font-medium hover:bg-surface-inverse-hover disabled:opacity-50",children:s?"Posting…":"Post"})]})]}),children:e.jsx("div",{className:"pt-2 pb-3",children:e.jsx(O,{updateId:l.id,onSaved:d,onPlaces:u,showAudience:!1})})})}function ie(){const t=new Date;return t.setDate(t.getDate()+1),t.setHours(9,0,0,0),t}function ae(){const t=new Date,l=(8-t.getDay())%7||7;return t.setDate(t.getDate()+l),t.setHours(9,0,0,0),t}function oe({update:t,onSaved:i}){return e.jsxs("div",{className:"mt-3 space-y-4 border-t border-info-border pt-3",children:[e.jsx("p",{className:"text-[12px] text-info-fg/85",children:"Set these now. Each one saves immediately."}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-[10px] uppercase tracking-[0.15em] text-info-fg/70 mb-2",children:"Location"}),e.jsx(O,{updateId:t.id,onSaved:i})]})]})}const k=[{status:"recorded",label:"Saving your recording",detail:"Stored safely. Handing off to the transcriber."},{status:"transcribing",label:"Transcribing",detail:"This is the long one, usually under a minute."},{status:"translating",label:"Drafting your narrative and headline quote",detail:"Almost there."}];function de({update:t,onPublishNow:i,onUnschedule:l,onSaved:d,onMarkSilent:g,onWriteOwn:r,onChoosePlaces:s,busy:a=!1}
1){const[c,u]=o.useState(!1),[y,m]=o.useState(""),[j,p]=o.useState(null);if(!t.is_me_author)return null;if(t.pipeline_status==="ready_for_review"&&t.scheduled_publish_at)return e.jsxs("div",{className:"mb-6 rounded-md border border-info-border bg-info-soft p-4",children:[e.jsxs("p",{className:"text-sm font-medium text-info-fg",children:["Scheduled to publish ",le(t.scheduled_publish_at)]}),e.jsx("p",{className:"mt-0.5 text-[12px] text-info-fg/85",children:"It's only visible to you until then. You can publish it now or discard the schedule."}),e.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[i&&e.jsx("button",{type:"button",onClick:()=>{i()},disabled:a,className:"text-xs px-3 py-1.5 rounded-md bg-surface-inverse text-ink-on-inverse font-medium hover:bg-surface-inverse-hover disabled:opacity-50",children:"Publish now"}),l&&e.jsx("button",{type:"button",onClick:()=>{l()},disabled:a,className:"text-xs px-3 py-1.5 rounded-md border border-border-strong text-ink-secondary hover:border-border-heavy disabled:opacity-50",children:"Discard schedule"})]})]});const v=k.findIndex(w=>w.status===t.pipeline_status);if(v>=0){const w=k[v];return e.jsxs("div",{className:"mb-6 rounded-md border border-info-border bg-info-soft p-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-7 h-7 rounded-full border-2 border-info-border border-t-info-fg animate-spin shrink-0","aria-hidden":!0}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("p",{className:"text-sm font-medium text-info-fg",children:["Step ",v+1," of ",k.length,": ",w.label]}),e.jsxs("p",{className:"text-[12px] text-info-fg/85 mt-0.5",children:[w.detail," ",t.is_reply?"Your reply goes to the person who asked as soon as it is ready. You can leave this page.":e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"Keep this page open"}),". We'll show you the draft to approve as soon as it lands, and you don't need to refresh."]})]})]})]}),e.jsx("ol",{className:"mt-3 flex gap-1.5","aria-label":`Step ${v+1} of ${k.length}`,children:k.map((f,N)=>e.jsx("li",{className:"h-1.5 flex-1 rounded-full "+(N<v?"bg-info-fg":N===v?"bg-info-fg/60 animate-pulse":"bg-info-border")},f.status))}),r&&!t.is_reply&&e.jsx("div",{className:"mt-4 border-t border-info-border pt-3",children:c?e.jsxs("div",{children:[e.jsx("textarea",{value:y,onChange:f=>m(f.target.value.slice(0,500)),autoFocus:!0,rows:3,placeholder:"What happened? One breath, in your own words.","aria-label":"Update",className:"w-full rounded-md border border-border-strong bg-surface-raised px-3 py-2 text-[15px] focus:outline-none focus:ring-1 focus:ring-surface-inverse"}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsx("button",{type:"button",disabled:a||!y.trim(),onClick:()=>{p(null),r(y.trim()).catch(f=>p(f instanceof Error?f.message:"Could not post that."))},className:"text-xs px-3 py-1.5 rounded-md bg-surface-inverse text-ink-on-inverse font-medium hover:bg-surface-inverse-hover disabled:opacity-50",children:"Next"}),e.jsx("button",{type:"button",onClick:()=>u(!1),className:"text-xs text-ink-muted hover:text-ink",children:"Keep waiting instead"}),e.jsx("span",{className:"ml-auto text-[11px] tabular-nums text-ink-muted",children:500-y.length})]}),e.jsx(P,{text:j,className:"mt-2"})]}):e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("button",{type:"button",onClick:()=>u(!0),disabled:a,className:"text-xs px-3 py-1.5 rounded-md bg-surface-inverse text-ink-on-inverse font-medium hover:bg-surface-inverse-hover disabled:opacity-50",children:"Write it yourself"}),e.jsx("button",{type:"button",disabled:a,onClick:()=>{p(null),r("").catch(f=>p(f instanceof Error?f.message:"Could not do that."))},className:"text-xs px-3 py-1.5 rounded-md border border-info-border text-info-fg hover:bg-info-soft disabled:opacity-50",children:"Post without words"}),e.jsx("span",{className:"text-[12px] text-info-fg/85",children:"or wait for three suggestions."}),e.jsx(P,{text:j,className:"w-full"})]})}),d&&!t.is_reply&&e.jsx(oe,{update:t,onSaved:d})]})}return t.pipeline_status==="failed"?e.jsxs("div",{className:"mb-6 rounded-md border border-danger-border bg-danger-soft p-4",children:[e.jsx("p",{className:"text-sm font-medium text-danger-fg",children:"We couldn't finish processing this recording."}),e.jsx("p",{className:"text-[12px] text-danger-fg/85 mt-0.5",children:"Your video is saved. You don't need to record it again. The transcript step didn't complete, so there's no draft to approve yet. We retry automatically; if it keeps failing, publish it with your own headline quote instead."}),g&&e.jsx("button",{type:"button",onClick:()=>{g()},disabled:a,className:"mt-3 text-xs px-3 py-1.5 rounded-md bg-surface-inverse text-ink-on-inverse font-medium hover:bg-surface-inverse-hover disabled:opacity-50",children:"Write my own quote"})]}):t.pipeline_status==="ready_for_review"?e.jsxs("div",{className:"mb-6 rounded-md border border-warning-border bg-warning-soft p-4 flex items-center gap-3 flex-wrap",children:[e.jsx("p",{className:"text-sm font-medium text-warning-fg flex-1 min-w-0",children:t.recording_kind==="text"?"Ready to post.":"Your draft is ready."}),s&&e.jsx("button",{type:"button",onClick:s,disabled:a,className:"text-xs px-3 py-1.5 rounded-md bg-surface-inverse text-ink-on-inverse font-medium hover:bg-surface-inverse-hover disabled:opacity-50",children:"Location →"})]}):null}function le(t){const i=new Date(t);
1return Number.isNaN(i.getTime())?"later":i.toLocaleString(void 0,{weekday:"short",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}const ce=new Set(["recorded","transcribing","translating"]);function ze(){const{id:t}=$(),[i]=q(),l=K(),d=U(),g=l.state?.from??null,r=ee(()=>b.updateCard(t),[t],{enabled:!!t}),[s,a]=o.useState(null),[c,u]=o.useState(!1),[y,m]=o.useState(null),[j,p]=o.useState("words"),[v,w]=o.useState(!1),[f,N]=o.useState(!1);o.useEffect(()=>{t&&b.recordViews("update")},[t]),o.useEffect(()=>{if(!t)return;let n=!1,h=null;async function F(){try{const S=await b.update(t);if(n)return;a(S),S.is_me_author&&ce.has(S.pipeline_status)?h=setTimeout(F,3e3):r.retry()}catch{}}return F(),()=>{n=!0,h&&clearTimeout(h)}},[t]);async function C(){t&&(a(await b.update(t)),r.retry())}async function E(){if(t){u(!0),m(null);try{const{update:n,first_publish:h}=await b.publishReviewedUpdate(t);a(n),r.retry(),h&&w(!0)}catch(n){m(n instanceof Error?n.message:"Publish failed")}finally{u(!1)}}}async function W(n){if(t){u(!0),m(null);try{await b.scheduleUpdatePublish(t,n.toISOString()),await C()}catch(h){m(h instanceof Error?h.message:"Couldn't schedule")}finally{u(!1)}}}async function Y(){if(t)try{await b.unscheduleUpdatePublish(t),await C()}catch{}}async function A(n){if(!t)return;const{update:h}=await b.writeOwnPost(t,n);a(h),r.retry()}async function H(){if(t){u(!0);try{await b.markUpdateSilent(t),await C()}catch(n){m(n instanceof Error?n.message:"Couldn't do that")}finally{u(!1)}}}async function z(n){N(!0);try{await b.deleteUpdate(n.id),d(g?.to??R(n.project_id),{replace:!0})}catch{N(!1)}}if(r.failed)return e.jsx(I,{children:r.status===404?e.jsx("p",{className:"text-sm text-ink-muted",children:"Update not found."}):e.jsx(G,{what:"this post",detail:r.error,onRetry:r.retry})});if(!r.data)return e.jsx(I,{children:e.jsx("p",{className:"text-sm text-ink-muted",children:"Loading…"})});const x=s&&s.is_me_author&&s.pipeline_status!=="published"?s:null,_=!!x&&x.pipeline_status==="ready_for_review"&&!x.scheduled_publish_at,L=_&&x.recording_kind!=="text",D=x?e.jsx(M,{onConfirm:()=>z(x),busy:f,triggerLabel:"Delete",label:"Delete update",message:"Delete this update? Its comments and reactions go with it. This can't be undone."}):void 0;return e.jsxs(e.Fragment,{children:[e.jsx(re,{item:r.data.item,openComments:!x&&(i.get("c")==="1"||!!i.get("reply")),highlightCommentId:i.get("reply")}),v&&s&&s.pipeline_status==="published"&&e.jsx(te,{visibility:s.visibility,profileSlug:s.author_profile_slug,onDismiss:()=>w(!1)}),x&&!_&&e.jsx(T,{open:!0,onClose:()=>d(-1),title:"Your update",closeLabel:"Close",headerRight:D,fit:!0,children:e.jsx("div",{className:"pt-4 [&>div]:mb-0",children:e.jsx(de,{update:x,onPublishNow:E,onUnschedule:Y,onMarkSilent:H,onWriteOwn:A,busy:c})})}),_&&(L&&j==="words"?e.jsx(X,{update:x,hideCancel:!0,onCancel:()=>d(-1),onSaved:n=>a(n),onContinue:()=>p("location"),publishing:c,publishError:y,onSeek:()=>{},headerRight:D}):e.jsx(ne,{open:!0,onClose:()=>L?p("words"):d(-1),update:x,onSaved:n=>a(n),onPublish:E,onSchedule:W,publishing:c,error:y}))]})}export{ze as UpdateDetailPage};

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.