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

Integrate Toolpad Core in Toolpad Studio runtime #4119

Merged
merged 34 commits into from
Oct 10, 2024

Conversation

apedroferreira
Copy link
Member

@apedroferreira apedroferreira commented Sep 19, 2024

Closes #4060
Closes #4155

Screen.Recording.2024-10-03.at.14.21.49.mov
Screen.Recording.2024-10-03.at.14.22.40.mov
  • Includes fix in Studio for only scrolling to selected elements in editor when needed (it was really disrupting UX)
  • Includes and documents new specific AppProvider with react-router-dom routing out of the box
  • Adds sx prop to DashboardLayout that can be used to customize height, width or any other styles. The default layout dimensions are 100vh and 100vw but can be overriden. The layout header and sidebar do not use fixed positions anymore, but absolute ones instead, and vertical scrolling happens in the layout content only.

https://deploy-preview-4119--mui-toolpad-docs.netlify.app/toolpad/core/introduction/base-concepts
https://deploy-preview-4119--mui-toolpad-docs.netlify.app/toolpad/core/react-app-provider
https://deploy-preview-4119--mui-toolpad-docs.netlify.app/toolpad/core/react-dashboard-layout/#full-screen-content

#4045 and #4149 will be covered separately for a fuller documentation of the new AppProvider for React Router. Left TODO comments in both issues.

@apedroferreira apedroferreira added the core Infrastructure work going on behind the scenes label Sep 19, 2024
@apedroferreira apedroferreira self-assigned this Sep 19, 2024
@@ -270,6 +270,14 @@ if (import.meta.hot) {
: // load compiled
path.resolve(currentDirectory, '../exports'),
},
{
find: '@toolpad/core',
Copy link
Member Author

@apedroferreira apedroferreira Sep 19, 2024

Choose a reason for hiding this comment

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

I had to add an alias here to get @toolpad/core imports to work in Studio, not sure why it's not needed for @toolpad/studio-components for example, as those just worked?

Copy link
Member

Choose a reason for hiding this comment

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

pnpm installs the core build folder into studio node modules because of its package.json publishConfig.directory setting. During the core build command a package.json is generated in that build folder. the build folder is what gets published on npm.

The dev command of builds the sources into the build folder, but it doesn't copy the package.json. That's why module resolution doesn't work. You made it work by alisaing to the core main folder, which does have a package.json.

I added some commits that just call the copy command in the dev command. It's not perfect, it won't watch for changes to package.json, but at least it unblocks us in the PR.

@github-actions github-actions bot added PR: out-of-date The pull request has merge conflicts and can't be merged and removed PR: out-of-date The pull request has merge conflicts and can't be merged labels Sep 20, 2024
@Janpot
Copy link
Member

Janpot commented Sep 20, 2024

This horizontal scrolling is something to investigate:

Screen.Recording.2024-09-20.at.10.26.48.mov

@apedroferreira
Copy link
Member Author

This horizontal scrolling is something to investigate:

Yeah still fixing a few things.

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Sep 20, 2024
return [
`import { ${name} } from '@toolpad/core/${name}';${
hasNextJsVersion
? `\nimport { ${name} } from '@toolpad/core/nextjs/${name}'; // Next.js`
: ''
}${
hasReactRouterDOMVersion
? `\nimport { ${name} } from '@toolpad/core/react-router-dom/${name}'; // react-router-dom`
Copy link
Member

@Janpot Janpot Sep 20, 2024

Choose a reason for hiding this comment

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

We don't support imports deeper than one level. This must be

import { AppProvider } from '@toolpad/core/react-router-dom'

cc @bharatkashyap same for nextjs

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Oct 1, 2024
@apedroferreira apedroferreira marked this pull request as ready for review October 3, 2024 17:26
@apedroferreira apedroferreira requested review from Janpot and a team October 3, 2024 17:26
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Oct 5, 2024
Copy link
Member

@Janpot Janpot left a comment

Choose a reason for hiding this comment

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

Looks good, let's just add that test that covers the React warning we see in https://stackblitz.com/run?file=Demo.tsx,index.tsx

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Oct 9, 2024
@apedroferreira
Copy link
Member Author

Looks good, let's just add that test that covers the React warning we see in https://stackblitz.com/run?file=Demo.tsx,index.tsx

Added that test and also a full-size map demo in https://deploy-preview-4119--mui-toolpad-docs.netlify.app/toolpad/core/react-dashboard-layout/#full-screen-content

Merging soon if there's nothing else!

@Janpot
Copy link
Member

Janpot commented Oct 9, 2024

The theme toggle doesn't work

Screen.Recording.2024-10-09.at.16.22.07.mov

@apedroferreira
Copy link
Member Author

The theme toggle doesn't work

Screen.Recording.2024-10-09.at.16.22.07.mov

Works for me...
And no changes related to that as far as I know...
Can you change it in the other demos?

@Janpot
Copy link
Member

Janpot commented Oct 9, 2024

Can you change it in the other demos?

Yes, I could

But now it seems to be fixed. I did expect all of them to change when I switch one 🤔

@apedroferreira
Copy link
Member Author

apedroferreira commented Oct 9, 2024

Can you change it in the other demos?

Yes, I could

But now it seems to be fixed.

Weird, I guess we can ignore for now and it might come up again if it's an issue?

I did expect all of them to change when I switch one 🤔

This used to happen before, I can try to make it work like that again later if we decide it would be best.

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Oct 9, 2024
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Oct 10, 2024
@apedroferreira apedroferreira merged commit a0c12c9 into mui:master Oct 10, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Infrastructure work going on behind the scenes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DashboardLayout 100dvh integrate Toolpad core into Toolpad studio runtime
2 participants