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 styled, { 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'; //TODO wrap in themeprovider, as in landscape root app.js 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(); console.log('xx--------', this.props); 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;