diff --git a/app/(auth)/auth/login/page.tsx b/app/(auth)/auth/login/page.tsx index 3580948..891b4cf 100644 --- a/app/(auth)/auth/login/page.tsx +++ b/app/(auth)/auth/login/page.tsx @@ -1,31 +1,14 @@ "use client" -import { useEffect, Suspense } from "react" -import Link from "next/link" -import Image from "next/image" +import { useEffect, Suspense, useState } from "react" import { useSearchParams } from "next/navigation" import { useRouter } from "next/navigation" import { useTranslation } from "react-i18next" -import { RiSettings3Line } from "@remixicon/react" -import { Input } from "@/components/ui/input" -import { Button } from "@/components/ui/button" -import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs" -import { - Field, - FieldContent, - FieldLabel, -} from "@/components/ui/field" -import { ThemeSwitcher } from "@/components/theme-switcher" -import { LanguageSwitcher } from "@/components/language-switcher" -import { AuthHeroStatic } from "@/components/auth/heroes/hero-static" +import { LoginForm, type LoginMethod } from "@/components/auth/login-form" import { useAuth } from "@/contexts/auth-context" import { useMessage } from "@/lib/feedback/message" import { buildRoute } from "@/lib/routes" -import logoImage from "@/assets/logo.svg" import { configManager } from "@/lib/config" -import { useState } from "react" - -type LoginMethod = "accessKeyAndSecretKey" | "sts" export default function LoginPage() { return ( @@ -70,9 +53,7 @@ function LoginPageContent() { e.preventDefault() const credentials = - method === "accessKeyAndSecretKey" - ? accessKeyAndSecretKey - : sts + method === "accessKeyAndSecretKey" ? accessKeyAndSecretKey : sts try { const currentConfig = await configManager.loadConfig() @@ -97,227 +78,3 @@ function LoginPageContent() { /> ) } - -function LoginForm({ - method, - setMethod, - accessKeyAndSecretKey, - setAccessKeyAndSecretKey, - sts, - setSts, - handleLogin, -}: { - method: LoginMethod - setMethod: (m: LoginMethod) => void - accessKeyAndSecretKey: { accessKeyId: string; secretAccessKey: string } - setAccessKeyAndSecretKey: React.Dispatch< - React.SetStateAction<{ accessKeyId: string; secretAccessKey: string }> - > - sts: { accessKeyId: string; secretAccessKey: string; sessionToken: string } - setSts: React.Dispatch< - React.SetStateAction<{ - accessKeyId: string - secretAccessKey: string - sessionToken: string - }> - > - handleLogin: (e: React.FormEvent) => void -}) { - const { t } = useTranslation() - - return ( -
- {t("Login Problems?")}{" "} - - {t("Get Help")} - -
-+ {item.value ?? "-"} +
++ {t("Servers")} +
++ {t("Online")} +
++ {onlineServers} +
++ {t("Offline")} +
++ {offlineServers} +
++ {t("Disks")} +
++ {t("Online")} +
++ {onlineDisks} +
++ {t("Offline")} +
++ {offlineDisks} +
++ {t("Version")}: {server.version ?? "--"} +
++ {t("Used")}:{" "} + + {niceBytes(String(drive.usedspace ?? 0))} + +
++ {t("Available")}:{" "} + + {niceBytes(String(drive.availspace ?? 0))} + +
++ {metric.display} +
+ {metric.caption ? ( ++ {metric.caption} +
+ ) : null} ++ {t("Used Capacity")} +
++ {niceBytes(String(totalUsedCapacity))} +
++ {usedPercent.toFixed(0)}% +
++ {item.label} +
++ {item.value} +
+- {t("License Valid Until")}:{endDate} -
-- {t("License Details")} -
-- {t("Customer Service")} -
-- {t("Feature Permissions")} -
-- {t("Technical Parameters")} -
-{error}
@@ -326,334 +194,40 @@ export default function PerformancePage() {- {metric.display} -
- {metric.caption ? ( -- {metric.caption} -
- ) : null} -- {t("Used Capacity")} -
-- {niceBytes( - String(datausageinfo.total_used_capacity ?? 0) - )} -
-- {usedPercent.toFixed(0)}% -
-- {item.label} -
-- {item.value} -
-- {t("Servers")} -
-- {t("Online")} -
-- {onlineServers} -
-- {t("Offline")} -
-- {offlineServers} -
-- {t("Disks")} -
-- {t("Online")} -
-- {systemInfo?.backend?.onlineDisks ?? 0} -
-- {t("Offline")} -
-- {systemInfo?.backend?.offlineDisks ?? 0} -
-- {item.value ?? "-"} -
-- {t("Version")}: {server.version ?? "--"} -
-- {t("Used")}:{" "} - - {niceBytes( - String(drive.usedspace ?? 0) - )} - -
-- {t("Available")}:{" "} - - {niceBytes( - String(drive.availspace ?? 0) - )} - -
-+ {t("Login Problems?")}{" "} + + {t("Get Help")} + +
++ {t("License Valid Until")}:{endDate} +
++ {t("License Details")} +
++ {t("Customer Service")} +
++ {t("Feature Permissions")} +
++ {t("Technical Parameters")} +
+