<commit_before>import './gennyHeader.scss';
import { customStyle } from './gennyHeaderStyle';
import React, { Component } from 'react';
import { Label, Dropdown, ImageView, IconSmall, GennyTreeView, GennyNotification, ColorPicker, Device, Header, Selector } from 'views/components';
import { Grid } from '@genny-project/layson';
import { string,object, bool  } from 'prop-types';
import store from 'views/store';
import { GennyBridge } from 'utils/genny';
import decode_token from 'jwt-decode';

class GennyHeader extends Component {

  static defaultProps = {
    className: '',
    style: {},
    hideSubheader: false
  }

  static propTypes = {
    className: string,
    height: string,
    style: object,
    hideSubheader: bool
  };

  state = {
  }

  handleLogout = () => {
    this.sendData('LOGOUT', {
      code: 'LOGOUT',
    });
  }

  handleAccount = () => {
    this.sendData('ACCOUNTS', {
      code: 'ACCOUNTS',
    });
  }

  handleProfile = () => {
    this.sendData('PROFILE', {
      code: 'PROFILE',
    });
  }

  handleMessages = () => {
    this.sendData('TV_SELECT', {
      code: 'TV1',
      value: 'GRP_COMMS_TEST'
  }, 'GRP_COMMS_TEST');
  }

  sendEvent(event, data) {
    GennyBridge.sendTVEvent(event, data);
  }

  handleClickImage = () => {
    //console.log("clicked profile image");
  }

  sendData(event, data) {
    GennyBridge.sendLogout(event, data);
  }

  onColorChange = (color) => {
    let answer = [
      {
        targetCode: this.props.currentProject,
        attributeCode: 'PRI_COLOR',
        value: color
      }
    ];
    GennyBridge.sendAnswer(answer);
  };

  render() {

    const { style, className, projectTitle, projectGreeting, userName, userImage, hideSubheader, token } = this.props;
    const { } = this.state;
    const componentStyle = {
      ...style,
      ...customStyle.gennyHeader
    };

    let session_data = decode_token(token);
    let roles = session_data.realm_access.roles;
    console.log(roles);

    return (
      <div className={`genny-header ${window.getScreenSize()}`} style={componentStyle}>
        <Header
          className='main-header'
          cols={[
            { style: { 
              flexGrow: "1", 
              color: "white",
              display: "flex",
              alignItems: "center",
              paddingLeft: "5px",
              paddingRight: "5px" 
            }},
            { style: { 
              flexGrow: "1", 
              justifyContent: "flex-end", 
              color: "white",
              display: "flex",
              alignItems: "center",
              paddingLeft: "5px",
              paddingRight: "5px" 
            }}
          ]} 
          rows={[ { style: { flexGrow: "1", paddingLeft: "50px", height: "100%" } } ]}
        >
          <Label text={projectTitle} position={[0,0]} />
          {/*<GennyNotification position={[0,1]} />*/}
          
          <Dropdown 
            style={ customStyle.dropdown } 
            position={[0,1]}
            header={
              <span style={ customStyle.dropdownSpan }><Label text={`${userName}`} /><IconSmall name="expand_more" /></span>
            }
          >
            <ul className="dropdown-profile" style={ customStyle.dropdownProfile }>
              <li style={ customStyle.dropdownLi } onClick={this.handleProfile}><IconSmall name="person" /><span>Profile</span></li>
              <li style={ customStyle.dropdownLi } onClick={this.handleAccount}><IconSmall name="settings" /><span>Account</span></li>
              <Selector checkValues={roles} showValues={['uma_authorization']}>
                <li style={ customStyle.dropdownLi } onClick={this.handleMessages}><IconSmall name="email" /><span>Test Message</span></li>
              </Selector>
              <br/>
              <li style={ customStyle.dropdownLi } onClick={this.handleLogout}><IconSmall name="power_settings_new" /><span>Log Out</span></li>
            </ul>
          </Dropdown>
          
          {/*}
          <Device isDesktop position={[0,1]}>
            <ImageView src={userImage} onClick={this.handleClickImage} style={{ width: '40px', minWidth: '40px'}}/>
          </Device>
          <Device isDesktop position={[0,1]}>
            <IconSmall className="help" name="help"/>
            </Device>*/}
        </Header>
        { !hideSubheader ? 
        <Grid className='sub-header' cols={[1]} rows={1} style={ customStyle.subHeader }>
          <GennyTreeView isHorizontal={true} style={{ backgroundColor: componentStyle.backgroundColor }} position={[0,0]}/>
        </Grid> : null }
      </div>
    );
  }
}

