Remove Neo4J
This commit is contained in:
@ -1,37 +0,0 @@
|
||||
import api from '../api';
|
||||
|
||||
export const SUGGESTIONS_FETCH_REQUEST = 'SUGGESTIONS_FETCH_REQUEST';
|
||||
export const SUGGESTIONS_FETCH_SUCCESS = 'SUGGESTIONS_FETCH_SUCCESS';
|
||||
export const SUGGESTIONS_FETCH_FAIL = 'SUGGESTIONS_FETCH_FAIL';
|
||||
|
||||
export function fetchSuggestions() {
|
||||
return (dispatch, getState) => {
|
||||
dispatch(fetchSuggestionsRequest());
|
||||
|
||||
api(getState).get('/api/v1/accounts/suggestions').then(response => {
|
||||
dispatch(fetchSuggestionsSuccess(response.data));
|
||||
}).catch(error => {
|
||||
dispatch(fetchSuggestionsFail(error));
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
export function fetchSuggestionsRequest() {
|
||||
return {
|
||||
type: SUGGESTIONS_FETCH_REQUEST
|
||||
};
|
||||
};
|
||||
|
||||
export function fetchSuggestionsSuccess(accounts) {
|
||||
return {
|
||||
type: SUGGESTIONS_FETCH_SUCCESS,
|
||||
accounts: accounts
|
||||
};
|
||||
};
|
||||
|
||||
export function fetchSuggestionsFail(error) {
|
||||
return {
|
||||
type: SUGGESTIONS_FETCH_FAIL,
|
||||
error: error
|
||||
};
|
||||
};
|
@ -1,86 +0,0 @@
|
||||
import PureRenderMixin from 'react-addons-pure-render-mixin';
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import AccountContainer from '../../../containers/account_container';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
|
||||
const outerStyle = {
|
||||
position: 'relative'
|
||||
};
|
||||
|
||||
const headerStyle = {
|
||||
fontSize: '14px',
|
||||
fontWeight: '500',
|
||||
display: 'block',
|
||||
padding: '10px',
|
||||
color: '#9baec8',
|
||||
background: '#454b5e',
|
||||
overflow: 'hidden'
|
||||
};
|
||||
|
||||
const nextStyle = {
|
||||
display: 'inline-block',
|
||||
float: 'right',
|
||||
fontWeight: '400',
|
||||
color: '#2b90d9'
|
||||
};
|
||||
|
||||
const SuggestionsBox = React.createClass({
|
||||
|
||||
propTypes: {
|
||||
accountIds: ImmutablePropTypes.list,
|
||||
perWindow: React.PropTypes.number
|
||||
},
|
||||
|
||||
getInitialState () {
|
||||
return {
|
||||
index: 0
|
||||
};
|
||||
},
|
||||
|
||||
getDefaultProps () {
|
||||
return {
|
||||
perWindow: 2
|
||||
};
|
||||
},
|
||||
|
||||
mixins: [PureRenderMixin],
|
||||
|
||||
handleNextClick (e) {
|
||||
e.preventDefault();
|
||||
|
||||
let newIndex = this.state.index + 1;
|
||||
|
||||
if (this.props.accountIds.skip(this.props.perWindow * newIndex).size === 0) {
|
||||
newIndex = 0;
|
||||
}
|
||||
|
||||
this.setState({ index: newIndex });
|
||||
},
|
||||
|
||||
render () {
|
||||
const { accountIds, perWindow } = this.props;
|
||||
|
||||
if (!accountIds || accountIds.size === 0) {
|
||||
return <div />;
|
||||
}
|
||||
|
||||
let nextLink = '';
|
||||
|
||||
if (accountIds.size > perWindow) {
|
||||
nextLink = <a href='#' style={nextStyle} onClick={this.handleNextClick}><FormattedMessage id='suggestions_box.refresh' defaultMessage='Refresh' /></a>;
|
||||
}
|
||||
|
||||
return (
|
||||
<div style={outerStyle}>
|
||||
<strong style={headerStyle}>
|
||||
<FormattedMessage id='suggestions_box.who_to_follow' defaultMessage='Who to follow' /> {nextLink}
|
||||
</strong>
|
||||
|
||||
{accountIds.skip(perWindow * this.state.index).take(perWindow).map(accountId => <AccountContainer key={accountId} id={accountId} withNote={false} />)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
export default SuggestionsBox;
|
@ -1,8 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import SuggestionsBox from '../components/suggestions_box';
|
||||
|
||||
const mapStateToProps = (state) => ({
|
||||
accountIds: state.getIn(['user_lists', 'suggestions'])
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps)(SuggestionsBox);
|
@ -3,9 +3,7 @@ import ComposeFormContainer from './containers/compose_form_container';
|
||||
import UploadFormContainer from './containers/upload_form_container';
|
||||
import NavigationContainer from './containers/navigation_container';
|
||||
import PureRenderMixin from 'react-addons-pure-render-mixin';
|
||||
import SuggestionsContainer from './containers/suggestions_container';
|
||||
import SearchContainer from './containers/search_container';
|
||||
import { fetchSuggestions } from '../../actions/suggestions';
|
||||
import { connect } from 'react-redux';
|
||||
import { mountCompose, unmountCompose } from '../../actions/compose';
|
||||
|
||||
@ -19,7 +17,6 @@ const Compose = React.createClass({
|
||||
|
||||
componentDidMount () {
|
||||
this.props.dispatch(mountCompose());
|
||||
this.props.dispatch(fetchSuggestions());
|
||||
},
|
||||
|
||||
componentWillUnmount () {
|
||||
@ -29,14 +26,10 @@ const Compose = React.createClass({
|
||||
render () {
|
||||
return (
|
||||
<Drawer>
|
||||
<div style={{ flex: '1 1 auto' }}>
|
||||
<SearchContainer />
|
||||
<NavigationContainer />
|
||||
<ComposeFormContainer />
|
||||
<UploadFormContainer />
|
||||
</div>
|
||||
|
||||
<SuggestionsContainer />
|
||||
<SearchContainer />
|
||||
<NavigationContainer />
|
||||
<ComposeFormContainer />
|
||||
<UploadFormContainer />
|
||||
</Drawer>
|
||||
);
|
||||
}
|
||||
|
@ -41,8 +41,6 @@ const en = {
|
||||
"search.placeholder": "Suche",
|
||||
"search.account": "Konto",
|
||||
"search.hashtag": "Hashtag",
|
||||
"suggestions_box.who_to_follow": "Wem folgen",
|
||||
"suggestions_box.refresh": "Aktualisieren",
|
||||
"upload_button.label": "Media-Datei anfügen",
|
||||
"upload_form.undo": "Entfernen",
|
||||
"notification.follow": "{name} folgt dir",
|
||||
|
@ -45,8 +45,6 @@ const en = {
|
||||
"search.placeholder": "Search",
|
||||
"search.account": "Account",
|
||||
"search.hashtag": "Hashtag",
|
||||
"suggestions_box.who_to_follow": "Who to follow",
|
||||
"suggestions_box.refresh": "Refresh",
|
||||
"upload_button.label": "Add media",
|
||||
"upload_form.undo": "Undo",
|
||||
"notification.follow": "{name} followed you",
|
||||
|
@ -42,8 +42,6 @@ const es = {
|
||||
"search.placeholder": "Buscar",
|
||||
"search.account": "Cuenta",
|
||||
"search.hashtag": "Etiqueta",
|
||||
"suggestions_box.who_to_follow": "A quién seguir",
|
||||
"suggestions_box.refresh": "Refrescar",
|
||||
"upload_button.label": "Añadir medio",
|
||||
"upload_form.undo": "Deshacer",
|
||||
"notification.follow": "{name} le esta ahora siguiendo",
|
||||
|
@ -41,8 +41,6 @@ const fr = {
|
||||
"search.placeholder": "Chercher",
|
||||
"search.account": "Compte",
|
||||
"search.hashtag": "Mot-clé",
|
||||
"suggestions_box.who_to_follow": "Suggestions",
|
||||
"suggestions_box.refresh": "Rafraîchir",
|
||||
"upload_button.label": "Joindre un média",
|
||||
"upload_form.undo": "Annuler",
|
||||
"notification.follow": "{name} s’est abonné⋅e à vos statuts",
|
||||
|
@ -40,8 +40,6 @@ const pt = {
|
||||
"search.placeholder": "Busca",
|
||||
"search.account": "Conta",
|
||||
"search.hashtag": "Hashtag",
|
||||
"suggestions_box.who_to_follow": "Quem seguir",
|
||||
"suggestions_box.refresh": "Recarregar",
|
||||
"upload_button.label": "Adicionar media",
|
||||
"upload_form.undo": "Desfazer"
|
||||
};
|
||||
|
@ -4,7 +4,6 @@ import {
|
||||
FOLLOWING_FETCH_SUCCESS,
|
||||
FOLLOWING_EXPAND_SUCCESS
|
||||
} from '../actions/accounts';
|
||||
import { SUGGESTIONS_FETCH_SUCCESS } from '../actions/suggestions';
|
||||
import {
|
||||
REBLOGS_FETCH_SUCCESS,
|
||||
FAVOURITES_FETCH_SUCCESS
|
||||
@ -14,7 +13,6 @@ import Immutable from 'immutable';
|
||||
const initialState = Immutable.Map({
|
||||
followers: Immutable.Map(),
|
||||
following: Immutable.Map(),
|
||||
suggestions: Immutable.List(),
|
||||
reblogged_by: Immutable.Map(),
|
||||
favourited_by: Immutable.Map()
|
||||
});
|
||||
@ -42,8 +40,6 @@ export default function userLists(state = initialState, action) {
|
||||
return normalizeList(state, 'following', action.id, action.accounts, action.next);
|
||||
case FOLLOWING_EXPAND_SUCCESS:
|
||||
return appendToList(state, 'following', action.id, action.accounts, action.next);
|
||||
case SUGGESTIONS_FETCH_SUCCESS:
|
||||
return state.set('suggestions', Immutable.List(action.accounts.map(item => item.id)));
|
||||
case REBLOGS_FETCH_SUCCESS:
|
||||
return state.setIn(['reblogged_by', action.id], Immutable.List(action.accounts.map(item => item.id)));
|
||||
case FAVOURITES_FETCH_SUCCESS:
|
||||
|
Reference in New Issue
Block a user