-
Notifications
You must be signed in to change notification settings - Fork 6
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
feat: set styles for new routing #3494
base: launch-build
Are you sure you want to change the base?
Conversation
You can access the deployment of this PR at https://renku-ci-ui-3494.dev.renku.ch |
8abfc99
to
1b9be89
Compare
by default styles v2, styles v1 apply only for /v1, /projects/*, /datasets/*
1b9be89
to
4802e5d
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.
Some first comments below 👇
Also, can you update the PR description with the routing changes? And also what has been broken by these changes?
v1: { | ||
root: "v1/*", | ||
search: "search", | ||
help: "help", |
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.
Where are notifications, styleGuide, secrets
?
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.
I have included in the last commit
@@ -323,7 +325,7 @@ class NotificationsMenuList extends Component { | |||
|
|||
return ( | |||
<Fragment> | |||
<Link to="/notifications"> | |||
<Link to={Url.get(ABSOLUTE_ROUTES.v1.notifications)}> |
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.
Do not use Url.get()
with ABSOLUTE_ROUTES
.
<Link to={Url.get(ABSOLUTE_ROUTES.v1.notifications)}> | |
<Link to={ABSOLUTE_ROUTES.v1.notifications}> |
export function isRenkuLegacy(pathname) { | ||
return ( | ||
pathname.startsWith("/v1") || | ||
pathname.startsWith("/projects") || | ||
pathname.startsWith("/datasets") | ||
); | ||
} | ||
|
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 would be better to add this to a TypeScript file. It is OK to have HelperFunctionsV2.ts
.
client/src/landing/NavBar.jsx
Outdated
<LoggedInNavBar | ||
model={props.model} | ||
notifications={props.notifications} | ||
params={props.params} | ||
/> |
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.
Note: this should probably be a V1 navbar which is LoggedInNavBar
or AnonymousNavBar
.
client/src/index.jsx
Outdated
@@ -141,16 +140,36 @@ function FeatureFlagHandler() { | |||
export function StyleHandler() { | |||
return ( | |||
<Switch> | |||
<CompatRoute path="/v2"> | |||
<Route path="/projects"> |
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.
Are we not using the RELATIVE_ROUTES
here?
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.
I have included in the last commit
@@ -212,7 +213,7 @@ export function RenkuToolbarHelpMenu({ firstItem }: RenkuToolbarHelpMenuProps) { | |||
aria-labelledby="help-menu" | |||
> | |||
<DropdownItem className="p-0"> | |||
<Link className="dropdown-item" to="/help"> | |||
<Link className="dropdown-item" to={Url.get(ABSOLUTE_ROUTES.v1.help)}> |
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.
<Link className="dropdown-item" to={Url.get(ABSOLUTE_ROUTES.v1.help)}> | |
<Link className="dropdown-item" to={ABSOLUTE_ROUTES.v1.help}> |
@@ -98,7 +99,7 @@ export default function LoggedInNavBar({ | |||
className="nav-item col-12 col-sm-4 col-lg-auto pe-lg-4" | |||
> | |||
<RenkuNavLink | |||
to={Url.get(Url.pages.landing)} | |||
to={Url.get(ABSOLUTE_ROUTES.v1.root)} |
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.
to={Url.get(ABSOLUTE_ROUTES.v1.root)} | |
to={ABSOLUTE_ROUTES.v1.root} |
@@ -85,7 +86,7 @@ export default function LoggedInNavBar({ | |||
> | |||
<NavItem className="nav-item col-12 col-sm-4 col-lg-auto pe-lg-4"> | |||
<RenkuNavLink | |||
to={Url.get(Url.pages.search)} | |||
to={Url.get(ABSOLUTE_ROUTES.v1.search)} |
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.
to={Url.get(ABSOLUTE_ROUTES.v1.search)} | |
to={ABSOLUTE_ROUTES.v1.search} |
location={location} | ||
{...props} | ||
/> | ||
<AppContext.Provider value={appContext}> |
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.
Any specific reason to move AppContext.Provider
? Also, if you do move it to include more of the App, then it would be nice to remove the params
prop drilling.
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.
the NavbarV2
uses parameters from the appContext, so to make those values available, I rewrote the other component to also retrieve the values from the appContext
} | ||
/> | ||
<Route | ||
path="help/*" |
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.
Use RELATIVE_ROUTES
here.
- Fix handling of absolute and relative routes. - Remove prop drilling for params, modal, and notifications in App.jsx. - Prevent redirection to / when the user is unauthenticated in /v1. - Display the anonymous navigation bar on /v1, /projects, and /datasets when the user is not authenticated.
7a096c7
to
630a9de
Compare
Thanks, @leafty , for the review! I’ve applied your suggestions. |
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.
One comment about the style handler, otherwise this looks good. 👏
client/src/index.jsx
Outdated
@@ -141,16 +141,26 @@ function FeatureFlagHandler() { | |||
export function StyleHandler() { | |||
return ( | |||
<Switch> | |||
<CompatRoute path="/v2"> | |||
<Route path={RELATIVE_ROUTES.projects}> |
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.
Should the style handler use the isRenkuLegacy()
function instead? With doing the routing here and having the isRenkuLegacy()
function, we have a risk of not having the style corresponding to what isRenkuLegacy()
says.
This is really great, thanks for making these changes, you've already done a bunch of work from my build! :) |
PR to handle atyles for new routing
fix #3499
Tests will be handled in #3503.
Functionalities such as creating a new v2 project or v2 group will be addressed in #3501.
Summary of Changes
Included in the Update:
*
/v1
now loads the Renku 1.0 dashboard when the user is authenticated./v1/*
load the corresponding Renku 1.0 pages:/v1/search
/v1/help
/v1/notifications
/v1/secrets
/projects/*
now load Renku 1.0 project pages./datasets/*
routes load the appropriate content from Renku 1.0.Pending Fixes to solve in (#3501):
/v2
:/secrets
,/search
, and/help
should load the content currently served under/v2/secrets
,/v2/search
, and/v2/help
./notifications
should load what is in/v1/notifications
??? pending to decide since/v2/notifications
doesn’t exist/v2
to/r
should address these inconsistencies./deploy