From: Daniel Karbach Date: Sun, 13 Mar 2022 22:41:12 +0000 (+0100) Subject: number rounds and results X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=0f171dfffd9c0c2cc895c9f282c5f4550844cc5a;p=alttp.git number rounds and results --- diff --git a/resources/js/components/common/Icon.js b/resources/js/components/common/Icon.js index 66d2ac9..003adff 100644 --- a/resources/js/components/common/Icon.js +++ b/resources/js/components/common/Icon.js @@ -62,8 +62,11 @@ const makePreset = (presetDisplayName, presetName) => { Icon.DISCORD = makePreset('DiscordIcon', ['fab', 'discord']); Icon.EDIT = makePreset('EditIcon', 'edit'); Icon.FINISHED = makePreset('FinishedIcon', 'square-check'); +Icon.FIRST_PLACE = makePreset('FirstPlaceIcon', 'trophy'); Icon.LOGOUT = makePreset('LogoutIcon', 'sign-out-alt'); Icon.PENDING = makePreset('PendingIcon', 'clock'); Icon.PROTOCOL = makePreset('ProtocolIcon', 'file-alt'); +Icon.SECOND_PLACE = makePreset('SecondPlaceIcon', 'medal'); +Icon.THIRD_PLACE = makePreset('ThirdPlaceIcon', 'award'); export default Icon; diff --git a/resources/js/components/protocol/Item.js b/resources/js/components/protocol/Item.js index 6127a92..f827f1a 100644 --- a/resources/js/components/protocol/Item.js +++ b/resources/js/components/protocol/Item.js @@ -16,6 +16,7 @@ const getEntryDate = entry => { const getEntryDescription = entry => { switch (entry.type) { + case 'result.report': case 'round.create': return i18n.t( `protocol.description.${entry.type}`, diff --git a/resources/js/components/results/Item.js b/resources/js/components/results/Item.js index 5cdd3be..2c1b656 100644 --- a/resources/js/components/results/Item.js +++ b/resources/js/components/results/Item.js @@ -9,7 +9,24 @@ import { findResult } from '../../helpers/Participant'; import { maySeeResults } from '../../helpers/permissions'; import { withUser } from '../../helpers/UserContext'; +const getIcon = (result, index) => { + if (!result || !result.has_finished) { + return ; + } + if (index === 0) { + return ; + } + if (index === 1) { + return ; + } + if (index === 2) { + return ; + } + return ; +}; + const Item = ({ + index, participant, round, tournament, @@ -25,17 +42,14 @@ const Item = ({ formatTime(result) : null} - {result && result.has_finished ? - - : - - } + {getIcon(result, index)} ); }; Item.propTypes = { + index: PropTypes.number, participant: PropTypes.shape({ user: PropTypes.shape({ }), diff --git a/resources/js/components/results/List.js b/resources/js/components/results/List.js index 9ad0896..8775529 100644 --- a/resources/js/components/results/List.js +++ b/resources/js/components/results/List.js @@ -5,8 +5,9 @@ import Item from './Item'; import { sortByResult } from '../../helpers/Participant'; const List = ({ round, tournament }) =>
- {sortByResult(tournament.participants, round).map(participant => + {sortByResult(tournament.participants, round).map((participant, index) =>
  • -

    {i18n.t('rounds.date', { date: new Date(round.created_at) })}

    +

    + {`#${index + 1} `} + {i18n.t('rounds.date', { date: new Date(round.created_at) })} +

    ; Item.propTypes = { + index: PropTypes.number, round: PropTypes.shape({ created_at: PropTypes.string, seed: PropTypes.string, diff --git a/resources/js/components/rounds/List.js b/resources/js/components/rounds/List.js index 2ac8f17..928f7b9 100644 --- a/resources/js/components/rounds/List.js +++ b/resources/js/components/rounds/List.js @@ -11,8 +11,9 @@ const List = ({ tournament, }) => rounds && rounds.length ?

      - {rounds.map(round => + {rounds.map((round, index) =>