Dev helpers, string cleanup

zio/dev^2
Eric Bailey 2024-09-11 21:47:25 -05:00
parent c8b133863d
commit 6e78ce53d7
4 changed files with 27 additions and 8 deletions

View File

@ -430,7 +430,6 @@ export function TenMillionInner({userNumber}: {userNumber: number}) {
style={[ style={[
a.text_sm, a.text_sm,
a.font_semibold, a.font_semibold,
,
a.leading_tight, a.leading_tight,
lightTheme.atoms.text_contrast_low, lightTheme.atoms.text_contrast_low,
]}> ]}>
@ -533,13 +532,13 @@ export function TenMillionInner({userNumber}: {userNumber: number}) {
fontWeight: '900', fontWeight: '900',
}, },
]}> ]}>
Thanks for being an early part of Bluesky. <Trans>You're part of the next wave of the internet.</Trans>
</Text> </Text>
<Text style={[a.leading_snug, a.text_lg, a.pb_xl]}> <Text style={[a.leading_snug, a.text_lg, a.pb_xl]}>
<Trans> <Trans>
We're rebuilding the social internet together. Congratulations, Thanks for being part of our first 10 million users. We're glad
we're glad you're here. you're here.
</Trans>{' '} </Trans>{' '}
</Text> </Text>
@ -554,7 +553,7 @@ export function TenMillionInner({userNumber}: {userNumber: number}) {
a.pt_xl, a.pt_xl,
]}> ]}>
<Text style={[a.text_md, a.italic, t.atoms.text_contrast_medium]}> <Text style={[a.text_md, a.italic, t.atoms.text_contrast_medium]}>
Brag a little! <Trans>Brag a little!</Trans>
</Text> </Text>
<Button <Button

View File

@ -1,9 +1,15 @@
import React from 'react' import React from 'react'
import {Nux, useNuxs, useUpsertNuxMutation} from '#/state/queries/nuxs' import {
Nux,
useNuxs,
useRemoveNuxsMutation,
useUpsertNuxMutation,
} from '#/state/queries/nuxs'
import {useSession} from '#/state/session' import {useSession} from '#/state/session'
import {isSnoozed, snooze} from '#/components/dialogs/nuxs/snoozing' import {isSnoozed, snooze, unsnooze} from '#/components/dialogs/nuxs/snoozing'
import {TenMillion} from '#/components/dialogs/nuxs/TenMillion' import {TenMillion} from '#/components/dialogs/nuxs/TenMillion'
import {IS_DEV} from '#/env'
type Context = { type Context = {
activeNux: Nux | undefined activeNux: Nux | undefined
@ -33,6 +39,7 @@ function Inner() {
}) })
const [activeNux, setActiveNux] = React.useState<Nux | undefined>() const [activeNux, setActiveNux] = React.useState<Nux | undefined>()
const {mutate: upsertNux} = useUpsertNuxMutation() const {mutate: upsertNux} = useUpsertNuxMutation()
const {mutate: removeNuxs} = useRemoveNuxsMutation()
const snoozeNuxDialog = React.useCallback(() => { const snoozeNuxDialog = React.useCallback(() => {
snooze() snooze()
@ -51,6 +58,15 @@ function Inner() {
}) })
}, [activeNux, setActiveNux, upsertNux, nuxs]) }, [activeNux, setActiveNux, upsertNux, nuxs])
if (IS_DEV && typeof window !== 'undefined') {
// @ts-ignore
window.clearNuxDialog = (id: Nux) => {
if (!IS_DEV || !id) return
removeNuxs([id])
unsnooze()
}
}
React.useEffect(() => { React.useEffect(() => {
if (snoozed) return if (snoozed) return
if (!nuxs) return if (!nuxs) return

View File

@ -5,6 +5,10 @@ export function snooze() {
device.set(['lastNuxDialog'], new Date().toISOString()) device.set(['lastNuxDialog'], new Date().toISOString())
} }
export function unsnooze() {
device.set(['lastNuxDialog'], undefined)
}
export function isSnoozed() { export function isSnoozed() {
const lastNuxDialog = device.get(['lastNuxDialog']) const lastNuxDialog = device.get(['lastNuxDialog'])
if (!lastNuxDialog) return false if (!lastNuxDialog) return false

View File

@ -2,5 +2,5 @@
* Device data that's specific to the device and does not vary based account * Device data that's specific to the device and does not vary based account
*/ */
export type Device = { export type Device = {
lastNuxDialog: string lastNuxDialog: string | undefined
} }