/** * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author Alexander Rose */ import * as React from 'react' import { StructureView } from '../structure-view'; import { App } from '../app'; import { Viewport } from './viewport'; import { StructureViewComponent } from './structure-view'; // export function FileInput (props: { // accept: string // onChange: (v: FileList | null) => void, // }) { // return props.onChange.call(null, e.target.files)} // /> // } export interface AppProps { app: App } export interface AppState { structureView: StructureView | null } export class AppComponent extends React.Component { state = { structureView: this.props.app.structureView, } componentDidMount() { this.props.app.pdbIdLoaded.subscribe((structureView) => { this.setState({ structureView: this.props.app.structureView }) }) } render() { const { structureView } = this.state return
Load PDB ID { if (e.keyCode === 13) { const value = e.currentTarget.value.trim() if (value) { this.props.app.loadPdbId(value) } } }} />
Load CIF file { if (e.target.files) this.props.app.loadCifFile(e.target.files[0]) }} />

{structureView ? : ''}
; } }