From 76d25043011c1b9b61a804a0200f41bb92ef1d95 Mon Sep 17 00:00:00 2001 From: DeepanshuSarswat Date: Mon, 14 Nov 2022 20:06:17 +0530 Subject: [PATCH 1/4] Filter Data --- .../member-profile/contribution/index.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/components/member-profile/contribution/index.js b/src/components/member-profile/contribution/index.js index 414eaa6f..0798d51c 100644 --- a/src/components/member-profile/contribution/index.js +++ b/src/components/member-profile/contribution/index.js @@ -21,6 +21,8 @@ const Contribution = ({ contribution, fullName, imageLink, devUser }) => { const url = featureUrl || prList[0]?.url; const gotoUrl = () => url && window.open(url, '_blank'); const urlObj = url && new URL(url); + const closePullRequest = contribution.prList.filter((pullRequest)=> pullRequest.state == 'closed'); + contribution.prList = closePullRequest; const contributionCard = () => ( { @@ -109,8 +111,8 @@ const ContributionCard = ({ featureLiveOnText = featureLiveDate; } } else { - const createdAt = +new Date(prList[0].createdAt); - const updatedAt = +new Date(prList[0].updatedAt); + const createdAt = +new Date(prList[0]?.createdAt); + const updatedAt = +new Date(prList[0]?.updatedAt); if (prList[0].state === 'closed') { completedDate = timeWas(createdAt, false, updatedAt); completedText = ( @@ -121,7 +123,10 @@ const ContributionCard = ({ } } return ( -
+ { featureTitle && + (
setShowSettings(true)} onMouseLeave={() => setShowSettings(false)} > @@ -164,7 +169,9 @@ const ContributionCard = ({
)}
-
+ ) + } + ); }; From d127538a43baf5af33ebe3bb2cea5560ae2b9130 Mon Sep 17 00:00:00 2001 From: DeepanshuSarswat Date: Mon, 14 Nov 2022 22:16:33 +0530 Subject: [PATCH 2/4] filter data --- src/components/member-profile/contribution/index.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/components/member-profile/contribution/index.js b/src/components/member-profile/contribution/index.js index 0798d51c..d91d12bf 100644 --- a/src/components/member-profile/contribution/index.js +++ b/src/components/member-profile/contribution/index.js @@ -38,7 +38,7 @@ const Contribution = ({ contribution, fullName, imageLink, devUser }) => { return (
- {contributionCard()} + {prList[0]?.title && contributionCard()}
); @@ -49,7 +49,7 @@ const Contribution = ({ contribution, fullName, imageLink, devUser }) => { onClick={gotoUrl} aria-hidden="true" > - {contributionCard()} + {prList[0]?.title && contributionCard()} ); }; @@ -123,10 +123,7 @@ const ContributionCard = ({ } } return ( - - <> - { featureTitle && - (
setShowSettings(true)} onMouseLeave={() => setShowSettings(false)} > @@ -169,9 +166,7 @@ const ContributionCard = ({
)}
- ) - } - + ); }; From 93c758e44eb5ea771133e8df3ffaf0f687cdcbcc Mon Sep 17 00:00:00 2001 From: DeepanshuSarswat Date: Mon, 14 Nov 2022 22:23:02 +0530 Subject: [PATCH 3/4] filter data --- src/components/member-profile/contribution/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/member-profile/contribution/index.js b/src/components/member-profile/contribution/index.js index d91d12bf..5c292a9a 100644 --- a/src/components/member-profile/contribution/index.js +++ b/src/components/member-profile/contribution/index.js @@ -21,7 +21,7 @@ const Contribution = ({ contribution, fullName, imageLink, devUser }) => { const url = featureUrl || prList[0]?.url; const gotoUrl = () => url && window.open(url, '_blank'); const urlObj = url && new URL(url); - const closePullRequest = contribution.prList.filter((pullRequest)=> pullRequest.state == 'closed'); + const closePullRequest = contribution.prList.filter((data)=> data.state === 'closed'); contribution.prList = closePullRequest; const contributionCard = () => ( Date: Sun, 20 Nov 2022 18:02:02 +0530 Subject: [PATCH 4/4] filter data --- src/components/member-profile/contribution/index.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components/member-profile/contribution/index.js b/src/components/member-profile/contribution/index.js index 5c292a9a..54cf8dd1 100644 --- a/src/components/member-profile/contribution/index.js +++ b/src/components/member-profile/contribution/index.js @@ -14,15 +14,18 @@ const renderPRLinks = (prList) => }); const Contribution = ({ contribution, fullName, imageLink, devUser }) => { + const contributions = contribution; const { task: { featureUrl }, prList, - } = contribution; + } = contributions; const url = featureUrl || prList[0]?.url; const gotoUrl = () => url && window.open(url, '_blank'); const urlObj = url && new URL(url); - const closePullRequest = contribution.prList.filter((data)=> data.state === 'closed'); - contribution.prList = closePullRequest; + const closePullRequest = contributions.prList.filter( + (data) => data.state === 'closed' + ); + contributions.prList = closePullRequest; const contributionCard = () => ( Completed in