0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-26 07:22:44 +00:00
Commit Graph

170 Commits

Author SHA1 Message Date
Gazook89
83244485ab Move scrollToPage to toolbar component
Keeps toolbar functions within the toolbar component and reduces props that need to be sent down.
2024-08-20 15:15:36 -05:00
Gazook89
f5ee55d0ca keep current page number within existing page range
Make it so that if a user enters a page number higher than the total page count, it jumps them to last page.  if lower than 1, it jumps them to first page.
2024-08-19 23:40:21 -05:00
Gazook89
9adc3e2e1a linting 2024-08-19 22:49:38 -05:00
Gazook89
fd00a9f81d remove some console logs and some linting 2024-08-19 22:46:25 -05:00
Gazook89
720e43e9d9 update page increment/decrement buttons
putting the `pageInput - 1` modifier in the `scrollToPage` method allows for more understandable button function ('back button' is `- 1` and 'forward button' is `+ 1`).
2024-08-19 22:43:41 -05:00
Gazook89
a42b867bcb create handler function for controlled input
Moved onChange handler function to a component method and simplified it a smidge.

Must use parseInt now because the input type will change to 'text' rather than 'number'
2024-08-19 22:38:46 -05:00
Gazook89
499c640a11 Move the Toolbar component out of the iframe
The website UI should stay out of the iframe if possible.  Otherwise, users can style the UI on their brew which may or may not be a pain, and it's simple enough to avoid it.
2024-08-18 18:50:36 -05:00
Gazook89
8be3154865 rename functions/attributes
updateZoom() => handleZoom

updateZoom prop => onZoomChange

More clarity of prop versus handler function.
2024-08-17 20:48:30 -05:00
Gazook89
9aa7c67c5b remove "makeZoom" function
The makeZoom function is redundant if we just insert the style a little further down when the `.pages` div is initialized, as a `style` attribute on the tag.
2024-08-17 20:41:59 -05:00
Víctor Losada Hernández
f0765b5aaa "refactored ToolBar component to use a single state object, and updated styles in toolBar.less" 2024-08-15 20:05:23 +02:00
Víctor Losada Hernández
1452920fbd Merge branch 'master' of https://github.com/naturalcrit/homebrewery into pdf-tools 2024-08-15 17:41:27 +02:00
Trevor Buckner
32fa50d608 Fallback to showing "Blank" theme if themes fail to load. 2024-07-29 12:30:13 -04:00
Trevor Buckner
82f73fb21d cleanup 2024-07-23 17:24:50 -04:00
Trevor Buckner
45f7080afd Move loadAllBrewStylesAndSnippets to the parent page component
Themes contain both CSS and Snippets. The brewRenderer only cares about the CSS, but other components need the Snippets. Better to have the parent "editPage", etc. load the theme bundles and pass them down to each child that needs it, rather than trying to pass from the child up.

This also fixes the `metadataEditor.jsx` not being able to change themes live; A new theme bundle is now loaded when a new theme is selected, instead of only the first time the BrewRenderer mounts.

Also renamed to "fetchThemeBundle"
2024-07-21 16:25:24 -04:00
Trevor Buckner
0a5ff213de use same theme endpoint for user and static themes
`getThemeBundle()` rework no longer needs two separate endpoints
2024-07-20 11:39:23 -04: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
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
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
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
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
David Bolack
645da7ae5f Merge branch 'brew_themes_user_selection' of github.com:dbolack-ab/homebrewery into brew_themes_user_selection 2024-07-05 16:54:11 -05:00
David Bolack
8570335d79 Consolidate variable redundancy. 2024-07-05 16:53:21 -05:00
Trevor Buckner
e4bde91f6a Merge branch 'master' into brew_themes_user_selection 2024-07-02 12:04:17 -04:00
Trevor Buckner
2cdd65b083 revert DOMPURIFY for now 2024-06-29 11:29:31 -04:00
David Bolack
7a349ae26d Remove weirdly redundant error box. 2024-06-13 18:13:32 -05:00
David Bolack
0945a5e47e Merge branch 'master' into brew_themes_user_selection 2024-06-13 15:15:30 -05:00
G.Ambatte
8685c5cae4 Break Dialog out of NotificationPopup, restore NotificationPopup to original position 2024-06-04 16:26:51 +12:00
Víctor Losada Hernández
202ea1d905 "Removed margin-bottom from brewRenderer style, added padding-bottom and updated styles in brewRenderer.less" 2024-06-02 15:59:09 +02:00
David Bolack
5442f232d5 Merge branch 'master' into brew_themes_user_selection 2024-05-31 22:32:14 -05:00
G.Ambatte
a6ce36689c Shift NotificationPopup to shared components & update BrewRenderer ref 2024-06-01 12:38:01 +12:00
Víctor Losada Hernández
3fad8227a7 "Updated brewRenderer.jsx: added id 'zoomStyle' to style tag and changed margin-bottom from 7cm to 5cm." 2024-06-01 00:50:16 +02:00
Víctor Losada Hernández
c60ddb701c this one works best 2024-05-31 21:06:39 +02:00
Víctor Losada Hernández
0e00460012 change margin bottom to fixed distance 2024-05-31 21:03:27 +02:00
Víctor Losada Hernández
afa0571382 fix page displacement 2024-05-31 20:57:09 +02:00
Víctor Losada Hernández
000c3db8cd fixed page error 2024-05-31 20:14:41 +02:00
Víctor Losada Hernández
69db1e2cb7 change page works, added change zoom via input too 2024-05-31 19:43:09 +02:00
Víctor Losada Hernández
933dc372d2 "Refactor scrollToPage function to retrieve iframe element internally and add page not found logging" 2024-05-31 17:10:35 +02:00
Víctor Losada Hernández
6fb185a964 Merge branch 'master' of https://github.com/naturalcrit/homebrewery into pdf-tools 2024-05-31 16:23:55 +02:00
Víctor Losada Hernández
1442414299 scroll to page 2024-05-31 16:23:47 +02:00
Víctor Losada Hernández
f6161abf52 bottom margin to prevent bottom clip 2024-05-29 16:23:32 +02:00
Trevor Buckner
8a55658bd7 Rename printPage function to printCurrentBrew()
Avoid confusion with other "page" components.
2024-05-28 16:11:18 -04:00
Trevor Buckner
b4349a0476 iframe hotkey printing only works in Edit/Share/New
Default browser printing still works
2024-05-28 12:51:58 -04:00
Víctor Losada Hernández
4543881808 functional zoom 2024-05-28 08:51:23 +02:00
Trevor Buckner
ac3168e365 Move "printPage()" to helpers.js for reuse in multiple pages 2024-05-24 19:28:02 -04:00
Trevor Buckner
4ce68b86ed Fix hotkey printing on focused iframe 2024-05-23 17:09:03 -04:00
Víctor Losada Hernández
bc9ab284d8 Initial UI 2024-05-21 08:01:50 +02:00
David Bolack
54d2709d6a Merge 2024-05-20 17:58:22 -05:00
David Bolack
916bd5f4d6 Merge branch 'master' into brew_themes_user_selection 2024-05-20 17:56:21 -05:00
David Bolack
8c5f4e0605 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.
2024-05-13 11:14:35 -05:00
G.Ambatte
eb0440d36d Fix ID removal 2024-04-28 01:13:12 +12:00