@@ -14,6 +14,7 @@ const AddTrackCard = ({ categories }: { categories: Categories[] }) => {
14
14
const [ hidden , setHidden ] = useState ( false ) ;
15
15
const [ selectedCategory , setSelectedCategory ] = useState < string [ ] > ( [ ] ) ;
16
16
const [ cohort , setCohort ] = useState ( 3 ) ;
17
+ const [ canvaLink , setCanvaLink ] = useState ( "" ) ;
17
18
const { toast } = useToast ( ) ;
18
19
19
20
function handleFilterButton ( category : string ) {
@@ -26,7 +27,7 @@ const AddTrackCard = ({ categories }: { categories: Categories[] }) => {
26
27
27
28
return (
28
29
< div >
29
- < Card className = "cols-span-4 p-4 m-2 w-full" >
30
+ < Card className = "cols-span-4 m-2 w-full p-4 " >
30
31
< Input
31
32
type = "text"
32
33
placeholder = "Track Id"
@@ -68,7 +69,16 @@ const AddTrackCard = ({ categories }: { categories: Categories[] }) => {
68
69
setCohort ( parseInt ( event . target . value ) ) ;
69
70
} }
70
71
/>
71
- < div className = "flex lg:flex-row justify-evenly mx-auto py-1" >
72
+ < Input
73
+ type = "text"
74
+ placeholder = "Canva Link"
75
+ className = "my-2"
76
+ value = { canvaLink }
77
+ onChange = { ( event ) => {
78
+ setCanvaLink ( event . target . value ) ;
79
+ } }
80
+ />
81
+ < div className = "mx-auto flex justify-evenly py-1 lg:flex-row" >
72
82
{ categories . map ( ( category , i ) => (
73
83
< Button
74
84
key = { i }
@@ -85,12 +95,32 @@ const AddTrackCard = ({ categories }: { categories: Categories[] }) => {
85
95
</ Button >
86
96
< Button
87
97
disabled = { ! title || ! description || ! image }
88
- className = "w-full mt-4"
98
+ className = "mt-4 w-full "
89
99
onClick = { async ( ) => {
90
- await createTrack ( { problems : [ ] , id, title, description, image, hidden, selectedCategory } ) ;
100
+ await createTrack ( {
101
+ problems : [ ] ,
102
+ id,
103
+ title,
104
+ description,
105
+ image,
106
+ hidden,
107
+ selectedCategory,
108
+ canvaLink,
109
+ trackType : canvaLink ? "CANVA" : "NOTION" ,
110
+ } ) ;
91
111
setNewProblems ( ( prev ) => [
92
112
...prev ,
93
- { id, title, description, image, hidden, cohort, createdAt : new Date ( ) } ,
113
+ {
114
+ id,
115
+ title,
116
+ description,
117
+ image,
118
+ hidden,
119
+ cohort,
120
+ createdAt : new Date ( ) ,
121
+ canvaLink,
122
+ trackType : canvaLink ? "CANVA" : "NOTION" ,
123
+ } ,
94
124
] ) ;
95
125
toast ( {
96
126
title : "Added a Track" ,
@@ -107,7 +137,7 @@ const AddTrackCard = ({ categories }: { categories: Categories[] }) => {
107
137
< div className = "grid grid-cols-6" >
108
138
< img
109
139
src = { Track . image }
110
- className = "flex m-4 min-h-[130px] sm:h- [130px] min-w -[130px] sm:w-[130px] rounded-xl "
140
+ className = "m-4 flex min-h-[130px] min-w- [130px] rounded-xl sm:h -[130px] sm:w-[130px]"
111
141
/>
112
142
< div className = "col-span-5" >
113
143
< CardHeader >
0 commit comments