Skip to content

Commit

Permalink
More fixes and updates
Browse files Browse the repository at this point in the history
  • Loading branch information
apedroferreira committed Jan 22, 2025
1 parent 87bd739 commit f7a894a
Show file tree
Hide file tree
Showing 15 changed files with 208 additions and 188 deletions.
12 changes: 6 additions & 6 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@
"@emotion/server": "11.11.0",
"@emotion/styled": "11.14.0",
"@mui/base": "5.0.0-beta.68",
"@mui/docs": "6.3.1",
"@mui/icons-material": "6.3.1",
"@mui/docs": "6.4.1",
"@mui/icons-material": "6.4.1",
"@mui/internal-markdown": "1.0.24",
"@mui/joy": "5.0.0-beta.51",
"@mui/lab": "6.0.0-beta.22",
"@mui/material": "6.3.1",
"@mui/material": "6.4.1",
"@mui/material-nextjs": "6.3.1",
"@mui/styles": "6.3.1",
"@mui/system": "6.3.1",
"@mui/utils": "6.3.1",
"@mui/styles": "6.4.1",
"@mui/system": "6.4.1",
"@mui/utils": "6.4.1",
"@mui/x-date-pickers": "7.23.6",
"@mui/x-date-pickers-pro": "7.23.6",
"@mui/x-license": "7.23.6",
Expand Down
6 changes: 3 additions & 3 deletions packages/toolpad-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"dependencies": {
"@babel/runtime": "^7.26.0",
"@mui/lab": "6.0.0-beta.22",
"@mui/utils": "6.3.1",
"@mui/utils": "6.4.1",
"@toolpad/utils": "workspace:*",
"@vitejs/plugin-react": "4.3.4",
"client-only": "^0.0.1",
Expand All @@ -65,8 +65,8 @@
"prop-types": "15.8.1"
},
"devDependencies": {
"@mui/icons-material": "6.3.1",
"@mui/material": "6.3.1",
"@mui/icons-material": "6.4.1",
"@mui/material": "6.4.1",
"@mui/x-data-grid": "7.22.2",
"@types/invariant": "2.2.37",
"@types/prop-types": "15.7.14",
Expand Down
18 changes: 12 additions & 6 deletions packages/toolpad-core/src/CRUD/Create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ function Create<D extends DataModel>(props: CreateProps<D>) {
async (previousState, formData) => {
try {
await createOne(
Object.fromEntries(fields.map(({ field }) => [field, formData.get(field)])) as D,
Object.fromEntries(
fields
.filter(({ field }) => field !== 'id')
.map(({ field }) => [field, formData.get(field)]),
) as D,
);
notifications.show('Item created successfully.', {
severity: 'success',
Expand All @@ -46,11 +50,13 @@ function Create<D extends DataModel>(props: CreateProps<D>) {
return (
<Box component="form" action={submitAction} noValidate autoComplete="off">
<Grid container spacing={2} sx={{ mb: 2 }}>
{fields.map(({ field, headerName }) => (
<Grid key={field} size={6}>
<TextField id={field} label={headerName} sx={{ width: '100%' }} />
</Grid>
))}
{fields
.filter(({ field }) => field !== 'id')
.map(({ field, headerName }) => (
<Grid key={field} size={6}>
<TextField id={field} label={headerName} sx={{ width: '100%' }} />
</Grid>
))}
</Grid>
<Button type="submit" variant="contained" loading={isSubmitting}>
Create
Expand Down
4 changes: 2 additions & 2 deletions packages/toolpad-studio-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
"url": "https://github.com/mui/toolpad/issues"
},
"dependencies": {
"@mui/icons-material": "6.3.1",
"@mui/icons-material": "6.4.1",
"@mui/lab": "6.0.0-beta.22",
"@mui/material": "6.3.1",
"@mui/material": "6.4.1",
"@mui/x-charts": "7.23.6",
"@mui/x-data-grid-premium": "7.23.6",
"@mui/x-date-pickers": "7.23.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/toolpad-studio-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
},
"dependencies": {
"@auth/core": "0.37.4",
"@mui/material": "6.3.1",
"@mui/material": "6.4.1",
"@tanstack/react-query": "5.61.3",
"@toolpad/utils": "workspace:*",
"@types/json-schema": "7.0.15",
Expand Down
8 changes: 4 additions & 4 deletions packages/toolpad-studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@
"@emotion/styled": "11.14.0",
"@googleapis/drive": "8.14.0",
"@googleapis/sheets": "9.3.1",
"@mui/icons-material": "6.3.1",
"@mui/icons-material": "6.4.1",
"@mui/lab": "6.0.0-beta.22",
"@mui/material": "6.3.1",
"@mui/system": "6.3.1",
"@mui/material": "6.4.1",
"@mui/system": "6.4.1",
"@mui/types": "7.2.21",
"@mui/utils": "6.3.1",
"@mui/utils": "6.4.1",
"@mui/x-charts": "7.23.6",
"@mui/x-data-grid": "7.23.6",
"@mui/x-data-grid-premium": "7.23.6",
Expand Down
4 changes: 2 additions & 2 deletions playground/nextjs-pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"devDependencies": {
"@emotion/react": "11.14.0",
"@emotion/styled": "11.14.0",
"@mui/icons-material": "6.3.1",
"@mui/material": "6.3.1",
"@mui/icons-material": "6.4.1",
"@mui/material": "6.4.1",
"@mui/material-nextjs": "6.3.1",
"@toolpad/core": "workspace:*",
"@types/react": "^19.0.0",
Expand Down
4 changes: 2 additions & 2 deletions playground/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"devDependencies": {
"@emotion/react": "11.14.0",
"@emotion/styled": "11.14.0",
"@mui/icons-material": "6.3.1",
"@mui/material": "6.3.1",
"@mui/icons-material": "6.4.1",
"@mui/material": "6.4.1",
"@mui/material-nextjs": "6.3.1",
"@toolpad/core": "workspace:*",
"@types/node": "^20.17.12",
Expand Down
4 changes: 2 additions & 2 deletions playground/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"devDependencies": {
"@emotion/react": "11.14.0",
"@emotion/styled": "11.14.0",
"@mui/icons-material": "6.3.1",
"@mui/material": "6.3.1",
"@mui/icons-material": "6.4.1",
"@mui/material": "6.4.1",
"@toolpad/core": "workspace:*",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.3",
Expand Down
5 changes: 0 additions & 5 deletions playground/vite/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ const NAVIGATION: Navigation = [
title: 'Dashboard',
icon: <DashboardIcon />,
},
{
segment: 'orders/new',
title: 'New Order',
icon: <ShoppingCartIcon />,
},
{
segment: 'orders',
title: 'Orders',
Expand Down
13 changes: 11 additions & 2 deletions playground/vite/src/layouts/dashboard.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
import * as React from 'react';
import { Outlet } from 'react-router';
import { Outlet, useLocation, useParams } from 'react-router';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
import { PageContainer } from '@toolpad/core/PageContainer';

export default function Layout() {
const location = useLocation();
const { orderId } = useParams();

const title = orderId && `Order ${orderId}`;
const title = React.useMemo(() => {
if (orderId) {
return `Order ${orderId}`;
}
if (location.pathname === '/orders/new') {
return 'New Order';
}
return undefined;
}, [location.pathname, orderId]);

return (
<DashboardLayout>
Expand Down
2 changes: 1 addition & 1 deletion playground/vite/src/pages/order.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { Show } from '@toolpad/core/CRUD';
import { useNavigate, useParams } from 'react-router-dom';
import { useNavigate, useParams } from 'react-router';
import ordersDataSource, { Order } from '../data/orders';

export default function OrderPage() {
Expand Down
2 changes: 1 addition & 1 deletion playground/vite/src/pages/orders.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { useNavigate } from 'react-router-dom';
import { useNavigate } from 'react-router';
import { List } from '@toolpad/core/CRUD';
import ordersDataSource, { Order } from '../data/orders';

Expand Down
Loading

0 comments on commit f7a894a

Please sign in to comment.