From 17a3259affb0d4ebfff4a7838723324498179662 Mon Sep 17 00:00:00 2001 From: e-for-eshaan Date: Mon, 20 May 2024 17:02:13 +0530 Subject: [PATCH] --wip-- --- .../content/DoraMetrics/DoraMetricsBody.tsx | 66 +++++++++++-------- 1 file changed, 39 insertions(+), 27 deletions(-) diff --git a/web-server/src/content/DoraMetrics/DoraMetricsBody.tsx b/web-server/src/content/DoraMetrics/DoraMetricsBody.tsx index e336b196..8e4a88b8 100644 --- a/web-server/src/content/DoraMetrics/DoraMetricsBody.tsx +++ b/web-server/src/content/DoraMetrics/DoraMetricsBody.tsx @@ -1,6 +1,6 @@ import { Grid, Divider, Button } from '@mui/material'; import Link from 'next/link'; -import { useEffect } from 'react'; +import { useEffect, useMemo } from 'react'; import { DoraMetricsConfigurationSettings } from '@/components/DoraMetricsConfigurationSettings'; import { DoraScore } from '@/components/DoraScore'; @@ -89,7 +89,20 @@ export const DoraMetricsBody = () => { const stats = useDoraStats(); + const repoBookmarks = useSelector((s) => s.doraMetrics.repo_bookmarks); + const teamRepos = useSelector((s) => s.team.teamReposMaps[singleTeamId]); const { isFreshOrg } = useFreshOrgCalculator(); + const isSyncing = useMemo(() => { + if (isFreshOrg) return true; + const syncedRepos = repoBookmarks.map((item) => item.repo_id); + const teamRepoIds = teamRepos?.map((repo) => repo.id) || []; + console.log('Debugging', { + syncedRepos, + teamRepoIds + }); + if (teamRepoIds.every((id) => syncedRepos.includes(id))) return false; + return true; + }, [isFreshOrg, repoBookmarks, teamRepos]); if (isErrored) return ( @@ -99,32 +112,31 @@ export const DoraMetricsBody = () => { /> ); if (!firstLoadDone) return ; - if (isTeamInsightsEmpty) - if (isFreshOrg) - return ( - - - - ); - else - return ( - - - - - - - ); + if (isSyncing) + return ( + + + + ); + else if (isTeamInsightsEmpty) + return ( + + + + + + + ); return (