From 320b5d890af2ab5c11a268769926019dbe1fdaf2 Mon Sep 17 00:00:00 2001 From: Autumn Valenta Date: Sun, 28 Apr 2024 01:33:23 -0600 Subject: [PATCH] Clean up logic consistency This was done before because we were floundering with how to detect submenus, but we should always prepare the targetData (the 'interaction' object) with an array value at the choice key. --- src/components/DisplayMenu.jsx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/components/DisplayMenu.jsx b/src/components/DisplayMenu.jsx index 0665783..0260efe 100644 --- a/src/components/DisplayMenu.jsx +++ b/src/components/DisplayMenu.jsx @@ -1,12 +1,10 @@ import { useState, useEffect } from 'react'; import ScreenStack from './ScreenStack'; -import { ACTIONS } from '../Actions'; import useSave from '../hooks/useSave'; import { minifyNumbers, bufferize } from '../utils'; const OPTION_KEYS = '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'; -const SUB_MENU_CHOICES = [ACTIONS.BUY, "Load"]; export default function DisplayMenu({ width, height, @@ -48,8 +46,7 @@ export default function DisplayMenu({ // Prepare sub menu options view useEffect(() => { - // console.log("Active choice", activeChoice, targetData); - if (!targetData || !SUB_MENU_CHOICES.includes(activeChoice)) { + if (typeof targetData?.[activeChoice] !== 'object') { setSubOptions(null); return; }