import "./App.css"; import 'styles/styles.css' import { useEffect } from "react"; import { Redirect, Route, Switch, useHistory } from "react-router-dom"; import { useTranslation } from "react-i18next"; import cookies from "js-cookie"; import { Header } from "components/shared/Header/Header"; import { Card } from "components/pages/Main/Card/Card"; import { PopupComponent } from "components/pages/ConnectPage/PopupComponent/PopupComponent"; import { PlayerComponent } from "components/pages/Stream/PlayerComponent/PlayerComponent"; import { useAppDispatch, useAppSelector } from "hooks/redux"; import { fetchCards } from "store/reducers/ActionCreator"; import { cardSlice } from "store/reducers/cardSlice"; import { languageSlice } from "store/reducers/languageSlice"; import { ICards } from "models/ICards"; const App: React.FC = () => { const dispatch = useAppDispatch(); const history = useHistory(); const { handleCurrentCard } = cardSlice.actions; const { handleChangeLanguage } = languageSlice.actions; const { cards, currentCard } = useAppSelector((state) => state.cardReducer); useEffect(() => { dispatch(fetchCards()); dispatch(handleChangeLanguage(cookies.get("i18next"))); }, []); useEffect(() => { window.screen.orientation.lock("landscape"); }, []); const handleCards = (card: ICards) => { dispatch(handleCurrentCard(card)); history.push("/connect-page"); }; const closeStream = () => { history.push("/"); }; const { t } = useTranslation(); return (

{t("demo-title")}

{cards.map((i: ICards) => ( handleCards(i)} key={i._id} item={i}> ))}
{currentCard ? (
) : ( )}
); }; export default App;