-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: style navigation tabs #57
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this related to this issue? chore-style-tabs
I am getting tons of errors / warnings both in the terminal when running tests and the developer console (especially when clicking on the tabs) These relate to invalid props on Dom elements (fullWidth, indicator, selectionFollowsFocus, and textColor) that we are not using explicitly so not sure what is going on here. Did you look into it? It seems like it is something we should try to fix. If for no other reason than that any [other] errors we need to address will be invisible among all the other noise.
The other warning I get repeatedly is:
chunk-GYPSVNDI.js?v=08559733:674 MUI: The value
provided to the Tabs component is invalid.
None of the Tabs' children match with "undefined".
You can provide one of the following values: /tab1, 1, /tab2.
Also, I don't seem to be passing through the index file at all.
src/renderer/src/routes/index.tsx
Do you know why?
I thought I would see the onboarding screens but I am not.
I understand that this is a foundation, but I wonder if it could be cleaned up and clarified a little more before it is merged based on some of the comments below and in here.
</Text> | ||
} | ||
value={'/tab2'} | ||
/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you add an sx here with paddingBottom the about icon won't be so close to the bottom of the screen...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
icon={<PostAddIcon />} | ||
value={'/tab1'} | ||
/> | ||
<Box flexGrow={1} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is kind of unfortunate that you had to do this to put the tabs at the bottom. Just noticing. Nothing I am suggesting you change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
THIS BOX IS CAUSING ALL THE CONSOLE ERRORS
</div> | ||
<Suspense fallback={<CircularProgress />}> | ||
<div>map component here</div> | ||
</Suspense> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This component seems very complex. It handles routing, tab rendering, Suspense and layout. Could there be a separate function or hook to handle the logic of determining which tab is selected?
It would be nice if MapLayout could just focus on Layout
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im open to simplfying this. Im just not fully sure how we do that. Do you have any suggestions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a useMapTabs hook to determine what tab to show? But maybe that is unnecessary. Just a suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, because the tabs needed a value
prop it had to be aware of the navigation name. This requires the use of useLocation
hook. This was causing the entire layout screen and all its children (aka the whole app) to rerender on every change in location. So I had to encapsulate the tabs into its own component. I think it simplifies the component?
I think this brings up the question of what is the scope of a component. Gregor has argued that the parent component should contain all the logic, and while it is messier, it does expose everything. And while i don't fully agree, he has some good points. I think there needs to be a more in depth conversation about what are the standards for components.
Regardless, I think the optimization of encapsulating the logic makes sense here because navigation touches everything, and this is a layout component that is the parent for the rest of the app. So the optimization is a necessary as opposed to an over optimization.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it does too. Thanks. I think we will be glad of this later.
Oooh, i didnt open up my console so i didnt see any of these. Will look into them now |
I fixed all the errors. I had to do some hacky things BUT i think these hacky things are better than the alternatives.
|
@@ -86,6 +86,7 @@ const theme = createTheme({ | |||
}, | |||
}, | |||
}, | |||
spacing: 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a bunch of spacing was being multipied by 8 because of the way the theme api. So setting the spacing to 1 means any padding or margin is multiplied by one. I don't think we have any utility in one defined default spacing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good find! Sorry about that. I probably added that back in the summer and totally forgot why!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work fixing all of those errors! Very impressive!
@@ -3,7 +3,6 @@ import { CssBaseline, ThemeProvider } from '@mui/material' | |||
import CircularProgress from '@mui/material/CircularProgress' | |||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query' | |||
import { Outlet, createRootRoute } from '@tanstack/react-router' | |||
import { TanStackRouterDevtools } from '@tanstack/router-devtools' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to remove the actual Devtools also? It is commented out right now.
</div> | ||
<Suspense fallback={<CircularProgress />}> | ||
<div>map component here</div> | ||
</Suspense> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it does too. Thanks. I think we will be glad of this later.
Styled the navigation tabs to prep for the map component.