text
stringlengths 7
3.69M
|
|---|
import React from "react"
import { Link } from "gatsby"
import Layout from "../components/layout"
import SEO from "../components/seo"
const Diagrams = () => (
<Layout>
<SEO title="Diagramme" />
<h1>Diagramme</h1>
<table>
<tbody>
<tr>
<th>Strukturdiagramme der UML</th>
</tr>
<tr>
<td>
<a
href="https://de.wikipedia.org/wiki/Klassendiagramm"
title="Klassendiagramm"
target="_blank"
rel="noopener noreferrer"
>
Klassendiagramm
</a>
</td>
</tr>
<tr>
<td>
<a
href="https://de.wikipedia.org/wiki/Komponentendiagramm"
title="Komponentendiagramm"
target="_blank"
rel="noopener noreferrer"
>
Komponentendiagramm
</a>
</td>
</tr>
<tr>
<td>
<a
href="https://de.wikipedia.org/wiki/Kompositionsstrukturdiagramm"
title="Kompositionsstrukturdiagramm"
target="_blank"
rel="noopener noreferrer"
>
Kompositionsstrukturdiagramm
</a>
</td>
</tr>
<tr>
<td>
<a
href="https://de.wikipedia.org/wiki/Objektdiagramm"
title="Objektdiagramm"
target="_blank"
rel="noopener noreferrer"
>
Objektdiagramm
</a>
</td>
</tr>
<tr>
<td>
<a
href="https://de.wikipedia.org/wiki/Paketdiagramm"
title="Paketdiagramm"
target="_blank"
rel="noopener noreferrer"
>
Paketdiagramm
</a>
</td>
</tr>
<tr>
<td>
<a
href="https://de.wikipedia.org/wiki/Profildiagramm"
title="Profildiagramm"
target="_blank"
rel="noopener noreferrer"
>
Profildiagramm
</a>
</td>
</tr>
<tr>
<td>
<a
href="https://de.wikipedia.org/wiki/Verteilungsdiagramm"
title="Verteilungsdiagramm"
target="_blank"
rel="noopener noreferrer"
>
Verteilungsdiagramm
</a>
</td>
</tr>
<tr>
<th>Verhaltensdiagramme der UML</th>
</tr>
<tr>
<td>
<a
href="https://de.wikipedia.org/wiki/Aktivit%C3%A4tsdiagramm"
title="Aktivitätsdiagramm"
target="_blank"
rel="noopener noreferrer"
>
Aktivitätsdiagramm
</a>
</td>
</tr>
<tr>
<td>
<a
href="https://de.wikipedia.org/wiki/Anwendungsfalldiagramm"
title="Anwendungsfalldiagramm"
target="_blank"
rel="noopener noreferrer"
>
Anwendungsfalldiagramm
</a>
</td>
</tr>
<tr>
<td>
<a
href="https://de.wikipedia.org/wiki/Interaktions%C3%BCbersichtsdiagramm"
title="Interaktionsübersichtsdiagramm"
target="_blank"
rel="noopener noreferrer"
>
Interaktionsübersichtsdiagramm
</a>
</td>
</tr>
<tr>
<td>
<a
href="https://de.wikipedia.org/wiki/Kommunikationsdiagramm_(UML)"
title="Kommunikationsdiagramm (UML)"
target="_blank"
rel="noopener noreferrer"
>
Kommunikationsdiagramm
</a>
</td>
</tr>
<tr>
<td>
<a
href="https://de.wikipedia.org/wiki/Sequenzdiagramm"
title="Sequenzdiagramm"
target="_blank"
rel="noopener noreferrer"
>
Sequenzdiagramm
</a>
</td>
</tr>
<tr>
<td>
<a
href="https://de.wikipedia.org/wiki/Zeitverlaufsdiagramm"
title="Zeitverlaufsdiagramm"
target="_blank"
rel="noopener noreferrer"
>
Zeitverlaufsdiagramm
</a>
</td>
</tr>
<tr>
<td>
<a
href="https://de.wikipedia.org/wiki/Zustandsdiagramm_(UML)"
title="Zeitverlaufsdiagramm"
target="_blank"
rel="noopener noreferrer"
>
Zustandsdiagramm
</a>
</td>
</tr>
</tbody>
</table>
<Link to="/">Go back to the homepage</Link>
</Layout>
)
export default Diagrams
|
// @ts-check
/* eslint-disable react/display-name */
import React from 'react';
// BEGIN (write your solution here)
const getCard = (params={}) => {
console.log(`title: ${params.title}, text: ${params.text}`);
if (!params.hasOwnProperty('title') && !params.hasOwnProperty('text')) {
return null;
}
return <div className="card">
<div className="card-body">
{params.title ? <h4 className="card-title">{params.title}</h4> : null}
{params.text ? <p className="card-text">{params.text}</p> : null}
</div>
</div>;
}
export default getCard;
// END
|
import createReducer from 'rdx/utils/create-reducer';
import types from 'rdx/modules/auth/types';
const initialState = '';
export default {
authToken: createReducer(initialState, {
[types.SET_AUTH_TOKEN](state, action) {
return action.payload;
},
}, true),
};
|
export class GroupedTimeline {
constructor(anchor, groups, onGroupClick = null) {
this.anchor = $(anchor);
this.groups = groups;
this.onGroupClick = onGroupClick;
}
render () {
let count = this.groups.length;
let groupWidth = 100 / (count);
let timeline = this.initTimeline();
for (let i = 0; i < count; i++) {
let group = this.groups[i];
let groupDelta = group.endTime.getTime() - group.startTime.getTime();
let point = this.getGroupTimelinePoint(i, group.name, null, groupWidth * i, groupWidth);
timeline.append(point);
//if (i < count - 1) {
point.on('click', (e) => {
e.preventDefault();
e.stopPropagation();
if (this.onGroupClick != null) {
this.onGroupClick(group, this.groups[i + 1], e.target);
}
});
// Add small dots in between
group.events.forEach(event => {
let delta = event.time.getTime() - group.startTime.getTime();
let location = (groupWidth * i) + delta / groupDelta * groupWidth;
timeline.append(this.getSmallTimelinePoint(location, event.title));
});
//}
}
// Add last point
let point = this.getGroupTimelinePoint(-1, '', null, 100);
timeline.append(point);
}
initTimeline() {
this.anchor.empty();
let container = $('<div></div>');
container.addClass("timeline-container");
let timeline = $('<div></div>');
timeline.addClass("timeline");
container.append(timeline);
this.anchor.append(container);
return timeline;
}
getGroupTimelinePoint(index, name, description = null, left=0, width=0) {
let event = $('<div></div>');
event.addClass('timeline-point point-year')
.data('group', index)
.css('left', left + '%');
if (width > 0) {
event.css('width', width + '%');
}
let point = $('<div></div>');
point.addClass('point-header');
event.append(point);
let header = $('<p></p>');
header.text(name);
point.append(header);
if (description != null) {
let subHeader = $('<small></small>');
subHeader.text(description);
point.append(subHeader);
}
return event;
}
getSmallTimelinePoint(left=0, name='') {
let event = $('<div></div>');
event.addClass('timeline-point point-small')
.data('name', name)
.css('left', left + '%');
return event;
}
}
|
import Row from 'react-bootstrap/lib/Row';
import Col from 'react-bootstrap/lib/Col';
import CarouselItem from 'react-bootstrap/lib/CarouselItem';
import Divider from 'material-ui/Divider';
import React, { Component } from 'react';
import RaisedButton from 'material-ui/RaisedButton';
export default class CategoryItem extends Component{
constructor(props) {
super(props);
this.state={};
this.state.images =[];
}
render()
{
const styles = require('./CategoryItem.scss');
var state = this.state;
return (
<Row>
<div>
<Col md={3}>
<img src="http://placehold.it/300x250"></img>
</Col>
<Col md={7}>
<Row>
<h2>Package name</h2>
<h5>base address, soo and sooooo... with pin code</h5>
<h5>Tour Operator</h5>
</Row>
<Row>
<Divider />
</Row>
<Row>
SightSeeing:
</Row>
</Col>
<Col md={2} className={styles.center}>
<Row>
<Row>
Price
</Row>
<Row>
3 days 4 nights
</Row>
<RaisedButton label="Book Now" primary={true} />
</Row>
<Row>
Rating
</Row>
</Col>
</div>
</Row>
);
}
}
|
var o = function() {
function p() {
this.score = 0, this.bestScore = 0, this.coin = 0, this.surpassRatio = 0, this.homeCallback = null,
this.restartCallback = null, this.tips = "", this.props = [], this.titleList = [];
}
return p.getInstance = function(d, e, t, o, i, n, a, s, c) {
void 0 === c && (c = null);
var r = new p();
return r.score = d, r.bestScore = e, r.coin = t, r.surpassRatio = o, r.tips = i,
r.homeCallback = n, r.restartCallback = a, r.props = s, r.titleList = c, r;
}, p;
}();
exports.default = o;
|
db.movies.find({
$and: [
{
category: {
$all: ["action", "adventure"]
}
},
{ imdbRating: { $gte: 7 } }
]
})
|
import React from 'react';
import ReactDOM from 'react-dom';
import Video from '../video_components/Video'
import VideoBlock from '../video_components/VideoBlock'
import CommentList from '../chat_components/CommentList'
class ChatSearch extends React.Component {
constructor() {
super()
this.state = {loading: true, onChat: false, data: [], chat_data: []};
this.handleVideoClick = this.handleVideoClick.bind(this);
}
componentDidMount() {
let ids = []
let videos = []
fetch('/api/get_downloads').then(response => response.json()).then(data => {
data.forEach(d => ids.push(d.slice(0, -5)))
var api_params = "?"
ids.forEach(s => api_params = api_params + 'id=' + s + '&')
fetch(`https://api.twitch.tv/helix/videos/${api_params}`, {headers: {'Client-ID': `${this.props.client_id}`, 'Authorization': `Bearer ${this.props.client_token}`}}).then(response => response.json()).then(data => {
data.data.forEach(d => videos.push(<Video id={d.id} title={d.title} user_name={d.user_name} created={d.created_at} duration={d.duration} thumbnail={d.thumbnail_url} handleClick={this.handleVideoClick}/>));
this.setState({loading: false, data: videos});
});
});
}
handleVideoClick(id) {
fetch('/api/get_chat', { headers : {'video_id': id}}).then(response => response.json()).then(data => this.setState({onChat: true, chat_data: data}));
}
render() {
if (this.state.loading) {
return <h1> loading </h1>
}
else if (!this.state.onChat) {
return (
<div>
<VideoBlock list={this.state.data} />
</div>
);
}
else {
return (
<div>
<button onClick={(e) => {e.preventDefault(); this.setState({onChat: false});}}> Return to Videos </button>
<CommentList data={this.state.chat_data} />;
</div>
);
}
}
}
export default ChatSearch;
|
var size = 5;
var i = 0;
// top
for (i = 0; i < size; i++)
document.write("*");
//middle
for (var j = 0; j < size - 2; j++){
document.write("\n"); // go to next row
// middle (2 on sides with size-2 in between)
document.write("*");
for (i = 0; i < size-2; i++)
document.write(" ");
document.write("*\n"); // goes to new row as well
}
// same as top
for (i = 0; i < size; i++)
document.write("*");
|
'use strict';
angular.module('starter')
.directive('showLoginState', ['$state', function ($state) {
return {
scope: { },
template: '' +
'<div ng-switch="global.isLoggedIn" ui-sref="tab.settings">' +
'<span class="padding-top" ng-switch-when="true">Connecté</span>'+
'<button class="button" ng-switch-when="false">Se connecter</button>'+
'<span ng-switch-when="undefined">Indéfini</span>'+
'</div>',
link: function ($scope, elem, attrs) {
$scope.global = $state.current.data.global;
}
};
}]);
|
import React from 'react'
import '../styles/App.css'
import propTypes from 'prop-types'
import Setting from 'react-icons/lib/md/settings'
import Menu from 'react-icons/lib/md/more-vert'
const Navigation=({size,price,id,settingOne,settingTwo})=>(
<div className="content-nav">
<div className="options">
<span className="Sort-lable">SORT BY</span>
<span className="btnn"
onClick={size} >Size</span>
<span className="btnn"
onClick={price}>Price</span>
<span className="btnn"
onClick={id}>Id</span>
</div>
<div className="more">
<span className="symbbtn" ><Setting/></span>
<span className="symbbtn symbbtn-alt" ><Menu/></span>
</div>
</div>
)
export default Navigation
Navigation.propTypes={
size:propTypes.func.isRequired,
price:propTypes.func.isRequired,
id:propTypes.func.isRequired
}
|
import React, { PropTypes } from 'react'
import EditImage from './EditImage'
var EditHeader = React.createClass({
propTypes: {
groupId: PropTypes.string.isRequired,
isOpen: PropTypes.bool.isRequired,
image: PropTypes.string.isRequired,
onDone: PropTypes.func,
},
render() {
let link = `groups/${this.props.groupId}/header`
return (
<EditImage
image={this.props.image}
isOpen={this.props.isOpen}
link={link}
onDone={this.props.onDone}
ratio={21/9}
/>
)
}
})
export default EditHeader
|
const passport = require('passport')
const jwt = require('jsonwebtoken')
const { Session } = require('../models/index')
/**
* Controller method for logging in a user.
* @param req
* @param res
* @returns {Promise<void>}
*/
const login = async (req, res) => {
passport.authenticate('login',
(err, user, info) => {
if (err || !user) {
return res.status(400).send({
message: info ? info.message : 'Login failed.'
})
}
req.login(user, {session: false}, async (err) => {
if (err) {
return res.status(400).send(err)
}
const session = new Session({version: 1, _userId: user._id.toString()})
try {
await session.save()
} catch (e) {
throw new Error('An Error Occurred.')
}
const token = jwt.sign({
_sessionId: session._id.toString(),
version: session.version
}, process.env.JWT_SECRET, {expiresIn: '12h'})
return res.send({token})
})
})(req, res)
}
/**
* Controller method for refreshing an expired Json Web Token.
* @param req
* @param res
* @returns {Promise<void>}
*/
const refresh = async (req, res) => {
passport.authenticate('refresh',
async (err, session, info) => {
if (err || !session) {
return res.status(400).send({
message: info ? info.message : 'Unauthorized. Please login.'
})
}
session.version += 1
try {
await session.save()
} catch (e) {
throw new Error('An Error Occurred.')
}
const token = jwt.sign({
_sessionId: session._id.toString(),
version: session.version
}, process.env.JWT_SECRET, {expiresIn: '12h'})
return res.send({token})
})(req, res)
}
/**
* Controller method for logging out a user. Actual Session of the Token will be deleted.
* @param req
* @param res
* @returns {Promise<void>}
*/
const logout = async (req, res) => {
await req.session.delete()
res.send('Logout successful.')
}
module.exports = {
login,
refresh,
logout
}
|
var mysql = require('mysql');
var pool = mysql.createPool({
host : "52.40.47.174",
user : "frontend",
password: "secretTMW",
database: "tmw"
});
module.exports.pool = pool;
|
module.exports = function (app) {
var ctrl = app.controllers.clientes;
app.get('/api/clientes', function (req, res) {
if (req.query.hasOwnProperty('nome')) {
ctrl.getByNome(req.query['nome'], function (err, result) {
if (err)
res.status(500).json(err);
else
res.json(result);
});
return;
}
if (req.query.hasOwnProperty('telefone')) {
ctrl.getByTelefone(req.query['telefone'], function (err, result) {
if (err)
res.status(500).json(err);
else
res.json(result);
});
return;
}
ctrl.getAll(function (err, result) {
if (err)
res.status(500).json(err);
else
res.json(result);
});
});
app.get('/api/clientes/:id', function (req, res) {
ctrl.get(req.params.id, function (err, result) {
if (err)
res.status(500).json(err);
else {
if (!result)
res.status(404).send('Cliente não encontrado!');
else
res.json(result);
}
});
});
app.post('/api/clientes', function (req, res) {
var cliente = req.body;
ctrl.post(cliente, function (err, result) {
if (err) {
res.status(500).json(err);
} else {
res.json(result);
}
});
});
app.put('/api/clientes/:id', function (req, res) {
var cliente = req.body;
ctrl.put(req.params.id, cliente, function (err, result) {
if (err) {
res.status(500).json(err);
} else {
if (!result)
res.status(404).send('Cliente não encontrado!');
else
res.status(204).send();
}
});
});
app.delete('/api/clientes/:id', function (req, res) {
ctrl.delete(req.params.id, function (err, result) {
if (err) {
res.status(500).json(err);
} else {
if (!result)
res.status(404).send('Cliente não encontrado!');
else
res.status(200).send(result);
}
});
});
}
|
//
//
// let cols = 8;
//
//
// module.exports = cols;
class Animation2 {
//the position where the frame will be drawn
constructor() {
this.x = 0;
this.y = 0;
this.srcX = 0;
this.srcY = 0;
this.width = 64;
this.height = 128;
this.sheetWidth = 800;
this.sheetHeight = 250;
this.cols = 4;
this.rows = 1;
this.currentFrame = 0;
this.image = new Image();
this.image.src = "spritesRyu.png";
this.canvas = document.getElementById('canvas');
this.canvas.width = 64*4;
this.canvas.height = 128*4;
this.ctx = this.canvas.getContext('2d');
this.ctx.scale(4, 4);
}
updateFrame(){
this.currentFrame = ++this.currentFrame % this.cols;
this.srcX = this.currentFrame * this.width;
this.srcY = this.height;
}
drawImage(){
this.updateFrame();
this.ctx.imageSmoothingEnabled = false;
this.ctx.drawImage(this.image, this.srcX, this.srcY, 64*2, 128*2, this.x, this.y, 64*2, 128*2);
}
// sleep(milliseconds) {
// var start = new Date().getTime();
// for (var i = 0; i < 1e7; i++) {
// if ((new Date().getTime() - start) > milliseconds){
// break;
// }
// }
// }
//
drawAnimation(next){
let i = 0;
let inter = setInterval(() => {
i++;
this.drawImage();
if (i == 4)
clearInterval(inter);
}, 100)
return inter;
}
}
export default Animation2;
|
function pageToolkit(pageName){
var self = this;
var hrtime = process.hrtime()[1];
this.backToIndex = function(respond){
respond(302, '/msgcenter/' + pageName + '/?_=' + hrtime);
};
this.forwardProcess = function(to, ids, respond){
var form = {
_: hrtime,
};
for(var i in ids){
form['item' + i] = ids[i];
};
respond(
302,
'/msgcenter/' + to + '/process?'
+ $.nodejs.querystring.stringify(form)
);
};
this.remove = function(queues, ids, phase, data, respond){
var output = '';
var queue = {
encrypted: queues.send.proceeded,
plaintext: queues.send.pending,
}[pageName] || undefined;
function worker(){
var task = [];
for(var i in ids){
task.push((function(){
var itemID = ids[i];
return function(callback){
queue.remove(itemID, function(){
callback(null);
});
};
})());
};
$.nodejs.async.parallel(task, function(err){
self.backToIndex(respond);
});
};
if(0 == phase){
respond(null, {
type: 'remove',
ids: ids,
phase: phase,
});
} else {
if('y' == data.post['confirm']){
worker();
} else {
self.backToIndex(respond);
};
};
};
return this;
};
module.exports = function(pageName){
return new pageToolkit(pageName);
};
|
function formSubmit() {
var seq = document.getElementById("seq");
var answer = document.getElementById("ans");
answer.value = CharRemover(seq.value);
function CharRemover(str) {
str.split(" ").forEach(function (t) {
for (var i = 0; i < t.length; i++) {
if (t.lastIndexOf(t[i]) !== t.indexOf(t[i])) {
while(str.indexOf(t[i]) !== -1 && t[i] !== "!" &&
t[i] !== "." &&
t[i] !== "," &&
t[i] !== ";" &&
t[i] !== "?" &&
t[i] !== ":")
str = str.replace(t[i],"")
}
}
});
return str;
}
}
|
const pessoa = {
saudacao: "Olá, bom dia",
falar (){
console.log(this.saudacao)
}
}
// pessoa.falar()
// const falar = pessoa.falar
// falar()
// const falarDepessoa = pessoa.falar.bind(pessoa)
// falarDepessoa()
function venda () {
console.log(this.valor)
}
const venda1 = {
valor: 100
}
venda.bind(venda1)()
|
try
{
Koadic.http.download("~DIRECTORY~/dynwrapx.dll", "~DLLUUID~");
Koadic.http.download("~DIRECTORY~/dynwrapx.manifest", "~MANIFESTUUID~");
Koadic.work.report("Success");
}
catch (e)
{
Koadic.work.error(e);
}
Koadic.exit();
|
const request = require('request');
const async = require('async');
const mongoose = require('mongoose');
const util = require('util')
const database = require('./database');
mongoose.connect('mongodb://mongo:27017/desafio_2', (err)=>{
if(err)
console.log(err);
});
const fetch_json = (url) => {
return new Promise((resolve, reject) => {
request(url, (error, response, body) => {
if(error){
reject(error);
} else if(response.statusCode != 200){
reject(new Error('Request URL failed'))
} else {
try{
const json_response = JSON.parse(body);
resolve(json_response);
} catch(err) {
reject(err);
}
}
});
});
};
const create_bulk_object = (events) => {
let response_array = [];
return new Promise((resolve, reject) => {
async.forEach(events, (event, cb) => {
try{
let custom_data = {};
// Remove key and value keys
async.forEach(event.custom_data, (item, nextData) => {
custom_data[item.key] = item.value;
nextData();
}, () => {
event.custom_data = custom_data;
response_array.push(event);
cb();
});
} catch(err){
cb(err);
}
}, (err) => {
if(err){
reject(err);
} else {
resolve(response_array);
}
});
});
};
const join_queries = (res, group_products) => {
return new Promise((resolve, reject) => {
async.forEachOf(res, (item, index, cb)=> {
res[index].products = group_products[index].products;
cb()
}, () => resolve(res));
});
}
const build_timeline = () => {
return new Promise(async (resolve, reject) => {
const params_query_products = database.event.aggregate_query_products;
const params_query_transaction = database.event.aggregate_query_transaction;
try{
let res = await database.event.model.aggregate(params_query_transaction).exec();
const group_products = await database.event.model.aggregate(params_query_products).exec();
res = join_queries(res, group_products);
resolve(res);
} catch(err) {
reject(err);
}
});
}
const run = (url='https://storage.googleapis.com/dito-questions/events.json') => {
fetch_json(url)
.then(data => create_bulk_object(data.events))
.then(events_array => {
database.event.model.insertMany(events_array, (err, docs) => {
if(err){ console.log('Error on insert') }
else {
build_timeline()
.then(res => {
console.log('******** RESULTADO *********')
console.log(util.inspect(res, false, null, true /* enable colors */))
})
.catch(err => console.log(err));
}
});
})
}
run();
|
import'./RcSplash.scss';
import React from 'react';
import { Route, Link, Redirect, withRouter } from 'react-router-dom'
import {auth, fire} from '../../service/firebase';
import RcAuth from '../../components/rc-auth/RcAuth.jsx';
import RcClock from '../../components/rc-clock/RcClock.jsx';
class RcSplash extends React.Component {
constructor(props) {
super(props);
this.auth = auth;
this.state = {
loading: true
}
}
componentDidMount() {
if(!this.auth.currentUser) setTimeout(() => this.setState({loading: false}),3000);
}
render() {
let content = this.state.loading ? (
<div className="rc-center-image">
<img src='https://placeimg.com/640/480/any' />
</div>
) : (
<div>
{/* <AuthCheck component={RcHome} path='/' blah="Blah Blah Blah..." thot="Jill" duh="simpson" /> */}
{/* <button><Link to="/login">login</Link></button> */}
</div>
);
return (
<div className="rc-splash-container">
{content}
<Route path="/login" component={RcAuth} />
</div>
)
}
}
export default withRouter(RcSplash);
|
$( function () {
$('.master').on( 'change', function () {
$('input[type=checkbox]:not(.master)').each( function () {
$(this).prop('checked', !$(this).prop('checked'));
});
})
});
|
import express from 'express';
import apiErrorHandler from './middlewares/errorHandler';
import list from './controllers/shopbacker.list';
import add from './controllers/shopbacker.add';
const routes = express.Router();
routes.get('/shopbacker', list);
routes.post('/shopbacker/add', add);
routes.use(apiErrorHandler);
export default routes;
|
'use strict'
const web = require('../../dd-trace/src/plugins/util/web')
const traceRoute = handler => req => {
const { original, route } = req
if (web.active(original)) {
web.enterRoute(original, route)
}
return handler(req)
}
const wrapLogger = tracer => logger => record => {
const span = tracer.scope().active()
if (!span) return logger(record)
const correlation = {
dd: {
trace_id: span.context().toTraceId(),
span_id: span.context().toSpanId()
}
}
record = record instanceof Error
? Object.assign(record, correlation)
: Object.assign({}, record, correlation)
return logger(record)
}
const wrapMount = (tracer, config) => mount => opts => {
const handler = mount(opts)
const traced = (req, res) =>
web.instrument(
tracer, config, req, res, 'paperplane.request',
() => handler(req, res)
)
return traced
}
const wrapRoutes = tracer => routes => handlers => {
const traced = {}
for (const route in handlers) {
traced[route] = traceRoute(handlers[route])
}
return routes(traced)
}
module.exports = [
{
name: 'paperplane',
versions: ['>=2.3.2'],
file: 'lib/logger.js',
patch (exports, tracer) {
if (tracer._logInjection) {
this.wrap(exports, 'logger', wrapLogger(tracer))
}
},
unpatch (exports) {
this.unwrap(exports, 'logger')
}
},
{
name: 'paperplane',
versions: ['>=2.3.2'],
file: 'lib/mount.js',
patch (exports, tracer, config) {
config = web.normalizeConfig(config)
this.wrap(exports, 'mount', wrapMount(tracer, config))
},
unpatch (exports) {
this.unwrap(exports, 'mount')
}
},
{
name: 'paperplane',
versions: ['>=2.3.2'],
file: 'lib/routes.js',
patch (exports, tracer) {
this.wrap(exports, 'routes', wrapRoutes(tracer))
},
unpatch (exports) {
this.unwrap(exports, 'routes')
}
},
{
name: 'paperplane',
versions: ['2.3.0 - 2.3.1'],
patch (paperplane, tracer, config) {
config = web.normalizeConfig(config)
this.wrap(paperplane, 'mount', wrapMount(tracer, config))
this.wrap(paperplane, 'routes', wrapRoutes(tracer))
},
unpatch (paperplane) {
this.unwrap(paperplane, ['mount', 'routes'])
}
}
]
|
// 桥梁
import http from '@/base/api/public'
let manageConfig = require('@/config/manageConfig')
let manUrl = manageConfig.ApiUrlPre
// 查找全部项目
// export const getAll = () => {
// return http.requestQuickGet(manUrl + '/bridge_a/getAll')
// }
// 批量删除项目
export const delByIds = ids => {
return http.requestQuickGet(manUrl + '/bridge_a/delByIds/{ids}?ids=' + ids)
}
// 获取指定标段下所有的桥梁表
export const findBySectionId = sectionId => {
return http.requestQuickGet(manUrl + '/bridge_a/findBySectionId?sectionId=' + sectionId)
}
// 获取指定项目下所有的桥梁表
export const findByItemId = itemId => {
return http.requestQuickGet(manUrl + '/bridge_a/findByItemAId?itemAId=' + itemId)
}
// 根据id查找项目
export const getById = id => {
return http.requestQuickGet(manUrl + '/bridge_a/getOne/' + id)
}
// 添加项目
export const add = param => {
return http.requestPost(manUrl + '/bridge_a/add', param)
}
// 修改项目
export const edit = param => {
return http.requestPost(manUrl + '/bridge_a/edit', param)
}
// 添加项目
export const getByCondition = param => {
return http.requestPost(manUrl + '/bridge_a/getByCondition?pageNumber='+param.pageNumber+'&pageSize='+param.pageSize, param)
}
|
import styled from 'styled-components';
const IllustrationHero = styled.div`
transform: translateY(60px);
@media (min-width: 768px) {
width: 45%;
}
`;
export default IllustrationHero;
|
import React, { Component } from 'react';
import { Polar } from 'react-chartjs-2';
import ChartConfig from 'Constants/chart-config';
const data = {
datasets: [{
data: [
11,
16,
7,
3
],
backgroundColor: [
ChartConfig.color.primary,
ChartConfig.color.warning,
ChartConfig.color.default,
ChartConfig.color.info
],
label: 'My dataset'
}],
labels: [
'Series A',
'Series B',
'Series C',
'Series D'
]
};
const options = {
legend: {
labels: {
fontColor: ChartConfig.legendFontColor
}
}
};
export default class PolarChart extends Component {
render() {
return (
<Polar data={data} options={options} />
);
}
}
|
'use strict';
module.exports = {
Db: require('./modules/db'),
User: require('./modules/user')
};
|
import Ember from 'ember';
// Copied from ember-osf/utils/load-relationship.js
function loadAll(model, relationship, dest, options = {}) {
var page = options.page || 1;
var query = {
'page[size]': 10,
page: page
};
query = Ember.assign(query, options || {});
return model.query(relationship, query).then(results => {
dest.pushObjects(results.toArray());
if (results.meta) {
var total = results.meta.pagination.count;
var pageSize = 10;
var remaining = total - (page * pageSize);
if (remaining > 0) {
query.page = page + 1;
query['page[size]'] = pageSize;
return loadAll(model, relationship, dest, query);
}
}
});
}
export default Ember.Mixin.create({
_study: null,
_child: null,
_response: null,
_pastResponses: Ember.A(),
_getStudy(params) {
return this.get('store').findRecord('study', params.study_id);
},
_getChild(params) {
// Note: could handle case where child_id parameter is missing or invalid here and
// generate an example child record.
return this.get('store').findRecord('child', params.child_id);
},
_createStudyResponse() {
let response = this.store.createRecord('response', {
completed: false,
expData: {},
sequence: []
});
response.set('study', this.get('_study'));
response.set('child', this.get('_child'));
return response;
},
model(params) {
return Ember.RSVP.Promise.resolve()
.then(() => this._getStudy(params))
.then((study) => { // Store study to this
this.set('_study', study);
console.log('Study: ' + study.id);
return this._getChild(params);
})
.then((child) => {
this.set('_child', child);
console.log('Child: ' + child.id);
return this._createStudyResponse().save();
}).then((response) => {
this.set('_response', response);
// merge each page of previous responses into _pastResponses
return loadAll(this.get('_study'), 'responses', this.get('_pastResponses'), { 'child': this.get('_child').id });
}).then(() => {
const response = this.get('_response');
response.set('study', this.get('_study'));
response.set('child', this.get('_child'));
if (!this.get('_pastResponses').includes(response)) {
this.get('_pastResponses').pushObject(response);
}
})
.catch((errors) => {
window.console.log(errors);
this.transitionTo('page-not-found');
});
},
setupController(controller) {
this._super(controller);
controller.set('study', this.get('_study'));
controller.set('child', this.get('_child'));
controller.set('response', this.get('_response'));
controller.set('pastResponses', this.get('_pastResponses'));
}
});
|
var data = [
// {url:'inscripciones-la-fototeca', titulo: 'Inscripciones La Fototeca', imagen : 'fototeca/thumb.png'},
{url:'portones-y-sistemas', titulo: 'Portones y sistemas', imagen : 'portones/thumb.png'},
{url:'our-fashion-box', titulo: 'Our Fashion Box', imagen : 'our/thumb.png'},
{url:'cronicas-geek', titulo: 'Cronicas de un geek', imagen : 'cronicas/thumb.png'},
{url:'portafolio-antiguo', titulo: 'Portafolio antiguo', imagen : 'oldcv/thumb.png'},
{url:'radio-manager', titulo: 'Administrador de radios', imagen : 'radiomanager/thumb.png'},
{url:'envio-mensajes', titulo: 'Envio de mensajes', imagen : 'sendmsm/thumb.png'},
{url:'catalogo', titulo: 'Tienda de perfumes', imagen : 'catalogo/thumb.png'},
{url:'bpo', titulo: 'BPO Innovations', imagen : 'bpo/thumb.png'},
{url:'imporex', titulo: 'Imporex 95', imagen : 'imporex/thumb.png'},
{url:'cm', titulo: 'cm', imagen : 'cm/dashboard/thumb.png'},
]
module.exports = data;
|
import { useState } from "react";
import config from "../configuration";
export default () => {
const initialX = config.shapeSize;
const initialY = config.shapeSize;
const [x, setX] = useState(initialX);
const [y, setY] = useState(initialY);
function updatePosition(xDirection, yDirection) {
setX(x + xDirection);
setY(y + yDirection);
}
function reset() {
setX(initialX);
setY(initialY);
}
return [x, y, updatePosition, reset];
};
|
function loadview()
{
$.ajax({
url:"services/organization.php",
data:{"_": new Date().getHours() , "type":"inter"},
dataType:'json',
type:"GET",
success: function(data){
console.log(data.result);
$('#media-data img').attr('src',data.result.chart);
},
error : function (xhr,status,err)
{
console.error("load organization inter market error : " + xhr.responseText);
alert("load organization inter market error : "+ xhr.responseText);
}
});
}
function loadinfo()
{
$.ajax({
url:"services/attributes.php",
data:{"_": new Date().getHours() , "type":"chart"},
dataType:'json',
type:"GET",
success: function(data){
console.log(data.result);
$('#media-data img').attr('src',data.result.chart);
},
error : function (xhr,status,err)
{
console.error("load organization chart error : " + xhr.responseText);
alert("load organization chart error : "+ xhr.responseText);
}
});
}
function loadcountry(){
var endpoint = "services/organization.php";
var method = "GET";
var args = {"_": new Date().getHours() , "type":"country"} ;
utility.service(endpoint,method,args,showcountry);
}
function showcountry(resp){
console.log(resp);
if(resp.result!=undefined){
var view = $('#content-data');
$.each(resp.result,function(id,val){
var item = val.title+"<br/>";
view.append(item);
});
}
}
|
/* eslint-disable jsx-a11y/control-has-associated-label */
import React from 'react';
import PropTypes from 'prop-types';
import { useTranslation } from 'react-i18next';
export default function SelfAssessmentPanel({ task, onClick }) {
const { t } = useTranslation();
const handleClick = (e) => {
onClick(e);
};
const handleHover = (e) => {
e.target.className += ' hover:bg-green-300';
};
const style = {
buttonStyle:
'bg-transparent border-2 border-gray-400 rounded-full focus:outline-none',
trans: 'transition duration-500',
hover: '',
};
return (
<div className="transition-all duration-100 bg-background-primary">
<div className="flex-auto h-64 py-10 lg:h-48">
<h1
className={` text-4xl text-textColor-primary text-center font-sans ${style.trans} ${style.hover} transition-all duration-100 `}
>
{t(task)}
</h1>
</div>
<div className="flex-auto pt-20 ">
<div className={` flex mt-8 mx-auto justify-center ${style.trans}`}>
<div className="flex flex-col self-center justify-center flex-1 ">
<button
type="button"
data-rate="20"
className={` p-6 mt-6 mx-auto md:p-10 ${style.buttonStyle} ${style.trans} ${style.hover}`}
onClick={handleClick}
onMouseEnter={handleHover}
/>
<p className="mx-auto mt-3 text-gray-500">{t('Never')}</p>
</div>
<div className="flex self-center justify-center flex-1 ">
<button
type="button"
data-rate="40"
className={` p-4 md:p-8 ${style.buttonStyle} ${style.trans} ${style.hover}`}
onClick={handleClick}
onMouseEnter={handleHover}
/>
</div>
<div className="flex self-center justify-center flex-1 ">
<button
type="button"
data-rate="60"
className={` p-3 md:p-6 ${style.buttonStyle} ${style.trans}${style.hover}`}
onClick={handleClick}
onMouseEnter={handleHover}
/>
</div>
<div className="flex self-center justify-center flex-1 ">
<button
type="button"
data-rate="80"
className={` p-4 md:p-8 ${style.buttonStyle} ${style.trans} ${style.hover}`}
onClick={handleClick}
onMouseEnter={handleHover}
/>
</div>
<div className="flex flex-col self-center justify-center flex-1 ">
<button
type="button"
data-rate="100"
className={`p-6 mt-6 mx-auto md:p-10 ${style.buttonStyle} ${style.trans} ${style.hover} `}
onClick={handleClick}
onMouseEnter={handleHover}
/>
<p className="mx-auto mt-3 text-gray-500">{t('Always')}</p>
</div>
</div>
</div>
</div>
);
}
SelfAssessmentPanel.propTypes = {
task: PropTypes.string.isRequired,
onClick: PropTypes.func.isRequired,
};
|
import React, { useState, useContext, useEffect } from "react";
import styled from "@emotion/styled";
import AuthContext from "../../context/autenticacion/authContext";
import { Link } from "react-router-dom";
const ContenedorLogin = styled.div`
background-image: radial-gradient(
circle at 62.28% 119.64%,
#434863 0,
#1f3159 50%,
#001d4f 100%
);
height: 1000px;
display: grid;
align-items: center;
`;
const LoginDiv = styled.div`
background-image: linear-gradient(
345deg,
#00ffff 0,
#21e0ff 25%,
#3cb5f2 50%,
#408cbb 75%,
#3b6788 100%
);
height: auto;
width: 60%;
border-radius: 15%;
margin: 0 auto;
padding-top: 1em;
`;
const Loginh1 = styled.h1`
font-size: 2em;
color: #ffffff;
width: 60%;
margin: 0 auto;
margin-bottom: 1em;
`;
const LoginForm = styled.div`
width: 90%;
margin: 0 auto;
div > button {
margin: 0 auto;
}
`;
const NuevaCuenta = (props) => {
const authContext = useContext(AuthContext);
const { autenticado, registrarUsuario } = authContext;
//En caso de que el usuario se haya autenticado o registrado o este duplicado
useEffect(() => {
if (autenticado) {
props.history.push("/Agenda");
}
// eslint-disable-next-line
}, [autenticado, props.history]);
//State cliente
const [cliente, guardarCliente] = useState({
nombre: "",
correo: "",
password: "",
});
//Extraer Cliente
const { nombre, correo, password } = cliente;
const onChange = (e) => {
guardarCliente({
...cliente,
[e.target.name]: e.target.value,
});
};
const onSubmit = (e) => {
e.preventDefault();
registrarUsuario({
nombre,
correo,
password,
});
};
return (
<ContenedorLogin>
<LoginDiv>
<Loginh1>Registro </Loginh1>
<LoginForm>
<form onSubmit={onSubmit}>
<div className="field">
<label className="label">Correo</label>
<input
className="input is-rounded "
type="correo"
id="correo"
name="correo"
placeholder="Tu correo"
value={correo}
onChange={onChange}
/>
</div>
<div className="field">
<label className="label">Password</label>
<input
className="input is-rounded"
type="password"
id="password"
name="password"
placeholder="Ingresa Tu password"
value={password}
onChange={onChange}
/>
</div>
<div className="field">
<label className="label">Nombre</label>
<input
className="input is-rounded"
type="text"
id="nombre"
name="nombre"
placeholder="Ingresa Tu Nombre"
value={nombre}
onChange={onChange}
/>
</div>
<div className="field">
<button className="button is-link is-medium is-rounded">
Registrar
</button>
</div>
<Link to="/">Tienes una cuenta? Inicia Sesion</Link>
</form>
</LoginForm>
</LoginDiv>
</ContenedorLogin>
);
};
export default NuevaCuenta;
|
//Task 6
function largestNum(a,b,c){
//largest number
if((a>b) && (a>c)){
return a;
}else{
if((b > a) && (b > c)){
return b;
}else{
if((c > a) && (c > b)){
return c;
}
}
}
}
console.log(largestNum(12,4,65));
|
const Todo = require('./Todo')
module.exports.list = (req,res) => {
Todo.find()
.then((item) =>{
if(item){
res.json(item)
} else {
res.json({})
}
})
.catch(err => {
res.json(err)
})
}
module.exports.create = (req,res) => {
const body = req.body
const todo = new Todo(body)
todo.save()
.then((item) => {
if(item){
res.json(item)
} else {
res.json({})
}
})
.catch(err => {
res.json(err)
})
}
module.exports.show = (req,res) => {
const id = req.params.id
Todo.findById(id)
.then((item) => {
if(item){
res.json(item)
} else {
res.json({})
}
})
.catch(err => {
res.json(err)
})
}
module.exports.update = (req,res) => {
const id = req.params.id
const body = req.body
Todo.findByIdAndUpdate(id,body, {new: true, runValidators: true})
.then((item) => {
if(item){
res.json(item)
} else {
res.json({})
}
})
.catch(err => {
res.json(err)
})
}
module.exports.delete = (req, res) => {
const id = req.params.id
Todo.findByIdAndDelete(id)
.then((item) => {
if(item){
res.json(item)
} else {
res.json({})
}
})
.catch(err => {
res.json(err)
})
}
|
const mysql = require("mysql");
const inquirer = require("inquirer");
const { printTable } = require('console-table-printer');
const figlet = require('figlet');
var connection = mysql.createConnection({
host: "localhost",
port: 3306,
user: "root",
password: "",
database: "teams_db"
});
figlet('TMDMS', function(err, data) {
if (err) {
console.log('Something went wrong...');
console.dir(err);
return;
}
console.log(data)
});
connection.connect(function (err) {
if (err) throw err;
runSearch();
})
function runSearch() {
inquirer
.prompt({
name: "action",
type: "rawlist",
message: "What would you like to do?",
choices: [
"View all employees",
"View all employees by manager",
"View all employees by department",
"Search for a specific employee",
"Add employee",
"Remove employee",
"Update employee role ID or salary",
"View all departments",
"Add department",
"Remove department",
"View all roles",
"Add role",
"Remove role",
"View operating expenses",
"EXIT"
]
})
.then(function (answer) {
switch (answer.action) {
case "View all employees":
empAll();
break;
case "View all employees by manager":
empMng();
break;
case "View all employees by department":
empDep();
break;
case "Search for a specific employee":
empSearch();
break;
case "Add employee":
addEmp();
break;
case "Remove employee":
removeEmp();
break;
case "Update employee role ID or salary":
updateEmp();
break;
case "View all departments":
viewDep();
break;
case "Add department":
addDep();
break;
case "Remove department":
removeDep();
break;
case "View all roles":
viewRoles();
break;
case "Add role":
addRole();
break;
case "Remove role":
removeRole();
break;
case "View operating expenses":
operatingExp();
break;
case "Exit":
connection.end();
break;
}
});
}
// WORKS
function empAll() {
connection.query("SELECT * FROM employees", function (err, res) {
if (err) throw err;
printTable(res);
runSearch();
})
};
// WORKS
function empMng() {
connection.query("SELECT e.first_name, e.last_name, e.emp_id, dm.dept_id FROM employees e JOIN dept_managers dm ON e.emp_id = dm.emp_id;", function (err, results) {
if (err) throw err;
inquirer
.prompt([
{
name: "choice",
type: "rawlist",
choices: function () {
var choiceArray = [];
for (var i = 0; i < results.length; i++) {
choiceArray.push(results[i].first_name + " " + results[i].last_name);
}
return choiceArray;
},
message: "Which manager?"
}
])
.then(function (answer) {
const manager = results.find(person => person.first_name + " " + person.last_name === answer.choice)
connection.query("SELECT e.first_name, e.last_name, r.dept_id FROM employees e JOIN roles r ON e.role_id = r.role_id WHERE ?;",
{ dept_id: manager.dept_id },
function (err, res) {
if (err) throw err;
printTable(res);
runSearch();
}
)
})
})
};
// WORKS
function empDep() {
connection.query("SELECT * FROM departments", function (err, results) {
if (err) throw err;
inquirer
.prompt([
{
name: "choice",
type: "rawlist",
choices: function () {
var choiceArray = [];
for (var i = 0; i < results.length; i++) {
choiceArray.push(results[i].dept_name);
}
return choiceArray;
},
message: "Which department?"
}
])
.then(function (answer) {
const department = results.find(dept => dept.dept_name === answer.choice);
connection.query("SELECT e.first_name, e.last_name, r.dept_id FROM employees e JOIN roles r ON e.role_id = r.role_id WHERE ?",
{ dept_id: department.dept_id },
function (err, res) {
if (err) throw err;
printTable(res);
runSearch();
}
)
})
})
};
// WORKS
function empSearch() {
inquirer
.prompt({
name: "employee",
type: "input",
message: "What is the employee's first name?"
})
.then(function (answer) {
connection.query("SELECT * FROM employees WHERE ?", { first_name: answer.employee }, function (err, res) {
if (err) throw err;
printTable(res);
runSearch();
});
});
};
// WORKS
function addEmp() {
connection.query("SELECT * FROM roles", function (err, results) {
if (err) throw err;
inquirer
.prompt([
{
name: "emp_id",
type: "input",
message: "What will the employee's id number be?"
},
{
name: "first_name",
type: "input",
message: "What is the employees's first name?"
},
{
name: "last_name",
type: "input",
message: "What is the employee's last name?"
},
{
name: "role_id",
type: "input",
message: "What will their role_id be?",
},
{
name: "salary",
type: "input",
message: "What is their salary?",
}
])
.then(function (answer) {
connection.query(
"INSERT INTO employees SET ?",
{
emp_id: answer.emp_id,
first_name: answer.first_name,
last_name: answer.last_name,
role_id: answer.role_id,
salary: answer.salary
},
function (err) {
if (err) throw err;
console.log("Your employee was added successfully!");
runSearch();
}
);
});
})
};
// WORKS
function removeEmp() {
connection.query("SELECT * FROM employees", function (err, results) {
if (err) throw err;
inquirer
.prompt([
{
name: "emp_id",
type: "input",
message: "What is the employee ID of the employee you want to remove?",
}
])
.then(function (answer) {
connection.query("DELETE FROM employees WHERE ?",
{
emp_id: answer.emp_id
},
function (err, res) {
if (err) throw err;
console.log("Your employee was removed successfully!");
runSearch();
}
);
});
});
};
// WORKS
function updateEmp() {
connection.query("SELECT * FROM employees", function (err, results) {
if (err) throw err;
inquirer
.prompt([
{
name: "emp_id",
type: "rawlist",
message: "What is the employee ID of the employee you want to update?",
choices: function () {
var choiceArray = [];
for (var i = 0; i < results.length; i++) {
choiceArray.push(results[i].emp_id)
}
return choiceArray;
}
},
{
name: "choice",
type: "rawlist",
message: "What would you like to update?",
choices: [
"Update employee role",
"Update employee salary",
]
}
])
.then(function (answer) {
if (answer.choice === "Update employee role") {
inquirer
.prompt([
{
name: "role_id",
type: "input",
message: "What is the new role ID of the employee?"
}
])
.then(function (answer2) {
connection.query("UPDATE employees SET ? WHERE ?",
[
{ role_id: answer2.role_id },
{ emp_id: answer.emp_id }
],
function (err, res) {
if (err) throw err;
console.log("Your employee's role was updated successfully!")
runSearch();
}
)
})
}
else if (answer.choice === "Update employee salary") {
inquirer
.prompt([
{
name: "salary",
type: "input",
message: "What is the new salary of the employee?"
}
])
.then(function (answer2) {
connection.query("UPDATE employees SET ? WHERE ?",
[
{ salary: answer2.salary },
{ emp_id: answer.emp_id }
],
function (err, res) {
if (err) throw err;
console.log("Your employee's salary was updated successfully!")
runSearch();
}
)
});
}
});
});
};
// WORKS
function viewDep() {
connection.query("SELECT * FROM departments", function (err, res) {
if (err) throw err;
printTable(res);
runSearch();
})
};
// WORKS
function addDep() {
connection.query("SELECT * FROM departments", function (err, results) {
if (err) throw err;
inquirer
.prompt([
{
name: "dept_id",
type: "input",
message: "What will the departments's id number be?"
},
{
name: "dept_name",
type: "input",
message: "What is the departments's name?"
}
])
.then(function (answer) {
connection.query(
"INSERT INTO departments SET ?",
{
dept_id: answer.dept_id,
dept_name: answer.dept_name,
},
function (err) {
if (err) throw err;
console.log("Your department was added successfully!");
runSearch();
}
);
});
});
};
// WORKS
function removeDep() {
connection.query("SELECT * FROM departments", function (err, results) {
if (err) throw err;
inquirer
.prompt([
{
name: "dept_id",
type: "input",
message: "What is the department ID of the department you want to remove?",
}
])
.then(function (answer) {
connection.query("DELETE FROM departments WHERE ?",
{
dept_id: answer.dept_id
},
function (err, res) {
if (err) throw eww;
console.log("Your department was removed successfully!");
runSearch();
}
);
});
});
};
// WORKS
function viewRoles() {
connection.query("SELECT * FROM roles", function (err, res) {
if (err) throw err;
printTable(res);
runSearch();
})
};
// WORKS
function addRole() {
connection.query("SELECT * FROM roles", function (err, results) {
if (err) throw err;
inquirer
.prompt([
{
name: "role_id",
type: "input",
message: "What will the role's id number be?"
},
{
name: "title",
type: "input",
message: "What will the role's title be"
},
{
name: "dept_id",
type: "input",
message: "What will the role's department id be?"
},
])
.then(function (answer) {
connection.query(
"INSERT INTO roles SET ?",
{
role_id: answer.role_id,
title: answer.title,
dept_id: answer.dept_id
},
function (err) {
if (err) throw err;
console.log("Your role was added successfully!");
runSearch();
}
);
});
})
};
// WORKS
function removeRole() {
connection.query("SELECT * FROM roles", function (err, results) {
if (err) throw err;
inquirer
.prompt([
{
name: "role_id",
type: "input",
message: "What is the role ID of the role you want to remove?",
}
])
.then(function (answer) {
connection.query("DELETE FROM roles WHERE ?",
{
role_id: answer.role_id
},
function (err, res) {
if (err) throw eww;
console.log("Your role was removed successfully!");
runSearch();
}
);
});
});
};
// WORKS
function operatingExp() {
connection.query("SELECT * FROM departments", function (err, results) {
if (err) throw err;
inquirer
.prompt([
{
name: "dept_id",
type: "rawlist",
message: "What department would you like to audit?",
choices: function () {
var choiceArray = [];
for (var i = 0; i < results.length; i++) {
choiceArray.push(results[i].dept_id)
}
return choiceArray;
}
},
])
.then(function (answer) {
connection.query(
"SELECT SUM(e.salary) AS Total_Expense,r.dept_id AS Department_ID FROM employees e JOIN roles r ON e.role_id = r.role_id WHERE ?",
[
{
dept_id: answer.dept_id
},
],
function (err, res) {
if (err) throw err;
printTable(res);
runSearch();
}
);
});
});
};
|
#!/usr/bin/env node
/**
* Bibliotecas
*/
var http = require('http');
var path = require('path');
var socketio = require('socket.io');
var express = require('express');
var cp = require('child_process');
/**
* Configurações do servidor
*/
var router = express();
var server = http.createServer(router);
var io = socketio.listen(server);
router.use(express.static(path.resolve(__dirname, 'client')));
var users = [];
io.on('connection', function(socket) {
var user = users.push({
socket: socket
}) - 1;
socket.on('disconnect', function() {
var index = users.findIndex(function(user) {
return user.socket === socket;
});
if (index >= 0) {
users[index].process && users[index].process.kill();
users[index] = {};
}
});
socket.on('start', function(settings) {
users[user].process = cp.fork(path.resolve(__dirname, 'class-schedule.js'));
users[user].process.on('message', function(message) {
users[message.user].socket.emit(message.name, message.data);
});
users[user].process.send({
user: user,
settings: settings
});
});
});
server.listen(process.env.PORT || 8080, process.env.IP || '0.0.0.0', function() {
var addr = server.address();
console.log('Server listening at', addr.address + ':' + addr.port);
});
|
$(document).ready( function () {
$('.main-carousel').flickity({
autoPlay: 5000,
wrapAround: true,
pageDots: true,
prevNextButtons: false,
setGallerySize: false,
draggable: true,
dragThreshold: 9
});
});
|
/**
* Created by Administrator on 2017/8/23.
*/
$(function(){
init();
function init() {
var prov=$('.prov').data().prov||' ';
var city=$('.city').data().city||' ';
citySelect('.form_gs',prov,city);
}
function citySelect(obj,prov,city){
console.log(prov,city);
$(obj).citySelect({
// nodata:"none",
required:false,
prov:prov,
city:city
});
}
});
|
import React from "react";
import { View, ScrollView } from "react-native";
import { useSelector } from "react-redux";
// components
import CreditItem from "../components/CreditItem";
import Background from "../components/Background";
import ThemeText from "../components/ThemeText";
import Wrapper from "../components/Wrapper";
// svg
import Logo from "../assets/logo-single.svg";
// styles
import styles from "../styles/main";
import openLink from "../helpers/openLink";
const credits = [
{
name: "Rain",
author: "StockSnap",
url: "https://pixabay.com/images/id-2590618",
},
{
name: "Clear",
author: "cegoh",
url: "https://pixabay.com/images/id-3184798",
},
{
name: "Thunder",
author: "Free-Photos",
url: "https://pixabay.com/images/id-1082080",
},
{
name: "Snow",
author: "Free-Photos",
url: "https://pixabay.com/images/id-1209401",
},
{
name: "Fog",
author: "StockSnap",
url: "https://pixabay.com/images/id-2617838",
},
{
name: "Cloudy",
author: "waquitar",
url: "https://pixabay.com/images/id-1571775",
},
{
name: "Typhoon",
author: "WikiImages",
url: "https://pixabay.com/images/id-62957",
},
{
name: "sky",
author: "Engin_Akyurt",
url: "https://pixabay.com/images/id-3052118/",
},
];
const CreditScreen = () => {
const { theme } = useSelector(state => state);
return (
<Wrapper>
<Background source={require("../assets/sky.jpg")} />
<View style={styles.creditWrapper}>
<View style={styles.alignCenter}>
<View style={[styles.alignCenter, styles.dialog]}>
<Logo width={150} fill={theme.black} />
<ThemeText>
Weather Inspector is a Harvard CS50 Mobile Project
</ThemeText>
<ThemeText>
Made By{" "}
<ThemeText
style={styles.link}
onPress={() => openLink("https://google.com")}
>
LCTOAN.
</ThemeText>
</ThemeText>
</View>
<ThemeText style={styles.heading}>Images:</ThemeText>
<ScrollView style={styles.listWrapper}>
{credits.map(credit => (
<CreditItem credit={credit} key={credit.url} />
))}
</ScrollView>
</View>
</View>
</Wrapper>
);
};
export default CreditScreen;
|
// console.log('ggggggggggggggggggggggggggg')
//
// function rankFunc(id) {
// // let wrap = document.createElement('div');
// // wrap.setAttribute('class', 'text-muted');
// // wrap.innerHTML = '<button onclick="reply(\'sad\')" type="button" value="sad" class="btn feel"><i class="fa fa-frown-o fa-3x"></i></button><button onclick="reply(\'neutral\')" type="button" value="neutral" class="btn feel"><i class="fa fa-meh-o fa-3x"></i></button><button onclick="reply(\'happy\')" type="button" value="happy" class="btn feel"><i class="fa fa-smile-o fa-3x"></i></button><hr>'
//
//
// console.log("rank fun")
// console.log(id)
// swal({
// title: "Rate me!",
// text: "Write something interesting:",
// type: "input",
// showCancelButton: true,
// closeOnConfirm: false,
// inputPlaceholder: "Write something"
// }, async function (inputValue) {
// // if (inputValue === false) return false;
// if (inputValue === "") {
// swal.showInputError("You need to write something!");
// return false
// }
// if(inputValue){
// try {
// const res = await fetch('/rateContractor', {
// method: 'POST',
// body: JSON.stringify({id,"recommendation": inputValue}),
// headers: {'Content-Type': 'application/json'}
// })
// const data = await res.json()
// if (data) {
// swal("Nice!", "You wrote: " + inputValue, "success");
//
// }
// } catch (err) {
// console.log(err)
// }
// }
//
// });
//
// }
// eslint-disable-next-line no-unused-vars
// function ask() {
// let wrap = document.createElement('div')
// // wrap.setAttribute('class', 'text-muted');
// wrap.innerHTML = '<h1>333333333333</h1><button onclick="reply(\'sad\')" type="button" value="sad" class="btn feel"><i class="fa fa-frown-o fa-3x"></i></button><button onclick="reply(\'neutral\')" type="button" value="neutral" class="btn feel"><i class="fa fa-meh-o fa-3x"></i></button><button onclick="reply(\'happy\')" type="button" value="happy" class="btn feel"><i class="fa fa-smile-o fa-3x"></i></button><hr>'
//
// swal({
// title: "",
// text: "How do you like the new features?",
// icon: "info",
// className: '',
// closeOnClickOutside: false,
// // content: {
// // element: wrap
// // },
// content: wrap,
//
// buttons: {
// confirm: {
// text: "Close",
// value: '',
// visible: true,
// className: "btn btn-default",
// closeModal: true,
// }
// },
// }).then((value) => {
// if (value === 'sad') {
// swal("Sorry!", {
// icon: "error",
// buttons: false
// });
// } else if (value === 'neutral') {
// swal("Okay!", {
// icon: "warning",
// buttons: false
// });
// } else if (value === 'happy') {
// swal("Hooray!", {
// icon: "success",
// buttons: false
// });
// }
// });
// }
// function reply(feel){
// swal.setActionValue(feel);
// }
|
import React, { useContext, useEffect } from 'react';
import { withStyles, makeStyles } from '@material-ui/core/styles';
import Table from '@material-ui/core/Table';
import TableBody from '@material-ui/core/TableBody';
import TableCell from '@material-ui/core/TableCell';
import TableContainer from '@material-ui/core/TableContainer';
import TableHead from '@material-ui/core/TableHead';
import TableRow from '@material-ui/core/TableRow';
import Paper from '@material-ui/core/Paper';
import DeleteIcon from '@material-ui/icons/Delete';
import IconButton from '@material-ui/core/IconButton';
import { localItem } from '../../contexts/LocalContext';
import { Navbar } from 'react-bootstrap';
import Header from '../../containers/Navbar/Navbar';
// import { cartContext } from '../../contexts/CartContext';
const StyledTableCell = withStyles((theme) => ({
head: {
backgroundColor: theme.palette.common.black,
color: theme.palette.common.white,
},
body: {
fontSize: 14,
},
}))(TableCell);
const StyledTableRow = withStyles((theme) => ({
root: {
'&:nth-of-type(odd)': {
backgroundColor: theme.palette.action.hover,
},
},
}))(TableRow);
// function createData(name, calories, fat, carbs, protein) {
// return { name, calories, fat, carbs, protein };
// }
const useStyles = makeStyles({
table: {
minWidth: 700,
},
});
export default function Favorite() {
const classes = useStyles();
const { getItemFromLocal, delFromToLocal, items } = useContext(localItem)
// const {removeProductFromCart, addP roductToCart, cart} = useContext(cartContext)
console.log(items)
useEffect(() => {
getItemFromLocal()
}, [])
return (
<>
<Header/>
<TableContainer component={Paper}>
<Table className={classes.table} aria-label="customized table">
<TableHead>
<TableRow>
<StyledTableCell>Name</StyledTableCell>
<StyledTableCell align="right">brand</StyledTableCell>
<StyledTableCell align="right">price</StyledTableCell>
<StyledTableCell align="right">×</StyledTableCell>
{/* <StyledTableCell align="right">buy</StyledTableCell> */}
</TableRow>
</TableHead>
<TableBody>
{items.map((row) => (
<StyledTableRow key={row.name}>
<StyledTableCell component="th" scope="row">
{row.title}
</StyledTableCell>
<StyledTableCell align="right">{row.brand}</StyledTableCell>
<StyledTableCell align="right">{row.price}</StyledTableCell>
<StyledTableCell align="right">
<IconButton onClick={delFromToLocal} aria-label="delete">
<DeleteIcon />
</IconButton>
</StyledTableCell>
</StyledTableRow>
))}
</TableBody>
</Table>
</TableContainer>
</>
);
}
|
const { devices } = require('playwright');
exports.config = {
tests: './*.test.js',
output: './output',
helpers: {
VideoHelper: {
require: 'codeceptjs-video-helper'
},
Playwright: {
browser: 'chromium',
url: 'http://localhost:8001',
show: true,
emulate: {
...devices['Pixel 2'],
recordVideo: process.env.RECORD_TESTS ? {
dir: "./output"
} : undefined,
}
}
// WebDriver: {
// url: 'http://localhost:8001',
// smartWait: 5000,
// browser: "chrome",
// restart: false,
// windowSize: "maximize",hi
// timeouts: {
// "script": 60000,
// "page load": 10000
// }
// }
},
include: {
I: './steps_file.js'
},
bootstrap: null,
mocha: {},
name: 'e2e',
plugins: {
pauseOnFail: {},
retryFailedStep: {
enabled: true
},
tryTo: {
enabled: true
},
screenshotOnFail: {
enabled: true
},
wdio: {
enabled: true,
services: ['selenium-standalone']
// additional config for service can be passed here
}
}
}
|
module.exports = async (question) => {
const response = []
let repeat = true
const breakLoop = () => repeat = false
while (repeat) {
const anwser = await question(breakLoop)
if (anwser) response.push(anwser)
}
return response
}
|
if (typeof require === "function") var flexo = require("../../flexo.js");
(function (dcpu16)
{
// Names of the registers
dcpu16.registers = "ABCXYZIJ";
// Opcodes
dcpu16.opcodes = ["", "SET", "ADD", "SUB", "MUL", "DIV", "MOD", "SHL", "SHR",
"AND", "BOR", "XOR", "IFE", "IFN", "IFG", "IFB", "JSR"];
// Format a hex value like 0x%4x
dcpu16.hex = function(v)
{
return "0x{0}".fmt(flexo.pad(v.toString(16), 4));
};
// Decode the first word of an instruction and return opcode, a and b (for
// simple opcodes)
function decode(word)
{
var op = word & 0xf;
if (op) {
// Simple opcode
var a = (word & 0x03f0) >> 4;
var b = (word & 0xfc00) >> 10;
return [dcpu16.opcodes[op], a, b];
} else {
// Extended opcode
var o = word & 0x03f0;
var a = (word & 0xfc00) >> 10;
return [dcpu16.opcodes[o], a];
}
}
// Return true if the value v requires fetching the next word
function should_fetch_next(v)
{
return (v >= 0x10 && v < 0x18) || v === 0x1e || v === 0x1f;
}
// Disassemble a value (given an extra word when necessary)
function disassemble_value(v, w)
{
if (v < 0x08) return dcpu16.registers[v];
if (v < 0x10) return "[{0}]".fmt(dcpu16.registers[v - 8]);
if (v < 0x18) {
return "[0x{0} + {1}]".fmt(w.toString(16), dcpu16.registers[v - 16]);
}
if (v === 0x18) return "POP";
if (v === 0x19) return "PEEK";
if (v === 0x1a) return "PUSH";
if (v === 0x1b) return "SP";
if (v === 0x1c) return "PC";
if (v === 0x1d) return "O";
if (v === 0x1e) return "[0x{0}]".fmt(w.toString(16));
if (v === 0x1f) return "0x{0}".fmt(w.toString(16));
return v - 32;
}
// Disassemble an instruction given one, two or three words. Note that w2 always
// goes with a, and w3 always with b (or a in the case of an extended opcode)
function disassemble(word, w2, w3)
{
var op = word & 0x0f;
if (op) {
var opcode = dcpu16.opcodes[op];
var a = (word & 0x03f0) >> 4;
var da = disassemble_value(a, w2);
var b = (word & 0xfc00) >> 10;
var db = disassemble_value(b, w3);
return "{0} {1}, {2}".fmt(opcode, da, db);
} else {
var o = word & 0x03f0;
var opcode = dcpu16.opcodes[op];
var a = (word & 0xfc00) >> 10;
var da = disassemble_value(a, w3);
return "{0} {1}".fmt(opcode, da);
}
}
// An actual machine with RAM and registers. Initialize before use!
dcpu16.machine =
{
// Initialize the RAM and registers of the machine
init: function()
{
this.ram = new Uint16Array(new ArrayBuffer(0x20000));
for (var i = this.ram.length - 1; i >= 0; --i) this.ram[i] = 0;
this.registers = new Uint16Array(new ArrayBuffer(16));
for (var i = this.registers.length - 1; i >= 0; --i) {
this.set_register(i, 0);
}
this.init_chars();
this.set_pc(0);
this.set_sp(0xffff);
this.set_o(0);
this.set_skip(false); // flag set when IFE, IFN, IFG or IFB is false
this.last_pc = 0xffff; // check whether we're in a loop
this.rate = 100; // rate of instruction fetching (0 for immediate)
return this;
},
set_ram: function(address, v)
{
address = address & 0xffff;
this.ram[address] = v & 0xffff;
flexo.notify(this, "@memory", { address: address });
},
init_chars: function()
{
this.set_ram(0x8182, 0x7e09); // A
this.set_ram(0x8183, 0x7e00);
},
set_register: function(i, v)
{
this.registers[i] = v & 0xffff;
flexo.notify(this, "@register", { which: dcpu16.registers[i],
value: this.registers[i] });
return this.registers[i];
},
set_pc: function(v)
{
this.pc = v & 0xffff;
flexo.notify(this, "@register", { which: "PC", value: this.pc });
return this.pc;
},
set_sp: function(v)
{
this.sp = v & 0xffff;
flexo.notify(this, "@register", { which: "SP", value: this.sp });
return this.sp;
},
set_o: function(v)
{
this.o = v & 0xffff;
flexo.notify(this, "@register", { which: "O", value: this.o });
return this.o;
},
set_skip: function(v)
{
this.skip = v;
flexo.notify(this, "@register", { which: "SKIP", value: this.skip });
return this.skip;
},
// Get a value for a/b given the next word
get_value: function(v, w)
{
if (v < 0x08) return this.registers[v]; // register
if (v < 0x10) return this.ram[this.registers[v - 8]]; // [register]
if (v < 0x18) return this.ram[this.registers[v - 16]] + w; // [register+w]
if (v === 0x18) { // POP / [SP++]
return this.ram[this.set_sp(this.sp + 1) - 1];
}
if (v === 0x19) return this.ram[this.sp]; // PEEK = [SP]
if (v === 0x1a) return this.ram[this.set_sp(this.sp - 1)]; // PUSH / [--SP]
if (v === 0x1b) return this.sp; // SP
if (v === 0x1c) return this.pc; // PC
if (v === 0x1d) return this.o; // O
if (v === 0x1e) return this.ram[w]; // [w]
if (v === 0x1f) return w; // w
return v - 0x20; // literal
},
// Set a value for a/b given the next word
set_value: function(v, w, value)
{
if (v < 0x08) this.set_register(v, value);
if (v < 0x10) this.set_ram(this.registers[v - 8], value);
if (v < 0x18) this.set_ram(this.registers[v - 16] + w, value);
if (v === 0x18) this.set_ram(this.set_sp(this.sp + 1) - 1);
if (v === 0x19) this.set_ram(this.sp, value);
if (v === 0x1a) this.set_ram(this.set_sp(this.sp - 1));
if (v === 0x1b) this.set_sp(value);
if (v === 0x1c) this.set_pc(value);
if (v === 0x1d) this.set_o(value);
if (v === 0x1e) this.set_ram(w, value);
},
set_with_overflow: function(a, wa, r)
{
this.set_value(a, wa, r);
this.set_o((r >> 16) & 0xffff);
},
exec: function()
{
var op =
{
SET: function(a, wa, b, wb) {
this.set_value(a, wa, this.get_value(b, wb));
},
ADD: function(a, wa, b, wb) {
this.set_with_overflow(a, wa,
this.get_value(a, wa) + this.get_value(b, wb));
},
SUB: function(a, wa, b, wb) {
this.set_with_overflow(a, wa,
this.get_value(a, wa) - this.get_value(b, wb));
},
MUL: function(a, wa, b, wb) {
this.set_with_overflow(a, wa,
this.get_value(a, wa) * this.get_value(b, wb));
},
DIV: function(a, wa, b, wb) {
this.set_with_overflow(a, wa,
this.get_value(a, wa) / this.get_value(b, wb));
},
MOD: function(a, wa, b, wb) {
this.set_with_overflow(a, wa,
this.get_value(a, wa) % this.get_value(b, wb));
},
SHL: function(a, wa, b, wb) {
this.set_with_overflow(a, wa,
this.get_value(a, wa) << this.get_value(b, wb));
},
SHR: function(a, wa, b, wb) {
this.set_with_overflow(a, wa,
this.get_value(a, wa) >> this.get_value(b, wb));
},
AND: function(a, wa, b, wb) {
this.set_value(a, wa, this.get_value(a, wa) & this.get_value(b, wb));
},
BOR: function(a, wa, b, wb) {
this.set_value(a, wa, this.get_value(a, wa) | this.get_value(b, wb));
},
XOR: function(a, wa, b, wb) {
this.set_value(a, wa, this.get_value(a, wa) ^ this.get_value(b, wb));
},
IFE: function(a, wa, b, wb) {
this.set_skip(this.get_value(a, wa) !== this.get_value(b, wb));
},
IFN: function(a, wa, b, wb) {
this.set_skip(this.get_value(a, wa) === this.get_value(b, wb));
},
IFG: function(a, wa, b, wb) {
this.set_skip(this.get_value(a, wa) <= this.get_value(b, wb));
},
IFB: function(a, wa, b, wb) {
this.set_skip((this.get_value(a, wa) & this.get_value(b, wb)) === 0);
},
JSR: function(a, wa) {
this.set_ram(this.set_sp(this.sp - 1), this.pc);
this.set_pc(this.get_value(a, wa));
},
};
var pc = this.pc;
var w = this.ram[pc++];
var instr = decode(w);
var w2 = should_fetch_next(instr[1]) ? this.ram[pc++] : 0;
var w3 = should_fetch_next(instr[2]) ? this.ram[pc++] : 0;
flexo.log("{0}: {1}".fmt(dcpu16.hex(this.pc), disassemble(w, w2, w3)));
this.set_pc(pc);
if (!this.skip) {
op[instr[0]].call(this, instr[1], w2, instr[2], w3);
} else {
flexo.log(" ... skipped!");
this.set_skip(false);
}
if (this.last_pc !== pc) {
this.last_pc = pc;
if (this.rate) {
setTimeout(this.exec.bind(this), this.rate);
} else {
this.exec();
}
}
}
};
})(typeof exports === "object" ? exports : this.dcpu16 = {});
|
var WallGame = function(universe) {
this.universe = universe;
this.walls = [];
this.timePlayed = 0;
this.generation = 0;
this.bestGene;
this.creatures = [];
this.trainer = new GATrainer(new Network([9,10,1]),{
population_size: 2,
mutation_size: 0.3,
mutation_rate: 0.05,
num_match: 4*2,
elite_percentage: 0.20
}, false);
this.survivors = this.trainer.population_size;
for (var i = 0; i < this.survivors; i++) {
var creature = new MountainLion(this.universe,new THREE.Vector3(Math.random() * 200, 100, Math.random() * 200));
this.universe.scene.add(creature.graphic);
creature.isAlive = true;
creature.fitness = 0;
creature.gene = [];
creature.decision = [0];
creature.brain = new Network([9,10,1]);
this.creatures.push(creature);
};
for (var i = 0; i < this.creatures.length; i++) {
this.creatures[i].chromosome = this.trainer.chromosomes[i];
this.creatures[i].brain.setWeights(this.trainer.chromosomes[i].gene);
}
}
WallGame.prototype.trainNetwork = function() {
var fitnessSort = function(a, b) {
if (a.fitness > b.fitness) {
return -1;
}
if (a.fitness < b.fitness) {
return 1;
}
return 0;
};
this.creatures.sort(fitnessSort);
this.bestGene = this.creatures[0].chromosome.gene;
console.log("generation",this.generation)
console.log("best gene",this.bestGene)
for (i = 1; i < this.creatures.length; i++) { // keep best guy the same. don't mutate the best one, so start from 1, not 0.
this.creatures[i].chromosome.mutate(this.trainer.mutation_rate, this.trainer.mutation_size);
}
for (var i = 0; i < this.creatures.length; i++) {
this.creatures[i].brain.setWeights(this.creatures[i].chromosome.gene)
};
}
WallGame.prototype.init = function() {
for (var i = 0; i < this.walls.length; i++) {
this.universe.scene.remove(this.walls[i].graphic)
};
this.walls = [];
this.generation++;
this.timePlayed = 0;
this.survivors = this.creatures.length;
this.trainNetwork();
for (var i = 0; i < this.creatures.length; i++) {
this.creatures[i].location = new THREE.Vector3(Math.random() * 200, 100, Math.random() * 200);
this.universe.scene.add(this.creatures[i].graphic);
this.creatures[i].isAlive = true;
this.creatures[i].fitness = 0;
};
}
WallGame.prototype.run = function() {
for (var i = this.walls.length - 1; i >= 0; i--) {
if (this.walls[i].location.x > this.universe.width / 2 || this.walls[i].location.x < -this.universe.width / 2 || this.walls[i].location.z > this.universe.height / 2 || this.walls[i].location.z < -this.universe.height / 2) {
this.universe.scene.remove(this.walls[i].graphic)
this.walls.splice(i, 1);
} else {
this.walls[i].update();
}
}
if (this.timePlayed % 40 == 0) {
var movingWall = new MovingWall(this.universe, new THREE.Vector3(-100, 100, -400));
this.walls.push(movingWall);
}
for (var i = this.creatures.length - 1; i >= 0; i--) {
if (this.creatures[i].graphic && this.creatures[i].isAlive) {
var senses = this.creatures[i].getSenses();
// console.log(this.decision,senses[senses.length-1])
var decision = this.creatures[i].brain.forward(senses);
// console.log(i,senses,decision)
for (var k = 0; k < decision.length; k++) {
if (decision[k] > 0.5) {
decision[k] = 1;
} else {
decision[k] = 0;
}
};
this.decision = decision;
this.creatures[i].doAction(decision);
this.creatures[i].update();
var collision = this.creatures[i].checkCollision(this.walls);
if (collision) {
this.universe.scene.remove(this.creatures[i].graphic)
this.creatures[i].isAlive = false;
this.creatures[i].fitness = this.timePlayed;
console.log("dead")
this.survivors--;
}
}
}
this.timePlayed++;
// console.log(this.timePlayed)
if (this.timePlayed > 500 || this.survivors == 0) {
console.log("restart",this.timePlayed,this.survivors)
this.init();
}
}
|
/**
* This file contains all functions for rendering the maze using different approaches
*/
/** Maze Generation using Depth-First Search (iterative approach) */
async function GenerateMaze_DFS(){
//InitializeAllWalls();
await ClearBoard();
let x = Math.floor(Math.random() * width)*2+1;
let y = Math.floor(Math.random() * height)*2+1;
let stack = [];
stack.push([y,x,-3]);
while(stack.length > 0){
/**Initialize current div to be visited and initialize all eight walls*/
let curr = stack[stack.length-1];
if($('#'+(curr[0])+'a'+(curr[1])).attr('type') != 'visited'){
RenderEightWalls(curr[0],curr[1]);
}
$('#'+(curr[0])+'a'+(curr[1])).attr('type','visited');
/**We need to carve out the walls */
Excavate(curr[2],curr[1],curr[0]);
let options = [];
for(let i = 0; i < 4; i++){
let curr_div = $('#'+(curr[0]+dy[i])+'a'+(curr[1]+dx[i]))
if(validDivIndx(curr[0]+dy[i],curr[1]+dx[i]) && curr_div.attr('type') != 'visited'){
options.push([curr[0]+dy[i],curr[1]+dx[i],i])
}
}
if(!options.length) stack.pop();
else{
let indx = Math.floor(Math.random()*options.length);
let next = options[indx];
stack.push(next);
await new Promise(resolve => setTimeout(resolve, 60/FPS));
}
}
$('[type=visited]').attr('type','tile');
}
/** Maze Generation using Prims minimum spanning tree algorithm */
async function GenerateMaze_Prims(){
await ClearBoard();
let x = Math.floor(Math.random() * width)*2+1;
let y = Math.floor(Math.random() * height)*2+1;
let set = [[y,x]];
while(set.length > 0){
let indx = Math.floor(Math.random()*set.length)
let curr = set[indx]; //pick random element in the set
set.splice(indx,1);
if($('#'+curr[0]+'a'+curr[1]).attr('type')!='visited'){
RenderEightWalls(curr[0],curr[1]);
}
else{
continue;
}
$('#'+curr[0]+'a'+curr[1]).attr('type','visited');
//Carve out the walls
switch(curr[2]){
case 0: $('#'+(curr[0])+'a'+(curr[1]+1)).attr('type','visited'); break;
case 2: $('#'+(curr[0])+'a'+(curr[1]-1)).attr('type','visited'); break;
case 1: $('#'+(curr[0]-1)+'a'+(curr[1])).attr('type','visited'); break;
default: $('#'+(curr[0]+1)+'a'+(curr[1])).attr('type','visited');break;
}
//analyze options
for(let i = 0; i < 4; i++){
let curr_div = $('#'+(curr[0]+dy[i])+'a'+(curr[1]+dx[i]))
if(validDivIndx(curr[0]+dy[i],curr[1]+dx[i]) && curr_div.attr('type') != 'visited'){
set.push([curr[0]+dy[i],curr[1]+dx[i],i]);
}
}
await new Promise(resolve => setTimeout(resolve, 60/FPS));
}
$('[type=visited]').attr('type','tile');
}
/** Maze Generation using Kruskals randomized tree algorithm */
async function GenerateMaze_Kruskals(){
await ClearBoard();
let edges = GetEdges();
while(edges.length > 0){
let curr = edges.splice(Math.floor(Math.random()*edges.length), 1)[0];
let div_1 = $('#'+curr[0][0]+'a'+curr[0][1]);
let div_2 = $('#'+curr[1][0]+'a'+curr[1][1]);
if(div_1.attr('type') != 'visited' || div_2.attr('type') != 'visited'){
//Render the wall
if(div_1.attr('type') != 'visited'){
RenderEightWalls(curr[0][0],curr[0][1]);
div_1.attr('set',div_1.attr('id'));
}
if(div_2.attr('type') != 'visited'){
RenderEightWalls(curr[1][0],curr[1][1]);
div_2.attr('set',div_2.attr('id'));
}
//Combine in same set
$('[set=' + div_2.attr('set') + ']').attr('set', div_1.attr('set'));
//Excavate the barrier between the two
$('#'+((curr[0][0] + curr[1][0])/2) + 'a' + (curr[0][1] + curr[1][1])/2).attr('type','visited');
div_1.attr('type','visited');
div_2.attr('type','visited');
}
else if(div_1.attr('set') != div_2.attr('set')){
//Combine the sets;
$('[set =' + div_2.attr('set') + ']').attr('set', div_1.attr('set'));
//Excavate the barrier between the two
$('#'+((curr[0][0] + curr[1][0])/2) + 'a' + (curr[0][1] + curr[1][1])/2).attr('type','visited');
}
await new Promise(resolve => setTimeout(resolve, 60/FPS));
}
$('[type=visited]').attr('type','tile');
$('[set]').removeAttr('set');
}
/** Maze Generation using the Hunt and Kill Method (enhanced DFS) */
async function GenerateMaze_HAK(){
await ClearBoard();
while(true){
let start = HAK_helper();
if(start[0] == -1){
$('[type=visited]').attr('type','tile');
return;
}
else if(start[1] == 1) start.push(1);
else start.push(2);
let stack = [start];
while(stack.length > 0){
let curr = stack[stack.length-1];
let options = [];
RenderEightWalls(curr[0],curr[1]);
Excavate(curr[2],curr[1],curr[0]);
$('#'+curr[0]+'a'+curr[1]).attr('type','visited');
stack.pop();
for(let i = 0; i < 4; i++){
let curr_div = $('#'+(curr[0]+dy[i])+'a'+(curr[1]+dx[i]));
if(validDivIndx(curr[0]+dy[i],curr[1]+dx[i]) && curr_div.attr('type') != "visited"){
options.push([curr[0]+dy[i],curr[1]+dx[i],i]);
}
}
if(!options.length) break;
else{
let indx = Math.floor(Math.random()*options.length);
stack.push(options[indx]);
}
await new Promise(resolve => setTimeout(resolve, 60/FPS));
}
}
}
/** Maze Generation using Eller's Algorithm */
async function GenerateMaze_Eller(){
await ClearBoard();
//Analyze by row
for(let i = 1; i < 2*height+1; i+=2){
//Rule: every node must connect to another node, unless it cannot
//Excavation: excavate the left wall if binding
//Edge case: when we are at the bottom row
let edge_case = i == 2 * height - 1;
for(let j = 1; j < 2 * width + 1; j+= 2){
let curr_node = $('#'+i+'a'+j);
let prev_node = $('#'+i+'a'+(j-2));
if(curr_node.attr('type') != 'visited'){
RenderEightWalls(i,j);
curr_node.attr('type', 'visited');
curr_node.attr('set',curr_node.attr('id'));
}
let clear = prev_node.attr('set') != curr_node.attr('set');
if(j != 1 && (Math.floor(Math.random()*3) && clear || edge_case)){
Excavate(2, j, i);
//Combine the sets
$('[set=' + curr_node.attr('set') + ']').attr('set',prev_node.attr('set'));
}
await new Promise(resolve => setTimeout(resolve, 60/FPS));
}
//If we meet the edge case, break out of the loop
if(edge_case) break;
//Excavation: for each set, excavate a single verticle wall and render the new vertical components
let curr_set = $('#'+i+'a'+1).attr('set');
let options = [];
for(let j = 1; j < 2 * width + 3; j+= 2){ //+3 is an edge case
let curr_node = $('#'+i+'a'+j);
if(curr_node.attr('set') == curr_set){
options.push([i,j]);
}
else{
let indx = Math.floor(Math.random()*options.length);
let curr = options[indx];
let lower_node = $('#'+(curr[0]+2)+'a'+curr[1]);
RenderEightWalls(curr[0]+2,curr[1]);
Excavate(3,curr[1],curr[0]);
lower_node.attr('type','visited');
lower_node.attr('set',curr_set);
curr_set = curr_node.attr('set');
options = [[i,j]];
}
await new Promise(resolve => setTimeout(resolve, 60/FPS));
}
}
$('[set]').removeAttr('set');
$('[type=visited]').attr('type','tile');
console.log($('[type=visited]').length);
}
//await new Promise(resolve => setTimeout(resolve, 50));
|
import React from 'react'
import ReactDOM from 'react-dom'
import { Provider } from 'react-redux'
import { createStore, applyMiddleware, compose } from 'redux'
import { Router, Route, IndexRoute, browserHistory } from 'react-router'
import reduxThunk from 'redux-thunk'
import App from './components/App'
import RequireAuth from './components/Auth/RequireAuth'
import Signup from './components/Auth/Signup'
import Signin from './components/Auth/Signin'
import Signout from './components/Auth/Signout'
import Welcome from './components/Welcome'
import Invoices from './components/Invoicing/List/Invoices'
import InvoiceShow from './components/Invoicing/Show/InvoiceShow'
import CreateInvoice from './components/Invoicing/CreateInvoice'
import EditInvoice from './components/Invoicing/EditInvoice'
import Customers from './components/Customers/Customers'
import CreateCustomer from './components/Customers/CreateCustomer'
import EditCustomer from './components/Customers/EditCustomer'
import SettingsPage from './components/Settings/SettingsPage'
import reducers from './reducers'
import { AUTH_USER } from './actions/types'
// App-wide styles
require('./styles/styles.scss')
// const createStoreWithMiddleware = applyMiddleware(reduxThunk)(createStore)
// const store = createStoreWithMiddleware(reducers)
let store = createStore(reducers, compose(
applyMiddleware(reduxThunk),
window.devToolsExtension ? window.devToolsExtension() : f => f
))
const token = window.localStorage.getItem('token')
// If a token exists, consider the user to be signed in.
if (token) {
store.dispatch({ type: AUTH_USER })
}
ReactDOM.render(
<Provider store={store}>
<Router history={browserHistory}>
<Route path='/' component={App}>
<IndexRoute component={Welcome} />
<Route path='signin' component={Signin} />
<Route path='signup' component={Signup} />
<Route path='signout' component={Signout} />
<Route path='invoices' component={RequireAuth(Invoices)} />
<Route path='/invoices/new' component={CreateInvoice} />
<Route path='/invoices/edit/:id' component={EditInvoice} />
<Route path='/customers' component={RequireAuth(Customers)} />
<Route path='/customers/new' component={RequireAuth(CreateCustomer)} />
<Route path='/customers/edit/:id' component={RequireAuth(EditCustomer)} />
<Route path='/settings' component={SettingsPage} />
</Route>
<Route path='/:id' component={InvoiceShow} />
</Router>
</Provider>
, document.querySelector('#root'))
|
import React, { Component } from 'react';
import Button from '@material-ui/core/Button';
import { getElectron } from '../utils/common';
export const ElectronFileSaveButton = (props) => {
// eslint-disable-next-line react/prop-types
const { label, onFileSelected } = props;
const electronSaveFile = () => {
const { remote } = getElectron();
const file = remote.dialog.showSaveDialogSync();
if (file) {
onFileSelected(file);
}
};
return (
<Button variant="contained" color="primary" onClick={electronSaveFile}>
{label}
</Button>
);
};
export default ElectronFileSaveButton;
|
//购物车页
//登录后状态页面渲染
html_login();
//页面跳转
html_location()
//购物车页面数据渲染——————————————————————————————————————————
//用户id
var user_id=getCookie("user_id");
//通过用户id查找数据
if(user_id){
$.ajax({
type:"get",
url:"../api/cart.php",
async:true,
data:{
"mate":"cartinit",//匹配参数
"user_id":user_id
},success:function(str){
var data = JSON.parse(str);
// console.log(data)
var arrs=[]
for(let i=0;i<data.length;i++){
//再通过商品id查找商品表
var goods_id=data[i].goods_id;
$.ajax({
type:"get",
url:"../api/cart.php",
async:true,
data:{
"mate":"goods_data",//匹配参数
"goods_id":goods_id
},success:function(strs){
var datas = JSON.parse(strs);
//追加数组
arrs.push(datas[0]);
if(i==data.length-1){
init(arrs);
}
}
});
}
function init(arrs){
for(var j=0;j<arrs.length;j++){
//获取数量
var goods_num=data[j].goods_num;
//获取尺码
var goods_size=data[j].goods_size;
//获取商品信息
var goods_data=arrs[j]
var html=`<tbody id="${data[j].goods_id}">
<tr class="shoptit">
<td colspan="7">
<input type="checkbox" name="" class="shopall" value="" />
<a>蘑菇街</a>
</td>
</tr>
<!--内容-->
<tr class="cart_item">
<td class="ckeck_wrap"><input type="checkbox" name="" id="" value="" /></td>
<td class="goods_wrap">
<a class="goods_img"><img src="../${goods_data.goods_img.split("&")[0]}"/></a>
<a class="goods_title">${goods_data.goods_name}</a>
</td>
<td class="goodsinfo_wrap">
<p>尺码:${goods_size}</p>
</td>
<td class="goodsprice_wrap">
<del>${goods_data.goods_cost_price}</del>
<p>${goods_data.goods_price}</p>
</td>
<td class="goodsnum_wrap">
<div class="goods_nums">
<input type="button" name="" class="goods_num_red" value="-" />
<input type="text" name="" class="goods_num" value="${goods_num}" />
<input type="button" name="" class="goods_num_add" value="+" />
</div>
</td>
<td class="goodssum_wrap">
<p>1.00</p>
</td>
<td class="goodsctrl_del">
<a>删除</a>
</td>
</tr>
</tbody>
`
$("#cart_main table").append(html)
}
//初始化小计
for(var i=0;i<$(".cart_item").length;i++){
var price=$(".cart_item .goodsprice_wrap>p").eq(i).text();//原价
var num=$(".cart_item .goods_nums .goods_num").eq(i).val();//数量
var total=(price*num).toFixed(2);//小计
$(".cart_item .goodssum_wrap>p").eq(i).text(total);
}
//初始化购物车商品数
cart_size();
}
}
});
}
else{
var res=confirm("您还未登录,是否要跳转到登录界面?");
if(res){
window.open("../html/login.html");
}
}
//购物车功能操作——————————————————————————————————————————
//加数量
$('.cart_wrap').on('click','.goods_num_add',function(){
//给每一个加号绑定事件(用事件委托的方式绑定)
var val=$(this).prev().val();//前一个兄弟元素
val++;//隐式转换
// console.log(val);
if(val>=10){
//库存量是10.限制最大值
val=10;
}
//设置内容
$(this).prev().val(val);
//小计
price($(this));//把点击当前节点当成实参传过去
var arr=checked();//判断哪行被选中,存到该数组中
allnum(arr);//传被选中的行的下标过去,那边做累计处理
//总价
allprice(arr);
//商品数
goods_num($(this));
});
//减数量
$('.cart_wrap').on('click','.goods_num_red',function(){
//给每一个加号绑定事件(用事件委托的方式绑定)
var val=$(this).next().val();
val--;//隐式转换
// console.log(val);
if(val<=1){
//库存量是100.限制最大值
val=1;
}
//设置内容
$(this).next().val(val);
//小计
price($(this));//把点击当前节点当成实参传过去
var arr=checked();//判断哪行被选中,存到该数组中
allnum(arr);//传被选中的行的下标过去,那边做累计处理
//总价
allprice(arr);
goods_num($(this))
});
//小计
function price(now){
var pri=now.parent().parent().prev().children().eq(1).text();//拿到对应行的单价
//获取数量
var all=now.parent().children().eq(1).val();
// console.log(all);
var aprice=pri*all;//小计
now.parent().parent().next().children().eq(0).text(aprice.toFixed(2));//toFixed(2)保留两个小数
}
//删除当行
$('.cart_wrap').on('click','.goodsctrl_del>a',function(){
var res=confirm('您确定要删除该商品吗?');
if(res){
var goods_id=$(this).parent().parent().parent().attr("id");
var user_id=getCookie("user_id");
$.ajax({
type:"get",
url:"../api/cart.php",
async:true,
data:{
"mate":"cart_delete",//匹配参数
"user_id":user_id,
"goods_id":goods_id
},success:function(str){
console.log(str)
}
});
$(this).parent().parent().parent().remove();//删除节点
cart_size();//更新购物车商品数量
}
updata();
var arr=checked();//判断哪行被选中,存到该数组中
allnum(arr);//传被选中的行的下标过去,那边做累计处理
//总价
allprice(arr);
});
//全选
var isCheacked=true;
function all_checked(){
//attr()加普通属性 title prop() 加有行为的属性
if(isCheacked){
//全选
$('.ckeck_wrap input').prop('checked','checked');
$('.shopall').prop('checked','checked');//店铺
$('#all_checks').prop('checked','checked');
}else{
//不选
$('.ckeck_wrap input').removeAttr('checked');
$('.shopall').removeAttr('checked');
$('#all_checks').removeAttr('checked');
}
isCheacked=!isCheacked;
//点击全选的时候,数量和总价跟着变
//总数量
var arr=checked();//判断哪行被选中,存到该数组中
allnum(arr);//传被选中的行的下标过去,那边做累计处理
//总价
allprice(arr);
}
//表头全选
$('.s_all').on('click',function(){
all_checked();
});
//表尾全选
$('#all_checks').on('click',function(){
all_checked();
});
//循环判断哪行被选中了
function checked(){
var arr=[];//设置一个空数组,等会被选中的就把下标存起来
var le=$('.ckeck_wrap input').size();
for(var i=0;i<le;i++){
if($('.ckeck_wrap input').eq(i).prop('checked')){
//不为空证明被选中了
arr.push(i);
}
}
return arr;
}
//删除多行
$('#delall').on('click',function(){
var arr=checked();//被选中的行
var res=confirm('您确定要删除多行吗?');
if(res){
//删除arr下标对应的行
for(var i=arr.length-1;i>=0;i--){
//从后面开始删除
$('.ckeck_wrap').eq(arr[0]).parent().parent().remove();
$('.goodsctrl_del').eq(arr[0]).parent().parent().remove();
}
cart_size();//更新购物车商品数量
}
updata();
var arr=checked();//判断哪行被选中,存到该数组中
allnum(arr);//传被选中的行的下标过去,那边做累计处理
//总价
allprice(arr);
});
//刷新判断购物车是否为空
function updata(){
if($('.ckeck_wrap').size()==0){
$('#all_checks').removeAttr('checked');
}
}
//总数量
function allnum(arr){
var num=0;//总数量
for(var i=0;i<arr.length;i++){
num+=parseInt($('.goods_num').eq(arr[i]).val());
}
$('.cart_paybar .nums').text(num);
if(num>0){
$("._info>a").css("background","#f13e3a");
}
else{
$("._info>a").css("background","#d8d8d8");
}
}
//总价
function allprice(arr){
var price=0;
for(var i=0;i<arr.length;i++){
var nowtotal=$('.goodssum_wrap p').eq(arr[i]).text();
// nowtotal=$.trim(nowtotal);
// console.log(nowtotal);
// nowtotal=nowtotal.substring(2);//数据提取完成 255
// console.log(nowtotal);
price+=nowtotal*1;
}
$('.cart_paybar .total').text(price.toFixed(2));
}
//单行选中
$('#cart_main .container').on('click','input',function(){
var arr=checked();
if(arr.length==$('.ckeck_wrap').size()){
//都被选中了
$('#all_checks').prop('checked','checked');
$('.s_all').prop('checked','checked');
//三个都被选中了,下次点击全选按钮是为了全不选
isCheacked=false;
}
else{
$('#all_checks').removeAttr('checked');
$('.s_all').removeAttr('checked');
//证明没有选中全部
isCheacked=true;
}
var arr=checked();//判断哪行被选中,存到该数组中
allnum(arr);//传被选中的行的下标过去,那边做累计处理
$('.shopall').eq(arr[0]).prop('checked','checked');//店铺
//总价
allprice(arr);
});
//手动输入改变总价
$('.goods_num').on('blur',function(){
price($(this));
var arr=checked();//判断哪行被选中,存到该数组中
allnum(arr);//传被选中的行的下标过去,那边做累计处理
//总价
allprice(arr);
});
////店铺选择
//$(".shopall").on("click",function(){
//
// $(this).parent().parent().next().children().eq(0).children().prop('checked','checked');
// var arr=checked();//判断哪行被选中,存到该数组中
// allnum(arr);//传被选中的行的下标过去,那边做累计处理
//
// //总价
// allprice(arr);
//})
//初始化购物车商品数量
function cart_size(){
var sizes=$(".cart_item").size();
$(".allgoods>span").text(sizes)
}
cart_size();
//购买按钮
$("#cart_btn").click(function(){
// console.log(checked())
cart_size();//更新购物车商品数量
})
//修改单个商品数量
function goods_num(o){
var goods_num=o.parent().children().eq(1).val();//数量
var goods_id=o.parent().parent().parent().parent().attr("id");
var user_id=getCookie("user_id");
// console.log(user_id)
$.ajax({
type:"get",
url:"../api/cart.php",
async:true,
data:{
"mate":"update_goods_num",//匹配参数
"goods_num":goods_num,
"goods_id":goods_id,
"user_id":user_id
},success:function(str){
// console.log(str)
}
});
}
|
function sumDouble(a, b){
if (a === b) {
return (a + b) * 2;
} else if (a !== b) {
return a + b;
}
|
function environmentQA() {
var ambiente = {
url : 'https://devpetstore.swagger.io'
};
// Feature API Ejemplo
ambiente.flujoX = {
user : {
numero_celular : '+54911773622662',
dni : '714666242',
password : '116699'
},
cards : {
visa_debit_card_token : '4123660000000016',
visa_credit_card : '4540760039904452',
visa_debit_card : '4517656612965467',
master_credit_card : '5505688277915366',
master_debit_card : '5142850888531006',
amex_credit_card : '371593210999043',
cabal_credit_card : '6042011000007025'
}
}
return ambiente;
}
|
const {URL} = require('url');
const {config} = require('@ucd-lib/fin-node-utils');
const FIN_URL = new URL(config.server.url);
module.exports = () => {
return `host=${FIN_URL.host}; proto=${FIN_URL.protocol.replace(/:$/,'')}`;
}
|
function binarySearch(arr, key) {
let low = 0;
let high = arr.length - 1;
let mid, element;
while (low <= high) {
mid = Math.floor((low + high) / 2);
element = arr[mid];
if (element < key) {
low = mid + 1;
} else if (element > key) {
high = mid - 1;
} else {
return mid;
}
}
return -1;
}
let ar = [1, 2, 3, 4, 5, 6, 7, 8, 9];
console.log(binarySearch(ar, 4));
console.log('asdf');
|
// Input stuff
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin
});
let lines = [];
rl.on('line', l => {
lines.push(+l);
});
rl.on("close", () => { main(); process.exit(0) });
// Constent
const faultyChecksum = 21806024;
function main() {
for (let i = 0; i < lines.length; i++) {
const res = look_checksum(i);
if (isNaN(res) && Array.isArray(res)) {
const arr = res.sort((a, b)=> a - b);
console.log(arr);
let checksum = 0;
arr.map(item => checksum+=item);
const first = arr.shift();
const last = arr.pop();
if (faultyChecksum === checksum) console.log(last + first);
}
}
}
function look_checksum(i) {
const code = lines[i];
const list = [code];
let sum = code;
let j = i;
while (true) {
j++;
sum += lines[j];
list.push(lines[j]);
if (sum === faultyChecksum) return list;
if (sum > faultyChecksum || j >= lines.length) return sum;
}
}
|
define(["jquery",
"zone/base",
"app/animation-util"],
function (
$,
BaseZone,
animationMethods) {
"use strict";
var MoveInZone = function ($element) {
BaseZone.apply(this, arguments);
this.$text = $element.find("p");
};
MoveInZone.inheritsFrom(BaseZone);
MoveInZone.prototype.moveIn = function () {
this.$text.each(animationMethods.slideInFromTheSide());
this.parent.moveIn.call(this);
};
MoveInZone.prototype.moveOut = function () {
this.$text.each(animationMethods.slideBackToTheSide());
};
return MoveInZone;
});
|
const express = require('express');
const router = express.Router();
const controller = require("../controllers/auth")
router.use('/:lng?/logout', (req, res, next) => {
if(!req.user){
res.redirect(process.env.PUBLIC_URL)
return
}
req.logOut()
if (req.query.data) {
req.session.user = null;
res.send({ success: true })
}else{
req.session.user = null;
req.session.logout = true
res.redirect( process.env.PUBLIC_URL)
}
})
router.get('/:lng?/login',controller.login);
router.get('/:lng?/signup',controller.signup);
router.get('/:lng?/signup/invite/:code',controller.invitesignup);
router.get('/:lng?/forgot',controller.forgotPassword);
router.get('/:lng?/reset/:code',controller.verifyCode);
router.get('/:lng?/verify-account/:code?',controller.verifyAccount)
module.exports = router;
|
// JavaScript
console.log('this is loaded');
exports.twitterKeys = {
consumer_key: 'M6cd7fpK2miScr4b3ebtXiqEk',
consumer_secret: 'Kqt2yxq5JDo6vcTE0xZoMql9rnwczoKWg6y0z6W5Le5CItPIRU',
access_token_key: '898016280917139457-Wu0mBm4V83pQ9hYJS5LjYTLOmIyrJCu',
access_token_secret: 'nF0WX8XnclqqKvkNE0ENOyutHhuvm9Rc8EhRVWdd2JiF8',
}
|
import React from 'react';
import ReactDOM from 'react-dom';
import Root from './components/root';
import * as d3 from "d3";
import configureStore from './store/store.js';
import { summonerSoloQueue, summonerQueues } from './reducers/selectors';
document.addEventListener("DOMContentLoaded", () => {
const store = configureStore();
window.store = store;
window.summonerQueues = summonerQueues;
window.summonerSoloQueue = summonerSoloQueue;
ReactDOM.render(<Root store={store}/>, document.getElementById('root'));
});
|
Ext.define('InvoiceApp.store.SupplierBuyerStore',{
extend:'Ext.data.Store',
config:{
autoLoad:true,
model:'InvoiceApp.model.SupplierBuyer'
}
});
|
/*
* Copyright (C) 2021 Radix IoT LLC. All rights reserved.
*/
maThemingProvider.$inject = ['$injector'];
function maThemingProvider($injector) {
this.$get = maThemingFactory;
maThemingFactory.$inject = [];
function maThemingFactory() {
// no hard dep, may want to move away from $mdTheming
const $mdThemingProvider = $injector.has('$mdThemingProvider') && $injector.get('$mdThemingProvider');
const THEMES = $mdThemingProvider ? $mdThemingProvider._THEMES : {};
const PALETTES = $mdThemingProvider ? $mdThemingProvider._PALETTES : {};
const paletteNames = ['primary', 'accent', 'warn', 'background'];
const hueNames = ['default', 'hue-1', 'hue-2', 'hue-3', '50', '100', '200', '300', '400', '500', '600', '700', '800', '900', 'A100', 'A200', 'A400', 'A700'];
const foregroundHues = ['1', '2', '3', '4'];
const allHues = paletteNames.map(palette => {
return hueNames.map(hue => {
return {
palette,
hue,
colorString: hue === 'default' ? palette : `${palette}-${hue}`
};
});
}).reduce((acc, h) => {
return acc.concat(h);
});
class ThemeService {
getThemeColor(options) {
let {theme, palette, hue} = options;
const scheme = THEMES[theme].colors[palette];
if (scheme.hues[hue]) {
hue = scheme.hues[hue];
}
const paletteObj = PALETTES[scheme.name];
return paletteObj[hue];
}
getThemeColors(options) {
const color = this.getThemeColor(options);
return {
color: color.hex.toUpperCase(),
contrast: `rgba(${color.contrast.join(',')})`
};
}
getCssVariables(theme) {
const properties = [];
allHues.map(x => {
const color = this.getThemeColor(Object.assign({theme}, x));
return Object.assign({}, color, x);
}).forEach(color => {
const value = color.value.join(',');
const contrast = color.contrast.join(',');
properties.push({name: `--ma-${color.colorString}`, value: `rgb(${value})`});
properties.push({name: `--ma-${color.colorString}-contrast`, value: `rgba(${contrast})`});
properties.push({name: `--ma-${color.colorString}-value`, value: value});
});
foregroundHues.forEach(hue => {
properties.push({name: `--ma-foreground-${hue}`, value: THEMES[theme].foregroundPalette[hue]});
});
properties.push({name: '--ma-foreground-value', value: THEMES[theme].isDark ? '255,255,255' : '0,0,0'});
return properties;
}
themeElement(element, theme) {
if (theme) {
const properties = this.getCssVariables(theme);
properties.forEach(property => {
element.style.setProperty(property.name, property.value);
});
} else {
// remove theme
element.style.removeProperty('--ma-font-default');
element.style.removeProperty('--ma-font-paragraph');
element.style.removeProperty('--ma-font-heading');
element.style.removeProperty('--ma-font-code');
allHues.forEach(x => {
element.style.removeProperty(`--ma-${x.colorString}`);
element.style.removeProperty(`--ma-${x.colorString}-contrast`);
element.style.removeProperty(`--ma-${x.colorString}-value`);
});
foregroundHues.forEach(hue => {
element.style.removeProperty(`--ma-foreground-${hue}`);
});
element.style.removeProperty(`--ma-foreground-value`);
}
this.setThemeClasses(element, theme);
}
setThemeClasses(element, theme) {
element.classList.remove('ma-theme-dark');
element.classList.remove('ma-theme-light');
if (theme) {
const themeObj = THEMES[theme];
element.classList.add(themeObj.isDark ? 'ma-theme-dark' : 'ma-theme-light');
}
}
getPaletteNames() {
return paletteNames;
}
getHueNames() {
return hueNames;
}
getThemes() {
return THEMES;
}
getPalettes() {
return PALETTES;
}
defaultTheme() {
return {
primaryPalette: 'indigo',
primaryPaletteHues: {'default': '500', 'hue-1': '300', 'hue-2': '800', 'hue-3': 'A100'},
accentPalette: 'pink',
accentPaletteHues: {'default': 'A200', 'hue-1': 'A100', 'hue-2': 'A400', 'hue-3': 'A700'},
warnPalette: 'deep-orange',
warnPaletteHues: {'default': '500', 'hue-1': '300', 'hue-2': '800', 'hue-3': 'A100'},
backgroundPalette: 'grey',
backgroundPaletteHues: {'default': '50', 'hue-1': 'A100', 'hue-2': '100', 'hue-3': '300'},
dark: false
};
}
}
return new ThemeService();
}
}
export default maThemingProvider;
|
import React from 'react';
import Modal from 'react-responsive-modal'
import axios from 'axios'
import { translate } from 'react-i18next'
import Button from '../../common/buttons/button'
import Consts from '../../../utils/consts'
const INITIAL_STATE = {
//error starts as 'true' because all fields start empty, which disables task creation
error: true,
users: []
}
class TaskModal extends React.Component {
constructor(props) {
super(props)
this.state = INITIAL_STATE
}
sendCancel = () => {
this.setState(INITIAL_STATE)
this.props.onClose()
}
checkError = () => {
this.setState({
error: !this.refs.name.value || !this.refs.description.value || !this.refs.team.value
})
}
sendData = () => {
const modalData = {
title: this.refs.name.value,
problem: this.refs.description.value,
assignedToId: this.refs.user && this.refs.user.value ? this.refs.user.value : this.refs.team.value,
assignedToType: this.refs.user && this.refs.user.value ? "Profile" : "Team",
severityId: this.props.alarm.severityId ? this.props.alarm.severityId : this.refs.severity.value
}
this.props.callback(modalData)
}
renderSeverityOptions = () => {
const data = this.props.severities.sort((a, b) => a.value < b.value) || []
if (data !== []) {
return data.map(reg => (
<option key={reg.id} value={reg.id}>
{reg.type}
</option>
)
)
} else {
return []
}
}
renderTeamOptions = () => {
const data = this.props.teams || []
if (data !== []) {
return data.map(reg => (
<option key={reg.id} value={reg.id}>
{reg.name}
</option>
)
)
} else {
return []
}
}
getTeamUsers = (e) => {
if (this.props.userRole === 'manager' && this.refs.team && this.refs.team.value !== this.props.userProfile.teamId)
return
const teamId = e.target.value
axios.get(Consts.API_URL + "/Teams/" + teamId + "/member?access_token=" + JSON.parse(localStorage.getItem('_user')).id)
.then(resp => {
const _users = resp.data
this.setState({
users: _users
}, () => this.forceUpdate())
})
}
renderTeamUsers = () => {
const data = this.state.users || []
if (data !== []) {
return data.map(reg => (
<option key={reg.id} value={reg.id}>
{`${reg.name} (username: ${reg.username})`}
</option>
)
)
} else {
return []
}
}
render() {
const { t } = this.props;
var managerDiffTeam = this.props.userRole === 'manager' && this.refs.team && this.refs.team.value !== this.props.userProfile.teamId
const alarmSeverity = this.props.severities.filter(sev => this.props.alarm.severityId === sev.id)[0]
var disableUsers = this.state.users.length === 0 || managerDiffTeam
return (
<Modal open={this.props.open} onClose={this.props.onClose} showCloseIcon={false} little>
<div className="modal-form">
<div className="modal-dialog" style={{ margin: 'auto' }}>
<div className="modal-body">
<div>
<div className="row-sm-3">
<h3 className="m-t-none m-b">{"Create New Task"}</h3>
<p>{t("labels.createNewTaskAlarm") + this.props.alarm.name + "'"}</p>
</div>
<hr />
<div className="row-sm-9">
<form role="form" style={{ overflow: 'auto' }} onChange={this.checkError}>
<div className="form-group">
<label>{t("labels.taskName")}</label>
<input ref="name" placeholder={t("labels.taskName")} className="form-control" required />
</div>
<div className="form-group">
<label>{t("labels.problemDescription")}</label>
<textarea ref="description" placeholder={t("labels.problemDescription")} className="form-control" style={{ resize: 'vertical' }} />
</div>
<div className="hr-line-dashed" />
<div className="form-group">
<div className="col-sm-4">
<label>{t("labels.team")}</label>
<select ref="team" className="form-control m-b" onChange={(e) => this.props.userRole === 'operator' ? null : this.getTeamUsers(e)}>
<option disabled selected value={null} />
{this.renderTeamOptions()}
</select>
</div>
{this.props.userRole === 'operator' ?
<div className="col-sm-4" /> :
<div className="col-sm-4" >
<label>{t("labels.user")}</label>
<select ref="user" className="form-control m-b" disabled={disableUsers}>
<option />
{this.renderTeamUsers()}
</select>
</div>
}
<div className="col-sm-4">
<label>{t("labels.severity")}</label>
{!this.props.alarm.severityId ?
<select ref="severity" className="form-control m-b">
{this.renderSeverityOptions()}
</select>
:
<p className="form-control-static">{alarmSeverity ? alarmSeverity.type : "Undefined"}</p>
}
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<div style={{ float: 'right' }}>
<Button onClick={() => this.sendCancel()} color="default" label={t("buttons.cancel")} />
<Button onClick={() => this.state.error ? null : this.sendData()} color="primary" label={t("buttons.create")} extra={this.state.error ? "disabled" : ""} />
</div>
</div>
</Modal>
)
}
}
export default translate('tasks')(TaskModal)
|
describe('HomeServiceTest', function(){
var homeServiceMock = {}, homeController = {}, $controller, $rootScope, $scope;
beforeEach(angular.mock.module('myApp'));
beforeEach(inject(function(_$controller_, _$rootScope_, _homeService_) {
$rootScope = _$rootScope_;
$scope = $rootScope.$new();
homeService = homeServiceMock;
$controller = _$controller_;
jasmine.getJSONFixtures().fixturesPath='base/tests/responses';
homeController = $controller('homeController', { $scope: $scope, homeService: homeServiceMock });
}));
homeServiceMock = {
getCategories: function (key, callback){
var response = getJSONFixture('getCategories.json');
callback(response);
},
search: function (key, movie, callback) {
var response = getJSONFixture('search.json');
callback(response);
},
getPopular: function (key, callback){
var response = getJSONFixture('getPopular.json');
callback(response);
},
getKey: function (callback){
callback();
}
}
it('homeController should exist', function() {
expect(homeController).toBeDefined();
});
it('homeController.moreItems should exist', function() {
homeController.moreItems('popular');
homeController.model.config.showPopular = 4;
homeController.moreItems('search');
});
it('homeController.search should map results', function() {
homeController.model.movieSearched = 'notebook';
homeController.search();
var response = getJSONFixture('search.json');
for(var i = 0; i < response.results.length; i++){
if(response.results[i].poster_path){
response.results[i].image = 'https://image.tmdb.org/t/p/w185' + response.results[i].poster_path;
}
}
expect(homeController.model.search).toEqual(response.results);
});
it('initModel should map results', function() {
homeController.initModel();
var categoriesResp = getJSONFixture('getCategories.json');
var categories = {};
categoriesResp.genres.forEach(function(genre){
categories[genre.id] = genre.name;
});
var popular = getJSONFixture('getPopular.json');
for(var i = 0; i < popular.results.length; i++){
if(popular.results[i].poster_path){
popular.results[i].image = 'https://image.tmdb.org/t/p/w185' + popular.results[i].poster_path;
}
}
expect(homeController.model.popular).toEqual(popular.results);
expect(homeController.model.config.categories).toEqual(categories);
});
});
|
import React, { Component } from 'react';
import { StyleSheet, css } from 'aphrodite';
import Button from '@material-ui/core/Button';
import LeftIcon from '@material-ui/icons/ArrowBack';
import RightIcon from '@material-ui/icons/ArrowForward';
import DownIcon from '@material-ui/icons/ArrowDownward';
import BlockColumn from './Column'
import { noOfColumn, numberOfRow, moveTime, windowWidth, checkWordTime } from '../config/config'
import { checkWord, sortWordQueue } from '../config/wordCheck';
import { saveHighScore, getHighScore, scoreForThisWord } from '../config/SaveScore';
import { lettersAdjustedPerWeight } from '../config/GenerateLetter';
import GameOver from './GameOver';
import About from './About';
const styles = StyleSheet.create({
container: {
display: 'flex',
flexDirection: 'column',
justifyContent: 'flex-start',
},
scoreLine: {
display: 'flex',
flexDirection: 'row',
justifyContent: 'space-around',
alignItems: 'center',
backgroundColor: '#3367D6',
color: '#fff',
fontFamily: "'Roboto', sans-serif",
fontSize: "1.0rem",
fontWeight: 600,
"@media (max-width: 700px)": {
width: windowWidth()
},
"@media (min-width: 700px)": {
height: 50
},
},
gameContainer: {
display: 'flex',
flexDirection: 'row',
justifyContent: 'center'
},
score: {
margin: 5,
paddin: 5
},
controlContainer: {
display: 'flex',
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
// flexWrap: 'wrap',
padding: 0
},
buttons: {
// border: '1px solid blue',
width: 80,
height: 40,
margin: 5
},
destroyColor: {
backgroundColor: "green"
}
});
const GAMESTATE = {
INITIAL: 'initial',
IN_PROGRESS: "inProgress",
PAUSED: 'paused',
ENDED: 'ended',
}
const allletters = lettersAdjustedPerWeight();
class Game extends Component {
nextLetter = undefined;
letters = [];
wordQueue = [];
gameState = GAMESTATE.INITIAL;
checkWordAutomatic;
state = {
updateFlag: false,
score: 0
}
componentDidMount() {
window.addEventListener("keydown", this._onKeyPress);
}
_onKeyPress = (evt) => {
if (evt.key === "a" || evt.keyCode === 37) {
evt.preventDefault();
//move left
this._moveLeft()
} else if (evt.key === "d" || evt.keyCode === 39) {
evt.preventDefault();
//move right
this._moveRight()
} else if (evt.key === "s" || evt.keyCode === 40) {
evt.preventDefault();
//move right
this._moveDown()
}
}
_moveLeft = () => {
let updatedSomething = false
for (let i = 0; i < this.letters.length; i++) {
if (this.letters[i].moving) {
if (this.letters[i].pos.x > 0 && !this._alreadyHasLetterInPos({ x: this.letters[i].pos.x - 1, y: this.letters[i].pos.y })) {
this.letters[i].pos.x = this.letters[i].pos.x - 1;
}
updatedSomething = true;
}
}
if (updatedSomething) {
this.setState({ updateFlag: !this.state.updateFlag })
}
}
_moveRight = () => {
let updatedSomething = false
for (let i = 0; i < this.letters.length; i++) {
if (this.letters[i].moving) {
if (this.letters[i].pos.x < noOfColumn - 1 && !this._alreadyHasLetterInPos({ x: this.letters[i].pos.x + 1, y: this.letters[i].pos.y })) {
this.letters[i].pos.x = this.letters[i].pos.x + 1;
}
updatedSomething = true;
}
}
if (updatedSomething) {
this.setState({ updateFlag: !this.state.updateFlag })
}
}
_moveDown = () => {
let updatedSomething = false
for (let i = 0; i < this.letters.length; i++) {
if (this.letters[i].moving) {
const alreadyHas = this._alreadyHasLetterInPos({ x: this.letters[i].pos.x, y: this.letters[i].pos.y + 1 });
if (this.letters[i].pos.y < numberOfRow - 1 && !alreadyHas) {
this.letters[i].pos.y = this.letters[i].pos.y + 1;
}
if (this.letters[i].pos.y == numberOfRow - 1 || alreadyHas) {
this.letters[i].moving = false;
}
updatedSomething = true;
}
}
if (updatedSomething) {
this.setState({ updateFlag: !this.state.updateFlag })
}
}
_startGame = () => {
if (this.gameState != GAMESTATE.PAUSED)
this.setState({ score: 0 })
this.gameState = GAMESTATE.IN_PROGRESS;
if (this.letters.length == 0) {
this.generateLetter();
}
setTimeout(this.startMoving, moveTime);
}
_pauseGame = () => {
this.gameState = GAMESTATE.PAUSED;
clearInterval(this.gameInterval)
saveHighScore(this.state.score) //just save
this.setState({ updateFlag: !this.state.updateFlag })
}
startMoving = () => {
clearInterval(this.gameInterval)
this.gameInterval = setInterval(this.moveLetters, moveTime);
}
_alreadyHasLetterInPos = (pos) => {
for (let i = 0; i < this.letters.length; i++) {
if (this.letters[i].pos.x == pos.x && this.letters[i].pos.y == pos.y) {
return true;
}
}
return false;
}
moveLetters = () => {
let updatedSomething = false
for (let i = 0; i < this.letters.length; i++) {
if (this.letters[i].pos.y < numberOfRow - 1 && this.letters[i].moving) {
const alreadyHas = this._alreadyHasLetterInPos({ x: this.letters[i].pos.x, y: this.letters[i].pos.y + 1 })
if (!alreadyHas)
this.letters[i].pos.y = this.letters[i].pos.y + 1;
if (this.letters[i].pos.y == numberOfRow - 1 || alreadyHas) {
this.letters[i].moving = false;
}
if (this.letters[i].pos.y == 0) {
// so basically one column is full Game over
saveHighScore(this.state.score)
this.letters = [];
clearInterval(this.gameInterval)
this.gameState = GAMESTATE.ENDED;
this.setState({ updateFlag: !this.state.updateFlag })
}
updatedSomething = true;
}
}
if (updatedSomething) {
//console.log(this.state.letters, " vs ", updated)
this.setState({ updateFlag: !this.state.updateFlag })
} else {
// this._checkPossibleWords();
this.generateLetter();
}
}
_getNewLetter = () => {
let _newLetter;
if (this.nextLetter) {
_newLetter = this.nextLetter;
this.nextLetter = allletters[Math.floor(Math.random() * allletters.length)];
} else {
_newLetter = allletters[Math.floor(Math.random() * allletters.length)];
this.nextLetter = allletters[Math.floor(Math.random() * allletters.length)];
}
return _newLetter;
}
generateLetter = () => {
const letter = this._getNewLetter();
const columnno = Math.floor(Math.random() * noOfColumn);
const newLetter = {
letter: letter,
moving: true,
isWord: false,
pos: {
x: columnno,
y: 0
}
}
this.letters = [...this.letters, newLetter]
this.setState({ updateFlag: !this.state.updateFlag })
}
_getLetterAtPos = (pos) => {
for (let i = 0; i < this.letters.length; i++) {
if (this.letters[i].pos.x == pos.x && this.letters[i].pos.y == pos.y) {
return this.letters[i]
}
}
return undefined;
}
_checkPossibleWords = () => {
//not implemented poperly so not using
this.letters.forEach((_letter, index) => {
let possibleWord = _letter.letter;
let letterEnvolved = [_letter]
//check on y
for (let i = _letter.pos.y - 1; i > 0; i--) {
let posToCheck = { x: _letter.pos.x, y: i }
let letterAtThisPos = this._getLetterAtPos(posToCheck)
if (letterAtThisPos) {
possibleWord = possibleWord + letterAtThisPos.letter
letterEnvolved.push(letterAtThisPos)
} else {
i = 0;
}
}
if (checkWord(possibleWord.toLowerCase())) letterEnvolved.forEach(_letter => _letter.isWord = true)
// check on x
})
}
_getLetterForThisColumn = (column) => {
const _letterInColumn = []
for (let i = 0; i < this.letters.length; i++) {
if (this.letters[i].pos.x === column)
_letterInColumn.push(this.letters[i])
}
return _letterInColumn
}
_getColumn = () => {
let columns = []
for (let i = 0; i < noOfColumn; i++) {
const letter = this._getLetterForThisColumn(i)
columns.push(<BlockColumn key={`column${i}`} columnId={i} letters={letter} onLetterClick={this._onLetterClick} />)
}
return columns;
}
_onLetterClick = (letter) => {
this.letters.find(_l => {
if (_l && _l.pos.x == letter.pos.x && _l.pos.y == letter.pos.y) {
_l.isWord = !_l.isWord;
if (_l.isWord)
this.wordQueue.push(letter);
else {
//remove from wordQueue
this.wordQueue.splice(this.wordQueue.findIndex(_l => _l && _l.pos.x == letter.pos.x && _l.pos.y == letter.pos.y), 1);
}
}
})
this.setState({ updateFlag: !this.state.updateFlag })
//check word automatically
clearTimeout(this.checkWordAutomatic)
this.checkWordAutomatic = setTimeout(this._checkWordAndDestroy, checkWordTime)
}
_checkWordAndDestroy = () => {
if (this.wordQueue.length > 0) {
this.wordQueue = sortWordQueue(this.wordQueue);
//check its proper selected // in sequence
// row check
let wordIsInRow = true;
let wordIsInColumn = true;
if (this.wordQueue.length > 1) {
for (let i = 0; i < this.wordQueue.length - 1; i++) {
if (Math.abs(this.wordQueue[i].pos.x - this.wordQueue[i + 1].pos.x) != 1) {
wordIsInRow = false;
}
}
}
if (!wordIsInRow) {
// if not in row then only we will check for column
for (let i = 0; i < this.wordQueue.length - 1; i++) {
if (Math.abs(this.wordQueue[i].pos.y - this.wordQueue[i + 1].pos.y) != 1) {
wordIsInColumn = false;
}
}
}
if (wordIsInRow || wordIsInColumn) {
let word = "";
this.wordQueue.forEach(_w => word = word + _w.letter);
if (checkWord(word.toLowerCase())) {
this._foundValidWord(word, wordIsInRow, wordIsInColumn);
} else if (checkWord(word.toLowerCase().split("").reverse().join(""))) {
// check reverse word as well
this._foundValidWord(word, wordIsInRow, wordIsInColumn);
}
}
this.wordQueue = [];
this.letters.forEach(_l => _l.isWord = false);
this.setState({ updateFlag: !this.state.updateFlag })
}
}
_foundValidWord = (word, wordIsInRow, wordIsInColumn) => {
// valid word
this.letters = this.letters.filter(_letter => {
const _letterInWordQueue = this.wordQueue.find(_wl => (_wl.pos.x == _letter.pos.x && _wl.pos.y == _letter.pos.y))
if (_letterInWordQueue) return false;
return true
})
const newScore = this.state.score + scoreForThisWord(word.length);
//fill empty space left by destroyed letters
if (wordIsInRow) {
this.wordQueue.forEach(_wq => {
this.letters.forEach(_l => {
if (_l.pos.x == _wq.pos.x && _l.pos.y < _wq.pos.y) {
_l.pos.y = _l.pos.y + 1;
}
})
})
} else if (wordIsInColumn) {
this.letters.forEach(_l => {
if (_l.pos.x == this.wordQueue[0].pos.x && _l.pos.y < this.wordQueue[0].pos.y) {
_l.pos.y = _l.pos.y + this.wordQueue.length
}
})
}
this.setState({ updateFlag: !this.state.updateFlag, score: newScore })
}
render() {
return (
<div className={css(styles.container)} >
<div className={css(styles.scoreLine)}>
<div className={css(styles.score)}> {`Best : ${getHighScore()}`} </div>
<div className={css(styles.score)}> {`Score : ${this.state.score}`} </div>
{this.nextLetter && <div className={css(styles.score)}> {`Next : ${this.nextLetter.toUpperCase()}`} </div>}
</div>
{this.gameState != GAMESTATE.ENDED &&
<div className={css(styles.gameContainer)}>
{this._getColumn()}
</div>
}
{this.gameState === GAMESTATE.ENDED &&
<GameOver score={this.state.score} />
}
<div className={css(styles.controlContainer)}>
{this.gameState != GAMESTATE.IN_PROGRESS &&
<Button variant="contained" size="small" color="secondary" className={css(styles.buttons)} onClick={this._startGame}> {this.letters.length > 0 ? "Resume" : "Start"}</Button>}
{this.gameState != GAMESTATE.PAUSED && this.gameState === GAMESTATE.IN_PROGRESS &&
<Button variant="contained" size="small" color="secondary" className={css(styles.buttons)} onClick={this._pauseGame}> Pause</Button>}
{this.wordQueue.length > 0 &&
<Button variant="contained" size="small" color="primary" className={css([styles.buttons, styles.destroyColor])} onClick={this._checkWordAndDestroy}> Destroy</Button>}
{this.gameState != GAMESTATE.PAUSED && this.gameState === GAMESTATE.IN_PROGRESS &&
<Button variant="contained" size="small" color="primary" className={css(styles.buttons)} onClick={this._moveLeft}><LeftIcon /></Button>}
{this.gameState != GAMESTATE.PAUSED && this.gameState === GAMESTATE.IN_PROGRESS &&
<Button variant="contained" size="small" color="primary" className={css(styles.buttons)} onClick={this._moveDown}><DownIcon /></Button>}
{this.gameState != GAMESTATE.PAUSED && this.gameState === GAMESTATE.IN_PROGRESS &&
<Button variant="contained" size="small" color="primary" className={css(styles.buttons)} onClick={this._moveRight}><RightIcon /></Button>}
</div>
<About score={this.state.score} />
</div>
);
}
}
export default Game
|
{
"cities": [
{
"name": "深圳市",
"id": "440300",
"cityPinyin": "shenchoushi",
"provinceId": "440000",
"hotCity": true,
"cityShortPY": "SZS"
},
{
"name": "北京市",
"id": "110100",
"cityPinyin": "beijingshi",
"provinceId": "110000",
"hotCity": true,
"cityShortPY": "BJS"
},
{
"name": "天津市",
"id": "120100",
"cityPinyin": "tianjinshi",
"provinceId": "120000",
"hotCity": true,
"cityShortPY": "TJS"
},
{
"name": "石家庄市",
"id": "130100",
"cityPinyin": "shijiazhuangshi",
"provinceId": "130000",
"hotCity": false,
"cityShortPY": "SJZS"
},
{
"name": "唐山市",
"id": "130200",
"cityPinyin": "tangshanshi",
"provinceId": "130000",
"hotCity": false,
"cityShortPY": "TSS"
},
{
"name": "秦皇岛市",
"id": "130300",
"cityPinyin": "qinhuangdaoshi",
"provinceId": "130000",
"hotCity": false,
"cityShortPY": "QHDS"
},
{
"name": "邯郸市",
"id": "130400",
"cityPinyin": "handanshi",
"provinceId": "130000",
"hotCity": false,
"cityShortPY": "HDS"
},
{
"name": "邢台市",
"id": "130500",
"cityPinyin": "xingtaishi",
"provinceId": "130000",
"hotCity": false,
"cityShortPY": "XTS"
},
{
"name": "保定市",
"id": "130600",
"cityPinyin": "baodingshi",
"provinceId": "130000",
"hotCity": false,
"cityShortPY": "BDS"
},
{
"name": "张家口市",
"id": "130700",
"cityPinyin": "zhangjiakoushi",
"provinceId": "130000",
"hotCity": false,
"cityShortPY": "ZJKS"
},
{
"name": "承德市",
"id": "130800",
"cityPinyin": "chengdeshi",
"provinceId": "130000",
"hotCity": false,
"cityShortPY": "CDS"
},
{
"name": "沧州市",
"id": "130900",
"cityPinyin": "cangzhoushi",
"provinceId": "130000",
"hotCity": false,
"cityShortPY": "CZS"
},
{
"name": "廊坊市",
"id": "131000",
"cityPinyin": "langfangshi",
"provinceId": "130000",
"hotCity": false,
"cityShortPY": "LFS"
},
{
"name": "衡水市",
"id": "131100",
"cityPinyin": "hengshuishi",
"provinceId": "130000",
"hotCity": false,
"cityShortPY": "HSS"
},
{
"name": "太原市",
"id": "140100",
"cityPinyin": "taiyuanshi",
"provinceId": "140000",
"hotCity": false,
"cityShortPY": "TYS"
},
{
"name": "大同市",
"id": "140200",
"cityPinyin": "datongshi",
"provinceId": "140000",
"hotCity": false,
"cityShortPY": "DTS"
},
{
"name": "阳泉市",
"id": "140300",
"cityPinyin": "yangquanshi",
"provinceId": "140000",
"hotCity": false,
"cityShortPY": "YQS"
},
{
"name": "长治市",
"id": "140400",
"cityPinyin": "changzhishi",
"provinceId": "140000",
"hotCity": false,
"cityShortPY": "ZZS"
},
{
"name": "晋城市",
"id": "140500",
"cityPinyin": "jinchengshi",
"provinceId": "140000",
"hotCity": false,
"cityShortPY": "JCS"
},
{
"name": "朔州市",
"id": "140600",
"cityPinyin": "shuozhoushi",
"provinceId": "140000",
"hotCity": false,
"cityShortPY": "SZS"
},
{
"name": "晋中市",
"id": "140700",
"cityPinyin": "jinzhongshi",
"provinceId": "140000",
"hotCity": false,
"cityShortPY": "JZS"
},
{
"name": "运城市",
"id": "140800",
"cityPinyin": "yunchengshi",
"provinceId": "140000",
"hotCity": false,
"cityShortPY": "YCS"
},
{
"name": "忻州市",
"id": "140900",
"cityPinyin": "xinzhoushi",
"provinceId": "140000",
"hotCity": false,
"cityShortPY": "XZS"
},
{
"name": "临汾市",
"id": "141000",
"cityPinyin": "linfenshi",
"provinceId": "140000",
"hotCity": false,
"cityShortPY": "LFS"
},
{
"name": "吕梁市",
"id": "141100",
"cityPinyin": "lvliangshi",
"provinceId": "140000",
"hotCity": false,
"cityShortPY": "LLS"
},
{
"name": "呼和浩特市",
"id": "150100",
"cityPinyin": "huhehaoteshi",
"provinceId": "150000",
"hotCity": false,
"cityShortPY": "HHHTS"
},
{
"name": "包头市",
"id": "150200",
"cityPinyin": "baotoushi",
"provinceId": "150000",
"hotCity": false,
"cityShortPY": "BTS"
},
{
"name": "乌海市",
"id": "150300",
"cityPinyin": "wuhaishi",
"provinceId": "150000",
"hotCity": false,
"cityShortPY": "WHS"
},
{
"name": "赤峰市",
"id": "150400",
"cityPinyin": "chifengshi",
"provinceId": "150000",
"hotCity": false,
"cityShortPY": "CFS"
},
{
"name": "通辽市",
"id": "150500",
"cityPinyin": "tongliaoshi",
"provinceId": "150000",
"hotCity": false,
"cityShortPY": "TLS"
},
{
"name": "鄂尔多斯市",
"id": "150600",
"cityPinyin": "eerduosishi",
"provinceId": "150000",
"hotCity": false,
"cityShortPY": "EEDSS"
},
{
"name": "呼伦贝尔市",
"id": "150700",
"cityPinyin": "hulunbeiershi",
"provinceId": "150000",
"hotCity": false,
"cityShortPY": "HLBES"
},
{
"name": "巴彦淖尔市",
"id": "150800",
"cityPinyin": "bayanneershi",
"provinceId": "150000",
"hotCity": false,
"cityShortPY": "BYNES"
},
{
"name": "乌兰察布市",
"id": "150900",
"cityPinyin": "wulanchabushi",
"provinceId": "150000",
"hotCity": false,
"cityShortPY": "WLCBS"
},
{
"name": "兴安盟",
"id": "152200",
"cityPinyin": "xinganmeng",
"provinceId": "150000",
"hotCity": false,
"cityShortPY": "XAM"
},
{
"name": "锡林郭勒盟",
"id": "152500",
"cityPinyin": "xilinguolemeng",
"provinceId": "150000",
"hotCity": false,
"cityShortPY": "XLGLM"
},
{
"name": "阿拉善盟",
"id": "152900",
"cityPinyin": "alashanmeng",
"provinceId": "150000",
"hotCity": false,
"cityShortPY": "ALSM"
},
{
"name": "沈阳市",
"id": "210100",
"cityPinyin": "shenyangshi",
"provinceId": "210000",
"hotCity": false,
"cityShortPY": "SYS"
},
{
"name": "大连市",
"id": "210200",
"cityPinyin": "dalianshi",
"provinceId": "210000",
"hotCity": false,
"cityShortPY": "DLS"
},
{
"name": "鞍山市",
"id": "210300",
"cityPinyin": "anshanshi",
"provinceId": "210000",
"hotCity": false,
"cityShortPY": "ASS"
},
{
"name": "抚顺市",
"id": "210400",
"cityPinyin": "fushunshi",
"provinceId": "210000",
"hotCity": false,
"cityShortPY": "FSS"
},
{
"name": "本溪市",
"id": "210500",
"cityPinyin": "benxishi",
"provinceId": "210000",
"hotCity": false,
"cityShortPY": "BXS"
},
{
"name": "丹东市",
"id": "210600",
"cityPinyin": "dandongshi",
"provinceId": "210000",
"hotCity": false,
"cityShortPY": "DDS"
},
{
"name": "锦州市",
"id": "210700",
"cityPinyin": "jinzhoushi",
"provinceId": "210000",
"hotCity": false,
"cityShortPY": "JZS"
},
{
"name": "营口市",
"id": "210800",
"cityPinyin": "yingkoushi",
"provinceId": "210000",
"hotCity": false,
"cityShortPY": "YKS"
},
{
"name": "阜新市",
"id": "210900",
"cityPinyin": "fuxinshi",
"provinceId": "210000",
"hotCity": false,
"cityShortPY": "FXS"
},
{
"name": "辽阳市",
"id": "211000",
"cityPinyin": "liaoyangshi",
"provinceId": "210000",
"hotCity": false,
"cityShortPY": "LYS"
},
{
"name": "盘锦市",
"id": "211100",
"cityPinyin": "panjinshi",
"provinceId": "210000",
"hotCity": false,
"cityShortPY": "PJS"
},
{
"name": "铁岭市",
"id": "211200",
"cityPinyin": "tielingshi",
"provinceId": "210000",
"hotCity": false,
"cityShortPY": "TLS"
},
{
"name": "朝阳市",
"id": "211300",
"cityPinyin": "chaoyangshi",
"provinceId": "210000",
"hotCity": false,
"cityShortPY": "CYS"
},
{
"name": "葫芦岛市",
"id": "211400",
"cityPinyin": "huludaoshi",
"provinceId": "210000",
"hotCity": false,
"cityShortPY": "HLDS"
},
{
"name": "长春市",
"id": "220100",
"cityPinyin": "changchunshi",
"provinceId": "220000",
"hotCity": false,
"cityShortPY": "ZCS"
},
{
"name": "吉林市",
"id": "220200",
"cityPinyin": "jilinshi",
"provinceId": "220000",
"hotCity": false,
"cityShortPY": "JLS"
},
{
"name": "四平市",
"id": "220300",
"cityPinyin": "sipingshi",
"provinceId": "220000",
"hotCity": false,
"cityShortPY": "SPS"
},
{
"name": "辽源市",
"id": "220400",
"cityPinyin": "liaoyuanshi",
"provinceId": "220000",
"hotCity": false,
"cityShortPY": "LYS"
},
{
"name": "通化市",
"id": "220500",
"cityPinyin": "tonghuashi",
"provinceId": "220000",
"hotCity": false,
"cityShortPY": "THS"
},
{
"name": "白山市",
"id": "220600",
"cityPinyin": "baishanshi",
"provinceId": "220000",
"hotCity": false,
"cityShortPY": "BSS"
},
{
"name": "松原市",
"id": "220700",
"cityPinyin": "songyuanshi",
"provinceId": "220000",
"hotCity": false,
"cityShortPY": "SYS"
},
{
"name": "白城市",
"id": "220800",
"cityPinyin": "baichengshi",
"provinceId": "220000",
"hotCity": false,
"cityShortPY": "BCS"
},
{
"name": "延边朝鲜族自治州",
"id": "222400",
"cityPinyin": "yanbianchaoxianzuzizhizhou",
"provinceId": "220000",
"hotCity": false,
"cityShortPY": "YBCXZZZZ"
},
{
"name": "哈尔滨市",
"id": "230100",
"cityPinyin": "haerbinshi",
"provinceId": "230000",
"hotCity": false,
"cityShortPY": "HEBS"
},
{
"name": "齐齐哈尔市",
"id": "230200",
"cityPinyin": "qiqihaershi",
"provinceId": "230000",
"hotCity": false,
"cityShortPY": "QQHES"
},
{
"name": "鸡西市",
"id": "230300",
"cityPinyin": "jixishi",
"provinceId": "230000",
"hotCity": false,
"cityShortPY": "JXS"
},
{
"name": "鹤岗市",
"id": "230400",
"cityPinyin": "hegangshi",
"provinceId": "230000",
"hotCity": false,
"cityShortPY": "HGS"
},
{
"name": "双鸭山市",
"id": "230500",
"cityPinyin": "shuangyashanshi",
"provinceId": "230000",
"hotCity": false,
"cityShortPY": "SYSS"
},
{
"name": "大庆市",
"id": "230600",
"cityPinyin": "daqingshi",
"provinceId": "230000",
"hotCity": false,
"cityShortPY": "DQS"
},
{
"name": "伊春市",
"id": "230700",
"cityPinyin": "yichunshi",
"provinceId": "230000",
"hotCity": false,
"cityShortPY": "YCS"
},
{
"name": "佳木斯市",
"id": "230800",
"cityPinyin": "jiamusishi",
"provinceId": "230000",
"hotCity": false,
"cityShortPY": "JMSS"
},
{
"name": "七台河市",
"id": "230900",
"cityPinyin": "qitaiheshi",
"provinceId": "230000",
"hotCity": false,
"cityShortPY": "QTHS"
},
{
"name": "牡丹江市",
"id": "231000",
"cityPinyin": "mudanjiangshi",
"provinceId": "230000",
"hotCity": false,
"cityShortPY": "MDJS"
},
{
"name": "黑河市",
"id": "231100",
"cityPinyin": "heiheshi",
"provinceId": "230000",
"hotCity": false,
"cityShortPY": "HHS"
},
{
"name": "绥化市",
"id": "231200",
"cityPinyin": "suihuashi",
"provinceId": "230000",
"hotCity": false,
"cityShortPY": "SHS"
},
{
"name": "大兴安岭地区",
"id": "232700",
"cityPinyin": "daxinganlingdiqu",
"provinceId": "230000",
"hotCity": false,
"cityShortPY": "DXALDQ"
},
{
"name": "上海市",
"id": "310100",
"cityPinyin": "shanghaishi",
"provinceId": "310000",
"hotCity": true,
"cityShortPY": "SHS"
},
{
"name": "南京市",
"id": "320100",
"cityPinyin": "nanjingshi",
"provinceId": "320000",
"hotCity": false,
"cityShortPY": "NJS"
},
{
"name": "无锡市",
"id": "320200",
"cityPinyin": "wuxishi",
"provinceId": "320000",
"hotCity": false,
"cityShortPY": "WXS"
},
{
"name": "徐州市",
"id": "320300",
"cityPinyin": "xuzhoushi",
"provinceId": "320000",
"hotCity": false,
"cityShortPY": "XZS"
},
{
"name": "常州市",
"id": "320400",
"cityPinyin": "changzhoushi",
"provinceId": "320000",
"hotCity": false,
"cityShortPY": "CZS"
},
{
"name": "苏州市",
"id": "320500",
"cityPinyin": "suzhoushi",
"provinceId": "320000",
"hotCity": true,
"cityShortPY": "SZS"
},
{
"name": "南通市",
"id": "320600",
"cityPinyin": "nantongshi",
"provinceId": "320000",
"hotCity": false,
"cityShortPY": "NTS"
},
{
"name": "连云港市",
"id": "320700",
"cityPinyin": "lianyungangshi",
"provinceId": "320000",
"hotCity": false,
"cityShortPY": "LYGS"
},
{
"name": "淮安市",
"id": "320800",
"cityPinyin": "huaianshi",
"provinceId": "320000",
"hotCity": false,
"cityShortPY": "HAS"
},
{
"name": "盐城市",
"id": "320900",
"cityPinyin": "yanchengshi",
"provinceId": "320000",
"hotCity": false,
"cityShortPY": "YCS"
},
{
"name": "扬州市",
"id": "321000",
"cityPinyin": "yangzhoushi",
"provinceId": "320000",
"hotCity": false,
"cityShortPY": "YZS"
},
{
"name": "镇江市",
"id": "321100",
"cityPinyin": "zhenjiangshi",
"provinceId": "320000",
"hotCity": false,
"cityShortPY": "ZJS"
},
{
"name": "泰州市",
"id": "321200",
"cityPinyin": "taizhoushi",
"provinceId": "320000",
"hotCity": false,
"cityShortPY": "TZS"
},
{
"name": "宿迁市",
"id": "321300",
"cityPinyin": "suqianshi",
"provinceId": "320000",
"hotCity": false,
"cityShortPY": "XQS"
},
{
"name": "杭州市",
"id": "330100",
"cityPinyin": "hangzhoushi",
"provinceId": "330000",
"hotCity": true,
"cityShortPY": "HZS"
},
{
"name": "宁波市",
"id": "330200",
"cityPinyin": "ningboshi",
"provinceId": "330000",
"hotCity": true,
"cityShortPY": "NBS"
},
{
"name": "温州市",
"id": "330300",
"cityPinyin": "wenzhoushi",
"provinceId": "330000",
"hotCity": false,
"cityShortPY": "WZS"
},
{
"name": "嘉兴市",
"id": "330400",
"cityPinyin": "jiaxingshi",
"provinceId": "330000",
"hotCity": false,
"cityShortPY": "JXS"
},
{
"name": "湖州市",
"id": "330500",
"cityPinyin": "huzhoushi",
"provinceId": "330000",
"hotCity": false,
"cityShortPY": "HZS"
},
{
"name": "绍兴市",
"id": "330600",
"cityPinyin": "shaoxingshi",
"provinceId": "330000",
"hotCity": false,
"cityShortPY": "SXS"
},
{
"name": "金华市",
"id": "330700",
"cityPinyin": "jinhuashi",
"provinceId": "330000",
"hotCity": true,
"cityShortPY": "JHS"
},
{
"name": "衢州市",
"id": "330800",
"cityPinyin": "quzhoushi",
"provinceId": "330000",
"hotCity": false,
"cityShortPY": "QZS"
},
{
"name": "舟山市",
"id": "330900",
"cityPinyin": "zhoushanshi",
"provinceId": "330000",
"hotCity": false,
"cityShortPY": "ZSS"
},
{
"name": "台州市",
"id": "331000",
"cityPinyin": "taizhoushi",
"provinceId": "330000",
"hotCity": false,
"cityShortPY": "TZS"
},
{
"name": "丽水市",
"id": "331100",
"cityPinyin": "lishuishi",
"provinceId": "330000",
"hotCity": false,
"cityShortPY": "LSS"
},
{
"name": "合肥市",
"id": "340100",
"cityPinyin": "hefeishi",
"provinceId": "340000",
"hotCity": false,
"cityShortPY": "HFS"
},
{
"name": "芜湖市",
"id": "340200",
"cityPinyin": "wuhushi",
"provinceId": "340000",
"hotCity": false,
"cityShortPY": "WHS"
},
{
"name": "蚌埠市",
"id": "340300",
"cityPinyin": "bangbushi",
"provinceId": "340000",
"hotCity": false,
"cityShortPY": "BBS"
},
{
"name": "淮南市",
"id": "340400",
"cityPinyin": "huainanshi",
"provinceId": "340000",
"hotCity": false,
"cityShortPY": "HNS"
},
{
"name": "马鞍山市",
"id": "340500",
"cityPinyin": "maanshanshi",
"provinceId": "340000",
"hotCity": false,
"cityShortPY": "MASS"
},
{
"name": "淮北市",
"id": "340600",
"cityPinyin": "huaibeishi",
"provinceId": "340000",
"hotCity": false,
"cityShortPY": "HBS"
},
{
"name": "铜陵市",
"id": "340700",
"cityPinyin": "tonglingshi",
"provinceId": "340000",
"hotCity": false,
"cityShortPY": "TLS"
},
{
"name": "安庆市",
"id": "340800",
"cityPinyin": "anqingshi",
"provinceId": "340000",
"hotCity": false,
"cityShortPY": "AQS"
},
{
"name": "黄山市",
"id": "341000",
"cityPinyin": "huangshanshi",
"provinceId": "340000",
"hotCity": false,
"cityShortPY": "HSS"
},
{
"name": "滁州市",
"id": "341100",
"cityPinyin": "chuzhoushi",
"provinceId": "340000",
"hotCity": false,
"cityShortPY": "CZS"
},
{
"name": "阜阳市",
"id": "341200",
"cityPinyin": "fuyangshi",
"provinceId": "340000",
"hotCity": false,
"cityShortPY": "FYS"
},
{
"name": "宿州市",
"id": "341300",
"cityPinyin": "suzhoushi",
"provinceId": "340000",
"hotCity": false,
"cityShortPY": "XZS"
},
{
"name": "六安市",
"id": "341500",
"cityPinyin": "liuanshi",
"provinceId": "340000",
"hotCity": false,
"cityShortPY": "LAS"
},
{
"name": "亳州市",
"id": "341600",
"cityPinyin": "bozhoushi",
"provinceId": "340000",
"hotCity": false,
"cityShortPY": "BZS"
},
{
"name": "池州市",
"id": "341700",
"cityPinyin": "chizhoushi",
"provinceId": "340000",
"hotCity": false,
"cityShortPY": "CZS"
},
{
"name": "宣城市",
"id": "341800",
"cityPinyin": "xuanchengshi",
"provinceId": "340000",
"hotCity": false,
"cityShortPY": "XCS"
},
{
"name": "福州市",
"id": "350100",
"cityPinyin": "fuzhoushi",
"provinceId": "350000",
"hotCity": false,
"cityShortPY": "FZS"
},
{
"name": "厦门市",
"id": "350200",
"cityPinyin": "xiamenshi",
"provinceId": "350000",
"hotCity": false,
"cityShortPY": "SMS"
},
{
"name": "莆田市",
"id": "350300",
"cityPinyin": "putianshi",
"provinceId": "350000",
"hotCity": false,
"cityShortPY": "PTS"
},
{
"name": "三明市",
"id": "350400",
"cityPinyin": "sanmingshi",
"provinceId": "350000",
"hotCity": false,
"cityShortPY": "SMS"
},
{
"name": "泉州市",
"id": "350500",
"cityPinyin": "quanzhoushi",
"provinceId": "350000",
"hotCity": false,
"cityShortPY": "QZS"
},
{
"name": "漳州市",
"id": "350600",
"cityPinyin": "zhangzhoushi",
"provinceId": "350000",
"hotCity": false,
"cityShortPY": "ZZS"
},
{
"name": "南平市",
"id": "350700",
"cityPinyin": "nanpingshi",
"provinceId": "350000",
"hotCity": false,
"cityShortPY": "NPS"
},
{
"name": "龙岩市",
"id": "350800",
"cityPinyin": "longyanshi",
"provinceId": "350000",
"hotCity": false,
"cityShortPY": "LYS"
},
{
"name": "宁德市",
"id": "350900",
"cityPinyin": "ningdeshi",
"provinceId": "350000",
"hotCity": false,
"cityShortPY": "NDS"
},
{
"name": "南昌市",
"id": "360100",
"cityPinyin": "nanchangshi",
"provinceId": "360000",
"hotCity": false,
"cityShortPY": "NCS"
},
{
"name": "景德镇市",
"id": "360200",
"cityPinyin": "jingdezhenshi",
"provinceId": "360000",
"hotCity": false,
"cityShortPY": "JDZS"
},
{
"name": "萍乡市",
"id": "360300",
"cityPinyin": "pingxiangshi",
"provinceId": "360000",
"hotCity": false,
"cityShortPY": "PXS"
},
{
"name": "九江市",
"id": "360400",
"cityPinyin": "jiujiangshi",
"provinceId": "360000",
"hotCity": false,
"cityShortPY": "JJS"
},
{
"name": "新余市",
"id": "360500",
"cityPinyin": "xinyushi",
"provinceId": "360000",
"hotCity": false,
"cityShortPY": "XYS"
},
{
"name": "鹰潭市",
"id": "360600",
"cityPinyin": "yingtanshi",
"provinceId": "360000",
"hotCity": false,
"cityShortPY": "YTS"
},
{
"name": "赣州市",
"id": "360700",
"cityPinyin": "ganzhoushi",
"provinceId": "360000",
"hotCity": false,
"cityShortPY": "GZS"
},
{
"name": "吉安市",
"id": "360800",
"cityPinyin": "jianshi",
"provinceId": "360000",
"hotCity": false,
"cityShortPY": "JAS"
},
{
"name": "宜春市",
"id": "360900",
"cityPinyin": "yichunshi",
"provinceId": "360000",
"hotCity": false,
"cityShortPY": "YCS"
},
{
"name": "抚州市",
"id": "361000",
"cityPinyin": "fuzhoushi",
"provinceId": "360000",
"hotCity": false,
"cityShortPY": "FZS"
},
{
"name": "上饶市",
"id": "361100",
"cityPinyin": "shangraoshi",
"provinceId": "360000",
"hotCity": false,
"cityShortPY": "SRS"
},
{
"name": "济南市",
"id": "370100",
"cityPinyin": "jinanshi",
"provinceId": "370000",
"hotCity": false,
"cityShortPY": "JNS"
},
{
"name": "青岛市",
"id": "370200",
"cityPinyin": "qingdaoshi",
"provinceId": "370000",
"hotCity": false,
"cityShortPY": "QDS"
},
{
"name": "淄博市",
"id": "370300",
"cityPinyin": "ziboshi",
"provinceId": "370000",
"hotCity": false,
"cityShortPY": "ZBS"
},
{
"name": "枣庄市",
"id": "370400",
"cityPinyin": "zaozhuangshi",
"provinceId": "370000",
"hotCity": false,
"cityShortPY": "ZZS"
},
{
"name": "东营市",
"id": "370500",
"cityPinyin": "dongyingshi",
"provinceId": "370000",
"hotCity": false,
"cityShortPY": "DYS"
},
{
"name": "烟台市",
"id": "370600",
"cityPinyin": "yantaishi",
"provinceId": "370000",
"hotCity": false,
"cityShortPY": "YTS"
},
{
"name": "潍坊市",
"id": "370700",
"cityPinyin": "weifangshi",
"provinceId": "370000",
"hotCity": false,
"cityShortPY": "WFS"
},
{
"name": "济宁市",
"id": "370800",
"cityPinyin": "jiningshi",
"provinceId": "370000",
"hotCity": false,
"cityShortPY": "JNS"
},
{
"name": "泰安市",
"id": "370900",
"cityPinyin": "taianshi",
"provinceId": "370000",
"hotCity": false,
"cityShortPY": "TAS"
},
{
"name": "威海市",
"id": "371000",
"cityPinyin": "weihaishi",
"provinceId": "370000",
"hotCity": false,
"cityShortPY": "WHS"
},
{
"name": "日照市",
"id": "371100",
"cityPinyin": "rizhaoshi",
"provinceId": "370000",
"hotCity": false,
"cityShortPY": "RZS"
},
{
"name": "莱芜市",
"id": "371200",
"cityPinyin": "laiwushi",
"provinceId": "370000",
"hotCity": false,
"cityShortPY": "LWS"
},
{
"name": "临沂市",
"id": "371300",
"cityPinyin": "linyishi",
"provinceId": "370000",
"hotCity": false,
"cityShortPY": "LYS"
},
{
"name": "德州市",
"id": "371400",
"cityPinyin": "dezhoushi",
"provinceId": "370000",
"hotCity": false,
"cityShortPY": "DZS"
},
{
"name": "聊城市",
"id": "371500",
"cityPinyin": "liaochengshi",
"provinceId": "370000",
"hotCity": false,
"cityShortPY": "LCS"
},
{
"name": "滨州市",
"id": "371600",
"cityPinyin": "binzhoushi",
"provinceId": "370000",
"hotCity": false,
"cityShortPY": "BZS"
},
{
"name": "菏泽市",
"id": "371700",
"cityPinyin": "hezeshi",
"provinceId": "370000",
"hotCity": false,
"cityShortPY": "HZS"
},
{
"name": "郑州市",
"id": "410100",
"cityPinyin": "zhengzhoushi",
"provinceId": "410000",
"hotCity": true,
"cityShortPY": "ZZS"
},
{
"name": "开封市",
"id": "410200",
"cityPinyin": "kaifengshi",
"provinceId": "410000",
"hotCity": false,
"cityShortPY": "KFS"
},
{
"name": "洛阳市",
"id": "410300",
"cityPinyin": "luoyangshi",
"provinceId": "410000",
"hotCity": false,
"cityShortPY": "LYS"
},
{
"name": "平顶山市",
"id": "410400",
"cityPinyin": "pingdingshanshi",
"provinceId": "410000",
"hotCity": false,
"cityShortPY": "PDSS"
},
{
"name": "安阳市",
"id": "410500",
"cityPinyin": "anyangshi",
"provinceId": "410000",
"hotCity": false,
"cityShortPY": "AYS"
},
{
"name": "鹤壁市",
"id": "410600",
"cityPinyin": "hebishi",
"provinceId": "410000",
"hotCity": false,
"cityShortPY": "HBS"
},
{
"name": "新乡市",
"id": "410700",
"cityPinyin": "xinxiangshi",
"provinceId": "410000",
"hotCity": false,
"cityShortPY": "XXS"
},
{
"name": "焦作市",
"id": "410800",
"cityPinyin": "jiaozuoshi",
"provinceId": "410000",
"hotCity": false,
"cityShortPY": "JZS"
},
{
"name": "濮阳市",
"id": "410900",
"cityPinyin": "puyangshi",
"provinceId": "410000",
"hotCity": false,
"cityShortPY": "PYS"
},
{
"name": "许昌市",
"id": "411000",
"cityPinyin": "xuchangshi",
"provinceId": "410000",
"hotCity": false,
"cityShortPY": "XCS"
},
{
"name": "漯河市",
"id": "411100",
"cityPinyin": "leiheshi",
"provinceId": "410000",
"hotCity": false,
"cityShortPY": "LHS"
},
{
"name": "三门峡市",
"id": "411200",
"cityPinyin": "sanmenxiashi",
"provinceId": "410000",
"hotCity": false,
"cityShortPY": "SMXS"
},
{
"name": "南阳市",
"id": "411300",
"cityPinyin": "nanyangshi",
"provinceId": "410000",
"hotCity": false,
"cityShortPY": "NYS"
},
{
"name": "商丘市",
"id": "411400",
"cityPinyin": "shangqiushi",
"provinceId": "410000",
"hotCity": false,
"cityShortPY": "SQS"
},
{
"name": "信阳市",
"id": "411500",
"cityPinyin": "xinyangshi",
"provinceId": "410000",
"hotCity": false,
"cityShortPY": "XYS"
},
{
"name": "周口市",
"id": "411600",
"cityPinyin": "zhoukoushi",
"provinceId": "410000",
"hotCity": false,
"cityShortPY": "ZKS"
},
{
"name": "驻马店市",
"id": "411700",
"cityPinyin": "zhumadianshi",
"provinceId": "410000",
"hotCity": false,
"cityShortPY": "ZMDS"
},
{
"name": "济源市",
"id": "999410881",
"cityPinyin": "jiyuanshi",
"provinceId": "410000",
"hotCity": false,
"cityShortPY": "JYS"
},
{
"name": "武汉市",
"id": "420100",
"cityPinyin": "wuhanshi",
"provinceId": "420000",
"hotCity": false,
"cityShortPY": "WHS"
},
{
"name": "黄石市",
"id": "420200",
"cityPinyin": "huangshishi",
"provinceId": "420000",
"hotCity": false,
"cityShortPY": "HSS"
},
{
"name": "十堰市",
"id": "420300",
"cityPinyin": "shiyanshi",
"provinceId": "420000",
"hotCity": false,
"cityShortPY": "SYS"
},
{
"name": "宜昌市",
"id": "420500",
"cityPinyin": "yichangshi",
"provinceId": "420000",
"hotCity": false,
"cityShortPY": "YCS"
},
{
"name": "襄阳市",
"id": "420600",
"cityPinyin": "xiangyangshi",
"provinceId": "420000",
"hotCity": false,
"cityShortPY": "XYS"
},
{
"name": "鄂州市",
"id": "420700",
"cityPinyin": "ezhoushi",
"provinceId": "420000",
"hotCity": false,
"cityShortPY": "EZS"
},
{
"name": "荆门市",
"id": "420800",
"cityPinyin": "jingmenshi",
"provinceId": "420000",
"hotCity": false,
"cityShortPY": "JMS"
},
{
"name": "孝感市",
"id": "420900",
"cityPinyin": "xiaoganshi",
"provinceId": "420000",
"hotCity": false,
"cityShortPY": "XGS"
},
{
"name": "荆州市",
"id": "421000",
"cityPinyin": "jingzhoushi",
"provinceId": "420000",
"hotCity": false,
"cityShortPY": "JZS"
},
{
"name": "黄冈市",
"id": "421100",
"cityPinyin": "huanggangshi",
"provinceId": "420000",
"hotCity": false,
"cityShortPY": "HGS"
},
{
"name": "咸宁市",
"id": "421200",
"cityPinyin": "xianningshi",
"provinceId": "420000",
"hotCity": false,
"cityShortPY": "XNS"
},
{
"name": "随州市",
"id": "421300",
"cityPinyin": "suizhoushi",
"provinceId": "420000",
"hotCity": false,
"cityShortPY": "SZS"
},
{
"name": "恩施土家族苗族自治州",
"id": "422800",
"cityPinyin": "enshitujiazumiaozuzizhizhou",
"provinceId": "420000",
"hotCity": false,
"cityShortPY": "ESTJZMZZZZ"
},
{
"name": "仙桃市",
"id": "999429004",
"cityPinyin": "xiantaoshi",
"provinceId": "420000",
"hotCity": false,
"cityShortPY": "XTS"
},
{
"name": "潜江市",
"id": "999429005",
"cityPinyin": "qianjiangshi",
"provinceId": "420000",
"hotCity": false,
"cityShortPY": "QJS"
},
{
"name": "天门市",
"id": "999429006",
"cityPinyin": "tianmenshi",
"provinceId": "420000",
"hotCity": false,
"cityShortPY": "TMS"
},
{
"name": "神农架林区",
"id": "999429021",
"cityPinyin": "shennongjialinqu",
"provinceId": "420000",
"hotCity": false,
"cityShortPY": "SNJLQ"
},
{
"name": "长沙市",
"id": "430100",
"cityPinyin": "changshashi",
"provinceId": "430000",
"hotCity": true,
"cityShortPY": "ZSS"
},
{
"name": "株洲市",
"id": "430200",
"cityPinyin": "zhuzhoushi",
"provinceId": "430000",
"hotCity": false,
"cityShortPY": "ZZS"
},
{
"name": "湘潭市",
"id": "430300",
"cityPinyin": "xiangtanshi",
"provinceId": "430000",
"hotCity": false,
"cityShortPY": "XTS"
},
{
"name": "衡阳市",
"id": "430400",
"cityPinyin": "hengyangshi",
"provinceId": "430000",
"hotCity": false,
"cityShortPY": "HYS"
},
{
"name": "邵阳市",
"id": "430500",
"cityPinyin": "shaoyangshi",
"provinceId": "430000",
"hotCity": false,
"cityShortPY": "SYS"
},
{
"name": "岳阳市",
"id": "430600",
"cityPinyin": "yueyangshi",
"provinceId": "430000",
"hotCity": false,
"cityShortPY": "YYS"
},
{
"name": "常德市",
"id": "430700",
"cityPinyin": "changdeshi",
"provinceId": "430000",
"hotCity": false,
"cityShortPY": "CDS"
},
{
"name": "张家界市",
"id": "430800",
"cityPinyin": "zhangjiajieshi",
"provinceId": "430000",
"hotCity": false,
"cityShortPY": "ZJJS"
},
{
"name": "益阳市",
"id": "430900",
"cityPinyin": "yiyangshi",
"provinceId": "430000",
"hotCity": false,
"cityShortPY": "YYS"
},
{
"name": "郴州市",
"id": "431000",
"cityPinyin": "chenzhoushi",
"provinceId": "430000",
"hotCity": false,
"cityShortPY": "CZS"
},
{
"name": "永州市",
"id": "431100",
"cityPinyin": "yongzhoushi",
"provinceId": "430000",
"hotCity": false,
"cityShortPY": "YZS"
},
{
"name": "怀化市",
"id": "431200",
"cityPinyin": "huaihuashi",
"provinceId": "430000",
"hotCity": false,
"cityShortPY": "HHS"
},
{
"name": "娄底市",
"id": "431300",
"cityPinyin": "loudishi",
"provinceId": "430000",
"hotCity": false,
"cityShortPY": "LDS"
},
{
"name": "湘西土家族苗族自治州",
"id": "433100",
"cityPinyin": "xiangxitujiazumiaozuzizhizhou",
"provinceId": "430000",
"hotCity": false,
"cityShortPY": "XXTJZMZZZZ"
},
{
"name": "广州市",
"id": "440100",
"cityPinyin": "guangzhoushi",
"provinceId": "440000",
"hotCity": false,
"cityShortPY": "GZS"
},
{
"name": "韶关市",
"id": "440200",
"cityPinyin": "shaoguanshi",
"provinceId": "440000",
"hotCity": false,
"cityShortPY": "SGS"
},
{
"name": "深圳市",
"id": "440300",
"cityPinyin": "shenchoushi",
"provinceId": "440000",
"hotCity": true,
"cityShortPY": "SZS"
},
{
"name": "珠海市",
"id": "440400",
"cityPinyin": "zhuhaishi",
"provinceId": "440000",
"hotCity": false,
"cityShortPY": "ZHS"
},
{
"name": "汕头市",
"id": "440500",
"cityPinyin": "shantoushi",
"provinceId": "440000",
"hotCity": false,
"cityShortPY": "STS"
},
{
"name": "佛山市",
"id": "440600",
"cityPinyin": "fushanshi",
"provinceId": "440000",
"hotCity": false,
"cityShortPY": "BSS"
},
{
"name": "江门市",
"id": "440700",
"cityPinyin": "jiangmenshi",
"provinceId": "440000",
"hotCity": false,
"cityShortPY": "JMS"
},
{
"name": "湛江市",
"id": "440800",
"cityPinyin": "zhanjiangshi",
"provinceId": "440000",
"hotCity": false,
"cityShortPY": "ZJS"
},
{
"name": "茂名市",
"id": "440900",
"cityPinyin": "maomingshi",
"provinceId": "440000",
"hotCity": false,
"cityShortPY": "MMS"
},
{
"name": "肇庆市",
"id": "441200",
"cityPinyin": "zhaoqingshi",
"provinceId": "440000",
"hotCity": false,
"cityShortPY": "ZQS"
},
{
"name": "惠州市",
"id": "441300",
"cityPinyin": "huizhoushi",
"provinceId": "440000",
"hotCity": false,
"cityShortPY": "HZS"
},
{
"name": "梅州市",
"id": "441400",
"cityPinyin": "meizhoushi",
"provinceId": "440000",
"hotCity": false,
"cityShortPY": "MZS"
},
{
"name": "汕尾市",
"id": "441500",
"cityPinyin": "shanweishi",
"provinceId": "440000",
"hotCity": false,
"cityShortPY": "SWS"
},
{
"name": "河源市",
"id": "441600",
"cityPinyin": "heyuanshi",
"provinceId": "440000",
"hotCity": false,
"cityShortPY": "HYS"
},
{
"name": "阳江市",
"id": "441700",
"cityPinyin": "yangjiangshi",
"provinceId": "440000",
"hotCity": false,
"cityShortPY": "YJS"
},
{
"name": "清远市",
"id": "441800",
"cityPinyin": "qingyuanshi",
"provinceId": "440000",
"hotCity": false,
"cityShortPY": "QYS"
},
{
"name": "东莞市",
"id": "441900",
"cityPinyin": "dongguanshi",
"provinceId": "440000",
"hotCity": true,
"cityShortPY": "DGS"
},
{
"name": "中山市",
"id": "442000",
"cityPinyin": "zhongshanshi",
"provinceId": "440000",
"hotCity": true,
"cityShortPY": "ZSS"
},
{
"name": "潮州市",
"id": "445100",
"cityPinyin": "chaozhoushi",
"provinceId": "440000",
"hotCity": false,
"cityShortPY": "CZS"
},
{
"name": "揭阳市",
"id": "445200",
"cityPinyin": "jieyangshi",
"provinceId": "440000",
"hotCity": false,
"cityShortPY": "JYS"
},
{
"name": "云浮市",
"id": "445300",
"cityPinyin": "yunfushi",
"provinceId": "440000",
"hotCity": false,
"cityShortPY": "YFS"
},
{
"name": "南宁市",
"id": "450100",
"cityPinyin": "nanningshi",
"provinceId": "450000",
"hotCity": false,
"cityShortPY": "NNS"
},
{
"name": "柳州市",
"id": "450200",
"cityPinyin": "liuzhoushi",
"provinceId": "450000",
"hotCity": false,
"cityShortPY": "LZS"
},
{
"name": "桂林市",
"id": "450300",
"cityPinyin": "guilinshi",
"provinceId": "450000",
"hotCity": false,
"cityShortPY": "GLS"
},
{
"name": "梧州市",
"id": "450400",
"cityPinyin": "wuzhoushi",
"provinceId": "450000",
"hotCity": false,
"cityShortPY": "WZS"
},
{
"name": "北海市",
"id": "450500",
"cityPinyin": "beihaishi",
"provinceId": "450000",
"hotCity": false,
"cityShortPY": "BHS"
},
{
"name": "防城港市",
"id": "450600",
"cityPinyin": "fangchenggangshi",
"provinceId": "450000",
"hotCity": false,
"cityShortPY": "FCGS"
},
{
"name": "钦州市",
"id": "450700",
"cityPinyin": "qinzhoushi",
"provinceId": "450000",
"hotCity": false,
"cityShortPY": "QZS"
},
{
"name": "贵港市",
"id": "450800",
"cityPinyin": "guigangshi",
"provinceId": "450000",
"hotCity": false,
"cityShortPY": "GGS"
},
{
"name": "玉林市",
"id": "450900",
"cityPinyin": "yulinshi",
"provinceId": "450000",
"hotCity": false,
"cityShortPY": "YLS"
},
{
"name": "百色市",
"id": "451000",
"cityPinyin": "baiseshi",
"provinceId": "450000",
"hotCity": false,
"cityShortPY": "BSS"
},
{
"name": "贺州市",
"id": "451100",
"cityPinyin": "hezhoushi",
"provinceId": "450000",
"hotCity": false,
"cityShortPY": "HZS"
},
{
"name": "河池市",
"id": "451200",
"cityPinyin": "hechishi",
"provinceId": "450000",
"hotCity": false,
"cityShortPY": "HCS"
},
{
"name": "来宾市",
"id": "451300",
"cityPinyin": "laibinshi",
"provinceId": "450000",
"hotCity": false,
"cityShortPY": "LBS"
},
{
"name": "崇左市",
"id": "451400",
"cityPinyin": "chongzuoshi",
"provinceId": "450000",
"hotCity": false,
"cityShortPY": "CZS"
},
{
"name": "海口市",
"id": "460100",
"cityPinyin": "haikoushi",
"provinceId": "460000",
"hotCity": false,
"cityShortPY": "HKS"
},
{
"name": "三亚市",
"id": "460200",
"cityPinyin": "sanyashi",
"provinceId": "460000",
"hotCity": false,
"cityShortPY": "SYS"
},
{
"name": "五指山市",
"id": "999469001",
"cityPinyin": "wuzhishanshi",
"provinceId": "460000",
"hotCity": false,
"cityShortPY": "WZSS"
},
{
"name": "琼海市",
"id": "999469002",
"cityPinyin": "qionghaishi",
"provinceId": "460000",
"hotCity": false,
"cityShortPY": "QHS"
},
{
"name": "儋州市",
"id": "999469003",
"cityPinyin": "danzhoushi",
"provinceId": "460000",
"hotCity": false,
"cityShortPY": "DZS"
},
{
"name": "文昌市",
"id": "999469005",
"cityPinyin": "wenchangshi",
"provinceId": "460000",
"hotCity": false,
"cityShortPY": "WCS"
},
{
"name": "万宁市",
"id": "999469006",
"cityPinyin": "wanningshi",
"provinceId": "460000",
"hotCity": false,
"cityShortPY": "WNS"
},
{
"name": "东方市",
"id": "999469007",
"cityPinyin": "dongfangshi",
"provinceId": "460000",
"hotCity": false,
"cityShortPY": "DFS"
},
{
"name": "定安县",
"id": "999469025",
"cityPinyin": "dinganxian",
"provinceId": "460000",
"hotCity": false,
"cityShortPY": "DAX"
},
{
"name": "屯昌县",
"id": "999469026",
"cityPinyin": "tunchangxian",
"provinceId": "460000",
"hotCity": false,
"cityShortPY": "TCX"
},
{
"name": "澄迈县",
"id": "999469027",
"cityPinyin": "chengmaixian",
"provinceId": "460000",
"hotCity": false,
"cityShortPY": "CMX"
},
{
"name": "临高县",
"id": "999469028",
"cityPinyin": "lingaoxian",
"provinceId": "460000",
"hotCity": false,
"cityShortPY": "LGX"
},
{
"name": "白沙黎族自治县",
"id": "999469030",
"cityPinyin": "baishalizuzizhixian",
"provinceId": "460000",
"hotCity": false,
"cityShortPY": "BSLZZZX"
},
{
"name": "昌江黎族自治县",
"id": "999469031",
"cityPinyin": "changjianglizuzizhixian",
"provinceId": "460000",
"hotCity": false,
"cityShortPY": "CJLZZZX"
},
{
"name": "乐东黎族自治县",
"id": "999469033",
"cityPinyin": "ledonglizuzizhixian",
"provinceId": "460000",
"hotCity": false,
"cityShortPY": "LDLZZZX"
},
{
"name": "陵水黎族自治县",
"id": "999469034",
"cityPinyin": "lingshuilizuzizhixian",
"provinceId": "460000",
"hotCity": false,
"cityShortPY": "LSLZZZX"
},
{
"name": "保亭黎族苗族自治县",
"id": "999469035",
"cityPinyin": "baotinglizumiaozuzizhixian",
"provinceId": "460000",
"hotCity": false,
"cityShortPY": "BTLZMZZZX"
},
{
"name": "琼中黎族苗族自治县",
"id": "999469036",
"cityPinyin": "qiongzhonglizumiaozuzizhixian",
"provinceId": "460000",
"hotCity": false,
"cityShortPY": "QZLZMZZZX"
},
{
"name": "西沙群岛",
"id": "999469037",
"cityPinyin": "xishaqundao",
"provinceId": "460000",
"hotCity": false,
"cityShortPY": "XSQD"
},
{
"name": "南沙群岛",
"id": "999469038",
"cityPinyin": "nanshaqundao",
"provinceId": "460000",
"hotCity": false,
"cityShortPY": "NSQD"
},
{
"name": "中沙群岛的岛礁及其海域",
"id": "999469039",
"cityPinyin": "zhongshaqundaodedaojiaojiqihaiyu",
"provinceId": "460000",
"hotCity": false,
"cityShortPY": "ZSQDDDJJQHY"
},
{
"name": "重庆市",
"id": "500100",
"cityPinyin": "zhongqingshi",
"provinceId": "500000",
"hotCity": false,
"cityShortPY": "ZQS"
},
{
"name": "成都市",
"id": "510100",
"cityPinyin": "chengdushi",
"provinceId": "510000",
"hotCity": true,
"cityShortPY": "CDS"
},
{
"name": "自贡市",
"id": "510300",
"cityPinyin": "zigongshi",
"provinceId": "510000",
"hotCity": false,
"cityShortPY": "ZGS"
},
{
"name": "攀枝花市",
"id": "510400",
"cityPinyin": "panzhihuashi",
"provinceId": "510000",
"hotCity": false,
"cityShortPY": "PZHS"
},
{
"name": "泸州市",
"id": "510500",
"cityPinyin": "luzhoushi",
"provinceId": "510000",
"hotCity": false,
"cityShortPY": "LZS"
},
{
"name": "德阳市",
"id": "510600",
"cityPinyin": "deyangshi",
"provinceId": "510000",
"hotCity": false,
"cityShortPY": "DYS"
},
{
"name": "绵阳市",
"id": "510700",
"cityPinyin": "mianyangshi",
"provinceId": "510000",
"hotCity": false,
"cityShortPY": "MYS"
},
{
"name": "广元市",
"id": "510800",
"cityPinyin": "guangyuanshi",
"provinceId": "510000",
"hotCity": false,
"cityShortPY": "GYS"
},
{
"name": "遂宁市",
"id": "510900",
"cityPinyin": "suiningshi",
"provinceId": "510000",
"hotCity": false,
"cityShortPY": "SNS"
},
{
"name": "内江市",
"id": "511000",
"cityPinyin": "najiangshi",
"provinceId": "510000",
"hotCity": false,
"cityShortPY": "NJS"
},
{
"name": "乐山市",
"id": "511100",
"cityPinyin": "leshanshi",
"provinceId": "510000",
"hotCity": false,
"cityShortPY": "LSS"
},
{
"name": "南充市",
"id": "511300",
"cityPinyin": "nanchongshi",
"provinceId": "510000",
"hotCity": false,
"cityShortPY": "NCS"
},
{
"name": "眉山市",
"id": "511400",
"cityPinyin": "meishanshi",
"provinceId": "510000",
"hotCity": false,
"cityShortPY": "MSS"
},
{
"name": "宜宾市",
"id": "511500",
"cityPinyin": "yibinshi",
"provinceId": "510000",
"hotCity": false,
"cityShortPY": "YBS"
},
{
"name": "广安市",
"id": "511600",
"cityPinyin": "guanganshi",
"provinceId": "510000",
"hotCity": false,
"cityShortPY": "GAS"
},
{
"name": "达州市",
"id": "511700",
"cityPinyin": "dazhoushi",
"provinceId": "510000",
"hotCity": false,
"cityShortPY": "DZS"
},
{
"name": "雅安市",
"id": "511800",
"cityPinyin": "yaanshi",
"provinceId": "510000",
"hotCity": false,
"cityShortPY": "YAS"
},
{
"name": "巴中市",
"id": "511900",
"cityPinyin": "bazhongshi",
"provinceId": "510000",
"hotCity": false,
"cityShortPY": "BZS"
},
{
"name": "资阳市",
"id": "512000",
"cityPinyin": "ziyangshi",
"provinceId": "510000",
"hotCity": false,
"cityShortPY": "ZYS"
},
{
"name": "阿坝藏族羌族自治州",
"id": "513200",
"cityPinyin": "abacangzuqiangzuzizhizhou",
"provinceId": "510000",
"hotCity": false,
"cityShortPY": "ABCZQZZZZ"
},
{
"name": "甘孜藏族自治州",
"id": "513300",
"cityPinyin": "ganzicangzuzizhizhou",
"provinceId": "510000",
"hotCity": false,
"cityShortPY": "GZCZZZZ"
},
{
"name": "凉山彝族自治州",
"id": "513400",
"cityPinyin": "liangshanyizuzizhizhou",
"provinceId": "510000",
"hotCity": false,
"cityShortPY": "LSYZZZZ"
},
{
"name": "贵阳市",
"id": "520100",
"cityPinyin": "guiyangshi",
"provinceId": "520000",
"hotCity": false,
"cityShortPY": "GYS"
},
{
"name": "六盘水市",
"id": "520200",
"cityPinyin": "liupanshuishi",
"provinceId": "520000",
"hotCity": false,
"cityShortPY": "LPSS"
},
{
"name": "遵义市",
"id": "520300",
"cityPinyin": "zunyishi",
"provinceId": "520000",
"hotCity": false,
"cityShortPY": "ZYS"
},
{
"name": "安顺市",
"id": "520400",
"cityPinyin": "anshunshi",
"provinceId": "520000",
"hotCity": false,
"cityShortPY": "ASS"
},
{
"name": "铜仁地区",
"id": "522200",
"cityPinyin": "tongrendiqu",
"provinceId": "520000",
"hotCity": false,
"cityShortPY": "TRDQ"
},
{
"name": "黔西南布依族苗族自治州",
"id": "522300",
"cityPinyin": "qianxinanbuyizumiaozuzizhizhou",
"provinceId": "520000",
"hotCity": false,
"cityShortPY": "QXNBYZMZZZZ"
},
{
"name": "毕节地区",
"id": "522400",
"cityPinyin": "bijiediqu",
"provinceId": "520000",
"hotCity": false,
"cityShortPY": "BJDQ"
},
{
"name": "黔东南苗族侗族自治州",
"id": "522600",
"cityPinyin": "qiandongnanmiaozudongzuzizhizhou",
"provinceId": "520000",
"hotCity": false,
"cityShortPY": "QDNMZDZZZZ"
},
{
"name": "黔南布依族苗族自治州",
"id": "522700",
"cityPinyin": "qiannanbuyizumiaozuzizhizhou",
"provinceId": "520000",
"hotCity": false,
"cityShortPY": "QNBYZMZZZZ"
},
{
"name": "昆明市",
"id": "530100",
"cityPinyin": "kunmingshi",
"provinceId": "530000",
"hotCity": false,
"cityShortPY": "KMS"
},
{
"name": "曲靖市",
"id": "530300",
"cityPinyin": "qujingshi",
"provinceId": "530000",
"hotCity": false,
"cityShortPY": "QJS"
},
{
"name": "玉溪市",
"id": "530400",
"cityPinyin": "yuxishi",
"provinceId": "530000",
"hotCity": false,
"cityShortPY": "YXS"
},
{
"name": "保山市",
"id": "530500",
"cityPinyin": "baoshanshi",
"provinceId": "530000",
"hotCity": false,
"cityShortPY": "BSS"
},
{
"name": "昭通市",
"id": "530600",
"cityPinyin": "zhaotongshi",
"provinceId": "530000",
"hotCity": false,
"cityShortPY": "ZTS"
},
{
"name": "丽江市",
"id": "530700",
"cityPinyin": "lijiangshi",
"provinceId": "530000",
"hotCity": false,
"cityShortPY": "LJS"
},
{
"name": "普洱市",
"id": "530800",
"cityPinyin": "puershi",
"provinceId": "530000",
"hotCity": false,
"cityShortPY": "PES"
},
{
"name": "临沧市",
"id": "530900",
"cityPinyin": "lincangshi",
"provinceId": "530000",
"hotCity": false,
"cityShortPY": "LCS"
},
{
"name": "楚雄彝族自治州",
"id": "532300",
"cityPinyin": "chuxiongyizuzizhizhou",
"provinceId": "530000",
"hotCity": false,
"cityShortPY": "CXYZZZZ"
},
{
"name": "红河哈尼族彝族自治州",
"id": "532500",
"cityPinyin": "honghehanizuyizuzizhizhou",
"provinceId": "530000",
"hotCity": false,
"cityShortPY": "HHHNZYZZZZ"
},
{
"name": "文山壮族苗族自治州",
"id": "532600",
"cityPinyin": "wenshanzhuangzumiaozuzizhizhou",
"provinceId": "530000",
"hotCity": false,
"cityShortPY": "WSZZMZZZZ"
},
{
"name": "西双版纳傣族自治州",
"id": "532800",
"cityPinyin": "xishuangbannadaizuzizhizhou",
"provinceId": "530000",
"hotCity": false,
"cityShortPY": "XSBNDZZZZ"
},
{
"name": "大理白族自治州",
"id": "532900",
"cityPinyin": "dalibaizuzizhizhou",
"provinceId": "530000",
"hotCity": false,
"cityShortPY": "DLBZZZZ"
},
{
"name": "德宏傣族景颇族自治州",
"id": "533100",
"cityPinyin": "dehongdaizujingpozuzizhizhou",
"provinceId": "530000",
"hotCity": false,
"cityShortPY": "DHDZJPZZZZ"
},
{
"name": "怒江傈僳族自治州",
"id": "533300",
"cityPinyin": "nujianglisuzuzizhizhou",
"provinceId": "530000",
"hotCity": false,
"cityShortPY": "NJLSZZZZ"
},
{
"name": "迪庆藏族自治州",
"id": "533400",
"cityPinyin": "diqingcangzuzizhizhou",
"provinceId": "530000",
"hotCity": false,
"cityShortPY": "DQCZZZZ"
},
{
"name": "拉萨市",
"id": "540100",
"cityPinyin": "lasashi",
"provinceId": "540000",
"hotCity": false,
"cityShortPY": "LSS"
},
{
"name": "昌都地区",
"id": "542100",
"cityPinyin": "changdudiqu",
"provinceId": "540000",
"hotCity": false,
"cityShortPY": "CDDQ"
},
{
"name": "山南地区",
"id": "542200",
"cityPinyin": "shannandiqu",
"provinceId": "540000",
"hotCity": false,
"cityShortPY": "SNDQ"
},
{
"name": "日喀则地区",
"id": "542300",
"cityPinyin": "rikazediqu",
"provinceId": "540000",
"hotCity": false,
"cityShortPY": "RKZDQ"
},
{
"name": "那曲地区",
"id": "542400",
"cityPinyin": "naqudiqu",
"provinceId": "540000",
"hotCity": false,
"cityShortPY": "NQDQ"
},
{
"name": "阿里地区",
"id": "542500",
"cityPinyin": "alidiqu",
"provinceId": "540000",
"hotCity": false,
"cityShortPY": "ALDQ"
},
{
"name": "林芝地区",
"id": "542600",
"cityPinyin": "linzhidiqu",
"provinceId": "540000",
"hotCity": false,
"cityShortPY": "LZDQ"
},
{
"name": "西安市",
"id": "610100",
"cityPinyin": "xianshi",
"provinceId": "610000",
"hotCity": true,
"cityShortPY": "XAS"
},
{
"name": "铜川市",
"id": "610200",
"cityPinyin": "tongchuanshi",
"provinceId": "610000",
"hotCity": false,
"cityShortPY": "TCS"
},
{
"name": "宝鸡市",
"id": "610300",
"cityPinyin": "baojishi",
"provinceId": "610000",
"hotCity": false,
"cityShortPY": "BJS"
},
{
"name": "咸阳市",
"id": "610400",
"cityPinyin": "xianyangshi",
"provinceId": "610000",
"hotCity": false,
"cityShortPY": "XYS"
},
{
"name": "渭南市",
"id": "610500",
"cityPinyin": "weinanshi",
"provinceId": "610000",
"hotCity": false,
"cityShortPY": "WNS"
},
{
"name": "延安市",
"id": "610600",
"cityPinyin": "yananshi",
"provinceId": "610000",
"hotCity": false,
"cityShortPY": "YAS"
},
{
"name": "汉中市",
"id": "610700",
"cityPinyin": "hanzhongshi",
"provinceId": "610000",
"hotCity": false,
"cityShortPY": "HZS"
},
{
"name": "榆林市",
"id": "610800",
"cityPinyin": "yulinshi",
"provinceId": "610000",
"hotCity": false,
"cityShortPY": "YLS"
},
{
"name": "安康市",
"id": "610900",
"cityPinyin": "ankangshi",
"provinceId": "610000",
"hotCity": false,
"cityShortPY": "AKS"
},
{
"name": "商洛市",
"id": "611000",
"cityPinyin": "shangluoshi",
"provinceId": "610000",
"hotCity": false,
"cityShortPY": "SLS"
},
{
"name": "兰州市",
"id": "620100",
"cityPinyin": "lanzhoushi",
"provinceId": "620000",
"hotCity": false,
"cityShortPY": "LZS"
},
{
"name": "嘉峪关市",
"id": "620200",
"cityPinyin": "jiayuguanshi",
"provinceId": "620000",
"hotCity": false,
"cityShortPY": "JYGS"
},
{
"name": "金昌市",
"id": "620300",
"cityPinyin": "jinchangshi",
"provinceId": "620000",
"hotCity": false,
"cityShortPY": "JCS"
},
{
"name": "白银市",
"id": "620400",
"cityPinyin": "baiyinshi",
"provinceId": "620000",
"hotCity": false,
"cityShortPY": "BYS"
},
{
"name": "天水市",
"id": "620500",
"cityPinyin": "tianshuishi",
"provinceId": "620000",
"hotCity": false,
"cityShortPY": "TSS"
},
{
"name": "武威市",
"id": "620600",
"cityPinyin": "wuweishi",
"provinceId": "620000",
"hotCity": false,
"cityShortPY": "WWS"
},
{
"name": "张掖市",
"id": "620700",
"cityPinyin": "zhangyeshi",
"provinceId": "620000",
"hotCity": false,
"cityShortPY": "ZYS"
},
{
"name": "平凉市",
"id": "620800",
"cityPinyin": "pingliangshi",
"provinceId": "620000",
"hotCity": false,
"cityShortPY": "PLS"
},
{
"name": "酒泉市",
"id": "620900",
"cityPinyin": "jiuquanshi",
"provinceId": "620000",
"hotCity": false,
"cityShortPY": "JQS"
},
{
"name": "庆阳市",
"id": "621000",
"cityPinyin": "qingyangshi",
"provinceId": "620000",
"hotCity": false,
"cityShortPY": "QYS"
},
{
"name": "定西市",
"id": "621100",
"cityPinyin": "dingxishi",
"provinceId": "620000",
"hotCity": false,
"cityShortPY": "DXS"
},
{
"name": "陇南市",
"id": "621200",
"cityPinyin": "longnanshi",
"provinceId": "620000",
"hotCity": false,
"cityShortPY": "LNS"
},
{
"name": "临夏回族自治州",
"id": "622900",
"cityPinyin": "linxiahuizuzizhizhou",
"provinceId": "620000",
"hotCity": false,
"cityShortPY": "LXHZZZZ"
},
{
"name": "甘南藏族自治州",
"id": "623000",
"cityPinyin": "gannancangzuzizhizhou",
"provinceId": "620000",
"hotCity": false,
"cityShortPY": "GNCZZZZ"
},
{
"name": "西宁市",
"id": "630100",
"cityPinyin": "xiningshi",
"provinceId": "630000",
"hotCity": false,
"cityShortPY": "XNS"
},
{
"name": "海东地区",
"id": "632100",
"cityPinyin": "haidongdiqu",
"provinceId": "630000",
"hotCity": false,
"cityShortPY": "HDDQ"
},
{
"name": "海北藏族自治州",
"id": "632200",
"cityPinyin": "haibeicangzuzizhizhou",
"provinceId": "630000",
"hotCity": false,
"cityShortPY": "HBCZZZZ"
},
{
"name": "黄南藏族自治州",
"id": "632300",
"cityPinyin": "huangnancangzuzizhizhou",
"provinceId": "630000",
"hotCity": false,
"cityShortPY": "HNCZZZZ"
},
{
"name": "海南藏族自治州",
"id": "632500",
"cityPinyin": "hainancangzuzizhizhou",
"provinceId": "630000",
"hotCity": false,
"cityShortPY": "HNCZZZZ"
},
{
"name": "果洛藏族自治州",
"id": "632600",
"cityPinyin": "guoluocangzuzizhizhou",
"provinceId": "630000",
"hotCity": false,
"cityShortPY": "GLCZZZZ"
},
{
"name": "玉树藏族自治州",
"id": "632700",
"cityPinyin": "yushucangzuzizhizhou",
"provinceId": "630000",
"hotCity": false,
"cityShortPY": "YSCZZZZ"
},
{
"name": "海西蒙古族藏族自治州",
"id": "632800",
"cityPinyin": "haiximengguzucangzuzizhizhou",
"provinceId": "630000",
"hotCity": false,
"cityShortPY": "HXMGZCZZZZ"
},
{
"name": "银川市",
"id": "640100",
"cityPinyin": "yinchuanshi",
"provinceId": "640000",
"hotCity": false,
"cityShortPY": "YCS"
},
{
"name": "石嘴山市",
"id": "640200",
"cityPinyin": "shizuishanshi",
"provinceId": "640000",
"hotCity": false,
"cityShortPY": "SZSS"
},
{
"name": "吴忠市",
"id": "640300",
"cityPinyin": "wuzhongshi",
"provinceId": "640000",
"hotCity": false,
"cityShortPY": "WZS"
},
{
"name": "固原市",
"id": "640400",
"cityPinyin": "guyuanshi",
"provinceId": "640000",
"hotCity": false,
"cityShortPY": "GYS"
},
{
"name": "中卫市",
"id": "640500",
"cityPinyin": "zhongweishi",
"provinceId": "640000",
"hotCity": false,
"cityShortPY": "ZWS"
},
{
"name": "乌鲁木齐市",
"id": "650100",
"cityPinyin": "wulumuqishi",
"provinceId": "650000",
"hotCity": false,
"cityShortPY": "WLMQS"
},
{
"name": "克拉玛依市",
"id": "650200",
"cityPinyin": "kelamayishi",
"provinceId": "650000",
"hotCity": false,
"cityShortPY": "KLMYS"
},
{
"name": "吐鲁番地区",
"id": "652100",
"cityPinyin": "tulufandiqu",
"provinceId": "650000",
"hotCity": false,
"cityShortPY": "TLFDQ"
},
{
"name": "哈密地区",
"id": "652200",
"cityPinyin": "hamidiqu",
"provinceId": "650000",
"hotCity": false,
"cityShortPY": "HMDQ"
},
{
"name": "昌吉回族自治州",
"id": "652300",
"cityPinyin": "changjihuizuzizhizhou",
"provinceId": "650000",
"hotCity": false,
"cityShortPY": "CJHZZZZ"
},
{
"name": "博尔塔拉蒙古自治州",
"id": "652700",
"cityPinyin": "boertalamengguzizhizhou",
"provinceId": "650000",
"hotCity": false,
"cityShortPY": "BETLMGZZZ"
},
{
"name": "巴音郭楞蒙古自治州",
"id": "652800",
"cityPinyin": "bayinguolengmengguzizhizhou",
"provinceId": "650000",
"hotCity": false,
"cityShortPY": "BYGLMGZZZ"
},
{
"name": "阿克苏地区",
"id": "652900",
"cityPinyin": "akesudiqu",
"provinceId": "650000",
"hotCity": false,
"cityShortPY": "AKSDQ"
},
{
"name": "克孜勒苏柯尔克孜自治州",
"id": "653000",
"cityPinyin": "kezilesukeerkezizizhizhou",
"provinceId": "650000",
"hotCity": false,
"cityShortPY": "KZLSKEKZZZZ"
},
{
"name": "喀什地区",
"id": "653100",
"cityPinyin": "kashidiqu",
"provinceId": "650000",
"hotCity": false,
"cityShortPY": "KSDQ"
},
{
"name": "和田地区",
"id": "653200",
"cityPinyin": "hetiandiqu",
"provinceId": "650000",
"hotCity": false,
"cityShortPY": "HTDQ"
},
{
"name": "伊犁哈萨克自治州",
"id": "654000",
"cityPinyin": "yilihasakezizhizhou",
"provinceId": "650000",
"hotCity": false,
"cityShortPY": "YLHSKZZZ"
},
{
"name": "塔城地区",
"id": "654200",
"cityPinyin": "tachengdiqu",
"provinceId": "650000",
"hotCity": false,
"cityShortPY": "TCDQ"
},
{
"name": "阿勒泰地区",
"id": "654300",
"cityPinyin": "aletaidiqu",
"provinceId": "650000",
"hotCity": false,
"cityShortPY": "ALTDQ"
},
{
"name": "石河子市",
"id": "999659001",
"cityPinyin": "shihezishi",
"provinceId": "650000",
"hotCity": false,
"cityShortPY": "SHZS"
},
{
"name": "阿拉尔市",
"id": "999659002",
"cityPinyin": "alaershi",
"provinceId": "650000",
"hotCity": false,
"cityShortPY": "ALES"
},
{
"name": "图木舒克市",
"id": "999659003",
"cityPinyin": "tumushukeshi",
"provinceId": "650000",
"hotCity": false,
"cityShortPY": "TMSKS"
},
{
"name": "五家渠市",
"id": "999659004",
"cityPinyin": "wujiaqushi",
"provinceId": "650000",
"hotCity": false,
"cityShortPY": "WJQS"
},
{
"name": "台北市",
"id": "710100",
"cityPinyin": "taibeishi",
"provinceId": "710000",
"hotCity": false,
"cityShortPY": "TBS"
},
{
"name": "高雄市",
"id": "710200",
"cityPinyin": "gaoxiongshi",
"provinceId": "710000",
"hotCity": false,
"cityShortPY": "GXS"
},
{
"name": "台南市",
"id": "710300",
"cityPinyin": "tainanshi",
"provinceId": "710000",
"hotCity": false,
"cityShortPY": "TNS"
},
{
"name": "台中市",
"id": "710400",
"cityPinyin": "taizhongshi",
"provinceId": "710000",
"hotCity": false,
"cityShortPY": "TZS"
},
{
"name": "金门县",
"id": "710500",
"cityPinyin": "jinmenxian",
"provinceId": "710000",
"hotCity": false,
"cityShortPY": "JMX"
},
{
"name": "南投县",
"id": "710600",
"cityPinyin": "nantouxian",
"provinceId": "710000",
"hotCity": false,
"cityShortPY": "NTX"
},
{
"name": "基隆市",
"id": "710700",
"cityPinyin": "jilongshi",
"provinceId": "710000",
"hotCity": false,
"cityShortPY": "JLS"
},
{
"name": "新竹市",
"id": "710800",
"cityPinyin": "xinzhushi",
"provinceId": "710000",
"hotCity": false,
"cityShortPY": "XZS"
},
{
"name": "嘉义市",
"id": "710900",
"cityPinyin": "jiayishi",
"provinceId": "710000",
"hotCity": false,
"cityShortPY": "JYS"
},
{
"name": "新北市",
"id": "999711100",
"cityPinyin": "xinbeishi",
"provinceId": "710000",
"hotCity": false,
"cityShortPY": "XBS"
},
{
"name": "宜兰县",
"id": "999711200",
"cityPinyin": "yilanxian",
"provinceId": "710000",
"hotCity": false,
"cityShortPY": "YLX"
},
{
"name": "新竹县",
"id": "999711300",
"cityPinyin": "xinzhuxian",
"provinceId": "710000",
"hotCity": false,
"cityShortPY": "XZX"
},
{
"name": "桃园县",
"id": "999711400",
"cityPinyin": "taoyuanxian",
"provinceId": "710000",
"hotCity": false,
"cityShortPY": "TYX"
},
{
"name": "苗栗县",
"id": "999711500",
"cityPinyin": "miaolixian",
"provinceId": "710000",
"hotCity": false,
"cityShortPY": "MLX"
},
{
"name": "彰化县",
"id": "999711700",
"cityPinyin": "zhanghuaxian",
"provinceId": "710000",
"hotCity": false,
"cityShortPY": "ZHX"
},
{
"name": "嘉义县",
"id": "999711900",
"cityPinyin": "jiayixian",
"provinceId": "710000",
"hotCity": false,
"cityShortPY": "JYX"
},
{
"name": "云林县",
"id": "999712100",
"cityPinyin": "yunlinxian",
"provinceId": "710000",
"hotCity": false,
"cityShortPY": "YLX"
},
{
"name": "屏东县",
"id": "999712400",
"cityPinyin": "pingdongxian",
"provinceId": "710000",
"hotCity": false,
"cityShortPY": "PDX"
},
{
"name": "台东县",
"id": "999712500",
"cityPinyin": "taidongxian",
"provinceId": "710000",
"hotCity": false,
"cityShortPY": "TDX"
},
{
"name": "花莲县",
"id": "999712600",
"cityPinyin": "hualianxian",
"provinceId": "710000",
"hotCity": false,
"cityShortPY": "HLX"
},
{
"name": "澎湖县",
"id": "999712700",
"cityPinyin": "penghuxian",
"provinceId": "710000",
"hotCity": false,
"cityShortPY": "PHX"
},
{
"name": "香港岛",
"id": "810100",
"cityPinyin": "xianggangdao",
"provinceId": "810000",
"hotCity": false,
"cityShortPY": "XGD"
},
{
"name": "九龙",
"id": "810200",
"cityPinyin": "jiulong",
"provinceId": "810000",
"hotCity": false,
"cityShortPY": "JL"
},
{
"name": "新界",
"id": "810300",
"cityPinyin": "xinjie",
"provinceId": "810000",
"hotCity": false,
"cityShortPY": "XJ"
},
{
"name": "澳门半岛",
"id": "820100",
"cityPinyin": "aomenbandao",
"provinceId": "820000",
"hotCity": false,
"cityShortPY": "AMBD"
},
{
"name": "离岛",
"id": "820200",
"cityPinyin": "lidao",
"provinceId": "820000",
"hotCity": false,
"cityShortPY": "LD"
},
{
"name": "海外",
"id": "990100",
"cityPinyin": "haiwai",
"provinceId": "990000",
"hotCity": false,
"cityShortPY": "HW"
}
]
}
|
/**
* Lado derecho parte del buscador e interaccion con
* Redux
*/
import React from 'react'
import { connect } from 'react-redux'
import PrimeraParte from './PrimeraParte/PrimeraParte'
import Segunda from './Segunda/Segunda'
import './SideB.css'
import { objectCreator } from '../../Redux/Actions/Artista'
const SideB = props => {
//Funcion para recibir los datos se le agrego un if por si llega undefined
// utilizamos la funcion dispatch para enviar los datos al estado de Redux
const CreateCard = value => {
console.log(value)
if( value !== undefined ){
props.objectCreator(value)
}}
return (
<section className="sideb">
<PrimeraParte CreateCard={CreateCard}></PrimeraParte>
<Segunda></Segunda>
</section>
)
}
// Redux dispatch
const mapDispatchToprops = dispatch => ({
objectCreator: value => dispatch( objectCreator(value) )
})
export default connect(null, mapDispatchToprops)(SideB)
|
'use strict';
const clean = require('./tasks/clean');
const stylus = require('./tasks/stylus');
const webpack = require('./tasks/webpack');
clean(['public/css/*']).then(() => {
stylus([
'client/css/*/*.styl',
'!client/css/commons/**/*.styl',
'!client/css/utils/**/*.styl',
'!client/css/partials/**/*.styl',
], 'public/css');
});
clean(['public/js/*']).then(() => {
webpack('client/js/controllers/**/*.js', 'public/js');
});
|
import { mutation, string, db } from 'joiql-mongo'
import request from 'superagent'
import { Converter } from 'csvtojson'
import { camelCase, mapKeys, find } from 'lodash'
import { teamNameToID } from '../views/lib'
const Slack = require('slack-api').promisify()
const { SHEETS_URL, SEATING_URL, SLACK_AUTH_TOKEN } = process.env
const convert = (data) =>
new Promise((resolve, reject) => {
new Converter().fromString(data, (err, json) => {
if (err) reject(err)
else resolve(json)
})
})
const updateTeamRanks = (members) => {
members.forEach(m => {
m.teamRank = getNumberOfManagers(members, m, 0)
})
}
const getNumberOfManagers = (members, member, depth) => {
if (!getManager(members, member)) { return depth }
return getNumberOfManagers(members, getManager(members, member), depth + 1)
}
const getManager = (members, member) => find(members, (m) => m.name === member.reportsTo)
const updateTeamMembers = async () => {
// Remove old entries
await db.members.remove()
const seats = await db.seatings.find().toArray()
const response = await Slack.users.list({ token: SLACK_AUTH_TOKEN })
const slackMembers = response.members
const res = await request.get(SHEETS_URL)
const parsed = await convert(res.text)
const members = parsed
.map((obj) => mapKeys(obj, (v, k) => camelCase(k)))
.map((member) => {
// Use email prefix as a global handle for pretty URLs
member.handle = member.email.replace('@', '')
// Generate a team ID for URLs
member.teamID = teamNameToID(member.team)
member.subteamID = teamNameToID(member.subteam)
member.productTeamID = teamNameToID(member.productTeam)
// Hook Up Slack IDs
const slackMember = find(slackMembers, m => m.profile && m.profile.email && m.profile.email.startsWith(member.email))
if (slackMember) { member.slackID = slackMember.id } else { console.error(`Could not find Slack ID for ${member.name}`) }
// Find a seat and update it if we need to
member.seat = find(seats, s => s.id === member.seat)
if (member.seat) {
db.seatings.update({ _id: member.seat._id }, { $set: {
occupier_name: member.handle,
occupier_handle: member.handle
} })
member.floor_id = member.seat.floor_id
}
return member
})
updateTeamRanks(members)
await Promise.all(members.map((member) => db.members.save(member)))
}
const updateTeamSeating = async () => {
await db.seatings.remove()
const res = await request.get(SEATING_URL)
const parsed = await convert(res.text)
const seats = parsed.map(f => ({
id: f.seat_id,
url: f.floor_plan_url,
name: f.floor_name,
floor_id: f.floor_name && teamNameToID(f.floor_name),
x: f.x,
y: f.y,
status: f.status
}))
await Promise.all(seats.map((seat) => db.seatings.save(seat)))
}
export default mutation('sync', string(), async (ctx) => {
await updateTeamSeating()
await updateTeamMembers()
ctx.res.sync = 'success'
})
|
import React from 'react';
import guid from '../utils/guid';
import boards from '../utils/boards';
import Icon from './Icon';
const IconList = React.createClass({
getInitialState: function() {
return boards;
},
handleNewBoard: function(args) {
console.log(args);
function newBoard(opts) {
const board = {
title: opts.title,
id: guid(),
decks: opts.decks
};
return board;
};
const b = newBoard(args);
let boards = this.state.boards;
boards.push(b);
this.setState({
boards: boards,
});
},
handleDeleteBoard: function(data) {
console.log(data);
const b = data;
let boards = this.state.boards;
let board = 0;
for (var i = 0; i < boards.length; i++) {
if (boards[i].id == data) {
board = i;
};
}
boards.splice(board, 1);
this.setState({
boards: boards,
});
},
render: function() {
const boards = this.props.boards.map((board) => {
return (
<Icon
key={board.id}
id={board.id}
title={board.title}
onDeleteBoard={this.handleDeleteBoard}
/>
);
});
return (
<div>
{boards}
<BoardInput
onClick={this.handleNewBoard}
decks={[]}
/>
</div>
);
},
});
export default IconList;
|
import * as d3 from 'd3';
function gridData(dx, dy, step, vertical, horizont, color) {
const everyVertical = vertical.length;
const everyHorizont = horizont.length;
dx = dx % (step * everyHorizont);
dy = dy % (step * everyVertical);
const horizontalLines = d3
.range(window.innerWidth/step + 2*everyHorizont)
.map((x) => {return {
x1: (x-everyHorizont) * step + dx,
x2: (x-everyHorizont) * step + dx,
y1: 0,
y2: window.innerHeight,
stroke: color[ horizont[ x % everyHorizont ] ]
};});
const verticalLines = d3
.range(window.innerHeight/step + 2*everyVertical)
.map((y) => {return {
x1: 0,
x2: window.innerWidth,
y1: (y-everyVertical) * step + dy,
y2: (y-everyVertical) * step + dy,
stroke: color[ vertical[ y % everyVertical ] ]
};})
return horizontalLines
.concat(verticalLines)
.sort(
(a, b) =>
Object.values(color).indexOf(a.stroke) <
Object.values(color).indexOf(b.stroke)
);
}
export function Grid(svg, config) {
const vertical = ((config||{}).pattern||{}).vertical || 'bsssssss';
const horizontal = ((config||{}).pattern||{}).horizontal || 'bsssssss';
const color = (config||{}).color||{};
color.b = color.b || '#3c529e';
color.s = color.s || '#233671';
color.bg = color.bg || '#1c2e60';
svg.style('background-color', color.bg);
const space = (config||{}).space || 20;
const grid = svg.append('g');
return {
update(transform) {
const x = (transform||{}).x || 0,
y = (transform||{}).y || 0,
k = (transform||{}).k || 1;
var lines = grid
.selectAll('line')
.data(gridData(
x, y,
space * k,
vertical,
horizontal,
color
));
lines
.enter()
.append("line")
.merge(lines)
.attr('x1', (d) => d.x1 )
.attr('y1', (d) => d.y1 )
.attr('x2', (d) => d.x2 )
.attr('y2', (d) => d.y2 )
.attr('stroke-width', 1 )
.attr('stroke', (d) => d.stroke );
lines.exit().remove();
}
}
}
|
import * as types from '../actions/types';
import {combineReducers} from 'redux';
import {reducer as formReducer} from 'redux-form';
const initialState = {
rates : [],
supported : [],
orders : [],
};
function dataReducer( state = initialState, action ){
switch ( action.type ) {
case types.GETRATES:
return {
...state,
rates : action.payload
};
case types.GETORDERS:
return {
...state,
orders : action.payload
};
case types.GETSUPPORTED:
return {
...state,
supported : action.payload
};
default:
return state;
}
}
export default combineReducers({
data : dataReducer,
form : formReducer
});
|
import React, { Component } from "react";
import ModalExample from "./modal";
class Paciente extends Component {
render() {
const { nombre, apmat, appat, rut } = this.props.paciente;
return (
<tr>
<th scope="row">{nombre}</th>
<td>{appat}</td>
<td>{apmat}</td>
<td>{rut}</td>
<td>
<ModalExample />
</td>
</tr>
);
}
getCategorizationName() {
const { categorizacion } = this.props.paciente;
let categoria = "";
switch (categorizacion) {
case 0:
categoria = "Sin asignar";
break;
case 1:
categoria = "Grave";
break;
case 2:
categoria = "Critico";
break;
default:
break;
}
return categoria;
}
getBadgeClasses() {
let classes = "badge badge-pill m-2 badge-";
const { categorizacion } = this.props.paciente;
switch (categorizacion) {
case 0:
classes += "info";
break;
case 1:
classes += "warning";
break;
case 2:
classes += "danger";
break;
default:
break;
}
return classes;
}
}
export default Paciente;
|
import {TweenLite, Power3} from 'gsap/TweenMax';
let ease = Power3.easeOut;
let duration = 1;
let delay = .5;
export default {
expand(cols, width) {
TweenLite.set(cols[1], {'width': width * 2});
TweenLite.from(cols, duration, {
transformOrigin: 'left',
scaleX: 0,
delay,
ease
});
},
shrink(cols) {
return new Promise(function (resolve, reject) {
TweenLite.to(cols, duration, {
transformOrigin: 'left', scaleX: 0, ease
});
TweenLite.delayedCall(duration - .6, () => {
resolve();
});
});
}
}
|
const jwt = require("jsonwebtoken");
const config = require("../config");
/**
* Generate the token
* @param {Object} user - user object
*/
exports.generateToken = (user) => {
const body = { id: user.id, email: user.email };
// Sign the JWT token and populate the payload with the user email and id
const token = jwt.sign({ user: body }, config.secret);
// Send back the token to the user
return token;
};
|
if (typeof(JS_LIB_LOADED)=='boolean')
{
var JS_POSTREQUEST_FILE = "postRequest.js";
var JS_POSTREQUEST_LOADED = true;
include(jslib_dictionary);
function
PostRequest (baseuri)
{
this.baseu = baseuri;
this.parameters = new Dictionary();
}
PostRequest.prototype =
{
baseu: null,
method: "POST",
parameters: null,
cnttype: null,
cntenc: null,
put: function (key,value)
{
this.parameters.put(key,value);
return this;
},
getRequestUri: function ()
{
var uri = "";
uri += this.baseu;
return uri;
},
getRequestMethod: function () { return this.method; },
setRequestHeaders: function (p)
{
p.setRequestHeader("Content-type","application/x-www-form-urlencoded");
},
getBody: function ()
{
var uri = "";
this.parameters.resetIterator();
while (this.parameters.hasMoreElements())
{
var param = this.parameters.next();
if (this.parameters.hasMoreElements()) {
uri+= escape(param.key)+"="+escape(param.value)+"&";
} else {
uri+= escape(param.key)+"="+escape(param.value);
break;
}
}
return uri;
}
}
jslibLoadMsg(JS_POSTREQUEST_FILE);
} else { dump("Load Failure: postRequest.js\n"); }
|
import React, { Component } from "react";
import {
View,
StyleSheet,
TouchableOpacity,
AsyncStorage,
Alert,
ScrollView,
Text,
TextInput,
Image,
FlatList,
ActivityIndicator
} from "react-native";
import StarRating from "react-native-star-rating";
import { Input, InputProps, Button } from "react-native-ui-kitten";
import AntIcon from "react-native-vector-icons/AntDesign";
import { RadioGroup } from "react-native-btr";
import CustomHeader from "../Header/CustomHeader";
import * as CONSTANT from "../Constants/Constant";
import axios from "axios";
import MultiSelect from "react-native-multiple-select";
import { withNavigation, DrawerActions } from "react-navigation";
import {
Collapse,
CollapseHeader,
CollapseBody
} from "accordion-collapse-react-native";
class LocationDetail extends Component {
constructor(props) {
super(props);
this.state = {
fetchLocation: [],
fetchLocationMondaySlots: [],
fetchLocationTuesdaySlots: [],
fetchLocationWednesdaySlots: [],
fetchLocationThursdaySlots: [],
fetchLocationFridaySlots: [],
fetchLocationSaturdaySlots: [],
fetchLocationSundaySlots: [],
projectHospitalKnown: "",
projectIntervalKnown: "",
projectDurationKnown: "",
projectSlotsKnown: "",
projectDaysKnown: "",
projectSelectedServiceKnown: "",
projectprojectEndTimeKnown: "",
projectprojectStartTimeKnown: "",
selectedHours: 0,
selectedMinutes: 0,
fee: "",
customSpaces: "",
Monday: "mon",
service: [],
isLoading: true,
radioButtonsforStartAsMon: [
{
label: "1",
value: "1",
checked: true,
color: "#323232",
disabled: false,
width: "33.33%",
size: 6
},
{
label: "2",
value: "2",
checked: false,
color: "#323232",
disabled: false,
width: "33.33%",
size: 6
},
{
label: "Other",
value: "other",
checked: false,
color: "#323232",
disabled: false,
width: "33.33%",
size: 6
}
],
radioButtonsforStartAsTue: [
{
label: "1",
value: "1",
checked: true,
color: "#323232",
disabled: false,
width: "33.33%",
size: 6
},
{
label: "2",
value: "2",
checked: false,
color: "#323232",
disabled: false,
width: "33.33%",
size: 6
},
{
label: "Other",
value: "other",
checked: false,
color: "#323232",
disabled: false,
width: "33.33%",
size: 6
}
],
radioButtonsforStartAsWed: [
{
label: "1",
value: "1",
checked: true,
color: "#323232",
disabled: false,
width: "33.33%",
size: 6
},
{
label: "2",
value: "2",
checked: false,
color: "#323232",
disabled: false,
width: "33.33%",
size: 6
},
{
label: "Other",
value: "other",
checked: false,
color: "#323232",
disabled: false,
width: "33.33%",
size: 6
}
],
radioButtonsforStartAsThur: [
{
label: "1",
value: "1",
checked: true,
color: "#323232",
disabled: false,
width: "33.33%",
size: 6
},
{
label: "2",
value: "2",
checked: false,
color: "#323232",
disabled: false,
width: "33.33%",
size: 6
},
{
label: "Other",
value: "other",
checked: false,
color: "#323232",
disabled: false,
width: "33.33%",
size: 6
}
],
radioButtonsforStartAsFri: [
{
label: "1",
value: "1",
checked: true,
color: "#323232",
disabled: false,
width: "33.33%",
size: 6
},
{
label: "2",
value: "2",
checked: false,
color: "#323232",
disabled: false,
width: "33.33%",
size: 6
},
{
label: "Other",
value: "other",
checked: false,
color: "#323232",
disabled: false,
width: "33.33%",
size: 6
}
],
radioButtonsforStartAsSat: [
{
label: "1",
value: "1",
checked: true,
color: "#323232",
disabled: false,
width: "33.33%",
size: 6
},
{
label: "2",
value: "2",
checked: false,
color: "#323232",
disabled: false,
width: "33.33%",
size: 6
},
{
label: "Other",
value: "other",
checked: false,
color: "#323232",
disabled: false,
width: "33.33%",
size: 6
}
],
radioButtonsforStartAsSun: [
{
label: "1",
value: "1",
checked: true,
color: "#323232",
disabled: false,
width: "33.33%",
size: 6
},
{
label: "2",
value: "2",
checked: false,
color: "#323232",
disabled: false,
width: "33.33%",
size: 6
},
{
label: "Other",
value: "other",
checked: false,
color: "#323232",
disabled: false,
width: "33.33%",
size: 6
}
]
};
}
componentDidMount() {
this.fetchLocationDetail();
this.ProjectIntervalSpinner();
}
fetchLocationDetail = async () => {
const { params } = this.props.navigation.state;
const id = await AsyncStorage.getItem("projectUid");
const response = await fetch(
CONSTANT.BaseUrl +
"team/get_team_details?team_id=" +
JSON.stringify(params.id) +
"&user_id=" +
id
);
const json = await response.json();
if (
Array.isArray(json) &&
json[0] &&
json[0].type &&
json[0].type === "error"
) {
this.setState({ fetchLocation: [], isLoading: false }); // empty data set
} else {
this.setState({ fetchLocation: json[0] });
this.setState({ fetchLocationMondaySlots: json[0].slots.mon });
this.setState({ fetchLocationTuesdaySlots: json[0].slots.tue });
this.setState({ fetchLocationWednesdaySlots: json[0].slots.wed });
this.setState({ fetchLocationThursdaySlots: json[0].slots.thu });
this.setState({ fetchLocationFridaySlots: json[0].slots.fri });
this.setState({ fetchLocationSaturdaySlots: json[0].slots.sat });
this.setState({
fetchLocationSundaySlots: json[0].slots.sun,
isLoading: false
});
}
};
// To get all Intervals
ProjectIntervalSpinner = async () => {
const { params } = this.props.navigation.state;
return fetch(CONSTANT.BaseUrl + "taxonomies/get_list?list=intervals", {
method: "GET",
headers: {
Accept: "application/json",
"Content-Type": "application/json"
}
})
.then(response => response.json())
.then(responseJson => {
let projectInterval = responseJson;
this.setState({ projectInterval }, this.ProjectDurationSpinner);
})
.catch(error => {
console.error(error);
});
};
// To get duration list
ProjectDurationSpinner = async () => {
const { params } = this.props.navigation.state;
return fetch(CONSTANT.BaseUrl + "taxonomies/get_list?list=durations", {
method: "GET",
headers: {
Accept: "application/json",
"Content-Type": "application/json"
}
})
.then(response => response.json())
.then(responseJson => {
let projectDuration = responseJson;
this.setState(
{
projectDuration
},
this.ProjectStartTimeSpinner
);
})
.catch(error => {
console.error(error);
});
};
// To get all slots list
ProjectStartTimeSpinner = async () => {
const { params } = this.props.navigation.state;
return fetch(CONSTANT.BaseUrl + "taxonomies/get_list?list=time", {
method: "GET",
headers: {
Accept: "application/json",
"Content-Type": "application/json"
}
})
.then(response => response.json())
.then(responseJson => {
let projectStartTime = responseJson;
this.setState(
{
projectStartTime
},
this.ProjectEndTimeSpinner
);
})
.catch(error => {
console.error(error);
});
};
// To get all slots list
ProjectEndTimeSpinner = async () => {
const { params } = this.props.navigation.state;
return fetch(CONSTANT.BaseUrl + "taxonomies/get_list?list=time", {
method: "GET",
headers: {
Accept: "application/json",
"Content-Type": "application/json"
}
})
.then(response => response.json())
.then(responseJson => {
let projectEndTime = responseJson;
this.setState(
{
projectEndTime
},
this.ProjectServicesSpinner
);
})
.catch(error => {
console.error(error);
});
};
AddSlotsForMonady = async () => {
Alert.alert("I am in ");
let selectedItemforStartAsMon = this.state.radioButtonsforStartAsMon.find(
e => e.checked == true
);
selectedItemforStartAsMon = selectedItemforStartAsMon
? selectedItemforStartAsMon.value
: this.state.radioButtonsforStartAsMon[0].value;
const Uid = await AsyncStorage.getItem("projectUid");
const {
title,
desc,
base64_string,
articleCategoryKnown,
name,
type,
path,
customSpaces,
fee,
service
} = this.state;
const { params } = this.props.navigation.state;
axios
.post(CONSTANT.BaseUrl + "team/update_slot", {
start_time: this.state.projectprojectStartTimeKnown.toString(),
end_time: this.state.projectprojectEndTimeKnown.toString(),
intervals: this.state.projectIntervalKnown.toString(),
durations: this.state.projectDurationKnown.toString(),
spaces: selectedItemforStartAsMon,
week_day: "mon",
custom_spaces: customSpaces,
user_id: Uid,
post_id: params.id
})
.then(async response => {
if (response.status === 200) {
this.setState({ isUpdatingLoader: false });
Alert.alert("Updated Successfully", response.data.message);
this.fetchLocationDetail();
console.log(response);
} else if (response.status === 203) {
Alert.alert("Error", response.data.message);
console.log(response);
}
})
.catch(error => {
Alert.alert(error);
console.log(error);
});
};
AddSlotsForTuesday = () => {};
AddSlotsForWednesday = () => {};
AddSlotsForThursday = () => {};
AddSlotsForFriday = () => {};
AddSlotsForSaturday = () => {};
AddSlotsForSunday = () => {};
DeleteAllSlotsForMonday = async () => {
const Uid = await AsyncStorage.getItem("projectUid");
const {
title,
desc,
base64_string,
articleCategoryKnown,
name,
type,
path,
customSpaces,
fee,
service
} = this.state;
const { params } = this.props.navigation.state;
axios
.post(CONSTANT.BaseUrl + "team/remove_slot", {
day: "mon",
user_id: Uid,
id: params.id
})
.then(async response => {
if (response.status === 200) {
this.setState({ isUpdatingLoader: false });
Alert.alert("Updated Successfully", response.data.message);
this.fetchLocationDetail();
console.log(response);
} else if (response.status === 203) {
Alert.alert("Error", response.data.message);
console.log(response);
}
})
.catch(error => {
Alert.alert(error);
console.log(error);
});
};
DeleteAllSlotsForTuesday = () => {};
DeleteAllSlotsForWednesday = () => {};
DeleteAllSlotsForThursday = () => {};
DeleteAllSlotsForFriday = () => {};
DeleteAllSlotsForSaturday = () => {};
DeleteAllSlotsForSunday = () => {};
render() {
let selectedItemforStartAsMon = this.state.radioButtonsforStartAsMon.find(
e => e.checked == true
);
selectedItemforStartAsMon = selectedItemforStartAsMon
? selectedItemforStartAsMon.value
: this.state.radioButtonsforStartAsMon[0].value;
// const {selectedHours, selectedMinutes} = this.state;
let selectedItemforStartAsTue = this.state.radioButtonsforStartAsTue.find(
e => e.checked == true
);
selectedItemforStartAsTue = selectedItemforStartAsTue
? selectedItemforStartAsTue.value
: this.state.radioButtonsforStartAsTue[0].value;
// const {selectedHours, selectedMinutes} = this.state;
let selectedItemforStartAsWed = this.state.radioButtonsforStartAsWed.find(
e => e.checked == true
);
selectedItemforStartAsWed = selectedItemforStartAsWed
? selectedItemforStartAsWed.value
: this.state.radioButtonsforStartAsWed[0].value;
// const {selectedHours, selectedMinutes} = this.state;
let selectedItemforStartAsThur = this.state.radioButtonsforStartAsThur.find(
e => e.checked == true
);
selectedItemforStartAsThur = selectedItemforStartAsThur
? selectedItemforStartAsThur.value
: this.state.radioButtonsforStartAsThur[0].value;
// const {selectedHours, selectedMinutes} = this.state;
let selectedItemforStartAsFri = this.state.radioButtonsforStartAsFri.find(
e => e.checked == true
);
selectedItemforStartAsFri = selectedItemforStartAsFri
? selectedItemforStartAsFri.value
: this.state.radioButtonsforStartAsFri[0].value;
// const {selectedHours, selectedMinutes} = this.state;
let selectedItemforStartAsSat = this.state.radioButtonsforStartAsSat.find(
e => e.checked == true
);
selectedItemforStartAsSat = selectedItemforStartAsSat
? selectedItemforStartAsSat.value
: this.state.radioButtonsforStartAsSat[0].value;
// const {selectedHours, selectedMinutes} = this.state;
let selectedItemforStartAsSun = this.state.radioButtonsforStartAsSun.find(
e => e.checked == true
);
selectedItemforStartAsSun = selectedItemforStartAsSun
? selectedItemforStartAsSun.value
: this.state.radioButtonsforStartAsSun[0].value;
// const {selectedHours, selectedMinutes} = this.state;
const {
fetchLocation,
fetchLocationMondaySlots,
fetchLocationTuesdaySlots,
fetchLocationThursdaySlots,
fetchLocationWednesdaySlots,
fetchLocationFridaySlots,
fetchLocationSaturdaySlots,
fetchLocationSundaySlots,
isLoading
} = this.state;
return (
<View style={styles.container}>
<CustomHeader headerText={"Location Detail"} />
{isLoading ? (
<View style={{ justifyContent: "center", height: "100%" }}>
<ActivityIndicator
size="small"
color={CONSTANT.primaryColor}
style={{
height: 30,
width: 30,
borderRadius: 60,
alignContent: "center",
alignSelf: "center",
justifyContent: "center",
backgroundColor: "#fff",
elevation: 5
}}
/>
</View>
) : null}
{this.state.fetchLocation && (
<ScrollView>
<View
style={{
backgroundColor: "#fff",
borderRadius: 6,
margin: 5,
flexDirection: "row",
padding: 10,
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.2,
shadowColor: "#000",
elevation: 3
}}
>
<View>
<Image
style={{ width: 75, height: 75, borderRadius: 6 }}
source={{ uri: fetchLocation.hospital_img }}
/>
</View>
<View
style={{
flexDirection: "column",
margin: 10,
justifyContent: "center"
}}
>
<Text style={{ color: "#3FABF3", fontSize: 13 , fontFamily:CONSTANT.PoppinsMedium, }}>
{fetchLocation.hospital_status}
</Text>
<Text
style={{
color: "#3D4461",
fontFamily:CONSTANT.PoppinsBold,
fontSize: 16
}}
>
{fetchLocation.hospital_name}
</Text>
<FlatList
style={{}}
data={this.state.fetchLocation.week_days}
ListEmptyComponent={this._listEmptyComponent}
keyExtractor={(x, i) => i.toString()}
renderItem={({ item }) => (
<View>
<Text
style={{
color: "#858585",
fontSize: 12,
marginRight: 5,
fontFamily:CONSTANT.PoppinsMedium,
}}
>
{item}
</Text>
</View>
)}
horizontal={true}
/>
</View>
</View>
<Text
style={{
color: "#3d4461",
width: "70%",
fontSize: 18,
fontFamily:CONSTANT.PoppinsBold,
marginBottom: 15,
marginLeft: 10,
marginTop: 10
}}
>
Days I Offer My Services:
</Text>
<View style={{ paddingBottom: 10 }}>
{fetchLocationMondaySlots && (
<Collapse>
<CollapseHeader
style={{ height: 70, marginTop: 5, marginBottom: 5 }}
>
<View
style={{
backgroundColor: "#ffffff",
elevation: 3,
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.2,
shadowColor: "#000",
marginRight: 10,
marginTop: 5,
marginLeft: 10,
marginBottom: 5,
borderRadius: 4,
height: 70
}}
>
<TouchableOpacity>
<View style={styles.mainLayoutServices}>
<Text
numberOfLines={1}
style={styles.mainServiceName}
>
Monday
</Text>
</View>
</TouchableOpacity>
<AntIcon
name="edit"
color={"#2FBC9C"}
size={17}
style={{
alignSelf: "flex-end",
marginTop: -62,
padding: 20
}}
/>
</View>
</CollapseHeader>
<CollapseBody style={{ width: "100%" }}>
<View>
<View
style={{
flexDirection: "row",
alignSelf: "center",
marginTop: 10
}}
>
{fetchLocationMondaySlots.length != 0 && (
<TouchableOpacity
onPress={this.DeleteAllSlotsForMonday}
style={{
alignItems: "center",
height: 40,
margin: 10,
borderRadius: 4,
width: "25%",
alignSelf: "center",
backgroundColor: "#F95851"
}}
>
<Text
style={{
alignSelf: "center",
alignItems: "center",
textAlign: "center",
color: "#fff",
paddingTop: 10,
fontFamily:CONSTANT.PoppinsMedium,
}}
>
Delete All
</Text>
</TouchableOpacity>
)}
</View>
<FlatList
style={{
alignSelf: "center",
marginLeft: 10,
marginRight: 10
}}
data={this.state.fetchLocationMondaySlots}
extraData={this.state}
renderItem={({ item, index }) => (
<TouchableOpacity
onPress={() => this.selectedSlotData(item)}
style={{
flexDirection: "column",
margin: 3,
width: "48%",
backgroundColor: "#fff",
borderRadius: 5,
height: 45,
borderColor: CONSTANT.primaryColor,
borderWidth: 0.6,
justifyContent: "center",
alignItems: "center"
}}
>
<Text
style={{
fontFamily:CONSTANT.PoppinsBold,
fontSize: 13,
marginHorizontal: 10
}}
>
{item.start_time} - {item.end_time}
</Text>
<Text style={{ fontSize: 10 , fontFamily:CONSTANT.PoppinsMedium,}}>
Space: {item.spaces}
</Text>
</TouchableOpacity>
)}
numColumns={2}
/>
</View>
<View
style={{
backgroundColor: "#f7f7f7",
borderRadius: 5,
elevation: 5,
margin: 10,
paddingTop: 10
}}
>
<Text
style={{
color: "#3d4461",
width: "70%",
fontSize: 18,
fontFamily:CONSTANT.PoppinsBold,
marginBottom: 15,
marginLeft: 10,
marginTop: 10
}}
>
Add New Slot:
</Text>
<View
style={{
marginLeft: 10,
marginRight: 10,
marginBottom: 10
}}
>
<MultiSelect
ref={component => {
this.multiSelect = component;
}}
onSelectedItemsChange={value =>
this.setState({
projectIntervalKnown: value
})
}
uniqueKey="key"
items={this.state.projectInterval}
selectedItems={this.state.projectIntervalKnown}
borderBottomWidth={0}
single={true}
searchInputPlaceholderText="Pick Interval..."
selectText="Pick Interval"
styleMainWrapper={{
backgroundColor: "#fff",
borderRadius: 4,
marginTop: 10
}}
styleDropdownMenuSubsection={{
backgroundColor: "#fff",
paddingRight: -7,
height: 60,
paddingLeft: 10,
borderWidth: 0.6,
borderColor: "#fff",
borderColor: "#dddddd",
borderRadius: 4
}}
displayKey="val"
submitButtonText="Submit"
/>
</View>
<View
style={{
marginLeft: 10,
marginRight: 10,
marginBottom: 10
}}
>
<MultiSelect
ref={component => {
this.multiSelect = component;
}}
onSelectedItemsChange={value =>
this.setState({
projectDurationKnown: value
})
}
uniqueKey="key"
items={this.state.projectDuration}
selectedItems={this.state.projectDurationKnown}
borderBottomWidth={0}
single={true}
searchInputPlaceholderText="Pick Duration..."
selectText="Pick Duration"
styleMainWrapper={{
backgroundColor: "#fff",
borderRadius: 4,
marginTop: 10
}}
styleDropdownMenuSubsection={{
backgroundColor: "#fff",
paddingRight: -7,
height: 60,
paddingLeft: 10,
borderWidth: 0.6,
borderColor: "#fff",
borderColor: "#dddddd",
borderRadius: 4
}}
displayKey="val"
submitButtonText="Submit"
/>
</View>
<View
style={{
marginLeft: 10,
marginRight: 10,
marginBottom: 10
}}
>
<MultiSelect
ref={component => {
this.multiSelect = component;
}}
onSelectedItemsChange={value =>
this.setState({
projectprojectStartTimeKnown: value
})
}
uniqueKey="key"
items={this.state.projectStartTime}
selectedItems={
this.state.projectprojectStartTimeKnown
}
borderBottomWidth={0}
single={true}
searchInputPlaceholderText="Pick Start Time..."
selectText="Pick Start Time"
styleMainWrapper={{
backgroundColor: "#fff",
borderRadius: 4,
marginTop: 10
}}
styleDropdownMenuSubsection={{
backgroundColor: "#fff",
paddingRight: -7,
height: 60,
paddingLeft: 10,
borderWidth: 0.6,
borderColor: "#fff",
borderColor: "#dddddd",
borderRadius: 4
}}
displayKey="val"
submitButtonText="Submit"
/>
</View>
<View
style={{
marginLeft: 10,
marginRight: 10,
marginBottom: 10
}}
>
<MultiSelect
ref={component => {
this.multiSelect = component;
}}
onSelectedItemsChange={value =>
this.setState({
projectprojectEndTimeKnown: value
})
}
uniqueKey="key"
items={this.state.projectEndTime}
selectedItems={this.state.projectprojectEndTimeKnown}
borderBottomWidth={0}
single={true}
searchInputPlaceholderText="Pick End Time..."
selectText="Pick End Time"
styleMainWrapper={{
backgroundColor: "#fff",
borderRadius: 4,
marginTop: 10
}}
styleDropdownMenuSubsection={{
backgroundColor: "#fff",
paddingRight: -7,
height: 60,
paddingLeft: 10,
borderWidth: 0.6,
borderColor: "#fff",
borderColor: "#dddddd",
borderRadius: 4
}}
displayKey="val"
submitButtonText="Submit"
/>
</View>
<Text
style={{
color: "#3d4461",
width: "70%",
fontSize: 18,
fontFamily:CONSTANT.PoppinsBold,
marginBottom: 15,
marginLeft: 10,
marginTop: 10
}}
>
Assign Appointment Spaces:
</Text>
<RadioGroup
color={CONSTANT.primaryColor}
labelStyle={{ fontSize: 14 }}
radioButtons={this.state.radioButtonsforStartAsMon}
onPress={radioButtons =>
this.setState({ radioButtons })
}
style={{
paddingTop: 0,
flexDirection: "row",
marginBottom: 10,
marginTop: 0,
marginLeft: 25,
display: "flex",
width: "100%",
alignSelf: "center",
alignContent: "center",
textAlign: "center"
}}
/>
{selectedItemforStartAsMon == "other" && (
<TextInput
underlineColorAndroid="transparent"
placeholderTextColor="#7F7F7F"
placeholder="Other Value"
style={styles.TextInputLayout}
onChangeText={customSpaces =>
this.setState({ customSpaces })
}
/>
)}
<TouchableOpacity
onPress={this.AddSlotsForMonady}
style={{
alignItems: "center",
height: 40,
margin: 10,
borderRadius: 4,
width: "25%",
alignSelf: "center",
backgroundColor: "#2FBC9C"
}}
>
<Text
style={{
alignSelf: "center",
alignItems: "center",
textAlign: "center",
color: "#fff",
paddingTop: 10,
fontFamily: CONSTANT.PoppinsMedium
}}
>
Add More
</Text>
</TouchableOpacity>
</View>
</CollapseBody>
</Collapse>
)}
{fetchLocationTuesdaySlots && (
<Collapse>
<CollapseHeader
style={{ height: 70, marginTop: 5, marginBottom: 5 }}
>
<View
style={{
backgroundColor: "#ffffff",
elevation: 3,
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.2,
shadowColor: "#000",
marginRight: 10,
marginTop: 5,
marginLeft: 10,
marginBottom: 5,
borderRadius: 4,
height: 70
}}
>
<TouchableOpacity>
<View style={styles.mainLayoutServices}>
<Text
numberOfLines={1}
style={styles.mainServiceName}
>
Tuesday
</Text>
</View>
</TouchableOpacity>
<AntIcon
name="edit"
color={"#2FBC9C"}
size={17}
style={{
alignSelf: "flex-end",
marginTop: -42,
marginRight: 20
}}
/>
</View>
</CollapseHeader>
<CollapseBody style={{ width: "100%" }}>
<View>
<View
style={{
flexDirection: "row",
alignSelf: "center",
marginTop: 10
}}
>
{fetchLocationTuesdaySlots.length != 0 && (
<TouchableOpacity
onPress={this.DeleteAllSlotsForTuesday}
style={{
alignItems: "center",
height: 40,
margin: 10,
borderRadius: 4,
width: "25%",
alignSelf: "center",
backgroundColor: "#F95851"
}}
>
<Text
style={{
alignSelf: "center",
alignItems: "center",
textAlign: "center",
color: "#fff",
paddingTop: 10
}}
>
Delete All
</Text>
</TouchableOpacity>
)}
<View
style={{
backgroundColor: "#fff",
borderRadius: 5,
elevation: 5
}}
></View>
</View>
<FlatList
style={{
alignSelf: "center",
marginLeft: 10,
marginRight: 10
}}
data={this.state.fetchLocationTuesdaySlots}
extraData={this.state}
renderItem={({ item, index }) => (
<TouchableOpacity
style={{
flexDirection: "column",
margin: 3,
width: "48%",
backgroundColor: "#fff",
borderRadius: 5,
height: 45,
borderColor: CONSTANT.primaryColor,
borderWidth: 0.6,
justifyContent: "center",
alignItems: "center"
}}
>
<Text
style={{
fontFamily:CONSTANT.PoppinsBold,
fontSize: 13,
marginHorizontal: 10
}}
>
{item.start_time} - {item.end_time}
</Text>
<Text style={{ fontSize: 10 , fontFamily:CONSTANT.PoppinsMedium,}}>
Space: {item.spaces}
</Text>
</TouchableOpacity>
)}
numColumns={2}
/>
</View>
<View
style={{
backgroundColor: "#f7f7f7",
borderRadius: 5,
elevation: 5,
margin: 10,
paddingTop: 10
}}
>
<Text
style={{
color: "#3d4461",
width: "70%",
fontSize: 18,
fontFamily:CONSTANT.PoppinsBold,
marginBottom: 15,
marginLeft: 10,
marginTop: 10
}}
>
Add New Slot:
</Text>
<View
style={{
marginLeft: 10,
marginRight: 10,
marginBottom: 10
}}
>
<MultiSelect
ref={component => {
this.multiSelect = component;
}}
onSelectedItemsChange={value =>
this.setState({
projectIntervalKnown: value
})
}
uniqueKey="key"
items={this.state.projectInterval}
selectedItems={this.state.projectIntervalKnown}
borderBottomWidth={0}
single={true}
searchInputPlaceholderText="Pick Interval..."
selectText="Pick Interval"
styleMainWrapper={{
backgroundColor: "#fff",
borderRadius: 4,
marginTop: 10
}}
styleDropdownMenuSubsection={{
backgroundColor: "#fff",
paddingRight: -7,
height: 60,
paddingLeft: 10,
borderWidth: 0.6,
borderColor: "#fff",
borderColor: "#dddddd",
borderRadius: 4
}}
displayKey="val"
submitButtonText="Submit"
/>
</View>
<View
style={{
marginLeft: 10,
marginRight: 10,
marginBottom: 10
}}
>
<MultiSelect
ref={component => {
this.multiSelect = component;
}}
onSelectedItemsChange={value =>
this.setState({
projectDurationKnown: value
})
}
uniqueKey="key"
items={this.state.projectDuration}
selectedItems={this.state.projectDurationKnown}
borderBottomWidth={0}
single={true}
searchInputPlaceholderText="Pick Duration..."
selectText="Pick Duration"
styleMainWrapper={{
backgroundColor: "#fff",
borderRadius: 4,
marginTop: 10
}}
styleDropdownMenuSubsection={{
backgroundColor: "#fff",
paddingRight: -7,
height: 60,
paddingLeft: 10,
borderWidth: 0.6,
borderColor: "#fff",
borderColor: "#dddddd",
borderRadius: 4
}}
displayKey="val"
submitButtonText="Submit"
/>
</View>
<View
style={{
marginLeft: 10,
marginRight: 10,
marginBottom: 10
}}
>
<MultiSelect
ref={component => {
this.multiSelect = component;
}}
onSelectedItemsChange={value =>
this.setState({
projectprojectStartTimeKnown: value
})
}
uniqueKey="key"
items={this.state.projectStartTime}
selectedItems={
this.state.projectprojectStartTimeKnown
}
borderBottomWidth={0}
single={true}
searchInputPlaceholderText="Pick Start Time..."
selectText="Pick Start Time"
styleMainWrapper={{
backgroundColor: "#fff",
borderRadius: 4,
marginTop: 10
}}
styleDropdownMenuSubsection={{
backgroundColor: "#fff",
paddingRight: -7,
height: 60,
paddingLeft: 10,
borderWidth: 0.6,
borderColor: "#fff",
borderColor: "#dddddd",
borderRadius: 4
}}
displayKey="val"
submitButtonText="Submit"
/>
</View>
<View
style={{
marginLeft: 10,
marginRight: 10,
marginBottom: 10
}}
>
<MultiSelect
ref={component => {
this.multiSelect = component;
}}
onSelectedItemsChange={value =>
this.setState({
projectprojectEndTimeKnown: value
})
}
uniqueKey="key"
items={this.state.projectEndTime}
selectedItems={this.state.projectprojectEndTimeKnown}
borderBottomWidth={0}
single={true}
searchInputPlaceholderText="Pick End Time..."
selectText="Pick End Time"
styleMainWrapper={{
backgroundColor: "#fff",
borderRadius: 4,
marginTop: 10
}}
styleDropdownMenuSubsection={{
backgroundColor: "#fff",
paddingRight: -7,
height: 60,
paddingLeft: 10,
borderWidth: 0.6,
borderColor: "#fff",
borderColor: "#dddddd",
borderRadius: 4
}}
displayKey="val"
submitButtonText="Submit"
/>
</View>
<Text
style={{
color: "#3d4461",
width: "70%",
fontSize: 18,
fontFamily:CONSTANT.PoppinsBold,
marginBottom: 15,
marginLeft: 10,
marginTop: 10
}}
>
Assign Appointment Spaces:
</Text>
<RadioGroup
color={CONSTANT.primaryColor}
labelStyle={{ fontSize: 14 }}
radioButtons={this.state.radioButtonsforStartAsTue}
onPress={radioButtons =>
this.setState({ radioButtons })
}
style={{
paddingTop: 0,
flexDirection: "row",
marginBottom: 10,
marginTop: 0,
marginLeft: 13,
display: "flex",
width: "100%",
alignSelf: "center",
alignContent: "center",
textAlign: "center"
}}
/>
{selectedItemforStartAsTue == "other" && (
<TextInput
underlineColorAndroid="transparent"
placeholderTextColor="#7F7F7F"
placeholder="Other Value"
style={styles.TextInputLayout}
onChangeText={customSpaces =>
this.setState({ customSpaces })
}
/>
)}
<TouchableOpacity
onPress={this.AddSlotsForTuesday}
style={{
alignItems: "center",
height: 40,
margin: 10,
borderRadius: 4,
width: "25%",
alignSelf: "center",
backgroundColor: "#2FBC9C"
}}
>
<Text
style={{
alignSelf: "center",
alignItems: "center",
textAlign: "center",
color: "#fff",
paddingTop: 10,
fontFamily: CONSTANT.PoppinsMedium
}}
>
Add More
</Text>
</TouchableOpacity>
</View>
</CollapseBody>
</Collapse>
)}
{fetchLocationWednesdaySlots && (
<Collapse>
<CollapseHeader
style={{ height: 70, marginTop: 5, marginBottom: 5 }}
>
<View
style={{
backgroundColor: "#ffffff",
elevation: 3,
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.2,
shadowColor: "#000",
marginRight: 10,
marginTop: 5,
marginLeft: 10,
marginBottom: 5,
borderRadius: 4,
height: 70
}}
>
<TouchableOpacity>
<View style={styles.mainLayoutServices}>
<Text
numberOfLines={1}
style={styles.mainServiceName}
>
Wednesday
</Text>
</View>
</TouchableOpacity>
<AntIcon
name="edit"
color={"#2FBC9C"}
size={17}
style={{
alignSelf: "flex-end",
marginTop: -42,
marginRight: 20
}}
/>
</View>
</CollapseHeader>
<CollapseBody style={{ width: "100%" }}>
<View>
<View
style={{
flexDirection: "row",
alignSelf: "center",
marginTop: 10
}}
>
{fetchLocationWednesdaySlots.length != 0 && (
<TouchableOpacity
onPress={this.DeleteAllSlotsForWednesday}
style={{
alignItems: "center",
height: 40,
margin: 10,
borderRadius: 4,
width: "25%",
alignSelf: "center",
backgroundColor: "#F95851"
}}
>
<Text
style={{
alignSelf: "center",
alignItems: "center",
textAlign: "center",
color: "#fff",
paddingTop: 10
}}
>
Delete All
</Text>
</TouchableOpacity>
)}
</View>
<FlatList
style={{
alignSelf: "center",
marginLeft: 10,
marginRight: 10
}}
data={this.state.fetchLocationWednesdaySlots}
extraData={this.state}
renderItem={({ item, index }) => (
<TouchableOpacity
onPress={() => this.selectedSlotData(item)}
style={{
flexDirection: "column",
margin: 3,
width: "48%",
backgroundColor: "#fff",
borderRadius: 5,
height: 45,
borderColor: CONSTANT.primaryColor,
borderWidth: 0.6,
justifyContent: "center",
alignItems: "center"
}}
>
<Text
style={{
fontFamily:CONSTANT.PoppinsBold,
fontSize: 13,
marginHorizontal: 10
}}
>
{item.start_time} - {item.end_time}
</Text>
<Text style={{ fontSize: 10 ,fontFamily:CONSTANT.PoppinsMedium, }}>
Space: {item.spaces}
</Text>
</TouchableOpacity>
)}
numColumns={2}
/>
</View>
<View
style={{
backgroundColor: "#f7f7f7",
borderRadius: 5,
elevation: 5,
margin: 10,
paddingTop: 10
}}
>
<Text
style={{
color: "#3d4461",
width: "70%",
fontSize: 18,
fontFamily:CONSTANT.PoppinsBold,
marginBottom: 15,
marginLeft: 10,
marginTop: 10
}}
>
Add New Slot:
</Text>
<View
style={{
marginLeft: 10,
marginRight: 10,
marginBottom: 10
}}
>
<MultiSelect
ref={component => {
this.multiSelect = component;
}}
onSelectedItemsChange={value =>
this.setState({
projectIntervalKnown: value
})
}
uniqueKey="key"
items={this.state.projectInterval}
selectedItems={this.state.projectIntervalKnown}
borderBottomWidth={0}
single={true}
searchInputPlaceholderText="Pick Interval..."
selectText="Pick Interval"
styleMainWrapper={{
backgroundColor: "#fff",
borderRadius: 4,
marginTop: 10
}}
styleDropdownMenuSubsection={{
backgroundColor: "#fff",
paddingRight: -7,
height: 60,
paddingLeft: 10,
borderWidth: 0.6,
borderColor: "#fff",
borderColor: "#dddddd",
borderRadius: 4
}}
displayKey="val"
submitButtonText="Submit"
/>
</View>
<View
style={{
marginLeft: 10,
marginRight: 10,
marginBottom: 10
}}
>
<MultiSelect
ref={component => {
this.multiSelect = component;
}}
onSelectedItemsChange={value =>
this.setState({
projectDurationKnown: value
})
}
uniqueKey="key"
items={this.state.projectDuration}
selectedItems={this.state.projectDurationKnown}
borderBottomWidth={0}
single={true}
searchInputPlaceholderText="Pick Duration..."
selectText="Pick Duration"
styleMainWrapper={{
backgroundColor: "#fff",
borderRadius: 4,
marginTop: 10
}}
styleDropdownMenuSubsection={{
backgroundColor: "#fff",
paddingRight: -7,
height: 60,
paddingLeft: 10,
borderWidth: 0.6,
borderColor: "#fff",
borderColor: "#dddddd",
borderRadius: 4
}}
displayKey="val"
submitButtonText="Submit"
/>
</View>
<View
style={{
marginLeft: 10,
marginRight: 10,
marginBottom: 10
}}
>
<MultiSelect
ref={component => {
this.multiSelect = component;
}}
onSelectedItemsChange={value =>
this.setState({
projectprojectStartTimeKnown: value
})
}
uniqueKey="key"
items={this.state.projectStartTime}
selectedItems={
this.state.projectprojectStartTimeKnown
}
borderBottomWidth={0}
single={true}
searchInputPlaceholderText="Pick Start Time..."
selectText="Pick Start Time"
styleMainWrapper={{
backgroundColor: "#fff",
borderRadius: 4,
marginTop: 10
}}
styleDropdownMenuSubsection={{
backgroundColor: "#fff",
paddingRight: -7,
height: 60,
paddingLeft: 10,
borderWidth: 0.6,
borderColor: "#fff",
borderColor: "#dddddd",
borderRadius: 4
}}
displayKey="val"
submitButtonText="Submit"
/>
</View>
<View
style={{
marginLeft: 10,
marginRight: 10,
marginBottom: 10
}}
>
<MultiSelect
ref={component => {
this.multiSelect = component;
}}
onSelectedItemsChange={value =>
this.setState({
projectprojectEndTimeKnown: value
})
}
uniqueKey="key"
items={this.state.projectEndTime}
selectedItems={this.state.projectprojectEndTimeKnown}
borderBottomWidth={0}
single={true}
searchInputPlaceholderText="Pick End Time..."
selectText="Pick End Time"
styleMainWrapper={{
backgroundColor: "#fff",
borderRadius: 4,
marginTop: 10
}}
styleDropdownMenuSubsection={{
backgroundColor: "#fff",
paddingRight: -7,
height: 60,
paddingLeft: 10,
borderWidth: 0.6,
borderColor: "#fff",
borderColor: "#dddddd",
borderRadius: 4
}}
displayKey="val"
submitButtonText="Submit"
/>
</View>
<Text
style={{
color: "#3d4461",
width: "70%",
fontSize: 18,
fontFamily:CONSTANT.PoppinsBold,
marginBottom: 15,
marginLeft: 10,
marginTop: 10
}}
>
Assign Appointment Spaces:
</Text>
<RadioGroup
color={CONSTANT.primaryColor}
labelStyle={{ fontSize: 14 }}
radioButtons={this.state.radioButtonsforStartAsWed}
onPress={radioButtons =>
this.setState({ radioButtons })
}
style={{
paddingTop: 0,
flexDirection: "row",
marginBottom: 10,
marginTop: 0,
marginLeft: 13,
display: "flex",
width: "100%",
alignSelf: "center",
alignContent: "center",
textAlign: "center"
}}
/>
{selectedItemforStartAsWed == "other" && (
<TextInput
underlineColorAndroid="transparent"
placeholderTextColor="#7F7F7F"
placeholder="Other Value"
style={styles.TextInputLayout}
onChangeText={customSpaces =>
this.setState({ customSpaces })
}
/>
)}
<TouchableOpacity
onPress={this.AddSlotsForWednesday}
style={{
alignItems: "center",
height: 40,
margin: 10,
borderRadius: 4,
width: "25%",
alignSelf: "center",
backgroundColor: "#2FBC9C"
}}
>
<Text
style={{
alignSelf: "center",
alignItems: "center",
textAlign: "center",
color: "#fff",
paddingTop: 10,
fontFamily: CONSTANT.PoppinsMedium
}}
>
Add More
</Text>
</TouchableOpacity>
</View>
</CollapseBody>
</Collapse>
)}
{fetchLocationThursdaySlots && (
<Collapse>
<CollapseHeader
style={{ height: 70, marginTop: 5, marginBottom: 5 }}
>
<View
style={{
backgroundColor: "#ffffff",
elevation: 3,
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.2,
shadowColor: "#000",
marginRight: 10,
marginTop: 5,
marginLeft: 10,
marginBottom: 5,
borderRadius: 4,
height: 70
}}
>
<TouchableOpacity>
<View style={styles.mainLayoutServices}>
<Text
numberOfLines={1}
style={styles.mainServiceName}
>
Thursday
</Text>
</View>
</TouchableOpacity>
<AntIcon
name="edit"
color={"#2FBC9C"}
size={17}
style={{
alignSelf: "flex-end",
marginTop: -42,
marginRight: 20
}}
/>
</View>
</CollapseHeader>
<CollapseBody style={{ width: "100%" }}>
<View>
<View
style={{
flexDirection: "row",
alignSelf: "center",
marginTop: 10
}}
>
{fetchLocationThursdaySlots.length != 0 && (
<TouchableOpacity
onPress={this.DeleteAllSlotsForThursday}
style={{
alignItems: "center",
height: 40,
margin: 10,
borderRadius: 4,
width: "25%",
alignSelf: "center",
backgroundColor: "#F95851"
}}
>
<Text
style={{
alignSelf: "center",
alignItems: "center",
textAlign: "center",
color: "#fff",
paddingTop: 10
}}
>
Delete All
</Text>
</TouchableOpacity>
)}
</View>
<FlatList
style={{
alignSelf: "center",
marginLeft: 10,
marginRight: 10
}}
data={this.state.fetchLocationThursdaySlots}
extraData={this.state}
renderItem={({ item, index }) => (
<TouchableOpacity
onPress={() => this.selectedSlotData(item)}
style={{
flexDirection: "column",
margin: 3,
width: "48%",
backgroundColor: "#fff",
borderRadius: 5,
height: 45,
borderColor: CONSTANT.primaryColor,
borderWidth: 0.6,
justifyContent: "center",
alignItems: "center"
}}
>
<Text
style={{
fontFamily:CONSTANT.PoppinsBold,
fontSize: 13,
marginHorizontal: 10
}}
>
{item.start_time} - {item.end_time}
</Text>
<Text style={{ fontSize: 10 , fontFamily:CONSTANT.PoppinsMedium,}}>
Space: {item.spaces}
</Text>
</TouchableOpacity>
)}
numColumns={2}
/>
</View>
<View
style={{
backgroundColor: "#f7f7f7",
borderRadius: 5,
elevation: 5,
margin: 10,
paddingTop: 10
}}
>
<Text
style={{
color: "#3d4461",
width: "70%",
fontSize: 18,
fontFamily:CONSTANT.PoppinsBold,
marginBottom: 15,
marginLeft: 10,
marginTop: 10
}}
>
Add New Slot:
</Text>
<View
style={{
marginLeft: 10,
marginRight: 10,
marginBottom: 10
}}
>
<MultiSelect
ref={component => {
this.multiSelect = component;
}}
onSelectedItemsChange={value =>
this.setState({
projectIntervalKnown: value
})
}
uniqueKey="key"
items={this.state.projectInterval}
selectedItems={this.state.projectIntervalKnown}
borderBottomWidth={0}
single={true}
searchInputPlaceholderText="Pick Interval..."
selectText="Pick Interval"
styleMainWrapper={{
backgroundColor: "#fff",
borderRadius: 4,
marginTop: 10
}}
styleDropdownMenuSubsection={{
backgroundColor: "#fff",
paddingRight: -7,
height: 60,
paddingLeft: 10,
borderWidth: 0.6,
borderColor: "#fff",
borderColor: "#dddddd",
borderRadius: 4
}}
displayKey="val"
submitButtonText="Submit"
/>
</View>
<View
style={{
marginLeft: 10,
marginRight: 10,
marginBottom: 10
}}
>
<MultiSelect
ref={component => {
this.multiSelect = component;
}}
onSelectedItemsChange={value =>
this.setState({
projectDurationKnown: value
})
}
uniqueKey="key"
items={this.state.projectDuration}
selectedItems={this.state.projectDurationKnown}
borderBottomWidth={0}
single={true}
searchInputPlaceholderText="Pick Duration..."
selectText="Pick Duration"
styleMainWrapper={{
backgroundColor: "#fff",
borderRadius: 4,
marginTop: 10
}}
styleDropdownMenuSubsection={{
backgroundColor: "#fff",
paddingRight: -7,
height: 60,
paddingLeft: 10,
borderWidth: 0.6,
borderColor: "#fff",
borderColor: "#dddddd",
borderRadius: 4
}}
displayKey="val"
submitButtonText="Submit"
/>
</View>
<View
style={{
marginLeft: 10,
marginRight: 10,
marginBottom: 10
}}
>
<MultiSelect
ref={component => {
this.multiSelect = component;
}}
onSelectedItemsChange={value =>
this.setState({
projectprojectStartTimeKnown: value
})
}
uniqueKey="key"
items={this.state.projectStartTime}
selectedItems={
this.state.projectprojectStartTimeKnown
}
borderBottomWidth={0}
single={true}
searchInputPlaceholderText="Pick Start Time..."
selectText="Pick Start Time"
styleMainWrapper={{
backgroundColor: "#fff",
borderRadius: 4,
marginTop: 10
}}
styleDropdownMenuSubsection={{
backgroundColor: "#fff",
paddingRight: -7,
height: 60,
paddingLeft: 10,
borderWidth: 0.6,
borderColor: "#fff",
borderColor: "#dddddd",
borderRadius: 4
}}
displayKey="val"
submitButtonText="Submit"
/>
</View>
<View
style={{
marginLeft: 10,
marginRight: 10,
marginBottom: 10
}}
>
<MultiSelect
ref={component => {
this.multiSelect = component;
}}
onSelectedItemsChange={value =>
this.setState({
projectprojectEndTimeKnown: value
})
}
uniqueKey="key"
items={this.state.projectEndTime}
selectedItems={this.state.projectprojectEndTimeKnown}
borderBottomWidth={0}
single={true}
searchInputPlaceholderText="Pick End Time..."
selectText="Pick End Time"
styleMainWrapper={{
backgroundColor: "#fff",
borderRadius: 4,
marginTop: 10
}}
styleDropdownMenuSubsection={{
backgroundColor: "#fff",
paddingRight: -7,
height: 60,
paddingLeft: 10,
borderWidth: 0.6,
borderColor: "#fff",
borderColor: "#dddddd",
borderRadius: 4
}}
displayKey="val"
submitButtonText="Submit"
/>
</View>
<Text
style={{
color: "#3d4461",
width: "70%",
fontSize: 18,
fontFamily:CONSTANT.PoppinsBold,
marginBottom: 15,
marginLeft: 10,
marginTop: 10
}}
>
Assign Appointment Spaces:
</Text>
<RadioGroup
color={CONSTANT.primaryColor}
labelStyle={{ fontSize: 14 }}
radioButtons={this.state.radioButtonsforStartAsThur}
onPress={radioButtons =>
this.setState({ radioButtons })
}
style={{
paddingTop: 0,
flexDirection: "row",
marginBottom: 10,
marginTop: 0,
marginLeft: 13,
display: "flex",
width: "100%",
alignSelf: "center",
alignContent: "center",
textAlign: "center"
}}
/>
{selectedItemforStartAsThur == "other" && (
<TextInput
underlineColorAndroid="transparent"
placeholderTextColor="#7F7F7F"
placeholder="Other Value"
style={styles.TextInputLayout}
onChangeText={customSpaces =>
this.setState({ customSpaces })
}
/>
)}
<TouchableOpacity
onPress={this.AddSlotsForThursday}
style={{
alignItems: "center",
height: 40,
margin: 10,
borderRadius: 4,
width: "25%",
alignSelf: "center",
backgroundColor: "#2FBC9C"
}}
>
<Text
style={{
alignSelf: "center",
alignItems: "center",
textAlign: "center",
color: "#fff",
paddingTop: 10,
fontFamily: CONSTANT.PoppinsMedium
}}
>
Add More
</Text>
</TouchableOpacity>
</View>
</CollapseBody>
</Collapse>
)}
{fetchLocationFridaySlots && (
<Collapse>
<CollapseHeader
style={{ height: 70, marginTop: 5, marginBottom: 5 }}
>
<View
style={{
backgroundColor: "#ffffff",
elevation: 3,
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.2,
shadowColor: "#000",
marginRight: 10,
marginTop: 5,
marginLeft: 10,
marginBottom: 5,
borderRadius: 4,
height: 70
}}
>
<TouchableOpacity>
<View style={styles.mainLayoutServices}>
<Text
numberOfLines={1}
style={styles.mainServiceName}
>
Friday
</Text>
</View>
</TouchableOpacity>
<AntIcon
name="edit"
color={"#2FBC9C"}
size={17}
style={{
alignSelf: "flex-end",
marginTop: -42,
marginRight: 20
}}
/>
</View>
</CollapseHeader>
<CollapseBody style={{ width: "100%" }}>
<View>
<View
style={{
flexDirection: "row",
alignSelf: "center",
marginTop: 10
}}
>
{fetchLocationFridaySlots.length != 0 && (
<TouchableOpacity
onPress={this.DeleteAllSlotsForFriday}
style={{
alignItems: "center",
height: 40,
margin: 10,
borderRadius: 4,
width: "25%",
alignSelf: "center",
backgroundColor: "#F95851"
}}
>
<Text
style={{
alignSelf: "center",
alignItems: "center",
textAlign: "center",
color: "#fff",
paddingTop: 10
}}
>
Delete All
</Text>
</TouchableOpacity>
)}
</View>
<FlatList
style={{
alignSelf: "center",
marginLeft: 10,
marginRight: 10
}}
data={this.state.fetchLocationFridaySlots}
extraData={this.state}
renderItem={({ item, index }) => (
<TouchableOpacity
onPress={() => this.selectedSlotData(item)}
style={{
flexDirection: "column",
margin: 3,
width: "48%",
backgroundColor: "#fff",
borderRadius: 5,
height: 45,
borderColor: CONSTANT.primaryColor,
borderWidth: 0.6,
justifyContent: "center",
alignItems: "center"
}}
>
<Text
style={{
fontFamily:CONSTANT.PoppinsBold,
fontSize: 13,
marginHorizontal: 10
}}
>
{item.start_time} - {item.end_time}
</Text>
<Text style={{ fontSize: 10 , fontFamily:CONSTANT.PoppinsMedium }}>
Space: {item.spaces}
</Text>
</TouchableOpacity>
)}
numColumns={2}
/>
</View>
<View
style={{
backgroundColor: "#f7f7f7",
borderRadius: 5,
elevation: 5,
margin: 10,
paddingTop: 10
}}
>
<Text
style={{
color: "#3d4461",
width: "70%",
fontSize: 18,
fontFamily:CONSTANT.PoppinsBold,
marginBottom: 15,
marginLeft: 10,
marginTop: 10
}}
>
Add New Slot:
</Text>
<View
style={{
marginLeft: 10,
marginRight: 10,
marginBottom: 10
}}
>
<MultiSelect
ref={component => {
this.multiSelect = component;
}}
onSelectedItemsChange={value =>
this.setState({
projectIntervalKnown: value
})
}
uniqueKey="key"
items={this.state.projectInterval}
selectedItems={this.state.projectIntervalKnown}
borderBottomWidth={0}
single={true}
searchInputPlaceholderText="Pick Interval..."
selectText="Pick Interval"
styleMainWrapper={{
backgroundColor: "#fff",
borderRadius: 4,
marginTop: 10
}}
styleDropdownMenuSubsection={{
backgroundColor: "#fff",
paddingRight: -7,
height: 60,
paddingLeft: 10,
borderWidth: 0.6,
borderColor: "#fff",
borderColor: "#dddddd",
borderRadius: 4
}}
displayKey="val"
submitButtonText="Submit"
/>
</View>
<View
style={{
marginLeft: 10,
marginRight: 10,
marginBottom: 10
}}
>
<MultiSelect
ref={component => {
this.multiSelect = component;
}}
onSelectedItemsChange={value =>
this.setState({
projectDurationKnown: value
})
}
uniqueKey="key"
items={this.state.projectDuration}
selectedItems={this.state.projectDurationKnown}
borderBottomWidth={0}
single={true}
searchInputPlaceholderText="Pick Duration..."
selectText="Pick Duration"
styleMainWrapper={{
backgroundColor: "#fff",
borderRadius: 4,
marginTop: 10
}}
styleDropdownMenuSubsection={{
backgroundColor: "#fff",
paddingRight: -7,
height: 60,
paddingLeft: 10,
borderWidth: 0.6,
borderColor: "#fff",
borderColor: "#dddddd",
borderRadius: 4
}}
displayKey="val"
submitButtonText="Submit"
/>
</View>
<View
style={{
marginLeft: 10,
marginRight: 10,
marginBottom: 10
}}
>
<MultiSelect
ref={component => {
this.multiSelect = component;
}}
onSelectedItemsChange={value =>
this.setState({
projectprojectStartTimeKnown: value
})
}
uniqueKey="key"
items={this.state.projectStartTime}
selectedItems={
this.state.projectprojectStartTimeKnown
}
borderBottomWidth={0}
single={true}
searchInputPlaceholderText="Pick Start Time..."
selectText="Pick Start Time"
styleMainWrapper={{
backgroundColor: "#fff",
borderRadius: 4,
marginTop: 10
}}
styleDropdownMenuSubsection={{
backgroundColor: "#fff",
paddingRight: -7,
height: 60,
paddingLeft: 10,
borderWidth: 0.6,
borderColor: "#fff",
borderColor: "#dddddd",
borderRadius: 4
}}
displayKey="val"
submitButtonText="Submit"
/>
</View>
<View
style={{
marginLeft: 10,
marginRight: 10,
marginBottom: 10
}}
>
<MultiSelect
ref={component => {
this.multiSelect = component;
}}
onSelectedItemsChange={value =>
this.setState({
projectprojectEndTimeKnown: value
})
}
uniqueKey="key"
items={this.state.projectEndTime}
selectedItems={this.state.projectprojectEndTimeKnown}
borderBottomWidth={0}
single={true}
searchInputPlaceholderText="Pick End Time..."
selectText="Pick End Time"
styleMainWrapper={{
backgroundColor: "#fff",
borderRadius: 4,
marginTop: 10
}}
styleDropdownMenuSubsection={{
backgroundColor: "#fff",
paddingRight: -7,
height: 60,
paddingLeft: 10,
borderWidth: 0.6,
borderColor: "#fff",
borderColor: "#dddddd",
borderRadius: 4
}}
displayKey="val"
submitButtonText="Submit"
/>
</View>
<Text
style={{
color: "#3d4461",
width: "70%",
fontSize: 18,
fontFamily:CONSTANT.PoppinsBold,
marginBottom: 15,
marginLeft: 10,
marginTop: 10
}}
>
Assign Appointment Spaces:
</Text>
<RadioGroup
color={CONSTANT.primaryColor}
labelStyle={{ fontSize: 14 }}
radioButtons={this.state.radioButtonsforStartAsFri}
onPress={radioButtons =>
this.setState({ radioButtons })
}
style={{
paddingTop: 0,
flexDirection: "row",
marginBottom: 10,
marginTop: 0,
marginLeft: 13,
display: "flex",
width: "100%",
alignSelf: "center",
alignContent: "center",
textAlign: "center"
}}
/>
{selectedItemforStartAsFri == "other" && (
<TextInput
underlineColorAndroid="transparent"
placeholderTextColor="#7F7F7F"
placeholder="Other Value"
style={styles.TextInputLayout}
onChangeText={customSpaces =>
this.setState({ customSpaces })
}
/>
)}
<TouchableOpacity
onPress={this.AddSlotsForFriday}
style={{
alignItems: "center",
height: 40,
margin: 10,
borderRadius: 4,
width: "25%",
alignSelf: "center",
backgroundColor: "#2FBC9C"
}}
>
<Text
style={{
alignSelf: "center",
alignItems: "center",
textAlign: "center",
color: "#fff",
paddingTop: 10,
fontFamily: CONSTANT.PoppinsMedium
}}
>
Add More
</Text>
</TouchableOpacity>
</View>
</CollapseBody>
</Collapse>
)}
{fetchLocationSaturdaySlots && (
<Collapse>
<CollapseHeader
style={{ height: 70, marginTop: 5, marginBottom: 5 }}
>
<View
style={{
backgroundColor: "#ffffff",
elevation: 3,
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.2,
shadowColor: "#000",
marginRight: 10,
marginTop: 5,
marginLeft: 10,
marginBottom: 5,
borderRadius: 4,
height: 70
}}
>
<TouchableOpacity>
<View style={styles.mainLayoutServices}>
<Text
numberOfLines={1}
style={styles.mainServiceName}
>
Saturday
</Text>
</View>
</TouchableOpacity>
<AntIcon
name="edit"
color={"#2FBC9C"}
size={17}
style={{
alignSelf: "flex-end",
marginTop: -42,
marginRight: 20
}}
/>
</View>
</CollapseHeader>
<CollapseBody style={{ width: "100%" }}>
<View>
<View
style={{
flexDirection: "row",
alignSelf: "center",
marginTop: 10
}}
>
{fetchLocationSaturdaySlots.length != 0 && (
<TouchableOpacity
onPress={this.DeleteAllSlotsForSaturday}
style={{
alignItems: "center",
height: 40,
margin: 10,
borderRadius: 4,
width: "25%",
alignSelf: "center",
backgroundColor: "#F95851"
}}
>
<Text
style={{
alignSelf: "center",
alignItems: "center",
textAlign: "center",
color: "#fff",
paddingTop: 10
}}
>
Delete All
</Text>
</TouchableOpacity>
)}
</View>
<FlatList
style={{
alignSelf: "center",
marginLeft: 10,
marginRight: 10
}}
data={this.state.fetchLocationSaturdaySlots}
extraData={this.state}
renderItem={({ item, index }) => (
<TouchableOpacity
onPress={() => this.selectedSlotData(item)}
style={{
flexDirection: "column",
margin: 3,
width: "48%",
backgroundColor: "#fff",
borderRadius: 5,
height: 45,
borderColor: CONSTANT.primaryColor,
borderWidth: 0.6,
justifyContent: "center",
alignItems: "center"
}}
>
<Text
style={{
fontFamily:CONSTANT.PoppinsBold,
fontSize: 13,
marginHorizontal: 10
}}
>
{item.start_time} - {item.end_time}
</Text>
<Text style={{ fontSize: 10 , fontFamily:CONSTANT.PoppinsMedium }}>
Space: {item.spaces}
</Text>
</TouchableOpacity>
)}
numColumns={2}
/>
</View>
<View
style={{
backgroundColor: "#f7f7f7",
borderRadius: 5,
elevation: 5,
margin: 10,
paddingTop: 10
}}
>
<Text
style={{
color: "#3d4461",
width: "70%",
fontSize: 18,
fontFamily:CONSTANT.PoppinsBold,
marginBottom: 15,
marginLeft: 10,
marginTop: 10
}}
>
Add New Slot:
</Text>
<View
style={{
marginLeft: 10,
marginRight: 10,
marginBottom: 10
}}
>
<MultiSelect
ref={component => {
this.multiSelect = component;
}}
onSelectedItemsChange={value =>
this.setState({
projectIntervalKnown: value
})
}
uniqueKey="key"
items={this.state.projectInterval}
selectedItems={this.state.projectIntervalKnown}
borderBottomWidth={0}
single={true}
searchInputPlaceholderText="Pick Interval..."
selectText="Pick Interval"
styleMainWrapper={{
backgroundColor: "#fff",
borderRadius: 4,
marginTop: 10
}}
styleDropdownMenuSubsection={{
backgroundColor: "#fff",
paddingRight: -7,
height: 60,
paddingLeft: 10,
borderWidth: 0.6,
borderColor: "#fff",
borderColor: "#dddddd",
borderRadius: 4
}}
displayKey="val"
submitButtonText="Submit"
/>
</View>
<View
style={{
marginLeft: 10,
marginRight: 10,
marginBottom: 10
}}
>
<MultiSelect
ref={component => {
this.multiSelect = component;
}}
onSelectedItemsChange={value =>
this.setState({
projectDurationKnown: value
})
}
uniqueKey="key"
items={this.state.projectDuration}
selectedItems={this.state.projectDurationKnown}
borderBottomWidth={0}
single={true}
searchInputPlaceholderText="Pick Duration..."
selectText="Pick Duration"
styleMainWrapper={{
backgroundColor: "#fff",
borderRadius: 4,
marginTop: 10
}}
styleDropdownMenuSubsection={{
backgroundColor: "#fff",
paddingRight: -7,
height: 60,
paddingLeft: 10,
borderWidth: 0.6,
borderColor: "#fff",
borderColor: "#dddddd",
borderRadius: 4
}}
displayKey="val"
submitButtonText="Submit"
/>
</View>
<View
style={{
marginLeft: 10,
marginRight: 10,
marginBottom: 10
}}
>
<MultiSelect
ref={component => {
this.multiSelect = component;
}}
onSelectedItemsChange={value =>
this.setState({
projectprojectStartTimeKnown: value
})
}
uniqueKey="key"
items={this.state.projectStartTime}
selectedItems={
this.state.projectprojectStartTimeKnown
}
borderBottomWidth={0}
single={true}
searchInputPlaceholderText="Pick Start Time..."
selectText="Pick Start Time"
styleMainWrapper={{
backgroundColor: "#fff",
borderRadius: 4,
marginTop: 10
}}
styleDropdownMenuSubsection={{
backgroundColor: "#fff",
paddingRight: -7,
height: 60,
paddingLeft: 10,
borderWidth: 0.6,
borderColor: "#fff",
borderColor: "#dddddd",
borderRadius: 4
}}
displayKey="val"
submitButtonText="Submit"
/>
</View>
<View
style={{
marginLeft: 10,
marginRight: 10,
marginBottom: 10
}}
>
<MultiSelect
ref={component => {
this.multiSelect = component;
}}
onSelectedItemsChange={value =>
this.setState({
projectprojectEndTimeKnown: value
})
}
uniqueKey="key"
items={this.state.projectEndTime}
selectedItems={this.state.projectprojectEndTimeKnown}
borderBottomWidth={0}
single={true}
searchInputPlaceholderText="Pick End Time..."
selectText="Pick End Time"
styleMainWrapper={{
backgroundColor: "#fff",
borderRadius: 4,
marginTop: 10
}}
styleDropdownMenuSubsection={{
backgroundColor: "#fff",
paddingRight: -7,
height: 60,
paddingLeft: 10,
borderWidth: 0.6,
borderColor: "#fff",
borderColor: "#dddddd",
borderRadius: 4
}}
displayKey="val"
submitButtonText="Submit"
/>
</View>
<Text
style={{
color: "#3d4461",
width: "70%",
fontSize: 18,
fontFamily:CONSTANT.PoppinsBold,
marginBottom: 15,
marginLeft: 10,
marginTop: 10
}}
>
Assign Appointment Spaces:
</Text>
<RadioGroup
color={CONSTANT.primaryColor}
labelStyle={{ fontSize: 14 }}
radioButtons={this.state.radioButtonsforStartAsSat}
onPress={radioButtons =>
this.setState({ radioButtons })
}
style={{
paddingTop: 0,
flexDirection: "row",
marginBottom: 10,
marginTop: 0,
marginLeft: 13,
display: "flex",
width: "100%",
alignSelf: "center",
alignContent: "center",
textAlign: "center"
}}
/>
{selectedItemforStartAsSat == "other" && (
<TextInput
underlineColorAndroid="transparent"
placeholderTextColor="#7F7F7F"
placeholder="Other Value"
style={styles.TextInputLayout}
onChangeText={customSpaces =>
this.setState({ customSpaces })
}
/>
)}
<TouchableOpacity
onPress={this.AddSlotsForSaturday}
style={{
alignItems: "center",
height: 40,
margin: 10,
borderRadius: 4,
width: "25%",
alignSelf: "center",
backgroundColor: "#2FBC9C"
}}
>
<Text
style={{
alignSelf: "center",
alignItems: "center",
textAlign: "center",
color: "#fff",
paddingTop: 10,
fontFamily: CONSTANT.PoppinsMedium
}}
>
Add More
</Text>
</TouchableOpacity>
</View>
</CollapseBody>
</Collapse>
)}
{fetchLocationSundaySlots && (
<Collapse>
<CollapseHeader
style={{ height: 70, marginTop: 5, marginBottom: 5 }}
>
<View
style={{
backgroundColor: "#ffffff",
elevation: 3,
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.2,
shadowColor: "#000",
marginRight: 10,
marginTop: 5,
marginLeft: 10,
marginBottom: 5,
borderRadius: 4,
height: 70
}}
>
<TouchableOpacity>
<View style={styles.mainLayoutServices}>
<Text
numberOfLines={1}
style={styles.mainServiceName}
>
Sunday
</Text>
</View>
</TouchableOpacity>
<AntIcon
name="edit"
color={"#2FBC9C"}
size={17}
style={{
alignSelf: "flex-end",
marginTop: -42,
marginRight: 20
}}
/>
</View>
</CollapseHeader>
<CollapseBody style={{ width: "100%" }}>
<View>
<View
style={{
flexDirection: "row",
alignSelf: "center",
marginTop: 10
}}
>
{fetchLocationSundaySlots.length != 0 && (
<TouchableOpacity
onPress={this.DeleteAllSlotsForSunday}
style={{
alignItems: "center",
height: 40,
margin: 10,
borderRadius: 4,
width: "25%",
alignSelf: "center",
backgroundColor: "#F95851"
}}
>
<Text
style={{
alignSelf: "center",
alignItems: "center",
textAlign: "center",
color: "#fff",
paddingTop: 10
}}
>
Delete All
</Text>
</TouchableOpacity>
)}
</View>
<FlatList
style={{
alignSelf: "center",
marginLeft: 10,
marginRight: 10
}}
data={this.state.fetchLocationSundaySlots}
extraData={this.state}
renderItem={({ item, index }) => (
<TouchableOpacity
onPress={() => this.selectedSlotData(item)}
style={{
flexDirection: "column",
margin: 3,
width: "48%",
backgroundColor: "#fff",
borderRadius: 5,
height: 45,
borderColor: CONSTANT.primaryColor,
borderWidth: 0.6,
justifyContent: "center",
alignItems: "center"
}}
>
<Text
style={{
fontFamily:CONSTANT.PoppinsBold,
fontSize: 13,
marginHorizontal: 10
}}
>
{item.start_time} - {item.end_time}
</Text>
<Text style={{ fontSize: 10 , fontFamily:CONSTANT.PoppinsMedium }}>
Space: {item.spaces}
</Text>
</TouchableOpacity>
)}
numColumns={2}
/>
</View>
<View
style={{
backgroundColor: "#f7f7f7",
borderRadius: 5,
elevation: 5,
margin: 10,
paddingTop: 10
}}
>
<Text
style={{
color: "#3d4461",
width: "70%",
fontSize: 18,
fontFamily:CONSTANT.PoppinsBold,
marginBottom: 15,
marginLeft: 10,
marginTop: 10
}}
>
Add New Slot:
</Text>
<View
style={{
marginLeft: 10,
marginRight: 10,
marginBottom: 10
}}
>
<MultiSelect
ref={component => {
this.multiSelect = component;
}}
onSelectedItemsChange={value =>
this.setState({
projectIntervalKnown: value
})
}
uniqueKey="key"
items={this.state.projectInterval}
selectedItems={this.state.projectIntervalKnown}
borderBottomWidth={0}
single={true}
searchInputPlaceholderText="Pick Interval..."
selectText="Pick Interval"
styleMainWrapper={{
backgroundColor: "#fff",
borderRadius: 4,
marginTop: 10
}}
styleDropdownMenuSubsection={{
backgroundColor: "#fff",
paddingRight: -7,
height: 60,
paddingLeft: 10,
borderWidth: 0.6,
borderColor: "#fff",
borderColor: "#dddddd",
borderRadius: 4
}}
displayKey="val"
submitButtonText="Submit"
/>
</View>
<View
style={{
marginLeft: 10,
marginRight: 10,
marginBottom: 10
}}
>
<MultiSelect
ref={component => {
this.multiSelect = component;
}}
onSelectedItemsChange={value =>
this.setState({
projectDurationKnown: value
})
}
uniqueKey="key"
items={this.state.projectDuration}
selectedItems={this.state.projectDurationKnown}
borderBottomWidth={0}
single={true}
searchInputPlaceholderText="Pick Duration..."
selectText="Pick Duration"
styleMainWrapper={{
backgroundColor: "#fff",
borderRadius: 4,
marginTop: 10
}}
styleDropdownMenuSubsection={{
backgroundColor: "#fff",
paddingRight: -7,
height: 60,
paddingLeft: 10,
borderWidth: 0.6,
borderColor: "#fff",
borderColor: "#dddddd",
borderRadius: 4
}}
displayKey="val"
submitButtonText="Submit"
/>
</View>
<View
style={{
marginLeft: 10,
marginRight: 10,
marginBottom: 10
}}
>
<MultiSelect
ref={component => {
this.multiSelect = component;
}}
onSelectedItemsChange={value =>
this.setState({
projectprojectStartTimeKnown: value
})
}
uniqueKey="key"
items={this.state.projectStartTime}
selectedItems={
this.state.projectprojectStartTimeKnown
}
borderBottomWidth={0}
single={true}
searchInputPlaceholderText="Pick Start Time..."
selectText="Pick Start Time"
styleMainWrapper={{
backgroundColor: "#fff",
borderRadius: 4,
marginTop: 10
}}
styleDropdownMenuSubsection={{
backgroundColor: "#fff",
paddingRight: -7,
height: 60,
paddingLeft: 10,
borderWidth: 0.6,
borderColor: "#fff",
borderColor: "#dddddd",
borderRadius: 4
}}
displayKey="val"
submitButtonText="Submit"
/>
</View>
<View
style={{
marginLeft: 10,
marginRight: 10,
marginBottom: 10
}}
>
<MultiSelect
ref={component => {
this.multiSelect = component;
}}
onSelectedItemsChange={value =>
this.setState({
projectprojectEndTimeKnown: value
})
}
uniqueKey="key"
items={this.state.projectEndTime}
selectedItems={this.state.projectprojectEndTimeKnown}
borderBottomWidth={0}
single={true}
searchInputPlaceholderText="Pick End Time..."
selectText="Pick End Time"
styleMainWrapper={{
backgroundColor: "#fff",
borderRadius: 4,
marginTop: 10
}}
styleDropdownMenuSubsection={{
backgroundColor: "#fff",
paddingRight: -7,
height: 60,
paddingLeft: 10,
borderWidth: 0.6,
borderColor: "#fff",
borderColor: "#dddddd",
borderRadius: 4
}}
displayKey="val"
submitButtonText="Submit"
/>
</View>
<Text
style={{
color: "#3d4461",
width: "70%",
fontSize: 18,
fontFamily:CONSTANT.PoppinsBold,
marginBottom: 15,
marginLeft: 10,
marginTop: 10
}}
>
Assign Appointment Spaces:
</Text>
<RadioGroup
color={CONSTANT.primaryColor}
labelStyle={{ fontSize: 14 }}
radioButtons={this.state.radioButtonsforStartAsSun}
onPress={radioButtons =>
this.setState({ radioButtons })
}
style={{
paddingTop: 0,
flexDirection: "row",
marginBottom: 10,
marginTop: 0,
marginLeft: 13,
display: "flex",
width: "100%",
alignSelf: "center",
alignContent: "center",
textAlign: "center"
}}
/>
{selectedItemforStartAsSun == "other" && (
<TextInput
underlineColorAndroid="transparent"
placeholderTextColor="#7F7F7F"
placeholder="Other Value"
style={styles.TextInputLayout}
onChangeText={customSpaces =>
this.setState({ customSpaces })
}
/>
)}
<TouchableOpacity
onPress={this.AddSlotsForSunday}
style={{
alignItems: "center",
height: 40,
margin: 10,
borderRadius: 4,
width: "25%",
alignSelf: "center",
backgroundColor: "#2FBC9C"
}}
>
<Text
style={{
alignSelf: "center",
alignItems: "center",
textAlign: "center",
color: "#fff",
paddingTop: 10,
fontFamily: CONSTANT.PoppinsMedium
}}
>
Add More
</Text>
</TouchableOpacity>
</View>
</CollapseBody>
</Collapse>
)}
</View>
</ScrollView>
)}
</View>
);
}
}
export default withNavigation(LocationDetail);
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#f7f7f7"
},
nextButtonStyle: {
color: "#fff",
backgroundColor: "#f7395a",
borderRadius: 6,
fontSize: 13,
padding: 8,
elevation: 2,
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.2,
shadowColor: "#000"
},
previousButtonStyle: {
color: "#fff",
backgroundColor: "#19253f",
borderRadius: 6,
fontSize: 13,
padding: 8,
elevation: 2,
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.2,
shadowColor: "#000"
},
mainLayoutServices: {
flexDirection: "row",
height: 70
},
ImageStyle: {
margin: 15,
width: 35,
height: 35
},
mainServiceName: {
color: CONSTANT.primaryColor,
fontSize: 15,
margin: 24,
fontFamily:CONSTANT.PoppinsBold,
},
TextInputLayout: {
minHeight: 45,
color: "#323232",
paddingLeft: 10,
paddingRight: 10,
borderRadius: 2,
borderWidth: 0.6,
borderColor: "#dddddd",
fontFamily:CONSTANT.PoppinsBold,
marginLeft: 10,
marginRight: 10,
marginBottom: 10
}
});
|
import React from 'react';
import {Animated, AnimatedAgent} from 'boxart';
import Component from '../../src/modules/update-ancestor';
class Main extends Component {
constructor() {
super();
this.state = {
numbers: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
};
}
shuffle() {
this.setState({
// Unreliable one-line array reverse & shuffle
numbers: this.state.numbers.reverse().sort(() => Math.random() - 0.5 > 0 ? -1 : 1),
});
}
render() {
setTimeout(this.shuffle, 1000);
return (
<div className="game-board">
<AnimatedAgent>
<ul>
{this.state.numbers.map(num => <Animated
animateKey={num}
key={num}>
<li>{num}</li>
</Animated>)}
</ul>
</AnimatedAgent>
</div>
);
}
}
// Boilerplate
// ============================================================================
import '../../src/styles/index.styl';
import ReactDOM from 'react-dom';
import FullViewport from '../../src/modules/full-viewport';
import PreventZoom from '../../src/modules/prevent-zoom';
class Example extends Component {
render() {
return (
<PreventZoom><FullViewport>
<Main />
</FullViewport></PreventZoom>
);
}
}
ReactDOM.render(
<Example />,
document.getElementById('root')
);
|
var mongoose = require("mongoose");
var Schema = mongoose.Schema;
var FoodPost = new Schema({
user: {
type: String,
required: false
},
username: {
type: String,
required: false
},
name: {
type: String,
required: false
},
image: {
type: String,
ref: "Image",
required: false
},
description: {
type: String,
required: false
},
tags: {
type: Array,
required: false
},
rating: {
type: Number,
required: false
},
address: {
type: String,
required: false
},
date: {
type: Date,
required: false
},
profilePic:{
type: String,
required: false
}
});
var Dish = mongoose.model("Dish", FoodPost);
module.exports = Dish;
|
import { rgbpal } from './tv'
class Sprites {
constructor() {
this.sprites = {};
}
async getImageData(imageUrl) {
let img;
const imageLoadPromise = new Promise(resolve => {
img = new Image();
img.onload = resolve;
img.src = imageUrl;
});
await imageLoadPromise;
return img;
}
// return nearest color from array
nearestColor(palleteRGB, colorRGB) {
var lowest = Number.POSITIVE_INFINITY;
var tmp;
let index = 0;
palleteRGB.forEach((el, i) => {
tmp = this.distance(colorRGB, el)
if (tmp < lowest) {
lowest = tmp;
index = i;
};
})
return index;
}
distance(a, b) {
return Math.sqrt(Math.pow(a[0] - b[0], 2) + Math.pow(a[1] - b[1], 2) + Math.pow(a[2] - b[2], 2));
}
async getPixelData(img) {
//const canvas = document.createElement('canvas');
const canvas = document.getElementById('debug');
canvas.width = img.width;
canvas.height = img.height;
const context = canvas.getContext('2d');
context.drawImage(img, 0, 0);
const imageData = context.getImageData(0, 0, img.width, img.height).data;
console.log(imageData)
let imageRgbData = [];
for (var i = 0; i < imageData.length; i += 4) {
const rgbPixel = [
imageData[i] = imageData[i] / 255, // red
imageData[i + 1] = imageData[i + 1] / 255, // green
imageData[i + 2] = imageData[i + 2] / 255, // blue
imageData[i + 3] = 1 // no transparent
]
imageRgbData.push(this.nearestColor(rgbpal, rgbPixel));
}
return {
data: imageRgbData,
width: img.width,
height: img.height
};
}
async loadPng(src) {
// load image
const imageObj = await this.getImageData(src);
// get pixel data
const imageData = await this.getPixelData(imageObj);
return imageData;
}
async add(name, path) {
this.sprites[name] = await this.loadPng(path);
console.log('🎨', this.get(name));
}
get(name) { return this.sprites[name]; }
}
export { Sprites };
|
const { createDB } = require('./../js/create.js')
var db = createDB()
db.serialize(function() {
var stmt = db.prepare("INSERT INTO tags (file_id, type, value, confidence) VALUES (?, ?, ?, ?)");
db.all("SELECT rowid AS id, name FROM files", function(err, rows) {
rows.forEach(function (row) {
console.log(row.id + ": " + row.name);
stmt.run(
[
row.id,
'subject',
randomTag(),
Math.floor((Math.random() * 100) + 1)
]
);
});
stmt.finalize();
});
});
db.close();
const randomTag = () => {
const aTags = ['sky', 'person', 'landscape', 'car', 'dog', 'happy', 'cat']
return aTags[Math.floor((Math.random() * (aTags.length - 1)) + 1)]
}
|
var fs = require("fs");
var path = require("path");
function SgResourceDataStore() {
this.getResourceHeaders = function(callback) {
$.get(API_URL+ 'api/resource/get_header_list/')
.success(function (data) {
var headers = JSON.parse(data).data;
for (var i = 0, len = headers.length; i < len; ++i) {
headers[i]['hasNewResource'] = false;
}
if (callback) callback(headers);
});
};
this.getProviderResourceHeaders = function(callback) {
$.get(API_URL+ 'api/company/get_header_list/')
.success(function (data) {
console.log(data);
var headers = data.data;
for (var i = 0, len = headers.length; i < len; ++i) {
headers[i]['hasNewResource'] = false;
}
if (callback) callback(headers);
});
};
this.getResource = function(resourceId, callback) {
var file_path = path.join(window.userData, resourceId + '.json');
console.log(file_path);
// read cache
fs.readFile(file_path, 'utf-8', function (err, data) {
if (!err) {
// return cache
if (callback) callback(JSON.parse(data));
return;
}
// fetch from server
$.post(API_URL + 'api/resource/fetch-json-file2/', {resource_id: resourceId, q: ''})
.success(function (result) {
var file_data = result.data.file_stream;
// save to cache
fs.writeFile(file_path, JSON.stringify(file_data), function (err) {
if (err) {
return console.error(err);
}
});
if (callback) callback(file_data);
});
});
};
this.isResourceAvailable = function(resourceId, callback) {
//check file existing
var file_path = path.join(window.userData, resourceId + '.json');;
fs.stat(file_path, function (err, stats) {
if (callback) {
return callback(!err);
}
});
};
return this;
};
|
/**
* Created by abhinavnathgupta on 14/11/16.
*/
var jwt = require('jwt-simple');
var config = require('./DataConfig');
var auth = {
login: function (username, password) {
if (username == 'admin@admin.com' && password == 'admin') {
return false;
}
else {
return true;
}
},
genToken: function (secret) {
var dateObj = new Date();
var expires = dateObj.setDate(dateObj.getSeconds() + config.timeout);
var token = jwt.encode({
exp: expires
}, secret);
return {
session: token,
expires: expires,
};
}
};
module.exports = auth;
|
import '@babel/polyfill';
import Api from './api';
import Request from './request';
import { DataResponse, ErrorResponse } from './response';
/**
* @typedef ModuleConfig
* @property {string} url The URL of the Resting Squirrel API.
* @property {?string} dataKey Key which contains data informations in the response. Default: 'data'.
* @property {?string} errorKey Key which contains error informations in the response. Default: 'error'.
* @property {?boolean} meta If true meta data are returned in the response. Default: true.
* @property {?string} apiKey The api key to validates calls on the API. Default: null.
* @property {?boolean} keepAlive Indicates if the connection should be kept alive. Default: false.
* @property {?boolean} logWarning Indicates if the warnings should be printed to stdout. Default: false.
*/
/**
*
* @param {ModuleConfig} config
*/
const fn = (config = {}) => {
const { url, dataKey, errorKey, meta, apiKey, keepAlive, logWarning } = config;
const createApi = (version = null) => new Api(url, version, dataKey, errorKey, meta, apiKey, keepAlive, logWarning);
const M = createApi();
/**
*
* @param {number} version Version of the API endpoint.
*/
M.v = version => createApi(version);
M.ping = (cb) => createApi().get('/ping', cb);
return M;
};
Object.defineProperties(fn, {
concurrency: {
set: value => Request.concurrency = value,
get: () => Request.concurrency,
},
cacheTTL: {
set: value => Request.cacheTTL = value,
get: () => Request.cacheTTL,
},
});
export {
fn as default,
DataResponse,
ErrorResponse,
};
|
/* Home Page */
// Imports //
import componentDistortSlider from "./components/distort-slider";
// Export //
export default function homePage() {
// Home Page Animations //
componentDistortSlider();
}
|
const assert = require('assert')
const texme = require('../texme.js')
const MARK = texme.tokenType.MARK
const MASK = texme.tokenType.MASK
const MASK_LITERAL = texme.tokenLiteral.MASK
describe('tokenize', function () {
it('plain text', function () {
const input = 'Foo'
const expected = [[MARK, input]]
assert.deepStrictEqual(texme.tokenize(input), expected)
})
it('math with single dollar', function () {
const input = '$ 1 + 1 = 2 $'
const expected = [[MASK, input]]
assert.deepStrictEqual(texme.tokenize(input), expected)
})
it('math with double dollars', function () {
const input = '$$ 1 + 1 = 2 $$'
const expected = [[MASK, input]]
assert.deepStrictEqual(texme.tokenize(input), expected)
})
it('escaped dollar in the begining', function () {
const input = '\\$ 1 + 1 = 2 $'
const expected = [[MASK, '\\$'], [MARK, ' 1 + 1 = 2 $']]
assert.deepStrictEqual(texme.tokenize(input), expected)
})
it('escaped dollar in the end', function () {
const input = '$ 1 + 1 = 2 \\$'
const expected = [[MARK, '$ 1 + 1 = 2 '], [MASK, '\\$']]
assert.deepStrictEqual(texme.tokenize(input), expected)
})
it('escaped dollar followed by dollar in the beginning', function () {
const input = '\\$$ 1 + 1 = 2 $$'
const expected = [[MASK, '\\$'], [MASK, '$ 1 + 1 = 2 $'], [MARK, '$']]
assert.deepStrictEqual(texme.tokenize(input), expected)
})
it('escaped dollar followed by dollar in the end', function () {
const input = '$$ 1 + 1 = 2 \\$$'
const expected = [[MARK, '$'], [MASK, '$ 1 + 1 = 2 \\$$']]
assert.deepStrictEqual(texme.tokenize(input), expected)
// The above expected output shows a deviation from MathJax behaviour.
// MathJax would treat the entire input `$$ 1 + 1 = 2 \$` to be non-math.
// However we are parsing `$ 1 + 1 = 2 \$$` as math. There are a few things
// to be said here:
//
// - This difference in behaviour is not apparent to the user. Even with
// our deviant tokenization, after mask(), renderCommonMark(), and
// unmask(), we present `$$ 1 + 1 = 2 \$$` to MathJax, so it would end
// up treating the whole input as non-math anyway. The behaviour
// visible to the user is same with both TeXMe and pure-MathJax.
//
// - We expect the user to write `\$` instead of `$` whenever the `$`
// could be confused with TeX-delimiters. Therefore, an input like this
// which is meant to be purely non-math input is expected to be entered
// as `\$\$ 1 + 1 = 2 \$\$` by the user. In this project, we will not
// try too hard to maintain behaviour-parity with MathJax for
// ill-written input. But we will try hard to do so for well-written
// input.
})
it('escaped dollar in inline math', function () {
const input = '$ \\$1 $'
const expected = [[MASK, '$ \\$1 $']]
assert.deepStrictEqual(texme.tokenize(input), expected)
})
it('escaped dollar in displayed math', function () {
const input = '$$ \\$1 $$'
const expected = [[MASK, '$$ \\$1 $$']]
assert.deepStrictEqual(texme.tokenize(input), expected)
})
it('math with parentheses', function () {
const input = '\\( 1 + 1 = 2 \\)'
const expected = [[MASK, input]]
assert.deepStrictEqual(texme.tokenize(input), expected)
})
it('math with brackets', function () {
const input = '\\[ 1 + 1 = 2 \\]'
const expected = [[MASK, input]]
assert.deepStrictEqual(texme.tokenize(input), expected)
})
it('math environment', function () {
const input = '\\begin{align} 1 + 1 & = 2 \\\\ 2 + 2 & = 4 \\end{align}'
const expected = [[MASK, input]]
assert.deepStrictEqual(texme.tokenize(input), expected)
})
it('invalid environment', function () {
const input = '\\begin{junk} 1 + 1 & = 2 \\\\ 2 + 2 & = 4 \\end{junk}'
const expected = [[MASK, input]]
assert.deepStrictEqual(texme.tokenize(input), expected)
})
it('mask literal', function () {
const input = MASK_LITERAL
const expected = [[MASK, input]]
assert.deepStrictEqual(texme.tokenize(input), expected)
})
it('adjacent math', function () {
const input = '$ 1 + 1 = 2 $$$ 2 + 2 = 4 $$\\begin{align} 3 + 3 = 6 \\end{align}'
const expected = [
[MASK, '$ 1 + 1 = 2 $'], [MASK, '$$ 2 + 2 = 4 $$'],
[MASK, '\\begin{align} 3 + 3 = 6 \\end{align}']
]
assert.deepStrictEqual(texme.tokenize(input), expected)
})
it('single dollars in double dollars', function () {
const input = '$$ $ 1 + 1 = 2 $ $$'
const expected = [[MASK, input]]
assert.deepStrictEqual(texme.tokenize(input), expected)
})
it('single dollars in brackets', function () {
const input = '\\[ $ 1 + 1 = 2 $ \\]'
const expected = [[MASK, input]]
assert.deepStrictEqual(texme.tokenize(input), expected)
})
it('parentheses in brackets', function () {
const input = '\\[ \\( 1 + 1 = 2 \\) \\]'
const expected = [[MASK, input]]
assert.deepStrictEqual(texme.tokenize(input), expected)
})
it('dollars in environment', function () {
const input = '\\begin{align} $ 1 + 1 & = 2 $ \\\\ $$ 2 + 2 & = 4 $$ \\end{align}'
const expected = [[MASK, input]]
assert.deepStrictEqual(texme.tokenize(input), expected)
})
it('parentheses and brackets in environment', function () {
const input = '\\begin{align} \\( 1 + 1 & = 2 \\) \\\\ \\[ 2 + 2 & = 4 \\] \\end{align}'
const expected = [[MASK, input]]
assert.deepStrictEqual(texme.tokenize(input), expected)
})
it('dollars in invalid environment', function () {
const input = '\\begin{align} $ 1 + 1 & = 2 $ \\\\ $$ 2 + 2 & = 4 $$ \\end{align}'
const expected = [[MASK, input]]
assert.deepStrictEqual(texme.tokenize(input), expected)
})
it('mask in inline math', function () {
const input = '$' + MASK_LITERAL + '$'
const expected = [[MASK, input]]
assert.deepStrictEqual(texme.tokenize(input), expected)
})
it('mask in displayed math', function () {
const input = '$$' + MASK_LITERAL + '$$'
const expected = [[MASK, input]]
assert.deepStrictEqual(texme.tokenize(input), expected)
})
it('mask in environment', function () {
const input = '\\begin{align} ' + MASK_LITERAL + ' \\end{align}'
const expected = [[MASK, input]]
assert.deepStrictEqual(texme.tokenize(input), expected)
})
it('multiple lines', function () {
const l1 = 'Binomial theorem:\n'
const l2 = '$$ (x + y)^n = \\sum_{k=0}^n {n \\choose k} x^{n - k} y^k $$'
const l3 = '\nExponential function:\n'
const l4 = '\\[ e^x = \\lim_{n \\to \\infty} ' +
'\\left( 1+ \\frac{x}{n} \\right)^n \\]'
const expected = [[MARK, l1], [MASK, l2], [MARK, l3], [MASK, l4]]
assert.deepStrictEqual(texme.tokenize(l1 + l2 + l3 + l4), expected)
})
it('nested environment', function () {
const input = [
'\\begin{align*}',
'A & = \\begin{bmatrix}',
' 1 & 0 \\\\',
' 0 & 1',
' \\end{bmatrix} \\\\',
'{a}_{i} & = {b}_{i}',
'\\end{align*}'
].join('\n')
const expected = [[MASK, input]]
assert.deepStrictEqual(texme.tokenize(input), expected)
})
it('dollar in unprotected inline code', function () {
const input = '`foo = $bar` hello $ 1 + 1 = 2 $'
const expected = [
[MARK, '`foo = '],
[MASK, '$bar` hello $'],
[MARK, ' 1 + 1 = 2 $']
]
assert.deepStrictEqual(texme.tokenize(input), expected)
})
it('dollar in unprotected code block', function () {
const input = [
'```',
'foo = $bar',
'```',
'hello',
'$ 1 + 1 = 2 $'
].join('\n')
const expected = [
[MARK, '```\nfoo = '],
[MASK, '$bar\n```\nhello\n$'],
[MARK, ' 1 + 1 = 2 $']
]
assert.deepStrictEqual(texme.tokenize(input), expected)
})
it('dollar in protected inline code', function () {
const input = '\\begin{md}`foo = $bar`\\end{md} hello $ 1 + 1 = 2 $'
const expected = [
[MARK, '`foo = $bar`'],
[MARK, ' hello '],
[MASK, '$ 1 + 1 = 2 $']
]
assert.deepStrictEqual(texme.tokenize(input), expected)
})
it('dollar in protected code block', function () {
const input = [
'\\begin{md}',
'```',
'foo = $bar',
'```',
'\\end{md}',
'hello',
'$ 1 + 1 = 2 $'
].join('\n')
const expected = [
[MARK, '\n```\nfoo = $bar\n```\n'],
[MARK, '\nhello\n'],
[MASK, '$ 1 + 1 = 2 $']
]
assert.deepStrictEqual(texme.tokenize(input), expected)
})
it('unprotected nested code block', function () {
const input = '\\begin{md}`\\begin{md}x\\end{md} a = $b`\\end{md} $ 0 $'
const expected = [
[MARK, '`\\begin{md}x'],
[MARK, ' a = '],
[MASK, '$b`\\end{md} $'],
[MARK, ' 0 $']
]
assert.deepStrictEqual(texme.tokenize(input), expected)
})
it('protected nested code block', function () {
const input = '\\begin{md*}`\\begin{md}x\\end{md} a = $b`\\end{md*} $ 0 $'
const expected = [
[MARK, '`\\begin{md}x\\end{md} a = $b`'],
[MARK, ' '],
[MASK, '$ 0 $']
]
assert.deepStrictEqual(texme.tokenize(input), expected)
})
it('non-greedy environment name', function () {
const input = '\\begin{equation} *{x}* = *{y}* \\end{equation} *{x}*'
const expected = [
[MASK, '\\begin{equation} *{x}* = *{y}* \\end{equation}'],
[MARK, ' *{x}*']
]
assert.deepStrictEqual(texme.tokenize(input), expected)
})
})
|
import React, {Component} from 'react';
import { connect } from 'react-redux';
import { getQuestions, formatText, screens } from './helpers';
import { setGameState } from '../../../../functions/index';
class ChooseQuestion extends Component {
constructor(props) {
super(props);
this.state = {
questions: []
}
}
componentDidMount() {
const { playerIndex, gameState, players } = this.props;
const { round, rounds, category } = gameState;
if (rounds[round].askingIndex === playerIndex) {
const questions = getQuestions(category).map(question => formatText(question, rounds[round], players));
this.setState({questions});
}
}
submitQuestionChoice = (question) => {
setGameState(this.props.code, {
screen: screens.readQuestion,
question
});
}
render() {
const { playerIndex, gameState, players } = this.props;
const { round, rounds } = gameState;
const { questions } = this.state;
const { answeringIndex, askingIndex } = rounds[round];
const answeringPlayer = answeringIndex === playerIndex ? 'you' : players.find(player => player.index === answeringIndex).name;
const askingPlayer = players.find(player => player.index === askingIndex).name;
if (!rounds || !rounds[round]) {
return <div>Loading...</div>;
} else if (askingIndex === playerIndex) {
return <div className="column">
<h2>Choose a question for {answeringPlayer}:</h2>
<form onSubmit={e => e.preventDefault()} className="column options">
{questions.map((question, i) => <button type="submit" key={i} onClick={() => this.submitQuestionChoice(question)}>{question}</button>)}
</form>
</div>
} else {
return <h2>{askingPlayer} is choosing a question for {answeringPlayer}...</h2>
}
}
}
function mapStateToProps({ gameState, playerIndex, players, code }) {
return { gameState, playerIndex, players, code };
}
export default connect(mapStateToProps, null)(ChooseQuestion);
|
/* globals describe it expect */
import clone from '../src/clone'
describe('clone', () => {
it('should clone a string', () => {
let a = 'foo'
let b = clone(a)
a = 'bar'
expect(a).toBe('bar')
expect(b).toBe('foo')
})
it('should clone a number', () => {
let a = 10
let b = clone(a)
a = 3
expect(a).toBe(3)
expect(b).toBe(10)
})
it('should clone an array', () => {
let a = [ 'foo', 'bar' ]
let b = clone(a)
a.push('baz')
expect(a).toEqual([ 'foo', 'bar', 'baz' ])
expect(b).toEqual([ 'foo', 'bar' ])
})
it('should clone an object', () => {
let a = { foo: 1, bar: 2 }
let b = clone(a)
a.baz = 3
expect(a).toEqual({ foo: 1, bar: 2, baz: 3 })
expect(b).toEqual({ foo: 1, bar: 2 })
})
it('should deep clone', () => {
let a = { foo: [ 1, 2, { bar: 3 } ] }
let b = clone(a)
a.foo[ 2 ].bar = 4
expect(a).toEqual({ foo: [ 1, 2, { bar: 4 } ] })
expect(b).toEqual({ foo: [ 1, 2, { bar: 3 } ] })
})
})
|
import Select from './select';
import Picker from './picker';
export {
Picker,
Select,
};
|
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { compose } from 'redux';
import { createStructuredSelector } from 'reselect';
import { css } from 'styled-components';
import Box from '@/components/Box';
import HoriontalScale from '@/components/HorizontalScale';
import Plates from '@/components/Plates';
import { getDates } from '@/containers/DateSelector/actions';
import TestResults from '@/containers/TestResults';
import injectLogic from '@/utils/injectLogic';
import injectReducer from '@/utils/injectReducer';
import injectStyles from '@/utils/injectStyles';
import CONSTANTS from './constants';
import logic from './logic';
import reducer from './reducer';
import {
makeSelectPlatesResultByRange,
makeSelectScalesResultByRange,
makeSelectStatus
} from './selectors';
class HemoglobinMassTest extends Component {
componentDidMount() {
const { dispatch } = this.props;
dispatch(getDates(CONSTANTS.DATES_PATH, 1, CONSTANTS.GRAPHQL_BACK_TYPE));
}
render() {
// const { status, statusByRange, platesData } = this.props;
const { platesData, scalesData, className } = this.props;
return (
// <TestResults status={status}>
<TestResults status="loaded">
<Box title="Общая гемоглобиновая масса" className={className}>
<p>ОМГ</p>
<HoriontalScale
value={scalesData[0].value}
minValue={8}
maxValue={20.2}
maximum={20.1}
markers={{ spacing: 2, caption: 2 }}
/>
<p>ОЦК</p>
<HoriontalScale
value={scalesData[1].value}
minValue={40}
maxValue={140}
maximum={135}
type={['ock', 'man']}
markers={{ spacing: 10, caption: 2 }}
/>
<Plates data={platesData} />
</Box>
{/* <Box title="Динамика">
</Box> */}
</TestResults>
);
}
}
HemoglobinMassTest.propTypes = {
className: PropTypes.string.isRequired,
dispatch: PropTypes.func.isRequired,
results: PropTypes.shape({
data: PropTypes.shape({
data: PropTypes.array,
total: PropTypes.number
}),
dataHashKey: PropTypes.string
}),
// status: PropTypes.string.isRequired,
// statusByRange: PropTypes.string.isRequired
platesData: PropTypes.array.isRequired,
scalesData: PropTypes.array.isRequired,
};
HemoglobinMassTest.defaultProps = {
results: {}
};
HemoglobinMassTest.displayName = 'HemoglobinMassTest';
const mapStateToProps = createStructuredSelector({
status: makeSelectStatus(CONSTANTS.REDUCER_KEY.RESULTS),
statusByRange: makeSelectStatus(CONSTANTS.REDUCER_KEY.RESULTS_BY_RANGE),
platesData: makeSelectPlatesResultByRange(),
scalesData: makeSelectScalesResultByRange()
});
const withConnect = connect(mapStateToProps);
const withLogic = injectLogic({ logic, type: 'test' });
const withReducer = injectReducer({ key: CONSTANTS.REDUCER_KEY.KEY, reducer });
const styles = css`
& > ${Plates} {
margin-top: 20px;
}
& > p {
font: 700 15px/20px var(--ff);
color: #4d4f4f;
}
`;
export default compose(
withConnect,
withLogic,
withReducer
)(injectStyles(HemoglobinMassTest, styles));
|
import {
useCallback,
useContext
} from 'preact/hooks';
import {
LayoutContext
} from '../context';
/**
* Creates a state that persists in the global LayoutContext.
*
* @example
* ```jsx
* function Group(props) {
* const [ open, setOpen ] = useLayoutState([ 'groups', 'foo', 'open' ], false);
* }
* ```
*
* @param {(string|number)[]} path
* @param {any} [defaultValue]
*
* @returns {[ any, Function ]}
*/
export function useLayoutState(path, defaultValue) {
const {
getLayoutForKey,
setLayoutForKey
} = useContext(LayoutContext);
const layoutForKey = getLayoutForKey(path, defaultValue);
const setState = useCallback ((newValue) => {
setLayoutForKey(path, newValue);
}, [ setLayoutForKey ]);
return [ layoutForKey, setState ];
}
|
import React from 'react'
import { Field, reduxForm } from 'redux-form'
import { RenderField } from '../shared'
const validate = values => {
const errors = {}
if (!values.username) {
errors.username = 'Required'
} else if (values.username.length > 15) {
errors.username = 'Must be 15 characters or less'
}
if (!values.email) {
errors.email = 'Required'
} else if (!/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i.test(values.email)) {
errors.email = 'Invalid email address'
}
if (!values.age) {
errors.age = 'Required'
} else if (isNaN(Number(values.age))) {
errors.age = 'Must be a number'
} else if (Number(values.age) < 18) {
errors.age = 'Sorry, you must be at least 18 years old'
}
return errors
}
const warn = values => {
const warnings = {}
if (values.age < 19) {
warnings.age = 'Hmm, you seem a bit young...'
}
return warnings
}
const SyncValidationForm = ({handleSubmit, pristine, reset, submitting}) => {
return (
<form
noValidate
onSubmit={handleSubmit}>
<div className="mt-3">
<Field
name="username"
type="text"
component={RenderField}
label="Username"
/>
</div>
<div className="mt-3">
<Field name="email" type="email" component={RenderField} label="Email" />
</div>
<div className="mt-3">
<Field name="age" type="number" component={RenderField} label="Age" />
</div>
<div>
<button type="submit" className="btn btn-secondary" disabled={submitting}>
Submit
</button>
<button type="button" className="btn btn-light ml-3" disabled={pristine || submitting} onClick={reset}>
Clear Values
</button>
</div>
</form>
)
}
export default reduxForm({
form: 'syncValidation',
validate,
warn,
forceUnregisterOnUnmount: true,
destroyOnUnmount: false
})(SyncValidationForm)
export const listing = `
import React from 'react'
import { Field, reduxForm } from 'redux-form'
import { RenderField } from '../shared'
const validate = values => {
const errors = {}
if (!values.username) {
errors.username = 'Required'
} else if (values.username.length > 15) {
errors.username = 'Must be 15 characters or less'
}
if (!values.email) {
errors.email = 'Required'
} else if (!/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i.test(values.email)) {
errors.email = 'Invalid email address'
}
if (!values.age) {
errors.age = 'Required'
} else if (isNaN(Number(values.age))) {
errors.age = 'Must be a number'
} else if (Number(values.age) < 18) {
errors.age = 'Sorry, you must be at least 18 years old'
}
return errors
}
const warn = values => {
const warnings = {}
if (values.age < 19) {
warnings.age = 'Hmm, you seem a bit young...'
}
return warnings
}
const SyncValidationForm = ({handleSubmit, pristine, reset, submitting}) => {
return (
<form
noValidate
onSubmit={handleSubmit}>
<div className="mt-3">
<Field
name="username"
type="text"
component={RenderField}
label="Username"
/>
</div>
<div className="mt-3">
<Field name="email" type="email" component={RenderField} label="Email" />
</div>
<div className="mt-3">
<Field name="age" type="number" component={RenderField} label="Age" />
</div>
<div>
<button type="submit" className="btn btn-secondary" disabled={submitting}>
Submit
</button>
<button type="button" className="btn btn-light ml-3" disabled={pristine || submitting} onClick={reset}>
Clear Values
</button>
</div>
</form>
)
}
export default reduxForm({
form: 'syncValidation',
validate,
warn,
forceUnregisterOnUnmount: true,
destroyOnUnmount: false
})(SyncValidationForm)
`
|
import React,{Component} from 'react';
import {Link} from 'react-router-dom';
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import PropTypes from 'prop-types';
import TopBar from '../items/topBar';
import Loading from '../items/loading';
import {queryCart} from "../functional/common";
import {QueryCartList} from "../../action/action";
class Order extends Component{
constructor(props) {
super(props);
this.state = {
orderList: [{
time: 'Monday, 08.08',
vendor: '商家1'
}]
};
}
componentWillMount() {
document.body.style.background = '#fff';
}
componentDidMount() {
let fetch = queryCart();
this.props.QueryCartList(fetch);
}
goBack() {
this.context.router.history.goBack();
}
render() {
this.cartList = this.props.cartList ? this.props.cartList : localStorage.getItem('cartList');
return(
<div className="order">
<TopBar goBack={this.goBack.bind(this)}/>
{(() => {
console.log(this.cartList)
if(this.props.loading) {
//加载动画
return(<Loading style={{
position: 'absolute',
top: 0,
right: 0,
bottom: 0,
left: 0,
margin: 'auto'
}}/>)
}else{
if(this.cartList) {
//没有order数据显示
if(this.cartList.length <= 0) {
return(<div className="isCenter">You don't have any orders yet</div>)
}
//有order数据显示
else{
return(
this.state.orderList.map((res,i) => (
<div key={i}>
<div className="time">{res.time}</div>
<div className="vendor-box">
<div className="vendor">{res.vendor}</div>
<div className="orderGoods">
<div>
<p>商品1</p>
<p>1</p>
<span className="iconfont icon-close"></span>
</div>
<div>
<p>商品2</p>
<p>1</p>
<span className="iconfont icon-close"></span>
</div>
</div>
</div>
<div className="address-box">
<div>
<p>12:00 @ 123 Street and 456 Ave, BJ后面</p>
<p className="circle circle-active"></p>
</div>
<div>
<p>12:00 @ 123 Street and 456 Ave, BJ后面</p>
<p className="circle"></p>
</div>
<div>
<p>12:00 @ 123 Street and 456 Ave, BJ后面</p>
<p className="circle"></p>
</div>
</div>
<div className="time">{res.time}</div>
<div className="vendor-box">
<div className="vendor">{res.vendor}</div>
<div className="orderGoods">
<div>
<p>商品1</p>
<p>1</p>
<span className="iconfont icon-close"></span>
</div>
<div>
<p>商品2</p>
<p>1</p>
<span className="iconfont icon-close"></span>
</div>
</div>
</div>
<div className="address-box">
<div>
<p>12:00 @ 123 Street and 456 Ave, BJ后面</p>
<p className="circle circle-active"></p>
</div>
<div>
<p>12:00 @ 123 Street and 456 Ave, BJ后面</p>
<p className="circle"></p>
</div>
<div>
<p>12:00 @ 123 Street and 456 Ave, BJ后面</p>
<p className="circle"></p>
</div>
</div>
<div className="placeOrder">Place Order</div>
</div>
))
);
}
}
}
})()}
</div>
)
}
}
Order.contextTypes = {
router: PropTypes.object
};
const mapStateToProps = (state,props) => {
console.log(state)
return state;
};
const mapDispatchToProps = (dispatch, ownProps) => {
return bindActionCreators({
QueryCartList
},dispatch);
};
export default connect(mapStateToProps, mapDispatchToProps)(Order);
|
import './HotStickersList.css'
import ShopPage from "./ShopPage";
import { Link } from "react-router-dom";
function WarnAndFuzzyStickerList(){
return(
<ShopPage>
<div className="StickerList">
<Link to ="/Sticker6001">
<div className="Sticker-from">
<div className="Stcker-ShowImg">
<img src="Profile-250.png" width="90px" height="90px" />
</div>
<div className="Sticker-DisptionZone">
<div className="Sticker-Name">
<p id="name">Sticker 6001</p>
</div>
<div className="Sticker-Disption">
<p id="disption">Disption 6001</p>
</div>
</div>
</div>
</Link>
</div>
</ShopPage>
);
};
export default WarnAndFuzzyStickerList;
|
(function($) {
if(!$.responsiveImageTag){
$.responsiveImageTag = new Object();
};
$.responsiveImageTag = function(el, options) {
// To avoid scope issues, use 'base' instead of 'this'
// to reference this class from internal events and functions.
var base = this;
// Access to jQuery and DOM versions of element
base.$el = $(el);
base.el = el;
base.el.data('responsiveImageTag', base);
base.platform = "desktop";
base.options = $.extend({}, $.responsiveImageTag.defaultOptions, options);
//Public functions
base.init = function() {
// Test for available width in current browser window
// 767px, anything smaller than an ipad is considered mobile
if(screen.width <= 767){
base.platform = "mobile";
}
var $img = $("<img/>", {
"alt": base.$el.attr("data-alttext"),
"class": base.$el.attr("data-cssclass")
});
if(base.platform === "mobile"){
$img.attr("src", base.$el.attr("data-mobilesrc"));
}else{
$img.attr("src", base.$el.attr("data-fullsrc"));
}
base.$el.prev().append($img);
base.$el.hide();
};
// Call init function
base.init();
};
$.responsiveImageTag.defaultOptions = {
// Currently no options
};
$.fn.responsiveImageTag = function(options) {
return this.each(function() {
(new $.responsiveImageTag($(this), options));
});
};
//Private function
})(jQuery);
|
/*
***********************************************************************************
ORIGINAL SOURCE: https://github.com/cwilso/volume-meter/blob/master/volume-meter.js
***********************************************************************************
The MIT License (MIT)
Copyright (c) 2014 Chris Wilson
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
var andre;
var connected = false;
document.onmousedown = () => {
if (connected) return;
andre = document.getElementById("chin");
navigator.mediaDevices.getUserMedia(
{
audio: {
mandatory: {
googHighpassFilter: false,
googNoiseSuppression: false,
googAutoGainControl: false,
googEchoCancellation: false
}
}
}
)
.then(connectToStream)
.catch((err) => {
alert("Error: " + err);
document.getElementsByTagName("red")[0].style.background = "green";
});
};
function connectToStream(stream) {
connected = true;
document.getElementsByTagName("body")[0].style.background = "green";
let audioContext = new AudioContext();
let mediaStream = audioContext.createMediaStreamSource(stream);
let processor = audioContext.createScriptProcessor(512);
mediaStream.connect(processor);
processor.clipping = false;
processor.lastClip = 0;
processor.volume = 0;
processor.clipLevel = 0.98;
processor.averaging = 0.95;
processor.clipLag = 750;
processor.connect(audioContext.destination);
processor.onaudioprocess = (e) => {
let input = e.inputBuffer.getChannelData(0);
let sum = 0;
for (let i = 0; i < input.length; i++) {
let vol = input[i];
if (Math.abs(vol) >= processor.clipLevel) {
processor.clipping = true;
processor.lastClip = window.performance.now();
}
sum += vol * vol;
}
let avg = Math.sqrt(sum / input.length); //get average of input volumes
processor.volume = Math.max(avg, processor.volume * processor.averaging);
requestAnimationFrame(() => {
andre.style.transform = `rotate(${-160 * processor.volume}deg)`; //change chin transform relative to volume
});
}
processor.shutdown = () => {
processor.disconnect();
processor.onaudioprocess = null;
}
}
|
class Toggle extends HTMLElement {
constructor(...args) {
super(...args);
this.state = {isToggleOn: true};
}
// standard W3C EventListener behavior
handleEvent() {
this.state.isToggleOn = !this.state.isToggleOn;
}
render() {
return this.html`
<button onclick=${this}>
${this.state.isToggleOn ? 'ON' : 'OFF'}
</button>`;
}
}
|
module.exports = {
title: {
notEmpty: true,
errorMessage: 'A title is required',
},
subtitle: {
notEmpty: true,
errorMessage: 'A subtitle is required',
},
category: {
notEmpty: true,
errorMessage: 'A category is required',
},
author: {
notEmpty: true,
errorMessage: 'An author is required',
},
body: {
notEmpty: true,
errorMessage: 'A body is required',
},
};
|
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { compose } from 'redux';
import { createStructuredSelector } from 'reselect';
import { QUESTIONS } from '@/athleteTests/AnxietyQuiz/constants';
import Box from '@/components/Box';
import HistogramChart from '@/components/HistogramChart';
import QuizAnswers from '@/components/QuizAnswers';
// import LineChart from '@/components/LineChart';
import { getDates } from '@/containers/DateSelector/actions';
import TestResults from '@/containers/TestResults';
import injectLogic from '@/utils/injectLogic';
import injectReducer from '@/utils/injectReducer';
import { COLORS } from '@/utils/styleConstants';
import CONSTANTS from './constants';
import AnswersContainer from './elements/AnswersContainer';
import logic from './logic';
import reducer from './reducer';
import {
// makeSelectDynamic,
makeSelectHistogramResultByRange,
// makeSelectLegend,
makeSelectStatus
} from './selectors';
class AnxietyTest extends Component {
componentDidMount() {
const { dispatch } = this.props;
const { API_TYPE, DATES_PATH } = CONSTANTS;
dispatch(getDates(DATES_PATH, API_TYPE));
}
render() {
const { histogramData } = this.props;
const result = {};
result.answers = [1, 2, 3, 4, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 2, 1, 2, 3, 4,1, 2, 3, 4, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 2, 1, 2, 3, 4];
return (
<TestResults /* status={status} */>
<Box /* status={statusByRange} */ title="Личностная и ситуативная тревожность">
<HistogramChart
{...histogramData}
colors={bar => bar?.data?.color}
legendValue=""
units=""
/>
</Box>
<Box /* status={statusByRange} */ title="Результаты тестирования">
Соответствующая тревожность оптимальная
</Box>
<Box title="Ответы на вопросы">
<AnswersContainer>
<QuizAnswers answers={result.answers.slice(0, 20)} questions={QUESTIONS.FIRST} />
<hr />
<QuizAnswers
answers={result.answers.slice(0, 20)}
color={COLORS.QUIZ.SECONDARY}
questions={QUESTIONS.SECOND}
/>
</AnswersContainer>
</Box>
</TestResults>
);
}
}
AnxietyTest.propTypes = {
dispatch: PropTypes.func.isRequired,
legend: PropTypes.array,
histogramData: PropTypes.object,
status: PropTypes.string.isRequired,
statusByRange: PropTypes.string.isRequired
};
AnxietyTest.defaultProps = {
legend: [],
histogramData: {}
};
AnxietyTest.displayName = 'AnxietyTest';
// AnxietyTest.whyDidYouRender = true;
const mapStateToProps = createStructuredSelector({
/* legend: makeSelectLegend(), */
histogramData: makeSelectHistogramResultByRange(),
status: makeSelectStatus(CONSTANTS.REDUCER_KEY.RESULTS),
statusByRange: makeSelectStatus(CONSTANTS.REDUCER_KEY.RESULTS_BY_RANGE)
});
const withConnect = connect(mapStateToProps);
const withLogic = injectLogic({ logic, type: 'test' });
const withReducer = injectReducer({ key: CONSTANTS.REDUCER_KEY.KEY, reducer });
export default compose(
withConnect,
withLogic,
withReducer
)(AnxietyTest);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.