Skip to content

Commit

Permalink
add 2024 happy new year achievement
Browse files Browse the repository at this point in the history
  • Loading branch information
juunini committed Dec 26, 2023
1 parent c08eb6b commit aa78f35
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/backend/src/core/CustomAchievements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export const customAchievementTypes = [
'visitToKaelz',
'visitToJuunini',
'happyXmas2023',
'happyNewYear2024',
];
6 changes: 3 additions & 3 deletions packages/frontend/src/components/MkAchievements.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ SPDX-License-Identifier: AGPL-3.0-only
</div>
<div :class="$style.body">
<div :class="$style.header">
<span :class="$style.title">{{ i18n.ts._achievements._types['_' + achievement.name]?.title ?? customAchievementTitle(achievement.name) }}</span>
<span :class="$style.title">{{ i18n.ts._achievements._types['_' + achievement.name]?.title || customAchievementTitle(achievement.name) }}</span>
<span :class="$style.time">
<time v-tooltip="new Date(achievement.unlockedAt).toLocaleString()">{{ new Date(achievement.unlockedAt).getFullYear() }}/{{ new Date(achievement.unlockedAt).getMonth() + 1 }}/{{ new Date(achievement.unlockedAt).getDate() }}</time>
</span>
</div>
<div :class="$style.description">{{ withDescription ? (i18n.ts._achievements._types['_' + achievement.name]?.description ?? customAchievementDescription(achievement.name)) : '???' }}</div>
<div v-if="(i18n.ts._achievements._types['_' + achievement.name]?.flavor || customAchievementFlavor(achievement.name)) && withDescription" :class="$style.flavor">{{ i18n.ts._achievements._types['_' + achievement.name]?.flavor ?? customAchievementFlavor(achievement.name) }}</div>
<div :class="$style.description">{{ withDescription ? (i18n.ts._achievements._types['_' + achievement.name]?.description || customAchievementDescription(achievement.name)) : '???' }}</div>
<div v-if="(i18n.ts._achievements._types['_' + achievement.name]?.flavor || customAchievementFlavor(achievement.name)) && withDescription" :class="$style.flavor">{{ i18n.ts._achievements._types['_' + achievement.name]?.flavor || customAchievementFlavor(achievement.name) }}</div>
</div>
</div>
<template v-if="withLocked">
Expand Down
16 changes: 16 additions & 0 deletions packages/frontend/src/pages/user/customAchievements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const customAchievementTypes = [
'visitToKaelz',
'visitToJuunini',
'happyXmas2023',
'happyNewYear2024',
];

export const customAchievementBadges = {
Expand All @@ -24,6 +25,11 @@ export const customAchievementBadges = {
bg: '#ffffff',
frame: 'silver',
},
'happyNewYear2024': {
img: 'https://storage.googleapis.com/yodangang-express/images/happyNewYear2024.webp',
bg: '#000000',
frame: 'bronze',
},
};

export async function customAchievementsInUsers(user: Record<string, any>): Promise<void> {
Expand All @@ -46,6 +52,10 @@ export async function customAchievementsInMainBoot(): Promise<void> {
if (year === 2023 && month === 11 && (day === 24 || day === 25)) {
await claimAchievement('happyXmas2023');
}

if (year === 2024 && month === 0 && day === 1) {
await claimAchievement('happyNewYear2024');
}
}

export function customAchievementTitle(achievement?: string): string {
Expand All @@ -56,6 +66,8 @@ export function customAchievementTitle(achievement?: string): string {
return '지상 μ΅œκ°•μ˜ 개발자?';
case 'happyXmas2023':
return 'HAPPY X-MAS 2023';
case 'happyNewYear2024':
return 'HAPPY NEW YEAR!';
}
return '???';
}
Expand All @@ -68,6 +80,8 @@ export function customAchievementDescription(achievement: string): string {
return '지상 μ΅œκ°•μ˜ 개발자 μ₯¬λ‹ˆλ‹ˆμ˜ ν”„λ‘œν•„μ„ ν™•μΈν–ˆμŠ΅λ‹ˆλ‹€';
case 'happyXmas2023':
return '2023λ…„ ν¬λ¦¬μŠ€λ§ˆμŠ€μ— μ ‘μ†ν•˜μ…¨μŠ΅λ‹ˆλ‹€.';
case 'happyNewYear2024':
return '2024λ…„ 1μ›” 1일에 μ ‘μ†ν–ˆμŠ΅λ‹ˆλ‹€.';
}
return '???';
}
Expand All @@ -78,6 +92,8 @@ export function customAchievementFlavor(achievement: string): string {
return '근데... νŒ”λ‘œμš° λ²„νŠΌ λˆŒλ €λ‹ˆ?';
case 'happyXmas2023':
return '메리 크리슀마슀!';
case 'happyNewYear2024':
return 'μƒˆν•΄ 볡 많이 λ°›μœΌμ„Έμš”!';
}
return '';
}
2 changes: 2 additions & 0 deletions packages/sw/src/scripts/custom-achievements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export function customAchievementTitle(achievement?: string): string {
return '지상 μ΅œκ°•μ˜ 개발자?';
case 'happyXmas2023':
return 'HAPPY X-MAS 2023';
case 'happyNewYear2024':
return 'HAPPY NEW YEAR!';
}

return '';
Expand Down

0 comments on commit aa78f35

Please sign in to comment.