]> git.localhorst.tv Git - alttp.git/commitdiff
add user stream links
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 17 Mar 2022 20:42:47 +0000 (21:42 +0100)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 17 Mar 2022 20:42:47 +0000 (21:42 +0100)
database/migrations/2022_03_17_185202_user_stream_link.php [new file with mode: 0644]
resources/js/components/common/Icon.js
resources/js/components/tournament/Scoreboard.js
resources/js/i18n/de.js
resources/js/i18n/en.js
resources/sass/_variables.scss

diff --git a/database/migrations/2022_03_17_185202_user_stream_link.php b/database/migrations/2022_03_17_185202_user_stream_link.php
new file mode 100644 (file)
index 0000000..e8abfa3
--- /dev/null
@@ -0,0 +1,32 @@
+<?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('users', function(Blueprint $table) {
+                       $table->text('stream_link')->nullable()->default(null);
+               });
+       }
+
+       /**
+        * Reverse the migrations.
+        *
+        * @return void
+        */
+       public function down()
+       {
+               Schema::table('users', function(Blueprint $table) {
+                       $table->dropColumn('stream_link');
+               });
+       }
+};
index 8b49c7e94b809984c682059966faaab9a0bfef3d..53f251c68094ad59e3bec265fe374224a0802d01 100644 (file)
@@ -67,6 +67,7 @@ Icon.LOGOUT = makePreset('LogoutIcon', 'sign-out-alt');
 Icon.PENDING = makePreset('PendingIcon', 'clock');
 Icon.PROTOCOL = makePreset('ProtocolIcon', 'file-alt');
 Icon.SECOND_PLACE = makePreset('SecondPlaceIcon', 'medal');
+Icon.STREAM = makePreset('StreamIcon', ['fab', 'twitch']);
 Icon.THIRD_PLACE = makePreset('ThirdPlaceIcon', 'award');
 
 export default Icon;
index 008974b7cc76ce1b8f362707f0dfb6fdcead4ee0..e142a80e030488f9a96d474d31d390b9a5259617 100644 (file)
@@ -1,8 +1,9 @@
 import PropTypes from 'prop-types';
 import React from 'react';
-import { Table } from 'react-bootstrap';
+import { Button, Table } from 'react-bootstrap';
 import { withTranslation } from 'react-i18next';
 
+import Icon from '../common/Icon';
 import Box from '../users/Box';
 import { calculateScores } from '../../helpers/Tournament';
 import i18n from '../../i18n';
@@ -18,7 +19,22 @@ const Scoreboard = ({ tournament }) =>
        <tbody>
        {calculateScores(tournament).map(score =>
                <tr className="score" key={score.participant.id}>
-                       <td><Box user={score.participant.user} /></td>
+                       <td>
+                               <div className="d-flex align-items-center justify-content-between">
+                                       <Box user={score.participant.user} />
+                                       {score.participant.user.stream_link ?
+                                               <Button
+                                                       href={score.participant.user.stream_link}
+                                                       size="sm"
+                                                       target="_blank"
+                                                       title={i18n.t('users.stream')}
+                                                       variant="outline-twitch"
+                                               >
+                                                       <Icon.STREAM title="" />
+                                               </Button>
+                                       : null}
+                               </div>
+                       </td>
                        <td className="text-end text-lg">{score.score}</td>
                </tr>
        )}
index 27a2a4022aed37aee49360f5f7a26cf471485ae3..e7c508695fb183288574b71ef89445a35e9859a1 100644 (file)
@@ -28,6 +28,7 @@ export default {
                        PendingIcon: 'Ausstehend',
                        SecondPlaceIcon: 'Zweiter Platz',
                        ThirdPlaceIcon: 'Dritter Platz',
+                       StreamIcon: 'Stream',
                        zelda: {
                                'big-key': 'Big Key',
                                'blue-boomerang': 'Boomerang',
@@ -124,6 +125,9 @@ export default {
                tournaments: {
                        scoreboard: 'Scoreboard',
                },
+               users: {
+                       stream: 'Stream',
+               },
                validation: {
                        error: {
                                required: 'Bitte ausfüllen',
index 80c091a363136867c6ff4618cc10cd42d49900dd..0f8b744381957b828ea6a4442d74aa3eda547f00 100644 (file)
@@ -28,6 +28,7 @@ export default {
                        PendingIcon: 'Pending',
                        SecondPlaceIcon: 'Second Place',
                        ThirdPlaceIcon: 'Third Place',
+                       StreamIcon: 'Stream',
                        zelda: {
                                'big-key': 'Big Key',
                                'blue-boomerang': 'Boomerang',
@@ -124,6 +125,9 @@ export default {
                tournaments: {
                        scoreboard: 'Scoreboard',
                },
+               users: {
+                       stream: 'Stream',
+               },
                validation: {
                        error: {
                                required: 'Please tell me',
index aadcd836691bf6dd8adc6e80714a1229ff3a43be..886d1d2bc307ab5cd666e1794660cd43cd1b0486 100644 (file)
@@ -11,8 +11,10 @@ $bronze: #ad8a56;
 $discord: #5865f2;
 $gold: #c9b037;
 $silver: #b4b4b4;
+$twitch: #6441a5;
 
 // Custom variant
 $custom-colors: (
-       "discord": $discord
+       "discord": $discord,
+       "twitch": $twitch
 );