Merge branch 'main' of gitlab.com:soapbox-pub/soapbox into lexical-rm-nodes
This commit is contained in:
commit
bad17c52d8
|
@ -2,10 +2,29 @@ import React from 'react';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
|
|
||||||
import { BigCard } from 'soapbox/components/big-card';
|
import { BigCard } from 'soapbox/components/big-card';
|
||||||
|
import { Text } from 'soapbox/components/ui';
|
||||||
|
import { useInstance, useRegistrationStatus } from 'soapbox/hooks';
|
||||||
|
|
||||||
import RegistrationForm from './registration-form';
|
import RegistrationForm from './registration-form';
|
||||||
|
|
||||||
const RegistrationPage: React.FC = () => {
|
const RegistrationPage: React.FC = () => {
|
||||||
|
const instance = useInstance();
|
||||||
|
const { isOpen } = useRegistrationStatus();
|
||||||
|
|
||||||
|
if (!isOpen) {
|
||||||
|
return (
|
||||||
|
<BigCard title={<FormattedMessage id='registration.closed_title' defaultMessage='Registrations Closed' />}>
|
||||||
|
<Text theme='muted' align='center'>
|
||||||
|
<FormattedMessage
|
||||||
|
id='registration.closed_message'
|
||||||
|
defaultMessage='{instance} is not accepting new members.'
|
||||||
|
values={{ instance: instance.title }}
|
||||||
|
/>
|
||||||
|
</Text>
|
||||||
|
</BigCard>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BigCard title={<FormattedMessage id='column.registration' defaultMessage='Sign Up' />}>
|
<BigCard title={<FormattedMessage id='column.registration' defaultMessage='Sign Up' />}>
|
||||||
<RegistrationForm />
|
<RegistrationForm />
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { expandCommunityTimeline } from 'soapbox/actions/timelines';
|
||||||
import { useCommunityStream } from 'soapbox/api/hooks';
|
import { useCommunityStream } from 'soapbox/api/hooks';
|
||||||
import PullToRefresh from 'soapbox/components/pull-to-refresh';
|
import PullToRefresh from 'soapbox/components/pull-to-refresh';
|
||||||
import { Column } from 'soapbox/components/ui';
|
import { Column } from 'soapbox/components/ui';
|
||||||
import { useAppSelector, useAppDispatch, useSettings } from 'soapbox/hooks';
|
import { useAppSelector, useAppDispatch } from 'soapbox/hooks';
|
||||||
|
|
||||||
import Timeline from '../ui/components/timeline';
|
import Timeline from '../ui/components/timeline';
|
||||||
|
|
||||||
|
@ -13,26 +13,23 @@ import { SiteBanner } from './components/site-banner';
|
||||||
|
|
||||||
const LandingTimeline = () => {
|
const LandingTimeline = () => {
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
|
|
||||||
const settings = useSettings();
|
|
||||||
const onlyMedia = !!settings.getIn(['community', 'other', 'onlyMedia'], false);
|
|
||||||
const next = useAppSelector(state => state.timelines.get('community')?.next);
|
const next = useAppSelector(state => state.timelines.get('community')?.next);
|
||||||
|
|
||||||
const timelineId = 'community';
|
const timelineId = 'community';
|
||||||
|
|
||||||
const handleLoadMore = (maxId: string) => {
|
const handleLoadMore = (maxId: string) => {
|
||||||
dispatch(expandCommunityTimeline({ url: next, maxId, onlyMedia }));
|
dispatch(expandCommunityTimeline({ url: next, maxId }));
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleRefresh = () => {
|
const handleRefresh = () => {
|
||||||
return dispatch(expandCommunityTimeline({ onlyMedia }));
|
return dispatch(expandCommunityTimeline());
|
||||||
};
|
};
|
||||||
|
|
||||||
useCommunityStream({ onlyMedia });
|
useCommunityStream();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dispatch(expandCommunityTimeline({ onlyMedia }));
|
dispatch(expandCommunityTimeline());
|
||||||
}, [onlyMedia]);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Column transparent withHeader={false}>
|
<Column transparent withHeader={false}>
|
||||||
|
@ -43,7 +40,7 @@ const LandingTimeline = () => {
|
||||||
<PullToRefresh onRefresh={handleRefresh}>
|
<PullToRefresh onRefresh={handleRefresh}>
|
||||||
<Timeline
|
<Timeline
|
||||||
scrollKey={`${timelineId}_timeline`}
|
scrollKey={`${timelineId}_timeline`}
|
||||||
timelineId={`${timelineId}${onlyMedia ? ':media' : ''}`}
|
timelineId={timelineId}
|
||||||
prefix='home'
|
prefix='home'
|
||||||
onLoadMore={handleLoadMore}
|
onLoadMore={handleLoadMore}
|
||||||
emptyMessage={<FormattedMessage id='empty_column.community' defaultMessage='The local timeline is empty. Write something publicly to get the ball rolling!' />}
|
emptyMessage={<FormattedMessage id='empty_column.community' defaultMessage='The local timeline is empty. Write something publicly to get the ball rolling!' />}
|
||||||
|
|
|
@ -6,7 +6,7 @@ export const useRegistrationStatus = () => {
|
||||||
const features = useFeatures();
|
const features = useFeatures();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
/** Registrations are open, either through Pepe or traditional account creation. */
|
/** Registrations are open. */
|
||||||
isOpen: features.accountCreation && instance.registrations,
|
isOpen: features.accountCreation && instance.registrations,
|
||||||
};
|
};
|
||||||
};
|
};
|
Loading…
Reference in New Issue