Skip to content

Commit

Permalink
fix(up-next): derive computed properties and properly update
Browse files Browse the repository at this point in the history
  • Loading branch information
vladjerca committed Nov 16, 2024
1 parent 290d648 commit 22dc32a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
} & ChildrenProps;
const { children, total, progress }: ShowProgressTagProps = $props();
const percentage = (progress / total) * 100;
const percentage = $derived((progress / total) * 100);
</script>

<div class="show-progress-tag" style:--progress-width={`${percentage}%`}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
onMarkAsWatched,
type,
}: EpisodeProps = $props();
const duration = $derived(remaining * runtime);
</script>

<EpisodeCard>
Expand All @@ -48,9 +50,7 @@
{#snippet tags()}
<ShowProgressTag {total} progress={completed}>
<span class="show-progress-text">
{i18n.remainingText(remaining)} ({i18n.durationText(
remaining * runtime,
)})
{i18n.remainingText(remaining)} ({i18n.durationText(duration)})
</span>
</ShowProgressTag>
{/snippet}
Expand Down

0 comments on commit 22dc32a

Please sign in to comment.