From 13bf3b422baf09ef07d5c1509a77c4a7f9d05794 Mon Sep 17 00:00:00 2001 From: adambelouad <132090786+adambelouad@users.noreply.github.com> Date: Wed, 11 Feb 2026 20:18:39 -0500 Subject: [PATCH 1/4] fixed error removed files --- frontend/app/questions/ask/page.tsx | 7 + frontend/app/questions/page.tsx | 5 +- frontend/components/AskQuestion.tsx | 240 +++++++++++++++++----------- 3 files changed, 158 insertions(+), 94 deletions(-) create mode 100644 frontend/app/questions/ask/page.tsx diff --git a/frontend/app/questions/ask/page.tsx b/frontend/app/questions/ask/page.tsx new file mode 100644 index 0000000..e54788d --- /dev/null +++ b/frontend/app/questions/ask/page.tsx @@ -0,0 +1,7 @@ +'use client'; + +import AskQuestion from '@/components/AskQuestion'; + +export default function AskQuestionPage() { + return ; +} diff --git a/frontend/app/questions/page.tsx b/frontend/app/questions/page.tsx index 49164e3..bf50f5a 100644 --- a/frontend/app/questions/page.tsx +++ b/frontend/app/questions/page.tsx @@ -3,8 +3,11 @@ import AccessTimeIcon from '@mui/icons-material/AccessTime'; import AddIcon from '@mui/icons-material/Add'; import { Button, Heading, Pane, Text, TrendingUpIcon, majorScale } from 'evergreen-ui'; +import { useRouter } from 'next/navigation'; export function QAPage() { + const router = useRouter(); + /** * Handles the recent button click */ @@ -23,7 +26,7 @@ export function QAPage() { * Handles the ask question button click */ const askQuestionHandler = () => { - // Placeholder for button click action + router.push('/questions/ask'); }; return ( diff --git a/frontend/components/AskQuestion.tsx b/frontend/components/AskQuestion.tsx index 5e727e0..3bd5814 100644 --- a/frontend/components/AskQuestion.tsx +++ b/frontend/components/AskQuestion.tsx @@ -2,7 +2,8 @@ import React, { useState } from 'react'; -import { Pane, Textarea, Button, majorScale, minorScale } from 'evergreen-ui'; +import { ArrowLeftIcon, Button, Heading, Pane, Text, Textarea, majorScale } from 'evergreen-ui'; +import { useRouter } from 'next/navigation'; interface FormState { questionTitle: string; @@ -19,9 +20,9 @@ const initialFormState: FormState = { }; export default function AskQuestion(): React.ReactElement { + const router = useRouter(); const [form, setForm] = useState(initialFormState); const [submitted, setSubmitted] = useState(false); - const [canceled, setCanceled] = useState(false); const handleChange = (e: React.ChangeEvent) => { const { name, value } = e.target as HTMLInputElement; @@ -38,106 +39,159 @@ export default function AskQuestion(): React.ReactElement { const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); setSubmitted(true); - setCanceled(false); setForm(initialFormState); }; const handleCancel = () => { setForm(initialFormState); - setSubmitted(false); - setCanceled(true); + router.push('/questions'); + }; + + const handleBack = () => { + router.push('/questions'); }; return ( - -

Ask a Question

-

- Get help from the Princeton academics community -

-
-
- - -
- -
- - -
- -
- - -
- -
- -