import { Box, Col } from '@tlon/indigo-react'; import React, { Component } from 'react'; import dark from '@tlon/indigo-dark'; import light from '@tlon/indigo-light'; import { ThemeProvider } from 'styled-components'; import Api from './api'; import { History } from './components/history'; import { Input } from './components/input'; import './css/custom.css'; import Store from './store'; import Subscription from './subscription'; import Channel from './lib/channel'; class TermApp extends Component { store: Store; api: any; subscription: any; constructor(props) { super(props); this.store = new Store(); this.store.setStateHandler(this.setState.bind(this)); this.state = this.store.state; } resetControllers() { this.api = null; this.subscription = null; } componentDidMount() { this.resetControllers(); // eslint-disable-next-line new-cap const channel = new Channel(); this.api = new Api(window.ship, channel); this.store.api = this.api; this.subscription = new Subscription(this.store, this.api, channel); this.subscription.start(); } componentWillUnmount() { this.subscription.delete(); this.store.clear(); this.resetControllers(); } getTheme() { const { props } = this; return ((props.dark && props?.display?.theme == 'auto') || props?.display?.theme == 'dark' ) ? dark : light; } render() { const theme = this.getTheme(); return ( {/* @ts-ignore declare props in later pass */} ); } } export default TermApp;