diff --git a/src/renderer/components/dock/info-panel.scss b/src/renderer/components/dock/info-panel.scss index f481bd9884..23dcc52243 100644 --- a/src/renderer/components/dock/info-panel.scss +++ b/src/renderer/components/dock/info-panel.scss @@ -12,37 +12,12 @@ > .controls { white-space: nowrap; - - &:empty { - display: none; - } + flex: 1 1; &:not(:empty) + .info { - border: 1px solid $borderColor; - border-top: 0; - border-bottom: 0; min-height: 25px; padding-left: $padding; padding-right: $padding; } } - - > .info { - @include hidden-scrollbar; - - min-width: 40px; // min-space for icon - flex: 1 1; - white-space: nowrap; - text-overflow: ellipsis; - - > div { - padding-right: $padding; - flex-shrink: 0; - } - - .Icon { - margin: 0; - margin-right: $padding; - } - } } \ No newline at end of file diff --git a/src/renderer/components/dock/info-panel.tsx b/src/renderer/components/dock/info-panel.tsx index 39d998d9d4..db92098be8 100644 --- a/src/renderer/components/dock/info-panel.tsx +++ b/src/renderer/components/dock/info-panel.tsx @@ -38,35 +38,29 @@ export class InfoPanel extends Component { showNotifications: true, } - @observable.ref result: ReactNode; @observable error = ""; @observable waiting = false; componentDidMount() { disposeOnUnmount(this, [ reaction(() => this.props.tabId, () => { - this.result = "" - this.error = "" this.waiting = false }) ]) } @computed get errorInfo() { - return this.error || this.props.error; + return this.props.error; } submit = async () => { const { showNotifications } = this.props; - this.result = ""; - this.error = ""; this.waiting = true; try { - this.result = await this.props.submit() - if (showNotifications) Notifications.ok(this.result); + const result = await this.props.submit(); + if (showNotifications) Notifications.ok(result); } catch (error) { - this.error = error.toString(); - if (showNotifications) Notifications.error(this.error); + if (showNotifications) Notifications.error(error.toString()); } finally { this.waiting = false } @@ -81,27 +75,15 @@ export class InfoPanel extends Component { dockStore.closeTab(this.props.tabId); } - renderInfo() { - if (!this.props.showInlineInfo) { + renderErrorIcon() { + if (!this.props.showInlineInfo || !this.errorInfo) { return; } - const { result, errorInfo } = this; return ( - <> - {result && ( -
- - {result} -
- )} - {errorInfo && ( -
- - {errorInfo} -
- )} - - ) +
+ +
+ ); } render() { @@ -114,7 +96,7 @@ export class InfoPanel extends Component { {controls}
- {waiting ? <> {submittingMessage} : this.renderInfo()} + {waiting ? <> {submittingMessage} : this.renderErrorIcon()}