Rammohan0504 commited on
Commit
1f66497
·
verified ·
1 Parent(s): 004df50

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -1
app.py CHANGED
@@ -123,6 +123,9 @@ with gr.Blocks() as demo:
123
  <textarea id="custom-description" rows="2" style="width: 100%; padding: 5px; border-radius: 5px; border: 1px solid #ddd;"></textarea>
124
  <button onclick="addItemToCart()" style="margin-top: 20px; padding: 10px 20px; background-color: #28a745; color: white; border: none; border-radius: 5px;">Add to Cart</button>
125
  </div>
 
 
 
126
  <script>
127
  let selectedDish = "";
128
  let selectedExtras = [];
@@ -169,9 +172,18 @@ with gr.Blocks() as demo:
169
  })
170
  }).then(response => response.json()).then(data => {
171
  document.querySelector("#cart-display").innerHTML = data.html;
 
172
  closePopup();
173
  });
174
  }
 
 
 
 
 
 
 
 
175
  </script>
176
  """)
177
 
@@ -182,4 +194,3 @@ with gr.Blocks() as demo:
182
 
183
 
184
  demo.launch()
185
-
 
123
  <textarea id="custom-description" rows="2" style="width: 100%; padding: 5px; border-radius: 5px; border: 1px solid #ddd;"></textarea>
124
  <button onclick="addItemToCart()" style="margin-top: 20px; padding: 10px 20px; background-color: #28a745; color: white; border: none; border-radius: 5px;">Add to Cart</button>
125
  </div>
126
+ <div id="notification" style="display: none; position: fixed; bottom: 20px; right: 20px; background-color: #4caf50; color: white; padding: 15px; border-radius: 5px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); z-index: 1000;">
127
+ Your item has been added to the cart!
128
+ </div>
129
  <script>
130
  let selectedDish = "";
131
  let selectedExtras = [];
 
172
  })
173
  }).then(response => response.json()).then(data => {
174
  document.querySelector("#cart-display").innerHTML = data.html;
175
+ showNotification();
176
  closePopup();
177
  });
178
  }
179
+
180
+ function showNotification() {
181
+ const notification = document.getElementById('notification');
182
+ notification.style.display = 'block';
183
+ setTimeout(() => {
184
+ notification.style.display = 'none';
185
+ }, 3000);
186
+ }
187
  </script>
188
  """)
189
 
 
194
 
195
 
196
  demo.launch()