From 9160186db0ea1b0da0edfec49cb3d99ead213bc4 Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Thu, 25 Aug 2022 09:52:09 +0200 Subject: [PATCH] SMR seed codes --- app/Http/Controllers/RoundController.php | 1 + app/Models/Round.php | 1 + .../2022_08_25_070942_tournament_game.php | 38 +++++++++++++++++++ resources/js/components/rounds/Item.js | 3 +- resources/js/components/rounds/SeedCode.js | 10 +++-- resources/sass/rounds.scss | 17 +++++++-- 6 files changed, 62 insertions(+), 8 deletions(-) create mode 100644 database/migrations/2022_08_25_070942_tournament_game.php diff --git a/app/Http/Controllers/RoundController.php b/app/Http/Controllers/RoundController.php index d616b86..596628d 100644 --- a/app/Http/Controllers/RoundController.php +++ b/app/Http/Controllers/RoundController.php @@ -22,6 +22,7 @@ class RoundController extends Controller $tournament->loadMax('rounds', 'number'); $round = Round::create([ + 'game' => $tournament->game, 'number' => intval($tournament->rounds_max_number) + 1, 'no_record' => $tournament->no_record, 'tournament_id' => $validatedData['tournament_id'], diff --git a/app/Models/Round.php b/app/Models/Round.php index 18be60f..b6c9d02 100644 --- a/app/Models/Round.php +++ b/app/Models/Round.php @@ -90,6 +90,7 @@ class Round extends Model ]; protected $fillable = [ + 'game', 'number', 'no_record', 'tournament_id', diff --git a/database/migrations/2022_08_25_070942_tournament_game.php b/database/migrations/2022_08_25_070942_tournament_game.php new file mode 100644 index 0000000..a836099 --- /dev/null +++ b/database/migrations/2022_08_25_070942_tournament_game.php @@ -0,0 +1,38 @@ +string('game')->default('alttpr'); + }); + Schema::table('rounds', function(Blueprint $table) { + $table->string('game')->default('alttpr'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('tournaments', function(Blueprint $table) { + $table->dropColumn('game'); + }); + Schema::table('rounds', function(Blueprint $table) { + $table->dropColumn('game'); + }); + } +}; diff --git a/resources/js/components/rounds/Item.js b/resources/js/components/rounds/Item.js index 8a46946..6eb3d94 100644 --- a/resources/js/components/rounds/Item.js +++ b/resources/js/components/rounds/Item.js @@ -49,7 +49,7 @@ const Item = ({

{round.code ? <> - +
: null} @@ -78,6 +78,7 @@ Item.propTypes = { round: PropTypes.shape({ code: PropTypes.arrayOf(PropTypes.string), created_at: PropTypes.string, + game: PropTypes.string, locked: PropTypes.bool, number: PropTypes.number, seed: PropTypes.string, diff --git a/resources/js/components/rounds/SeedCode.js b/resources/js/components/rounds/SeedCode.js index 1539c18..2f74279 100644 --- a/resources/js/components/rounds/SeedCode.js +++ b/resources/js/components/rounds/SeedCode.js @@ -3,15 +3,17 @@ import React from 'react'; import ZeldaIcon from '../common/ZeldaIcon'; -const SeedCode = ({ code }) => - - {code.map((symbol, index) => - +const SeedCode = ({ code, game }) => + + {code.map(game === 'smr' + ? (symbol, index) => {symbol} + : (symbol, index) => )} ; SeedCode.propTypes = { code: PropTypes.arrayOf(PropTypes.string), + game: PropTypes.string, }; export default SeedCode; diff --git a/resources/sass/rounds.scss b/resources/sass/rounds.scss index d8d117d..6e3d04c 100644 --- a/resources/sass/rounds.scss +++ b/resources/sass/rounds.scss @@ -39,9 +39,6 @@ } .seed-code { - display: inline-flex; - flex-direction: row; - flex-wrap: nowrap; align-items: center; align-content: center; justify-content: flex-start; @@ -51,4 +48,18 @@ background: $dark; color: $light; vertical-align: middle; + + &.game-alttpr { + display: inline-flex; + flex-direction: row; + flex-wrap: nowrap; + } + + &.game-smr { + display: inline-grid; + grid-template-columns: 1fr 1fr; + > span { + text-transform: uppercase; + } + } } -- 2.39.2