You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by GitBox <gi...@apache.org> on 2022/09/30 16:27:13 UTC
[GitHub] [incubator-devlake] henit-chobisa opened a new pull request, #3303: feat: Added Responsive Sidebar
henit-chobisa opened a new pull request, #3303:
URL: https://github.com/apache/incubator-devlake/pull/3303
# Summary
## Additions :
- Added `UIContext` for Universal State Management of the Sidebar.
- Added Conditional Rendering to the Sidebar.
- Added new `Navbar Item`, `menu` button, that toggles the sidebar on smaller window sizes.
## Effect :
- UI Context Added for further UI State Management.
- Responsive Sidebar would be implemented in the Config-UI.
- There would be a toggle button for seen in the smaller screen sizes.
### Does this close any open issues?
Closes #3106
### Screenshots


### Other Information
Any other information that is important to this PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3303: feat: Added Responsive Sidebar
Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3303:
URL: https://github.com/apache/incubator-devlake/pull/3303#discussion_r984826800
##########
config-ui/src/components/Nav.jsx:
##########
@@ -15,73 +15,104 @@
* limitations under the License.
*
*/
-import React from 'react'
-import { Alignment, Position, Popover, Navbar, Icon } from '@blueprintjs/core'
+import React, { useContext, useEffect, useState } from 'react'
+import { Position, Popover, Navbar, Icon } from '@blueprintjs/core'
import '@/styles/nav.scss'
import { ReactComponent as SlackIcon } from '@/images/slack-mark-monochrome-black.svg'
import { ReactComponent as SlackLogo } from '@/images/slack-rgb.svg'
+import UIContext from '@/store/UIContext'
+import useWindowSize from '@/hooks/useWIndowSize'
const Nav = () => {
+ const uiContext = useContext(UIContext)
+ const [menuClass, setMenuClass] = useState('navbarMenuButton')
+ const size = useWindowSize()
+
+ const toggleSidebarOpen = (open) => {
Review Comment:
@henit-chobisa For that last main Effect, instead of providing the entire `size` object, be more specific since only width is needed, change `size` to `size?.width` instead for more granularity and to prevent an unwanted re-render.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] e2corporation commented on pull request #3303: feat: Added Responsive Sidebar
Posted by GitBox <gi...@apache.org>.
e2corporation commented on PR #3303:
URL: https://github.com/apache/incubator-devlake/pull/3303#issuecomment-1263800240
@henit-chobisa It appears the last commit contains a space before the colon, so it's breaking the **lint-commit-message** CI Check. Are you able to use amend functionality and reword it? https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/changing-a-commit-message
<img width="676" alt="Screen Shot 2022-09-30 at 12 49 09 PM" src="https://user-images.githubusercontent.com/1742233/193318878-43f53f69-fb84-48b7-b23d-b427b4d98515.png">
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3303: feat: Added Responsive Sidebar
Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3303:
URL: https://github.com/apache/incubator-devlake/pull/3303#discussion_r985238865
##########
config-ui/src/hooks/useWIndowSize.jsx:
##########
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import { useEffect, useState } from 'react'
+
+function useWindowSize() {
+ const [windowSize, setWindowSize] = useState({
+ width: 320,
+ height: 240
+ })
+
+ useEffect(() => {
+ if (typeof window !== 'undefined') {
+ function handleResize() {
Review Comment:
This `handleResize` Closure should also be lifted out of the conditional and be declared on Ln `28`, which will also fix the reference issue when the cleanup function is moved out of the conditional (see comment on `Ln` 41)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] e2corporation commented on pull request #3303: feat: Added Responsive Sidebar
Posted by GitBox <gi...@apache.org>.
e2corporation commented on PR #3303:
URL: https://github.com/apache/incubator-devlake/pull/3303#issuecomment-1263805860
@henit-chobisa Also it's important to resolve any React `react-hooks/exhaustive-deps` dependency warnings. Please resolve _only_ the warning(s) associated with your files, leave any other warning regarding `DataTransformations`.
It looks like one of the effects in `Nav.jsx` needs the dependencies added.
<img width="1248" alt="Screen Shot 2022-09-30 at 12 54 51 PM" src="https://user-images.githubusercontent.com/1742233/193319881-9fb5819f-b5bb-4e16-9be4-ccb8a5a45db7.png">
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3303: feat: Added Responsive Sidebar
Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3303:
URL: https://github.com/apache/incubator-devlake/pull/3303#discussion_r984814878
##########
config-ui/src/components/Nav.jsx:
##########
@@ -15,73 +15,104 @@
* limitations under the License.
*
*/
-import React from 'react'
-import { Alignment, Position, Popover, Navbar, Icon } from '@blueprintjs/core'
+import React, { useContext, useEffect, useState } from 'react'
+import { Position, Popover, Navbar, Icon } from '@blueprintjs/core'
import '@/styles/nav.scss'
import { ReactComponent as SlackIcon } from '@/images/slack-mark-monochrome-black.svg'
import { ReactComponent as SlackLogo } from '@/images/slack-rgb.svg'
+import UIContext from '@/store/UIContext'
+import useWindowSize from '@/hooks/useWIndowSize'
const Nav = () => {
+ const uiContext = useContext(UIContext)
+ const [menuClass, setMenuClass] = useState('navbarMenuButton')
+ const size = useWindowSize()
+
+ const toggleSidebarOpen = (open) => {
Review Comment:
@henit-chobisa We may need to wrap this whole `toggleSidebarOpen` function with a `useCallback` hook, this function being a loose constant maybe partially responsible for the circular loop as it will cause a re-render.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3303: feat: Added Responsive Sidebar
Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3303:
URL: https://github.com/apache/incubator-devlake/pull/3303#discussion_r984833126
##########
config-ui/src/components/Nav.jsx:
##########
@@ -15,73 +15,104 @@
* limitations under the License.
*
*/
-import React from 'react'
-import { Alignment, Position, Popover, Navbar, Icon } from '@blueprintjs/core'
+import React, { useContext, useEffect, useState } from 'react'
+import { Position, Popover, Navbar, Icon } from '@blueprintjs/core'
import '@/styles/nav.scss'
import { ReactComponent as SlackIcon } from '@/images/slack-mark-monochrome-black.svg'
import { ReactComponent as SlackLogo } from '@/images/slack-rgb.svg'
+import UIContext from '@/store/UIContext'
+import useWindowSize from '@/hooks/useWIndowSize'
const Nav = () => {
+ const uiContext = useContext(UIContext)
+ const [menuClass, setMenuClass] = useState('navbarMenuButton')
+ const size = useWindowSize()
+
+ const toggleSidebarOpen = (open) => {
Review Comment:
@henit-chobisa If you have resolved the main Effect without having to add a callback to toggleSidebar... then we can remove the callback there if it isn't required.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] e2corporation commented on pull request #3303: feat: Added Responsive Sidebar
Posted by GitBox <gi...@apache.org>.
e2corporation commented on PR #3303:
URL: https://github.com/apache/incubator-devlake/pull/3303#issuecomment-1263793777
> @e2corporation
> Julien, following you, I made a new PR, taking care of all the linter issues, commits and coding standards of Lake.
> Kindly Review.
> Thank you... 😄
Thanks for getting the PR refreshed Henit! Nice work.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3303: feat: Added Responsive Sidebar
Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3303:
URL: https://github.com/apache/incubator-devlake/pull/3303#discussion_r985238666
##########
config-ui/src/hooks/useWIndowSize.jsx:
##########
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import { useEffect, useState } from 'react'
+
+function useWindowSize() {
+ const [windowSize, setWindowSize] = useState({
+ width: 320,
+ height: 240
+ })
+
+ useEffect(() => {
+ if (typeof window !== 'undefined') {
+ function handleResize() {
+ // Set window width/height to state
+ setWindowSize({
+ width: window.innerWidth,
+ height: window.innerHeight
+ })
+ }
+
+ window.addEventListener('resize', handleResize)
+
+ handleResize()
+
+ return () => window.removeEventListener('resize', handleResize)
Review Comment:
The cleanup function for this Effect should not be inside the `IF` statement, it should be moved out.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] klesh commented on pull request #3303: feat: Added Responsive Sidebar
Posted by GitBox <gi...@apache.org>.
klesh commented on PR #3303:
URL: https://github.com/apache/incubator-devlake/pull/3303#issuecomment-1272217494
@henit-chobisa @e2corporation Great Collaboration! Glad to see this merged. Thank you all.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3303: feat: Added Responsive Sidebar
Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3303:
URL: https://github.com/apache/incubator-devlake/pull/3303#discussion_r984774818
##########
config-ui/src/components/Nav.jsx:
##########
@@ -15,73 +15,104 @@
* limitations under the License.
*
*/
-import React from 'react'
-import { Alignment, Position, Popover, Navbar, Icon } from '@blueprintjs/core'
+import React, { useContext, useEffect, useState } from 'react'
+import { Position, Popover, Navbar, Icon } from '@blueprintjs/core'
import '@/styles/nav.scss'
import { ReactComponent as SlackIcon } from '@/images/slack-mark-monochrome-black.svg'
import { ReactComponent as SlackLogo } from '@/images/slack-rgb.svg'
+import UIContext from '@/store/UIContext'
+import useWindowSize from '@/hooks/useWIndowSize'
const Nav = () => {
+ const uiContext = useContext(UIContext)
+ const [menuClass, setMenuClass] = useState('navbarMenuButton')
+ const size = useWindowSize()
+
+ const toggleSidebarOpen = (open) => {
+ uiContext.changeSidebarVisibility(open)
+ setMenuClass((_) =>
Review Comment:
There is an underscore `_` here being used to indicate the current state of `menuClass`. `mC` maybe a better alias, but since we're not referencing it we could just drop the underscore altogether.
```suggestion
setMenuClass(() =>
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] e2corporation commented on pull request #3303: feat: Added Responsive Sidebar
Posted by GitBox <gi...@apache.org>.
e2corporation commented on PR #3303:
URL: https://github.com/apache/incubator-devlake/pull/3303#issuecomment-1263839709
@henit-chobisa Out of the 3 missing dependencies in the array, add them 1 at a time so you can isolate which _exact_ dependency is the culprit responsible for creating the circular loop situation then start from there.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] henit-chobisa commented on a diff in pull request #3303: feat: Added Responsive Sidebar
Posted by GitBox <gi...@apache.org>.
henit-chobisa commented on code in PR #3303:
URL: https://github.com/apache/incubator-devlake/pull/3303#discussion_r984841231
##########
config-ui/src/components/Nav.jsx:
##########
@@ -15,73 +15,104 @@
* limitations under the License.
*
*/
-import React from 'react'
-import { Alignment, Position, Popover, Navbar, Icon } from '@blueprintjs/core'
+import React, { useContext, useEffect, useState } from 'react'
+import { Position, Popover, Navbar, Icon } from '@blueprintjs/core'
import '@/styles/nav.scss'
import { ReactComponent as SlackIcon } from '@/images/slack-mark-monochrome-black.svg'
import { ReactComponent as SlackLogo } from '@/images/slack-rgb.svg'
+import UIContext from '@/store/UIContext'
+import useWindowSize from '@/hooks/useWIndowSize'
const Nav = () => {
+ const uiContext = useContext(UIContext)
+ const [menuClass, setMenuClass] = useState('navbarMenuButton')
+ const size = useWindowSize()
+
+ const toggleSidebarOpen = (open) => {
Review Comment:
> @henit-chobisa If you have resolved the main Effect without having to add a callback to toggleSidebar... then we can remove the callback there if it isn't required.
No Julien, I resolved it with the help of useCallback
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3303: feat: Added Responsive Sidebar
Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3303:
URL: https://github.com/apache/incubator-devlake/pull/3303#discussion_r984825996
##########
config-ui/src/components/Nav.jsx:
##########
@@ -15,73 +15,104 @@
* limitations under the License.
*
*/
-import React from 'react'
-import { Alignment, Position, Popover, Navbar, Icon } from '@blueprintjs/core'
+import React, { useContext, useEffect, useState } from 'react'
+import { Position, Popover, Navbar, Icon } from '@blueprintjs/core'
import '@/styles/nav.scss'
import { ReactComponent as SlackIcon } from '@/images/slack-mark-monochrome-black.svg'
import { ReactComponent as SlackLogo } from '@/images/slack-rgb.svg'
+import UIContext from '@/store/UIContext'
+import useWindowSize from '@/hooks/useWIndowSize'
const Nav = () => {
+ const uiContext = useContext(UIContext)
+ const [menuClass, setMenuClass] = useState('navbarMenuButton')
+ const size = useWindowSize()
+
+ const toggleSidebarOpen = (open) => {
Review Comment:
@henit-chobisa For the toggleSidebar callback, which dependencies are being requested?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] e2corporation commented on pull request #3303: feat: Added Responsive Sidebar
Posted by GitBox <gi...@apache.org>.
e2corporation commented on PR #3303:
URL: https://github.com/apache/incubator-devlake/pull/3303#issuecomment-1263816738
> > @henit-chobisa Also it's important to resolve any React `react-hooks/exhaustive-deps` dependency warnings. Please resolve _only_ the warning(s) associated with your files, leave any other warning regarding `DataTransformations`.
> > It looks like one of the effects in `Nav.jsx` needs the dependencies added.
> > <img alt="Screen Shot 2022-09-30 at 12 54 51 PM" width="1248" src="https://user-images.githubusercontent.com/1742233/193319881-9fb5819f-b5bb-4e16-9be4-ccb8a5a45db7.png">
>
> Actually Julien, the suggested dependencies cannot be added to the array, as it will show adverse side effects, I have tried it before pushing.
@henit-chobisa This is actually an indicator that the logic inside the Effect is flawed in some way causing a circular loop, and the logic flow should be altered and reworked.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3303: feat: Added Responsive Sidebar
Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3303:
URL: https://github.com/apache/incubator-devlake/pull/3303#discussion_r984827889
##########
config-ui/src/components/Nav.jsx:
##########
@@ -15,73 +15,104 @@
* limitations under the License.
*
*/
-import React from 'react'
-import { Alignment, Position, Popover, Navbar, Icon } from '@blueprintjs/core'
+import React, { useContext, useEffect, useState } from 'react'
+import { Position, Popover, Navbar, Icon } from '@blueprintjs/core'
import '@/styles/nav.scss'
import { ReactComponent as SlackIcon } from '@/images/slack-mark-monochrome-black.svg'
import { ReactComponent as SlackLogo } from '@/images/slack-rgb.svg'
+import UIContext from '@/store/UIContext'
+import useWindowSize from '@/hooks/useWIndowSize'
const Nav = () => {
+ const uiContext = useContext(UIContext)
+ const [menuClass, setMenuClass] = useState('navbarMenuButton')
+ const size = useWindowSize()
+
+ const toggleSidebarOpen = (open) => {
Review Comment:
> Should I break `toggleSidebar` to two different functions ?
> This may solve the issue
That may be unlikely and cause a similar condition with only 2 more functions to troubleshoot. I think if you troubleshoot this original function further it can be resolved.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] henit-chobisa commented on a diff in pull request #3303: feat: Added Responsive Sidebar
Posted by GitBox <gi...@apache.org>.
henit-chobisa commented on code in PR #3303:
URL: https://github.com/apache/incubator-devlake/pull/3303#discussion_r984825263
##########
config-ui/src/components/Nav.jsx:
##########
@@ -15,73 +15,104 @@
* limitations under the License.
*
*/
-import React from 'react'
-import { Alignment, Position, Popover, Navbar, Icon } from '@blueprintjs/core'
+import React, { useContext, useEffect, useState } from 'react'
+import { Position, Popover, Navbar, Icon } from '@blueprintjs/core'
import '@/styles/nav.scss'
import { ReactComponent as SlackIcon } from '@/images/slack-mark-monochrome-black.svg'
import { ReactComponent as SlackLogo } from '@/images/slack-rgb.svg'
+import UIContext from '@/store/UIContext'
+import useWindowSize from '@/hooks/useWIndowSize'
const Nav = () => {
+ const uiContext = useContext(UIContext)
+ const [menuClass, setMenuClass] = useState('navbarMenuButton')
+ const size = useWindowSize()
+
+ const toggleSidebarOpen = (open) => {
Review Comment:
the below `useEffect` logic I figured out by just removing the `uiContext.sidebarVisible` check, that was unnecessary.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] henit-chobisa commented on a diff in pull request #3303: feat: Added Responsive Sidebar
Posted by GitBox <gi...@apache.org>.
henit-chobisa commented on code in PR #3303:
URL: https://github.com/apache/incubator-devlake/pull/3303#discussion_r984826593
##########
config-ui/src/components/Nav.jsx:
##########
@@ -15,73 +15,104 @@
* limitations under the License.
*
*/
-import React from 'react'
-import { Alignment, Position, Popover, Navbar, Icon } from '@blueprintjs/core'
+import React, { useContext, useEffect, useState } from 'react'
+import { Position, Popover, Navbar, Icon } from '@blueprintjs/core'
import '@/styles/nav.scss'
import { ReactComponent as SlackIcon } from '@/images/slack-mark-monochrome-black.svg'
import { ReactComponent as SlackLogo } from '@/images/slack-rgb.svg'
+import UIContext from '@/store/UIContext'
+import useWindowSize from '@/hooks/useWIndowSize'
const Nav = () => {
+ const uiContext = useContext(UIContext)
+ const [menuClass, setMenuClass] = useState('navbarMenuButton')
+ const size = useWindowSize()
+
+ const toggleSidebarOpen = (open) => {
Review Comment:
Should I break `toggleSidebar` to two different functions ?
This may solve the issue
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] henit-chobisa commented on pull request #3303: feat: Added Responsive Sidebar
Posted by GitBox <gi...@apache.org>.
henit-chobisa commented on PR #3303:
URL: https://github.com/apache/incubator-devlake/pull/3303#issuecomment-1263815342
> @henit-chobisa Also it's important to resolve any React `react-hooks/exhaustive-deps` dependency warnings. Please resolve _only_ the warning(s) associated with your files, leave any other warning regarding `DataTransformations`.
>
> It looks like one of the effects in `Nav.jsx` needs the dependencies added.
>
> <img alt="Screen Shot 2022-09-30 at 12 54 51 PM" width="1248" src="https://user-images.githubusercontent.com/1742233/193319881-9fb5819f-b5bb-4e16-9be4-ccb8a5a45db7.png">
Actually Julien, the suggested dependencies cannot be added to the array, as it will show adverse side effects, I have tried it before pushing.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3303: feat: Added Responsive Sidebar
Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3303:
URL: https://github.com/apache/incubator-devlake/pull/3303#discussion_r984872085
##########
config-ui/src/components/Nav.jsx:
##########
@@ -15,73 +15,104 @@
* limitations under the License.
*
*/
-import React from 'react'
-import { Alignment, Position, Popover, Navbar, Icon } from '@blueprintjs/core'
+import React, { useContext, useEffect, useState } from 'react'
+import { Position, Popover, Navbar, Icon } from '@blueprintjs/core'
import '@/styles/nav.scss'
import { ReactComponent as SlackIcon } from '@/images/slack-mark-monochrome-black.svg'
import { ReactComponent as SlackLogo } from '@/images/slack-rgb.svg'
+import UIContext from '@/store/UIContext'
+import useWindowSize from '@/hooks/useWIndowSize'
const Nav = () => {
+ const uiContext = useContext(UIContext)
Review Comment:
@henit-chobisa Does it help the situation any if you used De-structuring here?
```suggestion
const { changeSidebarVisibility, desktopBreakpointWidth, sidebarVisible } = useContext(UIContext)
```
Then instead of referencing the Entire `UIContext` object, we can just utilize the De-structured children props?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] henit-chobisa commented on a diff in pull request #3303: feat: Added Responsive Sidebar
Posted by GitBox <gi...@apache.org>.
henit-chobisa commented on code in PR #3303:
URL: https://github.com/apache/incubator-devlake/pull/3303#discussion_r984824349
##########
config-ui/src/components/Nav.jsx:
##########
@@ -15,73 +15,104 @@
* limitations under the License.
*
*/
-import React from 'react'
-import { Alignment, Position, Popover, Navbar, Icon } from '@blueprintjs/core'
+import React, { useContext, useEffect, useState } from 'react'
+import { Position, Popover, Navbar, Icon } from '@blueprintjs/core'
import '@/styles/nav.scss'
import { ReactComponent as SlackIcon } from '@/images/slack-mark-monochrome-black.svg'
import { ReactComponent as SlackLogo } from '@/images/slack-rgb.svg'
+import UIContext from '@/store/UIContext'
+import useWindowSize from '@/hooks/useWIndowSize'
const Nav = () => {
+ const uiContext = useContext(UIContext)
+ const [menuClass, setMenuClass] = useState('navbarMenuButton')
+ const size = useWindowSize()
+
+ const toggleSidebarOpen = (open) => {
Review Comment:
While I was trying to resolve this, I did the same but after this, the `useCallback` hook, ask for the UIContext dependency and that is the infinite loop.
<img width="619" alt="image" src="https://user-images.githubusercontent.com/72302948/193328283-3aa72ad8-4f43-4009-9a77-8940c394d2f8.png">
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] henit-chobisa commented on pull request #3303: feat: Added Responsive Sidebar
Posted by GitBox <gi...@apache.org>.
henit-chobisa commented on PR #3303:
URL: https://github.com/apache/incubator-devlake/pull/3303#issuecomment-1272292470
> @henit-chobisa @e2corporation Great Collaboration! Glad to see this merged. Thank you all.
Looking forward for more like this! 🔥🔥
Grateful to the community and @e2corporation
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #3303: feat: Added Responsive Sidebar
Posted by GitBox <gi...@apache.org>.
e2corporation commented on code in PR #3303:
URL: https://github.com/apache/incubator-devlake/pull/3303#discussion_r984829127
##########
config-ui/src/components/Nav.jsx:
##########
@@ -15,73 +15,104 @@
* limitations under the License.
*
*/
-import React from 'react'
-import { Alignment, Position, Popover, Navbar, Icon } from '@blueprintjs/core'
+import React, { useContext, useEffect, useState } from 'react'
+import { Position, Popover, Navbar, Icon } from '@blueprintjs/core'
import '@/styles/nav.scss'
import { ReactComponent as SlackIcon } from '@/images/slack-mark-monochrome-black.svg'
import { ReactComponent as SlackLogo } from '@/images/slack-rgb.svg'
+import UIContext from '@/store/UIContext'
+import useWindowSize from '@/hooks/useWIndowSize'
const Nav = () => {
+ const uiContext = useContext(UIContext)
+ const [menuClass, setMenuClass] = useState('navbarMenuButton')
+ const size = useWindowSize()
+
+ const toggleSidebarOpen = (open) => {
Review Comment:
@henit-chobisa for toggle sidebar func which dep are you providing? The entire `uiContext` object? or just `uiContext.changeSidebarVisibility` ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] henit-chobisa commented on pull request #3303: feat: Added Responsive Sidebar
Posted by GitBox <gi...@apache.org>.
henit-chobisa commented on PR #3303:
URL: https://github.com/apache/incubator-devlake/pull/3303#issuecomment-1263780540
@e2corporation
Julien, following you, I made a new PR, taking care of all the linter issues, commits and coding standards of Lake.
Kindly Review.
Thank you... 😄
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] henit-chobisa commented on a diff in pull request #3303: feat: Added Responsive Sidebar
Posted by GitBox <gi...@apache.org>.
henit-chobisa commented on code in PR #3303:
URL: https://github.com/apache/incubator-devlake/pull/3303#discussion_r984840949
##########
config-ui/src/components/Nav.jsx:
##########
@@ -15,73 +15,104 @@
* limitations under the License.
*
*/
-import React from 'react'
-import { Alignment, Position, Popover, Navbar, Icon } from '@blueprintjs/core'
+import React, { useContext, useEffect, useState } from 'react'
+import { Position, Popover, Navbar, Icon } from '@blueprintjs/core'
import '@/styles/nav.scss'
import { ReactComponent as SlackIcon } from '@/images/slack-mark-monochrome-black.svg'
import { ReactComponent as SlackLogo } from '@/images/slack-rgb.svg'
+import UIContext from '@/store/UIContext'
+import useWindowSize from '@/hooks/useWIndowSize'
const Nav = () => {
+ const uiContext = useContext(UIContext)
+ const [menuClass, setMenuClass] = useState('navbarMenuButton')
+ const size = useWindowSize()
+
+ const toggleSidebarOpen = (open) => {
Review Comment:
> @henit-chobisa for toggle sidebar func which dep are you providing? The entire `uiContext` object? or just `uiContext.changeSidebarVisibility` ?
Initially I gave, `uiContext.changeSidebarVisibility`, everything working nicely, but the linter still ask me for the whole uiContext object.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org