Improve Card display in Library Page #176
This commit is contained in:
3 files changed
+74
-11
No files matched your search
@@ -216,7 +216,7 @@ export const Card = ({
|
|||||||
<MarkPlayedButton
|
<MarkPlayedButton
|
||||||
itemId={item.Id}
|
itemId={item.Id}
|
||||||
itemName={item.Name}
|
itemName={item.Name}
|
||||||
isPlayed={item.UserData.Played}
|
isPlayed={item.UserData?.Played}
|
||||||
queryKey={queryKey}
|
queryKey={queryKey}
|
||||||
userId={userId}
|
userId={userId}
|
||||||
/>
|
/>
|
||||||
@@ -225,7 +225,7 @@ export const Card = ({
|
|||||||
{item.UserData?.PlaybackPositionTicks > 0 && (
|
{item.UserData?.PlaybackPositionTicks > 0 && (
|
||||||
<LinearProgress
|
<LinearProgress
|
||||||
variant="determinate"
|
variant="determinate"
|
||||||
value={item.UserData.PlayedPercentage}
|
value={item.UserData?.PlayedPercentage}
|
||||||
style={{
|
style={{
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
left: 0,
|
left: 0,
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ const LibraryView = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const [sortAscending, setSortAscending] = useState(true);
|
const [sortAscending, setSortAscending] = useState(true);
|
||||||
const [sortBy, setSortBy] = useState("SortName");
|
const [sortBy, setSortBy] = useState("");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {{title: string, value: string}} SortObject
|
* @typedef {{title: string, value: string}} SortObject
|
||||||
@@ -199,8 +199,13 @@ const LibraryView = () => {
|
|||||||
{ title: "3D", value: false, state: (val) => setIs3D(val) },
|
{ title: "3D", value: false, state: (val) => setIs3D(val) },
|
||||||
];
|
];
|
||||||
|
|
||||||
const [currentViewType, setCurrentViewType] = useState(undefined);
|
const [currentViewType, setCurrentViewType] = useState("");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {[SortObject[], Function]}
|
||||||
|
*/
|
||||||
const [viewType, setViewType] = useState([]);
|
const [viewType, setViewType] = useState([]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (currentLib.isSuccess) {
|
if (currentLib.isSuccess) {
|
||||||
if (currentLib.data.Items[0].CollectionType == "movies") {
|
if (currentLib.data.Items[0].CollectionType == "movies") {
|
||||||
@@ -306,26 +311,36 @@ const LibraryView = () => {
|
|||||||
result = await getArtistsApi(window.api).getAlbumArtists({
|
result = await getArtistsApi(window.api).getAlbumArtists({
|
||||||
userId: user.data.Id,
|
userId: user.data.Id,
|
||||||
parentId: libraryId,
|
parentId: libraryId,
|
||||||
|
startIndex: maxDisplayItems * (page - 1),
|
||||||
|
limit: maxDisplayItems,
|
||||||
});
|
});
|
||||||
} else if (currentViewType == "Person") {
|
} else if (currentViewType == "Person") {
|
||||||
result = await getPersonsApi(window.api).getPersons({
|
result = await getPersonsApi(window.api).getPersons({
|
||||||
userId: user.data.Id,
|
userId: user.data.Id,
|
||||||
personTypes: ["Actor"],
|
personTypes: ["Actor"],
|
||||||
|
startIndex: maxDisplayItems * (page - 1),
|
||||||
|
limit: maxDisplayItems,
|
||||||
});
|
});
|
||||||
} else if (currentViewType == "Genre") {
|
} else if (currentViewType == "Genre") {
|
||||||
result = await getGenresApi(window.api).getGenres({
|
result = await getGenresApi(window.api).getGenres({
|
||||||
userId: user.data.Id,
|
userId: user.data.Id,
|
||||||
parentId: libraryId,
|
parentId: libraryId,
|
||||||
|
startIndex: maxDisplayItems * (page - 1),
|
||||||
|
limit: maxDisplayItems,
|
||||||
});
|
});
|
||||||
} else if (currentViewType == "MusicGenre") {
|
} else if (currentViewType == "MusicGenre") {
|
||||||
result = await getMusicGenresApi(window.api).getMusicGenres({
|
result = await getMusicGenresApi(window.api).getMusicGenres({
|
||||||
userId: user.data.Id,
|
userId: user.data.Id,
|
||||||
parentId: libraryId,
|
parentId: libraryId,
|
||||||
|
startIndex: maxDisplayItems * (page - 1),
|
||||||
|
limit: maxDisplayItems,
|
||||||
});
|
});
|
||||||
} else if (currentViewType == "Studio") {
|
} else if (currentViewType == "Studio") {
|
||||||
result = await getStudiosApi(window.api).getStudios({
|
result = await getStudiosApi(window.api).getStudios({
|
||||||
userId: user.data.Id,
|
userId: user.data.Id,
|
||||||
parentId: libraryId,
|
parentId: libraryId,
|
||||||
|
startIndex: maxDisplayItems * (page - 1),
|
||||||
|
limit: maxDisplayItems,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
result = await getItemsApi(window.api).getItems({
|
result = await getItemsApi(window.api).getItems({
|
||||||
@@ -509,9 +524,15 @@ const LibraryView = () => {
|
|||||||
<div className="library-items">
|
<div className="library-items">
|
||||||
<div className="library-items-header">
|
<div className="library-items-header">
|
||||||
<div className="library-items-options">
|
<div className="library-items-options">
|
||||||
|
{disabledSortViews.includes(currentViewType) ? (
|
||||||
|
<></>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
setSortAscending(!sortAscending)
|
setSortAscending(
|
||||||
|
!sortAscending,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{sortAscending ? (
|
{sortAscending ? (
|
||||||
@@ -522,12 +543,36 @@ const LibraryView = () => {
|
|||||||
</IconButton>
|
</IconButton>
|
||||||
|
|
||||||
<TextField
|
<TextField
|
||||||
|
disabled={!Boolean(sortBy)}
|
||||||
select
|
select
|
||||||
value={sortBy}
|
value={sortBy}
|
||||||
onChange={handleSortBy}
|
onChange={handleSortBy}
|
||||||
size="small"
|
size="small"
|
||||||
>
|
>
|
||||||
{sortByData.map((option, index) => (
|
{sortByData.map(
|
||||||
|
(option, index) => (
|
||||||
|
<MenuItem
|
||||||
|
key={index}
|
||||||
|
value={option.value}
|
||||||
|
>
|
||||||
|
{option.title}
|
||||||
|
</MenuItem>
|
||||||
|
),
|
||||||
|
)}
|
||||||
|
</TextField>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<TextField
|
||||||
|
disabled={!Boolean(currentViewType)}
|
||||||
|
select
|
||||||
|
value={currentViewType}
|
||||||
|
onChange={(e) =>
|
||||||
|
setCurrentViewType(e.target.value)
|
||||||
|
}
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
|
{viewType.map((option, index) => (
|
||||||
<MenuItem
|
<MenuItem
|
||||||
key={index}
|
key={index}
|
||||||
value={option.value}
|
value={option.value}
|
||||||
@@ -621,11 +666,29 @@ const LibraryView = () => {
|
|||||||
}`
|
}`
|
||||||
: item.ProductionYear
|
: item.ProductionYear
|
||||||
}
|
}
|
||||||
|
disableOverlay={
|
||||||
|
item.Type ==
|
||||||
|
BaseItemKind.Person ||
|
||||||
|
item.Type ==
|
||||||
|
BaseItemKind.MusicAlbum ||
|
||||||
|
item.Type ==
|
||||||
|
BaseItemKind.Genre ||
|
||||||
|
item.Type ==
|
||||||
|
BaseItemKind.MusicGenre ||
|
||||||
|
item.Type ==
|
||||||
|
BaseItemKind.Studio
|
||||||
|
}
|
||||||
cardType={
|
cardType={
|
||||||
item.Type ==
|
item.Type ==
|
||||||
BaseItemKind.MusicAlbum ||
|
BaseItemKind.MusicAlbum ||
|
||||||
item.Type ==
|
item.Type ==
|
||||||
BaseItemKind.Audio
|
BaseItemKind.Audio ||
|
||||||
|
item.Type ==
|
||||||
|
BaseItemKind.Genre ||
|
||||||
|
item.Type ==
|
||||||
|
BaseItemKind.MusicGenre ||
|
||||||
|
item.Type ==
|
||||||
|
BaseItemKind.Studio
|
||||||
? "square"
|
? "square"
|
||||||
: "portrait"
|
: "portrait"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -386,15 +386,15 @@ const SeriesTitlePage = () => {
|
|||||||
"translateY(10px)",
|
"translateY(10px)",
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
}}
|
}}
|
||||||
animate={{
|
whileInView={{
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
transform:
|
transform:
|
||||||
"translateY(0px)",
|
"translateY(0px)",
|
||||||
}}
|
}}
|
||||||
|
viewport={{
|
||||||
|
once: true,
|
||||||
|
}}
|
||||||
transition={{
|
transition={{
|
||||||
delay:
|
|
||||||
index *
|
|
||||||
0.05,
|
|
||||||
duration: 0.2,
|
duration: 0.2,
|
||||||
ease: "backInOut",
|
ease: "backInOut",
|
||||||
}}
|
}}
|
||||||
|
|||||||
Reference in new issue
Block a user