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,6 +101,7 @@ 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" />

View File

@@ -32,13 +32,13 @@ type Card = {
type CardsYaml = {
tytul?: string;
opis?: string;
uwaga?: string;
waluta?: string;
cena_opis?: string;
internet_parametry_wspolne?: Param[];
cards?: Card[];
};
// ✅ telefon z YAML (do modala)
type PhoneParam = { klucz: string; label: string; value: string | number };
type PhoneCard = {
id?: string;
@@ -52,7 +52,6 @@ type PhoneYaml = { cards?: PhoneCard[] };
type Decoder = { id: string; nazwa: string; opis: string; cena: number };
// ✅ dodatki z YAML (do modala)
type Addon = {
id: string;
nazwa: string;
@@ -72,17 +71,6 @@ type AddonsYaml = {
dodatki?: Addon[];
};
// type ChannelsYaml = {
// title?: string;
// updated_at?: string;
// channels?: Array<{
// nazwa: string;
// opis?: string;
// image?: string;
// pakiety?: string[];
// }>;
// };
const seo = loadYamlFile<SeoYaml>(
path.join(process.cwd(), "src", "content", "internet-telewizja", "seo.yaml"),
);
@@ -99,6 +87,7 @@ const data = loadYamlFile<CardsYaml>(
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.";
@@ -111,7 +100,6 @@ const cards: Card[] = Array.isArray(data?.cards)
? data.cards.filter((c) => c?.widoczny === true)
: [];
// ✅ NOWE: dane do modala dodatków (bez ruszania reszty)
const phoneYaml = loadYamlFile<PhoneYaml>(
path.join(process.cwd(), "src", "content", "telefon", "cards.yaml"),
);
@@ -169,6 +157,7 @@ const switches: SwitchDef[] = Array.isArray(switchesYaml?.switches)
client:load
title={tytul}
description={opis}
uwaga={uwaga}
cards={cards}
internetWspolne={internetWspolne}
waluta={waluta}
@@ -180,6 +169,7 @@ const switches: SwitchDef[] = Array.isArray(switchesYaml?.switches)
addonsCenaOpis={addonsCenaOpis}
switches={switches}
/>
<p><span class="f-card-price text-sm">* </span>{uwaga}</p>
</div>
</section>
<SectionChannelsSearch />