Spaces:
Sleeping
Sleeping
Update templates/menu_page.html
Browse files- templates/menu_page.html +52 -33
templates/menu_page.html
CHANGED
|
@@ -24,7 +24,6 @@
|
|
| 24 |
margin-top: 50px;
|
| 25 |
}
|
| 26 |
|
| 27 |
-
/* Heading Style */
|
| 28 |
h1 {
|
| 29 |
text-align: center;
|
| 30 |
font-size: 2.5rem;
|
|
@@ -32,7 +31,6 @@
|
|
| 32 |
margin-bottom: 30px;
|
| 33 |
}
|
| 34 |
|
| 35 |
-
/* Menu Item Styles */
|
| 36 |
.menu-item {
|
| 37 |
border-bottom: 1px solid #eee;
|
| 38 |
padding: 15px 0;
|
|
@@ -41,31 +39,6 @@
|
|
| 41 |
align-items: center;
|
| 42 |
}
|
| 43 |
|
| 44 |
-
.menu-item:last-child {
|
| 45 |
-
border-bottom: none;
|
| 46 |
-
}
|
| 47 |
-
|
| 48 |
-
.menu-item .details {
|
| 49 |
-
flex-grow: 1;
|
| 50 |
-
}
|
| 51 |
-
|
| 52 |
-
.menu-item .details h3 {
|
| 53 |
-
margin: 0;
|
| 54 |
-
font-size: 1.6rem;
|
| 55 |
-
color: #333;
|
| 56 |
-
}
|
| 57 |
-
|
| 58 |
-
.menu-item .details p {
|
| 59 |
-
margin: 5px 0;
|
| 60 |
-
color: #666;
|
| 61 |
-
}
|
| 62 |
-
|
| 63 |
-
.menu-item .details .price {
|
| 64 |
-
font-weight: bold;
|
| 65 |
-
color: #e91e63;
|
| 66 |
-
}
|
| 67 |
-
|
| 68 |
-
/* Order Button Style */
|
| 69 |
.order-btn {
|
| 70 |
padding: 10px 20px;
|
| 71 |
background-color: #4CAF50;
|
|
@@ -73,17 +46,26 @@
|
|
| 73 |
border: none;
|
| 74 |
border-radius: 5px;
|
| 75 |
cursor: pointer;
|
| 76 |
-
font-size: 1rem;
|
| 77 |
-
transition: background-color 0.3s ease;
|
| 78 |
}
|
| 79 |
|
| 80 |
.order-btn:hover {
|
| 81 |
background-color: #45a049;
|
| 82 |
}
|
| 83 |
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
}
|
| 88 |
</style>
|
| 89 |
</head>
|
|
@@ -91,7 +73,7 @@
|
|
| 91 |
|
| 92 |
<div class="menu-container">
|
| 93 |
<h1>Welcome to the Menu</h1>
|
| 94 |
-
|
| 95 |
{% for item in menu_items %}
|
| 96 |
<div class="menu-item">
|
| 97 |
<div class="details">
|
|
@@ -103,7 +85,44 @@
|
|
| 103 |
<button class="order-btn">Order</button>
|
| 104 |
</div>
|
| 105 |
{% endfor %}
|
|
|
|
|
|
|
|
|
|
| 106 |
</div>
|
| 107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
</body>
|
| 109 |
</html>
|
|
|
|
| 24 |
margin-top: 50px;
|
| 25 |
}
|
| 26 |
|
|
|
|
| 27 |
h1 {
|
| 28 |
text-align: center;
|
| 29 |
font-size: 2.5rem;
|
|
|
|
| 31 |
margin-bottom: 30px;
|
| 32 |
}
|
| 33 |
|
|
|
|
| 34 |
.menu-item {
|
| 35 |
border-bottom: 1px solid #eee;
|
| 36 |
padding: 15px 0;
|
|
|
|
| 39 |
align-items: center;
|
| 40 |
}
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
.order-btn {
|
| 43 |
padding: 10px 20px;
|
| 44 |
background-color: #4CAF50;
|
|
|
|
| 46 |
border: none;
|
| 47 |
border-radius: 5px;
|
| 48 |
cursor: pointer;
|
|
|
|
|
|
|
| 49 |
}
|
| 50 |
|
| 51 |
.order-btn:hover {
|
| 52 |
background-color: #45a049;
|
| 53 |
}
|
| 54 |
|
| 55 |
+
#listen-btn {
|
| 56 |
+
padding: 10px 20px;
|
| 57 |
+
background-color: #4CAF50;
|
| 58 |
+
color: white;
|
| 59 |
+
border: none;
|
| 60 |
+
border-radius: 5px;
|
| 61 |
+
cursor: pointer;
|
| 62 |
+
font-size: 1.2rem;
|
| 63 |
+
display: block;
|
| 64 |
+
margin: 30px auto;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
#listen-btn:hover {
|
| 68 |
+
background-color: #45a049;
|
| 69 |
}
|
| 70 |
</style>
|
| 71 |
</head>
|
|
|
|
| 73 |
|
| 74 |
<div class="menu-container">
|
| 75 |
<h1>Welcome to the Menu</h1>
|
| 76 |
+
|
| 77 |
{% for item in menu_items %}
|
| 78 |
<div class="menu-item">
|
| 79 |
<div class="details">
|
|
|
|
| 85 |
<button class="order-btn">Order</button>
|
| 86 |
</div>
|
| 87 |
{% endfor %}
|
| 88 |
+
|
| 89 |
+
<!-- Button for triggering voice recognition -->
|
| 90 |
+
<button id="listen-btn">Say "Order" to order an item</button>
|
| 91 |
</div>
|
| 92 |
|
| 93 |
+
<script>
|
| 94 |
+
const listenButton = document.getElementById("listen-btn");
|
| 95 |
+
const recognition = new (window.SpeechRecognition || window.webkitSpeechRecognition)();
|
| 96 |
+
|
| 97 |
+
recognition.lang = "en-US";
|
| 98 |
+
recognition.interimResults = false;
|
| 99 |
+
|
| 100 |
+
function speak(text) {
|
| 101 |
+
const msg = new SpeechSynthesisUtterance(text);
|
| 102 |
+
window.speechSynthesis.speak(msg);
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
listenButton.addEventListener("click", () => {
|
| 106 |
+
speak("Please say the item you want to order.");
|
| 107 |
+
recognition.start();
|
| 108 |
+
});
|
| 109 |
+
|
| 110 |
+
recognition.onresult = (event) => {
|
| 111 |
+
const command = event.results[0][0].transcript.toLowerCase();
|
| 112 |
+
console.log("User said:", command);
|
| 113 |
+
|
| 114 |
+
// Add logic to recognize specific items or trigger actions based on the command
|
| 115 |
+
if (command.includes("order")) {
|
| 116 |
+
// For example, navigate or process an order (customize as needed)
|
| 117 |
+
speak("Your order has been placed.");
|
| 118 |
+
}
|
| 119 |
+
};
|
| 120 |
+
|
| 121 |
+
recognition.onerror = (event) => {
|
| 122 |
+
console.error("Speech recognition error:", event.error);
|
| 123 |
+
speak("Sorry, I couldn't understand that. Please try again.");
|
| 124 |
+
};
|
| 125 |
+
</script>
|
| 126 |
+
|
| 127 |
</body>
|
| 128 |
</html>
|