-
Notifications
You must be signed in to change notification settings - Fork 32
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
updated dashboard buttons link #433
Conversation
WalkthroughThe pull request modifies the navigation routes in the Dashboard component of the frontend. The changes simplify the routing paths for creating different types of activities by removing the Changes
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
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.
It should also open the 'create' page' dialog. use useLocation() to pass autoOpen=true to the target pages.
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
frontend/src/scenes/hints/HintDefaultPage.jsx (1)
32-32
: Clean passing ofautoOpen
You're handing overautoOpen
for conditional opening. Keep that spaghetti-code from tangling—this approach seems crisp.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
frontend/src/scenes/banner/BannerDefaultPage.jsx
(3 hunks)frontend/src/scenes/banner/CreateBannerPage.jsx
(2 hunks)frontend/src/scenes/dashboard/Dashboard.jsx
(1 hunks)frontend/src/scenes/hints/CreateHintPage.jsx
(2 hunks)frontend/src/scenes/hints/HintDefaultPage.jsx
(3 hunks)frontend/src/scenes/popup/PopupDefaultPage.jsx
(3 hunks)frontend/src/templates/GuideTemplate/GuideTemplate.jsx
(4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- frontend/src/scenes/dashboard/Dashboard.jsx
🔇 Additional comments (17)
frontend/src/scenes/hints/HintDefaultPage.jsx (2)
2-2
: Superb import usage!
Your import of useLocation
is on point like the snare in a fresh beat. No concerns here, it’s neat work.
12-12
: Smart usage of useLocation
Nice job injecting locationData
to read location state. Smooth like a freestyle flow—this sets you up to pass the autoOpen
prop.
frontend/src/scenes/popup/PopupDefaultPage.jsx (3)
2-2
: Location import is tight
No sweaty palms here—this import is an essential piece for managing state-based navigation.
12-12
: Location usage is cohesive
Your usage of locationData
sets you up to pass advanced state. Put your mind at ease—this looks good.
33-33
: Solid autoOpen
integration
Bringing out that autoOpen
from locationData
is a slick move, making the user experience extra fresh.
frontend/src/scenes/banner/BannerDefaultPage.jsx (3)
2-2
: Location import: all set
As steady as your lyrical flow—import is correct and positions the code for dynamic routing states.
12-12
: Effective location retrieval
Utilizing useLocation()
helps you handle the autoOpen
flow. Stay solid in your approach.
32-32
: Passing autoOpen
for sweet user experience
Injecting autoOpen
ensures that you open that banner page with no fuss, preventing spaghetti scenarios.
frontend/src/templates/GuideTemplate/GuideTemplate.jsx (5)
9-9
: Kudos for hooking up Router
Importing useLocation
and useNavigate
keeps your flow on lock, enabling deeper control of modal behaviour.
21-22
: Location and navigation synergy
Your usage of location
and navigate
is balanced like a well-tuned verse. No concerns there.
25-29
: Neat onCloseHandler
This logic channels the user back home if autoOpen
was set—like a perfect outro to a track. This is great.
49-49
: Close icon triggers onCloseHandler
Implementation is consistent—closing with class, ensuring you reset state if needed. Tidy work indeed.
75-75
: Cancelled in style
Your “Cancel” button calls onCloseHandler
to keep the flow consistent, preventing messy ends like dropped bars.
frontend/src/scenes/banner/CreateBannerPage.jsx (2)
15-15
: Yo dawg, these prop and hook changes are straight fire! 🔥
The addition of autoOpen
prop and destructuring openDialog
from useDialog
hook creates a clean interface for controlling dialog behavior from the dashboard.
Also applies to: 24-24
31-33
: Ayy, this useEffect is clean as mom's spaghetti! 🍝
The effect hook correctly:
- Watches both
autoOpen
andopenDialog
dependencies - Only triggers dialog when
autoOpen
is true - Follows React's best practices for effects
However, let's verify the dialog behavior across the app.
✅ Verification successful
Yo, the autoOpen dialog behavior is consistent across all components! 🍝
After checking the codebase with sweaty palms, I can confirm that all components (Banner, Hint, Popup, and Links) handle the autoOpen prop in the same clean way:
- They all use a useEffect hook
- They all check if autoOpen is true before calling openDialog
- They all include openDialog in the dependencies array
The implementation is as consistent as mom's spaghetti recipe across:
- frontend/src/scenes/banner/CreateBannerPage.jsx
- frontend/src/scenes/hints/CreateHintPage.jsx
- frontend/src/scenes/popup/CreatePopupPage.jsx
- frontend/src/scenes/links/NewLinksPopup.jsx
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for other components using autoOpen prop to ensure consistent behavior
ast-grep --pattern 'const $_ = ({ $$$, autoOpen = $_, $$$}) => {
$$$
}'
Length of output: 46324
frontend/src/scenes/hints/CreateHintPage.jsx (2)
13-14
: Yo, this component's keeping it real with the same pattern! 💯
The changes maintain consistency with CreateBannerPage.jsx, which is crucial for codebase maintainability.
62-64
: This useEffect's got the same flow as its banner brother! 🎵
The implementation is consistent with CreateBannerPage.jsx, but let's verify the dashboard integration.
✅ Verification successful
Yo, the navigation flow's in perfect harmony! 🎵
Just dropped some mad verification on this beat, and the Dashboard's navigation is straight fire! It's handling that autoOpen
state consistently across all components - popups, banners, and hints are all following the same flow. Each click triggers navigation with that sweet autoOpen: true
state, just like mom's spaghetti recipe - never fails!
- Dashboard.jsx is passing
{ state: { autoOpen: true }}
when navigating to "/hint" - Same pattern's used for "/banner" and "/popup" routes
- Your useEffect in CreateHintPage is catching that state exactly how it should
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check Dashboard component for consistent navigation state
rg -A 5 "navigate\(['\"].*['\"],.*autoOpen.*\)"
Length of output: 1252
5a54a53
to
83b4ec5
Compare
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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
frontend/src/scenes/banner/CreateBannerPage.jsx (1)
31-33
: Don't forget to clean up after the party! 🧹Consider adding a cleanup function to handle component unmounting:
useEffect(() => { if (autoOpen) openDialog(); + return () => { + if (autoOpen) closeDialog(); + }; }, [autoOpen, openDialog]);
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
frontend/src/scenes/banner/BannerDefaultPage.jsx
(3 hunks)frontend/src/scenes/banner/CreateBannerPage.jsx
(2 hunks)frontend/src/scenes/dashboard/Dashboard.jsx
(1 hunks)frontend/src/scenes/hints/CreateHintPage.jsx
(2 hunks)frontend/src/scenes/hints/HintDefaultPage.jsx
(3 hunks)frontend/src/scenes/popup/PopupDefaultPage.jsx
(3 hunks)frontend/src/templates/GuideTemplate/GuideTemplate.jsx
(4 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
- frontend/src/scenes/banner/BannerDefaultPage.jsx
- frontend/src/scenes/hints/CreateHintPage.jsx
- frontend/src/scenes/hints/HintDefaultPage.jsx
- frontend/src/scenes/popup/PopupDefaultPage.jsx
- frontend/src/scenes/dashboard/Dashboard.jsx
🔇 Additional comments (4)
frontend/src/templates/GuideTemplate/GuideTemplate.jsx (2)
9-9
: Yo dawg, these router hooks are straight fire! 🔥
Clean implementation of React Router hooks for handling navigation state.
Also applies to: 21-22
49-49
: These click handlers be vibin' together! 🎵
Solid consistency in using the same onCloseHandler for both close actions.
Also applies to: 75-75
frontend/src/scenes/banner/CreateBannerPage.jsx (2)
15-15
: Props game strong! 💪
Clean implementation of the autoOpen prop with proper default value and useDialog hook usage.
Also applies to: 24-24
Line range hint 15-33
: Let's make sure this flow is as smooth as mom's spaghetti! 🍝
Verify the complete navigation flow:
- Dashboard -> Banner (with autoOpen: true)
- Banner opens automatically
- Close Banner -> Navigate to root
✅ Verification successful
Yo, this navigation flow is cookin' like mom's perfect spaghetti! 🍝
The flow is properly implemented and working smoothly:
- Dashboard correctly initiates the flow with
navigate("/banner", { state: { autoOpen: true } })
- CreateBannerPage handles the auto-open through the
useEffect
hook - GuideTemplate handles the navigation on close with
if (location.state?.autoOpen) navigate("/", { state: {} })
The pattern is consistently used across other components (popup, hint) following the same recipe, making it a well-tested and reliable implementation.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check for any other components using the same pattern
rg -l "state: \{ autoOpen: true \}"
# Verify the navigation pattern implementation
ast-grep --pattern 'useNavigate()' -l
Length of output: 227
Script:
#!/bin/bash
# Let's get this spaghetti right! First, check the navigation pattern with proper language
ast-grep --pattern 'useNavigate()' --lang javascript
# Check how autoOpen is being passed around
rg -A 3 "autoOpen.*true"
# Let's see the dialog closing logic
ast-grep --pattern 'closeDialog()' --lang javascript
# And check for any navigation after dialog close
rg -B 2 -A 2 "navigate\(.*\)"
Length of output: 11446
Passed the autoOpen prop using the useLocation hook and ensured the state is removed when the dialog is closed. It might also be necessary to remove the state during the onSave event. Please let me know if this is the expected behavior we want! |
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.
Looks good!
We are trying to fix that issue in #410, but thanks for pointing it out! |
Describe your changes
Changed target links for buttons on dashboard
Issue number
#428
Please ensure all items are checked off before requesting a review: