]> git.localhorst.tv Git - alttp.git/blobdiff - resources/js/components/tournament/SettingsDialog.js
option to hide round numbers
[alttp.git] / resources / js / components / tournament / SettingsDialog.js
index 362cd6fbab36595da9754e1784eb4325911984d9..46fbfd87ecae299ec5aef94bddebbf71c691af9b 100644 (file)
@@ -57,6 +57,15 @@ const setDiscord = async (tournament, guild_id) => {
        }
 };
 
+const settings = async (tournament, params) => {
+       try {
+               await axios.post(`/api/tournaments/${tournament.id}/settings`, params);
+               toastr.success(i18n.t('tournaments.settingsSuccess'));
+       } catch (e) {
+               toastr.error(i18n.t('tournaments.settingsError'));
+       }
+};
+
 const inviteUrl = 'https://discordapp.com/oauth2/authorize?client_id=951113702839549982&scope=bot';
 
 const SettingsDialog = ({
@@ -96,6 +105,14 @@ const SettingsDialog = ({
                                                value={tournament.locked}
                                        />
                                </div>
+                               <div className="d-flex align-items-center justify-content-between mb-3">
+                                       <span>{i18n.t('tournaments.showNumbers')}</span>
+                                       <ToggleSwitch
+                                               onChange={({ target: { value } }) =>
+                                                       settings(tournament, { show_numbers: value })}
+                                               value={tournament.show_numbers}
+                                       />
+                               </div>
                                <div className="d-flex align-items-center justify-content-between">
                                        <div>
                                                <p>{i18n.t('tournaments.discord')}</p>
@@ -140,6 +157,7 @@ SettingsDialog.propTypes = {
                accept_applications: PropTypes.bool,
                discord: PropTypes.string,
                locked: PropTypes.bool,
+               show_numbers: PropTypes.bool,
        }),
 };