diff --git a/pool/shard004/JavaScript/0028887_check-style.js b/pool/shard004/JavaScript/0028887_check-style.js new file mode 100644 index 0000000000000000000000000000000000000000..97d87960b301d3bea00240efb53cd3138ad3657d --- /dev/null +++ b/pool/shard004/JavaScript/0028887_check-style.js @@ -0,0 +1,32 @@ +var ConfigurationLocator = require('./configuration-locator'); +var shell = require('procstreams'); +var DOMParser = require('xmldom').DOMParser; +var xpath = require('xpath'); +var path = require('path'); +var buildComment = require('./build-comment'); +var assert = require('better-assert'); + +module.exports = function(entry, parameters, complete) { + assert(parameters.repository().path() !== undefined); + assert(parameters.configuration().checkstyle() !== undefined); + + var filePath = path.join(parameters.repository().path(), entry); + var checkStyle = parameters.configuration().checkstyle(); + var locator = new ConfigurationLocator(checkStyle.xml(), checkStyle.defaultXml()); + var configXml = locator.locate(path.dirname(filePath)); + + // get XML report on STDOUT + shell('java', ['-jar', checkStyle.jar(), '-c', configXml, '-f', 'xml', filePath]).data(function(err, stdout, stderr) { + var comments = parameters.review().comments(entry); + var parser = new DOMParser(); + var doc = parser.parseFromString(stdout.toString()); + var errors = xpath.select('/checkstyle/file/error', doc); + errors.forEach(function(errorNode) { + var line = xpath.select1('@line', errorNode).value; + var message = xpath.select1('@message', errorNode).value; + var severity = xpath.select1('@severity', errorNode).value; + comments.push(buildComment(line, severity + ': ' + message)); + }); + complete(null); + }); +} diff --git a/pool/shard004/JavaScript/0028889_duration.js b/pool/shard004/JavaScript/0028889_duration.js new file mode 100644 index 0000000000000000000000000000000000000000..bd62b448bde932e2ff16cb4a5546f8de7897345d --- /dev/null +++ b/pool/shard004/JavaScript/0028889_duration.js @@ -0,0 +1,26 @@ +/** + * Adds started_at, ended_at and duration headers to the response + */ +const DurationMiddleware = () => ({ + request (request) { + return request.enhance({ + headers: { 'X-Started-At': Date.now() } + }) + }, + + response (next) { + const endedAt = Date.now() + + return next().then((response) => { + return response.enhance({ + headers: { + 'X-Started-At': response.request().headers()['x-started-at'], + 'X-Ended-At': endedAt, + 'X-Duration': endedAt - response.request().headers()['x-started-at'] + } + }) + }) + } +}) + +export default DurationMiddleware diff --git a/pool/shard004/JavaScript/0028892_autoheight-96129f09eb119d302b8b936606276fb6acb08fb0d07b8b1c2aee7550795ceced.js b/pool/shard004/JavaScript/0028892_autoheight-96129f09eb119d302b8b936606276fb6acb08fb0d07b8b1c2aee7550795ceced.js new file mode 100644 index 0000000000000000000000000000000000000000..1ef5e18f9bc00d7fa18017a7d12565840169ce5a --- /dev/null +++ b/pool/shard004/JavaScript/0028892_autoheight-96129f09eb119d302b8b936606276fb6acb08fb0d07b8b1c2aee7550795ceced.js @@ -0,0 +1,56 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + + +KindEditor.plugin('autoheight', function(K) { + var self = this; + + if (!self.autoHeightMode) { + return; + } + + var minHeight; + + function hideScroll() { + var edit = self.edit; + var body = edit.doc.body; + edit.iframe[0].scroll = 'no'; + body.style.overflowY = 'hidden'; + } + + function resetHeight() { + var edit = self.edit; + var body = edit.doc.body; + edit.iframe.height(minHeight); + self.resize(null, Math.max((K.IE ? body.scrollHeight : body.offsetHeight) + 76, minHeight)); + } + + function init() { + minHeight = K.removeUnit(self.height); + + self.edit.afterChange(resetHeight); + hideScroll(); + resetHeight(); + } + + if (self.isCreated) { + init(); + } else { + self.afterCreate(init); + } +}); + +/* +* 如何实现真正的自动高度? +* 修改编辑器高度之后,再次获取body内容高度时,最小值只会是当前iframe的设置高度,这样就导致高度只增不减。 +* 所以每次获取body内容高度之前,先将iframe的高度重置为最小高度,这样就能获取body的实际高度。 +* 由此就实现了真正的自动高度 +* 测试:chrome、firefox、IE9、IE8 +* */ +; diff --git a/pool/shard004/JavaScript/0028896_user.js b/pool/shard004/JavaScript/0028896_user.js new file mode 100644 index 0000000000000000000000000000000000000000..1ad02cc874da468f9749f98d8b9eeb07f9f8f705 --- /dev/null +++ b/pool/shard004/JavaScript/0028896_user.js @@ -0,0 +1,34 @@ +var mongoose = require('mongoose') +var bcrypt = require('bcrypt-nodejs') + +var UserSchema = new mongoose.Schema({ + name: String, + username: {type: String, required: true, index: {unique: true}}, + password: {type: String, required: true, select: false} +}) + +// hash the password before saving +UserSchema.pre('save', function (next) { + var user = this + + if (!user.isModified('password')) { + return next() + } + + bcrypt.hash(user.password, null, null, function (err, hash) { + if (err) { + return next(err) + } + + user.password = hash + next() + }) +}) + +// compare given password with db hash +UserSchema.methods.comparePassword = function (password) { + var user = this + return bcrypt.compareSync(password, user.password) +} + +mongoose.model('User', UserSchema) diff --git a/pool/shard004/JavaScript/0028899_defaults-hu_HU.js b/pool/shard004/JavaScript/0028899_defaults-hu_HU.js new file mode 100644 index 0000000000000000000000000000000000000000..a0d06445fa7ece44867b9b3a710ff0f941452a5f --- /dev/null +++ b/pool/shard004/JavaScript/0028899_defaults-hu_HU.js @@ -0,0 +1,44 @@ +/*! + * Bootstrap-select v1.12.4 (https://silviomoreto.github.io/bootstrap-select) + * + * Copyright 2013-2017 bootstrap-select + * Licensed under MIT (https://github.com/silviomoreto/bootstrap-select/blob/master/LICENSE) + */ + +(function (root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module unless amdModuleId is set + define(["jquery"], function (a0) { + return (factory(a0)); + }); + } else if (typeof module === 'object' && module.exports) { + // Node. Does not work with strict CommonJS, but + // only CommonJS-like environments that support module.exports, + // like Node. + module.exports = factory(require("jquery")); + } else { + factory(root["jQuery"]); + } +}(this, function (jQuery) { + +(function ($) { + $.fn.selectpicker.defaults = { + noneSelectedText: 'Válasszon!', + noneResultsText: 'Nincs találat {0}', + countSelectedText: function (numSelected, numTotal) { + return '{0} elem kiválasztva'; + }, + maxOptionsText: function (numAll, numGroup) { + return [ + 'Legfeljebb {n} elem választható', + 'A csoportban legfeljebb {n} elem választható' + ]; + }, + selectAllText: 'Mind', + deselectAllText: 'Egyik sem', + multipleSeparator: ', ' + }; +})(jQuery); + + +})); diff --git a/pool/shard004/JavaScript/0028906_storage-test.js b/pool/shard004/JavaScript/0028906_storage-test.js new file mode 100644 index 0000000000000000000000000000000000000000..a75f6e90e0e5ae4474cf718d6e2e126314747f06 --- /dev/null +++ b/pool/shard004/JavaScript/0028906_storage-test.js @@ -0,0 +1,99 @@ +/** + * Created by Pencroff on 30/01/2015. + */ + +var env = process.env.Not_Gulp_Env ? 'src' : 'lib', + expect = require('chai').expect, + StorageCtor = require('../' + env + '/Storage'); + +describe('Storage', function () { + var store; + beforeEach(function (done) { + store = new StorageCtor(); + done(); + }); + it('should return all data', function (done) { + expect(store.getAll()).to.eql({}); + done(); + }); + it('Should return object for any flow', function (done) { + expect(store.getFlow('Flow1')).to.eql({}); + expect(store.getFlow('Flow2')).to.eql({}); + expect(store.getAll()).to.eql({ + Flow1: {}, + Flow2: {} + }); + done(); + }); + it('should save data into step', function (done) { + store.setData('Flow', 'StepA', { some: 'First Object' }); + store.setData('Flow', 'StepB', { some: 'Second Object' }); + expect(store.getAll()).to.eql({ + Flow: { + StepA: { some: 'First Object' }, + StepB: { some: 'Second Object' } + } + }); + done(); + }); + it('should get data for step', function (done) { + store.setData('Flow', 'StepA', { + fieldA: 'DataA', + fieldB: 'DataB' + }); + expect(store.getStep('Flow', 'StepA')).to.eql({ + fieldA: 'DataA', + fieldB: 'DataB' + }); + done(); + }); + it('Should merge data into flow', function (done) { + store.setData('Flow', 'StepA', { + fieldA: 'DataA', + fieldB: 'DataB' + }); + store.mergeData('Flow', 'StepA', { + fieldB: 'DataBB', + fieldC: 'DataC' + }); + expect(store.getAll()).to.eql({ + Flow: { + StepA: { + fieldA: 'DataA', + fieldB: 'DataBB', + fieldC: 'DataC' + } + } + }); + done(); + }); + it('should support undefined or null values', function (done) { + store.setData('Flow', 'StepA'); + expect(store.getStep('Flow', 'StepA')).to.eql({}); + store.setData('Flow', 'StepA', null); + expect(store.getStep('Flow', 'StepA')).to.eql({}); + store.mergeData('Flow', 'StepA'); + expect(store.getStep('Flow', 'StepA')).to.eql({}); + store.mergeData('Flow', 'StepA', null); + expect(store.getStep('Flow', 'StepA')).to.eql({}); + done(); + }); + it('should clear flow data', function (done) { + store.setData('Flow', 'StepA', { + fieldA: 'DataA', + fieldB: 'DataB' + }); + store.clearFlow('Flow'); + expect(store.getFlow('Flow')).to.eql({}); + done(); + }); + it('should clear flow data', function (done) { + store.setData('Flow', 'StepA', { + fieldA: 'DataA', + fieldB: 'DataB' + }); + store.clear(); + expect(store.getAll()).to.eql({}); + done(); + }); +}); \ No newline at end of file diff --git a/pool/shard004/JavaScript/0028912_questionnaire-list.js b/pool/shard004/JavaScript/0028912_questionnaire-list.js new file mode 100644 index 0000000000000000000000000000000000000000..7e973e62d2a1ada5c8409a2a9364d279feaedabd --- /dev/null +++ b/pool/shard004/JavaScript/0028912_questionnaire-list.js @@ -0,0 +1,70 @@ +import { getQuestionnaireList } from 'utils/remote-api'; +import { questionnaireListRemoteToStores } from 'model/remote-to-stores'; + +export const LOAD_QLIST = 'LOAD_QLIST'; +export const LOAD_QLIST_SUCCESS = 'LOAD_QLIST_SUCCESS'; +export const LOAD_QLIST_FAILURE = 'LOAD_QLIST_FAILURE'; + +export const DELETE_QLIST_SUCCESS = 'DELETE_QLIST_SUCCESS'; + +/** + * Load questionnaire list success + * + * It's executed after the remote fetch of a list of questionnaires. + * + * The parameter "updateList" is an array of complex object. For each object, entries correspond to reducers, + * they contain an update to apply to the piece of state handled by the reducer to represent locally the questionnaire. + * + * It will update the stores: + * - questionnaireById + * - componentById + * - componentByQuestionnaire + * - conditionById + * + * @param {array} updatesList The new values to update in the different stores affected. + * @return {object} LOAD_QLIST_SUCCESS action. + */ +export const loadQuestionnaireListSuccess = updatesList => ({ + type: LOAD_QLIST_SUCCESS, + payload: updatesList, +}); + +/** + * Load questionnaire list failure + * + * It's executed after the fail of a remote questionnaires list fetch. + * + * @param {string} err The error returned for the fetch process. + * @return {object} LOAD_QLIST_FAILURE action + */ +export const loadQuestionnaireListFailure = err => ({ + type: LOAD_QLIST_FAILURE, + payload: err, +}); + +/** + * Load questionnaire list + * + * Asyc action that fetch a questionnaires list. + * + * @return {function} Thunk which may dispatch LOAD_QLIST_SUCCESS or LOAD_QLIST_FAILURE + */ +export const loadQuestionnaireList = (stamp, token) => dispatch => { + dispatch({ + type: LOAD_QLIST, + payload: null, + }); + return getQuestionnaireList(stamp, token) + .then(qrList => + dispatch( + loadQuestionnaireListSuccess(questionnaireListRemoteToStores(qrList)), + ), + ) + .catch(err => dispatch(loadQuestionnaireListFailure(err))); +}; + +export const deleteQuestionnaireList = () => dispatch => { + dispatch({ + type: DELETE_QLIST_SUCCESS, + }); +}; diff --git a/pool/shard004/JavaScript/0028915_messages.js b/pool/shard004/JavaScript/0028915_messages.js new file mode 100644 index 0000000000000000000000000000000000000000..f06449c11b9d0a4f03ae89a9b6d54a9be5ce1c0b --- /dev/null +++ b/pool/shard004/JavaScript/0028915_messages.js @@ -0,0 +1,110 @@ +const Pino = require('pino') +const moment = require('moment') +const ip = require('ip') + +const DynamoDB = require('./dynamodb.js') +const SQS = require('./sqs.js') +const Settings = require('./settings') + +class Messages { + constructor () { + this.dynamodb = new DynamoDB() + this.logger = new Pino({ level: process.env.LOG_LEVEL }) + this.sqs = new SQS() + this.settings = new Settings() + } + + isBotCommand (message) { + return message.entities && message.entities[0] && message.entities[0].type === 'bot_command' + } + + async handleBotCommand (message) { + const text = message.text + this.logger.info(text) + if (text.match(/\/jungHelp/i)) { + this.logger.info('newMessage jungHelp') + await this.sqs.sendJungHelpMessage(message) + } + if (text.match(/\/topTen/i)) { + this.logger.info('newMessage topTen') + await this.sqs.sendTopTenMessage(message) + } + if (text.match(/\/topDiver/i)) { + this.logger.info('newMessage topDiver') + await this.sqs.sendTopDiverMessage(message) + } + if (text.match(/\/allJung/i)) { + this.logger.info('newMessage allJung') + await this.sqs.sendAllJungMessage(message) + } + if (text.match(/\/enableAllJung/i)) { + this.logger.info('newMessage enableAllJung') + await this.sqs.sendEnableAllJungMessage(message) + } + if (text.match(/\/disableAllJung/i)) { + this.logger.info('newMessage disableAllJung') + await this.sqs.sendDisableAllJungMessage(message) + } + // setOffFromWorkTimeUTC + // Caveat: support only UTC time. Timezone support? ¯\_(ツ)_/¯ + // params: + // 0000-2345, allow every 15 minutes interval. Get off at 17:48? ¯\_(ツ)_/¯ + // comma seperated string of MON,TUE,WED,THU,FRI,SAT,SUN + const _handleIncorrectTimeFormat = async () => this.settings.setOffFromWorkTimeUTCIncorrectFormat({ + chatId: message.chat.id, + chatTitle: message.chat.title + }) + if (text.match(/\/setOffFromWorkTimeUTC/i)) { + this.logger.info('newMessage setOffFromWorkTimeUTC') + const params = text.split(' ') + if (params.length === 3) { + const offTime = params[1] + const rawWorkday = params[2] + if (offTime.match(/^([0-1]\d|2[0-3])(00|15|30|45)$/) && + rawWorkday.match(/^((MON|TUE|WED|THU|FRI|SAT|SUN),?){0,6}(MON|TUE|WED|THU|FRI|SAT|SUN)$/)) { + // E.g. MON,MON will be considered as MON + const workday = [...new Set(rawWorkday.split(','))].join(',') + this.logger.info(`normalised - offTime: ${offTime}, workday: ${workday}`) + await this.sqs.sendSetOffFromWorkTimeUTC({ message, offTime, workday }) + } else { + this.logger.info(`offTime: ${offTime}, rawWorkday: ${rawWorkday}`) + await _handleIncorrectTimeFormat() + } + } else { + await _handleIncorrectTimeFormat() + } + } + } + + async newMessage (event) { + this.logger.info(`newMessage start at ${moment().format()}`) + try { + const xForwardedFor = event.headers['X-Forwarded-For'] || event.headers['x-forwarded-for'] + const requestIP = xForwardedFor.split(', ')[0] + // should use WAF + if (!ip.cidrSubnet('91.108.4.0/22').contains(requestIP) && !ip.cidrSubnet('149.154.160.0/20').contains(requestIP)) { + this.logger.info(`Not Telegram Bot IP: ${requestIP}`) + return { statusCode: 403, message: 'Not Telegram Bot IP' } + } + const params = JSON.parse(event.body) + this.logger.trace(`messages.js::newMessage params: ${JSON.stringify(params)}`) + const message = params.message + if (!message || !message.chat.type.includes('group')) { + // handle edited_message and non group + return { statusCode: 204, message: 'edited_message or non-group' } + } + await this.dynamodb.saveMessage({ message }) + if (this.isBotCommand(message)) { + await this.handleBotCommand(message) + } + this.logger.info(`newMessage finish at ${moment().format()}`) + return { statusCode: 200 } + } catch (e) { + this.logger.error(e.message) + this.logger.info(`newMessage finish with error at ${moment().format()}`) + return { statusCode: 500 } + } + } +} + +module.exports = Messages diff --git a/pool/shard004/JavaScript/0028918_main.js b/pool/shard004/JavaScript/0028918_main.js new file mode 100644 index 0000000000000000000000000000000000000000..96e7af0fa0bd89c4522c1c5bdcc2e45bf1315ed7 --- /dev/null +++ b/pool/shard004/JavaScript/0028918_main.js @@ -0,0 +1,35 @@ +System.register(["angular", "./user.service", "./user-form.component", "./user-list.component", "./user.component"], function(exports_1, context_1) { + "use strict"; + var __moduleName = context_1 && context_1.id; + var ng, user_service_1, user_form_component_1, user_list_component_1, user_component_1; + var moduleName, appRootEl; + return { + setters:[ + function (ng_1) { + ng = ng_1; + }, + function (user_service_1_1) { + user_service_1 = user_service_1_1; + }, + function (user_form_component_1_1) { + user_form_component_1 = user_form_component_1_1; + }, + function (user_list_component_1_1) { + user_list_component_1 = user_list_component_1_1; + }, + function (user_component_1_1) { + user_component_1 = user_component_1_1; + }], + execute: function() { + moduleName = "demo"; + ng.module(moduleName, []) + .service(user_service_1.UserService.serviceName, user_service_1.UserService) + .component(user_form_component_1.UserFormComponent.controller.componentName, user_form_component_1.UserFormComponent) + .component(user_component_1.UserComponent.controller.componentName, user_component_1.UserComponent) + .component(user_list_component_1.UserListComponent.controller.componentName, user_list_component_1.UserListComponent); + appRootEl = document.querySelector("#app-container") || document.body; + ng.bootstrap(appRootEl, [moduleName]); + } + } +}); +//# sourceMappingURL=main.js.map \ No newline at end of file diff --git a/pool/shard004/JavaScript/0028919_LocalisedAmountFormatter.js b/pool/shard004/JavaScript/0028919_LocalisedAmountFormatter.js new file mode 100644 index 0000000000000000000000000000000000000000..ea091a1998f75aaaf03fec6d9f37c9ae78386b23 --- /dev/null +++ b/pool/shard004/JavaScript/0028919_LocalisedAmountFormatter.js @@ -0,0 +1,71 @@ +/** + * @module br/presenter/formatter/LocalisedAmountFormatter + */ + +/** + * @class + * @alias module:br/presenter/formatter/LocalisedAmountFormatter + * @implements module:br/presenter/formatter/Formatter + * + * @classdesc + * Formats a number into a localised string representation. + *

+ * LocalisedAmountFormatter Formats a number to a configuarble number of decimal placess + * according to current locale of browser. It automatically detects the current locale of the the + * browser and uses that to format numbers. For example
+ * 1234567.89 = 1,234,567.89 in english locale
+ * 1234567.89 = 1.234.567,89 in french locale
+ * It is typically used with Presenter, but can be invoked programmatically: + *

+ * br.presenter.formatter.LocalisedAmountFormatter.format(1234567890, {}) + * br.presenter.formatter.LocalisedAmountFormatter.format(1234567890, {dp: 4}) + */ +br.presenter.formatter.LocalisedAmountFormatter = function() +{ + +}; + +br.Core.implement(br.presenter.formatter.LocalisedAmountFormatter, br.presenter.formatter.Formatter); + +/** + * Formats a number into an localised string representation. + * + * @param {Variant} vValue the numeric amount (Number type). + * if a string is passed it is returned unchanged. + * @param {Map} mAttributes a list of attributes, as specified here and in. + * dp: number of decinal places to be displayed. Rounding occurs according + * to standard javascript behaviour. + * @return the tokenized amount. + * @type String + */ +br.presenter.formatter.LocalisedAmountFormatter.prototype.format = function(vValue, mAttributes) { + + //the field may want to display a message like "please enter " so + if (typeof vValue == "string") { + return vValue; + } + + if(typeof vValue != "number"){ + throw "LocalisedAmountFormatter.format(value): value must be numeric"; + } + + if(vValue < 0){ + throw "LocalisedAmountFormatter.format(value): value must be positive "; + } + + + var oAmount = new Number(vValue); + var decimalPlaces = mAttributes.dp || 0; + + var oRounded = new Number(oAmount.toFixed(decimalPlaces)); + var result = oRounded.toLocaleString(); + return result; +}; + + +/** + * @private + */ +br.presenter.formatter.LocalisedAmountFormatter.prototype.toString = function() { + return "br.presenter.formatter.LocalisedAmountFormatter"; +}; diff --git a/pool/shard004/JavaScript/0028920_onAnimationFrame.js b/pool/shard004/JavaScript/0028920_onAnimationFrame.js new file mode 100644 index 0000000000000000000000000000000000000000..72ce1b64925153a7aba1188e1ee0b1b1037098a3 --- /dev/null +++ b/pool/shard004/JavaScript/0028920_onAnimationFrame.js @@ -0,0 +1,52 @@ +/* global + global, document, demand, provide, queue, processor, settings, setTimeout, clearTimeout, + requestAnimationFrame, + functionFPS, + ClassQueue +*/ + +//=require shortcuts.js +//=require function/fps.js +//=require class/queue.js + +/** + * onAnimationFrame + * + * call callback via RequestAnimationFrame + * + * @param {function} fn + */ +var functionOnAnimationFrame = (function() { + var queue = new ClassQueue(), + duration = 0, start, budget, current; + + function process() { + start = performance.now(); + budget = (1000 / 60) * (0.2 * (Math.min(60, functionFPS()) / 60)); + + current(); + + duration += performance.now() - start; + current = current = queue.dequeue(); + + if(duration < budget) { + current && process(); + } else { + duration = 0; + + current && handle(); + } + } + + function handle() { + requestAnimationFrame(process); + } + + return function functionOnAnimationFrame(fn) { + queue.enqueue(fn); + + if(!current && (current = queue.dequeue())) { + handle(); + } + }; +}()); diff --git a/pool/shard004/JavaScript/0028923_MainSection.js b/pool/shard004/JavaScript/0028923_MainSection.js new file mode 100644 index 0000000000000000000000000000000000000000..378bc0b23d004146161879b8c1d242c1e22471f3 --- /dev/null +++ b/pool/shard004/JavaScript/0028923_MainSection.js @@ -0,0 +1,83 @@ +import React, { Component, PropTypes } from 'react'; +import TodoItem from './TodoItem'; +import Footer from './Footer'; +import { SHOW_ALL, SHOW_COMPLETED, SHOW_ACTIVE } from '../constants/TodoFilters'; + +const TODO_FILTERS = { + [SHOW_ALL]: () => true, + [SHOW_ACTIVE]: todo => !todo.completed, + [SHOW_COMPLETED]: todo => todo.completed +}; + +class MainSection extends Component { + constructor(props, context) { + super(props, context); + this.state = { filter: SHOW_ALL }; + } + + handleClearCompleted() { + this.props.actions.clearCompleted(); + } + + handleShow(filter) { + this.setState({ filter }); + } + + renderToggleAll(completedCount) { + const { todos, actions } = this.props; + if (todos.length > 0) { + return ( + + ); + } + } + + renderFooter(completedCount) { + const { todos } = this.props; + const { filter } = this.state; + const activeCount = todos.length - completedCount; + + if (todos.length) { + return ( +