@imposium-hub/components 2.5.11-1 → 2.5.11-10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/app-wrapper/AppWrapper.js +5 -2
- package/dist/cjs/components/app-wrapper/AppWrapper.js.map +1 -1
- package/dist/cjs/components/assets/AssetsTableNameCell.js +1 -2
- package/dist/cjs/components/assets/AssetsTableNameCell.js.map +1 -1
- package/dist/cjs/components/assets/StoryTableNameFilter.d.ts +2 -0
- package/dist/cjs/components/assets/StoryTableNameFilter.js +94 -0
- package/dist/cjs/components/assets/StoryTableNameFilter.js.map +1 -0
- package/dist/cjs/components/color-field/ColorField.js +9 -14
- package/dist/cjs/components/color-field/ColorField.js.map +1 -1
- package/dist/cjs/components/confirm-modal/ConfirmModal.d.ts +8 -0
- package/dist/cjs/components/confirm-modal/ConfirmModal.js +21 -8
- package/dist/cjs/components/confirm-modal/ConfirmModal.js.map +1 -1
- package/dist/cjs/components/data-table/DataTable.d.ts +1 -0
- package/dist/cjs/components/data-table/DataTable.js +75 -5
- package/dist/cjs/components/data-table/DataTable.js.map +1 -1
- package/dist/cjs/components/header/Header.d.ts +1 -0
- package/dist/cjs/components/header/Header.js +22 -2
- package/dist/cjs/components/header/Header.js.map +1 -1
- package/dist/cjs/components/story-previewer/StoryPreviewer.js +11 -1
- package/dist/cjs/components/story-previewer/StoryPreviewer.js.map +1 -1
- package/dist/cjs/constants/variables.d.ts +3 -0
- package/dist/cjs/constants/variables.js +27 -2
- package/dist/cjs/constants/variables.js.map +1 -1
- package/dist/cjs/index.d.ts +5 -1
- package/dist/cjs/index.js +12 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/redux/actions/asset-list.js +33 -42
- package/dist/cjs/redux/actions/asset-list.js.map +1 -1
- package/dist/cjs/redux/actions/asset-uploads.js +10 -0
- package/dist/cjs/redux/actions/asset-uploads.js.map +1 -1
- package/dist/cjs/redux/actions/story-filter.d.ts +4 -0
- package/dist/cjs/redux/actions/story-filter.js +18 -0
- package/dist/cjs/redux/actions/story-filter.js.map +1 -0
- package/dist/cjs/redux/reducers/asset-uploads.js.map +1 -1
- package/dist/cjs/redux/reducers/story-filter.d.ts +2 -0
- package/dist/cjs/redux/reducers/story-filter.js +33 -0
- package/dist/cjs/redux/reducers/story-filter.js.map +1 -0
- package/dist/esm/components/app-wrapper/AppWrapper.js +5 -2
- package/dist/esm/components/app-wrapper/AppWrapper.js.map +1 -1
- package/dist/esm/components/assets/AssetsTableNameCell.js +1 -2
- package/dist/esm/components/assets/AssetsTableNameCell.js.map +1 -1
- package/dist/esm/components/assets/StoryTableNameFilter.d.ts +2 -0
- package/dist/esm/components/assets/StoryTableNameFilter.js +20 -0
- package/dist/esm/components/assets/StoryTableNameFilter.js.map +1 -0
- package/dist/esm/components/color-field/ColorField.js +9 -14
- package/dist/esm/components/color-field/ColorField.js.map +1 -1
- package/dist/esm/components/confirm-modal/ConfirmModal.d.ts +8 -0
- package/dist/esm/components/confirm-modal/ConfirmModal.js +21 -8
- package/dist/esm/components/confirm-modal/ConfirmModal.js.map +1 -1
- package/dist/esm/components/data-table/DataTable.d.ts +1 -0
- package/dist/esm/components/data-table/DataTable.js +73 -3
- package/dist/esm/components/data-table/DataTable.js.map +1 -1
- package/dist/esm/components/header/Header.d.ts +1 -0
- package/dist/esm/components/header/Header.js +19 -3
- package/dist/esm/components/header/Header.js.map +1 -1
- package/dist/esm/components/story-previewer/StoryPreviewer.js +12 -2
- package/dist/esm/components/story-previewer/StoryPreviewer.js.map +1 -1
- package/dist/esm/constants/variables.d.ts +3 -0
- package/dist/esm/constants/variables.js +25 -1
- package/dist/esm/constants/variables.js.map +1 -1
- package/dist/esm/index.d.ts +5 -1
- package/dist/esm/index.js +5 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/redux/actions/asset-list.js +33 -42
- package/dist/esm/redux/actions/asset-list.js.map +1 -1
- package/dist/esm/redux/actions/asset-uploads.js +10 -0
- package/dist/esm/redux/actions/asset-uploads.js.map +1 -1
- package/dist/esm/redux/actions/story-filter.d.ts +4 -0
- package/dist/esm/redux/actions/story-filter.js +13 -0
- package/dist/esm/redux/actions/story-filter.js.map +1 -0
- package/dist/esm/redux/reducers/asset-uploads.js.map +1 -1
- package/dist/esm/redux/reducers/story-filter.d.ts +2 -0
- package/dist/esm/redux/reducers/story-filter.js +16 -0
- package/dist/esm/redux/reducers/story-filter.js.map +1 -0
- package/dist/styles.css +0 -3
- package/dist/styles.less +0 -5
- package/less/components/header.less +0 -5
- package/package.json +1 -1
- package/src/components/app-wrapper/AppWrapper.tsx +3 -4
- package/src/components/assets/AssetsTableNameCell.tsx +1 -10
- package/src/components/assets/StoryTableNameFilter.tsx +40 -0
- package/src/components/color-field/ColorField.tsx +16 -17
- package/src/components/confirm-modal/ConfirmModal.tsx +131 -0
- package/src/components/data-table/DataTable.tsx +90 -5
- package/src/components/header/Header.tsx +25 -2
- package/src/components/story-previewer/StoryPreviewer.tsx +28 -4
- package/src/constants/variables.ts +27 -1
- package/src/index.ts +11 -1
- package/src/redux/actions/asset-list.ts +36 -44
- package/src/redux/actions/asset-uploads.ts +9 -0
- package/src/redux/actions/story-filter.ts +15 -0
- package/src/redux/reducers/asset-uploads.ts +0 -2
- package/src/redux/reducers/story-filter.ts +18 -0
|
@@ -19,6 +19,7 @@ import Select, { createFilter } from 'react-select';
|
|
|
19
19
|
import { setAccessData } from '../../redux/actions/access';
|
|
20
20
|
import { bindActionCreators } from 'redux';
|
|
21
21
|
import { StoryTableTotalRendersCell } from '../assets/StoryTableTotalRendersCell';
|
|
22
|
+
import StoryTableNameFilter from '../assets/StoryTableNameFilter';
|
|
22
23
|
|
|
23
24
|
export interface IHeaderProps {
|
|
24
25
|
email?: string;
|
|
@@ -38,6 +39,7 @@ export interface IHeaderProps {
|
|
|
38
39
|
hideDocs?: boolean;
|
|
39
40
|
showFTLogo?: boolean;
|
|
40
41
|
access: any;
|
|
42
|
+
storyFilter: string;
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
export interface IHeaderState {
|
|
@@ -290,6 +292,7 @@ class ImposiumHeader extends React.PureComponent<IHeaderProps, IHeaderState> {
|
|
|
290
292
|
Header: 'Name',
|
|
291
293
|
width: 115,
|
|
292
294
|
minWidth: 115,
|
|
295
|
+
Search: () => <StoryTableNameFilter />,
|
|
293
296
|
disableSortBy: false
|
|
294
297
|
},
|
|
295
298
|
{
|
|
@@ -533,12 +536,30 @@ class ImposiumHeader extends React.PureComponent<IHeaderProps, IHeaderState> {
|
|
|
533
536
|
? [{ id: order, desc: orderDirection === 'desc' }]
|
|
534
537
|
: undefined;
|
|
535
538
|
|
|
536
|
-
|
|
539
|
+
let sortedStories = _.orderBy(
|
|
537
540
|
activeOrganizationBlob.stories,
|
|
538
541
|
['date_modified'],
|
|
539
542
|
['desc']
|
|
540
543
|
);
|
|
541
544
|
|
|
545
|
+
if (!!this.props.storyFilter) {
|
|
546
|
+
const storyFilter = this.props.storyFilter.toLowerCase();
|
|
547
|
+
|
|
548
|
+
const sortByName = sortedStories.filter((stories) =>
|
|
549
|
+
stories.name.toLowerCase().includes(storyFilter)
|
|
550
|
+
);
|
|
551
|
+
if (sortByName.length > 0) {
|
|
552
|
+
sortedStories = sortByName;
|
|
553
|
+
} else {
|
|
554
|
+
const sortById = sortedStories.filter((stories) =>
|
|
555
|
+
stories.id.includes(storyFilter)
|
|
556
|
+
);
|
|
557
|
+
if (sortById.length > 0) {
|
|
558
|
+
sortedStories = sortById;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
|
|
542
563
|
storyMenuInner = (
|
|
543
564
|
<DataTable
|
|
544
565
|
columns={this.getStoriesColumns()}
|
|
@@ -548,6 +569,7 @@ class ImposiumHeader extends React.PureComponent<IHeaderProps, IHeaderState> {
|
|
|
548
569
|
itemsPerPage={activeOrganizationBlob.stories.length}
|
|
549
570
|
hidePaginator={true}
|
|
550
571
|
onRowClick={this.changeStory}
|
|
572
|
+
keyboardNav={true}
|
|
551
573
|
/>
|
|
552
574
|
);
|
|
553
575
|
}
|
|
@@ -682,7 +704,8 @@ const mapStateToProps = (state): any => {
|
|
|
682
704
|
return {
|
|
683
705
|
auth: state.auth,
|
|
684
706
|
story: state.story,
|
|
685
|
-
access: state.access
|
|
707
|
+
access: state.access,
|
|
708
|
+
storyFilter: state.storyFilter.name
|
|
686
709
|
};
|
|
687
710
|
};
|
|
688
711
|
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { IImposiumAPI } from '../../services/API';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
VARIABLE_TYPES,
|
|
5
|
+
BOOLEAN_DEFAULT_OPTIONS,
|
|
6
|
+
colorPresets,
|
|
7
|
+
formatColor
|
|
8
|
+
} from '../../constants/variables';
|
|
4
9
|
import { OUTPUT_TYPES } from '../../constants/previewer';
|
|
5
10
|
import TextField from '../text-field/TextField';
|
|
6
11
|
import Button from '../button/Button';
|
|
@@ -23,6 +28,7 @@ import LogViewer from '../log-viewer/LogViewer';
|
|
|
23
28
|
import { connect } from 'react-redux';
|
|
24
29
|
import { ICON_DOWNLOAD, ICON_CLIPBOARD } from '../../constants/icons';
|
|
25
30
|
import AudioPlayer from '../players/AudioPlayer';
|
|
31
|
+
import ColorField from '../color-field/ColorField';
|
|
26
32
|
|
|
27
33
|
interface IStoryPreviewerProps {
|
|
28
34
|
api: IImposiumAPI;
|
|
@@ -137,15 +143,14 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
|
|
|
137
143
|
const { variables } = this.props;
|
|
138
144
|
const inventoryOverrides = this.props.editor?.inventoryOverrides;
|
|
139
145
|
const newInv = {};
|
|
140
|
-
|
|
141
146
|
for (const i in variables) {
|
|
142
147
|
if (variables.hasOwnProperty(i)) {
|
|
143
148
|
const override = inventoryOverrides ? inventoryOverrides[i] : null;
|
|
144
149
|
const inv = variables[i];
|
|
145
|
-
newInv[inv.id] =
|
|
150
|
+
newInv[inv.id] =
|
|
151
|
+
override !== null ? override : this.getVariableValue(inv.previewItem);
|
|
146
152
|
}
|
|
147
153
|
}
|
|
148
|
-
|
|
149
154
|
return newInv;
|
|
150
155
|
}
|
|
151
156
|
|
|
@@ -230,6 +235,11 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
|
|
|
230
235
|
}
|
|
231
236
|
}
|
|
232
237
|
|
|
238
|
+
private colorInputChanged(key, value) {
|
|
239
|
+
const color = formatColor(value);
|
|
240
|
+
this.variableInputChanged(key, color);
|
|
241
|
+
}
|
|
242
|
+
|
|
233
243
|
private variableInputChanged(key, value) {
|
|
234
244
|
const inventory = { ...this.state.inventory };
|
|
235
245
|
inventory[key] = value;
|
|
@@ -397,6 +407,20 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
|
|
|
397
407
|
</FieldWrapper>
|
|
398
408
|
);
|
|
399
409
|
break;
|
|
410
|
+
case VARIABLE_TYPES.COLOR:
|
|
411
|
+
const value = inventory[inv.id] ? inventory[inv.id] : 'rgba(0,0,0,1)';
|
|
412
|
+
fields.push(
|
|
413
|
+
<ColorField
|
|
414
|
+
label={inv.name}
|
|
415
|
+
labelPosition='top'
|
|
416
|
+
enableAlpha={true}
|
|
417
|
+
presetColors={colorPresets}
|
|
418
|
+
value={value}
|
|
419
|
+
pickerPosition='bottom'
|
|
420
|
+
onChange={(v) => this.colorInputChanged(inv.id, v)}
|
|
421
|
+
/>
|
|
422
|
+
);
|
|
423
|
+
break;
|
|
400
424
|
}
|
|
401
425
|
}
|
|
402
426
|
}
|
|
@@ -5,7 +5,8 @@ export const VARIABLE_TYPES = {
|
|
|
5
5
|
ENUM: 'enum',
|
|
6
6
|
IMAGE: 'image',
|
|
7
7
|
VIDEO: 'video',
|
|
8
|
-
AUDIO: 'audio'
|
|
8
|
+
AUDIO: 'audio',
|
|
9
|
+
COLOR: 'color'
|
|
9
10
|
};
|
|
10
11
|
|
|
11
12
|
export const BOOLEAN_DEFAULT_OPTIONS = [
|
|
@@ -18,3 +19,28 @@ export const BOOLEAN_DEFAULT_OPTIONS = [
|
|
|
18
19
|
label: 'False'
|
|
19
20
|
}
|
|
20
21
|
];
|
|
22
|
+
|
|
23
|
+
export const colorPresets = [
|
|
24
|
+
'#D0021B',
|
|
25
|
+
'#F5A623',
|
|
26
|
+
'#F8E71C',
|
|
27
|
+
'#8B572A',
|
|
28
|
+
'#7ED321',
|
|
29
|
+
'#417505',
|
|
30
|
+
'#BD10E0',
|
|
31
|
+
'#9013FE',
|
|
32
|
+
'#4A90E2',
|
|
33
|
+
'#50E3C2',
|
|
34
|
+
'#B8E986',
|
|
35
|
+
'#000000',
|
|
36
|
+
'#4A4A4A',
|
|
37
|
+
'#9B9B9B',
|
|
38
|
+
'#FFFFFF',
|
|
39
|
+
'transparent'
|
|
40
|
+
];
|
|
41
|
+
|
|
42
|
+
export const formatColor = (color) => {
|
|
43
|
+
const { r, g, b, a } = color.rgb;
|
|
44
|
+
const alpha = color.source === 'hsv' ? 1 : a;
|
|
45
|
+
return `rgba(${r},${g},${b},${alpha})`;
|
|
46
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -159,7 +159,11 @@ import ContextMenuItem from './components/context-menu/ContextMenuItem';
|
|
|
159
159
|
import ContextMenuTrigger from './components/context-menu/ContextMenuTrigger';
|
|
160
160
|
import CopyPropIdButton from './components/copy-prop-id-button/CopyPropIdButton';
|
|
161
161
|
import Submenu from './components/context-menu/SubMenu';
|
|
162
|
+
import { ConfirmModal, IConfirmModalProps } from './components/confirm-modal/ConfirmModal';
|
|
162
163
|
import AssetsTableAssetIdCell from './components/assets/AssetsTableAssetIdCell';
|
|
164
|
+
import { resetStoryFilter, updateStoryFilter } from './redux/actions/story-filter';
|
|
165
|
+
import storyFilter from './redux/reducers/story-filter';
|
|
166
|
+
import StoryTableNameFilter from './components/assets/StoryTableNameFilter';
|
|
163
167
|
|
|
164
168
|
export {
|
|
165
169
|
AppWrapper,
|
|
@@ -218,6 +222,7 @@ export {
|
|
|
218
222
|
AssetsTableGlobalCell,
|
|
219
223
|
AssetsTableStatusCell,
|
|
220
224
|
AssetsTableNameFilter,
|
|
225
|
+
StoryTableNameFilter,
|
|
221
226
|
AssetsTableAssetIdFilter,
|
|
222
227
|
AssetsTableAssetIdCell,
|
|
223
228
|
AssetsTableNameCell,
|
|
@@ -245,6 +250,8 @@ export {
|
|
|
245
250
|
storyDeleted,
|
|
246
251
|
updateFilters,
|
|
247
252
|
resetFilters,
|
|
253
|
+
updateStoryFilter,
|
|
254
|
+
resetStoryFilter,
|
|
248
255
|
getAssets,
|
|
249
256
|
deleteAssets,
|
|
250
257
|
downloadAssets,
|
|
@@ -259,6 +266,7 @@ export {
|
|
|
259
266
|
deselectAsset,
|
|
260
267
|
resetSelection,
|
|
261
268
|
assetFilters,
|
|
269
|
+
storyFilter,
|
|
262
270
|
assetList,
|
|
263
271
|
assetUploads,
|
|
264
272
|
selectedAssets,
|
|
@@ -315,5 +323,7 @@ export {
|
|
|
315
323
|
ContextMenuItem,
|
|
316
324
|
ContextMenuTrigger,
|
|
317
325
|
Submenu,
|
|
318
|
-
CopyPropIdButton
|
|
326
|
+
CopyPropIdButton,
|
|
327
|
+
ConfirmModal,
|
|
328
|
+
IConfirmModalProps
|
|
319
329
|
};
|
|
@@ -78,22 +78,18 @@ export const getAssets = (api: IImposiumAPI, storyId: string): any => {
|
|
|
78
78
|
|
|
79
79
|
export const deleteAssets = (api: IImposiumAPI, ids: string[], storyId: string): any => {
|
|
80
80
|
return (dispatch) => {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
});
|
|
94
|
-
} else {
|
|
95
|
-
return Promise.resolve(false);
|
|
96
|
-
}
|
|
81
|
+
return new Promise<boolean>((resolve, reject) => {
|
|
82
|
+
dispatch(toggleLoading(true));
|
|
83
|
+
api.deleteAssets(ids)
|
|
84
|
+
.then(() => {
|
|
85
|
+
dispatch(getAssets(api, storyId));
|
|
86
|
+
resolve(true);
|
|
87
|
+
})
|
|
88
|
+
.catch((errors: Error[]) => {
|
|
89
|
+
dispatch(toggleLoading(false));
|
|
90
|
+
reject(false);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
97
93
|
};
|
|
98
94
|
};
|
|
99
95
|
|
|
@@ -194,20 +190,18 @@ export const deleteAssetTags = (api: IImposiumAPI, id: string): any => {
|
|
|
194
190
|
|
|
195
191
|
export const deleteAssetsTags = (api: IImposiumAPI, ids: string[], storyId: string): any => {
|
|
196
192
|
return (dispatch) => {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
});
|
|
210
|
-
}
|
|
193
|
+
return new Promise<void>((resolve, reject) => {
|
|
194
|
+
dispatch(toggleLoading(true));
|
|
195
|
+
api.deleteAssetsTags(ids)
|
|
196
|
+
.then(() => {
|
|
197
|
+
dispatch(getAssets(api, storyId));
|
|
198
|
+
resolve();
|
|
199
|
+
})
|
|
200
|
+
.catch((errors: Error[]) => {
|
|
201
|
+
dispatch(toggleLoading(false));
|
|
202
|
+
reject();
|
|
203
|
+
});
|
|
204
|
+
});
|
|
211
205
|
};
|
|
212
206
|
};
|
|
213
207
|
|
|
@@ -245,20 +239,18 @@ export const updateAssetStory = (api: IImposiumAPI, id: string, storyId: string)
|
|
|
245
239
|
|
|
246
240
|
export const decoupleAssets = (api: IImposiumAPI, ids: string[], storyId: string): any => {
|
|
247
241
|
return (dispatch) => {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
});
|
|
261
|
-
}
|
|
242
|
+
return new Promise<void>((resolve, reject) => {
|
|
243
|
+
dispatch(toggleLoading(true));
|
|
244
|
+
api.decoupleAssets(ids)
|
|
245
|
+
.then(() => {
|
|
246
|
+
dispatch(getAssets(api, storyId));
|
|
247
|
+
resolve();
|
|
248
|
+
})
|
|
249
|
+
.catch((errors: Error[]) => {
|
|
250
|
+
dispatch(toggleLoading(false));
|
|
251
|
+
reject();
|
|
252
|
+
});
|
|
253
|
+
});
|
|
262
254
|
};
|
|
263
255
|
};
|
|
264
256
|
|
|
@@ -364,6 +364,15 @@ export const replaceAsset = (
|
|
|
364
364
|
if (axios.isCancel(e) && currentQueue !== queueLength - 1) {
|
|
365
365
|
currentQueue = currentQueue + 1;
|
|
366
366
|
createPromise(currentQueue);
|
|
367
|
+
} else {
|
|
368
|
+
const error: any = { ...e };
|
|
369
|
+
const errorMsg = error.response.data.error.split(':')[0];
|
|
370
|
+
dispatch({
|
|
371
|
+
type: assetUploadsActions.ERROR,
|
|
372
|
+
filename: replacedFileBlobs[activeIndex].filename,
|
|
373
|
+
errorMsg
|
|
374
|
+
});
|
|
375
|
+
doAssetTableHydration(api, storyId);
|
|
367
376
|
}
|
|
368
377
|
});
|
|
369
378
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const storyFilterActions: any = {
|
|
2
|
+
UPDATE: 'storyFilter/UPDATE',
|
|
3
|
+
RESET: 'storyFilter/RESET'
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
export const updateStoryFilter = (newFilters: any): any => ({
|
|
7
|
+
type: storyFilterActions.UPDATE,
|
|
8
|
+
newFilters
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export const resetStoryFilter = (): any => ({
|
|
12
|
+
type: storyFilterActions.RESET
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export default storyFilterActions;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import storyFilterActions from '../actions/story-filter';
|
|
2
|
+
|
|
3
|
+
const initialState: any = {
|
|
4
|
+
name: ''
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
const storyFilter = (state = initialState, action): any => {
|
|
8
|
+
switch (action.type) {
|
|
9
|
+
case storyFilterActions.UPDATE:
|
|
10
|
+
return { ...state, ...action.newFilters };
|
|
11
|
+
case storyFilterActions.RESET:
|
|
12
|
+
return { ...initialState };
|
|
13
|
+
default:
|
|
14
|
+
return state;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default storyFilter;
|