frankcollins3 / fill_container

codecamp team project updated with new icon screen menu + puppeteer icon search, GraphQL, redux, relational psql !mongo, and accuweatherAPI
1 stars 0 forks source link

setting STATUS[i] [5:36pm] #228

Closed frankcollins3 closed 1 year ago

frankcollins3 commented 1 year ago

Screen Shot 2023-06-18 at 5 27 23 PM

Screen Shot 2023-06-18 at 5 27 28 PM

/Home.tsx -> useEffect() -> SET_STATUS({payload: Array(HYDRO_SCHEDULE.length).fill(false)})

/reduxreducer: STATUS: action.payload

      case "SET_STATUS":
        return {
          ...state,
πŸ‘Ž            STATUS: STATUS[action.payload.index] === action.payload.update
          // STATUS: action.payload
        }

πŸ‘Ž to change the status I need to access the index of the STATUS state.

/Reminder {handleClick()} ->

const handleClick = (index:number) => {
πŸ‘Ž     SET_STATUS( {payload: {index: index, update: 'check' } })
    // SET_STATUS( {payload: STATUS[index] === 'check'})
    let calc = Math.ceil((HYDRO_INTAKE / HYDRO_SCHEDULE.length) * (index + 1) / HYDRO_INTAKE)
    SET_PROGRESS( {payload: percent / 100 } )
    // console.log(Math.floor(hydroIntake / hydroSchedule.length) * (index + 1)) / hydroIntake))      
}

first proposed approach: 0: switch to JQ and arrange the elements so that there can be viable .sibling() targeting between these elems

1: revert back to the way jenny had this done in the app.

2: split redux functionality for this into 2 actions: [SET_STATUS_LENGTH, SET_STATUS_INDEX]

frankcollins3 commented 1 year ago

option 1 works I prop drilled this one usage of state to use it exactly as she did just to respect time. All the other state have been successfully re-implemented in the way she used it but with Redux and Graphql.. not mongo [7:26pm]