diff --git a/README.md b/README.md index 897a852c..2c3473c4 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,7 @@ You can find binaries for Windows, MacOS and Linux on the - + https://github.com/ransome1/sleek diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 68f91299..d813fbea 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,6 +1,6 @@ name: sleek base: core18 -version: '0.8.3' +version: '0.8.4' summary: A todo app based on todo.txt, free and open-source description: | sleek offers a clean and simple interface that can be used with mouse and keyboard, keyboard only or touch devices. You will use an easy to understand but powerful syntax to create todos. According to the concept of todo.txt you can add contexts to your todos or assign them to projects you're working on. Priorities can be set and if you add due dates sleek will send you notifications just in time. diff --git a/src/css/style.css b/src/css/style.css index 5915d459..0405ed25 100644 --- a/src/css/style.css +++ b/src/css/style.css @@ -779,7 +779,8 @@ nav { #recurrencePicker .card .content #recurrencePickerDecrease, #recurrencePicker .card .content #recurrencePickerIncrease, #recurrencePicker .card .content #recurrencePickerSpinner { - font-size: 1.25em; } + font-size: 1.25em; + padding: .5em; } #recurrencePicker .card .content #recurrencePickerSpinner { width: 2em; } #recurrencePicker .card label { diff --git a/src/index.html b/src/index.html index fcb0f35c..c636d76d 100644 --- a/src/index.html +++ b/src/index.html @@ -96,10 +96,6 @@

- - diff --git a/src/render.js b/src/render.js index 028aca9e..007c5cc2 100644 --- a/src/render.js +++ b/src/render.js @@ -210,14 +210,14 @@ dueDatePickerInput.addEventListener('changeDate', function (e, details) { // we only update the object if there is a date selected. In case of a refresh it would throw an error otherwise if(e.detail.date) { // generate the object on what is written into input, so we don't overwrite previous inputs of user - item.currentTemp = new TodoTxtItem(modalFormInput.value, [ new DueExtension(), new RecExtension() ]); - item.currentTemp.due = new Date(e.detail.date); - item.currentTemp.dueString = new Date(e.detail.date.getTime() - (e.detail.date.getTimezoneOffset() * 60000 )).toISOString().split("T")[0]; - modalFormInput.value = item.currentTemp.toString(); + let todo = new TodoTxtItem(modalFormInput.value, [ new DueExtension(), new RecExtension() ]); + todo.due = new Date(e.detail.date); + todo.dueString = new Date(e.detail.date.getTime() - (e.detail.date.getTimezoneOffset() * 60000 )).toISOString().split("T")[0]; + modalFormInput.value = todo.toString(); // adjust size of inut dueDatePickerInput.setAttribute("size", dueDatePickerInput.value.length); // clean up as we don#t need it anymore - item.currentTemp = null; + todo = null; // if suggestion box was open, it needs to be closed suggestionContainer.classList.remove("is-active"); suggestionContainer.blur(); @@ -509,10 +509,6 @@ modalFormInputResize.onclick = function () { modalFormInput.onfocus = function () { suggestionContainer.classList.remove("is-active"); }; -modalFormInput.onblur = function () { - //console.log(suggestionContainer.hasFocus()); - //suggestionContainer.classList.remove("is-active"); -}; modalBackground.forEach(function(el) { el.onclick = function() { clearModal(); @@ -842,7 +838,7 @@ function parseDataFromFile() { // TODO: Reuse these later items.complete = items.objects.filter(function(item) { return item.complete === true }); items.incomplete = items.objects.filter(function(item) { return item.complete === false }); - // remove empty objects liek from empty lines in file + // remove empty objects like from empty lines in file items.objects = items.objects.filter(function(item) { return item.toString() != "" }); if(items.objects.length>0) { // if settings modal is open and archiving has been completed (will trigger this function) the buttons needs to be disabled until another completed todo is added @@ -1458,8 +1454,6 @@ function generateTodoData(searchString) { noResultContainer.classList.add("is-active"); return Promise.resolve("Info: No results to search input or filter selection"); } - // sort items according to todo.txt logic - sortItems(items.objectsFiltered); // produce an object where priority a to z + null is key items.objectsFiltered = items.objectsFiltered.reduce((r, a) => { r[a.priority] = [...r[a.priority] || [], a]; @@ -1472,6 +1466,15 @@ function generateTodoData(searchString) { // nodes need to be created to add them to the outer fragment // this creates a divider row for the priorities if(items.objectsFiltered[priority][0]!="null") tableContainerContent.appendChild(document.createRange().createContextualFragment("
" + items.objectsFiltered[priority][0] + "
")) + // sort items according to todo.txt logic + // second start dates + items.objectsFiltered[priority][1].sort(function(a, b) { + return b.date - a.date; + }); + // first due dates + items.objectsFiltered[priority][1].sort(function(a, b) { + return a.due - b.due; + }); // TODO: that's ugly, refine this for (let item in items.objectsFiltered[priority][1]) { let todo = items.objectsFiltered[priority][1][item]; @@ -2004,13 +2007,6 @@ function showForm(todo, templated) { console.log(error); } } -function sortItems(items) { - // first step of sorting items: the youngest to the top - items.sort((a, b) => b.date - a.date); - // array is sorted so the due date is desc - items.sort((a, b) => a.due - b.due); - return; -} function showResultStats() { // we show some information on filters if any are set if(items.objectsFiltered.length!=items.objects.length) { diff --git a/src/scss/style.scss b/src/scss/style.scss index f2dbe3e6..a7fd4598 100644 --- a/src/scss/style.scss +++ b/src/scss/style.scss @@ -961,6 +961,7 @@ nav { #recurrencePickerIncrease, #recurrencePickerSpinner { font-size: 1.25em; + padding: .5em; } #recurrencePickerSpinner { width: 2em;