InterviewMate / index.html
Jayaviji's picture
Update index.html
8a922ea verified
Raw History Blame Contribute Delete
6.62 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>InterviewMate</title>
<style>
* {
box-sizing: border-box;
font-family: Arial, sans-serif;
}
body {
margin: 0;
min-height: 100vh;
background: #f3f6ff;
padding: 25px 15px;
}
.app {
max-width: 600px;
margin: auto;
background: white;
padding: 28px;
border-radius: 20px;
box-shadow: 0 8px 30px rgba(0,0,0,.08);
}
h1 {
text-align: center;
margin-bottom: 8px;
}
.subtitle {
text-align: center;
color: #666;
margin-bottom: 25px;
}
label {
display: block;
font-weight: bold;
margin: 16px 0 7px;
}
input {
width: 100%;
padding: 14px;
border: 1px solid #d5d5d5;
border-radius: 10px;
font-size: 16px;
outline: none;
}
input:focus {
border-color: #4f46e5;
}
button {
width: 100%;
border: 0;
border-radius: 10px;
padding: 15px;
margin-top: 22px;
background: #4f46e5;
color: white;
font-size: 16px;
font-weight: bold;
cursor: pointer;
}
button:hover {
background: #4338ca;
}
.clear {
background: #6b7280;
margin-top: 10px;
}
.result {
display: none;
margin-top: 20px;
padding: 18px;
background: #f0fdf4;
border-radius: 12px;
line-height: 1.7;
}
.status {
margin-top: 15px;
text-align: center;
font-weight: bold;
}
.note {
text-align: center;
color: #777;
font-size: 12px;
margin-top: 20px;
line-height: 1.5;
}
</style>
</head>
<body>
<div class="app">
<h1>πŸ’Ό InterviewMate</h1>
<p class="subtitle">
Never miss your interview πŸ””
</p>
<label>Your Name</label>
<input id="name" type="text" placeholder="Enter your name">
<label>Company Name</label>
<input id="company" type="text" placeholder="Example: TCS">
<label>Job Role</label>
<input id="role" type="text" placeholder="Example: Data Analyst">
<label>Interview Date</label>
<input id="date" type="date">
<label>Interview Time</label>
<input id="time" type="time">
<button onclick="setReminder()">
πŸ”” Set Reminder
</button>
<button class="clear" onclick="clearReminder()">
πŸ—‘οΈ Clear Reminder
</button>
<div class="result" id="result">
<strong>βœ… Reminder Set</strong>
<div id="details"></div>
</div>
<div class="status" id="status"></div>
<p class="note">
Please allow notifications when your browser asks.
Keep this page open for the reminder to trigger.
</p>
</div>
<script>
let timer = null;
function setReminder() {
const name = document.getElementById("name").value.trim();
const company = document.getElementById("company").value.trim();
const role = document.getElementById("role").value.trim();
const date = document.getElementById("date").value;
const time = document.getElementById("time").value;
if (!name || !company || !role || !date || !time) {
alert("Please fill all the details.");
return;
}
const reminderTime = new Date(date + "T" + time);
const now = new Date();
if (reminderTime <= now) {
alert("Please select a future date and time.");
return;
}
if ("Notification" in window) {
if (Notification.permission === "default") {
Notification.requestPermission().then(permission => {
if (permission === "granted") {
saveReminder(
name,
company,
role,
date,
time,
reminderTime
);
} else {
alert("Please allow notifications.");
}
});
}
else if (Notification.permission === "granted") {
saveReminder(
name,
company,
role,
date,
time,
reminderTime
);
}
else {
alert(
"Notifications are blocked. Please enable them in browser settings."
);
}
} else {
alert("Your browser does not support notifications.");
}
}
function saveReminder(
name,
company,
role,
date,
time,
reminderTime
) {
const data = {
name: name,
company: company,
role: role,
date: date,
time: time,
timestamp: reminderTime.getTime()
};
localStorage.setItem(
"interviewReminder",
JSON.stringify(data)
);
showReminder(data);
document.getElementById("status").textContent =
"πŸ”” Reminder successfully set!";
startTimer(data);
}
function startTimer(data) {
if (timer) {
clearTimeout(timer);
}
const delay = data.timestamp - Date.now();
if (delay <= 0) {
return;
}
timer = setTimeout(() => {
if (
"Notification" in window &&
Notification.permission === "granted"
) {
new Notification("πŸ”” Interview Reminder", {
body:
"Your " +
data.role +
" interview at " +
data.company +
" is starting now!"
});
} else {
alert(
"πŸ”” Interview Reminder\n" +
data.company +
" - " +
data.role
);
}
localStorage.removeItem("interviewReminder");
}, delay);
}
function showReminder(data) {
document.getElementById("result").style.display = "block";
document.getElementById("details").innerHTML =
"<br>πŸ‘€ " + data.name +
"<br>🏒 " + data.company +
"<br>πŸ’Ό " + data.role +
"<br>πŸ“… " + data.date +
"<br>⏰ " + data.time;
}
function clearReminder() {
localStorage.removeItem("interviewReminder");
if (timer) {
clearTimeout(timer);
timer = null;
}
document.getElementById("result").style.display = "none";
document.getElementById("status").textContent =
"πŸ—‘οΈ Reminder cleared.";
}
window.onload = function() {
const saved =
localStorage.getItem("interviewReminder");
if (saved) {
const data = JSON.parse(saved);
if (data.timestamp > Date.now()) {
document.getElementById("name").value = data.name;
document.getElementById("company").value = data.company;
document.getElementById("role").value = data.role;
document.getElementById("date").value = data.date;
document.getElementById("time").value = data.time;
showReminder(data);
startTimer(data);
} else {
localStorage.removeItem("interviewReminder");
}
}
};
</script>
</body>
</html>