From 48814c213a0e2826debcf58c32fbd93b53c9c7fe Mon Sep 17 00:00:00 2001 From: IRHM <37304121+IRHM@users.noreply.github.com> Date: Thu, 3 Oct 2024 23:27:04 +0100 Subject: [PATCH] Poster: Fix issues i made 11 days ago --- src/lib/poster/ExtraDetails.svelte | 1 + src/lib/poster/GamePoster.svelte | 51 +++++++++----- src/lib/poster/Poster.svelte | 51 +++++++++----- src/lib/poster/PosterRating.svelte | 109 ++++++++++++++++------------- src/lib/poster/PosterStatus.svelte | 57 ++++++++------- 5 files changed, 157 insertions(+), 112 deletions(-) diff --git a/src/lib/poster/ExtraDetails.svelte b/src/lib/poster/ExtraDetails.svelte index d9699e44..ddfb398f 100644 --- a/src/lib/poster/ExtraDetails.svelte +++ b/src/lib/poster/ExtraDetails.svelte @@ -103,6 +103,7 @@ background-color: $poster-extra-detail-bg-color; border-radius: 10px; transition: opacity 100ms ease-out; + pointer-events: none !important; & > div { padding: 8px 3px; diff --git a/src/lib/poster/GamePoster.svelte b/src/lib/poster/GamePoster.svelte index 1a73fd18..88dfb0bc 100644 --- a/src/lib/poster/GamePoster.svelte +++ b/src/lib/poster/GamePoster.svelte @@ -141,6 +141,11 @@ }} on:mouseleave={() => (posterActive = false)} on:click={() => (posterActive = true)} + on:keyup={(e) => { + if (e.key === "Tab") { + e.currentTarget.scrollIntoView({ block: "center" }); + } + }} on:keypress={() => console.log("on kpress")} class={`${posterActive ? "active " : ""}${pinned ? "pinned " : ""}`} > @@ -171,9 +176,11 @@ {/if}
{ + on:click={(e) => { if (typeof onClick !== "undefined") { onClick(); + // Prevent the link inside this div from being clicked in this case. + e.preventDefault(); return; } if (posterActive && link) goto(link); @@ -184,19 +191,15 @@ role="button" tabindex="-1" > -

- {#if typeof onClick === "undefined" && link} - - {title} - - {:else} + +

{title} - {/if} - {#if year} - - {/if} -

- {media.summary} + {#if year} + + {/if} +

+ {media.summary} + {#if !hideButtons}
@@ -217,6 +220,15 @@ outline: 3px solid gold; } + li { + &:not(.active) { + .container .inner, + .container .inner .buttons { + pointer-events: none !important; + } + } + } + .container { display: flex; flex-flow: column; @@ -299,6 +311,10 @@ background-color: transparent; transition: opacity 150ms cubic-bezier(0.19, 1, 0.22, 1); + & > a { + height: 100%; + } + h2 { font-family: sans-serif, @@ -344,19 +360,16 @@ font-size: 11px; } - &:hover, - &:has(:focus-visible) { + .active & { transform: scale(1.3); z-index: 99; } - &.small:hover, - &.small:has(:focus-visible) { + .active &.small { transform: scale(1.1); } - &:hover, - &:has(:focus-visible), + .active &, &:global(.details-shown) { img { filter: blur(4px) grayscale(80%); diff --git a/src/lib/poster/Poster.svelte b/src/lib/poster/Poster.svelte index 9abeee4f..fbaf415f 100644 --- a/src/lib/poster/Poster.svelte +++ b/src/lib/poster/Poster.svelte @@ -113,6 +113,11 @@ }} on:mouseleave={() => (posterActive = false)} on:click={() => (posterActive = true)} + on:keyup={(e) => { + if (e.key === "Tab") { + e.currentTarget.scrollIntoView({ block: "center" }); + } + }} on:keypress={() => console.log("on kpress")} class={`${posterActive ? "active " : ""}${pinned ? "pinned " : ""}`} > @@ -139,9 +144,11 @@ {/if}
{ + on:click={(e) => { if (typeof onClick !== "undefined") { onClick(); + // Prevent the link inside this div from being clicked in this case. + e.preventDefault(); return; } if (posterActive && link) goto(link); @@ -152,19 +159,15 @@ role="button" tabindex="-1" > -

- {#if typeof onClick === "undefined" && link} - - {title} - - {:else} + +

{title} - {/if} - {#if year} - - {/if} -

- {media.overview} + {#if year} + + {/if} +

+ {media.overview} + {#if !hideButtons}
@@ -185,6 +188,15 @@ outline: 3px solid gold; } + li { + &:not(.active) { + .container .inner, + .container .inner .buttons { + pointer-events: none !important; + } + } + } + .container { display: flex; flex-flow: column; @@ -247,6 +259,10 @@ background-color: transparent; transition: opacity 150ms cubic-bezier(0.19, 1, 0.22, 1); + & > a { + height: 100%; + } + h2 { font-family: sans-serif, @@ -292,19 +308,16 @@ font-size: 11px; } - &:hover, - &:has(:focus-visible) { + .active & { transform: scale(1.3); z-index: 99; } - &.small:hover, - &.small:has(:focus-visible) { + .active &.small { transform: scale(1.1); } - &:hover, - &:has(:focus-visible), + .active &, &:global(.details-shown) { img { filter: blur(4px) grayscale(80%); diff --git a/src/lib/poster/PosterRating.svelte b/src/lib/poster/PosterRating.svelte index a0547a19..12265cbb 100644 --- a/src/lib/poster/PosterRating.svelte +++ b/src/lib/poster/PosterRating.svelte @@ -67,60 +67,65 @@ {/if} - {#if ratingsShown} -
- {#if isUsingThumbs} - - + + - + + + + {:else} + {@const stars = + settings?.ratingSystem == RatingSystem.OutOf5 + ? [5, 4, 3, 2, 1] + : [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]} + {#each stars as v} - {:else} - {@const stars = - settings?.ratingSystem == RatingSystem.OutOf5 - ? [5, 4, 3, 2, 1] - : [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]} - {#each stars as v} - - {/each} - {/if} -
- {/if} + {/each} + {/if} +
{:else if rating} {rating} @@ -223,6 +228,10 @@ z-index: 40; box-shadow: 0px 0px 1px #000; + &:not(.shown) { + display: none; + } + &.bot { top: calc(100% + 2px); border-radius: 0 0 4px 4px; diff --git a/src/lib/poster/PosterStatus.svelte b/src/lib/poster/PosterStatus.svelte index 40a19732..a5cdede2 100644 --- a/src/lib/poster/PosterStatus.svelte +++ b/src/lib/poster/PosterStatus.svelte @@ -33,30 +33,35 @@ {:else} + {/if} - {#if statusesShown} -
- {#each Object.entries(watchedStatuses) as [statusName, icon]} - - {/each} - {#if status} - - {/if} -
- {/if} +
+ {#each Object.entries(watchedStatuses) as [statusName, icon]} + + {/each} + {#if status} + + {/if} +