feat: show queue item from currently playing item in queueButton

This commit is contained in:
Prayag Prajapati committed 2024-09-14 11:33:18 +05:30
1 parent 48af14b64f
commit e82ff1ff0c
5 files changed
+104 -100

No files matched your search

+78 -74
View File
@@ -34,7 +34,7 @@ const QueueButton = () => {
const handlePlay = useMutation({ const handlePlay = useMutation({
mutationKey: ["handlePlayIndex"], mutationKey: ["handlePlayIndex"],
mutationFn: async ({ index }: { index: number }) => { mutationFn: async ({ index }: { index: number }) => {
const result = playItemFromQueue(index, user.data?.Id); const result = playItemFromQueue(index, user.data?.Id, api);
return result; return result;
}, },
onSuccess: () => { onSuccess: () => {
@@ -76,82 +76,86 @@ const QueueButton = () => {
position: "relative", position: "relative",
}} }}
> >
{queueItems.map((item, index) => { {queueItems
return ( .slice(currentItemIndex, queueItems.length - 1)
<MenuItem .map((item, index) => {
className="queue-item" return (
disabled={index === currentItemIndex} <MenuItem
onClick={() => handlePlay.mutate({ index })} className="queue-item"
key={item.Id} disabled={index === 0}
> onClick={() =>
<Typography variant="subtitle2"> handlePlay.mutate({ index: index + currentItemIndex })
{item.Type === "Audio" }
? index + 1 key={item.Id}
: item.IndexNumberEnd >
? `S${item.ParentIndexNumber}:E${item.IndexNumber} / ${item.IndexNumberEnd}` <Typography variant="subtitle2">
: `S${item.ParentIndexNumber}:E${item.IndexNumber}`} {item.Type === "Audio"
</Typography> ? index + 1
<div className="queue-item-image-container"> : item.IndexNumberEnd
{item.ImageTags?.Primary ? ( ? `S${item.ParentIndexNumber}:E${item.IndexNumber} / ${item.IndexNumberEnd}`
<img : `S${item.ParentIndexNumber}:E${item.IndexNumber}`}
className="queue-item-image" </Typography>
src={api?.getItemImageUrl(item?.Id, "Primary", { <div className="queue-item-image-container">
tag: item.ImageTags?.Primary, {item.ImageTags?.Primary ? (
})} <img
alt={item.Name} className="queue-item-image"
/> src={api?.getItemImageUrl(item?.Id, "Primary", {
) : item.AlbumPrimaryImageTag?.length > 0 ? ( tag: item.ImageTags?.Primary,
<img })}
className="queue-item-image" alt={item.Name}
src={api?.getItemImageUrl(item?.AlbumId, "Primary", { />
tag: item.AlbumPrimaryImageTag[0], ) : item.AlbumPrimaryImageTag?.length > 0 ? (
})} <img
alt={item.Name} className="queue-item-image"
/> src={api?.getItemImageUrl(item?.AlbumId, "Primary", {
) : ( tag: item.AlbumPrimaryImageTag[0],
<div className="queue-item-image-icon"> })}
{getTypeIcon(item.Type)} alt={item.Name}
</div> />
)} ) : (
{index === currentItemIndex && ( <div className="queue-item-image-icon">
<span {getTypeIcon(item.Type)}
className="material-symbols-rounded" </div>
style={{ )}
position: "absolute", {index === 0 && (
top: "50%", <span
left: "50%", className="material-symbols-rounded"
transform: "translate(-50%,-50%)", style={{
fontSize: "2em", position: "absolute",
"--wght": "100", top: "50%",
}} left: "50%",
> transform: "translate(-50%,-50%)",
equalizer fontSize: "2em",
</span> "--wght": "100",
)} }}
</div>
<div className="queue-item-info">
{item.SeriesName ? (
<>
<Typography variant="subtitle1" width="100%">
{item.SeriesName}
</Typography>
<Typography
variant="subtitle2"
width="100%"
style={{ opacity: 0.6 }}
> >
equalizer
</span>
)}
</div>
<div className="queue-item-info">
{item.SeriesName ? (
<>
<Typography variant="subtitle1" width="100%">
{item.SeriesName}
</Typography>
<Typography
variant="subtitle2"
width="100%"
style={{ opacity: 0.6 }}
>
{item.Name}
</Typography>
</>
) : (
<Typography variant="subtitle1" width="100%">
{item.Name} {item.Name}
</Typography> </Typography>
</> )}
) : ( </div>
<Typography variant="subtitle1" width="100%"> </MenuItem>
{item.Name} );
</Typography> })}
)}
</div>
</MenuItem>
);
})}
</MenuList> </MenuList>
</Menu> </Menu>
<IconButton onClick={(e) => setButtonEl(e.currentTarget)}> <IconButton onClick={(e) => setButtonEl(e.currentTarget)}>
+7 -5
View File
@@ -439,7 +439,7 @@ const ApiRouteChildren: ApiRouteChildren = {
const ApiRouteWithChildren = ApiRoute._addFileChildren(ApiRouteChildren) const ApiRouteWithChildren = ApiRoute._addFileChildren(ApiRouteChildren)
interface FileRoutesByFullPath { export interface FileRoutesByFullPath {
'/': typeof IndexRoute '/': typeof IndexRoute
'': typeof ApiRouteWithChildren '': typeof ApiRouteWithChildren
'/library': typeof ApiLibraryRouteWithChildren '/library': typeof ApiLibraryRouteWithChildren
@@ -468,7 +468,7 @@ interface FileRoutesByFullPath {
'/login/$userId/$userName': typeof ApiLoginUserIdUserNameRoute '/login/$userId/$userName': typeof ApiLoginUserIdUserNameRoute
} }
interface FileRoutesByTo { export interface FileRoutesByTo {
'/': typeof IndexRoute '/': typeof IndexRoute
'': typeof ApiRouteWithChildren '': typeof ApiRouteWithChildren
'/library': typeof ApiLibraryRouteWithChildren '/library': typeof ApiLibraryRouteWithChildren
@@ -496,7 +496,8 @@ interface FileRoutesByTo {
'/login/$userId/$userName': typeof ApiLoginUserIdUserNameRoute '/login/$userId/$userName': typeof ApiLoginUserIdUserNameRoute
} }
interface FileRoutesById { export interface FileRoutesById {
__root__: typeof rootRoute
'/': typeof IndexRoute '/': typeof IndexRoute
'/_api': typeof ApiRouteWithChildren '/_api': typeof ApiRouteWithChildren
'/_api/library': typeof ApiLibraryRouteWithChildren '/_api/library': typeof ApiLibraryRouteWithChildren
@@ -525,7 +526,7 @@ interface FileRoutesById {
'/_api/login/$userId/$userName': typeof ApiLoginUserIdUserNameRoute '/_api/login/$userId/$userName': typeof ApiLoginUserIdUserNameRoute
} }
interface FileRouteTypes { export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath fileRoutesByFullPath: FileRoutesByFullPath
fullPaths: fullPaths:
| '/' | '/'
@@ -582,6 +583,7 @@ interface FileRouteTypes {
| '/search' | '/search'
| '/login/$userId/$userName' | '/login/$userId/$userName'
id: id:
| '__root__'
| '/' | '/'
| '/_api' | '/_api'
| '/_api/library' | '/_api/library'
@@ -611,7 +613,7 @@ interface FileRouteTypes {
fileRoutesById: FileRoutesById fileRoutesById: FileRoutesById
} }
interface RootRouteChildren { export interface RootRouteChildren {
IndexRoute: typeof IndexRoute IndexRoute: typeof IndexRoute
ApiRoute: typeof ApiRouteWithChildren ApiRoute: typeof ApiRouteWithChildren
ErrorCodeRoute: typeof ErrorCodeRoute ErrorCodeRoute: typeof ErrorCodeRoute
+1
View File
@@ -139,6 +139,7 @@
flex-basis: 14%; flex-basis: 14%;
} }
width: 14%; width: 14%;
flex-basis: 14%;
height: fit-content; height: fit-content;
display: inline-flex; display: inline-flex;
flex-direction: row; flex-direction: row;
+1 -1
View File
@@ -7,7 +7,7 @@ export const Route = createFileRoute("/_api/login")({
const api = context.api; const api = context.api;
if (!api) { if (!api) {
console.info("Awaiting Api generation."); console.info("Awaiting Api generation.");
return; throw redirect({ to: "/login/manual" });
} }
const publicUsers = (await getUserApi(api).getPublicUsers()).data; const publicUsers = (await getUserApi(api).getPublicUsers()).data;
if (publicUsers.length > 0) { if (publicUsers.length > 0) {
+17 -20
View File
@@ -1,4 +1,3 @@
.video { .video {
&-osd { &-osd {
opacity: 0; opacity: 0;
@@ -18,9 +17,9 @@
} }
gap: 0.5em; gap: 0.5em;
} }
&-trick-bubble{ &-trick-bubble {
overflow: hidden; overflow: hidden;
border-radius: $border-radius-default; border-radius: $border-radius-default;
} }
} }
&-osd-visible { &-osd-visible {
@@ -36,7 +35,7 @@
bottom: 0; bottom: 0;
overflow: hidden; overflow: hidden;
} }
&-volume-indicator{ &-volume-indicator {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: 12em; width: 12em;
@@ -50,13 +49,12 @@
right: 2em; right: 2em;
z-index: 10; z-index: 10;
border-radius: 2em; border-radius: 2em;
.material-symbols-rounded{ .material-symbols-rounded {
font-size: 3em; font-size: 3em;
--fill:1; --fill: 1;
} }
} }
} }
video { video {
&::-webkit-media-text-track-display { &::-webkit-media-text-track-display {
overflow: visible !important; overflow: visible !important;
@@ -69,7 +67,6 @@ video {
text-shadow: 0 2px 10px rgb(0 0 0 / 0.8); text-shadow: 0 2px 10px rgb(0 0 0 / 0.8);
} }
} }
.video-player { .video-player {
background: black; background: black;
position: absolute; position: absolute;
@@ -77,7 +74,7 @@ video {
height: 100vh; height: 100vh;
top: 0; top: 0;
left: 0; left: 0;
&-osd{ &-osd {
position: absolute; position: absolute;
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
@@ -90,17 +87,17 @@ video {
justify-content: space-between; justify-content: space-between;
padding: 1em 2em; padding: 1em 2em;
background: linear-gradient(to top, rgb(0 0 0 / 0.7) 5vh, transparent 26vh 90vh, rgb(0 0 0 / 0.7)); background: linear-gradient(to top, rgb(0 0 0 / 0.7) 5vh, transparent 26vh 90vh, rgb(0 0 0 / 0.7));
&.hovering{ &.hovering {
cursor: default; cursor: default;
} }
&-controls{ &-controls {
&-progress{ &-progress {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 0.2em; gap: 0.2em;
align-items: stretch; align-items: stretch;
justify-content: center; justify-content: center;
&-text{ &-text {
display: flex; display: flex;
align-items: stretch; align-items: stretch;
justify-content: space-between; justify-content: space-between;
@@ -113,12 +110,12 @@ video {
align-items: center; align-items: center;
} }
} }
.MuiSlider-valueLabel { .MuiSlider-valueLabel {
padding: 0; padding: 0;
background: transparent; background: transparent;
overflow: hidden; overflow: hidden;
border-radius: $border-radius-default; border-radius: $border-radius-default;
border: 1.2px solid rgb(255 255 255 / 0.1); border: 1.2px solid rgb(255 255 255 / 0.1);
} }
} }
} }