Skip to content

Commit e0b546b

Browse files
committed
Merge branch 'develop' into chore/normalize-colors
* develop: feat: add show description to show detail page (#152) (#153) fix: html decode show hosts on home (#147) (#148)
2 parents edec232 + 0adcb19 commit e0b546b

7 files changed

Lines changed: 79 additions & 24 deletions

File tree

__tests__/SchedulePage.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ describe('SchedulePage', () => {
2727
expect(screen.getByText('Archives')).toBeTruthy();
2828
expect(screen.getByText('88.1 FM')).toBeTruthy();
2929
expect(screen.getByText(/archived episode/)).toBeTruthy();
30+
expect(screen.getByText('post music for post people.')).toBeTruthy();
3031
});
3132

3233
test('navigates to ArchivedShowView when tapping an archive in ShowDetails', async () => {

package-lock.json

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"@react-navigation/bottom-tabs": "^7.4.9",
1919
"@react-navigation/native": "^7.1.18",
2020
"@react-navigation/native-stack": "^7.3.28",
21+
"he": "^1.2.0",
2122
"react": "19.1.0",
2223
"react-native": "0.80.1",
2324
"react-native-gesture-handler": "^2.28.0",
@@ -43,6 +44,7 @@
4344
"@react-native/metro-config": "0.80.1",
4445
"@react-native/typescript-config": "0.80.1",
4546
"@testing-library/react-native": "^13.3.0",
47+
"@types/he": "^1.2.3",
4648
"@types/jest": "^29.5.13",
4749
"@types/react": "^19.1.0",
4850
"@types/react-native-vector-icons": "^6.4.18",

src/app/Home/index.tsx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { useEffect, useState, useMemo, useCallback } from 'react';
2+
import he from 'he';
23
import { debugError } from '@utils/Debug';
34
import {
45
View,
@@ -35,6 +36,7 @@ import { COLORS, CORE_COLORS } from '@utils/Colors';
3536
import { formatArchiveDate } from '@utils/DateTime';
3637

3738
import HomeNowPlaying from './HomeNowPlaying';
39+
import { ScheduleService } from '@services/ScheduleService';
3840

3941
const streamUrl = 'https://wmbr.org:8002/hi';
4042

@@ -56,6 +58,8 @@ export default function HomeScreen() {
5658
liveStreamUrl: streamUrl,
5759
});
5860

61+
const scheduleService = ScheduleService.getInstance();
62+
5963
const isPlaying = playbackState?.state === State.Playing;
6064

6165
const navigation =
@@ -99,7 +103,7 @@ export default function HomeScreen() {
99103
const unsubscribeMetadata = metadataService.subscribe((data: ShowInfo) => {
100104
setShowInfo(data);
101105
setCurrentShow(data.showTitle);
102-
setHosts(data.hosts);
106+
setHosts(he.decode(data.hosts || ''));
103107
setShowDescription(data.description);
104108

105109
try {
@@ -240,25 +244,32 @@ export default function HomeScreen() {
240244
await TrackPlayer.seekTo(newPosition);
241245
}, [progress.position, progress.duration]);
242246

243-
const handleOpenShowDetails = useCallback(() => {
247+
const handleOpenShowDetails = useCallback(async () => {
244248
const show = archiveState.currentShow;
245249
if (!show) return;
246250

251+
const scheduleShow = await scheduleService.getShowById(show.id);
252+
247253
// Navigate to Schedule tab with complete stack state
248254
navigation.navigate('Schedule' as WmbrRouteName, {
249255
// Specify the complete stack path
250256
state: {
251257
routes: [
252258
{ name: 'ScheduleMain' },
253-
{ name: 'ShowDetails', params: { show } },
259+
{ name: 'ShowDetails', params: { show, scheduleShow } },
254260
{
255261
name: 'ArchivedShowView',
256262
params: { show, archive: archiveState.currentArchive },
257263
},
258264
],
259265
},
260266
});
261-
}, [archiveState.currentShow, archiveState.currentArchive, navigation]);
267+
}, [
268+
archiveState.currentShow,
269+
archiveState.currentArchive,
270+
scheduleService,
271+
navigation,
272+
]);
262273

263274
if (showSplash) return <SplashScreen onAnimationEnd={handleSplashEnd} />;
264275

src/app/Schedule/SchedulePage.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,25 +99,24 @@ export default function SchedulePage() {
9999
}
100100
}, [scheduleService]);
101101

102-
const handleShowPress = async (show: ScheduleShow) => {
102+
const handleShowPress = async (scheduleShow: ScheduleShow) => {
103103
try {
104104
// fetch show cache (xml only)
105105
await recentlyPlayedService.fetchShowsCacheOnly();
106106

107107
// find the show from the cache
108-
const showWithArchiveData = recentlyPlayedService.getShowByName(
109-
show.name,
110-
);
108+
const show = recentlyPlayedService.getShowByName(scheduleShow.name);
111109

112-
if (showWithArchiveData && showWithArchiveData.archives.length > 0) {
110+
if (show && show.archives.length > 0) {
113111
navigation.navigate('ShowDetails' as WmbrRouteName, {
114-
show: showWithArchiveData,
112+
show,
113+
scheduleShow,
115114
});
116115
} else {
117116
// If no archives found, show info message
118117
Alert.alert(
119-
show.name,
120-
`No archived episodes found for "${show.name}". This show may not have been archived yet or may use a different name in the archive system.`,
118+
scheduleShow.name,
119+
`No archived episodes found for "${scheduleShow.name}". This show may not have been archived yet or may use a different name in the archive system.`,
121120
[{ text: 'OK' }],
122121
);
123122
}

src/app/Schedule/ShowDetailsPage.tsx

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,15 @@ import {
5454
generateDarkGradientColors,
5555
generateGradientColors,
5656
} from '@utils/GradientColors';
57+
import { ScheduleShow } from '@customTypes/Schedule';
5758

5859
const { width } = Dimensions.get('window');
5960
const CIRCLE_DIAMETER = 16;
6061

6162
// Route params for ShowDetailsPage
6263
export type ShowDetailsPageRouteParams = {
6364
show: Show;
65+
scheduleShow?: ScheduleShow;
6466
};
6567

6668
export default function ShowDetailsPage() {
@@ -69,7 +71,7 @@ export default function ShowDetailsPage() {
6971

7072
const route =
7173
useRoute<RouteProp<Record<string, ShowDetailsPageRouteParams>, string>>();
72-
const show: Show = route.params!.show;
74+
const { show, scheduleShow } = route.params;
7375

7476
const headerHeight = useHeaderHeight();
7577

@@ -303,9 +305,16 @@ export default function ShowDetailsPage() {
303305
{/* Show Info */}
304306
<View style={styles.infoSection}>
305307
<Text style={styles.showTitle}>{show.name}</Text>
306-
<Text style={styles.showSchedule}>{formatShowTime(show)}</Text>
307-
{show.hosts && (
308-
<Text style={styles.showHosts}>Hosted by {show.hosts}</Text>
308+
<View>
309+
<Text style={styles.showSchedule}>{formatShowTime(show)}</Text>
310+
{show.hosts && (
311+
<Text style={styles.showHosts}>Hosted by {show.hosts}</Text>
312+
)}
313+
</View>
314+
{scheduleShow?.description && (
315+
<Text style={styles.showDescription}>
316+
{scheduleShow.description}
317+
</Text>
309318
)}
310319
<Text style={styles.archiveCount}>
311320
{archives.length} archived episode
@@ -470,27 +479,29 @@ const styles = StyleSheet.create({
470479
infoSection: {
471480
paddingHorizontal: 20,
472481
paddingBottom: 30,
482+
flexDirection: 'column',
483+
rowGap: 8,
473484
},
474485
showTitle: {
475486
color: COLORS.TEXT.PRIMARY,
476487
fontSize: 32,
477488
fontWeight: 'bold',
478-
marginBottom: 8,
479489
},
480490
showSchedule: {
481-
color: COLORS.TEXT.SECONDARY,
482-
fontSize: 16,
483-
marginBottom: 4,
491+
color: COLORS.TEXT.TERTIARY,
492+
fontSize: 14,
484493
},
485494
showHosts: {
486-
color: COLORS.TEXT.SECONDARY,
495+
color: COLORS.TEXT.TERTIARY,
496+
fontSize: 14,
497+
},
498+
showDescription: {
499+
color: COLORS.TEXT.PRIMARY,
487500
fontSize: 16,
488-
marginBottom: 8,
489501
},
490502
archiveCount: {
491-
color: COLORS.TEXT.SECONDARY,
503+
color: COLORS.TEXT.TERTIARY,
492504
fontSize: 14,
493-
fontWeight: '500',
494505
},
495506
archivesSection: {
496507
paddingHorizontal: 20,

src/services/ScheduleService.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,19 @@ export class ScheduleService {
192192
return weeksSince % 2 === 0;
193193
}
194194

195+
async getShowById(showId: string): Promise<ScheduleShow | undefined> {
196+
try {
197+
const scheduleData = await this.fetchSchedule();
198+
199+
const matchingShow = scheduleData.shows.find(show => show.id === showId);
200+
201+
return matchingShow;
202+
} catch (error) {
203+
debugError('Error getting show by ID:', error);
204+
return;
205+
}
206+
}
207+
195208
// Helper method to find the previous show based on current time
196209
async findPreviousShow(
197210
currentShowName: string,

0 commit comments

Comments
 (0)