1
1
import { useTranslation } from "next-i18next" ;
2
2
import { ReactElement , useMemo } from "react" ;
3
3
import { useRouter } from "next/router" ;
4
- import { Bounty , Submission } from "@/types/bounty" ;
4
+ import { Bounty } from "@/types/bounty" ;
5
5
6
6
import DateManager from "@/utilities/DateManager" ;
7
7
import Badge from "@/components/ui/Badge" ;
8
8
import Avatar from "@/components/ui/Avatar" ;
9
9
import Reward from "@/components/badges/RewardBadge" ;
10
10
import Link from "next/link" ;
11
11
import useNavigation from "@/hooks/useNavigation" ;
12
- import useSafePush from "@/hooks/useSafePush" ;
13
12
14
13
export enum RewardType {
15
14
submission = "SUBMISSION" ,
@@ -39,7 +38,6 @@ export default function BountyCard({ bounty }: BountyProps): ReactElement {
39
38
const { t } = useTranslation ( ) ;
40
39
const { locale } = useRouter ( ) ;
41
40
const navigation = useNavigation ( ) ;
42
- const { safePush } = useSafePush ( ) ;
43
41
44
42
const convertDate = ( date : Date ) => DateManager . fromNow ( date , locale ) ;
45
43
@@ -57,10 +55,9 @@ export default function BountyCard({ bounty }: BountyProps): ReactElement {
57
55
} , [ bounty . challenge , bounty . course ?. slug , bounty . slug , bounty . submissions ?. link , bounty . url , isChallenge , navigation . community ] ) ;
58
56
59
57
const Component = link . startsWith ( "http" ) ? "a" : Link ;
60
- const onSubmissionClick = ( submission : Submission ) => safePush ( navigation . community . submissionPath ( submission . id , bounty . challenge , bounty ?. slug ) ) ;
61
58
62
59
return (
63
- < div className = "cursor-pointer flex md:flex-row-reverse md:space-x-5 px-5 min-h-32 md:h-auto md:w-full justify-between hover:bg-secondary relative" >
60
+ < div className = "p-5 flex md:flex-row-reverse md:space-x-5 px-5 min-h-32 md:h-auto md:w-full justify-between hover:bg-secondary relative" >
64
61
< div className = "bg-theme-accent flex-col w-full h-full justify-between md:-space-y-1 pl-3 pr-5 mt-7 mb-5" >
65
62
< Component className = "relative w-full block" href = { link } >
66
63
< div className = "font-medium text-md md:pt-1.5" > { bounty . course ? bounty . course . name : bounty . name } </ div >
@@ -74,11 +71,16 @@ export default function BountyCard({ bounty }: BountyProps): ReactElement {
74
71
{ bounty . submissions ?. length ? (
75
72
< div className = "mt-4 space-y-0 divide-y divide-gray-200 border-t border-t-solid border-gray-200" >
76
73
{ bounty . submissions . map ( ( submission ) => (
77
- < div className = "flex space-x-1 relative text-sm font-medium py-3 cursor-pointer " key = { submission . id } onClick = { ( ) => onSubmissionClick ( submission ) } >
74
+ < div className = "flex space-x-1 relative text-sm font-medium py-3" key = { submission . id } >
78
75
< div className = "flex justify-between w-full pr-0 gap-1 sm:gap-0" >
79
76
< div className = "flex space-x-1" >
80
77
< Avatar user = { submission . user } size = "mini" />
81
- < div className = "text-ellipsis overflow-hidden w-17 sm:w-auto whitespace-nowrap" > { submission . user . displayName } </ div >
78
+ < Link
79
+ className = "text-ellipsis overflow-hidden w-17 sm:w-auto whitespace-nowrap"
80
+ href = { navigation . community . submissionPath ( submission . id , bounty . challenge , bounty ?. slug ) }
81
+ >
82
+ { submission . user . displayName }
83
+ </ Link >
82
84
< div className = "flex align-middle text-gray-500 text-middle bg-gray-200 px-2 text-xxs rounded-xl m-0 h-5" >
83
85
{ submission . metadata && submission . metadata . feedbacks ? submission . metadata . feedbacks : 0 }
84
86
</ div >
0 commit comments