mirror of
https://github.com/reiyua/github-profile-trophy-reiyua-mirror.git
synced 2026-11-17 06:02:09 +11:00
Add joined2020 trophy
This commit is contained in:
parent
a6aac67444
commit
d89b242989
3 changed files with 23 additions and 0 deletions
|
|
@ -9,6 +9,7 @@ import {
|
||||||
MultipleLangTrophy,
|
MultipleLangTrophy,
|
||||||
LongTimeAccountTrophy,
|
LongTimeAccountTrophy,
|
||||||
AncientAccountTrophy,
|
AncientAccountTrophy,
|
||||||
|
Joined2020Trophy,
|
||||||
} from "./trophies.ts";
|
} from "./trophies.ts";
|
||||||
import { UserInfo } from "./github_api_client.ts";
|
import { UserInfo } from "./github_api_client.ts";
|
||||||
import { RANK_ORDER, RANK } from "./utils.ts";
|
import { RANK_ORDER, RANK } from "./utils.ts";
|
||||||
|
|
@ -42,6 +43,7 @@ export class Card {
|
||||||
new MultipleLangTrophy(userInfo.languageCount),
|
new MultipleLangTrophy(userInfo.languageCount),
|
||||||
new LongTimeAccountTrophy(userInfo.durationYear),
|
new LongTimeAccountTrophy(userInfo.durationYear),
|
||||||
new AncientAccountTrophy(userInfo.acientAccount),
|
new AncientAccountTrophy(userInfo.acientAccount),
|
||||||
|
new Joined2020Trophy(userInfo.joined2020),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Filter by hidden
|
// Filter by hidden
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ export class UserInfo {
|
||||||
public languageCount: number,
|
public languageCount: number,
|
||||||
public durationYear: number,
|
public durationYear: number,
|
||||||
public acientAccount: number,
|
public acientAccount: number,
|
||||||
|
public joined2020: number,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -94,6 +95,9 @@ export class GithubAPIClient {
|
||||||
const acientAccount = new Date(userData.createdAt).getFullYear() <= 2010
|
const acientAccount = new Date(userData.createdAt).getFullYear() <= 2010
|
||||||
? 1
|
? 1
|
||||||
: 0;
|
: 0;
|
||||||
|
const joined2020 = new Date(userData.createdAt).getFullYear() == 2020
|
||||||
|
? 1
|
||||||
|
: 0;
|
||||||
const userInfo = new UserInfo(
|
const userInfo = new UserInfo(
|
||||||
totalCommits,
|
totalCommits,
|
||||||
userData.followers.totalCount,
|
userData.followers.totalCount,
|
||||||
|
|
@ -104,6 +108,7 @@ export class GithubAPIClient {
|
||||||
languages.size,
|
languages.size,
|
||||||
durationYear,
|
durationYear,
|
||||||
acientAccount,
|
acientAccount,
|
||||||
|
joined2020
|
||||||
);
|
);
|
||||||
return userInfo;
|
return userInfo;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -116,6 +116,22 @@ export class MultipleLangTrophy extends Trophy{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class Joined2020Trophy extends Trophy{
|
||||||
|
constructor(score: number){
|
||||||
|
const rankConditions = [
|
||||||
|
new RankCondition(
|
||||||
|
RANK.SECRET,
|
||||||
|
"Everything started...",
|
||||||
|
1,
|
||||||
|
),
|
||||||
|
];
|
||||||
|
super(score, rankConditions);
|
||||||
|
this.title = "Joined2020";
|
||||||
|
this.filterTitles = ["Joined2020"];
|
||||||
|
this.bottomMessage = "Joined 2020"
|
||||||
|
this.hidden = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
export class AncientAccountTrophy extends Trophy{
|
export class AncientAccountTrophy extends Trophy{
|
||||||
constructor(score: number){
|
constructor(score: number){
|
||||||
const rankConditions = [
|
const rankConditions = [
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue