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

37 lines
1.2 KiB
TypeScript
Raw Normal View History

2023-03-08 13:30:11 -08:00
import styled from '@emotion/styled';
import { Button } from '@mantine/core';
2023-03-10 14:00:37 -08:00
import { useCallback } from 'react';
import { useAppDispatch, useAppSelector } from '../../store';
import { selectOpenAIApiKey } from '../../store/api-keys';
import { openOpenAIApiKeyPanel } from '../../store/settings-ui';
2023-03-08 13:30:11 -08: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 14:00:37 -08:00
const openAIApiKey = useAppSelector(selectOpenAIApiKey);
const dispatch = useAppDispatch();
const onConnectButtonClick = useCallback(() => dispatch(openOpenAIApiKeyPanel()), [dispatch]);
2023-03-08 13:30:11 -08:00
return <Page id={'landing'} showSubHeader={true}>
<Container>
<p>Hello, how can I help you today?</p>
2023-03-10 14:00:37 -08:00
{!openAIApiKey && (
<Button size="xs" variant="light" compact onClick={onConnectButtonClick}>
2023-03-08 13:30:11 -08:00
Connect your OpenAI account to get started
</Button>
)}
</Container>
</Page>;
}