PageSourceSearch

https://domma.ai/assets/ProfessorCurso-B1avd5dL.js

js domma.ai collected 2026-09-24 14:30:34 UTC 7,259 bytes, 1 lines download raw bytes

1import{Y as g,bQ as z,r as i,j as e,aq as v,bP as w,du as P,cg as E,a9 as S,b3 as R,cb as F,ah as U,cJ as D,au as f}from"./vendor-DPFe_te2.js";import{ah as A,c3 as k}from"./index-DFbr7-Jt.js";import{a as L}from"./useCourseAdmin-BO6xEhPs.js";import{C as M,a as B,u as q}from"./CourseStudentsTable-BaCd0iCm.js";import{R as O}from"./RichTextEditor-C6vTcfHI.js";import"./vendor-md-DlwECirW.js";import"./SegmentedControl-BeH67PkU.js";import"./EmptyState-DPrvaeoP.js";import"./Skeleton-CUQ6M2Hg.js";import"./StaggeredRows-xujaSBTe.js";import"./vendor-editor-Dh9fMAp9.js";function oe(){const{t:a}=g(),{id:s}=z(),{user:r}=A(),{course:o,isLoading:b}=k(s),[u,d]=i.useState("details");if(b)return e.jsx("div",{style:{display:"grid",placeItems:"center",padding:64},children:e.jsx(v,{size:22,className:"spin","aria-hidden":"true"})});if(!o)return e.jsx(N,{title:a("professor.course.notFoundTitle",{defaultValue:"Curso não encontrado"}),body:a("professor.course.notFoundBody",{defaultValue:"Este curso não existe ou foi removido."})});if(!o.instructor_id||o.instructor_id!==(r==null?void 0:r.id))return e.jsx(N,{title:a("professor.course.blockedTitle",{defaultValue:"Sem permissão"}),body:a("professor.course.blockedBody",{defaultValue:"Você não é o instrutor deste curso."})});const m=[{key:"details",label:a("professor.course.tabs.details",{defaultValue:"Detalhes"}),Icon:w},{key:"curriculum",label:a("professor.course.tabs.curriculum",{defaultValue:"Conteúdo"}),Icon:P},{key:"students",label:a("professor.course.tabs.students",{defaultValue:"Alunos"}),Icon:E}];return e.jsxs("div",{style:{display:"grid",gap:20},children:[e.jsxs("header",{style:{display:"grid",gap:8},children:[e.jsxs(S,{to:"/professor",style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:13,color:"var(--text-muted)",textDecoration:"none",width:"fit-content"},children:[e.jsx(R,{size:15,"aria-hidden":"true"}),a("professor.course.back",{defaultValue:"Meus cursos"})]}),e.jsxs("h1",{style:{margin:0,fontSize:22,letterSpacing:"-.02em",display:"inline-flex",alignItems:"center",gap:8},children:[e.jsx(F,{size:20,"aria-hidden":"true"}),o.title]})]}),e.jsx("nav",{className:"content-tabs",role:"tablist","aria-label":a("professor.course.tabsAria",{defaultValue:"Seções do curso"}),children:m.map(({key:l,label:h,Icon:n})=>e.jsxs("button",{type:"button",role:"tab","aria-selected":u===l,className:`content-tab${u===l?" is-active":""}`,onClick:()=>d(l),children:[e.jsx(n,{size:14,"aria-hidden":"true"}),e.jsx("span",{children:h})]},l))}),u==="details"&&e.jsx(W,{courseId:o.id}),u==="curriculum"&&e.jsx(M,{courseId:o.id}),u==="students"&&e.jsx(B,{courseId:o.id})]})}function N({title:a,body:s}){const{t:r}=g();return e.jsx("div",{style:{display:"grid",placeItems:"center",padding:64,textAlign:"center"},children:e.jsxs("div",{style:{display:"grid",gap:8,maxWidth:420},children:[e.jsx("h1",{style:{margin:0,fontSize:20},children:a}),e.jsx("p",{style:{margin:0,color:"var(--text-muted)"},children:s}),e.jsx(S,{to:"/professor",style:{marginTop:8,color:"var(--brand-400)"},children:r("professor.course.back",{defaultValue:"Meus cursos"})})]})})}function W({courseId:a}){const{t:s}=g(),{course:r}=k(a),{updateCourse:o}=L(),{uploadCover:b}=q(),u=i.useRef(null),[d,m]=i.useState(""),[l,h]=i.useState(""),[n,j]=i.useState(""),[p,y]=i.useState(null),[x,C]=i.useState(!1);i.useEffect(()=>{r&&(m(r.title??""),h(r.subtitle??""),j(r.description_md??""),y(r.cover_url??null))},[r]);const I=i.useMemo(()=>r?d!==(r.title??"")||l!==(r.subtitle??"")||n!==(r.description_md??"")||p!==(r.cover_url??null):!1,[r,d,l,n,p]);async function _(t){C(!0);try{const{publicUrl:c}=await b(t);y(c),f.success(s("professor.course.coverUploaded",{defaultValue:"Capa envi
1ada."}))}catch(c){f.error((c==null?void 0:c.message)||s("professor.course.coverError",{defaultValue:"Falha ao enviar a capa."}))}finally{C(!1)}}async function T(){if(!d.trim()){f.error(s("professor.course.titleRequired",{defaultValue:"O título é obrigatório."}));return}try{await o.mutateAsync({id:a,patch:{title:d.trim(),subtitle:l.trim()||null,description_md:n||null,cover_url:p}}),f.success(s("professor.course.saved",{defaultValue:"Detalhes salvos."}))}catch(t){f.error((t==null?void 0:t.message)||s("professor.course.saveError",{defaultValue:"Falha ao salvar."}))}}return e.jsxs("div",{style:G,children:[e.jsxs("div",{className:"course-field",children:[e.jsx("label",{className:"course-field__label",htmlFor:"course-title",children:s("professor.course.fields.title",{defaultValue:"Título"})}),e.jsx("input",{id:"course-title",className:"course-input",value:d,onChange:t=>m(t.target.value),placeholder:s("professor.course.fields.titlePh",{defaultValue:"Nome do curso"})})]}),e.jsxs("div",{className:"course-field",children:[e.jsx("label",{className:"course-field__label",htmlFor:"course-subtitle",children:s("professor.course.fields.subtitle",{defaultValue:"Subtítulo"})}),e.jsx("input",{id:"course-subtitle",className:"course-input",value:l,onChange:t=>h(t.target.value),placeholder:s("professor.course.fields.subtitlePh",{defaultValue:"Frase curta de apoio"})})]}),e.jsxs("div",{className:"course-field",children:[e.jsx("span",{className:"course-field__label",children:s("professor.course.fields.cover",{defaultValue:"Capa"})}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,flexWrap:"wrap"},children:[e.jsx("div",{style:H,children:p?e.jsx("img",{src:p,alt:"",style:J}):e.jsx("div",{style:{display:"grid",placeItems:"center",height:"100%",color:"var(--text-muted)"},children:e.jsx(U,{size:22,"aria-hidden":"true"})})}),e.jsxs("button",{type:"button",className:"course-btn course-btn--ghost",disabled:x,onClick:()=>{var t;return(t=u.current)==null?void 0:t.click()},children:[x?e.jsx(v,{size:14,className:"spin","aria-hidden":"true"}):e.jsx(D,{size:14,"aria-hidden":"true"}),p?s("professor.course.fields.changeCover",{defaultValue:"Trocar capa"}):s("professor.course.fields.uploadCover",{defaultValue:"Enviar capa"})]}),e.jsx("input",{ref:u,type:"file",accept:"image/png,image/jpeg,image/webp,image/avif",style:{display:"none"},onChange:t=>{var V;const c=(V=t.target.files)==null?void 0:V[0];c&&_(c),t.target.value=""}})]})]}),e.jsxs("div",{className:"course-field",children:[e.jsx("span",{className:"course-field__label",children:s("professor.course.fields.description",{defaultValue:"Descrição"})}),e.jsx(O,{value:n,onChange:j,placeholder:s("professor.course.fields.descriptionPh",{defaultValue:"O que o aluno vai aprender neste curso…"}),minHeight:180,ariaLabel:s("professor.course.fields.description",{defaultValue:"Descrição"})})]}),e.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:e.jsxs("button",{type:"button",className:"course-btn course-btn--primary",disabled:!I||o.isPending||x,onClick:T,children:[o.isPending&&e.jsx(v,{size:14,className:"spin","aria-hidden":"true"}),s("professor.course.save",{defaultValue:"Salvar detalhes"})]})})]})}const G={display:"grid",gap:16,padding:18,borderRadius:12,background:"var(--bg-card)",border:"1px solid var(--border)"},H={width:160,aspectRatio:"16 / 9",borderRadius:10,overflow:"hidden",border:"1px solid var(--border)",background:"var(--surface-2)",flexShrink:0},J={width:"100%",height:"100%",objectFit:"cover",display:"block"};export{oe 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.