From ef11f85c95bdcc24db02337d512fb0a1c078c49f Mon Sep 17 00:00:00 2001 From: KhunKrit46 Date: Fri, 4 Oct 2024 15:03:32 -0400 Subject: [PATCH 1/3] add description sprint1 --- client/src/pages/PostSolution.tsx | 79 +- package-lock.json | 1117 +++++++++++++++++++++++++++++ package.json | 1 + 3 files changed, 1186 insertions(+), 11 deletions(-) diff --git a/client/src/pages/PostSolution.tsx b/client/src/pages/PostSolution.tsx index 4c11115..6f86740 100644 --- a/client/src/pages/PostSolution.tsx +++ b/client/src/pages/PostSolution.tsx @@ -1,9 +1,10 @@ -import { useState, useEffect, ChangeEvent, FormEvent } from "react"; +import React, { useState } from "react"; import { useParams } from "react-router-dom"; import { Col, Container, Form, Row } from "react-bootstrap"; import Button from "../components/Button.tsx"; import { useNavigate } from "react-router-dom"; import { UserData } from "../types/UserData.ts"; +import ReactMarkdown from 'react-markdown'; type PostSolutionState = { title: string; @@ -21,6 +22,8 @@ const PostSolution = () => { diagram: null, }, ); + const [showPreview, setShowPreview] = useState(false); + const [description, setDescription] = useState(''); const handleChange = ( e: ChangeEvent, @@ -66,40 +69,94 @@ const PostSolution = () => { }); }; + const togglePreview = () => { + setShowPreview(!showPreview); + }; + return (

Submit Your Solution!

+

+ The solution retrospective helps you think about your project and share it with the community. Answer the questions below to talk about your project, what you learned, and where you need support. Clear details help others understand and give useful feedback. +

- Title + Solution Title - Description + Solution Description +

Provide a brief overview of your design pattern implementation. Include:

+
    +
  • The specific design pattern you used
  • +
  • The problem it solves
  • +
  • Key components of your implementation
  • +
  • How it adheres to design pattern principles
  • +
+
+ +
+ {showPreview ? ( +
+ {postSolutionState.description} +
+ ) : ( + + )} +
+ + Solution Diagram + + + Upload a diagram illustrating the structure and relationships of your design pattern implementation. Use UML or a similar notation to clearly show classes, interfaces, and their interactions. + + + + What are you most proud of, and what would you do differently next time? - - Diagram + + What challenges did you encounter, and how did you overcome them? {showPreview ? ( @@ -119,14 +114,11 @@ const PostSolution = () => { onChange={handleChange} rows={6} required - placeholder="Provide a brief overview of your design pattern implementation. Include: -- The specific design pattern you used -- The problem it solves -- Key components of your implementation -- How it adheres to design pattern principles" + placeholder="Provide a brief overview of your design pattern implementation" /> )} + Solution Diagram { accept="image/*" /> - Upload a diagram illustrating the structure and relationships of your design pattern implementation. Use UML or a similar notation to clearly show classes, interfaces, and their interactions. + Upload a diagram illustrating the structure and relationships of your design pattern implementation. Use UML or a similar notation. + - What are you most proud of, and what would you do differently next time? + + What are you most proud of, and what would you do differently next time? + { required /> + - What challenges did you encounter, and how did you overcome them? + + What challenges did you encounter, and how did you overcome them? + { required /> + diff --git a/client/src/pages/Solution.tsx b/client/src/pages/Solution.tsx index 77f3fbc..083b454 100644 --- a/client/src/pages/Solution.tsx +++ b/client/src/pages/Solution.tsx @@ -5,7 +5,7 @@ import { SolutionData } from "../types/SolutionData.ts"; import { CommentData } from "../types/CommentData.ts"; import Button from "../components/Button.tsx"; import Comment from "../components/Comment.tsx"; -import useCheckRole from "../hooks/useCheckRole.tsx"; // Make sure the path is correct +import useCheckRole from "../hooks/useCheckRole.tsx"; import dayjs from "dayjs"; function loadSolution(id, setter, setForbidden) { diff --git a/server/index.js b/server/index.js index 51096f8..d90ef8a 100644 --- a/server/index.js +++ b/server/index.js @@ -53,7 +53,7 @@ db.sequelize.sync().then(async () => { // import the challenges into the db. Comment out after first run // Also create the AI user - // await importChallenges(); + await importChallenges(); // await createAITAUser(); createAdmins(); From 5656dc7b385d9b9dcd2c5df5106c70ccd343b59f Mon Sep 17 00:00:00 2001 From: KhunKrit46 Date: Fri, 11 Oct 2024 07:04:48 -0400 Subject: [PATCH 3/3] uncomment challenge --- server/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/index.js b/server/index.js index d90ef8a..51096f8 100644 --- a/server/index.js +++ b/server/index.js @@ -53,7 +53,7 @@ db.sequelize.sync().then(async () => { // import the challenges into the db. Comment out after first run // Also create the AI user - await importChallenges(); + // await importChallenges(); // await createAITAUser(); createAdmins();