Skip to content

Commit

Permalink
Add beta and alpha badges
Browse files Browse the repository at this point in the history
  • Loading branch information
Prospector committed Aug 30, 2024
1 parent 4bafae8 commit 222e71e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
12 changes: 12 additions & 0 deletions apps/frontend/src/assets/images/badges/alpha-tester.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions apps/frontend/src/assets/images/badges/beta-tester.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 11 additions & 1 deletion apps/frontend/src/pages/user/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@
</nuxt-link>
<TenMClubBadge v-else-if="badge === '10m-club'" class="h-14 w-14" />
<EarlyAdopterBadge v-else-if="badge === 'early-adopter'" class="h-14 w-14" />
<AlphaTesterBadge v-else-if="badge === 'alpha-tester'" class="h-14 w-14" />
<BetaTesterBadge v-else-if="badge === 'beta-tester'" class="h-14 w-14" />
</div>
</div>
</div>
Expand Down Expand Up @@ -264,6 +266,8 @@ import ModBadge from "~/assets/images/badges/mod.svg?component";
import PlusBadge from "~/assets/images/badges/plus.svg?component";
import TenMClubBadge from "~/assets/images/badges/10m-club.svg?component";
import EarlyAdopterBadge from "~/assets/images/badges/early-adopter.svg?component";
import AlphaTesterBadge from "~/assets/images/badges/alpha-tester.svg?component";
import BetaTesterBadge from "~/assets/images/badges/beta-tester.svg?component";

import ReportIcon from "~/assets/images/utils/report.svg?component";
import UpToDate from "~/assets/images/illustrations/up_to_date.svg?component";
Expand Down Expand Up @@ -455,6 +459,10 @@ const sumDownloads = computed(() => {
return sum;
});

const joinDate = computed(() => new Date(user.value.created));
const MODRINTH_BETA_END_DATE = new Date("2022-02-27T08:00:00.000Z");
const MODRINTH_ALPHA_END_DATE = new Date("2020-11-30T08:00:00.000Z");

const badges = computed(() => {
const badges = [];

Expand Down Expand Up @@ -482,8 +490,10 @@ const badges = computed(() => {
badges.push("early-adopter");
}

if (isPermission(user.value.badges, 1 << 4)) {
if (isPermission(user.value.badges, 1 << 4) || joinDate.value < MODRINTH_ALPHA_END_DATE) {
badges.push("alpha-tester");
} else if (isPermission(user.value.badges, 1 << 4) || joinDate.value < MODRINTH_BETA_END_DATE) {
badges.push("beta-tester");
}

if (isPermission(user.value.badges, 1 << 5)) {
Expand Down

0 comments on commit 222e71e

Please sign in to comment.