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

[website] Split Toolpad documentation #41316

Merged
merged 9 commits into from
Mar 15, 2024
2 changes: 1 addition & 1 deletion docs/src/components/header/HeaderNavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ export default function HeaderNavBar() {
id={PRODUCT_IDS[4]}
href={ROUTES.productToolpad}
icon={<IconImage name="product-toolpad" />}
name="MUI Toolpad"
name="Toolpad"
chip={<Chip label="Beta" size="small" color="primary" variant="outlined" />}
description="Low-code admin builder."
/>
Expand Down
8 changes: 4 additions & 4 deletions docs/src/components/header/HeaderNavDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const PRODUCTS = [
href: ROUTES.productDesignKits,
},
{
name: 'MUI Toolpad',
name: 'Toolpad',
description: 'Low-code admin builder.',
href: ROUTES.productToolpad,
chip: 'Beta',
Expand Down Expand Up @@ -110,9 +110,9 @@ const DOCS = [
href: ROUTES.xIntro,
},
{
name: 'MUI Toolpad',
description: 'Low-code admin builder.',
href: ROUTES.toolpadDocs,
name: 'Toolpad',
description: 'Low-code admin builder',
href: ROUTES.toolpadStudioDocs,
chip: 'Beta',
},
];
Expand Down
2 changes: 1 addition & 1 deletion docs/src/layouts/AppFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default function AppFooter(props: AppFooterProps) {
MUI X
</Link>
<Link prefetch={false} href={ROUTES.productToolpad}>
MUI Toolpad
Toolpad
</Link>
<Link prefetch={false} href={ROUTES.productTemplates}>
Templates
Expand Down
2 changes: 2 additions & 0 deletions docs/src/modules/components/AppSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ const productNameProductId = {
x: 'MUI X',
system: 'MUI System',
toolpad: 'Toolpad',
'toolpad-studio': 'Toolpad Studio',
'toolpad-core': 'Toolpad Core',
};

export function convertProductIdToName(productInfo) {
Expand Down
4 changes: 2 additions & 2 deletions docs/src/modules/components/MuiProductSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export default function MuiProductSelector() {
</Box>
<li role="none">
<Link
href={ROUTES.toolpadDocs}
href={ROUTES.toolpadStudioDocs}
sx={(theme) => ({
p: 2,
pr: 3,
Expand All @@ -204,7 +204,7 @@ export default function MuiProductSelector() {
<ProductSubMenu
role="menuitem"
icon={<IconImage name="product-toolpad" />}
name="MUI Toolpad"
name="Toolpad"
description="Low-code admin builder."
chip={<Chip size="small" label="Beta" color="primary" variant="outlined" />}
/>
Expand Down
15 changes: 11 additions & 4 deletions docs/src/modules/utils/getProductInfoFromUrl.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,17 @@ describe('getProductInfoFromUrl', () => {
});
});

it('should handle MUI Toolpad', () => {
expect(getProductInfoFromUrl('/toolpad/getting-started/first-app/')).to.deep.equal({
productCategoryId: 'null',
productId: 'toolpad',
it('should handle Toolpad Core', () => {
expect(getProductInfoFromUrl('/toolpad/getting-started/')).to.deep.equal({
productCategoryId: 'toolpad',
productId: 'toolpad-core',
});
});

it('should handle Toolpad Studio', () => {
expect(getProductInfoFromUrl('/toolpad/studio/getting-started/first-app/')).to.deep.equal({
productCategoryId: 'toolpad',
productId: 'toolpad-studio',
});
});
});
12 changes: 11 additions & 1 deletion docs/src/modules/utils/getProductInfoFromUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,17 @@ export default function getProductInfoFromUrl(asPath: string): MuiProductInfo {
}
}

if (firstFolder === 'toolpad' || firstFolder === 'docs') {
if (firstFolder === 'toolpad') {
productCategoryId = 'toolpad';
const secondFolder = asPathWithoutLang.replace(/^\/+[^/]+\/([^/]+)\/.*/, '$1');
if (secondFolder === 'studio') {
productId = 'toolpad-studio';
} else {
productId = 'toolpad-core';
}
}
Comment on lines +54 to +62
Copy link
Member

@oliviertassinari oliviertassinari Mar 18, 2024

Choose a reason for hiding this comment

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

@bharatkashyap Can we fix MuiProductId and MuiProductCategoryId? These types are wrong now. Thanks


if (firstFolder === 'docs') {
productId = firstFolder;
}

Expand Down
1 change: 1 addition & 0 deletions docs/src/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const ROUTES = {
treeViewOverview: '/x/react-tree-view/',
// Toolpad pages
toolpadDocs: '/toolpad/getting-started/',
toolpadStudioDocs: '/toolpad/studio/getting-started',
// External pages
rssFeed: '/feed/blog/rss.xml',
handbook: 'https://mui-org.notion.site/Handbook-f086d47e10794d5e839aef9dc67f324b',
Expand Down
2 changes: 1 addition & 1 deletion docs/writing-rules/BrandName.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ swap:
MUI System: MUI System
MUI Store: MUI Store
MUI Core: MUI Core
MUI Toolpad: MUI Toolpad
Toolpad: Toolpad
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
Toolpad: Toolpad
MUI Toolpad: Toolpad
MUI Toolpad: Toolpad

handled in #41516.

MUI Connect: MUI Connect
Stack Overflow: Stack Overflow
# Don't forget to run the following command to generate the package writing-rules.zip file
Expand Down
Loading