Change onboarding prompt to follow suggestions carousel in web UI (#28878)
This commit is contained in:
parent
7316a08380
commit
9cdc60ecc6
17 changed files with 507 additions and 138 deletions
|
@ -21,6 +21,10 @@ export const TIMELINE_DISCONNECT = 'TIMELINE_DISCONNECT';
|
|||
export const TIMELINE_CONNECT = 'TIMELINE_CONNECT';
|
||||
|
||||
export const TIMELINE_MARK_AS_PARTIAL = 'TIMELINE_MARK_AS_PARTIAL';
|
||||
export const TIMELINE_INSERT = 'TIMELINE_INSERT';
|
||||
|
||||
export const TIMELINE_SUGGESTIONS = 'inline-follow-suggestions';
|
||||
export const TIMELINE_GAP = null;
|
||||
|
||||
export const loadPending = timeline => ({
|
||||
type: TIMELINE_LOAD_PENDING,
|
||||
|
@ -112,9 +116,19 @@ export function expandTimeline(timelineId, path, params = {}, done = noOp) {
|
|||
|
||||
api(getState).get(path, { params }).then(response => {
|
||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||
|
||||
dispatch(importFetchedStatuses(response.data));
|
||||
dispatch(expandTimelineSuccess(timelineId, response.data, next ? next.uri : null, response.status === 206, isLoadingRecent, isLoadingMore, isLoadingRecent && preferPendingItems));
|
||||
|
||||
if (timelineId === 'home' && !isLoadingMore && !isLoadingRecent) {
|
||||
const now = new Date();
|
||||
const fittingIndex = response.data.findIndex(status => now - (new Date(status.created_at)) > 4 * 3600 * 1000);
|
||||
|
||||
if (fittingIndex !== -1) {
|
||||
dispatch(insertIntoTimeline(timelineId, TIMELINE_SUGGESTIONS, Math.max(1, fittingIndex)));
|
||||
}
|
||||
}
|
||||
|
||||
if (timelineId === 'home') {
|
||||
dispatch(submitMarkers());
|
||||
}
|
||||
|
@ -221,3 +235,10 @@ export const markAsPartial = timeline => ({
|
|||
type: TIMELINE_MARK_AS_PARTIAL,
|
||||
timeline,
|
||||
});
|
||||
|
||||
export const insertIntoTimeline = (timeline, key, index) => ({
|
||||
type: TIMELINE_INSERT,
|
||||
timeline,
|
||||
index,
|
||||
key,
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue