From 10baf039df497b3b16e302894739c82aabd5146b Mon Sep 17 00:00:00 2001 From: Guz <43732358+Guz013@users.noreply.github.com> Date: Wed, 26 Jan 2022 12:23:24 -0300 Subject: [PATCH 01/18] fix(date-lib): hour display format. Fixed how the readable hours are displayed, now something like 8:5 will be correctly displayed 08:05. --- src/libs/date.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/date.ts b/src/libs/date.ts index 03b0151..bb01b6f 100644 --- a/src/libs/date.ts +++ b/src/libs/date.ts @@ -23,7 +23,7 @@ const date = { const d = new Date(); return { - readable: `${d.getHours()}:${d.getMinutes()}`, + readable: `${String(d.getHours()).padStart(2, '0')}:${String(d.getMinutes()).padStart(2, '0')}`, hours: d.getHours(), minutes: d.getMinutes(), seconds: d.getSeconds(), From 468e0078f90fbddc66f2ad9a6443fd2a82c1e6f0 Mon Sep 17 00:00:00 2001 From: Guz <43732358+Guz013@users.noreply.github.com> Date: Wed, 26 Jan 2022 12:28:22 -0300 Subject: [PATCH 02/18] feat(storageManagement): added easy local storage management. Created a simple library/functions to handle the JSON file used as memory on the browser's local storage, can handle errors, and can be reused in other projects without problems probably. Version changed to 0.2.0 --- nuxt.config.js | 1 + package.json | 2 +- src/components/ThemePicker.vue | 14 +++- src/libs/storageManagement.ts | 148 +++++++++++++++++++++++++++++++++ src/pages/index.vue | 11 +++ 5 files changed, 174 insertions(+), 2 deletions(-) create mode 100644 src/libs/storageManagement.ts diff --git a/nuxt.config.js b/nuxt.config.js index 0082da7..e5d29e1 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -2,6 +2,7 @@ export default { srcDir: 'src/', buildDir: 'dist', target: 'static', + ssr: false, // Global page headers: https://go.nuxtjs.dev/config-head head: { diff --git a/package.json b/package.json index 79362cc..5c24f69 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ToToday", - "version": "0.1.0", + "version": "0.2.0", "private": true, "scripts": { "dev": "nuxt", diff --git a/src/components/ThemePicker.vue b/src/components/ThemePicker.vue index 7415df2..f137ad0 100644 --- a/src/components/ThemePicker.vue +++ b/src/components/ThemePicker.vue @@ -3,7 +3,8 @@ - - - + +
+
@@ -15,23 +14,7 @@ From e6d036784f47f1c424a4f5c277c88edbad5e2f76 Mon Sep 17 00:00:00 2001 From: Guz <43732358+Guz013@users.noreply.github.com> Date: Sat, 29 Jan 2022 11:46:57 -0300 Subject: [PATCH 09/18] feat(taskList): created task list and improved task component Created the Task List component to handle and render the Task components dynamically; Improved Task component to now be able to delete itself from the list / added task controls; Task's state now are saved in LocalStorage; Added animations to Task Components; --- package.json | 2 +- src/assets/styles/global.scss | 6 + src/components/TaskComp.vue | 344 ++++++++++++++++++++++------------ src/components/TaskList.vue | 73 ++++++++ src/components/icon/Trash.vue | 42 +++++ src/static/icons/trash.svg | 6 + 6 files changed, 348 insertions(+), 125 deletions(-) create mode 100644 src/components/TaskList.vue create mode 100644 src/components/icon/Trash.vue create mode 100644 src/static/icons/trash.svg diff --git a/package.json b/package.json index 68e55f7..bd80041 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ToToday", - "version": "0.3.0", + "version": "0.4.0", "private": true, "scripts": { "dev": "nuxt", diff --git a/src/assets/styles/global.scss b/src/assets/styles/global.scss index 597b70c..2e87fd5 100644 --- a/src/assets/styles/global.scss +++ b/src/assets/styles/global.scss @@ -21,11 +21,17 @@ body { .light-mode body { background-color: $light-background; color: $light-primary; + * { + stroke: $light-secondary; + } } .dark-mode body { background-color: $dark-background; color: $dark-primary; + * { + stroke: $dark-secondary; + } } /* diff --git a/src/components/TaskComp.vue b/src/components/TaskComp.vue index efdad2c..56eec78 100644 --- a/src/components/TaskComp.vue +++ b/src/components/TaskComp.vue @@ -1,21 +1,34 @@ - @@ -42,6 +76,16 @@ export default Vue.extend({ $checked-color: $green0; $unchecked-color: $begonia-red0; +.newTask { + animation-delay: 0s !important; +} + +@for $i from 1 through 100 { + .task#task#{$i} { + animation-delay: #{$i * 0.2}s; + } +} + .task { .light-mode & { background-color: $blue0; @@ -52,151 +96,203 @@ $unchecked-color: $begonia-red0; color: $dark-primary; } - display: flex; - text-align: left; - align-items: center; - border-radius: 20px; margin-top: 5%; padding: 10px; - .checkbox { - padding: 1%; - padding-right: 2%; + display: flex; + align-items: center; + justify-content: space-between; + padding-right: 5%; - input { - display: none; + opacity: 0; + transform: translateY(50%); + + animation: enter 0.5s ease-out; + animation-fill-mode: forwards; + + @keyframes enter { + from { + opacity: 0; + transform: translateY(50%); } - input[type='checkbox']:checked + .icons { - animation: iconAnim 1s; - .checkedIcon { - display: inline-block; - } - .uncheckedIcon { + to { + opacity: 1; + transform: translateY(0); + } + } + + .taskInfo { + display: flex; + text-align: left; + align-items: center; + width: 100%; + + .checkbox { + padding: 1%; + padding-right: 2%; + + input { display: none; } - - .checkedIcon *, - .uncheckedIcon * { - .light-mode & { - @include colorFadeAnim( - $unchecked-color, - $checked-color, - 1s, - 'checkLight' - ); - stroke: $checked-color; + input[type='checkbox']:checked + .icons { + animation: iconAnim 1s; + .checkedIcon { + display: inline-block; } - .dark-mode & { - @include colorFadeAnim( - $unchecked-color, - $checked-color, - 1s, - 'checkDark' - ); - stroke: $checked-color; + .uncheckedIcon { + display: none; + } + + .checkedIcon *, + .uncheckedIcon * { + .light-mode & { + @include colorFadeAnim( + $unchecked-color, + $checked-color, + 1s, + 'checkLight' + ); + stroke: $checked-color; + } + .dark-mode & { + @include colorFadeAnim( + $unchecked-color, + $checked-color, + 1s, + 'checkDark' + ); + stroke: $checked-color; + } } } - } - input[type='checkbox']:not(:checked) + .icons { - animation: iconAnimReverse 1s; - .checkedIcon { - display: none; - } - .uncheckedIcon { - display: inline-block; - } - - .checkedIcon *, - .uncheckedIcon * { - .light-mode & { - @include colorFadeAnim( - $checked-color, - $unchecked-color, - 1s, - 'uncheckLight' - ); - stroke: $unchecked-color; + input[type='checkbox']:not(:checked) + .icons { + animation: iconAnimReverse 1s; + .checkedIcon { + display: none; } - .dark-mode & { - @include colorFadeAnim( - $checked-color, - $unchecked-color, - 1s, - 'uncheckDark' - ); - stroke: $unchecked-color; + .uncheckedIcon { + display: inline-block; + } + + .checkedIcon *, + .uncheckedIcon * { + .light-mode & { + @include colorFadeAnim( + $checked-color, + $unchecked-color, + 1s, + 'uncheckLight' + ); + stroke: $unchecked-color; + } + .dark-mode & { + @include colorFadeAnim( + $checked-color, + $unchecked-color, + 1s, + 'uncheckDark' + ); + stroke: $unchecked-color; + } } } - } - .icons { - @include center; - $bg-color: #00000080; + .icons { + @include center; + $bg-color: #00000080; - background-color: $bg-color; + background-color: $bg-color; - margin: 2px; - padding: 2px; - border-radius: 50%; + margin: 2px; + padding: 2px; + border-radius: 50%; - .checkedIcon *, - .uncheckedIcon * { - .light-mode & { - stroke: $unchecked-color; + .checkedIcon *, + .uncheckedIcon * { + .light-mode & { + stroke: $unchecked-color; + } + .dark-mode & { + stroke: $unchecked-color; + } } - .dark-mode & { - stroke: $unchecked-color; + } + + @keyframes iconAnim { + from { + transform: rotate(0) scale(1); + } + 5% { + transform: rotate(0) scale(0.7); + } + 50% { + transform: rotate(360deg) scale(1.2); + } + 90% { + transform: scale(1.2); + } + to { + transform: scale(1); + } + } + + @keyframes iconAnimReverse { + from { + transform: rotate(0) scale(1); + } + 5% { + transform: rotate(0) scale(0.7); + } + 50% { + transform: rotate(-360deg) scale(1); + } + to { + transform: rotate(-360deg) scale(1); } } } - @keyframes iconAnim { - from { - transform: rotate(0) scale(1); - } - 5% { - transform: rotate(0) scale(0.7); - } - 50% { - transform: rotate(360deg) scale(1.2); - } - 90% { - transform: scale(1.2); - } - to { - transform: scale(1); - } - } + .info { + display: inline-block; - @keyframes iconAnimReverse { - from { - transform: rotate(0) scale(1); + h1 { + font-size: 1.2em; + margin: 0; } - 5% { - transform: rotate(0) scale(0.7); - } - 50% { - transform: rotate(-360deg) scale(1); - } - to { - transform: rotate(-360deg) scale(1); + + p { + font-family: $secondary-font; + font-size: 0.8em; + margin: 0; } } } - .info { - display: inline-block; + .controls { + opacity: 0; + @media (pointer: none), (pointer: coarse) { + opacity: 0.5; + } + transition: opacity 0.2s; - h1 { - font-size: 1.2em; - margin: 0; + button { + background-color: transparent; + padding: 1px; + border: 0; + cursor: pointer; } - p { - font-family: $secondary-font; - font-size: 0.8em; - margin: 0; + .trashIcon { + * { + transition: stroke 0.2s; + } + &:hover * { + stroke: $unchecked-color; + } } } + &:hover .controls { + opacity: 1; + } } diff --git a/src/components/TaskList.vue b/src/components/TaskList.vue new file mode 100644 index 0000000..92c385e --- /dev/null +++ b/src/components/TaskList.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/src/components/icon/Trash.vue b/src/components/icon/Trash.vue new file mode 100644 index 0000000..7ba7575 --- /dev/null +++ b/src/components/icon/Trash.vue @@ -0,0 +1,42 @@ + + + diff --git a/src/static/icons/trash.svg b/src/static/icons/trash.svg new file mode 100644 index 0000000..a76989c --- /dev/null +++ b/src/static/icons/trash.svg @@ -0,0 +1,6 @@ + + + + + + From 6a5cf5edda09ccd368e79c0ee774eeca3ae539fa Mon Sep 17 00:00:00 2001 From: Guz <43732358+Guz013@users.noreply.github.com> Date: Sun, 30 Jan 2022 17:41:25 -0300 Subject: [PATCH 10/18] style: code style in some files --- src/libs/storageManagement.ts | 2 -- src/libs/utils.ts | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/libs/storageManagement.ts b/src/libs/storageManagement.ts index 17a0034..dcf0598 100644 --- a/src/libs/storageManagement.ts +++ b/src/libs/storageManagement.ts @@ -14,10 +14,8 @@ const sm = { * @param {any} value New value; */ add: (path: string, value: any) => { - let data = sm.getJSON().data; - if (obj.getByString(data, `data.${path}`)) return window.alert('ERROR: Value already in storage'); diff --git a/src/libs/utils.ts b/src/libs/utils.ts index 6c6e327..8d4e3ae 100644 --- a/src/libs/utils.ts +++ b/src/libs/utils.ts @@ -4,7 +4,7 @@ const resolvePath = (path: string) => { path = path.replace(/\[(\w+)\]/g, '.$1'); path = path.replace(/^\./, ''); return path.split('.'); -} +}; const obj = { setByString: (object: object | any, newValue: any, path: string) => { From 51c4618d9c6283f43c90587628906968603f417b Mon Sep 17 00:00:00 2001 From: Guz <43732358+Guz013@users.noreply.github.com> Date: Sun, 30 Jan 2022 17:50:27 -0300 Subject: [PATCH 11/18] fix(animations): animations played before necessary / on page load, files location; Fixed animation being played right after pages load, created `.preventAnimLoad` (used on a parent element that's being loaded), and `.preventAnim` classes (used on the element with the animation to be prevented) to this; Moved `TaskList.vue` and `TaskComp.vue` to Task (`components/Task`) for better organization. --- src/assets/styles/_variables.scss | 3 + src/assets/styles/global.scss | 4 + src/components/Task/TaskComp.vue | 346 +++++++++++++++++++++++++ src/components/{ => Task}/TaskList.vue | 4 +- src/components/TaskComp.vue | 298 --------------------- src/pages/index.vue | 14 +- 6 files changed, 368 insertions(+), 301 deletions(-) create mode 100644 src/components/Task/TaskComp.vue rename src/components/{ => Task}/TaskList.vue (93%) delete mode 100644 src/components/TaskComp.vue diff --git a/src/assets/styles/_variables.scss b/src/assets/styles/_variables.scss index b538f21..761e3ad 100644 --- a/src/assets/styles/_variables.scss +++ b/src/assets/styles/_variables.scss @@ -11,3 +11,6 @@ $dark-secondary: $eerie-black3; $main-font: 'Red Display', arial, helvetica, sans-serif; $secondary-font: 'Fira Code', monospace, sans-serif; + +$checked-color: $green0; +$unchecked-color: $begonia-red0; diff --git a/src/assets/styles/global.scss b/src/assets/styles/global.scss index 2e87fd5..f4e472b 100644 --- a/src/assets/styles/global.scss +++ b/src/assets/styles/global.scss @@ -34,6 +34,10 @@ body { } } +.preventAnimLoad * .preventAnim { + animation-duration: 0s !important; +} + /* ? Workaround with changing elements depending on the page's theme, ? probably there is a better way, using `v-if` and `v-else`, but apparently, diff --git a/src/components/Task/TaskComp.vue b/src/components/Task/TaskComp.vue new file mode 100644 index 0000000..fd7c6ae --- /dev/null +++ b/src/components/Task/TaskComp.vue @@ -0,0 +1,346 @@ + + + + + diff --git a/src/components/TaskList.vue b/src/components/Task/TaskList.vue similarity index 93% rename from src/components/TaskList.vue rename to src/components/Task/TaskList.vue index 92c385e..f40ef80 100644 --- a/src/components/TaskList.vue +++ b/src/components/Task/TaskList.vue @@ -24,6 +24,8 @@ const taskItem = { description: 'Task', checked: false, newTask: true, + autoCheck: true, + subTasks: [], }; export default Vue.extend({ @@ -37,7 +39,7 @@ export default Vue.extend({ const localTasks = sm.get('tasks'); - for(const task of localTasks) task.newTask = undefined; + for (const task of localTasks) task.newTask = undefined; sm.set('tasks', localTasks); }, diff --git a/src/components/TaskComp.vue b/src/components/TaskComp.vue deleted file mode 100644 index 56eec78..0000000 --- a/src/components/TaskComp.vue +++ /dev/null @@ -1,298 +0,0 @@ - - - - - diff --git a/src/pages/index.vue b/src/pages/index.vue index 38d92e1..5b303a4 100644 --- a/src/pages/index.vue +++ b/src/pages/index.vue @@ -1,12 +1,12 @@ @@ -340,6 +349,49 @@ export default Vue.extend({ } } + .subtasksButton { + display: flex; + align-items: center; + + opacity: 0; + @media (pointer: none), (pointer: coarse) { + opacity: 0.5; + } + transition: opacity 0.2s; + + background-color: transparent; + padding: 1px; + border: 0; + cursor: pointer; + + .dropdownIcon { + * { + transition: stroke 0.2s; + } + &:hover * { + .light-mode & { + stroke: $independence-gray0; + } + .dark-mode & { + stroke: $dark-primary; + } + } + } + + &.openedSubtasksButton { + .dropdownIcon { + transform: rotate(180deg); + } + } + &.closedSubtasksButton { + .dropdownIcon { + transform: rotate(0deg); + } + } + } + &:hover .subtasksButton { + opacity: 1; + } } } } diff --git a/src/components/icon/Dropdown.vue b/src/components/icon/Dropdown.vue new file mode 100644 index 0000000..e66d2b6 --- /dev/null +++ b/src/components/icon/Dropdown.vue @@ -0,0 +1,30 @@ + + + diff --git a/src/static/icons/source_icons_down-round-arrow.svg b/src/static/icons/source_icons_down-round-arrow.svg new file mode 100644 index 0000000..4a67454 --- /dev/null +++ b/src/static/icons/source_icons_down-round-arrow.svg @@ -0,0 +1,4 @@ + + + + From 03c21d3523ecef0ae27136b779227527ffe0320a Mon Sep 17 00:00:00 2001 From: Guz <43732358+Guz013@users.noreply.github.com> Date: Sun, 30 Jan 2022 18:55:26 -0300 Subject: [PATCH 13/18] fix(version): fixed app's version in correlation with the last commit/feature --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bd80041..13b8f65 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ToToday", - "version": "0.4.0", + "version": "0.5.0", "private": true, "scripts": { "dev": "nuxt", From 6ea20001e229d9495b2bdad74dcfc5799c1e9cce Mon Sep 17 00:00:00 2001 From: Guz <43732358+Guz013@users.noreply.github.com> Date: Sun, 30 Jan 2022 20:07:13 -0300 Subject: [PATCH 14/18] chore(types): added custom types for common objects/values. --- src/components/SubTask/SubTaskComp.vue | 20 +++++++------- src/components/SubTask/SubTaskList.vue | 4 +-- src/components/Task/TaskComp.vue | 4 +-- src/components/Task/TaskList.vue | 8 +++--- src/libs/date.ts | 4 +-- src/libs/storageManagement.ts | 17 ++++++------ src/types/Storage.d.ts | 37 ++++++++++++++++++++++++++ src/types/Tasks.d.ts | 13 +++++++++ tsconfig.json | 1 + 9 files changed, 81 insertions(+), 27 deletions(-) create mode 100644 src/types/Storage.d.ts create mode 100644 src/types/Tasks.d.ts diff --git a/src/components/SubTask/SubTaskComp.vue b/src/components/SubTask/SubTaskComp.vue index 0d25653..4877d85 100644 --- a/src/components/SubTask/SubTaskComp.vue +++ b/src/components/SubTask/SubTaskComp.vue @@ -19,7 +19,7 @@ - diff --git a/src/components/SubTask/SubTaskList.vue b/src/components/SubTask/SubTaskList.vue index a4911b3..35e0b09 100644 --- a/src/components/SubTask/SubTaskList.vue +++ b/src/components/SubTask/SubTaskList.vue @@ -20,7 +20,7 @@ import Vue from 'vue'; import sm from '~/libs/storageManagement'; -const subTaskItem = { +const subTaskItem: SubTask = { description: 'Task', checked: false, }; @@ -59,7 +59,7 @@ export default Vue.extend({ addSubTask: (parentId: number) => { if (sm.get('tasks') === undefined) sm.add('tasks', []); - const localTasks: any[] = sm.get('tasks'); + const localTasks: Task[] = sm.get('tasks'); const parentTask = localTasks[parentId]; if (!parentTask.subTasks) parentTask.subTasks = []; diff --git a/src/components/Task/TaskComp.vue b/src/components/Task/TaskComp.vue index 84db6b1..b7a994f 100644 --- a/src/components/Task/TaskComp.vue +++ b/src/components/Task/TaskComp.vue @@ -91,7 +91,7 @@ export default Vue.extend({ const element = document.querySelector( `input#checkboxInput${this.id}` ) as HTMLInputElement; - const tasks = sm.get('tasks'); + const tasks: Task[] = sm.get('tasks'); tasks[this.id].checked = element?.checked; @@ -100,7 +100,7 @@ export default Vue.extend({ sm.set('tasks', tasks); }, deleteTask() { - const localTasks = sm.get('tasks'); + const localTasks: Task[] = sm.get('tasks'); localTasks.splice(this.id, 1); sm.set('tasks', localTasks); }, diff --git a/src/components/Task/TaskList.vue b/src/components/Task/TaskList.vue index f40ef80..2062c41 100644 --- a/src/components/Task/TaskList.vue +++ b/src/components/Task/TaskList.vue @@ -19,7 +19,7 @@ import Vue from 'vue'; import sm from '~/libs/storageManagement'; -const taskItem = { +const taskItem: Task = { title: 'Task 00', description: 'Task', checked: false, @@ -37,9 +37,9 @@ export default Vue.extend({ beforeCreate() { if (sm.get('tasks') === undefined) sm.add('tasks', []); - const localTasks = sm.get('tasks'); + const localTasks: Task[] = sm.get('tasks'); - for (const task of localTasks) task.newTask = undefined; + for (const task of localTasks) task.newTask = false; sm.set('tasks', localTasks); }, @@ -52,7 +52,7 @@ export default Vue.extend({ addTask: () => { if (sm.get('tasks') === undefined) sm.add('tasks', []); - const localTasks = sm.get('tasks'); + const localTasks: Task[] = sm.get('tasks'); taskItem.title = `Title Task ${localTasks.length}`; taskItem.description = `Description Task ${localTasks.length}`; diff --git a/src/libs/date.ts b/src/libs/date.ts index e6f4446..e2822fd 100644 --- a/src/libs/date.ts +++ b/src/libs/date.ts @@ -22,7 +22,7 @@ const date = { year: () => new Date().getFullYear(), - day: (): any => { + day: () => { return { readable: `${String(date.dayNumber()).padStart(2, '0')} ${date.monthName( Number(date.month()) @@ -49,7 +49,7 @@ const date = { timeZone: () => String(new Date().getTimezoneOffset()), - full: () => { + full: (): DateInfo => { return { day: date.day(), hour: date.hours(), diff --git a/src/libs/storageManagement.ts b/src/libs/storageManagement.ts index dcf0598..b37a657 100644 --- a/src/libs/storageManagement.ts +++ b/src/libs/storageManagement.ts @@ -13,7 +13,7 @@ const sm = { * @param {string} path New value's path on `data`; * @param {any} value New value; */ - add: (path: string, value: any) => { + add: (path: string, value: any): void => { let data = sm.getJSON().data; if (obj.getByString(data, `data.${path}`)) @@ -102,22 +102,22 @@ const sm = { * * **Used internally by the storage management.** */ - getJSON: (): any => { + getJSON: (): StorageSchema => { sm.checkJSON(); return JSON.parse(localStorage.getItem(storageIndex) + ''); }, /** * Sets a new `data` on the local storage JSON file *(also updates the `date.updated` meta-information)*. - * @param {object} newData New data object to be updated/set; + * @param {DataInfo | object} newData New data object to be updated/set; * @param {boolean} meta Do new data parameters contain `meta` information? * * **Used internally by the storage management.** */ - setJSON: (newData: object, meta?: boolean) => { + setJSON: (newData: DataInfo | object, meta?: boolean) => { if (meta) localStorage.setItem(storageIndex, JSON.stringify(newData)); else { - const newJSON = { meta: sm.getJSON().meta, data: newData }; + const newJSON: StorageSchema = { meta: sm.getJSON().meta, data: newData }; localStorage.setItem(storageIndex, JSON.stringify(newJSON)); @@ -125,7 +125,7 @@ const sm = { updatedMeta.date.updated = date.full(); - const updatedJSON = { + const updatedJSON: StorageSchema = { meta: updatedMeta, data: newData, }; @@ -169,9 +169,10 @@ const sm = { if (localStorage.getItem(storageIndex) && !reset) return window.alert('ERROR: Local storage already exists'); - const colorTheme = localStorage.getItem('nuxt-color-mode'); + const colorTheme: 'light' | 'dark' | string = + localStorage.getItem('nuxt-color-mode') || 'light'; - const storage = { + const storage: StorageSchema = { meta: { index: storageIndex, name: appInfo.name, diff --git a/src/types/Storage.d.ts b/src/types/Storage.d.ts new file mode 100644 index 0000000..c34b7c3 --- /dev/null +++ b/src/types/Storage.d.ts @@ -0,0 +1,37 @@ +type DateInfo = { + day: { + year: number; + month: number; + number: number; + readable: string; + }; + hour: { + hours: number; + minutes: number; + seconds: number; + milliseconds: number; + readable: string; + }; + timeZone: string | number; +}; + +type MetaInfo = { + index: string; + name: string; + theme: 'dark' | 'light' | string; + version: `${number}.${number}.${number}` | string; + date: { + created: DateInfo; + updated: DateInfo; + }; +}; + +type DataInfo = { + tasks?: Task[]; + [name: string | number]: any; +}; + +type StorageSchema = { + meta: MetaInfo; + data: DataInfo; +}; diff --git a/src/types/Tasks.d.ts b/src/types/Tasks.d.ts new file mode 100644 index 0000000..5ac20c1 --- /dev/null +++ b/src/types/Tasks.d.ts @@ -0,0 +1,13 @@ +type SubTask = { + description: string; + checked: boolean; +}; + +type Task = { + title: string; + description: string; + checked: boolean; + newTask: boolean; + autoCheck: boolean; + subTasks: SubTask[]; +}; diff --git a/tsconfig.json b/tsconfig.json index 078d120..910328b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "typeRoots": ["node_modules/@types", "./src/types"], "target": "ES2018", "module": "ESNext", "moduleResolution": "Node", From 3091f636777cf0ae393913fcfa3f1f725a2eea6a Mon Sep 17 00:00:00 2001 From: Guz <43732358+Guz013@users.noreply.github.com> Date: Sun, 30 Jan 2022 20:59:44 -0300 Subject: [PATCH 15/18] fix(subTaskState): subTask checking parent's state and not subTask's state --- src/components/SubTask/SubTaskComp.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/SubTask/SubTaskComp.vue b/src/components/SubTask/SubTaskComp.vue index 4877d85..168b4ce 100644 --- a/src/components/SubTask/SubTaskComp.vue +++ b/src/components/SubTask/SubTaskComp.vue @@ -2,7 +2,7 @@
  • Date: Mon, 31 Jan 2022 12:20:08 -0300 Subject: [PATCH 16/18] feat(progressBar): added progress bar Created a progress bar component `ProgressBar.vue` that independently tracks how many tasks and sub-tasks have been completed. --- package.json | 2 +- src/components/ProgressBar.vue | 114 +++++++++++++++++++++++++++++++ src/components/Task/TaskList.vue | 1 + 3 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 src/components/ProgressBar.vue diff --git a/package.json b/package.json index 13b8f65..2328d46 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ToToday", - "version": "0.5.0", + "version": "0.6.0", "private": true, "scripts": { "dev": "nuxt", diff --git a/src/components/ProgressBar.vue b/src/components/ProgressBar.vue new file mode 100644 index 0000000..c1bf5e7 --- /dev/null +++ b/src/components/ProgressBar.vue @@ -0,0 +1,114 @@ + + + + + diff --git a/src/components/Task/TaskList.vue b/src/components/Task/TaskList.vue index 2062c41..74b24f4 100644 --- a/src/components/Task/TaskList.vue +++ b/src/components/Task/TaskList.vue @@ -11,6 +11,7 @@ :checked="task.checked" /> +
    From e522c42a8d089f0bb92136f7b700cef9c4ca23ce Mon Sep 17 00:00:00 2001 From: Guz <43732358+Guz013@users.noreply.github.com> Date: Mon, 31 Jan 2022 17:42:32 -0300 Subject: [PATCH 17/18] fix(cursorTaskComp): checkbox now sets the cursor to pointer --- src/components/Task/TaskComp.vue | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/Task/TaskComp.vue b/src/components/Task/TaskComp.vue index b7a994f..d3bad5f 100644 --- a/src/components/Task/TaskComp.vue +++ b/src/components/Task/TaskComp.vue @@ -213,6 +213,8 @@ export default Vue.extend({ padding: 1%; padding-right: 2%; + cursor: pointer; + input { display: none; } From 35c85fd3dea2649e0e33e6451a72d7f4c847ccb5 Mon Sep 17 00:00:00 2001 From: Guz <43732358+Guz013@users.noreply.github.com> Date: Tue, 1 Feb 2022 11:44:04 -0300 Subject: [PATCH 18/18] feat(inputs): Created inputs to the user create custom tasks. Created inputs for task and sub-tasks (`Task/TaskInput.vue`, `SubTask/SubTaskInput.vue`), enabling the creation of custom tasks and sub-tasks; Removed debug buttons. --- package.json | 2 +- src/components/SubTask/SubTaskComp.vue | 2 +- src/components/SubTask/SubTaskInput.vue | 171 ++++++++++++ src/components/SubTask/SubTaskList.vue | 24 +- src/components/Task/TaskComp.vue | 2 + src/components/Task/TaskInput.vue | 329 ++++++++++++++++++++++++ src/components/Task/TaskList.vue | 23 -- src/components/icon/Add.vue | 30 +++ src/pages/index.vue | 1 + src/static/icons/add-icon.svg | 4 + 10 files changed, 540 insertions(+), 48 deletions(-) create mode 100644 src/components/SubTask/SubTaskInput.vue create mode 100644 src/components/Task/TaskInput.vue create mode 100644 src/components/icon/Add.vue create mode 100644 src/static/icons/add-icon.svg diff --git a/package.json b/package.json index 2328d46..1537400 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ToToday", - "version": "0.6.0", + "version": "0.7.0", "private": true, "scripts": { "dev": "nuxt", diff --git a/src/components/SubTask/SubTaskComp.vue b/src/components/SubTask/SubTaskComp.vue index 168b4ce..fa6c08f 100644 --- a/src/components/SubTask/SubTaskComp.vue +++ b/src/components/SubTask/SubTaskComp.vue @@ -95,7 +95,6 @@ export default Vue.extend({ background-color: transparent; } - font: inherit; width: 20px; height: 20px; border: 5px solid currentColor; @@ -107,6 +106,7 @@ export default Vue.extend({ } .description { + font-family: $secondary-font; margin: 1px 0; } } diff --git a/src/components/SubTask/SubTaskInput.vue b/src/components/SubTask/SubTaskInput.vue new file mode 100644 index 0000000..09d2834 --- /dev/null +++ b/src/components/SubTask/SubTaskInput.vue @@ -0,0 +1,171 @@ + + + + + diff --git a/src/components/SubTask/SubTaskList.vue b/src/components/SubTask/SubTaskList.vue index 35e0b09..2483f2d 100644 --- a/src/components/SubTask/SubTaskList.vue +++ b/src/components/SubTask/SubTaskList.vue @@ -11,7 +11,7 @@ :checked="subTask.checked" /> - + @@ -20,11 +20,6 @@ import Vue from 'vue'; import sm from '~/libs/storageManagement'; -const subTaskItem: SubTask = { - description: 'Task', - checked: false, -}; - export default Vue.extend({ name: 'SubTasks', props: { @@ -55,23 +50,6 @@ export default Vue.extend({ this.preventAnim = false; }, 1000); }, - methods: { - addSubTask: (parentId: number) => { - if (sm.get('tasks') === undefined) sm.add('tasks', []); - - const localTasks: Task[] = sm.get('tasks'); - const parentTask = localTasks[parentId]; - - if (!parentTask.subTasks) parentTask.subTasks = []; - - subTaskItem.description = `Description sub task ${parentTask.subTasks.length}`; - - parentTask.subTasks.push(subTaskItem); - localTasks[parentId] = parentTask; - - sm.set('tasks', localTasks); - }, - }, }); diff --git a/src/components/Task/TaskComp.vue b/src/components/Task/TaskComp.vue index d3bad5f..ab980c6 100644 --- a/src/components/Task/TaskComp.vue +++ b/src/components/Task/TaskComp.vue @@ -337,6 +337,7 @@ export default Vue.extend({ .info { display: inline-block; + text-overflow: ellipsis; h1 { font-size: 1.2em; @@ -347,6 +348,7 @@ export default Vue.extend({ font-family: $secondary-font; font-size: 0.8em; margin: 0; + white-space: pre-wrap; } } } diff --git a/src/components/Task/TaskInput.vue b/src/components/Task/TaskInput.vue new file mode 100644 index 0000000..7385567 --- /dev/null +++ b/src/components/Task/TaskInput.vue @@ -0,0 +1,329 @@ + + + + + diff --git a/src/components/Task/TaskList.vue b/src/components/Task/TaskList.vue index 74b24f4..1fcf4be 100644 --- a/src/components/Task/TaskList.vue +++ b/src/components/Task/TaskList.vue @@ -12,7 +12,6 @@ /> - @@ -20,15 +19,6 @@ import Vue from 'vue'; import sm from '~/libs/storageManagement'; -const taskItem: Task = { - title: 'Task 00', - description: 'Task', - checked: false, - newTask: true, - autoCheck: true, - subTasks: [], -}; - export default Vue.extend({ data() { return { @@ -49,19 +39,6 @@ export default Vue.extend({ this.list = sm.get('tasks') ? sm.get('tasks') : []; }); }, - methods: { - addTask: () => { - if (sm.get('tasks') === undefined) sm.add('tasks', []); - - const localTasks: Task[] = sm.get('tasks'); - taskItem.title = `Title Task ${localTasks.length}`; - taskItem.description = `Description Task ${localTasks.length}`; - - localTasks.push(taskItem); - - sm.set('tasks', localTasks); - }, - }, }); diff --git a/src/components/icon/Add.vue b/src/components/icon/Add.vue new file mode 100644 index 0000000..9ed70b7 --- /dev/null +++ b/src/components/icon/Add.vue @@ -0,0 +1,30 @@ + + + diff --git a/src/pages/index.vue b/src/pages/index.vue index 5b303a4..26db289 100644 --- a/src/pages/index.vue +++ b/src/pages/index.vue @@ -7,6 +7,7 @@
    +
    diff --git a/src/static/icons/add-icon.svg b/src/static/icons/add-icon.svg new file mode 100644 index 0000000..6256914 --- /dev/null +++ b/src/static/icons/add-icon.svg @@ -0,0 +1,4 @@ + + + +