<commit_before>import Cycle from 'cycle-react'
let React = Cycle.React
let {Rx} = Cycle
import Class from 'classnames'

import {trim} from '../utils/utils'
import {preventDefault,isTextNotEmpty,formatData,exists} from '../utils/obsUtils'
import EditableItem from './EditableItem2'




function removeTag(tags, tag){
  let idx = tags.indexOf(tag)
  if(idx>-1){ 
    let tags = Object.assign([],tags)
    tags.splice(idx,1)
    //updateDesign$({tags:tags})
  }
}

function addLicense(licenses, license){
  let selectedLicense = license//input.options[input.selectedIndex].value

  let licenses = Object.assign([], licenses)
  if(licenses.indexOf(selectedLicense)===-1){
    licenses.push(selectedLicense)
    //updateDesign$({licenses:licenses})
  }

  //let selectedLicense = selectedLicense
}


function DesignCard(props,interactions){<commit_msg>- extracted utilty methods from old DesignCard into new on as seperate functions<commit_after>import Cycle from 'cycle-react'
let React = Cycle.React
let {Rx} = Cycle
import Class from 'classnames'

import {trim} from '../utils/utils'
import {preventDefault,isTextNotEmpty,formatData,exists} from '../utils/obsUtils'
import EditableItem from './EditableItem2'


function addTag(value, tags){
  //input = input.innerText
    
  //Rx.Observable.fromEvent  
  //let input = this.state.currentTagInput
  input = [input]
  input
    .filter(x=>x!=="")
    .map(function(data){ return data.replace(/^\s+|\s+$/g, '') })
    .map(x=>x.split(","))
    .map(function(data){
      tags = tags.concat( data )
      //updateDesign$({tags:tags})
      //self.setState({currentTagInput:""})
    })
}

function removeTag(tag, tags){
  let idx = tags.indexOf(tag)
  if(idx>-1){ 
    let tags = Object.assign([],tags)
    tags.splice(idx,1)
    //updateDesign$({tags:tags})
  }
}

function addLicense(license, licenses){
  let selectedLicense = license//input.options[input.selectedIndex].value

  let licenses = Object.assign([], licenses)
  if(licenses.indexOf(selectedLicense)===-1){
    licenses.push(selectedLicense)
    //updateDesign$({licenses:licenses})
  }

  //let selectedLicense = selectedLicense
}

function removeLicense(license, licenses){
  console.log("remove license")
  let idx = licenses.indexOf(license)
  if(idx>-1){ 
    let licenses = Object.assign([],licenses)
    licenses.splice(idx,1)
    //updateDesign$({licenses:licenses})
  }
}

function addAuthor(authors){
  let name = React.findDOMNode(this.refs.nAuthorName).value
  let email= React.findDOMNode(this.refs.nAuthorEmail).value
  let url  = React.findDOMNode(this.refs.nAuthorUrl).value
  console.log(email,url,name)
  
  let authors = Object.assign([], authors)
  authors.push({
    name:name,
    email:email,
    url:url
  })
  //updateDesign$({authors:authors})
}

function removeAuthor(author, authors){
  let authors = Object.assign([], authors)

  authors = authors.filter(function(authorsEntry){
    return !(
      authorsEntry.name === author.name && 
      authorsEntry.url  === author.url && 
      authorsEntry.email=== author.email)
  })

  //updateDesign$({authors:authors})
}




function DesignCard(props,interactions){
{'fraction_non_alphanumeric': 0.15115909812638934, 'fraction_numerical': 0.0031756113051762463, 'mean_word_length': 4.147058823529412, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, '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': '1855882', 'n_tokens_mistral': 1011, 'n_tokens_neox': 976, 'n_words': 198}