Skip to content

Commit 9b11c2a

Browse files
committed
Remove tours for recent tapes
1 parent 0e8b591 commit 9b11c2a

File tree

3 files changed

+19
-22
lines changed

3 files changed

+19
-22
lines changed

src/components/ArtistsColumn.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Artist } from '../types';
44
import Column from './Column';
55
import Row from './Row';
66
import RowHeader from './RowHeader';
7+
import { DEFAULT_ARTIST_SLUG } from '@/lib/defaultArtist';
78

89
const byObject = {
910
phish: 'Phish.in',
@@ -24,6 +25,7 @@ const ArtistsColumn = async () => {
2425
key={[idx, artist.id].join(':')}
2526
href={`/${artist.slug}`}
2627
activeSegments={{ artistSlug: artist.slug }}
28+
fallbackParams={{ artistSlug: DEFAULT_ARTIST_SLUG }}
2729
>
2830
<div>
2931
<div>{artist.name}</div>

src/components/RecentTapesColumn.tsx

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,40 +11,24 @@ import RowHeader from './RowHeader';
1111
import Tag from './Tag';
1212
import { notFound } from 'next/navigation';
1313

14-
const RecentTapesColumn = async ({
15-
artistSlug,
16-
year,
17-
}: Pick<RawParams, 'artistSlug' | 'year'>) => {
14+
const RecentTapesColumn = async ({ artistSlug, year }: Pick<RawParams, 'artistSlug' | 'year'>) => {
1815
const shows = await RelistenAPI.fetchRecentlyAdded(artistSlug).catch(() => {
1916
notFound();
2017
});
2118
const tours = {};
2219
return (
2320
<Column heading={year ? year : 'Recently Added'} key={year}>
2421
{(!shows || shows.length === 0) && (
25-
<div className="text-center text-gray-700 text-sm py-2">
26-
No recently added shows!
27-
</div>
22+
<div className="text-center text-gray-700 text-sm py-2">No recently added shows!</div>
2823
)}
2924
{shows &&
3025
artistSlug &&
3126
sortActiveBands(artistSlug, shows).map((show) => {
3227
const { year, month, day } = splitShowDate(show.display_date);
33-
const { venue, avg_duration, tour } = show;
34-
let tourName = '';
35-
36-
// keep track of which tours we've displayed
37-
if (tour) {
38-
if (!tours[tour.id]) tourName = tour.name ?? '';
39-
40-
tours[tour.id] = true;
41-
}
28+
const { venue, avg_duration } = show;
4229

4330
return (
4431
<div key={show.id}>
45-
{tourName && (
46-
<RowHeader>{tourName === 'Not Part of a Tour' ? '' : tourName}</RowHeader>
47-
)}
4832
<Row
4933
href={`/${artistSlug}/${year}/${month}/${day}`}
5034
activeSegments={{
@@ -76,4 +60,4 @@ const RecentTapesColumn = async ({
7660
);
7761
};
7862

79-
export default React.memo(RecentTapesColumn);
63+
export default React.memo(RecentTapesColumn);

src/components/Row.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,19 @@ type RowProps = {
1414
active?: boolean;
1515
loading?: boolean;
1616
activeSegments?: Record<string, string | undefined>;
17+
fallbackParams?: Record<string, string>;
1718
isActiveOverride?: boolean;
1819
};
1920

20-
const Row = ({ children, href, activeSegments, isActiveOverride, loading, ...props }: RowProps) => {
21+
const Row = ({
22+
children,
23+
href,
24+
activeSegments,
25+
isActiveOverride,
26+
loading,
27+
fallbackParams,
28+
...props
29+
}: RowProps) => {
2130
const [isPending, startTransition] = useTransition();
2231
const params = useParams();
2332
const pathname = usePathname();
@@ -27,7 +36,9 @@ const Row = ({ children, href, activeSegments, isActiveOverride, loading, ...pro
2736

2837
// if every segment is true, then we're active
2938
if (isActiveOverride === undefined && activeSegments) {
30-
isActive = Object.entries(activeSegments).every(([key, value]) => params[key] === value);
39+
isActive = Object.entries(activeSegments).every(
40+
([key, value]) => (params[key] ?? fallbackParams?.[key]) === value
41+
);
3142
}
3243

3344
if (!href) {

0 commit comments

Comments
 (0)