kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Implement login button and friendly greeting
rodzic
7adaa92a3e
commit
af16e48ce3
|
@ -2,16 +2,15 @@ import { FormattedMessage } from 'react-intl';
|
|||
|
||||
import { openModal } from 'soapbox/actions/modals.ts';
|
||||
import Button from 'soapbox/components/ui/button.tsx';
|
||||
import HStack from 'soapbox/components/ui/hstack.tsx';
|
||||
import Stack from 'soapbox/components/ui/stack.tsx';
|
||||
import Text from 'soapbox/components/ui/text.tsx';
|
||||
import { useAppDispatch } from 'soapbox/hooks/useAppDispatch.ts';
|
||||
import { useAppSelector } from 'soapbox/hooks/useAppSelector.ts';
|
||||
import { useFeatures } from 'soapbox/hooks/useFeatures.ts';
|
||||
import { useInstance } from 'soapbox/hooks/useInstance.ts';
|
||||
import { useRegistrationStatus } from 'soapbox/hooks/useRegistrationStatus.ts';
|
||||
|
||||
const SignUpPanel = () => {
|
||||
const { instance } = useInstance();
|
||||
const { nostrSignup } = useFeatures();
|
||||
const { isOpen } = useRegistrationStatus();
|
||||
const me = useAppSelector((state) => state.me);
|
||||
|
@ -19,26 +18,44 @@ const SignUpPanel = () => {
|
|||
|
||||
if (me || !isOpen) return null;
|
||||
|
||||
function getGreeting() {
|
||||
const hours = new Date().getHours();
|
||||
return hours < 12 ? 'GM' : 'Hey There';
|
||||
}
|
||||
|
||||
return (
|
||||
<Stack space={2} data-testid='sign-up-panel'>
|
||||
<Stack>
|
||||
<Text size='lg' weight='bold'>
|
||||
<FormattedMessage id='signup_panel.title' defaultMessage='New to {site_title}?' values={{ site_title: instance.title }} />
|
||||
<FormattedMessage id='signup_panel.greeting_title' defaultMessage='{greeting}! Welcome aboard!' values={{ greeting: getGreeting() }} />
|
||||
</Text>
|
||||
|
||||
<Text theme='muted' size='sm'>
|
||||
<FormattedMessage id='signup_panel.subtitle' defaultMessage="Sign up now to discuss what's happening." />
|
||||
<Text size='sm' theme='muted'>
|
||||
<FormattedMessage id='login_panel.subtitle' defaultMessage='Dive into the best of social media!' />
|
||||
</Text>
|
||||
</Stack>
|
||||
|
||||
<Button
|
||||
theme='primary'
|
||||
onClick={nostrSignup ? () => dispatch(openModal('NOSTR_SIGNUP')) : undefined}
|
||||
to={nostrSignup ? undefined : '/signup'}
|
||||
block
|
||||
>
|
||||
<FormattedMessage id='account.register' defaultMessage='Sign up' />
|
||||
</Button>
|
||||
<HStack space={2}>
|
||||
<Button
|
||||
theme='tertiary'
|
||||
onClick={nostrSignup ? () => dispatch(openModal('NOSTR_LOGIN')) : undefined}
|
||||
to={nostrSignup ? undefined : '/login'}
|
||||
block
|
||||
>
|
||||
<FormattedMessage id='account.login' defaultMessage='Log in' />
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
theme='primary'
|
||||
onClick={nostrSignup ? () => dispatch(openModal('NOSTR_SIGNUP')) : undefined}
|
||||
to={nostrSignup ? undefined : '/signup'}
|
||||
block
|
||||
>
|
||||
<FormattedMessage id='account.register' defaultMessage='Sign up' />
|
||||
</Button>
|
||||
|
||||
</HStack>
|
||||
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -1467,6 +1467,8 @@
|
|||
"settings.settings": "Settings",
|
||||
"shared.tos": "Terms of Service",
|
||||
"signup_panel.subtitle": "Sign up now to discuss what's happening.",
|
||||
"login_panel.subtitle": "Dive into the best of social media!",
|
||||
"signup_panel.greeting_title": "{greeting}! Welcome aboard!",
|
||||
"signup_panel.title": "New to {site_title}?",
|
||||
"site_preview.preview": "Preview",
|
||||
"soapbox_config.authenticated_profile_hint": "Users must be logged-in to view replies and media on user profiles.",
|
||||
|
|
Ładowanie…
Reference in New Issue