mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-12-14 02:31:51 +00:00
Merge pull request #44 from tobspr-games/fix/tgs-fallback
Fix TextualGameState HTML string fallback
This commit is contained in:
commit
7814c3a15a
@ -19,7 +19,11 @@ export abstract class TextualGameState extends GameState {
|
|||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
getInnerHTML(): string {
|
getInnerHTML(): string {
|
||||||
return "";
|
return `
|
||||||
|
<div class="content mainContent">
|
||||||
|
${this.getMainContentHTML()}
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -36,21 +40,8 @@ export abstract class TextualGameState extends GameState {
|
|||||||
* title, and content returned by {@link getInitialContent}.
|
* title, and content returned by {@link getInitialContent}.
|
||||||
*/
|
*/
|
||||||
protected override getContentLayout(): Node {
|
protected override getContentLayout(): Node {
|
||||||
let content = this.getInitialContent();
|
const initialContent = this.getInitialContent();
|
||||||
|
const content = initialContent !== null && <div class="content mainContent">{initialContent}</div>;
|
||||||
if (content === null) {
|
|
||||||
// Fall back either to getMainContentHTML or getInnerHTML (if not "")
|
|
||||||
let html = this.getInnerHTML();
|
|
||||||
if (html === "") {
|
|
||||||
html = `
|
|
||||||
<div class="content mainContent">
|
|
||||||
${this.getMainContentHTML()}
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
}
|
|
||||||
|
|
||||||
content = super.getContentLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -60,7 +51,7 @@ export abstract class TextualGameState extends GameState {
|
|||||||
{this.getStateHeaderTitle() ?? ""}
|
{this.getStateHeaderTitle() ?? ""}
|
||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
<div class="container">{content}</div>
|
<div class="container">{content || super.getContentLayout()}</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user