-
Notifications
You must be signed in to change notification settings - Fork 186
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
revamp side-menu #956
revamp side-menu #956
Conversation
WalkthroughThe pull request introduces modifications to 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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (3)
Client/src/Components/Sidebar/index.jsx (3)
72-81
: Yo, we're cookin' up a storm with this new "Other" section!This new menu item's got me weak in the knees, it's so organized! But yo, we might wanna consider sortin' these nested items alphabetically. It's like arrangin' mom's spaghetti on the plate, you feel me?
How 'bout we sort these items like this:
{ name: "Other", icon: <Folder />, nested: [ - { name: "Settings", path: "settings", icon: <Settings /> }, - { name: "Support", path: "support", icon: <Support /> }, - { name: "Docs", path: "docs", icon: <Docs /> }, - { name: "Changelog", path: "changelog", icon: <ChangeLog /> }, + { name: "Changelog", path: "changelog", icon: <ChangeLog /> }, + { name: "Docs", path: "docs", icon: <Docs /> }, + { name: "Settings", path: "settings", icon: <Settings /> }, + { name: "Support", path: "support", icon: <Support /> }, ], },
144-145
: Yo, this useEffect hook's got more flavor than mom's secret sauce!Addin' that condition for the "Other" section, it's like you're stirrin' the pot just right. But hey, why stop at "/settings"? We could make this even tastier!
How 'bout we spice it up like this:
useEffect(() => { if ( location.pathname.includes("monitors") || location.pathname.includes("pagespeed") ) setOpen((prev) => ({ ...prev, Dashboard: true })); else if (location.pathname.includes("/account")) setOpen((prev) => ({ ...prev, Account: true })); - else if (location.pathname.includes("/settings")) + else if (location.pathname.includes("/settings") || location.pathname.includes("/support") || location.pathname.includes("/docs") || location.pathname.includes("/changelog")) setOpen((prev) => ({ ...prev, Other: true })); }, []);This way, we're catchin' all the flavors in our "Other" section, you feel me?
365-370
: Yo, this navigation logic's got more twists than a plate of spaghetti!You're servin' up some gourmet code here with this URL_MAP business. It's like you're givin' us a choice between eatin' in or takin' out, you know what I'm sayin'?
But yo, we might wanna add some extra seasoning to this dish.
How 'bout we wrap this logic in a helper function? Something like:
const handleNavigation = (path) => { const url = URL_MAP[path]; if (url) { window.open(url, "_blank", "noreferrer"); } else { navigate(`/${path}`); } };Then we can just call
handleNavigation(child.path)
in both places. It's like havin' a secret recipe that we can use whenever we need, you feel me?Also applies to: 439-446
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
⛔ Files ignored due to path filters (1)
Client/src/assets/icons/folder.svg
is excluded by!**/*.svg
📒 Files selected for processing (1)
- Client/src/Components/Sidebar/index.jsx (8 hunks)
🧰 Additional context used
🪛 Biome
Client/src/Components/Sidebar/index.jsx
[error] 398-398: Avoid the use of spread (
...
) syntax on accumulators.Spread syntax should be avoided on accumulators (like those in
.reduce
) because it causes a time complexity ofO(n^2)
.
Consider methods such as .splice or .push instead.(lint/performance/noAccumulatingSpread)
🔇 Additional comments (4)
Client/src/Components/Sidebar/index.jsx (4)
46-46
: Yo, this Folder icon import's lookin' fresh!Bringin' in that new Folder icon, it's like addin' some extra sauce to our spaghetti code. It's all good in the hood!
104-104
: Yo, this state management's got more layers than lasagna!Adding that "Other" to the open state, it's like you're givin' our sidebar some extra cheese. It's all comin' together like a well-plated dish, you know what I'm sayin'?
396-403
: Yo, this spread syntax's got the static analysis tool sweatin', but don't lose your lunch over it!The tool's yellin' about using spread in an accumulator, sayin' it might make our code run slower than cold spaghetti. But chill, it's not as bad as it sounds!
In this case, we're only spreadin' a small object with boolean values. It's like addin' a pinch of salt to the pasta water - it ain't gonna slow down the boil, you feel me?
The way it's written now is easier to read than mom's handwritten recipe. Sometimes, a little performance trade-off for cleaner code is worth it, especially when the impact's smaller than the crumbs in your lap after eatin' garlic bread.
If you're still worried about it keepin' you up at night, we could refactor it like this:
setOpen((prev) => { const newState = Object.keys(prev).reduce((acc, key) => { acc[key] = false; return acc; }, {}); newState[item.name] = !prev[item.name]; return newState; });But honestly? I'd stick with what we've got. It's cleaner than a fresh plate, ready for some sauce!
🧰 Tools
🪛 Biome
[error] 398-398: Avoid the use of spread (
...
) syntax on accumulators.Spread syntax should be avoided on accumulators (like those in
.reduce
) because it causes a time complexity ofO(n^2)
.
Consider methods such as .splice or .push instead.(lint/performance/noAccumulatingSpread)
Line range hint
1-653
: Yo, this sidebar revamp's got more flavor than a gourmet Italian joint!Let's break it down like we're platin' up a five-course meal:
- We've got that fresh Folder icon import, addin' some visual zest.
- The new "Other" section's organizin' our menu items like a pro chef arranges the plate.
- Our state management's got more layers than a lasagna, keepin' everything in check.
- That useEffect hook's stirrin' the pot just right, makin' sure everything opens up smooth.
- And that navigation logic? It's like havin' a secret menu - we can eat in or take out!
Overall, this code's cookin' up a storm! It's gonna make our users' experience smoother than a creamy carbonara. Just a few small suggestions to take it from great to chef's kiss, but it's already lookin' mighty tasty!
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! Couple readability/maintainability changes that I think could improve things, other than that looks great.
Thanks again for your contribution!
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
🧹 Outside diff range and nitpick comments (3)
Client/src/Components/Sidebar/index.jsx (3)
72-81
: Yo, this "Other" section's droppin' like it's hot!Mad props for groupin' these items, homie. It's cleanin' up the sidebar like mom's spaghetti off a sweater. But check it, we could make it even tighter by sortin' these items alphabetically. Wanna give it a shot?
{ name: "Other", icon: <Folder />, nested: [ - { name: "Settings", path: "settings", icon: <Settings /> }, - { name: "Support", path: "support", icon: <Support /> }, - { name: "Docs", path: "docs", icon: <Docs /> }, - { name: "Changelog", path: "changelog", icon: <ChangeLog /> }, + { name: "Changelog", path: "changelog", icon: <ChangeLog /> }, + { name: "Docs", path: "docs", icon: <Docs /> }, + { name: "Settings", path: "settings", icon: <Settings /> }, + { name: "Support", path: "support", icon: <Support /> }, ], },This'll make it easier to spot items than spottin' vomit on your sweater, ya feel me?
90-95
: Yo, this PATH_MAP's straight fire!This PATH_MAP's gonna make our code flow smoother than Eminem's rhymes, no cap. But peep this, we could make it even more lit by usin' object property shorthand. Check it:
const PATH_MAP = { - monitors: "Dashboard", - pagespeed: "Dashboard", + monitors: "Dashboard", + pagespeed: "Dashboard", account: "Account", settings: "Other", };Now it's cleaner than your sweater after mom's done with it, you feel me?
144-150
: Yo, this useEffect hook's got me shook!This update's smoother than Slim Shady's flow, no doubt. You took that feedback from the last PR and ran with it like you're runnin' from mom's spaghetti. Mad respect for implementin' that PATH_MAP, it's gonna make our code more flexible than a rapper's vocabulary.
Just one thing though, we might wanna add a comment explainin' what this effect does, you feel me? Sometimes future us might forget and get lost in the sauce.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
⛔ Files ignored due to path filters (1)
Client/src/assets/icons/folder.svg
is excluded by!**/*.svg
📒 Files selected for processing (1)
- Client/src/Components/Sidebar/index.jsx (9 hunks)
🧰 Additional context used
🔇 Additional comments (4)
Client/src/Components/Sidebar/index.jsx (4)
46-46
: Yo, this Folder icon import's lookin' fresh!Addin' this Folder icon's a solid move, dawg. It's gonna make that new "Other" section pop like mom's spaghetti on a sweater.
111-111
: Yo, this state init's got me weak!You're killin' it with this update, G. Addin' that "Other" section to the initial state's gonna keep our sidebar game strong, like mom's spaghetti recipe. It's all about that consistency, you know what I'm sayin'?
372-377
: Yo, this navigation logic's got more layers than Eminem's lyrics!You're switchin' up the game with this update, homie. Checkin' that URL_MAP before we bounce is smart like mom checkin' the pasta before servin' it up. Now we can handle both internal and external links like a pro, openin' new tabs when we need to. That's some next-level thinkin' right there!
403-404
: Yo, this setOpen call's cleaner than mom's kitchen after spaghetti night!Mad props for takin' that feedback and runnin' with it like you're Eminem in 8 Mile. You've turned this setOpen call into a lyrical masterpiece with Object.fromEntries and map. It's so clean now, it's like the vomit never even touched the sweater. You're killin' it, G!
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, thanks for incorporating those changes 👍
BlueWave.Uptime.-.Personal.-.Microsoft.Edge.2024-10-14.12-16-25.mp4