Skip to content

Commit 7ac62b7

Browse files
committed
Add commas for thousand seperator for alert messages
1 parent 6ca142d commit 7ac62b7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/store/index.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,9 @@ export default createStore({
239239
); //get at least 1 point when the task is completed
240240
state.user.score += score; //get amount of points earned based on task difficulty, task priority, task due date, task repetition, task streak, daily streak and user level multipliers
241241
alert(
242-
`Task ${task.task} completed!\nYou earned ${xp} XP!\nYou earned ${score} points!`
242+
`Task ${task.task} completed!\nYou earned ${xp.toLocaleString(
243+
"en-US"
244+
)} XP!\nYou earned ${score.toLocaleString("en-US")} points!`
243245
); //alert user to show how many XP they earned and points earned after completing the task
244246
//check if user has leveled up
245247
const userLevel: number = state.user.level; //set userLevel variable before calculating user level state
@@ -248,7 +250,11 @@ export default createStore({
248250
Math.floor(Math.pow(state.user.xp, 1 / 3 + 5e-16))
249251
); //calculate level based on how many XP and set level to 1 if total XP is 0
250252
if (state.user.level > userLevel) {
251-
alert(`Level Up!\nYou are now level ${state.user.level}!`); //alert user when user levels up
253+
alert(
254+
`Level Up!\nYou are now level ${state.user.level.toLocaleString(
255+
"en-US"
256+
)}!`
257+
); //alert user when user levels up
252258
}
253259
state.user.progress =
254260
((state.user.xp -

0 commit comments

Comments
 (0)