Skip to content
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

Open
wants to merge 4 commits into
base: launch-build
Choose a base branch
from

Conversation

andre-code
Copy link
Contributor

@andre-code andre-code commented Jan 20, 2025

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:

  • Landing Page: Now loads with styles v2
  • Renku 1.0 Compatibility:
    * /v1 now loads the Renku 1.0 dashboard when the user is authenticated.
    • Routes under /v1/* load the corresponding Renku 1.0 pages:
      • /v1/search
      • /v1/help
      • /v1/notifications
      • /v1/secrets
  • Projects and Datasets:
    • Routes under /projects/* now load Renku 1.0 project pages.
    • Similarly, /datasets/* routes load the appropriate content from Renku 1.0.


Pending Fixes to solve in (#3501):

  • Style Guide: The style guide is currently broken and will be deprecated in this context.
  • Route Adjustments for /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
  • Project and Group Creation Redirects:
    • Issues with creating projects or groups in v2 need to be resolved.
    • The new redirect from /v2 to /r should address these inconsistencies.

/deploy

@RenkuBot
Copy link
Contributor

You can access the deployment of this PR at https://renku-ci-ui-3494.dev.renku.ch

by default styles v2,
styles v1 apply only for /v1, /projects/*, /datasets/*
@andre-code andre-code force-pushed the andrea/styles-launch-build branch from 1b9be89 to 4802e5d Compare January 22, 2025 09:10
@andre-code andre-code changed the base branch from main to launch-build January 22, 2025 09:16
@andre-code andre-code marked this pull request as ready for review January 22, 2025 10:05
@andre-code andre-code requested a review from a team as a code owner January 22, 2025 10:05
@leafty leafty self-assigned this Jan 22, 2025
Copy link
Member

@leafty leafty left a 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",
Copy link
Member

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?

Copy link
Contributor Author

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)}>
Copy link
Member

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.

Suggested change
<Link to={Url.get(ABSOLUTE_ROUTES.v1.notifications)}>
<Link to={ABSOLUTE_ROUTES.v1.notifications}>

Comment on lines 367 to 374
export function isRenkuLegacy(pathname) {
return (
pathname.startsWith("/v1") ||
pathname.startsWith("/projects") ||
pathname.startsWith("/datasets")
);
}

Copy link
Member

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.

Comment on lines 70 to 74
<LoggedInNavBar
model={props.model}
notifications={props.notifications}
params={props.params}
/>
Copy link
Member

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.

@@ -141,16 +140,36 @@ function FeatureFlagHandler() {
export function StyleHandler() {
return (
<Switch>
<CompatRoute path="/v2">
<Route path="/projects">
Copy link
Member

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?

Copy link
Contributor Author

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)}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<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)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
to={Url.get(ABSOLUTE_ROUTES.v1.search)}
to={ABSOLUTE_ROUTES.v1.search}

location={location}
{...props}
/>
<AppContext.Provider value={appContext}>
Copy link
Member

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.

Copy link
Contributor Author

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/*"
Copy link
Member

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.
@andre-code andre-code force-pushed the andrea/styles-launch-build branch from 7a096c7 to 630a9de Compare January 23, 2025 14:27
@andre-code andre-code requested a review from leafty January 23, 2025 14:39
@andre-code
Copy link
Contributor Author

Thanks, @leafty , for the review! I’ve applied your suggestions.

Copy link
Member

@leafty leafty left a 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. 👏

@@ -141,16 +141,26 @@ function FeatureFlagHandler() {
export function StyleHandler() {
return (
<Switch>
<CompatRoute path="/v2">
<Route path={RELATIVE_ROUTES.projects}>
Copy link
Member

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.

@ciyer
Copy link
Contributor

ciyer commented Jan 24, 2025

This is really great, thanks for making these changes, you've already done a bunch of work from my build! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants