<commit_before>import _ from 'lodash'
import React, { Component } from 'react'
import { connect } from 'react-redux'
import { ThemeProvider } from 'emotion-theming'

import { Environment, withEnvironment } from 'rt-components'
import { Flex } from 'rt-components'
import { ConnectionType, ServiceConnectionInfo } from 'system'
import Icon from './Icon'

import { Root, Body, Fill, ExpandToggle, ServiceList, ServiceRoot, ServiceName, NodeCount } from './styled.js'

export const SERVICES = ['blotter', 'reference', 'execution', 'pricing', 'analytics'].map(serviceType => ({
  serviceType
}))

class StatusBar extends Component {
  state = {
    expanded: true
  }

  resolveTheme = theme => {
    const { mode } = this.props
    const currentTheme = theme.statusBar[mode]

    theme = {
      ...theme,
      ...theme.statusBar[mode],
      serviceItem: {
        connected: theme.statusBar.connected,
        disconnected: mode === 'connecting' ? theme.statusBar.connecting : theme.statusBar.disconnected
      }
    }

    return theme
  }

  toggleExpanded = () => this.setState(({ expanded }) => ({ expanded: !expanded }))

  render() {
    const {
      connectionStatus: { url, transportType },
      mode,
      serviceStatus
    } = this.props

    const { expanded } = this.state

    return (
      <ThemeProvider key={mode} theme={this.resolveTheme}>
        <Root expand={expanded}>
          <Body onClick={this.toggleExpanded}>
            <Icon name="check" />

            {mode === 'disconnected' ? (
              'Disconnected'
            ) : (
              <React.Fragment>
                {_.capitalize(mode)} to {url} ({transportType})
              </React.Fragment>
            )}

            <Fill />
<commit_msg>Fix <StatusBar/> default expanded state<commit_after>import _ from 'lodash'
import React, { Component } from 'react'
import { connect } from 'react-redux'
import { ThemeProvider } from 'emotion-theming'

import Icon from './Icon'
import { Root, Body, Fill, ExpandToggle, ServiceList, ServiceRoot, ServiceName, NodeCount } from './styled.js'

export const SERVICES = ['blotter', 'reference', 'execution', 'pricing', 'analytics'].map(serviceType => ({
  serviceType
}))

class StatusBar extends Component {
  state = {
    expanded: false
  }

  resolveTheme = theme => {
    const { mode } = this.props
    const currentTheme = theme.statusBar[mode]

    return {
      ...theme,

      ...theme.statusBar[mode],

      serviceItem: {
        connected: theme.statusBar.connected,
        disconnected: mode === 'connecting' ? theme.statusBar.connecting : theme.statusBar.disconnected
      }
    }
  }

  toggleExpanded = () => this.setState(({ expanded }) => ({ expanded: !expanded }))

  render() {
    const {
      connectionStatus: { url, transportType },
      mode,
      serviceStatus
    } = this.props

    const { expanded } = this.state

    return (
      <ThemeProvider key={mode} theme={this.resolveTheme}>
        <Root expand={expanded}>
          <Body onClick={this.toggleExpanded}>
            <Icon name="check" />

            {mode === 'disconnected' ? (
              'Disconnected'
            ) : (
              <React.Fragment>
                {_.capitalize(mode)} to {url} ({transportType})
              </React.Fragment>
            )}

            <Fill />

{'fraction_non_alphanumeric': 0.13453453453453454, 'fraction_numerical': 0.0, 'mean_word_length': 2.5100105374077977, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5272910', 'n_tokens_mistral': 955, 'n_tokens_neox': 928, 'n_words': 224}