Comparing version 0.5.1 to 0.5.2
50
app.js
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const moment = require("moment"); | ||
const React = require("react"); | ||
const react_dom_1 = require("react-dom"); | ||
const history_1 = require("history"); | ||
const redux_1 = require("redux"); | ||
const react_redux_1 = require("react-redux"); | ||
const MetricsTable_1 = require("./components/MetricsTable"); | ||
const RecentActions_1 = require("./components/RecentActions"); | ||
const ConfigNumber_1 = require("./components/ConfigNumber"); | ||
const ConfigCheckbox_1 = require("./components/ConfigCheckbox"); | ||
const react_router_1 = require("react-router"); | ||
const connected_react_router_1 = require("connected-react-router"); | ||
const reducers = require("./reducers"); | ||
const types_1 = require("./types"); | ||
const packageDefinition = require('./package.json'); | ||
const App_1 = require("./components/App"); | ||
require("./site.less"); | ||
const buildTimestamp = __WEBPACK_TIMESTAMP__; | ||
const history = history_1.createHashHistory(); | ||
const reducer = redux_1.combineReducers(reducers); | ||
const store = redux_1.createStore(reducer); | ||
const store = redux_1.createStore(connected_react_router_1.connectRouter(history)(reducer), redux_1.compose(redux_1.applyMiddleware(connected_react_router_1.routerMiddleware(history)))); | ||
document.addEventListener('visibilitychange', () => { | ||
@@ -30,35 +28,5 @@ /** | ||
}); | ||
class App extends React.Component { | ||
render() { | ||
const { configuration, now } = this.props; | ||
const { daysPast } = configuration; | ||
const end = moment().endOf('day'); | ||
const start = end.clone().subtract(daysPast, 'd'); | ||
return (React.createElement("main", null, | ||
React.createElement("div", { className: "flex" }, | ||
React.createElement("h2", null, "Biometry App"), | ||
React.createElement("div", null, | ||
React.createElement(ConfigNumber_1.default, { label: "Days Past", name: "daysPast" }), | ||
React.createElement(ConfigCheckbox_1.default, { label: "Sort Alphabetically", name: "sortAlphabetically" }), | ||
React.createElement(ConfigCheckbox_1.default, { label: "Exclude Empty", name: "excludeEmpty" }))), | ||
React.createElement("section", null, | ||
React.createElement(MetricsTable_1.default, { start: start, end: end })), | ||
React.createElement("section", null, | ||
React.createElement("h3", null, "Recent Additions"), | ||
React.createElement(RecentActions_1.default, { limit: 20 })), | ||
React.createElement("footer", null, | ||
React.createElement("div", { className: "important" }, | ||
"Now: ", | ||
now.toISOString()), | ||
React.createElement("div", null, | ||
"Built: ", | ||
buildTimestamp), | ||
React.createElement("div", null, | ||
"Version: ", | ||
packageDefinition.version)))); | ||
} | ||
} | ||
const mapStateToProps = ({ configuration, now }) => ({ configuration, now }); | ||
const ConnectedApp = react_redux_1.connect(mapStateToProps)(App); | ||
react_dom_1.render((React.createElement(react_redux_1.Provider, { store: store }, | ||
React.createElement(ConnectedApp, null))), document.getElementById('app')); | ||
React.createElement(connected_react_router_1.ConnectedRouter, { history: history }, | ||
React.createElement(react_router_1.Switch, null, | ||
React.createElement(react_router_1.Route, { component: App_1.default }))))), document.getElementById('app')); |
@@ -11,2 +11,3 @@ "use strict"; | ||
const react_redux_1 = require("react-redux"); | ||
const bind_1 = require("@chbrown/bind"); | ||
const types_1 = require("../types"); | ||
@@ -24,7 +25,7 @@ class ConfigCheckbox extends React.Component { | ||
React.createElement("input", { type: "checkbox", checked: value, onChange: this.onChange }), | ||
React.createElement("b", null, label))); | ||
React.createElement("b", null, label || name))); | ||
} | ||
} | ||
__decorate([ | ||
types_1.bind | ||
bind_1.default | ||
], ConfigCheckbox.prototype, "onChange", null); | ||
@@ -31,0 +32,0 @@ const mapStateToProps = ({ configuration }) => ({ configuration }); |
@@ -11,2 +11,3 @@ "use strict"; | ||
const react_redux_1 = require("react-redux"); | ||
const bind_1 = require("@chbrown/bind"); | ||
const types_1 = require("../types"); | ||
@@ -24,3 +25,3 @@ class ConfigNumber extends React.Component { | ||
React.createElement("div", null, | ||
React.createElement("b", null, label)), | ||
React.createElement("b", null, label || name)), | ||
React.createElement("input", { type: "number", value: value, onChange: this.onChange }))); | ||
@@ -30,3 +31,3 @@ } | ||
__decorate([ | ||
types_1.bind | ||
bind_1.default | ||
], ConfigNumber.prototype, "onChange", null); | ||
@@ -33,0 +34,0 @@ const mapStateToProps = ({ configuration }) => ({ configuration }); |
@@ -14,2 +14,3 @@ "use strict"; | ||
const react_redux_1 = require("react-redux"); | ||
const bind_1 = require("@chbrown/bind"); | ||
const types_1 = require("../types"); | ||
@@ -28,13 +29,14 @@ const defaultHeaders = new Headers({ 'Content-Type': 'application/json' }); | ||
} | ||
function groupBy(xs, keyFn) { | ||
const hash = {}; | ||
xs.forEach(x => { | ||
function groupBy(values, keyFn) { | ||
const hashmap = new Map(); | ||
values.forEach(x => { | ||
const key = keyFn(x); | ||
let list = hash[key]; | ||
let list = hashmap.get(key); | ||
if (list === undefined) { | ||
list = hash[key] = []; | ||
list = []; | ||
hashmap.set(key, list); | ||
} | ||
list.push(x); | ||
}); | ||
return hash; | ||
return hashmap; | ||
} | ||
@@ -126,7 +128,7 @@ function createRange(start, end, duration) { | ||
__decorate([ | ||
types_1.bind | ||
bind_1.default | ||
], ActionSpan.prototype, "onDelete", null); | ||
const ConnectedActionSpan = react_redux_1.connect()(ActionSpan); | ||
class ActiontypeCell extends React.Component { | ||
onAdd(ev) { | ||
onAdd(_ev) { | ||
const { instant, actiontype_id } = this.props; | ||
@@ -155,3 +157,3 @@ dispatchSyncActions(this.props.dispatch, { | ||
__decorate([ | ||
types_1.bind | ||
bind_1.default | ||
], ActiontypeCell.prototype, "onAdd", null); | ||
@@ -233,3 +235,3 @@ const ConnectedActiontypeCell = react_redux_1.connect()(ActiontypeCell); | ||
const actiontypesWithActions = actiontypes.filter(actiontype => { | ||
const actiontypeActions = actions_hashmap[actiontype.actiontype_id] || []; | ||
const actiontypeActions = actions_hashmap.get(actiontype.actiontype_id) || []; | ||
const enteredSameDay = moment(actiontype.entered).isSame(highlighted_moment, 'day'); | ||
@@ -244,3 +246,3 @@ // if excludeEmpty is false, we include everything | ||
}).map(actiontype => { | ||
const actiontypeActions = actions_hashmap[actiontype.actiontype_id] || []; | ||
const actiontypeActions = actions_hashmap.get(actiontype.actiontype_id) || []; | ||
return { actiontype, actions: actiontypeActions }; | ||
@@ -274,3 +276,3 @@ }); | ||
__decorate([ | ||
types_1.bind | ||
bind_1.default | ||
], MetricsTable.prototype, "onAddActiontype", null); | ||
@@ -277,0 +279,0 @@ const mapStateToProps = ({ actions, actiontypes, now, configuration }) => ({ actions, actiontypes, now, configuration }); |
@@ -7,3 +7,3 @@ "use strict"; | ||
const ActionRow = ({ action, actiontype, now, format = 'YYYY-MM-DD h:mma' }) => { | ||
const instantaneous = (action.started - action.ended) === 0; | ||
const instantaneous = (action.started.getTime() - action.ended.getTime()) === 0; | ||
const ago = moment(action.entered).from(now); | ||
@@ -24,10 +24,5 @@ return (React.createElement("tr", null, | ||
}; | ||
class RecentActions extends React.Component { | ||
render() { | ||
const { actions, actiontypes, now, limit = 20 } = this.props; | ||
return (React.createElement("table", null, actions.slice(-limit).reverse().map(action => React.createElement(ActionRow, { key: action.action_id, action: action, now: now, actiontype: actiontypes.find(actiontype => actiontype.actiontype_id == action.actiontype_id) })))); | ||
} | ||
} | ||
const RecentActions = ({ actions, actiontypes, now, limit = 20 }) => (React.createElement("table", null, actions.slice(-limit).reverse().map(action => React.createElement(ActionRow, { key: action.action_id, action: action, now: now, actiontype: actiontypes.find(actiontype => actiontype.actiontype_id == action.actiontype_id) })))); | ||
const mapStateToProps = ({ actions, actiontypes, now }) => ({ actions, actiontypes, now }); | ||
const ConnectedRecentActions = react_redux_1.connect(mapStateToProps)(RecentActions); | ||
exports.default = ConnectedRecentActions; |
{ | ||
"name": "biometry", | ||
"description": "Biometry user interface", | ||
"version": "0.5.1", | ||
"version": "0.5.2", | ||
"keywords": [ | ||
@@ -16,27 +16,34 @@ "biometrics" | ||
"dependencies": { | ||
"moment": "^2.22.1", | ||
"prop-types": "^15.6.1", | ||
"react": "^16.3.2", | ||
"react-dom": "^16.3.2", | ||
"react-redux": "^5.0.7", | ||
"redux": "^4.0.0", | ||
"tarry": "0.3.4" | ||
"@chbrown/bind": "1.0.0", | ||
"connected-react-router": "4.3.0", | ||
"history": "4.7.2", | ||
"moment": "2.22.2", | ||
"prop-types": "15.6.2", | ||
"react": "16.4.1", | ||
"react-dom": "16.4.1", | ||
"react-redux": "5.0.7", | ||
"react-router": "4.3.1", | ||
"react-router-dom": "4.3.1", | ||
"redux": "4.0.0", | ||
"tarry": "0.4.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^9.6.7", | ||
"@types/prop-types": "^15.5.2", | ||
"@types/react": "^16.3.13", | ||
"@types/react-dom": "^16.0.5", | ||
"@types/react-redux": "^5.0.19", | ||
"ajv": "^6.4.0", | ||
"babel-core": "^6.26.3", | ||
"babel-loader": "^7.1.4", | ||
"babel-preset-env": "^1.6.1", | ||
"css-loader": "^0.28.9", | ||
"less": "^3.0.2", | ||
"less-loader": "^4.0.5", | ||
"style-loader": "^0.21.0", | ||
"typescript": "^2.8.3", | ||
"webpack": "^4.6.0", | ||
"webpack-cli": "^2.0.15" | ||
"@types/node": "10.5.2", | ||
"@types/prop-types": "15.5.3", | ||
"@types/react": "16.4.6", | ||
"@types/react-dom": "16.0.6", | ||
"@types/react-redux": "6.0.4", | ||
"@types/react-router": "4.0.28", | ||
"@types/react-router-dom": "4.2.7", | ||
"ajv": "6.5.2", | ||
"babel-core": "6.26.3", | ||
"babel-loader": "7.1.5", | ||
"babel-preset-env": "1.7.0", | ||
"css-loader": "1.0.0", | ||
"less": "3.7.1", | ||
"less-loader": "4.1.0", | ||
"style-loader": "0.21.0", | ||
"typescript": "2.9.2", | ||
"webpack": "4.16.0", | ||
"webpack-cli": "3.0.8" | ||
}, | ||
@@ -43,0 +50,0 @@ "scripts": { |
15
types.js
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.metry_host = 'https://metry.test'; | ||
function bind(target, propertyKey, descriptor) { | ||
return { | ||
configurable: true, | ||
get() { | ||
const value = descriptor.value.bind(this); | ||
Object.defineProperty(this, propertyKey, { | ||
value, | ||
configurable: true, | ||
writable: true, | ||
}); | ||
return value; | ||
}, | ||
}; | ||
} | ||
exports.bind = bind; | ||
exports.OperationType = { | ||
@@ -20,0 +5,0 @@ ADD_ACTIONS: 'ADD_ACTIONS', |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
304016
14
1551
12
18
+ Added@chbrown/bind@1.0.0
+ Addedconnected-react-router@4.3.0
+ Addedhistory@4.7.2
+ Addedreact-router@4.3.1
+ Addedreact-router-dom@4.3.1
+ Added@chbrown/bind@1.0.0(transitive)
+ Addedasap@2.0.6(transitive)
+ Addedconnected-react-router@4.3.0(transitive)
+ Addedcore-js@1.2.7(transitive)
+ Addedencoding@0.1.13(transitive)
+ Addedfbjs@0.8.18(transitive)
+ Addedhistory@4.7.2(transitive)
+ Addedhoist-non-react-statics@2.5.5(transitive)
+ Addediconv-lite@0.6.3(transitive)
+ Addedimmutable@3.8.2(transitive)
+ Addedis-stream@1.1.0(transitive)
+ Addedisarray@0.0.1(transitive)
+ Addedisomorphic-fetch@2.2.1(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedlodash-es@4.17.21(transitive)
+ Addedmoment@2.22.2(transitive)
+ Addednode-fetch@1.7.3(transitive)
+ Addedpath-to-regexp@1.9.0(transitive)
+ Addedpromise@7.3.1(transitive)
+ Addedprop-types@15.6.2(transitive)
+ Addedreact@16.4.1(transitive)
+ Addedreact-dom@16.4.1(transitive)
+ Addedreact-redux@5.0.7(transitive)
+ Addedreact-router@4.3.1(transitive)
+ Addedreact-router-dom@4.3.1(transitive)
+ Addedredux@3.7.24.0.0(transitive)
+ Addedresolve-pathname@2.2.0(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsetimmediate@1.0.5(transitive)
+ Addedsymbol-observable@1.2.0(transitive)
+ Addedtarry@0.4.0(transitive)
+ Addedua-parser-js@0.7.39(transitive)
+ Addedvalue-equal@0.4.0(transitive)
+ Addedwarning@3.0.04.0.3(transitive)
+ Addedwhatwg-fetch@3.6.20(transitive)
- Removed@babel/runtime@7.26.0(transitive)
- Removedhoist-non-react-statics@3.3.2(transitive)
- Removedmoment@2.30.1(transitive)
- Removedprop-types@15.8.1(transitive)
- Removedreact@16.14.0(transitive)
- Removedreact-dom@16.14.0(transitive)
- Removedreact-is@16.13.1(transitive)
- Removedreact-lifecycles-compat@3.0.4(transitive)
- Removedreact-redux@5.1.2(transitive)
- Removedredux@4.2.1(transitive)
- Removedregenerator-runtime@0.14.1(transitive)
- Removedscheduler@0.19.1(transitive)
- Removedtarry@0.3.4(transitive)
Updatedmoment@2.22.2
Updatedprop-types@15.6.2
Updatedreact@16.4.1
Updatedreact-dom@16.4.1
Updatedreact-redux@5.0.7
Updatedredux@4.0.0
Updatedtarry@0.4.0