-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
prize wall: faster interval, fix background, update text, public anno…
…uncement
- Loading branch information
Showing
15 changed files
with
137 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
libs/ui/pages/prizes/src/lib/hooks/use-time-to-interval.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { useInterval } from '@worksheets/ui-core'; | ||
import { PRIZE_WALL_INTERVAL } from '@worksheets/util/settings'; | ||
import { | ||
durationToString, | ||
getNextIntervalAligned, | ||
millisecondsAsDuration, | ||
printShortDateTime, | ||
timeUntil, | ||
} from '@worksheets/util/time'; | ||
import { useEffect, useState } from 'react'; | ||
|
||
export const useNextPrizeWallInterval = () => { | ||
const [timeRemaining, setTimeRemaining] = useState<number>(0); | ||
|
||
useEffect(() => { | ||
const next = getNextIntervalAligned(PRIZE_WALL_INTERVAL); | ||
setTimeRemaining(timeUntil(next.getTime())); | ||
}, []); | ||
|
||
useInterval(() => { | ||
const next = getNextIntervalAligned(PRIZE_WALL_INTERVAL); | ||
setTimeRemaining(timeUntil(next.getTime())); | ||
}, 1000); | ||
|
||
const string = durationToString(millisecondsAsDuration(timeRemaining)); | ||
|
||
return { | ||
string, | ||
number: timeRemaining, | ||
utc: printShortDateTime(new Date(Date.now() + timeRemaining)), | ||
}; | ||
}; |
25 changes: 0 additions & 25 deletions
25
libs/ui/pages/prizes/src/lib/hooks/use-time-to-midnight.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters