From 8b9e3776d33451063c2b757813b1de256af9c5ad Mon Sep 17 00:00:00 2001 From: Nidboj132 <28981031+Nidboj132@users.noreply.github.com> Date: Fri, 22 Sep 2023 19:34:25 +0200 Subject: feat: coop leaderboards (#53) Former-commit-id: ce710d4fc8821850c64777d90405bd4ad717961d --- frontend/src/components/pages/summary.css | 34 ++++++++++++++++++------ frontend/src/components/pages/summary.js | 44 +++++++++++++++++++++++++++---- 2 files changed, 65 insertions(+), 13 deletions(-) (limited to 'frontend/src/components') diff --git a/frontend/src/components/pages/summary.css b/frontend/src/components/pages/summary.css index 6ac56eb..51f8515 100644 --- a/frontend/src/components/pages/summary.css +++ b/frontend/src/components/pages/summary.css @@ -326,21 +326,28 @@ p>span.portal-count{font-weight: bold;font-size: 100px;vertical-align: -15%;} padding: 10px 10px 0 10px; } -#leaderboard-top>span{ - display: flex; - place-items: flex-end; -} #section6>hr{border: 1px solid #2b2e46;margin: 8px 20px 0px 20px;} #leaderboard-top{ display: grid; - grid-template-columns: 7.5% 25% 7.5% 25% 20% 15%; font-size: 20px; height: 34px; padding-left: 60px; margin: 0 20px 0 20px; } +#leaderboard-top>span{ + + display: flex; + place-items: flex-end; +} + +#runner{ + display: grid; + grid-template-columns: 50% 50%; + align-items: end; +} + #page-number{ display: flex; width: auto; @@ -374,8 +381,7 @@ text-align: center; font-size: 20px; font-family: inherit; - - grid-template-columns: 3% 4.5% 25% 4% 3.5% 25% 20% 15%; + grid-template-columns: 3% 4.5% 40% 4% 3.5% 15% 15% 15%; display: grid; border: 0; @@ -391,12 +397,24 @@ text-align: center; place-items: center; height: 44px; } -.leaderboard-record>span>img{ + +.leaderboard-record>div>span>img{ height: 36px; border-radius: 50px; padding: 0; scale: .95; } +.leaderboard-record>div{ + display: grid; + grid-template-columns: 50% 50%; + place-items: left; +} +.leaderboard-record>div>span{ + display: flex; + place-items: center; + height: 44px; +} + .leaderboard-record>span>button{ background-color: #0000; border: 0; diff --git a/frontend/src/components/pages/summary.js b/frontend/src/components/pages/summary.js index dde2243..4fc30a8 100644 --- a/frontend/src/components/pages/summary.js +++ b/frontend/src/components/pages/summary.js @@ -225,6 +225,19 @@ function TimeAgo(date) { return Math.floor(seconds) + ' seconds ago'; }; +function TicksToTime(ticks) { + + let seconds = Math.floor(ticks/60) + let minutes = Math.floor(seconds/60) + let hours = Math.floor(minutes/60) + + let milliseconds = Math.floor((ticks%60)*1000/60) + seconds = seconds % 60; + minutes = minutes % 60; + + return `${hours===0?"":hours+":"}${minutes===0?"":hours>0?minutes.toString().padStart(2, '0')+":":(minutes+":")}${minutes>0?seconds.toString().padStart(2, '0'):seconds}.${milliseconds.toString().padStart(3, '0')} (${ticks})`; +} + if(data!==null){ return ( <> @@ -362,9 +375,20 @@ return ( ):(
-
+
Place - Runner + + {lbData.data.map.is_coop?( +
+ Host + Partner +
+ ):( + Runner + )} + Portals Time Date @@ -382,13 +406,23 @@ return (
{lbData.data.records.map((r, index) => ( - + {r.placement} -   {r.user.user_name} + {lbData.data.map.is_coop?( +
+   {r.host.user_name} +   {r.partner.user_name} +
+ ):( +
  {r.user.user_name}
+ )} + {r.score_count} - {r.score_time} + {TicksToTime(r.score_time)} { TimeAgo(new Date(r.record_date.replace("T"," ").replace("Z",""))) } -- cgit v1.2.3