0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-04 21:12:41 +00:00

Functional user theme loading though noising console

This commit is contained in:
David Bolack
2024-02-27 13:41:51 -06:00
parent 2456432844
commit 7b3a1eb4ff
7 changed files with 99 additions and 49 deletions

View File

@@ -378,6 +378,7 @@ const Editor = createClass({
showEditButtons={this.props.showEditButtons}
renderer={this.props.renderer}
theme={this.props.brew.theme}
userThemes={this.props.brew.userThemes}
undo={this.undo}
redo={this.redo}
foldCode={this.foldCode}

View File

@@ -38,6 +38,7 @@ const MetadataEditor = createClass({
authors : [],
systems : [],
renderer : 'legacy',
themeClass : 'V3',
theme : '5ePHB',
lang : 'en'
},
@@ -110,8 +111,9 @@ const MetadataEditor = createClass({
});
},
handleTheme : function(theme){
handleTheme : function(theme, themeClass){
this.props.metadata.renderer = theme.renderer;
this.props.metadata.themeClass = themeClass;
this.props.metadata.theme = theme.path;
this.props.onChange(this.props.metadata);
},
@@ -199,7 +201,7 @@ const MetadataEditor = createClass({
const listThemes = (renderer)=>{
return _.map(_.values(mergedThemes[renderer]), (theme)=>{
const preview = theme?.thumbnail ? theme.thumbnail : `/themes/${theme.renderer}/${theme.path}/dropdownPreview.png`;
return <div className='item' key={`${renderer}_${theme.name}`} onClick={()=>this.handleTheme(theme)} title={''}>
return <div className='item' key={`${renderer}_${theme.name}`} onClick={()=>this.handleTheme(theme, renderer)} title={''}>
{`${renderer} : ${theme.name}`}
<img src={`/themes/${theme.renderer}/${theme.path}/dropdownTexture.png`}/>
<div className='preview'>
@@ -210,7 +212,7 @@ const MetadataEditor = createClass({
});
};
const currentTheme = mergedThemes[`${_.upperFirst(this.props.metadata.renderer)}`][this.props.metadata.theme];
const currentTheme = mergedThemes[`${_.upperFirst(this.props.metadata.themeClass?this.props.metadata.themeClass:this.props.metadata.renderer)}`][this.props.metadata.theme];
let dropdown;
if(this.props.metadata.renderer == 'legacy') {
@@ -224,7 +226,7 @@ const MetadataEditor = createClass({
dropdown =
<Nav.dropdown className='value' trigger='click'>
<div>
{`${_.upperFirst(currentTheme.renderer)} : ${currentTheme.name}`} <i className='fas fa-caret-down'></i>
{`${_.upperFirst(this.props.metadata.themeClass?this.props.metadata.themeClass:this.props.metadata.renderer)} : ${currentTheme.name}`} <i className='fas fa-caret-down'></i>
</div>
{/*listThemes('Legacy')*/}
{listThemes('V3')}

View File

@@ -84,7 +84,7 @@ const Snippetbar = createClass({
compileSnippets : function(rendererPath, themePath, snippets) {
let compiledSnippets = snippets;
const baseSnippetsPath = Themes[rendererPath][themePath].baseSnippets;
const baseSnippetsPath = themePath[0] != '#' ? Themes[rendererPath][themePath].baseSnippets : false;
const objB = _.keyBy(compiledSnippets, 'groupName');