/
githubmirror
/
client
Обзор
Документация
Войти
/
githubmirror
/
client
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
shared/stores/modal-header.tsx
40 строк
926 B
chrisnojima
less zust (#29314)
15 июн 2026, 16:55
Не верифицирован
15 июн 2026, 16:55
baeefd1
Код
Авторство
О чём код?
import * as Z from '@/util/zustand' // Bridges action-button/title state between a mounted modal screen body and // its navigation header (headerRight/headerTitle render outside the screen's // component tree, so React context can't span the two). type Store = { actionEnabled: boolean actionWaiting: boolean botInTeam: boolean botReadOnly: boolean botSubScreen: '' | 'install' | 'channels' onAction: (() => void) | undefined title: string } const initialStore: Store = { actionEnabled: false, actionWaiting: false, botInTeam: false, botReadOnly: false, botSubScreen: '', onAction: undefined, title: '', } export type State = Store & { dispatch: { resetState: () => void } } export const useModalHeaderState = Z.createZustand<State>('modal-header', () => { const dispatch: State['dispatch'] = { resetState: Z.defaultReset, } return { ...initialStore, dispatch, } })