<commit_before>import React from 'react';
import SubmitButton from './submit_button';
import Header from '../header/header';
import CloseButton from '../header/close_button';
import GlobalError from './global_error';
import * as l from './index';
const ui = l.ui;

export default class Lock extends React.Component {
  componentDidMount() {
    setTimeout(() => { this.refs.lock.getDOMNode().className += ' opened' }, 10);
  }

  render() {
    const { completed, lock, submitHandler } = this.props;
    const Content = this.props.content;
    const Confirmation = this.props.confirmation || null;

    const overlay = ui.appendContainer(lock) ?
      <div className="auth0-lock-overlay"/> : null;

    const icon = ui.icon(lock) || ""; // TODO: figure out if we still need the default and why, so we can remove it
    const showCloseButton = ui.closable(lock);
    const globalError = lock.get("globalError");
    const gravatar = ui.gravatar(lock) && lock.get("gravatar");

    const disableSubmit = lock.get("submitting");

    // TODO: handle opened class properly
    let className = "auth0-lock opened";
    if (l.submitting(lock)) {
      className += " auth0-lock-mode-loading opened";
    } else if (completed) {
      className += " auth0-lock-mode-completed opened";
    }

    return (
      <div className={className} ref="lock">
        {overlay}
        <div className="auth0-lock-center">
          <form className="auth0-lock-widget" onSubmit={::this.handleSubmit}>
            {/* TODO: update gravatar markup here */}
            {showCloseButton && <CloseButton lockID={lock.get("id")} />}
            <div className="auth0-lock-widget-container">
              <Header icon={icon} gravatar={gravatar}/>
              {globalError && <GlobalError message={globalError} />}
              <div className="auth0-lock-content">
                <this.props.content lock={lock} />
              </div>
              <SubmitButton disabled={disableSubmit} />
              <a href="https://auth0.com/" target="_blank" className="auth0-lock-badge auth0-lock-icon"/>
            </div>
            {Confirmation && <Confirmation lock={lock} />}<commit_msg>Add opened class only when lock is being shown<commit_after>import React from 'react/addons';
import SubmitButton from './submit_button';
import Header from '../header/header';
import CloseButton from '../header/close_button';
import GlobalError from './global_error';
import * as l from './index';
const ui = l.ui;
var ReactCSSTransitionGroup = React.addons.CSSTransitionGroup;

export default class Lock extends React.Component {
  // componentDidMount() {
  //   setTimeout(() => { this.refs.lock.getDOMNode().className += ' opened' }, 10);
  // }
  //
  render() {
    const { completed, lock, submitHandler } = this.props;
    const Content = this.props.content;
    const Confirmation = this.props.confirmation || null;

    const overlay = ui.appendContainer(lock) ?
      <div className="auth0-lock-overlay"/> : null;

    const icon = ui.icon(lock) || ""; // TODO: figure out if we still need the default and why, so we can remove it
    const showCloseButton = ui.closable(lock);
    const globalError = lock.get("globalError");
    const gravatar = ui.gravatar(lock) && lock.get("gravatar");

    const disableSubmit = lock.get("submitting");

    let className = "auth0-lock";
    if (lock.get("show")) {
      className += " opened";
    }
    if (l.submitting(lock)) {
      className += " auth0-lock-mode-loading";
    } else if (completed) {
      className += " auth0-lock-mode-completed";
    }

    return (
      <div className={className} ref="lock">
        {overlay}
        <div className="auth0-lock-center">
          <form className="auth0-lock-widget" onSubmit={::this.handleSubmit}>
            {/* TODO: update gravatar markup here */}
            {showCloseButton && <CloseButton lockID={lock.get("id")} />}
            <div className="auth0-lock-widget-container">
              <Header icon={icon} gravatar={gravatar}/>
              {globalError && <GlobalError message={globalError} />}
              <div className="auth0-lock-content">
                <this.props.content lock={lock} />
              </div>
              <SubmitButton disabled={disableSubmit} />
              <a href="https://auth0.com/" target="_blank" className="auth0-lock-badge auth0-lock-icon"/>
            </div>
            {Confirmation && <Confirmation lock={lock} />}
{'fraction_non_alphanumeric': 0.1478319478768816, 'fraction_numerical': 0.005841383958660975, 'mean_word_length': 2.801878736122972, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 35, 'https://': 2, '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': '6391746', 'n_tokens_mistral': 1271, 'n_tokens_neox': 1238, 'n_words': 311}