-
Notifications
You must be signed in to change notification settings - Fork 0
/
student-dashboard.html
214 lines (192 loc) · 6.84 KB
/
student-dashboard.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Penguin Hub | Student Dashboard</title>
<link rel="icon" type="image/x-icon" href="/images/favicon.ico">
<style>
/* General Styles */
body {
background-color: #222;
font-family: Arial, sans-serif;
color: #fff;
}
#header {
background-color: #333;
padding: 15px;
text-align: center;
}
#content {
margin-top: 50px;
text-align: center;
}
.button {
background-color: #555;
color: #fff;
padding: 10px 20px;
text-decoration: none;
border-radius: 5px;
margin: 10px;
display: inline-block;
}
.button:hover {
background-color: #777;
}
/* Chatbot Styles */
#chat-container {
max-width: 400px;
margin: 0 auto;
background-color: #333;
border-radius: 5px;
padding: 15px;
margin-top: 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}
.chat-header {
text-align: center;
}
.chat-messages {
max-height: 300px;
overflow-y: scroll;
padding: 10px;
background-color: #444;
border-radius: 5px;
}
.user-message,
.bot-message {
padding: 5px 10px;
margin: 5px;
border-radius: 5px;
}
.user-message {
background-color: #00796b;
color: #fff;
text-align: right;
}
.bot-message {
background-color: #009688;
color: #fff;
text-align: left;
}
.chat-input {
width: 100%;
padding: 10px;
margin-top: 10px;
border: none;
border-radius: 5px;
background-color: #444;
color: #fff;
}
</style>
</head>
<body>
<div id="header">
<h1>Penguin Learning | Student Dashboard</h1>
</div>
<div id="content">
<h2>Lessons</h2>
<p>Press A Button Below to Start a Lesson!</p>
<a href="/thecat.html" class="button">Alice And The Hole</a>
<a href="/year-2042.html" class="button">Year 2042</a>
<h2>Vocabulary Lessons</h2>
<a href="/vocab-1.html" class="button">First 5 Words</a>
</div>
<!-- Chatbot Container -->
<div id="chat-container">
<div class="chat-header">
<h3>PenguinHub AI</h3>
</div>
<div class="chat-messages" id="chat-messages">
<!-- Chat messages will be displayed here -->
</div>
<input type="text" class="chat-input" id="user-input" placeholder="Type your message...">
</div>
<script>
// Chatbot JavaScript
const chatMessages = document.getElementById('chat-messages');
const userInput = document.getElementById('user-input');
userInput.addEventListener('keydown', function (e) {
if (e.key === 'Enter') {
const userMessage = userInput.value.trim();
if (userMessage) {
addMessage('user', userMessage);
handleBotResponse(userMessage);
userInput.value = '';
}
}
});
function addMessage(sender, message) {
const messageElement = document.createElement('div');
messageElement.className = sender === 'user' ? 'user-message' : 'bot-message';
messageElement.textContent = message;
chatMessages.appendChild(messageElement);
chatMessages.scrollTop = chatMessages.scrollHeight;
}
function handleBotResponse(userMessage) {
// Define responses based on user input
const responses = {
'hello': 'Hello there! How can I assist you? Warning I can be very very buggy!',
'hi': 'Hi! How can I help you today?',
'how are you': 'I\'m just a Penguin Bot, but I\'m here to help you learn!',
'good morning': 'Good morning! What can I do for you?',
'good afternoon': 'Good afternoon! How can I assist you today?',
'good evening': 'Good evening! What can I do for you?',
'thank you': 'You\'re welcome! If you have more questions, feel free to ask.',
'thanks': 'You\'re welcome! If you have more questions, feel free to ask.',
'bye': 'Goodbye! Have a great day!',
'goodbye': 'Goodbye! If you ever need assistance, don\'t hesitate to return.',
'help': 'Of course! I can help you with various subjects and topics. Just ask me a question.',
'math': 'Sure, I can assist with math. What specific math problem do you need help with?',
'science': 'Science is fascinating! What science-related topic would you like to explore?',
'history': 'History is full of interesting stories. What historical event or period are you curious about?',
'english': 'English language and literature! What aspect of English are you interested in?',
'programming': 'Programming is a valuable skill. Which programming language or concept would you like to learn about?',
'tell me a joke': 'Why don\'t scientists trust atoms? Because they make up everything!',
'what is 1+1': 'FISH',
'9/11': 'The day that the United States Of America came under attack. Over 2,000 people were killed. And 6,000 injured.',
// ... (previously defined responses)
};
// Check if the user's message matches a predefined response
const botResponse = responses[userMessage.toLowerCase()];
// If there's a predefined response, display it; otherwise, provide a default response
if (botResponse) {
addMessage('bot', botResponse);
} else {
addMessage('bot', 'I\'m not sure how to respond to that. Please feel free to ask me a question.');
}
}
function setCookie(cname, cvalue, exdays) {
const d = new Date();
d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
let expires = "expires="+d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}
function getCookie(cname) {
let name = cname + "=";
let ca = document.cookie.split(';');
for(let i = 0; i < ca.length; i++) {
let c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
function checkCookie() {
let user = getCookie("username");
if (user != "") {
alert("Welcome again " + user);
} else {
user = prompt("Please enter your name:", "");
if (user != "" && user != null) {
setCookie("username", user, 365);
}
}
}
</script>
</body>
</html>