diff --git a/app/soapbox/features/auth_login/components/consumers-list.tsx b/app/soapbox/features/auth_login/components/consumers-list.tsx new file mode 100644 index 000000000..368bc63f4 --- /dev/null +++ b/app/soapbox/features/auth_login/components/consumers-list.tsx @@ -0,0 +1,29 @@ +import { List as ImmutableList } from 'immutable'; +import React from 'react'; + +import { HStack } from 'soapbox/components/ui'; +import { useAppSelector } from 'soapbox/hooks'; + +import ConsumerButton from './consumer-button'; + +interface IConsumersList { +} + +/** Displays OAuth consumers to log in with. */ +const ConsumersList: React.FC = () => { + const providers = useAppSelector(state => ImmutableList(state.instance.pleroma.get('oauth_consumer_strategies'))); + + if (providers.size > 0) { + return ( + + {providers.map(provider => ( + + ))} + + ); + } else { + return null; + } +}; + +export default ConsumersList; diff --git a/app/soapbox/features/auth_login/components/login_form.tsx b/app/soapbox/features/auth_login/components/login_form.tsx index 44b8e6df5..24e4e3740 100644 --- a/app/soapbox/features/auth_login/components/login_form.tsx +++ b/app/soapbox/features/auth_login/components/login_form.tsx @@ -1,12 +1,10 @@ -import { List as ImmutableList } from 'immutable'; import React from 'react'; import { FormattedMessage, defineMessages, useIntl } from 'react-intl'; import { Link } from 'react-router-dom'; -import { Button, Form, FormActions, FormGroup, HStack, Input, Stack } from 'soapbox/components/ui'; -import { useAppSelector } from 'soapbox/hooks'; +import { Button, Form, FormActions, FormGroup, Input, Stack } from 'soapbox/components/ui'; -import ConsumerButton from './consumer-button'; +import ConsumersList from './consumers-list'; const messages = defineMessages({ username: { @@ -26,7 +24,6 @@ interface ILoginForm { const LoginForm: React.FC = ({ isLoading, handleSubmit }) => { const intl = useIntl(); - const providers = useAppSelector(state => ImmutableList(state.instance.pleroma.get('oauth_consumer_strategies'))); return (
@@ -82,13 +79,7 @@ const LoginForm: React.FC = ({ isLoading, handleSubmit }) => { - {(providers.size > 0) && ( - - {providers.map(provider => ( - - ))} - - )} +
);