refactor: update domain warning screen

This commit is contained in:
Stavros
2026-03-01 13:29:07 +02:00
parent 914e46f565
commit 01581fc359
4 changed files with 28 additions and 18 deletions

View File

@@ -1,12 +1,12 @@
import { import {
Card, Card,
CardDescription, CardContent,
CardFooter, CardFooter,
CardHeader, CardHeader,
CardTitle, CardTitle,
} from "../ui/card"; } from "../ui/card";
import { Button } from "../ui/button"; import { Button } from "../ui/button";
import { Trans, useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useLocation } from "react-router"; import { useLocation } from "react-router";
interface Props { interface Props {
@@ -25,22 +25,25 @@ export const DomainWarning = (props: Props) => {
return ( return (
<Card role="alert" aria-live="assertive"> <Card role="alert" aria-live="assertive">
<CardHeader className="gap-1.5"> <CardHeader>
<CardTitle className="text-xl">{t("domainWarningTitle")}</CardTitle> <CardTitle className="text-xl">{t("domainWarningTitle")}</CardTitle>
<CardDescription>
<Trans
t={t}
i18nKey="domainWarningSubtitle"
values={{ appUrl, currentUrl }}
components={{ code: <code /> }}
shouldUnescape={true}
/>
</CardDescription>
</CardHeader> </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")}&nbsp;
<span className="text-primary">{appUrl}</span>
</span>
</pre>
<pre>
<span className="text-muted-foreground">
{t("domainWarningCurrent")}&nbsp;
<span className="text-primary">{currentUrl}</span>
</span>
</pre>
</CardContent>
<CardFooter className="flex flex-col items-stretch gap-3"> <CardFooter className="flex flex-col items-stretch gap-3">
<Button onClick={onClick} variant="warning">
{t("ignoreTitle")}
</Button>
<Button <Button
onClick={() => onClick={() =>
window.location.assign( window.location.assign(
@@ -51,6 +54,9 @@ export const DomainWarning = (props: Props) => {
> >
{t("goToCorrectDomainTitle")} {t("goToCorrectDomainTitle")}
</Button> </Button>
<Button onClick={onClick} variant="warning">
{t("ignoreTitle")}
</Button>
</CardFooter> </CardFooter>
</Card> </Card>
); );

View File

@@ -160,7 +160,7 @@ code {
} }
pre { pre {
@apply bg-accent border border-border rounded-md p-2 whitespace-break-spaces; @apply bg-accent border border-border rounded-md p-2 whitespace-break-spaces break-all;
} }
.lead { .lead {

View File

@@ -57,7 +57,9 @@
"fieldRequired": "This field is required", "fieldRequired": "This field is required",
"invalidInput": "Invalid input", "invalidInput": "Invalid input",
"domainWarningTitle": "Invalid Domain", "domainWarningTitle": "Invalid Domain",
"domainWarningSubtitle": "This instance is configured to be accessed from <code>{{appUrl}}</code>, but <code>{{currentUrl}}</code> is being used. If you proceed, you may encounter issues with authentication.", "domainWarningSubtitle": "You are accessing this instance from an incorrect domain. If you proceed, you may encounter issues with authentication.",
"domainWarningCurrent": "Current:",
"domainWarningExpected": "Expected:",
"ignoreTitle": "Ignore", "ignoreTitle": "Ignore",
"goToCorrectDomainTitle": "Go to correct domain", "goToCorrectDomainTitle": "Go to correct domain",
"authorizeTitle": "Authorize", "authorizeTitle": "Authorize",

View File

@@ -57,7 +57,9 @@
"fieldRequired": "This field is required", "fieldRequired": "This field is required",
"invalidInput": "Invalid input", "invalidInput": "Invalid input",
"domainWarningTitle": "Invalid Domain", "domainWarningTitle": "Invalid Domain",
"domainWarningSubtitle": "This instance is configured to be accessed from <code>{{appUrl}}</code>, but <code>{{currentUrl}}</code> is being used. If you proceed, you may encounter issues with authentication.", "domainWarningSubtitle": "You are accessing this instance from an incorrect domain. If you proceed, you may encounter issues with authentication.",
"domainWarningCurrent": "Current:",
"domainWarningExpected": "Expected:",
"ignoreTitle": "Ignore", "ignoreTitle": "Ignore",
"goToCorrectDomainTitle": "Go to correct domain", "goToCorrectDomainTitle": "Go to correct domain",
"authorizeTitle": "Authorize", "authorizeTitle": "Authorize",