frankcollins3 / Next-Water-App

Happy, Healthy Water Cycling App that tracks user/human fluid intake.
https://next-water-app.vercel.app
1 stars 0 forks source link

redux convention && organization [1:27pm] #33

Closed frankcollins3 closed 1 year ago

frankcollins3 commented 1 year ago

attemping to do: create a new directory for login/signup @redux/toolkit state.

error: // more confusion than anything ... /redux/main/mainActions.tsx && /reduxx/main/mainSlice.ts

if this app is to include a /redux/login/loginActions.tsx && /loginSlice.ts, then an easily posed question could be:

why would it be organized by directory if the point of redux would be that multiple components might need access to same state

for example: <navbar.tsx> the navbar has: <homebtn> <dashboard/calendar> <settings> <logout/login>

settings isn't it's own page. It's a state toggling button that brings up the with a form that allows the user: to change their settings.

These settings are the height, weight that determine how much fluid, and the start and end time to someones day once this is selected, the <Main> component will display that schedule.

for example: start_time: 8am end_time: 8pm (8 start 16 end) and a reminder/notification intensity of 2: | 8am | 10am | 12pm | 2pm | 4pm | 6pm | 8pm | will be the rendered schedule with clickable "bars" to: either acknowledge that 2 hour block, determined by setting of reminder from to pass or fail that water cycle.

The way the original app did it was using the main panel would use The route to determine rendering. I couldn't do this 2+ years later when I redid our project because an update meant only used once in app, Which it would be in App.tsx. So I set the same functionality to be determined by state rather than router for same effect.

I added a feature where: if the user was in /dashboard.tsx: the calendar page that allows user to refer to saved cycle data determined from above functionality of clicking bars, if the user wants to click the settings bar, the page will navigate back to home and set that state so the side panel opens

this is UX feature where, in my eyes, it doesn't make sense that the user has to click on the gear twice to pull up panel.

My question about the redux state (which didn't matter in my use of regular react-redux and connect-redux) is, if convention calls for pages-distinguished-organization system based on subdirectories determined by fileName.

Now, the dashboard will need access to this same redux/main/MainSlice.ts state from the

Why call it redux/main? in the least it seems the chatGPT provided description that @redux/toolkit is more opinionated seems more true now when you factor in this quirk that global state is supposed to a sort of pangea/joined global state. It seems we've "nationalized" and split into denominations, this way of sorting retrieval of state by their corresponding file

frankcollins3 commented 1 year ago

this problem seems further exacerbated once you consider the convention: 👍 {RootState} one could always: import {RootState} as RootStateMain || RootStateLogin

// leaving open there may be more confusions and questions regarding: @redux/toolkit and the conflict of convention.

[4:43pm]

wrong. {RootState} comes from reducers it becomes the . No conflict between convention.

[4:47pm]