0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-25 16:12:37 +00:00
Commit Graph

1879 Commits

Author SHA1 Message Date
Gazook89
6bb5d04f07 round the calculated zoom level 2024-08-23 23:02:04 -05:00
Gazook89
b0b1f7fd0b update method calls for zoom buttons
update method names in onClick events to match latest changes to the branch this builds from.
2024-08-23 22:58:43 -05:00
Gazook89
c25bf95a66 Merge branch 'pr/3499' into Fill-Pane-Buttons 2024-08-23 22:56:37 -05:00
Gazook89
a351013359 remove some odd if statement in onChange 2024-08-23 22:54:29 -05:00
Gazook89
1f86b4c3d0 add mainRef back in
This was previously in the .pageInfo widget, probably not for any good reason, but I'm moving it to the popups div for probably not a good reason.

It's used to get the parent .pane div, and pull its `height` value which is then passed to the `.brewRenderer` div to set the height.

I tried alternate methods that would make this obsolete (CSS methods mostly), but due to some complexity am just ditching those alternatives and popping this sucker into `.popups` for now.
2024-08-23 22:41:12 -05:00
Gazook89
627a6a732b remove .ppr_msg styling
This message doesn't exist anymore (i'm pretty sure), so this is just unused styling.  Unrleated to the PR, but just minor.
2024-08-23 19:26:41 -05:00
Gazook89
77421c2950 remove .pageInfo widget in bottom of preview
page counter function is in toolbar now, so this isn't necessary.
2024-08-23 19:25:49 -05:00
Gazook89
f3ed174b0e eslint and stylelint
stylelint has a problem with the `:horizontal` pseudo selector in brewRenderer.jsx, which is being used to apply some styling to the custom scrollbars.  As far as i can tell, the selector is not standards-track, so that is probably why.  Not sure if we want to adjsut our stylelint config to allow it?
2024-08-23 19:16:59 -05:00
Gazook89
977d0ea73a eslint 2024-08-23 19:05:23 -05:00
Gazook89
04effa2150 removed whitepsace 2024-08-23 18:59:32 -05:00
Gazook89
7f694e6ca7 fold handlePageChange directly into input onChange
Moved the single-line handler to operate directly in the onChange handler of the input that is calling it.

Considered doing the same with handleZoomChange, but that handler is used by two buttons rather than just one.
2024-08-23 18:58:51 -05:00
Gazook89
769a03916b rename pageInput state variable to pageNum 2024-08-23 18:48:36 -05:00
Gazook89
e3c90a8295 unset padding on brewRenderer in @print
Fixes an issue with the padding being reflected in pdfs as a white stripe at the top.
2024-08-23 18:45:08 -05:00
Gazook89
561ff6283a remove redundant handleScroll() method
handleScroll is replaced by getCurrentPage(), which effectively does the same thing.  The math is slightly different, though very similar, and result seems to be the same.
2024-08-23 18:33:14 -05:00
Gazook89
f34107ee1d fix typo 2024-08-23 15:06:48 -05:00
Gazook89
2246944dd2 Remove duplicate ErrorBar/popups tray
Removed duplicated components.

Restyled the popups to accomodate extra height of viewer tools.
2024-08-23 14:40:19 -05:00
Gazook89
32c6224f40 remove console.log 2024-08-22 23:30:36 -05:00
Gazook89
8dadc57934 adjustment to toolbar spacing between items
testing the use of spacing to separate tool groups.  Could alternatively use a thin vertical bar.
2024-08-22 23:22:39 -05:00
Gazook89
0dc9e9ecdb Add 2 custom zoom related icons
New icons for Zoom to Fit, and Fit Width buttons.  Used SVGR online tool to create react components and then combined them.

