Chat popup (#3098)

* add pop out chat button

* add button to close chat popup

* chat is hidden on main interface when a popup chat is open

* NameChangeEvent renames clients with the given id

if you have two or more owncast windows (or pop-out chats) open, changing your
name in 1 client is reflected in all clients.

* replace isChatVisible booleans with chatState enum

* update stories to use ChatState

* fix build tests

---------

Co-authored-by: janWilejan <>
This commit is contained in:
janWilejan
2023-06-26 16:00:27 +00:00
committed by GitHub
parent fca85a4a42
commit c563742856
6 changed files with 101 additions and 33 deletions

View File

@@ -17,7 +17,8 @@ import {
appStateAtom,
serverStatusState,
isMobileAtom,
isChatVisibleSelector,
ChatState,
chatStateAtom,
} from '../../stores/ClientConfigStore';
import { Content } from '../../ui/Content/Content';
import { Header } from '../../ui/Header/Header';
@@ -54,14 +55,14 @@ export const Main: FC = () => {
const fatalError = useRecoilValue<DisplayableError>(fatalErrorStateAtom);
const appState = useRecoilValue<AppStateOptions>(appStateAtom);
const isMobile = useRecoilValue<boolean | undefined>(isMobileAtom);
const isChatVisible = useRecoilValue<boolean>(isChatVisibleSelector);
const chatState = useRecoilValue<ChatState>(chatStateAtom);
const layoutRef = useRef<HTMLDivElement>(null);
const { chatDisabled } = clientConfig;
const { videoAvailable } = appState;
const { online, streamTitle } = clientStatus;
// accounts for sidebar width when online in desktop
const showChat = online && !chatDisabled && isChatVisible;
const showChat = online && !chatDisabled && chatState === ChatState.VISIBLE;
const dynamicFooterPadding = showChat && !isMobile ? DYNAMIC_PADDING_VALUE : '';
useEffect(() => {