0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-05 18:52:38 +00:00

Display name of write in theme next to write-in

Clear user's active ThemeBundle when an incomplete/broken/invalid writein.

Needs theming help.
This commit is contained in:
David Bolack
2025-01-07 22:11:01 -06:00
parent e7f8cda6ae
commit 74122d9057
6 changed files with 32 additions and 8 deletions

View File

@@ -279,6 +279,7 @@ const api = {
let currentTheme;
const completeStyles = [];
const completeSnippets = [];
let themePath = '';
while (req.params.id) {
//=== User Themes ===//
@@ -292,6 +293,7 @@ const api = {
currentTheme = req.brew;
splitTextStyleAndMetadata(currentTheme);
if(themePath === '') themePath = currentTheme.title;
// If there is anything in the snippets or style members, append them to the appropriate array
// if(currentTheme?.snippets) completeSnippets.push(JSON.parse(currentTheme.snippets));
@@ -301,6 +303,7 @@ const api = {
req.params.renderer = currentTheme.renderer;
} else {
//=== Static Themes ===//
if(themePath === '') themePath = req.params.id;
const localSnippets = `${req.params.renderer}_${req.params.id}`; // Just log the name for loading on client
const localStyle = `@import url(\"/themes/${req.params.renderer}/${req.params.id}/style.css\");`;
completeSnippets.push(localSnippets);
@@ -313,7 +316,8 @@ const api = {
const returnObj = {
// Reverse the order of the arrays so they are listed oldest parent to youngest child.
styles : completeStyles.reverse(),
snippets : completeSnippets.reverse()
snippets : completeSnippets.reverse(),
path : themePath
};
res.setHeader('Content-Type', 'application/json');