From 5fad9ff5d98a02a8bb2380164a29cf682edfeda6 Mon Sep 17 00:00:00 2001 From: Maxime Same-kotto Date: Thu, 7 Sep 2023 14:05:52 +0200 Subject: [PATCH] FIX: markers admin part --- src/component/AdminMarkerModal.js | 11 ++++++++++- src/component/AdminMarkerTable.js | 4 ++-- src/component/MarkerModal.js | 6 ++++++ src/view/Admin.js | 8 +++++++- 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/component/AdminMarkerModal.js b/src/component/AdminMarkerModal.js index c3c07d9..e3bc012 100644 --- a/src/component/AdminMarkerModal.js +++ b/src/component/AdminMarkerModal.js @@ -1,5 +1,5 @@ import * as React from "react"; -import { Button, Container, TextField, Typography, IconButton} from "@mui/material"; +import { Button, Container, TextField, Typography, IconButton, Input} from "@mui/material"; import "../styles/component/MarkerModal.css" import CloseIcon from '@mui/icons-material/Close'; import { useState } from "react"; @@ -78,6 +78,15 @@ export const AdminMarkerModal = ({closeModal, onSubmit, defaultValue}) => {

+ +
+ +
+ Model 3D + +
+ Texture + {errors &&
{`Please include: ${errors}`}
} diff --git a/src/component/AdminMarkerTable.js b/src/component/AdminMarkerTable.js index 85023d3..50828f7 100644 --- a/src/component/AdminMarkerTable.js +++ b/src/component/AdminMarkerTable.js @@ -18,7 +18,7 @@ export const AdminMarkerTable = ({ rows, editMarker, deleteMarker }) => { const [rowToEdit, setRowToEdit] = React.useState(null); const deleteRow = (targetId) => { - deleteMarker(markerStates.markers[targetId]); + deleteMarker(rows[targetId]); }; const editRow = (id) => { @@ -28,7 +28,7 @@ export const AdminMarkerTable = ({ rows, editMarker, deleteMarker }) => { }; const submitForm = (newRow) => { - markerStates.markers.map((marker, id) => { + rows.map((marker, id) => { if (id === rowToEdit) { editMarker(newRow); } diff --git a/src/component/MarkerModal.js b/src/component/MarkerModal.js index 88c5f65..60a363e 100644 --- a/src/component/MarkerModal.js +++ b/src/component/MarkerModal.js @@ -78,6 +78,12 @@ export const MarkerModal = ({closeModal, onSubmit, defaultValue}) => {

+ +
+ +
+ +
{errors &&
{`Please include: ${errors}`}
} diff --git a/src/view/Admin.js b/src/view/Admin.js index d3d1288..5ca755b 100644 --- a/src/view/Admin.js +++ b/src/view/Admin.js @@ -23,6 +23,7 @@ export default function Admin() { { isFocus: false, component: "OrganisationsTable", name: "Organisations" }, { isFocus: false, component: "ContactTable", name: "Contact" }, { isFocus: false, component: "NewsletterTable", name: "Newsletter" }, + {isFocus: false, component: "MarkersTable", name: "Markers"}, ]); const [table, setTable] = useState(<>); const token = localStorage.getItem("token"); @@ -227,7 +228,6 @@ export default function Admin() { /> ); else if (name === "MarkersTable") { - console.log(markers); return ( Organisations + {table}