mirror of
https://github.com/reiyua/github-profile-trophy-reiyua-mirror.git
synced 2026-11-17 06:02:09 +11:00
Add Organizations trophy as a secret
This commit is contained in:
parent
8842e9ce27
commit
3f7feb8208
4 changed files with 25 additions and 0 deletions
|
|
@ -11,6 +11,7 @@ import {
|
|||
AncientAccountTrophy,
|
||||
Joined2020Trophy,
|
||||
AllSuperRankTrophy,
|
||||
MultipleOrganizationsTrophy,
|
||||
} from "./trophies.ts";
|
||||
import { UserInfo } from "./user_info.ts";
|
||||
import { RANK_ORDER, RANK } from "./utils.ts";
|
||||
|
|
@ -54,6 +55,7 @@ export class Card {
|
|||
new AncientAccountTrophy(userInfo.ancientAccount),
|
||||
new Joined2020Trophy(userInfo.joined2020),
|
||||
new AllSuperRankTrophy(isAllSRank),
|
||||
new MultipleOrganizationsTrophy(userInfo.totalOrganizations),
|
||||
);
|
||||
|
||||
// Filter by hidden
|
||||
|
|
|
|||
|
|
@ -22,6 +22,9 @@ export class GithubAPIClient {
|
|||
issues(first: 1) {
|
||||
totalCount
|
||||
}
|
||||
organizations(first: 1) {
|
||||
totalCount
|
||||
}
|
||||
followers(first: 1) {
|
||||
totalCount
|
||||
}
|
||||
|
|
|
|||
|
|
@ -182,6 +182,21 @@ export class LongTimeAccountTrophy extends Trophy{
|
|||
this.hidden = true;
|
||||
}
|
||||
}
|
||||
export class MultipleOrganizationsTrophy extends Trophy{
|
||||
constructor(score: number){
|
||||
const rankConditions = [
|
||||
new RankCondition(
|
||||
RANK.SECRET,
|
||||
"Multiple Jobs",
|
||||
2,
|
||||
),
|
||||
];
|
||||
super(score, rankConditions);
|
||||
this.title = "Organizations";
|
||||
this.filterTitles = ["Organizations"];
|
||||
this.hidden = true;
|
||||
}
|
||||
}
|
||||
|
||||
export class TotalStarTrophy extends Trophy {
|
||||
constructor(score: number) {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@ export type GitHubUserData = {
|
|||
issues: {
|
||||
totalCount: number;
|
||||
};
|
||||
organizations: {
|
||||
totalCount: number;
|
||||
};
|
||||
followers: {
|
||||
totalCount: number;
|
||||
};
|
||||
|
|
@ -28,6 +31,7 @@ export class UserInfo {
|
|||
public readonly totalCommits: number;
|
||||
public readonly totalFollowers: number;
|
||||
public readonly totalIssues: number;
|
||||
public readonly totalOrganizations: number;
|
||||
public readonly totalPullRequests: number;
|
||||
public readonly totalStargazers: number;
|
||||
public readonly totalRepositories: number;
|
||||
|
|
@ -70,6 +74,7 @@ export class UserInfo {
|
|||
this.totalCommits = totalCommits;
|
||||
this.totalFollowers = userData.followers.totalCount;
|
||||
this.totalIssues = userData.issues.totalCount;
|
||||
this.totalOrganizations = userData.organizations.totalCount;
|
||||
this.totalPullRequests = userData.pullRequests.totalCount;
|
||||
this.totalStargazers = totalStargazers;
|
||||
this.totalRepositories = userData.repositories.totalCount;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue