Refactor app state to be a state machine with access selectors

This commit is contained in:
Gabe Kangas
2022-05-25 20:38:40 -07:00
parent dde9878a46
commit 7b1667bf6a
21 changed files with 421 additions and 223 deletions

View File

@@ -2,20 +2,19 @@ import { Spin } from 'antd';
import { Virtuoso } from 'react-virtuoso';
import { useRef } from 'react';
import { LoadingOutlined } from '@ant-design/icons';
import { ChatMessage } from '../../../interfaces/chat-message.model';
import { ChatState } from '../../../interfaces/application-state';
import { MessageType } from '../../../interfaces/socket-events';
import s from './ChatContainer.module.scss';
import { ChatMessage } from '../../../interfaces/chat-message.model';
import { ChatUserMessage } from '..';
interface Props {
messages: ChatMessage[];
state: ChatState;
loading: boolean;
}
export default function ChatContainer(props: Props) {
const { messages, state } = props;
const loading = state === ChatState.Loading;
const { messages, loading } = props;
const chatContainerRef = useRef(null);
const spinIcon = <LoadingOutlined style={{ fontSize: '32px' }} spin />;