From 876a60939bec446fa0d21476d88599629fb0c3b8 Mon Sep 17 00:00:00 2001 From: jlsuh Date: Fri, 20 Sep 2024 21:10:43 -0300 Subject: [PATCH] fix: upgrade to mui v6 --- src/AppRouter.tsx | 6 +++--- src/components/ModeSelect.tsx | 2 +- src/components/NavBar.tsx | 7 ++++--- src/components/StatusMarker.tsx | 13 ++++++++----- src/components/Subject.tsx | 25 ++++++++++++++----------- src/components/SubjectGrid.tsx | 3 +-- src/components/SubjectStack.tsx | 14 ++++++++------ src/context/PlanContext.ts | 2 +- src/layout/PlanLayout.tsx | 2 +- src/views/PlanView.tsx | 19 ++++++++----------- 10 files changed, 49 insertions(+), 44 deletions(-) diff --git a/src/AppRouter.tsx b/src/AppRouter.tsx index adc5a14..8ac15c3 100644 --- a/src/AppRouter.tsx +++ b/src/AppRouter.tsx @@ -12,10 +12,10 @@ function AppRouter() { return ( {plans.map((plan) => ( - } /> + } key={plan.id} path={`/${plan.id}`} /> ))} - } /> - } /> + } path="/" /> + } path="*" /> ); } diff --git a/src/components/ModeSelect.tsx b/src/components/ModeSelect.tsx index c42ba3b..978219d 100644 --- a/src/components/ModeSelect.tsx +++ b/src/components/ModeSelect.tsx @@ -16,7 +16,7 @@ function ModeSelect({ subject }: { subject: SubjectProps }) { return ( - + Modalidad ; + renderDivider: boolean; + status: Status; }) { const { updateStatuses } = useContext(PlanContext); @@ -20,20 +23,20 @@ function StatusMarker({ return ( {status.name} - + {renderDivider ? : null} ); } diff --git a/src/components/Subject.tsx b/src/components/Subject.tsx index a27113f..ba7baa2 100644 --- a/src/components/Subject.tsx +++ b/src/components/Subject.tsx @@ -2,13 +2,8 @@ import { ModeSelect, StatusRadioGroup } from '@/components'; import { PlanContext } from '@/context'; import type { PlanContextProps, SubjectProps } from '@/types'; import CircleIcon from '@mui/icons-material/Circle'; -import { - Card, - CardActions, - CardContent, - Grid, - Typography, -} from '@mui/material'; +import { Card, CardActions, CardContent, Typography } from '@mui/material'; +import Grid from '@mui/material/Grid2'; import { useContext } from 'react'; function Subject({ subject }: { subject: SubjectProps }) { @@ -18,9 +13,16 @@ function Subject({ subject }: { subject: SubjectProps }) { const color = contextSubject.status.color; return ( - + @@ -42,9 +45,9 @@ function Subject({ subject }: { subject: SubjectProps }) { diff --git a/src/components/SubjectGrid.tsx b/src/components/SubjectGrid.tsx index 57058a9..44a7015 100644 --- a/src/components/SubjectGrid.tsx +++ b/src/components/SubjectGrid.tsx @@ -1,6 +1,6 @@ import { Subject } from '@/components'; import type { SubjectProps } from '@/types'; -import { Grid } from '@mui/material'; +import Grid from '@mui/material/Grid2'; function SubjectGrid({ levelSubjects, @@ -10,7 +10,6 @@ function SubjectGrid({ return ( (PlanContext); const plan = findPlanById(contextPlan.id); const subjectsByLevel = plan.subjects; + const statusesMaxIndex = Object.values(statuses).length - 1; return ( @@ -20,10 +22,10 @@ function SubjectStack() { key={`level-${index + 1}-grid`} sx={{ flexDirection: 'column', + flexWrap: 'nowrap', }} > - + {index + 1}° año Marcar a todas como: - {Object.values(statuses).map((status) => ( + {Object.values(statuses).map((status, index) => ( ))} diff --git a/src/context/PlanContext.ts b/src/context/PlanContext.ts index 63a45cd..7a80ea1 100644 --- a/src/context/PlanContext.ts +++ b/src/context/PlanContext.ts @@ -3,8 +3,8 @@ import { createContext } from 'react'; const PlanContext = createContext({ contextPlan: { - id: '', branch: '', + id: '', subjects: {}, }, updateMode: () => {}, diff --git a/src/layout/PlanLayout.tsx b/src/layout/PlanLayout.tsx index b9a53bf..f216ce1 100644 --- a/src/layout/PlanLayout.tsx +++ b/src/layout/PlanLayout.tsx @@ -7,7 +7,7 @@ function PlanLayout({ children }: { children: ReactNode }) { <> - + {children} diff --git a/src/views/PlanView.tsx b/src/views/PlanView.tsx index 510c621..36b2a19 100644 --- a/src/views/PlanView.tsx +++ b/src/views/PlanView.tsx @@ -1,25 +1,22 @@ import { ExportSVGButton, ShowDigraphButton, SubjectStack } from '@/components'; -import { Box, Grid } from '@mui/material'; +import { Box } from '@mui/material'; +import Grid from '@mui/material/Grid2'; function PlanView() { return ( - + - - + + - +