Spaces:
Sleeping
Sleeping
Create templates/dashboard.html
Browse files
templates/templates/dashboard.html
ADDED
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Dashboard - Biryani Hub</title>
|
7 |
+
<style>
|
8 |
+
/* General Body Styling */
|
9 |
+
body {
|
10 |
+
font-family: Arial, sans-serif;
|
11 |
+
background-color: #f0f0f0;
|
12 |
+
margin: 0;
|
13 |
+
padding: 0;
|
14 |
+
}
|
15 |
+
/* Container for the dashboard content */
|
16 |
+
.dashboard-container {
|
17 |
+
max-width: 900px;
|
18 |
+
margin: 50px auto;
|
19 |
+
padding: 20px;
|
20 |
+
background-color: #fff;
|
21 |
+
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
22 |
+
border-radius: 8px;
|
23 |
+
text-align: center;
|
24 |
+
}
|
25 |
+
/* Heading Style */
|
26 |
+
h1 {
|
27 |
+
font-size: 2.5rem;
|
28 |
+
color: #333;
|
29 |
+
margin-bottom: 20px;
|
30 |
+
}
|
31 |
+
/* Paragraph Style */
|
32 |
+
p {
|
33 |
+
font-size: 1.2rem;
|
34 |
+
color: #666;
|
35 |
+
margin-bottom: 30px;
|
36 |
+
}
|
37 |
+
/* Link Style */
|
38 |
+
a {
|
39 |
+
text-decoration: none;
|
40 |
+
color: #4CAF50;
|
41 |
+
font-weight: bold;
|
42 |
+
font-size: 1.2rem;
|
43 |
+
transition: color 0.3s;
|
44 |
+
}
|
45 |
+
a:hover {
|
46 |
+
color: #45a049;
|
47 |
+
}
|
48 |
+
/* Button for listening */
|
49 |
+
#listen-btn {
|
50 |
+
padding: 10px 20px;
|
51 |
+
background-color: #4CAF50;
|
52 |
+
color: white;
|
53 |
+
border: none;
|
54 |
+
border-radius: 5px;
|
55 |
+
cursor: pointer;
|
56 |
+
font-size: 1.2rem;
|
57 |
+
}
|
58 |
+
#listen-btn:hover {
|
59 |
+
background-color: #45a049;
|
60 |
+
}
|
61 |
+
</style>
|
62 |
+
</head>
|
63 |
+
<body>
|
64 |
+
|
65 |
+
<div class="dashboard-container">
|
66 |
+
<h1>Welcome to the Dashboard</h1>
|
67 |
+
<p>This is your user dashboard where you can access various features.</p>
|
68 |
+
<a href="/menu">Go to Menu</a>
|
69 |
+
|
70 |
+
<!-- Button for triggering voice recognition -->
|
71 |
+
<button id="listen-btn">Say "Go to Menu"</button>
|
72 |
+
</div>
|
73 |
+
|
74 |
+
<script>
|
75 |
+
// Speech Recognition and Speech Synthesis for voice interaction
|
76 |
+
// Check for SpeechRecognition support
|
77 |
+
const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
|
78 |
+
const recognition = new SpeechRecognition();
|
79 |
+
recognition.lang = 'en-US';
|
80 |
+
recognition.interimResults = false;
|
81 |
+
recognition.maxAlternatives = 1;
|
82 |
+
// Function to speak the message
|
83 |
+
function speak(text) {
|
84 |
+
const msg = new SpeechSynthesisUtterance(text);
|
85 |
+
msg.rate = 1; // Speed of speech
|
86 |
+
window.speechSynthesis.speak(msg);
|
87 |
+
}
|
88 |
+
// Button for listening to user input
|
89 |
+
const listenButton = document.getElementById("listen-btn");
|
90 |
+
listenButton.addEventListener("click", () => {
|
91 |
+
speak("Please say 'Go to Menu' to navigate to the menu.");
|
92 |
+
recognition.start();
|
93 |
+
});
|
94 |
+
// Handle speech recognition result
|
95 |
+
recognition.onresult = (event) => {
|
96 |
+
const command = event.results[0][0].transcript.toLowerCase();
|
97 |
+
console.log("User said:", command);
|
98 |
+
// If user says "Go to Menu", navigate to the menu
|
99 |
+
if (command.includes("go to menu")) {
|
100 |
+
window.location.href = "/menu";
|
101 |
+
}
|
102 |
+
};
|
103 |
+
// Handle errors in speech recognition
|
104 |
+
recognition.onerror = (event) => {
|
105 |
+
console.error("Speech recognition error:", event.error);
|
106 |
+
speak("Sorry, I couldn't understand that. Please try again.");
|
107 |
+
};
|
108 |
+
</script>
|
109 |
+
|
110 |
+
</body>
|
111 |
+
</html>
|