If doing in future, be sure to set currentColor on `fill` property in the SVG itself.  Make the SVGs as closed curves only (don't rely on stroke).  set only a width property, not height.
2024-08-22 23:21:48 -05:00
Gazook89
977b871967 Combine toFit and toFill functions
Reduce overlap of the two functions and just require a 'mode' parameter.  Could like roll a 'manual' mode into this for the zoom slider, as well, but skipping for now.
2024-08-22 23:19:24 -05:00
Gazook89
90dd4326e7 Add a toFit() method to fit largest page in view
Adding a real toFit() button that takes the page with the largest single dimension (height or width) and makes it fit within the pane.
2024-08-22 20:56:42 -05:00
Gazook89
4c71987866 change the toFit method to toFill
Realized this method is filling the preview pane, and that toFit would force the zoom to show the entirety of a single page at once.
2024-08-22 15:56:23 -05:00
Gazook89
8965bb60aa add a toFit() method to determine zoom change
Adds a toFit() method to determine the delta/change needed to the current zoomLevel to fit the page to the pane, so that the widest page fits just inside the pane.
2024-08-22 15:52:52 -05:00
Gazook89
64fb032622 fix className 2024-08-22 15:51:16 -05:00
Víctor Losada Hernández
fb06ae0d03 Merge branch 'master' into pdf-tools 2024-08-21 23:07:25 +02:00
Gazook89
051eed0e83 restructure html, eliminate .tool divs
Treat each input and button as a direct child of the `.group` class, removing the intermediate div and reassign the `tool` classname to those inputs and buttons.  One item, the current / total page "set", is wrapped in a .tool div because they should be considered one item (even within the .group container).

And then a bunch of CSS adjustments to match the new structure.
2024-08-20 21:08:07 -05:00
Gazook89
cdc2ffeff4 remove if statement that shouldn't occur at all
Removing a redundant if/else that shouldn't be possible now that the currentPage is clamped between 1 and totalPages.
2024-08-20 20:18:54 -05:00
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
David Bolack
54d5dbf992 Pruning 2024-08-20 13:47:32 -05:00
David Bolack
cbcb712587 Merge branch 'master' into Issue_241 2024-08-20 13:34:47 -05:00
David Bolack
4957a0d2ef Flip which arror is which. 2024-08-20 13:18:48 -05:00
David Bolack
727f2bd80e use replaceState instead 2024-08-20 13:15:32 -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
2cf73698e8 white space lint 2024-08-19 23:38:48 -05:00
Gazook89
28a06348ab style tool groups, minor tweaks to spacing 2024-08-19 23:15:02 -05:00
Gazook89
9510b4d097 wrap each set of toolbars into groups
Allows more styling options, including flex wrapping by group rather than individual button.
2024-08-19 23:14:45 -05:00
Gazook89
37c8ea4fd7 Add total page count and some styling
Displaying the total page count near the current page number means we can lose the bottom right toolbar entirely (the renderer could be added to top toolbar, or just left for the metadata info in title bar).
2024-08-19 23:01:55 -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
176977dd2a change input type to 'text'
Changing input type to text removes the "spinner" controls from within the text box.  The spinner buttons are an accessibility issue (the tiny buttons are tiny), and we already have better buttons for incrementing/decrementing page number.

Text box only accepts numbers.
2024-08-19 22:40:50 -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
1196a1577f update minZoom and maxZoom variable names
Forgot to update the zoom variable names after making them all uppercase at their assignments.
2024-08-19 22:35:35 -05:00
Gazook89
54b11b1a4c refactor useEffect for updating currentPage state
The current page and the current page input share the same value, so the useEffect hook can be simplified.
2024-08-19 22:34:32 -05:00
Gazook89
7fa9b3cdd2 rearrange state declarations for pages
totalPages shouldn't need to be in state, since this component won't be changing it.

renamed pageNumberInput to just pageInput.  Was just something that happened in the course of working on it.

currentPage doesn't need to have it's own state separate from pageInput, they should always be the same *value*.
2024-08-19 22:32:02 -05:00
Gazook89
2f42c3f857 change top level constants to all caps
Better matches style of top level constants elsewhere in repo
2024-08-19 22:27:49 -05:00
David Bolack
67e868b5ee Rewrite path oncomponant load for cloned brews to prevent losing active changes on the "new" document. 2024-08-19 20:35:23 -05:00
Gazook89
05dd5e4c04 Change .toolbar position to absolute
Set as relative position, the toolbar (and mysteriously, the pageInfo box) would jump up 29px (toolbar height) when the "next page" button was clicked.  absolute pos fixes this.
2024-08-18 18:51: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
5a11b7918e refactor slider onChange and button onClick
Moved the zoomLevel state assignment to a newer useState hook function, making it easier (and shorter) to update that state within event handlers.

The slider onChange is a single easy line, and the buttons handlers are two lines for clarity.
2024-08-18 00:02:49 -05:00