-
Notifications
You must be signed in to change notification settings - Fork 34
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
implementing navbar custom buttons #2362
implementing navbar custom buttons #2362
Conversation
…elefu/geoview into 2180-implement-navbar-custom-buttons
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.
Reviewed 3 of 5 files at r1, 3 of 3 files at r2, all commit messages.
Reviewable status: all files reviewed, 13 unresolved discussions (waiting on @cphelefu and @kaminderpal)
packages/geoview-core/public/templates/add-panels.html
line 144 at r2 (raw file):
const groupName = navbarButtonGroupNameInput.value; if(groupName === '') {
Space between if and (
packages/geoview-core/src/core/components/nav-bar/nav-bar.tsx
line 24 at r2 (raw file):
}; type DefaultNavbar = 'fullScreen' | 'location' | 'home' | 'zoomIn' | 'zoomOut';
Type should be map-schema-type in api folder. If constant is needed, it should be in constant.ts
packages/geoview-core/src/core/components/nav-bar/nav-bar.tsx
line 60 at r2 (raw file):
const [buttonPanelGroups, setButtonPanelGroups] = useState<NavButtonGroups>(defaultButtonGroups); useEffect(() => {
Add logger to useEffect
packages/geoview-core/src/core/components/nav-bar/nav-bar.tsx
line 65 at r2 (raw file):
displayButtons = { ...displayButtons, fullScreen: 'fullScreen' }; } if (navBarComponents.includes('location')) {
Blank line between if
packages/geoview-core/src/core/components/nav-bar/nav-bar.tsx
line 68 at r2 (raw file):
displayButtons = { ...displayButtons, location: 'location' }; } if (navBarComponents.includes('home')) {
Blank line between if
packages/geoview-core/src/core/components/nav-bar/nav-bar.tsx
line 83 at r2 (raw file):
logger.logTraceUseCallback('NAV-BAR - addButtonPanel'); const d = {
What is d for? Maybe a more meaningful name?
packages/geoview-core/src/core/components/nav-bar/nav-bar.tsx
line 101 at r2 (raw file):
(sender: NavBarApi, event: NavBarRemovedEvent) => { logger.logTraceUseCallback('NAV-BAR - handleRemoveButtonPanel'); setButtonPanelGroups((prevState) => {
Blank line between logger and function
packages/geoview-core/src/core/components/nav-bar/nav-bar-panel-button.tsx
line 14 at r2 (raw file):
/** * Navbar modal component
Not modal, it is popover
packages/geoview-core/src/core/components/nav-bar/nav-bar-panel-button.tsx
line 16 at r2 (raw file):
* Navbar modal component * * @returns {JSX.Element} the export modal component
not export modal
packages/geoview-core/src/core/components/nav-bar/nav-bar-panel-button.tsx
line 19 at r2 (raw file):
*/ export default function NavbarPanelButton({ buttonPanel }: NavbarPanelButtonType): JSX.Element { const theme = useTheme();
logger.logTraceRender( at the start of component
packages/geoview-core/src/core/components/nav-bar/nav-bar-panel-button.tsx
line 79 at r2 (raw file):
<DialogTitle>{(buttonPanel.panel?.title as string) ?? ''}</DialogTitle> <DialogContent dividers> <Typography dangerouslySetInnerHTML={{ __html: buttonPanel?.panel?.content ?? '' }} />
For now but content can be a react component pass by props, not only sting
packages/geoview-core/src/core/components/nav-bar/nav-bar-style.ts
line 28 at r2 (raw file):
position: 'relative', pointerEvents: 'auto', // justifyContent: 'end',
remove dead code
packages/geoview-core/src/core/components/nav-bar/nav-bar-style.ts
line 32 at r2 (raw file):
padding: 5, flexDirection: 'column', // flexWrap: 'wrap',
remove dead code
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.
Reviewable status: all files reviewed, 13 unresolved discussions (waiting on @cphelefu and @jolevesq)
packages/geoview-core/src/core/components/nav-bar/nav-bar-panel-button.tsx
line 79 at r2 (raw file):
Previously, jolevesq (Johann Levesque) wrote…
For now but content can be a react component pass by props, not only sting
Also we can use HtmlToReact
npm package instead of dangerouslySetInnerHTML
Previously, jolevesq (Johann Levesque) wrote…
This type is just specific to this file; it can even just be converted to a string. Just added it to reduce errors of wrong key. |
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.
Reviewable status: all files reviewed, 13 unresolved discussions (waiting on @jolevesq)
packages/geoview-core/public/templates/add-panels.html
line 144 at r2 (raw file):
Previously, jolevesq (Johann Levesque) wrote…
Space between if and (
Done.
packages/geoview-core/src/core/components/nav-bar/nav-bar.tsx
line 60 at r2 (raw file):
Previously, jolevesq (Johann Levesque) wrote…
Add logger to useEffect
Done.
packages/geoview-core/src/core/components/nav-bar/nav-bar.tsx
line 68 at r2 (raw file):
Previously, jolevesq (Johann Levesque) wrote…
Blank line between if
Done.
packages/geoview-core/src/core/components/nav-bar/nav-bar.tsx
line 83 at r2 (raw file):
Previously, jolevesq (Johann Levesque) wrote…
What is d for? Maybe a more meaningful name?
Done.
packages/geoview-core/src/core/components/nav-bar/nav-bar.tsx
line 101 at r2 (raw file):
Previously, jolevesq (Johann Levesque) wrote…
Blank line between logger and function
Done.
packages/geoview-core/src/core/components/nav-bar/nav-bar-panel-button.tsx
line 14 at r2 (raw file):
Previously, jolevesq (Johann Levesque) wrote…
Not modal, it is popover
Done.
packages/geoview-core/src/core/components/nav-bar/nav-bar-panel-button.tsx
line 16 at r2 (raw file):
Previously, jolevesq (Johann Levesque) wrote…
not export modal
Done.
packages/geoview-core/src/core/components/nav-bar/nav-bar-panel-button.tsx
line 19 at r2 (raw file):
Previously, jolevesq (Johann Levesque) wrote…
logger.logTraceRender( at the start of component
Done.
packages/geoview-core/src/core/components/nav-bar/nav-bar-style.ts
line 28 at r2 (raw file):
Previously, jolevesq (Johann Levesque) wrote…
remove dead code
Done.
packages/geoview-core/src/core/components/nav-bar/nav-bar-style.ts
line 32 at r2 (raw file):
Previously, jolevesq (Johann Levesque) wrote…
remove dead code
Done.
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.
Reviewable status: 2 of 6 files reviewed, 13 unresolved discussions (waiting on @jolevesq)
packages/geoview-core/src/core/components/nav-bar/nav-bar-panel-button.tsx
line 79 at r2 (raw file):
Previously, kaminderpal (Kamy) wrote…
Also we can use
HtmlToReact
npm package instead ofdangerouslySetInnerHTML
Done.
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.
Reviewable status: 2 of 8 files reviewed, 13 unresolved discussions (waiting on @cphelefu and @jolevesq)
packages/geoview-core/src/core/components/nav-bar/nav-bar.tsx
line 65 at r2 (raw file):
Previously, jolevesq (Johann Levesque) wrote…
Blank line between if
Done.
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.
Reviewed 1 of 4 files at r3, 5 of 5 files at r4, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @cphelefu)
packages/geoview-core/src/core/components/nav-bar/nav-bar.tsx
line 24 at r2 (raw file):
Previously, cphelefu (Christopher Phelefu) wrote…
This type is just specific to this file; it can even just be converted to a string. Just added it to reduce errors of wrong key.
But component should reuse the type made for them by the map-schema-type. Because at the end, map-schema type is the one who validates if the component is good or not. The map-schema-Type must be aligned with the component. The zoom always come with zoomIn/zoomOut in one group
/** Valid values for the navBar array. */
export type TypeValidNavBarProps = 'zoom' | 'fullscreen' | 'home' | 'location';
packages/geoview-core/src/core/components/nav-bar/nav-bar-panel-button.tsx
line 1 at r4 (raw file):
/* eslint-disable @typescript-eslint/no-explicit-any */
No global eslint, we need to use them were needed
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.
Reviewable status: 4 of 8 files reviewed, 2 unresolved discussions (waiting on @jolevesq)
packages/geoview-core/src/core/components/nav-bar/nav-bar.tsx
line 24 at r2 (raw file):
Previously, jolevesq (Johann Levesque) wrote…
But component should reuse the type made for them by the map-schema-type. Because at the end, map-schema type is the one who validates if the component is good or not. The map-schema-Type must be aligned with the component. The zoom always come with zoomIn/zoomOut in one group
/** Valid values for the navBar array. */ export type TypeValidNavBarProps = 'zoom' | 'fullscreen' | 'home' | 'location';
Done. Removed that code.
packages/geoview-core/src/core/components/nav-bar/nav-bar-panel-button.tsx
line 1 at r4 (raw file):
Previously, jolevesq (Johann Levesque) wrote…
No global eslint, we need to use them were needed
Done.
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.
Reviewed all commit messages.
Reviewable status: 4 of 8 files reviewed, 2 unresolved discussions (waiting on @cphelefu)
packages/geoview-core/src/core/components/nav-bar/nav-bar-panel-button.tsx
line 84 at r5 (raw file):
<DialogTitle sx={sxClasses.popoverTitle}>{(buttonPanel.panel?.title as string) ?? ''}</DialogTitle> <DialogContent> <HtmlToReact htmlContent={(buttonPanel?.panel?.content ?? '') as string} />
It may not be a tring,. keep the any but add the eslint line escape here
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.
Reviewed 2 of 4 files at r5, 1 of 1 files at r6, 1 of 1 files at r7, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @cphelefu)
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.
Reviewed 2 of 2 files at r8, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @cphelefu)
5a2880b
into
Canadian-Geospatial-Platform:develop
Description
This PR refactors Navbar component. It does the following;
Fixes #2180
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.
https://cphelefu.github.io/geoview/add-panels.html
Checklist:
I have made corresponding changes to the documentationI have added tests that prove my fix is effective or that my feature worksNew and existing unit tests pass locally with my changesThis change is