diff --git a/frontend/.eslintrc.json b/frontend/.eslintrc.json new file mode 100644 index 00000000..bffb357a --- /dev/null +++ b/frontend/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "next/core-web-vitals" +} diff --git a/frontend/app/(hub)/properties/attributes/page.tsx b/frontend/app/(hub)/properties/attributes/page.tsx index 3944f616..720d5756 100644 --- a/frontend/app/(hub)/properties/attributes/page.tsx +++ b/frontend/app/(hub)/properties/attributes/page.tsx @@ -202,6 +202,7 @@ export default function Page() { color: 'primary.main', }} onClick={handleSaveClick(id)} + key={id + "save"} />, } @@ -209,6 +210,7 @@ export default function Page() { className="textPrimary" onClick={handleCancelClick(id)} color="inherit" + key={id + "cancel"} />, ]; } @@ -220,12 +222,14 @@ export default function Page() { className="textPrimary" onClick={handleEditClick(id)} color="inherit" - />, + key={id + "edit"} + />, } label="Delete" onClick={handleDeleteClick(id)} color="inherit" + key={id + "delete"} />, ]; }, diff --git a/frontend/app/(hub)/properties/census/page.tsx b/frontend/app/(hub)/properties/census/page.tsx index 4525a5ca..6b30fcb8 100644 --- a/frontend/app/(hub)/properties/census/page.tsx +++ b/frontend/app/(hub)/properties/census/page.tsx @@ -267,6 +267,7 @@ export default function Page() { color: 'primary.main', }} onClick={handleSaveClick(id)} + key={id + "save"} />, } @@ -274,6 +275,7 @@ export default function Page() { className="textPrimary" onClick={handleCancelClick(id)} color="inherit" + key={id + "cancel"} />, ]; } @@ -285,12 +287,14 @@ export default function Page() { className="textPrimary" onClick={handleEditClick(id)} color="inherit" + key={id + "edit"} />, } label="Delete" onClick={handleDeleteClick(id)} color="inherit" + key={id + "delete"} />, ]; }, diff --git a/frontend/app/(hub)/properties/personnel/page.tsx b/frontend/app/(hub)/properties/personnel/page.tsx index 3002a7b1..a08ab2f7 100644 --- a/frontend/app/(hub)/properties/personnel/page.tsx +++ b/frontend/app/(hub)/properties/personnel/page.tsx @@ -212,6 +212,7 @@ export default function Page() { color: 'primary.main', }} onClick={handleSaveClick(id)} + key={id + "save"} />, } @@ -219,6 +220,7 @@ export default function Page() { className="textPrimary" onClick={handleCancelClick(id)} color="inherit" + key={id + "cancel"} />, ]; } @@ -230,12 +232,14 @@ export default function Page() { className="textPrimary" onClick={handleEditClick(id)} color="inherit" + key={id + "edit"} />, } label="Delete" onClick={handleDeleteClick(id)} color="inherit" + key={id + "delete"} />, ]; }, diff --git a/frontend/app/(hub)/properties/quadrats/page.tsx b/frontend/app/(hub)/properties/quadrats/page.tsx index 142635ec..5817fbe5 100644 --- a/frontend/app/(hub)/properties/quadrats/page.tsx +++ b/frontend/app/(hub)/properties/quadrats/page.tsx @@ -279,6 +279,7 @@ export default function Page() { color: 'primary.main', }} onClick={handleSaveClick(id)} + key={id + "save"} />, } @@ -286,6 +287,7 @@ export default function Page() { className="textPrimary" onClick={handleCancelClick(id)} color="inherit" + key={id + "cancel"} />, ]; } @@ -297,12 +299,14 @@ export default function Page() { className="textPrimary" onClick={handleEditClick(id)} color="inherit" + key={id + "edit"} />, } label="Delete" onClick={handleDeleteClick(id)} color="inherit" + key={id + "delete"} />, ]; }, diff --git a/frontend/app/(hub)/properties/species/page.tsx b/frontend/app/(hub)/properties/species/page.tsx index 50e65e94..b323cabd 100644 --- a/frontend/app/(hub)/properties/species/page.tsx +++ b/frontend/app/(hub)/properties/species/page.tsx @@ -260,6 +260,7 @@ export default function Page() { color: 'primary.main', }} onClick={handleSaveClick(id)} + key={id + "save"} />, } @@ -267,6 +268,7 @@ export default function Page() { className="textPrimary" onClick={handleCancelClick(id)} color="inherit" + key={id + "cancel"} />, ]; } @@ -278,12 +280,14 @@ export default function Page() { className="textPrimary" onClick={handleEditClick(id)} color="inherit" + key={id + "edit"} />, } label="Delete" onClick={handleDeleteClick(id)} color="inherit" + key={id + "delete"} />, ]; }, diff --git a/frontend/app/contexts/userselectioncontext.tsx b/frontend/app/contexts/userselectioncontext.tsx index 6efc5f4b..de663dc7 100644 --- a/frontend/app/contexts/userselectioncontext.tsx +++ b/frontend/app/contexts/userselectioncontext.tsx @@ -11,6 +11,10 @@ export const CensusDispatchContext = createContext | null>(null); export default function PlotProvider({children}: { children: React.ReactNode }) { + const plotListContext = usePlotListContext(); + const censusListContext = useCensusListContext(); + const quadratListContext = useQuadratListContext(); + const [plot, plotDispatch] = useReducer( plotsReducer, null @@ -43,7 +47,6 @@ export default function PlotProvider({children}: { children: React.ReactNode }) } function plotsReducer(currentPlot: any, action: { plotKey: string | null }) { - let plotListContext = usePlotListContext(); if (plotListContext) { if (action.plotKey == null) return null; else if (plotListContext.find((p) => p.key == action.plotKey)) return plotListContext.find((p) => p.key == action.plotKey); @@ -56,7 +59,6 @@ function plotsReducer(currentPlot: any, action: { plotKey: string | null }) { } function censusReducer(currentCensus: any, action: { census: number | null }) { - let censusListContext = useCensusListContext(); if (censusListContext) { if (action.census == null) return null; else if (censusListContext.includes(action.census)) return action.census; @@ -69,7 +71,6 @@ function censusReducer(currentCensus: any, action: { census: number | null }) { } function quadratReducer(currentQuadrat: any, action: { quadrat: number | null }) { - let quadratListContext = useQuadratListContext(); if (quadratListContext) { if (action.quadrat == null) return null; else if (quadratListContext.includes(action.quadrat)) return action.quadrat; diff --git a/frontend/components/sidebar.tsx b/frontend/components/sidebar.tsx index 1b6f2ffa..8d08f7be 100755 --- a/frontend/components/sidebar.tsx +++ b/frontend/components/sidebar.tsx @@ -341,7 +341,7 @@ export default function Sidebar() { > {plotListContext.map((keyItem) => ( - + ))}