mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-30 21:52:43 +00:00
Merge branch 'master' into legacy_gmb
This commit is contained in:
@@ -115,7 +115,9 @@ const BrewRenderer = (props)=>{
|
|||||||
zoomLevel : 100,
|
zoomLevel : 100,
|
||||||
spread : 'single',
|
spread : 'single',
|
||||||
startOnRight : true,
|
startOnRight : true,
|
||||||
pageShadows : true
|
pageShadows : true,
|
||||||
|
rowGap : 5,
|
||||||
|
columnGap : 10,
|
||||||
});
|
});
|
||||||
|
|
||||||
//useEffect to store or gather toolbar state from storage
|
//useEffect to store or gather toolbar state from storage
|
||||||
|
|||||||
@@ -21,8 +21,9 @@ const ToolBar = ({ displayOptions, onDisplayOptionsChange, visiblePages, totalPa
|
|||||||
}, [visiblePages]);
|
}, [visiblePages]);
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
const visibility = localStorage.getItem('hb_toolbarVisibility') === 'true';
|
const Visibility = localStorage.getItem('hb_toolbarVisibility');
|
||||||
setToolsVisible(visibility);
|
if (Visibility) setToolsVisible(Visibility === 'true');
|
||||||
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const handleZoomButton = (zoom)=>{
|
const handleZoomButton = (zoom)=>{
|
||||||
@@ -68,7 +69,7 @@ const ToolBar = ({ displayOptions, onDisplayOptionsChange, visiblePages, totalPa
|
|||||||
} else if(mode == 'fit'){
|
} else if(mode == 'fit'){
|
||||||
// find the page with the largest single dim (height or width) so that zoom can be adapted to fit it.
|
// find the page with the largest single dim (height or width) so that zoom can be adapted to fit it.
|
||||||
let minDimRatio;
|
let minDimRatio;
|
||||||
if(displayOptions.spread === 'active')
|
if(displayOptions.spread === 'single')
|
||||||
minDimRatio = [...pages].reduce(
|
minDimRatio = [...pages].reduce(
|
||||||
(minRatio, page)=>Math.min(minRatio,
|
(minRatio, page)=>Math.min(minRatio,
|
||||||
iframeWidth / page.offsetWidth,
|
iframeWidth / page.offsetWidth,
|
||||||
@@ -165,7 +166,7 @@ const ToolBar = ({ displayOptions, onDisplayOptionsChange, visiblePages, totalPa
|
|||||||
id='single-spread'
|
id='single-spread'
|
||||||
className='tool'
|
className='tool'
|
||||||
title='Single Page'
|
title='Single Page'
|
||||||
onClick={()=>{handleOptionChange('spread', 'active');}}
|
onClick={()=>{handleOptionChange('spread', 'single');}}
|
||||||
aria-checked={displayOptions.spread === 'single'}
|
aria-checked={displayOptions.spread === 'single'}
|
||||||
><i className='fac single-spread' /></button>
|
><i className='fac single-spread' /></button>
|
||||||
<button role='radio'
|
<button role='radio'
|
||||||
|
|||||||
@@ -175,6 +175,10 @@
|
|||||||
opacity : 0;
|
opacity : 0;
|
||||||
transition : all 0.2s ease;
|
transition : all 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.toggleButton button i {
|
||||||
|
filter: drop-shadow(0 0 2px black) drop-shadow(0 0 1px black);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,9 +188,4 @@
|
|||||||
z-index : 5;
|
z-index : 5;
|
||||||
display : flex;
|
display : flex;
|
||||||
height : 100%;
|
height : 100%;
|
||||||
|
|
||||||
button i {
|
|
||||||
filter: drop-shadow(0 0 2px black) drop-shadow(0 0 1px black);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -23,14 +23,15 @@ const ErrorNavItem = createClass({
|
|||||||
|
|
||||||
const error = this.props.error;
|
const error = this.props.error;
|
||||||
const response = error.response;
|
const response = error.response;
|
||||||
const status = response.status;
|
const status = response?.status;
|
||||||
const HBErrorCode = response.body?.HBErrorCode;
|
const errorCode = error.code
|
||||||
const message = response.body?.message;
|
const HBErrorCode = response?.body?.HBErrorCode;
|
||||||
|
const message = response?.body?.message;
|
||||||
let errMsg = '';
|
let errMsg = '';
|
||||||
try {
|
try {
|
||||||
errMsg += `${error.toString()}\n\n`;
|
errMsg += `${error.toString()}\n\n`;
|
||||||
errMsg += `\`\`\`\n${error.stack}\n`;
|
errMsg += `\`\`\`\n${error.stack}\n`;
|
||||||
errMsg += `${JSON.stringify(response.error, null, ' ')}\n\`\`\``;
|
errMsg += `${JSON.stringify(response?.error, null, ' ')}\n\`\`\``;
|
||||||
console.log(errMsg);
|
console.log(errMsg);
|
||||||
} catch (e){}
|
} catch (e){}
|
||||||
|
|
||||||
@@ -73,7 +74,7 @@ const ErrorNavItem = createClass({
|
|||||||
</Nav.item>;
|
</Nav.item>;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(response.body?.errors?.[0].reason == 'storageQuotaExceeded') {
|
if(response?.body?.errors?.[0].reason == 'storageQuotaExceeded') {
|
||||||
return <Nav.item className='save error' icon='fas fa-exclamation-triangle'>
|
return <Nav.item className='save error' icon='fas fa-exclamation-triangle'>
|
||||||
Oops!
|
Oops!
|
||||||
<div className='errorContainer' onClick={clearError}>
|
<div className='errorContainer' onClick={clearError}>
|
||||||
@@ -82,7 +83,7 @@ const ErrorNavItem = createClass({
|
|||||||
</Nav.item>;
|
</Nav.item>;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(response.req.url.match(/^\/api.*Google.*$/m)){
|
if(response?.req.url.match(/^\/api.*Google.*$/m)){
|
||||||
return <Nav.item className='save error' icon='fas fa-exclamation-triangle'>
|
return <Nav.item className='save error' icon='fas fa-exclamation-triangle'>
|
||||||
Oops!
|
Oops!
|
||||||
<div className='errorContainer' onClick={clearError}>
|
<div className='errorContainer' onClick={clearError}>
|
||||||
@@ -129,6 +130,18 @@ const ErrorNavItem = createClass({
|
|||||||
</Nav.item>;
|
</Nav.item>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(errorCode === 'ECONNABORTED') {
|
||||||
|
return <Nav.item className='save error' icon='fas fa-exclamation-triangle'>
|
||||||
|
Oops!
|
||||||
|
<div className='errorContainer' onClick={clearError}>
|
||||||
|
The request to the server was interrupted or timed out.
|
||||||
|
This can happen due to a network issue, or if
|
||||||
|
trying to save a particularly large brew.
|
||||||
|
Please check your internet connection and try again.
|
||||||
|
</div>
|
||||||
|
</Nav.item>;
|
||||||
|
}
|
||||||
|
|
||||||
return <Nav.item className='save error' icon='fas fa-exclamation-triangle'>
|
return <Nav.item className='save error' icon='fas fa-exclamation-triangle'>
|
||||||
Oops!
|
Oops!
|
||||||
<div className='errorContainer'>
|
<div className='errorContainer'>
|
||||||
|
|||||||
@@ -404,6 +404,7 @@ app.get('/new/:id', asyncHandler(getBrew('share')), asyncHandler(async(req, res,
|
|||||||
renderer : req.brew.renderer,
|
renderer : req.brew.renderer,
|
||||||
theme : req.brew.theme,
|
theme : req.brew.theme,
|
||||||
tags : req.brew.tags,
|
tags : req.brew.tags,
|
||||||
|
snippets : req.brew.snippets
|
||||||
};
|
};
|
||||||
req.brew = _.defaults(brew, DEFAULT_BREW);
|
req.brew = _.defaults(brew, DEFAULT_BREW);
|
||||||
|
|
||||||
|
|||||||
@@ -412,6 +412,8 @@ const api = {
|
|||||||
const after = await afterSave();
|
const after = await afterSave();
|
||||||
if(!after) return;
|
if(!after) return;
|
||||||
|
|
||||||
|
saved.textBin = undefined; // Remove textBin from the saved object to save bandwidth
|
||||||
|
|
||||||
res.status(200).send(saved);
|
res.status(200).send(saved);
|
||||||
},
|
},
|
||||||
deleteGoogleBrew : async (account, id, editId, res)=>{
|
deleteGoogleBrew : async (account, id, editId, res)=>{
|
||||||
|
|||||||
Reference in New Issue
Block a user