Skip to content

Commit

Permalink
feat: add companies support
Browse files Browse the repository at this point in the history
Signed-off-by: frank-zsy <[email protected]>
  • Loading branch information
frank-zsy committed Nov 30, 2024
1 parent f99b517 commit f503ad4
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
15 changes: 15 additions & 0 deletions i18n/en/code.json
Original file line number Diff line number Diff line change
Expand Up @@ -408,5 +408,20 @@
},
"leaderboards.projects.country": {
"message": "Initiator Country"
},
"leaderboards.companies.title": {
"message": "2024 Global Company OpenRank Leaderboard Top 100"
},
"leaderboards.companies.name": {
"message": "Company Name"
},
"leaderboards.companies.repos": {
"message": "Repos Count"
},
"leaderboards.companies.developers": {
"message": "Developers Count"
},
"leaderboards.companies.country": {
"message": "Country"
}
}
17 changes: 16 additions & 1 deletion i18n/zh/code.json
Original file line number Diff line number Diff line change
Expand Up @@ -401,12 +401,27 @@
"message": "项目名"
},
"leaderboards.projects.developers": {
"message": "社区规模"
"message": "开发者规模"
},
"leaderboards.projects.initiator": {
"message": "发起组织"
},
"leaderboards.projects.country": {
"message": "发起组织所在国家"
},
"leaderboards.companies.title": {
"message": "2024 全球企业 OpenRank 排行榜 Top 100"
},
"leaderboards.companies.name": {
"message": "企业"
},
"leaderboards.companies.repos": {
"message": "仓库数量"
},
"leaderboards.companies.developers": {
"message": "开发者规模"
},
"leaderboards.companies.country": {
"message": "所在国家"
}
}
16 changes: 16 additions & 0 deletions src/pages/leaderboards/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,22 @@ function OpenLeaderboard() {
}).catch(e => {
console.log(e);
});
} else if (type === 'companies') {
axios.get(`https://oss.open-digger.cn/leaderboards/${type}.json`).then(resp => {
const data = resp.data;
setTitle(translate({ id: 'leaderboards.companies.title' }));
setData(data.data);
setOptions([
{ name: '#', type: 'String', fields: ['rank'], width: 80 },
{ name: translate({ id: 'leaderboards.companies.name' }), type: 'StringWithIcon', fields: ['name', 'logo'], width: 300 },
{ name: 'OpenRank', type: 'String', fields: ['openrank'], width: 200 },
{ name: translate({ id: 'leaderboards.companies.repos' }), type: 'String', fields: ['repoCount'], width: 200 },
{ name: translate({ id: 'leaderboards.companies.developers' }), type: 'String', fields: ['developerCount'], width: 200 },
{ name: translate({ id: 'leaderboards.companies.country' }), type: 'String', fields: ['country'], width: 200 },
]);
}).catch(e => {
console.log(e);
});
} else {
alert(`Leaderboard type ${type} is not supported.`);
}
Expand Down

0 comments on commit f503ad4

Please sign in to comment.