diff --git a/front/packages/ui/src/browse/grid.tsx b/front/packages/ui/src/browse/grid.tsx
index fb88bf92..60b0472d 100644
--- a/front/packages/ui/src/browse/grid.tsx
+++ b/front/packages/ui/src/browse/grid.tsx
@@ -19,21 +19,52 @@
*/
import { KyooImage, WatchStatusV } from "@kyoo/models";
-import {
- Link,
- Skeleton,
- ts,
- focusReset,
- P,
- SubP,
- PosterBackground,
- Icon,
-} from "@kyoo/primitives";
+import { Link, Skeleton, ts, focusReset, P, SubP, PosterBackground, Icon } from "@kyoo/primitives";
import { ImageStyle, View } from "react-native";
import { percent, px, Stylable, Theme, useYoshiki } from "yoshiki/native";
import { Layout, WithLoading } from "../fetch";
import Done from "@material-symbols/svg-400/rounded/done-fill.svg";
+export const ItemWatchStatus = ({
+ watchStatus,
+ unseenEpisodesCount,
+ ...props
+}: {
+ watchStatus?: WatchStatusV | null;
+ unseenEpisodesCount?: number | null;
+}) => {
+ const { css } = useYoshiki();
+
+ if (watchStatus !== WatchStatusV.Completed && !unseenEpisodesCount) return null;
+
+ return (
+ theme.darkOverlay,
+ borderRadius: 999999,
+ },
+ props,
+ )}
+ >
+ {watchStatus === WatchStatusV.Completed ? (
+
+ ) : (
+ {unseenEpisodesCount}
+ )}
+
+ );
+};
+
export const ItemGrid = ({
href,
name,
@@ -90,28 +121,7 @@ export const ItemGrid = ({
layout={{ width: percent(100) }}
{...(css("poster") as { style: ImageStyle })}
>
- {(watchStatus === WatchStatusV.Completed || unseenEpisodesCount) && (
- theme.darkOverlay,
- borderRadius: 999999,
- })}
- >
- {watchStatus === WatchStatusV.Completed ? (
-
- ) : (
- {unseenEpisodesCount}
- )}
-
- )}
+
{isLoading || (
diff --git a/front/packages/ui/src/browse/list.tsx b/front/packages/ui/src/browse/list.tsx
index e42cece7..2a8d1df2 100644
--- a/front/packages/ui/src/browse/list.tsx
+++ b/front/packages/ui/src/browse/list.tsx
@@ -35,6 +35,7 @@ import { View } from "react-native";
import { percent, px, rem, useYoshiki } from "yoshiki/native";
import { Layout, WithLoading } from "../fetch";
import Done from "@material-symbols/svg-400/rounded/done-fill.svg";
+import { ItemWatchStatus } from "./grid";
export const ItemList = ({
href,
@@ -130,28 +131,7 @@ export const ItemList = ({
forcedLoading={isLoading}
layout={{ height: percent(80) }}
>
- {(watchStatus === WatchStatusV.Completed || unseenEpisodesCount) && (
- theme.darkOverlay,
- borderRadius: 999999,
- })}
- >
- {watchStatus === WatchStatusV.Completed ? (
-
- ) : (
- {unseenEpisodesCount}
- )}
-
- )}
+
);
diff --git a/front/packages/ui/src/home/recommanded.tsx b/front/packages/ui/src/home/recommanded.tsx
index 966fa517..b9ce978c 100644
--- a/front/packages/ui/src/home/recommanded.tsx
+++ b/front/packages/ui/src/home/recommanded.tsx
@@ -49,7 +49,7 @@ import { Theme, percent, px, rem, useYoshiki } from "yoshiki/native";
import { Layout, WithLoading } from "../fetch";
import { InfiniteFetch } from "../fetch-infinite";
import PlayArrow from "@material-symbols/svg-400/rounded/play_arrow-fill.svg";
-import { ItemGrid } from "../browse/grid";
+import { ItemGrid, ItemWatchStatus } from "../browse/grid";
import Done from "@material-symbols/svg-400/rounded/done-fill.svg";
export const ItemDetails = ({
@@ -133,28 +133,7 @@ export const ItemDetails = ({
)}
- {(watchStatus === WatchStatusV.Completed || unseenEpisodesCount) && (
- theme.darkOverlay,
- borderRadius: 999999,
- })}
- >
- {watchStatus === WatchStatusV.Completed ? (
-
- ) : (
- {unseenEpisodesCount}
- )}
-
- )}
+
{(isLoading || tagline) && (