<commit_before>angular.module( 'ripplecharts.landing', [
  'ui.state'
])

.config(function config( $stateProvider ) {
  $stateProvider.state( 'landing', {
    url: '/',
    views: {
      "main": {
        controller: 'LandingCtrl',
        templateUrl: 'landing/landing.tpl.html'
      }
    },
    data:{ },
    resolve : {
      gateInit : function (gateways) {
        return gateways.promise;
      }
    }
  });
})

.controller( 'LandingCtrl', function LandingCtrl( $scope, $rootScope, $location, gateways ) {

  var api   = new ApiHandler(API);
  var donut = new ValueSummary({id:"metricDetail", gateways: gateways});

  var exchangeRates   = {};
  var valueCurrencies = {
    "USD" : "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",  //bitstamp
    "EUR" : "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q", //snapswap
    "JPY" : "r94s8px6kSw1uZ1MV98dhSRTvc6VMPoPcN", //tokoyo jpy
    "CNY" : "razqQK<KEY>", //rippleChina
    "KRW" : "rUkMKjQitpgAM5WTGk79xpjT38DEJY283d", //pax moneta
    "XRP" : ""
  }

  var totalAccounts
  var totalNetworkValueXRP;
  var transactionVolumeXRP;
  var tradeVolumeXRP;

  $scope.valueRate;
  $scope.valueCurrency     = "USD";
  $scope.metricDetail      = "tradeVolume";
  $scope.metricDetailTitle = "Trade Volume (last 24 hours)";

  //dropdown to change currency for metrics
  var valueSelect = d3.select("#valueCurrency")
    .on("change", function(){
      var currency = this.value;
      setValueRate(currency, true, function(err){
        $scope.valueCurrency = currency;
        showValue("totalNetworkValue");
        showValue("transactionVolume");
        showValue("tradeVolume");
      });
    });

  valueSelect.selectAll("option")
    .data(d3.keys(valueCurrencies))
    .enter().append("option")
    .html(function(d){return d})
    .attr("selected", function(d) {if (d == $scope.valueCurrency.currency) return true});

  //remote.on('transaction_all', feed.handleTransaction); //display transaction feed
  remote.on('transaction_all', handleNewAccount); //add to new accounts total

  remote.on("connect", function(){
    getTotalAccounts();  //we want to retreive this number every time we reconnect
  });

  if (remote._connected) getTotalAccounts();


  //get "fixed" multimarket charts for the most important markets
  var markets = new MultiMarket ({
    url            : API,
    id             : "topMarkets",
    fixed          : true,
    clickable      : true,
    updateInterval : 60, //1 minute
    gateways       : gateways
  });


  markets.list([
    {
      base    : {currency:"XRP"},
      counter : {currency:"USD", issuer:"<KEY>"}
    }, {
      base    : {currency:'XRP'},
      counter : {currency:'JPY', issuer: 'r94s8px6kSw1uZ1MV98dhSRTvc6VMPoPcN'}
    }, {
      base    : {currency:'BTC', issuer: 'rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q'},
      counter : {currency:'XRP'}
    }, {
      base    : {currency:"XRP"},
      counter : {currency:"CNY", issuer:"razqQKzJRdB4UxFPWf5NEpEG3WMkmwgcXA"}
    }, {
      base    : {currency:'XRP'},
      counter : {currency:'KRW', issuer: 'rUkMKjQitpgAM5WTGk79xpjT38DEJY283d'}
    }, {
      base    : {currency:"BTC", issuer:"rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"},
      counter : {currency:"XRP"}
    }
    ]);


  markets.on('chartClick', function(chart){
    var path = "/markets/"+chart.base.currency+
      (chart.base.issuer ? ":"+chart.base.issuer : "")+<commit_msg>update landing page<commit_after>angular.module( 'ripplecharts.landing', [
  'ui.state'
])

.config(function config( $stateProvider ) {
  $stateProvider.state( 'landing', {
    url: '/',
    views: {
      "main": {
        controller: 'LandingCtrl',
        templateUrl: 'landing/landing.tpl.html'
      }
    },
    data:{ },
    resolve : {
      gateInit : function (gateways) {
        return gateways.promise;
      }
    }
  });
})

.controller( 'LandingCtrl', function LandingCtrl( $scope, $rootScope, $location, gateways ) {

  var api   = new ApiHandler(API);
  var donut = new ValueSummary({id:"metricDetail", gateways: gateways});

  var exchangeRates   = {};
  var valueCurrencies = {
    "USD" : "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",  //bitstamp
    "EUR" : "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q", //snapswap
    "JPY" : "r94s8px6kSw1uZ1MV98dhSRTvc6VMPoPcN", //tokoyo jpy
    "CNY" : "razqQK<KEY>", //rippleChina
    "KRW" : "<KEY>", //pax moneta
    "XRP" : ""
  }

  var totalAccounts
  var totalNetworkValueXRP;
  var transactionVolumeXRP;
  var tradeVolumeXRP;

  $scope.valueRate;
  $scope.valueCurrency     = "USD";
  $scope.metricDetail      = "tradeVolume";
  $scope.metricDetailTitle = "Trade Volume (last 24 hours)";

  //dropdown to change currency for metrics
  var valueSelect = d3.select("#valueCurrency")
    .on("change", function(){
      var currency = this.value;
      setValueRate(currency, true, function(err){
        $scope.valueCurrency = currency;
        showValue("totalNetworkValue");
        showValue("transactionVolume");
        showValue("tradeVolume");
      });
    });

  valueSelect.selectAll("option")
    .data(d3.keys(valueCurrencies))
    .enter().append("option")
    .html(function(d){return d})
    .attr("selected", function(d) {if (d == $scope.valueCurrency.currency) return true});

  //remote.on('transaction_all', feed.handleTransaction); //display transaction feed
  remote.on('transaction_all', handleNewAccount); //add to new accounts total

  remote.on("connect", function(){
    getTotalAccounts();  //we want to retreive this number every time we reconnect
  });

  if (remote._connected) getTotalAccounts();


  //get "fixed" multimarket charts for the most important markets
  var markets = new MultiMarket ({
    url            : API,
    id             : "topMarkets",
    fixed          : true,
    clickable      : true,
    updateInterval : 60, //1 minute
    gateways       : gateways
  });


  markets.list([
    {
      base    : {currency:"XRP"},
      counter : {currency:"USD", issuer:"rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q"}
    }, {
      base    : {currency:'XRP'},
      counter : {currency:'JPY', issuer: 'r94s8px6kSw1uZ1MV98dhSRTvc6VMPoPcN'}
    }, {
      base    : {currency:'BTC', issuer: 'rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q'},
      counter : {currency:'XRP'}
    }, {
      base    : {currency:"XRP"},
      counter : {currency:"CNY", issuer:"razqQKzJRdB4UxFPWf5NEpEG3WMkmwgcXA"}
    }, {
      base    : {currency:'XRP'},
      counter : {currency:'USD', issuer: '<KEY>'}
    }, {
      base    : {currency:"BTC", issuer:"<KEY>"},
      counter : {currency:"XRP"}
    }
    ]);


  markets.on('chartClick', function(chart){
    var path = "/markets/"+chart.base.currency+
      (chart.base.issuer ? ":"+chart.base.issuer : "")+
{'fraction_non_alphanumeric': 0.15083046535986833, 'fraction_numerical': 0.017507107586413287, 'mean_word_length': 3.053365676167374, 'pattern_counts': {'":': 4, '<': 9, '<?xml version=': 0, '>': 9, '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': '4708884', 'n_tokens_mistral': 2446, 'n_tokens_neox': 2335, 'n_words': 424}