-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbookings.js
More file actions
47 lines (42 loc) · 1.84 KB
/
Copy pathbookings.js
File metadata and controls
47 lines (42 loc) · 1.84 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
// bookings.js – SkillSwap Bookings Page
(function () {
injectShell('nav-bookings');
// ── Dismiss alert banners ─────────────────────────────────
document.querySelectorAll('.booking-alert-close').forEach(btn => {
btn.addEventListener('click', function () {
const targetId = this.dataset.target;
const el = document.getElementById(targetId);
if (el) {
el.style.height = el.offsetHeight + 'px';
el.style.overflow = 'hidden';
el.style.transition = 'height 0.3s, opacity 0.3s, margin 0.3s';
requestAnimationFrame(() => {
el.style.height = '0';
el.style.opacity = '0';
el.style.marginBottom = '0';
});
setTimeout(() => el.remove(), 320);
}
});
});
// ── Tab switching ─────────────────────────────────────────
const tabs = document.getElementById('bookingTabs');
tabs.querySelectorAll('.tab-btn').forEach(btn => {
btn.addEventListener('click', function () {
// Update active tab
tabs.querySelectorAll('.tab-btn').forEach(b => b.classList.remove('active'));
this.classList.add('active');
// Show/hide panels
const active = this.dataset.tab;
['upcoming', 'pending', 'history'].forEach(t => {
const panel = document.getElementById('tab-' + t);
if (panel) panel.style.display = (t === active) ? '' : 'none';
});
});
});
// ── Calendar connect ──────────────────────────────────────
document.querySelector('[href="#"]')?.addEventListener('click', function (e) {
e.preventDefault();
alert('Google Calendar integration coming soon!');
});
})();