diff --git a/docs/src/components/home/ProductsSwitcher.tsx b/docs/src/components/home/ProductsSwitcher.tsx
index 812c6b9b4355bf..f42bb70cdb1296 100644
--- a/docs/src/components/home/ProductsSwitcher.tsx
+++ b/docs/src/components/home/ProductsSwitcher.tsx
@@ -89,8 +89,8 @@ export default function ProductsSwitcher(props: {
icon={}
/>,
}
chip={
,
+ },
+ {
+ segment: 'orders',
+ title: 'Orders',
+ icon: ,
+ },
+ {
+ kind: 'divider',
+ },
+ {
+ kind: 'header',
+ title: 'Analytics',
+ },
+ {
+ segment: 'reports',
+ title: 'Reports',
+ icon: ,
+ children: [
+ {
+ segment: 'sales',
+ title: 'Sales',
+ icon: ,
+ },
+ {
+ segment: 'traffic',
+ title: 'Traffic',
+ icon: ,
+ },
+ ],
+ },
+ {
+ segment: 'integrations',
+ title: 'Integrations',
+ icon: ,
+ },
+];
+
+interface DemoProps {
+ window?: () => Window;
+}
+
+const NOOP = () => {};
+
+const PlaceHolder = styled('div')<{ height: number }>(({ theme, height }) => ({
+ border: `1px solid ${theme.palette.divider}`,
+ height,
+ borderRadius: theme.shape.borderRadius,
+}));
+
+function DashboardLayoutBasic(props: DemoProps) {
+ const { window } = props;
+
+ const [pathname, setPathname] = React.useState('/dashboard');
+
+ const router = React.useMemo(() => {
+ return {
+ pathname,
+ searchParams: new URLSearchParams(),
+ navigate: (path) => setPathname(String(path)),
+ };
+ }, [pathname]);
+
+ const demoWindow = window !== undefined ? window() : undefined;
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+}
+
+export default function ToolpadDashboardLayout() {
+ return (
+
+
+
+ );
+}
diff --git a/docs/src/components/home/ToolpadShowcase.tsx b/docs/src/components/home/ToolpadShowcase.tsx
index 08a10b519b16a5..a2bcbf435e9ff9 100644
--- a/docs/src/components/home/ToolpadShowcase.tsx
+++ b/docs/src/components/home/ToolpadShowcase.tsx
@@ -10,7 +10,28 @@ import { HighlightedCode } from '@mui/docs/HighlightedCode';
import MoreInfoBox from 'docs/src/components/action/MoreInfoBox';
import ROUTES from 'docs/src/route';
-const tabOneCode = `
+const ToolpadCoreShowcase = React.lazy(() => import('./ToolpadCoreShowcaseDemo'));
+
+const tabOneCode = `,
+ }
+ // ...
+]}>
+
+
+ {/* ... */}
+
+
+`;
+
+const tabTwoCode = `
apiVersion: v1
kind: page
spec:
@@ -32,46 +53,45 @@ spec:
name: map
`;
-const tabTwoCode = `
-import { createDataProvider } from "@toolpad/studio/server";
-import db from "../db";
-export default createDataProvider({
- async getRecords({ paginationModel: { start, pageSize } }) {
- return {
- records: await db.query("SELECT * FROM USERS"),
- };
- },
-});
-`;
+interface TabContainerProps {
+ index: number;
+ value: number;
+ isDemo: boolean;
+ children: React.ReactNode;
+}
-const tabThreeCode = `
-import * as React from "react";
-import { createComponent } from "@toolpad/studio/browser";
-import * as L from "leaflet";
-function Leaflet({ lat, long, zoom }: LeafletProps) {
- const root: any = React.useRef(null);
+function TabContainer({ index, value, isDemo, children }: TabContainerProps) {
return (
-
+ ({
+ width: '100%',
+ maxWidth: '100%',
+ height: 260,
+ display: value === index ? 'flex' : 'none',
+ overflow: isDemo ? 'auto' : 'clip',
+ bgcolor: '#FFF',
+ borderRadius: '8px',
+ boxShadow: `0 4px 8px ${alpha(theme.palette.common.black, 0.1)}`,
+ borderColor: 'grey.200',
+ ...(isDemo && { scrollbarGutter: 'stable' }),
+ })}
+ >
+ {children}
+
);
}
-export default createComponent(Leaflet, {
- argTypes: {
- lat: { type: "number", }
-})
- `;
interface ImageProps {
alt: string;
- index: number;
src: string;
- value: number;
}
-function Image({ alt, index, src, value }: ImageProps) {
+function Image({ alt, src }: ImageProps) {
return (
+ Loading...
+
+ }
+ >
+
+
+ );
+}
+
interface TabPanelProps {
children?: React.ReactNode;
index: number;
@@ -115,37 +156,28 @@ function a11yProps(index: number) {
const tabsCodeInfo = [
{
code: tabOneCode,
- label: 'Local first',
- language: 'yml',
- description:
- "Store your app's configuration locally in yaml files. Changes made in Toolpad Studio are automatically synced to the files, and vice-versa.",
+ label: 'Core',
+ language: 'tsx',
imgSrc: '/static/branding/toolpad/ex-1.png',
- imgAlt: '.yaml file represents Toolpad app',
+ imgAlt: 'Toolpad app',
+ Demo: ToolpadCoreShowcaseDemo,
},
{
code: tabTwoCode,
- label: 'Serverless',
- language: 'tsx',
+ label: 'Studio',
+ language: 'yml',
description:
- 'Write serverless functions to fetch your data, Toolpad automatically makes the result available on the page.',
- imgSrc: '/static/branding/toolpad/ex-2.png',
- imgAlt: 'Toolpad user management app',
- },
- {
- code: tabThreeCode,
- label: 'Customizable',
- language: 'tsx',
- description: 'Bring your own React components into Toolpad Studio.',
- imgSrc: '/static/branding/toolpad/ex-3.png',
- imgAlt: 'Toolpad app with custom component',
+ 'A drag-and-drop builder for creating dashboards and internal tools quickly, with your own components and data. Changes you make are synced to yml, and vice versa.',
+ imgSrc: '/static/branding/toolpad/ex-1.png',
+ imgAlt: '.yaml file represents Toolpad app',
},
];
export default function ToolpadShowcase() {
- const [value, setValue] = React.useState(0);
+ const [tabValue, setTabValue] = React.useState(0);
const handleChange = (event: React.SyntheticEvent, newValue: number) => {
- setValue(newValue);
+ setTabValue(newValue);
};
return (
@@ -154,7 +186,7 @@ export default function ToolpadShowcase() {
preview={
({
@@ -195,21 +227,17 @@ export default function ToolpadShowcase() {
))}
- ({
- width: '100%',
- height: 260,
- overflow: 'clip',
- boxShadow: `0 4px 8px ${alpha(theme.palette.common.black, 0.1)}`,
- borderColor: 'grey.200',
- borderRadius: '8px',
- })}
- >
- {tabsCodeInfo.map((tab, index) => (
-
- ))}
-
+ {tabsCodeInfo.map((tab, index) =>
+ tab.Demo ? (
+
+
+
+ ) : (
+
+
+
+ ),
+ )}
}
@@ -217,19 +245,21 @@ export default function ToolpadShowcase() {
{tabsCodeInfo.map((tab, index) => (
-
-
- {tab.description}
-
+
+ {tab.description ? (
+
+ {tab.description}
+
+ ) : null}
}
diff --git a/docs/src/route.ts b/docs/src/route.ts
index c91b5953700ece..b5d20ee57a4b4f 100644
--- a/docs/src/route.ts
+++ b/docs/src/route.ts
@@ -51,9 +51,10 @@ const ROUTES = {
treeViewOverview: '/x/react-tree-view/',
// Toolpad pages
toolpadLandingPage: '/toolpad/',
+ toolpadStudioLandingPage: '/toolpad/studio/',
toolpadStudioDocs: '/toolpad/studio/getting-started/',
toolpadCoreDocs: '/toolpad/core/introduction/',
- toolpadWhy: '/toolpad/studio/getting-started/why-toolpad/',
+ toolpadStudioWhy: '/toolpad/studio/getting-started/why-toolpad/',
// External pages
rssFeed: '/feed/blog/rss.xml',
handbook: 'https://mui-org.notion.site/Handbook-f086d47e10794d5e839aef9dc67f324b',