diff --git a/src/app/Dashboard/Components/TrackerCompares.tsx b/src/app/Dashboard/Components/TrackerCompares.tsx index 9d8cc95..2e857a5 100755 --- a/src/app/Dashboard/Components/TrackerCompares.tsx +++ b/src/app/Dashboard/Components/TrackerCompares.tsx @@ -10,6 +10,7 @@ import { HeaderSection } from "~/components/Blocks/HeaderSection"; import { Dropdown } from "~/components/Dropdown/Dropdown"; import { TopPanel } from "./TopPanel"; import { ActiveStatsPanel } from "./ActiveStatsPanel"; +import { LineActivities } from "~/components/Plots/LineActivities"; export const TrackerCompares = observer(() => { const stateDashboard = React.useContext(DashboardService); @@ -38,6 +39,23 @@ export const TrackerCompares = observer(() => { limit={stateDashboard.limit} /> +
+
+ + User activities + #user + +
+
+ name)} + height={250} + limit={stateDashboard.limit} + data={stateFavourite.userCompareStats || []} + /> +
+
)} @@ -105,6 +123,23 @@ export const TrackerCompares = observer(() => { limit={stateDashboard.limit} /> +
+
+ + Team activities + #team + +
+
+ name)} + height={250} + limit={stateDashboard.limit} + data={stateFavourite.teamCompareStats || []} + /> +
+
)} @@ -172,6 +207,25 @@ export const TrackerCompares = observer(() => { limit={stateDashboard.limit} /> +
+
+ + Repository activities + #repository + +
+
+ name + )} + height={250} + limit={stateDashboard.limit} + data={stateFavourite.repositoryCompareStats || []} + /> +
+
)} diff --git a/src/app/Dashboard/DashboardService.tsx b/src/app/Dashboard/DashboardService.tsx index c183c99..73ad0bd 100755 --- a/src/app/Dashboard/DashboardService.tsx +++ b/src/app/Dashboard/DashboardService.tsx @@ -221,6 +221,12 @@ export const DashboardService = createService( data = state.teamStats[state.name]; } else if (state.mode === "user") { data = state.userStats[state.name]; + } else { + data = [ + ...Object.values(state.repositoriesStats).flatMap((s) => s), + ...Object.values(state.teamStats).flatMap((s) => s), + ...Object.values(state.userStats).flatMap((s) => s), + ]; } let max = 0; let total = 0; diff --git a/src/app/Dashboard/FavouriteService.tsx b/src/app/Dashboard/FavouriteService.tsx index d1be5db..3443810 100755 --- a/src/app/Dashboard/FavouriteService.tsx +++ b/src/app/Dashboard/FavouriteService.tsx @@ -61,6 +61,21 @@ export interface FavouriteState { name: string; }[]; }; + teamCompareStats: ({ + day: string; + } & { + [name: string]: number; + })[]; + userCompareStats: ({ + day: string; + } & { + [name: string]: number; + })[]; + repositoryCompareStats: ({ + day: string; + } & { + [name: string]: number; + })[]; } export const FavouriteService = createService( @@ -73,6 +88,75 @@ export const FavouriteService = createService( get groupped() { return state.trackers ? groupBy(state.trackers, "type") : {}; }, + get repositoryCompareStats() { + const result: { + [day: string]: { + day: string; + } & any; + } = {}; + state.groupped.repository.forEach(({ name }) => { + const date = state.service.repositoriesStats[name]; + if (date) { + date.forEach((data) => { + if (!result[data.day]) { + result[data.day] = { + day: data.day, + [name]: data.value, + }; + } else { + result[data.day][name] = data.value; + } + }); + } + }); + return Object.values(result); + }, + get userCompareStats() { + const result: { + [day: string]: { + day: string; + } & any; + } = {}; + state.groupped.user.forEach(({ name }) => { + const date = state.service.userStats[name]; + if (date) { + date.forEach((data) => { + if (!result[data.day]) { + result[data.day] = { + day: data.day, + [name]: data.value, + }; + } else { + result[data.day][name] = data.value; + } + }); + } + }); + return Object.values(result); + }, + get teamCompareStats() { + const result: { + [day: string]: { + day: string; + } & any; + } = {}; + state.groupped.team.forEach(({ name }) => { + const date = state.service.teamStats[name]; + if (date) { + date.forEach((data) => { + if (!result[data.day]) { + result[data.day] = { + day: data.day, + [name]: data.value, + }; + } else { + result[data.day][name] = data.value; + } + }); + } + }); + return Object.values(result); + }, get activeUsers() { return ( state.groupped.user?.reduce((a, { name }) => { diff --git a/src/app/Dashboard/RepositoryDashboard.tsx b/src/app/Dashboard/RepositoryDashboard.tsx index 6205f0a..fa1d3f0 100755 --- a/src/app/Dashboard/RepositoryDashboard.tsx +++ b/src/app/Dashboard/RepositoryDashboard.tsx @@ -200,6 +200,7 @@ export const RepositoryDashboard = observer(() => { ) : ( { ) : (