From bf0bd7cbe626e4cffbe11dcdce4b92050ad08867 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 21 Feb 2024 18:25:14 +0000 Subject: [PATCH 1/8] build(deps): bump ip from 1.1.5 to 1.1.9 Bumps [ip](https://github.com/indutny/node-ip) from 1.1.5 to 1.1.9. - [Commits](https://github.com/indutny/node-ip/compare/v1.1.5...v1.1.9) --- updated-dependencies: - dependency-name: ip dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 6ef217c..46308f7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9774,9 +9774,9 @@ ip-regex@^2.1.0: integrity sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk= ip@^1.1.0, ip@^1.1.5: - version "1.1.5" - resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.5.tgz#bdded70114290828c0a039e72ef25f5aaec4354a" - integrity sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo= + version "1.1.9" + resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.9.tgz#8dfbcc99a754d07f425310b86a99546b1151e396" + integrity sha512-cyRxvOEpNHNtchU3Ln9KC/auJgup87llfQpQ+t5ghoC/UhL16SWzbueiCsdTnWmqAWl7LadfuwhlqmtOaqMHdQ== ipaddr.js@1.9.1, ipaddr.js@^1.9.0: version "1.9.1" From 73b273018361b25e0dc72fb1011116bf9a32f611 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markku=20M=C3=A4kitalo?= <20476051+makitalo@users.noreply.github.com> Date: Thu, 22 Feb 2024 23:10:43 +0200 Subject: [PATCH 2/8] feat(levels): show own time in LevelList --- src/features/LevelList/index.jsx | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/features/LevelList/index.jsx b/src/features/LevelList/index.jsx index bb61773..11aade9 100644 --- a/src/features/LevelList/index.jsx +++ b/src/features/LevelList/index.jsx @@ -38,6 +38,7 @@ export default function LevelList({ const [searchQuery, setSearchQuery] = useState(''); const [page, setPage] = useState(defaultPage); const [pageSize] = useState(defaultPageSize); + const { loggedIn } = useStoreState(state => state.Login); const { levels, tagOptions, kuskiOptions, loadingLevels } = useStoreState( state => state.LevelList, ); @@ -104,8 +105,9 @@ export default function LevelList({ 'Added', 'Filename', 'Level name', - 'By', + 'Added by', 'Best time', + 'My time', 'Battles', 'Apples', 'Killers', @@ -262,11 +264,12 @@ export default function LevelList({ Added Filename Level name - By + Added by Best time + {loggedIn && My time} Battles Apples - Kiilers + Killers {!summary && ( <> @@ -297,7 +300,7 @@ export default function LevelList({ {columns.indexOf('Level name') !== -1 && ( {level.LongName} )} - {columns.indexOf('By') !== -1 && ( + {columns.indexOf('Added by') !== -1 && ( {level.KuskiData ? ( @@ -311,6 +314,11 @@ export default function LevelList({ {level.Besttime ? )} + {loggedIn && columns.indexOf('My time') !== -1 && ( + + {level.Mytime ? + )} {columns.indexOf('Battles') !== -1 && ( {level.BattleCount || '-'} )} @@ -320,9 +328,6 @@ export default function LevelList({ {columns.indexOf('Killers') !== -1 && ( {level.Killers} )} - {columns.indexOf('Unlisted') !== -1 && ( - {level.Unlisted === 1 ? 'Yes' : ''} - )} {columns.indexOf('Tags') !== -1 && ( From 761d9696abd74e92a742158347e5dd3aab7c577a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 27 Feb 2024 11:11:23 +0000 Subject: [PATCH 3/8] build(deps): bump es5-ext from 0.10.53 to 0.10.63 Bumps [es5-ext](https://github.com/medikoo/es5-ext) from 0.10.53 to 0.10.63. - [Release notes](https://github.com/medikoo/es5-ext/releases) - [Changelog](https://github.com/medikoo/es5-ext/blob/main/CHANGELOG.md) - [Commits](https://github.com/medikoo/es5-ext/compare/v0.10.53...v0.10.63) --- updated-dependencies: - dependency-name: es5-ext dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 50 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 13 deletions(-) diff --git a/yarn.lock b/yarn.lock index 6ef217c..4f5cf2a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7574,21 +7574,22 @@ es-to-primitive@^1.2.1: is-date-object "^1.0.1" is-symbol "^1.0.2" -es5-ext@^0.10.35, es5-ext@^0.10.50: - version "0.10.53" - resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.53.tgz#93c5a3acfdbef275220ad72644ad02ee18368de1" - integrity sha512-Xs2Stw6NiNHWypzRTY1MtaG/uJlwCk8kH81920ma8mvN8Xq1gsfhZvpkImLQArw8AHnv8MT2I45J3c0R8slE+Q== +es5-ext@^0.10.35, es5-ext@^0.10.50, es5-ext@^0.10.62, es5-ext@~0.10.14: + version "0.10.63" + resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.63.tgz#9c222a63b6a332ac80b1e373b426af723b895bd6" + integrity sha512-hUCZd2Byj/mNKjfP9jXrdVZ62B8KuA/VoK7X8nUh5qT+AxDmcbvZz041oDVZdbIN1qW6XY9VDNwzkvKnZvK2TQ== dependencies: - es6-iterator "~2.0.3" - es6-symbol "~3.1.3" - next-tick "~1.0.0" + es6-iterator "^2.0.3" + es6-symbol "^3.1.3" + esniff "^2.0.1" + next-tick "^1.1.0" es5-shim@^4.5.13: version "4.5.15" resolved "https://registry.yarnpkg.com/es5-shim/-/es5-shim-4.5.15.tgz#6a26869b261854a3b045273f5583c52d390217fe" integrity sha512-FYpuxEjMeDvU4rulKqFdukQyZSTpzhg4ScQHrAosrlVpR6GFyaw14f74yn2+4BugniIS0Frpg7TvwZocU4ZMTw== -es6-iterator@2.0.3, es6-iterator@~2.0.3: +es6-iterator@2.0.3, es6-iterator@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.3.tgz#a7de889141a05a94b0854403b2d0a0fbfa98f3b7" integrity sha1-p96IkUGgWpSwhUQDstCg+/qY87c= @@ -7602,7 +7603,7 @@ es6-shim@^0.35.5: resolved "https://registry.yarnpkg.com/es6-shim/-/es6-shim-0.35.6.tgz#d10578301a83af2de58b9eadb7c2c9945f7388a0" integrity sha512-EmTr31wppcaIAgblChZiuN/l9Y7DPyw8Xtbg7fIVngn6zMW+IEBJDJngeKC3x6wr0V/vcA2wqeFnaw1bFJbDdA== -es6-symbol@^3.1.1, es6-symbol@~3.1.3: +es6-symbol@^3.1.1, es6-symbol@^3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.3.tgz#bad5d3c1bcdac28269f4cb331e431c78ac705d18" integrity sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA== @@ -7890,6 +7891,16 @@ eslint@^7.11.0: text-table "^0.2.0" v8-compile-cache "^2.0.3" +esniff@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/esniff/-/esniff-2.0.1.tgz#a4d4b43a5c71c7ec51c51098c1d8a29081f9b308" + integrity sha512-kTUIGKQ/mDPFoJ0oVfcmyJn4iBDRptjNVIzwIFR7tqWXdVI9xfA2RMwY/gbSpJG3lkdWNEjLap/NqVHZiJsdfg== + dependencies: + d "^1.0.1" + es5-ext "^0.10.62" + event-emitter "^0.3.5" + type "^2.7.2" + espree@^7.3.0: version "7.3.0" resolved "https://registry.yarnpkg.com/espree/-/espree-7.3.0.tgz#dc30437cf67947cf576121ebd780f15eeac72348" @@ -7958,6 +7969,14 @@ etag@~1.8.1: resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" integrity sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg== +event-emitter@^0.3.5: + version "0.3.5" + resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.5.tgz#df8c69eef1647923c7157b9ce83840610b02cc39" + integrity sha512-D9rRn9y7kLPnJ+hMq7S/nhvoKwwvVJahBi2BPmx3bvbsEdK3W9ii8cBSGjP+72/LnM4n6fo3+dkCX5FeTQruXA== + dependencies: + d "1" + es5-ext "~0.10.14" + eventemitter3@^4.0.0, eventemitter3@^4.0.1, eventemitter3@^4.0.4: version "4.0.7" resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f" @@ -11984,10 +12003,10 @@ nested-error-stacks@^2.0.0, nested-error-stacks@^2.1.0: resolved "https://registry.yarnpkg.com/nested-error-stacks/-/nested-error-stacks-2.1.0.tgz#0fbdcf3e13fe4994781280524f8b96b0cdff9c61" integrity sha512-AO81vsIO1k1sM4Zrd6Hu7regmJN1NSiAja10gc4bX3F0wd+9rQmcuHQaHVQCYIEC8iFXnE+mavh23GOt7wBgug== -next-tick@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c" - integrity sha1-yobR/ogoFpsBICCOPchCS524NCw= +next-tick@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.1.0.tgz#1836ee30ad56d67ef281b22bd199f709449b35eb" + integrity sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ== nice-try@^1.0.4: version "1.0.5" @@ -16619,6 +16638,11 @@ type@^2.0.0: resolved "https://registry.yarnpkg.com/type/-/type-2.1.0.tgz#9bdc22c648cf8cf86dd23d32336a41cfb6475e3f" integrity sha512-G9absDWvhAWCV2gmF1zKud3OyC61nZDwWvBL2DApaVFogI07CprggiQAOOjvp2NRjYWFzPyu7vwtDrQFq8jeSA== +type@^2.7.2: + version "2.7.2" + resolved "https://registry.yarnpkg.com/type/-/type-2.7.2.tgz#2376a15a3a28b1efa0f5350dcf72d24df6ef98d0" + integrity sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw== + typedarray-to-buffer@^3.1.5: version "3.1.5" resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080" From bb5c78880b56b1fee3bda249d4f48e2e67564625 Mon Sep 17 00:00:00 2001 From: Sune Date: Tue, 27 Feb 2024 21:22:47 +0100 Subject: [PATCH 4/8] feat(cups): sort and filter personal times --- src/pages/cup/Personal.jsx | 131 ++++++++++++++++++++++++++++++------- src/pages/cup/store.js | 12 ++++ 2 files changed, 120 insertions(+), 23 deletions(-) diff --git a/src/pages/cup/Personal.jsx b/src/pages/cup/Personal.jsx index 3b97a53..c1a26b7 100644 --- a/src/pages/cup/Personal.jsx +++ b/src/pages/cup/Personal.jsx @@ -1,10 +1,15 @@ -/* eslint-disable react/no-danger */ import React, { useEffect, Fragment, useState } from 'react'; import styled from 'styled-components'; import { nickId } from 'utils/nick'; import { forEach } from 'lodash'; import { format } from 'date-fns'; -import { Grid, Checkbox } from '@material-ui/core'; +import { + Grid, + Checkbox, + RadioGroup, + FormControlLabel, + Radio, +} from '@material-ui/core'; import { Paper } from 'components/Paper'; import Header from 'components/Header'; import LocalTime from 'components/LocalTime'; @@ -14,6 +19,7 @@ import Recplayer from 'components/Recplayer'; import { getPrivateCupRecUri } from 'utils/cups'; import PreviewRecButton from 'components/PreviewRecButton'; import config from 'config'; +import FieldBoolean from 'components/FieldBoolean'; const eventSort = (a, b) => a.CupIndex - b.CupIndex; @@ -31,10 +37,15 @@ const currentEventIndex = events => { }; const Personal = () => { - const { myReplays, cup, events, myTimes } = useStoreState(state => state.Cup); - const { getMyReplays, updateReplay, getMyTimes } = useStoreActions( - actions => actions.Cup, + const { myReplays, cup, events, myTimes, myTimesOptions } = useStoreState( + state => state.Cup, ); + const { + getMyReplays, + updateReplay, + getMyTimes, + setMyTimesOptions, + } = useStoreActions(actions => actions.Cup); const [previewRecIndex, setPreviewRecIndex] = useState(null); @@ -62,6 +73,32 @@ const Personal = () => { setPreviewRecIndex(newIndex); }; + const timesSort = (a, b) => { + if (myTimesOptions.order === 'byTime') { + return a.Time - b.Time; + } + if (myTimesOptions.order === 'byDriven') { + return a.Driven - b.Driven; + } + }; + + const timesFilter = times => { + if (myTimesOptions.onlyImproved) { + const improved = []; + times + .sort((a, b) => a.Driven - b.Driven) + .forEach((t, i) => { + if (i === 0) { + improved.push(t); + } else if (t.Time < improved[improved.length - 1].Time) { + improved.push(t); + } + }); + return improved; + } + return times; + }; + return ( {nickId() > 0 && ( @@ -140,12 +177,47 @@ const Personal = () => {
Current event times
-
+ This shows your online times for current event. Can be used to verify that your times was registered on the server, as you can't see these anywhere else. Apples results are not shown here. -
+ + + setMyTimesOptions({ + ...myTimesOptions, + order: n.target.value, + }) + } + name="weeks" + row + > + } + /> + } + /> + + + setMyTimesOptions({ + ...myTimesOptions, + onlyImproved: !myTimesOptions.onlyImproved, + }) + } + /> {myTimes && ( <> {events.sort(eventSort).map((e, i) => { @@ -158,22 +230,24 @@ const Personal = () => {
Event {i + 1}
- {myTimesInLev[0].times.map(t => ( - -
-
- - ( - - ) - -
- ))} + {timesFilter(myTimesInLev[0].times) + .sort(timesSort) + .map(t => ( + +
+
+ + ( + + ) + +
+ ))} ); })} @@ -205,4 +279,15 @@ const Container = styled.div` padding: 8px; `; +const RadioThin = styled(Radio)` + && { + padding-top: 0; + padding-bottom: 0; + } +`; + +const MyTimesDesc = styled.div` + margin-bottom: ${p => p.theme.padSmall}; +`; + export default Personal; diff --git a/src/pages/cup/store.js b/src/pages/cup/store.js index 0dab61d..8b4854c 100644 --- a/src/pages/cup/store.js +++ b/src/pages/cup/store.js @@ -133,6 +133,18 @@ export default { actions.pushMyTimes({ times: times.data, level: payload.LevelIndex }); } }), + myTimesOptions: persist( + { + order: 'byTime', + onlyImproved: false, + }, + { + storage: 'localStorage', + }, + ), + setMyTimesOptions: action((state, payload) => { + state.myTimesOptions = payload; + }), teamReplays: [], teamOptions: persist( { From 09f1b9d231c5c1079ae00d2823c9de48f3782800 Mon Sep 17 00:00:00 2001 From: Sune Date: Wed, 28 Feb 2024 22:32:51 +0100 Subject: [PATCH 5/8] feat(cups): events list - link to level page --- src/pages/cup/Events.jsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/pages/cup/Events.jsx b/src/pages/cup/Events.jsx index d0322ef..61d2ac5 100644 --- a/src/pages/cup/Events.jsx +++ b/src/pages/cup/Events.jsx @@ -12,6 +12,7 @@ import Download from 'components/Download'; import EventItem from 'components/EventItem'; import config from 'config'; import { Paper } from 'components/Paper'; +import { Level } from 'components/Names'; import { admins } from 'utils/cups'; import { nickId } from 'utils/nick'; import Interviews from './Interviews'; @@ -68,9 +69,15 @@ const Cups = props => { ) } level={ - - {e.Level ? e.Level.LevelName : ''} - + e.Level ? ( + <> + + {`${e.Level.LevelName}.lev`} + + <> - + + + ) : null } by={} eventTime={ From 8bf69dc7809e6b3b0899cea89dda94094255d322 Mon Sep 17 00:00:00 2001 From: Sune Date: Tue, 5 Mar 2024 21:30:04 +0100 Subject: [PATCH 6/8] fix(levels): level page crashes and console errors --- src/components/LeaderHistory.jsx | 2 +- src/pages/level/StatsTable.jsx | 6 +++--- src/pages/level/TimeTable.jsx | 2 +- src/pages/level/index.jsx | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/components/LeaderHistory.jsx b/src/components/LeaderHistory.jsx index 53b9565..db6d96a 100644 --- a/src/components/LeaderHistory.jsx +++ b/src/components/LeaderHistory.jsx @@ -112,7 +112,7 @@ export default function LeaderHistory({ return ( - {[...allFinished] + {[...(allFinished || [])] .reduce((acc, cur) => { if (acc.length < 1 || acc[acc.length - 1].Time > cur.Time) acc.push(cur); diff --git a/src/pages/level/StatsTable.jsx b/src/pages/level/StatsTable.jsx index 3dd11a9..2b13eaf 100644 --- a/src/pages/level/StatsTable.jsx +++ b/src/pages/level/StatsTable.jsx @@ -17,10 +17,10 @@ const finishedTypes = { }; const StatsTable = ({ data, loading }) => { - if (data.length === 0) { + if (loading) return ; + if (!data?.length) { return You have not played this level yet.; } - if (loading) return ; const getTotalRunCount = () => { return sumBy(data, 'RunCount'); @@ -122,7 +122,7 @@ const StatsTable = ({ data, loading }) => { }; StatsTable.propTypes = { - data: PropTypes.arrayOf(PropTypes.shape()).isRequired, + data: PropTypes.arrayOf(PropTypes.shape()), }; const Container = styled.div` diff --git a/src/pages/level/TimeTable.jsx b/src/pages/level/TimeTable.jsx index 2b641ab..b14e6c6 100644 --- a/src/pages/level/TimeTable.jsx +++ b/src/pages/level/TimeTable.jsx @@ -73,7 +73,7 @@ const TimeTable = ({ data, latestBattle, loading, height }) => { }; TimeTable.propTypes = { - data: PropTypes.arrayOf(PropTypes.shape()).isRequired, + data: PropTypes.arrayOf(PropTypes.shape()), }; export default TimeTable; diff --git a/src/pages/level/index.jsx b/src/pages/level/index.jsx index 940d8b7..f2afee2 100644 --- a/src/pages/level/index.jsx +++ b/src/pages/level/index.jsx @@ -110,7 +110,7 @@ const Level = ({ LevelId }) => { } = useQueryAlt( ['CrippledTimes', LevelId, cripple], async () => CrippledTimes(LevelId, cripple, 1000, 1, 10000), - { enabled: cripple !== '' && tab !== 2 }, + { enabled: cripple !== '' && tab !== 2, retry: 0 }, ); const { @@ -126,7 +126,7 @@ const Level = ({ LevelId }) => { } = useQueryAlt( ['CrippledPersonal', LevelId, kuskiIndex, cripple], async () => CrippledPersonal(LevelId, kuskiIndex, cripple, 1000), - { enabled: cripple !== '' && kuskiIndex > 0 && tab === 2 }, + { enabled: cripple !== '' && kuskiIndex > 0 && tab === 2, retry: 0 }, ); const { @@ -141,7 +141,7 @@ const Level = ({ LevelId }) => { } = useQueryAlt( ['CrippledTimeStats', LevelId, kuskiIndex, cripple], async () => CrippledTimeStats(LevelId, kuskiIndex, cripple), - { enabled: cripple !== '' && kuskiIndex > 0 && tab === 2 }, + { enabled: cripple !== '' && kuskiIndex > 0 && tab === 2, retry: 0 }, ); const fetchPersonalStats = () => { From 8615545dbfbdcb2353b85a97c3cf7ecb5a2c0a45 Mon Sep 17 00:00:00 2001 From: Sune Date: Tue, 5 Mar 2024 21:40:31 +0100 Subject: [PATCH 7/8] fix(help): donate never refetching --- src/pages/help/tabs/Donate.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/help/tabs/Donate.jsx b/src/pages/help/tabs/Donate.jsx index 7c72868..18913fe 100644 --- a/src/pages/help/tabs/Donate.jsx +++ b/src/pages/help/tabs/Donate.jsx @@ -51,8 +51,8 @@ const Donate = ({ cached = false, small = false }) => { } = useStoreActions(actions => actions.Help); useEffect(() => { - if (!donations) getDonations({ cached }); - }); + getDonations({ cached }); + }, [cached]); if (!donations) return loading...; From 6f036b9868dd38ed344002fbd5b13c24f5573a75 Mon Sep 17 00:00:00 2001 From: Sune Date: Fri, 8 Mar 2024 20:23:24 +0100 Subject: [PATCH 8/8] feat(cups): add discord flag to paste friendly results --- src/components/CupResults.jsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/CupResults.jsx b/src/components/CupResults.jsx index 9a27787..b907b96 100644 --- a/src/components/CupResults.jsx +++ b/src/components/CupResults.jsx @@ -26,6 +26,9 @@ const CupResults = props => { {results.map((r, no) => (
{r.Position ? r.Position : no + 1}.{' '} + {r.KuskiData.Country + ? `:flag_${r.KuskiData.Country.toLowerCase()}: ` + : null} {cup.TeamPoints ? (