Skip to content

Commit 67347d6

Browse files
committed
Fix spelling mistakes and grammar
1 parent 8d21e64 commit 67347d6

File tree

6 files changed

+55
-52
lines changed

6 files changed

+55
-52
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Vue gamification todo list app with Vuex, SCSS and TypeScript
22

3-
This application is a todo list with task repetition with level and experience points and it stores to local storage using `vuex-persistedstate`.
3+
This application is a todo list with task repetition with level and experience points,
4+
and it stores to local storage using `vuex-persistedstate`.
45

56
## Contents
67

@@ -12,9 +13,9 @@ This application is a todo list with task repetition with level and experience p
1213

1314
- Gamification with levels and experience points (XP)
1415
- Task repetition for daily, weekly, monthly or yearly tasks
15-
- Different priorties and difficulties to choose from
16+
- Different priorities and difficulties to choose from
1617

17-
## Setup the application
18+
## Set up the application
1819

1920
```
2021
git clone https://github.com/lulunac27a/gamification-todo-list-vue-typescript.git

src/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<div>
44
<h1>Todo List Application using Vue, TypeScript and Vuex</h1>
55
<p>
6-
This is a task list application using Vue, TypeScript and Vuex with SCSS
6+
This is a task list application using Vue, TypeScript, and Vuex with SCSS
77
styles. It supports gamification like levels and experience points (XP).
88
</p>
99
<NewTodo />

src/components/NewTodo.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<form @submit.prevent="addTodo">
33
<!--all fields are required-->
4-
Name:<br /><!--name up to 255 characters-->
4+
Name:<br /><!--task name can be up to 255 characters in length-->
55
<input
66
class="todo-input"
77
id="name"
@@ -74,7 +74,7 @@ export interface todoTask {
7474
repeatFrequency: number; //task repetition frequency
7575
newId: number; //task id
7676
completed: boolean; //task completed or not
77-
timesCompleted: number; //times task has been completed
77+
timesCompleted: number; //number of times tasks has been completed
7878
streak: number; //task completion streak
7979
originalDueDate: Date; //task original due date in YYYY-MM-DD string
8080
}
@@ -95,10 +95,10 @@ export default defineComponent({
9595
repeatOften: 1,
9696
repeatFrequency: repeatFrequency.Once, //set default task repetition to one-time
9797
newId: 0, //initial task id is 0
98-
completed: false, //task not completed if task is created
98+
completed: false, //task not completed if a task is created
9999
timesCompleted: 0,
100100
streak: 0, //set default task streak to 0
101-
originalDueDate: currentLocalDate.toISOString().split("T")[0], //set default original task due date to today
101+
originalDueDate: currentLocalDate.toISOString().split("T")[0], //set a default original task due date to today
102102
};
103103
},
104104
mounted() {

src/components/TodoList.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@use "sass:math";
2+
23
$margin: 10px;
34
h3 {
45
margin: $margin 0 0;
@@ -17,6 +18,7 @@ li {
1718
a {
1819
color: #42b983;
1920
}
21+
2022
.overdue {
2123
color: red;
2224
font-weight: bold;

src/components/TodoList.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export default defineComponent({
123123
return store.getters.getTotalTasksCompleted; //get total tasks completed
124124
},
125125
lastCompletedDates() {
126-
return store.getters.getLastCompletionDate; //get current last completion date
126+
return store.getters.getLastCompletionDate; //get the current last completion date
127127
},
128128
bestScoreEarneds() {
129129
return store.getters.getBestScoreEarned; //get best score earned

src/store/index.ts

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ export default createStore({
1010
xp: 0 as number,
1111
progress: 0 as number,
1212
score: 0 as number, //set score to 0 when state is created
13-
bestScoreEarned: 0 as number, //highest number of points earned achieved when task is completed
13+
bestScoreEarned: 0 as number, //the highest number of points earned achieved when a task is completed
1414
dailyStreak: 0 as number, //set daily streak to 0 and last completion date to undefined when state is created
15-
tasksCompletedToday: 0 as number, //set number of tasks completed in a day (today) to 0
16-
totalTasksCompleted: 0 as number, //set total number of tasks completed to 0
15+
tasksCompletedToday: 0 as number, //set the number of tasks completed in a day (today) to 0
16+
totalTasksCompleted: 0 as number, //set the total number of tasks completed to 0
1717
lastCompletionDate: undefined as string | undefined, //last completion date in YYYY-MM-DD string
1818
},
1919
},
2020
getters: {
21-
getTodos: (state) => state.todos, //get task list
21+
getTodos: (state) => state.todos, //get a task list
2222
getXp: (state) => state.user.xp, //get user XP
2323
getLevel: (state) => state.user.level, //get user level
2424
getProgress: (state) => state.user.progress, //get user level progress
@@ -27,11 +27,11 @@ export default createStore({
2727
getTasksCompletedToday: (state) => state.user.tasksCompletedToday, //get user tasks completed in a day
2828
getTotalTasksCompleted: (state) => state.user.totalTasksCompleted, //get user total tasks completed
2929
getLastCompletionDate: (state) => state.user.lastCompletionDate, //get user last completion date
30-
getBestScoreEarned: (state) => state.user.bestScoreEarned, //get user best score earned when task is completed
30+
getBestScoreEarned: (state) => state.user.bestScoreEarned, //get the user best score earned when a task is completed
3131
},
3232
mutations: {
3333
/**
34-
* Update user XP state when user presses Complete button to complete the task.
34+
* Update user XP state when a user presses Complete button to complete the task.
3535
*/
3636
updateXp: (state, payload) => {
3737
const task = state.todos.find(
@@ -40,7 +40,7 @@ export default createStore({
4040
const daysToDue: number =
4141
(Number(new Date(task.dueDate + " 23:59:59.999")) -
4242
Number(new Date().setHours(23, 59, 59, 999))) /
43-
(1000 * 60 * 60 * 24); //calculate number of days until the task is due
43+
(1000 * 60 * 60 * 24); //calculate the number of days until the task is due
4444
const dateMultiplier: number =
4545
daysToDue < 0
4646
? -2 / (daysToDue - 1)
@@ -50,16 +50,16 @@ export default createStore({
5050
(Number(new Date().setHours(23, 59, 59, 999)) -
5151
Number(new Date())) /
5252
(1000 * 24 * 60 * 60))
53-
: 1 + 1 / (daysToDue + 1); //if task is overdue, XP and score multiplier is less than 1 that decreases over time when task is overdue, else XP multiplier bonus increases (more than 1) when task gets closer to due date
54-
let streakMultiplier: number; //calculate task streak XP and score multiplier based on task streak, if task is completed before the due date then the streak increases else if the task is completed overdue (after the due date) reset task streak to 0
53+
: 1 + 1 / (daysToDue + 1); //if a task is overdue, XP and score multiplier is less than 1 that decreases over time when a task is overdue, else XP multiplier bonus increases (more than 1) when a task gets closer to due date
54+
let streakMultiplier: number; //calculate task streak XP and score multiplier based on task streak, if a task is completed before the due date, then the streak increases else if the task is completed overdue (after the due date) reset task streak to 0
5555
let repeatMultiplier: number; //calculate task repetition XP and score multiplier based on task repetition occurrence and task repetition frequency
5656
let dailyStreakMultiplier: number; //calculate daily streak XP and score multiplier based on daily streak
5757
let levelMultiplier: number; //calculate level score multiplier based on user level
5858
let dayTasksMultiplier: number; //calculate XP and score multiplier for tasks completed in a day (today)
5959
let tasksMultiplier: number; //calculate score multiplier for total number of tasks completed
6060
const activeTasks: number = state.todos.filter(
6161
(taskList) => !taskList.completed
62-
).length; //calculate number of active tasks (tasks that are not completed) using array.filter
62+
).length; //calculate the number of active tasks (tasks that are not completed) using array.filter
6363
let activeTasksMultiplier: number; //calculate score multiplier for number of active tasks (tasks that are not completed)
6464
//calculate task repetition XP multiplier
6565
if (Number(task.repeatFrequency) === 1) {
@@ -107,7 +107,7 @@ export default createStore({
107107
//if task is overdue
108108
task.streak = 0; //reset task streak to 0
109109
} else {
110-
//if task is completed before due date (not overdue)
110+
//if a task is completed before due date (not overdue)
111111
task.streak++; //increase task streak
112112
}
113113
//calculate daily streak
@@ -126,7 +126,7 @@ export default createStore({
126126
//if user last completion date is yesterday
127127
state.user.dailyStreak++; //increase daily streak
128128
}
129-
//calculate number of tasks completed in a day
129+
//calculate the number of tasks completed in a day
130130
if (
131131
state.user.lastCompletionDate === undefined ||
132132
Number(new Date(state.user.lastCompletionDate + " 23:59:59.999")) !==
@@ -144,39 +144,39 @@ export default createStore({
144144
dailyStreakMultiplier = 1 + 0.1 * (state.user.dailyStreak - 1); //1x daily streak XP multiplier from 1 daily streak plus 0.1x streak multiplier for each daily streak
145145
} else if (state.user.dailyStreak < 7) {
146146
//1 week is 7 days
147-
dailyStreakMultiplier = 1.2 + 0.05 * (state.user.dailyStreak - 3); //1.2x daily streak XP multiplier from 3 daily streak plus 0.05x streak multiplier for each daily streak
147+
dailyStreakMultiplier = 1.2 + 0.05 * (state.user.dailyStreak - 3); //1.2x daily streak XP multiplier from 3 daily streaks plus 0.05x streak multiplier for each daily streak
148148
} else if (state.user.dailyStreak < 14) {
149-
//2 weeks is 14 days
150-
dailyStreakMultiplier = 1.4 + 0.04 * (state.user.dailyStreak - 7); //1.4x daily streak XP multiplier from 7 daily streak (1 week) plus 0.04x streak multiplier for each daily streak
149+
//2 weeks are 14 days
150+
dailyStreakMultiplier = 1.4 + 0.04 * (state.user.dailyStreak - 7); //1.4x daily streak XP multiplier from 7 daily streaks (1 week) plus 0.04x streak multiplier for each daily streak
151151
} else if (state.user.dailyStreak < 30) {
152152
//1 month is approximately 30 days
153-
dailyStreakMultiplier = 1.68 + 0.03 * (state.user.dailyStreak - 14); //1.68x daily streak XP multiplier from 14 daily streak (2 weeks) plus 0.03x streak multiplier for each daily streak
153+
dailyStreakMultiplier = 1.68 + 0.03 * (state.user.dailyStreak - 14); //1.68x daily streak XP multiplier from 14 daily streaks (2 weeks) plus 0.03x streak multiplier for each daily streak
154154
} else if (state.user.dailyStreak < 60) {
155-
//2 months is approximately 60 days
156-
dailyStreakMultiplier = 2.16 + 0.02 * (state.user.dailyStreak - 30); //2.16x daily streak XP multiplier from 30 daily streak (approximately 1 month) plus 0.02x streak multiplier for each daily streak
155+
//2 months are approximately 60 days
156+
dailyStreakMultiplier = 2.16 + 0.02 * (state.user.dailyStreak - 30); //2.16x daily streak XP multiplier from 30 daily streaks (approximately 1 month) plus 0.02x streak multiplier for each daily streak
157157
} else if (state.user.dailyStreak < 90) {
158-
//3 months is approximately 90 days
159-
dailyStreakMultiplier = 2.76 + 0.015 * (state.user.dailyStreak - 60); //2.76x daily streak XP multiplier from 60 daily streak (approximately 2 months) plus 0.015x streak multiplier for each daily streak
158+
//3 months are approximately 90 days
159+
dailyStreakMultiplier = 2.76 + 0.015 * (state.user.dailyStreak - 60); //2.76x daily streak XP multiplier from 60 daily streaks (approximately 2 months) plus 0.015x streak multiplier for each daily streak
160160
} else if (state.user.dailyStreak < 180) {
161-
//6 months is approximately 180 days
162-
dailyStreakMultiplier = 3.21 + 0.01 * (state.user.dailyStreak - 90); //3.21x daily streak XP multiplier from 90 daily streak (approximately 3 months) plus 0.01x streak multiplier for each daily streak
161+
//6 months are approximately 180 days
162+
dailyStreakMultiplier = 3.21 + 0.01 * (state.user.dailyStreak - 90); //3.21x daily streak XP multiplier from 90 daily streaks (approximately 3 months) plus 0.01x streak multiplier for each daily streak
163163
} else if (state.user.dailyStreak < 365) {
164164
//1 year is approximately 365 days
165-
dailyStreakMultiplier = 4.11 + 0.005 * (state.user.dailyStreak - 180); //4.11x daily streak XP multiplier from 180 daily streak (approximately 6 months) plus 0.005x streak multiplier for each daily streak
165+
dailyStreakMultiplier = 4.11 + 0.005 * (state.user.dailyStreak - 180); //4.11x daily streak XP multiplier from 180 daily streaks (approximately 6 months) plus 0.005x streak multiplier for each daily streak
166166
} else if (state.user.dailyStreak < 730) {
167-
//2 years is approximately 730 days
168-
dailyStreakMultiplier = 5.035 + 0.003 * (state.user.dailyStreak - 365); //5.035x daily streak XP multiplier from 365 daily streak (approximately 1 year) plus 0.003x streak multiplier for each daily streak
167+
//2 years are approximately 730 days
168+
dailyStreakMultiplier = 5.035 + 0.003 * (state.user.dailyStreak - 365); //5.035x daily streak XP multiplier from 365 daily streaks (approximately 1 year) plus 0.003x streak multiplier for each daily streak
169169
} else if (state.user.dailyStreak < 1461) {
170-
//4 years is approximately 1,461 days
171-
dailyStreakMultiplier = 6.13 + 0.002 * (state.user.dailyStreak - 730); //6.13x daily streak XP multiplier from 730 daily streak (approximately 2 years) plus 0.002x streak multiplier for each daily streak
170+
//4 years are approximately 1,461 days
171+
dailyStreakMultiplier = 6.13 + 0.002 * (state.user.dailyStreak - 730); //6.13x daily streak XP multiplier from 730 daily streaks (approximately 2 years) plus 0.002x streak multiplier for each daily streak
172172
} else if (state.user.dailyStreak < 3652) {
173-
//10 years is approximately 3,652 days
174-
dailyStreakMultiplier = 7.592 + 0.001 * (state.user.dailyStreak - 1461); //7.592x daily streak XP multiplier from 1,461 daily (approximately 4 years) streak plus 0.001x streak multiplier for each daily streak
173+
//10 years are approximately 3,652 days
174+
dailyStreakMultiplier = 7.592 + 0.001 * (state.user.dailyStreak - 1461); //7.592x daily streak XP multiplier from 1,461 daily streaks (approximately 4 years) plus 0.001x streak multiplier for each daily streak
175175
} else {
176-
dailyStreakMultiplier = 9.783; //9.783x daily streak XP multiplier from 3,652 daily streak (approximately 10 years)
176+
dailyStreakMultiplier = 9.783; //9.783x daily streak XP multiplier from 3,652 daily streaks (approximately 10 years)
177177
}
178178

179-
//set last completion date to today
179+
//set the last completion date to today
180180
state.user.lastCompletionDate = new Date(
181181
new Date().setMinutes(
182182
new Date().getMinutes() - new Date().getTimezoneOffset()
@@ -221,7 +221,7 @@ export default createStore({
221221
state.user.tasksCompletedToday === 0 ||
222222
state.user.tasksCompletedToday === 1
223223
) {
224-
dayTasksMultiplier = 1; //1x multiplier for 0 or 1 task completed in a day
224+
dayTasksMultiplier = 1; //1x multiplier for 0 or 1 tasks completed in a day
225225
} else if (state.user.tasksCompletedToday < 5) {
226226
dayTasksMultiplier = 1 + 0.125 * (state.user.tasksCompletedToday - 1); //1x multiplier plus 0.125x multiplier for each task completed in a day from 1 task completed in a day
227227
} else if (state.user.tasksCompletedToday < 10) {
@@ -341,7 +341,7 @@ export default createStore({
341341
}
342342
//calculate active task score multiplier
343343
if (activeTasks === 0 || activeTasks === 1) {
344-
activeTasksMultiplier = 1; //1x active task score multiplier for 0 or 1 active task
344+
activeTasksMultiplier = 1; //1x active task score multiplier for 0 or 1 active tasks
345345
} else if (activeTasks < 3) {
346346
activeTasksMultiplier = 1 + 0.25 * (activeTasks - 1); //1x active task score multiplier from 1 active task plus 0.25x active task score multiplier for each active task
347347
} else if (activeTasks < 5) {
@@ -369,7 +369,7 @@ export default createStore({
369369
} else {
370370
activeTasksMultiplier = 27; //27x active task score multiplier from 10,000 active tasks
371371
}
372-
//calculate amount of XP earned and points earned when task is completed
372+
//calculate the amount of XP earned and points earned when a task is completed
373373
const xpEarned: number = Math.max(
374374
Math.floor(
375375
task.difficulty *
@@ -382,7 +382,7 @@ export default createStore({
382382
),
383383
1
384384
); //get at least 1 XP when the task is completed
385-
state.user.xp += xpEarned; //get amount of XP earned based on task difficulty, task priority, task due date, task repetition, task streak and daily streak multipliers
385+
state.user.xp += xpEarned; //get the amount of XP earned based on task difficulty, task priority, task due date, task repetition, task streak and daily streak multipliers
386386
const pointsEarned: number = Math.max(
387387
Math.floor(
388388
task.difficulty *
@@ -400,8 +400,8 @@ export default createStore({
400400
); //get at least 1 point when the task is completed
401401
state.user.score += pointsEarned; //get amount of points earned based on task difficulty, task priority, task due date, task repetition, task streak, daily streak and user level multipliers
402402
if (pointsEarned > state.user.bestScoreEarned) {
403-
//if points earned is greaedr than best score earned
404-
state.user.bestScoreEarned = pointsEarned; //set best score earned to points earned whan task is completed
403+
//if points earned are greater than the best score earned
404+
state.user.bestScoreEarned = pointsEarned; //set the best score earned to points earned when a task is completed
405405
}
406406
alert(
407407
`Task ${task.task} completed!\nYou earned ${xpEarned.toLocaleString(
@@ -432,7 +432,7 @@ export default createStore({
432432
},
433433
create_Todo: (state, payload) => {
434434
/**
435-
* Create the task when user presses the Add Task button.
435+
* Create the task when a user presses the Add Task button.
436436
*/
437437
const createTask = {
438438
newId: payload.newId as number,
@@ -458,18 +458,18 @@ export default createStore({
458458
(todo: { newId: number }) => todo.newId === payload
459459
);
460460
if (Number(item.repeatFrequency) === 5) {
461-
//if task is a one-time only
461+
//if a task is a one-time only
462462
item.completed = !item.completed; //complete task item (set completed task to true)
463463
} else {
464-
item.timesCompleted++; //increment number of times task has been completed by 1
464+
item.timesCompleted++; //increment number of times tasks has been completed by 1
465465
if (Number(item.repeatFrequency) === 1) {
466466
//if task repeat frequency is daily
467467
const newDueDate: Date = new Date(
468468
new Date(item.originalDueDate + " 23:59:59.999").setDate(
469469
new Date(item.originalDueDate + " 23:59:59.999").getDate() +
470470
item.timesCompleted * item.repeatOften
471471
)
472-
); //get new due date
472+
); //get a new due date
473473
const adjustedNewDueDate: Date = new Date(
474474
newDueDate.setMinutes(
475475
newDueDate.getMinutes() - newDueDate.getTimezoneOffset()
@@ -592,7 +592,7 @@ export default createStore({
592592
},
593593
delete_Todo: (state, payload) => {
594594
/**
595-
* Delete the task when user confirms task deletion alert after pressing the Delete button.
595+
* Delete the task when a user confirms task deletion alert after pressing the Delete button.
596596
*/
597597
const index = state.todos.findIndex(
598598
(todo: { newId: number }) => todo.newId === payload
@@ -605,7 +605,7 @@ export default createStore({
605605
) as boolean; //ask user to confirm task deletion
606606
}
607607
if (deleteTask || state.todos[index].completed) {
608-
//delete task if one-time task is completed when the delete button is clicked or when user confirms deletion alert
608+
//delete task if one-time task is completed when the deleted button is clicked or when user confirms deletion alert
609609
state.todos.splice(index, 1); //delete task item
610610
}
611611
},

0 commit comments

Comments
 (0)