From a1740fcc317a98456047c61ecfe4ad375c9f5407 Mon Sep 17 00:00:00 2001 From: dm Date: Thu, 18 Dec 2025 08:22:03 +0100 Subject: [PATCH] Indywidualna strona dla premium --- src/components/layout/Header.astro | 1 + src/content/internet-telewizja/tv-addons.yaml | 3 +- src/islands/jambox/JamboxChannelsSearch.jsx | 3 +- .../modals/sections/TvAddonsSection.jsx | 3 +- src/pages/premium/[tid].astro | 157 ++++++++++++++++++ src/pages/premium/index.astro | 48 +----- src/styles/navbar.css | 4 +- 7 files changed, 174 insertions(+), 45 deletions(-) create mode 100644 src/pages/premium/[tid].astro diff --git a/src/components/layout/Header.astro b/src/components/layout/Header.astro index 2c23bfb..fec127b 100644 --- a/src/components/layout/Header.astro +++ b/src/components/layout/Header.astro @@ -8,6 +8,7 @@ const links = [ { name: "INTERNET ŚWIATŁOWODOWY", href: "/internet-swiatlowodowy" }, { name: "INTERNET I TELEWIZJA", href: "/internet-telewizja" }, { name: "TELEFON", href: "/telefon" }, + { name: "PAKIETY PREMIUM", href: "/premium" }, { name: "ZASIĘG SIECI", href: "/mapa-zasiegu" }, { name: "KONTAKT", href: "/kontakt" }, { name: "DOKUMENTY", href: "/dokumenty" }, diff --git a/src/content/internet-telewizja/tv-addons.yaml b/src/content/internet-telewizja/tv-addons.yaml index 6ba81cf..1b7c373 100644 --- a/src/content/internet-telewizja/tv-addons.yaml +++ b/src/content/internet-telewizja/tv-addons.yaml @@ -1,6 +1,7 @@ tytul: Pakiety premium opis: | - Rozbuduj telewizję o kanały premium i dodatkowe serwisy VOD. Dobierz pakiet filmowy, sportowy lub rozrywkowy — dokładnie pod to, co oglądasz. + Rozbuduj telewizję o kanały premium i dodatkowe serwisy VOD. + Dobierz pakiet filmowy, sportowy lub rozrywkowy — dokładnie pod to, co oglądasz. cena_opis: zł/mies. dodatki: diff --git a/src/islands/jambox/JamboxChannelsSearch.jsx b/src/islands/jambox/JamboxChannelsSearch.jsx index f12948c..872c8d9 100644 --- a/src/islands/jambox/JamboxChannelsSearch.jsx +++ b/src/islands/jambox/JamboxChannelsSearch.jsx @@ -424,7 +424,8 @@ export default function JamboxChannelsSearch() { type="button" class="f-chsearch-pkg" onClick={() => window.open( - `/premium#tid-${encodeURIComponent(p.tid)}`, + // `/premium#tid-${encodeURIComponent(p.tid)}`, + `/premium/${p.tid}`, "_blank", "noopener,noreferrer" )} diff --git a/src/islands/modals/sections/TvAddonsSection.jsx b/src/islands/modals/sections/TvAddonsSection.jsx index bd9290f..a9d4f1b 100644 --- a/src/islands/modals/sections/TvAddonsSection.jsx +++ b/src/islands/modals/sections/TvAddonsSection.jsx @@ -99,7 +99,8 @@ export default function TvAddonsSection({ {a.tid ? ( Number(a?.tid) === tid) + : null; + +if (!picked) { + return new Response("Nie znaleziono pakietu dla podanego tid.", { status: 404 }); +} + +// --- jeśli jest group => bierzemy całą grupę --- +const pickedGroup = String(picked?.group ?? "").trim(); + +let viewAddons: TvAddon[] = []; +if (pickedGroup) { + viewAddons = addons.filter((a) => String(a?.group ?? "").trim() === pickedGroup); +} else { + viewAddons = [picked]; +} + +// stabilne sortowanie (np. po tid, żeby HBO/Disney nie skakały) +viewAddons = viewAddons + .slice() + .sort((a, b) => Number(a?.tid ?? 0) - Number(b?.tid ?? 0)); + +// tytuł/description strony +const singleTitle = pickedGroup ? (pickedGroup.toUpperCase() || pageTitle) : (String(picked?.nazwa ?? "").trim() || pageTitle); +const singleDesc = pageDesc; +--- + + + + + + { + viewAddons.map((addon: TvAddon, index: number) => { + const isAboveFold = index === 0; + + const pkgName = String(addon?.nazwa ?? "").trim(); + const hasYamlImage = !!String(addon?.image ?? "").trim(); + const assumeHasMedia = pkgName ? true : hasYamlImage; + + const anchorId = addon?.tid != null ? `tid-${addon.tid}` : undefined; + + return ( +
+
+
+ {pkgName &&

{pkgName}

} + {addon?.opis && } +
+ +
+ {pkgName ? ( + + ) : null} +
+
+
+ ); + }) + } + + +
diff --git a/src/pages/premium/index.astro b/src/pages/premium/index.astro index 5f6a7b6..ec22ddb 100644 --- a/src/pages/premium/index.astro +++ b/src/pages/premium/index.astro @@ -37,6 +37,9 @@ const doc = yaml.load( const pageTitle = doc?.tytul ?? "Dodatkowe pakiety TV"; const pageDesc = doc?.opis ?? ""; const addons: TvAddon[] = Array.isArray(doc?.dodatki) ? doc.dodatki : []; + +// ustaw tu bazowy URL dla stron pakietów +const detailsBase = "/pakiety-premium"; // => /pakiety-premium/{tid} --- @@ -55,19 +58,20 @@ const addons: TvAddon[] = Array.isArray(doc?.dodatki) ? doc.dodatki : []; const pkgName = String(addon?.nazwa ?? "").trim(); const assumeHasMedia = pkgName ? true : hasYamlImage; - const anchorId = addon?.tid != null ? `tid-${addon.tid}` : undefined; + + // link do strony pakietu (jeśli jest tid) + const href = addon?.tid != null ? `${detailsBase}/${addon.tid}` : null; return ( -
+
{pkgName &&

{pkgName}

} + {addon?.opis && }
@@ -87,40 +91,4 @@ const addons: TvAddon[] = Array.isArray(doc?.dodatki) ? doc.dodatki : []; ); }) } - - - diff --git a/src/styles/navbar.css b/src/styles/navbar.css index 260780b..5893706 100644 --- a/src/styles/navbar.css +++ b/src/styles/navbar.css @@ -3,7 +3,7 @@ } .f-navbar-inner { - @apply max-w-7xl mx-auto flex items-center justify-between py-1 px-4; + @apply max-w-screen-2xl mx-auto flex items-center justify-between py-1 px-4; } .f-navbar-links { @@ -42,7 +42,7 @@ .f-navbar-logo { @apply block; - height: 60px; /* testowo: 44px / 40px jak chcesz ciaśniej */ + height: 60px; width: auto; }