Skip to content

Commit 6a7875b

Browse files
[docs] Improve the docs (#2366)
1 parent dc712d4 commit 6a7875b

File tree

9 files changed

+62
-61
lines changed

9 files changed

+62
-61
lines changed

docs/data/toolpad/landing/useCases.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import * as React from 'react';
22
import Typography from '@mui/material/Typography';
33
import GradientText from 'docs/src/components/typography/GradientText';
4-
import ROUTES from '../../../src/route';
54

65
const useCases = {
76
overline: 'Use cases',
@@ -18,7 +17,7 @@ const useCases = {
1817
description:
1918
'Provide the stakeholders with simple apps to manage their daily operations. You can quickly build an app on Toolpad by calling APIs or writing custom functions. Your app remains secure as the code never leaves your network, and you can securely deploy it to any service you choose.',
2019
action: {
21-
href: ROUTES.toolpadUtilityAppExample,
20+
href: '/toolpad/examples/qr-generator/',
2221
label: 'View example',
2322
},
2423
},
@@ -29,7 +28,7 @@ const useCases = {
2928
description:
3029
'Enable your teams to quickly view and manage customer orders, queries, and refunds by creating admin apps that gather data from third-party APIs providers like Stripe, Twilio, Zendesk, etc. Toolpad allows end users to create, read, update, or delete records.',
3130
action: {
32-
href: ROUTES.toolpadAdminExample,
31+
href: '/toolpad/examples/basic-crud-app/',
3332
label: 'View example',
3433
},
3534
},
@@ -40,7 +39,7 @@ const useCases = {
4039
description:
4140
'Build BI dashboards to slice and dice any metric across various dimensions. Further, use them to monitor KPIs, track business goals, and identify trends and opportunities. Toolpad allows you to combine data from multiple sources and bind it by writing JavaScript anywhere.',
4241
action: {
43-
href: ROUTES.toolpadBIExample,
42+
href: '/toolpad/examples/npm-stats/',
4443
label: 'View example',
4544
},
4645
},

docs/src/components/landing/CodeBlock.js

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import { alpha } from '@mui/material/styles';
99
import HighlightedCode from 'docs/src/modules/components/HighlightedCode';
1010
import MarkdownElement from 'docs/src/components/markdown/MarkdownElement';
1111

12-
export const code = [
13-
`
12+
const code = [
13+
`
1414
import { PrismaClient, Prisma } from '@prisma/client';
1515
1616
const prisma = new PrismaClient();
@@ -32,16 +32,16 @@ export async function deleteUser(id: number) {
3232
}`,
3333

3434
`
35-
import Stripe from "stripe";
36-
import path from "path";
37-
import fs from "fs";
38-
import { exec } from "child_process";
35+
import Stripe from 'stripe';
36+
import path from 'path';
37+
import fs from 'fs';
38+
import { exec } from 'child_process';
3939
40-
const stripe = new Stripe(...)
40+
const stripe = new Stripe(...);
4141
4242
export async function downloadPDF(limit: number = 100) {
4343
let startingAfter;
44-
let listInvoices;
44+
let listInvoices;
4545
do {
4646
listInvoices = await stripe.invoices.list({
4747
starting_after: startingAfter,
@@ -78,35 +78,38 @@ export async function downloadPDF(limit: number = 100) {
7878
`,
7979

8080
`
81-
import mysql from 'mysql2/promise';
81+
import mysql from 'mysql2/promise';
8282
import SSH2Promise from 'ssh2-promise';
8383
import * as fs from 'fs/promises';
8484
8585
export async function getOrders() {
86-
const sql = await fs.readFile('./getOrders.sql',
87-
'utf8');
86+
const sql = await fs.readFile('./getOrders.sql', {
87+
encoding: 'utf8',
88+
});
8889
8990
const connection = await connectionFn(true);
9091
const [, rows] = await connection.query(sql);
91-
connection.end();
92+
await connection.end();
9293
return rows;
9394
}
9495
9596
export async function updateOrder(order_id: number,
96-
contacted_status: string) {
97-
98-
const sql = await fs.readFile('./updateOrder.sql',
99-
'utf8');
100-
97+
contacted_status: string) {
98+
99+
const sql = await fs.readFile('./updateOrder.sql', {
100+
encoding: 'utf8',
101+
});
102+
101103
const connection = await connectionFn(true);
102-
const [, rows] = await connection.execute(sql, { order_id, contacted_status });
103-
connection.end();
104-
return rows;
105-
104+
const [, rows] = await connection.execute(sql, {
105+
order_id,
106+
contacted_status,
107+
});
108+
await connection.end();
109+
return rows;
106110
}
107111
108-
async function connectionFn(multiple = false) {
109-
112+
async function connectionFn(multiple = false) {
110113
const ssh = new SSH2Promise({
111114
host: process.env.BASTION_HOST,
112115
port: 22,
@@ -115,26 +118,25 @@ async function connectionFn(multiple = false) {
115118
});
116119
117120
const tunnel = await ssh.addTunnel({
118-
remoteAddr: process.env.STORE_HOST,
121+
remoteAddr: process.env.MYSQL_HOST,
119122
remotePort: 3306,
120123
});
121124
122125
const connection = await mysql.createConnection({
123126
host: 'localhost',
124127
port: tunnel.localPort,
125-
user: process.env.STORE_USERNAME,
126-
password: process.env.STORE_PASSWORD,
127-
database: process.env.STORE_DATABASE,
128+
user: process.env.MYSQL_USERNAME,
129+
password: process.env.MYSQL_PASSWORD,
130+
database: process.env.MYSQL_DATABASE,
128131
multipleStatements: multiple,
129132
namedPlaceholders: true,
130133
});
131134
132135
return connection;
133-
}
134136
}`,
135137
];
136138

137-
export const filenames = ['users.ts', 'stripeInvoice.tsx', 'orders.ts'];
139+
const filenames = ['users.ts', 'stripeInvoice.tsx', 'orders.ts'];
138140

139141
export default function CodeBlock({ appMode, fileIndex, setFrameIndex }) {
140142
const tabsRef = React.useRef(null);

docs/src/components/landing/GithubStars.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export default function GithubStars() {
5858
display: 'flex',
5959
alignItem: 'center',
6060
ml: 0.5,
61-
color: theme.palette.primary[500],
61+
color: theme.palette.primary[700],
6262
...theme.applyDarkStyles({
6363
color: theme.palette.primary[200],
6464
}),

docs/src/components/landing/Hero.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,12 @@ export default function Hero() {
186186
]}
187187
/>
188188
</Typography>
189-
<Typography variant="h1" sx={{ my: 1, minWidth: { xs: 'auto', sm: 600 } }}>
189+
<Typography variant="h1" sx={{ my: 2, minWidth: { xs: 'auto', sm: 600 } }}>
190190
Turn your <TypingAnimation wordIndex={wordIndex} setWordIndex={setWordIndex} />
191191
<br />
192192
<GradientText>into UIs</GradientText>
193193
</Typography>
194-
<Typography color="text.secondary" sx={{ maxWidth: 520, mb: 2, textWrap: 'balance' }}>
194+
<Typography color="text.secondary" sx={{ maxWidth: 520, mb: 3, textWrap: 'balance' }}>
195195
Build scalable and secure internal tools locally. Drag and drop to build UI, then connect
196196
to data sources with your own code.
197197
</Typography>
@@ -201,7 +201,7 @@ export default function Hero() {
201201
/>
202202
<Box
203203
sx={{
204-
mt: 2,
204+
mt: 4,
205205
display: 'flex',
206206
alignItems: 'center',
207207
justifyContent: { xs: 'space-around', sm: 'start' },

docs/src/components/landing/UseCases.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import Link from '@mui/material/Link';
2+
import Link from 'docs/src/modules/components/Link';
33
import PropTypes from 'prop-types';
44
import { styled, alpha } from '@mui/material/styles';
55
import Box from '@mui/material/Box';
@@ -15,10 +15,11 @@ import GradientText from 'docs/src/components/typography/GradientText';
1515
import Grid from '@mui/material/Unstable_Grid2';
1616
import ROUTES from '../../route';
1717

18-
const ImageContainer = styled(Box)(({ theme }) => [
18+
const ImageContainer = styled(Link)(({ theme }) => [
1919
{
2020
position: 'relative',
2121
width: '100%',
22+
display: 'block',
2223
height: 'auto',
2324
borderRadius: 16,
2425
padding: 8,
@@ -108,7 +109,7 @@ export default function CardGrid() {
108109
/>
109110
<Grid container spacing={5} sx={{ mt: { xs: 1, sm: 4 } }}>
110111
<Grid xs={12} md={6}>
111-
<ImageContainer>
112+
<ImageContainer noLinkStyle href="/toolpad/examples/basic-crud-app/">
112113
<Img
113114
src="/static/toolpad/docs/examples/basic-crud-app.png"
114115
width="2880"
@@ -119,23 +120,23 @@ export default function CardGrid() {
119120
icon={<AdminPanelSettingsRoundedIcon fontSize="small" color="primary" />}
120121
title="Admin panel"
121122
description="Enable your teams to quickly view and manage customer orders, queries, and refunds by creating admin apps that gather data from third-party APIs providers like Stripe, Twilio, Zendesk, etc. Toolpad allows end users to create, read, update, or delete records."
122-
href={ROUTES.toolpadAdminExample}
123+
href="/toolpad/examples/basic-crud-app/"
123124
/>
124125
</Grid>
125126
<Grid xs={12} md={6}>
126-
<ImageContainer>
127+
<ImageContainer noLinkStyle href="/toolpad/examples/npm-stats/">
127128
<Img src="/static/toolpad/docs/examples/npm-stats.png" width="2880" height="1592" />
128129
</ImageContainer>
129130
<ContentCard
130131
icon={<DashboardRoundedIcon fontSize="small" color="primary" />}
131132
title="Analytics dashboard"
132133
description="Build Analytics dashboards to slice and dice any metric across various dimensions. Further, use them to monitor KPIs, track business goals, and identify trends and opportunities. Toolpad allows you to combine data from multiple sources and bind
133134
it by writing JavaScript anywhere."
134-
href={ROUTES.toolpadBIExample}
135+
href="/toolpad/examples/npm-stats/"
135136
/>
136137
</Grid>
137138
<Grid xs={12} md={6}>
138-
<ImageContainer>
139+
<ImageContainer noLinkStyle href="/toolpad/examples/qr-generator/">
139140
<Img
140141
src="/static/toolpad/docs/examples/qr-generator.png"
141142
width="2880"
@@ -148,7 +149,7 @@ export default function CardGrid() {
148149
description="Provide the stakeholders with simple apps to manage their daily operations. You can quickly build an app on Toolpad by calling APIs or writing custom functions.
149150
Your app remains secure as the code never leaves your network, and you can
150151
securely deploy it to any service you choose."
151-
href={ROUTES.toolpadUtilityAppExample}
152+
href="/toolpad/examples/qr-generator/"
152153
/>
153154
</Grid>
154155
<Grid xs={12} md={6}>

docs/src/route.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ const ROUTES = {
33
toolpadQuickstart: '/toolpad/getting-started/first-app/',
44
toolpadDocs: '/toolpad/getting-started/installation/',
55
toolpadUpvote: 'https://github.com/mui/mui-toolpad/labels/waiting%20for%20%F0%9F%91%8D',
6-
toolpadUtilityAppExample: '/toolpad/examples/qr-generator/',
7-
toolpadAdminExample: '/toolpad/examples/admin-app/',
8-
toolpadBIExample: '/toolpad/examples/npm-stats/',
96
toolpadMoreExamples: 'https://github.com/mui/mui-toolpad/tree/master/examples',
107
toolpadBetaBlog: 'https://mui.com/blog/2023-toolpad-beta-announcement/',
118
// https://docs.netlify.com/site-deploys/overview/#deploy-contexts

examples/basic-crud-app/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88

99
## Check out the live app
1010

11-
<p></p>
12-
13-
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/fork/github/mui/mui-toolpad/tree/master/examples/basic-crud-app)
11+
Not available yet. You can open [in dev mode with StackBlitz](https://stackblitz.com/fork/github/mui/mui-toolpad/tree/master/examples/basic-crud-app) in the meantime.
1412

1513
## How to run
1614

@@ -30,6 +28,10 @@ npm install
3028
npm run dev
3129
```
3230

31+
or:
32+
33+
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/fork/github/mui/mui-toolpad/tree/master/examples/basic-crud-app)
34+
3335
## What's inside
3436

3537
This app demonstrates the following capabilities of Toolpad:

examples/npm-stats/README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,7 @@
88

99
## Check out the live app
1010

11-
<p></p>
12-
13-
[![Render Badge]](https://npm-stats.onrender.com/prod/pages/evZC-gp)
14-
15-
[Render Badge]: https://img.shields.io/badge/Render-purple?style=for-the-badge&color=%234350e9&link=https%3A%2F%2Fnpm-stats.onrender.com%2Fprod%2Fpages%2FevZC-gp
16-
17-
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/fork/github/mui/mui-toolpad/tree/master/examples/npm-stats)
11+
https://npm-stats.onrender.com/prod/pages/evZC-gp
1812

1913
## How to run
2014

@@ -34,6 +28,10 @@ npm install
3428
npm run dev
3529
```
3630

31+
or:
32+
33+
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/fork/github/mui/mui-toolpad/tree/master/examples/npm-stats)
34+
3735
## What's inside
3836

3937
This app demonstrates the following capabilities of Toolpad:

examples/qr-generator/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88

99
## Check out the live app
1010

11-
<p></p>
12-
13-
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/fork/github/mui/mui-toolpad/tree/master/examples/qr-generator)
11+
Not available yet. You can open [in dev mode with StackBlitz](https://stackblitz.com/fork/github/mui/mui-toolpad/tree/master/examples/qr-generator) in the meantime.
1412

1513
## How to use
1614

@@ -30,6 +28,10 @@ npm install
3028
npm run dev
3129
```
3230

31+
or:
32+
33+
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/fork/github/mui/mui-toolpad/tree/master/examples/qr-generator)
34+
3335
## What's inside
3436

3537
This app demonstrates the following capabilities of Toolpad:

0 commit comments

Comments
 (0)