Skip to content
Snippets Groups Projects
Commit bc404a50 authored by xaralis's avatar xaralis
Browse files

Revert "wip"

This reverts commit 80f7624d.
parent 35d1e5a4
No related branches found
No related tags found
No related merge requests found
Pipeline #6458 passed
......@@ -8,17 +8,15 @@ import * as Sentry from "@sentry/react";
import { Integrations } from "@sentry/tracing";
import { loadAnnouncements } from "actions/announcements";
import { loadConfig, loadEventList } from "actions/global-info";
import { loadConfig } from "actions/global-info";
import { loadPosts } from "actions/posts";
import { loadProgram } from "actions/program";
import { loadMe, refreshAccessToken } from "actions/users";
import { initializeWSChannel } from "actions/ws";
import Footer from "components/Footer";
import Navbar from "components/Navbar";
import EventBoundRoute from "components/routing/EventBoundRoute";
import About from "pages/About";
import Home from "pages/Home";
import Index from "pages/Index";
import NotFound from "pages/NotFound";
import Program from "pages/Program";
import Protocol from "pages/Protocol";
......@@ -120,15 +118,10 @@ const BaseApp = () => {
</Helmet>
<Navbar />
<Switch>
<Route exact path="/" children={<Index />} />
<EventBoundRoute exact path="/event/live" children={<Home />} />
<EventBoundRoute exact path="/event/program" children={<Program />} />
<EventBoundRoute
exact
path="/event/protocol"
children={<Protocol />}
/>
<EventBoundRoute exact path="/event/about" children={<About />} />
<Route exact path="/" children={<Home />} />
<Route exact path="/program" children={<Program />} />
<Route exact path="/protocol" children={<Protocol />} />
<Route exact path="/about" children={<About />} />
<Route component={NotFound} />
</Switch>
<Footer />
......@@ -139,11 +132,10 @@ const BaseApp = () => {
};
const ConfiguredApp = () => {
// loadConfig.read();
// loadProgram.read();
// loadAnnouncements.read();
// loadPosts.read();
loadEventList.read();
loadConfig.read();
loadProgram.read();
loadAnnouncements.read();
loadPosts.read();
return (
<Suspense fallback={LoadingComponent}>
......
......@@ -6,33 +6,6 @@ import { fetch } from "api";
import { markdownConverter } from "markdown";
import { GlobalInfoStore } from "stores";
export const loadEventList = createAsyncAction(
async () => {
try {
const resp = await fetch("/events");
const payload = await resp.json();
if (!isArray(payload)) {
return errorResult([], "Unexpected response format");
}
return successResult(payload);
} catch (err) {
return errorResult([], err.toString());
}
},
{
postActionHook: ({ result }) => {
if (!result.error) {
GlobalInfoStore.update((state) => {
console.log(result.payload);
});
}
},
}
);
export const loadConfig = createAsyncAction(
async () => {
try {
......
import React from "react";
import { Redirect, Route } from "react-router-dom";
import PropTypes from "prop-types";
import { GlobalInfoStore } from "stores";
const EventBoundRoute = ({
component: Component,
children,
fallbackTo = "/",
...rest
}) => {
const { eventId } = GlobalInfoStore.useState();
return (
<Route
{...rest}
render={(props) =>
!!eventId ? (
children ? (
children
) : (
<Component {...props} />
)
) : (
<Redirect to={fallbackTo} />
)
}
/>
);
};
EventBoundRoute.propTypes = {
component: PropTypes.elementType,
children: PropTypes.node,
fallbackTo: PropTypes.string,
};
export default EventBoundRoute;
import React from "react";
const Index = () => {
return <div></div>;
};
export default Index;
......@@ -3,9 +3,7 @@ import { Store } from "pullstate";
/** @type {CF2021.GlobalInfoStorePayload} */
const globalInfoStoreInitial = {
currentEventId: null,
events: [],
connectionState: "offline",
connectionState: "connecting",
onlineMembers: 0,
onlineUsers: 0,
groupSizeHalf: null,
......
declare namespace CF2021 {
interface EventDetails {
name: string;
type: 1 | 2 | 3;
description?: string;
start: Date;
stream: string;
banner: string;
}
export interface GlobalInfoStorePayload {
// Current event selection
currentEventId: string;
events: EventDetails[];
connectionState: "connected" | "offline" | "connecting";
onlineMembers: number;
onlineUsers: number;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment