You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.3 KiB

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