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

Feature/sprints functionality pt4 #136

Merged
merged 68 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
d1f1478
refactor: update forms enum
JaneMoroz May 2, 2024
5879c1c
refactor: update cacheTag
JaneMoroz May 2, 2024
ad4dcd0
refactor: update `validateInput` in order to use multiple choice
JaneMoroz May 2, 2024
a15ddde
fix: prettier + minor import fix
JaneMoroz May 2, 2024
3ebd95f
style: fix padding
JaneMoroz May 2, 2024
dfa0ab6
feat: fetch form
JaneMoroz May 2, 2024
3cdcb94
refactor: move `createValidationSchema` into a separate file
JaneMoroz May 2, 2024
7fe6d44
feat: add `WeeklyCheckInForm` submit functionality pt1
JaneMoroz May 2, 2024
fa673a2
Merge branch 'feature/sprints-functionality-pt3' into feature/sprints…
JaneMoroz May 2, 2024
4c01d01
fix: lint
JaneMoroz May 2, 2024
701b9a0
Merge branch 'feature/sprints-functionality-pt3' into feature/sprints…
JaneMoroz May 5, 2024
1efb1c1
feat: add `WeeklyCheckInForm` submit functionality pt2
JaneMoroz May 5, 2024
fcc9f5b
refactor: refactor responseBody
JaneMoroz May 5, 2024
035a27c
feat: add `submit voyage project` functionality
JaneMoroz May 5, 2024
69bd236
fix: lint&prettier
JaneMoroz May 5, 2024
fa9ef06
Merge branch 'dev' into feature/sprints-functionality-pt4
JaneMoroz May 6, 2024
326fb75
feat: add `radioGroup` form input
JaneMoroz May 6, 2024
8eb5252
feat: add `radioIcon` form input
JaneMoroz May 6, 2024
8dab6da
fix: lint&prettier
JaneMoroz May 6, 2024
16dc338
fix: show correct timezone (with daylightSaving is being considered)
JaneMoroz May 7, 2024
e3f7b09
feat: add feat: add `scale` form input
JaneMoroz May 7, 2024
7e714fe
refactor: make `leftTitle`, `rightTitle` and `label` dynamic
JaneMoroz May 7, 2024
0aa12db
fix: lint
JaneMoroz May 7, 2024
0a4e775
fix: revert `DateTimeComponent` changes
JaneMoroz May 8, 2024
de44f7f
feat: add feat: add boolean form input
JaneMoroz May 8, 2024
b8b28a6
fix: lint
JaneMoroz May 8, 2024
2295a80
Merge branch 'dev' into feature/sprints-functionality-pt4
JaneMoroz May 13, 2024
cc5d361
fix: lint + prettier
JaneMoroz May 13, 2024
5e35f8a
Merge branch 'fix/sprints' into feature/sprints-functionality-pt4
JaneMoroz May 13, 2024
6dc4ecc
feat: add `shortText` form input
JaneMoroz May 13, 2024
887d1be
feat: add `teamMembersCheckbox` input
JaneMoroz May 13, 2024
4189eb2
refactor: update response body+validation schema
JaneMoroz May 13, 2024
990e0af
style: submit voyage btn fix
JaneMoroz May 13, 2024
2c61b81
Merge branch 'dev' into feature/sprints-functionality-pt4
JaneMoroz May 13, 2024
dc2825d
feat: add status check for `weekly checkin form submission`
JaneMoroz May 14, 2024
09990ba
refactor: refactor `FromInputs` options
JaneMoroz May 14, 2024
73f08d2
fix: lint&prettier
JaneMoroz May 14, 2024
5131bc5
refactor: move form related components to global components, create f…
JaneMoroz May 14, 2024
fb78966
fix: lint
JaneMoroz May 14, 2024
e798691
fix: fix import error
JaneMoroz May 14, 2024
47ed0ff
refactor: refactor label text
JaneMoroz May 14, 2024
348cb6f
refactor: remove some checks for now
JaneMoroz May 14, 2024
fcd9f9c
refactor: renaming
JaneMoroz May 14, 2024
fbe9ff8
refactor: renaming
JaneMoroz May 14, 2024
f40c730
refactor: clean up
JaneMoroz May 16, 2024
6af0b62
Merge branch 'fix/-fix-current-date' into feature/sprints-functionali…
JaneMoroz May 20, 2024
f42ae04
Merge branch 'dev' into feature/sprints-functionality-pt4
JaneMoroz May 23, 2024
4ba995d
feat: add `url` form input + update `createValidationSchema` and `cre…
JaneMoroz May 30, 2024
04191ed
Merge branch 'dev' into feature/sprints-functionality-pt4
JaneMoroz May 30, 2024
4fdbed2
Merge branch 'dev' into feature/sprints-functionality-pt4
JaneMoroz May 30, 2024
a9fc519
Merge branch 'dev' into feature/sprints-functionality-pt4
JaneMoroz May 30, 2024
e05e725
Merge branch 'dev' into feature/sprints-functionality-pt4
JaneMoroz Jun 1, 2024
5771ac8
style: fix action button text + icon
JaneMoroz Jun 1, 2024
0f3b9a7
feat: add `projectSubmitted` status to userSlice + render `Submit Voy…
JaneMoroz Jun 1, 2024
fec9d5a
fix: allow users to submit sprints forms even if there's no meeting
JaneMoroz Jun 1, 2024
594c62e
fix: fix button's name
JaneMoroz Jun 1, 2024
d08f5db
fix: fix validation rules
JaneMoroz Jun 1, 2024
73e76c1
fix: lint + prettier
JaneMoroz Jun 1, 2024
a7d1578
fix: fix `TechStackCard` lint error
JaneMoroz Jun 1, 2024
d98f7d0
fix: fix storybook lint error
JaneMoroz Jun 1, 2024
bbd34c2
refactor: refactor spront action buttons
JaneMoroz Jun 5, 2024
e7dbb50
fix: fix validation issue, caused by the default values not equal str…
JaneMoroz Jun 5, 2024
f9d7776
feat: add redirect, when a user tries to access a weekly checkin form…
JaneMoroz Jun 5, 2024
c34b14f
Merge branch 'dev' into feature/sprints-functionality-pt4
JaneMoroz Jun 5, 2024
e7b163d
fix: fix `redirect` bug
JaneMoroz Jun 6, 2024
227b506
fix: reuse `getCurrentVoyageTeam`
JaneMoroz Jun 6, 2024
e4d4270
fix: lint&prettier
JaneMoroz Jun 6, 2024
9d07130
fix: remove `required` from `isHours`
JaneMoroz Jun 6, 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
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Button from "@/components/Button";
import TextInput from "@/components/inputs/TextInput";
import { onOpenModal } from "@/store/features/modal/modalSlice";
import { useAppDispatch } from "@/store/hooks";
import { validateTextInput } from "@/helpers/form/validateInput";
import { validateTextInput } from "@/utils/form/validateInput";
import routePaths from "@/utils/routePaths";
import useServerAction from "@/hooks/useServerAction";
import Spinner from "@/components/Spinner";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { serverSignIn } from "@/app/(auth)/authService";

import Button from "@/components/Button";
import TextInput from "@/components/inputs/TextInput";
import { validateTextInput } from "@/helpers/form/validateInput";
import { validateTextInput } from "@/utils/form/validateInput";
import { clientSignIn } from "@/store/features/auth/authSlice";
import { onOpenModal } from "@/store/features/modal/modalSlice";
import { useAppDispatch } from "@/store/hooks";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as z from "zod";
import { zodResolver } from "@hookform/resolvers/zod";
import Button from "@/components/Button";
import TextInput from "@/components/inputs/TextInput";
import { validateTextInput } from "@/helpers/form/validateInput";
import { validateTextInput } from "@/utils/form/validateInput";
import routePaths from "@/utils/routePaths";

const validationSchema = z.object({
Expand Down
2 changes: 1 addition & 1 deletion src/app/(auth)/users/components/NewPasswordContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import TextInput from "@/components/inputs/TextInput";
import Button from "@/components/Button";
import { onOpenModal } from "@/store/features/modal/modalSlice";
import { useAppDispatch } from "@/store/hooks";
import { validateTextInput } from "@/helpers/form/validateInput";
import { validateTextInput } from "@/utils/form/validateInput";
import useServerAction from "@/hooks/useServerAction";
import Spinner from "@/components/Spinner";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useParams } from "next/navigation";
import { PencilSquareIcon } from "@heroicons/react/24/outline";
import { type SetStateAction, useEffect } from "react";
import TextInput from "@/components/inputs/TextInput";
import { validateTextInput } from "@/helpers/form/validateInput";
import { validateTextInput } from "@/utils/form/validateInput";
import { useAppDispatch } from "@/store/hooks";
import { editHours } from "@/app/(main)/my-voyage/[teamId]/directory/directoryService";
import { onOpenModal } from "@/store/features/modal/modalSlice";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { type Dispatch, type SetStateAction, useEffect } from "react";
import { useParams } from "next/navigation";
import Button from "@/components/Button";
import TextInput from "@/components/inputs/TextInput";
import { validateTextInput } from "@/helpers/form/validateInput";
import { validateTextInput } from "@/utils/form/validateInput";
import { useAppDispatch } from "@/store/hooks";
import useServerAction from "@/hooks/useServerAction";
import { addFeature } from "@/myVoyage/features/featuresService";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { type SubmitHandler, useForm } from "react-hook-form";
import { useEffect, useRef, useState } from "react";
import Card from "./Card";
import TextInput from "@/components/inputs/TextInput";
import { validateTextInput } from "@/helpers/form/validateInput";
import { validateTextInput } from "@/utils/form/validateInput";
import { type Features } from "@/store/features/features/featuresSlice";
import useServerAction from "@/hooks/useServerAction";
import { editFeature } from "@/myVoyage/features/featuresService";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useState, useEffect } from "react";
import Button from "@/components/Button";
import TextInput from "@/components/inputs/TextInput";
import Textarea from "@/components/inputs/Textarea";
import { validateTextInput } from "@/helpers/form/validateInput";
import { validateTextInput } from "@/utils/form/validateInput";
import { useAppDispatch, useIdeation } from "@/store/hooks";
import { type IdeationData } from "@/store/features/ideation/ideationSlice";
import Spinner from "@/components/Spinner";
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Suspense } from "react";

import WeeklyCheckInWrapper from "@/myVoyage/sprints/components/WeeklyCheckInWrapper";
import Spinner from "@/components/Spinner";

interface WeeklyCheckInPageProps {
params: {
teamId: string;
meetingId: string;
sprintNumber: string;
};
}

export default function WeeklyCheckInPage({ params }: WeeklyCheckInPageProps) {
return (
<Suspense fallback={<Spinner />}>
<WeeklyCheckInWrapper params={params} />
</Suspense>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Suspense } from "react";

import SubmitProjectWrapper from "@/myVoyage/sprints/components/SubmitProjectWrapper";
import Spinner from "@/components/Spinner";

interface VoyageSubmissionPageProps {
params: {
teamId: string;
meetingId: string;
sprintNumber: string;
};
}

export default function VoyageSubmissionPage({
params,
}: VoyageSubmissionPageProps) {
return (
<Suspense fallback={<Spinner />}>
<SubmitProjectWrapper params={params} />
</Suspense>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import { type Voyage, type Sprint } from "@/store/features/sprint/sprintSlice";
import { getUser } from "@/utils/getUser";
import { getCurrentVoyageData } from "@/utils/getCurrentVoyageData";
import routePaths from "@/utils/routePaths";
import {
getSprintCheckinIsStatus,
getVoyageProjectStatus,
} from "@/utils/getFormStatus";

function getMeeting(sprints: Sprint[], sprintNumber: number) {
const sprint = sprints.find((sprint) => sprint.number === sprintNumber);
Expand Down Expand Up @@ -79,6 +83,15 @@ export default async function EmptySprintWrapper({
`/my-voyage/${teamId}/sprints/${sprintNumber}/meeting/${meeting.id}`,
);
} else {
// Check if a checkin form for the current sprint has been submitted
const sprintCheckinIsSubmitted = getSprintCheckinIsStatus(
user,
sprintNumber,
);

// Check if a voyage project has been submitted
const voyageProjectIsSubmitted = getVoyageProjectStatus(user, teamId);

return (
<div className="flex w-full flex-col gap-y-10">
<VoyagePageBannerContainer
Expand All @@ -94,7 +107,12 @@ export default async function EmptySprintWrapper({
/>
</VoyagePageBannerContainer>
<ProgressStepper currentSprintNumber={currentSprintNumber} />
<SprintActions params={params} />
<SprintActions
params={params}
sprintCheckinIsSubmitted={sprintCheckinIsSubmitted}
voyageProjectIsSubmitted={voyageProjectIsSubmitted}
currentSprintNumber={currentSprintNumber}
/>
<EmptySprintState />
<EmptySprintProvider voyage={voyageData} />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import {
ArrowRightIcon,
PlusIcon,
} from "@heroicons/react/24/outline";
import {
CheckCircleIcon,
RocketLaunchIcon as SolidRocketLaunchIcon,
} from "@heroicons/react/24/solid";

import Button from "@/components/Button";
import routePaths from "@/utils/routePaths";
Expand All @@ -16,53 +20,109 @@ interface SprintActionsProps {
meetingId?: string;
sprintNumber: string;
};
sprintCheckinIsSubmitted: boolean;
voyageProjectIsSubmitted: boolean;
currentSprintNumber: number;
}

export default function SprintActions({ params }: SprintActionsProps) {
export default function SprintActions({
params,
sprintCheckinIsSubmitted,
voyageProjectIsSubmitted,
currentSprintNumber,
}: SprintActionsProps) {
const [teamId, meetingId, sprintNumber] = [
params.teamId,
params.meetingId,
params.sprintNumber,
];

const isCurrentSprint = sprintNumber === currentSprintNumber.toString();
const submitVoyageIsAllowed = sprintNumber === "5" || sprintNumber === "6";
return (
<div className="flex justify-between rounded-2xl border border-base-100 bg-base-200 p-5 shadow-md">
{/* TODO: add animated variant to Button.tsx ??? */}
<Link
href={
meetingId
? routePaths.submitVoyagePage(teamId, sprintNumber, meetingId)
: routePaths.dashboardPage()
}
>

function renderWeeklyCheckinButton() {
if (sprintCheckinIsSubmitted) {
return (
<Button variant="primary" size="lg" className="group" disabled={true}>
<CheckCircleIcon className="h-[18px] w-[18px]" />
Check-in Submitted
</Button>
);
} else {
if (isCurrentSprint) {
return (
<Button
variant="primary"
size="lg"
className="group"
disabled={false}
>
<DocumentCheckIcon className="h-[18px] w-[18px]" />
Submit Check-in
<ArrowRightIcon className="h-[18px] w-0 transition-all group-hover:w-[18px]" />
</Button>
);
} else {
return (
<Button variant="primary" size="lg" className="group" disabled={true}>
<DocumentCheckIcon className="h-[18px] w-[18px]" />
Submit Check-in
</Button>
);
}
}
}

function renderSubmitVoyageButton() {
if (submitVoyageIsAllowed) {
return (
<Button
variant="secondary"
size="lg"
className="group"
disabled={!meetingId || !submitVoyageIsAllowed}
disabled={false}
>
<RocketLaunchIcon className="h-[18px] w-[18px]" /> Submit Voyage
{(submitVoyageIsAllowed || !meetingId) && (
<ArrowRightIcon className="h-[18px] w-0 transition-all group-hover:w-[18px] group-disabled:group-hover:w-0" />
)}
<RocketLaunchIcon className="h-[18px] w-[18px]" />
Submit Voyage
<ArrowRightIcon className="h-[18px] w-0 transition-all group-hover:w-[18px]" />
</Button>
);
} else {
if (voyageProjectIsSubmitted) {
return (
<Button
variant="secondary"
size="lg"
className="group"
disabled={true}
>
<RocketLaunchIcon className="h-[18px] w-[18px]" />
Voyage Submitted
</Button>
);
} else {
return (
<Button
variant="secondary"
size="lg"
className="group"
disabled={true}
>
<SolidRocketLaunchIcon className="h-[18px] w-[18px]" />
Submit Voyage
</Button>
);
}
}
}

return (
<div className="flex justify-between rounded-2xl border border-base-100 bg-base-200 p-5 shadow-md">
<Link href={routePaths.submitVoyagePage(teamId, sprintNumber)}>
{renderSubmitVoyageButton()}
</Link>
<Link
href={
meetingId
? routePaths.weeklyCheckInPage(teamId, sprintNumber, meetingId)
: routePaths.dashboardPage()
}
>
<Button
variant="primary"
size="lg"
className="group"
disabled={!meetingId}
>
<DocumentCheckIcon className="h-[18px] w-[18px]" /> Submit Check-in
<ArrowRightIcon className="h-[18px] w-0 transition-all group-hover:w-[18px] group-disabled:group-hover:w-0" />
</Button>
<Link href={routePaths.weeklyCheckInPage(teamId, sprintNumber)}>
{renderWeeklyCheckinButton()}
</Link>
<Link
href={
Expand All @@ -72,7 +132,7 @@ export default function SprintActions({ params }: SprintActionsProps) {
}
>
<Button variant="outline" size="lg" className="group">
<CalendarIcon className="h-[18px] w-[18px]" />{" "}
<CalendarIcon className="h-[18px] w-[18px]" />
{meetingId ? "Edit Meeting" : "Create Meeting"}
{meetingId ? null : (
<PlusIcon className="h-[18px] w-0 transition-all group-hover:w-[18px]" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ import { getUser } from "@/utils/getUser";
import { getSprintCache } from "@/utils/getSprintCache";
import { getCurrentVoyageData } from "@/utils/getCurrentVoyageData";
import routePaths from "@/utils/routePaths";
import { SprintSections } from "@/utils/sections";
import { Forms } from "@/utils/form/formsEnums";
import {
getSprintCheckinIsStatus,
getVoyageProjectStatus,
} from "@/utils/getFormStatus";

export async function fetchMeeting({
sprintNumber,
Expand Down Expand Up @@ -123,6 +127,12 @@ export default async function SprintWrapper({ params }: SprintWrapperProps) {
redirect(`/my-voyage/${teamId}/sprints/${currentSprintNumber}/`);
}

// Check if a checkin form for the current sprint has been submitted
const sprintCheckinIsSubmitted = getSprintCheckinIsStatus(user, sprintNumber);

// Check if a voyage project has been submitted
const voyageProjectIsSubmitted = getVoyageProjectStatus(user, teamId);

return (
<div className="flex w-full flex-col gap-y-10">
<VoyagePageBannerContainer
Expand All @@ -139,7 +149,12 @@ export default async function SprintWrapper({ params }: SprintWrapperProps) {
</VoyagePageBannerContainer>

<ProgressStepper currentSprintNumber={currentSprintNumber} />
<SprintActions params={params} />
<SprintActions
params={params}
sprintCheckinIsSubmitted={sprintCheckinIsSubmitted}
voyageProjectIsSubmitted={voyageProjectIsSubmitted}
currentSprintNumber={currentSprintNumber}
/>
<MeetingOverview
title={meetingData.title!}
dateTime={meetingData.dateTime!}
Expand All @@ -152,10 +167,10 @@ export default async function SprintWrapper({ params }: SprintWrapperProps) {
params={params}
notes={meetingData.notes}
planning={sectionsData.find(
(section) => section.form.id === Number(SprintSections.planning),
(section) => section.form.id === Number(Forms.planning),
)}
review={sectionsData.find(
(section) => section.form.id === Number(SprintSections.review),
(section) => section.form.id === Number(Forms.review),
)}
/>
</div>
Expand Down
Loading
Loading