0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-05-09 14:08:40 +00:00
Commit Graph

6435 Commits

Author SHA1 Message Date
Víctor Losada Hernández bcef4006dc Remove console.log statement in /metadata/:id route handler 2024-07-19 08:58:19 +02:00
Trevor Buckner f364f054f8 restore renderStyle
`renderStyle` is still necessary; it allows us to update the style live in the component render step as the user types into the style tab. Otherwise the style is only rendered once and never updates.

React also discourages directly editing the DOM ourselves, because it makes changes to the DOM that react cannot track; we should aim to provide all DOM writes inside of the component render function instead of using `document.createElement`, etc.

Too that end, this commit reduces the `loadAllStylesAndSnippets` function to just fetch and parse the data; actual rendering is moved back to `renderStyle()`
2024-07-19 01:33:56 -04:00
Trevor Buckner 460358ce1f Simplify some logic 2024-07-19 00:09:21 -04:00
Trevor Buckner 0448f15322 Classify user brews as V3 if they use V3
Each theme in the theme chain, including user brews, must use the same renderer. When moving to V4 or future versions, it will be important to distinguish which themes are compatible with each other
2024-07-19 00:05:45 -04:00
Trevor Buckner d741878f78 Also remove userthemes from Brew object in sharePage 2024-07-19 00:00:06 -04:00
G.Ambatte f830104531 Use textContent instead of innerText 2024-07-17 13:59:00 +12:00
Trevor Buckner d22cd88446 fix crash in metadataeditor 2024-07-15 23:47:19 -04:00
Trevor Buckner 1444581c86 pass userThemes prop to Editor -> MetadataEditor 2024-07-15 23:44:07 -04:00
Trevor Buckner dfbd85a8ce pass userThemes as a new prop, rather than inside of the brew 2024-07-15 23:29:16 -04:00
Trevor Buckner af5434c9b7 cleanup 2024-07-15 16:45:55 -04:00
Trevor Buckner 484b0a6dff simplify getThemeBundle() by using just one loop
Also, removes need for special handling of the "first" theme.
2024-07-15 16:38:19 -04:00
Trevor Buckner 4951b9bf1a Add async error handler to /edit and /new
Since /edit and /new endpoints now have an `await` inside that could return an error (`getUsersBrewThemes()`), asyncHandler must be added to pass errors along instead of just crashing
2024-07-13 19:46:12 -04:00
Trevor Buckner 62c619de24 userThemes need not be nested inside a Brew object 2024-07-13 19:38:51 -04:00
Trevor Buckner 44c96aad04 spacing 2024-07-13 18:11:04 -04:00
Trevor Buckner f392216ff4 Spacing 2024-07-13 18:08:29 -04:00
Trevor Buckner 591cae0e8f more renaming engine to renderer 2024-07-13 18:08:00 -04:00
Trevor Buckner e222811d03 Rename engine to renderer to unify naming
This value is named `renderer` everywhere else. Relabeling to a consistent name.
2024-07-13 18:06:46 -04:00
Trevor Buckner c9b885f868 include theme as baseTheme when getting user brew themes
`baseTheme` for a user brew theme is just the `theme` value of that brew.
2024-07-13 18:01:50 -04:00
Trevor Buckner fed65f5430 Merge branch 'master' into dependabot/npm_and_yarn/dompurify-3.1.6 2024-07-13 17:44:37 -04:00
Trevor Buckner 47f912750b Extract getting userThemes from getBrew()
`getBrew()` should do one thing only; retrieve a brew. UI elements like the list of themes available to the user are not part of a brew.

Moved into the handers for the `/edit/` and `/new/` endpoints
2024-07-13 17:44:23 -04:00
Trevor Buckner f29a5e346e Remove id parameter from getUsersBrewThemes
Filtering out the current brew can be done later as needed; certain situations may call for retrieving the whole list.
2024-07-13 17:35:19 -04:00
Trevor Buckner ee381c91fe Simplify getUserBrewThemes function a bit 2024-07-13 17:26:38 -04:00
Trevor Buckner 5f8d46f1b6 Reuse splitTextStyleAndMetadata from helpers.js 2024-07-13 17:09:45 -04:00
David Bolack ade819c70c A not so light rework.
This removes the existing endpoints and replaces them with /theme.

/theme/:id - return a theme bundle containing all styling from this USER theme and any parents.
/theme/:engine/:id - return a theme bundle containing all styling from this STATIC theme and any parents

The theme bundle returns a marshalled JSON object containing:
  styles - an array of strings representing the collected styles in loading order
  snippets - an array ( currently empty ) of collected snippets.

The various bits of theme rendering code for <style> an style <link> have been swapped out with an 'onDidMount' call that loads the thendpoint and appends a series of <style> blocks to the brewRender's head.

This loses some caching advantages, but probably won't matter in the long run.
2024-07-13 12:12:05 -05:00
Trevor Buckner c209a86f90 Merge branch 'master' into fixInkFriendlySnippet-#3563 2024-07-11 09:47:54 -04:00
Trevor Buckner 4fe38e3929 Merge pull request #3567 from G-Ambatte/fixUglyDropCap-#3551
Add additional styles to SolberaImitationRemake font declaration
2024-07-11 09:47:26 -04:00
Trevor Buckner b6d69173cd Merge branch 'master' into fixUglyDropCap-#3551 2024-07-11 09:46:45 -04:00
Trevor Buckner 8b085e1806 Merge pull request #3569 from G-Ambatte/fixBrewItemLinkUnderlining-#3568
Unset text-decoration on Brew Item links
2024-07-11 09:46:36 -04:00
G.Ambatte cb9d24d5b4 Remove text-decoration from Brew Item links 2024-07-11 20:03:17 +12:00
G.Ambatte 23fd70e3c3 Add additional style to existing SolberaImitation 2024-07-11 18:10:26 +12:00
Trevor Buckner 2fa3c0f311 themeClass is never used 2024-07-11 00:26:50 -04:00
Trevor Buckner 5c0a072115 userThemes passed to SnippetBar.jsx is never used 2024-07-11 00:25:11 -04:00
Trevor Buckner 29c2274a19 Unify some variable naming 2024-07-10 18:54:45 -04:00
Trevor Buckner a6f787ea8f Remove getBrewThemeParentCSS 2024-07-10 17:56:39 -04:00
Trevor Buckner 24c86dd199 Remove unused test 2024-07-10 17:49:57 -04:00
Trevor Buckner 7eb96ee6be Simplify brewRenderer output to only emit current theme
Instead of Blank, Parent, and Theme, just make use of the @include chaining, to handle all parent themes down to and including Blank
2024-07-10 17:46:51 -04:00
Trevor Buckner 27aebf0e3b Give 5ePHB and Journal themes a baseTheme of "Blank" 2024-07-10 17:15:45 -04:00
Trevor Buckner 88578a3d16 Fix failing test 2024-07-10 14:22:42 -04:00
Trevor Buckner 28446d3ae2 Comments for theme CSS endpoints 2024-07-10 14:21:23 -04:00
Trevor Buckner a247e50c9f renaming "get" functions
rename `getStaticTheme` to `getStaticThemeCSS`
rename `getBrewThemeWithCSS` to `getBrewThemeCSS`
rename `getBrewThemeParent` to `getBrewThemeParentCSS`

to avoid confusion with other "get" endpoints like `getBrew`, and unify naming for endpoint functions that return CSS.

Simplify `isStaticTheme` function (getting the parent theme is handled elsewhere)
2024-07-10 14:15:03 -04:00
David Bolack 656edb07ea Rework detection of user brews to look up themeid in static themes list before assuming is a user brew.
Ended up being a fairly straightforward change. A few ternaries got smooshed or inverted. Passes builtin and local tests. Need to compare on the test instance.
2024-07-08 18:12:58 -05:00
G.Ambatte 0cf79ceeb1 Merge branch 'master' into fixInkFriendlySnippet-#3563 2024-07-09 08:00:27 +12:00
G.Ambatte 7b9bd70554 Change filter to box-shadow 2024-07-08 19:57:21 +00:00
David Bolack 4b05bcac69 Merge branch 'master' into Issue_241 2024-07-08 10:16:57 -05:00
David Bolack 1555535f2e Merge branch 'master' into Issue_1430_Unique_HeaderIDs 2024-07-08 10:16:05 -05:00
David Bolack 19ee3d6dbb Merge branch 'master' into Issue_241_Part_II 2024-07-08 10:14:43 -05:00
David Bolack a413dc8d4f Merge branch 'master' into Issue_2563 2024-07-08 10:14:06 -05:00
David Bolack 74ee09397e Merge branch 'master' into Issue_2688 2024-07-08 10:08:54 -05:00
dependabot[bot] a06aa2a103 Bump dompurify from 3.1.5 to 3.1.6
Bumps [dompurify](https://github.com/cure53/DOMPurify) from 3.1.5 to 3.1.6.
- [Release notes](https://github.com/cure53/DOMPurify/releases)
- [Commits](https://github.com/cure53/DOMPurify/compare/3.1.5...3.1.6)

---
updated-dependencies:
- dependency-name: dompurify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-08 03:17:11 +00:00
David Bolack ea6595d4d6 Merge branch 'master' into brew_themes_user_selection
Fixes a regression for legacy brews.
2024-07-07 12:03:15 -05:00