Persist selected QR code color theme in invite friends dialog (#10892)

This commit is contained in:
Spence Pope
2026-06-16 20:07:50 -04:00
committed by GitHub
parent 9825057bef
commit f92712f34d
3 changed files with 22 additions and 2 deletions
@@ -0,0 +1,14 @@
import {device, useStorage} from '#/storage'
import {INVITE_THEMES, type InviteThemeKey} from '../themes'
/**
* Persisted color theme for the Invite Friends QR card (APP-2409). Falls back
* to 'day' when nothing is stored or the stored key is no longer a valid
* theme.
*/
export function useInviteThemeKey() {
const [stored, setThemeKey] = useStorage(device, ['inviteFriendsThemeKey'])
const themeKey: InviteThemeKey =
stored && stored in INVITE_THEMES ? stored : 'day'
return [themeKey, setThemeKey] as const
}