X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=resources%2Fjs%2Fcomponents%2Frounds%2FSeedButton.js;h=59bc3baaa15b2d18a6fcb16b5c5e84bf2492fec3;hb=d4e908822c1750b086e90007bf677f66241d0f5b;hp=d9d343304eca067fc7996fa72c940f187a85badc;hpb=a748d5724c8acff6e3bb3fe6c20aa5968b65d58a;p=alttp.git
diff --git a/resources/js/components/rounds/SeedButton.js b/resources/js/components/rounds/SeedButton.js
index d9d3433..59bc3ba 100644
--- a/resources/js/components/rounds/SeedButton.js
+++ b/resources/js/components/rounds/SeedButton.js
@@ -1,22 +1,34 @@
import PropTypes from 'prop-types';
import React, { useState } from 'react';
import { Button } from 'react-bootstrap';
-import { withTranslation } from 'react-i18next';
+import { useTranslation } from 'react-i18next';
import SeedDialog from './SeedDialog';
import { maySetSeed } from '../../helpers/permissions';
-import { withUser } from '../../helpers/UserContext';
-import i18n from '../../i18n';
+import { useUser } from '../../hooks/user';
-const SeedButton = ({ round, tournament, user }) => {
+const SeedButton = ({ round, tournament }) => {
const [showDialog, setShowDialog] = useState(false);
+ const { t } = useTranslation();
+ const { user } = useUser();
+
if (round.seed) {
- return (
+ return <>
- );
+ {round.spoiler ?
+
+ : null}
+ >;
}
if (maySetSeed(user, tournament, round)) {
return <>
@@ -26,21 +38,20 @@ const SeedButton = ({ round, tournament, user }) => {
show={showDialog}
/>
>;
}
- return i18n.t('rounds.noSeed');
+ return t('rounds.noSeed');
};
SeedButton.propTypes = {
round: PropTypes.shape({
seed: PropTypes.string,
+ spoiler: PropTypes.string,
}),
tournament: PropTypes.shape({
}),
- user: PropTypes.shape({
- }),
};
-export default withTranslation()(withUser(SeedButton));
+export default SeedButton;