diff --git a/src/App.css b/src/App.css index 54c0c8d..94b33cb 100644 --- a/src/App.css +++ b/src/App.css @@ -14,14 +14,14 @@ body { display: grid; grid-template-columns: repeat(6, 1fr); /* 4 zones in the top row */ grid-template-rows: auto auto; /* Two rows */ - gap: 20px; - padding: 20px; + gap: 5px; /* Reduced gap between zones */ + padding: 5px; justify-items: center; } .dropzone { width: 200px; - padding: 20px; + padding: 10px; border: 2px dashed #aaa; background-color: #ffffff; border-radius: 10px; @@ -106,4 +106,72 @@ body { font-style: italic; /* Optional: make the note italic for emphasis */ color: #555; /* Optional: subtle color for the note */ width: 100%; /* Ensure the note spans the full width of the card */ + } + + .popup { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent background */ + display: flex; + justify-content: center; + align-items: center; + z-index: 1000; /* Ensure it appears above other elements */ + } + + .popup-content { + background-color: #ffffff; + padding: 20px; + border-radius: 10px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); + width: 300px; + max-width: 90%; + text-align: center; + } + + .popup-content h3 { + margin-bottom: 20px; + color: #333; + } + + .popup-content label { + display: block; + margin-bottom: 10px; + text-align: left; + font-weight: bold; + color: #555; + } + + .popup-content input { + width: 100%; + padding: 8px; + margin-bottom: 15px; + border: 1px solid #ccc; + border-radius: 5px; + box-sizing: border-box; + } + + .popup-content button { + padding: 10px 20px; + margin: 5px; + border: none; + border-radius: 5px; + cursor: pointer; + font-size: 1em; + } + + .popup-content button:first-of-type { + background-color: #4caf50; /* Green for Add */ + color: white; + } + + .popup-content button:last-of-type { + background-color: #f44336; /* Red for Cancel */ + color: white; + } + + .popup-content button:hover { + opacity: 0.9; } \ No newline at end of file diff --git a/src/App.js b/src/App.js index f80257a..dfead02 100644 --- a/src/App.js +++ b/src/App.js @@ -1,4 +1,4 @@ -import React, { useState } from "react"; +import React, { useState, useEffect, useRef } from "react"; import "./App.css"; const App = () => { @@ -14,8 +14,26 @@ const App = () => { circuit: [], inbound: [], ppr: [], + aog: [], }); + const [showPopup, setShowPopup] = useState(false); + const [newCard, setNewCard] = useState({ + registration: "", + type: "", + pob: "", + note: "", + }); + const [editCard, setEditCard] = useState(null); + + const registrationInputRef = useRef(null); + + useEffect(() => { + if (showPopup) { + registrationInputRef.current?.focus(); + } + }, [showPopup]); + const handleDragStart = (e, card, sourceZone) => { e.dataTransfer.setData("card", JSON.stringify(card)); e.dataTransfer.setData("sourceZone", sourceZone); @@ -63,6 +81,7 @@ const App = () => { className="card" draggable onDragStart={(e) => handleDragStart(e, card, sourceZone)} + onClick={() => handleCardClick(card, sourceZone)} >