Skip to content

Commit cba1b3d

Browse files
committed
refactor: update FeaturedSongs context to use new types and clean up unused code
1 parent edb817f commit cba1b3d

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

apps/frontend/src/modules/browse/components/client/context/FeaturedSongs.context.tsx

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
'use client';
22

3-
import {
4-
FeaturedSongsDtoType,
5-
SongPreviewDtoType,
6-
TimespanType,
7-
} from '@nbw/database';
3+
import { TIMESPANS } from '@nbw/config';
4+
import { type FeaturedSongsDto, type SongPreviewDto } from '@nbw/database';
85
import { createContext, useContext, useEffect, useState } from 'react';
6+
type TimespanType = (typeof TIMESPANS)[number];
97

108
type FeaturedSongsContextType = {
11-
featuredSongsPage: SongPreviewDtoType[];
9+
featuredSongsPage: SongPreviewDto[];
1210
timespan: TimespanType;
1311
setTimespan: (timespan: TimespanType) => void;
1412
timespanEmpty: Record<string, boolean>;
@@ -23,14 +21,14 @@ export function FeaturedSongsProvider({
2321
initialFeaturedSongs,
2422
}: {
2523
children: React.ReactNode;
26-
initialFeaturedSongs: FeaturedSongsDtoType;
24+
initialFeaturedSongs: FeaturedSongsDto;
2725
}) {
2826
// Featured songs
29-
const [featuredSongs] = useState<FeaturedSongsDtoType>(initialFeaturedSongs);
27+
const [featuredSongs] = useState<FeaturedSongsDto>(initialFeaturedSongs);
3028

31-
const [featuredSongsPage, setFeaturedSongsPage] = useState<
32-
SongPreviewDtoType[]
33-
>(initialFeaturedSongs.week);
29+
const [featuredSongsPage, setFeaturedSongsPage] = useState<SongPreviewDto[]>(
30+
initialFeaturedSongs.week,
31+
);
3432

3533
const [timespan, setTimespan] = useState<TimespanType>('week');
3634

@@ -43,7 +41,6 @@ export function FeaturedSongsProvider({
4341
);
4442

4543
useEffect(() => {
46-
// eslint-disable-next-line react-hooks/exhaustive-deps
4744
setFeaturedSongsPage(featuredSongs[timespan]);
4845
}, [featuredSongs, timespan]);
4946

apps/frontend/src/modules/shared/components/client/ads/DetectAdBlock.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const DetectAdBlock = () => {
22
return (
33
<>
4-
{/* eslint-disable-next-line @next/next/no-sync-scripts */}
54
<script src='/adasync.js' />
65
<script
76
id='detect-ad-block'

0 commit comments

Comments
 (0)