Skip to content

Commit

Permalink
Fix ts errors
Browse files Browse the repository at this point in the history
Fix ts errors
  • Loading branch information
JoseCSG authored May 28, 2024
2 parents fa1dd7c + ef3040e commit 52009cd
Show file tree
Hide file tree
Showing 9 changed files with 364 additions and 189 deletions.
24 changes: 2 additions & 22 deletions app/(base)/dashboard/[userId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import DashboardEmotionsSection from "@/components/Dashboard/DashboardEmotionsSe
import DashboardSurveyCalendar from "@/components/Dashboard/DashboardSurveyCalendar";
import PCPSection from "@/components/Dashboard/DashboardPCPSection";
import Loader from "@/components/Loader";
import { getRulerGraphInfo } from "@/services/user-dashboard";

const Dashboard = async ({ params }: { params: { userId: string } }) => {
const activeUserId = await getUserId();
Expand Down Expand Up @@ -48,28 +49,7 @@ const Dashboard = async ({ params }: { params: { userId: string } }) => {
gradient: { start: "#4598FB", end: "#6640D5" },
};

const emotionsData = [
{
title: "High Energy - Unpleasant",
percentage: 16,
gradient: { start: "#ee824e", end: "#e14a5f" },
},
{
title: "High Energy - Pleasant",
percentage: 22,
gradient: { start: "#f4e37c", end: "#f4b745" },
},
{
title: "Low Energy - Unpleasant",
percentage: 37,
gradient: { start: "#92bef6", end: "#7481f7" },
},
{
title: "Low Energy - Pleasant",
percentage: 25,
gradient: { start: "#9feba8", end: "#6bc68c" },
},
];
const emotionsData = await getRulerGraphInfo(params.userId);

const completedSurveys = [
{ date: new Date(2024, 0, 5), color: "red" },
Expand Down
14 changes: 7 additions & 7 deletions components/BannerImagePanel.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
"use client";

import { useState } from "react";
import Banner0 from "@/public/Banner0.svg";
import Banner1 from "@/public/Banner1.svg";
import Banner2 from "@/public/Banner2.svg";
import Banner3 from "@/public/Banner3.svg";
import Banner4 from "@/public/Banner4.svg";
import { updateBannerId } from "@/services/user";
import Image from "next/image";
import toast from "react-hot-toast";
import { useRouter } from "next/navigation";

const images = [Banner0, Banner1, Banner2, Banner3, Banner4];

const BannerImagePanel = ({ closeModal }: { closeModal: () => void }) => {
const [selectedImage, setSelectedImage] = useState<number | null>(null);
const router = useRouter();
const images = [
"/Banner0.svg",
"/Banner1.svg",
"/Banner2.svg",
"/Banner3.svg",
"/Banner4.svg",
];

const handleImageClick = (index: number) => {
setSelectedImage(index);
Expand Down
4 changes: 2 additions & 2 deletions components/NoDataCard.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from "react";
import Image from "next/image";
import NoData from "@/public/NoData.svg";

interface NoDataCardProps {
text: string;
Expand All @@ -10,11 +9,12 @@ const NoDataCard = ({ text }: NoDataCardProps) => {
return (
<div className="flex flex-col items-center justify-center">
<Image
src={NoData}
src={"/NoData.svg"}
alt="No Data Image"
className="hidden md:block"
priority
height={70}
width={100}
/>
<p className="text-center text-sm font-medium text-grayText">{text}</p>
</div>
Expand Down
14 changes: 9 additions & 5 deletions components/modals/SprintSurvey.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { Fragment, useEffect, useMemo, useState } from "react";
import SprintStepOne from "./SprintStepOne";
import SprintStepTwo from "./SprintStepTwo";
import {
QuestionType,
Questions,
SprintSurveyAnswer,
SurveyStepTwoAnswer,
Expand Down Expand Up @@ -56,14 +57,14 @@ const SprintSurvey = ({

const sprintQuestions: Questions[] | undefined = useMemo(() => {
return allSprintQuestions?.filter(
(question) => question.type === "SPRINT_QUESTION",
);
(question) => question.type === ("SPRINT_QUESTION" as QuestionType),
) as Questions[];
}, [allSprintQuestions]);

const coworkerQuestions: Questions[] | undefined = useMemo(() => {
return allSprintQuestions?.filter(
(question) => question.type === "COWORKER_QUESTION",
);
(question) => question.type === ("COWORKER_QUESTION" as QuestionType),
) as Questions[];
}, [allSprintQuestions]);

/* const coworkerCommentQuestions: Questions[] | undefined = useMemo(() => {
Expand All @@ -77,6 +78,7 @@ const SprintSurvey = ({
sprintSurveyId: sprintSurveyId,
projectAnswers: [],
coworkersAnswers: [],
commentId: 0,
coworkersComments: [],
});
const sprintSurveyStepTwoAnswerBase: SurveyStepTwoAnswer = useMemo(() => {
Expand Down Expand Up @@ -136,6 +138,9 @@ const SprintSurvey = ({
});
});
}
sprintAnswer.commentId = allSprintQuestions?.find(
(type) => type.type === "COWORKER_COMMENT",
)?.id as number;
sprintAnswer.coworkersAnswers.push(questionObject);
});
};
Expand Down Expand Up @@ -172,7 +177,6 @@ const SprintSurvey = ({
else modal.classList.remove("max-w-xl");
}, [step]);

//TODO: Render the loading state into the modal
if (!users) return <div></div>;
if (isError) return <div>Error loading data</div>;
return (
Expand Down
2 changes: 0 additions & 2 deletions db/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,11 @@ export const rulerSurveyAnswers = pgTable(
);

export const questionTypeEnum = pgEnum("type_question", [
/*
"SPRINT_QUESTION",
"COWORKER_QUESTION",
"COWORKER_COMMENT",
"FINAL_PROJECT_QUESTION",
"FINAL_PROJECT_COMMENT",
*/
]);

export const question = pgTable("question", {
Expand Down
Loading

0 comments on commit 52009cd

Please sign in to comment.