feat(shcedule): add predefined schedule sport group

This commit is contained in:
2026-09-07 23:39:34 +03:00
parent 5db61da32b
commit 1835935eaf
11 changed files with 159 additions and 107 deletions
+6 -4
View File
@@ -57,8 +57,9 @@ export class ScheduleChannelElement extends HTMLElement {
}
export class ScheduleChannelGroupElement extends HTMLElement {
static observedAttributes = ["channels"];
static observedAttributes = ["group", "channels"];
group: string | null = null;
channels: Channel[] | null = null;
constructor() {
@@ -67,12 +68,13 @@ export class ScheduleChannelGroupElement extends HTMLElement {
connectedCallback() {
this.channels = JSON.parse(this.getAttribute("channels") || "[]");
const ids = this.channels?.map((item) => `${item.provider}:${item.id}`).join("+");
this.group = this.getAttribute("group");
const groupId = this.channels?.map((item) => `${item.provider}:${item.id}`).join(",") || this.group || "n/a";
this.innerHTML = `
<a href="group?ids=${ids}"
<a href="group/${encodeURIComponent(groupId)}"
class="d-flex justify-content-between align-items-start text-decoration-none">
<span>
<span class="text-primary">Open All</span>
<span class="text-primary">${this.group || "Open All"}</span>
</span>
</a>`;
this.classList = "list-group-item list-group-item-action";
+5 -3
View File
@@ -14,9 +14,11 @@ export class ScheduleChannelManager {
element.setAttribute("removable", "");
container.appendChild(element);
}
const groupElement = new ScheduleChannelGroupElement();
groupElement.setAttribute("channels", JSON.stringify(channels));
container.append(groupElement);
if (channels.length > 0) {
const groupElement = new ScheduleChannelGroupElement();
groupElement.setAttribute("channels", JSON.stringify(channels));
container.append(groupElement);
}
}
}
}