añadido soporte para descripcion de coordenadas
This commit is contained in:
@@ -6,6 +6,7 @@ export default function EditarModal({ tipo, coord, show, close, setCoords }) {
|
||||
const x = formData.get("x");
|
||||
const y = formData.get("y");
|
||||
const z = formData.get("z");
|
||||
const descripcion = formData.get("descripcion");
|
||||
|
||||
let storedTipo = localStorage.getItem(tipo);
|
||||
if (storedTipo) {
|
||||
@@ -17,6 +18,7 @@ export default function EditarModal({ tipo, coord, show, close, setCoords }) {
|
||||
x: Number(x),
|
||||
y: y ? Number(y) : null,
|
||||
z: Number(z),
|
||||
descripcion: descripcion,
|
||||
};
|
||||
localStorage.setItem(tipo, JSON.stringify(arr));
|
||||
setCoords(arr);
|
||||
@@ -77,6 +79,15 @@ export default function EditarModal({ tipo, coord, show, close, setCoords }) {
|
||||
defaultValue={coord.z}
|
||||
/>
|
||||
</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 />
|
||||
<button type="submit" className="btn btn-primary m-2">
|
||||
Actualizar
|
||||
|
||||
@@ -5,6 +5,7 @@ export default function NuevaCoord({ coord, setcoord, colapsar, tipo }) {
|
||||
const [x, setX] = useState("");
|
||||
const [y, setY] = useState("");
|
||||
const [z, setZ] = useState("");
|
||||
const [descripcion, setDescripcion] = useState("");
|
||||
|
||||
const handleAdd = () => {
|
||||
const newCoord = {
|
||||
@@ -12,6 +13,7 @@ export default function NuevaCoord({ coord, setcoord, colapsar, tipo }) {
|
||||
x: x,
|
||||
y: llevaY ? y : null,
|
||||
z: z,
|
||||
descripcion: descripcion,
|
||||
};
|
||||
|
||||
setcoord([...coord, newCoord]);
|
||||
@@ -61,6 +63,14 @@ export default function NuevaCoord({ coord, setcoord, colapsar, tipo }) {
|
||||
/>
|
||||
</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 />
|
||||
<button className="btn btn-primary" onClick={handleAdd}>
|
||||
Añadir
|
||||
|
||||
@@ -51,7 +51,7 @@ export default function Keeper({ tipo }) {
|
||||
|
||||
const Compartir = (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);
|
||||
setShowToast(true);
|
||||
};
|
||||
@@ -91,7 +91,7 @@ export default function Keeper({ tipo }) {
|
||||
durationMs={5000}
|
||||
setShow={setShowToast}
|
||||
show={showToast}
|
||||
message={`Copiada Coordenada ${selCoord?.num}`}
|
||||
message={`Copiada Coordenada [${selCoord?.descripcion}]`}
|
||||
/>
|
||||
|
||||
<div className="accordion" id="accordionNuevaCoord">
|
||||
@@ -142,6 +142,7 @@ export default function Keeper({ tipo }) {
|
||||
<th>X:</th>
|
||||
<th>Y:</th>
|
||||
<th>Z:</th>
|
||||
<th>Descripcion</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -156,6 +157,7 @@ export default function Keeper({ tipo }) {
|
||||
<td>{x.x}</td>
|
||||
<td>{x.y !== null && `Y: ${x.y}`}</td>
|
||||
<td>{x.z}</td>
|
||||
<td>{x.descripcion}</td>
|
||||
<td>
|
||||
<button
|
||||
class="ms-2 btn btn-outline-warning btn-sm"
|
||||
|
||||
Reference in New Issue
Block a user