Skip to content

Commit 1fb9fc2

Browse files
committed
updates
1 parent a7203ca commit 1fb9fc2

15 files changed

Lines changed: 1425 additions & 117 deletions

angular.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444
},
4545
{
4646
"type": "anyComponentStyle",
47-
"maximumWarning": "4kB",
48-
"maximumError": "8kB"
47+
"maximumWarning": "10kB",
48+
"maximumError": "10kB"
4949
}
5050
],
5151
"outputHashing": "all",

proxy.conf.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,13 @@
33
"target": "http://localhost:5264",
44
"secure": false,
55
"changeOrigin": true
6+
},
7+
"/radio-browser": {
8+
"target": "https://de1.api.radio-browser.info",
9+
"secure": true,
10+
"changeOrigin": true,
11+
"pathRewrite": {
12+
"^/radio-browser": ""
13+
}
614
}
715
}

src/app/app.component.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
<h1 class="site-title">lucent.earth</h1>
22
<app-globe-view
3-
[sidebarOpen]="selectedStream !== null"
3+
[sidebarOpen]="sidebarOpen"
44
[sidebarInsetSnap]="sidebarPanelResizing"
55
[selectedStream]="selectedStream"
6+
[selectedRadio]="selectedRadio"
67
[initialStreamQuery]="initialStreamQuery"
8+
[initialRadioQuery]="initialRadioQuery"
79
(streamSelected)="onStreamSelected($event)"
10+
(radioSelected)="onRadioSelected($event)"
811
/>
9-
@if (selectedStream) {
12+
@if (sidebarOpen) {
1013
<app-stream-sidebar
1114
[stream]="selectedStream"
15+
[radioSelection]="selectedRadio"
1216
(closing)="onSidebarClosing()"
1317
(closed)="onSidebarClosed()"
1418
(resizeActiveChange)="sidebarPanelResizing = $event"

src/app/app.component.ts

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Component, HostBinding, OnInit } from '@angular/core';
22
import { GlobeViewComponent } from './globe-view/globe-view.component';
3+
import type { GlobeRadioSelection } from './radio.models';
34
import type { GlobeStreamPoint } from './stream.models';
45
import { StreamSidebarComponent } from './stream-sidebar/stream-sidebar.component';
56

@@ -11,24 +12,39 @@ import { StreamSidebarComponent } from './stream-sidebar/stream-sidebar.componen
1112
})
1213
export class AppComponent implements OnInit {
1314
selectedStream: GlobeStreamPoint | null = null;
15+
selectedRadio: GlobeRadioSelection | null = null;
1416
/** True while dragging the sidebar width — globe width must not ease */
1517
sidebarPanelResizing = false;
1618
/** Pixels reserved on the right for the fixed sidebar; drives globe host width */
1719
@HostBinding('style.--sidebar-inset.px')
1820
sidebarInsetPx = 0;
1921
/** From `?stream=` on first load; globe selects + focuses after streams load */
2022
initialStreamQuery: string | null = null;
23+
initialRadioQuery: string | null = null;
24+
25+
get sidebarOpen(): boolean {
26+
return this.selectedStream !== null || this.selectedRadio !== null;
27+
}
2128

2229
ngOnInit(): void {
2330
if (typeof window === 'undefined') return;
24-
const raw = new URL(window.location.href).searchParams.get('stream');
25-
this.initialStreamQuery = raw?.trim() ? raw.trim() : null;
31+
const u = new URL(window.location.href);
32+
const rawStream = u.searchParams.get('stream');
33+
const rawRadio = u.searchParams.get('radio');
34+
this.initialStreamQuery = rawStream?.trim() ? rawStream.trim() : null;
35+
this.initialRadioQuery = rawRadio?.trim() ? rawRadio.trim() : null;
2636
}
2737

2838
onStreamSelected(stream: GlobeStreamPoint): void {
2939
this.selectedStream = stream;
3040
this.sidebarInsetPx = 640;
31-
this.syncStreamQueryParam();
41+
this.syncUrlQueryParams();
42+
}
43+
44+
onRadioSelected(sel: GlobeRadioSelection): void {
45+
this.selectedRadio = sel;
46+
this.sidebarInsetPx = 640;
47+
this.syncUrlQueryParams();
3248
}
3349

3450
/** Start of close animation: globe expands while panel slides off */
@@ -38,21 +54,27 @@ export class AppComponent implements OnInit {
3854

3955
onSidebarClosed(): void {
4056
this.selectedStream = null;
41-
this.syncStreamQueryParam();
57+
this.selectedRadio = null;
58+
this.syncUrlQueryParams();
4259
}
4360

4461
onSidebarLayoutWidth(px: number): void {
4562
this.sidebarInsetPx = Math.max(0, Math.round(px));
4663
}
4764

48-
private syncStreamQueryParam(): void {
65+
private syncUrlQueryParams(): void {
4966
if (typeof window === 'undefined') return;
5067
const u = new URL(window.location.href);
5168
if (this.selectedStream?.channelLogin) {
5269
u.searchParams.set('stream', this.selectedStream.channelLogin);
5370
} else {
5471
u.searchParams.delete('stream');
5572
}
73+
if (this.selectedRadio?.station.stationuuid) {
74+
u.searchParams.set('radio', this.selectedRadio.station.stationuuid);
75+
} else {
76+
u.searchParams.delete('radio');
77+
}
5678
window.history.replaceState(window.history.state, '', u.toString());
5779
}
5880
}

src/app/globe-map.models.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import type { GlobeRadioPoint } from './radio.models';
2+
import type { GlobeStreamPoint } from './stream.models';
3+
4+
export type GlobeMapPoint = GlobeStreamPoint | GlobeRadioPoint;
5+
6+
export function isGlobeRadioPoint(p: GlobeMapPoint): p is GlobeRadioPoint {
7+
return p.kind === 'radio';
8+
}
9+
10+
export function isGlobeStreamMapPoint(p: GlobeMapPoint): p is GlobeStreamPoint {
11+
return p.kind === 'stream';
12+
}
13+
14+
export function mapPointMarkerId(p: GlobeMapPoint): string {
15+
return isGlobeRadioPoint(p) ? p.markerId : p.channelLogin;
16+
}

0 commit comments

Comments
 (0)