Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Update On Elapsed on listpage #115

Merged
merged 86 commits into from
Dec 28, 2022
Merged
Changes from 3 commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
3924663
remove unnecessary await from displayCountdowns()
RDjarbeng Dec 22, 2022
9b75d6e
add list refresh after cd elapses
RDjarbeng Dec 22, 2022
42d872d
remove .then from displayAndStartCount use normal try catch
RDjarbeng Dec 22, 2022
ff50db8
Move listpage element ids to different file
RDjarbeng Dec 25, 2022
2c7f8cc
move listpage sorting to different file
RDjarbeng Dec 25, 2022
b4edcbe
move listpage ui functions to another folder
RDjarbeng Dec 25, 2022
3b89014
move listpage ui functions to another folder
RDjarbeng Dec 25, 2022
e420432
move listpage ui functions to another folder
RDjarbeng Dec 25, 2022
b72ca77
move sort and ui functions to different folder
RDjarbeng Dec 25, 2022
cd95d0f
correct path from trigger context menu
RDjarbeng Dec 25, 2022
321cc1a
clock ui functions, update imports
RDjarbeng Dec 25, 2022
c14cc76
clock ui functions, update imports
RDjarbeng Dec 25, 2022
74ca86d
update imports after moving list functions
RDjarbeng Dec 25, 2022
20681ff
update imports after moving list functions
RDjarbeng Dec 25, 2022
f5ffa7f
remove unnecessary await
RDjarbeng Dec 25, 2022
d01c785
rename displayAndStart() to displayAndUpdatecount
RDjarbeng Dec 25, 2022
40fa1ae
move button getters from form update
RDjarbeng Dec 25, 2022
713268a
move handleFormUpdate() to formUpdate.js, update imports
RDjarbeng Dec 25, 2022
ad80460
update comments
RDjarbeng Dec 25, 2022
fcff0c6
move listpage event listener to different file, export delete functio…
RDjarbeng Dec 25, 2022
7cbdd59
format listevent listener
RDjarbeng Dec 26, 2022
7471372
update imports use new update local item
RDjarbeng Dec 26, 2022
cb03ff4
use update local item to update state of the countdowns
RDjarbeng Dec 26, 2022
f48894c
move fetchArrayOfCountdowns to different file
RDjarbeng Dec 26, 2022
b7ac132
move fetchArrayOfCountdowns to different file
RDjarbeng Dec 26, 2022
c339507
add base path to vite preview
RDjarbeng Dec 26, 2022
7dec8f8
move fetchArrayOfCountdowns() to different file
RDjarbeng Dec 26, 2022
9d53079
Merge branch 'fixUpdateOnElapse' of https://github.com/RDjarbeng/coun…
RDjarbeng Dec 26, 2022
2fcdddd
move isTargetElementOnCountdownItem() to different file
RDjarbeng Dec 26, 2022
3e536cc
update params for isClassOnTargetElement()
RDjarbeng Dec 26, 2022
2d295f3
move isTargetElementOnContextMenu and isClassOnTargetElement to list…
RDjarbeng Dec 26, 2022
b5be2d7
move setMainClockCountdown to listeventlistener
RDjarbeng Dec 26, 2022
20b4f1b
Rename Listpage...IDS to listpage....Classes
RDjarbeng Dec 26, 2022
a36efaf
update imports after function move
RDjarbeng Dec 26, 2022
3e72f84
Move sortTitleEventHandler to different file
RDjarbeng Dec 26, 2022
6d35d68
Create separate file for listEventHandlers
RDjarbeng Dec 26, 2022
497d510
remove unused async await
RDjarbeng Dec 26, 2022
592cb15
move sort functions to sort.js
RDjarbeng Dec 26, 2022
5cde586
add listeners for sort to html imports
RDjarbeng Dec 26, 2022
5246420
remove displayandAddListeners from listfunctions
RDjarbeng Dec 26, 2022
18955b0
remove addSortUI and listeners
RDjarbeng Dec 26, 2022
5cfb8df
fix imports
RDjarbeng Dec 26, 2022
e8d6672
Implement conditional rendering of sortUI
RDjarbeng Dec 26, 2022
4bfb0e4
remove unused imports
RDjarbeng Dec 26, 2022
328bb05
add strings for css selectors to separate file
RDjarbeng Dec 27, 2022
c82b143
Merge remote-tracking branch 'origin/vitePWA' into fixUpdateOnElapse
RDjarbeng Dec 27, 2022
988da10
move setcountdown status to different file
RDjarbeng Dec 27, 2022
6c1e799
stop loading listpage from within formupdate.js
RDjarbeng Dec 27, 2022
c43a739
Add getArrayOfCountdownStatus for other functions to use to interface
RDjarbeng Dec 27, 2022
d79043a
add listener function to refresh page after form submit
RDjarbeng Dec 27, 2022
b6299ff
add check for null for arrayofCountdowns first
RDjarbeng Dec 27, 2022
36458e9
use new array status function
RDjarbeng Dec 27, 2022
c6f10c8
remove export of fetchArrayOfCountdowns method
RDjarbeng Dec 27, 2022
54ccc89
move fetchArrayOfCountdowns to listfunctions
RDjarbeng Dec 27, 2022
8b5dc6f
delete fetch array of countdowns file
RDjarbeng Dec 27, 2022
bc43544
update imports for fetchArrayOfCountdowns and getCountdownString
RDjarbeng Dec 27, 2022
fc28b49
update imports remove fetchArrayOfCountdowns
RDjarbeng Dec 27, 2022
68ffff4
update imports
RDjarbeng Dec 27, 2022
296c676
set delete to refresh page
RDjarbeng Dec 27, 2022
77c19f1
resolve error due to variable name
RDjarbeng Dec 27, 2022
3ab15a9
correct var name
RDjarbeng Dec 27, 2022
f1d112c
comment out unused function
RDjarbeng Dec 27, 2022
21bc4c3
addEvent handlers and sortui to reregister on form submission
RDjarbeng Dec 27, 2022
0d16b6d
update imports
RDjarbeng Dec 27, 2022
3a32f68
change getArrayOfCountdownStatus to always fetch from storage
RDjarbeng Dec 27, 2022
d8a1b24
add remove sortUI function
RDjarbeng Dec 27, 2022
6f830d5
add todo
RDjarbeng Dec 27, 2022
2def88d
remove listEventListener import
RDjarbeng Dec 27, 2022
e479eb3
use addSortUI instead, without duplicate listeners
RDjarbeng Dec 27, 2022
a7ef2e2
move getArrayOfCountdownStatus into event listener
RDjarbeng Dec 27, 2022
6c6fdfd
add remove sortUI function
RDjarbeng Dec 27, 2022
9eec631
import and use remove sortUI function
RDjarbeng Dec 27, 2022
589195b
add comments
RDjarbeng Dec 28, 2022
9925b77
let countdown function call getdistance()
RDjarbeng Dec 28, 2022
26c8d1c
add getLocalIsoString function to always use user timezone
RDjarbeng Dec 28, 2022
c48fec6
rename function to getLocalIsoStringFromDateInput
RDjarbeng Dec 28, 2022
1013535
use getLocalIsoStringFromDateInput instead of toISOString
RDjarbeng Dec 28, 2022
6c57f4f
change time refresh interval to 500ms
RDjarbeng Dec 28, 2022
f7a8d2d
move updateCountdownItemFromForm()
RDjarbeng Dec 28, 2022
b765743
move updateCountdownItemFromForm()
RDjarbeng Dec 28, 2022
0b7379a
add small todo about toISOString()
RDjarbeng Dec 28, 2022
2f08467
move handleHomePageFormSubmission
RDjarbeng Dec 28, 2022
93dea93
set update to use updateArrayOfCountdownState, move handleHomePageFor…
RDjarbeng Dec 28, 2022
f093716
update imports
RDjarbeng Dec 28, 2022
a5aa9b5
remove unused console.log
RDjarbeng Dec 28, 2022
5b7c82a
replay toISOstring in updateRepeatCountdown for new function getLocal…
RDjarbeng Dec 28, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions js/listFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,12 +359,12 @@ export const addSortEventListeners = () => {
addClickListenersWithoutDuplicates(sortOpts, sortOptionsEventHandler)
}

