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

1876 Commits

Author SHA1 Message Date
Trevor Buckner
4b0b56dd35 Lint the jsx files 2024-08-24 23:55:17 -04:00
Trevor Buckner
bf6eae7b3c Simplify some logic in Toolbar 2024-08-24 23:54:09 -04:00
Trevor Buckner
3377d6645d Tidy up brewRenderer 2024-08-24 23:53:44 -04:00
Trevor Buckner
5069eadd0a Manual tidying of .less files 2024-08-24 23:53:07 -04:00
Gazook89
504bb78a8d switching padding to margin
using `padding-top` was breaking the navbar dropdowns (they would lose focus).
2024-08-24 22:02:43 -05:00
Gazook89
690c683943 select text when clicking into page input 2024-08-24 09:08:19 -05:00
Gazook89
3acf90dfdb Add handlePageChange() to control input
Reintroducing handlePageChange() method to handle the page input separately from the scroll function.  It tests the regex pattern on the string, parses to integer, and sets pageNum state.

scrollToPage also now sets the pageNum state after performing the scroll so the input box matches the new current page.
2024-08-24 09:05:43 -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
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
Gazook89
36ab6923ed remove zoomInput state property
zoomLevel and zoomInput should always be the same, so I've removed one.
2024-08-17 23:43:32 -05:00
Gazook89
7cc967ad49 setZoomLevel to no longer use if/else
Remove the 'in'/'out' parameter of the function and just have the buttons send postive or negative integers equal to the desired change in the zoom.  No need for if/else statements using strings.
2024-08-17 23:39:59 -05:00
Gazook89
d108088295 remove unneeded handler 2024-08-17 21:23:12 -05:00