From 4f684215e6aa774aef4a8697b7653004e1256d80 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= <joamag@gmail.com>
Date: Sun, 30 Oct 2022 19:18:06 +0000
Subject: [PATCH] reactor: removed unused values

---
 examples/web/index.ts                         | 10 +---------
 examples/web/react/app.tsx                    |  1 +
 examples/web/react/components/index.ts        |  1 +
 examples/web/react/components/modal/modal.tsx |  2 +-
 examples/web/react/components/toast/toast.css |  0
 examples/web/react/components/toast/toast.tsx | 14 ++++++++++++++
 examples/web/tsconfig.json                    |  1 +
 7 files changed, 19 insertions(+), 10 deletions(-)
 create mode 100644 examples/web/react/components/toast/toast.css
 create mode 100644 examples/web/react/components/toast/toast.tsx

diff --git a/examples/web/index.ts b/examples/web/index.ts
index b5286b24..e8e3ff62 100644
--- a/examples/web/index.ts
+++ b/examples/web/index.ts
@@ -17,19 +17,12 @@ import info from "./package.json";
 
 declare const require: any;
 
-const PIXEL_UNSET_COLOR = 0x1b1a17ff;
-
 const LOGIC_HZ = 600;
 const VISUAL_HZ = 60;
-const TIMER_HZ = 60;
 const IDLE_HZ = 10;
 
 const FREQUENCY_DELTA = 60;
 
-const DISPLAY_WIDTH = 160;
-const DISPLAY_HEIGHT = 144;
-const DISPLAY_RATIO = DISPLAY_WIDTH / DISPLAY_HEIGHT;
-
 const SAMPLE_RATE = 2;
 
 const BACKGROUNDS = [
@@ -82,7 +75,6 @@ class GameboyEmulator extends Observable implements Emulator {
 
     private logicFrequency: number = LOGIC_HZ;
     private visualFrequency: number = VISUAL_HZ;
-    private timerFrequency: number = TIMER_HZ;
     private idleFrequency: number = IDLE_HZ;
 
     private toastTimeout: number | null = null;
@@ -800,7 +792,7 @@ class GameboyEmulator extends Observable implements Emulator {
         return {
             name: this.romName || undefined,
             data: this.romData || undefined,
-            size: this.romData?.length,
+            size: this.romSize,
             extra: {
                 romType: this.cartridge?.rom_type_s(),
                 romSize: this.cartridge?.rom_size_s(),
diff --git a/examples/web/react/app.tsx b/examples/web/react/app.tsx
index 82446e8e..6cc0fba4 100644
--- a/examples/web/react/app.tsx
+++ b/examples/web/react/app.tsx
@@ -254,6 +254,7 @@ export const App: FC<AppProps> = ({ emulator, backgrounds = ["264653"] }) => {
             "Are you sure you want to start a benchmark?\nThe benchmark is considered an expensive operation!",
             "Confirm"
         );
+        alert(`Will run it as ${result}`);
     };
     const onFullscreenClick = () => {
         setFullscreen(!fullscreen);
diff --git a/examples/web/react/components/index.ts b/examples/web/react/components/index.ts
index b37d84ce..447bf850 100644
--- a/examples/web/react/components/index.ts
+++ b/examples/web/react/components/index.ts
@@ -12,3 +12,4 @@ export * from "./panel-split/panel-split";
 export * from "./paragraph/paragraph";
 export * from "./section/section";
 export * from "./title/title";
+export * from "./toast/toast";
diff --git a/examples/web/react/components/modal/modal.tsx b/examples/web/react/components/modal/modal.tsx
index 0f632a0b..15040026 100644
--- a/examples/web/react/components/modal/modal.tsx
+++ b/examples/web/react/components/modal/modal.tsx
@@ -1,4 +1,4 @@
-import React, { ReactNode, FC, ButtonHTMLAttributes, useEffect } from "react";
+import React, { FC, useEffect } from "react";
 import Button from "../button/button";
 
 import "./modal.css";
diff --git a/examples/web/react/components/toast/toast.css b/examples/web/react/components/toast/toast.css
new file mode 100644
index 00000000..e69de29b
diff --git a/examples/web/react/components/toast/toast.tsx b/examples/web/react/components/toast/toast.tsx
new file mode 100644
index 00000000..5f0efbe8
--- /dev/null
+++ b/examples/web/react/components/toast/toast.tsx
@@ -0,0 +1,14 @@
+import React, { FC } from "react";
+
+import "./toast.css";
+
+type ToastProps = {
+    style?: string[];
+};
+
+export const Toast: FC<ToastProps> = ({ style = [] }) => {
+    const classes = () => ["toast", ...style].join(" ");
+    return <div className={classes()}></div>;
+};
+
+export default Toast;
diff --git a/examples/web/tsconfig.json b/examples/web/tsconfig.json
index 8f83dd8e..d38b2b51 100644
--- a/examples/web/tsconfig.json
+++ b/examples/web/tsconfig.json
@@ -7,6 +7,7 @@
         "target": "es6",
         "noImplicitAny": true,
         "noImplicitThis": true,
+        "noUnusedLocals": true,
         "alwaysStrict": true,
         "strictBindCallApply": true,
         "strictNullChecks": true,
-- 
GitLab