export async function displayCountdowns() {
let arrayOfCountdowns = await fetchArrayOfCountdowns();
export function displayCountdowns() {
let arrayOfCountdowns = fetchArrayOfCountdowns();

if (arrayOfCountdowns && arrayOfCountdowns.length) {

let listItems = await populateList(arrayOfCountdowns)
let listItems = populateList(arrayOfCountdowns)

setInnerHtmlForNotNull(countdownList, listItems)
setInnerHtmlForNotNull(countdownTextDisplay, '')
Expand Down Expand Up @@ -543,15 +543,18 @@ export function updateCountdownItemFromForm(){
* display countdowns and start updating display for countdowns in progress
*/
export function displayAndStartcount() {
displayCountdowns().then(() => {
if (getCountItemExists()) {
let interval = setInterval(() => getCountItemExists() ? updateCountdownItems() : clearInterval(interval), 1000)
}
}).catch((err) => {
console.log(err);
errorHandler('Unable to display your countdowns');
});
}
try{

displayCountdowns()
if (getCountItemExists()) {
let interval = setInterval(() => getCountItemExists() ? updateCountdownItems() : clearInterval(interval), 1000)
}
}catch(err) {
console.log(err);
errorHandler('Unable to display your countdowns');
};
}


/**
* update countdown status for non elapsed countdowns
Expand Down Expand Up @@ -580,7 +583,10 @@ export function updateCountdownItemFromForm(){
} else {
console.log('elapsing', arrayOfCountdowns.find((countdown) => countdown.dateModified == element.getAttribute('data-id')));
element.classList.remove('countdown-counting')
setInnerHtmlForNotNull(element, 'Elapsed')
setInnerHtmlForNotNull(element, 'Elapsed');
//update bottom part of countdown
displayAndStartcount();

}

});
Expand Down