Dodanie grupy dla kanałow tematycznych. Porządki w theme.css
This commit is contained in:
@@ -17,10 +17,8 @@ export default function InternetAddonsModal({
|
||||
isOpen,
|
||||
onClose,
|
||||
plan,
|
||||
|
||||
phoneCards = [],
|
||||
addons = [],
|
||||
|
||||
cenaOpis = "zł / mies.",
|
||||
}) {
|
||||
const phonePlans = useMemo(() => mapPhoneYamlToPlans(phoneCards), [phoneCards]);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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>
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user