File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
web/src/modules/browse/components Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { faPlay } from '@fortawesome/free-solid-svg-icons';
4
4
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' ;
5
5
import { SongPreviewDtoType } from '@shared/validation/song/dto/types' ;
6
6
import Link from 'next/link' ;
7
+ import { useRouter } from 'next/navigation' ;
7
8
import Skeleton from 'react-loading-skeleton' ;
8
9
9
10
import {
@@ -14,6 +15,8 @@ import {
14
15
import SongThumbnail from '../../shared/components/layout/SongThumbnail' ;
15
16
16
17
const SongDataDisplay = ( { song } : { song : SongPreviewDtoType | null } ) => {
18
+ const router = useRouter ( ) ;
19
+
17
20
return (
18
21
< div className = 'flex flex-col gap-2 pb-2 h-full' >
19
22
{ /* Song image */ }
@@ -49,12 +52,18 @@ const SongDataDisplay = ({ song }: { song: SongPreviewDtoType | null }) => {
49
52
< Skeleton />
50
53
) : (
51
54
< >
52
- < Link
53
- href = { `/user/${ song . uploader . username } ` }
55
+ { /* TODO: this should be a Link component, but the whole card is a link itself
56
+ and the <a> tag can't be nested. Figure out a better way to arrange them (likely
57
+ place a link in the image, title and each of the card's components) */ }
58
+ < button
59
+ onClick = { ( e ) => {
60
+ e . preventDefault ( ) ;
61
+ router . push ( `/user/${ song . uploader . username } ` ) ;
62
+ } }
54
63
className = 'hover:underline'
55
64
>
56
65
{ song . uploader . username }
57
- </ Link >
66
+ </ button >
58
67
{ ' • ' }
59
68
{ formatTimeAgo ( new Date ( song . createdAt ) ) }
60
69
</ >
You can’t perform that action at this time.
0 commit comments