MCPcopy Create free account
hub / github.com/code100x/daily-code / AddTrackCard

Function AddTrackCard

apps/web/components/admin/AddTrackCard.tsx:8–158  ·  view source on GitHub ↗
({ categories }: { categories: Categories[] })

Source from the content-addressed store, hash-verified

6import { Track } from "@prisma/client";
7
8const AddTrackCard = ({ categories }: { categories: Categories[] }) => {
9 const [newTracks, setNewProblems] = useState<Omit<Track, "inSearch">[]>([]);
10 const [id, setId] = useState("");
11 const [title, setTitle] = useState("");
12 const [description, setDescription] = useState("");
13 const [image, setImage] = useState("");
14 const [hidden, setHidden] = useState(false);
15 const [selectedCategory, setSelectedCategory] = useState<string[]>([]);
16 const [cohort, setCohort] = useState(3);
17 const [canvaLink, setCanvaLink] = useState("");
18 const { toast } = useToast();
19
20 function handleFilterButton(category: string) {
21 if (selectedCategory.includes(category)) {
22 setSelectedCategory(selectedCategory.filter((item) => item !== category));
23 } else {
24 setSelectedCategory([...selectedCategory, category]);
25 }
26 }
27
28 return (
29 <div>
30 <Card className="cols-span-4 m-2 w-full p-4">
31 <Input
32 type="text"
33 placeholder="Track Id"
34 className="my-2"
35 onChange={(event) => {
36 setId(event.target.value);
37 }}
38 />
39 <Input
40 type="text"
41 placeholder="Track title"
42 className="my-2"
43 onChange={(event) => {
44 setTitle(event.target.value);
45 }}
46 />
47 <Input
48 type="text"
49 placeholder="Track Description"
50 className="my-2"
51 onChange={(event) => {
52 setDescription(event.target.value);
53 }}
54 />
55 <Input
56 type="text"
57 placeholder="Image"
58 className="my-2"
59 onChange={(event) => {
60 setImage(event.target.value);
61 }}
62 />
63 <Input
64 type="number"
65 placeholder="Cohort"

Callers

nothing calls this directly

Calls 4

useToastFunction · 0.90
createTrackFunction · 0.90
toastFunction · 0.85
handleFilterButtonFunction · 0.70

Tested by

no test coverage detected