Progress
This commit is contained in:
@@ -54,6 +54,7 @@ const initialState = ImmutableMap({
|
||||
spoiler_text: '',
|
||||
privacy: null,
|
||||
text: '',
|
||||
markdown_text: '',
|
||||
focusDate: null,
|
||||
caretPosition: null,
|
||||
preselectDate: null,
|
||||
@@ -75,6 +76,7 @@ const initialState = ImmutableMap({
|
||||
tagHistory: ImmutableList(),
|
||||
scheduled_at: null,
|
||||
rte_controls_visible: false,
|
||||
gif: null,
|
||||
});
|
||||
|
||||
const initialPoll = ImmutableMap({
|
||||
@@ -298,6 +300,7 @@ export default function compose(state = initialState, action) {
|
||||
map.set('poll', null);
|
||||
map.set('idempotencyKey', uuid());
|
||||
map.set('scheduled_at', null);
|
||||
map.set('rte_controls_visible', false);
|
||||
});
|
||||
case COMPOSE_SUBMIT_REQUEST:
|
||||
return state.set('is_submitting', true);
|
||||
@@ -389,7 +392,9 @@ export default function compose(state = initialState, action) {
|
||||
case COMPOSE_SCHEDULED_AT_CHANGE:
|
||||
return state.set('scheduled_at', action.date);
|
||||
case COMPOSE_RICH_TEXT_EDITOR_CONTROLS_VISIBILITY:
|
||||
return ''
|
||||
return state.withMutations(map => {
|
||||
map.set('rte_controls_visible', !state.get('rte_controls_visible'));
|
||||
});
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
||||
55
app/javascript/gabsocial/reducers/gab_trends.js
Normal file
55
app/javascript/gabsocial/reducers/gab_trends.js
Normal file
@@ -0,0 +1,55 @@
|
||||
import {
|
||||
GIFS_CLEAR_RESULTS,
|
||||
GIF_SET_SELECTED,
|
||||
GIF_CHANGE_SEARCH_TEXT,
|
||||
GIF_RESULTS_FETCH_REQUEST,
|
||||
GIF_RESULTS_FETCH_SUCCESS,
|
||||
GIF_RESULTS_FETCH_FAIL,
|
||||
GIF_CATEGORIES_FETCH_REQUEST,
|
||||
GIF_CATEGORIES_FETCH_SUCCESS,
|
||||
GIF_CATEGORIES_FETCH_FAIL
|
||||
} from '../actions/tenor'
|
||||
import { Map as ImmutableMap } from 'immutable'
|
||||
|
||||
const initialState = ImmutableMap({
|
||||
categories: [],
|
||||
results: [],
|
||||
chosenUrl: '',
|
||||
searchText: '',
|
||||
loading: false,
|
||||
error: false,
|
||||
})
|
||||
|
||||
export default function (state = initialState, action) {
|
||||
switch (action.type) {
|
||||
case GIF_RESULTS_FETCH_REQUEST:
|
||||
case GIF_CATEGORIES_FETCH_REQUEST:
|
||||
return state.set('loading', true)
|
||||
case GIF_RESULTS_FETCH_SUCCESS:
|
||||
return state.withMutations(map => {
|
||||
map.set('results', action.results);
|
||||
map.set('error', false);
|
||||
map.set('loading', false);
|
||||
});
|
||||
case GIF_CATEGORIES_FETCH_SUCCESS:
|
||||
return state.withMutations(map => {
|
||||
map.set('categories', action.categories);
|
||||
map.set('error', false);
|
||||
map.set('loading', false);
|
||||
});
|
||||
case GIF_RESULTS_FETCH_FAIL:
|
||||
case GIF_CATEGORIES_FETCH_FAIL:
|
||||
return state.withMutations(map => {
|
||||
map.set('error', !!action.error);
|
||||
map.set('loading', false);
|
||||
});
|
||||
case GIFS_CLEAR_RESULTS:
|
||||
return state.set('results', [])
|
||||
case GIF_SET_SELECTED:
|
||||
return state.set('chosenUrl', action.url)
|
||||
case GIF_CHANGE_SEARCH_TEXT:
|
||||
return state.set('searchText', action.text.trim());
|
||||
default:
|
||||
return state
|
||||
}
|
||||
}
|
||||
@@ -2,32 +2,32 @@ import {
|
||||
GROUP_FETCH_SUCCESS,
|
||||
GROUP_FETCH_FAIL,
|
||||
GROUPS_FETCH_SUCCESS,
|
||||
} from '../actions/groups';
|
||||
import { GROUP_UPDATE_SUCCESS } from '../actions/group_editor';
|
||||
import { Map as ImmutableMap, fromJS } from 'immutable';
|
||||
} from '../actions/groups'
|
||||
import { GROUP_UPDATE_SUCCESS } from '../actions/group_editor'
|
||||
import { Map as ImmutableMap, fromJS } from 'immutable'
|
||||
|
||||
const initialState = ImmutableMap();
|
||||
const initialState = ImmutableMap()
|
||||
|
||||
const normalizeGroup = (state, group) => state.set(group.id, fromJS(group));
|
||||
const normalizeGroup = (state, group) => state.set(group.id, fromJS(group))
|
||||
|
||||
const normalizeGroups = (state, groups) => {
|
||||
groups.forEach(group => {
|
||||
state = normalizeGroup(state, group);
|
||||
});
|
||||
state = normalizeGroup(state, group)
|
||||
})
|
||||
|
||||
return state;
|
||||
};
|
||||
return state
|
||||
}
|
||||
|
||||
export default function groups(state = initialState, action) {
|
||||
switch(action.type) {
|
||||
case GROUP_FETCH_SUCCESS:
|
||||
case GROUP_UPDATE_SUCCESS:
|
||||
return normalizeGroup(state, action.group);
|
||||
return normalizeGroup(state, action.group)
|
||||
case GROUPS_FETCH_SUCCESS:
|
||||
return normalizeGroups(state, action.groups);
|
||||
return normalizeGroups(state, action.groups)
|
||||
case GROUP_FETCH_FAIL:
|
||||
return state.set(action.id, false);
|
||||
return state.set(action.id, false)
|
||||
default:
|
||||
return state;
|
||||
return state
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,82 +1,84 @@
|
||||
import { combineReducers } from 'redux-immutable'
|
||||
import popover from './popover'
|
||||
import timelines from './timelines'
|
||||
import meta from './meta'
|
||||
import { loadingBarReducer } from 'react-redux-loading-bar'
|
||||
import modal from './modal'
|
||||
import user_lists from './user_lists'
|
||||
import domain_lists from './domain_lists'
|
||||
import accounts from './accounts'
|
||||
import accounts_counters from './accounts_counters'
|
||||
import statuses from './statuses'
|
||||
import relationships from './relationships'
|
||||
import settings from './settings'
|
||||
import push_notifications from './push_notifications'
|
||||
import status_lists from './status_lists'
|
||||
import mutes from './mutes'
|
||||
import reports from './reports'
|
||||
import contexts from './contexts'
|
||||
import compose from './compose'
|
||||
import search from './search'
|
||||
import media_attachments from './media_attachments'
|
||||
import notifications from './notifications'
|
||||
import height_cache from './height_cache'
|
||||
import custom_emojis from './custom_emojis'
|
||||
import lists from './lists'
|
||||
import listEditor from './list_editor'
|
||||
import listAdder from './list_adder'
|
||||
import filters from './filters'
|
||||
import contexts from './contexts'
|
||||
import conversations from './conversations'
|
||||
import suggestions from './suggestions'
|
||||
import polls from './polls'
|
||||
import identity_proofs from './identity_proofs'
|
||||
import hashtags from './hashtags'
|
||||
import custom_emojis from './custom_emojis'
|
||||
import domain_lists from './domain_lists'
|
||||
import filters from './filters'
|
||||
import groups from './groups'
|
||||
import group_relationships from './group_relationships'
|
||||
import group_lists from './group_lists'
|
||||
import group_editor from './group_editor'
|
||||
import group_lists from './group_lists'
|
||||
import group_relationships from './group_relationships'
|
||||
import hashtags from './hashtags'
|
||||
import height_cache from './height_cache'
|
||||
import identity_proofs from './identity_proofs'
|
||||
import lists from './lists'
|
||||
import listAdder from './list_adder'
|
||||
import listEditor from './list_editor'
|
||||
import media_attachments from './media_attachments'
|
||||
import meta from './meta'
|
||||
import modal from './modal'
|
||||
import mutes from './mutes'
|
||||
import notifications from './notifications'
|
||||
import polls from './polls'
|
||||
import popover from './popover'
|
||||
import push_notifications from './push_notifications'
|
||||
import relationships from './relationships'
|
||||
import reports from './reports'
|
||||
import search from './search'
|
||||
import settings from './settings'
|
||||
import sidebar from './sidebar'
|
||||
import statuses from './statuses'
|
||||
import status_lists from './status_lists'
|
||||
import status_revisions from './status_revisions'
|
||||
import suggestions from './suggestions'
|
||||
import tenor from './tenor'
|
||||
import timelines from './timelines'
|
||||
import user_lists from './user_lists'
|
||||
|
||||
const reducers = {
|
||||
popover,
|
||||
timelines,
|
||||
meta,
|
||||
loadingBar: loadingBarReducer,
|
||||
modal,
|
||||
user_lists,
|
||||
domain_lists,
|
||||
status_lists,
|
||||
accounts,
|
||||
accounts_counters,
|
||||
statuses,
|
||||
relationships,
|
||||
settings,
|
||||
push_notifications,
|
||||
mutes,
|
||||
reports,
|
||||
contexts,
|
||||
compose,
|
||||
search,
|
||||
media_attachments,
|
||||
notifications,
|
||||
height_cache,
|
||||
contexts,
|
||||
conversations,
|
||||
custom_emojis,
|
||||
domain_lists,
|
||||
filters,
|
||||
groups,
|
||||
group_editor,
|
||||
group_lists,
|
||||
group_relationships,
|
||||
hashtags,
|
||||
height_cache,
|
||||
identity_proofs,
|
||||
lists,
|
||||
listEditor,
|
||||
listAdder,
|
||||
filters,
|
||||
conversations,
|
||||
suggestions,
|
||||
listEditor,
|
||||
loadingBar: loadingBarReducer,
|
||||
media_attachments,
|
||||
meta,
|
||||
modal,
|
||||
mutes,
|
||||
notifications,
|
||||
polls,
|
||||
hashtags,
|
||||
groups,
|
||||
group_relationships,
|
||||
group_lists,
|
||||
group_editor,
|
||||
popover,
|
||||
push_notifications,
|
||||
relationships,
|
||||
reports,
|
||||
search,
|
||||
settings,
|
||||
sidebar,
|
||||
statuses,
|
||||
status_lists,
|
||||
status_revisions,
|
||||
suggestions,
|
||||
tenor,
|
||||
timelines,
|
||||
user_lists,
|
||||
}
|
||||
|
||||
export default combineReducers(reducers)
|
||||
|
||||
55
app/javascript/gabsocial/reducers/tenor.js
Normal file
55
app/javascript/gabsocial/reducers/tenor.js
Normal file
@@ -0,0 +1,55 @@
|
||||
import {
|
||||
GIFS_CLEAR_RESULTS,
|
||||
GIF_SET_SELECTED,
|
||||
GIF_CHANGE_SEARCH_TEXT,
|
||||
GIF_RESULTS_FETCH_REQUEST,
|
||||
GIF_RESULTS_FETCH_SUCCESS,
|
||||
GIF_RESULTS_FETCH_FAIL,
|
||||
GIF_CATEGORIES_FETCH_REQUEST,
|
||||
GIF_CATEGORIES_FETCH_SUCCESS,
|
||||
GIF_CATEGORIES_FETCH_FAIL
|
||||
} from '../actions/tenor'
|
||||
import { Map as ImmutableMap } from 'immutable'
|
||||
|
||||
const initialState = ImmutableMap({
|
||||
categories: [],
|
||||
results: [],
|
||||
chosenUrl: '',
|
||||
searchText: '',
|
||||
loading: false,
|
||||
error: false,
|
||||
})
|
||||
|
||||
export default function (state = initialState, action) {
|
||||
switch (action.type) {
|
||||
case GIF_RESULTS_FETCH_REQUEST:
|
||||
case GIF_CATEGORIES_FETCH_REQUEST:
|
||||
return state.set('loading', true)
|
||||
case GIF_RESULTS_FETCH_SUCCESS:
|
||||
return state.withMutations(map => {
|
||||
map.set('results', action.results);
|
||||
map.set('error', false);
|
||||
map.set('loading', false);
|
||||
});
|
||||
case GIF_CATEGORIES_FETCH_SUCCESS:
|
||||
return state.withMutations(map => {
|
||||
map.set('categories', action.categories);
|
||||
map.set('error', false);
|
||||
map.set('loading', false);
|
||||
});
|
||||
case GIF_RESULTS_FETCH_FAIL:
|
||||
case GIF_CATEGORIES_FETCH_FAIL:
|
||||
return state.withMutations(map => {
|
||||
map.set('error', !!action.error);
|
||||
map.set('loading', false);
|
||||
});
|
||||
case GIFS_CLEAR_RESULTS:
|
||||
return state.set('results', [])
|
||||
case GIF_SET_SELECTED:
|
||||
return state.set('chosenUrl', action.url)
|
||||
case GIF_CHANGE_SEARCH_TEXT:
|
||||
return state.set('searchText', action.text.trim());
|
||||
default:
|
||||
return state
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user