blob: 55b2492469faa7ed3f1fda6bc35ad5c8fe489fc8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
import * as React from 'react';
import connect, { Connect } from '../../flux/connect';
import { SetTitleAction } from '../../actions/titleActions';
import { AddErrorInfoAction } from '../../actions/errorActions';
import { IconType } from '../../models/iconDefinition';
export interface IAppFrameProps {
title: string;
icon?: IconType;
}
/**
* Represents a component to wich will embed each single app providing the
* functionality to update the title and implement an exeprion border.
*/
export class AppFrame extends React.Component<IAppFrameProps & Connect> {
public render(): JSX.Element {
return (
<div style={{ flex: "1", overflow: "auto", display: "flex", flexDirection: "column" }}>
{ this.props.children }
</div>
)
}
public componentDidMount() {
this.props.dispatch(new SetTitleAction(this.props.title, this.props.icon));
}
public componentDidCatch(error: Error | null, info: object) {
this.props.dispatch(new AddErrorInfoAction({ error, info }));
}
}
export default connect()(AppFrame);
|