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,
|
AncientAccountTrophy,
|
||||||
Joined2020Trophy,
|
Joined2020Trophy,
|
||||||
AllSuperRankTrophy,
|
AllSuperRankTrophy,
|
||||||
|
MultipleOrganizationsTrophy,
|
||||||
} from "./trophies.ts";
|
} from "./trophies.ts";
|
||||||
import { UserInfo } from "./user_info.ts";
|
import { UserInfo } from "./user_info.ts";
|
||||||
import { RANK_ORDER, RANK } from "./utils.ts";
|
import { RANK_ORDER, RANK } from "./utils.ts";
|
||||||
|
|
@ -54,6 +55,7 @@ export class Card {
|
||||||
new AncientAccountTrophy(userInfo.ancientAccount),
|
new AncientAccountTrophy(userInfo.ancientAccount),
|
||||||
new Joined2020Trophy(userInfo.joined2020),
|
new Joined2020Trophy(userInfo.joined2020),
|
||||||
new AllSuperRankTrophy(isAllSRank),
|
new AllSuperRankTrophy(isAllSRank),
|
||||||
|
new MultipleOrganizationsTrophy(userInfo.totalOrganizations),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Filter by hidden
|
// Filter by hidden
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,9 @@ export class GithubAPIClient {
|
||||||
issues(first: 1) {
|
issues(first: 1) {
|
||||||
totalCount
|
totalCount
|
||||||
}
|
}
|
||||||
|
organizations(first: 1) {
|
||||||
|
totalCount
|
||||||
|
}
|
||||||
followers(first: 1) {
|
followers(first: 1) {
|
||||||
totalCount
|
totalCount
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -182,6 +182,21 @@ export class LongTimeAccountTrophy extends Trophy{
|
||||||
this.hidden = true;
|
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 {
|
export class TotalStarTrophy extends Trophy {
|
||||||
constructor(score: number) {
|
constructor(score: number) {
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,9 @@ export type GitHubUserData = {
|
||||||
issues: {
|
issues: {
|
||||||
totalCount: number;
|
totalCount: number;
|
||||||
};
|
};
|
||||||
|
organizations: {
|
||||||
|
totalCount: number;
|
||||||
|
};
|
||||||
followers: {
|
followers: {
|
||||||
totalCount: number;
|
totalCount: number;
|
||||||
};
|
};
|
||||||
|
|
@ -28,6 +31,7 @@ export class UserInfo {
|
||||||
public readonly totalCommits: number;
|
public readonly totalCommits: number;
|
||||||
public readonly totalFollowers: number;
|
public readonly totalFollowers: number;
|
||||||
public readonly totalIssues: number;
|
public readonly totalIssues: number;
|
||||||
|
public readonly totalOrganizations: number;
|
||||||
public readonly totalPullRequests: number;
|
public readonly totalPullRequests: number;
|
||||||
public readonly totalStargazers: number;
|
public readonly totalStargazers: number;
|
||||||
public readonly totalRepositories: number;
|
public readonly totalRepositories: number;
|
||||||
|
|
@ -70,6 +74,7 @@ export class UserInfo {
|
||||||
this.totalCommits = totalCommits;
|
this.totalCommits = totalCommits;
|
||||||
this.totalFollowers = userData.followers.totalCount;
|
this.totalFollowers = userData.followers.totalCount;
|
||||||
this.totalIssues = userData.issues.totalCount;
|
this.totalIssues = userData.issues.totalCount;
|
||||||
|
this.totalOrganizations = userData.organizations.totalCount;
|
||||||
this.totalPullRequests = userData.pullRequests.totalCount;
|
this.totalPullRequests = userData.pullRequests.totalCount;
|
||||||
this.totalStargazers = totalStargazers;
|
this.totalStargazers = totalStargazers;
|
||||||
this.totalRepositories = userData.repositories.totalCount;
|
this.totalRepositories = userData.repositories.totalCount;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue