Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
82d743a
standup feature page that takes standup op people and stores it
Pratiyushkumar Apr 26, 2023
9bad1a7
Merge branch 'develop' of https://github.com/Real-Dev-Squad/website-s…
Pratiyushkumar Apr 28, 2023
56dda6c
modified UI design only
Pratiyushkumar Apr 28, 2023
ff23a23
test cases added for the standup feature
Pratiyushkumar May 1, 2023
7d61a87
Delete url.ts
Pratiyushkumar May 2, 2023
63a654f
Merge branch 'develop' of https://github.com/Real-Dev-Squad/website-s…
Pratiyushkumar May 6, 2023
de469f0
modified UI design only
Pratiyushkumar Apr 28, 2023
75a5eb5
test cases added for the standup feature
Pratiyushkumar May 1, 2023
20b7c0f
Made the working standup feature, only API integration remains
Pratiyushkumar May 6, 2023
f1a39e9
Merge branch 'Real-Dev-Squad:develop' into develop
Pratiyushkumar May 6, 2023
e27a5f2
Resolved merge conflicts
Pratiyushkumar May 6, 2023
924a200
Merge branch 'develop' of https://github.com/Real-Dev-Squad/website-s…
Pratiyushkumar May 15, 2023
7ded770
Merge branch 'develop' of https://github.com/Real-Dev-Squad/website-s…
Pratiyushkumar May 15, 2023
bc44ae0
Merge branch 'develop' of https://github.com/Real-Dev-Squad/website-s…
Pratiyushkumar May 17, 2023
5869772
modified UI design only
Pratiyushkumar Apr 28, 2023
3277362
test cases added for the standup feature
Pratiyushkumar May 1, 2023
c15d9c2
Made the working standup feature, only API integration remains
Pratiyushkumar May 6, 2023
63f7f56
modified UI design only
Pratiyushkumar Apr 28, 2023
b94c266
Delete url.ts
Pratiyushkumar May 2, 2023
c80e189
updating the code as per the review comments
Pratiyushkumar May 17, 2023
734d730
Merge branch 'feature/standup-feature' of https://github.com/Pratiyus…
Pratiyushkumar May 17, 2023
77f1466
fixed error
Pratiyushkumar May 17, 2023
4d430fd
fixing the errors in the PR
Pratiyushkumar May 17, 2023
ef1f499
deleting formatDate.js
Pratiyushkumar May 17, 2023
6e207f3
fixed the api.ts file and standup.ts file
Pratiyushkumar May 17, 2023
33c86ec
addded comments and also removed unwanted file
Pratiyushkumar May 17, 2023
47cda6a
fixed the suggested changes in PR
Pratiyushkumar May 20, 2023
d03eb67
Merge branch 'develop' of https://github.com/Real-Dev-Squad/website-s…
Pratiyushkumar May 20, 2023
8305d20
PR review comments fixed
Pratiyushkumar May 22, 2023
dd8a827
comments removed from standup.type file
Pratiyushkumar May 22, 2023
5f32fa8
adding memo and useEffect dependency
Pratiyushkumar May 22, 2023
e532b6b
changes fixed as per PR review comments
Pratiyushkumar May 24, 2023
beaec0a
pipe symbol fixed and background color change fixed
Pratiyushkumar May 25, 2023
fb96dcb
PR review comments fixed
Pratiyushkumar May 26, 2023
6acc12b
API integration running and feature is ready to be merge
Pratiyushkumar May 27, 2023
0004581
changes done as per comments
Pratiyushkumar May 29, 2023
bab5d57
Merge branch 'develop' of https://github.com/Real-Dev-Squad/website-s…
Pratiyushkumar May 29, 2023
80852ce
Merge branch 'develop' of https://github.com/Pratiyushkumar/website-s…
Pratiyushkumar May 29, 2023
9a8b623
fixed class name as per review
Pratiyushkumar May 30, 2023
ed256f6
fixed the total missed update count
Pratiyushkumar May 31, 2023
93b5631
put my feature behind the feature flag
Pratiyushkumar May 31, 2023
7712e93
fixed className in css
Pratiyushkumar May 31, 2023
a9f3541
fixed edge case of total missed update
Pratiyushkumar May 31, 2023
2eec52a
code bug fixed
Pratiyushkumar May 31, 2023
514616b
Failing test case fixed
Pratiyushkumar May 31, 2023
5b4abac
fixed total missed update and conditional rendering function
Pratiyushkumar Jun 1, 2023
9d25d96
Merge branch 'develop' of https://github.com/Pratiyushkumar/website-s…
Pratiyushkumar Jun 1, 2023
b028f3d
Merge branch 'develop' of https://github.com/Pratiyushkumar/website-s…
Pratiyushkumar Jun 1, 2023
0e07744
Delete standup.test.tsx
Pratiyushkumar Jun 3, 2023
7faf398
Removed Test file and fixed Changes
Pratiyushkumar Jun 3, 2023
d829ec9
fixed minor changes
Pratiyushkumar Jun 3, 2023
9ac2ee9
removed tag type, improved variable name
Pratiyushkumar Jun 4, 2023
5e316b4
used moment library in getTotalMissedUpdates function
Pratiyushkumar Jun 4, 2023
ed333fa
Merge branch 'Real-Dev-Squad:develop' into develop
Pratiyushkumar Jun 5, 2023
3bb87f7
fixed task progress banner
Pratiyushkumar Jun 6, 2023
c17d42e
fixed the if else condition in standup file
Pratiyushkumar Jun 7, 2023
8fae607
Merge branch 'develop' into feature/standup-feature
Pratiyushkumar Jun 7, 2023
3281d41
Merge branch 'Real-Dev-Squad:develop' into develop
Pratiyushkumar Jun 8, 2023
ee69597
Merge branch 'develop' into feature/standup-feature
Pratiyushkumar Jun 14, 2023
69774e9
Merge branch 'Real-Dev-Squad:develop' into develop
Pratiyushkumar Jun 15, 2023
ca67d89
Merge branch 'develop' of https://github.com/Pratiyushkumar/website-s…
Pratiyushkumar Jun 15, 2023
591b9e8
Merge branch 'feature/standup-feature' of https://github.com/Pratiyus…
Pratiyushkumar Jun 15, 2023
3c64d79
removed fragments and useEffect hook
Pratiyushkumar Jun 16, 2023
b3bdcec
removed comments
Pratiyushkumar Jun 16, 2023
d8187a0
fixed css and css classname
Pratiyushkumar Jun 17, 2023
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
1 change: 1 addition & 0 deletions src/app/services/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const api = createApi({
'User',
'Tags',
'Levels',
'User_Standup',
],
/**
* This api has endpoints injected in adjacent files,
Expand Down
8 changes: 7 additions & 1 deletion src/app/services/progressesApi.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { api } from './api';
import { userDetails } from '@/types/standup.type';

export const progressesApi = api.injectEndpoints({
endpoints: (builder) => ({
Expand All @@ -13,7 +14,12 @@ export const progressesApi = api.injectEndpoints({
},
}),
}),
userProgressDetails: builder.query<userDetails, string | undefined>({
query: (id): string => `/progresses?userId=${id}`,
providesTags: ['User_Standup'],
}),
}),
});

export const { useSaveProgressMutation } = progressesApi;
export const { useSaveProgressMutation, useUserProgressDetailsQuery } =
progressesApi;
70 changes: 27 additions & 43 deletions src/components/Layout/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { FC, ReactNode } from 'react';
import { FC, ReactNode, Fragment } from 'react';
import Link from 'next/link';
import { useRouter } from 'next/router';
import Footer from '@/components/footer';
import styles from '@/components/Layout/Layout.module.scss';
import NavBar from '@/components/navBar';
import { navBarContentMock, featureFlags } from '@/constants/navbar-Content';
import { useGetUserQuery } from '@/app/services/userApi';
import { Loader } from '../tasks/card/Loader';

Expand Down Expand Up @@ -37,50 +38,33 @@ const Layout: FC<Props> = ({ children }) => {
{isLoading && <Loader />}
<div className={styles.wrapper}>
<div className={styles.header}>
{navBarContent('Tasks', '/', router.pathname === '/')}|
{navBarContent(
'Issues',
'/issues',
router.pathname === '/issues'
)}
|
{navBarContent(
'Mine',
'/mine',
router.pathname === '/mine'
)}
{/* TODO: Uncomment when DS(Chanllenges) is ready */}
{/* |
{navBarContent(
'DS',
'/challenges',
router.pathname === '/challenges'
)} */}
|
{navBarContent(
'Open PRs',
'/openPRs',
router.pathname === '/openPRs'
)}
|
{navBarContent(
'Stale PRs',
'/stale-pr',
router.pathname === '/stale-pr'
)}
|
{navBarContent(
'Idle Users',
'/idle-users',
router.pathname === '/idle-users'
)}
{dev && (
<>
|
{navBarContentMock.map((element, index) => (
<Fragment key={index}>
{navBarContent(
'Availability Panel',
'/availability-panel'
element.title,
element.refURL,
router.pathname === element.pathName
)}
{element.pipeSymbol}
</Fragment>
))}
{dev && (
<>
{featureFlags.map((element, index) => {
return (
<>
{element.pipeSymbol}
<Fragment key={index}>
{navBarContent(
element.title,
element.refURL,
router.pathname ===
element.pathName
)}
</Fragment>
</>
);
})}
</>
)}
</div>
Expand Down
12 changes: 5 additions & 7 deletions src/components/ProgressForm/ProgressForm.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ $section-padding-top-bottom: $base-unit * 30;
$section-padding-left-right: $base-unit * 25;

.banner {
width: 60%;
margin: $diff-margin auto;
background-color: $color-blue;
color: $color-white;
border: 1px solid $color-red;
font-size: $base-unit * 4;
display: flex;
flex-direction: column;
align-items: center;
align-items: flex-start;
justify-content: center;
width: 100%;
margin-top: $diff-margin;
margin-left: 8.2rem;
}

.mark {
Expand Down
28 changes: 19 additions & 9 deletions src/components/ProgressForm/ProgressHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
import styles from '@/components/ProgressForm/ProgressForm.module.scss';
import { FC } from 'react';
import styles from '@/components/standup/standupContainer.module.scss';
import { progressHeaderProps } from '@/types/ProgressUpdates';

function ProgressHeader() {
const ProgressHeader: FC<progressHeaderProps> = ({
totalMissedUpdates,
updateType,
}) => {
return (
<header className={styles.banner}>
<p>
You have <span className={styles.mark}> 2 missed</span> Progress
Updates
<div className={styles.progressBanner}>
<p className={styles.bannerPara}>
You have
<span className={styles.totalMissedUpdates}>
{totalMissedUpdates} missed
</span>
{updateType} updates
</p>
<p>Lets try to avoid missing updates</p>
</header>
<p className={styles.bannerPara}>
Let&apos;s try to avoid having zero days
</p>
</div>
);
}
};

export default ProgressHeader;
20 changes: 16 additions & 4 deletions src/components/ProgressForm/ProgressLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import { FC } from 'react';

import getCurrentDate from '@/utils/getLatestDate';

Expand All @@ -8,19 +8,31 @@ import ProgressForm from './ProgressForm';
import styles from '@/components/ProgressForm/ProgressForm.module.scss';

import { questions } from '@/constants/ProgressUpdates';
import { getTotalMissedUpdates } from '@/utils/getTotalMissedUpdate';
import { useUserProgressDetailsQuery } from '@/app/services/progressesApi';
import { useGetUserQuery } from '@/app/services/userApi';

function ProgressLayout() {
const ProgressLayout: FC = () => {
const { data: user } = useGetUserQuery();
const { data: userStandupdata } = useUserProgressDetailsQuery(user?.id);
const standupDates = userStandupdata?.data?.map((element) => element.date);
const totalMissedUpdates = getTotalMissedUpdates(standupDates || []);
return (
<>
<NavBar />
<ProgressHeader />
<div className={styles.banner}>
<ProgressHeader
totalMissedUpdates={totalMissedUpdates}
updateType="Progress"
/>
</div>
<section className={styles.container}>
<h1 className={styles.formHeading}>Task Updates</h1>
<h2 className={styles.date}>On {getCurrentDate()}</h2>
<ProgressForm questions={questions} />
</section>
</>
);
}
};

export default ProgressLayout;
38 changes: 38 additions & 0 deletions src/components/standup/FormInputComponent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { FC } from 'react';

import styles from '@/components/standup/standupContainer.module.scss';
import { InputProps } from '@/types/standup.type';

const FormInputComponent: FC<InputProps> = ({
placeholder,
name,
value,
dataTestId,
labelValue,
htmlFor,
inputId,
handleChange,
}) => {
return (
<>
<label className={styles.updateHeading} htmlFor={htmlFor}>
{labelValue}
</label>
<input
id={inputId}
data-testid={dataTestId}
type="text"
className={styles.inputField}
placeholder={placeholder}
required
name={name}
value={value}
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
handleChange(e)
}
/>
</>
);
};

export default FormInputComponent;
135 changes: 135 additions & 0 deletions src/components/standup/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
import { FC, useState, useEffect } from 'react';
import moment from 'moment';
import styles from '@/components/standup/standupContainer.module.scss';

import {
useSaveProgressMutation,
useUserProgressDetailsQuery,
} from '@/app/services/progressesApi';
import { useGetUserQuery } from '@/app/services/userApi';

import FormInputComponent from './FormInputComponent';
import { standupUpdateType } from '@/types/standup.type';
import { getTotalMissedUpdates } from '@/utils/getTotalMissedUpdate';
import { toast, ToastTypes } from '@/helperFunctions/toast';
import {
ERROR_MESSAGE,
STANDUP_SUBMISSION_SUCCESS,
} from '@/constants/constants';
import ProgressHeader from '../ProgressForm/ProgressHeader';

const defaultState = {
type: 'user',
completed: '',
planned: '',
blockers: '',
};

const StandUpContainer: FC = () => {
const [standupUpdate, setStandupUpdate] =
useState<standupUpdateType>(defaultState);

const [addStandup] = useSaveProgressMutation();
const { data: user } = useGetUserQuery();
const { data: userStandupdata } = useUserProgressDetailsQuery(user?.id);

const { SUCCESS, ERROR } = ToastTypes;
const standupDates = userStandupdata?.data?.map((element) => element.date);
const totalMissedUpdates = getTotalMissedUpdates(standupDates || []);
const yesterdayDate = moment().subtract(1, 'days').format('MMMM DD, YYYY');

const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
setStandupUpdate((prevStandupUpdate) => ({
...prevStandupUpdate,
[event.target.name]: event.target.value,
}));
};
const isValidate = () => {
return (
standupUpdate.completed !== '' &&
standupUpdate.planned !== '' &&
standupUpdate.blockers !== ''
);
};

const buttonStyleClass = !isValidate()
? `${styles.nonActiveButton}`
: `${styles.activeButton}`;

const handleFormSubmission = async (
event: React.FormEvent<HTMLFormElement>
) => {
event.preventDefault();
try {
await addStandup(standupUpdate);
toast(SUCCESS, STANDUP_SUBMISSION_SUCCESS);
setStandupUpdate(defaultState);
} catch (error) {
console.error(error);
toast(ERROR, ERROR_MESSAGE);
}
};

return (
<>
<section className="container">
<div className={styles.standupContainer}>
<ProgressHeader
totalMissedUpdates={totalMissedUpdates}
updateType="Standup"
/>

<div className={styles.standupUpdateContainer}>
<h1 className={styles.standupTitle}>Standup Update</h1>
<form
className={styles.standupForm}
onSubmit={handleFormSubmission}
>
<fieldset className={styles.formFields}>
<FormInputComponent
htmlFor="completed"
labelValue={yesterdayDate}
dataTestId="completedInputField"
placeholder="e.g Raised PR for adding new config"
name="completed"
value={standupUpdate.completed}
inputId="completed"
handleChange={handleChange}
/>
<FormInputComponent
htmlFor="planned"
labelValue="Today"
dataTestId="todayInputField"
placeholder="e.g Refactor signup to support Google login"
name="planned"
value={standupUpdate.planned}
inputId="planned"
handleChange={handleChange}
/>
<FormInputComponent
htmlFor="blockers"
labelValue="Blockers"
dataTestId="blockerInputField"
placeholder="e.g Waiting on identity team to deploy FF"
name="blockers"
value={standupUpdate.blockers}
inputId="blockers"
handleChange={handleChange}
/>
</fieldset>
<button
className={`${styles.submitButton} ${buttonStyleClass}`}
disabled={!isValidate()}
type="submit"
>
Submit
</button>
</form>
</div>
</div>
</section>
</>
);
};

export default StandUpContainer;
Loading