chat-with-gpt/app/src/components/pages/landing.tsx

40 lines
1.4 KiB
TypeScript
Raw Normal View History

2023-03-08 21:30:11 +00:00
import styled from '@emotion/styled';
import { Button } from '@mantine/core';
2023-03-10 22:00:37 +00:00
import { useCallback } from 'react';
2023-03-14 11:00:40 +00:00
import { FormattedMessage } from 'react-intl';
2023-03-10 22:00:37 +00:00
import { useAppDispatch, useAppSelector } from '../../store';
import { selectOpenAIApiKey } from '../../store/api-keys';
import { openOpenAIApiKeyPanel } from '../../store/settings-ui';
2023-03-08 21:30:11 +00:00
import { Page } from '../page';
const Container = styled.div`
flex-grow: 1;
padding-bottom: 5vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-family: "Work Sans", sans-serif;
line-height: 1.7;
gap: 1rem;
`;
export default function LandingPage(props: any) {
2023-03-10 22:00:37 +00:00
const openAIApiKey = useAppSelector(selectOpenAIApiKey);
const dispatch = useAppDispatch();
const onConnectButtonClick = useCallback(() => dispatch(openOpenAIApiKeyPanel()), [dispatch]);
2023-03-08 21:30:11 +00:00
return <Page id={'landing'} showSubHeader={true}>
<Container>
2023-03-14 11:00:40 +00:00
<p>
<FormattedMessage defaultMessage={'Hello, how can I help you today?'} />
</p>
2023-03-10 22:00:37 +00:00
{!openAIApiKey && (
<Button size="xs" variant="light" compact onClick={onConnectButtonClick}>
2023-03-14 11:00:40 +00:00
<FormattedMessage defaultMessage={'Connect your OpenAI account to get started'} />
2023-03-08 21:30:11 +00:00
</Button>
)}
</Container>
</Page>;
}