From d3fd032a81c310eb76d0dbe586f0ae6dcf51e051 Mon Sep 17 00:00:00 2001 From: n8detar Date: Fri, 15 Apr 2022 19:07:29 -0700 Subject: [PATCH] Added download page. --- tubearchivist/www/src/components/Nav.tsx | 8 +- tubearchivist/www/src/pages/download.tsx | 177 +++++++++++++++++++++++ 2 files changed, 182 insertions(+), 3 deletions(-) mode change 100644 => 100755 tubearchivist/www/src/components/Nav.tsx create mode 100755 tubearchivist/www/src/pages/download.tsx diff --git a/tubearchivist/www/src/components/Nav.tsx b/tubearchivist/www/src/components/Nav.tsx old mode 100644 new mode 100755 index 16558bd..f16894a --- a/tubearchivist/www/src/components/Nav.tsx +++ b/tubearchivist/www/src/components/Nav.tsx @@ -53,9 +53,11 @@ export const Nav = () => {
playlists
- -
downloads
-
+ + +
downloads
+
+
diff --git a/tubearchivist/www/src/pages/download.tsx b/tubearchivist/www/src/pages/download.tsx new file mode 100755 index 0000000..fcd1e0a --- /dev/null +++ b/tubearchivist/www/src/pages/download.tsx @@ -0,0 +1,177 @@ +import type { GetServerSideProps, NextPage } from "next"; +import { getSession, useSession } from "next-auth/react"; +import { useState } from "react"; +import { dehydrate, QueryClient, useQuery } from "react-query"; +import { CustomHead } from "../components/CustomHead"; +import { Layout } from "../components/Layout"; + +type ViewStyle = "grid" | "list"; + +export const getServerSideProps: GetServerSideProps = async (context) => { + const queryClient = new QueryClient(); + const session = await getSession(context); + + if (!session) { + return { + redirect: { + destination: "/auth/login", + permanent: false, + }, + }; + } + + return { + props: { + dehydratedState: dehydrate(queryClient), + session, + }, + }; +}; + +const Download: NextPage = () => { + + const [viewStyle, setViewStyle] = useState("grid"); + + const handleSetViewstyle = (selectedViewStyle: ViewStyle) => { + setViewStyle(selectedViewStyle); + }; + + return ( + <> + + + +
+
+

Downloads

+
+
+
+
+
+ console.log("rescanPending()")} + src="/img/icon-rescan.svg" + alt="rescan-icon" + title="Rescan subscriptions" + /> + {/* rescan-icon */} +

Rescan subscriptions

+
+
+ console.log("dlPending()")} + src="/img/icon-download.svg" + alt="download-icon" + title="Start download" + /> + {/* download-icon */} +

Start download

+
+
+ console.log("showForm()")} + src="/img/icon-add.svg" + alt="add-icon" + title="Add to download queue" + /> +

Add to download queue

+
+
+ {/* {% csrf_token %} + {{ subscribe_form }} */} + +
+
+
+
+
+
+ Show only ignored videos: +
+ console.log("toggleCheckbox(this)")} + type="checkbox" + /> + {/* {% if not show_subed_only %} */} + + {/* {% else %} */} + + {/* {% endif %} */} +
+
+
+ handleSetViewstyle("grid")} + alt="grid view" + /> + {/* grid view */} + handleSetViewstyle("list")} + alt="list view" + /> + {/* list view */} +
+
+
+ {/* {% if show_ignored_only %} */} +

Ignored from download

+ + {/* onclick="deleteQueue(this)" */} + {/* {% else %} */} +

Download queue

+ + {/* onclick="deleteQueue(this)" */} + {/* {% endif %} */} +
+ {/*

Total videos: {channels?.data?.length}

*/} + {/*
*/} + {/* {% if results %} */} + {/* {% for video in results %} */} + {/*
*/} + {/*
*/} + {/* video_thumb */} + {/* {% if show_ignored_only %} */} + {/* ignored */} + {/* {% else %} */} + {/* queued */} + {/* {% endif %} */} + {/*
*/} + {/*
*/} + {/*

{{ video.source.title }}

*/} + {/* {% if video.source.channel_indexed %} */} + {/*
{{ video.source.channel_name }} */} + {/* {% else %} */} + {/* {{ video.source.channel_name }} */} + {/* {% endif %} */} + {/*

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

*/} + {/* {% if show_ignored_only %} */} + {/* */} + {/* */} + {/* {% else %} */} + {/* */} + {/* */} + {/* {% endif %} */} + {/*
*/} + {/*
*/} + {/* {% endfor %} */} + {/* {% endif %} */} + {/*
*/} +
+ {/* */} + + + ); +}; + +export default Download; \ No newline at end of file