From 8c29042cb834925f4eb3aa4f2cc637e52e170702 Mon Sep 17 00:00:00 2001 From: Cooper Ransom Date: Fri, 8 Mar 2024 18:03:03 -0500 Subject: [PATCH] Make the admin page cool asf --- public/config.js | 2 +- .../player/atoms/NextEpisodeButton.tsx | 1 - src/pages/admin/AdminPage.tsx | 2 +- src/pages/parts/admin/WorkerTestPart.tsx | 37 ++++++++++++++----- 4 files changed, 30 insertions(+), 12 deletions(-) diff --git a/public/config.js b/public/config.js index 9a0ebf09..50bab584 100644 --- a/public/config.js +++ b/public/config.js @@ -1,6 +1,6 @@ window.__CONFIG__ = { // The URL for the CORS proxy, the URL must NOT end with a slash! - VITE_CORS_PROXY_URL: ["https://sudo-proxy0.netlify.app", "https://sudo-proxy1.up.railway.app", "https://sudo-proxy2.up.railway.app", "https://sudo-proxy3.up.railway.app", "https://sudo-proxy4.netlify.app", "https://sudo-worker-1.cooperransom08.workers.dev", "https://sudo-worker-2.cooperransom08.workers.dev", "https://sudo-worker-3.cooperransom08.workers.dev", "https://sudo-proxy9.netlify.app", "https://sudo-proxy10.up.railway.app"], + VITE_CORS_PROXY_URL: ["https://sudo-proxy0.netlify.app", "https://sudo-worker-4.cooperransom08.workers.dev", "https://sudo-proxy2.up.railway.app", "https://sudo-proxy3.up.railway.app", "https://sudo-proxy4.netlify.app", "https://sudo-worker-1.cooperransom08.workers.dev", "https://sudo-worker-2.cooperransom08.workers.dev", "https://sudo-worker-3.cooperransom08.workers.dev", "https://sudo-proxy9.netlify.app", "https://sudo-proxy1.up.railway.app"], // The READ API key to access TMDB VITE_TMDB_READ_API_KEY: "eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJhZTljNGE2ZDE1ZDFiODZiNzdlMWQyYmI5ZGY0MzdmYyIsInN1YiI6IjY1YjNmMWI0NTk0Yzk0MDE2MzNkZDBjNSIsInNjb3BlcyI6WyJhcGlfcmVhZCJdLCJ2ZXJzaW9uIjoxfQ.kAX7TkbKuJkNty6IsjcCLnoENFicVZn6d6DkLQsy3p8", diff --git a/src/components/player/atoms/NextEpisodeButton.tsx b/src/components/player/atoms/NextEpisodeButton.tsx index cd7e7ed5..e90cb9dc 100644 --- a/src/components/player/atoms/NextEpisodeButton.tsx +++ b/src/components/player/atoms/NextEpisodeButton.tsx @@ -47,7 +47,6 @@ export function NextEpisodeButton(props: { const isHidden = usePlayerStore((s) => s.interface.hideNextEpisodeBtn); const meta = usePlayerStore((s) => s.meta); const { setDirectMeta } = usePlayerMeta(); - const hideNextEpisodeButton = usePlayerStore((s) => s.hideNextEpisodeButton); const metaType = usePlayerStore((s) => s.meta?.type); const time = usePlayerStore((s) => s.progress.time); const showingState = shouldShowNextEpisodeButton(time, duration); diff --git a/src/pages/admin/AdminPage.tsx b/src/pages/admin/AdminPage.tsx index fd5c671f..ebf2d787 100644 --- a/src/pages/admin/AdminPage.tsx +++ b/src/pages/admin/AdminPage.tsx @@ -12,7 +12,7 @@ export function AdminPage() { Admin tools - Useful tools to test out your current deployment + Silly tools used test sudo-flix! ૮₍´˶• . • ⑅ ₎ა diff --git a/src/pages/parts/admin/WorkerTestPart.tsx b/src/pages/parts/admin/WorkerTestPart.tsx index 5f8b9853..274cbded 100644 --- a/src/pages/parts/admin/WorkerTestPart.tsx +++ b/src/pages/parts/admin/WorkerTestPart.tsx @@ -1,5 +1,5 @@ import classNames from "classnames"; -import { useMemo, useState } from "react"; +import { useEffect, useMemo, useState } from "react"; import { useAsyncFn } from "react-use"; import { singularProxiedFetch } from "@/backend/helpers/fetch"; @@ -52,7 +52,9 @@ export function WorkerTestPart() { { id: string; status: "error" | "success"; error?: Error }[] >([]); + const [buttonClicked, setButtonClicked] = useState(false); const [buttonDisabled, setButtonDisabled] = useState(false); + const [allWorkersPassed, setAllWorkersPassed] = useState(false); const [testState, runTests] = useAsyncFn(async () => { setButtonDisabled(true); @@ -88,6 +90,7 @@ export function WorkerTestPart() { status: "error", error: err as Error, }); + setAllWorkersPassed(false); // Set allWorkersPassed to false if a worker fails } }); @@ -95,6 +98,12 @@ export function WorkerTestPart() { setTimeout(() => setButtonDisabled(false), 5000); }, [workerList, setWorkerState]); + useEffect(() => { + setAllWorkersPassed( + workerState.every((worker) => worker.status === "success"), + ); + }, [workerState]); + return ( <> Worker tests @@ -119,14 +128,24 @@ export function WorkerTestPart() { })}
- + {allWorkersPassed && buttonClicked ? ( +
+

All workers have passed the test! ٩(ˊᗜˋ*)و ♡

+
+ ) : ( + + )}