Dodanie grupy dla kanałow tematycznych. Porządki w theme.css

This commit is contained in:
dm
2025-12-17 15:45:19 +01:00
parent 345fa23f84
commit 0203e95cfc
7 changed files with 252 additions and 207 deletions

View File

@@ -17,10 +17,8 @@ export default function InternetAddonsModal({
isOpen,
onClose,
plan,
phoneCards = [],
addons = [],
cenaOpis = "zł / mies.",
}) {
const phonePlans = useMemo(() => mapPhoneYamlToPlans(phoneCards), [phoneCards]);

View File

@@ -8,7 +8,7 @@ function formatMoney(amount, currency = "PLN") {
if (typeof amount !== "number" || Number.isNaN(amount)) return "";
try {
return new Intl.NumberFormat("pl-PL", {
style: "currency",
style: "",
currency,
maximumFractionDigits: 0,
}).format(amount);

View File

@@ -14,10 +14,26 @@ export default function TvAddonsSection({
setTvTerm,
tvAddonsPrice,
}) {
const toggleCheckboxAddon = (id) => {
const toggleCheckboxAddon = (addon) => {
setSelectedQty((prev) => {
const next = { ...prev };
next[id] = (next[id] || 0) > 0 ? 0 : 1;
const isOn = (next[addon.id] || 0) > 0;
const willTurnOn = !isOn;
// ✅ jeśli grupa "single" i włączamy -> wyłącz inne z tej grupy
if (willTurnOn && addon.group && addon.group_mode === "single") {
for (const a of tvAddonsVisible) {
if (a.id !== addon.id && a.group === addon.group) {
next[a.id] = 0;
}
}
}
// toggle bieżącego
next[addon.id] = willTurnOn ? 1 : 0;
return next;
});
};
@@ -37,66 +53,66 @@ export default function TvAddonsSection({
if (!isQty) {
return (
<label class="f-addon-item f-addon-item--tv" key={"tv-" + a.id}>
<div class="f-addon-checkbox">
<input
type="checkbox"
checked={qty > 0}
onChange={() => toggleCheckboxAddon(a.id)}
/>
</div>
<label class="f-addon-item f-addon-item--tv" key={"tv-" + a.id}>
<div class="f-addon-checkbox">
<input
type="checkbox"
checked={qty > 0}
onChange={() => toggleCheckboxAddon(a)}
/>
</div>
<div class="f-addon-main">
<div class="f-addon-name">{a.nazwa}</div>
<div class="f-addon-main">
<div class="f-addon-name">{a.nazwa}</div>
{termPricing && (
<div class="mt-2 flex flex-wrap gap-3 text-sm" onClick={(e) => e.stopPropagation()}>
<label class="inline-flex items-center gap-2">
<input
type="radio"
name={`term-${a.id}`}
checked={(tvTerm[a.id] || "12m") === "12m"}
onChange={() => setTvTerm((p) => ({ ...p, [a.id]: "12m" }))}
/>
<span>12 miesięcy</span>
{termPricing && (
<div class="mt-2 flex flex-wrap gap-3 text-sm" onClick={(e) => e.stopPropagation()}>
<label class="inline-flex items-center gap-2">
<input
type="radio"
name={`term-${a.id}`}
checked={(tvTerm[a.id] || "12m") === "12m"}
onChange={() => setTvTerm((p) => ({ ...p, [a.id]: "12m" }))}
/>
<span>12 miesięcy</span>
</label>
<label class="inline-flex items-center gap-2">
<input
type="radio"
name={`term-${a.id}`}
checked={(tvTerm[a.id] || "12m") === "bezterminowo"}
onChange={() => setTvTerm((p) => ({ ...p, [a.id]: "bezterminowo" }))}
/>
<span>Bezterminowo</span>
</label>
</div>
)}
</div>
<div class="f-addon-price">{money(unit)} {cenaOpis}</div>
{/* ✅ osobny wiersz na pełną szerokość */}
{(a.tid || a.opis) && (
<div class="f-addon-below" onClick={(e) => e.stopPropagation()}>
{a.tid ? (
<a
class="f-addon-more"
href={`/internet-telewizja/pakiety-tematyczne#tid-${encodeURIComponent(a.tid)}`}
target="_blank"
rel="noopener noreferrer"
aria-label={`Więcej informacji o pakiecie ${a.nazwa ?? ""} (otwiera się w nowej karcie)`}
title={`Więcej o pakiecie ${a.nazwa ?? ""}`}
>
Przejdź do szczegółowych informacji pakietu {a.nazwa ?? ""}
</a>
) : (
a.opis ? <div class="f-addon-desc">{a.opis}</div> : null
)}
</div>
)}
</label>
<label class="inline-flex items-center gap-2">
<input
type="radio"
name={`term-${a.id}`}
checked={(tvTerm[a.id] || "12m") === "bezterminowo"}
onChange={() => setTvTerm((p) => ({ ...p, [a.id]: "bezterminowo" }))}
/>
<span>Bezterminowo</span>
</label>
</div>
)}
</div>
<div class="f-addon-price">{money(unit)} {cenaOpis}</div>
{/* ✅ osobny wiersz na pełną szerokość */}
{(a.tid || a.opis) && (
<div class="f-addon-below" onClick={(e) => e.stopPropagation()}>
{a.tid ? (
<a
class="f-addon-more"
href={`/internet-telewizja/pakiety-tematyczne#tid-${encodeURIComponent(a.tid)}`}
target="_blank"
rel="noopener noreferrer"
aria-label={`Więcej informacji o pakiecie ${a.nazwa ?? ""} (otwiera się w nowej karcie)`}
title={`Więcej o pakiecie ${a.nazwa ?? ""}`}
>
Przejdź do szczegółowych informacji pakietu {a.nazwa ?? ""}
</a>
) : (
a.opis ? <div class="f-addon-desc">{a.opis}</div> : null
)}
</div>
)}
</label>
);
}