({ categories }: { categories: Categories[] })
| 15 | } |
| 16 | |
| 17 | const CompleteAddTracks = ({ categories }: { categories: Categories[] }) => { |
| 18 | const [notionId, setNotionId] = useState(""); |
| 19 | const [trackId, setTrackId] = useState(""); |
| 20 | const [trackTitle, setTrackTitle] = useState(""); |
| 21 | const [trackDescription, setTrackDescription] = useState(""); |
| 22 | const [trackImage, setTrackImage] = useState(""); |
| 23 | const [cohort, setCohort] = useState<string>("3"); |
| 24 | const [selectedCategory, setSelectedCategory] = useState<string[]>([]); |
| 25 | const [trackData, setTrackData] = useState<CompleteTrack>({} as CompleteTrack); |
| 26 | |
| 27 | function handleFilterButton(category: string) { |
| 28 | if (selectedCategory.includes(category)) { |
| 29 | setSelectedCategory(selectedCategory.filter((item) => item !== category)); |
| 30 | } else { |
| 31 | setSelectedCategory([...selectedCategory, category]); |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | useEffect(() => { |
| 36 | setTrackData({ trackId, trackDescription, trackTitle, trackImage, selectedCategory, cohort }); |
| 37 | }, [trackId, trackDescription, trackTitle, trackImage,selectedCategory]); |
| 38 | return ( |
| 39 | <div className="flex flex-col justify-center"> |
| 40 | <div className="text-5xl text-center mb-4">Track</div> |
| 41 | <div className="flex flex-col space-y-5 justify-center my-4"> |
| 42 | <div className="flex justify-center"> |
| 43 | <div className="mr-3">{"TrackId: "}</div> |
| 44 | <Input className="w-1/3 mr-3" onChange={(e) => setTrackId(e.target.value)} placeholder="TrackId" /> |
| 45 | </div> |
| 46 | <div className="flex justify-center"> |
| 47 | <div className="mr-3">{"TrackTitle: "}</div> |
| 48 | <Input className="w-1/3 mr-3" onChange={(e) => setTrackTitle(e.target.value)} placeholder="TrackTitle" /> |
| 49 | </div> |
| 50 | <div className="flex justify-center"> |
| 51 | <div className="mr-3">{"Description: "}</div> |
| 52 | <Input |
| 53 | className="w-1/3 mr-3" |
| 54 | onChange={(e) => setTrackDescription(e.target.value)} |
| 55 | placeholder="TrackDescription" |
| 56 | /> |
| 57 | </div> |
| 58 | <div className="flex justify-center"> |
| 59 | <div className="mr-3">{"TrackImage: "}</div> |
| 60 | <Input className="w-1/3 mr-3" onChange={(e) => setTrackImage(e.target.value)} placeholder="TrackImage" /> |
| 61 | </div> |
| 62 | <div className="flex justify-center"> |
| 63 | <div className="mr-3">{"NotionId: "}</div> |
| 64 | <Input className="w-1/3 mr-3" onChange={(e) => setNotionId(e.target.value)} placeholder="NotionId" /> |
| 65 | </div> |
| 66 | <div className="flex justify-center"> |
| 67 | <div className="mr-3">{"Cohort: "}</div> |
| 68 | <Input className="w-1/3 mr-3" type="number" value={cohort} onChange={(e) => setCohort(e.target.value)} placeholder="3" /> |
| 69 | </div> |
| 70 | <div className="flex lg:flex-row justify-evenly mx-auto py-1"> |
| 71 | {categories.map((category, i) => ( |
| 72 | <Button |
| 73 | key={i} |
| 74 | variant="ghost" |
nothing calls this directly
no test coverage detected