mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-20 14:37:43 +01:00
Make the admin page cool asf
This commit is contained in:
parent
da414a25e1
commit
8c29042cb8
4 changed files with 30 additions and 12 deletions
|
@ -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",
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -12,7 +12,7 @@ export function AdminPage() {
|
|||
<SubPageLayout>
|
||||
<ThinContainer>
|
||||
<Heading1>Admin tools</Heading1>
|
||||
<Paragraph>Useful tools to test out your current deployment</Paragraph>
|
||||
<Paragraph>Silly tools used test sudo-flix! ૮₍´˶• . • ⑅ ₎ა</Paragraph>
|
||||
|
||||
<ConfigValuesPart />
|
||||
<BackendTestPart />
|
||||
|
|
|
@ -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 (
|
||||
<>
|
||||
<Heading2 className="!mb-0 mt-12">Worker tests</Heading2>
|
||||
|
@ -119,14 +128,24 @@ export function WorkerTestPart() {
|
|||
})}
|
||||
<Divider />
|
||||
<div className="flex justify-end">
|
||||
{allWorkersPassed && buttonClicked ? (
|
||||
<div>
|
||||
<p>All workers have passed the test! ٩(ˊᗜˋ*)و ♡</p>
|
||||
</div>
|
||||
) : (
|
||||
<Button
|
||||
theme="purple"
|
||||
loading={testState.loading}
|
||||
onClick={buttonDisabled ? undefined : runTests}
|
||||
onClick={(event) => {
|
||||
event.preventDefault();
|
||||
setButtonClicked(true);
|
||||
if (!buttonDisabled) runTests();
|
||||
}}
|
||||
disabled={buttonDisabled}
|
||||
>
|
||||
Test workers
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</Box>
|
||||
</>
|
||||
|
|
Loading…
Reference in a new issue