mirror of
https://github.com/reiyua/github-profile-trophy-reiyua-mirror.git
synced 2026-11-17 06:02:09 +11:00
Fix trophy title name
This commit is contained in:
parent
6a0fb2ca03
commit
1a0de058bb
2 changed files with 27 additions and 12 deletions
17
src/card.ts
17
src/card.ts
|
|
@ -8,8 +8,7 @@ import {
|
|||
TotalRepositoryTrophy,
|
||||
MultipleLangTrophy,
|
||||
LongTimeAccountTrophy,
|
||||
AncientAccountTrophy
|
||||
|
||||
AncientAccountTrophy,
|
||||
} from "./trophies.ts";
|
||||
import { UserInfo } from "./github_api_client.ts";
|
||||
import { CONSTANTS, RANK_ORDER, RANK } from "./utils.ts";
|
||||
|
|
@ -24,7 +23,7 @@ export class Card {
|
|||
private maxRow: number,
|
||||
private panelSize: number,
|
||||
private paddingWidth: number,
|
||||
private paddingHight: number
|
||||
private paddingHight: number,
|
||||
) {
|
||||
this.width = panelSize * this.maxColumn;
|
||||
}
|
||||
|
|
@ -42,16 +41,22 @@ export class Card {
|
|||
);
|
||||
|
||||
// Filter by hidden
|
||||
trophyList = trophyList.filter((trophy) => !trophy.hidden || trophy.rank !== RANK.UNKNOWN);
|
||||
trophyList = trophyList.filter((trophy) =>
|
||||
!trophy.hidden || trophy.rank !== RANK.UNKNOWN
|
||||
);
|
||||
|
||||
// Filter by titles
|
||||
if (this.titles.length != 0) {
|
||||
trophyList = trophyList.filter((trophy) => this.titles.includes(trophy.title))
|
||||
trophyList = trophyList.filter((trophy) => {
|
||||
return trophy.filterTitles.some((title) => this.titles.includes(title))
|
||||
});
|
||||
}
|
||||
|
||||
// Filter by ranks
|
||||
if (this.ranks.length != 0) {
|
||||
trophyList = trophyList.filter((trophy) => this.ranks.includes(trophy.rank))
|
||||
trophyList = trophyList.filter((trophy) =>
|
||||
this.ranks.includes(trophy.rank)
|
||||
);
|
||||
}
|
||||
|
||||
// Sort by rank
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ export class Trophy {
|
|||
topMessage = "Unknown";
|
||||
bottomMessage = "0";
|
||||
title = "";
|
||||
filterTitles: Array<string> = [];
|
||||
hidden = false;
|
||||
constructor(
|
||||
private score: number,
|
||||
|
|
@ -102,7 +103,8 @@ export class MultipleLangTrophy extends Trophy{
|
|||
),
|
||||
];
|
||||
super(score, rankConditions);
|
||||
this.title = "MultipleLang";
|
||||
this.title = "MultiLanguage";
|
||||
this.filterTitles = ["MultipleLang", "MultiLanguage"];
|
||||
this.hidden = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -118,6 +120,7 @@ export class AncientAccountTrophy extends Trophy{
|
|||
];
|
||||
super(score, rankConditions);
|
||||
this.title = "AncientUser";
|
||||
this.filterTitles = ["AncientUser"];
|
||||
this.bottomMessage = "Before 2010"
|
||||
this.hidden = true;
|
||||
}
|
||||
|
|
@ -133,6 +136,7 @@ export class LongTimeAccountTrophy extends Trophy{
|
|||
];
|
||||
super(score, rankConditions);
|
||||
this.title = "LongTimeUser";
|
||||
this.filterTitles = ["LongTimeUser"];
|
||||
this.hidden = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -182,7 +186,8 @@ export class TotalStarTrophy extends Trophy {
|
|||
),
|
||||
];
|
||||
super(score, rankConditions);
|
||||
this.title = "Star";
|
||||
this.title = "Stars";
|
||||
this.filterTitles = ["Star", "Stars"];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -232,6 +237,7 @@ export class TotalCommitTrophy extends Trophy {
|
|||
];
|
||||
super(score, rankConditions);
|
||||
this.title = "Commit";
|
||||
this.filterTitles = ["Commit"];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -280,7 +286,8 @@ export class TotalFollowerTrophy extends Trophy {
|
|||
),
|
||||
];
|
||||
super(score, rankConditions);
|
||||
this.title = "Follower";
|
||||
this.title = "Followers";
|
||||
this.filterTitles = ["Follower", "Followers"];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -329,7 +336,8 @@ export class TotalIssueTrophy extends Trophy {
|
|||
),
|
||||
];
|
||||
super(score, rankConditions);
|
||||
this.title = "Issue";
|
||||
this.title = "Issues";
|
||||
this.filterTitles = ["Issue", "Issues"];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -378,7 +386,8 @@ export class TotalPullRequestTrophy extends Trophy {
|
|||
),
|
||||
];
|
||||
super(score, rankConditions);
|
||||
this.title = "PR";
|
||||
this.title = "PullRequest";
|
||||
this.filterTitles = ["PR", "PullRequest"];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -427,6 +436,7 @@ export class TotalRepositoryTrophy extends Trophy {
|
|||
),
|
||||
];
|
||||
super(score, rankConditions);
|
||||
this.title = "Repo";
|
||||
this.title = "Repositories";
|
||||
this.filterTitles = ["Repo", "Repository", "Repositories"];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue