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

View File

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