Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge antes de expo #213

Merged
merged 24 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
7535070
Merge branch 'dev' of https://github.com/wizelineacademy/itesm-sociof…
pedroalonsoms Jun 5, 2024
299d3e7
Merge branch 'dev' of https://github.com/wizelineacademy/itesm-sociof…
pedroalonsoms Jun 5, 2024
fbd839d
fixes sqs bugs
pedroalonsoms Jun 6, 2024
ac744c7
Merge branch 'dev' of https://github.com/wizelineacademy/itesm-sociof…
pedroalonsoms Jun 6, 2024
0ce0441
function removed from page.tsx
EduardodeValle Jun 6, 2024
3cb3995
Schema.ts updated
EduardodeValle Jun 7, 2024
2a4a4ee
Merge pull request #206 from wizelineacademy/schema-bugfix
EduardodeValle Jun 7, 2024
90e7464
Embedding column fixed in schema
EduardodeValle Jun 7, 2024
00b0ef5
Merge branch 'dev' of https://github.com/wizelineacademy/itesm-sociof…
pedroalonsoms Jun 7, 2024
5ab249c
fixes schema.ts mess
pedroalonsoms Jun 7, 2024
4effb46
Merge pull request #207 from wizelineacademy/sqs-integration-with-lalo
pedroalonsoms Jun 7, 2024
9d0a018
feat: el select ya esta bonito
JoseCSG Jun 7, 2024
e6ea1ec
feat: el select ya esta bonito
JoseCSG Jun 7, 2024
0f3c52a
no lint or tsc errors
JoseCSG Jun 7, 2024
5745c38
no lint or tsc errors
JoseCSG Jun 7, 2024
325f4c0
fixed cypress test on workflow
JoseCSG Jun 7, 2024
f376e0e
returns strings instead of errors from pcp page
pedroalonsoms Jun 7, 2024
f6e46a4
Merge branch 'dev' of https://github.com/wizelineacademy/itesm-sociof…
pedroalonsoms Jun 7, 2024
2d38dc1
Merge pull request #211 from wizelineacademy/sqs-integration-with-lalo
pedroalonsoms Jun 7, 2024
d012a42
fix: hotfix of pcp select
JoseCSG Jun 7, 2024
172c200
hotfix for projects-create page to compile
pedroalonsoms Jun 7, 2024
8e96362
Merge branch 'dev' of https://github.com/wizelineacademy/itesm-sociof…
pedroalonsoms Jun 7, 2024
2fdc760
Merge pull request #212 from wizelineacademy/sqs-integration-with-lalo
pedroalonsoms Jun 7, 2024
c10131d
fixed cypress test on workflow
JoseCSG Jun 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:

- name: Install SST
run: |
wget https://github.com/sst/ion/releases/download/v0.0.399/sst-linux-amd64.deb
wget https://github.com/sst/ion/releases/download/v0.0.411/sst-linux-amd64.deb
sudo dpkg -i sst-linux-amd64.deb

- name: Install Bun
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ on:
branches:
- dev

env:
AUTH_SECRET: ${{ secrets.AUTH_SECRET }}
POSTGRES_URL: ${{ secrets.POSTGRES_URL }}
OPENAI_KEY: ${{ secrets.OPENAI_KEY }}

jobs:
cypress-test:
runs-on: ubuntu-latest
needs: build

steps:
- name: Git checkout
Expand Down Expand Up @@ -48,7 +52,7 @@ jobs:
headless: true
env:
CYPRESS_CACHE_FOLDER: ~/.cache/Cypress
build:
unit-test:
runs-on: ubuntu-latest

