]> git.localhorst.tv Git - alttp.git/commitdiff
SMR seed codes
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 25 Aug 2022 07:52:09 +0000 (09:52 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 25 Aug 2022 07:52:52 +0000 (09:52 +0200)
app/Http/Controllers/RoundController.php
app/Models/Round.php
database/migrations/2022_08_25_070942_tournament_game.php [new file with mode: 0644]
resources/js/components/rounds/Item.js
resources/js/components/rounds/SeedCode.js
resources/sass/rounds.scss

index d616b861b3d0edb8c22d99679ae4f56614d1a079..596628d072da19ceae60e2c5190d8c2e6c23404d 100644 (file)
@@ -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'],
index 18be60fe015d346a085a416e4990aee3458c7447..b6c9d023917f4076775dd3f5d8f55321bb57c745 100644 (file)
@@ -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 (file)
index 0000000..a836099
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+       /**
+        * Run the migrations.
+        *
+        * @return void
+        */
+       public function up()
+       {
+               Schema::table('tournaments', function(Blueprint $table) {
+                       $table->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');
+               });
+       }
+};
index 8a4694603eb010ae076f5201f2fa7f315aef3f6c..6eb3d9446809a34d8eac6711f65f5031bc709720 100644 (file)
@@ -49,7 +49,7 @@ const Item = ({
                <p className="seed">
                        {round.code ?
                                <>
-                                       <SeedCode code={round.code} />
+                                       <SeedCode code={round.code} game={round.game || 'alttpr'} />
                                        <br />
                                </>
                        : 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,
index 1539c18009718e7a480b0bda9b7e394678891e77..2f7427979e335ff2e826474373347fe80616b0c5 100644 (file)
@@ -3,15 +3,17 @@ import React from 'react';
 
 import ZeldaIcon from '../common/ZeldaIcon';
 
-const SeedCode = ({ code }) =>
-<span className="seed-code">
-       {code.map((symbol, index) =>
-               <ZeldaIcon key={`${symbol}.${index}`} name={symbol} />
+const SeedCode = ({ code, game }) =>
+<span className={`seed-code game-${game}`}>
+       {code.map(game === 'smr'
+               ? (symbol, index) => <span key={`${symbol}.${index}`}>{symbol}</span>
+               : (symbol, index) => <ZeldaIcon key={`${symbol}.${index}`} name={symbol} />
        )}
 </span>;
 
 SeedCode.propTypes = {
        code: PropTypes.arrayOf(PropTypes.string),
+       game: PropTypes.string,
 };
 
 export default SeedCode;
index d8d117db805f729859c1a0b4bf98c883401369d5..6e3d04c900a509aff7981043c5ef5591b27d28e2 100644 (file)
@@ -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;
        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;
+               }
+       }
 }