groups: Add browserId to local state

This commit is contained in:
Patrick O'Sullivan 2022-03-25 14:26:18 -05:00
parent 66451c9089
commit 0a5cd0041d

View File

@ -11,6 +11,7 @@ import { clearStorageMigration, createStorageKey, storageVersion, wait } from '~
export type SubscriptionStatus = 'connected' | 'disconnected' | 'reconnecting';
export interface LocalState {
browserId: string;
theme: 'light' | 'dark' | 'auto';
hideAvatars: boolean;
hideNicknames: boolean;
@ -42,6 +43,7 @@ export const selectLocalState =
<K extends keyof LocalState>(keys: K[]) => f.pick<LocalState, K>(keys);
const useLocalState = create<LocalStateZus>(persist((set, get) => ({
browserId: '',
dark: false,
mobile: false,
breaks: {
@ -131,4 +133,9 @@ export function useOsDark() {
return useLocalState(selOsDark);
}
const selBrowserId = (s: LocalState) => s.browserId;
export function useBrowserId() {
return useLocalState(selBrowserId);
}
export { useLocalState as default, withLocalState };