Skip to content

Commit

Permalink
Clean up logic consistency
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tiliv committed Apr 28, 2024
1 parent d47f86f commit 320b5d8
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/components/DisplayMenu.jsx
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 320b5d8

Please sign in to comment.