Skip to content

Commit f828550

Browse files
committed
Change todo to task and rename some files
1 parent 17f9953 commit f828550

File tree

10 files changed

+93
-93
lines changed

10 files changed

+93
-93
lines changed

README.md

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

3-
This application is a todo list with task repetition with level and experience points,
3+
This application is a task list with task repetition with level and experience points,
44
and it stores to local storage using `vuex-persistedstate`.
55
Try it on Netlify: https://gamification-todo-list-vue-typescript.netlify.app/
66

docs/index.md

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

3-
This application is a todo list with task repetition with level and experience points,
3+
This application is a task list with task repetition with level and experience points,
44
and it stores to local storage using `vuex-persistedstate`.
55
Try it on Netlify: https://gamification-todo-list-vue-typescript.netlify.app/
66

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "todo-list-application-typescript",
2+
"name": "task-list-application-typescript",
33
"version": "1.14.0",
44
"private": true,
55
"scripts": {

public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
66
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
77
<link rel="icon" href="<%= BASE_URL %>favicon.ico" />
8-
<title>Gamification Todo List with Vue and TypeScript</title>
8+
<title>Gamification Task List with Vue and TypeScript</title>
99
</head>
1010
<body>
1111
<noscript>

src/App.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
<template>
22
<img alt="Vue logo" src="./assets/logo.png" />
33
<div>
4-
<h1>Todo List Application using Vue, TypeScript and Vuex</h1>
4+
<h1>Task List Application using Vue, TypeScript and Vuex</h1>
55
<p>
66
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>
9-
<NewTodo />
10-
<TodoList />
9+
<NewTask />
10+
<TaskList />
1111
</div>
1212
</template>
1313

1414
<script lang="ts">
1515
import { defineComponent } from "vue";
16-
import NewTodo from "./components/NewTodo.vue";
17-
import TodoList from "./components/TodoList.vue";
16+
import NewTask from "./components/NewTask.vue";
17+
import TaskList from "./components/TaskList.vue";
1818
1919
export default defineComponent({
2020
name: "App",
2121
components: {
22-
NewTodo,
23-
TodoList,
22+
NewTask,
23+
TaskList,
2424
},
2525
});
2626
</script>

src/components/NewTodo.vue renamed to src/components/NewTask.vue

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<template>
2-
<form @submit.prevent="addTodo">
2+
<form @submit.prevent="addTask">
33
<!--all fields are required in order to add a task-->
44
Name:<br /><!--task name can be up to 255 characters in length-->
55
<input
6-
class="todo-input"
6+
class="task-input"
77
id="name"
88
type="text"
99
placeholder="Enter task name"
@@ -13,28 +13,28 @@
1313
/><br />
1414
Due date:<br /><!--task due date must be on or after today date-->
1515
<input
16-
class="todo-input"
16+
class="task-input"
1717
id="due-date"
1818
type="date"
1919
placeholder="Enter due date"
2020
v-model="originalDueDate"
2121
required
2222
/><br />
2323
Priority:<br />
24-
<select class="todo-input" id="priority" v-model="priority" required>
24+
<select class="task-input" id="priority" v-model="priority" required>
2525
<option value="1">Low</option>
2626
<option value="2">Medium</option>
2727
<option value="3">High</option></select
2828
><br />
2929
Difficulty:<br />
30-
<select class="todo-input" id="difficulty" v-model="difficulty" required>
30+
<select class="task-input" id="difficulty" v-model="difficulty" required>
3131
<option value="1">Easy</option>
3232
<option value="2">Medium</option>
3333
<option value="3">Hard</option></select
3434
><br />
3535
Repeat every:<br />
3636
<input
37-
class="todo-input"
37+
class="task-input"
3838
id="repeat-every"
3939
type="number"
4040
placeholder="Enter number of days/weeks/months/years to repeat"
@@ -45,7 +45,7 @@
4545
/><br />
4646
Repeat interval:<br />
4747
<select
48-
class="todo-input"
48+
class="task-input"
4949
id="repeat-interval"
5050
v-model="repeatInterval"
5151
required
@@ -62,11 +62,11 @@
6262

6363
<script lang="ts">
6464
import store from "@/store";
65-
import { Difficulty, Priority, RepeatInterval } from "./TodoList.vue";
65+
import { Difficulty, Priority, RepeatInterval } from "./TaskList.vue";
6666
import { defineComponent } from "vue";
6767
6868
export interface TodoTask {
69-
//todo task interface
69+
//todo task list interface
7070
task: string; //task name
7171
dueDate: Date; //task due date
7272
priority: number; //task priority
@@ -114,9 +114,9 @@ export default defineComponent({
114114
},
115115
methods: {
116116
/**
117-
* Add task to todo list when user presses the Add Task button.
117+
* Add task to task list when user presses the Add Task button.
118118
*/
119-
addTodo: function (): void | TodoTask[] {
119+
addTask: function (): void | TodoTask[] {
120120
this.dueDate = this.originalDueDate; //set task due date to entered task original due date
121121
store.dispatch("createTask", this);
122122
this.newId++;
File renamed without changes.

src/components/TodoList.vue renamed to src/components/TaskList.vue

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="todo-app">
2+
<div class="task-list-app">
33
<!--task list app content-->
44
<p>
55
Level:
@@ -60,57 +60,57 @@
6060
}}</span></ve-progress
6161
>
6262
<h3>Task list</h3>
63-
<ul class="todos">
63+
<ul class="tasks">
6464
<!--repeat for each tasks-->
65-
<li v-for="todo in todos" :key="todo.newId" class="todo">
65+
<li v-for="task in getTasks" :key="task.newId" class="task">
6666
<span
6767
:class="{
68-
overdue: new Date(todo.dueDate + ' 23:59:59.999') < new Date(),
68+
overdue: new Date(task.dueDate + ' 23:59:59.999') < new Date(),
6969
}"
7070
><span id="text-numeric-display"
71-
>{{ todo.task
71+
>{{ task.task
7272
}}<span
73-
v-if="new Date(todo.dueDate + ' 23:59:59.999') < new Date()"
73+
v-if="new Date(task.dueDate + ' 23:59:59.999') < new Date()"
7474
>
7575
(Overdue)</span
7676
></span
7777
>
7878
<br />Streak:
7979
<span id="text-numeric-display">{{
80-
todo.streak.toLocaleString("en-US")
80+
task.streak.toLocaleString("en-US")
8181
}}</span>
8282
<br />Rank:
8383
<span id="text-numeric-display">{{
84-
todo.rank.toLocaleString("en-US")
84+
task.rank.toLocaleString("en-US")
8585
}}</span>
86-
<br /><progress max="100" :value="todo.rankProgress"></progress
86+
<br /><progress max="100" :value="task.rankProgress"></progress
8787
><br />Due date:
88-
<span id="text-numeric-display">{{ todo.dueDate }}</span>
88+
<span id="text-numeric-display">{{ task.dueDate }}</span>
8989
<br />Priority:
90-
<span id="text-numeric-display">{{ todo.priority }}</span>
90+
<span id="text-numeric-display">{{ task.priority }}</span>
9191
<br />Difficulty:
92-
<span id="text-numeric-display">{{ todo.difficulty }}</span>
92+
<span id="text-numeric-display">{{ task.difficulty }}</span>
9393
<br />Repeat:
94-
<span v-if="todo.repeatInterval != 5"
94+
<span v-if="task.repeatInterval != 5"
9595
><span id="text-numeric-display">{{
96-
todo.repeatEvery.toLocaleString("en-US")
96+
task.repeatEvery.toLocaleString("en-US")
9797
}}</span></span
98-
>&nbsp;<span v-if="todo.repeatInterval == 1">Day</span
99-
><span v-if="todo.repeatInterval == 2">Week</span
100-
><span v-if="todo.repeatInterval == 3">Month</span
101-
><span v-if="todo.repeatInterval == 4">Year</span
102-
><span v-if="todo.repeatInterval == 5">Once</span
103-
><span v-if="todo.repeatEvery > 1 && todo.repeatInterval != 5"
98+
>&nbsp;<span v-if="task.repeatInterval == 1">Day</span
99+
><span v-if="task.repeatInterval == 2">Week</span
100+
><span v-if="task.repeatInterval == 3">Month</span
101+
><span v-if="task.repeatInterval == 4">Year</span
102+
><span v-if="task.repeatInterval == 5">Once</span
103+
><span v-if="task.repeatEvery > 1 && task.repeatInterval != 5"
104104
>s</span
105105
></span
106106
>
107107
<!--don't show complete button if one-time task is completed--><button
108-
v-if="!todo.isCompleted"
109-
@click="completeTodo(todo.newId)"
108+
v-if="!task.isCompleted"
109+
@click="completeTask(task.newId)"
110110
>
111111
Complete
112112
</button>
113-
<button @click="deleteTodo(todo.newId)">Delete</button><br />
113+
<button @click="deleteTask(task.newId)">Delete</button><br />
114114
</li>
115115
</ul>
116116
</div>
@@ -138,7 +138,7 @@ export enum Priority {
138138
High = 3,
139139
}
140140
export default defineComponent({
141-
name: "TodoList",
141+
name: "TaskList",
142142
props: {
143143
newId: Number,
144144
tasks: Array,
@@ -160,11 +160,11 @@ export default defineComponent({
160160
originalDueDate: Date,
161161
},
162162
computed: {
163-
todos() {
163+
getTasks() {
164164
//eslint-disable-next-line
165-
return store.getters.getTodos.sort((a: any, b: any) =>
165+
return store.getters.getTasks.sort((a: any, b: any) =>
166166
a.dueDate.localeCompare(b.dueDate),
167-
); //get tasks (todos) and sort tasks by task's due date with the top one the oldest
167+
); //get list of tasks (todos) and sort tasks by task's due date with the top one the oldest
168168
},
169169
getCurrentLevel() {
170170
return store.getters.getLevel; //get current level
@@ -202,19 +202,19 @@ export default defineComponent({
202202
* Complete task based on task ID.
203203
* @param id task ID
204204
*/
205-
completeTodo: function (id: number): void {
205+
completeTask: function (id: number): void {
206206
store.dispatch("completeTask", id);
207207
},
208208
/**
209209
* Delete task based on task ID.
210210
* @param id task ID
211211
*/
212-
deleteTodo: function (id: number): void {
212+
deleteTask: function (id: number): void {
213213
store.dispatch("deleteTask", id);
214214
},
215215
},
216216
});
217217
</script>
218218

219219
<!-- Add "scoped" attribute to limit CSS to this component only -->
220-
<link scoped lang="scss" src="./TodoList.scss" />
220+
<link scoped lang="scss" src="./TaskList.scss" />

src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ store.dispatch("loadUser").then(
1818
console.log("User data failed to load.");
1919
},
2020
); //load user data
21-
store.dispatch("loadTodos").then(
21+
store.dispatch("loadTasks").then(
2222
(success) => {
2323
//if task list data is loaded successfully
2424
console.log("Task list data loaded successfully!");

0 commit comments

Comments
 (0)