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