añadido soporte para descripcion de coordenadas

This commit is contained in:
2025-03-17 23:58:07 -03:00
parent 0ab8cf026e
commit 0c784b3855
3 changed files with 25 additions and 2 deletions

View File

@@ -6,6 +6,7 @@ export default function EditarModal({ tipo, coord, show, close, setCoords }) {
const x = formData.get("x"); const x = formData.get("x");
const y = formData.get("y"); const y = formData.get("y");
const z = formData.get("z"); const z = formData.get("z");
const descripcion = formData.get("descripcion");
let storedTipo = localStorage.getItem(tipo); let storedTipo = localStorage.getItem(tipo);
if (storedTipo) { if (storedTipo) {
@@ -17,6 +18,7 @@ export default function EditarModal({ tipo, coord, show, close, setCoords }) {
x: Number(x), x: Number(x),
y: y ? Number(y) : null, y: y ? Number(y) : null,
z: Number(z), z: Number(z),
descripcion: descripcion,
}; };
localStorage.setItem(tipo, JSON.stringify(arr)); localStorage.setItem(tipo, JSON.stringify(arr));
setCoords(arr); setCoords(arr);
@@ -77,6 +79,15 @@ export default function EditarModal({ tipo, coord, show, close, setCoords }) {
defaultValue={coord.z} defaultValue={coord.z}
/> />
</div> </div>
<div className="mb-3">
<label className="form-label">Descripción</label>
<input
type="text"
name="descripcion"
className="form-control"
defaultValue={coord.descripcion}
/>
</div>
<hr /> <hr />
<button type="submit" className="btn btn-primary m-2"> <button type="submit" className="btn btn-primary m-2">
Actualizar Actualizar

View File

@@ -5,6 +5,7 @@ export default function NuevaCoord({ coord, setcoord, colapsar, tipo }) {
const [x, setX] = useState(""); const [x, setX] = useState("");
const [y, setY] = useState(""); const [y, setY] = useState("");
const [z, setZ] = useState(""); const [z, setZ] = useState("");
const [descripcion, setDescripcion] = useState("");
const handleAdd = () => { const handleAdd = () => {
const newCoord = { const newCoord = {
@@ -12,6 +13,7 @@ export default function NuevaCoord({ coord, setcoord, colapsar, tipo }) {
x: x, x: x,
y: llevaY ? y : null, y: llevaY ? y : null,
z: z, z: z,
descripcion: descripcion,
}; };
setcoord([...coord, newCoord]); setcoord([...coord, newCoord]);
@@ -61,6 +63,14 @@ export default function NuevaCoord({ coord, setcoord, colapsar, tipo }) {
/> />
</div> </div>
</div> </div>
<div className="input-group mb-3">
<span class="input-group-text">Descripción:</span>
<input
type="text"
className="form-control"
onChange={(e) => setDescripcion(e.target.value)}
/>
</div>
<hr /> <hr />
<button className="btn btn-primary" onClick={handleAdd}> <button className="btn btn-primary" onClick={handleAdd}>
Añadir Añadir

View File

@@ -51,7 +51,7 @@ export default function Keeper({ tipo }) {
const Compartir = (coord) => { const Compartir = (coord) => {
setCoord(coord); setCoord(coord);
const textToCopy = `X: ${coord.x}${coord.y ? ` Y: ${coord.y}` : ""} Z: ${coord.z}`; const textToCopy = `- ${coord.descripcion}, X: ${coord.x}${coord.y ? ` Y: ${coord.y}` : ""} Z: ${coord.z}`;
navigator.clipboard.writeText(textToCopy); navigator.clipboard.writeText(textToCopy);
setShowToast(true); setShowToast(true);
}; };
@@ -91,7 +91,7 @@ export default function Keeper({ tipo }) {
durationMs={5000} durationMs={5000}
setShow={setShowToast} setShow={setShowToast}
show={showToast} show={showToast}
message={`Copiada Coordenada ${selCoord?.num}`} message={`Copiada Coordenada [${selCoord?.descripcion}]`}
/> />
<div className="accordion" id="accordionNuevaCoord"> <div className="accordion" id="accordionNuevaCoord">
@@ -142,6 +142,7 @@ export default function Keeper({ tipo }) {
<th>X:</th> <th>X:</th>
<th>Y:</th> <th>Y:</th>
<th>Z:</th> <th>Z:</th>
<th>Descripcion</th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
@@ -156,6 +157,7 @@ export default function Keeper({ tipo }) {
<td>{x.x}</td> <td>{x.x}</td>
<td>{x.y !== null && `Y: ${x.y}`}</td> <td>{x.y !== null && `Y: ${x.y}`}</td>
<td>{x.z}</td> <td>{x.z}</td>
<td>{x.descripcion}</td>
<td> <td>
<button <button
class="ms-2 btn btn-outline-warning btn-sm" class="ms-2 btn btn-outline-warning btn-sm"