diff --git a/app/login/do-you-know.tsx b/app/login/do-you-know.tsx index 0025379..d138182 100644 --- a/app/login/do-you-know.tsx +++ b/app/login/do-you-know.tsx @@ -20,9 +20,9 @@ export default async function DoYouKnow() { const randomKnow = knowsList[Math.floor(Math.random() * knowsList.length)]; return ( -
-
DO YOU KNOW?
-
{randomKnow}
+
+
你知道嗎?
+
{randomKnow}
); } diff --git a/app/login/page.tsx b/app/login/page.tsx index 52ec838..d05370a 100644 --- a/app/login/page.tsx +++ b/app/login/page.tsx @@ -19,107 +19,80 @@ export default async function LoginPage({ searchParams }: LoginPageProps) { const params = await searchParams; return ( -
-
- {/* Left Information Panel */} -
+
+ -
- {/* Placeholder Image */} -
- - {/* Information Section */} - +
+
+ 資料庫練功坊 + + + + {/* Do You Know */} + - {/* Bottom Section */} -
- {/* Status and Navigation */} -
- }> - - + {/* Bottom Section */} +
+ {/* Status and Navigation */} +
+ }> + + -
+
-
- - - + + + + - - GitHub - - - GitHub - - + GitHub + + + GitHub + + - - 向 GitHub 貢獻程式碼,每次都能直接獲得 200 - 700 點不等的點數! - - -
+ + 向 GitHub 貢獻程式碼,每次都能直接獲得 200 - 700 點不等的點數! + +
- - {/* Right Login Area */} -
-
- -
- -
- 資料庫練功坊 - - -
-
); diff --git a/app/login/status.action.ts b/app/login/status.action.ts index 3c8a776..87ba659 100644 --- a/app/login/status.action.ts +++ b/app/login/status.action.ts @@ -1,11 +1,17 @@ "use server"; -export async function getUpstreamStatus(): Promise { +export async function getUpstreamLatency(): Promise { try { - const response = await fetch("https://api.dbplay.app"); - return response.ok; + const start = Date.now(); + + const response = await fetch("https://api.dbplay.app", { method: "HEAD" }); + if (!response.ok) { + return -1; + } + + return Date.now() - start; } catch (error) { console.error("Error getting upstream status:", error); - return false; + return -1; } } diff --git a/app/login/status.tsx b/app/login/status.tsx index 75ce6cf..dee1600 100644 --- a/app/login/status.tsx +++ b/app/login/status.tsx @@ -1,10 +1,11 @@ +import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"; import { Circle } from "lucide-react"; -import { getUpstreamStatus } from "./status.action"; +import { getUpstreamLatency } from "./status.action"; export async function UpstreamStatus() { - const status = await getUpstreamStatus(); + const latency = await getUpstreamLatency(); - if (!status) { + if (latency === -1 || latency > 1000) { return (
@@ -16,12 +17,17 @@ export async function UpstreamStatus() { } return ( -
- -
- 服務正常 🙌 -
-
+ + +
+ +
+ 服務正常 🙌 +
+
+
+ 延遲:{latency}ms +
); }