diff --git a/site/assets/css/style.css b/site/assets/css/style.css index fab0807..f3db8e3 100644 --- a/site/assets/css/style.css +++ b/site/assets/css/style.css @@ -2699,7 +2699,6 @@ h3.contact-title { width: 100% !important; } -.schedule-export .schedule-day-filter, .schedule-export .schedule-scroll-hint { display: none !important; } @@ -2730,43 +2729,6 @@ h3.contact-title { align-items: center !important; } -/* ── Schedule day filter — one day on screen, picker bar to switch ───────────── - On screen the schedule shows a single day with a clickable day-picker bar (the - same behaviour the phone had, now at every width). The JPG export ignores all - of this — it re-enables the full-week grid via .schedule-export — so the - downloaded image is always the complete week. */ -.schedule-day-filter { - display: flex; - flex-wrap: wrap; - gap: 8px; - justify-content: center; - margin: 0 0 1.75rem; -} - -.sdf-btn { - border: 1px solid var(--fitme-surface-2); - background: #fff; - color: var(--fitme-text-soft); - font-weight: 700; - font-size: .9rem; - padding: 9px 20px; - min-height: 44px; - border-radius: var(--fitme-radius); - cursor: pointer; - transition: border-color var(--fitme-transition), color var(--fitme-transition); -} - -.sdf-btn:hover { - border-color: var(--fitme-accent); - color: var(--fitme-text); -} - -.sdf-btn.active { - background: var(--fitme-accent); - border-color: var(--fitme-accent); - color: var(--fitme-dark); -} - /* On-screen single-day layout — one centred column showing the chosen day's classes in time order, keeping the Manhã / Tarde dividers as section breaks. Scoped to :not(.schedule-export) so the capture clone keeps the full week. */ @@ -2819,12 +2781,39 @@ h3.contact-title { display: none !important; } -/* Single-day mode: the active day-filter button already names the day being - shown — drop the redundant title above the grid. Kept for the 3-day desktop - view (.is-3day), where the header also distinguishes three different days - and the side ones stay clickable. */ +/* Single-day mode: no day-filter bar any more (audit UX pass) — the header + itself is the only day switcher, so it always shows, with prev/next arrows + beside the day name. Kept plain (no arrows) for the 3-day desktop view + (.is-3day), where the side days are already directly clickable. */ .schedule:not(.schedule-export):not(.is-3day) .schedule_dayhead { - display: none !important; + gap: 10px; + align-items: center; +} + +.schedule.is-3day .sched-nav, +.schedule-export .sched-nav { + display: none; +} + +.sched-nav { + display: flex; + align-items: center; + justify-content: center; + width: 44px; + height: 44px; + border: none; + border-radius: var(--fitme-radius); + background: var(--fitme-surface-2); + color: var(--fitme-text-soft); + font-size: 1rem; + cursor: pointer; + transition: background var(--fitme-transition), color var(--fitme-transition); + flex: 0 0 auto; +} + +.sched-nav:hover { + background: var(--fitme-accent); + color: var(--fitme-dark); } .schedule-scroll-hint { diff --git a/site/assets/js/main.js b/site/assets/js/main.js index 153adda..a151016 100644 --- a/site/assets/js/main.js +++ b/site/assets/js/main.js @@ -377,26 +377,28 @@ document.addEventListener('DOMContentLoaded', function () { window.addEventListener('scroll', function () { if (panelOpen() && !floating.matches && !opening) closePanel(); }, { passive: true }); }); -/* ── Schedule day filter ───────────────────────────────────────────────────── - The on-screen schedule shows the chosen day (phones) or that day centred - between the day before and after (desktop ≥992px); a day-picker bar switches - days (each header + class cell is tagged with data-day). Defaults to today - when the gym is open that day, otherwise the first day. The JPG export is - unaffected — its clone removes every .sched-hide and re-renders the full week. */ +/* ── Schedule day switcher ──────────────────────────────────────────────────── + The on-screen schedule shows the chosen day (phones/tablets) or that day + centred between the day before and after (desktop ≥992px, .is-3day); each + header + class cell is tagged with data-day. There is no separate day-picker + bar — the header itself is the switcher: prev/next arrows beside the day + name on phones/tablets, and clicking a side day's header on desktop. + Defaults to today when the gym is open that day, otherwise the first day. + The JPG export is unaffected — its clone removes every .sched-hide and + re-renders the full week. */ document.addEventListener('DOMContentLoaded', function () { // Works on the home page (#horario) and the CrossFit page (bare .schedule). var scope = document.querySelector('.schedule'); if (!scope) return; - var filter = scope.querySelector('.schedule-day-filter'); + var dayheads = scope.querySelectorAll('.schedule_dayhead'); var cells = scope.querySelectorAll('.schedule_cell, .schedule_dayhead'); - if (!filter || !cells.length) return; - var buttons = filter.querySelectorAll('.sdf-btn'); + if (!dayheads.length) return; var labels = scope.querySelectorAll('.schedule_section_label'); // Desktop shows three days — the chosen one centred between the day before // and the day after (wrapping round the week); phones show just the one. var wide = window.matchMedia('(min-width: 992px)'); - var week = Array.prototype.map.call(buttons, function (b) { return b.getAttribute('data-day'); }); + var week = Array.prototype.map.call(dayheads, function (h) { return h.getAttribute('data-day'); }); var current = null; // Toggle classes (not inline display) — .sched-hide carries !important so it @@ -418,9 +420,6 @@ document.addEventListener('DOMContentLoaded', function () { if (three && col !== 2) c.classList.add('sched-side'); } }); - buttons.forEach(function (b) { - b.classList.toggle('active', b.getAttribute('data-day') === day); - }); // Show a Manhã / Tarde divider only when a visible day has a class in that block. labels.forEach(function (lbl) { var sec = lbl.getAttribute('data-section'); @@ -431,25 +430,28 @@ document.addEventListener('DOMContentLoaded', function () { }); } - filter.addEventListener('click', function (e) { - var btn = e.target.closest('.sdf-btn'); - if (btn) showDay(btn.getAttribute('data-day')); - }); - // Clicking a side day's header centres it. + function step(dir) { + var i = week.indexOf(current), n = week.length; + if (i === -1 || !n) return; + showDay(week[(i + dir + n) % n]); + } + scope.addEventListener('click', function (e) { + if (e.target.closest('.sched-prev')) { step(-1); return; } + if (e.target.closest('.sched-next')) { step(1); return; } + // Clicking a side day's header (desktop 3-day view) centres it. var head = e.target.closest('.schedule_dayhead.sched-side'); if (head) showDay(head.getAttribute('data-day')); }); var reflow = function () { if (current) showDay(current); }; if (wide.addEventListener) wide.addEventListener('change', reflow); else if (wide.addListener) wide.addListener(reflow); - // Pre-select today when the schedule has a button for it (PT day names), + // Pre-select today when the schedule has a header for it (PT day names), // otherwise the first day. var ptDays = { 1: 'segunda', 2: 'terça', 3: 'quarta', 4: 'quinta', 5: 'sexta', 6: 'sábado' }; var today = ptDays[new Date().getDay()]; - var todayBtn = today ? filter.querySelector('.sdf-btn[data-day="' + today + '"]') : null; - var start = todayBtn || buttons[0]; - if (start) showDay(start.getAttribute('data-day')); + var start = (today && week.indexOf(today) !== -1) ? today : week[0]; + if (start) showDay(start); }); /* ── Contact form: stretch the message box to meet the map ─────────────────── diff --git a/site/crossfit.php b/site/crossfit.php index b1cfb23..0ea8c04 100644 --- a/site/crossfit.php +++ b/site/crossfit.php @@ -38,6 +38,33 @@ echo view('crossfit', $data); echo view('crossfit_badge', $data); echo view('gallery', $data); echo view('horario', $data); + +// ── Informações e contactos ─────────────────────────────────────────────────── +// Same partial as the home page (site/includes/contactos.php), so visitors get +// the gym's contact info + form without leaving the CrossFit page. +$gid = (int) $gym['id']; +$on = fn(string $key) => gym_section_on($gym, $key); +$whours = $on('workhours') ? site_work_hours($pdo, $gid) : []; +$work_hours_days = ['Segunda-Sexta' => 'segunda', 'Sábado' => 'sabado', 'Domingo/Feriados' => 'domingo']; +usort($whours, fn($x, $y) => strcmp((string) $x['open'], (string) $y['open'])); +$assunto = ''; +if (isset($_GET['assunto'])) { + $assunto = $_GET['assunto']; + if ($assunto == 'pt'): $assunto = 'Informações - Personal Trainer'; + elseif ($assunto == 'pt_cf'): $assunto = 'Informações - Personal Trainer CrossFit'; + elseif ($assunto == 'insc'): $assunto = 'Informações - Inscrição no Ginásio'; + elseif ($assunto == 'aula'): $assunto = 'Informações - Aula Experimental'; + elseif ($assunto == 'nut'): $assunto = 'Informações - Nutricionista'; + elseif ($assunto == 'fis'): $assunto = 'Informações - Fisioterapia'; + endif; +} +echo view('contactos', [ + 'whours' => $whours, + 'work_hours_days' => $work_hours_days, + 'assunto' => $assunto, + 'show' => $on('contactos'), +]); + echo view('map', $data); echo view('ad_footer', $data); echo view('footer', $data); diff --git a/site/includes/contactos.php b/site/includes/contactos.php new file mode 100644 index 0000000..4833b0a --- /dev/null +++ b/site/includes/contactos.php @@ -0,0 +1,136 @@ + 'segunda', 'Sábado' => 'sabado', 'Domingo/Feriados' => 'domingo']; +$assunto = $assunto ?? ''; +$show = $show ?? true; +$session = session(); +?> + + +
+
+ + + + + +
+
+

Informações

+
+

Localização

+
+ +
+ +

+
+
+
+
+
+

Telefone

+
+ +
+ +

+
+ + +

+
+ +
+
+
+
+

E-mail

+
+ + +
+
+ +
+

Horário de Funcionamento

+
+ $value): ?> +
+
+ +
+ +
Encerrado
+
+ +
+
+ + +
+ +
+
+
+
+

