fix(mui): Migrate from Grid to Grid2 API (MUI v7)

Issue: MUI v7 deprecated the old Grid API with 'item', 'xs', 'sm', 'md' props.
Warnings: 'The item prop has been removed', 'The xs/sm/md props have been removed'

Solution: Migrate to Grid2 component with new 'size' prop:
- Changed Grid import to Grid2 (aliased as Grid)
- Removed 'item' prop from all Grid components
- Changed xs={6} sm={4} md={2} to size={{ xs: 6, sm: 4, md: 2 }}

Reference: https://mui.com/material-ui/migration/upgrade-to-grid-v2/

All Grid warnings now resolved.
This commit is contained in:
2025-10-02 16:09:00 +00:00
parent 1044f228f2
commit eb609e1260

View File

@@ -1,7 +1,7 @@
'use client';
import { useState, useEffect } from 'react';
import { Box, Typography, Button, Paper, Grid, CircularProgress } from '@mui/material';
import { Box, Typography, Button, Paper, Grid2 as Grid, CircularProgress } from '@mui/material';
import { AppShell } from '@/components/layouts/AppShell/AppShell';
import { ProtectedRoute } from '@/components/common/ProtectedRoute';
import { EmailVerificationBanner } from '@/components/common/EmailVerificationBanner';
@@ -126,7 +126,7 @@ export default function HomePage() {
</Typography>
<Grid container spacing={2} sx={{ mb: 4 }}>
{quickActions.map((action, index) => (
<Grid item xs={6} sm={4} md={2} key={action.label}>
<Grid size={{ xs: 6, sm: 4, md: 2 }} key={action.label}>
<motion.div
initial={{ opacity: 0, scale: 0.9 }}
animate={{ opacity: 1, scale: 1 }}
@@ -184,7 +184,7 @@ export default function HomePage() {
</Box>
) : (
<Grid container spacing={3}>
<Grid item xs={6} sm={3}>
<Grid size={{ xs: 6, sm: 3 }}>
<Box
textAlign="center"
sx={{
@@ -204,7 +204,7 @@ export default function HomePage() {
</Typography>
</Box>
</Grid>
<Grid item xs={6} sm={3}>
<Grid size={{ xs: 6, sm: 3 }}>
<Box
textAlign="center"
sx={{
@@ -226,7 +226,7 @@ export default function HomePage() {
</Typography>
</Box>
</Grid>
<Grid item xs={6} sm={3}>
<Grid size={{ xs: 6, sm: 3 }}>
<Box
textAlign="center"
sx={{
@@ -246,7 +246,7 @@ export default function HomePage() {
</Typography>
</Box>
</Grid>
<Grid item xs={6} sm={3}>
<Grid size={{ xs: 6, sm: 3 }}>
<Box
textAlign="center"
sx={{