Ensure dialog shows for all accounts without snoozing

zio/dev^2
Eric Bailey 2024-09-12 13:45:06 -05:00
parent 46402fd010
commit bd79ce7ea0
1 changed files with 18 additions and 3 deletions

View File

@ -20,12 +20,18 @@ type Context = {
const queuedNuxs: { const queuedNuxs: {
id: Nux id: Nux
enabled(props: {gate: ReturnType<typeof useGate>}): boolean enabled(props: {gate: ReturnType<typeof useGate>}): boolean
/**
* TEMP only intended for use with the 10Milly dialog rn, since there are no
* other NUX dialogs configured
*/
unsafe_disableSnooze: boolean
}[] = [ }[] = [
{ {
id: Nux.TenMillionDialog, id: Nux.TenMillionDialog,
enabled({gate}) { enabled({gate}) {
return gate('ten_million_dialog') return gate('ten_million_dialog')
}, },
unsafe_disableSnooze: true,
}, },
] ]
@ -76,18 +82,27 @@ function Inner() {
if (snoozed) return if (snoozed) return
if (!nuxs) return if (!nuxs) return
for (const {id, enabled} of queuedNuxs) { for (const {id, enabled, unsafe_disableSnooze} of queuedNuxs) {
const nux = nuxs.find(nux => nux.id === id) const nux = nuxs.find(nux => nux.id === id)
// check if completed first // check if completed first
if (nux && nux.completed) continue if (nux && nux.completed) continue
// then check gate (track exposure) // then check gate (track exposure)
if (!enabled({gate})) continue if (!enabled({gate})) continue
// we have a winner // we have a winner
setActiveNux(id) setActiveNux(id)
// immediately snooze (in memory)
snoozeNuxDialog() /**
* TEMP only intended for use with the 10Milly dialog rn, since there are no
* other NUX dialogs configured
*/
if (!unsafe_disableSnooze) {
// immediately snooze (in memory)
snoozeNuxDialog()
}
// immediately update remote data (affects next reload) // immediately update remote data (affects next reload)
upsertNux({ upsertNux({
id, id,