-
- {getUserIcons(
- data.highestContributionContributor.origin,
- data.highestContributionContributor.name
- )}
-
-
- {data.highestContributionContributor.name || '/'}
-
+ {getTopUser(
+ data.highestContributionContributor.origin,
+ data.highestContributionContributor.name
+ )}
{t('analyze:metric_detail:top_contributor')}
@@ -328,44 +323,74 @@ const getIcons = (type: string) => {
return
;
}
};
-const getUserIcons = (type, name) => {
- switch (type) {
- case 'github':
- return (
-
- (e.currentTarget.src = '/images/github.png')}
- unoptimized
- fill={true}
- style={{
- objectFit: 'cover',
- }}
- alt="icon"
- placeholder="blur"
- blurDataURL="/images/github.png"
- />
-
- );
- case 'gitee':
- return (
-
-
- (e.currentTarget.src = '/images/logos/gitee-red.svg')
- }
- unoptimized
- fill={true}
- alt="icon"
- placeholder="blur"
- blurDataURL="/images/logos/gitee-red.svg"
- />
-
- );
- // return
;
- default:
- return
;
+const getTopUser = (type, name) => {
+ let url = null;
+ let userIcon = null;
+ if (!name) {
+ userIcon =
;
+ } else {
+ switch (type) {
+ case 'github':
+ url = 'https://github.com/' + name;
+ userIcon = (
+
+ (e.currentTarget.src = '/images/github.png')}
+ unoptimized
+ fill={true}
+ style={{
+ objectFit: 'cover',
+ }}
+ alt="icon"
+ placeholder="blur"
+ blurDataURL="/images/github.png"
+ />
+
+ );
+ break;
+ case 'gitee':
+ url = 'https://gitee.com/' + name;
+ userIcon = (
+
+
+ (e.currentTarget.src = '/images/logos/gitee-red.svg')
+ }
+ unoptimized
+ fill={true}
+ alt="icon"
+ placeholder="blur"
+ blurDataURL="/images/logos/gitee-red.svg"
+ />
+
+ );
+ break;
+ default:
+ userIcon =
;
+ break;
+ }
}
+
+ return (
+ <>
+
{userIcon}
+
+ {url ? (
+
+ {name}
+
+ ) : (
+ name || '/'
+ )}
+
+ >
+ );
};
export default MetricDashboard;
diff --git a/apps/web/src/modules/analyze/hooks/useHandleQueryParams.ts b/apps/web/src/modules/analyze/hooks/useHandleQueryParams.ts
index 537bc0e5..bab4560d 100644
--- a/apps/web/src/modules/analyze/hooks/useHandleQueryParams.ts
+++ b/apps/web/src/modules/analyze/hooks/useHandleQueryParams.ts
@@ -1,11 +1,19 @@
import { useRouter } from 'next/router';
// 修改或新增查询参数
+const clearEmptyProperties = (obj) => {
+ Object.keys(obj).forEach(function (key) {
+ if (obj[key] === null || obj[key] === undefined || obj[key] === '') {
+ delete obj[key];
+ }
+ });
+};
export const useHandleQueryParams = () => {
const router = useRouter();
const handleQueryParams = (newParams) => {
const { pathname, query } = router;
const newQueryParams = { ...query, ...newParams };
+ clearEmptyProperties(newQueryParams);
router.push({
pathname,
query: newQueryParams,
diff --git a/apps/web/src/styles/antd.scss b/apps/web/src/styles/antd.scss
index de02d82f..238f6b3c 100644
--- a/apps/web/src/styles/antd.scss
+++ b/apps/web/src/styles/antd.scss
@@ -1,6 +1,9 @@
-.ant-table-filter-dropdown-btns {
+.ant-table-filter-dropdown {
.ant-btn-primary {
background-color: #1677ff !important;
+ // :hover {
+ // background-color: #4096ff !important;
+ // }
}
}
.ant-progress-bg {