feat(#304) Environments color 🎨#1053
feat(#304) Environments color 🎨#1053sid-bruno merged 14 commits intousebruno:feature/environment-color-extendedfrom
Conversation
c831150 to
10e7f14
Compare
eb02a3c to
0bf21d1
Compare
|
It would be nice if this could tint more than just the Environment button in the corner, but that's probably best left as a follow-up. (Also, why all the force-pushes?) |
|
Hi! When will this be merged? This one feature is the only thing stopping us from moving from Insomnia to Bruno LOL |
0f443d6 to
339687a
Compare
|
quite some changes, using redux store. |
|
Following up on this, really appreciate seeing the progress:) |
|
Checking in again:) |
|
Friendly ping:) |
I would also love it to see it merged and available in my beloved bruno! |
|
Beep 🤖 |
|
Any updates on this PR? It would be nice to have it in Bruno. Thanks! |
|
If something interested, I rebase this PR on v1.23.0 |
2709a60 to
77c6714
Compare
|
Hello there, I rebased the work onto main branch. (not something I will do every month, fixing conflicts..) |
|
Hello, could somebody from Bruno maintainers please indicate what is the expected timeframe of this feature's integration or what are the next steps with this pull request? Certainly for our team (and I believe many others) used to Insomnia's environment colors, this represents a significant and eagerly awaited UX improvement. Thanks! |
|
Any updates on this feature? |
…ings/EnvironmentList/EnvironmentDetails/EnvironmentColor/index.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Signed-off-by: Mathieu D <mathieu.dreano@decathlon.com>
Signed-off-by: Mathieu D <mathieu.dreano@decathlon.com>
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/index.js (1)
27-45: Potential infinite loop and redundant logic in the effect.This effect has
selectedEnvironmentin its dependency array while also callingsetSelectedEnvironmentinside. This can cause repeated re-runs. Additionally, lines 29-33 already find and set_selectedEnvironment, but line 35 immediately overwrites it with another lookup—this appears redundant.Consider consolidating the logic:
🐛 Proposed fix
useEffect(() => { if (selectedEnvironment) { - const _selectedEnvironment = environments?.find(env => env?.uid === selectedEnvironment?.uid); - const hasSelectedEnvironmentChanged = !isEqual(selectedEnvironment, _selectedEnvironment); - if (hasSelectedEnvironmentChanged) { - setSelectedEnvironment(_selectedEnvironment); - } - setOriginalEnvironmentVariables(selectedEnvironment.variables); - setSelectedEnvironment(findItem(environments, selectedEnvironment.uid)); + const updatedEnv = findItem(environments, selectedEnvironment.uid); + if (updatedEnv && !isEqual(selectedEnvironment, updatedEnv)) { + setSelectedEnvironment(updatedEnv); + setOriginalEnvironmentVariables(updatedEnv.variables); + } return; } const environment = findItem(environments, activeEnvironmentUid); if (environment) { setSelectedEnvironment(environment); } else { setSelectedEnvironment(environments?.length ? environments[0] : null); } - }, [activeEnvironmentUid, selectedEnvironment]); + }, [activeEnvironmentUid, environments]);
🧹 Nitpick comments (2)
packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/index.js (2)
47-51: Redundant effect—already handled above.This effect syncs
selectedEnvironmentwhenenvironmentschanges, but the first effect (lines 27-45) should already handle this if its dependencies are corrected. Consider removing this effect to avoid duplicate re-renders and potential race conditions between effects.♻️ Proposed removal
- useEffect(() => { - if (selectedEnvironment) { - setSelectedEnvironment(findEnvironmentInCollection(collection, selectedEnvironment.uid)); - } - }, [environments]);
2-2: Inconsistent usage offindItemvsfindEnvironmentInCollection.Line 35 uses
findItem(environments, ...)while line 49 usesfindEnvironmentInCollection(collection, ...). Both accomplish the same goal but with different signatures. Pick one approach for consistency—findItemoperates on the array directly, whilefindEnvironmentInCollectionexpects the collection object.Also applies to: 35-35, 49-49
Signed-off-by: Mathieu D <mathieu.dreano@decathlon.com>
|
Hey, @MathieuDreano thanks for the contribution, there's internal work going on to improve and polish your PR, would you mind if the contributors adopted this PR and merged it in? |
|
Hello @sid-bruno good to know you're working on it, I leave it to you ! You can merge as much as you want ! |
|
Cool, i'll merge this in and then we'll take it from there mostly because of design consistency |
|
@sid-bruno one thing that would be nice and I didn't have the time to look up, use oklch to better handle light/dark theme.
|
Probably over time, currently the theme structure has just gotten hardened and is on RGB, will take this up as we get more time to polish the color accuracy |
fc4dcc9
into
usebruno:feature/environment-color-extended
* associate environment to a color Signed-off-by: mathieu <mathieu.dreano@gmail.com> use StyledWrapper Signed-off-by: mathieu <mathieu.dreano@gmail.com> don't save anything for color if it is not set Signed-off-by: mathieu <mathieu.dreano@gmail.com> use redux store instead of local state remove logs fix selectedEnvironment cleanup add bottom border on active tab * associate environment to a color Signed-off-by: mathieu <mathieu.dreano@gmail.com> * move dependency to appropriate package.json Signed-off-by: mathieu <mathieu.dreano@gmail.com> * use border instead of background color Signed-off-by: mathieu <mathieu.dreano@gmail.com> * simplify onColorChange Signed-off-by: mathieu <mathieu.dreano@gmail.com> * add black, keep backgound on unselected color Signed-off-by: mathieu <mathieu.dreano@gmail.com> * fix conflicts Signed-off-by: mathieu <mathieu.dreano@gmail.com> * associate environment to a color Signed-off-by: mathieu <mathieu.dreano@gmail.com> use StyledWrapper Signed-off-by: mathieu <mathieu.dreano@gmail.com> don't save anything for color if it is not set Signed-off-by: mathieu <mathieu.dreano@gmail.com> use redux store instead of local state remove logs fix selectedEnvironment cleanup add bottom border on active tab # Conflicts: # packages/bruno-app/src/components/Environments/EnvironmentSelector/StyledWrapper.js # packages/bruno-app/src/components/Environments/EnvironmentSelector/index.js # packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/index.js # packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/index.js # packages/bruno-app/src/components/Environments/EnvironmentSettings/index.js # packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js * Update packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentColor/index.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * unused selectedEnvironment prop in EnvironmentList Signed-off-by: Mathieu D <mathieu.dreano@decathlon.com> * RequestTab, avoid unnecessary call if undefined activeCollection Signed-off-by: Mathieu D <mathieu.dreano@decathlon.com> * use @uiw/reac-color instead of react-color Signed-off-by: Mathieu D <mathieu.dreano@decathlon.com> --------- Signed-off-by: mathieu <mathieu.dreano@gmail.com> Signed-off-by: Mathieu D <mathieu.dreano@decathlon.com> Co-authored-by: Mathieu D <mathieu.dreano@decathlon.com> Co-authored-by: Anoop M D <anoop@usebruno.com> Co-authored-by: Mathieu DREANO <122891400+mdreano@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
|
You're welcome, I looked at your "polish", you did like 90% of the job 😅 |
Even if it was one line from you, it's still a contribution and I wouldn't want to take that away from you. This should be available in the next release |
…and refactor License component to remove unnecessary props (#1053)

Description
associated issue: close #304
Associate a color to each environment, for quick visualization (and avoid calling your production environment by mistake...)
environment selection:

environment settings

env.bru format

highlight on request tab

Contribution Checklist:
Summary by CodeRabbit
New Features
Refactor
Style
✏️ Tip: You can customize this high-level summary in your review settings.