diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 141bf9f..a3f9b3e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -30,4 +30,5 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./frontend/dist - publish_branch: gh-pages \ No newline at end of file + publish_branch: gh-pages + keep_files: true \ No newline at end of file diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml new file mode 100644 index 0000000..68f7a95 --- /dev/null +++ b/.github/workflows/pr-preview.yml @@ -0,0 +1,102 @@ +name: PR Preview + +on: + pull_request: + types: [opened, synchronize, reopened, closed] + +permissions: + contents: write + pull-requests: write + +jobs: + deploy-preview: + if: github.event.action != 'closed' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install dependencies + working-directory: ./frontend + run: npm install + + - name: Build with PR base path + working-directory: ./frontend + run: npm run build -- --base=/ReproInventory/pr-previews/pr-${{ github.event.pull_request.number }}/ + + - name: Deploy preview + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./frontend/dist + publish_branch: gh-pages + destination_dir: pr-previews/pr-${{ github.event.pull_request.number }} + keep_files: true + + - name: Post preview URL comment + uses: actions/github-script@v7 + with: + script: | + const prNumber = context.payload.pull_request.number; + const previewUrl = `https://${{ github.repository_owner }}.github.io/ReproInventory/pr-previews/pr-${prNumber}/`; + const body = [ + '## 🔍 PR Preview', + '', + `**Preview URL:** ${previewUrl}`, + '', + `_Last updated: ${new Date().toUTCString()}_`, + ].join('\n'); + + const comments = await github.rest.issues.listComments({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + }); + + const existing = comments.data.find( + c => c.user.type === 'Bot' && c.body.includes('## 🔍 PR Preview') + ); + + if (existing) { + await github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: existing.id, + body, + }); + } else { + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + body, + }); + } + + cleanup-preview: + if: github.event.action == 'closed' + runs-on: ubuntu-latest + steps: + - name: Checkout gh-pages branch + uses: actions/checkout@v4 + with: + ref: gh-pages + + - name: Remove preview directory + run: | + PR_DIR="pr-previews/pr-${{ github.event.pull_request.number }}" + if [ -d "$PR_DIR" ]; then + rm -rf "$PR_DIR" + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add -A + git commit -m "chore: remove PR preview for #${{ github.event.pull_request.number }}" + git push + else + echo "No preview directory found, nothing to clean up." + fi diff --git a/frontend/dist/assets/index-BfAUm7qF.js b/frontend/dist/assets/index-zwxElJ_Y.js similarity index 95% rename from frontend/dist/assets/index-BfAUm7qF.js rename to frontend/dist/assets/index-zwxElJ_Y.js index 3a21422..5531cce 100644 --- a/frontend/dist/assets/index-BfAUm7qF.js +++ b/frontend/dist/assets/index-zwxElJ_Y.js @@ -187,13 +187,13 @@ Please update entry **ID: ${a.id}** in \`model/reproinventory_data.yaml\` with t \`\`\`yaml ${r} -\`\`\``,f=`${IE}/issues/new?labels=edit-material&title=${encodeURIComponent(o)}&body=${encodeURIComponent(c)}`;window.open(f,"_blank")}const eA=["Beginner","Intermediate","Advanced","NA"],tA=["Mac","Windows","Linux","Docker","Jupyter","NA"],nA=["<1 hr","1-4 hrs","1 day","1-3 days","1 week","1+ weeks","NA"],lA=["Hands-on tutorial / notebooks","lecture","video","notes","blog post","reference","slides","website","outline","meta-resource","NA"],aA=["self-paced","instructor","Hybrid","Discussion needed"],iA=["English","French","Spanish","Chinese","German","English, French","English, German","Other","NA"],rA=["Python","R","shell scripting","Matlab","Git","NA"],cA=["AFNI","SPM","FSL","Freesurfer","Python","Multiple","NA"],oA=["DWI","Structural","Functional","Task-based","Resting-State","EEG","Behavioral","MEG","MRI","NA"],sA=["information-oriented (reference)","understanding-oriented (explanation)","learning-oriented (tutorials)","problem-oriented (how to guides)","NA"],uA=["tag_team","level","platform","keywords","instruction_medium","delivery","language","programming_language","neuroimaging_software","imaging_modality","quadrants","source","prerequisite"];function av(a){const r={...a};for(const o of uA){const c=r[o];c!=null&&!Array.isArray(c)&&(r[o]=[c])}return r}const fA=({material:a,onClose:r})=>{const[o,c]=S.useState(()=>av(a));S.useEffect(()=>{c(av(a))},[a]);const f=(g,b)=>{c(w=>({...w,[g]:b}))},d=(g,b,w)=>{const _=o[g]||[],M=w?[..._,b]:_.filter(N=>N!==b);f(g,M)},v=(g,b,w)=>{const M=[...o[g]||[]];M[b]=w,f(g,M)},p=g=>{const b=o[g]||[];f(g,[...b,""])},x=(g,b)=>{const _=(o[g]||[]).filter((M,N)=>N!==b);f(g,_)},m=()=>{WE(o),r()};return u.jsxs(Lc,{className:"sm:max-w-[800px] overflow-y-auto max-h-[90vh]",children:[u.jsxs(Bc,{children:[u.jsxs(qc,{children:["Edit ",o.course_name||"Material"]}),u.jsx(Gc,{children:"Update the details of this training material."})]}),u.jsxs("div",{className:"grid gap-4 py-4",children:[u.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[u.jsx(te,{htmlFor:"id",className:"text-right",children:"ID"}),u.jsx(wt,{id:"id",value:o.id,disabled:!0,className:"col-span-3"})]}),u.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[u.jsx(te,{htmlFor:"course_name",className:"text-right",children:"Course Name"}),u.jsx(wt,{id:"course_name",value:o.course_name||"",onChange:g=>f("course_name",g.target.value),className:"col-span-3"})]}),u.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[u.jsx(te,{htmlFor:"url",className:"text-right",children:"URL"}),u.jsx(wt,{id:"url",value:o.url||"",onChange:g=>f("url",g.target.value),className:"col-span-3"})]}),u.jsxs("div",{className:"grid grid-cols-4 items-start gap-4",children:[u.jsx(te,{htmlFor:"tag_team",className:"text-right pt-2",children:"Tag Team"}),u.jsxs("div",{className:"col-span-3 space-y-2",children:[(o.tag_team||[]).map((g,b)=>u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(wt,{value:g,onChange:w=>v("tag_team",b,w.target.value),className:"flex-grow"}),u.jsx(nt,{variant:"outline",size:"icon",onClick:()=>x("tag_team",b),className:"flex-shrink-0",children:u.jsx(Qi,{className:"h-4 w-4"})})]},b)),u.jsxs(nt,{variant:"outline",size:"sm",onClick:()=>p("tag_team"),className:"mt-2",children:[u.jsx(Zi,{className:"h-4 w-4 mr-2"})," Add Tag Team"]})]})]}),u.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[u.jsx(te,{htmlFor:"last_updated",className:"text-right",children:"Last Updated"}),u.jsx(wt,{id:"last_updated",value:o.last_updated||"",onChange:g=>f("last_updated",g.target.value),className:"col-span-3"})]}),u.jsxs("div",{className:"grid grid-cols-4 items-start gap-4",children:[u.jsx(te,{htmlFor:"prerequisite",className:"text-right pt-2",children:"Prerequisite"}),u.jsxs("div",{className:"col-span-3 space-y-2",children:[(o.prerequisite||[]).map((g,b)=>u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(wt,{value:g,onChange:w=>v("prerequisite",b,w.target.value),className:"flex-grow"}),u.jsx(nt,{variant:"outline",size:"icon",onClick:()=>x("prerequisite",b),className:"flex-shrink-0",children:u.jsx(Qi,{className:"h-4 w-4"})})]},b)),u.jsxs(nt,{variant:"outline",size:"sm",onClick:()=>p("prerequisite"),className:"mt-2",children:[u.jsx(Zi,{className:"h-4 w-4 mr-2"})," Add Prerequisite"]})]})]}),u.jsxs("div",{className:"grid grid-cols-4 items-start gap-4",children:[u.jsx(te,{htmlFor:"source",className:"text-right pt-2",children:"Source"}),u.jsxs("div",{className:"col-span-3 space-y-2",children:[(o.source||[]).map((g,b)=>u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(wt,{value:g,onChange:w=>v("source",b,w.target.value),className:"flex-grow"}),u.jsx(nt,{variant:"outline",size:"icon",onClick:()=>x("source",b),className:"flex-shrink-0",children:u.jsx(Qi,{className:"h-4 w-4"})})]},b)),u.jsxs(nt,{variant:"outline",size:"sm",onClick:()=>p("source"),className:"mt-2",children:[u.jsx(Zi,{className:"h-4 w-4 mr-2"})," Add Source"]})]})]}),u.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[u.jsx(te,{htmlFor:"description",className:"text-right",children:"Description"}),u.jsx(wt,{id:"description",value:o.description||"",onChange:g=>f("description",g.target.value),className:"col-span-3"})]}),u.jsxs("div",{className:"grid grid-cols-4 items-start gap-4",children:[u.jsx(te,{htmlFor:"keywords",className:"text-right pt-2",children:"Keywords"}),u.jsxs("div",{className:"col-span-3 space-y-2",children:[(o.keywords||[]).map((g,b)=>u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(wt,{value:g,onChange:w=>v("keywords",b,w.target.value),className:"flex-grow"}),u.jsx(nt,{variant:"outline",size:"icon",onClick:()=>x("keywords",b),className:"flex-shrink-0",children:u.jsx(Qi,{className:"h-4 w-4"})})]},b)),u.jsxs(nt,{variant:"outline",size:"sm",onClick:()=>p("keywords"),className:"mt-2",children:[u.jsx(Zi,{className:"h-4 w-4 mr-2"})," Add Keyword"]})]})]}),u.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[u.jsx(te,{htmlFor:"notes",className:"text-right",children:"Notes"}),u.jsx(wt,{id:"notes",value:o.notes||"",onChange:g=>f("notes",g.target.value),className:"col-span-3"})]}),u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[u.jsxs("div",{children:[u.jsx(te,{className:"text-left",children:"Level"}),eA.map(g=>{var b;return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`level-${g}`,checked:((b=o.level)==null?void 0:b.includes(g))||!1,onCheckedChange:w=>d("level",g,w)}),u.jsx(te,{htmlFor:`level-${g}`,children:g})]},g)})]}),u.jsxs("div",{children:[u.jsx(te,{className:"text-left",children:"Platform"}),tA.map(g=>{var b;return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`platform-${g}`,checked:((b=o.platform)==null?void 0:b.includes(g))||!1,onCheckedChange:w=>d("platform",g,w)}),u.jsx(te,{htmlFor:`platform-${g}`,children:g})]},g)})]}),u.jsxs("div",{children:[u.jsx(te,{className:"text-left",children:"Instruction Medium"}),lA.map(g=>{var b;return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`instruction_medium-${g}`,checked:((b=o.instruction_medium)==null?void 0:b.includes(g))||!1,onCheckedChange:w=>d("instruction_medium",g,w)}),u.jsx(te,{htmlFor:`instruction_medium-${g}`,children:g})]},g)})]}),u.jsxs("div",{children:[u.jsx(te,{className:"text-left",children:"Delivery"}),aA.map(g=>{var b;return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`delivery-${g}`,checked:((b=o.delivery)==null?void 0:b.includes(g))||!1,onCheckedChange:w=>d("delivery",g,w)}),u.jsx(te,{htmlFor:`delivery-${g}`,children:g})]},g)})]}),u.jsxs("div",{children:[u.jsx(te,{className:"text-left",children:"Language"}),iA.map(g=>{var b;return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`language-${g}`,checked:((b=o.language)==null?void 0:b.includes(g))||!1,onCheckedChange:w=>d("language",g,w)}),u.jsx(te,{htmlFor:`language-${g}`,children:g})]},g)})]}),u.jsxs("div",{children:[u.jsx(te,{className:"text-left",children:"Programming Language"}),rA.map(g=>{var b;return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`programming_language-${g}`,checked:((b=o.programming_language)==null?void 0:b.includes(g))||!1,onCheckedChange:w=>d("programming_language",g,w)}),u.jsx(te,{htmlFor:`programming_language-${g}`,children:g})]},g)})]}),u.jsxs("div",{children:[u.jsx(te,{className:"text-left",children:"Neuroimaging Software"}),cA.map(g=>{var b;return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`neuroimaging_software-${g}`,checked:((b=o.neuroimaging_software)==null?void 0:b.includes(g))||!1,onCheckedChange:w=>d("neuroimaging_software",g,w)}),u.jsx(te,{htmlFor:`neuroimaging_software-${g}`,children:g})]},g)})]}),u.jsxs("div",{children:[u.jsx(te,{className:"text-left",children:"Imaging Modality"}),oA.map(g=>{var b;return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`imaging_modality-${g}`,checked:((b=o.imaging_modality)==null?void 0:b.includes(g))||!1,onCheckedChange:w=>d("imaging_modality",g,w)}),u.jsx(te,{htmlFor:`imaging_modality-${g}`,children:g})]},g)})]}),u.jsxs("div",{children:[u.jsx(te,{className:"text-left",children:"Quadrants"}),sA.map(g=>{var b;return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`quadrants-${g}`,checked:((b=o.quadrants)==null?void 0:b.includes(g))||!1,onCheckedChange:w=>d("quadrants",g,w)}),u.jsx(te,{htmlFor:`quadrants-${g}`,children:g})]},g)})]})]}),u.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[u.jsx(te,{htmlFor:"course_length",className:"text-right",children:"Course Length"}),u.jsxs(Fy,{value:o.course_length||"",onValueChange:g=>f("course_length",g),children:[u.jsx(wf,{className:"col-span-3",children:u.jsx(Py,{placeholder:"Select course length"})}),u.jsx(Nf,{children:nA.map(g=>u.jsx(Ef,{value:g,children:g},g))})]})]}),u.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[u.jsx(te,{htmlFor:"open_dataset",className:"text-right",children:"Open Dataset"}),u.jsxs("div",{className:"col-span-3 flex items-center gap-2",children:[u.jsx(ke,{id:"open_dataset",checked:o.open_dataset===!0,onCheckedChange:g=>f("open_dataset",g===!0?!0:null)}),u.jsx(te,{htmlFor:"open_dataset",className:"text-sm",children:"Uses an open dataset"})]})]})]}),u.jsxs("div",{className:"flex justify-end gap-2",children:[u.jsx(nt,{variant:"outline",onClick:r,children:"Cancel"}),u.jsx(nt,{onClick:m,children:"Submit via GitHub Issue"})]})]})},dA=Ku(),mA=["Beginner","Intermediate","Advanced","NA"],hA=["Mac","Windows","Linux","Docker","Jupyter","NA"],gA=["<1 hr","1-4 hrs","1 day","1-3 days","1 week","1+ weeks","NA"],vA=["Hands-on tutorial / notebooks","lecture","video","notes","blog post","reference","slides","website","outline","meta-resource","NA"],pA=["self-paced","instructor","Hybrid","Discussion needed"],yA=["English","French","Spanish","Chinese","German","English, French","English, German","Other","NA"],xA=["Python","R","shell scripting","Matlab","Git","NA"],bA=["AFNI","SPM","FSL","Freesurfer","Python","Multiple","NA"],SA=["DWI","Structural","Functional","Task-based","Resting-State","EEG","Behavioral","MEG","MRI","NA"],wA=["information-oriented (reference)","understanding-oriented (explanation)","learning-oriented (tutorials)","problem-oriented (how to guides)","NA"];function NA(a){const r=[],o=(f,d)=>{d!=null&&d!==""&&r.push(`${f}: ${d}`)},c=(f,d)=>{d&&d.length>0&&(r.push(`${f}:`),d.forEach(v=>r.push(` - ${v}`)))};return r.push("id: TBD"),o("course_name",a.course_name),o("url",a.url),c("level",a.level),c("platform",a.platform),c("keywords",a.keywords),o("course_length",a.course_length),c("instruction_medium",a.instruction_medium),c("delivery",a.delivery),c("language",a.language),c("programming_language",a.programming_language),c("neuroimaging_software",a.neuroimaging_software),c("imaging_modality",a.imaging_modality),o("open_dataset",a.open_dataset),o("description",a.description),o("notes",a.notes),c("quadrants",a.quadrants),r.join(` +\`\`\``,f=`${IE}/issues/new?labels=edit-material&title=${encodeURIComponent(o)}&body=${encodeURIComponent(c)}`;window.open(f,"_blank")}const eA=["Beginner","Intermediate","Advanced","NA"],tA=["Mac","Windows","Linux","Docker","Jupyter","NA"],nA=["<1 hr","1-4 hrs","1 day","1-3 days","1 week","1+ weeks","NA"],lA=["Hands-on tutorial / notebooks","lecture","video","notes","blog post","reference","slides","website","outline","meta-resource","NA"],aA=["self-paced","instructor","Hybrid","Discussion needed"],iA=["English","French","Spanish","Chinese","German","English, French","English, German","Other","NA"],rA=["Python","R","shell scripting","Matlab","Git","NA"],cA=["AFNI","SPM","FSL","Freesurfer","Python","Multiple","NA"],oA=["DWI","Structural","Functional","Task-based","Resting-State","EEG","Behavioral","MEG","MRI","NA"],sA=["information-oriented (reference)","understanding-oriented (explanation)","learning-oriented (tutorials)","problem-oriented (how to guides)","NA"],uA=["tag_team","level","platform","keywords","instruction_medium","delivery","language","programming_language","neuroimaging_software","imaging_modality","quadrants","source","prerequisite"];function av(a){const r={...a};for(const o of uA){const c=r[o];c!=null&&!Array.isArray(c)&&(r[o]=[c])}return r}const fA=({material:a,onClose:r})=>{const[o,c]=S.useState(()=>av(a));S.useEffect(()=>{c(av(a))},[a]);const f=(g,b)=>{c(w=>({...w,[g]:b}))},d=(g,b,w)=>{const _=o[g]||[],M=w?[..._,b]:_.filter(N=>N!==b);f(g,M)},v=(g,b,w)=>{const M=[...o[g]||[]];M[b]=w,f(g,M)},p=g=>{const b=o[g]||[];f(g,[...b,""])},x=(g,b)=>{const _=(o[g]||[]).filter((M,N)=>N!==b);f(g,_)},m=()=>{WE(o),r()};return u.jsxs(Lc,{className:"sm:max-w-[800px] overflow-y-auto max-h-[90vh]",children:[u.jsxs(Bc,{children:[u.jsxs(qc,{children:["Edit ",o.course_name||"Material"]}),u.jsx(Gc,{children:"Update the details of this training material."})]}),u.jsxs("div",{className:"grid gap-4 py-4",children:[u.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[u.jsx(te,{htmlFor:"id",className:"text-right",children:"ID"}),u.jsx(wt,{id:"id",value:o.id,disabled:!0,className:"col-span-3"})]}),u.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[u.jsx(te,{htmlFor:"course_name",className:"text-right",children:"Course Name"}),u.jsx(wt,{id:"course_name",value:o.course_name||"",onChange:g=>f("course_name",g.target.value),className:"col-span-3"})]}),u.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[u.jsx(te,{htmlFor:"url",className:"text-right",children:"URL"}),u.jsx(wt,{id:"url",value:o.url||"",onChange:g=>f("url",g.target.value),className:"col-span-3"})]}),u.jsxs("div",{className:"grid grid-cols-4 items-start gap-4",children:[u.jsx(te,{htmlFor:"tag_team",className:"text-right pt-2",children:"Tag Team"}),u.jsxs("div",{className:"col-span-3 space-y-2",children:[(o.tag_team||[]).map((g,b)=>u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(wt,{value:g,onChange:w=>v("tag_team",b,w.target.value),className:"flex-grow"}),u.jsx(nt,{variant:"outline",size:"icon",onClick:()=>x("tag_team",b),className:"flex-shrink-0",children:u.jsx(Qi,{className:"h-4 w-4"})})]},b)),u.jsxs(nt,{variant:"outline",size:"sm",onClick:()=>p("tag_team"),className:"mt-2",children:[u.jsx(Zi,{className:"h-4 w-4 mr-2"})," Add Tag Team"]})]})]}),u.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[u.jsx(te,{htmlFor:"last_updated",className:"text-right",children:"Last Updated"}),u.jsx(wt,{id:"last_updated",value:o.last_updated||"",onChange:g=>f("last_updated",g.target.value),className:"col-span-3"})]}),u.jsxs("div",{className:"grid grid-cols-4 items-start gap-4",children:[u.jsx(te,{htmlFor:"prerequisite",className:"text-right pt-2",children:"Prerequisite"}),u.jsxs("div",{className:"col-span-3 space-y-2",children:[(o.prerequisite||[]).map((g,b)=>u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(wt,{value:g,onChange:w=>v("prerequisite",b,w.target.value),className:"flex-grow"}),u.jsx(nt,{variant:"outline",size:"icon",onClick:()=>x("prerequisite",b),className:"flex-shrink-0",children:u.jsx(Qi,{className:"h-4 w-4"})})]},b)),u.jsxs(nt,{variant:"outline",size:"sm",onClick:()=>p("prerequisite"),className:"mt-2",children:[u.jsx(Zi,{className:"h-4 w-4 mr-2"})," Add Prerequisite"]})]})]}),u.jsxs("div",{className:"grid grid-cols-4 items-start gap-4",children:[u.jsx(te,{htmlFor:"source",className:"text-right pt-2",children:"Source"}),u.jsxs("div",{className:"col-span-3 space-y-2",children:[(o.source||[]).map((g,b)=>u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(wt,{value:g,onChange:w=>v("source",b,w.target.value),className:"flex-grow"}),u.jsx(nt,{variant:"outline",size:"icon",onClick:()=>x("source",b),className:"flex-shrink-0",children:u.jsx(Qi,{className:"h-4 w-4"})})]},b)),u.jsxs(nt,{variant:"outline",size:"sm",onClick:()=>p("source"),className:"mt-2",children:[u.jsx(Zi,{className:"h-4 w-4 mr-2"})," Add Source"]})]})]}),u.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[u.jsx(te,{htmlFor:"description",className:"text-right",children:"Description"}),u.jsx(wt,{id:"description",value:o.description||"",onChange:g=>f("description",g.target.value),className:"col-span-3"})]}),u.jsxs("div",{className:"grid grid-cols-4 items-start gap-4",children:[u.jsx(te,{htmlFor:"keywords",className:"text-right pt-2",children:"Keywords"}),u.jsxs("div",{className:"col-span-3 space-y-2",children:[(o.keywords||[]).map((g,b)=>u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(wt,{value:g,onChange:w=>v("keywords",b,w.target.value),className:"flex-grow"}),u.jsx(nt,{variant:"outline",size:"icon",onClick:()=>x("keywords",b),className:"flex-shrink-0",children:u.jsx(Qi,{className:"h-4 w-4"})})]},b)),u.jsxs(nt,{variant:"outline",size:"sm",onClick:()=>p("keywords"),className:"mt-2",children:[u.jsx(Zi,{className:"h-4 w-4 mr-2"})," Add Keyword"]})]})]}),u.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[u.jsx(te,{htmlFor:"notes",className:"text-right",children:"Notes"}),u.jsx(wt,{id:"notes",value:o.notes||"",onChange:g=>f("notes",g.target.value),className:"col-span-3"})]}),u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[u.jsxs("div",{children:[u.jsx(te,{className:"text-left",children:"Level"}),eA.map(g=>{var b;return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`level-${g}`,checked:((b=o.level)==null?void 0:b.includes(g))||!1,onCheckedChange:w=>d("level",g,w)}),u.jsx(te,{htmlFor:`level-${g}`,children:g})]},g)})]}),u.jsxs("div",{children:[u.jsx(te,{className:"text-left",children:"Platform"}),tA.map(g=>{var b;return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`platform-${g}`,checked:((b=o.platform)==null?void 0:b.includes(g))||!1,onCheckedChange:w=>d("platform",g,w)}),u.jsx(te,{htmlFor:`platform-${g}`,children:g})]},g)})]}),u.jsxs("div",{children:[u.jsx(te,{className:"text-left",children:"Instruction Medium"}),lA.map(g=>{var b;return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`instruction_medium-${g}`,checked:((b=o.instruction_medium)==null?void 0:b.includes(g))||!1,onCheckedChange:w=>d("instruction_medium",g,w)}),u.jsx(te,{htmlFor:`instruction_medium-${g}`,children:g})]},g)})]}),u.jsxs("div",{children:[u.jsx(te,{className:"text-left",children:"Delivery"}),aA.map(g=>{var b;return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`delivery-${g}`,checked:((b=o.delivery)==null?void 0:b.includes(g))||!1,onCheckedChange:w=>d("delivery",g,w)}),u.jsx(te,{htmlFor:`delivery-${g}`,children:g})]},g)})]}),u.jsxs("div",{children:[u.jsx(te,{className:"text-left",children:"Language"}),iA.map(g=>{var b;return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`language-${g}`,checked:((b=o.language)==null?void 0:b.includes(g))||!1,onCheckedChange:w=>d("language",g,w)}),u.jsx(te,{htmlFor:`language-${g}`,children:g})]},g)})]}),u.jsxs("div",{children:[u.jsx(te,{className:"text-left",children:"Programming Language"}),rA.map(g=>{var b;return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`programming_language-${g}`,checked:((b=o.programming_language)==null?void 0:b.includes(g))||!1,onCheckedChange:w=>d("programming_language",g,w)}),u.jsx(te,{htmlFor:`programming_language-${g}`,children:g})]},g)})]}),u.jsxs("div",{children:[u.jsx(te,{className:"text-left",children:"Neuroimaging Software"}),cA.map(g=>{var b;return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`neuroimaging_software-${g}`,checked:((b=o.neuroimaging_software)==null?void 0:b.includes(g))||!1,onCheckedChange:w=>d("neuroimaging_software",g,w)}),u.jsx(te,{htmlFor:`neuroimaging_software-${g}`,children:g})]},g)})]}),u.jsxs("div",{children:[u.jsx(te,{className:"text-left",children:"Imaging Modality"}),oA.map(g=>{var b;return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`imaging_modality-${g}`,checked:((b=o.imaging_modality)==null?void 0:b.includes(g))||!1,onCheckedChange:w=>d("imaging_modality",g,w)}),u.jsx(te,{htmlFor:`imaging_modality-${g}`,children:g})]},g)})]}),u.jsxs("div",{children:[u.jsx(te,{className:"text-left",children:"Quadrants"}),sA.map(g=>{var b;return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`quadrants-${g}`,checked:((b=o.quadrants)==null?void 0:b.includes(g))||!1,onCheckedChange:w=>d("quadrants",g,w)}),u.jsx(te,{htmlFor:`quadrants-${g}`,children:g})]},g)})]})]}),u.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[u.jsx(te,{htmlFor:"course_length",className:"text-right",children:"Course Length"}),u.jsxs(Fy,{value:o.course_length||"",onValueChange:g=>f("course_length",g),children:[u.jsx(wf,{className:"col-span-3",children:u.jsx(Py,{placeholder:"Select course length"})}),u.jsx(Nf,{children:nA.map(g=>u.jsx(Ef,{value:g,children:g},g))})]})]}),u.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[u.jsx(te,{htmlFor:"open_dataset",className:"text-right",children:"Open Dataset"}),u.jsxs("div",{className:"col-span-3 flex items-center gap-2",children:[u.jsx(ke,{id:"open_dataset",checked:o.open_dataset===!0,onCheckedChange:g=>f("open_dataset",g===!0)}),u.jsx(te,{htmlFor:"open_dataset",className:"text-sm",children:"Uses an open dataset"})]})]})]}),u.jsxs("div",{className:"flex justify-end gap-2",children:[u.jsx(nt,{variant:"outline",onClick:r,children:"Cancel"}),u.jsx(nt,{onClick:m,children:"Submit via GitHub Issue"})]})]})},dA=Ku(),mA=["Beginner","Intermediate","Advanced","NA"],hA=["Mac","Windows","Linux","Docker","Jupyter","NA"],gA=["<1 hr","1-4 hrs","1 day","1-3 days","1 week","1+ weeks","NA"],vA=["Hands-on tutorial / notebooks","lecture","video","notes","blog post","reference","slides","website","outline","meta-resource","NA"],pA=["self-paced","instructor","Hybrid","Discussion needed"],yA=["English","French","Spanish","Chinese","German","English, French","English, German","Other","NA"],xA=["Python","R","shell scripting","Matlab","Git","NA"],bA=["AFNI","SPM","FSL","Freesurfer","Python","Multiple","NA"],SA=["DWI","Structural","Functional","Task-based","Resting-State","EEG","Behavioral","MEG","MRI","NA"],wA=["information-oriented (reference)","understanding-oriented (explanation)","learning-oriented (tutorials)","problem-oriented (how to guides)","NA"];function NA(a){const r=[],o=(f,d)=>{d!=null&&d!==""&&r.push(`${f}: ${d}`)},c=(f,d)=>{d&&d.length>0&&(r.push(`${f}:`),d.forEach(v=>r.push(` - ${v}`)))};return r.push("id: TBD"),o("course_name",a.course_name),o("url",a.url),c("level",a.level),c("platform",a.platform),c("keywords",a.keywords),o("course_length",a.course_length),c("instruction_medium",a.instruction_medium),c("delivery",a.delivery),c("language",a.language),c("programming_language",a.programming_language),c("neuroimaging_software",a.neuroimaging_software),c("imaging_modality",a.imaging_modality),o("open_dataset",a.open_dataset),o("description",a.description),o("notes",a.notes),c("quadrants",a.quadrants),r.join(` `)}function EA(a){const r=NA(a),o=`Add material: ${a.course_name||"New training material"}`,c=`## New Training Material Submission Please review the following training material for addition to ReproInventory. \`\`\`yaml ${r} -\`\`\``,f=`${dA}/issues/new?labels=new-material&title=${encodeURIComponent(o)}&body=${encodeURIComponent(c)}`;window.open(f,"_blank")}const AA=({onClose:a})=>{const[r,o]=S.useState({id:"",course_name:"",url:"",level:[],platform:[],keywords:[],course_length:void 0,instruction_medium:[],delivery:[],language:[],programming_language:[],neuroimaging_software:[],imaging_modality:[],open_dataset:void 0,description:"",notes:"",quadrants:[]}),c=(m,g)=>{o(b=>({...b,[m]:g}))},f=(m,g,b)=>{const w=r[m]||[];c(m,b?[...w,g]:w.filter(_=>_!==g))},d=(m,g,b)=>{const w=[...r[m]||[]];w[g]=b,c(m,w)},v=m=>{c(m,[...r[m]||[],""])},p=(m,g)=>{c(m,(r[m]||[]).filter((b,w)=>w!==g))},x=()=>{var m;if(!((m=r.course_name)!=null&&m.trim())){alert("Please provide a course name.");return}EA(r),a()};return u.jsxs(Lc,{className:"sm:max-w-[800px] overflow-y-auto max-h-[90vh]",children:[u.jsxs(Bc,{children:[u.jsx(qc,{children:"Add New Training Material"}),u.jsx(Gc,{children:"Fill in the details below. Submitting will open a pre-filled GitHub issue for maintainer review. Only course name is required."})]}),u.jsxs("div",{className:"grid gap-4 py-4",children:[u.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[u.jsx(te,{htmlFor:"course_name",className:"text-right",children:"Course Name *"}),u.jsx(wt,{id:"course_name",value:r.course_name||"",onChange:m=>c("course_name",m.target.value),className:"col-span-3",placeholder:"Enter course name"})]}),u.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[u.jsx(te,{htmlFor:"url",className:"text-right",children:"URL"}),u.jsx(wt,{id:"url",value:r.url||"",onChange:m=>c("url",m.target.value),className:"col-span-3",placeholder:"https://example.com"})]}),u.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[u.jsx(te,{htmlFor:"description",className:"text-right",children:"Description"}),u.jsx(wt,{id:"description",value:r.description||"",onChange:m=>c("description",m.target.value),className:"col-span-3",placeholder:"Brief description of the material"})]}),u.jsxs("div",{className:"grid grid-cols-4 items-start gap-4",children:[u.jsx(te,{className:"text-right pt-2",children:"Keywords"}),u.jsxs("div",{className:"col-span-3 space-y-2",children:[(r.keywords||[]).map((m,g)=>u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(wt,{value:m,onChange:b=>d("keywords",g,b.target.value),className:"flex-grow",placeholder:"Enter keyword"}),u.jsx(nt,{variant:"outline",size:"icon",onClick:()=>p("keywords",g),children:u.jsx(Qi,{className:"h-4 w-4"})})]},g)),u.jsxs(nt,{variant:"outline",size:"sm",onClick:()=>v("keywords"),children:[u.jsx(Zi,{className:"h-4 w-4 mr-2"})," Add Keyword"]})]})]}),u.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[u.jsx(te,{className:"text-right",children:"Course Length"}),u.jsxs(Fy,{value:r.course_length||"",onValueChange:m=>c("course_length",m),children:[u.jsx(wf,{className:"col-span-3",children:u.jsx(Py,{placeholder:"Select course length"})}),u.jsx(Nf,{children:gA.map(m=>u.jsx(Ef,{value:m,children:m},m))})]})]}),u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[u.jsxs("div",{children:[u.jsx(te,{className:"text-sm font-medium",children:"Level"}),u.jsx("div",{className:"mt-2 space-y-2",children:mA.map(m=>{var g;return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`add-level-${m}`,checked:((g=r.level)==null?void 0:g.includes(m))||!1,onCheckedChange:b=>f("level",m,b)}),u.jsx(te,{htmlFor:`add-level-${m}`,className:"text-sm",children:m})]},m)})})]}),u.jsxs("div",{children:[u.jsx(te,{className:"text-sm font-medium",children:"Platform"}),u.jsx("div",{className:"mt-2 space-y-2",children:hA.map(m=>{var g;return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`add-platform-${m}`,checked:((g=r.platform)==null?void 0:g.includes(m))||!1,onCheckedChange:b=>f("platform",m,b)}),u.jsx(te,{htmlFor:`add-platform-${m}`,className:"text-sm",children:m})]},m)})})]}),u.jsxs("div",{children:[u.jsx(te,{className:"text-sm font-medium",children:"Instruction Medium"}),u.jsx("div",{className:"mt-2 space-y-2",children:vA.map(m=>{var g;return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`add-medium-${m}`,checked:((g=r.instruction_medium)==null?void 0:g.includes(m))||!1,onCheckedChange:b=>f("instruction_medium",m,b)}),u.jsx(te,{htmlFor:`add-medium-${m}`,className:"text-sm",children:m})]},m)})})]}),u.jsxs("div",{children:[u.jsx(te,{className:"text-sm font-medium",children:"Delivery"}),u.jsx("div",{className:"mt-2 space-y-2",children:pA.map(m=>{var g;return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`add-delivery-${m}`,checked:((g=r.delivery)==null?void 0:g.includes(m))||!1,onCheckedChange:b=>f("delivery",m,b)}),u.jsx(te,{htmlFor:`add-delivery-${m}`,className:"text-sm",children:m})]},m)})})]}),u.jsxs("div",{children:[u.jsx(te,{className:"text-sm font-medium",children:"Language"}),u.jsx("div",{className:"mt-2 space-y-2",children:yA.map(m=>{var g;return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`add-language-${m}`,checked:((g=r.language)==null?void 0:g.includes(m))||!1,onCheckedChange:b=>f("language",m,b)}),u.jsx(te,{htmlFor:`add-language-${m}`,className:"text-sm",children:m})]},m)})})]}),u.jsxs("div",{children:[u.jsx(te,{className:"text-sm font-medium",children:"Programming Language"}),u.jsx("div",{className:"mt-2 space-y-2",children:xA.map(m=>{var g;return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`add-prog-${m}`,checked:((g=r.programming_language)==null?void 0:g.includes(m))||!1,onCheckedChange:b=>f("programming_language",m,b)}),u.jsx(te,{htmlFor:`add-prog-${m}`,className:"text-sm",children:m})]},m)})})]}),u.jsxs("div",{children:[u.jsx(te,{className:"text-sm font-medium",children:"Neuroimaging Software"}),u.jsx("div",{className:"mt-2 space-y-2",children:bA.map(m=>{var g;return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`add-neuro-${m}`,checked:((g=r.neuroimaging_software)==null?void 0:g.includes(m))||!1,onCheckedChange:b=>f("neuroimaging_software",m,b)}),u.jsx(te,{htmlFor:`add-neuro-${m}`,className:"text-sm",children:m})]},m)})})]}),u.jsxs("div",{children:[u.jsx(te,{className:"text-sm font-medium",children:"Imaging Modality"}),u.jsx("div",{className:"mt-2 space-y-2",children:SA.map(m=>{var g;return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`add-modality-${m}`,checked:((g=r.imaging_modality)==null?void 0:g.includes(m))||!1,onCheckedChange:b=>f("imaging_modality",m,b)}),u.jsx(te,{htmlFor:`add-modality-${m}`,className:"text-sm",children:m})]},m)})})]})]}),u.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[u.jsx(te,{className:"text-right",children:"Open Dataset"}),u.jsxs("div",{className:"col-span-3 flex items-center gap-2",children:[u.jsx(ke,{id:"open_dataset",checked:r.open_dataset===!0,onCheckedChange:m=>c("open_dataset",m===!0?!0:null)}),u.jsx(te,{htmlFor:"open_dataset",className:"text-sm",children:"Uses an open dataset"})]})]}),u.jsxs("div",{children:[u.jsx(te,{className:"text-sm font-medium",children:"Quadrants"}),u.jsx("div",{className:"mt-2 space-y-2",children:wA.map(m=>{var g;return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`add-quadrant-${m}`,checked:((g=r.quadrants)==null?void 0:g.includes(m))||!1,onCheckedChange:b=>f("quadrants",m,b)}),u.jsx(te,{htmlFor:`add-quadrant-${m}`,className:"text-sm",children:m})]},m)})})]}),u.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[u.jsx(te,{htmlFor:"notes",className:"text-right",children:"Notes"}),u.jsx(wt,{id:"notes",value:r.notes||"",onChange:m=>c("notes",m.target.value),className:"col-span-3",placeholder:"Additional notes"})]})]}),u.jsxs("div",{className:"flex justify-end gap-2",children:[u.jsx(nt,{variant:"outline",onClick:a,children:"Cancel"}),u.jsx(nt,{onClick:x,children:"Submit via GitHub Issue"})]})]})};function CA(){const[a,r]=S.useState([]),[o,c]=S.useState(!0),[f,d]=S.useState(null),[v,p]=S.useState(null),[x,m]=S.useState(null),[g,b]=S.useState(!1);S.useEffect(()=>{(async()=>{try{const fe=await fetch("/ReproInventory/data/reproinventory_data.json");if(!fe.ok)throw new Error(`HTTP error! status: ${fe.status}`);const pt=await fe.json();r(pt)}catch(fe){d(fe.message)}finally{c(!1)}})()},[]);const[w,_]=S.useState(""),[M,N]=S.useState([]),[T,z]=S.useState([]),[R,U]=S.useState([]),[Y,q]=S.useState([]),[J,F]=S.useState([]),[Q,ie]=S.useState([]),[me,xe]=S.useState([]),[ue,be]=S.useState([]),[ve,de]=S.useState([]),[j,K]=S.useState(null),[B,re]=S.useState([]),[A,X]=S.useState(!1),I=(G,fe,pt)=>{G(Ft=>pt?[...Ft,fe]:Ft.filter(Bt=>Bt!==fe))},P=["Beginner","Intermediate","Advanced","NA"],ee=["Mac","Windows","Linux","Docker","Jupyter","NA"],ye=["<1 hr","1-4 hrs","1 day","1-3 days","1 week","1+ weeks","NA"],ce=["Hands-on tutorial / notebooks","lecture","video","notes","blog post","reference","slides","website","outline","meta-resource","NA"],W=["self-paced","instructor","Hybrid","Discussion needed"],se=["English","French","Spanish","Chinese","German","English, French","English, German","Other","NA"],De=["Python","R","shell scripting","Matlab","Git","NA"],Re=["AFNI","SPM","FSL","Freesurfer","Python","Multiple","NA"],Ne=["DWI","Structural","Functional","Task-based","Resting-State","EEG","Behavioral","MEG","MRI","NA"],Ee=[{label:"Yes",value:!0},{label:"No",value:!1}],lt=["information-oriented (reference)","understanding-oriented (explanation)","learning-oriented (tutorials)","problem-oriented (how to guides)","NA"],ct=S.useMemo(()=>a.filter(fe=>{var Ft,Bt,bl,ot,Ql,Zl,Yn,yt,Pt;const pt=[fe.course_name,fe.url,fe.description,fe.notes,...fe.keywords||[]].filter(Boolean).map(String).join(" ").toLowerCase();return!(w&&!pt.includes(w.toLowerCase())||M.length>0&&!((Ft=fe.level)!=null&&Ft.some(Ue=>M.includes(Ue)))||T.length>0&&!((Bt=fe.platform)!=null&&Bt.some(Ue=>T.includes(Ue)))||R.length>0&&fe.course_length&&!R.includes(fe.course_length)||Y.length>0&&!((bl=fe.instruction_medium)!=null&&bl.some(Ue=>Y.includes(Ue)))||J.length>0&&!((ot=fe.delivery)!=null&&ot.some(Ue=>J.includes(Ue)))||Q.length>0&&!((Ql=fe.language)!=null&&Ql.some(Ue=>Q.includes(Ue)))||me.length>0&&!((Zl=fe.programming_language)!=null&&Zl.some(Ue=>me.includes(Ue)))||ue.length>0&&!((Yn=fe.neuroimaging_software)!=null&&Yn.some(Ue=>ue.includes(Ue)))||ve.length>0&&!((yt=fe.imaging_modality)!=null&&yt.some(Ue=>ve.includes(Ue)))||j!==null&&fe.open_dataset!==j||B.length>0&&!((Pt=fe.quadrants)!=null&&Pt.some(Ue=>B.includes(Ue))))}),[a,w,M,T,R,Y,J,Q,me,ue,ve,j,B,A]),rn=()=>{_(""),N([]),z([]),U([]),q([]),F([]),ie([]),xe([]),be([]),de([]),K(null),re([]),X(!1)},Sn=G=>{switch(G){case"Hands-on tutorial / notebooks":case"website":case"notes":case"reference":case"blog post":case"outline":case"meta-resource":return u.jsx(Ag,{className:"w-4 h-4"});case"video":return u.jsx(K0,{className:"w-4 h-4"});case"lecture":case"slides":return u.jsx(L0,{className:"w-4 h-4"});default:return u.jsx(Ag,{className:"w-4 h-4"})}};return u.jsxs("div",{className:"min-h-screen bg-background",children:[u.jsxs("div",{className:"container mx-auto px-4 py-8",children:[u.jsxs("div",{className:"mb-8",children:[u.jsx("h1",{className:"text-3xl font-bold mb-2",children:"ReproInventory - Training"}),u.jsx("p",{className:"text-muted-foreground",children:"Explore our comprehensive collection of research training materials and educational resources"})]}),u.jsxs("div",{className:"grid lg:grid-cols-[300px_1fr] gap-8",children:[u.jsxs("div",{className:"space-y-6",children:[u.jsxs(hu,{children:[u.jsx(gu,{children:u.jsxs(vu,{className:"flex items-center gap-2",children:[u.jsx(Cg,{className:"w-5 h-5"}),"Search & Filters"]})}),u.jsxs(pu,{className:"space-y-4",children:[u.jsx("div",{children:u.jsx(wt,{placeholder:"Search materials...",value:w,onChange:G=>_(G.target.value),className:"w-full"})}),u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:"featured",checked:A,onCheckedChange:G=>X(G===!0)}),u.jsx(te,{htmlFor:"featured",className:"text-sm",children:"Featured only"})]}),u.jsxs("div",{className:"flex justify-between items-center",children:[u.jsx("span",{className:"text-sm font-medium",children:"Active Filters"}),u.jsx(nt,{variant:"ghost",size:"sm",onClick:rn,children:"Clear All"})]})]})]}),u.jsxs(w1,{defaultValue:"categories",className:"w-full",children:[u.jsxs(N1,{className:"grid w-full grid-cols-2",children:[u.jsx(kg,{value:"categories",children:"Categories"}),u.jsx(kg,{value:"attributes",children:"Attributes"})]}),u.jsx(Ug,{value:"categories",className:"space-y-4",children:u.jsxs(hu,{children:[u.jsxs(gu,{children:[u.jsx(vu,{className:"text-lg",children:"Quadrants"}),u.jsx(zg,{children:"Filter by Quadrants classification"})]}),u.jsx(pu,{children:u.jsx("div",{className:"space-y-3",children:lt.map(G=>u.jsxs("div",{className:"flex items-start space-x-2",children:[u.jsx(ke,{id:`quadrant-${G}`,checked:B.includes(G),onCheckedChange:fe=>I(re,G,fe)}),u.jsx("div",{className:"grid gap-1.5 leading-none",children:u.jsx(te,{htmlFor:`quadrant-${G}`,className:"text-sm font-medium",children:G})})]},G))})})]})}),u.jsx(Ug,{value:"attributes",className:"space-y-4",children:u.jsxs(X1,{type:"multiple",className:"w-full",children:[u.jsxs(dn,{value:"level",children:[u.jsx(mn,{children:"Level"}),u.jsx(hn,{children:u.jsx("div",{className:"space-y-2",children:P.map(G=>u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`level-${G}`,checked:M.includes(G),onCheckedChange:fe=>I(N,G,fe)}),u.jsx(te,{htmlFor:`level-${G}`,className:"text-sm",children:G})]},G))})})]}),u.jsxs(dn,{value:"platform",children:[u.jsx(mn,{children:"Platform"}),u.jsx(hn,{children:u.jsx("div",{className:"space-y-2",children:ee.map(G=>u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`platform-${G}`,checked:T.includes(G),onCheckedChange:fe=>I(z,G,fe)}),u.jsx(te,{htmlFor:`platform-${G}`,className:"text-sm",children:G})]},G))})})]}),u.jsxs(dn,{value:"course-length",children:[u.jsx(mn,{children:"Course Length"}),u.jsx(hn,{children:u.jsx("div",{className:"space-y-2",children:ye.map(G=>u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`length-${G}`,checked:R.includes(G),onCheckedChange:fe=>I(U,G,fe)}),u.jsx(te,{htmlFor:`length-${G}`,className:"text-sm",children:G})]},G))})})]}),u.jsxs(dn,{value:"instruction-medium",children:[u.jsx(mn,{children:"Instruction Medium"}),u.jsx(hn,{children:u.jsx("div",{className:"space-y-2",children:ce.map(G=>u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`medium-${G}`,checked:Y.includes(G),onCheckedChange:fe=>I(q,G,fe)}),u.jsx(te,{htmlFor:`medium-${G}`,className:"text-sm",children:G})]},G))})})]}),u.jsxs(dn,{value:"delivery",children:[u.jsx(mn,{children:"Delivery"}),u.jsx(hn,{children:u.jsx("div",{className:"space-y-2",children:W.map(G=>u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`delivery-${G}`,checked:J.includes(G),onCheckedChange:fe=>I(F,G,fe)}),u.jsx(te,{htmlFor:`delivery-${G}`,className:"text-sm",children:G})]},G))})})]}),u.jsxs(dn,{value:"language",children:[u.jsx(mn,{children:"Language"}),u.jsx(hn,{children:u.jsx("div",{className:"space-y-2",children:se.map(G=>u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`language-${G}`,checked:Q.includes(G),onCheckedChange:fe=>I(ie,G,fe)}),u.jsx(te,{htmlFor:`language-${G}`,className:"text-sm",children:G})]},G))})})]}),u.jsxs(dn,{value:"programming-language",children:[u.jsx(mn,{children:"Programming Language"}),u.jsx(hn,{children:u.jsx("div",{className:"space-y-2",children:De.map(G=>u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`programming-language-${G}`,checked:me.includes(G),onCheckedChange:fe=>I(xe,G,fe)}),u.jsx(te,{htmlFor:`programming-language-${G}`,className:"text-sm",children:G})]},G))})})]}),u.jsxs(dn,{value:"neuroimaging-software",children:[u.jsx(mn,{children:"Neuroimaging Software"}),u.jsx(hn,{children:u.jsx("div",{className:"space-y-2",children:Re.map(G=>u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`neuroimaging-software-${G}`,checked:ue.includes(G),onCheckedChange:fe=>I(be,G,fe)}),u.jsx(te,{htmlFor:`neuroimaging-software-${G}`,className:"text-sm",children:G})]},G))})})]}),u.jsxs(dn,{value:"imaging-modality",children:[u.jsx(mn,{children:"Imaging Modality"}),u.jsx(hn,{children:u.jsx("div",{className:"space-y-2",children:Ne.map(G=>u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`imaging-modality-${G}`,checked:ve.includes(G),onCheckedChange:fe=>I(de,G,fe)}),u.jsx(te,{htmlFor:`imaging-modality-${G}`,className:"text-sm",children:G})]},G))})})]}),u.jsxs(dn,{value:"open-dataset",children:[u.jsx(mn,{children:"Open Dataset"}),u.jsx(hn,{children:u.jsx("div",{className:"space-y-2",children:Ee.map(G=>u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`open-dataset-${G.value}`,checked:j===G.value,onCheckedChange:()=>K(j===G.value?null:G.value)}),u.jsx(te,{htmlFor:`open-dataset-${G.value}`,className:"text-sm",children:G.label})]},String(G.value)))})})]})]})})]})]}),u.jsxs("div",{className:"space-y-6",children:[o&&u.jsx("p",{children:"Loading materials..."}),f&&u.jsxs("p",{className:"text-red-500",children:["Error: ",f]}),!o&&!f&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{children:[u.jsxs("h2",{className:"text-xl font-semibold",children:[ct.length," Training Materials"]}),w&&u.jsxs("p",{className:"text-sm text-muted-foreground",children:['Results for "',w,'"']})]}),u.jsxs(Cu,{open:g,onOpenChange:b,children:[u.jsx(Tu,{asChild:!0,children:u.jsx(nt,{children:"Add Material"})}),u.jsx(AA,{onClose:()=>b(!1)})]})]}),u.jsx("div",{className:"grid gap-6 md:grid-cols-2 xl:grid-cols-3",children:ct.map(G=>{var fe,pt,Ft,Bt,bl;return u.jsxs(hu,{className:"hover:shadow-lg transition-shadow",children:[u.jsxs(gu,{children:[u.jsx("div",{className:"flex flex-col gap-1",children:u.jsxs("div",{className:"flex items-center gap-2",children:[Sn(((fe=G.instruction_medium)==null?void 0:fe[0])||""),u.jsx(Xi,{variant:"secondary",children:((pt=G.instruction_medium)==null?void 0:pt[0])||"N/A"})]})}),u.jsx(vu,{className:"text-lg break-words",children:G.course_name}),u.jsx(zg,{className:"break-words",children:G.description})]}),u.jsxs(pu,{className:"space-y-4",children:[u.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[u.jsxs("div",{className:"flex items-center gap-1",children:[u.jsx(z0,{className:"w-4 h-4"}),G.course_length||"N/A"]}),G.level&&u.jsx(Xi,{variant:"outline",children:G.level.join(", ")})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsxs("div",{children:[u.jsx(te,{className:"text-xs font-medium text-muted-foreground",children:"KEYWORDS"}),u.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:(Ft=G.keywords)==null?void 0:Ft.map(ot=>u.jsx(Xi,{variant:"outline",className:"text-xs",children:ot},ot))})]}),u.jsxs("div",{children:[u.jsx(te,{className:"text-xs font-medium text-muted-foreground",children:"PROGRAMMING LANGUAGE"}),u.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:(Bt=G.programming_language)==null?void 0:Bt.map(ot=>u.jsx(Xi,{variant:"outline",className:"text-xs",children:ot},ot))})]}),u.jsxs("div",{children:[u.jsx(te,{className:"text-xs font-medium text-muted-foreground",children:"PLATFORM"}),u.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:(bl=G.platform)==null?void 0:bl.map(ot=>u.jsx(Xi,{variant:"outline",className:"text-xs",children:ot},ot))})]}),G.url&&u.jsxs("a",{href:G.url,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:underline flex items-center gap-1 min-w-0",children:[u.jsx("span",{className:"truncate",children:"Access Material"})," ",u.jsx(U0,{className:"w-4 h-4 shrink-0"})]})]}),u.jsxs("div",{className:"flex gap-2 flex-wrap",children:[u.jsxs(Cu,{children:[u.jsx(Tu,{asChild:!0,children:u.jsx(nt,{variant:"outline",className:"w-fit text-xs px-2 py-1 h-auto",onClick:()=>p(G),children:"View Raw Data"})}),u.jsxs(Lc,{className:"sm:max-w-[800px]",children:[u.jsxs(Bc,{children:[u.jsxs(qc,{children:["Raw Data for ",v==null?void 0:v.course_name]}),u.jsx(Gc,{children:"This is the raw JSON data for the selected training material."})]}),u.jsx("div",{className:"max-h-[60vh] overflow-auto rounded-md bg-zinc-900 p-4 text-zinc-50",children:u.jsx("pre",{className:"text-xs",children:v?JSON.stringify(v,null,2):"No data selected"})})]})]}),u.jsxs(Cu,{onOpenChange:ot=>{ot||m(null)},children:[u.jsx(Tu,{asChild:!0,children:u.jsx(nt,{variant:"outline",className:"w-fit text-xs px-2 py-1 h-auto",onClick:()=>m(G),children:"Edit"})}),x&&u.jsx(fA,{material:x,onClose:()=>m(null)})]}),u.jsx(nt,{variant:"outline",className:"w-fit text-xs px-2 py-1 h-auto text-red-600 hover:text-red-700",onClick:()=>{const ot=`Delete material: ${G.course_name} (ID: ${G.id})`,Ql=`## Delete Training Material Request +\`\`\``,f=`${dA}/issues/new?labels=new-material&title=${encodeURIComponent(o)}&body=${encodeURIComponent(c)}`;window.open(f,"_blank")}const AA=({onClose:a})=>{const[r,o]=S.useState({id:"",course_name:"",url:"",level:[],platform:[],keywords:[],course_length:void 0,instruction_medium:[],delivery:[],language:[],programming_language:[],neuroimaging_software:[],imaging_modality:[],open_dataset:void 0,description:"",notes:"",quadrants:[]}),c=(m,g)=>{o(b=>({...b,[m]:g}))},f=(m,g,b)=>{const w=r[m]||[];c(m,b?[...w,g]:w.filter(_=>_!==g))},d=(m,g,b)=>{const w=[...r[m]||[]];w[g]=b,c(m,w)},v=m=>{c(m,[...r[m]||[],""])},p=(m,g)=>{c(m,(r[m]||[]).filter((b,w)=>w!==g))},x=()=>{var m;if(!((m=r.course_name)!=null&&m.trim())){alert("Please provide a course name.");return}EA(r),a()};return u.jsxs(Lc,{className:"sm:max-w-[800px] overflow-y-auto max-h-[90vh]",children:[u.jsxs(Bc,{children:[u.jsx(qc,{children:"Add New Training Material"}),u.jsx(Gc,{children:"Fill in the details below. Submitting will open a pre-filled GitHub issue for maintainer review. Only course name is required."})]}),u.jsxs("div",{className:"grid gap-4 py-4",children:[u.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[u.jsx(te,{htmlFor:"course_name",className:"text-right",children:"Course Name *"}),u.jsx(wt,{id:"course_name",value:r.course_name||"",onChange:m=>c("course_name",m.target.value),className:"col-span-3",placeholder:"Enter course name"})]}),u.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[u.jsx(te,{htmlFor:"url",className:"text-right",children:"URL"}),u.jsx(wt,{id:"url",value:r.url||"",onChange:m=>c("url",m.target.value),className:"col-span-3",placeholder:"https://example.com"})]}),u.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[u.jsx(te,{htmlFor:"description",className:"text-right",children:"Description"}),u.jsx(wt,{id:"description",value:r.description||"",onChange:m=>c("description",m.target.value),className:"col-span-3",placeholder:"Brief description of the material"})]}),u.jsxs("div",{className:"grid grid-cols-4 items-start gap-4",children:[u.jsx(te,{className:"text-right pt-2",children:"Keywords"}),u.jsxs("div",{className:"col-span-3 space-y-2",children:[(r.keywords||[]).map((m,g)=>u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(wt,{value:m,onChange:b=>d("keywords",g,b.target.value),className:"flex-grow",placeholder:"Enter keyword"}),u.jsx(nt,{variant:"outline",size:"icon",onClick:()=>p("keywords",g),children:u.jsx(Qi,{className:"h-4 w-4"})})]},g)),u.jsxs(nt,{variant:"outline",size:"sm",onClick:()=>v("keywords"),children:[u.jsx(Zi,{className:"h-4 w-4 mr-2"})," Add Keyword"]})]})]}),u.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[u.jsx(te,{className:"text-right",children:"Course Length"}),u.jsxs(Fy,{value:r.course_length||"",onValueChange:m=>c("course_length",m),children:[u.jsx(wf,{className:"col-span-3",children:u.jsx(Py,{placeholder:"Select course length"})}),u.jsx(Nf,{children:gA.map(m=>u.jsx(Ef,{value:m,children:m},m))})]})]}),u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[u.jsxs("div",{children:[u.jsx(te,{className:"text-sm font-medium",children:"Level"}),u.jsx("div",{className:"mt-2 space-y-2",children:mA.map(m=>{var g;return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`add-level-${m}`,checked:((g=r.level)==null?void 0:g.includes(m))||!1,onCheckedChange:b=>f("level",m,b)}),u.jsx(te,{htmlFor:`add-level-${m}`,className:"text-sm",children:m})]},m)})})]}),u.jsxs("div",{children:[u.jsx(te,{className:"text-sm font-medium",children:"Platform"}),u.jsx("div",{className:"mt-2 space-y-2",children:hA.map(m=>{var g;return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`add-platform-${m}`,checked:((g=r.platform)==null?void 0:g.includes(m))||!1,onCheckedChange:b=>f("platform",m,b)}),u.jsx(te,{htmlFor:`add-platform-${m}`,className:"text-sm",children:m})]},m)})})]}),u.jsxs("div",{children:[u.jsx(te,{className:"text-sm font-medium",children:"Instruction Medium"}),u.jsx("div",{className:"mt-2 space-y-2",children:vA.map(m=>{var g;return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`add-medium-${m}`,checked:((g=r.instruction_medium)==null?void 0:g.includes(m))||!1,onCheckedChange:b=>f("instruction_medium",m,b)}),u.jsx(te,{htmlFor:`add-medium-${m}`,className:"text-sm",children:m})]},m)})})]}),u.jsxs("div",{children:[u.jsx(te,{className:"text-sm font-medium",children:"Delivery"}),u.jsx("div",{className:"mt-2 space-y-2",children:pA.map(m=>{var g;return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`add-delivery-${m}`,checked:((g=r.delivery)==null?void 0:g.includes(m))||!1,onCheckedChange:b=>f("delivery",m,b)}),u.jsx(te,{htmlFor:`add-delivery-${m}`,className:"text-sm",children:m})]},m)})})]}),u.jsxs("div",{children:[u.jsx(te,{className:"text-sm font-medium",children:"Language"}),u.jsx("div",{className:"mt-2 space-y-2",children:yA.map(m=>{var g;return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`add-language-${m}`,checked:((g=r.language)==null?void 0:g.includes(m))||!1,onCheckedChange:b=>f("language",m,b)}),u.jsx(te,{htmlFor:`add-language-${m}`,className:"text-sm",children:m})]},m)})})]}),u.jsxs("div",{children:[u.jsx(te,{className:"text-sm font-medium",children:"Programming Language"}),u.jsx("div",{className:"mt-2 space-y-2",children:xA.map(m=>{var g;return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`add-prog-${m}`,checked:((g=r.programming_language)==null?void 0:g.includes(m))||!1,onCheckedChange:b=>f("programming_language",m,b)}),u.jsx(te,{htmlFor:`add-prog-${m}`,className:"text-sm",children:m})]},m)})})]}),u.jsxs("div",{children:[u.jsx(te,{className:"text-sm font-medium",children:"Neuroimaging Software"}),u.jsx("div",{className:"mt-2 space-y-2",children:bA.map(m=>{var g;return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`add-neuro-${m}`,checked:((g=r.neuroimaging_software)==null?void 0:g.includes(m))||!1,onCheckedChange:b=>f("neuroimaging_software",m,b)}),u.jsx(te,{htmlFor:`add-neuro-${m}`,className:"text-sm",children:m})]},m)})})]}),u.jsxs("div",{children:[u.jsx(te,{className:"text-sm font-medium",children:"Imaging Modality"}),u.jsx("div",{className:"mt-2 space-y-2",children:SA.map(m=>{var g;return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`add-modality-${m}`,checked:((g=r.imaging_modality)==null?void 0:g.includes(m))||!1,onCheckedChange:b=>f("imaging_modality",m,b)}),u.jsx(te,{htmlFor:`add-modality-${m}`,className:"text-sm",children:m})]},m)})})]})]}),u.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[u.jsx(te,{className:"text-right",children:"Open Dataset"}),u.jsxs("div",{className:"col-span-3 flex items-center gap-2",children:[u.jsx(ke,{id:"open_dataset",checked:r.open_dataset===!0,onCheckedChange:m=>c("open_dataset",m===!0)}),u.jsx(te,{htmlFor:"open_dataset",className:"text-sm",children:"Uses an open dataset"})]})]}),u.jsxs("div",{children:[u.jsx(te,{className:"text-sm font-medium",children:"Quadrants"}),u.jsx("div",{className:"mt-2 space-y-2",children:wA.map(m=>{var g;return u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`add-quadrant-${m}`,checked:((g=r.quadrants)==null?void 0:g.includes(m))||!1,onCheckedChange:b=>f("quadrants",m,b)}),u.jsx(te,{htmlFor:`add-quadrant-${m}`,className:"text-sm",children:m})]},m)})})]}),u.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[u.jsx(te,{htmlFor:"notes",className:"text-right",children:"Notes"}),u.jsx(wt,{id:"notes",value:r.notes||"",onChange:m=>c("notes",m.target.value),className:"col-span-3",placeholder:"Additional notes"})]})]}),u.jsxs("div",{className:"flex justify-end gap-2",children:[u.jsx(nt,{variant:"outline",onClick:a,children:"Cancel"}),u.jsx(nt,{onClick:x,children:"Submit via GitHub Issue"})]})]})};function CA(){const[a,r]=S.useState([]),[o,c]=S.useState(!0),[f,d]=S.useState(null),[v,p]=S.useState(null),[x,m]=S.useState(null),[g,b]=S.useState(!1);S.useEffect(()=>{(async()=>{try{const fe=await fetch("/ReproInventory/data/reproinventory_data.json");if(!fe.ok)throw new Error(`HTTP error! status: ${fe.status}`);const pt=await fe.json();r(pt)}catch(fe){d(fe.message)}finally{c(!1)}})()},[]);const[w,_]=S.useState(""),[M,N]=S.useState([]),[T,z]=S.useState([]),[R,U]=S.useState([]),[Y,q]=S.useState([]),[J,F]=S.useState([]),[Q,ie]=S.useState([]),[me,xe]=S.useState([]),[ue,be]=S.useState([]),[ve,de]=S.useState([]),[j,K]=S.useState(null),[B,re]=S.useState([]),[A,X]=S.useState(!1),I=(G,fe,pt)=>{G(Ft=>pt?[...Ft,fe]:Ft.filter(Bt=>Bt!==fe))},P=["Beginner","Intermediate","Advanced","NA"],ee=["Mac","Windows","Linux","Docker","Jupyter","NA"],ye=["<1 hr","1-4 hrs","1 day","1-3 days","1 week","1+ weeks","NA"],ce=["Hands-on tutorial / notebooks","lecture","video","notes","blog post","reference","slides","website","outline","meta-resource","NA"],W=["self-paced","instructor","Hybrid","Discussion needed"],se=["English","French","Spanish","Chinese","German","English, French","English, German","Other","NA"],De=["Python","R","shell scripting","Matlab","Git","NA"],Re=["AFNI","SPM","FSL","Freesurfer","Python","Multiple","NA"],Ne=["DWI","Structural","Functional","Task-based","Resting-State","EEG","Behavioral","MEG","MRI","NA"],Ee=[{label:"Yes",value:!0},{label:"No",value:!1}],lt=["information-oriented (reference)","understanding-oriented (explanation)","learning-oriented (tutorials)","problem-oriented (how to guides)","NA"],ct=S.useMemo(()=>a.filter(fe=>{var Ft,Bt,bl,ot,Ql,Zl,Yn,yt,Pt;const pt=[fe.course_name,fe.url,fe.description,fe.notes,...fe.keywords||[]].filter(Boolean).map(String).join(" ").toLowerCase();return!(w&&!pt.includes(w.toLowerCase())||M.length>0&&!((Ft=fe.level)!=null&&Ft.some(Ue=>M.includes(Ue)))||T.length>0&&!((Bt=fe.platform)!=null&&Bt.some(Ue=>T.includes(Ue)))||R.length>0&&fe.course_length&&!R.includes(fe.course_length)||Y.length>0&&!((bl=fe.instruction_medium)!=null&&bl.some(Ue=>Y.includes(Ue)))||J.length>0&&!((ot=fe.delivery)!=null&&ot.some(Ue=>J.includes(Ue)))||Q.length>0&&!((Ql=fe.language)!=null&&Ql.some(Ue=>Q.includes(Ue)))||me.length>0&&!((Zl=fe.programming_language)!=null&&Zl.some(Ue=>me.includes(Ue)))||ue.length>0&&!((Yn=fe.neuroimaging_software)!=null&&Yn.some(Ue=>ue.includes(Ue)))||ve.length>0&&!((yt=fe.imaging_modality)!=null&&yt.some(Ue=>ve.includes(Ue)))||j!==null&&fe.open_dataset!==j||B.length>0&&!((Pt=fe.quadrants)!=null&&Pt.some(Ue=>B.includes(Ue))))}),[a,w,M,T,R,Y,J,Q,me,ue,ve,j,B,A]),rn=()=>{_(""),N([]),z([]),U([]),q([]),F([]),ie([]),xe([]),be([]),de([]),K(null),re([]),X(!1)},Sn=G=>{switch(G){case"Hands-on tutorial / notebooks":case"website":case"notes":case"reference":case"blog post":case"outline":case"meta-resource":return u.jsx(Ag,{className:"w-4 h-4"});case"video":return u.jsx(K0,{className:"w-4 h-4"});case"lecture":case"slides":return u.jsx(L0,{className:"w-4 h-4"});default:return u.jsx(Ag,{className:"w-4 h-4"})}};return u.jsxs("div",{className:"min-h-screen bg-background",children:[u.jsxs("div",{className:"container mx-auto px-4 py-8",children:[u.jsxs("div",{className:"mb-8",children:[u.jsx("h1",{className:"text-3xl font-bold mb-2",children:"ReproInventory - Training"}),u.jsx("p",{className:"text-muted-foreground",children:"Explore our comprehensive collection of research training materials and educational resources"})]}),u.jsxs("div",{className:"grid lg:grid-cols-[300px_1fr] gap-8",children:[u.jsxs("div",{className:"space-y-6",children:[u.jsxs(hu,{children:[u.jsx(gu,{children:u.jsxs(vu,{className:"flex items-center gap-2",children:[u.jsx(Cg,{className:"w-5 h-5"}),"Search & Filters"]})}),u.jsxs(pu,{className:"space-y-4",children:[u.jsx("div",{children:u.jsx(wt,{placeholder:"Search materials...",value:w,onChange:G=>_(G.target.value),className:"w-full"})}),u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:"featured",checked:A,onCheckedChange:G=>X(G===!0)}),u.jsx(te,{htmlFor:"featured",className:"text-sm",children:"Featured only"})]}),u.jsxs("div",{className:"flex justify-between items-center",children:[u.jsx("span",{className:"text-sm font-medium",children:"Active Filters"}),u.jsx(nt,{variant:"ghost",size:"sm",onClick:rn,children:"Clear All"})]})]})]}),u.jsxs(w1,{defaultValue:"categories",className:"w-full",children:[u.jsxs(N1,{className:"grid w-full grid-cols-2",children:[u.jsx(kg,{value:"categories",children:"Categories"}),u.jsx(kg,{value:"attributes",children:"Attributes"})]}),u.jsx(Ug,{value:"categories",className:"space-y-4",children:u.jsxs(hu,{children:[u.jsxs(gu,{children:[u.jsx(vu,{className:"text-lg",children:"Quadrants"}),u.jsx(zg,{children:"Filter by Quadrants classification"})]}),u.jsx(pu,{children:u.jsx("div",{className:"space-y-3",children:lt.map(G=>u.jsxs("div",{className:"flex items-start space-x-2",children:[u.jsx(ke,{id:`quadrant-${G}`,checked:B.includes(G),onCheckedChange:fe=>I(re,G,fe)}),u.jsx("div",{className:"grid gap-1.5 leading-none",children:u.jsx(te,{htmlFor:`quadrant-${G}`,className:"text-sm font-medium",children:G})})]},G))})})]})}),u.jsx(Ug,{value:"attributes",className:"space-y-4",children:u.jsxs(X1,{type:"multiple",className:"w-full",children:[u.jsxs(dn,{value:"level",children:[u.jsx(mn,{children:"Level"}),u.jsx(hn,{children:u.jsx("div",{className:"space-y-2",children:P.map(G=>u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`level-${G}`,checked:M.includes(G),onCheckedChange:fe=>I(N,G,fe)}),u.jsx(te,{htmlFor:`level-${G}`,className:"text-sm",children:G})]},G))})})]}),u.jsxs(dn,{value:"platform",children:[u.jsx(mn,{children:"Platform"}),u.jsx(hn,{children:u.jsx("div",{className:"space-y-2",children:ee.map(G=>u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`platform-${G}`,checked:T.includes(G),onCheckedChange:fe=>I(z,G,fe)}),u.jsx(te,{htmlFor:`platform-${G}`,className:"text-sm",children:G})]},G))})})]}),u.jsxs(dn,{value:"course-length",children:[u.jsx(mn,{children:"Course Length"}),u.jsx(hn,{children:u.jsx("div",{className:"space-y-2",children:ye.map(G=>u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`length-${G}`,checked:R.includes(G),onCheckedChange:fe=>I(U,G,fe)}),u.jsx(te,{htmlFor:`length-${G}`,className:"text-sm",children:G})]},G))})})]}),u.jsxs(dn,{value:"instruction-medium",children:[u.jsx(mn,{children:"Instruction Medium"}),u.jsx(hn,{children:u.jsx("div",{className:"space-y-2",children:ce.map(G=>u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`medium-${G}`,checked:Y.includes(G),onCheckedChange:fe=>I(q,G,fe)}),u.jsx(te,{htmlFor:`medium-${G}`,className:"text-sm",children:G})]},G))})})]}),u.jsxs(dn,{value:"delivery",children:[u.jsx(mn,{children:"Delivery"}),u.jsx(hn,{children:u.jsx("div",{className:"space-y-2",children:W.map(G=>u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`delivery-${G}`,checked:J.includes(G),onCheckedChange:fe=>I(F,G,fe)}),u.jsx(te,{htmlFor:`delivery-${G}`,className:"text-sm",children:G})]},G))})})]}),u.jsxs(dn,{value:"language",children:[u.jsx(mn,{children:"Language"}),u.jsx(hn,{children:u.jsx("div",{className:"space-y-2",children:se.map(G=>u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`language-${G}`,checked:Q.includes(G),onCheckedChange:fe=>I(ie,G,fe)}),u.jsx(te,{htmlFor:`language-${G}`,className:"text-sm",children:G})]},G))})})]}),u.jsxs(dn,{value:"programming-language",children:[u.jsx(mn,{children:"Programming Language"}),u.jsx(hn,{children:u.jsx("div",{className:"space-y-2",children:De.map(G=>u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`programming-language-${G}`,checked:me.includes(G),onCheckedChange:fe=>I(xe,G,fe)}),u.jsx(te,{htmlFor:`programming-language-${G}`,className:"text-sm",children:G})]},G))})})]}),u.jsxs(dn,{value:"neuroimaging-software",children:[u.jsx(mn,{children:"Neuroimaging Software"}),u.jsx(hn,{children:u.jsx("div",{className:"space-y-2",children:Re.map(G=>u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`neuroimaging-software-${G}`,checked:ue.includes(G),onCheckedChange:fe=>I(be,G,fe)}),u.jsx(te,{htmlFor:`neuroimaging-software-${G}`,className:"text-sm",children:G})]},G))})})]}),u.jsxs(dn,{value:"imaging-modality",children:[u.jsx(mn,{children:"Imaging Modality"}),u.jsx(hn,{children:u.jsx("div",{className:"space-y-2",children:Ne.map(G=>u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`imaging-modality-${G}`,checked:ve.includes(G),onCheckedChange:fe=>I(de,G,fe)}),u.jsx(te,{htmlFor:`imaging-modality-${G}`,className:"text-sm",children:G})]},G))})})]}),u.jsxs(dn,{value:"open-dataset",children:[u.jsx(mn,{children:"Open Dataset"}),u.jsx(hn,{children:u.jsx("div",{className:"space-y-2",children:Ee.map(G=>u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ke,{id:`open-dataset-${G.value}`,checked:j===G.value,onCheckedChange:()=>K(j===G.value?null:G.value)}),u.jsx(te,{htmlFor:`open-dataset-${G.value}`,className:"text-sm",children:G.label})]},String(G.value)))})})]})]})})]})]}),u.jsxs("div",{className:"space-y-6",children:[o&&u.jsx("p",{children:"Loading materials..."}),f&&u.jsxs("p",{className:"text-red-500",children:["Error: ",f]}),!o&&!f&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{children:[u.jsxs("h2",{className:"text-xl font-semibold",children:[ct.length," Training Materials"]}),w&&u.jsxs("p",{className:"text-sm text-muted-foreground",children:['Results for "',w,'"']})]}),u.jsxs(Cu,{open:g,onOpenChange:b,children:[u.jsx(Tu,{asChild:!0,children:u.jsx(nt,{children:"Add Material"})}),u.jsx(AA,{onClose:()=>b(!1)})]})]}),u.jsx("div",{className:"grid gap-6 md:grid-cols-2 xl:grid-cols-3",children:ct.map(G=>{var fe,pt,Ft,Bt,bl;return u.jsxs(hu,{className:"hover:shadow-lg transition-shadow",children:[u.jsxs(gu,{children:[u.jsx("div",{className:"flex flex-col gap-1",children:u.jsxs("div",{className:"flex items-center gap-2",children:[Sn(((fe=G.instruction_medium)==null?void 0:fe[0])||""),u.jsx(Xi,{variant:"secondary",children:((pt=G.instruction_medium)==null?void 0:pt[0])||"N/A"})]})}),u.jsx(vu,{className:"text-lg break-words",children:G.course_name}),u.jsx(zg,{className:"break-words",children:G.description})]}),u.jsxs(pu,{className:"space-y-4",children:[u.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[u.jsxs("div",{className:"flex items-center gap-1",children:[u.jsx(z0,{className:"w-4 h-4"}),G.course_length||"N/A"]}),G.level&&u.jsx(Xi,{variant:"outline",children:G.level.join(", ")})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsxs("div",{children:[u.jsx(te,{className:"text-xs font-medium text-muted-foreground",children:"KEYWORDS"}),u.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:(Ft=G.keywords)==null?void 0:Ft.map(ot=>u.jsx(Xi,{variant:"outline",className:"text-xs",children:ot},ot))})]}),u.jsxs("div",{children:[u.jsx(te,{className:"text-xs font-medium text-muted-foreground",children:"PROGRAMMING LANGUAGE"}),u.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:(Bt=G.programming_language)==null?void 0:Bt.map(ot=>u.jsx(Xi,{variant:"outline",className:"text-xs",children:ot},ot))})]}),u.jsxs("div",{children:[u.jsx(te,{className:"text-xs font-medium text-muted-foreground",children:"PLATFORM"}),u.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:(bl=G.platform)==null?void 0:bl.map(ot=>u.jsx(Xi,{variant:"outline",className:"text-xs",children:ot},ot))})]}),G.url&&u.jsxs("a",{href:G.url,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:underline flex items-center gap-1 min-w-0",children:[u.jsx("span",{className:"truncate",children:"Access Material"})," ",u.jsx(U0,{className:"w-4 h-4 shrink-0"})]})]}),u.jsxs("div",{className:"flex gap-2 flex-wrap",children:[u.jsxs(Cu,{children:[u.jsx(Tu,{asChild:!0,children:u.jsx(nt,{variant:"outline",className:"w-fit text-xs px-2 py-1 h-auto",onClick:()=>p(G),children:"View Raw Data"})}),u.jsxs(Lc,{className:"sm:max-w-[800px]",children:[u.jsxs(Bc,{children:[u.jsxs(qc,{children:["Raw Data for ",v==null?void 0:v.course_name]}),u.jsx(Gc,{children:"This is the raw JSON data for the selected training material."})]}),u.jsx("div",{className:"max-h-[60vh] overflow-auto rounded-md bg-zinc-900 p-4 text-zinc-50",children:u.jsx("pre",{className:"text-xs",children:v?JSON.stringify(v,null,2):"No data selected"})})]})]}),u.jsxs(Cu,{onOpenChange:ot=>{ot||m(null)},children:[u.jsx(Tu,{asChild:!0,children:u.jsx(nt,{variant:"outline",className:"w-fit text-xs px-2 py-1 h-auto",onClick:()=>m(G),children:"Edit"})}),x&&u.jsx(fA,{material:x,onClose:()=>m(null)})]}),u.jsx(nt,{variant:"outline",className:"w-fit text-xs px-2 py-1 h-auto text-red-600 hover:text-red-700",onClick:()=>{const ot=`Delete material: ${G.course_name} (ID: ${G.id})`,Ql=`## Delete Training Material Request Please remove entry **ID: ${G.id}** ("${G.course_name}") from \`model/reproinventory_data.yaml\`.`,Zl=`${Ku()}/issues/new?labels=delete-material&title=${encodeURIComponent(ot)}&body=${encodeURIComponent(Ql)}`;window.open(Zl,"_blank")},children:"Delete"})]})]})]},G.id)})}),ct.length===0&&u.jsxs("div",{className:"text-center py-12",children:[u.jsx("div",{className:"mx-auto w-24 h-24 bg-muted rounded-full flex items-center justify-center mb-4",children:u.jsx(Cg,{className:"w-8 h-8 text-muted-foreground"})}),u.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No materials found"}),u.jsx("p",{className:"text-muted-foreground mb-4",children:"Try adjusting your search criteria or clearing some filters"}),u.jsx(nt,{onClick:rn,children:"Clear All Filters"})]})]})]})]})]}),u.jsx(P0,{})]})}function TA(){return u.jsx(CA,{})}w0.createRoot(document.getElementById("root")).render(u.jsx(S.StrictMode,{children:u.jsx(TA,{})})); diff --git a/frontend/dist/data/reproinventory_data.json b/frontend/dist/data/reproinventory_data.json index 0439445..96c1b8a 100644 --- a/frontend/dist/data/reproinventory_data.json +++ b/frontend/dist/data/reproinventory_data.json @@ -2185,7 +2185,10 @@ ], "course_name": "Andy's brain book", "url": "https://andysbrainbook.readthedocs.io/en/latest/", - "course_length": "NA", + "course_length": "1+ weeks", + "level": null, + "platform": null, + "keywords": null, "instruction_medium": [ "blog post", "Hands-on tutorial / notebooks" @@ -2265,7 +2268,7 @@ "large-scale data", "open data" ], - "course_length": "NA", + "course_length": "1+ weeks", "instruction_medium": null, "delivery": null, "language": null, @@ -2320,7 +2323,9 @@ "keywords": [ "Machine Learning" ], - "course_length": "NA", + "course_length": [ + "1+ weeks" + ], "instruction_medium": null, "delivery": null, "language": null, @@ -2373,8 +2378,6 @@ "Best Practices", "Data Visualization" ], - "course_length": null, - "instruction_medium": null, "delivery": null, "language": [ "English" diff --git a/frontend/dist/index.html b/frontend/dist/index.html index 4ecf570..fe632d8 100644 --- a/frontend/dist/index.html +++ b/frontend/dist/index.html @@ -4,7 +4,7 @@ ReproInventory - +