Files
main_frontend/src/pages/UnderMaintenancePage/UnderMaintenancePage.tsx
T
2026-04-04 14:51:40 +03:00

44 lines
1.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"use client"
import type { IUnderMaintenancePageProps } from "./UnderMaintenancePage.d"
import type { JSX } from "react"
import { FunctionComponent, useEffect } from "react"
import { useRouter, useSearchParams } from "next/navigation"
import { Construction } from "lucide-react"
import api from "@shared/api"
import styles from "./UnderMaintenancePage.module.scss"
const PING_INTERVAL_MS = 5000
export const UnderMaintenancePage: FunctionComponent<IUnderMaintenancePageProps> = (): JSX.Element => {
const router = useRouter()
const searchParams = useSearchParams()
const redirectPath = searchParams?.get("path") || "/"
const { isSuccess } = api.useQuery("get", "/api/ping/", {}, {
refetchInterval: PING_INTERVAL_MS,
retry: false,
})
useEffect(() => {
if (isSuccess) {
router.replace(redirectPath)
}
}, [isSuccess, redirectPath, router])
return (
<div className={styles.root} data-testid="UnderMaintenancePage">
<div className={styles.card}>
<div className={styles.icon}>
<Construction size={48} strokeWidth={1.5} />
</div>
<h1 className={styles.title}>Платформа недоступна</h1>
<p className={styles.description}>Попробуйте зайти позже.</p>
</div>
</div>
)
}