From 9209aa906716f9e5e99ffaa4e8d56294d1635a9a Mon Sep 17 00:00:00 2001 From: hitarth Date: Mon, 12 Aug 2024 01:43:19 +0530 Subject: [PATCH] Updates --- assets/{index-CGQsRFx2.js => index-BhFw0ni_.js} | 2 +- index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename assets/{index-CGQsRFx2.js => index-BhFw0ni_.js} (99%) diff --git a/assets/index-CGQsRFx2.js b/assets/index-BhFw0ni_.js similarity index 99% rename from assets/index-CGQsRFx2.js rename to assets/index-BhFw0ni_.js index 181fd25..7c26c03 100644 --- a/assets/index-CGQsRFx2.js +++ b/assets/index-BhFw0ni_.js @@ -195,5 +195,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho * [BSD-3-Clause](https://github.com/attentif/unix-timestamp-js/blob/master/LICENSE) */const De=YN.exports={};De.Millisecond=.001;De.Second=1;De.Minute=60;De.Hour=60*De.Minute;De.Day=24*De.Hour;De.Week=7*De.Day;De.Month=30.436875*De.Day;De.Year=12*De.Month;const Zpe=new RegExp("^\\s*([-+]?)\\s*"+["y","M","w","d","h","m","s","ms"].map(function(e){return"(?:(\\d+)\\s*"+e+")?"}).join("\\s*")+"\\s*$");let gc=XN;function XN(e){return e}function X2(e){return Math.round(e)}Object.defineProperty(De,"round",{get:function(){return gc===X2},set:function(e){gc=e?X2:XN}});De.now=function(e){const t=Date.now()/1e3;return gc(e?De.add(t,e):t)};De.add=function(e,t){if(!$0(e))throw new Error("Time must be a number");if(qN(t)){const r=Zpe.exec(t);if(!r)throw new Error("Expected offset string format: [+|-] [{years}y] [{months}M] [{weeks}w] [{days}d] [{hours}h] [{minutes}m] [{seconds}s] [{milliseconds}ms]");t=(r[1]==="-"?-1:1)*((r[2]||0)*De.Year+(r[3]||0)*De.Month+(r[4]||0)*De.Week+(r[5]||0)*De.Day+(r[6]||0)*De.Hour+(r[7]||0)*De.Minute+(r[8]||0)*De.Second+(r[9]||0)*De.Millisecond)}else if(!$0(t))throw new Error("Offset must be either a string or a number");return gc(e+t)};De.duration=function(e){return De.add(0,e)};De.fromDate=function(e){if(qN(e))e=new Date(e);else if(!Qpe(e))throw new Error("Expected either a string or a date");return gc(e.getTime()/1e3)};De.toDate=function(e){if(!$0(e))throw new Error("Expected a number");return new Date(e*1e3)};function qN(e){return typeof e=="string"||Object.prototype.toString.call(e)==="[object String]"}function $0(e){return typeof e=="number"||Object.prototype.toString.call(e)==="[object Number]"}function Qpe(e){return Object.prototype.toString.call(e)==="[object Date]"}var Jpe=YN.exports;const bc=ke(Jpe),ehe=({active:e,payload:t,label:r})=>{var n;if(e&&t&&t.length){const o=t[0].payload;return C.jsxs("div",{className:"custom-tooltip",style:{backgroundColor:"#fff",padding:"10px",border:"1px solid #ccc"},children:[C.jsx("p",{className:"label",children:`Rank: ${o.rank}`}),C.jsx("p",{className:"label",children:`Date: ${bc.toDate(o.ratingUpdateTimeSeconds).toDateString().slice(4)} `}),C.jsx("p",{className:"intro",children:`Contest Name: ${o.contestName}`}),C.jsx("p",{className:"delta",children:`Delta: ${o.newRating>=o.oldRating?"+":""} ${o.newRating-o.oldRating}`}),C.jsx("p",{className:"desc",children:`New Rating: ${o.newRating}`}),C.jsx("p",{className:"totalProbs",children:`Total Problems solved: ${(n=o==null?void 0:o.counts)==null?void 0:n.total}`})]})}return null},the=()=>{const[e,t]=v.useState([]),r=ys(m=>m.user.ratingGraph),n=ys(m=>m.user.problemsSolved);if(r.length===0)throw new Error(`No contest data to show here. - User probably has not participated in any contests yet.`);const o=[...n].reverse(),i=r.map(m=>({...m})),a={total:0};let s=0;for(let m=0;m=i.length)break;i[s].counts={...a},console.log(a),v.useEffect(()=>{const m=i.map(g=>({...g,date:bc.toDate(g.ratingUpdateTimeSeconds).toLocaleDateString("en-US",{year:"numeric",month:"short"})}));t(m)},[r,n]);const[l,u]=v.useState({}),c=1,f=e.length>10?Math.floor(e.length/10):0;let d=r[r.length-1].newRating;d=Number(Math.max(...r.map(m=>m.newRating)));const p=[1200,1400,1600,1900,2100,2300,2400,2600,3e3],h=p.filter(m=>m<=d);return h.push(p[h.length]),C.jsxs("div",{className:"h-96 w-[100%]",children:[C.jsx("div",{className:"border-b border-[#2e3135] pb-2 font-spaceMono font-medium",children:"# Rating v/s Problems Solved Chart"}),C.jsx(Ste,{width:"100%",height:"100%",className:"overflow-hidden",children:C.jsxs(qpe,{width:500,height:300,onMouseDown:m=>{console.log(m),u(m.activePayload[0].payload)},data:e,margin:{top:5,right:30,left:20,bottom:5},children:[C.jsx("defs",{children:C.jsx("filter",{id:"shadow",height:"130%",children:C.jsx("feDropShadow",{dx:"3",dy:"3",stdDeviation:"2",floodColor:"#00000050"})})}),C.jsx(Ut,{stroke:"#54545430",strokeWidth:1.3,y1:0,y2:1200,fill:"#cccccc",fillOpacity:c}),C.jsx(Ut,{stroke:"#54545430",strokeWidth:1.3,y1:1200,y2:1400,fill:"#77ff77",fillOpacity:c}),C.jsx(Ut,{stroke:"#54545430",strokeWidth:1.3,y1:1400,y2:1600,fill:"#77ddbb",fillOpacity:c}),C.jsx(Ut,{stroke:"#54545430",strokeWidth:1.3,y1:1600,y2:1900,fill:"#9eb1ff",fillOpacity:c}),C.jsx(Ut,{stroke:"#54545430",strokeWidth:1.3,y1:1900,y2:2100,fill:"#e97ee9",fillOpacity:c}),C.jsx(Ut,{stroke:"#54545430",strokeWidth:1.3,y1:2100,y2:2300,fill:"#e9ac50",fillOpacity:c}),C.jsx(Ut,{stroke:"#54545430",strokeWidth:1.3,y1:2300,y2:2400,fill:"#f7963c",fillOpacity:c}),C.jsx(Ut,{stroke:"#54545430",strokeWidth:1.3,y1:2400,y2:2600,fill:"#e96e6e",fillOpacity:c}),C.jsx(Ut,{stroke:"#54545430",strokeWidth:1.3,y1:2600,y2:3e3,fill:"#ff3333",fillOpacity:c}),C.jsx(Ut,{stroke:"#54545430",strokeWidth:1.3,y1:3e3,y2:3500,fill:"#b22323",fillOpacity:c}),C.jsx(Ut,{stroke:"#54545430",strokeWidth:1.3,y1:3500,fill:"#b22323",fillOpacity:c}),C.jsx(IN,{strokeDasharray:"",stroke:"#54545460",strokeWidth:1.3,horizontal:!1,strokeOpacity:.5}),C.jsx(ym,{dataKey:"counts.total",tick:{fontSize:12},interval:f}),C.jsx(gm,{ticks:h,tickCount:1,interval:0,fontSize:13}),C.jsx(Rn,{layout:"vertical",verticalAlign:"top",wrapperStyle:{color:"#000",fontSize:12},content:C.jsx(ehe,{})}),C.jsx(Es,{}),C.jsx(Vc,{type:"linear",dataKey:"newRating",stroke:"#ecbe3f",name:"Problems Solved",strokeWidth:2,activeDot:{r:6},dot:{stroke:"#ecbe3f",fill:"#fff",r:3.8,filter:""},filter:"url(#shadow)"})]})}),C.jsx("div",{className:"flex items-center justify-center font-spaceMono",children:C.jsxs("div",{className:"flex w-full justify-between sm:px-10",children:[l.rank&&C.jsxs("div",{className:"flex-col justify-start",children:[C.jsx("p",{className:"text-lg font-bold",children:`Rank: ${l.rank}`}),C.jsx("p",{className:"text-sm",children:`Date: ${bc.toDate(l.ratingUpdateTimeSeconds).toDateString().slice(4)} + User probably has not participated in any contests yet.`);const o=[...n].reverse(),i=r.map(m=>({...m})),a={total:0};let s=0;for(let m=0;m=i.length)break;i[s].counts={...a},v.useEffect(()=>{const m=i.map(g=>({...g,date:bc.toDate(g.ratingUpdateTimeSeconds).toLocaleDateString("en-US",{year:"numeric",month:"short"})}));t(m)},[r,n]);const[l,u]=v.useState({}),c=1,f=e.length>10?Math.floor(e.length/10):0;let d=r[r.length-1].newRating;d=Number(Math.max(...r.map(m=>m.newRating)));const p=[1200,1400,1600,1900,2100,2300,2400,2600,3e3],h=p.filter(m=>m<=d);return h.push(p[h.length]),C.jsxs("div",{className:"h-96 w-[100%]",children:[C.jsx("div",{className:"border-b border-[#2e3135] pb-2 font-spaceMono font-medium",children:"# Rating v/s Problems Solved Chart"}),C.jsx(Ste,{width:"100%",height:"100%",className:"overflow-hidden",children:C.jsxs(qpe,{width:500,height:300,onMouseDown:m=>{u(m.activePayload[0].payload)},data:e,margin:{top:5,right:30,left:20,bottom:5},children:[C.jsx("defs",{children:C.jsx("filter",{id:"shadow",height:"130%",children:C.jsx("feDropShadow",{dx:"3",dy:"3",stdDeviation:"2",floodColor:"#00000050"})})}),C.jsx(Ut,{stroke:"#54545430",strokeWidth:1.3,y1:0,y2:1200,fill:"#cccccc",fillOpacity:c}),C.jsx(Ut,{stroke:"#54545430",strokeWidth:1.3,y1:1200,y2:1400,fill:"#77ff77",fillOpacity:c}),C.jsx(Ut,{stroke:"#54545430",strokeWidth:1.3,y1:1400,y2:1600,fill:"#77ddbb",fillOpacity:c}),C.jsx(Ut,{stroke:"#54545430",strokeWidth:1.3,y1:1600,y2:1900,fill:"#9eb1ff",fillOpacity:c}),C.jsx(Ut,{stroke:"#54545430",strokeWidth:1.3,y1:1900,y2:2100,fill:"#e97ee9",fillOpacity:c}),C.jsx(Ut,{stroke:"#54545430",strokeWidth:1.3,y1:2100,y2:2300,fill:"#e9ac50",fillOpacity:c}),C.jsx(Ut,{stroke:"#54545430",strokeWidth:1.3,y1:2300,y2:2400,fill:"#f7963c",fillOpacity:c}),C.jsx(Ut,{stroke:"#54545430",strokeWidth:1.3,y1:2400,y2:2600,fill:"#e96e6e",fillOpacity:c}),C.jsx(Ut,{stroke:"#54545430",strokeWidth:1.3,y1:2600,y2:3e3,fill:"#ff3333",fillOpacity:c}),C.jsx(Ut,{stroke:"#54545430",strokeWidth:1.3,y1:3e3,y2:3500,fill:"#b22323",fillOpacity:c}),C.jsx(Ut,{stroke:"#54545430",strokeWidth:1.3,y1:3500,fill:"#b22323",fillOpacity:c}),C.jsx(IN,{strokeDasharray:"",stroke:"#54545460",strokeWidth:1.3,horizontal:!1,strokeOpacity:.5}),C.jsx(ym,{dataKey:"counts.total",tick:{fontSize:12},interval:f}),C.jsx(gm,{ticks:h,tickCount:1,interval:0,fontSize:13}),C.jsx(Rn,{layout:"vertical",verticalAlign:"top",wrapperStyle:{color:"#000",fontSize:12},content:C.jsx(ehe,{})}),C.jsx(Es,{}),C.jsx(Vc,{type:"linear",dataKey:"newRating",stroke:"#ecbe3f",name:"Problems Solved",strokeWidth:2,activeDot:{r:6},dot:{stroke:"#ecbe3f",fill:"#fff",r:3.8,filter:""},filter:"url(#shadow)"})]})}),C.jsx("div",{className:"flex items-center justify-center font-spaceMono",children:C.jsxs("div",{className:"flex w-full justify-between sm:px-10",children:[l.rank&&C.jsxs("div",{className:"flex-col justify-start",children:[C.jsx("p",{className:"text-lg font-bold",children:`Rank: ${l.rank}`}),C.jsx("p",{className:"text-sm",children:`Date: ${bc.toDate(l.ratingUpdateTimeSeconds).toDateString().slice(4)} `}),C.jsx("p",{className:"text-sm",children:`Contest Name: ${l.contestName}`}),C.jsx("p",{className:"text-sm",children:`Delta: ${l.newRating>=l.oldRating?"+":""} ${l.newRating-l.oldRating}`}),C.jsx("p",{className:"text-sm",children:`New Rating: ${l.newRating}`}),C.jsx("p",{className:"text-sm",children:`Total Problems solved: ${l.counts.total}`})]}),C.jsxs("div",{className:"flex-col items-center justify-center",children:[l.counts?C.jsx("div",{className:"mb-2 text-nowrap border border-gray-500 text-center font-spaceMono font-bold",children:"Total Problems Solved"}):C.jsx("div",{className:"font-spaceMono text-sm",children:"Click on the dots to view detailed stats"}),C.jsx("div",{className:"grid grid-flow-col grid-cols-3 grid-rows-5 gap-x-6 text-nowrap",children:l.counts&&Object.keys(l.counts).map(m=>m!=="total"?C.jsxs("div",{className:"flex gap-x-1 text-sm",children:[C.jsx("p",{className:"font-medium",style:{color:Xd(m)},children:`${m} :`}),C.jsx("p",{children:`${l.counts[m]}`})]}):null)})]})]})})]})};function rhe(){return C.jsx("div",{className:"w-[100%] h-96",children:C.jsx(the,{})})}function nhe({setStyleBlur:e}){const{problemsSolved:t,correctSubmissions:r,skippedSubmissions:n}=ys(o=>o.user);return C.jsx("div",{className:"",children:C.jsxs(rM,{defaultValue:"psolved",children:[C.jsxs(nM,{children:[C.jsx(Dl,{value:"profile",children:"Profile"}),C.jsx(Dl,{value:"psolved",children:"Problems Solved"}),C.jsx(Dl,{value:"correct",children:"Correct Submissions"}),C.jsx(Dl,{value:"skipped",children:"Skipped Submissions"})]}),C.jsxs(eb,{pt:"3",children:[C.jsx(Il,{value:"profile",children:C.jsx(rhe,{})}),C.jsx(Il,{value:"psolved",children:C.jsx(vv,{data:t})}),C.jsx(Il,{value:"correct",children:C.jsx(vv,{data:r})}),C.jsx(Il,{value:"skipped",children:C.jsx(wr,{size:"2",children:C.jsx(vv,{data:n})})})]})]})})}function ohe(){const e=lh(),[t,r]=v.useState(!0),n=Th();v.useEffect(()=>{n(ez(e.id)),n(tz(e.id)),r(!0)},[n,e.id]);const{problemsSolved:o,correctSubmissions:i,skippedSubmissions:a,isLoading:s,errorMsg:l}=ys(u=>u.user);return v.useEffect(()=>{s||setTimeout(()=>r(!1),500)},[s]),s?C.jsx(MM,{}):l?C.jsx(Ko,{text:l}):o.length+i.length+a.length===0?C.jsx(Ko,{title:"No data to show here !",text:"User has not made any submissions yet.",type:"info"}):C.jsx("div",{className:`mt-8 transition-all duration-300 ease-in-out sm:mx-4 lg:mx-14 ${t?"opacity-0 blur-md":""}`,children:C.jsx(nhe,{})})}function ihe({solutions:e,isLoadingRatings:t}){const[r,n]=v.useState(e),[o,i]=v.useState(r),[a,s]=v.useState({rating:"Rating",lang:"Lang"});v.useEffect(()=>{n(e),i(e)},[e]);function l(){s({...a,rating:"Asc"});const _=[...o].sort((T,$)=>T.rating-$.rating);i(_)}function u(){s({rating:"Rating",lang:"Lang"}),i(r)}function c(){s({...a,rating:"Desc"});const _=[...o].sort((T,$)=>$.rating-T.rating);i(_)}function f(_){s({rating:"Rating",lang:_});const T=[...r].filter($=>$.programmingLanguage.includes(_)?$:null);i(T)}function d(){const _=[...o].sort((T,$)=>T.timeConsumedMillis-$.timeConsumedMillis);i(_)}function p(){const _=[...o].sort((T,$)=>$.timeConsumedMillis-T.timeConsumedMillis);i(_)}const[h,m]=v.useState(100),[g,b]=v.useState(0),[y,w]=v.useState([]);v.useEffect(()=>{const _=g*h,T=_+h;w(o.slice(_,T))},[o,g,h]);const S=ys(_=>_.solutions).numberOfSubmissions,E=Th(),O=lh();function P(_){_>0&&(console.log("searching again"),E(TM(_)),E($M(O.contest,O.index,_)))}return C.jsxs("div",{children:[C.jsxs("div",{className:"flex justify-between gap-x-2",children:[C.jsxs(hs,{align:"center",className:"gap-2",children:[C.jsx(wr,{size:"1",children:"Submissions to Fetch: "}),C.jsx(Vr,{size:"1",variant:"soft",color:S===8e3?"indigo":"gray",onClick:()=>{P(8e3)},children:"8K"}),C.jsx(Vr,{size:"1",variant:"soft",color:S===2e4?"indigo":"gray",onClick:()=>{P(2e4)},children:"20K"}),C.jsx(Vr,{size:"1",variant:"soft",color:S===5e4?"indigo":"gray",onClick:()=>{P(5e4)},children:"50K"}),C.jsx(sM,{color:"gray",height:20,width:20}),C.jsxs(Ur,{color:"gray",variant:"outline",size:"1",children:["Correct Submissions: ",o.length]})]}),C.jsx(jM,{arraySize:o.length,pageSize:h,setPageSize:m,pageNo:g,setPageNo:b,page:y,setPage:w,position:"relative"})]}),C.jsxs(gb,{children:[C.jsx(bb,{children:C.jsxs(Mu,{children:[C.jsx(xr,{children:"No."}),C.jsx(xr,{children:"#"}),C.jsx(xr,{children:"Who"}),C.jsx(xr,{children:C.jsxs(Qa,{modal:!1,children:[C.jsx(Ja,{children:C.jsxs(Vr,{size:"1",variant:"soft",color:"gray",children:[a.rating,C.jsx(Za,{})]})}),C.jsxs(es,{size:"1",children:[C.jsx(ht,{shortcut:C.jsx(eg,{}),onClick:u,children:"Default"}),C.jsx(ht,{shortcut:C.jsx(Qy,{}),onClick:l,children:"Ascending"}),C.jsx(ht,{shortcut:C.jsx(Jy,{}),onClick:c,children:"Descending"})]})]})}),C.jsx(xr,{children:"Date"}),C.jsx(xr,{children:C.jsxs(Qa,{modal:!1,children:[C.jsx(Ja,{children:C.jsxs(Vr,{size:"1",variant:"soft",color:"gray",children:[a.lang,C.jsx(Za,{})]})}),C.jsxs(es,{size:"1",children:[C.jsx(ht,{onClick:u,color:"gray",shortcut:C.jsx(H7,{}),children:"All"}),C.jsx(ht,{onClick:()=>f("C++"),children:"C++"}),C.jsx(ht,{onClick:()=>f("Java "),children:"Java"}),C.jsx(ht,{onClick:()=>f("Pyt"),children:"Python"}),C.jsx(ht,{onClick:()=>f("PyPy"),children:"PyPy"}),C.jsx(ht,{onClick:()=>f("JavaScript"),children:"JavaScript"}),C.jsx(ht,{onClick:()=>f("Rust"),children:"Rust"}),C.jsx(ht,{onClick:()=>f("Go"),children:"Go"})]})]})}),C.jsx(xr,{children:C.jsxs(Qa,{modal:!1,children:[C.jsx(Ja,{children:C.jsxs(Vr,{size:"1",variant:"soft",color:"gray",children:["Time",C.jsx(Za,{})]})}),C.jsxs(es,{size:"1",children:[C.jsx(ht,{shortcut:C.jsx(eg,{}),onClick:u,children:"Default"}),C.jsx(ht,{shortcut:C.jsx(Qy,{}),onClick:d,children:"Ascending"}),C.jsx(ht,{shortcut:C.jsx(Jy,{}),onClick:p,children:"Descending"})]})]})}),C.jsx(xr,{children:"Memory"})]})}),C.jsx(wb,{className:"",children:y.map((_,T)=>C.jsxs(Mu,{style:{color:"#888888"},children:[C.jsx(Kr,{children:g*h+T+1}),C.jsx(Wd,{children:C.jsx(vs,{href:`https://codeforces.com/contest/${_.contestId}/submission/${_.id}`,target:"_blank",children:_.id})}),C.jsx(Wd,{children:C.jsx(vs,{style:{color:Xd(_.rating||0)},href:`https://codeforces.com/profile/${_.author.members[0].handle}`,target:"_blank",children:`${_.author.members[0].handle}`})}),C.jsx(Kr,{children:C.jsx("div",{style:{color:Xd(_.rating||0)},size:"1",color:"gray",variant:"outline",children:t?C.jsx(tb,{}):_.rating!==-1?_.rating:"-"})}),C.jsx(Kr,{children:C.jsxs("div",{className:"flex items-center gap-1",children:[C.jsx("div",{className:"text-nowrap",children:`${bc.toDate(_.creationTimeSeconds).toDateString().slice(4)}`}),C.jsx("span",{children:"-"}),C.jsx("div",{className:"text-[.7rem]",children:`${bc.toDate(_.creationTimeSeconds).toTimeString().slice(0,5)}`})]})}),C.jsx(Kr,{children:_.programmingLanguage}),C.jsxs(Kr,{children:[_.timeConsumedMillis," ms"]}),C.jsxs(Kr,{children:[Math.round(_.memoryConsumedBytes/1e3)," KB"]})]},_.id))})]})]})}function ahe(){const e=lh(),[t,r]=v.useState(!0),n=Th();v.useEffect(()=>{n(TM(8e3)),n($M(e.contest,e.index)),r(!0)},[n,e.contest,e.index]);const{solutions:o,ratings:i,isLoading:a,isLoadingRatings:s,errorMsg:l,errorMsgRatings:u}=ys(c=>c.solutions);return v.useEffect(()=>{!a&&o.length>0&&setTimeout(()=>r(!1),100)},[a,o.length]),a?C.jsx(MM,{}):l?C.jsx(Ko,{text:l}):o.length===0?C.jsx(Ko,{title:"No data to show here !",text:"No accepted submissions found.",type:"info"}):C.jsx("div",{className:`mt-8 transition-all duration-300 ease-in-out sm:mx-4 lg:mx-14 ${t?" blur-md":""}`,children:C.jsx(ihe,{solutions:o,isLoadingRatings:s})})}const she=K4([{element:C.jsx(VS,{}),errorElement:C.jsx(VS,{props:C.jsx(Ko,{})}),children:[{path:"/",element:C.jsx(lz,{}),errorElement:C.jsx(Ko,{})},{path:"/user/:id",element:C.jsx(ohe,{}),errorElement:C.jsx(Ko,{})},{path:"/problem/:contest/:index",element:C.jsx(ahe,{}),errorElement:C.jsx(Ko,{})}]}],{basename:"/codeforces-explorer"});function lhe(){return C.jsx(t8,{router:she})}const uhe=AF({reducer:{user:JF,solutions:oz}});Kv.createRoot(document.getElementById("root")).render(C.jsx(WB,{store:uhe,children:C.jsx(lhe,{})})); diff --git a/index.html b/index.html index 7bfb236..23ecd2b 100644 --- a/index.html +++ b/index.html @@ -35,7 +35,7 @@ })(window.location); - +