From 1e38aebb83ff5206a4dac60558edfa300ef4b2ca Mon Sep 17 00:00:00 2001 From: Prayag Prajapati Date: Fri, 22 Sep 2023 17:59:56 +0530 Subject: [PATCH] Start working on new library page #176 --- src/routes/library/index.jsx | 523 +++---------------------- src/routes/library/library.module.scss | 14 + 2 files changed, 75 insertions(+), 462 deletions(-) diff --git a/src/routes/library/index.jsx b/src/routes/library/index.jsx index 83e202c..032dafc 100644 --- a/src/routes/library/index.jsx +++ b/src/routes/library/index.jsx @@ -387,8 +387,6 @@ const LibraryView = () => { queryFn: () => fetchLibItems(id), enabled: currentLib.isSuccess, networkMode: "always", - keepPreviousData: false, - cacheTime: 0, }); const handleCurrentViewType = (e) => { @@ -458,454 +456,57 @@ const LibraryView = () => { }, []); return ( - - +
- - + {currentLib.isLoading ? ( + + ) : ( + currentLib.data.Items[0].Name + )} + + + ) : ( + items.data.TotalRecordCount + ) + } /> - - - - {currentLib.isLoading ? ( - - ) : ( - currentLib.data.Items[0].Name - )} - - - ) : ( - items.data.TotalRecordCount - ) - } - /> - - - {/* - Age - */} - - } - > - {currentLib.isSuccess && - allowedFilterViews.includes( - currentLib.data.Items[0] - .CollectionType, - ) && ( - <> - - - - - } - aria-controls="panel1bh-content" - id="panel1bh-header" - > - - Status - - - - - - {availableWatchStatus.map( - ( - item, - index, - ) => { - return ( - - { - item.title - } - - item.state( - e - .target - .checked, - ) - } - /> - - ); - }, - )} - - - - {!onlyStatusFilterViews.includes( - currentLib.data - .Items[0] - .CollectionType, - ) && ( - - - } - aria-controls="panel1bh-content" - id="panel1bh-header" - > - - Features - - - - - - {availableFeatureFilters.map( - ( - item, - index, - ) => { - return ( - - { - item.title - } - - item.state( - e - .target - .checked, - ) - } - /> - - ); - }, - )} - - - - )} - {!onlyStatusFilterViews.includes( - currentLib.data - .Items[0] - .CollectionType, - ) && ( - - - } - aria-controls="panel1bh-content" - id="panel1bh-header" - > - - Video - Type - - - - - - {availableVideoTypeFilters.map( - ( - item, - index, - ) => { - return ( - - { - item.title - } - - item.state( - e - .target - .checked, - ) - } - /> - - ); - }, - )} - - - - )} - - - )} - {!disabledSortViews.includes( - currentViewType, - ) && ( - <> - {sortByData != undefined && - sortBy != undefined && ( - <> - - } - checkedIcon={ - - } - sx={{ - color: "white !important", - }} - color="white" - onChange={ - handleSortChange - } - checked={ - sortAscending - } - /> - - {sortByData.map( - ( - item, - index, - ) => { - return ( - - {`By ${item.title}`} - - ); - }, - )} - - - )} - - )} - {viewType.length != 0 && - currentViewType != undefined && ( - - {viewType.map( - (item, index) => { - return ( - - { - item.title - } - - ); - }, - )} - - )} - - - +
+ +
{items.isLoading ? ( { ) : items.data.TotalRecordCount == 0 ? ( ) : currentViewType != BaseItemKind.Audio ? ( - +
{items.data.Items.map((item, index) => { return ( - { ] } > - + ); })} - +
) : ( @@ -1176,7 +775,7 @@ const LibraryView = () => { )} - {!items.isFetching && + {!items.isLoading && !disablePaginationViews.includes(currentViewType) && items.isSuccess && items.data.TotalRecordCount > maxDisplayItems && ( @@ -1212,10 +811,10 @@ const LibraryView = () => { /> )} + - {items.isError && } - - + {items.isError && } + ); }; diff --git a/src/routes/library/library.module.scss b/src/routes/library/library.module.scss index 6b026e3..dd99bda 100644 --- a/src/routes/library/library.module.scss +++ b/src/routes/library/library.module.scss @@ -34,3 +34,17 @@ } } } + +.library { + padding: 0 !important; + position: relative; + display: flex; + flex-direction: column; + align-items: stretch; + &-grid { + display: grid; + grid-template-columns: repeat(8, minmax(0, 1fr)); + justify-items: center; + align-items: start; + } +}