@@ -14,6 +14,7 @@ const AddTrackCard = ({ categories }: { categories: Categories[] }) => {
1414 const [ hidden , setHidden ] = useState ( false ) ;
1515 const [ selectedCategory , setSelectedCategory ] = useState < string [ ] > ( [ ] ) ;
1616 const [ cohort , setCohort ] = useState ( 3 ) ;
17+ const [ canvaLink , setCanvaLink ] = useState ( "" ) ;
1718 const { toast } = useToast ( ) ;
1819
1920 function handleFilterButton ( category : string ) {
@@ -26,7 +27,7 @@ const AddTrackCard = ({ categories }: { categories: Categories[] }) => {
2627
2728 return (
2829 < 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 " >
3031 < Input
3132 type = "text"
3233 placeholder = "Track Id"
@@ -68,7 +69,16 @@ const AddTrackCard = ({ categories }: { categories: Categories[] }) => {
6869 setCohort ( parseInt ( event . target . value ) ) ;
6970 } }
7071 />
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" >
7282 { categories . map ( ( category , i ) => (
7383 < Button
7484 key = { i }
@@ -85,12 +95,32 @@ const AddTrackCard = ({ categories }: { categories: Categories[] }) => {
8595 </ Button >
8696 < Button
8797 disabled = { ! title || ! description || ! image }
88- className = "w-full mt-4"
98+ className = "mt-4 w-full "
8999 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+ } ) ;
91111 setNewProblems ( ( prev ) => [
92112 ...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+ } ,
94124 ] ) ;
95125 toast ( {
96126 title : "Added a Track" ,
@@ -107,7 +137,7 @@ const AddTrackCard = ({ categories }: { categories: Categories[] }) => {
107137 < div className = "grid grid-cols-6" >
108138 < img
109139 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]"
111141 />
112142 < div className = "col-span-5" >
113143 < CardHeader >
0 commit comments