Add explore page to web UI (#17123)
* Add explore page to web UI * Fix not removing loaded statuses from trends on mute/block action
This commit is contained in:
parent
27965ce5ed
commit
d4592bbfcd
22 changed files with 727 additions and 63 deletions
|
@ -1,22 +1,45 @@
|
|||
import { TRENDS_FETCH_REQUEST, TRENDS_FETCH_SUCCESS, TRENDS_FETCH_FAIL } from '../actions/trends';
|
||||
import {
|
||||
TRENDS_TAGS_FETCH_REQUEST,
|
||||
TRENDS_TAGS_FETCH_SUCCESS,
|
||||
TRENDS_TAGS_FETCH_FAIL,
|
||||
TRENDS_LINKS_FETCH_REQUEST,
|
||||
TRENDS_LINKS_FETCH_SUCCESS,
|
||||
TRENDS_LINKS_FETCH_FAIL,
|
||||
} from 'mastodon/actions/trends';
|
||||
import { Map as ImmutableMap, List as ImmutableList, fromJS } from 'immutable';
|
||||
|
||||
const initialState = ImmutableMap({
|
||||
items: ImmutableList(),
|
||||
isLoading: false,
|
||||
tags: ImmutableMap({
|
||||
items: ImmutableList(),
|
||||
isLoading: false,
|
||||
}),
|
||||
|
||||
links: ImmutableMap({
|
||||
items: ImmutableList(),
|
||||
isLoading: false,
|
||||
}),
|
||||
});
|
||||
|
||||
export default function trendsReducer(state = initialState, action) {
|
||||
switch(action.type) {
|
||||
case TRENDS_FETCH_REQUEST:
|
||||
return state.set('isLoading', true);
|
||||
case TRENDS_FETCH_SUCCESS:
|
||||
case TRENDS_TAGS_FETCH_REQUEST:
|
||||
return state.setIn(['tags', 'isLoading'], true);
|
||||
case TRENDS_TAGS_FETCH_SUCCESS:
|
||||
return state.withMutations(map => {
|
||||
map.set('items', fromJS(action.trends));
|
||||
map.set('isLoading', false);
|
||||
map.setIn(['tags', 'items'], fromJS(action.trends));
|
||||
map.setIn(['tags', 'isLoading'], false);
|
||||
});
|
||||
case TRENDS_FETCH_FAIL:
|
||||
return state.set('isLoading', false);
|
||||
case TRENDS_TAGS_FETCH_FAIL:
|
||||
return state.setIn(['tags', 'isLoading'], false);
|
||||
case TRENDS_LINKS_FETCH_REQUEST:
|
||||
return state.setIn(['links', 'isLoading'], true);
|
||||
case TRENDS_LINKS_FETCH_SUCCESS:
|
||||
return state.withMutations(map => {
|
||||
map.setIn(['links', 'items'], fromJS(action.trends));
|
||||
map.setIn(['links', 'isLoading'], false);
|
||||
});
|
||||
case TRENDS_LINKS_FETCH_FAIL:
|
||||
return state.setIn(['links', 'isLoading'], false);
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue