adds "display" web settings support to frontend

Components with a "display" equals false in the web settings will not be displayed
in the frontend.
This commit is contained in:
Mose Müller 2024-03-11 13:48:30 +01:00
parent df42f41f53
commit 4a948f9155
2 changed files with 8 additions and 2 deletions

View File

@ -4,5 +4,6 @@ export const WebSettingsContext = createContext<Record<string, WebSetting>>({});
export type WebSetting = {
displayName: string;
display: boolean;
index: number;
};

View File

@ -62,8 +62,13 @@ export const GenericComponent = React.memo(
const webSettings = useContext(WebSettingsContext);
let displayName = name;
if (webSettings[fullAccessPath] && webSettings[fullAccessPath].displayName) {
displayName = webSettings[fullAccessPath].displayName;
if (webSettings[fullAccessPath]) {
if (webSettings[fullAccessPath].display === false) {
return null;
}
if (webSettings[fullAccessPath].displayName) {
displayName = webSettings[fullAccessPath].displayName;
}
}
function changeCallback(