1
1
import React from 'react' ;
2
2
import Button from '../../components/Button' ;
3
+ import { Quest } from '@/models/QuestModels/questResponse' ;
3
4
4
5
interface ModalProps {
5
6
onClose : ( ) => void ;
6
- onSkip : ( ) => void ;
7
- onComplete : ( ) => void ;
8
- imageUrl : string ;
9
- title : string ;
10
- category : string ;
11
- description : string ;
12
- objectives : string [ ] ;
13
- infoUrl ?: string ;
7
+ onSkip ?: ( ) => void ;
8
+ onComplete ?: ( ) => void ;
9
+ onIncomplete ?: ( ) => void ;
10
+ quest : Quest
14
11
}
15
12
16
13
const ViewQuest : React . FC < ModalProps > = ( props ) => {
17
14
const {
18
15
onClose,
19
16
onSkip,
20
17
onComplete,
21
- imageUrl,
22
- title,
23
- category,
24
- description,
25
- objectives,
26
- infoUrl
18
+ onIncomplete,
19
+ quest
27
20
} = props ;
21
+ const { title, description, objectives, image_url, category, info_url } = quest ;
28
22
29
23
return (
30
24
< >
31
25
< img
32
- src = { imageUrl }
26
+ src = { image_url }
33
27
alt = "logo"
34
28
className = 'w-full max-h-[16rem] object-cover'
35
29
/>
@@ -43,7 +37,7 @@ const ViewQuest: React.FC<ModalProps> = (props) => {
43
37
</ div >
44
38
45
39
< div className = "w-full p-4 mt-2 overflow-x-hidden overflow-y-auto text-lg font-bold max-h-48 text-text-secondary-highlight bg-secondary-highlight scrollbar-modern" >
46
- < p style = { { lineHeight : '1.1' } } className = "text-pretty" > { description } { description } { description } { description } { description } { description } { description } { description } </ p >
40
+ < p style = { { lineHeight : '1.1' } } className = "text-pretty" > { description } </ p >
47
41
{
48
42
( objectives && objectives . length > 0 ) &&
49
43
< div className = "flex flex-col justify-start w-full mt-4" >
@@ -68,13 +62,23 @@ const ViewQuest: React.FC<ModalProps> = (props) => {
68
62
< div className = "flex justify-start w-full sm:w-fit" >
69
63
< Button text = "close" onClick = { onClose } />
70
64
{
71
- infoUrl &&
72
- < Button text = "learn more" type = "info" onClick = { ( ) => window . open ( infoUrl , '_blank' , 'noopener,noreferrer' ) } />
65
+ info_url &&
66
+ < Button text = "learn more" type = "info" onClick = { ( ) => window . open ( info_url , '_blank' , 'noopener,noreferrer' ) } />
73
67
}
74
68
</ div >
75
69
< div className = "flex flex-col w-full gap-2 mt-2 sm:w-fit sm:mt-0 sm:flex-row sm:justify-end" >
76
- < Button text = "Skip" type = "cancel" onClick = { onSkip } />
77
- < Button text = "complete" type = "confirm" onClick = { onComplete } />
70
+ {
71
+ onSkip &&
72
+ < Button text = "Skip" type = "cancel" onClick = { onSkip } />
73
+ }
74
+ {
75
+ onComplete &&
76
+ < Button text = "complete" type = "confirm" onClick = { onComplete } />
77
+ }
78
+ {
79
+ onIncomplete &&
80
+ < Button text = "mark incomplete" type = "cancel" onClick = { onIncomplete } />
81
+ }
78
82
</ div >
79
83
</ div >
80
84
</ div >
0 commit comments