mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2026-03-03 05:12:03 +00:00
61 lines
1.7 KiB
TypeScript
61 lines
1.7 KiB
TypeScript
import {
|
|
Card,
|
|
CardContent,
|
|
CardFooter,
|
|
CardHeader,
|
|
CardTitle,
|
|
} from "../ui/card";
|
|
import { Button } from "../ui/button";
|
|
import { useTranslation } from "react-i18next";
|
|
import { useLocation } from "react-router";
|
|
|
|
interface Props {
|
|
onClick: () => void;
|
|
appUrl: string;
|
|
currentUrl: string;
|
|
}
|
|
|
|
export const DomainWarning = (props: Props) => {
|
|
const { onClick, appUrl, currentUrl } = props;
|
|
const { t } = useTranslation();
|
|
const { search } = useLocation();
|
|
|
|
const searchParams = new URLSearchParams(search);
|
|
|
|
return (
|
|
<Card role="alert" aria-live="assertive">
|
|
<CardHeader>
|
|
<CardTitle className="text-xl">{t("domainWarningTitle")}</CardTitle>
|
|
</CardHeader>
|
|
<CardContent className="flex flex-col gap-3 text-sm mb-1.25">
|
|
<p className="text-muted-foreground">{t("domainWarningSubtitle")}</p>
|
|
<pre>
|
|
<span className="text-muted-foreground">
|
|
{t("domainWarningExpected")}
|
|
<span className="text-primary">{appUrl}</span>
|
|
</span>
|
|
</pre>
|
|
<pre>
|
|
<span className="text-muted-foreground">
|
|
{t("domainWarningCurrent")}
|
|
<span className="text-primary">{currentUrl}</span>
|
|
</span>
|
|
</pre>
|
|
</CardContent>
|
|
<CardFooter className="flex flex-col items-stretch gap-3">
|
|
<Button
|
|
onClick={() =>
|
|
window.location.assign(`${appUrl}/login?${searchParams.toString()}`)
|
|
}
|
|
variant="outline"
|
|
>
|
|
{t("goToCorrectDomainTitle")}
|
|
</Button>
|
|
<Button onClick={onClick} variant="warning">
|
|
{t("ignoreTitle")}
|
|
</Button>
|
|
</CardFooter>
|
|
</Card>
|
|
);
|
|
};
|