Skip to content

Commit

Permalink
feat: add pie total count
Browse files Browse the repository at this point in the history
Signed-off-by: laixingyou <[email protected]>
  • Loading branch information
coder-sett committed Dec 25, 2023
1 parent 5ad54fe commit 1c71d18
Show file tree
Hide file tree
Showing 15 changed files with 112 additions and 85 deletions.
2 changes: 1 addition & 1 deletion apps/web/i18n
Submodule i18n updated 2 files
+7 −3 en/analyze.json
+6 −2 zh/analyze.json
14 changes: 7 additions & 7 deletions apps/web/src/common/components/EChartGl/useOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ const useOptions = () => {
t('analyze:topic:productivity'),
t('analyze:topic:productivity'),
t('analyze:topic:productivity'),
t('analyze:topic:robustness'),
t('analyze:topic:robustness'),
t('analyze:topic:robustness'),
t('analyze:topic:niche_creation'),
t('analyze:topic:niche_creation'),
t('analyze:topic:niche_creation'),
t('analyze:topic:robustness'),
t('analyze:topic:robustness'),
t('analyze:topic:robustness'),
];
const type = [
t('analyze:collaboration'),
Expand Down Expand Up @@ -47,16 +47,16 @@ const useOptions = () => {
{
name: t('analyze:all_model:community_activity'),
key: 'activity',
value: [4, 1, 20],
itemStyle: { color: color[1] },
value: [7, 1, 20],
itemStyle: { color: color[2] },
disable: false,
scope: 'collaboration',
},
{
name: t('analyze:all_model:organization_activity'),
key: 'organizations_activity',
value: [7, 1, 30],
itemStyle: { color: color[2] },
value: [4, 1, 30],
itemStyle: { color: color[1] },
disable: false,
scope: 'collaboration',
},
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/common/components/Header/MobileHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const MobileHeader: React.FC<PropsWithChildren> = ({ children }) => {
</div>
<div
className=""
onClickCapture={() => {
onClick={() => {
toggle();
}}
>
Expand Down
8 changes: 5 additions & 3 deletions apps/web/src/common/components/Tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ const Tab: React.FC<{
)}
onClick={() => !option.disable && onChange(option.value)}
>
<Tooltip arrow title={option.tooltip} placement="right">
<div>{option.label}</div>
</Tooltip>
<a>
<Tooltip arrow title={option.tooltip} placement="right">
<div>{option.label}</div>
</Tooltip>
</a>
</div>
);
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ const EcoContributorContribution: React.FC<{
const legend = [];
const ecoData = [];
const contributorsData = [];
let allCount = 0;
if (data?.ecoContributorsOverview?.length > 0) {
const ecoContributorsOverview = data.ecoContributorsOverview;
ecoContributorsOverview.forEach((item, i) => {
Expand All @@ -99,6 +100,7 @@ const EcoContributorContribution: React.FC<{
name: name,
itemStyle: { color: colorList[0] },
});
allCount += count;
ecoData.push({
name: name,
value: count,
Expand All @@ -108,6 +110,7 @@ const EcoContributorContribution: React.FC<{
}
return {
legend,
allCount,
ecoData,
contributorsData,
};
Expand All @@ -125,7 +128,12 @@ const EcoContributorContribution: React.FC<{
data: getSeries.legend,
},
title: {
text: t('analyze:metric_detail:global_contribution_distribution'),
text:
t('analyze:metric_detail:global_contribution_distribution') +
'(' +
getSeries.allCount +
unit +
')',
left: 'center',
},
series: [
Expand Down Expand Up @@ -201,6 +209,7 @@ const OrgContributorContribution: React.FC<{
const legend = [];
const ecoData = [];
const contributorsData = [];
let allCount = 0;
if (data?.orgContributionDistribution?.length > 0) {
const orgContributionDistribution = data.orgContributionDistribution;
orgContributionDistribution.forEach((item, i) => {
Expand All @@ -222,6 +231,7 @@ const OrgContributorContribution: React.FC<{
name: name,
itemStyle: { color: colorList[0] },
});
allCount += count;
ecoData.push({
name: name,
value: count,
Expand All @@ -231,6 +241,7 @@ const OrgContributorContribution: React.FC<{
}
return {
legend,
allCount,
ecoData,
contributorsData,
};
Expand All @@ -248,7 +259,12 @@ const OrgContributorContribution: React.FC<{
data: getSeries.legend,
},
title: {
text: t('analyze:metric_detail:global_contribution_distribution'),
text:
t('analyze:metric_detail:global_contribution_distribution') +
'(' +
getSeries.allCount +
unit +
')',
left: 'center',
},
series: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const ContributorContribution: React.FC<{
const legend = [];
const ecoData = [];
const contributorsData = [];
let allCount = 0;
if (data?.orgContributorsOverview?.length > 0) {
const ecoContributorsOverview = data.orgContributorsOverview;
ecoContributorsOverview
Expand All @@ -47,6 +48,7 @@ const ContributorContribution: React.FC<{
name: subTypeName,
itemStyle: { color: colorList[0] },
});
allCount += count;
ecoData.push({
name: subTypeName,
value: count,
Expand All @@ -56,6 +58,7 @@ const ContributorContribution: React.FC<{
}
return {
legend,
allCount,
ecoData,
contributorsData,
};
Expand All @@ -73,7 +76,12 @@ const ContributorContribution: React.FC<{
data: getSeries.legend,
},
title: {
text: t('analyze:metric_detail:organization_contribution_distribution'),
text:
t('analyze:metric_detail:organization_contribution_distribution') +
'(' +
getSeries.allCount +
unit +
')',
left: 'center',
},
series: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const MetricTable: React.FC<{
showSizeChanger: false,
position: ['bottomCenter'],
showTotal: (total) => {
return `Total ${total} items`;
return `${t('analyze:total_people', { total })} `;
},
},
filterOpts: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const ContributorContributors: React.FC<{
const legend = [];
const ecoData = [];
const contributorsData = [];
let allCount = 0;
if (data?.orgContributorsDistribution?.length > 0) {
const orgContributorsDistribution = data.orgContributorsDistribution;
orgContributorsDistribution.forEach((item, i) => {
Expand All @@ -49,6 +50,7 @@ const ContributorContributors: React.FC<{
name: name,
itemStyle: { color: colorList[0] },
});
allCount += count;
ecoData.push({
name: name,
value: count,
Expand All @@ -58,6 +60,7 @@ const ContributorContributors: React.FC<{
}
return {
legend,
allCount,
ecoData,
contributorsData,
};
Expand All @@ -75,7 +78,12 @@ const ContributorContributors: React.FC<{
data: getSeries.legend,
},
title: {
text: t('analyze:metric_detail:contributor_distribution'),
text:
t('analyze:metric_detail:contributor_distribution') +
'(' +
getSeries.allCount +
unit +
')',
left: 'center',
},
series: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const MetricTable: React.FC<{
showSizeChanger: false,
position: ['bottomCenter'],
showTotal: (total) => {
return `Total ${total} items`;
return `${t('analyze:total_issues', { total })} `;
},
},
filterOpts: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const MetricTable: React.FC<{
showSizeChanger: false,
position: ['bottomCenter'],
showTotal: (total) => {
return `Total ${total} items`;
return `${t('analyze:total_prs', { total })} `;
},
},
filterOpts: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const MetricDetail = () => {
<div className="md:hidden">
<LabelItems />
</div>
<span className="lg:hidden">
<span className="ml-2 text-base lg:hidden">
{t('analyze:metric_detail:project_deep_dive_insight')}
</span>
</div>
Expand Down
Loading

0 comments on commit 1c71d18

Please sign in to comment.