Dokumenty - wyrównywanie tytułow.
This commit is contained in:
@@ -10,8 +10,19 @@ import { loadYamlFile } from "../../lib/loadYaml";
|
||||
type SeoYaml = any;
|
||||
|
||||
type InternetParam = { klucz: string; label: string; value: string | number };
|
||||
type InternetCena = { budynek: number | string; umowa: number | string; miesiecznie: number; aktywacja?: number };
|
||||
type InternetCard = { nazwa: string; widoczny?: boolean; popularny?: boolean; parametry?: InternetParam[]; ceny?: InternetCena[] };
|
||||
type InternetCena = {
|
||||
budynek: number | string;
|
||||
umowa: number | string;
|
||||
miesiecznie: number;
|
||||
aktywacja?: number;
|
||||
};
|
||||
type InternetCard = {
|
||||
nazwa: string;
|
||||
widoczny?: boolean;
|
||||
popularny?: boolean;
|
||||
parametry?: InternetParam[];
|
||||
ceny?: InternetCena[];
|
||||
};
|
||||
type InternetCardsYaml = {
|
||||
tytul?: string;
|
||||
opis?: string;
|
||||
@@ -22,18 +33,46 @@ type InternetCardsYaml = {
|
||||
};
|
||||
|
||||
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 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[] };
|
||||
|
||||
const seo = loadYamlFile<SeoYaml>(
|
||||
path.join(process.cwd(), "src", "content", "internet-swiatlowodowy", "seo.yaml"),
|
||||
path.join(
|
||||
process.cwd(),
|
||||
"src",
|
||||
"content",
|
||||
"internet-swiatlowodowy",
|
||||
"seo.yaml",
|
||||
),
|
||||
);
|
||||
|
||||
const data = loadYamlFile<InternetCardsYaml>(
|
||||
path.join(process.cwd(), "src", "content", "internet-swiatlowodowy", "cards.yaml"),
|
||||
path.join(
|
||||
process.cwd(),
|
||||
"src",
|
||||
"content",
|
||||
"internet-swiatlowodowy",
|
||||
"cards.yaml",
|
||||
),
|
||||
);
|
||||
|
||||
const phoneData = loadYamlFile<PhoneCardsYaml>(
|
||||
@@ -41,7 +80,13 @@ const phoneData = loadYamlFile<PhoneCardsYaml>(
|
||||
);
|
||||
|
||||
const addonsData = loadYamlFile<AddonsYaml>(
|
||||
path.join(process.cwd(), "src", "content", "internet-swiatlowodowy", "addons.yaml"),
|
||||
path.join(
|
||||
process.cwd(),
|
||||
"src",
|
||||
"content",
|
||||
"internet-swiatlowodowy",
|
||||
"addons.yaml",
|
||||
),
|
||||
);
|
||||
|
||||
const tytul = data?.tytul ?? "";
|
||||
@@ -51,17 +96,21 @@ const uwaga = data?.uwaga ?? "";
|
||||
const waluta = data?.waluta ?? "PLN";
|
||||
const cenaOpis = data?.cena_opis ?? "zł/mies.";
|
||||
|
||||
const cards = (Array.isArray(data?.cards)
|
||||
? data.cards.filter((c) => c?.widoczny === true)
|
||||
: []) as InternetCard[];
|
||||
const cards = (
|
||||
Array.isArray(data?.cards)
|
||||
? data.cards.filter((c) => c?.widoczny === true)
|
||||
: []
|
||||
) as InternetCard[];
|
||||
|
||||
const phoneCards = (Array.isArray(phoneData?.cards)
|
||||
? phoneData.cards.filter((c) => c?.widoczny === true)
|
||||
: []) as PhoneCard[];
|
||||
const phoneCards = (
|
||||
Array.isArray(phoneData?.cards)
|
||||
? phoneData.cards.filter((c) => c?.widoczny === true)
|
||||
: []
|
||||
) as PhoneCard[];
|
||||
|
||||
const addons = (Array.isArray(addonsData?.dodatki)
|
||||
? addonsData.dodatki
|
||||
: []) as Addon[];
|
||||
const addons = (
|
||||
Array.isArray(addonsData?.dodatki) ? addonsData.dodatki : []
|
||||
) as Addon[];
|
||||
|
||||
const addonsCenaOpis = addonsData?.cena_opis ?? cenaOpis;
|
||||
|
||||
@@ -79,9 +128,9 @@ const switchesData = loadYamlFile<SwitchesYaml>(
|
||||
path.join(process.cwd(), "src", "content", "site", "switches.yaml"),
|
||||
);
|
||||
|
||||
const switches = (Array.isArray(switchesData?.switches)
|
||||
? switchesData.switches
|
||||
: []) as SwitchDef[];
|
||||
const switches = (
|
||||
Array.isArray(switchesData?.switches) ? switchesData.switches : []
|
||||
) as SwitchDef[];
|
||||
---
|
||||
|
||||
<DefaultLayout seo={seo}>
|
||||
@@ -100,9 +149,9 @@ const switches = (Array.isArray(switchesData?.switches)
|
||||
addonsCenaOpis={addonsCenaOpis}
|
||||
switches={switches}
|
||||
/>
|
||||
<p><span class="f-card-price text-sm">* </span>{uwaga}</p>
|
||||
</div>
|
||||
<p><span class="f-card-price text-sm">* </span>{uwaga}</p>
|
||||
</section>
|
||||
|
||||
<SectionRenderer src="./src/content/internet-swiatlowodowy/section.yaml" />
|
||||
</DefaultLayout>
|
||||
</DefaultLayout>
|
||||
|
||||
Reference in New Issue
Block a user