updating alerts ui/ux

This commit is contained in:
Mann Patel
2025-04-21 01:19:39 -06:00
parent 53686bd71d
commit 505f6cd134
4 changed files with 12 additions and 8 deletions

View File

@@ -7,6 +7,8 @@ const {
getAllTransactions,
updatePaymentStatus,
deleteTransaction,
getTransactionWithPagination,
removeTransation,
} = require("../controllers/transaction");
const router = express.Router();

View File

@@ -4,7 +4,6 @@ const pool = mysql.createPool({
host: "localhost",
user: "root",
database: "Marketplace",
password: "12345678"
});
// const pool = mysql.createPool(

View File

@@ -30,6 +30,8 @@ const ProductDetail = () => {
const [reviews, setReviews] = useState([]);
const [showReviewForm, setShowReviewForm] = useState(false);
const [showAlert, setShowAlert] = useState(false);
const [showAlert1, setShowAlert1] = useState(false);
const storedUser = JSON.parse(sessionStorage.getItem("user"));
const toggleFavorite = async (id) => {
@@ -303,6 +305,12 @@ const ProductDetail = () => {
onClose={() => setShowAlert(false)}
/>
)}
{showAlert1 && (
<FloatingAlert
message="Product added to transaction!"
onClose={() => setShowAlert1(false)}
/>
)}
<div className="flex flex-col md:flex-row gap-8">
<div className="md:w-3/5">
@@ -438,13 +446,8 @@ const ProductDetail = () => {
const result = await response.json();
if (result.success) {
alert("Transaction created successfully!");
} else {
throw new Error(
result.message || "Failed to create transaction",
);
setShowAlert1(true);
}
// Toggle contact options visibility
setShowContactOptions(!showContactOptions);
} catch (error) {

View File

@@ -79,7 +79,7 @@ CREATE TABLE Review (
-- Transaction Entity (Many-to-One with User, Many-to-One with Product)
CREATE TABLE Transaction (
TransactionID INT PRIMARY KEY,
TransactionID INT AUTO_INCREMENT PRIMARY KEY,
UserID INT,
ProductID INT,
Date DATETIME DEFAULT CURRENT_TIMESTAMP,