Restructured components and pages
This commit is contained in:
parent
6b1b650f78
commit
c6c98d36a0
@ -19,7 +19,7 @@ function NavContainer() {
|
|||||||
|
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route path={route.device(":deviceId")} component={p.DevicePage}/>
|
<Route path={route.device(":deviceId")} component={p.DevicePage}/>
|
||||||
<Route path={route.messagesTest} component={p.MessagesTestPage}/>
|
<Route path={route.messagesTest} component={p.MessageTest}/>
|
||||||
<Redirect to="/"/>
|
<Redirect to="/"/>
|
||||||
</Switch>
|
</Switch>
|
||||||
|
|
@ -1,5 +1,3 @@
|
|||||||
export { default as App } from "./App";
|
|
||||||
export { default as DevicesView } from "./DevicesView";
|
|
||||||
export { default as DeviceView } from "./DeviceView";
|
export { default as DeviceView } from "./DeviceView";
|
||||||
export { default as DurationView } from "./DurationView";
|
export { default as DurationView } from "./DurationView";
|
||||||
export { default as MessagesView } from "./MessagesView";
|
export { default as MessagesView } from "./MessagesView";
|
||||||
@ -9,6 +7,5 @@ export { default as ScheduleView } from "./ScheduleView";
|
|||||||
export { default as SectionRunnerView } from "./SectionRunnerView";
|
export { default as SectionRunnerView } from "./SectionRunnerView";
|
||||||
export { default as SectionTable } from "./SectionTable";
|
export { default as SectionTable } from "./SectionTable";
|
||||||
export { default as NavBar } from "./NavBar";
|
export { default as NavBar } from "./NavBar";
|
||||||
export { default as MessageTest } from "./MessageTest";
|
|
||||||
export { default as ProgramSequenceView } from "./ProgramSequenceView";
|
export { default as ProgramSequenceView } from "./ProgramSequenceView";
|
||||||
export { default as SectionChooser } from "./SectionChooser";
|
export { default as SectionChooser } from "./SectionChooser";
|
||||||
|
@ -3,7 +3,7 @@ import * as ReactDOM from "react-dom";
|
|||||||
import { AppContainer } from "react-hot-loader";
|
import { AppContainer } from "react-hot-loader";
|
||||||
import { Router } from "react-router-dom";
|
import { Router } from "react-router-dom";
|
||||||
|
|
||||||
import App from "@client/components/App";
|
import App from "@client/App";
|
||||||
import { AppState, ProvideState } from "@client/state";
|
import { AppState, ProvideState } from "@client/state";
|
||||||
import logger from "@common/logger";
|
import logger from "@common/logger";
|
||||||
|
|
||||||
@ -30,8 +30,8 @@ const doRender = (Component: React.ComponentType) => {
|
|||||||
doRender(App);
|
doRender(App);
|
||||||
|
|
||||||
if (module.hot) {
|
if (module.hot) {
|
||||||
module.hot.accept("@client/components/App", () => {
|
module.hot.accept("@client/App", () => {
|
||||||
const NextApp = require<any>("@client/components/App").default as typeof App;
|
const NextApp = require<any>("@client/App").default as typeof App;
|
||||||
doRender(NextApp);
|
doRender(NextApp);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -5,14 +5,15 @@ import { Item } from "semantic-ui-react";
|
|||||||
import DeviceView from "@client/components/DeviceView";
|
import DeviceView from "@client/components/DeviceView";
|
||||||
import { RouteComponentProps, withRouter } from "react-router";
|
import { RouteComponentProps, withRouter } from "react-router";
|
||||||
|
|
||||||
class DevicesView extends React.Component<{deviceId: string} & RouteComponentProps<any>> {
|
class DevicePage extends React.Component<RouteComponentProps<{ deviceId: string }>> {
|
||||||
render() {
|
render() {
|
||||||
|
const { match: { params: { deviceId } } } = this.props;
|
||||||
return (
|
return (
|
||||||
<Item.Group divided>
|
<Item.Group divided>
|
||||||
<DeviceView deviceId={this.props.deviceId} />
|
<DeviceView deviceId={deviceId} />
|
||||||
</Item.Group>
|
</Item.Group>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default withRouter(observer(DevicesView));
|
export default withRouter(observer(DevicePage));
|
@ -78,5 +78,4 @@ class LoginPage extends React.Component<{ appState: AppState }> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const DecoratedLoginPage = injectState(observer(LoginPage));
|
export default injectState(observer(LoginPage));
|
||||||
export { DecoratedLoginPage as LoginPage };
|
|
||||||
|
@ -3,7 +3,7 @@ import { Redirect } from "react-router";
|
|||||||
|
|
||||||
import { AppState, ConsumeState } from "@client/state";
|
import { AppState, ConsumeState } from "@client/state";
|
||||||
|
|
||||||
export function LogoutPage() {
|
export default function LogoutPage() {
|
||||||
function consumeState(appState: AppState) {
|
function consumeState(appState: AppState) {
|
||||||
appState.tokenStore.clear();
|
appState.tokenStore.clear();
|
||||||
return (
|
return (
|
||||||
|
@ -1,20 +1,5 @@
|
|||||||
import * as React from "react";
|
export { default as DevicePage } from "./DevicePage";
|
||||||
import { RouteComponentProps } from "react-router";
|
export { default as LoginPage } from "./LoginPage";
|
||||||
|
export { default as LogoutPage } from "./LogoutPage";
|
||||||
import { DevicesView, MessageTest} from "@client/components";
|
export { default as MessageTest } from "./MessageTest";
|
||||||
|
|
||||||
export { LoginPage } from "./LoginPage";
|
|
||||||
export { LogoutPage } from "./LogoutPage";
|
|
||||||
export { default as ProgramPage } from "./ProgramPage";
|
export { default as ProgramPage } from "./ProgramPage";
|
||||||
|
|
||||||
export function DevicePage({ match }: RouteComponentProps<{ deviceId: string }>) {
|
|
||||||
return (
|
|
||||||
<DevicesView deviceId={match.params.deviceId}/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function MessagesTestPage() {
|
|
||||||
return (
|
|
||||||
<MessageTest/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user