From: Daniel Karbach Date: Wed, 26 Nov 2025 11:02:52 +0000 (+0100) Subject: extract result verification interface X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=02f4453ef9ffa5897e3608003438ec3be5d23a2a;p=alttp.git extract result verification interface --- diff --git a/resources/js/components/common/Icon.jsx b/resources/js/components/common/Icon.jsx index 5ffd927..c6e0cfa 100644 --- a/resources/js/components/common/Icon.jsx +++ b/resources/js/components/common/Icon.jsx @@ -107,9 +107,10 @@ Icon.TWITCH = makePreset('TwitchIcon', ['fab', 'twitch']); Icon.UNKNOWN = makePreset('UnknownIcon', 'square-question'); Icon.UNLOCKED = makePreset('UnlockedIcon', 'lock-open'); Icon.UPLOAD = makePreset('UploadIcon', 'upload'); +Icon.VERIFIED = makePreset('VerifiedIcon', 'circle-check'); Icon.VIDEO = makePreset('VideoIcon', 'video'); -Icon.WARNING = makePreset('WarningIcon', 'triangle-exclamation'); Icon.VOLUME = makePreset('VolumeIcon', 'volume-high'); +Icon.WARNING = makePreset('WarningIcon', 'triangle-exclamation'); Icon.YOUTUBE = makePreset('YoutubeIcon', ['fab', 'youtube']); export default Icon; diff --git a/resources/js/components/protocol/Item.jsx b/resources/js/components/protocol/Item.jsx index 12d247f..b7d6052 100644 --- a/resources/js/components/protocol/Item.jsx +++ b/resources/js/components/protocol/Item.jsx @@ -137,10 +137,15 @@ const getEntryIcon = entry => { switch (entry.type) { case 'result.report': return ; + case 'result.verify': + return ; case 'round.create': return ; case 'round.delete': return ; + case 'round.edit': + case 'round.seed': + return ; case 'round.getseed': return ; case 'round.lock': diff --git a/resources/js/components/results/DetailDialog.jsx b/resources/js/components/results/DetailDialog.jsx index f3b1c99..17141fb 100644 --- a/resources/js/components/results/DetailDialog.jsx +++ b/resources/js/components/results/DetailDialog.jsx @@ -3,7 +3,7 @@ import React from 'react'; import { Button, Col, Form, Modal, Row } from 'react-bootstrap'; import { useTranslation } from 'react-i18next'; -import Icon from '../common/Icon'; +import Verification from './Verification'; import Box from '../users/Box'; import { getTime } from '../../helpers/Result'; import { formatNumberAlways } from '../../helpers/Round'; @@ -22,8 +22,6 @@ const DetailDialog = ({ tournament, user, }) => { - const [verifying, setVerifying] = React.useState(false); - const { t } = useTranslation(); const { user: authUser } = useUser(); @@ -40,16 +38,6 @@ const DetailDialog = ({ [authUser, result, round, tournament], ); - const handleVerifyClick = React.useCallback(async () => { - setVerifying(true); - try { - await actions.verifyResult(result); - } catch (e) { - console.error(e); - } - setVerifying(false); - }, [actions, result]); - return @@ -94,19 +82,6 @@ const DetailDialog = ({ : null} - {mayVerify && actions?.verifyResult ? ( - - {t('results.verification')} -
- -
-
- ) : null} {maySee && result && result.comment ? {t('results.comment')} @@ -115,6 +90,11 @@ const DetailDialog = ({ : null} + {result?.verified_at || (mayVerify && actions?.verifyResult) ? ( + + + + ) : null} + ; +}; + +Verification.propTypes = { + actions: PropTypes.shape({ + verifyResult: PropTypes.func, + }), + result: PropTypes.shape({ + verified_at: PropTypes.string, + verified_by: PropTypes.shape({ + }), + }), + round: PropTypes.shape({ + }), + tournament: PropTypes.shape({ + }), +}; + +export default Verification; diff --git a/resources/js/i18n/de.js b/resources/js/i18n/de.js index 7ccc32e..4ee602b 100644 --- a/resources/js/i18n/de.js +++ b/resources/js/i18n/de.js @@ -416,8 +416,11 @@ export default { TwitchIcon: 'Twitch', UnknownIcon: 'Unbekannt', UnlockedIcon: 'Offen', - YoutubeIcon: 'YouTube', + VerifiedIcon: 'Verifiziert', VideoIcon: 'Video', + VolumeIcon: 'Lautstärke', + WarningIcon: 'Achtung', + YoutubeIcon: 'YouTube', zelda: { aga: 'Agahnim', armos: 'Armos Knights', @@ -625,6 +628,9 @@ export default { score: 'Punkte', time: 'Zeit: {{ time }}', verification: 'Verifikation', + verificationPending: 'Noch nicht verifiziert', + verifiedAt: 'Verifiziert am {{ date, L }}', + verifiedAtBy: 'Verifiziert am {{ date, L }} durch <1 />', verifyButton: 'Ergebnis verifizieren', verifyError: 'Fehler beim Verifizieren', verifySuccess: 'Ergebnis verifiziert', diff --git a/resources/js/i18n/en.js b/resources/js/i18n/en.js index 8349e24..945b2a1 100644 --- a/resources/js/i18n/en.js +++ b/resources/js/i18n/en.js @@ -416,8 +416,11 @@ export default { TwitchIcon: 'Twitch', UnknownIcon: 'Unknown', UnlockedIcon: 'Unlocked', - YoutubeIcon: 'YouTube', + VerifiedIcon: 'Verified', VideoIcon: 'Video', + VolumeIcon: 'Volume', + WarningIcon: 'Warning', + YoutubeIcon: 'YouTube', zelda: { aga: 'Agahnim', armos: 'Armos Knights', @@ -625,6 +628,9 @@ export default { score: 'Score', time: 'Time: {{ time }}', verification: 'Verification', + verificationPending: 'Pending verification', + verifiedAt: 'Verified on {{ date, L }}', + verifiedAtBy: 'Verified on {{ date, L }} by <1 />', verifyButton: 'Verify result', verifyError: 'Error verifying result', verifySuccess: 'Result verified', diff --git a/resources/sass/results.scss b/resources/sass/results.scss index 5af982d..99fa5cf 100644 --- a/resources/sass/results.scss +++ b/resources/sass/results.scss @@ -1,3 +1,9 @@ +.result-dialog { + .verification { + border-top: thin solid $light; + } +} + .result-badge { position: relative; display: inline-flex;