Skip to content

Commit 857aecf

Browse files
committed
Add overdue class and styles and add more details of each task
1 parent 99a6126 commit 857aecf

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/components/TodoList.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,7 @@ li {
1414
a {
1515
color: #42b983;
1616
}
17+
.overdue {
18+
color: red;
19+
font-weight: bold;
20+
}

src/components/TodoList.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<p>XP: {{ xps }}</p><br/>
66
<ul class="todos">
77
<li v-for="todo in todos" :key="todo.newId" class="todo">
8-
{{ todo.task }}
8+
<span v-bind:class="{ 'overdue': new Date(todo.dueDate+' 23:59:59.999') < new Date()}">{{ todo.task }}: Due {{ todo.dueDate }} Priority: {{ todo.priority }} Difficulty: {{ todo.difficulty }} Repeat: <span v-if="todo.repeatFrequency != 5">{{ todo.repeatOften }}</span> <span v-if="todo.repeatFrequency == 1">Day</span><span v-if="todo.repeatFrequency == 2">Week</span><span v-if="todo.repeatFrequency == 3">Month</span><span v-if="todo.repeatFrequency == 4">Year</span><span v-if="todo.repeatFrequency == 5">Once</span><span v-if="todo.repeatOften > 1">s</span></span>
99
<button @click="completeTodo(todo.newId)">Complete</button>
1010
<button @click="deleteTodo(todo.newId)">Delete</button><br/>
1111
</li>

src/store/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ export default createStore({
3030
priority: payload.priority as number,
3131
difficulty: payload.difficulty as number,
3232
xp: payload.xp as number,
33-
completed: payload.completed as boolean
33+
completed: payload.completed as boolean,
34+
repeatOften: payload.repeatOften as number,
35+
repeatFrequency: payload.repeatFrequency as number
3436
};
3537
state.todos.unshift(createTask);
3638
},

0 commit comments

Comments
 (0)