Envia-nos uma mensagem

+ + + +
+ +
+
+ +
+
+ +
+
+ + + getFlashdata('email') !== null): ?> + + + + +
+
+
+
+
+
+ diff --git a/site/includes/horario.php b/site/includes/horario.php index f4fcef1..6a89531 100644 --- a/site/includes/horario.php +++ b/site/includes/horario.php @@ -43,11 +43,6 @@ foreach ($rows as $d) { $grid[$d['dia_semana']][$d['hora_inicio']][] = $d; } -
- $value): ?> - - -
@@ -57,7 +52,9 @@ foreach ($rows as $d) { $grid[$d['dia_semana']][$d['hora_inicio']][] = $d; } $value): $col++; ?>
+
+
@@ -138,7 +135,6 @@ foreach ($rows as $d) { $grid[$d['dia_semana']][$d['hora_inicio']][] = $d; } el.classList.remove('fade-in'); el.classList.remove('revealed'); }); - var f = board.querySelector('.schedule-day-filter'); if (f) f.parentNode.removeChild(f); var b = board.querySelector('.schedule-dl-btn'); if (b) { var w = b.closest('div'); (w || b).parentNode.removeChild(w || b); } Array.prototype.forEach.call(board.querySelectorAll('.sched-hide'), function (c) { c.classList.remove('sched-hide'); }); diff --git a/site/index.php b/site/index.php index d743d0f..a3ffc68 100644 --- a/site/index.php +++ b/site/index.php @@ -272,12 +272,6 @@ if (!in_array($default_day, $week_values, true)) { $default_day = $week_values[0
- -
- $value): ?> - - -
$value): $col++; ?>
+
+
@@ -424,9 +420,8 @@ if (!in_array($default_day, $week_values, true)) { $default_day = $week_values[0 el.classList.remove('fade-in'); el.classList.remove('revealed'); }); - var f = board.querySelector('.schedule-day-filter'); if (f) f.parentNode.removeChild(f); var b = doc.getElementById('scheduleDownload'); if (b) { var w = b.closest('div'); (w || b).parentNode.removeChild(w || b); } - // Un-hide every day (mobile day-filter may have hidden 5 of 6). + // Un-hide every day (single-day mode may have hidden 5 of 6). Array.prototype.forEach.call(board.querySelectorAll('.sched-hide'), function (c) { c.classList.remove('sched-hide'); }); var stamp = doc.createElement('p'); @@ -578,135 +573,13 @@ if (isset($_GET['assunto'])) { elseif ($assunto == 'fis'): $assunto = 'Informações - Fisioterapia'; endif; } -$session = session(); -?> - - -
-
- - - - - -
-
-

Informações

-
-

Localização

-
- -
- -

-
-
-
-
-
-

Telefone

-
- -
- -

-
- - -

-
- -
-
-
-
-

E-mail

-
- - -
-
- -
-

Horário de Funcionamento

-
- $value): ?> -
-
- -
- -
Encerrado
-
- -
-
- - -
- -
-
-
-
-

Envia-nos uma mensagem

- - - -
- -
-
- -
-
- -
-
- - - getFlashdata('email') !== null): ?> - - - - -
-
-
-
-
-
+echo view('contactos', [ + 'whours' => $whours, + 'work_hours_days' => $work_hours_days, + 'assunto' => $assunto, + 'show' => $on('contactos'), +]); - - -