-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
244 lines (213 loc) · 11.1 KB
/
Copy pathindex.html
File metadata and controls
244 lines (213 loc) · 11.1 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
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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Fellowship Tracker 2026</title>
<script src="https://cdn.tailwindcss.com"></script>
<style>
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700&display=swap');
body {
font-family: 'JetBrains Mono', monospace;
background-color: #000;
background-image: radial-gradient(#141414 1px, transparent 1px);
background-size: 20px 20px;
}
.pb-green { color: #4ade80; }
.pb-card { background-color: #0d0d0d; border: 1px solid #1f2937; }
.tag { display:inline-block; padding:1px 8px; font-size:9px; border-radius:3px;
border:1px solid #166534; color:#4ade80; background:#052e16;
text-transform:uppercase; letter-spacing:.08em; margin:1px; }
.tag-red { border-color:#7f1d1d; color:#f87171; background:#2d0a0a; }
::-webkit-scrollbar { width:5px; height:5px; }
::-webkit-scrollbar-track { background:#000; }
::-webkit-scrollbar-thumb { background:#1f2937; border-radius:10px; }
::-webkit-scrollbar-thumb:hover { background:#4ade80; }
.filter-btn {
padding: 4px 14px; font-size: 10px; letter-spacing:.1em;
border: 1px solid #1f2937; border-radius: 4px; cursor: pointer;
background: #0d0d0d; color: #9ca3af; transition: all .15s;
}
.filter-btn.active, .filter-btn:hover {
border-color: #4ade80; color: #4ade80; background: #052e16;
}
input[type="text"] {
background:#0d0d0d; border:1px solid #1f2937; color:#e5e7eb;
padding:6px 12px; border-radius:4px; font-size:11px; font-family:inherit;
outline:none; transition:border-color .15s;
}
input[type="text"]:focus { border-color:#4ade80; }
</style>
</head>
<body class="text-gray-300 min-h-screen">
<div class="max-w-7xl mx-auto py-12 px-4">
<!-- Header -->
<header class="mb-10">
<h1 class="text-5xl md:text-7xl font-bold text-white tracking-tighter">
Fellowship <span class="pb-green">Tracker</span>
</h1>
<p class="text-gray-500 text-xs mt-2 tracking-widest">[ BANGALORE / INDIA / 2025-2026 ]</p>
</header>
<!-- Stats Bar -->
<div id="stats-bar" class="flex gap-6 mb-8 text-xs text-gray-500"></div>
<!-- Controls -->
<div class="flex flex-wrap gap-3 mb-6 items-center">
<input type="text" id="search-input" placeholder="Search programs..." class="w-52">
<button class="filter-btn active" data-filter="all" onclick="setFilter('all',this)">ALL</button>
<button class="filter-btn" data-filter="open" onclick="setFilter('open',this)">OPEN NOW</button>
<button class="filter-btn" data-filter="remote" onclick="setFilter('remote',this)">REMOTE</button>
<button class="filter-btn" data-filter="stipend" onclick="setFilter('stipend',this)">STIPEND</button>
<button class="filter-btn" data-filter="research" onclick="setFilter('research',this)">RESEARCH</button>
<button class="filter-btn" data-filter="open-source" onclick="setFilter('open-source',this)">OPEN SOURCE</button>
<span class="ml-auto text-xs text-gray-600" id="count-label"></span>
</div>
<!-- Loading -->
<div id="loading" class="text-center py-16 pb-green animate-pulse text-sm tracking-widest">
[ INITIALIZING_DATA_STREAM... ]
</div>
<!-- Table -->
<div class="overflow-x-auto pb-card rounded-xl shadow-2xl hidden" id="table-container">
<table class="w-full border-collapse">
<thead>
<tr class="bg-[#111] border-b border-gray-800 text-gray-500 text-[10px] uppercase tracking-[.15em]">
<th class="px-5 py-4 text-left w-[28%]">Program</th>
<th class="px-5 py-4 text-left w-[12%]">Org</th>
<th class="px-5 py-4 text-center w-[12%]">Deadline</th>
<th class="px-5 py-4 text-center w-[8%]">Stipend</th>
<th class="px-5 py-4 text-center w-[8%]">Mode</th>
<th class="px-5 py-4 text-left w-[20%]">Eligibility</th>
<th class="px-5 py-4 text-right w-[12%]">Apply</th>
</tr>
</thead>
<tbody id="fellowship-list"></tbody>
</table>
</div>
<div id="no-results" class="hidden text-center py-16 text-gray-600 text-sm tracking-widest">
[ NO_RESULTS_FOUND ]
</div>
</div>
<script>
const API = "/api/fellowships";
let allData = [];
let activeFilter = "all";
// ── Fetch stats ─────────────────────────────────────────────
async function fetchStats() {
try {
const r = await fetch("/api/stats");
const s = await r.json();
document.getElementById("stats-bar").innerHTML = `
<span>TOTAL <span class="pb-green font-bold">${s.total}</span></span>
<span class="text-gray-700">|</span>
<span>OPEN <span class="pb-green font-bold">${s.open}</span></span>
<span class="text-gray-700">|</span>
<span>WITH_DEADLINE <span class="pb-green font-bold">${s.with_deadline}</span></span>
`;
} catch (_) {}
}
// ── Fetch fellowships ───────────────────────────────────────
async function fetchFellowships() {
try {
const r = await fetch(API + "?limit=200");
if (!r.ok) throw new Error(`HTTP ${r.status}`);
allData = await r.json();
renderTable(allData);
document.getElementById("loading").classList.add("hidden");
document.getElementById("table-container").classList.remove("hidden");
} catch (e) {
document.getElementById("loading").innerHTML =
`<span class="text-red-500">[ CONNECTION_ERROR: ${e.message} ]</span>`;
}
}
// ── Filters ─────────────────────────────────────────────────
function setFilter(filter, btn) {
activeFilter = filter;
document.querySelectorAll(".filter-btn").forEach(b => b.classList.remove("active"));
btn.classList.add("active");
applyFilters();
}
function applyFilters() {
const search = document.getElementById("search-input").value.toLowerCase().trim();
let filtered = [...allData];
if (activeFilter === "open")
filtered = filtered.filter(f => f.is_open === true);
else if (activeFilter === "remote")
filtered = filtered.filter(f => f.mode?.toLowerCase().includes("remote"));
else if (activeFilter === "stipend")
filtered = filtered.filter(f =>
f.stipend && !["unpaid","not specified","null"].includes(f.stipend.toLowerCase()));
else if (activeFilter !== "all")
filtered = filtered.filter(f => f.tags?.includes(activeFilter));
if (search)
filtered = filtered.filter(f =>
f.name?.toLowerCase().includes(search) ||
f.organization?.toLowerCase().includes(search) ||
f.eligibility?.toLowerCase().includes(search));
renderTable(filtered);
}
// ── Render ───────────────────────────────────────────────────
function deadlineBadge(deadline) {
if (!deadline || deadline === "Check Website" || deadline === "null")
return `<span class="tag tag-red">Check Site</span>`;
if (deadline.toLowerCase().includes("rolling"))
return `<span class="tag">Rolling</span>`;
const d = new Date(deadline);
if (isNaN(d.getTime())) {
// Fallback for strings like "March 2026"
return `<span class="tag">${deadline}</span>`;
}
const now = new Date();
const daysLeft = Math.ceil((d - now) / 86400000);
if (daysLeft < 0) return `<span class="tag tag-red">Closed</span>`;
if (daysLeft <= 14) return `<span class="tag tag-red">${daysLeft} days left</span>`;
return `<span class="tag">${deadline}</span>`;
}
function modeBadge(mode) {
if (!mode) return "";
const c = mode.toLowerCase().includes("remote") ? "" : "tag-red";
return `<span class="tag ${c}">${mode}</span>`;
}
function renderTable(data) {
const list = document.getElementById("fellowship-list");
const noResults = document.getElementById("no-results");
document.getElementById("count-label").textContent = `${data.length} results`;
if (!data.length) {
list.innerHTML = "";
noResults.classList.remove("hidden");
return;
}
noResults.classList.add("hidden");
list.innerHTML = data.map(f => `
<tr class="hover:bg-[#101010] transition-colors border-b border-gray-900">
<td class="px-5 py-5">
<div class="text-sm font-semibold text-white leading-tight">
<span class="pb-green mr-1">#</span>${f.name || "—"}
</div>
<div class="mt-1 flex flex-wrap gap-[2px]">
${(f.tags || []).slice(0,4).map(t => `<span class="tag">${t}</span>`).join("")}
</div>
</td>
<td class="px-5 py-5 text-xs text-gray-400">${f.organization || "—"}</td>
<td class="px-5 py-5 text-center">${deadlineBadge(f.deadline)}</td>
<td class="px-5 py-5 text-center text-xs text-gray-400">${f.stipend || "—"}</td>
<td class="px-5 py-5 text-center">${modeBadge(f.mode)}</td>
<td class="px-5 py-5 text-xs text-gray-500 leading-snug max-w-[220px]">
${f.eligibility ? f.eligibility.slice(0,100) + (f.eligibility.length > 100 ? "…" : "") : "—"}
</td>
<td class="px-5 py-5 text-right">
<a href="${f.apply_link}" target="_blank"
class="pb-green hover:underline text-[10px] font-bold tracking-wider whitespace-nowrap">
>> APPLY <<
</a>
</td>
</tr>
`).join("");
}
// ── Search input listener ────────────────────────────────────
document.getElementById("search-input")
.addEventListener("input", applyFilters);
// ── Boot ─────────────────────────────────────────────────────
fetchStats();
fetchFellowships();
</script>
</body>
</html>