forked from opensource-society/notesvault
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupload.html
More file actions
186 lines (162 loc) · 6.92 KB
/
upload.html
File metadata and controls
186 lines (162 loc) · 6.92 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Upload Notes</title>
<meta name="description" content="Upload your study notes to NotesVault.">
<link rel="icon" href="favicon.png" type="image/x-icon" />
<link rel="stylesheet" href="styles.css">
<!-- Google Font -->
<link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;700&display=swap"
rel="stylesheet" />
<!-- Tailwind CSS -->
<script src="upload.js" defer></script>
<script src="https://cdn.tailwindcss.com"></script>
<!-- Tailwind Config -->
<script>
tailwind.config = {
theme: {
extend: {
fontFamily: {
jakarta: ['"Plus Jakarta Sans"', 'sans-serif'],
},
colors: {
base: "#f9faf4",
ink: "#161A30",
primary: "#113946",
accent: "#B4CFB0"
}
}
}
};
</script>
<style>
body {
font-family: 'Plus Jakarta Sans', sans-serif;
}
</style>
</head>
<body class="font-jakarta bg-black text-ink">
<!-- Header -->
<header class="bg-black shadow p-3 flex justify-between items-center">
<h1 class="text-2xl font-bold text-ink text-white">NotesVault</h1>
<nav class="hidden md:flex space-x-6 text-sm text-gray-600">
<a href="pages/overview.html" class="text-gray-300 hover:underline">Overview</a>
<a href="index.html" class="text-gray-300 hover:underline">Student Account</a>
<a href="pages/about.html" class="text-gray-300 hover:underline">About</a>
<a href="#" class="text-gray-300 hover:underline">Features</a>
</nav>
<button class="bg-[#163d3b] mx-4 px-4 py-1 bg-[#163d3b] text-white rounded-full text-sm hover:bg-[#0d2f34]"><a
href="pages/signup.html" style="text-decoration: none;color:white;">Sign Up</a></button>
</header>
<!-- Main Upload Form -->
<main class="max-w-screen-md mx-auto p-6 mt-12 bg-white rounded-xl shadow">
<h2 class="text-2xl font-bold mb-6">Upload Notes</h2>
<form id="uploadForm" class="space-y-5">
<div>
<label for="branch" class="block text-sm font-medium">Branch <span class="text-red-500">*</span></label>
<select id="branch" required class="mt-1 w-full px-3 py-2 border border-gray-300 rounded-lg">
<option value="">Select Branch</option>
</select>
</div>
<div>
<label for="semester" class="block text-sm font-medium">Semester <span class="text-red-500">*</span></label>
<select id="semester" required class="mt-1 w-full px-3 py-2 border border-gray-300 rounded-lg">
<option value="">Select Semester</option>
</select>
</div>
<div>
<label for="subject" class="block text-sm font-medium">Subject <span class="text-red-500">*</span></label>
<select id="subject" required class="mt-1 w-full px-3 py-2 border border-gray-300 rounded-lg">
<option value="">Select Subject</option>
</select>
</div>
<div>
<label for="tags" class="block text-sm font-medium">Tags (optional)</label>
<input type="text" id="tags" placeholder="e.g. algo, PYQ"
class="mt-1 w-full px-3 py-2 border border-gray-300 rounded-lg" />
</div>
<div class="w-full p-2">
<label for="file" class="block text-sm font-medium text-gray-700 mb-1">
Upload File <span class="text-red-500">*</span>
</label>
<!-- Drop Zone -->
<div id="drop-zone"
class="flex flex-col items-center justify-center border-2 border-dashed border-gray-300 rounded-md h-40 bg-white text-gray-500 text-sm transition-all duration-300 ease-in-out cursor-pointer hover:bg-gray-50">
<p>Click or drag file here</p>
</div>
<input type="file" id="file" name="file" hidden required accept=".pdf,.docx,.txt,image/*" />
<!-- Preview -->
<div id="preview" class="mt-4 text-center text-sm text-gray-700"></div>
</div>
<button type="submit" class="w-full bg-green-600 text-white py-2 rounded-full hover:bg-[#0d2f34] transition-all">
Upload
</button>
</form>
<div id="message" class="mt-4 text-green-600 font-medium"></div>
</main>
<footer class="text-center text-sm mt-10 text-gray-500">© 2025 NotesVault</footer>
<!-- Script to Load Dropdowns from JSON -->
<script>
let data;
fetch('./data/search_parameters/parameters.json')
.then(res => res.json())
.then(json => {
data = json;
const branchSelect = document.getElementById('branch');
json.branches.forEach(b => {
if (typeof b === 'object') {
const option = document.createElement('option');
option.value = b.name;
option.textContent = b.name;
branchSelect.appendChild(option);
} else {
const option = document.createElement('option');
option.value = b;
option.textContent = b;
branchSelect.appendChild(option);
}
});
});
document.getElementById('branch').addEventListener('change', e => {
const semesterSelect = document.getElementById('semester');
semesterSelect.innerHTML = '<option value="">Select Semester</option>';
const subjectSelect = document.getElementById('subject');
subjectSelect.innerHTML = '<option value="">Select Subject</option>';
const selectedBranch = e.target.value;
const branchData = data.branches.find(b => b.name === selectedBranch);
if (!branchData) return;
branchData.semesters.forEach(sem => {
const option = document.createElement('option');
option.value = sem.semester;
option.textContent = `Semester ${sem.semester}`;
semesterSelect.appendChild(option);
});
});
document.getElementById('semester').addEventListener('change', e => {
const subjectSelect = document.getElementById('subject');
subjectSelect.innerHTML = '<option value="">Select Subject</option>';
const branch = document.getElementById('branch').value;
const semester = parseInt(e.target.value);
const branchData = data.branches.find(b => b.name === branch);
if (!branchData) return;
const semesterData = branchData.semesters.find(s => s.semester === semester);
if (!semesterData) return;
semesterData.subjects.forEach(sub => {
const code = Object.keys(sub)[0];
const name = sub[code];
const option = document.createElement('option');
option.value = code;
option.textContent = `${code} - ${name}`;
subjectSelect.appendChild(option);
});
});
document.getElementById("uploadForm").addEventListener("submit", function (e) {
e.preventDefault();
document.getElementById("message").innerText = "✅ Notes uploaded successfully (for demo purposes only — not stored)"
this.reset();
});
</script>
</body>
</html>