@selfcommunity/react-ui 0.1.2-alpha.8 → 0.1.2-alpha.9
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/BroadcastMessages/Message.js +2 -2
- package/lib/cjs/components/CategoriesFollowed/CategoriesFollowed.js +3 -20
- package/lib/cjs/components/CategoriesSuggestion/CategoriesSuggestion.js +1 -4
- package/lib/cjs/components/CommentObject/CommentObject.js +4 -1
- package/lib/cjs/components/FeedObject/FeedObject.js +1 -1
- package/lib/cjs/components/PeopleSuggestion/PeopleSuggestion.js +2 -8
- package/lib/cjs/components/UsersFollowed/UsersFollowed.js +3 -18
- package/lib/esm/components/BroadcastMessages/Message.js +2 -2
- package/lib/esm/components/CategoriesFollowed/CategoriesFollowed.js +3 -20
- package/lib/esm/components/CategoriesSuggestion/CategoriesSuggestion.js +1 -4
- package/lib/esm/components/CommentObject/CommentObject.js +4 -1
- package/lib/esm/components/FeedObject/FeedObject.js +1 -1
- package/lib/esm/components/PeopleSuggestion/PeopleSuggestion.js +2 -8
- package/lib/esm/components/UsersFollowed/UsersFollowed.js +3 -18
- package/lib/esm/react-ui/src/components/BroadcastMessages/Message.d.ts.map +1 -1
- package/lib/esm/react-ui/src/components/CategoriesFollowed/CategoriesFollowed.d.ts.map +1 -1
- package/lib/esm/react-ui/src/components/CategoriesSuggestion/CategoriesSuggestion.d.ts.map +1 -1
- package/lib/esm/react-ui/src/components/CommentObject/CommentObject.d.ts.map +1 -1
- package/lib/esm/react-ui/src/components/PeopleSuggestion/PeopleSuggestion.d.ts.map +1 -1
- package/lib/esm/react-ui/src/components/UsersFollowed/UsersFollowed.d.ts.map +1 -1
- package/lib/umd/react-ui.js +1 -1
- package/lib/umd/react-ui.js.map +1 -1
- package/package.json +6 -6
|
@@ -85,7 +85,7 @@ const Root = (0, _styles.styled)(_Widget.default, {
|
|
|
85
85
|
height: 30
|
|
86
86
|
}
|
|
87
87
|
}));
|
|
88
|
-
const PREFERENCES = [_reactCore.SCPreferences.
|
|
88
|
+
const PREFERENCES = [_reactCore.SCPreferences.LOGO_NAVBAR_LOGO_MOBILE, _reactCore.SCPreferences.TEXT_APPLICATION_NAME];
|
|
89
89
|
|
|
90
90
|
function Message(props) {
|
|
91
91
|
// PROPS
|
|
@@ -181,7 +181,7 @@ function Message(props) {
|
|
|
181
181
|
className: classes.header,
|
|
182
182
|
avatar: /*#__PURE__*/_react.default.createElement(_material.Avatar, {
|
|
183
183
|
alt: preferences[_reactCore.SCPreferences.TEXT_APPLICATION_NAME],
|
|
184
|
-
src: preferences[_reactCore.SCPreferences.
|
|
184
|
+
src: preferences[_reactCore.SCPreferences.LOGO_NAVBAR_LOGO_MOBILE_MOBILE]
|
|
185
185
|
}),
|
|
186
186
|
action: template === _types.SCBroadcastMessageTemplateType.DETAIL && /*#__PURE__*/_react.default.createElement(_material.IconButton, {
|
|
187
187
|
"aria-label": "close",
|
|
@@ -111,7 +111,6 @@ function CategoriesFollowed(inProps) {
|
|
|
111
111
|
} = props; // STATE
|
|
112
112
|
|
|
113
113
|
const [categories, setCategories] = (0, _react.useState)([]);
|
|
114
|
-
const [visibleCategories, setVisibleCategories] = (0, _react.useState)(limit);
|
|
115
114
|
const [loading, setLoading] = (0, _react.useState)(true);
|
|
116
115
|
const [hasMore, setHasMore] = (0, _react.useState)(false);
|
|
117
116
|
const [total, setTotal] = (0, _react.useState)(0);
|
|
@@ -129,17 +128,12 @@ function CategoriesFollowed(inProps) {
|
|
|
129
128
|
if (scUserContext.user['id'] === userId) {
|
|
130
129
|
setCategories(categories.filter(c => c.id !== category.id));
|
|
131
130
|
setTotal(prev => prev - 1);
|
|
132
|
-
|
|
133
|
-
if (visibleCategories < limit && total > 1) {
|
|
134
|
-
loadCategories(1);
|
|
135
|
-
}
|
|
131
|
+
setHasMore(total - 1 > limit);
|
|
136
132
|
} else {
|
|
137
133
|
const newCategories = [...categories];
|
|
138
134
|
const index = newCategories.findIndex(u => u.id === category.id);
|
|
139
135
|
|
|
140
136
|
if (index !== -1) {
|
|
141
|
-
console.log(category.followed);
|
|
142
|
-
|
|
143
137
|
if (category.followed) {
|
|
144
138
|
newCategories[index].followers_counter = category.followers_counter - 1;
|
|
145
139
|
newCategories[index].followed = !category.followed;
|
|
@@ -167,7 +161,7 @@ function CategoriesFollowed(inProps) {
|
|
|
167
161
|
setCategories([...categories, ...data]);
|
|
168
162
|
setTotal(data.length);
|
|
169
163
|
setNext(data['next']);
|
|
170
|
-
setHasMore(data.length >
|
|
164
|
+
setHasMore(data.length > limit);
|
|
171
165
|
setLoading(false);
|
|
172
166
|
}).catch(error => {
|
|
173
167
|
setLoading(false);
|
|
@@ -176,17 +170,6 @@ function CategoriesFollowed(inProps) {
|
|
|
176
170
|
});
|
|
177
171
|
}
|
|
178
172
|
}
|
|
179
|
-
/**
|
|
180
|
-
* Loads more categories when followed list changes
|
|
181
|
-
*/
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
function loadCategories(n) {
|
|
185
|
-
const newIndex = visibleCategories + n;
|
|
186
|
-
const newHasMore = newIndex < categories.length - 1;
|
|
187
|
-
setVisibleCategories(newIndex);
|
|
188
|
-
setHasMore(newHasMore);
|
|
189
|
-
}
|
|
190
173
|
/**
|
|
191
174
|
* On mount, fetches the list of categories followed
|
|
192
175
|
*/
|
|
@@ -209,7 +192,7 @@ function CategoriesFollowed(inProps) {
|
|
|
209
192
|
})}`), !total ? /*#__PURE__*/_react.default.createElement(_material.Typography, {
|
|
210
193
|
className: classes.noResults,
|
|
211
194
|
variant: "body2"
|
|
212
|
-
}, `${intl.formatMessage(messages.noCategories)}`) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_List.default, null, categories.slice(0,
|
|
195
|
+
}, `${intl.formatMessage(messages.noCategories)}`) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_List.default, null, categories.slice(0, limit).map(category => /*#__PURE__*/_react.default.createElement(_material.ListItem, {
|
|
213
196
|
key: category.id
|
|
214
197
|
}, /*#__PURE__*/_react.default.createElement(_Category.default, _extends({
|
|
215
198
|
elevation: 0,
|
|
@@ -110,10 +110,7 @@ function CategoriesSuggestion(inProps) {
|
|
|
110
110
|
function handleOnFollowCategory(category, follow) {
|
|
111
111
|
setCategories(categories.filter(c => c.id !== category.id));
|
|
112
112
|
setTotal(prev => prev - 1);
|
|
113
|
-
|
|
114
|
-
if (visibleCategories < limit && total > 1) {
|
|
115
|
-
loadCategories(1);
|
|
116
|
-
}
|
|
113
|
+
setHasMore(total - 1 > limit);
|
|
117
114
|
}
|
|
118
115
|
/**
|
|
119
116
|
* Fetches categories suggestion list
|
|
@@ -117,7 +117,7 @@ const Root = (0, _styles.styled)(_material.Box, {
|
|
|
117
117
|
[`& .${classes.nestedComments}`]: {
|
|
118
118
|
paddingTop: 0,
|
|
119
119
|
paddingBottom: 0,
|
|
120
|
-
paddingLeft:
|
|
120
|
+
paddingLeft: 25,
|
|
121
121
|
'& ul.MuiList-root': {
|
|
122
122
|
paddingTop: 0,
|
|
123
123
|
paddingBottom: 0,
|
|
@@ -125,6 +125,9 @@ const Root = (0, _styles.styled)(_material.Box, {
|
|
|
125
125
|
'& li.MuiListItem-root': {
|
|
126
126
|
paddingTop: 5
|
|
127
127
|
}
|
|
128
|
+
},
|
|
129
|
+
[theme.breakpoints.up('sm')]: {
|
|
130
|
+
paddingLeft: 55
|
|
128
131
|
}
|
|
129
132
|
},
|
|
130
133
|
[`& .${classes.content}`]: {
|
|
@@ -775,7 +775,7 @@ function FeedObject(inProps) {
|
|
|
775
775
|
className: classes.mediasSection
|
|
776
776
|
}, /*#__PURE__*/_react.default.createElement(_MediasPreview.default, _extends({
|
|
777
777
|
medias: obj.medias
|
|
778
|
-
},
|
|
778
|
+
}, MediasPreviewProps))), /*#__PURE__*/_react.default.createElement(_material.Box, {
|
|
779
779
|
className: classes.pollsSection
|
|
780
780
|
}, obj['poll'] && /*#__PURE__*/_react.default.createElement(_Poll.default, _extends({
|
|
781
781
|
feedObject: obj,
|
|
@@ -121,10 +121,7 @@ function PeopleSuggestion(inProps) {
|
|
|
121
121
|
function handleOnFollowUser(user, follow) {
|
|
122
122
|
setUsers(users.filter(u => u.id !== user.id));
|
|
123
123
|
setTotal(prev => prev - 1);
|
|
124
|
-
|
|
125
|
-
if (visiblePeople < limit && total > 1) {
|
|
126
|
-
loadPeople(1);
|
|
127
|
-
}
|
|
124
|
+
setHasMore(total - 1 > limit);
|
|
128
125
|
}
|
|
129
126
|
/**
|
|
130
127
|
* Handles list change on user connection
|
|
@@ -134,10 +131,7 @@ function PeopleSuggestion(inProps) {
|
|
|
134
131
|
function handleOnConnectUser(user, status) {
|
|
135
132
|
setUsers(users.filter(u => u.id !== user.id));
|
|
136
133
|
setTotal(prev => prev - 1);
|
|
137
|
-
|
|
138
|
-
if (visiblePeople < limit && total > 1) {
|
|
139
|
-
loadPeople(1);
|
|
140
|
-
}
|
|
134
|
+
setHasMore(total - 1 > limit);
|
|
141
135
|
}
|
|
142
136
|
/**
|
|
143
137
|
* Fetches user suggestion list
|
|
@@ -123,7 +123,6 @@ function UsersFollowed(inProps) {
|
|
|
123
123
|
} = props; // STATE
|
|
124
124
|
|
|
125
125
|
const [followed, setFollowed] = (0, _react.useState)([]);
|
|
126
|
-
const [visibleUsers, setVisibleUsers] = (0, _react.useState)(limit);
|
|
127
126
|
const [loading, setLoading] = (0, _react.useState)(true);
|
|
128
127
|
const [hasMore, setHasMore] = (0, _react.useState)(false);
|
|
129
128
|
const [total, setTotal] = (0, _react.useState)(0);
|
|
@@ -139,10 +138,7 @@ function UsersFollowed(inProps) {
|
|
|
139
138
|
if (scUserContext.user['id'] === userId) {
|
|
140
139
|
setFollowed(followed.filter(u => u.id !== user.id));
|
|
141
140
|
setTotal(prev => prev - 1);
|
|
142
|
-
|
|
143
|
-
if (visibleUsers < limit && total > 1) {
|
|
144
|
-
loadUsers(1);
|
|
145
|
-
}
|
|
141
|
+
setHasMore(total - 1 > limit);
|
|
146
142
|
} else {
|
|
147
143
|
const newUsers = [...followed];
|
|
148
144
|
const index = newUsers.findIndex(u => u.id === user.id);
|
|
@@ -173,7 +169,7 @@ function UsersFollowed(inProps) {
|
|
|
173
169
|
}).then(res => {
|
|
174
170
|
const data = res.data;
|
|
175
171
|
setFollowed([...followed, ...data.results]);
|
|
176
|
-
setHasMore(data.count >
|
|
172
|
+
setHasMore(data.count > limit);
|
|
177
173
|
setNext(data['next']);
|
|
178
174
|
setLoading(false);
|
|
179
175
|
setTotal(data.count);
|
|
@@ -184,17 +180,6 @@ function UsersFollowed(inProps) {
|
|
|
184
180
|
});
|
|
185
181
|
}
|
|
186
182
|
}
|
|
187
|
-
/**
|
|
188
|
-
* Loads more users when followed list changes
|
|
189
|
-
*/
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
function loadUsers(n) {
|
|
193
|
-
const newIndex = visibleUsers + n;
|
|
194
|
-
const newHasMore = newIndex < followed.length - 1;
|
|
195
|
-
setVisibleUsers(newIndex);
|
|
196
|
-
setHasMore(newHasMore);
|
|
197
|
-
}
|
|
198
183
|
/**
|
|
199
184
|
* On mount, fetches the list of users followed
|
|
200
185
|
*/
|
|
@@ -221,7 +206,7 @@ function UsersFollowed(inProps) {
|
|
|
221
206
|
})}`), !total ? /*#__PURE__*/_react.default.createElement(_material.Typography, {
|
|
222
207
|
className: classes.noResults,
|
|
223
208
|
variant: "body2"
|
|
224
|
-
}, `${intl.formatMessage(messages.noUsers)}`) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_List.default, null, followed.slice(0,
|
|
209
|
+
}, `${intl.formatMessage(messages.noUsers)}`) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_List.default, null, followed.slice(0, limit).map(user => /*#__PURE__*/_react.default.createElement(_material.ListItem, {
|
|
225
210
|
key: user.id
|
|
226
211
|
}, /*#__PURE__*/_react.default.createElement(_User.default, _extends({
|
|
227
212
|
elevation: 0,
|
|
@@ -85,7 +85,7 @@ const Root = (0, _styles.styled)(_Widget.default, {
|
|
|
85
85
|
height: 30
|
|
86
86
|
}
|
|
87
87
|
}));
|
|
88
|
-
const PREFERENCES = [_reactCore.SCPreferences.
|
|
88
|
+
const PREFERENCES = [_reactCore.SCPreferences.LOGO_NAVBAR_LOGO_MOBILE, _reactCore.SCPreferences.TEXT_APPLICATION_NAME];
|
|
89
89
|
|
|
90
90
|
function Message(props) {
|
|
91
91
|
// PROPS
|
|
@@ -181,7 +181,7 @@ function Message(props) {
|
|
|
181
181
|
className: classes.header,
|
|
182
182
|
avatar: /*#__PURE__*/_react.default.createElement(_material.Avatar, {
|
|
183
183
|
alt: preferences[_reactCore.SCPreferences.TEXT_APPLICATION_NAME],
|
|
184
|
-
src: preferences[_reactCore.SCPreferences.
|
|
184
|
+
src: preferences[_reactCore.SCPreferences.LOGO_NAVBAR_LOGO_MOBILE_MOBILE]
|
|
185
185
|
}),
|
|
186
186
|
action: template === _types.SCBroadcastMessageTemplateType.DETAIL && /*#__PURE__*/_react.default.createElement(_material.IconButton, {
|
|
187
187
|
"aria-label": "close",
|
|
@@ -111,7 +111,6 @@ function CategoriesFollowed(inProps) {
|
|
|
111
111
|
} = props; // STATE
|
|
112
112
|
|
|
113
113
|
const [categories, setCategories] = (0, _react.useState)([]);
|
|
114
|
-
const [visibleCategories, setVisibleCategories] = (0, _react.useState)(limit);
|
|
115
114
|
const [loading, setLoading] = (0, _react.useState)(true);
|
|
116
115
|
const [hasMore, setHasMore] = (0, _react.useState)(false);
|
|
117
116
|
const [total, setTotal] = (0, _react.useState)(0);
|
|
@@ -129,17 +128,12 @@ function CategoriesFollowed(inProps) {
|
|
|
129
128
|
if (scUserContext.user['id'] === userId) {
|
|
130
129
|
setCategories(categories.filter(c => c.id !== category.id));
|
|
131
130
|
setTotal(prev => prev - 1);
|
|
132
|
-
|
|
133
|
-
if (visibleCategories < limit && total > 1) {
|
|
134
|
-
loadCategories(1);
|
|
135
|
-
}
|
|
131
|
+
setHasMore(total - 1 > limit);
|
|
136
132
|
} else {
|
|
137
133
|
const newCategories = [...categories];
|
|
138
134
|
const index = newCategories.findIndex(u => u.id === category.id);
|
|
139
135
|
|
|
140
136
|
if (index !== -1) {
|
|
141
|
-
console.log(category.followed);
|
|
142
|
-
|
|
143
137
|
if (category.followed) {
|
|
144
138
|
newCategories[index].followers_counter = category.followers_counter - 1;
|
|
145
139
|
newCategories[index].followed = !category.followed;
|
|
@@ -167,7 +161,7 @@ function CategoriesFollowed(inProps) {
|
|
|
167
161
|
setCategories([...categories, ...data]);
|
|
168
162
|
setTotal(data.length);
|
|
169
163
|
setNext(data['next']);
|
|
170
|
-
setHasMore(data.length >
|
|
164
|
+
setHasMore(data.length > limit);
|
|
171
165
|
setLoading(false);
|
|
172
166
|
}).catch(error => {
|
|
173
167
|
setLoading(false);
|
|
@@ -176,17 +170,6 @@ function CategoriesFollowed(inProps) {
|
|
|
176
170
|
});
|
|
177
171
|
}
|
|
178
172
|
}
|
|
179
|
-
/**
|
|
180
|
-
* Loads more categories when followed list changes
|
|
181
|
-
*/
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
function loadCategories(n) {
|
|
185
|
-
const newIndex = visibleCategories + n;
|
|
186
|
-
const newHasMore = newIndex < categories.length - 1;
|
|
187
|
-
setVisibleCategories(newIndex);
|
|
188
|
-
setHasMore(newHasMore);
|
|
189
|
-
}
|
|
190
173
|
/**
|
|
191
174
|
* On mount, fetches the list of categories followed
|
|
192
175
|
*/
|
|
@@ -209,7 +192,7 @@ function CategoriesFollowed(inProps) {
|
|
|
209
192
|
})}`), !total ? /*#__PURE__*/_react.default.createElement(_material.Typography, {
|
|
210
193
|
className: classes.noResults,
|
|
211
194
|
variant: "body2"
|
|
212
|
-
}, `${intl.formatMessage(messages.noCategories)}`) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_List.default, null, categories.slice(0,
|
|
195
|
+
}, `${intl.formatMessage(messages.noCategories)}`) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_List.default, null, categories.slice(0, limit).map(category => /*#__PURE__*/_react.default.createElement(_material.ListItem, {
|
|
213
196
|
key: category.id
|
|
214
197
|
}, /*#__PURE__*/_react.default.createElement(_Category.default, _extends({
|
|
215
198
|
elevation: 0,
|
|
@@ -110,10 +110,7 @@ function CategoriesSuggestion(inProps) {
|
|
|
110
110
|
function handleOnFollowCategory(category, follow) {
|
|
111
111
|
setCategories(categories.filter(c => c.id !== category.id));
|
|
112
112
|
setTotal(prev => prev - 1);
|
|
113
|
-
|
|
114
|
-
if (visibleCategories < limit && total > 1) {
|
|
115
|
-
loadCategories(1);
|
|
116
|
-
}
|
|
113
|
+
setHasMore(total - 1 > limit);
|
|
117
114
|
}
|
|
118
115
|
/**
|
|
119
116
|
* Fetches categories suggestion list
|
|
@@ -117,7 +117,7 @@ const Root = (0, _styles.styled)(_material.Box, {
|
|
|
117
117
|
[`& .${classes.nestedComments}`]: {
|
|
118
118
|
paddingTop: 0,
|
|
119
119
|
paddingBottom: 0,
|
|
120
|
-
paddingLeft:
|
|
120
|
+
paddingLeft: 25,
|
|
121
121
|
'& ul.MuiList-root': {
|
|
122
122
|
paddingTop: 0,
|
|
123
123
|
paddingBottom: 0,
|
|
@@ -125,6 +125,9 @@ const Root = (0, _styles.styled)(_material.Box, {
|
|
|
125
125
|
'& li.MuiListItem-root': {
|
|
126
126
|
paddingTop: 5
|
|
127
127
|
}
|
|
128
|
+
},
|
|
129
|
+
[theme.breakpoints.up('sm')]: {
|
|
130
|
+
paddingLeft: 55
|
|
128
131
|
}
|
|
129
132
|
},
|
|
130
133
|
[`& .${classes.content}`]: {
|
|
@@ -775,7 +775,7 @@ function FeedObject(inProps) {
|
|
|
775
775
|
className: classes.mediasSection
|
|
776
776
|
}, /*#__PURE__*/_react.default.createElement(_MediasPreview.default, _extends({
|
|
777
777
|
medias: obj.medias
|
|
778
|
-
},
|
|
778
|
+
}, MediasPreviewProps))), /*#__PURE__*/_react.default.createElement(_material.Box, {
|
|
779
779
|
className: classes.pollsSection
|
|
780
780
|
}, obj['poll'] && /*#__PURE__*/_react.default.createElement(_Poll.default, _extends({
|
|
781
781
|
feedObject: obj,
|
|
@@ -121,10 +121,7 @@ function PeopleSuggestion(inProps) {
|
|
|
121
121
|
function handleOnFollowUser(user, follow) {
|
|
122
122
|
setUsers(users.filter(u => u.id !== user.id));
|
|
123
123
|
setTotal(prev => prev - 1);
|
|
124
|
-
|
|
125
|
-
if (visiblePeople < limit && total > 1) {
|
|
126
|
-
loadPeople(1);
|
|
127
|
-
}
|
|
124
|
+
setHasMore(total - 1 > limit);
|
|
128
125
|
}
|
|
129
126
|
/**
|
|
130
127
|
* Handles list change on user connection
|
|
@@ -134,10 +131,7 @@ function PeopleSuggestion(inProps) {
|
|
|
134
131
|
function handleOnConnectUser(user, status) {
|
|
135
132
|
setUsers(users.filter(u => u.id !== user.id));
|
|
136
133
|
setTotal(prev => prev - 1);
|
|
137
|
-
|
|
138
|
-
if (visiblePeople < limit && total > 1) {
|
|
139
|
-
loadPeople(1);
|
|
140
|
-
}
|
|
134
|
+
setHasMore(total - 1 > limit);
|
|
141
135
|
}
|
|
142
136
|
/**
|
|
143
137
|
* Fetches user suggestion list
|
|
@@ -123,7 +123,6 @@ function UsersFollowed(inProps) {
|
|
|
123
123
|
} = props; // STATE
|
|
124
124
|
|
|
125
125
|
const [followed, setFollowed] = (0, _react.useState)([]);
|
|
126
|
-
const [visibleUsers, setVisibleUsers] = (0, _react.useState)(limit);
|
|
127
126
|
const [loading, setLoading] = (0, _react.useState)(true);
|
|
128
127
|
const [hasMore, setHasMore] = (0, _react.useState)(false);
|
|
129
128
|
const [total, setTotal] = (0, _react.useState)(0);
|
|
@@ -139,10 +138,7 @@ function UsersFollowed(inProps) {
|
|
|
139
138
|
if (scUserContext.user['id'] === userId) {
|
|
140
139
|
setFollowed(followed.filter(u => u.id !== user.id));
|
|
141
140
|
setTotal(prev => prev - 1);
|
|
142
|
-
|
|
143
|
-
if (visibleUsers < limit && total > 1) {
|
|
144
|
-
loadUsers(1);
|
|
145
|
-
}
|
|
141
|
+
setHasMore(total - 1 > limit);
|
|
146
142
|
} else {
|
|
147
143
|
const newUsers = [...followed];
|
|
148
144
|
const index = newUsers.findIndex(u => u.id === user.id);
|
|
@@ -173,7 +169,7 @@ function UsersFollowed(inProps) {
|
|
|
173
169
|
}).then(res => {
|
|
174
170
|
const data = res.data;
|
|
175
171
|
setFollowed([...followed, ...data.results]);
|
|
176
|
-
setHasMore(data.count >
|
|
172
|
+
setHasMore(data.count > limit);
|
|
177
173
|
setNext(data['next']);
|
|
178
174
|
setLoading(false);
|
|
179
175
|
setTotal(data.count);
|
|
@@ -184,17 +180,6 @@ function UsersFollowed(inProps) {
|
|
|
184
180
|
});
|
|
185
181
|
}
|
|
186
182
|
}
|
|
187
|
-
/**
|
|
188
|
-
* Loads more users when followed list changes
|
|
189
|
-
*/
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
function loadUsers(n) {
|
|
193
|
-
const newIndex = visibleUsers + n;
|
|
194
|
-
const newHasMore = newIndex < followed.length - 1;
|
|
195
|
-
setVisibleUsers(newIndex);
|
|
196
|
-
setHasMore(newHasMore);
|
|
197
|
-
}
|
|
198
183
|
/**
|
|
199
184
|
* On mount, fetches the list of users followed
|
|
200
185
|
*/
|
|
@@ -221,7 +206,7 @@ function UsersFollowed(inProps) {
|
|
|
221
206
|
})}`), !total ? /*#__PURE__*/_react.default.createElement(_material.Typography, {
|
|
222
207
|
className: classes.noResults,
|
|
223
208
|
variant: "body2"
|
|
224
|
-
}, `${intl.formatMessage(messages.noUsers)}`) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_List.default, null, followed.slice(0,
|
|
209
|
+
}, `${intl.formatMessage(messages.noUsers)}`) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_List.default, null, followed.slice(0, limit).map(user => /*#__PURE__*/_react.default.createElement(_material.ListItem, {
|
|
225
210
|
key: user.id
|
|
226
211
|
}, /*#__PURE__*/_react.default.createElement(_User.default, _extends({
|
|
227
212
|
elevation: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Message.d.ts","sourceRoot":"","sources":["../../../../../../src/components/BroadcastMessages/Message.tsx"],"names":[],"mappings":"AACA,OAAO,EAML,SAAS,EASV,MAAM,eAAe,CAAC;AAOvB,OAAO,EAAC,8BAA8B,EAAC,MAAM,aAAa,CAAC;AAG3D,OAAO,EAAC,sBAAsB,EAAC,MAAM,sBAAsB,CAAC;AA0D5D,MAAM,WAAW,YAAa,SAAQ,SAAS;IAC7C;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,OAAO,EAAE,sBAAsB,CAAC;IAEhC;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,sBAAsB,KAAK,IAAI,CAAC;IAEpD;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,sBAAsB,KAAK,IAAI,CAAC;IAEnD;;;OAGG;IACH,QAAQ,CAAC,EAAE,8BAA8B,CAAC;IAE1C;;OAEG;IACH,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CAClB;AAID,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"Message.d.ts","sourceRoot":"","sources":["../../../../../../src/components/BroadcastMessages/Message.tsx"],"names":[],"mappings":"AACA,OAAO,EAML,SAAS,EASV,MAAM,eAAe,CAAC;AAOvB,OAAO,EAAC,8BAA8B,EAAC,MAAM,aAAa,CAAC;AAG3D,OAAO,EAAC,sBAAsB,EAAC,MAAM,sBAAsB,CAAC;AA0D5D,MAAM,WAAW,YAAa,SAAQ,SAAS;IAC7C;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,OAAO,EAAE,sBAAsB,CAAC;IAEhC;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,sBAAsB,KAAK,IAAI,CAAC;IAEpD;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,sBAAsB,KAAK,IAAI,CAAC;IAEnD;;;OAGG;IACH,QAAQ,CAAC,EAAE,8BAA8B,CAAC;IAE1C;;OAEG;IACH,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CAClB;AAID,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO,CA2IhE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CategoriesFollowed.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CategoriesFollowed/CategoriesFollowed.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAC,mBAAmB,EAAC,MAAM,yBAAyB,CAAC;AAoC5D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,GAAG,GAAG,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"CategoriesFollowed.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CategoriesFollowed/CategoriesFollowed.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAC,mBAAmB,EAAC,MAAM,yBAAyB,CAAC;AAoC5D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,GAAG,GAAG,CAAC,OAAO,CAoKpF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CategoriesSuggestion.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CategoriesSuggestion/CategoriesSuggestion.tsx"],"names":[],"mappings":"AAOA,OAAiB,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAuBpD,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAE9B;;OAEG;IACH,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,OAAO,EAAE,mBAAmB,GAAG,GAAG,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"CategoriesSuggestion.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CategoriesSuggestion/CategoriesSuggestion.tsx"],"names":[],"mappings":"AAOA,OAAiB,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAuBpD,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAE9B;;OAEG;IACH,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,OAAO,EAAE,mBAAmB,GAAG,GAAG,CAAC,OAAO,CA+HtF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommentObject.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CommentObject/CommentObject.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAmC,SAAS,EAAsB,MAAM,eAAe,CAAC;AAQ/F,OAAO,EAAC,iBAAiB,EAAC,MAAM,sBAAsB,CAAC;AASvD,OAAO,EAAC,aAAa,EAAyB,gBAAgB,EAAE,wBAAwB,EAAC,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"CommentObject.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CommentObject/CommentObject.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAmC,SAAS,EAAsB,MAAM,eAAe,CAAC;AAQ/F,OAAO,EAAC,iBAAiB,EAAC,MAAM,sBAAsB,CAAC;AASvD,OAAO,EAAC,aAAa,EAAyB,gBAAgB,EAAE,wBAAwB,EAAC,MAAM,sBAAsB,CAAC;AA4ItH,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;OAGG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAE9B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAE9B;;;OAGG;IACH,cAAc,CAAC,EAAE,wBAAwB,CAAC;IAE1C;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;OAGG;IACH,eAAe,CAAC,EAAE,iBAAiB,CAAC;IAEpC;;;;OAIG;IACH,YAAY,CAAC,EAAE,aAAa,CAAC;IAE7B;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAC;IAE/C;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAC;IAE1C;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAC;IAE5C;;;OAGG;IACH,0BAA0B,CAAC,EAAE,SAAS,CAAC;IAEvC;;;OAGG;IACH,uBAAuB,CAAC,EAAE,SAAS,CAAC;IAEpC;;;OAGG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAElC;;OAEG;IACH,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,OAAO,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CAse9E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PeopleSuggestion.d.ts","sourceRoot":"","sources":["../../../../../../src/components/PeopleSuggestion/PeopleSuggestion.tsx"],"names":[],"mappings":"AAOA,OAAa,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AA2BxC,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB;;OAEG;IACH,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,OAAO,EAAE,qBAAqB,GAAG,GAAG,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"PeopleSuggestion.d.ts","sourceRoot":"","sources":["../../../../../../src/components/PeopleSuggestion/PeopleSuggestion.tsx"],"names":[],"mappings":"AAOA,OAAa,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AA2BxC,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB;;OAEG;IACH,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,OAAO,EAAE,qBAAqB,GAAG,GAAG,CAAC,OAAO,CAmJpF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UsersFollowed.d.ts","sourceRoot":"","sources":["../../../../../../src/components/UsersFollowed/UsersFollowed.tsx"],"names":[],"mappings":"AASA,OAAa,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAyCxC,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,OAAO,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"UsersFollowed.d.ts","sourceRoot":"","sources":["../../../../../../src/components/UsersFollowed/UsersFollowed.tsx"],"names":[],"mappings":"AASA,OAAa,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAyCxC,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,OAAO,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CA4L9E"}
|