mirror of
https://github.com/reiyua/github-profile-trophy-reiyua-mirror.git
synced 2026-11-17 06:02:09 +11:00
Add TotalFollowerTrophy
This commit is contained in:
parent
94f1cb0a34
commit
4faa467ef4
2 changed files with 49 additions and 10 deletions
10
src/card.ts
10
src/card.ts
|
|
@ -1,4 +1,4 @@
|
||||||
import { TotalStarTrophy, TotalCommitTrophy } from "./trophies.ts";
|
import { TotalStarTrophy, TotalCommitTrophy, TotalFollowerTrophy } from "./trophies.ts";
|
||||||
|
|
||||||
export class Card {
|
export class Card {
|
||||||
constructor(private width = 1000, private height = 200) {
|
constructor(private width = 1000, private height = 200) {
|
||||||
|
|
@ -12,6 +12,10 @@ export class Card {
|
||||||
const trophy6 = new TotalCommitTrophy(200);
|
const trophy6 = new TotalCommitTrophy(200);
|
||||||
const trophy7 = new TotalCommitTrophy(1000);
|
const trophy7 = new TotalCommitTrophy(1000);
|
||||||
const trophy8 = new TotalCommitTrophy(5000);
|
const trophy8 = new TotalCommitTrophy(5000);
|
||||||
|
const trophy9 = new TotalFollowerTrophy(1);
|
||||||
|
const trophy10 = new TotalFollowerTrophy(50);
|
||||||
|
const trophy11 = new TotalFollowerTrophy(100);
|
||||||
|
const trophy12 = new TotalFollowerTrophy(500);
|
||||||
return `
|
return `
|
||||||
<svg
|
<svg
|
||||||
width="${this.width}"
|
width="${this.width}"
|
||||||
|
|
@ -39,6 +43,10 @@ export class Card {
|
||||||
${trophy6.render(300, 0)}
|
${trophy6.render(300, 0)}
|
||||||
${trophy7.render(200, 100)}
|
${trophy7.render(200, 100)}
|
||||||
${trophy8.render(300, 100)}
|
${trophy8.render(300, 100)}
|
||||||
|
${trophy9.render(400, 0)}
|
||||||
|
${trophy10.render(500, 0)}
|
||||||
|
${trophy11.render(400, 100)}
|
||||||
|
${trophy12.render(500, 100)}
|
||||||
</svg>`;
|
</svg>`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,22 +40,26 @@ abstract class Trophy {
|
||||||
export class TotalStarTrophy extends Trophy {
|
export class TotalStarTrophy extends Trophy {
|
||||||
constructor(private totalStartgazer: Number) {
|
constructor(private totalStartgazer: Number) {
|
||||||
super();
|
super();
|
||||||
this.title = "TOTAL STAR";
|
this.title = "STAR";
|
||||||
this.setRank();
|
this.setRank();
|
||||||
}
|
}
|
||||||
setRank() {
|
setRank() {
|
||||||
if (this.totalStartgazer >= 1000) {
|
if (this.totalStartgazer >= 1000) {
|
||||||
this.rank = "S";
|
this.rank = "S";
|
||||||
this.topMessage = "Super Star +1000";
|
this.topMessage = "Super Star";
|
||||||
|
this.bottomMessage = "+1000";
|
||||||
} else if (this.totalStartgazer >= 500) {
|
} else if (this.totalStartgazer >= 500) {
|
||||||
this.rank = "A";
|
this.rank = "A";
|
||||||
this.topMessage = "High Star +500";
|
this.topMessage = "High Star";
|
||||||
|
this.bottomMessage = "+500";
|
||||||
} else if (this.totalStartgazer >= 100) {
|
} else if (this.totalStartgazer >= 100) {
|
||||||
this.rank = "B";
|
this.rank = "B";
|
||||||
this.topMessage = "Middle Star +100";
|
this.topMessage = "Middle Star";
|
||||||
|
this.bottomMessage = "+100";
|
||||||
} else if (this.totalStartgazer >= 1) {
|
} else if (this.totalStartgazer >= 1) {
|
||||||
this.rank = "C";
|
this.rank = "C";
|
||||||
this.topMessage = "First Star";
|
this.topMessage = "First Star";
|
||||||
|
this.bottomMessage = "+1";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -63,25 +67,52 @@ export class TotalStarTrophy extends Trophy {
|
||||||
export class TotalCommitTrophy extends Trophy {
|
export class TotalCommitTrophy extends Trophy {
|
||||||
constructor(private totalStartgazer: Number) {
|
constructor(private totalStartgazer: Number) {
|
||||||
super();
|
super();
|
||||||
this.title = "TOTAL COMMIT";
|
this.title = "COMMIT";
|
||||||
this.setRank();
|
this.setRank();
|
||||||
}
|
}
|
||||||
setRank() {
|
setRank() {
|
||||||
if (this.totalStartgazer >= 5000) {
|
if (this.totalStartgazer >= 5000) {
|
||||||
this.rank = "S";
|
this.rank = "S";
|
||||||
this.topMessage = "Super commiter";
|
this.topMessage = "Super Commiter";
|
||||||
this.bottomMessage = "+5000";
|
this.bottomMessage = "+5000";
|
||||||
} else if (this.totalStartgazer >= 1000) {
|
} else if (this.totalStartgazer >= 1000) {
|
||||||
this.rank = "A";
|
this.rank = "A";
|
||||||
this.topMessage = "High commiter";
|
this.topMessage = "High Commiter";
|
||||||
this.bottomMessage = "+1000";
|
this.bottomMessage = "+1000";
|
||||||
} else if (this.totalStartgazer >= 200) {
|
} else if (this.totalStartgazer >= 200) {
|
||||||
this.rank = "B";
|
this.rank = "B";
|
||||||
this.topMessage = "Middle commiter";
|
this.topMessage = "Middle Commiter";
|
||||||
this.bottomMessage = "+200";
|
this.bottomMessage = "+200";
|
||||||
} else if (this.totalStartgazer >= 1) {
|
} else if (this.totalStartgazer >= 1) {
|
||||||
this.rank = "C";
|
this.rank = "C";
|
||||||
this.topMessage = "First commit";
|
this.topMessage = "First Commit";
|
||||||
|
this.bottomMessage = "+1";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class TotalFollowerTrophy extends Trophy {
|
||||||
|
constructor(private totalStartgazer: Number) {
|
||||||
|
super();
|
||||||
|
this.title = "FOLLOWER";
|
||||||
|
this.setRank();
|
||||||
|
}
|
||||||
|
setRank() {
|
||||||
|
if (this.totalStartgazer >= 500) {
|
||||||
|
this.rank = "S";
|
||||||
|
this.topMessage = "Celebrity";
|
||||||
|
this.bottomMessage = "+500";
|
||||||
|
} else if (this.totalStartgazer >= 200) {
|
||||||
|
this.rank = "A";
|
||||||
|
this.topMessage = "Famous User";
|
||||||
|
this.bottomMessage = "+200";
|
||||||
|
} else if (this.totalStartgazer >= 50) {
|
||||||
|
this.rank = "B";
|
||||||
|
this.topMessage = "Many Friends";
|
||||||
|
this.bottomMessage = "+50";
|
||||||
|
} else if (this.totalStartgazer >= 1) {
|
||||||
|
this.rank = "C";
|
||||||
|
this.topMessage = "First Friend";
|
||||||
this.bottomMessage = "+1";
|
this.bottomMessage = "+1";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue