mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-24 18:32:41 +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';
|
||||
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.
|
||||
|
||||
@@ -201,7 +201,6 @@ const BrewRenderer = (props)=>{
|
||||
}
|
||||
|
||||
if(rendererPath == '') {
|
||||
baseThemePath = 'Brew';
|
||||
baseRendererPath = '';
|
||||
} else {
|
||||
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 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;
|
||||
|
||||
if(this.props.metadata.renderer == 'legacy') {
|
||||
|
||||
@@ -99,7 +99,7 @@ const PrintPage = createClass({
|
||||
}
|
||||
let themePath = this.state.brew.theme ?? '5ePHB';
|
||||
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.
|
||||
|
||||
|
||||
@@ -300,6 +300,7 @@ app.get('/new/:id', asyncHandler(getBrew('share')), (req, res, next)=>{
|
||||
renderer : req.brew.renderer,
|
||||
theme : req.brew.theme,
|
||||
tags : req.brew.tags,
|
||||
userThemes : req.brew.userThemes
|
||||
};
|
||||
req.brew = _.defaults(brew, DEFAULT_BREW);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user