78 lines
2.5 KiB
TypeScript
Raw Normal View History

2023-03-21 05:27:31 +01:00
import type { PageProps } from "keycloakify/login/pages/PageProps";
import type { KcContext } from "../KcContext";
import type { I18n } from "../i18n";
2021-03-06 14:42:56 +01:00
export default function Info(props: PageProps<Extract<KcContext, { pageId: "info.ftl" }>, I18n>) {
const { kcContext, i18n, doUseDefaultCss, Template, classes } = props;
const { msgStr, msg } = i18n;
const { messageHeader, message, requiredActions, skipLink, pageRedirectUri, actionUri, client } = kcContext;
return (
<Template
2024-06-09 08:27:07 +02:00
kcContext={kcContext}
i18n={i18n}
2024-06-09 08:27:07 +02:00
doUseDefaultCss={doUseDefaultCss}
classes={classes}
displayMessage={false}
2024-07-04 19:53:57 +02:00
headerNode={
<span
dangerouslySetInnerHTML={{
__html: messageHeader ?? message.summary
}}
/>
}
2023-03-21 02:36:13 +01:00
>
<div id="kc-info-message">
2024-07-04 19:53:57 +02:00
<p
className="instruction"
dangerouslySetInnerHTML={{
__html: (() => {
let html = message.summary;
if (requiredActions) {
html += "<b>";
html += requiredActions.map(requiredAction => msgStr(`requiredAction.${requiredAction}` as const)).join(",");
html += "</b>";
}
return html;
})()
}}
/>
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>
);
}