diff --git a/app/soapbox/actions/mobile.ts b/app/soapbox/actions/mobile.ts deleted file mode 100644 index 1e11f473d..000000000 --- a/app/soapbox/actions/mobile.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { staticClient } from '../api'; - -import type { AppDispatch } from 'soapbox/store'; - -const FETCH_MOBILE_PAGE_REQUEST = 'FETCH_MOBILE_PAGE_REQUEST'; -const FETCH_MOBILE_PAGE_SUCCESS = 'FETCH_MOBILE_PAGE_SUCCESS'; -const FETCH_MOBILE_PAGE_FAIL = 'FETCH_MOBILE_PAGE_FAIL'; - -const fetchMobilePage = (slug = 'index', locale?: string) => - (dispatch: AppDispatch) => { - dispatch({ type: FETCH_MOBILE_PAGE_REQUEST, slug, locale }); - const filename = `${slug}${locale ? `.${locale}` : ''}.html`; - return staticClient.get(`/instance/mobile/${filename}`).then(({ data: html }) => { - dispatch({ type: FETCH_MOBILE_PAGE_SUCCESS, slug, locale, html }); - return html; - }).catch(error => { - dispatch({ type: FETCH_MOBILE_PAGE_FAIL, slug, locale, error }); - throw error; - }); - }; - -export { - FETCH_MOBILE_PAGE_REQUEST, - FETCH_MOBILE_PAGE_SUCCESS, - FETCH_MOBILE_PAGE_FAIL, - fetchMobilePage, -}; \ No newline at end of file diff --git a/app/soapbox/containers/soapbox.tsx b/app/soapbox/containers/soapbox.tsx index 099bb3b96..2841ec3ca 100644 --- a/app/soapbox/containers/soapbox.tsx +++ b/app/soapbox/containers/soapbox.tsx @@ -138,7 +138,6 @@ const SoapboxMount = () => { )} - {(features.accountCreation && instance.registrations) && ( diff --git a/app/soapbox/features/mobile/index.js b/app/soapbox/features/mobile/index.js deleted file mode 100644 index bb9cf3f97..000000000 --- a/app/soapbox/features/mobile/index.js +++ /dev/null @@ -1,108 +0,0 @@ -import React from 'react'; -import ImmutablePureComponent from 'react-immutable-pure-component'; -import { injectIntl, FormattedMessage } from 'react-intl'; -import { connect } from 'react-redux'; - -import { fetchMobilePage } from 'soapbox/actions/mobile'; -import { getSettings } from 'soapbox/actions/settings'; -import { getSoapboxConfig } from 'soapbox/actions/soapbox'; - -import { languages } from '../preferences'; - -const mapStateToProps = state => ({ - locale: getSettings(state).get('locale'), - mobilePages: getSoapboxConfig(state).get('mobilePages'), -}); - -@connect(mapStateToProps) -@injectIntl -class MobilePage extends ImmutablePureComponent { - - state = { - pageHtml: '', - locale: this.props.locale, - } - - loadPageHtml = () => { - const { dispatch, match, mobilePages } = this.props; - const { locale } = this.state; - const { slug } = match.params; - const page = mobilePages.get(slug || 'mobile'); - const fetchLocale = page && locale !== page.get('default') && page.get('locales').includes(locale); - dispatch(fetchMobilePage(slug, fetchLocale && locale)).then(html => { - this.setState({ pageHtml: html }); - }).catch(error => { - // TODO: Better error handling. 404 page? - this.setState({ pageHtml: '

Page not found

' }); - }); - } - - setLocale = (locale) => () => { - this.setState({ locale }); - }; - - componentDidMount() { - this.loadPageHtml(); - } - - componentDidUpdate(prevProps, prevState) { - const { locale, match, mobilePages } = this.props; - const { locale: prevLocale, mobilePages: prevMobilePages } = prevProps; - const { locale: stateLocale } = this.state; - const { locale: prevStateLocale } = prevState; - - const { slug } = match.params; - const { slug: prevSlug } = prevProps.match.params; - - if (locale !== prevLocale) this.setState({ locale }); - - if ( - slug !== prevSlug || - stateLocale !== prevStateLocale || - (!prevMobilePages.get(slug || 'mobile') && mobilePages.get(slug || 'mobile')) - ) - this.loadPageHtml(); - } - - render() { - const { match, mobilePages } = this.props; - const { slug } = match.params; - - const page = mobilePages.get(slug || 'mobile'); - const defaultLocale = page && page.get('default'); - const alsoAvailable = page && ( -
- - {' '} - -
- ); - - return ( -
-
- {alsoAvailable} -
- ); - } - -} - -export default MobilePage; diff --git a/app/soapbox/features/public_layout/index.tsx b/app/soapbox/features/public_layout/index.tsx index 5c7e45107..5615e950e 100644 --- a/app/soapbox/features/public_layout/index.tsx +++ b/app/soapbox/features/public_layout/index.tsx @@ -7,7 +7,6 @@ import { isStandalone } from 'soapbox/utils/state'; import AboutPage from '../about'; import LandingPage from '../landing_page'; -import MobilePage from '../mobile'; import Footer from './components/footer'; import Header from './components/header'; @@ -31,7 +30,6 @@ const PublicLayout = () => { -
diff --git a/app/soapbox/normalizers/soapbox/soapbox_config.ts b/app/soapbox/normalizers/soapbox/soapbox_config.ts index d9f1e5bb3..0447b3fc5 100644 --- a/app/soapbox/normalizers/soapbox/soapbox_config.ts +++ b/app/soapbox/normalizers/soapbox/soapbox_config.ts @@ -106,7 +106,6 @@ export const SoapboxConfigRecord = ImmutableRecord({ limit: 1, }), aboutPages: ImmutableMap>(), - mobilePages: ImmutableMap>(), authenticatedProfile: true, singleUserMode: false, singleUserModeProfile: '',