"Fossies" - the Fresh Open Source Software Archive 
Member "jitsi-meet-7305/react/features/base/dialog/reducer.ts" (26 May 2023, 1636 Bytes) of package /linux/misc/jitsi-meet-7305.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) TypeScript source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
See also the last
Fossies "Diffs" side-by-side code changes report for "reducer.ts":
jitsi-meet_8319_vs_jitsi-meet_8615.
1 import { ComponentType } from 'react';
2
3 import ReducerRegistry from '../redux/ReducerRegistry';
4 import { assign } from '../redux/functions';
5
6 import {
7 HIDE_DIALOG,
8 HIDE_SHEET,
9 OPEN_DIALOG,
10 OPEN_SHEET
11 } from './actionTypes';
12
13 export interface IDialogState {
14 component?: ComponentType;
15 componentProps?: Object;
16 sheet?: ComponentType;
17 sheetProps?: Object;
18 }
19
20 /**
21 * Reduces redux actions which show or hide dialogs.
22 *
23 * @param {IDialogState} state - The current redux state.
24 * @param {Action} action - The redux action to reduce.
25 * @param {string} action.type - The type of the redux action to reduce..
26 * @returns {State} The next redux state that is the result of reducing the
27 * specified action.
28 */
29 ReducerRegistry.register<IDialogState>('features/base/dialog', (state = {}, action): IDialogState => {
30 switch (action.type) {
31 case HIDE_DIALOG: {
32 const { component } = action;
33
34 if (typeof component === 'undefined' || state.component === component) {
35 return assign(state, {
36 component: undefined,
37 componentProps: undefined
38 });
39 }
40 break;
41 }
42
43 case OPEN_DIALOG:
44 return assign(state, {
45 component: action.component,
46 componentProps: action.componentProps
47 });
48
49 case HIDE_SHEET:
50 return assign(state, {
51 sheet: undefined,
52 sheetProps: undefined
53 });
54
55 case OPEN_SHEET:
56 return assign(state, {
57 sheet: action.component,
58 sheetProps: action.componentProps
59 });
60 }
61
62 return state;
63 });