0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-30 13:12:40 +00:00
Commit Graph

275 Commits

Author SHA1 Message Date
Trevor Buckner
2b7a1e1cb2 Reduce overlapping observer handlers
Combine handlePageVisibilityChange and handleCenterPageChange to reduce some of the infrastructure burden for handling centerPage.
2024-12-23 18:35:36 -05:00
Trevor Buckner
c8efca3120 useCallBack is not needed here. 2024-12-23 17:22:50 -05:00
Trevor Buckner
a53eacf055 remove CenterPage from ToolBar props
centerPage is not used in the toolbar component.
2024-12-23 17:17:13 -05:00
Trevor Buckner
870a4c3363 small cleanups 2024-12-09 17:06:26 -05:00
Trevor Buckner
aa951ff96c Small cleanups 2024-12-09 17:04:16 -05:00
Trevor Buckner
bae9fe939d Merge branch 'master' into Intersection-Observer 2024-12-09 16:16:11 -05:00
David Bolack
e252a39bd2 Implement Gazook89's suggested fix 2024-12-01 11:41:29 -06:00
Trevor Buckner
fb9148ada5 Site runs and all tests pass 2024-11-20 16:21:35 -05:00
David Bolack
4e4463fe4d Fix Issue 3718 by bounds checking prerender. 2024-11-11 11:17:00 -06:00
Gazook89
28a7f24989 add scrollToHash method back in
pretty much completely unchanged, was originally moved just to help with merging master in (ie it was erroneously removed)
2024-11-07 20:32:30 -06:00
Gazook89
9ef11bca99 lint and refactor 2024-11-07 10:40:44 -06:00
Gazook89
88b34a7ba3 Fix 'current page' input when zoomed in close
When the page is zoomed in very close, such that <30% of the page is in view, it doesn't register changes to the 'current page'.  This fixes that, passing in the 'centerPage' if 'visiblePages' is empty.

I don't love this fix, i think the visiblePages should always have *something* in it, but I can't quite figure out how to set that (since the normal update to visiblePages is happening in an observer that doesn't fire if nothing is in view).
2024-11-07 10:17:43 -06:00
Gazook89
9d86384032 refactor styles 2024-11-06 23:07:46 -06:00
Gazook89
a6bc87bcea apply displayOptions to legacy brews as well. 2024-11-06 23:07:03 -06:00
Gazook89
274e734135 add displayOptions to dependency array for memo
The memoization of the renderPages() method prevents a re-render when something like pageShadows is updated, so displayOptions are added to the dependency array in the memo method.
2024-11-06 21:53:14 -06:00
Gazook89
93b9f1d1da Merge branch 'Intersection-Observer' into Observer-Master-merge 2024-11-05 14:03:09 -06:00
Gazook89
172a3eaadf fix memoization on brewRenderer.jsx 2024-11-05 12:45:41 -06:00
Gazook89
89a16956b9 Merge branch 'master' into View-Modes 2024-11-04 14:22:54 -06:00
Gazook89
b098d28407 linting 2024-11-04 14:08:06 -06:00
Trevor Buckner
f63d2de8f4 Refactor toolbar view options (#2)
* Refactor toolbar view options

* Remove a couple more unused states
2024-11-01 22:19:48 -05:00
G.Ambatte
be4ba06081 Removed unused themes.json import 2024-10-29 17:32:31 +13:00
G.Ambatte
f1bebe3895 Move import to be adjacent to existing requires 2024-10-29 16:36:49 +13:00
G.Ambatte
a265723c57 Merge branch 'master' into fixLinks-#3547 2024-10-29 16:32:23 +13:00
Trevor Buckner
6373c398bc Fix scroll PR when no hash 2024-10-23 13:45:10 -04:00
Trevor Buckner
d5f498cbf9 Merge branch 'master' into scroll-to-element 2024-10-22 14:09:49 -04:00
Trevor Buckner
5040b9528f cleanup 2024-10-22 14:08:20 -04:00
Trevor Buckner
83a48b8d0c Simplify observer 2024-10-22 13:58:35 -04:00
Trevor Buckner
9fbdd24d01 Cleanup 2024-10-22 13:52:34 -04:00
Trevor Buckner
5b136f651c Call scrollToHash from our existing "frameDidMount`
`frameDidMount` is equivalent to using iframe.addEventListener('load');

Let's not add a new listener and just use the existing event we already have. Functionality still works.
2024-10-22 13:03:12 -04:00
Gazook89
4126188df1 linting 2024-10-21 22:29:58 -05:00
Gazook89
5c0d6e6012 move formatting of visible pages to toolbar
Doesn't need to be set in brewRenderer state and passed as a prop, when it can just do it's work directly in the toolbar.
2024-10-21 22:18:25 -05:00
Gazook89
de7b13bc15 Add some comments and cleanup
Little changes like removing console.logs and adding comments.
2024-10-21 22:13:12 -05:00
Gazook89
822d0c7738 Fix NaN/undefined showing on first load
Removes currentPage as a variable since it's been replaced.
2024-10-21 21:27:06 -05:00
Gazook89
0afc2ab2e6 modify effect to enable Jump Editor button
This fixes the "jump editor to preview position" button.
2024-10-21 20:43:32 -05:00
Gazook89
119755e23a Merge branch 'master' into Intersection-Observer 2024-10-21 00:33:56 -05:00
Gazook89
41fdf48ad3 Setup Intersection Observers & more...
Bad commit here with too much stuff.  I apologize.

This sets up two Intersection Observers: the first captures every page that is at least 30% visible inside the `.pages` container, and the second captures every page that has at least one pixel on the horizontal center line of `.pages`.  Both can be arrays of integers (page index).

The "visiblePages" array is duplicated and formatted into a "formattedPages" state, which gets displayed in the toolbar.

The toolbar displays that, unless the user clicks into the page input and enters their own integer (only a single integer, no range), which can then jump the preview to that page on Enter or blur().

The Arrow 'change page' buttons jump the preview back and forth by a 'full set'.
 If one page is viewed at a time, this is moved on page a time, and if 10 pages are viewed at a time it jumps the pages by 10.

Left to do:  adapt the "jump editor to match preview" divider button to work with new "centerPage".
2024-10-21 00:30:45 -05:00
Trevor Buckner
ac766f3b37 Update brewRenderer.jsx 2024-10-18 10:23:56 -04:00
Víctor Losada Hernández
d872a496a7 fix mutation observer integration 2024-10-17 23:38:11 +02:00
Víctor Losada Hernández
9a4473526a move around 2 2024-10-17 22:59:29 +02:00
Víctor Losada Hernández
5077fda3f6 move stuff around for minimal changes 2024-10-17 22:58:14 +02:00
Víctor Losada Hernández
397ae31f56 remove stale changes 2024-10-17 22:56:58 +02:00
Víctor Losada Hernández
87915ef0ef remove unnecessary changes 2024-10-17 22:42:55 +02:00
Víctor Losada Hernández
ccfd5578cf Merge branch 'master' of https://github.com/naturalcrit/homebrewery into scroll-to-element 2024-10-17 22:39:28 +02:00
Trevor Buckner
7888bfa878 Merge branch 'master' into tweakBrewRendererBackgroundStyle 2024-10-16 16:23:47 -04:00
Trevor Buckner
2aa60f793d Fix /new
/new starts with no `text` so it will crash without `?.`
2024-10-15 22:39:13 -04:00
Trevor Buckner
321bbba4b8 Rearrange 2024-10-15 22:07:41 -04:00
Trevor Buckner
36af1cdb7f Update brewRenderer.jsx 2024-10-15 21:47:27 -04:00
Víctor Losada Hernández
3c66907a86 Merge branch 'master' of https://github.com/naturalcrit/homebrewery into scroll-to-element 2024-10-13 11:15:15 +02:00
Gazook89
0855c5c181 remove errant console.log 2024-10-12 23:12:37 -05:00
Gazook89
ae11da2bc7 Fix the styles overriding previous styles
If there were two inputs sending styles to the same target (ie row and column gap), they would override each other.

This change fixes that by deepening the merges.  Admittedly, I turned to cGPT to help me with this as the nesting was throwing me for a loop.  It works, though, and I understand it now that I can read it.
2024-10-12 11:53:52 -05:00