• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

electron / fiddle / 3934490608

pending completion
3934490608

push

github

Erick Zhao
v0.32.1

931 of 1088 branches covered (85.57%)

Branch coverage included in aggregate %.

3456 of 3711 relevant lines covered (93.13%)

364.63 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/renderer/components/output-editors-wrapper.tsx
1
import * as React from 'react';
×
2

3
import { reaction } from 'mobx';
×
4
import { Mosaic, MosaicNode, MosaicParent } from 'react-mosaic-component';
×
5

6
import { AppState } from '../state';
7
import { Editors } from './editors';
×
8
import { Outputs } from './outputs';
×
9
import { Sidebar } from './sidebar';
×
10

11
interface WrapperProps {
12
  appState: AppState;
13
}
14

15
interface WrapperState {
16
  mosaic: MosaicNode<WrapperEditorId>;
17
  focusable: boolean;
18
}
19

20
export type WrapperEditorId = 'output' | 'editors' | 'sidebar';
21

22
export class OutputEditorsWrapper extends React.Component<
×
23
  WrapperProps,
24
  WrapperState
25
> {
26
  private MOSAIC_ELEMENTS = {
×
27
    output: <Outputs appState={this.props.appState} />,
28
    editors: <Editors appState={this.props.appState} />,
29
    sidebar: <Sidebar appState={this.props.appState} />,
30
  };
31

32
  constructor(props: any) {
33
    super(props);
×
34
    this.state = {
×
35
      mosaic: {
36
        direction: 'column',
37
        first: 'output',
38
        second: {
39
          direction: 'row',
40
          first: 'sidebar',
41
          second: 'editors',
42
          splitPercentage: 15,
43
        },
44
        splitPercentage: 25,
45
      },
46
      focusable: true,
47
    };
48
    reaction(
×
49
      () => this.props.appState.isSettingsShowing,
×
50
      (isSettingsShowing) => this.setState({ focusable: !isSettingsShowing }),
×
51
    );
52
  }
53

54
  public render() {
55
    return (
×
56
      <Mosaic<WrapperEditorId>
57
        renderTile={(id: string) => this.MOSAIC_ELEMENTS[id]}
×
58
        resize={{ minimumPaneSizePercentage: 15 }}
59
        value={this.state.mosaic}
60
        onChange={this.onChange}
61
        className={!this.state.focusable ? 'tabbing-hidden' : undefined}
×
62
      />
63
    );
64
  }
65

66
  private onChange = (rootNode: MosaicParent<WrapperEditorId>) => {
×
67
    const isConsoleShowing = rootNode.splitPercentage !== 0;
×
68

69
    if (isConsoleShowing !== this.props.appState.isConsoleShowing) {
×
70
      this.props.appState.isConsoleShowing = isConsoleShowing;
×
71
    }
72
    this.setState({ mosaic: rootNode });
×
73
  };
74
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc