From 54882b744d311d6e146acf6c726e21dc9f406bb6 Mon Sep 17 00:00:00 2001 From: n8detar Date: Wed, 20 Apr 2022 09:37:33 -0700 Subject: [PATCH] Fixed button margin & pagination testing --- tubearchivist/www/src/pages/download.tsx | 75 ++++++++++++++++-------- 1 file changed, 51 insertions(+), 24 deletions(-) diff --git a/tubearchivist/www/src/pages/download.tsx b/tubearchivist/www/src/pages/download.tsx index a7ce58c..c91141c 100755 --- a/tubearchivist/www/src/pages/download.tsx +++ b/tubearchivist/www/src/pages/download.tsx @@ -19,11 +19,13 @@ import { getTAUrl } from "../lib/constants"; const TA_BASE_URL = getTAUrl(); type ViewStyle = "grid" | "list"; +type Page = number; type IgnoredStatus = boolean; type FormHidden = boolean; type ErrorMessage = boolean; + export const getServerSideProps: GetServerSideProps = async (context) => { const queryClient = new QueryClient(); const session = await getSession(context); @@ -54,7 +56,6 @@ const Download: NextPage = () => { const [ignoredStatus, setIgnoredStatus] = useState(false); const [formHidden, setFormHidden] = useState(true); - const { data: downloads, @@ -73,17 +74,17 @@ const Download: NextPage = () => { const [viewStyle, setViewStyle] = useState(downloads?.config?.default_view?.downloads); const [errorMessage, setErrorMessage] = useState(false); + const [page, setPage] = useState(1); + const handleSetViewstyle = (selectedViewStyle: ViewStyle) => { setViewStyle(selectedViewStyle); }; const handleSetIgnoredStatus = (selectedIgnoredStatus: IgnoredStatus) => { - // ignoredStatus = !ignoredStatus; setIgnoredStatus(selectedIgnoredStatus); refetch(); }; - const handleSetFormHidden = (selectedFormHidden: FormHidden) => { setFormHidden(selectedFormHidden); @@ -93,6 +94,12 @@ const Download: NextPage = () => { setErrorMessage(selectedErrorMessage); }; + const handleSetPage = (selectedPage: Page) => { + console.log(page); + setPage(selectedPage); + console.log(page); + }; + const addToDownloadQueue = event => { event.preventDefault(); sendDownloads(session.ta_token.token, event.target.vid_url.value).then((response) => !response.message ? handleSetErrorMessage(false) : handleSetErrorMessage(true)); @@ -225,23 +232,27 @@ const Download: NextPage = () => {
- handleSetViewstyle("grid")} - /> +
+ handleSetViewstyle("grid")} + /> +
{/* grid view */} - handleSetViewstyle("list")} - /> +
+ handleSetViewstyle("list")} + /> +
{/* list view */}
@@ -286,8 +297,8 @@ const Download: NextPage = () => { {/*

Published: {{ video.source.published }} | Duration: {{ video.source.duration }} | {{ video.source.youtube_id }}

*/} {ignoredStatus &&
- - + +
} {/* {% if show_ignored_only %} */} @@ -295,9 +306,9 @@ const Download: NextPage = () => { {/* */} {!ignoredStatus &&
- - - + + +
} {/* {% else %} */} @@ -342,6 +353,22 @@ const Download: NextPage = () => { + {/* */}