+
Submit An Idea For Devsoc24
-
-
)
}
\ No newline at end of file
diff --git a/devsoc24-portal-fe/src/app/submit-idea/submit-idea-form.tsx b/devsoc24-portal-fe/src/app/submit-idea/submit-idea-form.tsx
index 37eeccc..d30b6ea 100644
--- a/devsoc24-portal-fe/src/app/submit-idea/submit-idea-form.tsx
+++ b/devsoc24-portal-fe/src/app/submit-idea/submit-idea-form.tsx
@@ -1,158 +1,274 @@
-import { Formik, Form, Field, ErrorMessage } from 'formik';
-import { Label } from "@/components/ui/label"
-import { Input } from '@/components/ui/input';
-import { Textarea } from "@/components/ui/textarea"
+import { zodResolver } from "@hookform/resolvers/zod";
+import { useForm, Controller } from "react-hook-form";
+import { type z } from "zod";
import {
- Select,
- SelectContent,
- SelectItem,
- SelectTrigger,
- SelectValue,
-} from "@/components/ui/select"
-import { Button } from "@/components/ui/button"
+ Form,
+ FormControl,
+ FormField,
+ FormItem,
+ FormMessage,
+} from "@/components/ui/form";
+import { Label } from "@/components/ui/label";
+import { Input } from "@/components/ui/input";
+import { Textarea } from "@/components/ui/textarea";
+import { Button } from "@/components/ui/button";
+import { ideaSchema } from "@/schemas/idea";
interface FormValues {
- projectName: string;
- projectTrack: string;
- description: string;
- figmaLink: string;
- githubLink: string;
- otherLinks: string;
+ projectName: string;
+ projectTrack: string;
+ description: string;
+ figmaLink: string;
+ githubLink: string;
+ otherLinks: string;
}
-import send from "@/assets/images/Send.svg"
-import Image from 'next/image';
-const tracks = ['Track 1', 'Track 2', 'Track 3'];
-
+import send from "@/assets/images/Send.svg";
+import Image from "next/image";
+const tracks = ["Track 1", "Track 2", "Track 3"];
export default function SubmitIdeaForm() {
- const initialValues: FormValues = {
- projectName: '',
- projectTrack: '',
- description: '',
- figmaLink: '',
- githubLink: '',
- otherLinks: ''
- };
- const onSubmit = (values: FormValues, { setSubmitting }: { setSubmitting: (isSubmitting: boolean) => void }) => {
- setSubmitting(false);
- };
-
- return (
-
-
- {({ isSubmitting }) => (
-
- )}
-
- )
-}
\ No newline at end of file
+
+
+ Submit Idea
+
+
+
+ );
+}
diff --git a/devsoc24-portal-fe/src/app/submit-project/page.tsx b/devsoc24-portal-fe/src/app/submit-project/page.tsx
index 279c5b2..76051f8 100644
--- a/devsoc24-portal-fe/src/app/submit-project/page.tsx
+++ b/devsoc24-portal-fe/src/app/submit-project/page.tsx
@@ -5,6 +5,8 @@ import Logo from "@/components/logo";
import Dashtitle from "@/assets/images/titleDashboard.svg";
import active from "@/assets/images/active.svg"
import SubmitProjectForm from "./submit-project-form";
+import { ArrowLeft } from 'lucide-react';
+import Link from "next/link";
export default function Page() {
return (
@@ -14,7 +16,7 @@ export default function Page() {
Project Submission For Devsoc24
diff --git a/devsoc24-portal-fe/src/app/submit-project/submit-project-form.tsx b/devsoc24-portal-fe/src/app/submit-project/submit-project-form.tsx
index 9178ea1..efb5d0f 100644
--- a/devsoc24-portal-fe/src/app/submit-project/submit-project-form.tsx
+++ b/devsoc24-portal-fe/src/app/submit-project/submit-project-form.tsx
@@ -1,158 +1,274 @@
-import { Formik, Form, Field, ErrorMessage } from 'formik';
-import { Label } from "@/components/ui/label"
-import { Input } from '@/components/ui/input';
-import { Textarea } from "@/components/ui/textarea"
+import { zodResolver } from "@hookform/resolvers/zod";
+import { useForm, Controller } from "react-hook-form";
+import { type z } from "zod";
import {
- Select,
- SelectContent,
- SelectItem,
- SelectTrigger,
- SelectValue,
-} from "@/components/ui/select"
-import { Button } from "@/components/ui/button"
+ Form,
+ FormControl,
+ FormField,
+ FormItem,
+ FormMessage,
+} from "@/components/ui/form";
+import { Label } from "@/components/ui/label";
+import { Input } from "@/components/ui/input";
+import { Textarea } from "@/components/ui/textarea";
+import { Button } from "@/components/ui/button";
+import { ideaSchema } from "@/schemas/idea";
interface FormValues {
- projectName: string;
- projectTrack: string;
- description: string;
- figmaLink: string;
- githubLink: string;
- otherLinks: string;
+ projectName: string;
+ projectTrack: string;
+ description: string;
+ figmaLink: string;
+ githubLink: string;
+ otherLinks: string;
}
-import send from "@/assets/images/Send.svg"
-import Image from 'next/image';
-const tracks = ['Track 1', 'Track 2', 'Track 3'];
-
+import send from "@/assets/images/Send.svg";
+import Image from "next/image";
+const tracks = ["Track 1", "Track 2", "Track 3"];
export default function SubmitProjectForm() {
- const initialValues: FormValues = {
- projectName: '',
- projectTrack: '',
- description: '',
- figmaLink: '',
- githubLink: '',
- otherLinks: ''
- };
- const onSubmit = (values: FormValues, { setSubmitting }: { setSubmitting: (isSubmitting: boolean) => void }) => {
- setSubmitting(false);
- };
-
- return (
-
-
- {({ isSubmitting }) => (
-
-
-
-
-
- Project Name*
-
-
-
-
-
-
- Project Track*
-
-
-
-
-
-
- {tracks.map((track) => (
-
- {track}
-
- ))}
-
-
-
-
-
-
-
-
- Description of Project*
+ const form = useForm({
+ resolver: zodResolver(ideaSchema),
+ defaultValues: {
+ projectName: "",
+ projectTrack: "",
+ description: "",
+ figmaLink: "",
+ githubLink: "",
+ otherLinks: "",
+ },
+ mode: "onChange",
+ });
-
-
+ // toast.update(toastId, {
+ // render:
+ // res === 200 ? "Login successful!" : res !== 500 ? res :
,
+ // type: res === 200 ? "success" : "error",
+ // isLoading: false,
+ // autoClose: 2000,
+ // });
-
500 max words
-
-
-
-
-
-
- Figma Link
- {
+ // void router.push("/overview");
+ // }, 2000);
+ // }
+ }
- />
-
+ return (
+
+
+
+
+
+
(
+
+
+
+
+ Project Name*
+
+
+
+
+
+
+ )}
+ >
+
+
+
(
+ (
+
+
+
+
+ Project Track
+ *
+
+
+ form.setValue("projectTrack", e.target.value)
+ }
+ className="rounded-md border border-gray-200 p-4 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-600"
+ >
+ Select Project Track
+ {tracks.map((track) => (
+
+ {track}
+
+ ))}
+
+
+
+
+
+ )}
+ />
+ )}
+ >
+
+
+
(
+
+
+
+
+ Description of Project
+ *
+
-
-
-
-
- GitHub Link
-
+
+
+
+
+ )}
+ >
- />
-
+ 500 max words
+
+
+
+
+
(
+
+
+
+
+ Figma Link
+
+
+
+
+
+
+ )}
+ >
+
+
+
(
+
+
+
+
+ GitHub Link
+
+
+
+
+
+
+ )}
+ >
+
+
+
(
+
+
+
+
+ Other Links
+
-
-
-
-
- Other Links
+
+
+
+
+
+ )}
+ >
-
-
+
+ Canva PPTs, Videos, Drive or Supporting Material can be shared
+
+
+
+
- Canva PPTs, Videos, Drive or Supporting Material can be shared
-
-
-
-
-
-
-
-
-
- Submit Project
-
-
- )}
-
- )
-}
\ No newline at end of file
+
+
+ Submit Idea
+
+
+
+ );
+}
diff --git a/devsoc24-portal-fe/src/components/customCard.tsx b/devsoc24-portal-fe/src/components/customCard.tsx
index 2df81c1..9f81804 100644
--- a/devsoc24-portal-fe/src/components/customCard.tsx
+++ b/devsoc24-portal-fe/src/components/customCard.tsx
@@ -2,15 +2,17 @@
import { Dialog, DialogTrigger } from "@/components/ui/dialog";
import { type CardProps } from "@/interfaces";
import JoinTeam from "@/components/team/joinTeam";
-import IdeaSubmission from "@/components/submission/submission"
+import IdeaSubmission from "@/components/submission/submission";
import Image from "next/image";
import { Button } from "@/components/ui/button";
import { useState } from "react";
import CreateTeam from "./team/createTeam";
+import { useRouter } from "next/navigation";
function CustomCard(props: CardProps) {
+ const router = useRouter();
const { title, cardImage, cardContent, cardDesc, buttonDetails } = props;
- const [ showModal, setShowModal ] = useState("");
+ const [showModal, setShowModal] = useState("");
const handleDialogTriggerClick = (modalType: string) => {
setShowModal(modalType);
@@ -18,7 +20,7 @@ function CustomCard(props: CardProps) {
return (
<>
-
+
{title}
@@ -45,7 +47,11 @@ function CustomCard(props: CardProps) {
{button.text}
) : (
-
+ void router.push(button.routeTo ?? "")}
+ >
{button.text}
),
diff --git a/devsoc24-portal-fe/src/schemas/idea.ts b/devsoc24-portal-fe/src/schemas/idea.ts
new file mode 100644
index 0000000..173a5af
--- /dev/null
+++ b/devsoc24-portal-fe/src/schemas/idea.ts
@@ -0,0 +1,38 @@
+"use client";
+
+import * as z from "zod";
+
+export const ideaSchema = z.object({
+ projectName: z
+ .string({
+ required_error: "Project name is required",
+ invalid_type_error: "Project must be a string",
+ }),
+ projectTrack: z
+ .string({
+ required_error: "Project track is required",
+ invalid_type_error: "Project track be a string",
+ }),
+ description: z
+ .string({
+ required_error: "Description is required",
+ invalid_type_error: "Description be a string",
+ }),
+ figmaLink: z
+ .string({
+ required_error: "Figma Link is required",
+ invalid_type_error: "Figma Link be a string",
+ }),
+ githubLink: z
+ .string({
+ required_error: "Github Link is required",
+ invalid_type_error: "Github Link be a string",
+ }),
+ otherLinks: z
+ .string({
+ required_error: "Other Links is required",
+ invalid_type_error: "Other Links be a string",
+ }),
+
+
+});
\ No newline at end of file