From 1a02644785f787c51b7cb6811e98df05a5ef5588 Mon Sep 17 00:00:00 2001 From: Drulikar Date: Mon, 6 Nov 2023 07:53:50 -0800 Subject: [PATCH] Refactor ternary --- tgui/packages/tgui/interfaces/CanvasLayer.js | 80 +++++++++++--------- 1 file changed, 45 insertions(+), 35 deletions(-) diff --git a/tgui/packages/tgui/interfaces/CanvasLayer.js b/tgui/packages/tgui/interfaces/CanvasLayer.js index d88a2a6f4441..e647ae765b1c 100644 --- a/tgui/packages/tgui/interfaces/CanvasLayer.js +++ b/tgui/packages/tgui/interfaces/CanvasLayer.js @@ -256,46 +256,56 @@ export class CanvasLayer extends Component { return count; } - render() { - // edge case where a new user joins and tries to draw on the canvas before they cached the png + displayCanvas() { return (
- {this.state.mapLoad ? ( -
- {this.complexity > 500 && ( - - - - )} - this.handleMouseDown(e)} - onMouseUp={(e) => this.handleMouseUp(e)} - onMouseMove={(e) => this.handleMouseMove(e)} + {this.complexity > 500 && ( + + -
- ) : ( - -

- Please wait a few minutes before attempting to access the canvas. -

-
+ )} + this.handleMouseDown(e)} + onMouseUp={(e) => this.handleMouseUp(e)} + onMouseMove={(e) => this.handleMouseMove(e)} + />
); } + + displayLoading() { + return ( +
+ +

+ Please wait a few minutes before attempting to access the canvas. +

+
+
+ ); + } + + render() { + if (this.state.mapLoad) { + return this.displayCanvas(); + } else { + // edge case where a new user joins and tries to draw on the canvas before they cached the png + return this.displayLoading(); + } + } }