Update card component and sidemenu

This commit is contained in:
Prayag Prajapati committed 2023-11-25 16:56:52 +05:30
1 parent 537176b77d
commit 81d188ac5a
9 files changed
+432 -651

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 469 KiB

+22
View File
@@ -0,0 +1,22 @@
<svg width="1155" height="1264" viewBox="0 0 1155 1264" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<path d="M968.546 551.878C981.951 559.555 993.091 570.638 1000.84 584.005C1008.59 597.372 1012.67 612.549 1012.67 628C1012.67 643.451 1008.59 658.628 1000.84 671.995C993.091 685.362 981.951 696.445 968.546 704.122L272.816 1107.92C215.959 1140.95 138 1103.21 138 1031.79V628V224.205C138 152.787 215.959 115.054 272.816 148.084L620.681 349.981L968.546 551.878Z" fill="url(#pattern0)"/>
<g filter="url(#filter0_d_33_14)">
<path d="M138 628V1031.79C138 1103.21 215.959 1140.95 272.816 1107.92L968.546 704.122C981.951 696.445 993.091 685.362 1000.84 671.995C1008.59 658.628 1012.67 643.451 1012.67 628C1012.67 612.549 1008.59 597.372 1000.84 584.005C993.091 570.638 981.951 559.555 968.546 551.878L620.681 349.981M138 628V224.205C138 152.787 215.959 115.054 272.816 148.084L620.681 349.981M138 628L620.681 349.981" stroke="white" stroke-width="100" shape-rendering="crispEdges"/>
</g>
<defs>
<pattern id="pattern0" patternContentUnits="objectBoundingBox" width="1" height="1">
<use xlink:href="#image0_33_14" transform="translate(-0.0625001 1) scale(0.000274658 0.000244141) rotate(-90)"/>
</pattern>
<filter id="filter0_d_33_14" x="0" y="0.237759" width="1154.67" height="1263.52" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dx="2" dy="4"/>
<feGaussianBlur stdDeviation="45"/>
<feComposite in2="hardAlpha" operator="out"/>
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_33_14"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_33_14" result="shape"/>
</filter>
<image id="image0_33_14" width="4096" height="4096" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAEAAAABAACAYAAADyoyQXAAAAAXNSR0IArs4c6QAAIABJREFUeF7s/QmS5DquNIxm3V7I/63jvv0v6556poEiAGJwJ6nIrNPV1nYqU8LgcAxSKETmr//39f/7/fX19fXr+I/5nz2WySD6nh9ED5GRthF5RIbF69scjzK8ormJ5CpeGPuI7AyvqM6af+1F/ub5n/XVWmjWvvUbYUPyjcqgcihPsZx/BuFqhRfUPtrvckwivRzJZ7lFsDD61RSq4mB8Ididyw10Dcpqtbp+IT3t4fJ6esex3RxUOcowV7zOzKHKJst1hb/y90YMKOdIbVb4URtoXc3yv2qf5ext+YyHFc4Zu4wsywdjm5X9SVhY7JH8+YFow/9W7WD6WirT6edmdDQhkR//+O8ve1z+np37MpqjbBSV1dS/X1oR2jxW6THGPtrmOIgzWduJObkiG6NvGmNe4loZdXy/nu0YA+qvlutZ1PXn47mZ+R8RQxtu/zce+/0/okZuOcnqbzsY//n6ksceWSH34HKG6hnB9f/rf8pny6rh5JS5PZmiUb/+6vx4Vff7PPhb4W8wxlo0tXX8arDaaeD6PHR+j3PjxGFm85DPX52oWHb06svmNd15QOwZbkQctppdTm55a+VOj2Kl1wniU9eWz7o3E+Me9KdMr1+L+feRsyCvIceyHwJu4jrNMuddGTxWbjm3t3JuIn6iq5KXxYExxcdYt15N3Z1dcs/JtbHj987gzF6JTS14cUZ5lZmL4o049q5JJVbTdZBPR8ivrjbXPRT92Kwunh0MR8rV4yxjaIOfnCrnbI2HMbnXGuMZkV3/tLZu4TM4ES9rMp0JnhNeQ2P95T4r5eLhMFTPj9/w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2k6MisGLZphBXPtHvXZe46ebtbfDCiqFyV24mAygdrNasVWG2rywYtKMFCZbcY9WNTLT0CgrTDq763EyWR1nCdp7KM699YCiw/K3VuNSm+nOeH7jFYXXFJenCNtaTTWrPhYcIS5ZXZvnLM1p9ejX9JGcYzWZ54O943pffpU3ZBrsiGIvzh2IfqIN/BMnLvkT4/xvxvQ3czr7a88MJypJOPyuXNR+awkm8r3WYs+cH066eZ3TqmruOO9bTv2Zk8x3EzNx4Drc817crvw711gFurYDhw9qcbsQYRu+sxB/iV4i6/reT10ymkOef3lswNEqyVGcw+LjlkcVnucXs5j+DjX6a+9eZvuGAoEtswFA76Kx/iRPDWL/95a3GwCcH5HbuY7w0JO6snuvcyNn46LwMSa5OULDK31dfvoZrw40Nr0Y/ZlhdhMAZwOAU/PsA7GI/l7w/+tOjNqA4Obp2Vyg8XYu+L82BThZ+8+9QcA/PSMeZ7a+vJzJfLeftZz10ae4lOucSXndWV6+rS9bTxaz4vKuIRm7rVGNUdeLxJzWor8BwEWEN6ZlUdmLXnYuu0BaPcSOd0kcCz4boP4ldQZL5tfHOUaY+fX4iG4JKu522vIuZJV/VIeJzw5Y79Lv45JjZNSqYom4tNgZzr0+YfWRGkYxonJVD4yjVfON6+c9Xc2FqK68umRld8uv1B/Cg52AMzMomutoDdquQ/Wy3otymeVn1h4zp2Z9MP2P+GDsZdft1XPenF61ic7kqu6yGkLPvRHfim+kNhD+0evrbPxMbnZgyXCuYmFsM7JMLLine truncated
</defs>
</svg>

