New programming screen
This commit is contained in:
1 parent
96d0fef792
commit
e627fe3637
24 files changed
+1297
-122
No files matched your search
@@ -12,31 +12,47 @@
|
||||
@if (schedule$ | async; as state) {
|
||||
@if (state.loading) {
|
||||
<div class="schedule-loading">Loading schedule…</div>
|
||||
} @else if (state.dayGroups.length === 0) {
|
||||
<div class="schedule-empty">No programs scheduled. Check back soon!</div>
|
||||
} @else if (state.shows.length === 0) {
|
||||
<div class="schedule-empty">No shows scheduled. Check back soon!</div>
|
||||
} @else {
|
||||
@for (group of state.dayGroups; track group.day_label) {
|
||||
<div class="schedule-day-block">
|
||||
<div class="schedule-day-label">{{ group.day_label }}</div>
|
||||
<div class="schedule-table">
|
||||
@for (program of group.programs; track program.id) {
|
||||
<div class="schedule-row">
|
||||
<div class="schedule-time">{{ program.time }}</div>
|
||||
<div class="schedule-divider"></div>
|
||||
<div class="schedule-details">
|
||||
<h4 class="schedule-title">{{ program.title }}</h4>
|
||||
<div class="schedule-meta">
|
||||
<span class="schedule-host">
|
||||
<span aria-hidden="true">🎙</span> {{ program.host }}
|
||||
<div class="show-list">
|
||||
@for (show of state.shows; track show.id) {
|
||||
<article class="show-card">
|
||||
<!-- Left: Show art badge -->
|
||||
<div class="show-card-art">
|
||||
@if (show.show_art_url) {
|
||||
<img [src]="show.show_art_url" [alt]="show.title + ' art'" class="show-art-img" />
|
||||
} @else {
|
||||
<div class="show-art-placeholder">
|
||||
<span aria-hidden="true">🎵</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<!-- Right: Hero-backed info area -->
|
||||
<div class="show-card-right" [class.has-hero]="show.hero_image_url" [style.background-image]="show.hero_image_url ? 'url(' + show.hero_image_url + ')' : ''">
|
||||
<div class="show-card-overlay"></div>
|
||||
<div class="show-card-info">
|
||||
<h3 class="show-title">{{ show.title }}</h3>
|
||||
<p class="show-description">{{ show.description }}</p>
|
||||
<div class="show-meta">
|
||||
<span class="show-host">
|
||||
<span aria-hidden="true">🎙</span> {{ show.host }}
|
||||
</span>
|
||||
<span class="show-genre">{{ show.genre }}</span>
|
||||
</div>
|
||||
<div class="show-schedule-slots">
|
||||
@for (slot of show.schedules | sortSchedules; track slot.id) {
|
||||
<span class="slot-tag">
|
||||
{{ slot.day_label }} {{ slot.time }}
|
||||
</span>
|
||||
<span class="schedule-genre">{{ program.genre }}</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</article>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -26,89 +26,210 @@
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
.schedule-day-block {
|
||||
max-width: 800px;
|
||||
margin: 0 auto $spacing-xl;
|
||||
}
|
||||
// ── Show list (vertical stack) ─────────────────────────────
|
||||
|
||||
.schedule-day-label {
|
||||
text-align: center;
|
||||
font-family: var(--font-heading);
|
||||
font-size: 1.2rem;
|
||||
color: var(--color-primary);
|
||||
margin-bottom: $spacing-md;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.schedule-table {
|
||||
.show-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0;
|
||||
gap: $spacing-lg;
|
||||
}
|
||||
|
||||
.schedule-row {
|
||||
// ── Horizontal show card ───────────────────────────────────
|
||||
|
||||
.show-card {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: stretch;
|
||||
padding: $spacing-md 0;
|
||||
border-bottom: 1px solid var(--color-light);
|
||||
transition: background $transition-fast;
|
||||
border-radius: $radius-lg;
|
||||
overflow: hidden;
|
||||
box-shadow: $shadow-md;
|
||||
transition: transform $transition-normal, box-shadow $transition-normal;
|
||||
min-height: 180px;
|
||||
|
||||
&:hover {
|
||||
background: var(--color-cream);
|
||||
transform: translateY(-2px);
|
||||
box-shadow: $shadow-lg;
|
||||
}
|
||||
}
|
||||
|
||||
.schedule-time {
|
||||
width: 100px;
|
||||
// ── Left: Show art badge (square) ──────────────────────────
|
||||
|
||||
.show-card-art {
|
||||
flex-shrink: 0;
|
||||
font-family: var(--font-mono);
|
||||
font-size: 0.95rem;
|
||||
color: var(--color-accent);
|
||||
font-weight: 600;
|
||||
padding-right: $spacing-md;
|
||||
text-align: right;
|
||||
padding-top: 2px;
|
||||
}
|
||||
|
||||
.schedule-divider {
|
||||
width: 2px;
|
||||
background: var(--color-accent-muted);
|
||||
margin: 0 $spacing-sm;
|
||||
border-radius: 1px;
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
.schedule-details {
|
||||
flex: 1;
|
||||
padding: $spacing-xs 0;
|
||||
}
|
||||
|
||||
.schedule-title {
|
||||
font-size: 1.05rem;
|
||||
color: var(--color-primary);
|
||||
margin-bottom: $spacing-xs;
|
||||
}
|
||||
|
||||
.schedule-meta {
|
||||
width: 140px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: var(--color-primary-dark);
|
||||
padding: $spacing-md;
|
||||
|
||||
.show-art-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
border-radius: $radius-md;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.show-art-placeholder {
|
||||
width: 100%;
|
||||
aspect-ratio: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgba(255, 255, 255, 0.12);
|
||||
border-radius: $radius-md;
|
||||
font-size: 3rem;
|
||||
color: var(--color-accent);
|
||||
}
|
||||
}
|
||||
|
||||
// ── Right: Hero-backed info panel ──────────────────────────
|
||||
|
||||
.show-card-right {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
background-color: var(--color-light);
|
||||
|
||||
&.has-hero {
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
}
|
||||
}
|
||||
|
||||
.show-card-overlay {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: linear-gradient(
|
||||
to right,
|
||||
rgba(26, 36, 50, 0.95) 0%,
|
||||
rgba(26, 36, 50, 0.85) 60%,
|
||||
rgba(26, 36, 50, 0.7) 100%
|
||||
);
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.show-card-info {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
padding: $spacing-lg $spacing-xl;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
// ── Show title ─────────────────────────────────────────────
|
||||
|
||||
.show-title {
|
||||
font-family: var(--font-heading);
|
||||
font-size: 1.4rem;
|
||||
color: var(--color-white);
|
||||
margin: 0 0 $spacing-sm;
|
||||
line-height: 1.25;
|
||||
}
|
||||
|
||||
// ── Show description (line-clamped) ────────────────────────
|
||||
|
||||
.show-description {
|
||||
font-size: 0.95rem;
|
||||
color: rgba(255, 255, 255, 0.82);
|
||||
margin: 0 0 $spacing-md;
|
||||
line-height: 1.5;
|
||||
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 3;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
// ── Meta row (host + genre) ────────────────────────────────
|
||||
|
||||
.show-meta {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: $spacing-md;
|
||||
font-size: 0.85rem;
|
||||
color: var(--color-medium);
|
||||
margin-bottom: $spacing-md;
|
||||
|
||||
.schedule-host {
|
||||
.show-host {
|
||||
color: var(--color-accent);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.schedule-genre {
|
||||
background: var(--color-light);
|
||||
padding: 2px 10px;
|
||||
.show-genre {
|
||||
background: rgba(255, 255, 255, 0.15);
|
||||
padding: 3px 12px;
|
||||
border-radius: 10px;
|
||||
color: rgba(255, 255, 255, 0.88);
|
||||
font-style: italic;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: #{$bp-md - 1px}) {
|
||||
.schedule-time { width: 80px; font-size: 0.85rem; }
|
||||
// ── Schedule slot tags ─────────────────────────────────────
|
||||
|
||||
.show-schedule-slots {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.slot-tag {
|
||||
display: inline-block;
|
||||
background: rgba(255, 255, 255, 0.16);
|
||||
color: var(--color-white);
|
||||
font-size: 0.78rem;
|
||||
font-family: var(--font-mono);
|
||||
padding: 4px 12px;
|
||||
border-radius: 12px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.12);
|
||||
white-space: nowrap;
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
|
||||
// ── Responsive ─────────────────────────────────────────────
|
||||
|
||||
@include responsive(md) {
|
||||
.show-card-art {
|
||||
width: 110px;
|
||||
padding: $spacing-sm;
|
||||
}
|
||||
|
||||
.show-card-info {
|
||||
padding: $spacing-md $spacing-lg;
|
||||
}
|
||||
|
||||
.show-title {
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
|
||||
.show-description {
|
||||
-webkit-line-clamp: 2;
|
||||
font-size: 0.88rem;
|
||||
}
|
||||
}
|
||||
|
||||
@include responsive(sm) {
|
||||
.show-card {
|
||||
flex-direction: column;
|
||||
min-height: auto;
|
||||
}
|
||||
|
||||
.show-card-art {
|
||||
width: 100%;
|
||||
aspect-ratio: 16 / 9;
|
||||
padding: $spacing-md;
|
||||
}
|
||||
|
||||
.show-card-info {
|
||||
padding: $spacing-md $spacing-lg $spacing-lg;
|
||||
}
|
||||
|
||||
.show-description {
|
||||
-webkit-line-clamp: 2;
|
||||
}
|
||||
}
|
||||
@@ -1,55 +1,32 @@
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { AsyncPipe, NgFor } from '@angular/common';
|
||||
import { AsyncPipe } from '@angular/common';
|
||||
import { map, Observable, startWith } from 'rxjs';
|
||||
|
||||
import { ProgramService } from '../services/program.service';
|
||||
import { Program } from '../interfaces/program';
|
||||
import { ShowService } from '../services/show.service';
|
||||
import { Show } from '../interfaces/show';
|
||||
import { StationConfigService } from '../services/station-config.service';
|
||||
|
||||
interface DayGroup {
|
||||
day_label: string;
|
||||
day_of_week: number;
|
||||
programs: Program[];
|
||||
}
|
||||
import { SortSchedulesPipe } from '../pipes/sort-schedules.pipe';
|
||||
|
||||
interface ScheduleState {
|
||||
loading: boolean;
|
||||
dayGroups: DayGroup[];
|
||||
}
|
||||
|
||||
function groupByDay(programs: Program[]): DayGroup[] {
|
||||
const map = new Map<string, DayGroup>();
|
||||
|
||||
for (const p of programs) {
|
||||
if (!map.has(p.day_label)) {
|
||||
map.set(p.day_label, {
|
||||
day_label: p.day_label,
|
||||
day_of_week: p.day_of_week,
|
||||
programs: [],
|
||||
});
|
||||
}
|
||||
map.get(p.day_label)!.programs.push(p);
|
||||
}
|
||||
|
||||
return Array.from(map.values()).sort((a, b) => a.day_of_week - b.day_of_week);
|
||||
shows: Show[];
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-schedule',
|
||||
standalone: true,
|
||||
imports: [AsyncPipe],
|
||||
imports: [AsyncPipe, SortSchedulesPipe],
|
||||
templateUrl: './schedule.component.html',
|
||||
styleUrl: './schedule.component.scss',
|
||||
})
|
||||
export class ScheduleComponent {
|
||||
private programService = inject(ProgramService);
|
||||
private showService = inject(ShowService);
|
||||
readonly config = inject(StationConfigService).config;
|
||||
|
||||
/** Async pipe drives the template — guarantees change detection on every emission. */
|
||||
readonly schedule$: Observable<ScheduleState> =
|
||||
this.programService.getPrograms().pipe(
|
||||
map((programs) => groupByDay(programs)),
|
||||
map((dayGroups) => ({ loading: false, dayGroups })),
|
||||
startWith({ loading: true, dayGroups: [] }),
|
||||
this.showService.getShows().pipe(
|
||||
map((shows) => ({ loading: false, shows })),
|
||||
startWith({ loading: true, shows: [] }),
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user