logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

timeline_container.js (1545B)


  1. import React from 'react';
  2. import { Provider } from 'react-redux';
  3. import PropTypes from 'prop-types';
  4. import configureStore from '../store/configureStore';
  5. import { hydrateStore } from '../actions/store';
  6. import { IntlProvider, addLocaleData } from 'react-intl';
  7. import { getLocale } from '../locales';
  8. import PublicTimeline from '../features/standalone/public_timeline';
  9. import CommunityTimeline from '../features/standalone/community_timeline';
  10. import HashtagTimeline from '../features/standalone/hashtag_timeline';
  11. import initialState from '../initial_state';
  12. const { localeData, messages } = getLocale();
  13. addLocaleData(localeData);
  14. const store = configureStore();
  15. if (initialState) {
  16. store.dispatch(hydrateStore(initialState));
  17. }
  18. export default class TimelineContainer extends React.PureComponent {
  19. static propTypes = {
  20. locale: PropTypes.string.isRequired,
  21. hashtag: PropTypes.string,
  22. showPublicTimeline: PropTypes.bool.isRequired,
  23. };
  24. static defaultProps = {
  25. showPublicTimeline: initialState.settings.known_fediverse,
  26. };
  27. render () {
  28. const { locale, hashtag, showPublicTimeline } = this.props;
  29. let timeline;
  30. if (hashtag) {
  31. timeline = <HashtagTimeline hashtag={hashtag} />;
  32. } else if (showPublicTimeline) {
  33. timeline = <PublicTimeline />;
  34. } else {
  35. timeline = <CommunityTimeline />;
  36. }
  37. return (
  38. <IntlProvider locale={locale} messages={messages}>
  39. <Provider store={store}>
  40. {timeline}
  41. </Provider>
  42. </IntlProvider>
  43. );
  44. }
  45. }