steps:
Expand Down
2 changes: 1 addition & 1 deletion app/(auth)/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const Login = () => {

return (
<main className="flex h-dvh items-center justify-center bg-gradient-to-r from-primary to-primary-light">
<section className="flex h-fit w-[33%] flex-col justify-center divide-y divide-gray-500 rounded-[20px] bg-bone px-16 py-8 drop-shadow-md">
<section className="flex h-fit w-fit flex-col justify-center divide-y divide-gray-500 rounded-[20px] bg-bone px-8 py-8 drop-shadow-md md:px-14 lg:px-16">
<div className="flex w-full flex-col items-center justify-start gap-y-4 pb-8">
<p className="mb-4 mt-6 text-center text-3xl font-semibold leading-normal text-black">
Log in to Feedback Flow
Expand Down
2 changes: 1 addition & 1 deletion app/(auth)/register/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const Register = () => {

return (
<div className="flex h-dvh items-center justify-center bg-gradient-to-r from-primary to-primary-light">
<section className="flex h-fit w-[33%] flex-col justify-center rounded-[20px] bg-bone px-10 py-8 drop-shadow-md ">
<section className="flex h-fit w-fit flex-col justify-center rounded-[20px] bg-bone px-8 py-8 drop-shadow-md md:px-14 lg:px-16 ">
<p className="mt-6 text-center text-3xl font-semibold leading-normal text-black">
Sign Up
</p>
Expand Down
65 changes: 37 additions & 28 deletions app/(base)/pcp/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,13 @@ const PCP = () => {
refetchOnWindowFocus: false,
});

const scheduledAt = sprintSurveyQuery.data?.scheduledAt;
const formattedDate = scheduledAt
? new Date(scheduledAt).toLocaleDateString("es-ES")
: "";
const formatDate = (date: Date) => {
return new Date(date).toLocaleString("default", {
day: "2-digit",
month: "short",
year: "numeric",
});
};

const progressPercentage = 100;

Expand All @@ -72,24 +75,27 @@ const PCP = () => {

return (
<div>
<section id="pip-progressbar" className="mt-4">
<section id="pip-progressbar" className="mt-4 w-full">
<div className="flex items-center justify-between">
<p className=" mb-2 text-3xl font-semibold">Personal Career Plan</p>
<p className=" mb-2 text-xl font-medium text-graySubtitle">
{`Sprint ${formattedDate}`}
{sprintSurveyQuery.data &&
typeof sprintSurveyQuery.data === "string"
? sprintSurveyQuery.data
: sprintSurveyQuery.isLoading || !sprintSurveyQuery.data
? "loading..."
: `Sprint ${formatDate(sprintSurveyQuery.data.scheduledAt as Date)}`}
</p>
</div>
<ProgressBar width={progressPercentage} height={6} />
</section>

<section id="pip-selectproject" className="pt-4">
<div className="relative inline-block w-full">
<div className="flex w-full flex-row items-center justify-between gap-4">
<ProgressBar width={progressPercentage} height={6} />
<Listbox value={projectId} onChange={setProjectId}>
<div className="relative mt-1">
<Listbox.Button className="relative flex w-1/4 cursor-default items-center justify-between rounded-lg bg-white py-2 pl-3 pr-4 text-left shadow-md focus:outline-none focus-visible:border-indigo-500 focus-visible:ring-2 focus-visible:ring-white/75 focus-visible:ring-offset-2 focus-visible:ring-offset-orange-300 sm:text-sm">
<div className="relative mt-1 w-1/4">
<Listbox.Button className="relative flex w-full cursor-default items-center justify-between rounded-lg bg-white py-2 pl-3 pr-4 text-left shadow-md focus:outline-none focus-visible:border-indigo-500 focus-visible:ring-2 focus-visible:ring-white/75 focus-visible:ring-offset-2 focus-visible:ring-offset-orange-300 sm:text-sm">
<p className="truncate">
{projectsQuery.data &&
projectsQuery.data.find((p) => p.id === projectId)?.name}
{(projectsQuery.data &&
projectsQuery.data.find((p) => p.id === projectId)?.name) ??
"Personal Improvement"}
</p>
<svg
className="h-4 w-4 fill-current text-gray-700"
Expand All @@ -105,10 +111,10 @@ const PCP = () => {
leaveFrom="opacity-100"
leaveTo="opacity-0"
>
<Listbox.Options className="absolute mt-1 max-h-56 w-1/4 overflow-auto rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black/5 focus:outline-none sm:text-sm">
<Listbox.Options className="absolute z-50 mt-1 max-h-56 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black/5 focus:outline-none sm:text-sm">
<Listbox.Option
key={0}
value={0}
key={-1}
value={-1}
className={({ active }) =>
`relative my-1 cursor-default select-none rounded-xl ${
active ? "bg-gray-200 text-black" : "text-gray-900"
Expand Down Expand Up @@ -197,10 +203,10 @@ const PCPTasks = ({ projectId }: { projectId: number }) => {
</button>
</div>

{tasksQuery.isLoading ? (
{tasksQuery.isLoading || !tasksQuery.data ? (
<p>loading...</p>
) : tasksQuery.isError ? (
<NoDataCard text={tasksQuery.error.message} />
) : tasksQuery.data && typeof tasksQuery.data === "string" ? (
<NoDataCard text={tasksQuery.data} />
) : (
tasksQuery.data && (
<div className="mt-2">
Expand Down Expand Up @@ -239,8 +245,8 @@ const PCPTasksDialogContent = ({ projectId }: { projectId: number }) => {
mutationFn: updateTask,
});

if (tasksHistoryQuery.isError) {
return <NoDataCard text={tasksHistoryQuery.error.message} />;
if (tasksHistoryQuery.data && typeof tasksHistoryQuery.data === "string") {
return <NoDataCard text={tasksHistoryQuery.data} />;
}

if (tasksHistoryQuery.isLoading || !tasksHistoryQuery.data) {
Expand Down Expand Up @@ -448,10 +454,10 @@ const PCPResources = ({ projectId }: { projectId: number }) => {
</button>
</div>

{resourcesQuery.isLoading ? (
{resourcesQuery.isLoading || !resourcesQuery.data ? (
<p>loading...</p>
) : resourcesQuery.isError ? (
<NoDataCard text={resourcesQuery.error.message} />
) : resourcesQuery.data && typeof resourcesQuery.data === "string" ? (
<NoDataCard text={resourcesQuery.data} />
) : (
resourcesQuery.data && (
<div className="mt-2">
Expand Down Expand Up @@ -532,8 +538,11 @@ const PCPResourcesDialogContent = ({ projectId }: { projectId: number }) => {
refetchOnWindowFocus: false,
});

if (resourcesHistoryQuery.isError) {
return <NoDataCard text={resourcesHistoryQuery.error.message} />;
if (
resourcesHistoryQuery.data &&
typeof resourcesHistoryQuery.data === "string"
) {
return <NoDataCard text={resourcesHistoryQuery.data} />;
}

if (resourcesHistoryQuery.isLoading || !resourcesHistoryQuery.data) {
Expand Down
4 changes: 0 additions & 4 deletions app/(base)/profile/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,10 @@ import CoWorkersCarousel from "@/components/CoWorkersCarousel";
import ProjectsCarousel from "@/components/ProjectsCarousel";
import ProfileTraits from "@/components/Profile/ProfileTraits";

import { feedbackAnalysis } from "@/services/rag";

const Profile: React.FC<{ params: { id: string } }> = async ({ params }) => {
const user = await getUserInfoById(params.id);
const traits = await getUserSkillsById(params.id);

feedbackAnalysis(53);

return (
<main>
<ProfileBanner user={user} />
Expand Down
4 changes: 3 additions & 1 deletion app/(base)/projects/create/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,9 @@ const CreateProject = () => {
</label>
<MultiSelect
// TODO: make this handle duplicate users
data={employeesQuery.data?.map((member) => member.name)}
data={Array.from(
new Set(employeesQuery.data?.map((member) => member.name)),
)}
renderOption={renderMultiSelectOption}
maxDropdownHeight={180}
// label="Employees of the month"
Expand Down
50 changes: 24 additions & 26 deletions app/(base)/projects/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,30 @@ const Projects = async () => {
const role = await getUserRole();

return (
<div>
<section className="mt-12 flex flex-col">
<div className="mb-8 flex justify-center gap-5">
<h3 className="text-4xl font-medium">My Projects</h3>
{(role === "MANAGER" || role === "ADMIN") && (
<Link
href="/projects/create"
className="rounded-full bg-primary px-5 py-2 font-medium text-white drop-shadow-lg"
>
<button className="">Create</button>
</Link>
)}
</div>
<div className="mx-auto flex flex-wrap items-center justify-center gap-6 overflow-x-auto">
{projects.map((project) => (
<ProjectCard
key={project.id}
id={project.id}
name={project.name}
date={`${formatDate(project.startDate)} - ${formatDate(project.endDate)}`}
description={project.description}
/>
))}
</div>
</section>
</div>
<section className="mt-12 flex flex-col overflow-x-hidden">
<div className="mb-8 flex justify-center gap-5">
<h3 className="text-4xl font-medium">My Projects</h3>
{(role === "MANAGER" || role === "ADMIN") && (
<Link
href="/projects/create"
className="rounded-full bg-primary px-5 py-2 font-medium text-white drop-shadow-lg"
>
<button className="">Create</button>
</Link>
)}
</div>
<div className="mx-auto flex flex-col flex-wrap items-center justify-center gap-6 overflow-x-hidden md:flex-row">
{projects.map((project) => (
<ProjectCard
key={project.id}
id={project.id}
name={project.name}
date={`${formatDate(project.startDate)} - ${formatDate(project.endDate)}`}
description={project.description}
/>
))}
</div>
</section>
);
};

Expand Down
10 changes: 9 additions & 1 deletion app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@tailwind components;
@tailwind utilities;

/* *>* {
/* * > * > * {
outline: red solid 1px;
} */

Expand Down Expand Up @@ -96,3 +96,11 @@
gap: 1rem;
grid-auto-flow: row;
}

.emotion-circle:hover {
transform: scale(1.2);
}

.emotion-box:has(.emotion-circle:hover) .emotion-circle:not(:hover) {
transform: scale(0.9);
}
4 changes: 2 additions & 2 deletions components/Dashboard/DashboardEmotionsSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ const DashboardEmotionsSection: React.FC<EmotionsSectionProps> = ({
Emotions Summary
</p>
</div>
<div className="m-auto grid grid-cols-2 gap-10">
<div className="emotion-box m-auto grid grid-cols-2 gap-10">
{emotionsData.map((circle, index) => (
<div
key={index}
className="flex items-center justify-center drop-shadow-lg transition-transform duration-300 ease-in-out hover:scale-125"
className="emotion-circle flex items-center justify-center drop-shadow-lg transition-transform duration-300 ease-in-out"
>
<Tooltip.Floating label={circle.title} color={circle.gradient.end}>
<div>
Expand Down
6 changes: 3 additions & 3 deletions components/ProgressBar.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
interface InterfaceProgressBar {
width: number; // percentage
height: number; // height in talwindcss
width: number;
height: number;
}

const ProgressBar = ({ width, height }: InterfaceProgressBar) => {
return (
<div className="w-100 rounded-full bg-gray-200 p-1.5">
<div className="w-3/4 rounded-full bg-gray-200 p-1.5">
<div
className={`h-${height} rounded-full bg-gradient-to-r from-primary to-secondary transition-all delay-100 ease-linear`}
style={{ width: `${width}%` }}
Expand Down
1 change: 0 additions & 1 deletion components/modals/ProjectSurvey.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const ProjectSurvey = ({
projectSurveyId,
}: ProjectSurveyProps) => {
const router = useRouter();

const { mutate } = useMutation({
mutationFn: submitProjectAnswer,
onSuccess: () => {
Expand Down
4 changes: 4 additions & 0 deletions components/modals/SprintSurvey.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
import toast from "react-hot-toast";
import { getUserId } from "@/services/user";
import Loader from "../Loader";
import { useRouter } from "next/navigation";

interface SprintSurveyProps {
showModal: boolean;
Expand Down Expand Up @@ -49,6 +50,8 @@ const SprintSurvey = ({
queryFn: async () => await getSprintSurveyQuestions(),
});

const router = useRouter();

const sprintQuestions: Questions[] | undefined = useMemo(() => {
return allSprintQuestions?.filter(
(question) => question.type === ("SPRINT_QUESTION" as QuestionType),
Expand Down Expand Up @@ -163,6 +166,7 @@ const SprintSurvey = ({
const submitSurveyAnswers = useMutation({
mutationFn: () => submitSprintSurveyAnswers(sprintAnswer),
onSuccess: () => {
router.refresh();
queryClient.invalidateQueries({ queryKey: ["notifications"] });
toast.success("Encuesta enviada exitosamente!");
},
Expand Down
3 changes: 3 additions & 0 deletions components/modals/ruler/RulerSurvey.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { getUserId } from "@/services/user";
import { submitRulerSurveyAnswer } from "@/services/rulerSurvey";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import toast from "react-hot-toast";
import { useRouter } from "next/navigation";

interface RulerSurveyProps {
showModal: boolean;
Expand All @@ -16,6 +17,7 @@ interface RulerSurveyProps {

const RulerSurvey = ({ showModal, onClose }: RulerSurveyProps) => {
const queryClient = useQueryClient();
const router = useRouter();
const [step, setStep] = useState<number>(1);
const { data: userId } = useQuery({
queryKey: ["userId"],
Expand Down Expand Up @@ -54,6 +56,7 @@ const RulerSurvey = ({ showModal, onClose }: RulerSurveyProps) => {
mutationFn: () => submitRulerSurveyAnswer(rulerSurveyAnswer),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ["notifications"] });
router.refresh();
toast.success("Encuesta enviada exitosamente!");
},
onError: () => {
Expand Down
4 changes: 0 additions & 4 deletions cypress/cypress.env.json

This file was deleted.

6 changes: 5 additions & 1 deletion cypress/e2e/login.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ describe("Login", () => {
cy.get("label").contains("Email").click().type("[email protected]");
cy.get("label").contains("Password").click().type("cypress");
cy.get("button").contains("Log in").click();
cy.wait(4000);
cy.url().should("include", "/dashboard");
});
it("Visits page not being signed in, and gets redirected to login", () => {
Expand All @@ -12,7 +13,10 @@ describe("Login", () => {
});
it("Tries to sign in with wrong credentials", () => {
cy.visit("/");
cy.get("label").contains("Email").click().type("[email protected]");
cy.get("label")
.contains("Email")
.click()
.type("[email protected]");
cy.get("label").contains("Password").click().type("prueba");
cy.get("button").contains("Log in").click();
cy.get("div").contains("Email or password is not valid.").should("exist");
Expand Down
Loading
Loading