<commit_before>(function () {
  'use strict';
  
  // loading dependencies
  var Dom = require('dom');
  var Form = require('form');
  var Db = require('db');
  var Page = require('page');
  var Ui = require('ui');
  
  var GameTime = require('GameTime');
  var RoleViews = require('RoleViews');
  var VotingViews = require('VotingViews');
  var CitizenViews = require('CitizenViews');
  
  /**
   * Renders the home screen for each user
   */
  function renderHome() {
    
    // the current game time
    var time = GameTime.startingOn(Db.shared.get('time').start);
    
    /**
     * Renders information in the bar on top of the application.
     * Token from repo Happening/<PASSWORD>
     */
    function infoItem(title, content) {
      Dom.div(function () {
        Dom.style({textAlign: 'center', Flex: true});
        Dom.div(function () {
          Dom.text(title);
          Dom.style({fontWeight: 'bold'});
        });
        content();
      });
    }
    
    // Render the page
    Dom.div(function () {
      
      // display current time
      infoItem('time', function () {
        var now = new Date();
        var dayNight = time.isDay(now)? 'Day': 'Night';
        var number = time.getNumber(now);
        Dom.text(dayNight + ' ' + number);
      });
      
      VotingViews.lynching(time);
      
      // button to go to the overview of the citizens
      Ui.bigButton(function () {
        Dom.text('List of citizens');
        Dom.on('click', function () {
          // go to citizen overview
          Page.nav(['citizens']);
        });
      });
      
      // display the role
      RoleViews.description(Db.personal.get('role'));
    });
  }
  
  /**
   * The main render method
   */
  exports.render = function () {
    
    // render a page based on the state
    if (Page.state.get(0) === 'voting') {
      // render an overview for a voting
      // TODO: hide the voting the nights for non-werewolves
      var votingId = Page.state.get(1);
      
      VotingViews.overview(votingId);
    } else if (Page.state.get(0) === 'citizens') {
      // render citizen overview
      CitizenViews.overview();
    } else {
      // no special page: render home page
      renderHome();
    }
  };
  
  /**
   * The screen allowing for additional settings
   */
  exports.renderSettings = function () {
    Dom.div(function () {
      
      Dom.p('The following will only be applied to new games. Not the current one.');
      
      // the setting for the number of werewolves
      Dom.p('Number of werewolves in the game:');
      Form.input({
        name: 'nWerewolf',<commit_msg>Redirect `/votings` to home page<commit_after>(function () {
  'use strict';
  
  // loading dependencies
  var Dom = require('dom');
  var Form = require('form');
  var Db = require('db');
  var Page = require('page');
  var Ui = require('ui');
  
  var GameTime = require('GameTime');
  var RoleViews = require('RoleViews');
  var VotingViews = require('VotingViews');
  var CitizenViews = require('CitizenViews');
  
  /**
   * Renders the home screen for each user
   */
  function renderHome() {
    
    // the current game time
    var time = GameTime.startingOn(Db.shared.get('time').start);
    
    /**
     * Renders information in the bar on top of the application.
     * Token from repo Happening/Betrayal
     */
    function infoItem(title, content) {
      Dom.div(function () {
        Dom.style({textAlign: 'center', Flex: true});
        Dom.div(function () {
          Dom.text(title);
          Dom.style({fontWeight: 'bold'});
        });
        content();
      });
    }
    
    // Render the page
    Dom.div(function () {
      
      // display current time
      infoItem('time', function () {
        var now = new Date();
        var dayNight = time.isDay(now)? 'Day': 'Night';
        var number = time.getNumber(now);
        Dom.text(dayNight + ' ' + number);
      });
      
      VotingViews.lynching(time);
      
      // button to go to the overview of the citizens
      Ui.bigButton(function () {
        Dom.text('List of citizens');
        Dom.on('click', function () {
          // go to citizen overview
          Page.nav(['citizens']);
        });
      });
      
      // display the role
      RoleViews.description(Db.personal.get('role'));
    });
  }
  
  /**
   * The main render method
   */
  exports.render = function () {
    
    // render a page based on the state
    if (Page.state.get(0) === 'voting') {
      // render an overview for a voting
      // TODO: hide the voting the nights for non-werewolves
      var votingId = Page.state.get(1);
      
      if (votingId) { // there is a voting id
        VotingViews.overview(votingId);
      } else {
        // otherwise just go back to the home menu
        Page.nav([]);
      }
    } else if (Page.state.get(0) === 'citizens') {
      // render citizen overview
      CitizenViews.overview();
    } else {
      // no special page: render home page
      renderHome();
    }
  };
  
  /**
   * The screen allowing for additional settings
   */
  exports.renderSettings = function () {
    Dom.div(function () {
      
      Dom.p('The following will only be applied to new games. Not the current one.');
      
      // the setting for the number of werewolves
      Dom.p('Number of werewolves in the game:');
      Form.input({
        name: 'nWerewolf',
{'fraction_non_alphanumeric': 0.13761807742174476, 'fraction_numerical': 0.0011113169105389886, 'mean_word_length': 2.0371203599550056, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '1582026', 'n_tokens_mistral': 1604, 'n_tokens_neox': 1577, 'n_words': 442}