refactor: support vtt and ass subtitles

This commit is contained in:
Prayag Prajapati committed 2024-07-17 16:09:35 +05:30
1 parent aeb52e8e89
commit 800256bf2c
17 files changed
+726 -452

No files matched your search

@@ -7,7 +7,9 @@ import PlayButton from "../buttons/playButton";
import TextLink from "../textLink";
import "./musicTrack.scss";
import { useApiInContext } from "@/utils/store/api";
import { useRouteContext } from "@tanstack/react-router";
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
import type { QueryKey } from "@tanstack/react-query";
import lyrics_icon from "../../assets/icons/lyrics.svg";
/**
* @typedef {Object} Props
@@ -33,6 +35,14 @@ const MusicTrack = ({
playlistItemId,
trackIndex,
className = "",
}: {
item: BaseItemDto;
queryKey: QueryKey;
userId: string | undefined;
playlistItem: boolean;
playlistItemId: string;
trackIndex: number;
className: string;
}) => {
const api = useApiInContext((s) => s.api);
const [currentTrackItem] = useAudioPlayback((state) => [state.item]);
@@ -100,13 +110,24 @@ const MusicTrack = ({
opacity: 0.8,
}}
>
{item.ArtistItems.map((artist, index) => (
{item.HasLyrics && (
<img
src={lyrics_icon}
alt="Lyrics"
className="music-track-info-lyrics"
/>
)}
{item.ArtistItems?.map((artist, index) => (
<>
<TextLink
key={index}
variant={"subtitle2"}
location={`/artist/${artist.Id}`}
otherProps={{
fontWeight: 400,
style: {
textDecoration: "none",
},
}}
>
{artist.Name}
+5 -1
View File
@@ -6,6 +6,7 @@
align-items: center;
justify-items: center;
width: 100%;
cursor: pointer;
&-icon {
position: absolute;
top: 0;
@@ -20,7 +21,7 @@
}
&-image {
margin: 0.4em;
border-radius: $border-radius-default;
border-radius: $border-radius_04;
overflow: hidden;
aspect-ratio: 1;
position: relative;
@@ -43,6 +44,9 @@
}
&-info {
justify-self: start;
&-lyrics {
margin-right: 0.4em;
}
}
&:hover {