ghost-portal/packages/app-storage/src/index.tsx
Jaco Greeff 45e42047f3
Node status app (#618)
* Structure for app-status (bonus: starting app-template to document)

* Add steps to add a new app from the template

* Follow instructions, ensure we have something working

* README update

* Disable Wiki (for the time being)

* Split last sidebar render helper

* speellung (edit: spelling), AppProps & empty new apps (current)

* app-template -> app-123code

* Status header in-place

* Very basic distus display in place

* Overflow for hash

* app-status -> app-nodeinfo
2019-01-19 22:18:35 +01:00

59 lines
1.3 KiB
TypeScript

// Copyright 2017-2019 @polkadot/app-storage authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { AppProps, I18nProps } from '@polkadot/ui-app/types';
import { QueryTypes } from './types';
import './index.css';
import React from 'react';
import Queries from './Queries';
import Selection from './Selection/index';
import translate from './translate';
type Props = AppProps & I18nProps;
type State = {
queue: Array<QueryTypes>
};
class StorageApp extends React.PureComponent<Props, State> {
state: State = {
queue: []
};
render () {
const { queue } = this.state;
return (
<main className='storage--App'>
<Selection onAdd={this.onAdd} />
<Queries
onRemove={this.onRemove}
value={queue}
/>
</main>
);
}
private onAdd = (query: QueryTypes): void => {
this.setState(
(prevState: State): State => ({
queue: [query].concat(prevState.queue)
})
);
}
private onRemove = (id: number): void => {
this.setState(
(prevState: State): State => ({
queue: prevState.queue.filter((item) => item.id !== id)
})
);
}
}
export default translate(StorageApp);