feat: add quality and audio brand labels

This commit is contained in:
Prayag Prajapati committed 2024-03-28 11:01:15 +05:30
1 parent 325a4ab858
commit db70e793c0
35 files changed
+757 -309

No files matched your search

+25 -20
View File
@@ -38,6 +38,26 @@ import {
import type { SxProps } from "@mui/material";
import { getRuntimeCompact } from "../../utils/date/time";
type PlayButtonProps = {
item: BaseItemDto;
itemId: string;
itemUserData: UserItemDataDto;
userId: string;
itemType: BaseItemKind;
currentAudioTrack: number;
currentVideoTrack: number;
currentSubTrack: number | "nosub";
className: string;
sx: SxProps;
buttonProps: ButtonProps;
iconOnly: boolean;
audio: boolean;
size: ButtonPropsSizeOverrides;
playlistItem: BaseItemDto;
playlistItemId: string;
trackIndex: number;
};
const PlayButton = ({
item,
itemId,
@@ -56,25 +76,7 @@ const PlayButton = ({
playlistItem,
playlistItemId = "",
trackIndex,
}: {
item: BaseItemDto;
itemId: string;
itemUserData: UserItemDataDto;
userId: string;
itemType: BaseItemKind;
currentAudioTrack: number;
currentVideoTrack: number;
currentSubTrack: number;
className: string;
sx: SxProps;
buttonProps: ButtonProps;
iconOnly: boolean;
audio: boolean;
size: ButtonPropsSizeOverrides;
playlistItem: BaseItemDto;
playlistItemId: string;
trackIndex: number;
}) => {
}: PlayButtonProps) => {
const [api] = useApi((state) => [state.api]);
const navigate = useNavigate();
@@ -235,7 +237,10 @@ const PlayButton = ({
(value) => value.Type === "Subtitle",
);
let enableSubtitles = true;
if (!currentSubTrack && subtitles?.length > 0) {
if (currentSubTrack === "nosub") {
enableSubtitles = false;
selectedSubtitleTrack = "nosub";
} else if (!currentSubTrack && subtitles?.length > 0) {
selectedSubtitleTrack = subtitles[0].Index;
} else {
enableSubtitles = false;
+2 -2
View File
@@ -9,10 +9,10 @@
transform: translateY(-50%);
z-index: 100;
&.right {
right: 0.5em;
left: calc(100% + 0.5em);
}
&.left {
left: 0.5em;
right: calc(100% + 0.5em);
}
}
&-indicator {
+28 -2
View File
@@ -1,13 +1,27 @@
import { Link, Typography } from "@mui/material";
import React from "react";
import anidbIcon from "../../assets/icons/anidb.png";
import anilistIcon from "../../assets/icons/anilist.svg";
import audioDBIcon from "../../assets/icons/audioDB.png";
import imdbIcon from "../../assets/icons/imdb.svg";
import musicBrainzIcon from "../../assets/icons/musicbrainz.svg";
import tvDbIcon from "../../assets/icons/the-tvdb.svg";
import tmdbIcon from "../../assets/icons/themoviedatabase.svg";
import traktIcon from "../../assets/icons/trakt.svg";
import tvMazeIcon from "../../assets/icons/tvmaze.png";
const knownIcons = ["imdb", "themoviedb", "trakt", "musicbrainz", "thetvdb"];
const knownIcons = [
"imdb",
"themoviedb",
"trakt",
"musicbrainz",
"thetvdb",
"anidb",
"anilist",
"tvmaze",
"theaudiodb",
];
const IconLink = ({ name, url }: { name: string; url: string }) => {
return (
@@ -23,7 +37,19 @@ const IconLink = ({ name, url }: { name: string; url: string }) => {
<img src={musicBrainzIcon} alt="MusicBrainz" />
)}
{name.toLocaleLowerCase() === "thetvdb" && (
<img src={tvDbIcon} alt="THeTVDB" />
<img src={tvDbIcon} alt="TheTVDB" />
)}
{name.toLocaleLowerCase() === "anidb" && (
<img src={anidbIcon} alt="AniDB" />
)}
{name.toLocaleLowerCase() === "anilist" && (
<img src={anilistIcon} alt="AniList" />
)}
{name.toLocaleLowerCase() === "tvmaze" && (
<img src={tvMazeIcon} alt="TVMaze" />
)}
{name.toLocaleLowerCase() === "theaudiodb" && (
<img src={audioDBIcon} alt="TheAudioDB" />
)}
{!knownIcons.includes(name.toLocaleLowerCase()) && (
<Typography>{name}</Typography>
+1
View File
@@ -24,6 +24,7 @@ const ShowMoreText = ({ content, collapsedLines, extraProps }) => {
style={{
alignItems: "flex-end",
gap: "1em",
opacity: 0.8,
}}
>
<Typography
+1 -1
View File
@@ -9,7 +9,7 @@ const TextLink = ({ children, location, variant, otherProps }) => {
return (
<Typography
variant={variant}
className="link"
className="link flex"
onClick={() => navigate(location)}
{...otherProps}
>