2023-03-19 16:28:38 +01:00
|
|
|
import { assert } from "keycloakify/tools/assert";
|
2023-03-21 05:27:31 +01:00
|
|
|
import type { PageProps } from "keycloakify/login/pages/PageProps";
|
2024-06-05 21:13:58 +02:00
|
|
|
import type { KcContext } from "../KcContext";
|
2024-06-09 04:43:18 +02:00
|
|
|
import { useI18n } from "../i18n";
|
2021-03-06 14:42:56 +01:00
|
|
|
|
2024-06-09 04:43:18 +02:00
|
|
|
export default function Info(props: PageProps<Extract<KcContext, { pageId: "info.ftl" }>>) {
|
|
|
|
const { kcContext, doUseDefaultCss, Template, classes } = props;
|
2022-10-13 11:58:31 +02:00
|
|
|
|
2024-06-09 04:43:18 +02:00
|
|
|
const { msgStr, msg } = useI18n({ kcContext });
|
2022-10-13 11:58:31 +02:00
|
|
|
|
2023-11-07 16:33:19 +01:00
|
|
|
assert(
|
|
|
|
kcContext.message !== undefined,
|
|
|
|
"No message in kcContext.message, there will always be a message in production context, add it in your mock"
|
|
|
|
);
|
2022-10-13 11:58:31 +02:00
|
|
|
|
|
|
|
const { messageHeader, message, requiredActions, skipLink, pageRedirectUri, actionUri, client } = kcContext;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Template
|
2024-06-09 04:43:18 +02:00
|
|
|
{...{ kcContext, doUseDefaultCss, classes }}
|
2022-10-13 11:58:31 +02:00
|
|
|
displayMessage={false}
|
|
|
|
headerNode={messageHeader !== undefined ? <>{messageHeader}</> : <>{message.summary}</>}
|
2023-03-21 02:36:13 +01:00
|
|
|
>
|
|
|
|
<div id="kc-info-message">
|
|
|
|
<p className="instruction">
|
|
|
|
{message.summary}
|
2024-05-11 00:18:18 +02:00
|
|
|
{requiredActions && <b>{requiredActions.map(requiredAction => msgStr(`requiredAction.${requiredAction}` as const)).join(",")}</b>}
|
2023-03-21 02:36:13 +01:00
|
|
|
</p>
|
2024-05-11 00:18:18 +02:00
|
|
|
{(() => {
|
|
|
|
if (skipLink) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pageRedirectUri) {
|
|
|
|
return (
|
|
|
|
<p>
|
|
|
|
<a href={pageRedirectUri}>{msg("backToApplication")}</a>
|
|
|
|
</p>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
if (actionUri) {
|
|
|
|
return (
|
|
|
|
<p>
|
|
|
|
<a href={actionUri}>{msg("proceedWithAction")}</a>
|
|
|
|
</p>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (client.baseUrl) {
|
|
|
|
return (
|
|
|
|
<p>
|
|
|
|
<a href={client.baseUrl}>{msg("backToApplication")}</a>
|
|
|
|
</p>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
})()}
|
2023-03-21 02:36:13 +01:00
|
|
|
</div>
|
|
|
|
</Template>
|
2022-10-13 11:58:31 +02:00
|
|
|
);
|
2023-02-25 18:11:23 +01:00
|
|
|
}
|