jihih / templates /index.html
bodhak's picture
Upload 4 files
22dc5f7 verified
<!-- <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>AI Interview Simulator</title>
</head>
<body>
<h1>Upload Your Resume</h1>
<form id="upload-form" enctype="multipart/form-data">
<input type="file" name="resume" accept=".pdf" required />
<button type="submit">Generate Questions</button>
</form>
<h2>Generated Questions:</h2>
<ul id="question-list"></ul>
<script>
const form = document.getElementById("upload-form");
const questionList = document.getElementById("question-list");
form.addEventListener("submit", async (e) => {
e.preventDefault();
const formData = new FormData(form);
const response = await fetch("/upload-resume", {
method: "POST",
body: formData
});
const questions = await response.json();
questionList.innerHTML = "";
questions.forEach(q => {
const li = document.createElement("li");
li.textContent = q;
questionList.appendChild(li);
});
});
</script>
</body>
</html> -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AI Interview Simulator</title>
<style>
:root {
--primary: #4f46e5;
--primary-dark: #4338ca;
--secondary: #f3f4f6;
--text: #1f2937;
--light-text: #6b7280;
--accent: #fef3c7;
--border: #e5e7eb;
--shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Inter', system-ui, -apple-system, sans-serif;
}
body {
background-color: #f9fafb;
color: var(--text);
line-height: 1.5;
}
.container {
max-width: 800px;
margin: 0 auto;
padding: 2rem 1rem;
}
header {
text-align: center;
margin-bottom: 3rem;
}
h1 {
color: var(--primary);
font-size: 2.5rem;
margin-bottom: 1rem;
}
.tagline {
color: var(--light-text);
font-size: 1.2rem;
max-width: 600px;
margin: 0 auto;
}
.card {
background-color: white;
border-radius: 12px;
box-shadow: var(--shadow);
padding: 2rem;
margin-bottom: 2rem;
}
.card-title {
color: var(--text);
font-size: 1.5rem;
margin-bottom: 1.5rem;
display: flex;
align-items: center;
gap: 10px;
}
.icon {
background-color: var(--accent);
width: 40px;
height: 40px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
color: var(--primary);
}
.upload-area {
border: 2px dashed var(--border);
border-radius: 8px;
padding: 2rem;
text-align: center;
transition: all 0.3s;
cursor: pointer;
position: relative;
margin-bottom: 1.5rem;
}
.upload-area:hover {
border-color: var(--primary);
background-color: rgba(79, 70, 229, 0.03);
}
.upload-area p {
color: var(--light-text);
margin: 1rem 0;
}
.file-input {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
opacity: 0;
cursor: pointer;
}
.button {
background-color: var(--primary);
color: white;
border: none;
border-radius: 8px;
padding: 12px 24px;
font-size: 1rem;
font-weight: 600;
cursor: pointer;
transition: all 0.2s;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 8px;
}
.button:hover {
background-color: var(--primary-dark);
transform: translateY(-1px);
}
.file-name {
background-color: var(--secondary);
padding: 8px 16px;
border-radius: 6px;
display: none;
align-items: center;
justify-content: space-between;
margin-bottom: 1.5rem;
}
.file-name.active {
display: flex;
}
.remove-file {
background: none;
border: none;
color: var(--light-text);
cursor: pointer;
font-size: 1.2rem;
}
.question-list {
list-style-type: none;
}
.question-item {
padding: 16px;
border-radius: 8px;
background-color: var(--secondary);
margin-bottom: 12px;
animation: fadeIn 0.5s ease-in-out;
}
.question-number {
font-weight: 600;
color: var(--primary);
margin-right: 8px;
}
.loading {
display: none;
align-items: center;
justify-content: center;
gap: 12px;
margin: 2rem 0;
}
.loading.active {
display: flex;
}
.spinner {
width: 24px;
height: 24px;
border: 3px solid rgba(79, 70, 229, 0.3);
border-radius: 50%;
border-top-color: var(--primary);
animation: spin 1s linear infinite;
}
.no-questions {
text-align: center;
color: var(--light-text);
padding: 2rem;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
to { transform: rotate(360deg); }
}
@media (max-width: 640px) {
.container {
padding: 1rem;
}
h1 {
font-size: 2rem;
}
.card {
padding: 1.5rem;
}
}
</style>
</head>
<body>
<div class="container">
<header>
<h1>AI Interview Simulator</h1>
<p class="tagline">Upload your resume and receive tailored interview questions to help you prepare for your next job interview</p>
</header>
<div class="card">
<h2 class="card-title">
<span class="icon">1</span>
Upload Your Resume
</h2>
<form id="upload-form" enctype="multipart/form-data">
<div class="upload-area" id="drop-area">
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-upload" style="color: var(--primary);">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
<polyline points="17 8 12 3 7 8"></polyline>
<line x1="12" y1="3" x2="12" y2="15"></line>
</svg>
<p>Drag and drop your resume, or click to browse</p>
<p style="font-size: 0.9rem;">Supported format: PDF</p>
<input type="file" name="resume" accept=".pdf" required class="file-input" id="file-input" />
</div>
<div class="file-name" id="file-display">
<span id="file-name">document.pdf</span>
<button type="button" class="remove-file" id="remove-file">×</button>
</div>
<button type="submit" class="button" id="generate-btn">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"></circle>
<polygon points="10 8 16 12 10 16 10 8"></polygon>
</svg>
Generate Interview Questions
</button>
</form>
</div>
<div class="loading" id="loading">
<div class="spinner"></div>
<span>Analyzing your resume...</span>
</div>
<div class="card" id="questions-card" style="display: none;">
<h2 class="card-title">
<span class="icon">2</span>
Your Interview Questions
</h2>
<div id="questions-container">
<ul class="question-list" id="question-list"></ul>
<div class="no-questions" id="no-questions">
Upload your resume to see personalized interview questions
</div>
</div>
</div>
</div>
<script>
const form = document.getElementById("upload-form");
const fileInput = document.getElementById("file-input");
const fileDisplay = document.getElementById("file-display");
const fileName = document.getElementById("file-name");
const removeFile = document.getElementById("remove-file");
const questionList = document.getElementById("question-list");
const questionsCard = document.getElementById("questions-card");
const noQuestions = document.getElementById("no-questions");
const loading = document.getElementById("loading");
// File input handling
fileInput.addEventListener("change", (e) => {
if (fileInput.files.length > 0) {
fileName.textContent = fileInput.files[0].name;
fileDisplay.classList.add("active");
}
});
removeFile.addEventListener("click", () => {
fileInput.value = "";
fileDisplay.classList.remove("active");
});
// Form submission
form.addEventListener("submit", async (e) => {
e.preventDefault();
if (fileInput.files.length === 0) {
alert("Please select a resume file first");
return;
}
loading.classList.add("active");
try {
const formData = new FormData(form);
// Simulate API call with timeout
setTimeout(async () => {
// In a real application, this would be an actual API call
// const response = await fetch("/upload-resume", {
// method: "POST",
// body: formData
// });
// const questions = await response.json();
// Sample questions for demonstration
const questions = [
"Tell me about your experience with front-end development frameworks mentioned in your resume.",
"Can you explain a challenging project you worked on and how you approached it?",
"How do you stay updated with the latest technologies in your field?",
"What made you interested in applying for this position?",
"Describe a situation where you had to learn a new technology quickly. How did you approach it?",
"How do you handle tight deadlines and pressure?",
"Can you elaborate on your experience with team collaboration tools?",
"What is your process for debugging complex issues in your code?"
];
// Display questions
questionList.innerHTML = "";
questions.forEach((q, index) => {
const li = document.createElement("li");
li.className = "question-item";
li.innerHTML = `<span class="question-number">Q${index + 1}:</span> ${q}`;
questionList.appendChild(li);
});
loading.classList.remove("active");
questionsCard.style.display = "block";
noQuestions.style.display = "none";
}, 2000); // Simulate loading delay
} catch (error) {
console.error("Error:", error);
loading.classList.remove("active");
alert("There was an error processing your request. Please try again.");
}
});
</script>
</body>
</html>