1515 * 3) form to add an item / addMode===true
1616 * 4) form to move a list (list of other categories) / moveMode===true
1717 * 5) form to copy a list (name of new list) / copyMode===true
18+ * 6) the actual list of items will be displayed unless #4 or #5 is visible.
1819 */
19- import React , { Fragment , useState , useEffect } from 'react' ;
20+ import React , { Fragment , useState } from 'react' ;
2021import { Link , useLocation , Redirect , useHistory } from 'react-router-dom' ;
2122import '../css/lists.css' ;
2223import { useStore } from '../store/StoreContext' ;
@@ -31,8 +32,9 @@ import MoveList from './MoveList'; // form to move the list to another category
3132import AddItemForm from './AddItemForm' ; // form to add an item
3233import ItemsGroup from './ItemsGroup' ; // the actual group (list) of items
3334import { IconButton , MakeSettingsButton , MakeHelpButton } from './IconButton' ;
34- import { getMobile } from '../store/getData' ;
35+ // import { getMobile } from '../store/getData';
3536import { useEscape } from '../util/helpers' ; // set addMode to false
37+ import * as api from '../util/constants' ;
3638
3739const OneList = ( ) => {
3840 const data = useLocation ( ) ; // to retrieve params from data.state
@@ -42,7 +44,8 @@ const OneList = () => {
4244 console . log ( '** listID: ' + listID ) ;
4345 const { state, dispatch } = useStore ( ) ; // this must come before conditional render
4446 const history = useHistory ( ) ;
45- const [ addMode , setAddMode ] = useState ( ! getMobile ( state ) ) ; // if mobile, show only button
47+ const [ addMode , setAddMode ] = useState ( false ) ; // just show items, not add form.
48+ // const [addMode, setAddMode] = useState(!getMobile(state)); // if mobile, show only button
4649 const [ editMode , setEditMode ] = useState ( false ) ; // edit list name
4750 const [ moveMode , setMoveMode ] = useState ( false ) ; // show form to change category
4851 const [ moreMode , setMoreMode ] = useState ( false ) ; // show or hide extra group of icons
@@ -83,15 +86,15 @@ const OneList = () => {
8386 setEditMode ( false ) ;
8487 } ;
8588
86-
87- useEffect ( ( ) => { // make sure addMode is up to date if isMobile tester is slow
88- // console.log('** setting AddMode to ' + (!state.isMobile).toString());
89- setAddMode ( ! getMobile ( state ) ) ;
90- } , [ state . isMobile ] ) ;
89+ // NOTE: Reinstate this in order to show/hide add form depending on platform.
90+ // useEffect(() => { // make sure addMode is up to date if isMobile tester is slow
91+ // // console.log('** setting AddMode to ' + (!state.isMobile).toString());
92+ // setAddMode(!getMobile(state));
93+ // }, [state.isMobile]);
9194
9295 const removeList = async ( ) => {
9396 await handleRemoveList ( listID , state , dispatch ) ;
94- if ( parentCatID != null ) history . push ( '/cat/' , { categoryID :parentCatID } ) ;
97+ // if (parentCatID!=null) history.push('/cat/', { categoryID:parentCatID });
9598 } ;
9699
97100 /**
@@ -189,19 +192,6 @@ const OneList = () => {
189192 ) ;
190193 } ;
191194
192- const showMoveZone = ( ) => {
193- const moveListProps = { cancelMove : cancelMove , listRec : oneListRec } ;
194- return ( < MoveList props = { moveListProps } /> ) ;
195- } ;
196- const showEditZone = ( ) => {
197- const editListProps = { cancelEdit : cancelEdit , listRec : oneListRec } ;
198- return ( < EditList props = { editListProps } /> ) ;
199- } ;
200- const showCopyZone = ( ) => {
201- const copyListProps = { cancelCopy : cancelCopy , listRec : oneListRec } ;
202- return ( < CopyList props = { copyListProps } /> ) ;
203- } ;
204-
205195 /**
206196 * The header area includes an edit button, and when this is pressed the edit form
207197 * (to change the list name) will be shown, and the main list will disappear until
0 commit comments