@selfcommunity/react-ui 0.9.0-alpha.1 → 0.9.0-alpha.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/lib/cjs/components/Event/Event.js +1 -1
- package/lib/cjs/components/EventHeader/EventHeader.js +1 -1
- package/lib/cjs/components/EventMediaWidget/EventMediaWidget.d.ts +4 -0
- package/lib/cjs/components/EventMediaWidget/EventMediaWidget.js +45 -34
- package/lib/cjs/components/EventMembersWidget/EventMembersWidget.d.ts +3 -0
- package/lib/cjs/components/EventMembersWidget/EventMembersWidget.js +18 -13
- package/lib/cjs/components/Events/Events.js +2 -3
- package/lib/cjs/components/OnBoardingWidget/Steps/Appearance/Appearance.js +10 -13
- package/lib/cjs/shared/EventActionsMenu/index.d.ts +1 -1
- package/lib/cjs/utils/widget.d.ts +1 -0
- package/lib/cjs/utils/widget.js +14 -0
- package/lib/esm/components/Event/Event.js +1 -1
- package/lib/esm/components/EventHeader/EventHeader.js +1 -1
- package/lib/esm/components/EventMediaWidget/EventMediaWidget.d.ts +4 -0
- package/lib/esm/components/EventMediaWidget/EventMediaWidget.js +46 -35
- package/lib/esm/components/EventMembersWidget/EventMembersWidget.d.ts +3 -0
- package/lib/esm/components/EventMembersWidget/EventMembersWidget.js +18 -13
- package/lib/esm/components/Events/Events.js +2 -3
- package/lib/esm/components/OnBoardingWidget/Steps/Appearance/Appearance.js +10 -13
- package/lib/esm/shared/EventActionsMenu/index.d.ts +1 -1
- package/lib/esm/utils/widget.d.ts +1 -0
- package/lib/esm/utils/widget.js +14 -0
- package/lib/umd/react-ui.js +1 -1
- package/package.json +3 -3
|
@@ -11,7 +11,6 @@ import { FormattedMessage } from 'react-intl';
|
|
|
11
11
|
import 'swiper/css';
|
|
12
12
|
import { SCOPE_SC_UI } from '../../constants/Errors';
|
|
13
13
|
import { DEFAULT_PAGINATION_OFFSET } from '../../constants/Pagination';
|
|
14
|
-
import HiddenPlaceholder from '../../shared/HiddenPlaceholder';
|
|
15
14
|
import { actionWidgetTypes, dataWidgetReducer, stateWidgetInitializer } from '../../utils/widget';
|
|
16
15
|
import Widget from '../Widget';
|
|
17
16
|
import { PREFIX } from './constants';
|
|
@@ -60,10 +59,10 @@ export default function EventMembersWidget(inProps) {
|
|
|
60
59
|
cacheStrategy,
|
|
61
60
|
visibleItems: limit
|
|
62
61
|
}, stateWidgetInitializer);
|
|
63
|
-
const [participantsCount, setParticipantsCount] = useState(
|
|
64
|
-
const [invitedCount, setInvitedCount] = useState(
|
|
65
|
-
const [requestsCount, setRequestsCount] = useState(
|
|
66
|
-
const [requestsUsers, setRequestsUsers] = useState(
|
|
62
|
+
const [participantsCount, setParticipantsCount] = useState(participants.count);
|
|
63
|
+
const [invitedCount, setInvitedCount] = useState(invited.count);
|
|
64
|
+
const [requestsCount, setRequestsCount] = useState(requests.count);
|
|
65
|
+
const [requestsUsers, setRequestsUsers] = useState(requests.results);
|
|
67
66
|
const [tabValue, setTabValue] = useState(TabContentEnum.PARTICIPANTS);
|
|
68
67
|
const [refresh, setRefresh] = useState(null);
|
|
69
68
|
// CONTEXT
|
|
@@ -97,7 +96,7 @@ export default function EventMembersWidget(inProps) {
|
|
|
97
96
|
Logger.error(SCOPE_SC_UI, error);
|
|
98
97
|
});
|
|
99
98
|
}
|
|
100
|
-
}, [participants.isLoadingNext, participants.initialized, scEvent]);
|
|
99
|
+
}, [participants.isLoadingNext, participants.initialized, scEvent, dispatchParticipants, setParticipantsCount]);
|
|
101
100
|
const _initInvited = useCallback(() => {
|
|
102
101
|
if (!invited.initialized && !invited.isLoadingNext && hasAllow) {
|
|
103
102
|
dispatchInvited({ type: actionWidgetTypes.LOADING_NEXT });
|
|
@@ -111,7 +110,7 @@ export default function EventMembersWidget(inProps) {
|
|
|
111
110
|
Logger.error(SCOPE_SC_UI, error);
|
|
112
111
|
});
|
|
113
112
|
}
|
|
114
|
-
}, [invited.isLoadingNext, invited.initialized,
|
|
113
|
+
}, [invited.isLoadingNext, invited.initialized, scEvent, dispatchInvited, setInvitedCount]);
|
|
115
114
|
const _initRequests = useCallback(() => {
|
|
116
115
|
if (!requests.initialized && !requests.isLoadingNext && hasAllow) {
|
|
117
116
|
dispatchRequests({ type: actionWidgetTypes.LOADING_NEXT });
|
|
@@ -126,7 +125,7 @@ export default function EventMembersWidget(inProps) {
|
|
|
126
125
|
Logger.error(SCOPE_SC_UI, error);
|
|
127
126
|
});
|
|
128
127
|
}
|
|
129
|
-
}, [requests.isLoadingNext, requests.initialized,
|
|
128
|
+
}, [requests.isLoadingNext, requests.initialized, scEvent, dispatchRequests, setRequestsCount, setRequestsUsers]);
|
|
130
129
|
// EFFECTS
|
|
131
130
|
useEffect(() => {
|
|
132
131
|
let _t;
|
|
@@ -151,6 +150,13 @@ export default function EventMembersWidget(inProps) {
|
|
|
151
150
|
};
|
|
152
151
|
}
|
|
153
152
|
}, [scUserContext.user, scEvent, refresh]);
|
|
153
|
+
useEffect(() => {
|
|
154
|
+
if (participants.initialized && scEvent && Boolean((eventId !== undefined && scEvent.id !== eventId) || (event && scEvent.id !== event.id))) {
|
|
155
|
+
dispatchParticipants({ type: actionWidgetTypes.RESET, payload: {} });
|
|
156
|
+
dispatchRequests({ type: actionWidgetTypes.RESET, payload: {} });
|
|
157
|
+
dispatchInvited({ type: actionWidgetTypes.RESET, payload: {} });
|
|
158
|
+
}
|
|
159
|
+
}, [participants.initialized, scEvent, eventId, event]);
|
|
154
160
|
// HANDLERS
|
|
155
161
|
const handleTabChange = useCallback((_evt, newTabValue) => {
|
|
156
162
|
setTabValue(newTabValue);
|
|
@@ -164,13 +170,12 @@ export default function EventMembersWidget(inProps) {
|
|
|
164
170
|
}
|
|
165
171
|
setRefresh(_tabValue);
|
|
166
172
|
}, []);
|
|
167
|
-
if (!scEvent
|
|
173
|
+
if (!scEvent ||
|
|
174
|
+
!participants.initialized ||
|
|
175
|
+
(scEvent && ((eventId !== undefined && scEvent.id !== eventId) || (event && scEvent.id !== event.id))) ||
|
|
176
|
+
(tabValue === TabContentEnum.PARTICIPANTS && participants.isLoadingNext && !participants.initialized)) {
|
|
168
177
|
return _jsx(Skeleton, {});
|
|
169
178
|
}
|
|
170
|
-
// RENDER
|
|
171
|
-
if (!scEvent) {
|
|
172
|
-
return _jsx(HiddenPlaceholder, {});
|
|
173
|
-
}
|
|
174
179
|
return (_jsx(Root, Object.assign({ className: classes.root }, rest, { children: _jsxs(CardContent, Object.assign({ className: classes.content }, { children: [_jsx(Typography, Object.assign({ variant: "h5", className: classes.title }, { children: _jsx(FormattedMessage, { id: title, defaultMessage: title }) })), _jsxs(TabContext, Object.assign({ value: tabValue }, { children: [_jsxs(TabList, Object.assign({ className: classes.tabsWrapper, onChange: handleTabChange, textColor: "primary", indicatorColor: "primary", variant: "fullWidth" }, { children: [_jsx(Tab, { label: _jsxs(Stack, Object.assign({ className: classes.tabLabelWrapper }, { children: [_jsx(Typography, Object.assign({ variant: "h3" }, { children: participantsCount })), _jsx(Typography, Object.assign({ variant: "subtitle2" }, { children: _jsx(FormattedMessage, { id: "ui.eventMembersWidget.participants", defaultMessage: "ui.eventMembersWidget.participants" }) }))] })), value: TabContentEnum.PARTICIPANTS }), hasAllow && (_jsx(Tab, { label: _jsxs(Stack, Object.assign({ className: classes.tabLabelWrapper }, { children: [_jsx(Typography, Object.assign({ variant: "h3" }, { children: invitedCount })), _jsx(Typography, Object.assign({ variant: "subtitle2" }, { children: _jsx(FormattedMessage, { id: "ui.eventMembersWidget.invited", defaultMessage: "ui.eventMembersWidget.invited" }) }))] })), value: TabContentEnum.INVITED })), hasAllow && (_jsx(Tab, { label: _jsxs(Stack, Object.assign({ className: classes.tabLabelWrapper }, { children: [_jsx(Typography, Object.assign({ variant: "h3" }, { children: requestsCount })), _jsx(Typography, Object.assign({ variant: "subtitle2" }, { children: _jsx(FormattedMessage, { id: "ui.eventMembersWidget.requests", defaultMessage: "ui.eventMembersWidget.requests" }) }))] })), value: TabContentEnum.REQUESTS }))] })), _jsx(TabPanel, Object.assign({ value: TabContentEnum.PARTICIPANTS, className: classes.tabPanel }, { children: _jsx(TabContentComponent, { tabValue: TabContentEnum.PARTICIPANTS, state: participants, dispatch: dispatchParticipants, userProps: userProps, dialogProps: dialogProps, handleRefresh: handleRefresh }) })), hasAllow && (_jsx(TabPanel, Object.assign({ value: TabContentEnum.INVITED, className: classes.tabPanel }, { children: _jsx(TabContentComponent, { tabValue: TabContentEnum.INVITED, state: invited, dispatch: dispatchInvited, userProps: userProps, dialogProps: dialogProps, actionProps: {
|
|
175
180
|
scEvent,
|
|
176
181
|
setCount: setInvitedCount
|
|
@@ -142,13 +142,13 @@ export default function Events(inProps) {
|
|
|
142
142
|
* On mount, fetches events list
|
|
143
143
|
*/
|
|
144
144
|
useEffect(() => {
|
|
145
|
-
if (!contentAvailability) {
|
|
145
|
+
if (!contentAvailability && !authUserId) {
|
|
146
146
|
return;
|
|
147
147
|
}
|
|
148
148
|
else {
|
|
149
149
|
query === '' && fetchEvents();
|
|
150
150
|
}
|
|
151
|
-
}, [contentAvailability, dateSearch, location, showFollowed, showPastEvents, showMyEvents, query]);
|
|
151
|
+
}, [contentAvailability, authUserId, dateSearch, location, showFollowed, showPastEvents, showMyEvents, query]);
|
|
152
152
|
/**
|
|
153
153
|
* Subscriber for pubsub callback
|
|
154
154
|
*/
|
|
@@ -211,7 +211,6 @@ export default function Events(inProps) {
|
|
|
211
211
|
/**
|
|
212
212
|
* Renders events list
|
|
213
213
|
*/
|
|
214
|
-
console.log(location);
|
|
215
214
|
const c = (_jsxs(_Fragment, { children: [showFilters && (_jsx(Grid, Object.assign({ container: true, className: classes.filters, gap: 2 }, { children: filters ? (filters) : !general ? (_jsxs(_Fragment, { children: [(events.length !== 0 || (events.length === 0 && showMyEvents)) && (_jsx(Grid, Object.assign({ item: true }, { children: _jsx(EventsChipRoot
|
|
216
215
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
217
216
|
// @ts-ignore
|
|
@@ -63,8 +63,7 @@ export default function Appearance(inProps) {
|
|
|
63
63
|
const { className, onCompleteAction } = props;
|
|
64
64
|
// STATE
|
|
65
65
|
const [state, dispatch] = useReducer(reducer, getInitialState(null));
|
|
66
|
-
|
|
67
|
-
const [loadingLogo, setLoadingLogo] = useState(false);
|
|
66
|
+
const [loadingLogo, setLoadingLogo] = useState('');
|
|
68
67
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
69
68
|
const [tab, setTab] = useState(0);
|
|
70
69
|
const [updating, setUpdating] = useState(false);
|
|
@@ -160,15 +159,13 @@ export default function Appearance(inProps) {
|
|
|
160
159
|
setUpdating(false);
|
|
161
160
|
}
|
|
162
161
|
});
|
|
163
|
-
const updateLogoPreference = (name) => __awaiter(this, void 0, void 0, function* () {
|
|
164
|
-
setLoadingLogo(
|
|
162
|
+
const updateLogoPreference = (name, file) => __awaiter(this, void 0, void 0, function* () {
|
|
163
|
+
setLoadingLogo(name);
|
|
165
164
|
const formData = new FormData();
|
|
166
|
-
|
|
167
|
-
// @ts-ignore
|
|
168
|
-
formData.append(name, fileInput);
|
|
165
|
+
formData.append(name, file);
|
|
169
166
|
yield PreferenceService.updatePreferences(formData)
|
|
170
167
|
.then((preference) => {
|
|
171
|
-
setLoadingLogo(
|
|
168
|
+
setLoadingLogo('');
|
|
172
169
|
dispatch({
|
|
173
170
|
type: actionTypes.SET_LOGOS,
|
|
174
171
|
payload: { logos: state.logos.map((l) => (l.name === name ? Object.assign(Object.assign({}, l), { value: preference[name].value }) : l)) }
|
|
@@ -176,7 +173,7 @@ export default function Appearance(inProps) {
|
|
|
176
173
|
onCompleteAction();
|
|
177
174
|
})
|
|
178
175
|
.catch((e) => {
|
|
179
|
-
setLoadingLogo(
|
|
176
|
+
setLoadingLogo('');
|
|
180
177
|
Logger.error(SCOPE_SC_UI, e);
|
|
181
178
|
});
|
|
182
179
|
});
|
|
@@ -186,9 +183,9 @@ export default function Appearance(inProps) {
|
|
|
186
183
|
* @param name
|
|
187
184
|
*/
|
|
188
185
|
const handleUpload = (event, name) => {
|
|
189
|
-
|
|
190
|
-
if (
|
|
191
|
-
updateLogoPreference(name);
|
|
186
|
+
const file = event.target.files[0];
|
|
187
|
+
if (file) {
|
|
188
|
+
updateLogoPreference(name, file);
|
|
192
189
|
}
|
|
193
190
|
};
|
|
194
191
|
useEffect(() => {
|
|
@@ -221,7 +218,7 @@ export default function Appearance(inProps) {
|
|
|
221
218
|
colorRef.current.blur();
|
|
222
219
|
}
|
|
223
220
|
};
|
|
224
|
-
return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, { children: [_jsx(Typography, Object.assign({ variant: "h4", className: classes.title, alignSelf: "self-start" }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.appearance", defaultMessage: "ui.onBoardingWidget.appearance" }) })), _jsx(Typography, Object.assign({ className: classes.summary }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.summary", defaultMessage: "ui.onBoardingWidget.step.appearance.summary" }) })), _jsx(Button, Object.assign({ variant: "outlined", size: "small", color: "primary", onClick: handleOpen }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.button", defaultMessage: "ui.onBoardingWidget.step.appearance.button" }) })), _jsxs(DrawerRoot, Object.assign({ className: classes.drawerRoot, anchor: "right", open: Boolean(anchorEl), onClose: handleClose }, { children: [_jsxs(Box, Object.assign({ className: classes.drawerHeader }, { children: [_jsx(Typography, Object.assign({ variant: "h4", color: "primary" }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.header.title", defaultMessage: "ui.onBoardingWidget.step.appearance.header.title" }) })), _jsx(IconButton, Object.assign({ className: classes.drawerHeaderAction, onClick: handleClose }, { children: _jsx(Icon, { children: "close" }) }))] })), _jsxs(Tabs, Object.assign({ value: tab, onChange: handleTabChange, variant: "scrollable", scrollButtons: "auto", "aria-label": "scrollable-tabs" }, { children: [_jsx(Tab, { label: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.colors.title", defaultMessage: "ui.onBoardingWidget.step.appearance.colors.title" }) }), _jsx(Tab, { label: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.logo.title", defaultMessage: "ui.onBoardingWidget.step.appearance.logo.title" }) }), _jsx(Tab, { label: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.titleSlogan.title", defaultMessage: "ui.onBoardingWidget.step.appearance.titleSlogan.title" }) })] })), _jsx(ScrollContainer, { children: _jsxs(Box, Object.assign({ className: classes.drawerContent }, { children: [tab === 0 && (_jsx(_Fragment, { children: state.colors.map((color) => (_jsxs(React.Fragment, { children: [_jsx(Typography, Object.assign({ variant: "h6" }, { children: formatColorLabel(color) })), _jsxs(Box, Object.assign({ className: classes.colorContainer }, { children: [_jsx(MuiColorInput, { inputRef: colorRef, className: classes.color, format: "hex", value: color.value, onChange: (newColor) => handleColorChange(newColor, color.name), isAlphaHidden: true, PopoverProps: { onClose: handleClosePopover } }), updatingColor && updatingColor === color.name && (_jsx(CircularProgress, { className: classes.colorProgress, color: "secondary", size: 24 }))] }))] }, color.id))) })), tab === 1 && (_jsx(_Fragment, { children: state.logos.map((logo) => (_jsxs(React.Fragment, { children: [_jsx(Typography, Object.assign({ variant: "h6" }, { children: formatLogoLabel(logo.name) })), _jsxs(Box, Object.assign({ className: classes.logoContainer }, { children: [_jsx("img", { src: logo.value, className: classes.logo }), _jsx("input", { type: "file", onChange: (event) => handleUpload(event, logo.name),
|
|
221
|
+
return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, { children: [_jsx(Typography, Object.assign({ variant: "h4", className: classes.title, alignSelf: "self-start" }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.appearance", defaultMessage: "ui.onBoardingWidget.appearance" }) })), _jsx(Typography, Object.assign({ className: classes.summary }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.summary", defaultMessage: "ui.onBoardingWidget.step.appearance.summary" }) })), _jsx(Button, Object.assign({ variant: "outlined", size: "small", color: "primary", onClick: handleOpen }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.button", defaultMessage: "ui.onBoardingWidget.step.appearance.button" }) })), _jsxs(DrawerRoot, Object.assign({ className: classes.drawerRoot, anchor: "right", open: Boolean(anchorEl), onClose: handleClose }, { children: [_jsxs(Box, Object.assign({ className: classes.drawerHeader }, { children: [_jsx(Typography, Object.assign({ variant: "h4", color: "primary" }, { children: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.header.title", defaultMessage: "ui.onBoardingWidget.step.appearance.header.title" }) })), _jsx(IconButton, Object.assign({ className: classes.drawerHeaderAction, onClick: handleClose }, { children: _jsx(Icon, { children: "close" }) }))] })), _jsxs(Tabs, Object.assign({ value: tab, onChange: handleTabChange, variant: "scrollable", scrollButtons: "auto", "aria-label": "scrollable-tabs" }, { children: [_jsx(Tab, { label: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.colors.title", defaultMessage: "ui.onBoardingWidget.step.appearance.colors.title" }) }), _jsx(Tab, { label: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.logo.title", defaultMessage: "ui.onBoardingWidget.step.appearance.logo.title" }) }), _jsx(Tab, { label: _jsx(FormattedMessage, { id: "ui.onBoardingWidget.step.appearance.titleSlogan.title", defaultMessage: "ui.onBoardingWidget.step.appearance.titleSlogan.title" }) })] })), _jsx(ScrollContainer, { children: _jsxs(Box, Object.assign({ className: classes.drawerContent }, { children: [tab === 0 && (_jsx(_Fragment, { children: state.colors.map((color) => (_jsxs(React.Fragment, { children: [_jsx(Typography, Object.assign({ variant: "h6" }, { children: formatColorLabel(color) })), _jsxs(Box, Object.assign({ className: classes.colorContainer }, { children: [_jsx(MuiColorInput, { inputRef: colorRef, className: classes.color, format: "hex", value: color.value, onChange: (newColor) => handleColorChange(newColor, color.name), isAlphaHidden: true, PopoverProps: { onClose: handleClosePopover } }), updatingColor && updatingColor === color.name && (_jsx(CircularProgress, { className: classes.colorProgress, color: "secondary", size: 24 }))] }))] }, color.id))) })), tab === 1 && (_jsx(_Fragment, { children: state.logos.map((logo) => (_jsxs(React.Fragment, { children: [_jsx(Typography, Object.assign({ variant: "h6" }, { children: formatLogoLabel(logo.name) })), _jsxs(Box, Object.assign({ className: classes.logoContainer }, { children: [_jsx("img", { src: logo.value, className: classes.logo }), _jsx("input", { type: "file", onChange: (event) => handleUpload(event, logo.name), hidden: true, accept: ".gif,.png,.jpg,.jpeg", id: logo.name }), _jsx(LoadingButton, Object.assign({ className: classes.uploadButton, onClick: () => document.getElementById(`${logo.name}`).click(), loading: Boolean(loadingLogo) && Boolean(logo.name === loadingLogo), disabled: Boolean(loadingLogo) && Boolean(logo.name !== loadingLogo) }, { children: _jsx(Icon, { children: "upload" }) }))] }))] }, logo.id))) })), tab === 2 && (_jsxs(Box, { children: [_jsx(TextField, { multiline: true, fullWidth: true,
|
|
225
222
|
//className={classes.field}
|
|
226
223
|
label: `${intl.formatMessage(messages.titleField)}`, margin: "normal", value: (_a = state === null || state === void 0 ? void 0 : state.slogans[0]) === null || _a === void 0 ? void 0 : _a.value, name: "application_slogan1", onChange: handleChange, InputProps: {
|
|
227
224
|
endAdornment: _jsx(Typography, Object.assign({ variant: "body2" }, { children: ((_b = state.slogans[0].value) === null || _b === void 0 ? void 0 : _b.length) ? 50 - ((_c = state.slogans[0].value) === null || _c === void 0 ? void 0 : _c.length) : 50 }))
|
package/lib/esm/utils/widget.js
CHANGED
|
@@ -15,6 +15,7 @@ export const actionWidgetTypes = {
|
|
|
15
15
|
LOAD_PREVIOUS_FAILURE: '_load_previous_failure',
|
|
16
16
|
SET_RESULTS: '_set_results',
|
|
17
17
|
SET_VISIBLE_ITEMS: '_set_visible_items',
|
|
18
|
+
INITIALIZE: '_initialize',
|
|
18
19
|
RESET: '_reset'
|
|
19
20
|
};
|
|
20
21
|
/**
|
|
@@ -53,6 +54,19 @@ export function dataWidgetReducer(state, action) {
|
|
|
53
54
|
case actionWidgetTypes.RESET:
|
|
54
55
|
_state = { isLoadingNext: false, next: null, results: [], count: 0, errorLoadNext: null, initialized: false };
|
|
55
56
|
break;
|
|
57
|
+
case actionWidgetTypes.INITIALIZE:
|
|
58
|
+
_state = {
|
|
59
|
+
cacheKey: action.payload.cacheKey ? action.payload.cacheKey : null,
|
|
60
|
+
count: action.payload.count ? action.payload.count : 0,
|
|
61
|
+
results: action.payload.results ? action.payload.results : [],
|
|
62
|
+
next: action.payload.next ? action.payload.next : null,
|
|
63
|
+
previous: action.payload.previous ? action.payload.previous : null,
|
|
64
|
+
isLoadingNext: action.payload.isLoadingNext ? action.payload.isLoadingNext : false,
|
|
65
|
+
isLoadingPrevious: action.payload.isLoadingPrevious ? action.payload.isLoadingPrevious : false,
|
|
66
|
+
visibleItems: action.payload.visibleItems ? action.payload.visibleItems : null,
|
|
67
|
+
initialized: false
|
|
68
|
+
};
|
|
69
|
+
break;
|
|
56
70
|
}
|
|
57
71
|
LRUCache.set(_state.cacheKey, _state);
|
|
58
72
|
return _state;
|