import React from 'react';
-import { Navigate, Route, Routes } from 'react-router-dom';
+import {
+ createBrowserRouter,
+ createRoutesFromElements,
+ Navigate,
+ Route,
+ RouterProvider,
+} from 'react-router-dom';
import FullLayout from './FullLayout';
-import AlttpSeed from '../pages/AlttpSeed';
-import DiscordBot from '../pages/DiscordBot';
-import DoorsTracker from '../pages/DoorsTracker';
-import Event from '../pages/Event';
-import Events from '../pages/Events';
import Front from '../pages/Front';
-import Map from '../pages/Map';
-import Schedule from '../pages/Schedule';
import Technique from '../pages/Technique';
import Techniques from '../pages/Techniques';
-import Tournament from '../pages/Tournament';
-import TwitchBot from '../pages/TwitchBot';
import User from '../pages/User';
-const AppRoutes = () => <Routes>
- <Route element={<FullLayout />}>
- <Route
- path="discord-bot"
- element={<DiscordBot />}
- />
- <Route
- path="dungeons"
- element={<Techniques namespace="dungeons" type="dungeon" />}
- />
- <Route
- path="dungeons/:name"
- element={<Technique basepath="dungeons" type="dungeon" />}
- />
- <Route
- path="events"
- element={<Events />}
- />
- <Route
- path="events/:name"
- element={<Event />}
- />
- <Route path="h/:hash" element={<AlttpSeed />} />
- <Route
- path="locations"
- element={<Techniques namespace="locations" type="location" />}
- />
- <Route
- path="locations/:name"
- element={<Technique basepath="locations" type="location" />}
- />
- <Route path="map">
- <Route index element={<Navigate replace to="lw" />} />
- <Route path=":activeMap" element={<Map />} />
- </Route>
- <Route
- path="modes"
- element={<Techniques namespace="modes" type="mode" />}
- />
- <Route
- path="modes/:name"
- element={<Technique basepath="modes" type="mode" />}
- />
- <Route
- path="rulesets"
- element={<Techniques namespace="rulesets" type="ruleset" />}
+const router = createBrowserRouter(
+ createRoutesFromElements(
+ <Route>
+ <Route element={<FullLayout />}>
+ <Route
+ path="discord-bot"
+ lazy={() => import(
+ /* webpackChunkName: "admin" */
+ '../pages/DiscordBot'
+ )}
+ />
+ <Route
+ path="dungeons"
+ element={<Techniques namespace="dungeons" type="dungeon" />}
+ />
+ <Route
+ path="dungeons/:name"
+ element={<Technique basepath="dungeons" type="dungeon" />}
+ />
+ <Route
+ path="events"
+ lazy={() => import(
+ /* webpackChunkName: "events" */
+ '../pages/Events'
+ )}
+ />
+ <Route
+ path="events/:name"
+ lazy={() => import(
+ /* webpackChunkName: "events" */
+ '../pages/Event'
+ )}
+ />
+ <Route
+ path="h/:hash"
+ lazy={() => import(
+ /* webpackChunkName: "seeds" */
+ '../pages/AlttpSeed'
+ )}
+ />
+ <Route
+ path="locations"
+ element={<Techniques namespace="locations" type="location" />}
+ />
+ <Route
+ path="locations/:name"
+ element={<Technique basepath="locations" type="location" />}
+ />
+ <Route path="map">
+ <Route index element={<Navigate replace to="lw" />} />
+ <Route
+ path=":activeMap"
+ lazy={() => import(
+ /* webpackChunkName: "map" */
+ '../pages/Map'
+ )}
+ />
+ </Route>
+ <Route
+ path="modes"
+ element={<Techniques namespace="modes" type="mode" />}
+ />
+ <Route
+ path="modes/:name"
+ element={<Technique basepath="modes" type="mode" />}
+ />
+ <Route
+ path="rulesets"
+ element={<Techniques namespace="rulesets" type="ruleset" />}
+ />
+ <Route
+ path="rulesets/:name"
+ element={<Technique basepath="rulesets" type="ruleset" />}
+ />
+ <Route
+ path="schedule"
+ lazy={() => import(
+ /* webpackChunkName: "events" */
+ '../pages/Schedule'
+ )}
+ />
+ <Route
+ path="tech"
+ element={<Techniques namespace="techniques" type="tech" />}
+ />
+ <Route
+ path="tech/:name"
+ element={<Technique basepath="tech" type="tech" />}
+ />
+ <Route
+ path="tournaments/:id"
+ lazy={() => import(
+ /* webpackChunkName: "tournament" */
+ '../pages/Tournament'
+ )}
+ />
+ <Route
+ path="twitch-bot"
+ lazy={() => import(
+ /* webpackChunkName: "admin" */
+ '../pages/TwitchBot'
+ )}
+ />
+ <Route path="users/:id" element={<User />} />
+ <Route path="/" element={<Front />} />
+ <Route path="*" element={<Navigate to="/" />} />
+ </Route>
+ <Route
+ path="doors-tracker"
+ lazy={() => import(
+ /* webpackChunkName: "tracker" */
+ '../pages/DoorsTracker'
+ )}
/>
- <Route
- path="rulesets/:name"
- element={<Technique basepath="rulesets" type="ruleset" />}
- />
- <Route path="schedule" element={<Schedule />} />
- <Route
- path="tech"
- element={<Techniques namespace="techniques" type="tech" />}
- />
- <Route
- path="tech/:name"
- element={<Technique basepath="tech" type="tech" />}
- />
- <Route path="tournaments/:id" element={<Tournament />} />
- <Route
- path="twitch-bot"
- element={<TwitchBot />}
- />
- <Route path="users/:id" element={<User />} />
- <Route path="/" element={<Front />} />
- <Route path="*" element={<Navigate to="/" />} />
- </Route>
- <Route
- path="doors-tracker"
- element={<DoorsTracker />}
- />
-</Routes>;
+ </Route>
+ )
+);
+
+const AppRoutes = () => <RouterProvider router={router} />;
export default AppRoutes;
import React from 'react';
import { Helmet } from 'react-helmet';
import { useTranslation } from 'react-i18next';
-import { BrowserRouter } from 'react-router-dom';
import Routes from './Routes';
import AlttpBaseRomProvider from '../helpers/AlttpBaseRomContext';
};
}, []);
- return <BrowserRouter>
- <AlttpBaseRomProvider>
- <UserProvider>
- <Helmet>
- <html lang={i18n.language} />
- <title>{t('general.appName')}</title>
- <meta name="description" content={t('general.appDescription')} />
- </Helmet>
- <Routes />
- </UserProvider>
- </AlttpBaseRomProvider>
- </BrowserRouter>;
+ return <AlttpBaseRomProvider>
+ <UserProvider>
+ <Helmet>
+ <html lang={i18n.language} />
+ <title>{t('general.appName')}</title>
+ <meta name="description" content={t('general.appDescription')} />
+ </Helmet>
+ <Routes />
+ </UserProvider>
+ </AlttpBaseRomProvider>;
};
export default App;
};
Item.propTypes = {
- event: PropTypes.arrayOf(PropTypes.shape({
+ event: PropTypes.shape({
+ corner: PropTypes.string,
+ description: PropTypes.shape({
+ }),
+ end: PropTypes.string,
id: PropTypes.number,
name: PropTypes.string,
- })),
+ start: PropTypes.string,
+ title: PropTypes.string,
+ }),
};
export default Item;
import ErrorMessage from '../components/common/ErrorMessage';
import Loading from '../components/common/Loading';
-const AlttpSeed = () => {
+export const Component = () => {
const params = useParams();
const { hash } = params;
<Seed onRetry={retry} patch={patch} seed={seed} />
</ErrorBoundary>;
};
-
-export default AlttpSeed;
const authEndpoint = 'https://discord.com/oauth2/authorize';
const clientId = process.env.MIX_DISCORD_CLIENT_ID;
-const DiscordBot = () => {
+export const Component = () => {
const { t } = useTranslation();
return <Container>
<Controls />
</Container>;
};
-
-export default DiscordBot;
const prevCSwitch = cur => nextCSwitch(nextCSwitch(cur));
-const DoorsTracker = () => {
+export const Component = () => {
const [state, setState] = React.useState(DUNGEONS.reduce((state, dungeon) => ({
...state,
[dungeon]: ITEMS.reduce((items, item) => ({
</div>
</>;
};
-
-export default DoorsTracker;
import React from 'react';
import { Container } from 'react-bootstrap';
import { Helmet } from 'react-helmet';
-import { withTranslation } from 'react-i18next';
+import { useTranslation } from 'react-i18next';
import { useParams } from 'react-router-dom';
import toastr from 'toastr';
import { useUser } from '../hooks/user';
import i18n from '../i18n';
-const Event = () => {
+export const Component = () => {
const params = useParams();
const { name } = params;
const { user } = useUser();
+ const { t } = useTranslation();
const [error, setError] = React.useState(null);
const [loading, setLoading] = React.useState(true);
parent_id: event.description_id,
...values,
});
- toastr.success(i18n.t('content.saveSuccess'));
+ toastr.success(t('content.saveSuccess'));
setEvent(event => ({
...event,
description: response.data,
}));
setShowContentDialog(false);
} catch (e) {
- toastr.error(i18n.t('content.saveError'));
+ toastr.error(t('content.saveError'));
}
}, [event && event.description_id]);
<Detail actions={actions} event={event} />
{episodes.length ? <>
<h2 className="mt-4">
- {i18n.t(hasConcluded(event)
+ {t(hasConcluded(event)
? 'events.pastEpisodes'
: 'events.upcomingEpisodes'
)}
/>
</ErrorBoundary>;
};
-
-export default withTranslation()(Event);
import Loading from '../components/common/Loading';
import List from '../components/events/List';
-const Events = () => {
+export const Component = () => {
const { t } = useTranslation();
const [error, setError] = React.useState(null);
</Container>
</ErrorBoundary>;
};
-
-export default Events;
import Pins from '../components/map/Pins';
import UWSuperTiles from '../components/map/UWSuperTiles';
-const Map = () => {
+export const Component = () => {
const [uwOverlay, setUWOverlay] = React.useState(false);
const { activeMap } = useParams();
</OpenSeadragon>
</Container>;
};
-
-export default Map;
import { toggleEventFilter } from '../helpers/Episode';
import { useUser } from '../hooks/user';
-const Schedule = () => {
+export const Component = () => {
const [ahead] = React.useState(14);
const [applyAs, setApplyAs] = React.useState('commentary');
const [behind] = React.useState(0);
</> : null}
</Container>;
};
-
-export default Schedule;
sortParticipants,
} from '../helpers/Tournament';
-const Tournament = () => {
+export const Component = () => {
const params = useParams();
const { id } = params;
<Detail addRound={addRound} tournament={tournament} />
</ErrorBoundary>;
};
-
-export default Tournament;
import { mayManageTwitchBot } from '../helpers/permissions';
import { useUser } from '../hooks/user';
-const TwitchBot = () => {
+export const Component = () => {
const { t } = useTranslation();
const { user } = useUser();
}
</Container>;
};
-
-export default TwitchBot;
])
.sourceMaps(true)
.version();
-if (mix.inProduction()) {
+//if (mix.inProduction()) {
mix.webpackConfig({
output: {
chunkFilename: 'js/chunks/[name].[chunkhash].js',
},
});
-} else {
- mix.webpackConfig({
- output: {
- asyncChunks: false,
- },
- });
-}
+//} else {
+// mix.webpackConfig({
+// output: {
+// asyncChunks: false,
+// },
+// });
+//}