<commit_before>'use strict';

import React from 'react';
import { Link } from 'react-router';
import NotFoundPage from './NotFoundPage';
import ShadersMenu from './ShadersMenu';
import Uniform from './Uniform';
import Flag from './Flag';
import shaders from '../data/shaders';

export default class ShaderPage extends React.Component {
  constructor() {
    super();
    this.state = {
      fragmentshader:""
    };
  }
  shaderChanged(fragmentshader) {
    console.log('fragmentshader changed');
    this.setState({fragmentshader});
  }
  render() {
    const id = this.props.params.id;
    const shader = shaders.filter((shader) => shader.id === id)[0];
    if (!shader) {
      return <NotFoundPage/>;
    }
    const headerStyle = { backgroundImage: `url(/img/${shader.cover})` };
    return (
      <div className="shader-full">
        <ShadersMenu/>
        <div className="shader">
          <header style={headerStyle}/>
          <div className="picture-container">
            <img src={`/img/${shader.image}`}/>
            <h2 className="name">{shader.name}</h2>
          </div>
          <textarea id="code" rows="20" cols="100" defaultValue={shader.text} onChange={this.shaderChanged.bind(this)}  onPaste={this.shaderChanged.bind(this)} onKeyUp={this.shaderChanged.bind(this)} />
          <section className="description">
             <strong><Flag code={shader.status} showName="true"/></strong>.
            From <a href={shader.link} target="_blank">{shader.link}</a>.
          </section>
          <section className="uniforms">
            <p><strong>{shader.uniforms.length}</strong> uniforms:</p>
            <ul>{
              shader.uniforms.map((uniform, i) => <Uniform key={i} {...uniform}/>)
            }</ul>
          </section>
        </div>
        <div className="navigateBack">
          <Link to="/">« Back to the index</Link>
        </div>
      </div>
    );
  }
}
<commit_msg>before npm install --save react-websocket<commit_after>'use strict';

import React from 'react';
import { Link } from 'react-router';
import NotFoundPage from './NotFoundPage';
import ShadersMenu from './ShadersMenu';
import Uniform from './Uniform';
import Flag from './Flag';
import shaders from '../data/shaders';

export default class ShaderPage extends React.Component {
  constructor() {
    super();
    this.state = {
      previousfragmentshader:"",
      fragmentshader:""
    };
  }
  shaderChanged(fragmentshader) {
    if (fragmentshader === this.state.previousfragmentshader) {
      console.log('fragmentshader text not changed');
    } else {
      console.log('fragmentshader changed');
      this.setState({fragmentshader});
      this.setState({previousfragmentshader: fragmentshader});
    }
  }
  render() {
    const id = this.props.params.id;
    const shader = shaders.filter((shader) => shader.id === id)[0];
    if (!shader) {
      return <NotFoundPage/>;
    }
    const headerStyle = { backgroundImage: `url(/img/${shader.cover})` };
    return (
      <div className="shader-full">
        <ShadersMenu/>
        <div className="shader">
          <header style={headerStyle}/>
          <div className="picture-container">
            <img src={`/img/${shader.image}`}/>
            <h2 className="name">{shader.name}</h2>
          </div>
          <textarea id="code" rows="20" cols="100" defaultValue={shader.text} onChange={this.shaderChanged.bind(this)}  
            onPaste={this.shaderChanged.bind(this)} onKeyUp={this.shaderChanged.bind(this)} />
          <section className="description">
             <strong><Flag code={shader.status} showName="true"/></strong>.
            From <a href={shader.link} target="_blank">{shader.link}</a>.
          </section>
          <section className="uniforms">
            <p><strong>{shader.uniforms.length}</strong> uniforms:</p>
            <ul>{
              shader.uniforms.map((uniform, i) => <Uniform key={i} {...uniform}/>)
            }</ul>
          </section>
        </div>
        <div className="navigateBack">
          <Link to="/">« Back to the index</Link>
        </div>
      </div>
    );
  }
}

{'fraction_non_alphanumeric': 0.1686074721009219, 'fraction_numerical': 0.0038816108685104317, 'mean_word_length': 2.632599118942731, 'pattern_counts': {'":': 0, '<': 69, '<?xml version=': 0, '>': 73, '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': '6317327', 'n_tokens_mistral': 1191, 'n_tokens_neox': 1238, 'n_words': 251}