]> git.localhorst.tv Git - alttp.git/commitdiff
event corner images
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Wed, 22 Feb 2023 21:39:52 +0000 (22:39 +0100)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Wed, 22 Feb 2023 21:39:52 +0000 (22:39 +0100)
database/migrations/2023_02_22_212552_add_event_corner.php [new file with mode: 0644]
resources/js/components/episodes/Item.js
resources/sass/episodes.scss

diff --git a/database/migrations/2023_02_22_212552_add_event_corner.php b/database/migrations/2023_02_22_212552_add_event_corner.php
new file mode 100644 (file)
index 0000000..ff6b277
--- /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('events', function(Blueprint $table) {
+                       $table->string('corner')->default('');
+               });
+       }
+
+       /**
+        * Reverse the migrations.
+        *
+        * @return void
+        */
+       public function down()
+       {
+               Schema::table('events', function(Blueprint $table) {
+                       $table->dropColumn('corner');
+               });
+       }
+};
index 71fe49ed5c6875eb00d34848143160a75576fc02..5f43c1248b15fb1df75f6c39477f7dfe223baaf7 100644 (file)
@@ -36,10 +36,19 @@ const Item = ({ episode, onAddRestream, onEditRestream, user }) => {
                classNames.push('is-active');
        }
 
+       const style = React.useMemo(() => {
+               if (episode.event && episode.event.corner) {
+                       return {
+                               backgroundImage: `url(${episode.event.corner})`,
+                       };
+               }
+               return null;
+       }, [episode.event && episode.event.corner]);
+
        const hasChannels = episode.channels && episode.channels.length;
        const hasPlayers = episode.players && episode.players.length;
 
-       return <div className={classNames.join(' ')}>
+       return <div className={classNames.join(' ')} style={style}>
                <div className="episode-start me-3 fs-4 text-end">
                        {t('schedule.startTime', { date: new Date(episode.start) })}
                </div>
@@ -99,6 +108,7 @@ Item.propTypes = {
                crew: PropTypes.arrayOf(PropTypes.shape({
                })),
                event: PropTypes.shape({
+                       corner: PropTypes.string,
                        title: PropTypes.string,
                }),
                players: PropTypes.arrayOf(PropTypes.shape({
index 33722576817344250a27a469df59fb66034894f0..df98cd7a9b52f73c712ace28c70e2e128dfdbb55 100644 (file)
@@ -9,6 +9,11 @@
 }
 
 .episodes-item {
+       background-size: 6rem auto;
+       background-repeat: no-repeat;
+       background-position: left bottom;
+       min-height: 8rem;
+
        &.is-active {
                border-color: $success !important;
                box-shadow: 0 0 0.25rem 0.25rem $success;