0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-06 20:52:40 +00:00

Merge branch 'master' into addLocalLogin-#269

This commit is contained in:
G.Ambatte
2022-03-27 17:09:13 +13:00
4 changed files with 80 additions and 54 deletions

74
package-lock.json generated
View File

@@ -9,7 +9,7 @@
"hasInstallScript": true, "hasInstallScript": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@babel/core": "^7.17.7", "@babel/core": "^7.17.8",
"@babel/plugin-transform-runtime": "^7.17.0", "@babel/plugin-transform-runtime": "^7.17.0",
"@babel/preset-env": "^7.16.11", "@babel/preset-env": "^7.16.11",
"@babel/preset-react": "^7.16.7", "@babel/preset-react": "^7.16.7",
@@ -23,7 +23,7 @@
"express-async-handler": "^1.2.0", "express-async-handler": "^1.2.0",
"express-static-gzip": "2.1.5", "express-static-gzip": "2.1.5",
"fs-extra": "10.0.1", "fs-extra": "10.0.1",
"googleapis": "97.0.0", "googleapis": "98.0.0",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"jwt-simple": "^0.5.6", "jwt-simple": "^0.5.6",
"less": "^3.13.1", "less": "^3.13.1",
@@ -32,7 +32,7 @@
"marked-extended-tables": "^1.0.3", "marked-extended-tables": "^1.0.3",
"markedLegacy": "npm:marked@^0.3.19", "markedLegacy": "npm:marked@^0.3.19",
"moment": "^2.29.1", "moment": "^2.29.1",
"mongoose": "^6.2.7", "mongoose": "^6.2.8",
"nanoid": "3.3.1", "nanoid": "3.3.1",
"nconf": "^0.11.3", "nconf": "^0.11.3",
"query-string": "7.1.1", "query-string": "7.1.1",
@@ -85,17 +85,17 @@
} }
}, },
"node_modules/@babel/core": { "node_modules/@babel/core": {
"version": "7.17.7", "version": "7.17.8",
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.17.7.tgz", "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.17.8.tgz",
"integrity": "sha512-djHlEfFHnSnTAcPb7dATbiM5HxGOP98+3JLBZtjRb5I7RXrw7kFRoG2dXM8cm3H+o11A8IFH/uprmJpwFynRNQ==", "integrity": "sha512-OdQDV/7cRBtJHLSOBqqbYNkOcydOgnX59TZx4puf41fzcVtN3e/4yqY8lMQsK+5X2lJtAdmA+6OHqsj1hBJ4IQ==",
"dependencies": { "dependencies": {
"@ampproject/remapping": "^2.1.0", "@ampproject/remapping": "^2.1.0",
"@babel/code-frame": "^7.16.7", "@babel/code-frame": "^7.16.7",
"@babel/generator": "^7.17.7", "@babel/generator": "^7.17.7",
"@babel/helper-compilation-targets": "^7.17.7", "@babel/helper-compilation-targets": "^7.17.7",
"@babel/helper-module-transforms": "^7.17.7", "@babel/helper-module-transforms": "^7.17.7",
"@babel/helpers": "^7.17.7", "@babel/helpers": "^7.17.8",
"@babel/parser": "^7.17.7", "@babel/parser": "^7.17.8",
"@babel/template": "^7.16.7", "@babel/template": "^7.16.7",
"@babel/traverse": "^7.17.3", "@babel/traverse": "^7.17.3",
"@babel/types": "^7.17.0", "@babel/types": "^7.17.0",
@@ -509,9 +509,9 @@
} }
}, },
"node_modules/@babel/helpers": { "node_modules/@babel/helpers": {
"version": "7.17.7", "version": "7.17.8",
"resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.17.7.tgz", "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.17.8.tgz",
"integrity": "sha512-TKsj9NkjJfTBxM7Phfy7kv6yYc4ZcOo+AaWGqQOKTPDOmcGkIFb5xNA746eKisQkm4yavUYh4InYM9S+VnO01w==", "integrity": "sha512-QcL86FGxpfSJwGtAvv4iG93UL6bmqBdmoVY0CMCU2g+oD2ezQse3PT5Pa+jiD6LJndBQi0EDlpzOWNlLuhz5gw==",
"dependencies": { "dependencies": {
"@babel/template": "^7.16.7", "@babel/template": "^7.16.7",
"@babel/traverse": "^7.17.3", "@babel/traverse": "^7.17.3",
@@ -564,9 +564,9 @@
"integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="
}, },
"node_modules/@babel/parser": { "node_modules/@babel/parser": {
"version": "7.17.7", "version": "7.17.8",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.17.7.tgz", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.17.8.tgz",
"integrity": "sha512-bm3AQf45vR4gKggRfvJdYJ0gFLoCbsPxiFLSH6hTVYABptNHY6l9NrhnucVjQ/X+SPtLANT9lc0fFhikj+VBRA==", "integrity": "sha512-BoHhDJrJXqcg+ZL16Xv39H9n+AqJ4pcDrQBGZN+wHxIysrLZ3/ECwCBUch/1zUNhnsXULcONU3Ei5Hmkfk6kiQ==",
"bin": { "bin": {
"parser": "bin/babel-parser.js" "parser": "bin/babel-parser.js"
}, },
@@ -6056,9 +6056,9 @@
} }
}, },
"node_modules/googleapis": { "node_modules/googleapis": {
"version": "97.0.0", "version": "98.0.0",
"resolved": "https://registry.npmjs.org/googleapis/-/googleapis-97.0.0.tgz", "resolved": "https://registry.npmjs.org/googleapis/-/googleapis-98.0.0.tgz",
"integrity": "sha512-npfVjA4unKsyKvlBC7nhKq6ReH/lsSkSl+0AcW9/TrjT4Uc5QUyJCd1vhH54k5SGDpVQ0xMyyC06dVRMsNarRw==", "integrity": "sha512-gJS+JF03FXouOpHN7dqxg5wrNCBef3ExBtYdCJoX4wlURuy6pixg7SC8sNAjFIXphMZWQ1Bbcu9aKxNv2xCbuQ==",
"dependencies": { "dependencies": {
"google-auth-library": "^7.0.2", "google-auth-library": "^7.0.2",
"googleapis-common": "^5.0.2" "googleapis-common": "^5.0.2"
@@ -9312,9 +9312,9 @@
} }
}, },
"node_modules/mongoose": { "node_modules/mongoose": {
"version": "6.2.7", "version": "6.2.8",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-6.2.7.tgz", "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-6.2.8.tgz",
"integrity": "sha512-yqTZcM3u0+aLzl6cirtXy6vr24kt+kFyTucCQ3pyncvO1jGn/M1R09qkC/v54QoPXeVJdpcuS5eQWn0NLlDvKA==", "integrity": "sha512-Wq6HG0sOJEQHp5YqMlxrnf93vBFwdY2zlAwqI97EPPSt69kiVV21pTv4cDanrCNWi4upG8ajQ/p9jpDjcECjkQ==",
"dependencies": { "dependencies": {
"bson": "^4.2.2", "bson": "^4.2.2",
"kareem": "2.3.4", "kareem": "2.3.4",
@@ -13120,17 +13120,17 @@
"integrity": "sha512-p8pdE6j0a29TNGebNm7NzYZWB3xVZJBZ7XGs42uAKzQo8VQ3F0By/cQCtUEABwIqw5zo6WA4NbmxsfzADzMKnQ==" "integrity": "sha512-p8pdE6j0a29TNGebNm7NzYZWB3xVZJBZ7XGs42uAKzQo8VQ3F0By/cQCtUEABwIqw5zo6WA4NbmxsfzADzMKnQ=="
}, },
"@babel/core": { "@babel/core": {
"version": "7.17.7", "version": "7.17.8",
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.17.7.tgz", "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.17.8.tgz",
"integrity": "sha512-djHlEfFHnSnTAcPb7dATbiM5HxGOP98+3JLBZtjRb5I7RXrw7kFRoG2dXM8cm3H+o11A8IFH/uprmJpwFynRNQ==", "integrity": "sha512-OdQDV/7cRBtJHLSOBqqbYNkOcydOgnX59TZx4puf41fzcVtN3e/4yqY8lMQsK+5X2lJtAdmA+6OHqsj1hBJ4IQ==",
"requires": { "requires": {
"@ampproject/remapping": "^2.1.0", "@ampproject/remapping": "^2.1.0",
"@babel/code-frame": "^7.16.7", "@babel/code-frame": "^7.16.7",
"@babel/generator": "^7.17.7", "@babel/generator": "^7.17.7",
"@babel/helper-compilation-targets": "^7.17.7", "@babel/helper-compilation-targets": "^7.17.7",
"@babel/helper-module-transforms": "^7.17.7", "@babel/helper-module-transforms": "^7.17.7",
"@babel/helpers": "^7.17.7", "@babel/helpers": "^7.17.8",
"@babel/parser": "^7.17.7", "@babel/parser": "^7.17.8",
"@babel/template": "^7.16.7", "@babel/template": "^7.16.7",
"@babel/traverse": "^7.17.3", "@babel/traverse": "^7.17.3",
"@babel/types": "^7.17.0", "@babel/types": "^7.17.0",
@@ -13433,9 +13433,9 @@
} }
}, },
"@babel/helpers": { "@babel/helpers": {
"version": "7.17.7", "version": "7.17.8",
"resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.17.7.tgz", "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.17.8.tgz",
"integrity": "sha512-TKsj9NkjJfTBxM7Phfy7kv6yYc4ZcOo+AaWGqQOKTPDOmcGkIFb5xNA746eKisQkm4yavUYh4InYM9S+VnO01w==", "integrity": "sha512-QcL86FGxpfSJwGtAvv4iG93UL6bmqBdmoVY0CMCU2g+oD2ezQse3PT5Pa+jiD6LJndBQi0EDlpzOWNlLuhz5gw==",
"requires": { "requires": {
"@babel/template": "^7.16.7", "@babel/template": "^7.16.7",
"@babel/traverse": "^7.17.3", "@babel/traverse": "^7.17.3",
@@ -13478,9 +13478,9 @@
} }
}, },
"@babel/parser": { "@babel/parser": {
"version": "7.17.7", "version": "7.17.8",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.17.7.tgz", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.17.8.tgz",
"integrity": "sha512-bm3AQf45vR4gKggRfvJdYJ0gFLoCbsPxiFLSH6hTVYABptNHY6l9NrhnucVjQ/X+SPtLANT9lc0fFhikj+VBRA==" "integrity": "sha512-BoHhDJrJXqcg+ZL16Xv39H9n+AqJ4pcDrQBGZN+wHxIysrLZ3/ECwCBUch/1zUNhnsXULcONU3Ei5Hmkfk6kiQ=="
}, },
"@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": {
"version": "7.16.7", "version": "7.16.7",
@@ -17690,9 +17690,9 @@
} }
}, },
"googleapis": { "googleapis": {
"version": "97.0.0", "version": "98.0.0",
"resolved": "https://registry.npmjs.org/googleapis/-/googleapis-97.0.0.tgz", "resolved": "https://registry.npmjs.org/googleapis/-/googleapis-98.0.0.tgz",
"integrity": "sha512-npfVjA4unKsyKvlBC7nhKq6ReH/lsSkSl+0AcW9/TrjT4Uc5QUyJCd1vhH54k5SGDpVQ0xMyyC06dVRMsNarRw==", "integrity": "sha512-gJS+JF03FXouOpHN7dqxg5wrNCBef3ExBtYdCJoX4wlURuy6pixg7SC8sNAjFIXphMZWQ1Bbcu9aKxNv2xCbuQ==",
"requires": { "requires": {
"google-auth-library": "^7.0.2", "google-auth-library": "^7.0.2",
"googleapis-common": "^5.0.2" "googleapis-common": "^5.0.2"
@@ -20160,9 +20160,9 @@
} }
}, },
"mongoose": { "mongoose": {
"version": "6.2.7", "version": "6.2.8",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-6.2.7.tgz", "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-6.2.8.tgz",
"integrity": "sha512-yqTZcM3u0+aLzl6cirtXy6vr24kt+kFyTucCQ3pyncvO1jGn/M1R09qkC/v54QoPXeVJdpcuS5eQWn0NLlDvKA==", "integrity": "sha512-Wq6HG0sOJEQHp5YqMlxrnf93vBFwdY2zlAwqI97EPPSt69kiVV21pTv4cDanrCNWi4upG8ajQ/p9jpDjcECjkQ==",
"requires": { "requires": {
"bson": "^4.2.2", "bson": "^4.2.2",
"kareem": "2.3.4", "kareem": "2.3.4",

View File

@@ -47,7 +47,7 @@
] ]
}, },
"dependencies": { "dependencies": {
"@babel/core": "^7.17.7", "@babel/core": "^7.17.8",
"@babel/plugin-transform-runtime": "^7.17.0", "@babel/plugin-transform-runtime": "^7.17.0",
"@babel/preset-env": "^7.16.11", "@babel/preset-env": "^7.16.11",
"@babel/preset-react": "^7.16.7", "@babel/preset-react": "^7.16.7",
@@ -61,7 +61,7 @@
"express-async-handler": "^1.2.0", "express-async-handler": "^1.2.0",
"express-static-gzip": "2.1.5", "express-static-gzip": "2.1.5",
"fs-extra": "10.0.1", "fs-extra": "10.0.1",
"googleapis": "97.0.0", "googleapis": "98.0.0",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"jwt-simple": "^0.5.6", "jwt-simple": "^0.5.6",
"less": "^3.13.1", "less": "^3.13.1",
@@ -70,7 +70,7 @@
"marked-extended-tables": "^1.0.3", "marked-extended-tables": "^1.0.3",
"markedLegacy": "npm:marked@^0.3.19", "markedLegacy": "npm:marked@^0.3.19",
"moment": "^2.29.1", "moment": "^2.29.1",
"mongoose": "^6.2.7", "mongoose": "^6.2.8",
"nanoid": "3.3.1", "nanoid": "3.3.1",
"nconf": "^0.11.3", "nconf": "^0.11.3",
"query-string": "7.1.1", "query-string": "7.1.1",

View File

@@ -10,43 +10,69 @@ const SplitPane = createClass({
return { return {
storageKey : 'naturalcrit-pane-split', storageKey : 'naturalcrit-pane-split',
onDragFinish : function(){} //fires when dragging onDragFinish : function(){} //fires when dragging
}; };
}, },
getInitialState : function() { getInitialState : function() {
return { return {
size : null, currentDividerPos : null,
isDragging : false windowWidth : 0,
isDragging : false
}; };
}, },
componentDidMount : function() { componentDidMount : function() {
const paneSize = window.localStorage.getItem(this.props.storageKey); const dividerPos = window.localStorage.getItem(this.props.storageKey);
if(paneSize){ if(dividerPos){
this.setState({ this.setState({
size : paneSize currentDividerPos : this.limitPosition(dividerPos, 0.1*(window.innerWidth-13), 0.9*(window.innerWidth-13)),
userSetDividerPos : dividerPos,
windowWidth : window.innerWidth
}); });
} }
window.addEventListener('resize', this.handleWindowResize);
},
componentWillUnmount : function() {
window.removeEventListener('resize', this.handleWindowResize);
},
handleWindowResize : function() {
// Allow divider to increase in size to last user-set position
// Limit current position to between 10% and 90% of visible space
const newLoc = this.limitPosition(this.state.userSetDividerPos, 0.1*(window.innerWidth-13), 0.9*(window.innerWidth-13));
this.setState({
currentDividerPos : newLoc,
windowWidth : window.innerWidth
});
},
limitPosition : function(x, min = 1, max = window.innerWidth - 13) {
const result = Math.round(Math.min(max, Math.max(min, x)));
return result;
}, },
handleUp : function(){ handleUp : function(){
if(this.state.isDragging){ if(this.state.isDragging){
this.props.onDragFinish(this.state.size); this.props.onDragFinish(this.state.currentDividerPos);
window.localStorage.setItem(this.props.storageKey, this.state.size); window.localStorage.setItem(this.props.storageKey, this.state.currentDividerPos);
} }
this.setState({ isDragging: false }); this.setState({ isDragging: false });
}, },
handleDown : function(){ handleDown : function(){
this.setState({ isDragging: true }); this.setState({ isDragging: true });
//this.unFocus() //this.unFocus()
}, },
handleMove : function(e){ handleMove : function(e){
if(!this.state.isDragging) return; if(!this.state.isDragging) return;
const minWidth = 1; const newSize = this.limitPosition(e.pageX);
const maxWidth = window.innerWidth - 13;
const newSize = Math.min(maxWidth, Math.max(minWidth, e.pageX));
this.setState({ this.setState({
size : newSize currentDividerPos : newSize,
userSetDividerPos : newSize
}); });
}, },
/* /*
@@ -70,7 +96,7 @@ const SplitPane = createClass({
render : function(){ render : function(){
return <div className='splitPane' onMouseMove={this.handleMove} onMouseUp={this.handleUp}> return <div className='splitPane' onMouseMove={this.handleMove} onMouseUp={this.handleUp}>
<Pane ref='pane1' width={this.state.size}>{this.props.children[0]}</Pane> <Pane ref='pane1' width={this.state.currentDividerPos}>{this.props.children[0]}</Pane>
{this.renderDivider()} {this.renderDivider()}
<Pane ref='pane2' isDragging={this.state.isDragging}>{this.props.children[1]}</Pane> <Pane ref='pane2' isDragging={this.state.isDragging}>{this.props.children[1]}</Pane>
</div>; </div>;

View File

@@ -658,7 +658,7 @@ body {
margin-bottom : 0.3cm; margin-bottom : 0.3cm;
} }
a{ a{
display : table; display : inline;
color : inherit; color : inherit;
text-decoration : none; text-decoration : none;
&:hover{ &:hover{