Skip to content

Commit

Permalink
Added color based on status
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexPerathoner committed Nov 5, 2024
1 parent 27218e8 commit 10602b5
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 8 deletions.
8 changes: 6 additions & 2 deletions src/lib/nav/DetailedMenu.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@
$: dve = $wlDetailedView;
</script>

<div class={`menu${$page.url?.pathname.startsWith("/search/") ? " on-search-page" : ""}`}>
<div
class={`menu${$page.url?.pathname.startsWith("/search/") ? " on-search-page" : ""}`}
style="right: {$page.url?.pathname === '/' || $page.url?.pathname.startsWith('/search/')
? 92
: 12}px;"
>
<div class="inner">
<h4 class="norm sm-caps">Shown Details</h4>
<button
Expand Down Expand Up @@ -50,7 +55,6 @@
<style lang="scss">
div.menu {
width: 200px;
right: 92px;
&:before {
left: 3px;
Expand Down
19 changes: 14 additions & 5 deletions src/lib/poster/ExtraDetails.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@
$: settings = $userSettings;
$: isUsingThumbs = settings && settings.ratingSystem === RatingSystem.Thumbs;
let statusColorMap = {
FINISHED: "var(--status-finished-color)",
PLANNED: "var(--status-planned-color)",
WATCHING: "var(--status-watching-color)",
HOLD: "var(--status-hold-color)",
DROPPED: "var(--status-dropped-color)"
};
$: backgroundColor = status !== undefined ? statusColorMap[status] : "";
function formatDate(e: number) {
if (!e) {
return "Unknown";
Expand All @@ -26,8 +36,8 @@
}
</script>

{#if ($page.url?.pathname === "/" || $page.url?.pathname.startsWith("/search/")) && details && dve && dve.length > 0}
<div class="extra-details">
{#if details && dve && dve.length > 0}
<div class="extra-details" style="background-color: {backgroundColor}">
<!--
The `if` statements can't be on their own line to look pretty
because that will cause whitespace in the generated markup,
Expand Down Expand Up @@ -90,17 +100,16 @@
<style lang="scss">
.extra-details {
position: absolute;
bottom: 5px;
bottom: 0.5rem;
left: 50%;
transform: translateX(-50%);
display: flex;
flex-flow: column;
justify-content: center;
align-items: center;
font-size: 14px;
width: 160px;
width: 80%;
color: white;
background-color: $poster-extra-detail-bg-color;
border-radius: 10px;
transition: opacity 100ms ease-out;
pointer-events: none !important;
Expand Down
2 changes: 1 addition & 1 deletion src/routes/(app)/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@
</div>
<div class="btns">
<!-- Detailed posters only supported on own watched list currently -->
{#if $page.url?.pathname === "/" || $page.url?.pathname.startsWith("/search/")}
{#if $page.url?.pathname === "/" || $page.url?.pathname.startsWith("/search/") || $page.url?.pathname.startsWith("/discover/") || $page.url?.pathname.startsWith("/person/")}
<button
class="plain other detailedView"
on:click={() => {
Expand Down
12 changes: 12 additions & 0 deletions src/vars.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
--placeholder-color: #8e8e8e;
--poster-rating-color: gold;
--img-blend-multiply-bg-col: rgba(0, 0, 0, 0.85);

--status-finished-color: rgba(123, 213, 85, 0.8);
--status-planned-color: rgba(247, 154, 99, 0.8);
--status-watching-color: rgba(61, 100, 242, 0.8);
--status-hold-color: rgba(232, 93, 117, 0.8);
--status-dropped-color: rgba(232, 93, 117, 0.8);
}

:root.theme-dark {
Expand All @@ -24,6 +30,12 @@
--placeholder-color: #8e8e8e;
--poster-rating-color: black;
--img-blend-multiply-bg-col: rgba(255, 255, 255, 0.03);

--status-finished-color: rgba(123, 213, 85, 0.8);
--status-planned-color: rgba(247, 154, 99, 0.8);
--status-watching-color: rgba(61, 100, 242, 0.8);
--status-hold-color: rgba(232, 93, 117, 0.8);
--status-dropped-color: rgba(232, 93, 117, 0.8);
}

$bg-color: var(--bg-color);
Expand Down

0 comments on commit 10602b5

Please sign in to comment.