From 1a4369dfd8309582070c4b2021e18bf24b6008e6 Mon Sep 17 00:00:00 2001 From: Cooper Date: Sat, 13 Jul 2024 11:44:12 +0000 Subject: [PATCH] Add /links/weblate and fix up latest additions --- pages/index.tsx | 8 ++-- pages/links/discord.tsx | 28 ++++++++++--- pages/links/weblate.tsx | 91 +++++++++++++++++++++++++++++++++++++++++ theme.config.tsx | 2 +- 4 files changed, 120 insertions(+), 9 deletions(-) create mode 100644 pages/links/weblate.tsx diff --git a/pages/index.tsx b/pages/index.tsx index bf8eb09..8ceb2fa 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -13,9 +13,11 @@ export default function LandingPage() {
- - Logo of sudo-flix - + + + Logo of sudo-flix + +
sudo-flix diff --git a/pages/links/discord.tsx b/pages/links/discord.tsx index 8e78ff7..c05ee4c 100644 --- a/pages/links/discord.tsx +++ b/pages/links/discord.tsx @@ -1,15 +1,22 @@ import { useEffect, useState } from 'react'; +const redirectUrl = 'https://discord.gg/mxhcENzG2j'; + export default function DiscordRedirect() { const [countdown, setCountdown] = useState(5); useEffect(() => { const interval = setInterval(() => { - setCountdown((currentCountdown) => currentCountdown - 1); + setCountdown((currentCountdown) => { + if (currentCountdown <= 0) { + return currentCountdown; + } + return currentCountdown - 1; + }); }, 1000); const timer = setTimeout(() => { - window.location.href = 'https://discord.gg/mxhcENzG2j'; + window.location.href = redirectUrl; }, 5000); return () => { @@ -56,14 +63,25 @@ export default function DiscordRedirect() { padding: '1em', marginInline: '2.5em', border: 'solid 1px #37334C', - borderRadius: '0.3em', + borderRadius: '0.35em', alignItems: 'center', textAlign: 'center', }} > -

+

Redirecting you to our Discord in: -
+ {countdown <= 0 ? ( + + ) : null} {countdown}

diff --git a/pages/links/weblate.tsx b/pages/links/weblate.tsx new file mode 100644 index 0000000..1ce609f --- /dev/null +++ b/pages/links/weblate.tsx @@ -0,0 +1,91 @@ +import { useEffect, useState } from 'react'; + +const redirectUrl = 'https://weblate.tinypixel.uk/projects/sudo-flix/main/'; + +export default function WeblateRedirect() { + const [countdown, setCountdown] = useState(5); + + useEffect(() => { + const interval = setInterval(() => { + setCountdown((currentCountdown) => { + if (currentCountdown <= 0) { + return currentCountdown; + } + return currentCountdown - 1; + }); + }, 1000); + + const timer = setTimeout(() => { + window.location.href = redirectUrl; + }, 5000); + + return () => { + clearTimeout(timer); + clearInterval(interval); + }; + }, []); + + return ( +
+
+

+ Sudo-Flix Weblate +

+
+
+ +
+ ); +} diff --git a/theme.config.tsx b/theme.config.tsx index 3284fda..9bfc2b8 100644 --- a/theme.config.tsx +++ b/theme.config.tsx @@ -25,7 +25,7 @@ export default defineTheme({ newTab: true, icon: 'mdi:discord', }), - link('Check it out', 'https://sudo-flix.lol', { + link('Check it out', '/instances', { style: 'star', newTab: true, }),