After

Width:  |  Height:  |  Size: 4.9 MiB

+67 -72
View File
@@ -47,82 +47,77 @@ export const ActorCard = ({
navigate(`/person/${item.Id}`);
};
return (
<CardActionArea
style={{
padding: disablePadding ? 0 : "0.6em",
borderRadius: "calc(0.6em + 6px)",
}}
className="card-container"
<div
className="card card-actor"
elevation={0}
onClick={onClick ? onClick : defaultOnClick}
>
<MuiCard className="card card-actor" elevation={0}>
<div className="card-box">
<div
className="card-image-container"
style={{
aspectRatio: 1,
}}
>
{!!imageBlurhash && (
<Blurhash
hash={imageBlurhash}
width={128}
height={128}
resolutionX={24}
resolutionY={24}
className="card-image-blurhash"
/>
)}
<div className="card-image-icon-container">
<div className="material-symbols-rounded">
person
</div>
</div>
<img
src={api.getItemImageUrl(
seriesId ? item.SeriesId : item.Id,
"Primary",
{
quality: 80,
fillHeight: 448,
fillWidth: 448,
},
)}
style={{
height: "100%",
width: "100%",
opacity: 0,
}}
loading="lazy"
onLoad={(e) => (e.target.style.opacity = 1)}
className="card-image"
<div className="card-box">
<div
className="card-image-container"
style={{
aspectRatio: 1,
}}
>
{!!imageBlurhash && (
<Blurhash
hash={imageBlurhash}
width={128}
height={128}
resolutionX={24}
resolutionY={24}
className="card-image-blurhash"
/>
)}
<div className="card-image-icon-container">
<div className="material-symbols-rounded">
person
</div>
</div>
<div
className="card-text-container"
style={{ display: hideText ? "none" : "block" }}
>
<Typography
variant="subtitle1"
fontWeight={500}
noWrap
textAlign="center"
style={{ opacity: 0.9 }}
>
{cardTitle}
</Typography>
<Typography
variant="subtitle2"
noWrap
textAlign="center"
style={{ opacity: 0.6 }}
lineHeight="auto"
>
{cardCaption}
</Typography>
</div>
<img
src={api.getItemImageUrl(
seriesId ? item.SeriesId : item.Id,
"Primary",
{
quality: 80,
fillHeight: 448,
fillWidth: 448,
},
)}
style={{
height: "100%",
width: "100%",
opacity: 0,
}}
loading="lazy"
onLoad={(e) => (e.target.style.opacity = 1)}
className="card-image"
/>
</div>
</MuiCard>
</CardActionArea>
<div
className="card-text-container"
style={{ display: hideText ? "none" : "block" }}
>
<Typography
variant="subtitle1"
fontWeight={500}
noWrap
textAlign="center"
style={{ opacity: 0.9 }}
>
{cardTitle}
</Typography>
<Typography
variant="subtitle2"
noWrap
textAlign="center"
style={{ opacity: 0.6 }}
lineHeight="auto"
>
{cardCaption}
</Typography>
</div>
</div>
</div>
);
};
+169 -181
View File
@@ -88,192 +88,180 @@ export const Card = ({
}
};
return (
<CardActionArea
style={{
padding: disablePadding ? 0 : "0.6em",
borderRadius: "calc(0.6em + 6px)",
}}
className="card-container"
<div
className="card"
elevation={0}
tabIndex={0}
onClick={onClick ? onClick : defaultOnClick}
>
<MuiCard className="card" elevation={0}>
<div className="card-box">
<div
className="card-image-container"
style={{
aspectRatio: cardImageAspectRatios[cardType],
}}
>
{!!item.UserData && (
<>
<div
className="card-indicator check"
style={{
opacity: item.UserData?.Played
? 1
: 0,
}}
>
<div className="material-symbols-rounded">
done
</div>
</div>
<div
className={`card-indicator text`}
style={{
opacity: item.UserData
?.UnplayedItemCount
? 1
: 0,
}}
>
<Typography
variant="subtitle2"
padding="0.1em 0.4em"
fontWeight={400}
>
{
item.UserData
?.UnplayedItemCount
}
</Typography>
</div>
</>
)}
{!!imageBlurhash && (
<Blurhash
hash={imageBlurhash}
width={128}
height={128}
resolutionX={24}
resolutionY={24}
className="card-image-blurhash"
/>
)}
<div className="card-image-icon-container">
{overrideIcon
? getTypeIcon(overrideIcon)
: getTypeIcon(item.Type)}
</div>
<img
src={
overrideIcon == "User"
? `${api.basePath}/Users/${item.Id}/Images/Primary`
: api.getItemImageUrl(
seriesId
? item.SeriesId
: item.AlbumId
? item.AlbumId
: item.Id,
imageType,
{
quality: 85,
fillHeight: 462,
fillWidth: 462,
},
)
}
style={{
height: "100%",
width: "100%",
opacity: 0,
}}
loading="lazy"
onLoad={(e) => (e.target.style.opacity = 1)}
className="card-image"
/>
{!disableOverlay && (
<div className="card-overlay">
<PlayButton
itemId={item.Id}
userId={userId}
itemType={item.Type}
currentAudioTrack={0}
currentSubTrack={0}
currentVideoTrack={0}
className="card-play-button"
iconProps={{
style: { fontSize: "2.5em" },
}}
iconOnly
audio={
item.Type ==
BaseItemKind.MusicAlbum ||
item.Type ==
BaseItemKind.Audio ||
item.Type ==
BaseItemKind.AudioBook ||
item.Type ==
BaseItemKind.Playlist
}
playlistItem={
item.Type ==
BaseItemKind.Playlist
}
playlistItemId={item.Id}
/>
<LikeButton
itemId={item.Id}
itemName={item.Name}
isFavorite={
item.UserData?.IsFavorite
}
queryKey={queryKey}
userId={userId}
/>
<MarkPlayedButton
itemId={item.Id}
itemName={item.Name}
isPlayed={item.UserData?.Played}
queryKey={queryKey}
userId={userId}
/>
</div>
)}
{item.UserData?.PlaybackPositionTicks > 0 && (
<LinearProgress
variant="determinate"
value={item.UserData?.PlayedPercentage}
<div className="card-box">
<div
className="card-image-container"
style={{
aspectRatio: cardImageAspectRatios[cardType],
}}
>
{!!item.UserData && (
<>
<div
className="card-indicator check"
style={{
position: "absolute",
left: 0,
right: 0,
bottom: 0,
zIndex: 2,
height: "6px",
background:
"rgb(5 5 5 / 0.5) !important",
backdropFilter: "blur(5px)",
opacity: item.UserData?.Played
? 1
: 0,
}}
color="primary"
>
<div className="material-symbols-rounded">
done
</div>
</div>
<div
className={`card-indicator text`}
style={{
opacity: item.UserData
?.UnplayedItemCount
? 1
: 0,
}}
>
<Typography
variant="subtitle2"
padding="0.1em 0.4em"
fontWeight={400}
>
{item.UserData?.UnplayedItemCount}
</Typography>
</div>
</>
)}
{!!imageBlurhash && (
<Blurhash
hash={imageBlurhash}
width={128}
height={128}
resolutionX={24}
resolutionY={24}
className="card-image-blurhash"
/>
)}
<div className="card-image-icon-container">
{overrideIcon
? getTypeIcon(overrideIcon)
: getTypeIcon(item.Type)}
</div>
<img
src={
overrideIcon == "User"
? `${api.basePath}/Users/${item.Id}/Images/Primary`
: api.getItemImageUrl(
seriesId
? item.SeriesId
: item.AlbumId
? item.AlbumId
: item.Id,
imageType,
{
quality: 85,
fillHeight: 462,
fillWidth: 462,
},
)
}
style={{
height: "100%",
width: "100%",
opacity: 0,
}}
loading="lazy"
onLoad={(e) => (e.target.style.opacity = 1)}
className="card-image"
/>
{!disableOverlay && (
<div className="card-overlay">
<PlayButton
itemId={item.Id}
userId={userId}
itemType={item.Type}
currentAudioTrack={0}
currentSubTrack={0}
currentVideoTrack={0}
className="card-play-button"
iconProps={{
style: { fontSize: "2.5em" },
}}
iconOnly
audio={
item.Type ==
BaseItemKind.MusicAlbum ||
item.Type == BaseItemKind.Audio ||
item.Type ==
BaseItemKind.AudioBook ||
item.Type == BaseItemKind.Playlist
}
playlistItem={
item.Type == BaseItemKind.Playlist
}
playlistItemId={item.Id}
/>
)}
</div>
<div
className="card-text-container"
style={{ display: hideText ? "none" : "block" }}
>
<Typography
variant="subtitle1"
fontWeight={500}
noWrap
textAlign="center"
style={{ opacity: 0.9 }}
>
{cardTitle}
</Typography>
<Typography
variant="subtitle2"
noWrap
textAlign="center"
style={{ opacity: 0.6 }}
lineHeight="auto"
>
{cardCaption}
</Typography>
</div>
<LikeButton
itemId={item.Id}
itemName={item.Name}
isFavorite={item.UserData?.IsFavorite}
queryKey={queryKey}
userId={userId}
/>
<MarkPlayedButton
itemId={item.Id}
itemName={item.Name}
isPlayed={item.UserData?.Played}
queryKey={queryKey}
userId={userId}
/>
</div>
)}
{item.UserData?.PlaybackPositionTicks > 0 && (
<LinearProgress
variant="determinate"
value={item.UserData?.PlayedPercentage}
style={{
position: "absolute",
left: 0,
right: 0,
bottom: 0,
zIndex: 2,
height: "6px",
background:
"rgb(5 5 5 / 0.5) !important",
backdropFilter: "blur(5px)",
}}
color="primary"
/>
)}
</div>
</MuiCard>
</CardActionArea>
<div
className="card-text-container"
style={{ display: hideText ? "none" : "block" }}
>
<Typography
variant="subtitle1"
fontWeight={500}
noWrap
textAlign="center"
style={{ opacity: 0.9 }}
>
{cardTitle}
</Typography>
<Typography
variant="subtitle2"
noWrap
textAlign="center"
style={{ opacity: 0.6 }}
lineHeight="auto"
>
{cardCaption}
</Typography>
</div>
</div>
</div>
);
};
+21 -9
View File
@@ -4,6 +4,7 @@
overflow: visible !important;
align-items: flex-start;
background: transparent !important;
padding: 0.4em;
&-box {
display: flex;
width: 100%;
@@ -25,7 +26,7 @@
&-container {
position: relative;
width: 100%;
border-radius: $border-radius-default;
border-radius: 8px;
box-shadow: 0 4px 8px rgb(0 0 0 / 0.2);
overflow: hidden;
height: auto;
@@ -59,6 +60,8 @@
left: 0;
width: 100% !important;
height: 100% !important;
border-radius: 8px;
overflow: hidden;
}
}
&-overlay {
@@ -75,14 +78,22 @@
align-items: flex-end;
justify-content: flex-end;
padding: 0.5em;
border-radius: 8px;
}
&-container:hover,
&-container:focus,
&-container:focus-within {
&:hover,
&:focus,
&:focus-within {
.card-overlay {
opacity: 1;
}
}
&:hover {
cursor: pointer;
}
&:focus {
outline: none;
}
&-play-button {
position: absolute !important;
top: 50%;
@@ -105,11 +116,6 @@
border-radius: 100px;
box-shadow: 0 0 5px rgb(0 0 0 / 0.2);
}
&-text {
&-container {
height: 15%;
}
}
&-episode {
.card-box {
height: unset !important;
@@ -117,6 +123,12 @@
}
&-actor {
transition: all $transition-time-default;
border-radius: 10px;
// padding: 1em !important;
&:hover {
background: rgb(255 255 255 / 0.1) !important;
}
.card-image-container {
border-radius: 100% !important;
}
+141 -152
View File
@@ -51,170 +51,159 @@ export const EpisodeCard = ({
navigate(`/episode/${item.Id}`);
};
return (
<CardActionArea
style={{
padding: "0.6em",
borderRadius: "calc(0.6em + 6px)",
}}
className="card-container"
<div
className="card card-episode"
elevation={0}
onClick={onClick ? onClick : defaultOnClick}
>
<MuiCard className="card card-episode" elevation={0}>
<div className="card-box">
<div
className="card-image-container"
<div className="card-box">
<div
className="card-image-container"
style={{
aspectRatio: 1.777,
}}
>
{!!item.UserData && (
<div
className="card-indicator check"
style={{
opacity: item.UserData?.Played ? 1 : 0,
}}
>
<div className="material-symbols-rounded">
done
</div>
</div>
)}
{!!imageBlurhash && (
<Blurhash
hash={imageBlurhash}
width={128}
height={128}
resolutionX={24}
resolutionY={24}
className="card-image-blurhash"
/>
)}
<div className="card-image-icon-container">
<div className="material-symbols-rounded">
tv_gen
</div>
</div>
<img
src={api.getItemImageUrl(item.Id, "Primary", {
quality: 90,
fillHeight: 512,
fillWidth: 512,
})}
style={{
aspectRatio: 1.777,
height: "100%",
width: "100%",
opacity: 0,
}}
loading="lazy"
onLoad={(e) => (e.target.style.opacity = 1)}
className="card-image"
/>
<div className="card-overlay">
<PlayButton
itemId={item.Id}
userId={userId}
itemType={item.Type}
currentAudioTrack={0}
currentSubTrack={0}
currentVideoTrack={0}
className="card-play-button"
iconProps={{
style: { fontSize: "2.5em" },
}}
iconOnly
/>
<LikeButton
itemId={item.Id}
itemName={item.Name}
isFavorite={item.UserData?.IsFavorite}
queryKey={queryKey}
userId={userId}
/>
<MarkPlayedButton
itemId={item.Id}
itemName={item.Name}
isPlayed={item.UserData.Played}
queryKey={queryKey}
userId={userId}
/>
</div>
{100 > item.UserData?.PlayedPercentage > 0 && (
<LinearProgress
variant="determinate"
value={item.UserData.PlayedPercentage}
style={{
position: "absolute",
left: 0,
right: 0,
bottom: 0,
zIndex: 2,
height: "6px",
background:
"rgb(5 5 5 / 0.5) !important",
backdropFilter: "blur(5px)",
}}
color="primary"
/>
)}
</div>
<div
className="card-text-container"
style={{ display: "block", marginTop: "0.5em" }}
>
<div
style={{
display: "flex",
alignItems: "center",
justifyContent: "space-between",
gap: "1em",
}}
>
{!!item.UserData && (
<div
className="card-indicator check"
style={{
opacity: item.UserData?.Played
? 1
: 0,
}}
>
<div className="material-symbols-rounded">
done
</div>
</div>
)}
{!!imageBlurhash && (
<Blurhash
hash={imageBlurhash}
width={128}
height={128}
resolutionX={24}
resolutionY={24}
className="card-image-blurhash"
/>
)}
<div className="card-image-icon-container">
<div className="material-symbols-rounded">
tv_gen
</div>
</div>
<img
src={api.getItemImageUrl(
item.Id,
"Primary",
{
quality: 90,
fillHeight: 512,
fillWidth: 512,
},
)}
style={{
height: "100%",
width: "100%",
opacity: 0,
}}
loading="lazy"
onLoad={(e) => (e.target.style.opacity = 1)}
className="card-image"
/>
<div className="card-overlay">
<PlayButton
itemId={item.Id}
userId={userId}
itemType={item.Type}
currentAudioTrack={0}
currentSubTrack={0}
currentVideoTrack={0}
className="card-play-button"
iconProps={{
style: { fontSize: "2.5em" },
}}
iconOnly
/>
<LikeButton
itemId={item.Id}
itemName={item.Name}
isFavorite={item.UserData?.IsFavorite}
queryKey={queryKey}
userId={userId}
/>
<MarkPlayedButton
itemId={item.Id}
itemName={item.Name}
isPlayed={item.UserData.Played}
queryKey={queryKey}
userId={userId}
/>
</div>
{100 > item.UserData?.PlayedPercentage > 0 && (
<LinearProgress
variant="determinate"
value={item.UserData.PlayedPercentage}
style={{
position: "absolute",
left: 0,
right: 0,
bottom: 0,
zIndex: 2,
height: "6px",
background:
"rgb(5 5 5 / 0.5) !important",
backdropFilter: "blur(5px)",
}}
color="primary"
/>
)}
</div>
<div
className="card-text-container"
style={{ display: "block", marginTop: "0.5em" }}
>
<div
style={{
display: "flex",
alignItems: "center",
justifyContent: "space-between",
gap: "1em",
}}
>
<Typography
variant="subtitle1"
fontWeight={500}
textAlign="start"
noWrap
style={{
opacity: 0.9,
}}
>
{cardTitle}
</Typography>
<Typography
variant="subtitle1"
fontWeight={500}
noWrap
textAlign="start"
style={{ opacity: 0.8, flexShrink: 0 }}
>
{getRuntimeCompact(item.RunTimeTicks)}
</Typography>
</div>
<Typography
variant="subtitle2"
variant="subtitle1"
fontWeight={500}
textAlign="start"
noWrap
style={{
opacity: 0.6,
display: "-webkit-box",
overflow: "hidden",
WebkitBoxOrient: "vertical",
WebkitLineClamp: 3,
opacity: 0.9,
}}
lineHeight="auto"
>
{cardCaption}
{cardTitle}
</Typography>
<Typography
variant="subtitle1"
fontWeight={500}
noWrap
textAlign="start"
style={{ opacity: 0.8, flexShrink: 0 }}
>
{getRuntimeCompact(item.RunTimeTicks)}
</Typography>
</div>
<Typography
variant="subtitle2"
textAlign="start"
style={{
opacity: 0.6,
display: "-webkit-box",
overflow: "hidden",
WebkitBoxOrient: "vertical",
WebkitLineClamp: 3,
}}
lineHeight="auto"
>
{cardCaption}
</Typography>
</div>
</MuiCard>
</CardActionArea>
</div>
</div>
);
};
+6 -237
View File
@@ -1,43 +1,24 @@
/** @format */
import React from "react";
import { useEffect, useState } from "react";
import { delUser } from "../../utils/storage/user";
import React, { useEffect, useState } from "react";
import { useQuery } from "@tanstack/react-query";
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
import { useNavigate, NavLink, useLocation } from "react-router-dom";
import { NavLink, useLocation } from "react-router-dom";
import { styled } from "@mui/material/styles";
import Skeleton from "@mui/material/Skeleton";
import Tooltip from "@mui/material/Tooltip";
import List from "@mui/material/List";
import ListItem from "@mui/material/ListItem";
import ListItemIcon from "@mui/material/ListItemIcon";
import ListItemButton from "@mui/material/ListItemButton";
import IconButton from "@mui/material/IconButton";
import Divider from "@mui/material/Divider";
import MuiDrawer from "@mui/material/Drawer";
import ListItemText from "@mui/material/ListItemText";
import Typography from "@mui/material/Typography";
import { MdiClose } from "../icons/mdiClose";
import { MdiLogoutVariant } from "../icons/mdiLogoutVariant";
import {
MediaCollectionTypeIconCollection,
getTypeIcon,
} from "../../components/utils/iconsCollection.jsx";
import { MdiHomeVariantOutline } from "../icons/mdiHomeVariantOutline";
import { EventEmitter as event } from "../../eventEmitter.js";
import { getTypeIcon } from "../../components/utils/iconsCollection.jsx";
import "./sidemenu.module.scss";
import { useDrawerStore } from "../../utils/store/drawer";
import { useApi } from "../../utils/store/api";
import Icon from "../../assets/icon.png";
const DrawerHeader = styled("div")(({ theme }) => ({
display: "flex",
alignItems: "center",
@@ -62,7 +43,6 @@ export const SideMenu = () => {
const [display, setDisplay] = useState(false);
const navigate = useNavigate();
const user = useQuery({
queryKey: ["user"],
queryFn: async () => {
@@ -84,15 +64,6 @@ export const SideMenu = () => {
networkMode: "always",
});
const handleLogout = async () => {
console.log("Logging out user...");
await api.logout();
delUser();
sessionStorage.removeItem("accessToken");
event.emit("create-jellyfin-api", api.basePath);
navigate("/login");
};
useEffect(() => {
if (
location.pathname.includes("login") ||
@@ -108,15 +79,6 @@ export const SideMenu = () => {
}
}, [location]);
const [open, setDrawerOpen] = useDrawerStore((state) => [
state.open,
state.setOpen,
]);
const handleDrawerOpen = () => {
setDrawerOpen(true);
};
if (!display) {
return <></>;
}
@@ -148,15 +110,7 @@ export const SideMenu = () => {
justifyContent: "center",
}}
>
<IconButton
color="inherit"
aria-label="open drawer"
onClick={handleDrawerOpen}
>
<div className="material-symbols-rounded">
menu
</div>
</IconButton>
<img src={Icon} className="sidemenu-icon" />
</DrawerHeader>
<div className="sidemenu-item-container">
{libraries.isPending ? (
@@ -227,191 +181,6 @@ export const SideMenu = () => {
)}
</div>
</MiniDrawer>
<MuiDrawer
open={open}
variant="persistent"
onClose={() => setDrawerOpen(false)}
elevation={0}
PaperProps={{
sx: {
background: "rgb(0 0 0 / 0.5)",
backdropFilter: "blur(10px)",
boxShadow: "0 0 15px rgb(0 0 0 / 0.2)",
width: 260,
},
}}
className="sidemenu-open"
>
<DrawerHeader
className="Mui-DrawerHeader"
sx={{
justifyContent: "flex-start",
}}
>
<IconButton onClick={() => setDrawerOpen(false)}>
<div className="material-symbols-rounded">
close
</div>
</IconButton>
</DrawerHeader>
<Divider />
{libraries.isPending ? (
<>
<Skeleton
height="100%"
variant="rounded"
width="calc(100% - 10px )"
sx={{ margin: "5px" }}
></Skeleton>
</>
) : (
<>
<List sx={{ border: "none" }}>
<Tooltip
title="Home"
placement="right"
followCursor
arrow
>
<ListItem
className="sidemenu-item-container"
disablePadding
sx={{
mt: "0em !important",
}}
>
<ListItemButton
component={NavLink}
to={"home"}
className="sidemenu-item"
sx={{
minHeight: 48,
justifyContent:
"center",
px: 2.5,
flexDirection:
"row",
}}
>
<ListItemIcon
sx={{
minWidth: 0,
justifyContent:
"center",
mr: 2,
}}
>
<div className="material-symbols-rounded">
home
</div>
</ListItemIcon>
<ListItemText>
Home
</ListItemText>
</ListItemButton>
</ListItem>
</Tooltip>
{libraries.data.Items.map(
(library, index) => {
return (
<Tooltip
title={library.Name}
placement="right"
arrow
followCursor
key={index}
>
<ListItem
className="sidemenu-item-container"
disablePadding
sx={{
mt: "0em !important",
}}
>
<ListItemButton
component={
NavLink
}
to={
"/library/" +
library.Id
}
className="sidemenu-item"
sx={{
minHeight: 48,
justifyContent:
"center",
px: 2.5,
flexDirection:
"row",
}}
>
<ListItemIcon
sx={{
minWidth: 0,
justifyContent:
"center",
mr: 2,
}}
>
{getTypeIcon(
library.CollectionType,
)}
</ListItemIcon>
<ListItemText>
{
library.Name
}
</ListItemText>
</ListItemButton>
</ListItem>
</Tooltip>
);
},
)}
</List>
<List sx={{ marginTop: "auto" }}>
<Divider />
<Tooltip
title="Logout"
placement="right"
followCursor
arrow
>
<ListItem disablePadding>
<ListItemButton
sx={{
minHeight: 48,
justifyContent:
"center",
px: 2.5,
}}
onClick={handleLogout}
>
<ListItemIcon
sx={{
minWidth: 0,
justifyContent:
"center",
mr: 2,
}}
>
<div className="material-symbols-rounded">
logout
</div>
</ListItemIcon>
<ListItemText>
Logout
</ListItemText>
</ListItemButton>
</ListItem>
</Tooltip>
</List>
</>
)}
</MuiDrawer>
</>
);
}
+5
View File
@@ -1,11 +1,16 @@
/** @format */
.sidemenu {
&-icon {
width: 60%;
object-fit: cover;
}
&-item {
&-container {
display: flex;
flex-direction: column;
margin-top: 1em;
overflow-y: auto;
}
position: relative;
+1
View File
@@ -13,6 +13,7 @@ $border-radius: 20px;
padding: 0.25em 0;
background: hsl(256, 100%, 4%, 40%);
transition: background $transition-time-default;
backdrop-filter: blur(5px);
&:first-child {
border-radius: $border-radius $border-radius 8px 8px;