mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-08 07:32:40 +00:00
Brew Theme Fixes.
This adds the User Brew themes, where applicible, to the /new path. This adds a semi-graceful failure to the metadata panel when a Brew Theme is declared as used but is not present. More gracefully handles loading with themes not present.
This commit is contained in:
@@ -189,7 +189,7 @@ const BrewRenderer = (props)=>{
|
|||||||
}
|
}
|
||||||
let themePath = props.theme ?? '5ePHB';
|
let themePath = props.theme ?? '5ePHB';
|
||||||
const Themes = { ...staticThemes, ...props.userThemes };
|
const Themes = { ...staticThemes, ...props.userThemes };
|
||||||
let baseThemePath = Themes[rendererPath][themePath]?.baseTheme;
|
let baseThemePath = (themePath && themePath[0] !== '#') ? Themes[rendererPath][themePath]?.baseTheme : 'Brew';
|
||||||
|
|
||||||
// Override static theme values if a Brew theme.
|
// Override static theme values if a Brew theme.
|
||||||
|
|
||||||
@@ -201,7 +201,6 @@ const BrewRenderer = (props)=>{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(rendererPath == '') {
|
if(rendererPath == '') {
|
||||||
baseThemePath = 'Brew';
|
|
||||||
baseRendererPath = '';
|
baseRendererPath = '';
|
||||||
} else {
|
} else {
|
||||||
baseRendererPath += '/';
|
baseRendererPath += '/';
|
||||||
|
|||||||
@@ -215,7 +215,8 @@ const MetadataEditor = createClass({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const currentThemePath = this.props.metadata?.theme && this.props.metadata.theme[0] === '#' ? 'Brew' : this.props.metadata.renderer;
|
const currentThemePath = this.props.metadata?.theme && this.props.metadata.theme[0] === '#' ? 'Brew' : this.props.metadata.renderer;
|
||||||
const currentTheme = mergedThemes[`${_.upperFirst(currentThemePath)}`][this.props.metadata.theme];
|
// const currentTheme = mergedThemes[`${_.upperFirst(currentThemePath)}`][this.props.metadata.theme];
|
||||||
|
const currentTheme = mergedThemes[`${_.upperFirst(currentThemePath)}`].hasOwnProperty(this.props.metadata.theme) ? mergedThemes[`${_.upperFirst(currentThemePath)}`][this.props.metadata.theme] : { name: `!!! THEME MISSING !!! ID=${this.props.metadata.theme.slice(1)}`};
|
||||||
let dropdown;
|
let dropdown;
|
||||||
|
|
||||||
if(this.props.metadata.renderer == 'legacy') {
|
if(this.props.metadata.renderer == 'legacy') {
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ const PrintPage = createClass({
|
|||||||
}
|
}
|
||||||
let themePath = this.state.brew.theme ?? '5ePHB';
|
let themePath = this.state.brew.theme ?? '5ePHB';
|
||||||
const Themes = { ...staticThemes, ...this.state.brew.userThemes };
|
const Themes = { ...staticThemes, ...this.state.brew.userThemes };
|
||||||
let baseThemePath = Themes[rendererPath][themePath]?.baseTheme;
|
let baseThemePath = (themePath && themePath[0] !== '#') ? Themes[rendererPath][themePath]?.baseTheme : 'Brew';
|
||||||
|
|
||||||
// Override static theme values if a Brew theme.
|
// Override static theme values if a Brew theme.
|
||||||
|
|
||||||
|
|||||||
@@ -300,6 +300,7 @@ app.get('/new/:id', asyncHandler(getBrew('share')), (req, res, next)=>{
|
|||||||
renderer : req.brew.renderer,
|
renderer : req.brew.renderer,
|
||||||
theme : req.brew.theme,
|
theme : req.brew.theme,
|
||||||
tags : req.brew.tags,
|
tags : req.brew.tags,
|
||||||
|
userThemes : req.brew.userThemes
|
||||||
};
|
};
|
||||||
req.brew = _.defaults(brew, DEFAULT_BREW);
|
req.brew = _.defaults(brew, DEFAULT_BREW);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user