From dd0a228cf7a85f519f83c7f9e3e0d83884799c33 Mon Sep 17 00:00:00 2001 From: cyberleu <809427284@qq.com> Date: Wed, 24 Jul 2024 12:49:05 +0800 Subject: [PATCH 1/3] finish task 2 --- src/components/TablePanel.js | 1 + src/components/table.js | 121 +++++++++++++++++++---------------- src/locales/en.json | 3 +- src/locales/zh.json | 5 +- 4 files changed, 74 insertions(+), 56 deletions(-) diff --git a/src/components/TablePanel.js b/src/components/TablePanel.js index 048c1b2..acbc19a 100644 --- a/src/components/TablePanel.js +++ b/src/components/TablePanel.js @@ -20,6 +20,7 @@ const TablePanel = (props) => { {t('company')} {t('repo')} {t('developer')} + {t('none')} diff --git a/src/components/table.js b/src/components/table.js index 60830b7..2f8842c 100644 --- a/src/components/table.js +++ b/src/components/table.js @@ -23,15 +23,15 @@ const activityColumns = (object, t_month) => [ }, ...(object == 'actor' ? [ - { - title: t('avatar'), - dataIndex: 'id', - width: '5%', - align: 'center', - render: MyAvatar, - fixed: 'left', - }, - ] + { + title: t('avatar'), + dataIndex: 'id', + width: '5%', + align: 'center', + render: MyAvatar, + fixed: 'left', + }, + ] : []), { title: '', @@ -64,16 +64,16 @@ const activityColumns = (object, t_month) => [ }, ...(object == 'repo' ? [ - { - title: t('insight_board'), - dataIndex: 'name', - align: 'center', - width: '10%', - render: function (text, row, index) { - return dashboard(text, index, t_month); - }, + { + title: t('insight_board'), + dataIndex: 'name', + align: 'center', + width: '10%', + render: function (text, row, index) { + return dashboard(text, index, t_month); }, - ] + }, + ] : []), { title: t('activity'), @@ -100,15 +100,15 @@ const activityDetailColumns = (object, t_month) => [ }, ...(object == 'actor' ? [ - { - title: t('avatar'), - dataIndex: 'id', - width: '5%', - align: 'center', - render: MyAvatar, - fixed: 'left', - }, - ] + { + title: t('avatar'), + dataIndex: 'id', + width: '5%', + align: 'center', + render: MyAvatar, + fixed: 'left', + }, + ] : []), { title: '', @@ -141,16 +141,16 @@ const activityDetailColumns = (object, t_month) => [ }, ...(object == 'repo' ? [ - { - title: t('insight_board'), - dataIndex: 'name', - align: 'center', - width: '10%', - render: function (text, row, index) { - return dashboard(text, index, t_month); - }, + { + title: t('insight_board'), + dataIndex: 'name', + align: 'center', + width: '10%', + render: function (text, row, index) { + return dashboard(text, index, t_month); }, - ] + }, + ] : []), { title: t('activity'), @@ -207,15 +207,15 @@ const open_rankColumns = (object, t_month) => [ }, ...(object == 'actor' ? [ - { - title: t('avatar'), - dataIndex: 'id', - width: '5%', - align: 'center', - render: MyAvatar, - fixed: 'left', - }, - ] + { + title: t('avatar'), + dataIndex: 'id', + width: '5%', + align: 'center', + render: MyAvatar, + fixed: 'left', + }, + ] : []), { title: '', @@ -248,16 +248,16 @@ const open_rankColumns = (object, t_month) => [ }, ...(object == 'repo' ? [ - { - title: t('insight_board'), - dataIndex: 'name', - align: 'center', - width: '10%', - render: function (text, row, index) { - return dashboard(text, index, t_month); - }, + { + title: t('insight_board'), + dataIndex: 'name', + align: 'center', + width: '10%', + render: function (text, row, index) { + return dashboard(text, index, t_month); }, - ] + }, + ] : []), { title: t('influence'), @@ -278,6 +278,19 @@ const open_rankColumns = (object, t_month) => [ return PointRender(text, row, index); }, }, + ...(object == 'none' + ? [ + { + title: t('nation'), + dataIndex: 'name', + align: 'center', + width: '10%', + render: function (text, row, index) { + return dashboard(text, index, t_month); + }, + }, + ] + : []), ]; const solveDate = (year, month) => { if (year === null && month === null) { diff --git a/src/locales/en.json b/src/locales/en.json index 1dd6d27..003de8f 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -17,6 +17,7 @@ "year": "Yearly", "rank": "Rank", "company": "Company", + "none": "None", "repo": "Project", "insight_board": "Insight Board", "actor": "ID", @@ -98,4 +99,4 @@ "XSOSIInsightBoard": "The XSOSI Insights Dashboard is used to present various indicators and data related to the XSOSI project. The dashboard displays basic metrics such as the number of participants, current phase, total number of organizations, and total number of projects. Additionally, it presents the latest OpenRank distribution chart for the project, individual OpenRank leaderboard, latest OpenRank leaderboard for the project, and monthly change chart of the overall OpenRank value for the project. Through the XSOSI Insights Dashboard, users can understand the ranking and allowances of contributors, the overall contribution of the project, and encourage more members to actively participate in the project, thus promoting the development and prosperity of open-source projects.", "OSPOInsightBoard": "The X-lab OSPO Insights Dashboard primarily showcases the activity of X-lab in the open-source domain. The dashboard not only provides basic metrics such as the activity level, new stars, and new issues in X-lab's GitHub open-source projects but also presents detailed data such as OpenDigger metrics breakdown and OpenRank comparisons. Additionally, the dashboard displays data from X-lab's knowledge base on Yuque and its publication record in the open-source field. Through the X-lab OSPO Insights Dashboard, users can gain a comprehensive understanding of X-lab's activity in the open-source domain, thereby promoting collaboration and development with the open-source community." } -} +} \ No newline at end of file diff --git a/src/locales/zh.json b/src/locales/zh.json index bac51d5..93452d4 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -6,12 +6,15 @@ }, "chinese": "中国", "global": "全球", + "nation": "国家", "time": "时间: ", "index": "指数: ", "detail": "详情: ", "item": "目标: ", "region": "地区: ", + "region2": "地区", "developer": "开发者", + "none": "无", "loading": "加载中", "month": "月度", "year": "年度", @@ -98,4 +101,4 @@ "XSOSIInsightBoard": "XSOSI 洞察大屏", "OSPOInsightBoard": "X-lab OSPO 大屏" } -} +} \ No newline at end of file From c234068f4b9d45f71936ee09d33d407842b919c6 Mon Sep 17 00:00:00 2001 From: cyberleu <809427284@qq.com> Date: Wed, 24 Jul 2024 13:13:00 +0800 Subject: [PATCH 2/3] update --- src/components/table.js | 4 ++-- src/locales/en.json | 1 + src/locales/zh.json | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/table.js b/src/components/table.js index 2f8842c..f0f6b82 100644 --- a/src/components/table.js +++ b/src/components/table.js @@ -278,10 +278,10 @@ const open_rankColumns = (object, t_month) => [ return PointRender(text, row, index); }, }, - ...(object == 'none' + ...(object == 'region2' ? [ { - title: t('nation'), + title: t('participants'), dataIndex: 'name', align: 'center', width: '10%', diff --git a/src/locales/en.json b/src/locales/en.json index 003de8f..5841995 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -12,6 +12,7 @@ "item": "Item: ", "region": "Region: ", "developer": "Developer", + "participants": "Participents", "loading": "Loading", "month": "Monthly", "year": "Yearly", diff --git a/src/locales/zh.json b/src/locales/zh.json index 93452d4..52f95b8 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -14,6 +14,7 @@ "region": "地区: ", "region2": "地区", "developer": "开发者", + "participants": "参与人数", "none": "无", "loading": "加载中", "month": "月度", From 1b1a6ce083ea3a64e8005218feff8cca62f3613f Mon Sep 17 00:00:00 2001 From: cyberleu <809427284@qq.com> Date: Wed, 24 Jul 2024 14:15:36 +0800 Subject: [PATCH 3/3] prettier --- src/components/TablePanel.js | 17 ++++- src/components/table.js | 124 ++++++++++++++++------------------- src/locales/en.json | 3 +- src/locales/zh.json | 3 +- 4 files changed, 76 insertions(+), 71 deletions(-) diff --git a/src/components/TablePanel.js b/src/components/TablePanel.js index acbc19a..33ae40d 100644 --- a/src/components/TablePanel.js +++ b/src/components/TablePanel.js @@ -1,9 +1,10 @@ -import { Row, Col, Radio, Switch, Input } from 'antd'; +import { Row, Col, Radio, Switch, Input, Select } from 'antd'; import { t } from 'i18next'; import React from 'react'; import SwitchablePicker from './datePicker'; const { Search } = Input; +const { Option } = Select; const TablePanel = (props) => { return ( @@ -20,7 +21,6 @@ const TablePanel = (props) => { {t('company')} {t('repo')} {t('developer')} - {t('none')} @@ -35,6 +35,19 @@ const TablePanel = (props) => { {t('influence')} + + {t('source')} + + diff --git a/src/components/table.js b/src/components/table.js index f0f6b82..1593103 100644 --- a/src/components/table.js +++ b/src/components/table.js @@ -23,15 +23,15 @@ const activityColumns = (object, t_month) => [ }, ...(object == 'actor' ? [ - { - title: t('avatar'), - dataIndex: 'id', - width: '5%', - align: 'center', - render: MyAvatar, - fixed: 'left', - }, - ] + { + title: t('avatar'), + dataIndex: 'id', + width: '5%', + align: 'center', + render: MyAvatar, + fixed: 'left', + }, + ] : []), { title: '', @@ -64,16 +64,16 @@ const activityColumns = (object, t_month) => [ }, ...(object == 'repo' ? [ - { - title: t('insight_board'), - dataIndex: 'name', - align: 'center', - width: '10%', - render: function (text, row, index) { - return dashboard(text, index, t_month); + { + title: t('insight_board'), + dataIndex: 'name', + align: 'center', + width: '10%', + render: function (text, row, index) { + return dashboard(text, index, t_month); + }, }, - }, - ] + ] : []), { title: t('activity'), @@ -100,15 +100,15 @@ const activityDetailColumns = (object, t_month) => [ }, ...(object == 'actor' ? [ - { - title: t('avatar'), - dataIndex: 'id', - width: '5%', - align: 'center', - render: MyAvatar, - fixed: 'left', - }, - ] + { + title: t('avatar'), + dataIndex: 'id', + width: '5%', + align: 'center', + render: MyAvatar, + fixed: 'left', + }, + ] : []), { title: '', @@ -141,16 +141,16 @@ const activityDetailColumns = (object, t_month) => [ }, ...(object == 'repo' ? [ - { - title: t('insight_board'), - dataIndex: 'name', - align: 'center', - width: '10%', - render: function (text, row, index) { - return dashboard(text, index, t_month); + { + title: t('insight_board'), + dataIndex: 'name', + align: 'center', + width: '10%', + render: function (text, row, index) { + return dashboard(text, index, t_month); + }, }, - }, - ] + ] : []), { title: t('activity'), @@ -207,15 +207,15 @@ const open_rankColumns = (object, t_month) => [ }, ...(object == 'actor' ? [ - { - title: t('avatar'), - dataIndex: 'id', - width: '5%', - align: 'center', - render: MyAvatar, - fixed: 'left', - }, - ] + { + title: t('avatar'), + dataIndex: 'id', + width: '5%', + align: 'center', + render: MyAvatar, + fixed: 'left', + }, + ] : []), { title: '', @@ -248,16 +248,16 @@ const open_rankColumns = (object, t_month) => [ }, ...(object == 'repo' ? [ - { - title: t('insight_board'), - dataIndex: 'name', - align: 'center', - width: '10%', - render: function (text, row, index) { - return dashboard(text, index, t_month); + { + title: t('insight_board'), + dataIndex: 'name', + align: 'center', + width: '10%', + render: function (text, row, index) { + return dashboard(text, index, t_month); + }, }, - }, - ] + ] : []), { title: t('influence'), @@ -278,19 +278,6 @@ const open_rankColumns = (object, t_month) => [ return PointRender(text, row, index); }, }, - ...(object == 'region2' - ? [ - { - title: t('participants'), - dataIndex: 'name', - align: 'center', - width: '10%', - render: function (text, row, index) { - return dashboard(text, index, t_month); - }, - }, - ] - : []), ]; const solveDate = (year, month) => { if (year === null && month === null) { @@ -350,6 +337,7 @@ function MyTable(props) { year: null, // 字符串格式 month: null, // 整数格式,0表示1月,1表示2月..., null for year type time type: 'month', + source: 'all', search: null, }); @@ -506,6 +494,7 @@ function MyTable(props) { month, year, type, + source, } = state; return (
@@ -518,6 +507,7 @@ function MyTable(props) { }} >