|
|
|
|
@ -6,69 +6,55 @@ import { |
|
|
|
|
} from 'react-router-dom' |
|
|
|
|
|
|
|
|
|
import { indexLexics } from 'config/lexics/indexLexics' |
|
|
|
|
import { useLexicsConfig } from 'features/LexicsStore' |
|
|
|
|
import { PAGES } from 'config' |
|
|
|
|
import { devices } from 'config/devices' |
|
|
|
|
|
|
|
|
|
import { useLexicsConfig } from 'features/LexicsStore' |
|
|
|
|
|
|
|
|
|
import { HomePage } from 'features/HomePage' |
|
|
|
|
import { TeamPage } from 'features/TeamPage' |
|
|
|
|
import { MatchPage } from 'features/MatchPage' |
|
|
|
|
import { PlayerPage } from 'features/PlayerPage' |
|
|
|
|
import { TournamentPage } from 'features/TournamentPage' |
|
|
|
|
import { ExtendedSearchStore, ExtendedSearchPage } from 'features/ExtendedSearchPage' |
|
|
|
|
import { UserAccount } from 'features/UserAccount' |
|
|
|
|
import { MatchSwitchesStore } from 'features/MatchSwitches' |
|
|
|
|
import { MainWrapper } from 'features/MainWrapper' |
|
|
|
|
import { UserAccountForm } from 'features/UserAccount' |
|
|
|
|
|
|
|
|
|
import { UserFavorites } from 'features/UserFavorites' |
|
|
|
|
import { MatchSwitchesStore } from 'features/MatchSwitches' |
|
|
|
|
import { UserFavoritesStore } from 'features/UserFavorites/store' |
|
|
|
|
import { useMediaQuery } from 'features/MediaQuery' |
|
|
|
|
import { FormStore } from 'features/FormStore' |
|
|
|
|
|
|
|
|
|
export const AuthenticatedApp = () => { |
|
|
|
|
useLexicsConfig(indexLexics) |
|
|
|
|
const isMobile = useMediaQuery({ query: devices.tablet }) |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<MatchSwitchesStore> |
|
|
|
|
<Switch> |
|
|
|
|
<Route path={PAGES.useraccount}> |
|
|
|
|
<UserAccountForm /> |
|
|
|
|
</Route> |
|
|
|
|
<UserFavoritesStore> |
|
|
|
|
<ExtendedSearchStore> |
|
|
|
|
<MainWrapper> |
|
|
|
|
{!isMobile && <UserFavorites />} |
|
|
|
|
<Route exact path={PAGES.home}> |
|
|
|
|
<HomePage /> |
|
|
|
|
</Route> |
|
|
|
|
|
|
|
|
|
<Route path={`/:sportName${PAGES.tournament}/:pageId`}> |
|
|
|
|
<TournamentPage /> |
|
|
|
|
</Route> |
|
|
|
|
|
|
|
|
|
<Route path={`/:sportName${PAGES.team}/:pageId`}> |
|
|
|
|
<TeamPage /> |
|
|
|
|
</Route> |
|
|
|
|
<Route path={`/:sportName${PAGES.player}/:pageId`}> |
|
|
|
|
<PlayerPage /> |
|
|
|
|
</Route> |
|
|
|
|
<Route path={`/:sportName${PAGES.match}/:pageId`}> |
|
|
|
|
<MatchPage /> |
|
|
|
|
</Route> |
|
|
|
|
<Route path={PAGES.extendedSearch}> |
|
|
|
|
<ExtendedSearchPage /> |
|
|
|
|
</Route> |
|
|
|
|
</MainWrapper> |
|
|
|
|
</ExtendedSearchStore> |
|
|
|
|
</UserFavoritesStore> |
|
|
|
|
<Redirect to={PAGES.home} /> |
|
|
|
|
</Switch> |
|
|
|
|
<UserFavoritesStore> |
|
|
|
|
<ExtendedSearchStore> |
|
|
|
|
{/* в Switch как прямой children можно рендерить только Route или Redirect */} |
|
|
|
|
<Switch> |
|
|
|
|
<Route path={PAGES.useraccount}> |
|
|
|
|
<UserAccountForm /> |
|
|
|
|
</Route> |
|
|
|
|
<Route exact path={PAGES.home}> |
|
|
|
|
<HomePage /> |
|
|
|
|
</Route> |
|
|
|
|
<Route path={`/:sportName${PAGES.tournament}/:pageId`}> |
|
|
|
|
<TournamentPage /> |
|
|
|
|
</Route> |
|
|
|
|
<Route path={`/:sportName${PAGES.team}/:pageId`}> |
|
|
|
|
<TeamPage /> |
|
|
|
|
</Route> |
|
|
|
|
<Route path={`/:sportName${PAGES.player}/:pageId`}> |
|
|
|
|
<PlayerPage /> |
|
|
|
|
</Route> |
|
|
|
|
<Route path={`/:sportName${PAGES.match}/:pageId`}> |
|
|
|
|
<MatchPage /> |
|
|
|
|
</Route> |
|
|
|
|
<Route path={PAGES.extendedSearch}> |
|
|
|
|
<ExtendedSearchPage /> |
|
|
|
|
</Route> |
|
|
|
|
<Redirect to={PAGES.home} /> |
|
|
|
|
</Switch> |
|
|
|
|
</ExtendedSearchStore> |
|
|
|
|
</UserFavoritesStore> |
|
|
|
|
</MatchSwitchesStore> |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export const UserAccountForm = () => ( |
|
|
|
|
<FormStore> |
|
|
|
|
<UserAccount /> |
|
|
|
|
</FormStore> |
|
|
|
|
) |
|
|
|
|
|