aboutsummaryrefslogtreecommitdiff
path: root/components/anime/viewMode/listMode.js
blob: f3bcf058f1e87929ae2908638b7f86bb69fc37f8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import Link from "next/link";

export default function ListMode({
  info,
  episode,
  index,
  artStorage,
  providerId,
  progress,
  dub,
}) {
  const time = artStorage?.[episode?.id]?.timeWatched;
  const duration = artStorage?.[episode?.id]?.duration;
  let prog = (time / duration) * 100;
  if (prog > 90) prog = 100;

  return (
    <div key={episode.number} className="flex flex-col gap-3 px-2">
      <Link
        href={`/en/anime/watch/${info.id}/${providerId}?id=${encodeURIComponent(
          episode.id
        )}&num=${episode.number}${dub ? `&dub=${dub}` : ""}`}
        className={`text-start text-sm lg:text-lg ${
          progress
            ? progress && episode.number <= progress
              ? "text-[#5f5f5f]"
              : "text-white"
            : prog === 100
            ? "text-[#5f5f5f]"
            : "text-white"
        }`}
      >
        <p>Episode {episode.number}</p>
        {episode.title && (
          <p
            className={`text-xs lg:text-sm ${
              progress
                ? progress && episode.number <= progress
                  ? "text-[#5f5f5f]"
                  : "text-[#b1b1b1]"
                : prog === 100
                ? "text-[#5f5f5f]"
                : "text-[#b1b1b1]"
            } italic`}
          >
            "{episode.title}"
          </p>
        )}
      </Link>
      {index !== episode?.length - 1 && <span className="h-[1px] bg-white" />}
    </div>
  );
}