export default GennyHeader;<commit_msg>fixed header<commit_after>import './gennyHeader.scss';
import { customStyle } from './gennyHeaderStyle';
import React, { Component } from 'react';
import { Label, Dropdown, ImageView, IconSmall, GennyTreeView, GennyNotification, ColorPicker, Device, Header, Selector } from 'views/components';
import { Grid } from '@genny-project/layson';
import { string,object, bool  } from 'prop-types';
import store from 'views/store';
import { GennyBridge } from 'utils/genny';
import decode_token from 'jwt-decode';

class GennyHeader extends Component {

  static defaultProps = {
    className: '',
    style: {},
    hideSubheader: false
  }

  static propTypes = {
    className: string,
    height: string,
    style: object,
    hideSubheader: bool
  };

  state = {
  }

  handleLogout = () => {
    this.sendData('LOGOUT', {
      code: 'LOGOUT',
    });
  }

  handleAccount = () => {
    this.sendData('ACCOUNTS', {
      code: 'ACCOUNTS',
    });
  }

  handleProfile = () => {
    this.sendData('PROFILE', {
      code: 'PROFILE',
    });
  }

  handleMessages = () => {
    this.sendData('TV_SELECT', {
      code: 'TV1',
      value: 'GRP_COMMS_TEST'
  }, 'GRP_COMMS_TEST');
  }

  sendEvent(event, data) {
    GennyBridge.sendTVEvent(event, data);
  }

  handleClickImage = () => {
    //console.log("clicked profile image");
  }

  sendData(event, data) {
    GennyBridge.sendLogout(event, data);
  }

  onColorChange = (color) => {
    let answer = [
      {
        targetCode: this.props.currentProject,
        attributeCode: 'PRI_COLOR',
        value: color
      }
    ];
    GennyBridge.sendAnswer(answer);
  };

  render() {

    const { style, className, projectTitle, projectGreeting, userName, userImage, hideSubheader, token } = this.props;
    const { } = this.state;
    const componentStyle = {
      ...style,
      ...customStyle.gennyHeader
    };

    let session_data = decode_token(token);
    let roles = session_data.realm_access.roles;

    return (
      <div className={`genny-header ${window.getScreenSize()}`} style={componentStyle}>
        <Header
          className='main-header'
          cols={[
            { style: {
              flexGrow: "1",
              color: "white",
              display: "flex",
              alignItems: "center",
              paddingLeft: "5px",
              paddingRight: "5px"
            }},
            { style: {
              flexGrow: "1",
              justifyContent: "flex-end",
              color: "white",
              display: "flex",
              alignItems: "center",
              paddingLeft: "5px",
              paddingRight: "5px"
            }}
          ]}
          rows={[ { style: { flexGrow: "1", paddingLeft: "50px", height: "100%" } } ]}
        >
          <Label position={[0,0]} text={projectTitle} />
          <Label position={[0,1]} text={`${userName}`} />
          <Dropdown
            style={ customStyle.dropdown }
            position={[0,1]}
            header={
              <span style={ customStyle.dropdownSpan }><IconSmall name="expand_more" /></span>
            }
          >
            <ul className="dropdown-profile" style={ customStyle.dropdownProfile }>
              <li style={ customStyle.dropdownLi } onClick={this.handleProfile}><IconSmall name="person" /><span>Profile</span></li>
              <li style={ customStyle.dropdownLi } onClick={this.handleAccount}><IconSmall name="settings" /><span>Account</span></li>
              <Selector checkValues={roles} showValues={['uma_authorization']}>
                <li style={ customStyle.dropdownLi } onClick={this.handleMessages}><IconSmall name="email" /><span>Test Message</span></li>
              </Selector>
              <br/>
              <li style={ customStyle.dropdownLi } onClick={this.handleLogout}><IconSmall name="power_settings_new" /><span>Log Out</span></li>
            </ul>
          </Dropdown>

          {/*}
          <Device isDesktop position={[0,1]}>
            <ImageView src={userImage} onClick={this.handleClickImage} style={{ width: '40px', minWidth: '40px'}}/>
          </Device>
          <Device isDesktop position={[0,1]}>
            <IconSmall className="help" name="help"/>
            </Device>*/}
        </Header>
        { !hideSubheader ?
        <Grid className='sub-header' cols={[1]} rows={1} style={ customStyle.subHeader }>
          <GennyTreeView isHorizontal={true} style={{ backgroundColor: componentStyle.backgroundColor }} position={[0,0]}/>
        </Grid> : null }
      </div>
    );
  }
}

export default GennyHeader;
{'fraction_non_alphanumeric': 0.1533203125, 'fraction_numerical': 0.006727430555555556, 'mean_word_length': 2.2894361170592434, 'pattern_counts': {'":': 0, '<': 94, '<?xml version=': 0, '>': 106, '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': '3399538', 'n_tokens_mistral': 2786, 'n_tokens_neox': 2699, 'n_words': 538}