diff --git a/src/components/ProgressBar.tsx b/src/components/ProgressBar.tsx index d96c8e6..952331b 100644 --- a/src/components/ProgressBar.tsx +++ b/src/components/ProgressBar.tsx @@ -11,6 +11,7 @@ const ProgressBar = ({ completed }: ProgressBarProps) => { backgroundColor: "yellowGreen", borderRadius: "inherit", transition: "width 1s ease-in-out", + minHeight: "100%", }; return ( diff --git a/src/components/SummaryQuestionAnswer.tsx b/src/components/SummaryQuestionAnswer.tsx new file mode 100644 index 0000000..a521ebc --- /dev/null +++ b/src/components/SummaryQuestionAnswer.tsx @@ -0,0 +1,20 @@ +import { Key } from "react"; + +interface SummaryQuestionAnswerProps { + question: string; + answer: string; + key?: Key; +} + +export default function SummaryQuestionAnswer({ + question, + answer, + key, +}: SummaryQuestionAnswerProps) { + return ( +
  • +

    {question}

    +

    {answer}

    +
  • + ); +} diff --git a/src/components/survey/demographicssurvey.tsx b/src/components/survey/demographicssurvey.tsx index cd7fbe4..00f7c83 100644 --- a/src/components/survey/demographicssurvey.tsx +++ b/src/components/survey/demographicssurvey.tsx @@ -172,7 +172,7 @@ export default function DemographicsSurvey() { > Retake demographic survey - + + +
    +
    +
    +

    Location Questions

    +
      + + + + + +
    +
    +
    +

    Demographic Questions

    +
      + {sortedDemoQuestions.map((question, index) => { + let userAnswer = "No Answer"; + if (answersResult) { + userAnswer = answersResult[index + 1] ?? "No answer"; + } + return ( + + ); + })} +
    +
    +
    +
    +
    +
    + + + + + + +
    +
    + + + +
    +
    + + + ); +}; + +export default QuerySummary; diff --git a/src/server/api/routers/user.ts b/src/server/api/routers/user.ts index 8631bb5..be2e89f 100644 --- a/src/server/api/routers/user.ts +++ b/src/server/api/routers/user.ts @@ -104,4 +104,14 @@ export const userRouter = createTRPCRouter({ }, }); }), + getDemoSurveyAnswers: publicProcedure.query(async ({ ctx }) => { + if (!ctx.session) { + console.log("Not authenticated"); + return null; + } + const { id: userId } = ctx.session.user; + return ctx.prisma.userSurveyAnswers.findMany({ + where: { userId: userId }, + }); + }), });