fallback to openid scope

This commit is contained in:
Max Peintner
2025-05-07 14:03:18 +02:00
parent 602b8ad2f1
commit 9df31eb9d6

View File

@@ -43,28 +43,33 @@ export function ConsentScreen({
} }
} }
const scopes = scope?.filter((s) => !!s);
return ( return (
<div className="pt-4 w-full flex flex-col items-center space-y-4"> <div className="pt-4 w-full flex flex-col items-center space-y-4">
<ul className="list-disc space-y-2 w-full"> <ul className="list-disc space-y-2 w-full">
{scope {scopes?.length === 0 && (
?.filter((s) => !!s) <span className="w-full text-sm flex flex-row items-center bg-background-light-400 dark:bg-background-dark-400 border border-divider-light py-2 px-4 rounded-md transition-all">
.map((s) => { {t("device.scope.openid")}
const translationKey = `device.scope.${s}`; </span>
const description = t(translationKey, null); )}
{scopes?.map((s) => {
const translationKey = `device.scope.${s}`;
const description = t(translationKey, null);
// Check if the key itself is returned and provide a fallback // Check if the key itself is returned and provide a fallback
const resolvedDescription = const resolvedDescription =
description === translationKey ? "" : description; description === translationKey ? "" : description;
return ( return (
<li <li
key={s} key={s}
className="w-full text-sm flex flex-row items-center bg-background-light-400 dark:bg-background-dark-400 border border-divider-light py-2 px-4 rounded-md transition-all" className="w-full text-sm flex flex-row items-center bg-background-light-400 dark:bg-background-dark-400 border border-divider-light py-2 px-4 rounded-md transition-all"
> >
<span>{resolvedDescription}</span> <span>{resolvedDescription}</span>
</li> </li>
); );
})} })}
</ul> </ul>
<p className="ztdl-p text-xs text-left"> <p className="ztdl-p text-xs text-left">