<commit_before>import * as React from "react";
import * as moment from "moment"
import {thread} from "../thread";
import {auth} from "../auth";
import {IMessage, IUser} from "../../../common/data";

interface UserListState {
  users: IUser[];
}

class UserList extends React.Component<{}, UserListState> {
  constructor() {
    super();
    this.state = {
      users: []
    };
    thread.on("connectionUpdate", () => {
      this.setState({
        users: thread.availableUsers
      });
    });
  }

  render() {
    const {users} = this.state;
    return (
      <div className="user-list">
        <div>Available users:</div>
        <ul>
          {users.map((user, i)=><li key={i}>{user.name}</li>)}
        </ul>
      </div>
    );
  }
}

interface UserViewState {
  user?: IUser;
  loggedOut?: boolean;
}

class UserView extends React.Component<{}, UserViewState> {
  constructor() {
    super();
    this.state = {
      user: null,
      loggedOut: false
    };
    auth.on("change", () => {
      this.setState({
        user: auth.user,
        loggedOut: auth.loggedOut
      });
    });
  }

  render() {
    const {user, loggedOut} = this.state;

    if (user) {
      const signOut = () => auth.logOut();
      return (
        <div className="user-view">
          <div className="name">{user.name}</div>
          <a href="#" className="sign-out" onClick={signOut}>Log Out</a>
        </div>
      )
    } else if (loggedOut) {
      const signIn = () => auth.logIn();
      return (
        <div className="user-view">
          <a href="#" className="sign-in" onClick={signIn}>Log In</a>
        </div>
      )
    } else {
      return (
        <div className="user-view">
        </div>
      )
    }
  }
}

const MessageView = (props: {message: IMessage}) => {
  const {text, user, createdAt} = props.message;
  const time = moment(createdAt).format("MMM Do, h:mm:ss A")
  return (
    <div className="message">
      <div className="info">
        <div className="user">{user.name}</div>
        <div className="time">{time}</div>
      </div>
      <div className="text">{text}</div>
    </div>
  );
}

class MessageForm extends React.Component<{}, {}> {<commit_msg>No seconds<commit_after>import * as React from "react";
import * as moment from "moment"
import {thread} from "../thread";
import {auth} from "../auth";
import {IMessage, IUser} from "../../../common/data";

interface UserListState {
  users: IUser[];
}

class UserList extends React.Component<{}, UserListState> {
  constructor() {
    super();
    this.state = {
      users: []
    };
    thread.on("connectionUpdate", () => {
      this.setState({
        users: thread.availableUsers
      });
    });
  }

  render() {
    const {users} = this.state;
    return (
      <div className="user-list">
        <div>Available users:</div>
        <ul>
          {users.map((user, i)=><li key={i}>{user.name}</li>)}
        </ul>
      </div>
    );
  }
}

interface UserViewState {
  user?: IUser;
  loggedOut?: boolean;
}

class UserView extends React.Component<{}, UserViewState> {
  constructor() {
    super();
    this.state = {
      user: null,
      loggedOut: false
    };
    auth.on("change", () => {
      this.setState({
        user: auth.user,
        loggedOut: auth.loggedOut
      });
    });
  }

  render() {
    const {user, loggedOut} = this.state;

    if (user) {
      const signOut = () => auth.logOut();
      return (
        <div className="user-view">
          <div className="name">{user.name}</div>
          <a href="#" className="sign-out" onClick={signOut}>Log Out</a>
        </div>
      )
    } else if (loggedOut) {
      const signIn = () => auth.logIn();
      return (
        <div className="user-view">
          <a href="#" className="sign-in" onClick={signIn}>Log In</a>
        </div>
      )
    } else {
      return (
        <div className="user-view">
        </div>
      )
    }
  }
}

const MessageView = (props: {message: IMessage}) => {
  const {text, user, createdAt} = props.message;
  const time = moment(createdAt).format("MMM Do, h:mm A")
  return (
    <div className="message">
      <div className="info">
        <div className="user">{user.name}</div>
        <div className="time">{time}</div>
      </div>
      <div className="text">{text}</div>
    </div>
  );
}

class MessageForm extends React.Component<{}, {}> {
{'fraction_non_alphanumeric': 0.18324965769055226, 'fraction_numerical': 0.0, 'mean_word_length': 2.27089552238806, 'pattern_counts': {'":': 0, '<': 69, '<?xml version=': 0, '>': 81, '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': '1655387', 'n_tokens_mistral': 1408, 'n_tokens_neox': 1415, 'n_words': 307}