From 700c9520fbc010bb14025e4314595952a1370072 Mon Sep 17 00:00:00 2001 From: shatfield4 Date: Mon, 11 Dec 2023 17:46:32 -0800 Subject: [PATCH 1/2] loading state fix --- frontend/src/pages/DocumentView/FragmentList/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/pages/DocumentView/FragmentList/index.tsx b/frontend/src/pages/DocumentView/FragmentList/index.tsx index 780ef3a..cb9c850 100644 --- a/frontend/src/pages/DocumentView/FragmentList/index.tsx +++ b/frontend/src/pages/DocumentView/FragmentList/index.tsx @@ -154,7 +154,7 @@ export default function FragmentList({ )} - {fragments.length === 0 && !searching && ( + {!searchMode && fragments.length === 0 && !searching && !loading && (

From 03f5c38f3383f807fed6d6b8a5310b701437769e Mon Sep 17 00:00:00 2001 From: shatfield4 Date: Tue, 12 Dec 2023 10:53:20 -0800 Subject: [PATCH 2/2] fix styling for document paginator and search modes --- .../components/DocumentPaginator/index.tsx | 39 ++++++++++++++++--- .../pages/DocumentView/FragmentList/index.tsx | 17 ++++++-- frontend/src/pages/DocumentView/index.tsx | 2 +- 3 files changed, 48 insertions(+), 10 deletions(-) diff --git a/frontend/src/components/DocumentPaginator/index.tsx b/frontend/src/components/DocumentPaginator/index.tsx index 3d72889..d55fb93 100644 --- a/frontend/src/components/DocumentPaginator/index.tsx +++ b/frontend/src/components/DocumentPaginator/index.tsx @@ -1,3 +1,4 @@ +import { CaretDown } from '@phosphor-icons/react'; import { numberWithCommas } from '../../utils/numbers'; function generatePageItems(total: number, current: number) { @@ -30,17 +31,37 @@ export default function DocumentListPagination({ gotoPage, }: IPaginationProps) { const pageItems = generatePageItems(pageCount, currentPage); + + const hasPrevious = currentPage > 1; + const hasNext = currentPage < pageCount; + + const goToPrevious = () => { + if (currentPage > 1) gotoPage(currentPage - 1); + }; + + const goToNext = () => { + if (currentPage < pageCount) gotoPage(currentPage + 1); + }; + return ( -

+
+ {hasPrevious && ( + + )}
    {pageItems.map((item, i) => typeof item === 'number' ? ( ) )}
+ {hasNext && ( + + )}
); } diff --git a/frontend/src/pages/DocumentView/FragmentList/index.tsx b/frontend/src/pages/DocumentView/FragmentList/index.tsx index cb9c850..5943e86 100644 --- a/frontend/src/pages/DocumentView/FragmentList/index.tsx +++ b/frontend/src/pages/DocumentView/FragmentList/index.tsx @@ -64,7 +64,10 @@ export default function FragmentList({ }, [document, currentPage]); return ( <> -
+
@@ -89,7 +92,7 @@ export default function FragmentList({
-
+
{loading || searching ? (
@@ -104,7 +107,7 @@ export default function FragmentList({
) : ( - + + @@ -144,7 +153,7 @@ export default function FragmentList({
Metadata + {' '} +
)} - {searchMode && searchFragments.length === 0 && ( + {searchMode && searchFragments.length === 0 && !searching && (

diff --git a/frontend/src/pages/DocumentView/index.tsx b/frontend/src/pages/DocumentView/index.tsx index dc3fe23..474aef0 100644 --- a/frontend/src/pages/DocumentView/index.tsx +++ b/frontend/src/pages/DocumentView/index.tsx @@ -122,7 +122,7 @@ export default function DocumentView() { } >

-
+