From a2e4316879908c5bc2c38cef81eef9152476b6f6 Mon Sep 17 00:00:00 2001 From: Dominik Guzei Date: Tue, 26 Mar 2019 15:26:20 +0100 Subject: show infobox when updating workspaces --- packages/ui/src/infobox/index.tsx | 7 ++ src/components/ui/Infobox.js | 17 ++++- .../workspaces/components/WorkspacesDashboard.js | 89 +++++++++++++--------- .../workspaces/containers/WorkspacesScreen.js | 3 +- src/features/workspaces/store.js | 15 ++-- src/i18n/locales/defaultMessages.json | 29 +++++-- src/i18n/locales/en-US.json | 3 +- .../workspaces/components/WorkspacesDashboard.json | 29 +++++-- src/stores/lib/Request.js | 4 +- 9 files changed, 129 insertions(+), 67 deletions(-) diff --git a/packages/ui/src/infobox/index.tsx b/packages/ui/src/infobox/index.tsx index 1a442a733..9066a623e 100644 --- a/packages/ui/src/infobox/index.tsx +++ b/packages/ui/src/infobox/index.tsx @@ -11,6 +11,7 @@ interface IProps extends IWithStyle { type?: string; dismissable?: boolean; onDismiss?: () => void; + onUnmount?: () => void; ctaOnClick?: () => void; ctaLabel?: string; ctaLoading?: boolean; @@ -46,6 +47,7 @@ const styles = (theme: Theme) => ({ wrapper: { position: 'relative', overflow: 'hidden', + height: 'auto', }, infobox: { alignItems: 'center', @@ -129,6 +131,11 @@ class InfoboxComponent extends Component { }, 3000); } + componentWillUnmount(): void { + const { onUnmount } = this.props; + if (onUnmount) onUnmount(); + } + render() { const { classes, diff --git a/src/components/ui/Infobox.js b/src/components/ui/Infobox.js index a33c6474a..0917ee9f0 100644 --- a/src/components/ui/Infobox.js +++ b/src/components/ui/Infobox.js @@ -13,6 +13,8 @@ export default @observer class Infobox extends Component { ctaLabel: PropTypes.string, ctaLoading: PropTypes.bool, dismissable: PropTypes.bool, + onDismiss: PropTypes.func, + onSeen: PropTypes.func, }; static defaultProps = { @@ -22,12 +24,19 @@ export default @observer class Infobox extends Component { ctaOnClick: () => null, ctaLabel: '', ctaLoading: false, + onDismiss: () => null, + onSeen: () => null, }; state = { dismissed: false, }; + componentDidMount() { + const { onSeen } = this.props; + if (onSeen) onSeen(); + } + render() { const { children, @@ -37,6 +46,7 @@ export default @observer class Infobox extends Component { ctaLoading, ctaOnClick, dismissable, + onDismiss, } = this.props; if (this.state.dismissed) { @@ -76,9 +86,10 @@ export default @observer class Infobox extends Component { {dismissable && (