Conversation Colors
This commit is contained in:
parent
b63d8e908c
commit
28f016ce48
128 changed files with 3997 additions and 1207 deletions
50
ts/state/ducks/globalModals.ts
Normal file
50
ts/state/ducks/globalModals.ts
Normal file
|
@ -0,0 +1,50 @@
|
|||
// Copyright 2021 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
// State
|
||||
|
||||
export type GlobalModalsStateType = {
|
||||
readonly isChatColorEditorVisible: boolean;
|
||||
};
|
||||
|
||||
// Actions
|
||||
|
||||
const TOGGLE_CHAT_COLOR_EDITOR = 'globalModals/TOGGLE_CHAT_COLOR_EDITOR';
|
||||
|
||||
type ToggleChatColorEditorActionType = {
|
||||
type: typeof TOGGLE_CHAT_COLOR_EDITOR;
|
||||
};
|
||||
|
||||
export type GlobalModalsActionType = ToggleChatColorEditorActionType;
|
||||
|
||||
// Action Creators
|
||||
|
||||
export const actions = {
|
||||
toggleChatColorEditor,
|
||||
};
|
||||
|
||||
function toggleChatColorEditor(): ToggleChatColorEditorActionType {
|
||||
return { type: TOGGLE_CHAT_COLOR_EDITOR };
|
||||
}
|
||||
|
||||
// Reducer
|
||||
|
||||
export function getEmptyState(): GlobalModalsStateType {
|
||||
return {
|
||||
isChatColorEditorVisible: false,
|
||||
};
|
||||
}
|
||||
|
||||
export function reducer(
|
||||
state: Readonly<GlobalModalsStateType> = getEmptyState(),
|
||||
action: Readonly<GlobalModalsActionType>
|
||||
): GlobalModalsStateType {
|
||||
if (action.type === TOGGLE_CHAT_COLOR_EDITOR) {
|
||||
return {
|
||||
...state,
|
||||
isChatColorEditorVisible: !state.isChatColorEditorVisible,
|
||||
};
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue