PageSourceSearch

https://pmhfullrebuild.base44.app/assets/AdminResourceContent-B8uPyJ9E.js

js pmhfullrebuild.base44.app collected 2026-10-03 03:09:44 UTC 6,265 bytes, 1 lines download raw bytes

1import{r as c,j as e,d as p,w as C}from"./index-DUpcj-SV.js";import{B as b}from"./button-B9wu21LD.js";import{I as f}from"./input-Bs6J1OPY.js";import{L as j}from"./label-DhSSxpWE.js";import"./index-BACy2y7J.js";const y={conference_name:"",date_label:"",sort_date:"",location:"",presentation_title:"",photo_url:"",second_photo_url:""};function g({label:l,value:i,onChange:d}){const[a,r]=c.useState(!1),h=async s=>{var n;const m=(n=s.target.files)==null?void 0:n[0];if(!m)return;r(!0);const{file_url:t}=await p.integrations.Core.UploadPublicFile({file:m});d(t),r(!1)};return e.jsxs("div",{children:[e.jsx(j,{children:l}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-3",children:[i&&e.jsx("img",{src:i,alt:"",className:"w-14 h-14 rounded object-cover"}),e.jsx(f,{type:"file",accept:"image/*",onChange:h,disabled:a})]}),a&&e.jsx("p",{className:"pmh-xs text-pmh-muted mt-1",children:"Uploading..."})]})}function w({initial:l,onSaved:i,onCancel:d}){const[a,r]=c.useState({...y,...l}),[h,s]=c.useState(!1),m=o=>u=>r(v=>({...v,[o]:u.target.value})),t=o=>u=>r(v=>({...v,[o]:u})),n=async o=>{o.preventDefault(),s(!0);const{id:u,created_date:v,updated_date:k,created_by_id:P,...x}=a,_={...x,photo_alt:x.photo_url?`${x.conference_name}, ${x.location||""}`.trim():"",second_photo_alt:x.second_photo_url?`${x.conference_name}, ${x.location||""}`.trim():""};l!=null&&l.id?await p.entities.ConferencePresentation.update(l.id,{..._,photo_alt:l.photo_alt||_.photo_alt,second_photo_alt:l.second_photo_alt||_.second_photo_alt}):await p.entities.ConferencePresentation.create(_),s(!1),i()};return e.jsxs("form",{onSubmit:n,className:"bg-white border border-pmh-border rounded-card p-6 grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"md:col-span-2",children:[e.jsx(j,{children:"Conference name"}),e.jsx(f,{required:!0,value:a.conference_name,onChange:m("conference_name"),className:"mt-1.5"})]}),e.jsxs("div",{children:[e.jsx(j,{children:"Date as shown (for example 12-15 July 2026)"}),e.jsx(f,{value:a.date_label,onChange:m("date_label"),className:"mt-1.5"})]}),e.jsxs("div",{children:[e.jsx(j,{children:"Start date (used to order newest first)"}),e.jsx(f,{required:!0,type:"date",value:a.sort_date,onChange:m("sort_date"),className:"mt-1.5"})]}),e.jsxs("div",{children:[e.jsx(j,{children:"Location"}),e.jsx(f,{value:a.location,onChange:m("location"),className:"mt-1.5"})]}),e.jsxs("div",{children:[e.jsx(j,{children:"Presentation title"}),e.jsx(f,{value:a.presentation_title,onChange:m("presentation_title"),className:"mt-1.5"})]}),e.jsx(g,{label:"Photo",value:a.photo_url,onChange:t("photo_url")}),e.jsx(g,{label:"Second photo (optional)",value:a.second_photo_url,onChange:t("second_photo_url")}),e.jsxs("div",{className:"md:col-span-2 flex gap-3",children:[e.jsx(b,{type:"submit",disabled:h,className:"pmh-btn pmh-btn-primary px-7 py-5",children:h?"Saving...":"Save conference"}),e.jsx(b,{type:"button",variant:"outline",onClick:d,className:"px-7 py-5",children:"Cancel"})]})]})}const N=[{channel:"podcast",label:"Spotify podcast link"},{channel:"youtube",label:"YouTube channel link"}];function S(){const[l,i]=c.useState({}),[d,a]=c.useState(!1),[r,h]=c.useState(!1);c.useEffect(()=>{p.entities.MediaChannel.list("-created_date",10).then(t=>{i(Object.fromEntries((t.items||t).map(n=>[n.channel,n])))})},[]);const s=(t,n)=>{h(!1),i(o=>({...o,[t]:{...o[t],channel:t,url:n}}))},m=async()=>{a(!0);const t={...l};for(const{channel:n}of N){const o=t[n];if(!o)continue;const u=(o.url||"").trim();o.id?await p.entities.MediaChannel.update(o.id,{url:u}):t[n]=await p.entities.MediaChannel.create({channel:n,url:u})}i(t),a(!1),h(!0)};return e.jsxs("div",{className:"bg-white border border-pmh-border rounded-card p-6 space-y-4",children:[N.map(t=>{var n;return e.jsxs("div",{children:[e.jsx(j,{children:t.label}),e.jsx(f,{type:"url",placeholder:"https://",value:((n=l[t.channel])==null?void 0:n.url)||"",onChange:o=>s(t.channel,o.target.value),className:"mt-1.5"})]},t.channel)}),e.jsx("p",{className:"pmh-xs text-pmh-muted",children:'Leave a link empty to show "Coming soon". The button appears once a link is saved.'}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(b,{onClick:m,disabled:d,className:"pmh-btn pmh-btn-primary px-7 py-5",children:d?"Saving...":"Save links"}),r&&e.jsx("span",{className:"pmh-small text-pmh-muted",children:"Saved."})]})]})}function T(){const[l,i]=c.useState([]),[d,a]=c.useState(null),r=c.useCallback(()=>{p.entities.ConferencePresentation.list("-sort_date",100).then(s=>i(s.items||s))},[]);c.useEffect(r,[r]);const h=async s=>{window.confirm(`Delete ${s.conference_name}?`)&&(await p.entities.ConferencePresentation.delete(s.id),r())};return e.jsxs("div",{className:"min-h-screen bg-pmh-bg-warm flex flex-col",children:[e.jsx(C,{}),e.jsxs("main",{className:"flex-1 pmh-container py-12 md:py-16 max-w-[900px]",children:[e.jsx("p",{className:"pmh-eyebrow mb-3",children:"Resources Page"}),e.jsx("h1",{className:"pmh-h1",children:"Conferences and Media"}),e.jsx("div",{className:"w-10 h-[2px] bg-pmh-orange mt-6"}),e.jsxs("div",{className:"mt-12 flex items-center justify-between",children:[e.jsx("h2",{className:"pmh-h3",children:"Conference presentations"}),!d&&e.jsx(b,{onClick:()=>a({}),className:"pmh-btn pmh-btn-primary px-6 py-5",children:"Add conference"})]}),d&&e.jsx("div",{className:"mt-6",children:e.jsx(w,{initial:d,onCancel:()=>a(null),onSaved:()=>{a(null),r()}})}),e.jsx("div",{className:"mt-6 space-y-3",children:l.map(s=>e.jsxs("div",{className:"bg-white border border-pmh-border rounded-card p-4 flex items-center gap-4",children:[s.photo_url&&e.jsx("img",{src:s.photo_url,alt:"",className:"w-14 h-14 roun
1ded object-cover"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"pmh-small font-semibold text-pmh-navy",children:s.conference_name}),e.jsx("p",{className:"pmh-xs text-pmh-muted",children:[s.date_label,s.location].filter(Boolean).join(" - ")})]}),e.jsx(b,{variant:"outline",size:"sm",onClick:()=>{a(s),window.scrollTo({top:0,behavior:"smooth"})},children:"Edit"}),e.jsx(b,{variant:"outline",size:"sm",onClick:()=>h(s),children:"Delete"})]},s.id))}),e.jsx("h2",{className:"pmh-h3 mt-14 mb-6",children:"Podcast and YouTube links"}),e.jsx(S,{})]})]})}export{T 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.