PageSourceSearch

https://www.codechef.com/build/react2/assets/ProblemBookMark-BH5n7Mgq.js

js codechef.com collected 2026-09-24 08:55:00 UTC 3,636 bytes, 1 lines download raw bytes

1import{r,a3 as l,Z as t,a2 as k,ah as L,b0 as j,ap as R}from"./vendor-mui-D5pLRgDb.js";import{U as F,d as H,S as M,T as O,b as W,n as N,cb as z,Z as I,X as c,g as U,A as C,a as B}from"./index-BSFWpFMK.js";import{s,g as S}from"./PracticePage.module-BJvG3uSe.js";import"./__commonjsHelpers__-BosuxZz1.js";import"./vendor-sweetalert2-CokzRhbv.js";import"./HorizontalTabPanel-DmgXUE-p.js";import"./CheckBox-Dkb41L1G.js";import"./Chip-BkMi8CMj.js";import"./Tabs.module-7o-Hithh.js";function Y(){const{dispatch:h}=r.useContext(F),[d,b]=r.useState([]),[v,y]=r.useState([]),[p,w]=r.useState(""),[g,x]=r.useState({}),u=50,E=e=>{x(o=>({...o,[e]:!o[e]}))};r.useEffect(()=>{const e=async()=>{try{const o=await C.get("/api/list/bookmarks"),{data:a}=o.data;b(a)}catch(o){await B(o)}};h(H("Bookmarks")),h(M("100%")),h(O(!1)),h(W(!0)),e()},[]);const $=async(e,o)=>{try{await C.delete("/api/bookmark",{data:{problemCode:e,contestCode:o}}),b(d.filter(({problemCode:a,contestCode:n})=>!(a===e&&n===o)))}catch(a){await B(a)}},f=[{label:"Problem Code",name:"problemCode"},{label:"Problem Name",name:"problemName"},{label:"Difficulty",name:"difficulty"},{label:"Note",name:"note"},{label:"Added",name:"creationTime"},{label:"",name:"remove"}];r.useEffect(()=>{const e=setTimeout(()=>{const o=p.toLowerCase(),a=d.filter(n=>Object.keys(n).some(T=>f.some(P=>P.name===T&&String(n[T]).toLowerCase().includes(o))));y(a)},300);return()=>{clearTimeout(e)}},[p,d]);const A=e=>{w(e.target.value)},D=p?v:d,i={};D.forEach(e=>{const{courseName:o}=e;i[o]||(i[o]=[]),i[o].push(e)}
1),Object.keys(i).forEach(e=>{i[e].sort((o,a)=>{const n=new Date(o.creationTime);return new Date(a.creationTime).getTime()-n.getTime()})});const m=[];return Object.entries(i).forEach(([e,o])=>{m.push(t("tr",{className:s.courseSectionRow,children:t("td",{colSpan:f.length,children:e})},`${e}-section`)),o.forEach((a,n)=>{m.push(l("tr",{children:[t("td",{children:a.problemCode}),t("td",{children:t(N,{href:a.pathName,value:a.problemName,className:s["m-link"]})}),t("td",{children:a.difficulty===-1?"NA":a.difficulty}),t("td",{children:a.note===""?"-":l(k,{children:[t("span",{className:s.noteText,children:g[`${e}-${n}`]?a.note:a.note.length>u?`${a.note.slice(0,u)}...`:a.note}),a.note.length>u&&t("span",{className:s.textButton,role:"button",tabIndex:0,onClick:()=>E(`${e}-${n}`),children:g[`${e}-${n}`]?"less":"more"})]})}),t("td",{className:s.creationTime,children:a.creationTime===""?"-":z(a.creationTime)}),t("td",{children:t(L,{"aria-label":"Remove Problem",component:"span",onClick:()=>$(a.problemCode,a.contestCode),size:"large",children:t(I,{title:"Remove",children:t(j,{className:s.dangerIcon,fontSize:"small"})})})})]},`${e}-${n}`))})}),l(k,{children:[S&&S("bookmarks"),d?.length?l("div",{className:c(s.recentPracticeContainer,s.dark),children:[t("div",{className:c(s.practiceContainer,s.dark),children:t("div",{className:c(s.searchContainer,s.dark),children:t(R,{value:p,onChange:A,placeholder:"Search Bookmarks",variant:"outlined",size:"small",fullWidth:!0,className:s.search})})}),l("div",{className:s.bookmarkTableWrapper,children:[l("table",{className:c(s.bookmarkTable,s.dark),children:[t("thead",{children:t("tr",{children:f.map((e,o)=>t("th",{children:e.label},e.name||o))})}),m?.length>0&&t("tbody",{children:m})]}),m?.length===0&&t("div",{className:c(s.searchNoBookmark,s.dark),children:"No bookmarks found"})]})]}):l("div",{className:c(s.noBookmark,s.dark),children:["Looks like you haven’t bookmarked any problems. Start",t(N,{className:c(s.noBookmarkLink,s.dark),href:`${U()}/learn`,value:t("span",{children:"exploring"}),newTab:!0}),"now!"]})]})}export{Y 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.