Implement hiding widgets

This commit is contained in:
KingRainbow44 2023-05-26 12:02:43 -04:00
parent be588de92f
commit 9f6f8bef79
No known key found for this signature in database
GPG Key ID: FC2CB64B00D257BE
3 changed files with 25 additions and 4 deletions

View File

@ -4,7 +4,12 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>GM Handbook</title>
<script>
window["hide"] = ["quests", "achievements"];
</script>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>

View File

@ -24,14 +24,22 @@ class HomeButton extends React.PureComponent<IProps> {
navigate(this.props.anchor);
}
/**
* Checks if this component should be showed.
*/
private shouldShow(): boolean {
return !(((window as any).hide) as string[])
.includes(this.props.anchor.toLowerCase());
}
render() {
return (
return this.shouldShow() ? (
<div className={"HomeButton"} onClick={() => this.redirect()}>
<img className={"HomeButton_Icon"} src={this.props.icon} alt={this.props.name} />
<p className={"HomeButton_Label"}>{this.props.name}</p>
</div>
);
) : undefined;
}
}

View File

@ -24,14 +24,22 @@ class SideBarButton extends React.PureComponent<IProps> {
navigate(this.props.anchor);
}
/**
* Checks if this component should be showed.
*/
private shouldShow(): boolean {
return !(((window as any).hide) as string[])
.includes(this.props.anchor.toLowerCase());
}
render() {
return (
return this.shouldShow() ? (
<div className={"SideBarButton"} onClick={() => this.redirect()}>
<img className={"SideBarButton_Icon"} src={this.props.icon} alt={this.props.name} />
<p className={"SideBarButton_Label"}>{this.props.name}</p>
</div>
);
) : undefined;
}
}