Uwaga o cenach

This commit is contained in:
dm
2025-12-20 13:37:39 +01:00
parent a21d5f6ff1
commit 8ef6ebd1b1
2 changed files with 18 additions and 27 deletions

View File

@@ -15,17 +15,16 @@ type InternetCard = { nazwa: string; widoczny?: boolean; popularny?: boolean; pa
type InternetCardsYaml = {
tytul?: string;
opis?: string;
uwaga?: string;
waluta?: string;
cena_opis?: string;
cards?: InternetCard[];
};
// TELEFON YAML (twój format)
type PhoneParam = { klucz: string; label: string; value: string | number };
type PhoneCard = { nazwa: string; widoczny?: boolean; popularny?: boolean; cena?: { wartosc: number; opis?: string }; parametry?: PhoneParam[] };
type PhoneCardsYaml = { cards?: PhoneCard[] };
// ADDONS YAML (twój format)
type Addon = { id: string; nazwa: string; typ?: string; ilosc?: boolean; min?: number; max?: number; krok?: number; opis?: string; cena: number };
type AddonsYaml = { cena_opis?: string; dodatki?: Addon[] };
@@ -47,23 +46,23 @@ const addonsData = loadYamlFile<AddonsYaml>(
const tytul = data?.tytul ?? "";
const opis = data?.opis ?? "Wybierz rodzaj budynku i czas trwania umowy";
const uwaga = data?.uwaga ?? "";
const waluta = data?.waluta ?? "PLN";
const cenaOpis = data?.cena_opis ?? "zł/mies.";
const cards: InternetCard[] = Array.isArray(data?.cards)
const cards = (Array.isArray(data?.cards)
? data.cards.filter((c) => c?.widoczny === true)
: [];
: []) as InternetCard[];
const phoneCards: PhoneCard[] = Array.isArray(phoneData?.cards)
const phoneCards = (Array.isArray(phoneData?.cards)
? phoneData.cards.filter((c) => c?.widoczny === true)
: [];
: []) as PhoneCard[];
const addons: Addon[] = Array.isArray(addonsData?.dodatki)
const addons = (Array.isArray(addonsData?.dodatki)
? addonsData.dodatki
: [];
: []) as Addon[];
// jeśli chcesz, możesz nadpisać cenaOpis w modalu z addons.yaml:
const addonsCenaOpis = addonsData?.cena_opis ?? cenaOpis;
type SwitchOption = { id: string | number; nazwa: string };
@@ -80,9 +79,9 @@ const switchesData = loadYamlFile<SwitchesYaml>(
path.join(process.cwd(), "src", "content", "site", "switches.yaml"),
);
const switches: SwitchDef[] = Array.isArray(switchesData?.switches)
const switches = (Array.isArray(switchesData?.switches)
? switchesData.switches
: [];
: []) as SwitchDef[];
---
<DefaultLayout seo={seo}>
@@ -92,6 +91,7 @@ const switches: SwitchDef[] = Array.isArray(switchesData?.switches)
client:load
title={tytul}
description={opis}
uwaga={uwaga}
cards={cards}
waluta={waluta}
cenaOpis={cenaOpis}
@@ -101,7 +101,8 @@ const switches: SwitchDef[] = Array.isArray(switchesData?.switches)
switches={switches}
/>
</div>
<p><span class="f-card-price text-sm">* </span>{uwaga}</p>
</section>
<SectionRenderer src="./src/content/internet-swiatlowodowy/section.yaml" />
</DefaultLayout>
</DefaultLayout>