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 ? (
- {[...allFinished]
+ {[...(allFinished || [])]
.reduce((acc, cur) => {
if (acc.length < 1 || acc[acc.length - 1].Time > cur.Time)
acc.push(cur);
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 && (
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={
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 = () => {
-
+
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 = () => {
- {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(
{
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... ;
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 = () => {
diff --git a/yarn.lock b/yarn.lock
index 6ef217c..d292289 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"
@@ -9774,9 +9793,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"
@@ -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"