-
Notifications
You must be signed in to change notification settings - Fork 10
feat: APP-866 stay on same page when switching dashboards #2789
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
base: dev
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for terrasos ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Summary of ChangesHello @alexander-astrand, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the dashboard user experience by introducing smarter navigation when switching between personal and organization views. Instead of always redirecting to a default page, the system now attempts to keep the user on the same section, or a logical fallback, ensuring a more seamless transition and reducing the need for users to re-navigate to their desired content. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request implements the logic to maintain the current page when switching between personal and organization dashboards. A new function, getSwitchDashboardPath, is introduced to compute the appropriate navigation path, which includes sensible fallbacks for pages not available on the target dashboard. While the changes successfully implement the feature, I have identified a couple of areas for improvement. My review includes a suggestion to enhance the readability of the path-switching logic and a comment on a potential performance concern related to eager data fetching for both dashboard types.
|
@erikalogie @S4mmyb See testing instructions |
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 69ab6e24bb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
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.
there's a bug when I'm logging in with a web2 account that is a member of an org (eg a viewer since it has no wallet addr)
if I check my org sell orders, then switch to my user dashboard, I'm redirected to /dashboard/sell-orders while there's actually no sell order section for my web2 account (as expected)
I also found another (existing) bug: as a web2 org member, you can't access the org dashboard portfolio while you should be able to see it without being able to perform any tx of course. But I guess we can create a separate task for that
| ? organizationHasCreditBatches | ||
| : personalHasCreditBatches; | ||
|
|
||
| const getSwitchDashboardPath = (targetIsOrg: boolean) => { |
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.
we could wrap it in useCallback and we could even migrate some portion of the logic to Dashboard.utils.tsx to improve code visibility, Dashboard.tsx is already quite large!
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.
adding some comments would be nice too
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.
Did you open a bug for the second one?
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.
yes APP-870
|
Ok this looks good to me aside from the things that Marie already pointed out |
|
https://www.loom.com/share/ccc6a8f37775442db031625d88a61dbc Maybe we should discuss this during the engineering call |
|
Overall looks good and works - we just discussed on the engineering call that if you are within a project (i.e. managing a project) and switch accounts from that view, the redirect should go to projects rather than portfolio if the individual/org doesn't have access to that project. |
@alexander-astrand ignore this, Marie and Sam thought it was fine as-is |
… between dashboards
b54dc20 to
479099e
Compare
| isIssuer: boolean; | ||
| showCreditClasses: boolean; | ||
| isLoadingIsIssuer: boolean; | ||
| isLoadingCreditClasses: boolean; |
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.
we could extract this into a reusable type so we do not have to repeat for both organizationProfileItems and personalProfileItems
| !targetHasCreditClasses && | ||
| !targetCreditClassesLoading) || | ||
| // Don't navigate to sell-orders if switching to personal dashboard without orders | ||
| (section === 'sell-orders' && !targetIsOrg && !hasOrders && !ordersLoading); |
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.
there's a bug when I'm logging in with a web2 account that is a member of an org (eg a viewer since it has no wallet addr)
if I check my org sell orders, then switch to my user dashboard, I'm redirected to /dashboard/sell-orders while there's actually no sell order section for my web2 account (as expected)
I'm still experiencing this bug
This is because hasOrders is about purchased orders (so credits that have be bought), so nothing to do with sell orders (credits that you sold)
Description
https://regennetwork.atlassian.net/browse/APP-866
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
How to test
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...