0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-23 16:33:05 +00:00

Compare commits

...

599 Commits

Author SHA1 Message Date
Trevor Buckner
10d4cd4ab3 Merge pull request #3796 from naturalcrit/FixGoogleLinksinUserPage 2024-10-06 15:52:29 -04:00
Trevor Buckner
2a523c4955 Fix links to google drive files in user page
User page was not marking Google Brews as "stubbed" if the brew belongs   to another users' Google Drive or your own credentials are expired (it searches the current user drive for google files and checks if those are stubbed)

This now sets *every* file found on Mongo as "Stubbed", whether the Drive file belongs to the current user or not.
2024-10-06 15:48:10 -04:00
Víctor Losada Hernández
487a574f50 initital fix 2024-10-06 00:05:12 -04:00
Trevor Buckner
1a325fb3c5 New notification 2024-10-01 22:25:17 -04:00
Trevor Buckner
0110c6afed Remove duplicate error log for googleActions.list 2024-10-01 15:06:11 -04:00
Trevor Buckner
0e29620710 Remove delayMiddleware and ratelimiter 2024-10-01 14:13:15 -04:00
Trevor Buckner
c33b44855a Go back to service account for brew updates 2024-10-01 12:17:30 -04:00
Trevor Buckner
e7e35294c6 disable rate limiter 2024-09-30 10:59:43 -04:00
Trevor Buckner
e9c45b216c Add retryconfig and forward user ip 2024-09-30 08:31:39 -04:00
Trevor Buckner
40925253bd autosave to 16 seconds 2024-09-30 00:59:30 -04:00
Trevor Buckner
66433d9e77 5 requests 2024-09-30 00:45:10 -04:00
Trevor Buckner
3a6750613b express proxy settings 2024-09-30 00:31:58 -04:00
Trevor Buckner
a7361f8450 add delay between get and update 2024-09-30 00:14:37 -04:00
Trevor Buckner
32fa272947 reduce rate limit to 60 requests in 5 minutes 2024-09-30 00:03:27 -04:00
Trevor Buckner
68895bdca2 Rate limit /api requests from each IP address
100 requests each 5 minutes.
2024-09-29 23:37:26 -04:00
Trevor Buckner
8ab6a8599d Use personal auth if logged in via google. 2024-09-29 21:47:45 -04:00
Trevor Buckner
ea656e5119 Issue notice 2024-09-29 00:15:26 -04:00
Trevor Buckner
05ad8e17a7 Merge pull request #3755 from naturalcrit/RaiseAutoSaveDelay 2024-09-26 19:17:51 -04:00
Trevor Buckner
bf87225415 Merge branch 'v3.15.1' into RaiseAutoSaveDelay 2024-09-26 19:17:35 -04:00
Trevor Buckner
8b61e69b77 Merge pull request #3754 from naturalcrit/RemoveDoubleGoogleDriveLogs 2024-09-26 19:15:46 -04:00
Trevor Buckner
e260eb0911 Raise timeout to 10 s.
No need to be stingy here... Can lower back down if this works.
2024-09-26 19:14:16 -04:00
Trevor Buckner
c8424e0b10 Remove test that no longer applies 2024-09-26 19:12:19 -04:00
Trevor Buckner
ff9a75f6b6 Remove duplicate error logs for google drive update / new
Errors are now logged once in the central error handler in app.js
2024-09-26 19:00:07 -04:00
Trevor Buckner
84736980c9 Merge pull request #3713 from Gazook89/Fix-Vault-Styling-Issues
Fix Vault Page CSS specificity issues
2024-09-05 14:59:09 -04:00
Gazook89
e0be7a5db3 Move rules out of body and into more specific elements 2024-09-05 11:13:08 -05:00
Trevor Buckner
2e332d7699 Merge pull request #3710 from naturalcrit/dependabot/npm_and_yarn/eslint-plugin-jest-28.8.3
Bump eslint-plugin-jest from 28.8.2 to 28.8.3
2024-09-05 11:01:57 -04:00
dependabot[bot]
53979f2266 Bump eslint-plugin-jest from 28.8.2 to 28.8.3
Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 28.8.2 to 28.8.3.
- [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases)
- [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v28.8.2...v28.8.3)

---
updated-dependencies:
- dependency-name: eslint-plugin-jest
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-05 03:38:40 +00:00
Trevor Buckner
780c92cb9b Merge pull request #3704 from G-Ambatte/experimentalGitAttribs 2024-09-04 19:38:41 -04:00
Trevor Buckner
20c54ef79e Merge branch 'master' into experimentalGitAttribs 2024-09-04 19:38:32 -04:00
Trevor Buckner
5ce69041fc Merge pull request #3708 from naturalcrit/fix-arrows
FIx missing arrows
2024-09-04 18:07:38 -04:00
Víctor Losada Hernández
20db8c6720 restore missing state 2024-09-04 23:57:44 +02:00
Trevor Buckner
ed35eb2680 Merge pull request #3702 from naturalcrit/dependabot/npm_and_yarn/mongoose-8.6.1 2024-09-04 17:22:22 -04:00
Trevor Buckner
2a7b7cd50c Merge branch 'master' into dependabot/npm_and_yarn/mongoose-8.6.1 2024-09-04 17:21:44 -04:00
Trevor Buckner
d37fa03ec7 Merge pull request #3701 from naturalcrit/dependabot/npm_and_yarn/eslint-plugin-react-7.35.2 2024-09-04 17:21:33 -04:00
Trevor Buckner
2c7d39147d Merge branch 'master' into dependabot/npm_and_yarn/eslint-plugin-react-7.35.2 2024-09-04 17:20:58 -04:00
Trevor Buckner
6535e94ccd Merge pull request #3707 from naturalcrit/v3.15.0 2024-09-04 17:20:49 -04:00
Trevor Buckner
2ede3d7cf3 Merge branch 'master' into v3.15.0 2024-09-04 17:20:41 -04:00
Trevor Buckner
e56b2a7ce5 Merge pull request #3706 from 5e-Cleric/experimental-development 2024-09-04 17:20:21 -04:00
Trevor Buckner
ad8e004fa9 Update Dismisskey for popup
Need a new key so this new message will appear again for users who cleared the popup before
2024-09-04 17:16:11 -04:00
Trevor Buckner
e05d2e805c v3.15.0 2024-09-04 17:01:27 -04:00
Víctor Losada Hernández
a083999943 Merge branch 'master' into experimental-development 2024-09-04 22:54:09 +02:00
Víctor Losada Hernández
247bc719b8 fix z-index issue 2024-09-04 22:52:57 +02:00
Víctor Losada Hernández
cd01014d79 notification 2024-09-04 22:48:39 +02:00
Víctor Losada Hernández
7ab1efb0c9 litttle message in vault 2024-09-04 22:39:30 +02:00
Trevor Buckner
eb05ac00a6 Merge pull request #3263 from 5e-Cleric/experimental-development 2024-09-04 16:24:44 -04:00
Trevor Buckner
2bc39a468f set default value for dontRenderStorage prop 2024-09-04 16:15:18 -04:00
Trevor Buckner
c735ab7c35 Fix crash on metaData tab
Hiding the `moveBrew` etc. properties when `this.state.showMoveArrows == false` means when the `metaData` tab turns off the arrows it crashes because now some functions are undefined.

Just using a whole separate property to avoid conflict.
2024-09-04 15:50:32 -04:00
Víctor Losada Hernández
d5e367649e fix overlapping thumbnail issue 2024-09-04 12:23:21 +02:00
Víctor Losada Hernández
f10444f14a fix for storage 2 2024-09-04 12:18:35 +02:00
Víctor Losada Hernández
29d4003bd2 fix splitpane errors 2024-09-04 09:37:35 +02:00
Víctor Losada Hernández
1225e5cb6a remove storage rendering in vault 2024-09-04 09:29:47 +02:00
Víctor Losada Hernández
aab24c732e fix error managing 2024-09-04 09:25:13 +02:00
G.Ambatte
dd5d551c73 Merge branch 'master' into experimentalGitAttribs 2024-09-04 17:11:21 +12:00
Trevor Buckner
d7d690a9d1 Lint 2024-09-04 01:06:56 -04:00
Trevor Buckner
4f39222724 Change spaces to tabs 2024-09-04 00:52:08 -04:00
Trevor Buckner
a1e585ccaa Remove redundant validation check
`performSearch()` and `loadTotal()` shouldn't need a separate check for valid items if `loadPage` already does it through `validateForm`
2024-09-04 00:43:12 -04:00
Trevor Buckner
373a627c14 With unneeded state gone, can rename back to title, author, etc.
No longer naming conflict with state and function parameters. We can go back to the shorter names
2024-09-04 00:35:27 -04:00
Trevor Buckner
a7cb73b02e Remove unused update in loadPage
Now `update` is unused; can remove that parameter.
2024-09-04 00:20:18 -04:00
Trevor Buckner
cd3e517b03 Remove setPageState in loadPage. Already occurs in performSearch()
`performSearch` will set PageState whether `update` is true or not, so this line here is not doing anything.
2024-09-04 00:18:35 -04:00
Trevor Buckner
ef201409d9 rename setPage to setPageState (match pageState name) 2024-09-03 23:55:54 -04:00
Trevor Buckner
e3ef93f03a Alignment 2024-09-03 23:54:52 -04:00
G.Ambatte
aa90513825 Update gitattributes 2024-09-04 15:46:00 +12:00
Trevor Buckner
1990064be4 Tidy findTotal 2024-09-03 23:44:43 -04:00
Trevor Buckner
44099c813c Fix err is not defined. Remove extra console.error (central error handler already prints the error) 2024-09-03 23:44:24 -04:00
dependabot[bot]
8f18601c2e Bump mongoose from 8.6.0 to 8.6.1
Bumps [mongoose](https://github.com/Automattic/mongoose) from 8.6.0 to 8.6.1.
- [Release notes](https://github.com/Automattic/mongoose/releases)
- [Changelog](https://github.com/Automattic/mongoose/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Automattic/mongoose/compare/8.6.0...8.6.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-04 03:39:03 +00:00
dependabot[bot]
db02f88287 Bump eslint-plugin-react from 7.35.1 to 7.35.2
Bumps [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) from 7.35.1 to 7.35.2.
- [Release notes](https://github.com/jsx-eslint/eslint-plugin-react/releases)
- [Changelog](https://github.com/jsx-eslint/eslint-plugin-react/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jsx-eslint/eslint-plugin-react/compare/v7.35.1...v7.35.2)

---
updated-dependencies:
- dependency-name: eslint-plugin-react
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-04 03:38:40 +00:00
Trevor Buckner
56185e2a1c Tidy findBrews 2024-09-03 23:11:10 -04:00
Trevor Buckner
590318ff1d Simplify rendererConditions 2024-09-03 22:58:50 -04:00
Víctor Losada Hernández
48a5a70d2e z-index doesn't work with static positioning 2024-09-04 00:17:59 +02:00
Víctor Losada Hernández
1c1901c90a fix thumbnail over text 2024-09-04 00:16:15 +02:00
Víctor Losada Hernández
ebae351033 remove unnecesary state 2024-09-04 00:11:58 +02:00
Víctor Losada Hernández
e54d81ceef small css fixes 2024-09-03 23:28:33 +02:00
Víctor Losada Hernández
849da23829 bring back thumbnails! 2024-09-03 23:17:33 +02:00
Víctor Losada Hernández
1e36e63ed6 bring back the comma! 2024-09-03 23:07:23 +02:00
Víctor Losada Hernández
abb2d57879 Merge branch 'master' of https://github.com/naturalcrit/homebrewery into experimental-development 2024-09-03 22:58:05 +02:00
Víctor Losada Hernández
52779eec35 Merge branch 'experimental-development' of https://github.com/5e-Cleric/homebrewery into experimental-development 2024-09-03 22:56:49 +02:00
Víctor Losada Hernández
9e694e5e46 move email catching to api 2024-09-03 22:56:45 +02:00
Víctor Losada Hernández
321b8a0696 Merge pull request #3699 from Gazook89/Focus-Editor-After-Switch
Set Focus on Editor after Tab Switches
2024-09-03 22:37:01 +02:00
Víctor Losada Hernández
f2563e436f Merge branch 'master' into Focus-Editor-After-Switch 2024-09-03 22:34:30 +02:00
Gazook89
3c6f49aa0a Move focus method to handleViewChange 2024-09-03 14:48:45 -05:00
Trevor Buckner
9bc5701006 Indent 2024-09-03 14:18:17 -04:00
Trevor Buckner
a3a5f749ab Merge pull request #3700 from naturalcrit/dependabot/npm_and_yarn/eslint-plugin-react-7.35.1
Bump eslint-plugin-react from 7.35.0 to 7.35.1
2024-09-03 14:10:20 -04:00
dependabot[bot]
36b026d89e Bump eslint-plugin-react from 7.35.0 to 7.35.1
Bumps [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) from 7.35.0 to 7.35.1.
- [Release notes](https://github.com/jsx-eslint/eslint-plugin-react/releases)
- [Changelog](https://github.com/jsx-eslint/eslint-plugin-react/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jsx-eslint/eslint-plugin-react/compare/v7.35.0...v7.35.1)

---
updated-dependencies:
- dependency-name: eslint-plugin-react
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-03 18:09:47 +00:00
Trevor Buckner
dbd4a5c490 Merge pull request #3686 from G-Ambatte/v3.14.3
Up version to v3.14.3
2024-09-03 14:08:29 -04:00
Trevor Buckner
0d95c48988 Merge branch 'master' into v3.14.3 2024-09-03 14:08:06 -04:00
Trevor Buckner
0d40f4eb16 Small Rewording 2024-09-03 14:06:54 -04:00
Trevor Buckner
6234943ffd Merge pull request #3698 from naturalcrit/dependabot/npm_and_yarn/eslint-plugin-jest-28.8.2
Bump eslint-plugin-jest from 28.8.0 to 28.8.2
2024-09-03 13:52:41 -04:00
dependabot[bot]
702f55bdbd Bump eslint-plugin-jest from 28.8.0 to 28.8.2
Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 28.8.0 to 28.8.2.
- [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases)
- [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v28.8.0...v28.8.2)

---
updated-dependencies:
- dependency-name: eslint-plugin-jest
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-03 17:35:36 +00:00
Trevor Buckner
859117cdf8 Merge pull request #3691 from naturalcrit/dependabot/npm_and_yarn/googleapis/drive-8.14.0
Bump @googleapis/drive from 8.13.1 to 8.14.0
2024-09-03 13:34:22 -04:00
Víctor Losada Hernández
7474605b93 rename 2 2024-09-03 15:58:31 +02:00
Víctor Losada Hernández
00a83ec16e renaming to make more clear 2024-09-03 15:54:53 +02:00
Gazook89
afa1e7974a Set focus on editor after tab switch
This sets the focus on the editor (and thus reveals cursor position) between editor changes (style to text to meta and back).
2024-09-02 21:07:19 -05:00
Víctor Losada Hernández
1517c00132 error logging to vault 2024-09-01 19:39:00 +02:00
Víctor Losada Hernández
6d24908465 now yes fixed 2024-09-01 19:31:43 +02:00
Víctor Losada Hernández
fd2d1f1ce2 fix little bug 2024-09-01 19:21:40 +02:00
Víctor Losada Hernández
226ad49663 renaming to keep some consistency 2024-09-01 19:12:25 +02:00
Víctor Losada Hernández
e830c51a16 add spacing to link 2024-09-01 11:22:25 +02:00
Víctor Losada Hernández
b6e904c9c8 "Rename searchButtonRef to submitButtonRef and update references" 2024-09-01 11:19:00 +02:00
Víctor Losada Hernández
3fc2e5202e rest of the suggested changes 2024-09-01 11:14:09 +02:00
Víctor Losada Hernández
f0b447866c suggested changes 2 2024-09-01 11:10:46 +02:00
Víctor Losada Hernández
c528c8639a title attribute to hidden authors 2024-08-31 23:21:14 +02:00
Víctor Losada Hernández
47d8bb20d2 hide usernames with emails 2024-08-31 23:12:24 +02:00
Víctor Losada Hernández
bb08aed1a8 move some css to prevent affecting brew cards 2024-08-31 22:43:54 +02:00
Víctor Losada Hernández
9a2f18fc0d provide error code text 2024-08-31 22:38:03 +02:00
Víctor Losada Hernández
df21f978df bring back throws 2024-08-31 22:34:04 +02:00
Víctor Losada Hernández
fb8c4c5c44 all sugggested changes 2024-08-31 22:28:29 +02:00
Víctor Losada Hernández
19102db23a indent with tabs 2024-08-31 22:11:43 +02:00
Víctor Losada Hernández
8d2a9ed9cb adress app.js changes requested 2024-08-31 22:08:21 +02:00
Víctor Losada Hernández
a0010c9c84 "Moved error message styles from .searchButton to body, and removed duplicate styles." 2024-08-31 19:39:01 +02:00
Víctor Losada Hernández
f7c3e81b7b "Added new route for '/vault' and updated catch-all for invalid routes" 2024-08-31 19:35:44 +02:00
Víctor Losada Hernández
c7f695e86a Merge branch 'master' of https://github.com/naturalcrit/homebrewery into experimental-development 2024-08-31 19:21:06 +02:00
Víctor Losada Hernández
e6e220fbec reposition button 2024-08-31 19:19:47 +02:00
Víctor Losada Hernández
8658a6a97a styling 2024-08-31 19:13:08 +02:00
Víctor Losada Hernández
cd94857b13 "Refactor VaultPage component: remove unnecessary whitespace, reformat code, and reorganize tips and tricks section" 2024-08-31 18:59:32 +02:00
Víctor Losada Hernández
3825bcbbfb "Simplified brewsQuery construction in buildBrewsQuery function" 2024-08-31 18:41:36 +02:00
Víctor Losada Hernández
981e7986ce Added className='renderer' to two input elements in vaultPage.jsx and added CSS rules for .renderer in vaultPage.less to display an error message when no checkboxes are checked. 2024-08-31 16:20:46 +02:00
dependabot[bot]
89583528c2 Bump @googleapis/drive from 8.13.1 to 8.14.0
Bumps [@googleapis/drive](https://github.com/googleapis/google-api-nodejs-client) from 8.13.1 to 8.14.0.
- [Release notes](https://github.com/googleapis/google-api-nodejs-client/releases)
- [Changelog](https://github.com/googleapis/google-api-nodejs-client/blob/main/release-please-config.json)
- [Commits](https://github.com/googleapis/google-api-nodejs-client/compare/drive-v8.13.1...drive-v8.14.0)

---
updated-dependencies:
- dependency-name: "@googleapis/drive"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-30 03:53:37 +00:00
G.Ambatte
e588e68313 Merge branch 'master' into v3.14.3 2024-08-29 17:47:36 +12:00
G.Ambatte
e4c2ffe973 Add image wrap icon fix 2024-08-29 17:46:23 +12:00
Trevor Buckner
c41116e6c8 Merge pull request #3687 from G-Ambatte/fixImageWrapIcons
Fix Image Wrap icons
2024-08-29 01:30:17 -04:00
G.Ambatte
b66ac43b35 Fix Image Wrap icons 2024-08-29 17:23:18 +12:00
G.Ambatte
c30404804d Fix typo 2024-08-29 17:20:39 +12:00
G.Ambatte
6b10e1aacb Very important F 2024-08-29 17:19:47 +12:00
G.Ambatte
e6185879c8 Up version to v3.14.3 2024-08-29 17:17:12 +12:00
Trevor Buckner
e776e5e054 Merge pull request #3684 from naturalcrit/FixTableInterruptors 2024-08-29 00:47:00 -04:00
Trevor Buckner
04bbb3d615 Merge branch 'master' into FixTableInterruptors 2024-08-29 00:44:46 -04:00
Trevor Buckner
5d1f589b07 Merge pull request #3685 from naturalcrit/dependabot/npm_and_yarn/marked-extended-tables-1.0.10 2024-08-29 00:44:38 -04:00
dependabot[bot]
ce5f093945 Bump marked-extended-tables from 1.0.9 to 1.0.10
Bumps [marked-extended-tables](https://github.com/calculuschild/marked-extended-tables) from 1.0.9 to 1.0.10.
- [Release notes](https://github.com/calculuschild/marked-extended-tables/releases)
- [Changelog](https://github.com/calculuschild/marked-extended-tables/blob/main/release.config.cjs)
- [Commits](https://github.com/calculuschild/marked-extended-tables/commits)

---
updated-dependencies:
- dependency-name: marked-extended-tables
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-29 04:42:49 +00:00
Trevor Buckner
371e464eb2 Merge branch 'master' into FixTableInterruptors 2024-08-29 00:30:07 -04:00
Trevor Buckner
804d714473 Add regex to detect when to interrupt a table 2024-08-29 00:20:47 -04:00
Trevor Buckner
8d00389aa2 Merge pull request #3683 from naturalcrit/dependabot/npm_and_yarn/marked-extended-tables-1.0.9 2024-08-29 00:19:42 -04:00
dependabot[bot]
d64787168b Bump marked-extended-tables from 1.0.8 to 1.0.9
Bumps [marked-extended-tables](https://github.com/calculuschild/marked-extended-tables) from 1.0.8 to 1.0.9.
- [Release notes](https://github.com/calculuschild/marked-extended-tables/releases)
- [Changelog](https://github.com/calculuschild/marked-extended-tables/blob/main/release.config.cjs)
- [Commits](https://github.com/calculuschild/marked-extended-tables/commits)

---
updated-dependencies:
- dependency-name: marked-extended-tables
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-29 04:17:07 +00:00
Trevor Buckner
49a1a74263 Merge pull request #3681 from naturalcrit/dependabot/npm_and_yarn/mongoose-8.6.0 2024-08-29 00:04:39 -04:00
dependabot[bot]
2636635397 Bump mongoose from 8.5.4 to 8.6.0
Bumps [mongoose](https://github.com/Automattic/mongoose) from 8.5.4 to 8.6.0.
- [Release notes](https://github.com/Automattic/mongoose/releases)
- [Changelog](https://github.com/Automattic/mongoose/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Automattic/mongoose/compare/8.5.4...8.6.0)

---
updated-dependencies:
- dependency-name: mongoose
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-29 04:01:06 +00:00
Trevor Buckner
c49c620ce1 Merge pull request #3680 from naturalcrit/dependabot/npm_and_yarn/stylelint-16.9.0 2024-08-29 00:00:07 -04:00
dependabot[bot]
0b00162590 Bump stylelint from 16.8.2 to 16.9.0
Bumps [stylelint](https://github.com/stylelint/stylelint) from 16.8.2 to 16.9.0.
- [Release notes](https://github.com/stylelint/stylelint/releases)
- [Changelog](https://github.com/stylelint/stylelint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/stylelint/stylelint/compare/16.8.2...16.9.0)

---
updated-dependencies:
- dependency-name: stylelint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-29 03:33:22 +00:00
Trevor Buckner
5e19bdaee7 Merge pull request #3678 from dbolack-ab/accursedKeys 2024-08-28 22:24:50 -04:00
David Bolack
bda8be6ec1 Remove stray console.log 2024-08-28 20:54:50 -05:00
David Bolack
132a7d1f53 A temporary, imperfect fix for the jump hotkeys 2024-08-28 20:48:33 -05:00
Trevor Buckner
2dbb92a37e Merge pull request #3677 from 5e-Cleric/account-page-handling-of-invalid-user
Account page handling of invalid user
2024-08-28 17:07:52 -04:00
Trevor Buckner
a124bd8657 I'm dumb. 2024-08-28 16:59:22 -04:00
Trevor Buckner
5323e6ca7a Merge branch 'master' into account-page-handling-of-invalid-user 2024-08-28 15:25:12 -04:00
Trevor Buckner
8423c48fd1 Slight rewording and add a period 2024-08-28 15:24:50 -04:00
Trevor Buckner
e8aceac133 Move check for account up a little 2024-08-28 15:21:43 -04:00
Trevor Buckner
5a692a74c5 Merge pull request #3660 from naturalcrit/imageWrappin
Image wrapping
2024-08-28 15:18:50 -04:00
Víctor Losada Hernández
6436e62ec0 set up error page 2024-08-28 21:10:28 +02:00
Víctor Losada Hernández
c9947d7f91 handle invalid account in account page, redirect to home 2024-08-28 20:42:53 +02:00
Trevor Buckner
3b3127248b Merge branch 'master' into imageWrappin 2024-08-28 14:37:26 -04:00
Trevor Buckner
1d2355e802 Merge pull request #3674 from naturalcrit/dependabot/npm_and_yarn/googleapis/drive-8.13.1
Bump @googleapis/drive from 8.13.0 to 8.13.1
2024-08-28 09:47:22 -04:00
dependabot[bot]
b85bb7bdd4 Bump @googleapis/drive from 8.13.0 to 8.13.1
Bumps [@googleapis/drive](https://github.com/googleapis/google-api-nodejs-client) from 8.13.0 to 8.13.1.
- [Release notes](https://github.com/googleapis/google-api-nodejs-client/releases)
- [Changelog](https://github.com/googleapis/google-api-nodejs-client/blob/main/release-please-config.json)
- [Commits](https://github.com/googleapis/google-api-nodejs-client/compare/drive-v8.13.0...drive-v8.13.1)

---
updated-dependencies:
- dependency-name: "@googleapis/drive"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-28 03:42:23 +00:00
Trevor Buckner
a016bfd133 Merge pull request #3673 from Gazook89/Fix-Toolbar-Positioning
Revert toolbar positioning change
2024-08-27 13:03:12 -04:00
Trevor Buckner
63fa747fd7 Merge branch 'master' into Fix-Toolbar-Positioning 2024-08-27 13:03:06 -04:00
Gazook89
a7ddeafd06 revert change 2024-08-27 11:59:29 -05:00
Trevor Buckner
81e6cae99d Merge pull request #3670 from 5e-Cleric/v3.14.2
up to v3.14.2
2024-08-27 12:00:38 -04:00
Trevor Buckner
be0db1770d Reword to describe the fix, rather than the PR title 2024-08-27 11:55:41 -04:00
Trevor Buckner
f905a62b6c Merge branch 'master' into v3.14.2 2024-08-27 11:47:47 -04:00
Trevor Buckner
35ca31cf43 Merge pull request #3671 from Gazook89/Fix-Toolbar-Positioning
Small Patch for Toolbar Positioning
2024-08-27 11:47:24 -04:00
Trevor Buckner
0ce3ac9be2 Merge branch 'master' into Fix-Toolbar-Positioning 2024-08-27 11:27:36 -04:00
Trevor Buckner
7cdf1c93cf Merge pull request #3665 from Gazook89/Fill-Pane-Buttons
VIEWER TOOLS PART 2 - Zoom to Fit, Fit to Width
2024-08-27 11:26:56 -04:00
Gazook89
a7c4b78ec8 set position relative, remove padding 2024-08-27 09:03:24 -05:00
Gazook89
aa321fe2c3 Merge branch 'master' into Fill-Pane-Buttons 2024-08-27 08:43:19 -05:00
Gazook89
7bc0af9a8c utilize Infinity and reduce() 2024-08-27 08:42:45 -05:00
Víctor Losada Hernández
69475833e6 "Update changelog.md with new hotkeys and fix for reload clobbering modified fresh clones" 2024-08-27 15:23:17 +02:00
Víctor Losada Hernández
7dce3b3de5 up to v3.14.2 2024-08-27 10:41:53 +02:00
Trevor Buckner
183687d676 Merge pull request #3075 from G-Ambatte/addCSSRoute-#1097
Add route to get brew styling
2024-08-26 20:04:46 -04:00
Trevor Buckner
786acc7a1c Merge branch 'master' into addCSSRoute-#1097 2024-08-26 20:01:45 -04:00
Trevor Buckner
3d3ad3f284 Small tweaks 2024-08-26 19:58:28 -04:00
Trevor Buckner
a6a1d70abc Merge pull request #3669 from naturalcrit/dependabot/npm_and_yarn/eslint-9.9.1
Bump eslint from 9.9.0 to 9.9.1
2024-08-26 17:39:44 -04:00
dependabot[bot]
73461d6372 Bump eslint from 9.9.0 to 9.9.1
Bumps [eslint](https://github.com/eslint/eslint) from 9.9.0 to 9.9.1.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v9.9.0...v9.9.1)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-26 21:35:52 +00:00
Trevor Buckner
e56c6a5085 Merge pull request #3668 from naturalcrit/dependabot/npm_and_yarn/superagent-10.1.0
Bump superagent from 9.0.2 to 10.1.0
2024-08-26 17:34:39 -04:00
Trevor Buckner
f8f0280f8c Merge branch 'master' into dependabot/npm_and_yarn/superagent-10.1.0 2024-08-26 17:27:58 -04:00
Trevor Buckner
4e393779ac Merge pull request #3644 from G-Ambatte/fixEmojiFolding-#3604
Prevent styling of lines inside folded sections
2024-08-26 17:26:01 -04:00
Trevor Buckner
5671728c97 Change filter to some
`some` stops once it finds a true case; `filter` has to process the whole list of folds first.
2024-08-26 17:23:44 -04:00
Gazook89
e06611a90f set all zoom buttons to use handleZoomButton
All zoom buttons run through same handler now.

They no longer take only the delta of the current zoom and desired zoom-- they take the actual desired zoom.

calculateZoom is now calculateChange, to help get the desired delta.
2024-08-26 16:16:13 -05:00
Gazook89
7b767368df Change icons to mask-image
Removes icons as components, uses mask-image instead.

Sets a size on the .fac icons to 1em so by default they are 1em and retain their aspect ratio.

rename the icon files for consistency.
2024-08-26 15:51:35 -05:00
Trevor Buckner
d59c6be359 Merge branch 'master' into fixEmojiFolding-#3604 2024-08-26 16:34:06 -04:00
dependabot[bot]
0d564dd0bf Bump superagent from 9.0.2 to 10.1.0
Bumps [superagent](https://github.com/ladjs/superagent) from 9.0.2 to 10.1.0.
- [Release notes](https://github.com/ladjs/superagent/releases)
- [Changelog](https://github.com/ladjs/superagent/blob/master/HISTORY.md)
- [Commits](https://github.com/ladjs/superagent/compare/v9.0.2...v10.1.0)

---
updated-dependencies:
- dependency-name: superagent
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-26 03:57:55 +00:00
Trevor Buckner
ef6e1e1782 Merge pull request #3667 from naturalcrit/dependabot/npm_and_yarn/mongoose-8.5.4
Bump mongoose from 8.5.3 to 8.5.4
2024-08-25 23:56:46 -04:00
dependabot[bot]
b2f5e39256 Bump mongoose from 8.5.3 to 8.5.4
Bumps [mongoose](https://github.com/Automattic/mongoose) from 8.5.3 to 8.5.4.
- [Release notes](https://github.com/Automattic/mongoose/releases)
- [Changelog](https://github.com/Automattic/mongoose/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Automattic/mongoose/compare/8.5.3...8.5.4)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-26 03:55:31 +00:00
Víctor Losada Hernández
762de62aa6 Merge branch 'master' into addCSSRoute-#1097 2024-08-25 13:21:37 +02:00
Trevor Buckner
d4d27aab6a Merge branch 'master' into Fill-Pane-Buttons 2024-08-24 23:59:19 -04:00
Trevor Buckner
1803c89a23 Merge pull request #3499 from 5e-Cleric/pdf-tools
Viewer tools
2024-08-24 23:58:10 -04:00
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
Trevor Buckner
7a5b0b32c4 restore deleted line from helpers.js 2024-08-24 23:26:45 -04:00
Gazook89
35a0a12f16 Merge branch 'pr/3499' into Fill-Pane-Buttons 2024-08-24 22:02:56 -05: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
94ae33d328 Merge branch 'pr/3499' into Fill-Pane-Buttons 2024-08-24 21:28:13 -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
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
370c480670 Merge branch 'master' into pr/3499 2024-08-23 22:55:13 -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
Víctor Losada Hernández
5e69718f4f Merge branch 'master' into imageWrappin 2024-08-23 23:30:37 +02:00
Víctor Losada Hernández
ca5a7a1dbb Merge branch 'master' into addCSSRoute-#1097 2024-08-23 23:16:19 +02:00
Víctor Losada Hernández
505ac0c1d5 Merge pull request #3515 from dbolack-ab/Issue_1430_Unique_HeaderIDs
Create globally unique Header IDs when marked parses.
2024-08-23 23:12:02 +02:00
Víctor Losada Hernández
987d1c881b Merge branch 'master' of https://github.com/naturalcrit/homebrewery into Issue_1430_Unique_HeaderIDs 2024-08-23 23:08:20 +02: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
Trevor Buckner
717ced28d6 Merge pull request #3662 from naturalcrit/dependabot/npm_and_yarn/babel/preset-env-7.25.4
Bump @babel/preset-env from 7.25.3 to 7.25.4
2024-08-23 01:17:02 -04:00
dependabot[bot]
fb836df8d5 Bump @babel/preset-env from 7.25.3 to 7.25.4
Bumps [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) from 7.25.3 to 7.25.4.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.25.4/packages/babel-preset-env)

---
updated-dependencies:
- dependency-name: "@babel/preset-env"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-23 05:03:02 +00:00
Trevor Buckner
fba08262d3 Merge pull request #3661 from naturalcrit/dependabot/npm_and_yarn/babel/plugin-transform-runtime-7.25.4
Bump @babel/plugin-transform-runtime from 7.24.7 to 7.25.4
2024-08-23 01:01:49 -04:00
dependabot[bot]
56582b6b24 Bump @babel/plugin-transform-runtime from 7.24.7 to 7.25.4
Bumps [@babel/plugin-transform-runtime](https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-transform-runtime) from 7.24.7 to 7.25.4.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.25.4/packages/babel-plugin-transform-runtime)

---
updated-dependencies:
- dependency-name: "@babel/plugin-transform-runtime"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-23 04:58:49 +00:00
Trevor Buckner
43e4e43c7c Merge pull request #3663 from naturalcrit/updateEsLintV9
up ESLint to v9.9
2024-08-23 00:57:34 -04:00
Trevor Buckner
3f3f113305 More typos 2024-08-23 00:54:00 -04:00
Trevor Buckner
96e23ee2ea fix accidental deletion 2024-08-23 00:52:48 -04:00
Trevor Buckner
c57c9e236b Update config file to new format 2024-08-23 00:49:36 -04: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
Trevor Buckner
4fa8351f7f Merge pull request #3643 from G-Ambatte/fixMaskSkewing-#3636
Change order of operations in mask img transform
2024-08-22 22:14:46 -04:00
Trevor Buckner
fa669f32fc Merge branch 'master' into fixMaskSkewing-#3636 2024-08-22 22:12:10 -04:00
Trevor Buckner
fc294807fd Merge branch 'master' into imageWrappin 2024-08-22 22:10:11 -04:00
Trevor Buckner
a9fe516675 Merge pull request #3657 from naturalcrit/dependabot/npm_and_yarn/stylelint-config-recess-order-5.1.0
Bump stylelint-config-recess-order from 5.0.1 to 5.1.0
2024-08-22 22:09:53 -04:00
Trevor Buckner
6502847b95 Merge pull request #3648 from dbolack-ab/preservePREColons
Fix for the colons in codeblocks issue.
2024-08-22 22:09:34 -04: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
Trevor Buckner
eeedc5f7d4 Merge branch 'master' into preservePREColons 2024-08-22 21:53:16 -04:00
Trevor Buckner
fff357d08b Make 'block-level' extension. Tweaks to pass new tests
'block-level' because it never occurs inside another block ('inline-level' always occurs inside something else); starts and stops on on its own line without anything else on the same line.
2024-08-22 21:52:40 -04:00
Trevor Buckner
e0b69dce14 add more test cases
Test a large number of breaks, and interaction with paragraphs
2024-08-22 21:49:40 -04:00
Trevor Buckner
e6c5e6451c Add more tests for edge conflicts with definition lists 2024-08-22 21:46:42 -04:00
Trevor Buckner
26866c337f Add tests to circleci 2024-08-22 21:45:44 -04: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
Trevor Buckner
073076e011 Merge pull request #3654 from naturalcrit/RerouteInvalidPaths
Add catch-all for invalid paths
2024-08-22 16:38:25 -04:00
Trevor Buckner
71b505d55b Merge branch 'master' into RerouteInvalidPaths 2024-08-22 16:37:55 -04:00
Trevor Buckner
dc7d877e6f Add snippets and icons 2024-08-22 16:35:48 -04:00
Trevor Buckner
40ab2c2283 rearrange code 2024-08-22 14:24:33 -04:00
Trevor Buckner
d8f0618691 Fix variables tests for same reason 2024-08-22 13:20:07 -04:00
Trevor Buckner
955b34b637 Fix tests to account for --HB_src variable presence 2024-08-22 13:12:40 -04:00
Trevor Buckner
8dea2ca9fb wrapLeft and wrapRight classes to automatically apply wrapping 2024-08-22 12:47:26 -04:00
Trevor Buckner
696bcd4367 Expose src url in --HB_src
Decided to do this for *all* images, not just those being injected. In case someone wants to automatically apply wrapping to images inside a stat block, etc.
2024-08-22 12:46:56 -04:00
Trevor Buckner
d70c5a6fe3 Merge pull request #3658 from naturalcrit/UpdateMarkedHelperFunctions
Update `cleanURL` helper function to match later Marked version
2024-08-22 11:53:51 -04:00
Trevor Buckner
645c9a122c Update cleanURL helper function to match later Marked version 2024-08-22 11:51:24 -04:00
Trevor Buckner
b774c89bdb Merge branch 'master' into RerouteInvalidPaths 2024-08-22 10:41:00 -04:00
dependabot[bot]
c75ebb36cb Bump stylelint-config-recess-order from 5.0.1 to 5.1.0
Bumps [stylelint-config-recess-order](https://github.com/stormwarning/stylelint-config-recess-order) from 5.0.1 to 5.1.0.
- [Release notes](https://github.com/stormwarning/stylelint-config-recess-order/releases)
- [Changelog](https://github.com/stormwarning/stylelint-config-recess-order/blob/main/CHANGELOG.md)
- [Commits](https://github.com/stormwarning/stylelint-config-recess-order/compare/v5.0.1...v5.1.0)

---
updated-dependencies:
- dependency-name: stylelint-config-recess-order
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-22 03:10:12 +00:00
David Bolack
1c03138968 Merge branch 'master' into Issue_1430_Unique_HeaderIDs 2024-08-21 21:23:09 -05:00
David Bolack
1313772adc Merge branch 'master' into preservePREColons 2024-08-21 21:21:06 -05:00
Víctor Losada Hernández
fb06ae0d03 Merge branch 'master' into pdf-tools 2024-08-21 23:07:25 +02:00
G.Ambatte
e952e05b79 Merge branch 'master' into fixMaskSkewing-#3636 2024-08-22 08:45:26 +12:00
Trevor Buckner
c020297d78 Merge pull request #3655 from naturalcrit/dependabot/npm_and_yarn/googleapis/drive-8.13.0
Bump @googleapis/drive from 8.11.1 to 8.13.0
2024-08-21 10:34:35 -04:00
dependabot[bot]
8ea7d3dc8f Bump @googleapis/drive from 8.11.1 to 8.13.0
Bumps [@googleapis/drive](https://github.com/googleapis/google-api-nodejs-client) from 8.11.1 to 8.13.0.
- [Release notes](https://github.com/googleapis/google-api-nodejs-client/releases)
- [Changelog](https://github.com/googleapis/google-api-nodejs-client/blob/main/release-please-config.json)
- [Commits](https://github.com/googleapis/google-api-nodejs-client/compare/drive-v8.11.1...drive-v8.13.0)

---
updated-dependencies:
- dependency-name: "@googleapis/drive"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-21 03:14:46 +00: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
Trevor Buckner
dedf9e0be9 Merge pull request #3630 from dbolack-ab/FalsePaths
Prevent loading of undefined renderer or theme theme bundle.
2024-08-20 17:33:41 -04:00
Trevor Buckner
0cc001fe94 Merge branch 'master' into FalsePaths 2024-08-20 17:33:30 -04:00
Trevor Buckner
0f969ce383 Add catch-all for invalid paths
res.route is the currently-matched route. If nothing has been matched by this point (route = undefined), we have an invalid route.
2024-08-20 17:11:50 -04: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
Trevor Buckner
defbc716c0 Merge pull request #3633 from naturalcrit/dependabot/npm_and_yarn/mongoose-8.5.3
Bump mongoose from 8.5.2 to 8.5.3
2024-08-20 16:09:07 -04:00
Trevor Buckner
1803dfdeb1 Merge branch 'master' into dependabot/npm_and_yarn/mongoose-8.5.3 2024-08-20 15:54:55 -04:00
Trevor Buckner
787d50f17c Merge pull request #3483 from dbolack-ab/Issue_241
Add Jump-To hotkeys
2024-08-20 15:54:42 -04:00
David Bolack
925d934892 Merge branch 'master' into preservePREColons 2024-08-20 14:02:46 -05:00
David Bolack
e45bcf76ce Merge branch 'master' into Issue_241 2024-08-20 13:49:02 -05:00
David Bolack
54d5dbf992 Pruning 2024-08-20 13:47:32 -05:00
David Bolack
bb18ed7eda Merge branch 'master' into Issue_1430_Unique_HeaderIDs 2024-08-20 13:41:29 -05:00
dependabot[bot]
f8895721fc Bump mongoose from 8.5.2 to 8.5.3
Bumps [mongoose](https://github.com/Automattic/mongoose) from 8.5.2 to 8.5.3.
- [Release notes](https://github.com/Automattic/mongoose/releases)
- [Changelog](https://github.com/Automattic/mongoose/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Automattic/mongoose/compare/8.5.2...8.5.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-20 18:36:57 +00:00
David Bolack
ba340f033a Merge branch 'master' into preservePREColons 2024-08-20 13:36:29 -05:00
Trevor Buckner
4c30a8f6a3 Merge pull request #3641 from naturalcrit/dependabot/npm_and_yarn/stylelint-16.8.2
Bump stylelint from 16.8.1 to 16.8.2
2024-08-20 14:35:39 -04:00
David Bolack
cbcb712587 Merge branch 'master' into Issue_241 2024-08-20 13:34:47 -05:00
Trevor Buckner
187b6a9e8a Merge branch 'master' into dependabot/npm_and_yarn/stylelint-16.8.2 2024-08-20 14:27:37 -04:00
Trevor Buckner
2816a39ff9 Merge pull request #3652 from dbolack-ab/saveTheClones
Prevent reload from clobbering modified fresh clones
2024-08-20 14:27:24 -04:00
David Bolack
9203cc2a6a Merge branch 'master' into preservePREColons 2024-08-20 13:24:24 -05:00
David Bolack
9e19ba2d4e Merge branch 'master' into saveTheClones 2024-08-20 13:22:56 -05:00
David Bolack
a706c9ff9b Merge branch 'master' into Issue_241 2024-08-20 13:22:25 -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
Trevor Buckner
11790fa438 Merge branch 'master' into dependabot/npm_and_yarn/stylelint-16.8.2 2024-08-20 13:53:56 -04:00
Trevor Buckner
c4049ec5fa Merge pull request #3642 from naturalcrit/dependabot/npm_and_yarn/react-router-dom-6.26.1
Bump react-router-dom from 6.26.0 to 6.26.1
2024-08-20 13:53:35 -04:00
Trevor Buckner
02fca27f85 Merge branch 'master' into dependabot/npm_and_yarn/react-router-dom-6.26.1 2024-08-20 13:51:07 -04:00
Trevor Buckner
7f717b92fd Merge pull request #3653 from naturalcrit/dependabot/npm_and_yarn/elliptic-6.5.7
Bump elliptic from 6.5.6 to 6.5.7
2024-08-20 13:50:52 -04:00
dependabot[bot]
e2272b078b Bump elliptic from 6.5.6 to 6.5.7
Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.6 to 6.5.7.
- [Commits](https://github.com/indutny/elliptic/compare/v6.5.6...v6.5.7)

---
updated-dependencies:
- dependency-name: elliptic
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-20 17:47:02 +00:00
dependabot[bot]
01161752c6 Bump react-router-dom from 6.26.0 to 6.26.1
Bumps [react-router-dom](https://github.com/remix-run/react-router/tree/HEAD/packages/react-router-dom) from 6.26.0 to 6.26.1.
- [Release notes](https://github.com/remix-run/react-router/releases)
- [Changelog](https://github.com/remix-run/react-router/blob/main/packages/react-router-dom/CHANGELOG.md)
- [Commits](https://github.com/remix-run/react-router/commits/react-router-dom@6.26.1/packages/react-router-dom)

---
updated-dependencies:
- dependency-name: react-router-dom
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-20 17:46:53 +00:00
Trevor Buckner
3237a4f2eb Merge branch 'master' into dependabot/npm_and_yarn/stylelint-16.8.2 2024-08-20 13:45:58 -04:00
Trevor Buckner
d87e07e9ba Merge pull request #3649 from naturalcrit/dependabot/npm_and_yarn/stylistic/stylelint-plugin-3.0.1
Bump @stylistic/stylelint-plugin from 3.0.0 to 3.0.1
2024-08-20 13:45:38 -04:00
dependabot[bot]
82529e0b06 Bump stylelint from 16.8.1 to 16.8.2
Bumps [stylelint](https://github.com/stylelint/stylelint) from 16.8.1 to 16.8.2.
- [Release notes](https://github.com/stylelint/stylelint/releases)
- [Changelog](https://github.com/stylelint/stylelint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/stylelint/stylelint/compare/16.8.1...16.8.2)

---
updated-dependencies:
- dependency-name: stylelint
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-20 17:44:18 +00:00
dependabot[bot]
641303d1ad Bump @stylistic/stylelint-plugin from 3.0.0 to 3.0.1
Bumps [@stylistic/stylelint-plugin](https://github.com/stylelint-stylistic/stylelint-stylistic) from 3.0.0 to 3.0.1.
- [Release notes](https://github.com/stylelint-stylistic/stylelint-stylistic/releases)
- [Changelog](https://github.com/stylelint-stylistic/stylelint-stylistic/blob/main/CHANGELOG.md)
- [Commits](https://github.com/stylelint-stylistic/stylelint-stylistic/compare/v3.0.0...v3.0.1)

---
updated-dependencies:
- dependency-name: "@stylistic/stylelint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-20 17:44:14 +00:00
Trevor Buckner
845c2eca76 Merge pull request #3650 from naturalcrit/dependabot/npm_and_yarn/googleapis/drive-8.11.1
Bump @googleapis/drive from 8.11.0 to 8.11.1
2024-08-20 13:42:58 -04:00
David Bolack
e957f40775 Revert previous simplification as it breaks the original purpose of this PR
Added test for inside a code block.
2024-08-20 12:17:51 -05:00
David Bolack
3985afade9 Remove need for Definition exceptios
Retool original `:` break to insert `\n\n`s between each `:` so that
the definition lists never have a chance for a mismatch.

Rename token to "hardbreak"
Add tests for hardBreaks for `:`, `::`, and `:::` which should verify it works and does not collide with definitionlists.
2024-08-20 11:46:43 -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
David Bolack
3a81521e6f Work around users using Definition lists as paragraph indents. 2024-08-19 19:40:55 -05:00
David Bolack
a30608a8ae Promote : paragraph breaks shortcut to a token. 2024-08-19 10:36:26 -05:00
dependabot[bot]
6a129aebdb Bump @googleapis/drive from 8.11.0 to 8.11.1
Bumps [@googleapis/drive](https://github.com/googleapis/google-api-nodejs-client) from 8.11.0 to 8.11.1.
- [Release notes](https://github.com/googleapis/google-api-nodejs-client/releases)
- [Changelog](https://github.com/googleapis/google-api-nodejs-client/blob/main/release-please-config.json)
- [Commits](https://github.com/googleapis/google-api-nodejs-client/compare/drive-v8.11.0...drive-v8.11.1)

---
updated-dependencies:
- dependency-name: "@googleapis/drive"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-19 03:58:19 +00:00
David Bolack
184f182b3a Short term fix for the colons in codeblocks issue. 2024-08-18 21:52:29 -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
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
Gazook89
5a84c0aaa7 Merge branch 'pr/3499' into Simplify-Zoom-Slider 2024-08-17 20:22:57 -05:00
Gazook89
4a6418a475 fix padding on sides of slider
Extra padding on the sides of a range slider extends the length of the slider, such that you can't move the thumb all the way to the end.
2024-08-17 18:08:33 -05:00
Gazook89
efb4c67e2a use zoom icons rather than text 2024-08-17 15:40:52 -05:00
Gazook89
b325779466 remove extra line breaks 2024-08-17 15:38:27 -05:00
Gazook89
0d475ab035 refactor some properties
Mostly change some properties from things like "transparent" to "unset".  A lot of things that are just overriding the default Naturalcrit "colored button".  Moved some properties to the top level `.toolbar` class and let it cascade down.
2024-08-17 15:38:00 -05:00
Gazook89
c791c0f60b modify the interactive states
more closely match the properties editor behavior.  removed some unnecessary (unused) properties.  Outline only appears when element is focused (rather than on hover as well).
2024-08-17 15:36:12 -05:00
Gazook89
f204b0ebc0 tool elements use width:auto for flexibility, but with min-width
Set the child elements of the toolbar to have auto width (can expand as needed), but have a min-width so no button, such as an icon, is too small.
2024-08-17 15:34:13 -05:00
Gazook89
adab8449e0 Change toolbar spacing
replace column-/row-gap with a single gap at 5px.  Padding on each child element will provide the space.  Set a height on toolbar, so child elements can be set to 100% height to improve bg color change on hover.
2024-08-17 15:32:30 -05:00
Gazook89
fc96f6bf95 text input changes (text-transform, radius, border, focus)
Aligning input here with Properties editor inputs.  Removed border radius, added thin border, a focus border.
2024-08-17 14:45:50 -05:00
Gazook89
9924c6049e Aesthetic changes to tooltip (radius, bg color)
Matching tooltip color to the background of the input it belongs to, for better cohesion.  Removed border-radius as well.
2024-08-17 14:26:45 -05:00
Gazook89
21e9251043 aesthetic changes (border, text align, font size)
Text align isn't doing anything, and no other UI element is using a border and doesn't seem necessary here.  Maintains the "flat" design.
2024-08-17 14:25:04 -05:00
Gazook89
19e6d94419 Set as Relative position, remove extra properties
Doesn't need to be Sticky positioning, relative is fine (it is still fixed above the iframe).  Allows us to remove a bunch of extra properties.

Add a smidgen of padding.
2024-08-17 14:23:33 -05:00
Gazook89
232f28b5b4 Remove extra styling of the slider thumb
can just use browser defaults for this.
2024-08-17 14:06:58 -05:00
Gazook89
6af5abd37d Rearrange nesting of slider tooltip
Just moving the :hover:after tooltip to within the existing css rule for sliders.
2024-08-17 14:06:14 -05:00
Gazook89
e0e49c606f Utilize browser defined style for slider, with accent-color
Avoid over-styling of browser-defined slider, but still apply a HB appropriate color scheme.  Prevents us from having to create our own tick marks, so we can just define the `option`s in the datalist and get tick marks in the right spot.
2024-08-17 14:05:14 -05:00
Gazook89
e9e49e39fb Set preview zoom to update with onChange
Commented out the existing onChange handler, switched the onMouseUp that actually applies the zoom to onChange.
2024-08-17 13:59:58 -05:00
Gazook89
ee4eb19f1e Run ESLint auto lint (spaces to tabs mostly) 2024-08-17 13:57:50 -05:00
G.Ambatte
cc9edcc67c Prevent styling of lines inside folded sections 2024-08-17 23:11:04 +12:00
Víctor Losada Hernández
032fcf12e0 "Removed dynamic generation of zoom levels in datalist, replaced with a single static option of 100%" 2024-08-17 11:39:22 +02:00
G.Ambatte
174024b472 Merge branch 'master' into fixMaskSkewing-#3636 2024-08-17 11:02:25 +12:00
G.Ambatte
8a8cd3fb18 Change order of operations in mask img transform 2024-08-17 10:54:02 +12:00
G.Ambatte
dff0a7ae77 Merge branch 'addCSSRoute-#1097' of https://github.com/G-Ambatte/homebrewery into addCSSRoute-#1097 2024-08-17 10:27:09 +12:00
G.Ambatte
014482b3d5 Remove app.spec.js test command 2024-08-17 10:26:59 +12:00
G.Ambatte
ce7a98f974 Merge branch 'master' into addCSSRoute-#1097 2024-08-17 10:25:18 +12:00
Víctor Losada Hernández
5ee4ada112 "Updated ToolBar component: added zoom level limits, refactored zoom level handling, and modified CSS styles for input and slider elements." 2024-08-16 15:58:00 +02: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
9dde4aa94e Merge branch 'pdf-tools' of https://github.com/5e-Cleric/homebrewery into pdf-tools 2024-08-15 17:46:49 +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
David Bolack
81a098b6cf Merge branch 'master' into Issue_241 2024-08-15 09:40:23 -05:00
Víctor Losada Hernández
c6f87eded0 add vault nav item to userpage 2024-08-14 20:42:18 +02:00
David Bolack
aa2fe3ef97 Merge branch 'master' into FalsePaths 2024-08-13 22:12:03 -05:00
Trevor Buckner
31fcf28e3f Merge pull request #3631 from naturalcrit/v3.14.1
Up to v3.14.1
2024-08-13 17:11:08 -04:00
David Bolack
52faa366ca Merge branch 'master' into Issue_1430_Unique_HeaderIDs 2024-08-13 12:30:16 -05:00
David Bolack
fc6930c868 Merge branch 'master' into Issue_241 2024-08-13 12:17:45 -05:00
David Bolack
1ed7e43db1 Implement G-Ambette's cleaner fix. 2024-08-13 12:09:45 -05:00
David Bolack
6ec51bf725 Revert "Prevent loading of undefined renderer or theme themebundle."
This reverts commit 136e877ee6.
2024-08-13 12:09:26 -05:00
G.Ambatte
ae336f1429 Add extra getCSS tests 2024-08-13 22:30:59 +12:00
G.Ambatte
5847b246ef Add getCSS test 2024-08-13 22:05:03 +12:00
G.Ambatte
38168131e7 Remove app.spec.js 2024-08-13 22:03:06 +12:00
G.Ambatte
00e113ff67 Move getCSS to homebrew.api.js 2024-08-13 22:02:54 +12:00
Víctor Losada Hernández
62b96f4e79 change back prop names 2024-08-13 12:00:58 +02:00
David Bolack
136e877ee6 Prevent loading of undefined renderer or theme themebundle. 2024-08-12 21:42:25 -05:00
Víctor Losada Hernández
8faae1e645 Remove console log statement for invalid search in VaultPage component. 2024-08-13 00:51:28 +02:00
Víctor Losada Hernández
e4852b7077 Merge branch 'master' of https://github.com/naturalcrit/homebrewery into experimental-development 2024-08-13 00:47:25 +02:00
G.Ambatte
2ba42def09 Merge branch 'master' into addCSSRoute-#1097 2024-08-12 22:01:56 +12:00
G.Ambatte
337d3567fc Merge branch 'addCSSRoute-#1097' of https://github.com/G-Ambatte/homebrewery into addCSSRoute-#1097 2024-08-12 18:49:11 +12:00
G.Ambatte
3dc8eec1e6 Add app test NPM command 2024-08-12 18:49:01 +12:00
G.Ambatte
fac2293b77 Add App test file 2024-08-12 18:48:46 +12:00
G.Ambatte
7d699e455e Switch CSS route to call a function 2024-08-12 18:48:28 +12:00
G.Ambatte
e03b540788 Merge branch 'master' into addCSSRoute-#1097 2024-08-10 18:03:50 +12:00
Víctor Losada Hernández
2dc4ebb39f Remove console log and CSS rule for hr element in vaultPage. 2024-08-10 00:12:17 +02:00
Víctor Losada Hernández
59672b79d8 remove unnecessary changes in unrelated files 2024-08-10 00:05:58 +02:00
Víctor Losada Hernández
59717fe630 "Refactor VaultPage component, update styles, and modify server-side API queries" 2024-08-10 00:00:43 +02:00
Víctor Losada Hernández
3f9c7a1794 "Moved and rearranged conditional statements for rendering no search/brews found messages in VaultPage component." 2024-08-09 23:15:59 +02:00
Víctor Losada Hernández
ca1f2dd1c3 fix validity check 2024-08-09 22:57:17 +02:00
Víctor Losada Hernández
a8e6f5cf26 "Refactor VaultPage component: moved form validation logic, removed unnecessary variables, and rearranged code structure." 2024-08-09 22:53:20 +02:00
Víctor Losada Hernández
f3a774d55c "Removed unnecessary conditional statement in buildBrewsQuery function" 2024-08-09 22:46:25 +02:00
Víctor Losada Hernández
834980890a "Refactor VaultPage component: update form validation and submission logic" 2024-08-09 22:44:26 +02:00
Víctor Losada Hernández
969eb354ce include query example for future debugging 2024-08-09 22:35:39 +02:00
Víctor Losada Hernández
9288ead130 remove owner functionality completely 2024-08-09 19:24:39 +02:00
Víctor Losada Hernández
a8a4930225 Merge branch 'experimental-development' of https://github.com/5e-Cleric/homebrewery; branch 'master' of https://github.com/naturalcrit/homebrewery into experimental-development 2024-08-09 18:54:51 +02:00
G.Ambatte
190bce519f Merge branch 'master' into addCSSRoute-#1097 2024-08-09 15:29:56 +12:00
David Bolack
6f4604c8a9 Merge branch 'master' into Issue_241 2024-08-02 15:51:53 -05:00
David Bolack
13fa06ec1f Merge branch 'master' into Issue_1430_Unique_HeaderIDs 2024-08-02 15:49:34 -05:00
Trevor Buckner
4b3b44ecc8 Merge branch 'master' into addCSSRoute-#1097 2024-08-01 14:28:10 -04:00
David Bolack
129e18da0f Merge branch 'master' into Issue_241 2024-08-01 11:04:52 -05:00
Víctor Losada Hernández
2bc7cda8c9 fixes 2024-08-01 17:36:14 +02:00
David Bolack
31b3bd1ace Merge branch 'master' into Issue_1430_Unique_HeaderIDs 2024-08-01 09:25:30 -05:00
Víctor Losada Hernández
f1ab332ce0 hide instead of comment 2024-08-01 16:02:00 +02:00
Víctor Losada Hernández
d50f23354a minor changes 2024-08-01 15:57:27 +02:00
Víctor Losada Hernández
662a2d776a Merge branch 'experimental-development' of https://github.com/5e-Cleric/homebrewery into experimental-development 2024-08-01 15:55:09 +02:00
Víctor Losada Hernández
80f07bf0b0 Nav item 2024-08-01 15:55:04 +02:00
Víctor Losada Hernández
6cf2dd8186 Merge branch 'master' into experimental-development 2024-08-01 15:49:52 +02:00
Víctor Losada Hernández
5de20cb451 disabling owner input 2024-08-01 15:32:13 +02:00
Víctor Losada Hernández
aa0d0bed48 Merge branch 'master' of https://github.com/naturalcrit/homebrewery into experimental-development 2024-07-31 23:12:47 +02:00
Víctor Losada Hernández
c92f30cfe0 change owner default to false 2024-07-31 08:58:23 +02:00
Víctor Losada Hernández
2a8e4b2a63 Merge branch 'experimental-development' of https://github.com/5e-Cleric/homebrewery into experimental-development 2024-07-31 08:57:42 +02:00
Víctor Losada Hernández
51c7549b45 Merge branch 'master' of https://github.com/naturalcrit/homebrewery into experimental-development 2024-07-31 08:57:28 +02:00
Víctor Losada Hernández
ea5170e6a6 Merge branch 'master' into experimental-development 2024-07-30 22:46:44 +02:00
David Bolack
a7f8b52966 Change default value for pageNumber on markdopwn.render() 2024-07-30 08:56:06 -05:00
David Bolack
6629bc64d8 Merge branch 'Issue_1430_Unique_HeaderIDs' of github.com:dbolack-ab/homebrewery into Issue_1430_Unique_HeaderIDs 2024-07-30 08:36:47 -05:00
David Bolack
bfd46fb6fd Merge branch 'master' into Issue_1430_Unique_HeaderIDs 2024-07-30 08:35:12 -05:00
David Bolack
2d335ef7fc Merge branch 'master' into Issue_241 2024-07-30 02:30:57 -05:00
Víctor Losada Hernández
cef90f5ff9 Added !brewCollection condition to if statement in VaultPage component. 2024-07-28 11:18:26 +02:00
Víctor Losada Hernández
5a9b77190a "Removed console log statement in VaultPage.jsx and updated brewsQuery logic in vault.api.js to handle legacy and v3 filters" 2024-07-28 11:10:27 +02:00
Víctor Losada Hernández
59a5f641af search by author 2024-07-28 10:45:56 +02:00
Víctor Losada Hernández
0bda666127 "Changed condition in onKeyDown event handler from checking input validity and value to checking searchButtonRef.current.disabled" 2024-07-27 10:46:08 +02:00
Víctor Losada Hernández
5b96ef4406 "Refactor VaultPage component: updated validateInput to validateForm, changed input validation logic, and added refs for search button and checkboxes." 2024-07-27 10:41:10 +02:00
Víctor Losada Hernández
af5bbdc677 change from $or to $in 2024-07-27 10:39:06 +02:00
Víctor Losada Hernández
2c4f4ff5fc Merge branch 'master' into pdf-tools 2024-07-26 14:14:57 +02:00
Víctor Losada Hernández
c1dc712542 better checkboxes and linting 2024-07-25 23:48:37 +02:00
Víctor Losada Hernández
3e2c2de269 Added hideMoveArrows prop to split pane for use in vault 2024-07-25 23:11:51 +02:00
Víctor Losada Hernández
cc08579583 change to splitPane component 2024-07-25 16:57:33 +02:00
Víctor Losada Hernández
e562ebef48 media query for mobile use expanded to vertical stack 2024-07-24 00:50:21 +02:00
Víctor Losada Hernández
e206b501a6 media query to show only one column in case of small window 2024-07-24 00:34:13 +02:00
Víctor Losada Hernández
016a9fa1e8 few css changes to make the page more responsive on smaller screens 2024-07-24 00:26:23 +02:00
Víctor Losada Hernández
01ee184044 "Update default count value from 10 to 20 in VaultPage component and vault API" 2024-07-23 23:57:05 +02:00
Víctor Losada Hernández
fd91bf0fff Merge branch 'master' into Issue_1430_Unique_HeaderIDs 2024-07-22 23:07:06 +02:00
Víctor Losada Hernández
ddf2006285 Merge branch 'master' of https://github.com/naturalcrit/homebrewery into experimental-development 2024-07-21 18:06:08 +02: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
eb99acc95b Merge branch 'master' into Issue_1430_Unique_HeaderIDs 2024-06-27 10:20:54 -05:00
David Bolack
060f28a0a6 Merge branch 'master' into Issue_241 2024-06-19 18:41:02 -05:00
David Bolack
a3f146cd53 Change the last Boneheaded hot change to something better
CTRL-SHIFT-LEFTARROW - Source Jump
CTRL-SHIFT-RIGHTARROW - Brew Jump
2024-06-19 18:39:20 -05:00
Víctor Losada Hernández
5232c16eb2 change div to form 2024-06-13 01:32:34 +02:00
Víctor Losada Hernández
bdfd194672 changed order of params per request 2024-06-13 01:13:38 +02:00
Víctor Losada Hernández
cb0cb32860 minor style changes & lint less file 2024-06-13 01:04:39 +02:00
Víctor Losada Hernández
1e080b30fd finally fixed the damn issue 2024-06-13 00:41:40 +02:00
David Bolack
cba57d1033 Fix and future-proof tests to use page 0 where necessary in markdown.render() calls. 2024-06-11 20:06:20 -05:00
David Bolack
1bece09339 Merge branch 'master' into Issue_1430_Unique_HeaderIDs 2024-06-11 12:59:21 -05:00
Víctor Losada Hernández
90431efbc9 "Removed ArchivePage and related files, replaced with VaultPage, updated routes and API endpoints, and made minor changes to theme configuration and error handling." 2024-06-11 00:33:36 +02:00
Víctor Losada Hernández
99b0c2b54e Merge branch 'master' of https://github.com/naturalcrit/homebrewery into experimental-development 2024-06-10 23:25:42 +02:00
Víctor Losada Hernández
042e217872 "Refactor ArchivePage component from createClass to functional component with hooks" 2024-06-10 23:23:31 +02:00
David Bolack
c918a79957 Integrates corrections for Document level unique Header IDs in tandum with marked-gfm-header-id updates.
Requries https://github.com/markedjs/marked-gfm-heading-id/issues/542 and an assumed version bump to work.

Validated locally.
2024-06-05 12:44:46 -05:00
David Bolack
a48d9d295e Try binging to ctrl-X and CTRL-Shift-X which seem to somehow be available... 2024-06-02 20:23:33 -05:00
Víctor Losada Hernández
a5f453f1e5 linting toolBar.less 2024-06-02 16:13:04 +02:00
Víctor Losada Hernández
c2170dd558 Remove line hiding toolbar in printCurrentBrew function 2024-06-02 16:12:46 +02:00
Víctor Losada Hernández
0c9958f461 "Removed '%' symbol handling from zoom input value" 2024-06-02 16:05:57 +02:00
Víctor Losada Hernández
e2a3959feb "Update brewRenderer.less: changed padding-bottom to padding-block, removed empty lines, and reformatted some styles." 2024-06-02 16:03:54 +02: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
Víctor Losada Hernández
e3c1e4b6f0 "Updated toolbar.less: changed hover selector to also include focus-within" 2024-06-02 15:50:47 +02: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
2d051fcdc0 misstype 2024-06-01 00:42:07 +02:00
Víctor Losada Hernández
95d7ce2876 move toolbar hiding to brewrenderer.less 2024-06-01 00:41:44 +02:00
Víctor Losada Hernández
1a52acd4a9 i fixed it wrong 2024-06-01 00:37:49 +02:00
Víctor Losada Hernández
de8194d7e0 hide toolbar during printing 2024-06-01 00:34:45 +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
ed92628012 udpate input zoom 2024-05-31 21:02:03 +02:00
Víctor Losada Hernández
12de8c5221 fix last page navigation 2024-05-31 21:00:01 +02:00
Víctor Losada Hernández
afa0571382 fix page displacement 2024-05-31 20:57:09 +02:00
Víctor Losada Hernández
75c592b437 "Update onPageChange argument in nextPage button onClick handler" 2024-05-31 20:28:34 +02:00
Víctor Losada Hernández
000c3db8cd fixed page error 2024-05-31 20:14:41 +02:00
Víctor Losada Hernández
f23c0bccbc "Added onKeyPress event handler to zoom input and page number input to blur the target on Enter key press." 2024-05-31 19:46:40 +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
176766dfe7 change in themes.json apparently 2024-05-31 16:25:29 +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
Víctor Losada Hernández
4543881808 functional zoom 2024-05-28 08:51:23 +02:00
Víctor Losada Hernández
609f5a3330 more logs 2024-05-23 14:08:37 +02:00
Víctor Losada Hernández
058d70ed82 auto, not scroll 2024-05-23 13:37:23 +02:00
Víctor Losada Hernández
cbdf06f39d oops 2024-05-23 13:35:00 +02:00
Víctor Losada Hernández
6f6c142aa2 fixes scrolling error 2024-05-23 13:32:09 +02:00
Víctor Losada Hernández
72cb8e7db9 remove console logs and add forced space to brew count 2024-05-23 13:18:07 +02:00
Víctor Losada Hernández
133295c225 big changes to the UI 2024-05-22 20:10:54 +02:00
Víctor Losada Hernández
54efc18ad4 minimum range text to 3 2024-05-22 19:55:20 +02:00
Víctor Losada Hernández
43f77dc525 fix valid check 2024-05-22 19:49:06 +02:00
Víctor Losada Hernández
34d37b24f1 "Update text in 'noBrews' div from 'Whenever you want, just start typing...' to 'No search yet'" 2024-05-22 12:33:11 +02:00
Víctor Losada Hernández
1e6427ca56 non selection , as per request 2024-05-22 12:28:57 +02:00
Víctor Losada Hernández
b9152867b8 "Refactor UpdateURL function" 2024-05-22 12:26:47 +02:00
Víctor Losada Hernández
879a1f5a57 fix page size to count 2024-05-22 08:51:49 +02:00
Víctor Losada Hernández
0f9ba1a5ae Merge branch 'master' of https://github.com/naturalcrit/homebrewery into experimental-development 2024-05-22 08:23:53 +02:00
Víctor Losada Hernández
d96d3c501e logs 2024-05-22 08:22:19 +02:00
Víctor Losada Hernández
215888baf4 "Simplified conditional statement for displaying total brews count" 2024-05-22 08:21:00 +02:00
Víctor Losada Hernández
d56ea62b5e "Refactor loadPage function in ArchivePage component to fix wrong load of data" 2024-05-22 08:17:12 +02:00
Víctor Losada Hernández
888cf55b3d should render an icon while loading total count 2024-05-22 08:13:21 +02:00
Víctor Losada Hernández
4d7b1864d9 This should fix correct load on URL, will probably not work 2024-05-22 08:02:50 +02:00
Víctor Losada Hernández
319746f6cd "Removed options from pageSize select, added new options, and updated CSS selector for searchButton" 2024-05-22 07:58:09 +02:00
Víctor Losada Hernández
8fd165a79b form changes 2024-05-21 23:43:56 +02:00
Víctor Losada Hernández
ecfdada810 fix damn error finally 2024-05-21 12:24:47 +02:00
Víctor Losada Hernández
68c3e1ba84 log at will 2024-05-21 12:16:07 +02:00
Víctor Losada Hernández
efda06ebe5 console log to find the issue 2024-05-21 12:09:41 +02:00
Víctor Losada Hernández
e9b85e1a9a damn totalBrews won't go away 2024-05-21 12:06:08 +02:00
Víctor Losada Hernández
f9d19c75b2 change renderPagination order of operations and fix pagination not loading properly 2024-05-21 11:57:48 +02:00
Víctor Losada Hernández
bc9ab284d8 Initial UI 2024-05-21 08:01:50 +02:00
David Bolack
eb809ca375 Merge branch 'master' into Issue_241 2024-05-20 17:59:34 -05:00
Víctor Losada Hernández
21244fba58 "Removed lodash import, simplified boolean assignments, refactored API request and error handling, and removed unused variables in ArchivePage component." 2024-05-19 23:45:12 +02:00
Víctor Losada Hernández
55dd4efe41 Merge branch 'master' of https://github.com/naturalcrit/homebrewery into experimental-development 2024-05-19 23:21:47 +02:00
David Bolack
40c8b04a98 Merge branch 'master' into Issue_241 2024-05-19 11:48:10 -05:00
David Bolack
c0cc27a750 Change Jump hotkeys to M ( move ) bindings. 2024-05-19 11:12:19 -05:00
Víctor Losada Hernández
6e08fcca80 minor changes 2024-05-18 23:47:29 +02:00
Víctor Losada Hernández
3d0a9ea805 "Update ArchivePage: erase brewcount when new query, modify error messages for 503 and 500 status codes" 2024-05-18 23:19:25 +02:00
Víctor Losada Hernández
a711f8eb89 remove regex search 2024-05-18 23:07:43 +02:00
David Bolack
9b0db15083 Add Jump To hotkeys
This binds CTRL/META-J to brewJump and SHIFT-CTRL/META-J to sourceJump.
2024-05-17 22:10:28 -05:00
Víctor Losada Hernández
97ef56f905 small changes, tips and style 2024-05-14 11:10:48 +02:00
Víctor Losada Hernández
124af97cc8 extra page buttons linked to relevant pages 2024-05-14 10:49:10 +02:00
Víctor Losada Hernández
021ac68400 Update archive page to use pagination with page numbers and ellipses
* Change the way pagination is handled on the archive page
* Display page links for 10 pages max
2024-05-14 10:44:16 +02:00
Víctor Losada Hernández
4b10686336 simplify logic 2024-05-14 09:49:14 +02:00
Víctor Losada Hernández
153812c6e5 simplify console log and remove unused code 2024-05-14 09:36:59 +02:00
Víctor Losada Hernández
9aa3ebe872 Merge branch 'master' of https://github.com/naturalcrit/homebrewery into experimental-development 2024-05-14 09:31:40 +02:00
Víctor Losada Hernández
e23166e1d5 when did i change this? 2024-05-14 09:31:22 +02:00
Víctor Losada Hernández
a89b575b26 archive 2.0 2024-05-13 13:37:53 +02:00
Víctor Losada Hernández
5eeac603db why didn't i think about this sooner 2024-05-09 08:24:27 +02:00
Víctor Losada Hernández
cca0f3b4dc Revert "pagination controls update search terms"
This reverts commit 9966e6322d.
2024-05-08 15:51:31 +02:00
Víctor Losada Hernández
22f4dade4f default value to page size 2024-05-08 15:51:14 +02:00
Víctor Losada Hernández
e30a0c3dce page size log to track issue 2024-05-08 15:41:44 +02:00
Víctor Losada Hernández
9966e6322d pagination controls update search terms 2024-05-08 15:33:27 +02:00
Víctor Losada Hernández
02450982c1 fix brewCollection issue 2024-05-08 13:32:03 +02:00
Víctor Losada Hernández
f9f2e604c0 linting and remove async conflict 2024-05-07 10:14:46 +02:00
Víctor Losada Hernández
40ac8b1909 Merge branch 'master' of https://github.com/naturalcrit/homebrewery into experimental-development 2024-05-07 00:12:26 +02:00
Víctor Losada Hernández
f1a2037bca page is sometimes a string?? 2024-05-06 23:40:31 +02:00
Víctor Losada Hernández
ded78c6639 better error handling in jsx 2024-05-06 23:32:18 +02:00
Víctor Losada Hernández
51fcb59f09 debugging 500 errir catching 2024-05-06 23:26:02 +02:00
Víctor Losada Hernández
e75c556443 use $text instead 2024-05-06 22:59:09 +02:00
Víctor Losada Hernández
752b2caaf4 Merge branch 'master' of https://github.com/naturalcrit/homebrewery into experimental-development 2024-05-06 13:45:06 +02:00
Víctor Losada Hernández
3c84143511 Merge branch 'master' of https://github.com/naturalcrit/homebrewery into experimental-development 2024-04-02 14:40:24 +02:00
Víctor Losada Hernández
dad4cd90ca Merge branch 'master' into addCSSRoute-#1097 2024-02-23 20:23:19 +01:00
Víctor Losada Hernández
094ad3bd59 -proj in countdocs 2024-02-21 08:07:46 +01:00
Víctor Losada Hernández
01e3cd0296 fix notitle search and catch 404? 2024-02-15 17:22:20 +01:00
Víctor Losada Hernández
fd6109099a catch catch catch 2024-02-15 16:59:17 +01:00
Víctor Losada Hernández
8c07b12bb0 catch error codes 2024-02-15 16:56:09 +01:00
Víctor Losada Hernández
eb404b8e5b where is my 503 error code 2024-02-15 16:51:20 +01:00
Víctor Losada Hernández
0fdb5e83cf if this renders null i don't understand anything 2024-02-15 16:44:03 +01:00
Víctor Losada Hernández
2a780bc482 503 2024-02-15 16:36:10 +01:00
Víctor Losada Hernández
f61b664687 503 log 2024-02-15 16:32:50 +01:00
Víctor Losada Hernández
04844a4422 you know the deal 2024-02-15 16:27:50 +01:00
Víctor Losada Hernández
3afc9f83d9 where the hell did i lose the error handling 2024-02-15 16:23:37 +01:00
Víctor Losada Hernández
e08435568c don't search on reload without title 2024-02-15 16:20:08 +01:00
Víctor Losada Hernández
1a80a74d4f more error handling 2024-02-15 16:15:38 +01:00
Víctor Losada Hernández
9c53541cbd searching animation 2024-02-15 15:53:26 +01:00
Víctor Losada Hernández
62db393969 proper error handling(i think) 2024-02-15 15:50:27 +01:00
Víctor Losada Hernández
d7c9ab43bc more tests 2024-02-15 15:34:10 +01:00
Víctor Losada Hernández
fcb4c722c6 test 404 error 2024-02-15 15:28:36 +01:00
Víctor Losada Hernández
7626f63beb page numberas as links 2024-02-15 15:16:01 +01:00
Víctor Losada Hernández
a6e45c7fd1 Merge branch 'master' into experimental-development 2024-02-15 13:49:43 +01:00
Víctor Losada Hernández
2658831e83 pagination controls don't reset search 2024-02-15 13:45:31 +01:00
Víctor Losada Hernández
ffdbe46a23 catch 503 without title query 2024-02-15 10:43:12 +01:00
Víctor Losada Hernández
6a11cd0e28 renderer filter query 2024-02-15 10:34:39 +01:00
Víctor Losada Hernández
153ab63393 pagesize as input 2024-02-15 08:48:47 +01:00
Víctor Losada Hernández
ea1855485c css fixes 2024-02-15 01:27:05 +01:00
Víctor Losada Hernández
3427fa1e94 total brews found 2024-02-15 01:26:54 +01:00
Víctor Losada Hernández
46262c56db 503 catch 2 2024-02-15 01:15:00 +01:00
Víctor Losada Hernández
3482d92ab6 catch 503 error 2024-02-15 01:10:28 +01:00
Víctor Losada Hernández
74ac8f9ffa quickfix 2024-02-13 10:52:12 +01:00
Víctor Losada Hernández
7e289950fa Merge branch 'experimental-development' of https://github.com/5e-Cleric/homebrewery into experimental-development 2024-02-13 10:48:24 +01:00
Víctor Losada Hernández
9fc8af6553 pagination controls render separately 2024-02-13 10:48:19 +01:00
G.Ambatte
7ffc02c3e5 Reset searching state on error 2024-02-13 13:25:45 +13:00
Víctor Losada Hernández
2f323cde8a remove unused logic from loadpage 2024-02-12 23:54:15 +01:00
Víctor Losada Hernández
534131d994 edit console logs and change totalDocs logic to count correctly 2024-02-12 23:54:00 +01:00
Víctor Losada Hernández
d233e2b4a5 css fix, pagination controls basic look 2024-02-12 23:18:37 +01:00
Víctor Losada Hernández
05a7defcb8 remove brewCount useless element 2024-02-12 23:18:24 +01:00
G.Ambatte
eeec24ae78 Change fetch to use request-middleware instead 2024-02-13 09:14:31 +13:00
G.Ambatte
1d778e3249 Update API route 2024-02-13 09:13:47 +13:00
G.Ambatte
3bb44d8a17 Lint clean up 2024-02-13 09:06:33 +13:00
Víctor Losada Hernández
71c52b4587 fix html response 2024-02-12 08:44:18 +01:00
Víctor Losada Hernández
fe449abb47 trying to figure out pagination 2024-02-10 16:41:39 +01:00
Víctor Losada Hernández
46d1f89b77 minor fixes 2024-01-29 00:12:14 +01:00
Víctor Losada Hernández
bf1f2054de minor fixes 2024-01-28 16:14:54 +01:00
Víctor Losada Hernández
399caaaeff typo 2024-01-28 16:11:32 +01:00
Víctor Losada Hernández
27b4176e23 initial screen 2024-01-28 16:08:44 +01:00
Víctor Losada Hernández
a8bc6b4e1d h2 to h3 2024-01-28 16:04:21 +01:00
Víctor Losada Hernández
3ca8f72762 brewCount 2024-01-28 16:02:19 +01:00
Víctor Losada Hernández
8aec5dbba6 error 500 catch and show 2024-01-28 15:57:51 +01:00
Víctor Losada Hernández
cccebd8494 title and no brews UI 2024-01-28 11:18:37 +01:00
Víctor Losada Hernández
5fbbd92ea7 limit to 1000 2024-01-28 01:12:46 +01:00
Víctor Losada Hernández
81f26e0892 exclude last fix 2024-01-28 00:55:22 +01:00
Víctor Losada Hernández
9366284e1d quick fix 2024-01-28 00:26:35 +01:00
Víctor Losada Hernández
9aa5eea8c9 exclude fields and add a time limit 2024-01-27 23:31:56 +01:00
Víctor Losada Hernández
20f61bff07 limit to 2000 2024-01-27 21:46:28 +01:00
Víctor Losada Hernández
625819da91 Merge branch 'master' of https://github.com/naturalcrit/homebrewery into experimental-development 2024-01-27 19:14:48 +01:00
Víctor Losada Hernández
2c691d84f2 author fix 3 2024-01-27 19:14:38 +01:00
Víctor Losada Hernández
4630d2640b author another fix 2024-01-27 17:29:16 +01:00
Víctor Losada Hernández
043f24d5ca invited authors is not a thing 2024-01-27 16:56:38 +01:00
Víctor Losada Hernández
87e18c0521 no authors fix 2024-01-27 16:56:28 +01:00
Víctor Losada Hernández
7e30f860b2 typo fix 2024-01-27 16:26:06 +01:00
Víctor Losada Hernández
0ac0ffe53d limit to 3000 2024-01-27 16:25:06 +01:00
Víctor Losada Hernández
ae4e1b55e6 minor changes 2024-01-27 16:24:45 +01:00
Víctor Losada Hernández
756ced088c Merge branch 'experimental-development' of https://github.com/5e-Cleric/homebrewery into experimental-development 2024-01-27 14:31:34 +01:00
Víctor Losada Hernández
8ce6b22be7 reject modernity, embrace tradition 2024-01-27 14:31:32 +01:00
Trevor Buckner
6184d64f89 Merge branch 'master' into pr/3263 2024-01-25 16:43:21 -05:00
Víctor Losada Hernández
c00c2626b4 Merge branch 'master' into experimental-development 2024-01-24 22:56:30 +01:00
Víctor Losada Hernández
89fddd0210 limit search and adapt ui 2024-01-24 21:15:26 +01:00
Víctor Losada Hernández
0c167d803c limit the search 2024-01-24 21:15:00 +01:00
Víctor Losada Hernández
c50042c1e7 i love grid template area 2024-01-23 22:55:36 +01:00
Víctor Losada Hernández
0dc1b46466 stying updates, agnostic theme 2024-01-23 19:08:57 +01:00
Víctor Losada Hernández
4ed9fc7d0e fix url params 2024-01-23 18:35:09 +01:00
Víctor Losada Hernández
162929bdca trying to catch url with query 2024-01-23 14:02:27 +01:00
Víctor Losada Hernández
54a2f6940c from admin to archive api 2024-01-23 10:40:53 +01:00
Víctor Losada Hernández
0dff59d793 linting and space issues 2024-01-23 08:07:51 +01:00
Víctor Losada Hernández
7951c4a03a basic ui and small changes 2024-01-23 00:20:18 +01:00
Víctor Losada Hernández
66fd56fccb basic functionality 2024-01-22 23:52:42 +01:00
Víctor Losada Hernández
da699e999f basic looks 2024-01-22 23:20:36 +01:00
Víctor Losada Hernández
c6a5f50c76 admin page fix 2024-01-22 17:22:54 +01:00
Víctor Losada Hernández
74c7395ab9 admin look by title 2024-01-22 16:59:45 +01:00
G.Ambatte
0a309ad0e1 Remove debugging console.log 2023-10-01 21:46:52 +13:00
G.Ambatte
52b0ae0400 Basic functionality pass 2023-10-01 21:35:50 +13:00
46 changed files with 2433 additions and 773 deletions

View File

@@ -67,6 +67,9 @@ jobs:
- run:
name: Test - Definition Lists
command: npm run test:definition-lists
- run:
name: Test - Hard Breaks
command: npm run test:hard-breaks
- run:
name: Test - Variables
command: npm run test:variables

View File

@@ -1,79 +0,0 @@
module.exports = {
root : true,
parserOptions : {
ecmaVersion : 2021,
sourceType : 'module',
ecmaFeatures : {
jsx : true
}
},
env : {
browser : true,
node : true
},
plugins : ['react', 'jest'],
rules : {
/** Errors **/
'camelcase' : ['error', { properties: 'never' }],
//'func-style' : ['error', 'expression', { allowArrowFunctions: true }],
'no-array-constructor' : 'error',
'no-iterator' : 'error',
'no-nested-ternary' : 'error',
'no-new-object' : 'error',
'no-proto' : 'error',
'react/jsx-no-bind' : ['error', { allowArrowFunctions: true }],
'react/jsx-uses-react' : 'error',
'react/prefer-es6-class' : ['error', 'never'],
'jest/valid-expect' : ['error', { maxArgs: 3 }],
/** Warnings **/
'max-lines' : ['warn', {
max : 200,
skipComments : true,
skipBlankLines : true,
}],
'max-depth' : ['warn', { max: 4 }],
'max-params' : ['warn', { max: 5 }],
'no-restricted-syntax' : ['warn', 'ClassDeclaration', 'SwitchStatement'],
'no-unused-vars' : ['warn', {
vars : 'all',
args : 'none',
varsIgnorePattern : 'config|_|cx|createClass'
}],
'react/jsx-uses-vars' : 'warn',
/** Fixable **/
'arrow-parens' : ['warn', 'always'],
'brace-style' : ['warn', '1tbs', { allowSingleLine: true }],
'jsx-quotes' : ['warn', 'prefer-single'],
'no-var' : 'warn',
'prefer-const' : 'warn',
'prefer-template' : 'warn',
'quotes' : ['warn', 'single', { 'allowTemplateLiterals': true }],
'semi' : ['warn', 'always'],
/** Whitespace **/
'array-bracket-spacing' : ['warn', 'never'],
'arrow-spacing' : ['warn', { before: false, after: false }],
'comma-spacing' : ['warn', { before: false, after: true }],
'indent' : ['warn', 'tab', { 'MemberExpression': 'off' }],
'keyword-spacing' : ['warn', {
before : true,
after : true,
overrides : {
if : { 'before': false, 'after': false }
}
}],
'key-spacing' : ['warn', {
multiLine : { beforeColon: true, afterColon: true, align: 'colon' },
singleLine : { beforeColon: false, afterColon: true }
}],
'linebreak-style' : 'off',
'no-trailing-spaces' : 'warn',
'no-whitespace-before-property' : 'warn',
'object-curly-spacing' : ['warn', 'always'],
'react/jsx-indent-props' : ['warn', 'tab'],
'space-in-parens' : ['warn', 'never'],
'template-curly-spacing' : ['warn', 'never'],
}
};

4
.gitattributes vendored
View File

@@ -1 +1,3 @@
package-lock.json binary
package-lock.json binary
*.json text eol=lf

View File

@@ -84,9 +84,105 @@ pre {
## changelog
For a full record of development, visit our [Github Page](https://github.com/naturalcrit/homebrewery).
### Tuesday 8/13/2024 - v3.14.1
{{taskList
### Wednesday 9/04/2024 - v3.15.0
{{taskList
##### 5e-Cleric, abquintic, calculuschild, Gazook89, G-Ambatte, Ericsheid, Kaiburr
* [x] New {{openSans **VAULT** {{fas,fa-dungeon}}}} page 🎉🎉🎉
:
All **PUBLISHED** brews ({{openSans :fas_circle_info: **Properties**}} menu) will be searchable, by title or author, and filtered by renderer. More features and adjustments will be coming.
:
Note: If any of your own brews are not showing up in search (particularly if stored on Google Drive), please edit and re-save to ensure our database has the data needed from document to be searchable.
Fixes issue [#697](https://github.com/naturalcrit/homebrewery/issues/697)
##### Gazook89
* [x] Auto-focus on text editor when switching editor tabs
}}
### Wednesday 8/28/2024 - v3.14.3
{{taskList
##### calculuschild, G-Ambatte
* [x] New {{openSans **IMAGES → {{fac,image-wrap-left}} IMAGE WRAP LEFT/RIGHT**}} snippets
Fixes issue [#380](https://github.com/naturalcrit/homebrewery/issues/380)
* [x] Fix v3.14.2 bug with `` failing after tables
##### 5e-Cleric
* [x] Fix Account page crash when not logged in
Fixes issue [#3605](https://github.com/naturalcrit/homebrewery/issues/3605)
##### abquintic
* [x] Fix jump hotkeys conflicting with `CTRL + SHIFT`. Preview and Source movement shortcuts now use `CTRL + SHIFT + META + LEFT\RIGHTARROW`
##### G-Ambatte
* [x] Fix display issue with image wrap icons
}}
### Tuesday 8/27/2024 - v3.14.2
{{taskList
##### calculuschild
* [x] Reroute invalid urls to homepage
Fixes issues [#3269](https://github.com/naturalcrit/homebrewery/issues/3629)
* [x] Background dependency updates
##### G-Ambatte
* [x] Add route to get brew styling via `/css/shareId`
Fixes issues [#1097](https://github.com/naturalcrit/homebrewery/issues/1097)
* [x] Fix `:emojis:` preventing code folding
Fixes issues [#3604](https://github.com/naturalcrit/homebrewery/issues/3604)
* [x] Fix mask image warping when rotated and stretched
Fixes issues [#3636](https://github.com/naturalcrit/homebrewery/issues/3636)
* [x] Fix Table of Contents uppercasing
Fixes issues [#3572](https://github.com/naturalcrit/homebrewery/issues/3572)
##### abquintic
* [x] Create globally unique Header IDs across pages
Fixes issues [#1430](https://github.com/naturalcrit/homebrewery/issues/1430)
* [x] Fix colon `` being parsed in codeblocks
* [x] Prevent crashes when loading undefined renderer or theme bundle
* [x] Add Jump-To hotkeys
* Use `CTRL/META + SHIFT + LEFTARROW` to brewJump
* Use `CTRL/META + SHIFT + RIGHTARROW` to sourceJump
* [x] Prevent reload from clobbering modified fresh clones
##### 5e-Cleric, Gazook89
* [x] Viewer tools for zoom/page navigation
}}
### Tuesday 8/13/2024 - v3.14.1
{{taskList
##### abquintic
* [x] Allow Table of Contents to flow across columns
@@ -129,16 +225,13 @@ Fixes issues [#3613](https://github.com/naturalcrit/homebrewery/issues/3613)
Fixes issues [#3622](https://github.com/naturalcrit/homebrewery/issues/3622)
##### calculuschild
* [x] Fix `/migrate` page using an editor context instead of share context
##### 5e-Cleric
* [x] Fix Monster Stat Blocks losing color in Safari
}}
\page
@@ -509,7 +602,7 @@ Fixes issue [#2729](https://github.com/naturalcrit/homebrewery/issues/2729),
### Thursday 17/08/2023 - v3.9.2
{{taskList
##### Calculuschild
##### calculuschild
* [x] Fix links to certain old Google Drive files
@@ -567,7 +660,7 @@ Fixes issue [#1924](https://github.com/naturalcrit/homebrewery/issues/1924)
### Friday 02/06/2023 - v3.9.0
{{taskList
##### Calculuschild
##### calculuschild
* [x] Fix some files not showing up on userpage when user has a large number of brews in Google Drive
@@ -664,7 +757,7 @@ Fixes issues [#2731](https://github.com/naturalcrit/homebrewery/issues/2731)
### Monday 13/03/2023 - v3.7.2
{{taskList
##### Calculuschild
##### calculuschild
* [x] Fix wide Monster Stat Blocks not spanning columns on Legacy
}}
@@ -687,7 +780,7 @@ Fixes issues [#1569](https://github.com/naturalcrit/homebrewery/issues/1569)
* [x] Updated the Google Drive icon
* [x] Backend fix to unit tests failing intermittently
##### Calculuschild
##### calculuschild
* [x] Fix PDF pixelation on CoverPage text outlines
}}
@@ -699,7 +792,7 @@ Fixes issues [#1569](https://github.com/naturalcrit/homebrewery/issues/1569)
**NOTE:** Some new snippets will now show a {{beta BETA}} tag. Feel free to use them, but be aware we may change how they work depending on your feedback.
}}
##### Calculuschild
##### calculuschild
* [x] New {{openSans **IMAGES → WATERCOLOR EDGE** {{fac,mask-edge}} }} and {{openSans **WATERCOLOR CORNER** {{fac,mask-corner}} }} snippets for V3, which adds a stylish watercolor texture to the edge of your images! (Thanks to /u/flamableconcrete on Reddit for providing these image masks!)
@@ -843,7 +936,7 @@ Fixes issues [#1670](https://github.com/naturalcrit/homebrewery/issues/1670)
### Thursday 28/10/2022 - v3.3.1
{{taskList
##### Calculuschild
##### calculuschild
* [x] Fixes to several broken CSS styles from v3.3.0
@@ -858,7 +951,7 @@ Fixes issues [#2468](https://github.com/naturalcrit/homebrewery/issues/2468)
### Friday 19/10/2022 - v3.3.0
{{taskList
##### Calculuschild
##### calculuschild
* [x] Fix for tables broken by Chrome v106
@@ -941,7 +1034,7 @@ Fixes issues [#2317](https://github.com/naturalcrit/homebrewery/issues/2317), [
### Wednesday 31/08/2022 - v3.2.1
{{taskList
##### Calculuschild
##### calculuschild
* [x] Reference Links should now work inside tables
@@ -967,7 +1060,7 @@ Fixes issues [#2317](https://github.com/naturalcrit/homebrewery/issues/2317), [
### Saturday 27/08/2022 - v3.2.0
{{taskList
##### Calculuschild
##### calculuschild
* [x] The V3 renderer is now the default for new brews.
@@ -994,7 +1087,7 @@ Fixes issues [#2317](https://github.com/naturalcrit/homebrewery/issues/2317), [
### Thursday 09/06/2022 - v3.1.1
{{taskList
##### Calculuschild:
##### calculuschild:
* [x] Fixed class table decorations appearing on top of the table in PDF output.
@@ -1838,4 +1931,4 @@ Massive changelog incoming:
* Added `phb.standalone.css` plus a build system for creating it
* Added page numbers and footer text
* Page accent now flips each page
* Page accent now flips each page

View File

@@ -7,6 +7,7 @@ const _ = require('lodash');
const MarkdownLegacy = require('naturalcrit/markdownLegacy.js');
const Markdown = require('naturalcrit/markdown.js');
const ErrorBar = require('./errorBar/errorBar.jsx');
const ToolBar = require('./toolBar/toolBar.jsx');
//TODO: move to the brew renderer
const RenderWarnings = require('homebrewery/renderWarnings/renderWarnings.jsx');
@@ -60,10 +61,11 @@ const BrewRenderer = (props)=>{
};
const [state, setState] = useState({
viewablePageNumber : 0,
height : PAGE_HEIGHT,
isMounted : false,
visibility : 'hidden',
height : PAGE_HEIGHT,
isMounted : false,
visibility : 'hidden',
zoom : 100,
currentPageNumber : 1,
});
const mainRef = useRef(null);
@@ -85,11 +87,14 @@ const BrewRenderer = (props)=>{
}));
};
const handleScroll = (e)=>{
const target = e.target;
const getCurrentPage = (e)=>{
const { scrollTop, clientHeight, scrollHeight } = e.target;
const totalScrollableHeight = scrollHeight - clientHeight;
const currentPageNumber = Math.ceil((scrollTop / totalScrollableHeight) * rawPages.length);
setState((prevState)=>({
...prevState,
viewablePageNumber : Math.floor(target.scrollTop / target.scrollHeight * rawPages.length)
currentPageNumber : currentPageNumber || 1
}));
};
@@ -100,23 +105,12 @@ const BrewRenderer = (props)=>{
if(index == props.currentEditorPage) //Already rendered before this step
return false;
if(Math.abs(index - state.viewablePageNumber) <= 3)
if(Math.abs(index - state.currentPageNumber) <= 3)
return true;
return false;
};
const renderPageInfo = ()=>{
return <div className='pageInfo' ref={mainRef}>
<div>
{props.renderer}
</div>
<div>
{state.viewablePageNumber + 1} / {rawPages.length}
</div>
</div>;
};
const renderDummyPage = (index)=>{
return <div className='phb page' id={`p${index + 1}`} key={index}>
<i className='fas fa-spinner fa-spin' />
@@ -186,11 +180,19 @@ const BrewRenderer = (props)=>{
document.dispatchEvent(new MouseEvent('click'));
};
//Toolbar settings:
const handleZoom = (newZoom)=>{
setState((prevState)=>({
...prevState,
zoom : newZoom
}));
};
return (
<>
{/*render dummy page while iFrame is mounting.*/}
{!state.isMounted
? <div className='brewRenderer' onScroll={handleScroll}>
? <div className='brewRenderer' onScroll={getCurrentPage}>
<div className='pages'>
{renderDummyPage(1)}
</div>
@@ -198,11 +200,13 @@ const BrewRenderer = (props)=>{
: null}
<ErrorBar errors={props.errors} />
<div className='popups'>
<div className='popups' ref={mainRef}>
<RenderWarnings />
<NotificationPopup />
</div>
<ToolBar onZoomChange={handleZoom} currentPage={state.currentPageNumber} totalPages={rawPages.length}/>
{/*render in iFrame so broken code doesn't crash the site.*/}
<Frame id='BrewRenderer' initialContent={INITIAL_CONTENT}
style={{ width: '100%', height: '100%', visibility: state.visibility }}
@@ -210,23 +214,23 @@ const BrewRenderer = (props)=>{
onClick={()=>{emitClick();}}
>
<div className={'brewRenderer'}
onScroll={handleScroll}
onScroll={getCurrentPage}
onKeyDown={handleControlKeys}
tabIndex={-1}
style={{ height: state.height }}>
{/* Apply CSS from Style tab and render pages from Markdown tab */}
{state.isMounted
&&
<>
{renderStyle()}
<div className='pages' lang={`${props.lang || 'en'}`}>
<div className='pages' lang={`${props.lang || 'en'}`} style={{ zoom: `${state.zoom}%` }}>
{renderPages()}
</div>
</>
}
</div>
</Frame>
{renderPageInfo()}
</>
);
};

View File

@@ -1,8 +1,9 @@
@import (multiple, less) 'shared/naturalcrit/styles/reset.less';
.brewRenderer {
will-change : transform;
overflow-y : scroll;
overflow-y : scroll;
will-change : transform;
padding-top : 30px;
:where(.pages) {
margin : 30px 0px;
& > :where(.page) {
@@ -14,66 +15,31 @@
box-shadow : 1px 4px 14px #000000;
}
}
&::-webkit-scrollbar {
width: 20px;
&:horizontal{
height: 20px;
width:auto;
width : 20px;
&:horizontal {
width : auto;
height : 20px;
}
&-thumb {
background: linear-gradient(90deg, #d3c1af 15px, #00000000 15px);
&:horizontal{
background: linear-gradient(0deg, #d3c1af 15px, #00000000 15px);
}
}
&-corner {
visibility: hidden;
background : linear-gradient(90deg, #D3C1AF 15px, #00000000 15px);
&:horizontal { background : linear-gradient(0deg, #D3C1AF 15px, #00000000 15px); }
}
&-corner { visibility : hidden; }
}
}
.pane { position : relative; }
.pageInfo {
position : absolute;
right : 17px;
bottom : 0;
z-index : 1000;
font-size : 10px;
font-weight : 800;
color : white;
background-color : #333333;
div {
display : inline-block;
padding : 8px 10px;
&:not(:last-child) { border-right : 1px solid #666666; }
}
}
.ppr_msg {
position : absolute;
bottom : 0;
left : 0px;
z-index : 1000;
padding : 8px 10px;
font-size : 10px;
font-weight : 800;
color : white;
background-color : #333333;
}
@media print {
.toolBar { display : none; }
.brewRenderer {
height: 100%;
overflow-y: unset;
height : 100%;
padding-top : unset;
overflow-y : unset;
.pages {
margin: 0px;
&>.page {
box-shadow: unset;
}
margin : 0px;
& > .page { box-shadow : unset; }
}
}
}

View File

@@ -4,7 +4,7 @@ const _ = require('lodash');
import Dialog from '../../../components/dialog.jsx';
const DISMISS_KEY = 'dismiss_notification12-04-23';
const DISMISS_KEY = 'dismiss_notification01-10-24';
const DISMISS_BUTTON = <i className='fas fa-times dismiss' />;
const NotificationPopup = ()=>{
@@ -15,11 +15,40 @@ const NotificationPopup = ()=>{
<small>This website is always improving and we are still adding new features and squashing bugs. Keep the following in mind:</small>
</div>
<ul>
<li key='psa'>
<em>Don't store IMAGES in Google Drive</em><br />
Google Drive is not an image service, and will block images from being used
in brews if they get more views than expected. Google has confirmed they won't fix
this, so we recommend you look for another image hosting service such as imgur, ImgBB or Google Photos.
<li key='ThrottlingError' style={{
backgroundColor: '#910000',
margin: '-10px -10px -10px -20px',
padding: '10px 10px 10px 20px',
fontSize: '1.0em'
}}>
<em>Known issue with saving/creating Google Drive files</em><br />
Dear users. The <a href="https://github.com/naturalcrit/homebrewery/issues/3770">
issue with saving to Google Drive</a> has resurfaced as of Oct 1, 2024 22:00 UTC.
<br></br><br></br>
Earlier we submitted a bug report to Google and have all but confirmed the issue
lies on Google's end and the disruption has been affecting multiple other
organizations besides us. Unfortunately, it means reliable interaction with
Google remains out of our control until they can resolve their issue.
<br></br><br></br>
Brews saved to Google Drive are <em>not lost</em> and can still be viewed, just not updated.
You can also access them via your Google Drive interface in the <code>/Hombrewery</code> folder.
<br></br><br></br>
If you need to urgently edit documents, you can detatch them from your Google Drive
by transferring them to our Homebrewery storage. To do this, click the colored Google Drive
icon next to the save button when on an edit page; you can transfer them back later,
but this should allow you to edit while this issue is ongoing.
<br></br><br></br>
If you are experiencing errors creating new documents, you can similarly change your
account settings to create new brews by default in the Homebrewery storage. Click
your username and then "account", then change the "default save location".
</li>
<li key='Vault'>
<em>Search brews with our new page!</em><br />
We have been working very hard in making this possible, now you can share your work and look at it in the new <a href="/vault">Vault</a> page!
All PUBLISHED brews will be available to anyone searching there, by title or author, and filtering by renderer.
More features will be coming.
</li>
<li key='googleDriveFolder'>

View File

@@ -1,9 +1,10 @@
.popups {
position : fixed;
top : @navbarHeight;
top : calc(@navbarHeight + @viewerToolsHeight);
right : 24px;
z-index : 10001;
width : 450px;
margin-top : 5px;
}
.notificationPopup {

View File

@@ -0,0 +1,162 @@
require('./toolBar.less');
const React = require('react');
const { useState, useEffect } = React;
const _ = require('lodash');
const MAX_ZOOM = 300;
const MIN_ZOOM = 10;
const ToolBar = ({ onZoomChange, currentPage, onPageChange, totalPages })=>{
const [zoomLevel, setZoomLevel] = useState(100);
const [pageNum, setPageNum] = useState(currentPage);
useEffect(()=>{
onZoomChange(zoomLevel);
}, [zoomLevel]);
useEffect(()=>{
setPageNum(currentPage);
}, [currentPage]);
const handleZoomButton = (zoom)=>{
setZoomLevel(_.round(_.clamp(zoom, MIN_ZOOM, MAX_ZOOM)));
};
const handlePageInput = (pageInput)=>{
if(/[0-9]/.test(pageInput))
setPageNum(parseInt(pageInput)); // input type is 'text', so `page` comes in as a string, not number.
};
const scrollToPage = (pageNumber)=>{
pageNumber = _.clamp(pageNumber, 1, totalPages);
const iframe = document.getElementById('BrewRenderer');
const brewRenderer = iframe?.contentWindow?.document.querySelector('.brewRenderer');
const page = brewRenderer?.querySelector(`#p${pageNumber}`);
page?.scrollIntoView({ block: 'start' });
setPageNum(pageNumber);
};
const calculateChange = (mode)=>{
const iframe = document.getElementById('BrewRenderer');
const iframeWidth = iframe.getBoundingClientRect().width;
const iframeHeight = iframe.getBoundingClientRect().height;
const pages = iframe.contentWindow.document.getElementsByClassName('page');
let desiredZoom = 0;
if(mode == 'fill'){
// find widest page, in case pages are different widths, so that the zoom is adapted to not cut the widest page off screen.
const widestPage = _.maxBy([...pages], 'offsetWidth').offsetWidth;
desiredZoom = (iframeWidth / widestPage) * 100;
} else if(mode == 'fit'){
// find the page with the largest single dim (height or width) so that zoom can be adapted to fit it.
const minDimRatio = [...pages].reduce((minRatio, page) => Math.min(minRatio, iframeWidth / page.offsetWidth, iframeHeight / page.offsetHeight), Infinity);
desiredZoom = minDimRatio * 100;
}
const margin = 5; // extra space so page isn't edge to edge (not truly "to fill")
const deltaZoom = (desiredZoom - zoomLevel) - margin;
return deltaZoom;
};
return (
<div className='toolBar'>
{/*v=====----------------------< Zoom Controls >---------------------=====v*/}
<div className='group'>
<button
id='fill-width'
className='tool'
onClick={()=>handleZoomButton(zoomLevel + calculateChange('fill'))}
>
<i className='fac fit-width' />
</button>
<button
id='zoom-to-fit'
className='tool'
onClick={()=>handleZoomButton(zoomLevel + calculateChange('fit'))}
>
<i className='fac zoom-to-fit' />
</button>
<button
id='zoom-out'
className='tool'
onClick={()=>handleZoomButton(zoomLevel - 20)}
disabled={zoomLevel <= MIN_ZOOM}
>
<i className='fas fa-magnifying-glass-minus' />
</button>
<input
id='zoom-slider'
className='range-input tool'
type='range'
name='zoom'
list='zoomLevels'
min={MIN_ZOOM}
max={MAX_ZOOM}
step='1'
value={zoomLevel}
onChange={(e)=>handleZoomButton(parseInt(e.target.value))}
/>
<datalist id='zoomLevels'>
<option value='100' />
</datalist>
<button
id='zoom-in'
className='tool'
onClick={()=>handleZoomButton(zoomLevel + 20)}
disabled={zoomLevel >= MAX_ZOOM}
>
<i className='fas fa-magnifying-glass-plus' />
</button>
</div>
{/*v=====----------------------< Page Controls >---------------------=====v*/}
<div className='group'>
<button
id='previous-page'
className='previousPage tool'
onClick={()=>scrollToPage(pageNum - 1)}
disabled={pageNum <= 1}
>
<i className='fas fa-arrow-left'></i>
</button>
<div className='tool'>
<input
id='page-input'
className='text-input'
type='text'
name='page'
inputMode='numeric'
pattern='[0-9]'
value={pageNum}
onClick={(e)=>e.target.select()}
onChange={(e)=>handlePageInput(e.target.value)}
onBlur={()=>scrollToPage(pageNum)}
onKeyDown={(e)=>e.key == 'Enter' && scrollToPage(pageNum)}
/>
<span id='page-count'>/ {totalPages}</span>
</div>
<button
id='next-page'
className='tool'
onClick={()=>scrollToPage(pageNum + 1)}
disabled={pageNum >= totalPages}
>
<i className='fas fa-arrow-right'></i>
</button>
</div>
</div>
);
};
module.exports = ToolBar;

View File

@@ -0,0 +1,103 @@
@import (less) './client/icons/customIcons.less';
.toolBar {
position : absolute;
z-index : 1;
box-sizing : border-box;
display : flex;
flex-wrap : wrap;
gap : 8px 30px;
align-items : center;
justify-content : center;
width : 100%;
height : auto;
padding : 2px 0;
font-family : 'Open Sans', sans-serif;
color : #CCCCCC;
background-color : #555555;
.group {
box-sizing : border-box;
display : flex;
gap : 0 3px;
align-items : center;
justify-content : center;
height : 28px;
}
.tool {
display : flex;
align-items : center;
}
input {
position : relative;
height : 1.5em;
padding : 2px 5px;
font-family : 'Open Sans', sans-serif;
color : #000000;
background : #EEEEEE;
border : 1px solid gray;
&:focus { outline : 1px solid #D3D3D3; }
// `.range-input` if generic to all range inputs, or `#zoom-slider` if only for zoom slider
&.range-input {
padding : 2px 0;
color : #D3D3D3;
accent-color : #D3D3D3;
&::-webkit-slider-thumb, &::-moz-slider-thumb {
width : 5px;
height : 5px;
cursor : pointer;
outline : none;
}
&:hover::after {
position : absolute;
bottom : -30px;
left : 50%;
z-index : 1;
display : grid;
place-items : center;
width : 4ch;
height : 1.2lh;
pointer-events : none;
content : attr(value);
background-color : #555555;
border : 1px solid #A1A1A1;
transform : translate(-50%, 50%);
}
}
// `.text-input` if generic to all range inputs, or `#page-input` if only for current page input
&#page-input {
width : 4ch;
margin-right : 1ch;
text-align : center;
}
}
button {
box-sizing : content-box;
display : flex;
align-items : center;
justify-content : center;
width : auto;
min-width : 46px;
height : 100%;
padding : 0 0px;
font-weight : unset;
color : inherit;
background-color : unset;
&:hover { background-color : #444444; }
&:focus { outline : 1px solid #D3D3D3; }
&:disabled {
color : #777777;
background-color : unset !important;
}
i {
font-size:1.2em;
}
}
}

View File

@@ -59,6 +59,8 @@ const Editor = createClass({
this.updateEditorSize();
this.highlightCustomMarkdown();
window.addEventListener('resize', this.updateEditorSize);
document.getElementById('BrewRenderer').addEventListener('keydown', this.handleControlKeys);
document.addEventListener('keydown', this.handleControlKeys);
const editorTheme = window.localStorage.getItem(EDITOR_THEME_KEY);
if(editorTheme) {
@@ -82,6 +84,19 @@ const Editor = createClass({
};
},
handleControlKeys : function(e){
if(!(e.ctrlKey && e.metaKey)) return;
const LEFTARROW_KEY = 37;
const RIGHTARROW_KEY = 39;
if (e.shiftKey && (e.keyCode == RIGHTARROW_KEY)) this.brewJump();
if (e.shiftKey && (e.keyCode == LEFTARROW_KEY)) this.sourceJump();
if ((e.keyCode == LEFTARROW_KEY) || (e.keyCode == RIGHTARROW_KEY)) {
e.stopPropagation();
e.preventDefault();
}
},
updateEditorSize : function() {
if(this.codeEditor.current) {
let paneHeight = this.editor.current.parentNode.clientHeight;
@@ -98,7 +113,10 @@ const Editor = createClass({
this.props.setMoveArrows(newView === 'text');
this.setState({
view : newView
}, this.updateEditorSize); //TODO: not sure if updateeditorsize needed
}, ()=>{
this.codeEditor.current?.codeMirror.focus();
this.updateEditorSize();
}); //TODO: not sure if updateeditorsize needed
},
getCurrentPage : function(){
@@ -119,8 +137,19 @@ const Editor = createClass({
const codeMirror = this.codeEditor.current.codeMirror;
codeMirror.operation(()=>{ // Batch CodeMirror styling
const foldLines = [];
//reset custom text styles
const customHighlights = codeMirror.getAllMarks().filter((mark)=>!mark.__isFold); //Don't undo code folding
const customHighlights = codeMirror.getAllMarks().filter((mark)=>{
// Record details of folded sections
if(mark.__isFold) {
const fold = mark.find();
foldLines.push({from: fold.from?.line, to: fold.to?.line});
}
return !mark.__isFold;
}); //Don't undo code folding
for (let i=customHighlights.length - 1;i>=0;i--) customHighlights[i].clear();
let editorPageCount = 2; // start page count from page 2
@@ -132,6 +161,11 @@ const Editor = createClass({
codeMirror.removeLineClass(lineNumber, 'text');
codeMirror.removeLineClass(lineNumber, 'wrap', 'sourceMoveFlash');
// Don't process lines inside folded text
// If the current lineNumber is inside any folded marks, skip line styling
if (foldLines.some(fold => lineNumber >= fold.from && lineNumber <= fold.to))
return;
// Styling for \page breaks
if((this.props.renderer == 'legacy' && line.includes('\\page')) ||
(this.props.renderer == 'V3' && line.match(/^\\page$/))) {
@@ -244,7 +278,7 @@ const Editor = createClass({
// Iterate over conflicting marks and clear them
var marks = codeMirror.findMarks(startPos, endPos);
marks.forEach(function(marker) {
marker.clear();
if(!marker.__isFold) marker.clear();
});
codeMirror.markText(startPos, endPos, { className: 'emoji' });
}

View File

@@ -10,6 +10,7 @@ const UserPage = require('./pages/userPage/userPage.jsx');
const SharePage = require('./pages/sharePage/sharePage.jsx');
const NewPage = require('./pages/newPage/newPage.jsx');
const ErrorPage = require('./pages/errorPage/errorPage.jsx');
const VaultPage = require('./pages/vaultPage/vaultPage.jsx');
const AccountPage = require('./pages/accountPage/accountPage.jsx');
const WithRoute = (props)=>{
@@ -71,6 +72,7 @@ const Homebrew = createClass({
<Route path='/new/:id' element={<WithRoute el={NewPage} brew={this.props.brew} userThemes={this.props.userThemes}/>} />
<Route path='/new' element={<WithRoute el={NewPage} userThemes={this.props.userThemes}/> } />
<Route path='/user/:username' element={<WithRoute el={UserPage} brews={this.props.brews} />} />
<Route path='/vault' element={<WithRoute el={VaultPage}/>}/>
<Route path='/changelog' element={<WithRoute el={SharePage} brew={this.props.brew} disableMeta={true} />} />
<Route path='/faq' element={<WithRoute el={SharePage} brew={this.props.brew} disableMeta={true} />} />
<Route path='/migrate' element={<WithRoute el={SharePage} brew={this.props.brew} disableMeta={true} />} />

View File

@@ -116,6 +116,17 @@ const ErrorNavItem = createClass({
</Nav.item>;
}
if(HBErrorCode === '55') {
return <Nav.item className='save error' icon='fas fa-exclamation-triangle'>
Oops!
<div className='errorContainer' onClick={clearError}>
Looks like there are too many requests
from this IP address in a short time.
Please try again after a few minutes.
</div>
</Nav.item>;
}
return <Nav.item className='save error' icon='fas fa-exclamation-triangle'>
Oops!
<div className='errorContainer'>

View File

@@ -1,6 +1,7 @@
@import 'naturalcrit/styles/colors.less';
@navbarHeight : 28px;
@viewerToolsHeight : 32px;
@keyframes pinkColoring {
0% { color : pink; }

View File

@@ -36,7 +36,7 @@ const RecentItems = createClass({
//== Add current brew to appropriate recent items list (depending on storageKey) ==//
if(this.props.storageKey == 'edit'){
let editId = this.props.brew.editId;
if(this.props.brew.googleId){
if(this.props.brew.googleId && !this.props.brew.stubbed){
editId = `${this.props.brew.googleId}${this.props.brew.editId}`;
}
edited = _.filter(edited, (brew)=>{
@@ -51,7 +51,7 @@ const RecentItems = createClass({
}
if(this.props.storageKey == 'view'){
let shareId = this.props.brew.shareId;
if(this.props.brew.googleId){
if(this.props.brew.googleId && !this.props.brew.stubbed){
shareId = `${this.props.brew.googleId}${this.props.brew.shareId}`;
}
viewed = _.filter(viewed, (brew)=>{
@@ -83,7 +83,7 @@ const RecentItems = createClass({
let edited = JSON.parse(localStorage.getItem(EDIT_KEY) || '[]');
if(this.props.storageKey == 'edit') {
let prevEditId = prevProps.brew.editId;
if(prevProps.brew.googleId){
if(prevProps.brew.googleId && !this.props.brew.stubbed){
prevEditId = `${prevProps.brew.googleId}${prevProps.brew.editId}`;
}
@@ -91,7 +91,7 @@ const RecentItems = createClass({
return brew.id !== prevEditId;
});
let editId = this.props.brew.editId;
if(this.props.brew.googleId){
if(this.props.brew.googleId && !this.props.brew.stubbed){
editId = `${this.props.brew.googleId}${this.props.brew.editId}`;
}
edited.unshift({

View File

@@ -0,0 +1,17 @@
const React = require('react');
const Nav = require('naturalcrit/nav/nav.jsx');
module.exports = function (props) {
return (
<Nav.item
color='purple'
icon='fas fa-dungeon'
href='/vault'
newTab={false}
rel='noopener noreferrer'
>
Vault
</Nav.item>
);
};

View File

@@ -19,7 +19,8 @@ const BrewItem = createClass({
stubbed : true
},
updateListFilter : ()=>{},
reportError : ()=>{}
reportError : ()=>{},
renderStorage : true
};
},
@@ -95,6 +96,7 @@ const BrewItem = createClass({
},
renderStorageIcon : function(){
if(!this.props.renderStorage) return;
if(this.props.brew.googleId) {
return <span title={this.props.brew.webViewLink ? 'Your Google Drive Storage': 'Another User\'s Google Drive Storage'}>
<a href={this.props.brew.webViewLink} target='_blank'>
@@ -142,10 +144,14 @@ const BrewItem = createClass({
}
<span title={`Authors:\n${brew.authors?.join('\n')}`}>
<i className='fas fa-user'/> {brew.authors?.map((author, index)=>(
<>
<a key={index} href={`/user/${author}`}>{author}</a>
{index < brew.authors.length - 1 && ', '}
</>))}
<React.Fragment key={index}>
{author === 'hidden'
? <span title="Username contained an email address; hidden to protect user's privacy">{author}</span>
: <a href={`/user/${author}`}>{author}</a>
}
{index < brew.authors.length - 1 && ', '}
</React.Fragment>
))}
</span>
<br />
<span title={`Last viewed: ${moment(brew.lastViewed).local().format(dateFormatString)}`}>

View File

@@ -29,7 +29,7 @@ const { printCurrentBrew, fetchThemeBundle } = require('../../../../shared/helpe
const googleDriveIcon = require('../../googleDrive.svg');
const SAVE_TIMEOUT = 3000;
const SAVE_TIMEOUT = 16000;
const EditPage = createClass({
displayName : 'EditPage',

View File

@@ -2,6 +2,9 @@ const dedent = require('dedent-tabs').default;
const loginUrl = 'https://www.naturalcrit.com/login';
//001-050 : Brew errors
//050-100 : Other pages errors
const errorIndex = (props)=>{
return {
// Default catch all
@@ -149,8 +152,16 @@ const errorIndex = (props)=>{
**Brew ID:** ${props.brew.brewId}`,
//account page when account is not defined
'50' : dedent`
## You are not signed in
You are trying to access the account page, but are not signed in to an account.
Please login or signup at our [login page](https://www.naturalcrit.com/login?redirect=https://homebrewery.naturalcrit.com/account).`,
// Brew locked by Administrators error
'100' : dedent`
'51' : dedent`
## This brew has been locked.
Only an author may request that this lock is removed.
@@ -160,7 +171,12 @@ const errorIndex = (props)=>{
**Brew ID:** ${props.brew.brewId}
**Brew Title:** ${props.brew.brewTitle}`,
'90' : dedent` An unexpected error occurred while looking for these brews.
Try again in a few minutes.`,
'91' : dedent` An unexpected error occurred while trying to get the total of brews.`,
};
};
module.exports = errorIndex;
module.exports = errorIndex;

View File

@@ -10,12 +10,12 @@ const Nav = require('naturalcrit/nav/nav.jsx');
const Navbar = require('../../navbar/navbar.jsx');
const NewBrewItem = require('../../navbar/newbrew.navitem.jsx');
const HelpNavItem = require('../../navbar/help.navitem.jsx');
const VaultNavItem = require('../../navbar/vault.navitem.jsx');
const RecentNavItem = require('../../navbar/recent.navitem.jsx').both;
const AccountNavItem = require('../../navbar/account.navitem.jsx');
const ErrorNavItem = require('../../navbar/error-navitem.jsx');
const { fetchThemeBundle } = require('../../../../shared/helpers.js');
const SplitPane = require('naturalcrit/splitPane/splitPane.jsx');
const Editor = require('../../editor/editor.jsx');
const BrewRenderer = require('../../brewRenderer/brewRenderer.jsx');
@@ -76,6 +76,7 @@ const HomePage = createClass({
}
<NewBrewItem />
<HelpNavItem />
<VaultNavItem />
<RecentNavItem />
<AccountNavItem />
</Nav.section>

View File

@@ -84,6 +84,9 @@ const NewPage = createClass({
if(brew.style)
localStorage.setItem(STYLEKEY, brew.style);
localStorage.setItem(METAKEY, JSON.stringify({ 'renderer': brew.renderer, 'theme': brew.theme, 'lang': brew.lang }));
if(window.location.pathname != '/new') {
window.history.replaceState({}, window.location.title, '/new/');
}
},
componentWillUnmount : function() {
document.removeEventListener('keydown', this.handleControlKeys);

View File

@@ -12,6 +12,7 @@ const Account = require('../../navbar/account.navitem.jsx');
const NewBrew = require('../../navbar/newbrew.navitem.jsx');
const HelpNavItem = require('../../navbar/help.navitem.jsx');
const ErrorNavItem = require('../../navbar/error-navitem.jsx');
const VaultNavitem = require('../../navbar/vault.navitem.jsx');
const UserPage = createClass({
displayName : 'UserPage',
@@ -66,6 +67,7 @@ const UserPage = createClass({
}
<NewBrew />
<HelpNavItem />
<VaultNavitem/>
<RecentNavItem />
<Account />
</Nav.section>

View File

@@ -0,0 +1,396 @@
require('./vaultPage.less');
const React = require('react');
const { useState, useEffect, useRef } = React;
const Nav = require('naturalcrit/nav/nav.jsx');
const Navbar = require('../../navbar/navbar.jsx');
const RecentNavItem = require('../../navbar/recent.navitem.jsx').both;
const Account = require('../../navbar/account.navitem.jsx');
const NewBrew = require('../../navbar/newbrew.navitem.jsx');
const HelpNavItem = require('../../navbar/help.navitem.jsx');
const BrewItem = require('../basePages/listPage/brewItem/brewItem.jsx');
const SplitPane = require('../../../../shared/naturalcrit/splitPane/splitPane.jsx');
const ErrorIndex = require('../errorPage/errors/errorIndex.js');
const request = require('../../utils/request-middleware.js');
const VaultPage = (props)=>{
const [pageState, setPageState] = useState(parseInt(props.query.page) || 1);
//Response state
const [brewCollection, setBrewCollection] = useState(null);
const [totalBrews, setTotalBrews] = useState(null);
const [searching, setSearching] = useState(false);
const [error, setError] = useState(null);
const titleRef = useRef(null);
const authorRef = useRef(null);
const countRef = useRef(null);
const v3Ref = useRef(null);
const legacyRef = useRef(null);
const submitButtonRef = useRef(null);
useEffect(()=>{
disableSubmitIfFormInvalid();
loadPage(pageState, true);
}, []);
const updateStateWithBrews = (brews, page)=>{
setBrewCollection(brews || null);
setPageState(parseInt(page) || 1);
setSearching(false);
};
const updateUrl = (titleValue, authorValue, countValue, v3Value, legacyValue, page)=>{
const url = new URL(window.location.href);
const urlParams = new URLSearchParams(url.search);
urlParams.set('title', titleValue);
urlParams.set('author', authorValue);
urlParams.set('count', countValue);
urlParams.set('v3', v3Value);
urlParams.set('legacy', legacyValue);
urlParams.set('page', page);
url.search = urlParams.toString();
window.history.replaceState(null, '', url.toString());
};
const performSearch = async (title, author, count, v3, legacy, page)=>{
updateUrl(title, author, count, v3, legacy, page);
const response = await request.get(
`/api/vault?title=${title}&author=${author}&v3=${v3}&legacy=${legacy}&count=${count}&page=${page}`
).catch((error)=>{
console.log('error at loadPage: ', error);
setError(error);
updateStateWithBrews([], 1);
});
if(response.ok)
updateStateWithBrews(response.body.brews, page);
};
const loadTotal = async (title, author, v3, legacy)=>{
setTotalBrews(null);
const response = await request.get(
`/api/vault/total?title=${title}&author=${author}&v3=${v3}&legacy=${legacy}`
).catch((error)=>{
console.log('error at loadTotal: ', error);
setError(error);
updateStateWithBrews([], 1);
});
if(response.ok)
setTotalBrews(response.body.totalBrews);
};
const loadPage = async (page, updateTotal)=>{
if(!validateForm())
return;
setSearching(true);
setError(null);
const title = titleRef.current.value || '';
const author = authorRef.current.value || '';
const count = countRef.current.value || 10;
const v3 = v3Ref.current.checked != false;
const legacy = legacyRef.current.checked != false;
performSearch(title, author, count, v3, legacy, page);
if(updateTotal)
loadTotal(title, author, v3, legacy);
};
const renderNavItems = ()=>(
<Navbar>
<Nav.section>
<Nav.item className='brewTitle'>
Vault: Search for brews
</Nav.item>
</Nav.section>
<Nav.section>
<NewBrew />
<HelpNavItem />
<RecentNavItem />
<Account />
</Nav.section>
</Navbar>
);
const validateForm = ()=>{
//form validity: title or author must be written, and at least one renderer set
const isTitleValid = titleRef.current.validity.valid && titleRef.current.value;
const isAuthorValid = authorRef.current.validity.valid && authorRef.current.value;
const isCheckboxChecked = legacyRef.current.checked || v3Ref.current.checked;
const isFormValid = (isTitleValid || isAuthorValid) && isCheckboxChecked;
return isFormValid;
};
const disableSubmitIfFormInvalid = ()=>{
submitButtonRef.current.disabled = !validateForm();
};
const renderForm = ()=>(
<div className='brewLookup'>
<h2 className='formTitle'>Brew Lookup</h2>
<div className='formContents'>
<label>
Title of the brew
<input
ref={titleRef}
type='text'
name='title'
defaultValue={props.query.title || ''}
onKeyUp={disableSubmitIfFormInvalid}
pattern='.{3,}'
title='At least 3 characters'
onKeyDown={(e)=>{
if(e.key === 'Enter' && !submitButtonRef.current.disabled)
loadPage(1, true);
}}
placeholder='v3 Reference Document'
/>
</label>
<label>
Author of the brew
<input
ref={authorRef}
type='text'
name='author'
pattern='.{1,}'
defaultValue={props.query.author || ''}
onKeyUp={disableSubmitIfFormInvalid}
onKeyDown={(e)=>{
if(e.key === 'Enter' && !submitButtonRef.current.disabled)
loadPage(1, true);
}}
placeholder='Username'
/>
</label>
<label>
Results per page
<select ref={countRef} name='count' defaultValue={props.query.count || 20}>
<option value='10'>10</option>
<option value='20'>20</option>
<option value='40'>40</option>
<option value='60'>60</option>
</select>
</label>
<label>
<input
className='renderer'
ref={v3Ref}
type='checkbox'
defaultChecked={props.query.v3 !== 'false'}
onChange={disableSubmitIfFormInvalid}
/>
Search for v3 brews
</label>
<label>
<input
className='renderer'
ref={legacyRef}
type='checkbox'
defaultChecked={props.query.legacy !== 'false'}
onChange={disableSubmitIfFormInvalid}
/>
Search for legacy brews
</label>
<button
id='searchButton'
ref={submitButtonRef}
onClick={()=>{
loadPage(1, true);
}}
>
Search
<i
className={searching ? 'fas fa-spin fa-spinner': 'fas fa-search'}
/>
</button>
</div>
<legend>
<h3>Tips and tricks</h3>
<ul>
<li>
Only <b>published</b> brews are searchable via this tool
</li>
<li>
Usernames are case-sensitive
</li>
<li>
Use <code>"word"</code> to match an exact string,
and <code>-</code> to exclude words (at least one word must not be negated)
</li>
<li>
Some common words like "a", "after", "through", "itself", "here", etc.,
are ignored in searches. The full list can be found &nbsp;
<a href='https://github.com/mongodb/mongo/blob/0e3b3ca8480ddddf5d0105d11a94bd4698335312/src/mongo/db/fts/stop_words_english.txt'>
here
</a>
</li>
</ul>
<small>New features will be coming, such as filters and search by tags.</small>
</legend>
</div>
);
const renderPaginationControls = ()=>{
if(!totalBrews) return null;
const countInt = parseInt(props.query.count || 20);
const totalPages = Math.ceil(totalBrews / countInt);
let startPage, endPage;
if(pageState <= 6) {
startPage = 1;
endPage = Math.min(totalPages, 10);
} else if(pageState + 4 >= totalPages) {
startPage = Math.max(1, totalPages - 9);
endPage = totalPages;
} else {
startPage = pageState - 5;
endPage = pageState + 4;
}
const pagesAroundCurrent = new Array(endPage - startPage + 1)
.fill()
.map((_, index)=>(
<a
key={startPage + index}
className={`pageNumber ${
pageState === startPage + index ? 'currentPage' : ''
}`}
onClick={()=>loadPage(startPage + index, false)}
>
{startPage + index}
</a>
));
return (
<div className='paginationControls'>
<button
className='previousPage'
onClick={()=>loadPage(pageState - 1, false)}
disabled={pageState === startPage}
>
<i className='fa-solid fa-chevron-left'></i>
</button>
<ol className='pages'>
{startPage > 1 && (
<a
className='pageNumber firstPage'
onClick={()=>loadPage(1, false)}
>
1 ...
</a>
)}
{pagesAroundCurrent}
{endPage < totalPages && (
<a
className='pageNumber lastPage'
onClick={()=>loadPage(totalPages, false)}
>
... {totalPages}
</a>
)}
</ol>
<button
className='nextPage'
onClick={()=>loadPage(pageState + 1, false)}
disabled={pageState === totalPages}
>
<i className='fa-solid fa-chevron-right'></i>
</button>
</div>
);
};
const renderFoundBrews = ()=>{
if(searching) {
return (
<div className='foundBrews searching'>
<h3 className='searchAnim'>Searching</h3>
</div>
);
}
if(error) {
const errorText = ErrorIndex()[error.HBErrorCode.toString()] || '';
return (
<div className='foundBrews noBrews'>
<h3>Error: {errorText}</h3>
</div>
);
}
if(!brewCollection) {
return (
<div className='foundBrews noBrews'>
<h3>No search yet</h3>
</div>
);
}
if(brewCollection.length === 0) {
return (
<div className='foundBrews noBrews'>
<h3>No brews found</h3>
</div>
);
}
return (
<div className='foundBrews'>
<span className='totalBrews'>
{`Brews found: `}
<span>{totalBrews}</span>
</span>
{brewCollection.map((brew, index)=>{
return (
<BrewItem
brew={{ ...brew }}
key={index}
reportError={props.reportError}
renderStorage={false}
/>
);
})}
{renderPaginationControls()}
</div>
);
};
return (
<div className='vaultPage'>
<link href='/themes/V3/Blank/style.css' rel='stylesheet' />
<link href='/themes/V3/5ePHB/style.css' rel='stylesheet' />
{renderNavItems()}
<div className='content'>
<SplitPane showDividerButtons={false}>
<div className='form dataGroup'>{renderForm()}</div>
<div className='resultsContainer dataGroup'>
{renderFoundBrews()}
</div>
</SplitPane>
</div>
</div>
);
};
module.exports = VaultPage;

View File

@@ -0,0 +1,362 @@
.vaultPage {
height : 100%;
overflow-y : hidden;
background-color : #2C3E50;
*:not(input) { user-select : none; }
.content {
background : #2C3E50;
height: 100%;
.dataGroup {
width : 100%;
height : 100%;
background : white;
&.form .brewLookup {
position : relative;
padding : 50px clamp(20px, 4vw, 50px);
small {
font-size : 10pt;
color : #555555;
a { color : #333333; }
}
code {
padding-inline : 5px;
background : lightgrey;
border-radius : 5px;
font-family : monospace;
}
h1, h2, h3, h4 {
font-family : 'CodeBold';
letter-spacing : 2px;
}
legend {
h3 {
margin-block : 30px 20px;
font-size : 20px;
text-align : center;
border-bottom : 2px solid;
}
ul {
padding-inline : 30px 10px;
li {
margin-block : 5px;
line-height : calc(1em + 5px);
list-style : disc;
}
}
}
&::after {
position : absolute;
top : 0;
right : 0;
left : 0;
display : block;
padding : 10px;
font-weight : 900;
color : white;
white-space : pre-wrap;
content : 'Error:\A At least one renderer should be enabled to make a search';
background : rgb(255, 60, 60);
opacity : 0;
transition : opacity 0.5s;
}
&:not(:has(input[type='checkbox']:checked))::after { opacity : 1; }
.formTitle {
margin : 20px 0;
font-size : 30px;
color : black;
text-align : center;
border-bottom : 2px solid;
}
.formContents {
position : relative;
display : flex;
flex-direction : column;
label {
display : flex;
align-items : center;
margin : 10px 0;
}
select { margin : 0 10px; }
input {
margin : 0 10px;
&:invalid { background : rgb(255, 188, 181); }
&[type='checkbox'] {
position : relative;
display : inline-block;
width : 50px;
height : 30px;
font-family : 'WalterTurncoat';
font-size : 20px;
font-weight : 800;
color : white;
letter-spacing : 2px;
appearance : none;
background : red;
isolation : isolate;
border-radius : 5px;
&::before,&::after {
position : absolute;
inset : 0;
z-index : 5;
padding-top : 2px;
text-align : center;
}
&::before {
display : block;
content : 'No';
}
&::after {
display : none;
content : 'Yes';
}
&:checked {
background : green;
&::before { display : none; }
&::after { display : block; }
}
}
}
#searchButton {
position : absolute;
right : 20px;
bottom : 0;
i {
margin-left : 10px;
animation-duration : 1000s;
}
}
}
}
&.resultsContainer {
display : flex;
flex-direction : column;
height : 100%;
overflow-y : auto;
font-family : 'BookInsanityRemake';
font-size : 0.34cm;
h3 {
font-family : 'Open Sans';
font-weight : 900;
color : white;
}
.foundBrews {
position : relative;
width : 100%;
height : 100%;
max-height : 100%;
padding : 50px 50px 70px 50px;
overflow-y : scroll;
background-color : #2C3E50;
h3 { font-size : 25px; }
&.noBrews {
display : grid;
place-items : center;
color : white;
}
&.searching {
display : grid;
place-items : center;
color : white;
h3 { position : relative; }
h3.searchAnim::after {
position : absolute;
top : 50%;
right : 0;
width : max-content;
height : 1em;
content : '';
translate : calc(100% + 5px) -50%;
animation : trailingDots 2s ease infinite;
}
}
.totalBrews {
position : fixed;
right : 0;
bottom : 0;
z-index : 1000;
padding : 8px 10px;
font-family : 'Open Sans';
font-size : 11px;
font-weight : 800;
color : white;
background-color : #333333;
.searchAnim {
position : relative;
display : inline-block;
width : 3ch;
height : 1em;
}
.searchAnim::after {
position : absolute;
top : 50%;
right : 0;
width : max-content;
height : 1em;
content : '';
translate : -50% -50%;
animation : trailingDots 2s ease infinite;
}
}
.brewItem {
width : 47%;
margin-right : 40px;
color : black;
isolation:isolate;
&:after {
position:absolute;
inset:0;
display:block;
content:'';
background-image : url('/assets/parchmentBackground.jpg');
z-index:-1;
}
&:nth-child(even of .brewItem) { margin-right : 0; }
h2 {
font-family : 'MrEavesRemake';
font-size : 0.75cm;
font-weight : 800;
line-height : 0.988em;
color : var(--HB_Color_HeaderText);
}
.info {
font-family : 'ScalySansRemake';
font-size : 1.2em;
position:relative;
z-index:2;
>span {
margin-right : 12px;
line-height : 1.5em;
}
}
.links {
z-index:2;
}
hr {
margin: 0px;
visibility: hidden;
}
.thumbnail {
z-index:1;
}
}
.paginationControls {
position : absolute;
left : 50%;
display : grid;
grid-template-areas : 'previousPage currentPage nextPage';
grid-template-columns : 50px 1fr 50px;
place-items : center;
width : auto;
translate : -50%;
.pages {
display : flex;
grid-area : currentPage;
justify-content : space-evenly;
width : 100%;
height : 100%;
padding : 5px 8px;
text-align : center;
.pageNumber {
margin-inline : 1vw;
font-family : 'Open Sans';
font-weight : 900;
color : white;
text-underline-position : under;
text-wrap : nowrap;
cursor : pointer;
&.currentPage {
color : gold;
text-decoration : underline;
pointer-events : none;
}
&.firstPage { margin-right : -5px; }
&.lastPage { margin-left : -5px; }
}
}
button {
width : max-content;
&.previousPage { grid-area : previousPage; }
&.nextPage { grid-area : nextPage; }
}
}
}
}
}
}
}
@keyframes trailingDots {
0%,
32% { content : ' .'; }
33%,
65% { content : ' ..'; }
66%,
100% { content : ' ...'; }
}
// media query for when the page is smaller than 1079 px in width
@media screen and (max-width : 1079px) {
.vaultPage .content {
.dataGroup.form .brewLookup { padding : 1px 20px 20px 10px; }
.dataGroup.resultsContainer .foundBrews .brewItem {
width : 100%;
margin-inline : auto;
}
}
}

View File

@@ -1,57 +1,75 @@
.fac {
display : inline-block;
display : inline-block;
background-color : currentColor;
mask-size : contain;
mask-repeat : no-repeat;
mask-position : center;
width : 1em;
aspect-ratio : 1;
}
.position-top-left {
content: url('../icons/position-top-left.svg');
mask-image: url('../icons/position-top-left.svg');
}
.position-top-right {
content: url('../icons/position-top-right.svg');
mask-image: url('../icons/position-top-right.svg');
}
.position-bottom-left {
content: url('../icons/position-bottom-left.svg');
mask-image: url('../icons/position-bottom-left.svg');
}
.position-bottom-right {
content: url('../icons/position-bottom-right.svg');
mask-image: url('../icons/position-bottom-right.svg');
}
.position-top {
content: url('../icons/position-top.svg');
mask-image: url('../icons/position-top.svg');
}
.position-right {
content: url('../icons/position-right.svg');
mask-image: url('../icons/position-right.svg');
}
.position-bottom {
content: url('../icons/position-bottom.svg');
mask-image: url('../icons/position-bottom.svg');
}
.position-left {
content: url('../icons/position-left.svg');
mask-image: url('../icons/position-left.svg');
}
.mask-edge {
content: url('../icons/mask-edge.svg');
mask-image: url('../icons/mask-edge.svg');
}
.mask-corner {
content: url('../icons/mask-corner.svg');
mask-image: url('../icons/mask-corner.svg');
}
.mask-center {
content: url('../icons/mask-center.svg');
mask-image: url('../icons/mask-center.svg');
}
.book-front-cover {
content: url('../icons/book-front-cover.svg');
mask-image: url('../icons/book-front-cover.svg');
}
.book-back-cover {
content: url('../icons/book-back-cover.svg');
mask-image: url('../icons/book-back-cover.svg');
}
.book-inside-cover {
content: url('../icons/book-inside-cover.svg');
mask-image: url('../icons/book-inside-cover.svg');
}
.book-part-cover {
content: url('../icons/book-part-cover.svg');
mask-image: url('../icons/book-part-cover.svg');
}
.image-wrap-left {
mask-image: url('../icons/image-wrap-left.svg');
}
.image-wrap-right {
mask-image: url('../icons/image-wrap-right.svg');
}
.davek {
content: url('../icons/Davek.svg');
mask-image: url('../icons/Davek.svg');
}
.rellanic {
content: url('../icons/Rellanic.svg');
mask-image: url('../icons/Rellanic.svg');
}
.iokharic {
content: url('../icons/Iokharic.svg');
mask-image: url('../icons/Iokharic.svg');
}
.zoom-to-fit {
mask-image: url('../icons/zoom-to-fit.svg');
}
.fit-width {
mask-image: url('../icons/fit-width.svg');
}

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="100%" viewBox="0 0 100 100" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<g transform="matrix(1.07509,0,0,1.07509,-3.75511,-3.75468)">
<g transform="matrix(0.843549,0,0,0.950644,8.38004,4.39672)">
<path d="M28.455,52.413L28.455,58.581C28.455,59.719 27.684,60.745 26.501,61.181C25.318,61.616 23.956,61.375 23.051,60.571L11.114,49.96C9.878,48.862 9.878,47.08 11.114,45.981L23.051,35.371C23.956,34.566 25.318,34.326 26.501,34.761C27.684,35.197 28.455,36.223 28.455,37.361L28.455,43.528L70.223,43.528L70.223,37.361C70.223,36.223 70.995,35.197 72.177,34.761C73.36,34.326 74.722,34.566 75.627,35.371L87.564,45.981C88.8,47.08 88.8,48.862 87.564,49.96L75.627,60.571C74.722,61.375 73.36,61.616 72.177,61.181C70.995,60.745 70.223,59.719 70.223,58.581L70.223,52.413L28.455,52.413Z"/>
</g>
<g transform="matrix(1.46702,0,0,0.986488,-23.0335,3.50686)">
<path d="M23.967,5.877L23.967,88.383C23.967,90.556 22.781,92.321 21.319,92.321L21.157,92.321C19.695,92.321 18.509,90.556 18.509,88.383L18.509,5.877C18.509,3.703 19.695,1.939 21.157,1.939L21.319,1.939C22.781,1.939 23.967,3.703 23.967,5.877Z"/>
</g>
<g transform="matrix(1.46702,0,0,0.986488,60.7211,3.50686)">
<path d="M23.967,5.877L23.967,88.383C23.967,90.556 22.781,92.321 21.319,92.321L21.157,92.321C19.695,92.321 18.509,90.556 18.509,88.383L18.509,5.877C18.509,3.703 19.695,1.939 21.157,1.939L21.319,1.939C22.781,1.939 23.967,3.703 23.967,5.877Z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
version="1.1"
x="0px"
y="0px"
viewBox="0 0 512.00006 512"
xml:space="preserve"
id="svg10"
sodipodi:docname="noun-wrap-image-left-212078.svg"
width="512.00006"
height="512"
inkscape:export-filename="image-wrap-right.svg"
inkscape:export-xdpi="300"
inkscape:export-ydpi="300"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><defs
id="defs10" /><sodipodi:namedview
id="namedview10"
pagecolor="#ffffff"
bordercolor="#111111"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="1"
inkscape:deskcolor="#d1d1d1" /><path
style="fill:none;stroke:#000000;stroke-width:64;stroke-linecap:round;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1"
d="M 185.80018,144 H 32"
id="path11"
sodipodi:nodetypes="cc"
clip-path="none"
inkscape:export-filename="image-wrap-right.svg"
inkscape:export-xdpi="300"
inkscape:export-ydpi="300" /><path
style="fill:none;stroke:#000000;stroke-width:64;stroke-linecap:round;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1"
d="M 185.80018,368 H 32"
id="path11-8"
sodipodi:nodetypes="cc"
clip-path="none" /><path
style="fill:none;stroke:#000000;stroke-width:64;stroke-linecap:round;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1"
d="M 480.00007,32 H 32"
id="path11-8-2-67"
clip-path="none"
sodipodi:nodetypes="cc" /><path
style="fill:none;stroke:#000000;stroke-width:64;stroke-linecap:round;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1"
d="M 480.00008,480 H 32"
id="path11-8-2-67-2"
clip-path="none"
sodipodi:nodetypes="cc" /><path
style="fill:none;stroke:#000000;stroke-width:64;stroke-linecap:round;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1"
d="M 160.0001,255.98832 32,256.01162"
id="path11-0"
sodipodi:nodetypes="cc"
clip-path="none" /><path
id="path23"
style="opacity:0.922046;fill:#000000;fill-opacity:1;stroke-width:64;stroke-linecap:round;stroke-dasharray:none;paint-order:fill markers stroke"
d="m 416.00008,96 a 160,160 0 0 1 96,32.50977 v 254.98046 a 160,160 0 0 1 -96,32.50977 160,160 0 0 1 -160,-160 160,160 0 0 1 160,-160 z" /></svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
version="1.1"
x="0px"
y="0px"
viewBox="0 0 512.00006 512"
xml:space="preserve"
id="svg10"
sodipodi:docname="noun-wrap-image-left-212078.svg"
width="512.00006"
height="512"
inkscape:export-filename="image-wrap-right.svg"
inkscape:export-xdpi="300"
inkscape:export-ydpi="300"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><defs
id="defs10" /><sodipodi:namedview
id="namedview10"
pagecolor="#ffffff"
bordercolor="#111111"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="1"
inkscape:deskcolor="#d1d1d1" /><path
style="fill:none;stroke:#000000;stroke-width:64;stroke-linecap:round;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1"
d="M 326.1999,144 H 480.00008"
id="path11"
sodipodi:nodetypes="cc"
clip-path="none"
inkscape:export-filename="image-wrap-right.svg"
inkscape:export-xdpi="300"
inkscape:export-ydpi="300" /><path
style="fill:none;stroke:#000000;stroke-width:64;stroke-linecap:round;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1"
d="M 326.1999,368 H 480.00008"
id="path11-8"
sodipodi:nodetypes="cc"
clip-path="none" /><path
style="fill:none;stroke:#000000;stroke-width:64;stroke-linecap:round;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1"
d="M 32.00001,32 H 480.00008"
id="path11-8-2-67"
clip-path="none"
sodipodi:nodetypes="cc" /><path
style="fill:none;stroke:#000000;stroke-width:64;stroke-linecap:round;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1"
d="M 32,480 H 480.00008"
id="path11-8-2-67-2"
clip-path="none"
sodipodi:nodetypes="cc" /><path
style="fill:none;stroke:#000000;stroke-width:64;stroke-linecap:round;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1"
d="m 351.99998,255.98832 128.0001,0.0233"
id="path11-0"
sodipodi:nodetypes="cc"
clip-path="none" /><path
id="path23"
style="opacity:0.922046;fill:#000000;fill-opacity:1;stroke-width:64;stroke-linecap:round;stroke-dasharray:none;paint-order:fill markers stroke"
d="M 96,96 A 160,160 0 0 0 0,128.50977 V 383.49023 A 160,160 0 0 0 96,416 160,160 0 0 0 256,256 160,160 0 0 0 96,96 Z" /></svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="100%" viewBox="0 0 100 100" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<g transform="matrix(1.0781,0,0,1.0781,-3.90545,-3.90502)">
<g transform="matrix(0.841196,0,0,0.947993,8.49652,4.52391)">
<path d="M44.333,52.413L28.455,52.413L28.455,58.581C28.455,59.719 27.684,60.745 26.501,61.181C25.318,61.616 23.956,61.375 23.051,60.571L11.114,49.96C9.878,48.862 9.878,47.08 11.114,45.981L23.051,35.371C23.956,34.566 25.318,34.326 26.501,34.761C27.684,35.197 28.455,36.223 28.455,37.361L28.455,43.528L44.333,43.528L44.333,29.439L37.382,29.439C36.099,29.439 34.943,28.755 34.452,27.705C33.961,26.656 34.233,25.448 35.14,24.644L47.097,14.052C48.335,12.956 50.343,12.956 51.581,14.052L63.539,24.644C64.446,25.448 64.717,26.656 64.226,27.705C63.735,28.755 62.579,29.439 61.296,29.439L54.346,29.439L54.346,43.528L70.223,43.528L70.223,37.361C70.223,36.223 70.995,35.197 72.177,34.761C73.36,34.326 74.722,34.566 75.627,35.371L87.564,45.981C88.8,47.08 88.8,48.862 87.564,49.96L75.627,60.571C74.722,61.375 73.36,61.616 72.177,61.181C70.995,60.745 70.223,59.719 70.223,58.581L70.223,52.413L54.346,52.413L54.346,66.502L61.296,66.502C62.579,66.502 63.735,67.187 64.226,68.236C64.717,69.286 64.446,70.494 63.539,71.297L51.581,81.889C50.343,82.986 48.335,82.986 47.097,81.889L35.14,71.297C34.233,70.494 33.961,69.286 34.452,68.236C34.943,67.187 36.099,66.502 37.382,66.502L44.333,66.503L44.333,52.413Z"/>
</g>
<g transform="matrix(1.0247,0,0,1.0247,-5.47698,-3.53855)">
<path d="M99.4,14.269L99.4,90.227C99.4,94.245 96.137,97.508 92.119,97.508L16.161,97.508C12.142,97.508 8.88,94.245 8.88,90.227L8.88,14.269C8.88,10.25 12.142,6.988 16.161,6.988L92.119,6.988C96.137,6.988 99.4,10.25 99.4,14.269ZM93.633,14.269C93.633,13.433 92.955,12.755 92.119,12.755L16.161,12.755C15.325,12.755 14.647,13.433 14.647,14.269L14.647,90.227C14.647,91.062 15.325,91.741 16.161,91.741L92.119,91.741C92.955,91.741 93.633,91.062 93.633,90.227L93.633,14.269Z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

71
eslint.config.mjs Normal file
View File

@@ -0,0 +1,71 @@
import react from "eslint-plugin-react";
import jest from "eslint-plugin-jest";
import globals from "globals";
export default [{
ignores: ["build/"]
},
{
files : ['**/*.js', '**/*.jsx'],
plugins : { react, jest },
languageOptions : {
ecmaVersion : "latest",
sourceType : "module",
parserOptions : { ecmaFeatures: { jsx: true } },
globals : { ...globals.browser, ...globals.node }
},
rules: {
/** Errors **/
"camelcase" : ["error", { properties: "never" }],
"no-array-constructor" : "error",
"no-iterator" : "error",
"no-nested-ternary" : "error",
"no-new-object" : "error",
"no-proto" : "error",
"react/jsx-no-bind" : ["error", { allowArrowFunctions: true }],
"react/jsx-uses-react" : "error",
"react/prefer-es6-class" : ["error", "never"],
"jest/valid-expect" : ["error", { maxArgs: 3 }],
/** Warnings **/
"max-lines" : ["warn", { max: 200, skipComments: true, skipBlankLines: true }],
"max-depth" : ["warn", { max: 4 }],
"max-params" : ["warn", { max: 5 }],
"no-restricted-syntax" : ["warn", "ClassDeclaration", "SwitchStatement"],
"no-unused-vars" : ["warn", { vars: "all", args: "none", varsIgnorePattern: "config|_|cx|createClass" }],
"react/jsx-uses-vars" : "warn",
/** Fixable **/
"arrow-parens" : ["warn", "always"],
"brace-style" : ["warn", "1tbs", { allowSingleLine: true }],
"jsx-quotes" : ["warn", "prefer-single"],
"no-var" : "warn",
"prefer-const" : "warn",
"prefer-template" : "warn",
"quotes" : ["warn", "single", { allowTemplateLiterals: true }],
"semi" : ["warn", "always"],
/** Whitespace **/
"array-bracket-spacing" : ["warn", "never"],
"arrow-spacing" : ["warn", { before: false, after: false }],
"comma-spacing" : ["warn", { before: false, after: true }],
"indent" : ["warn", "tab", { MemberExpression: "off" }],
"linebreak-style" : "off",
"no-trailing-spaces" : "warn",
"no-whitespace-before-property" : "warn",
"object-curly-spacing" : ["warn", "always"],
"react/jsx-indent-props" : ["warn", "tab"],
"space-in-parens" : ["warn", "never"],
"template-curly-spacing" : ["warn", "never"],
"keyword-spacing" : ["warn", {
before : true,
after : true,
overrides : { if: { before: false, after: false } }
}],
"key-spacing" : ["warn", {
multiLine : { beforeColon: true, afterColon: true, align: "colon" },
singleLine : { beforeColon: false, afterColon: true }
}]
}
}
];

843
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
{
"name": "homebrewery",
"description": "Create authentic looking D&D homebrews using only markdown",
"version": "3.14.1",
"version": "3.15.0",
"engines": {
"npm": "^10.2.x",
"node": "^20.8.x"
@@ -15,8 +15,8 @@
"quick": "node scripts/quick.js",
"build": "node scripts/buildHomebrew.js && node scripts/buildAdmin.js",
"builddev": "node scripts/buildHomebrew.js --dev",
"lint": "eslint --fix **/*.{js,jsx}",
"lint:dry": "eslint **/*.{js,jsx}",
"lint": "eslint --fix",
"lint:dry": "eslint",
"stylelint": "stylelint --fix **/*.{less}",
"stylelint:dry": "stylelint **/*.less",
"circleci": "npm test && eslint **/*.{js,jsx} --max-warnings=0",
@@ -24,6 +24,7 @@
"test": "jest --runInBand",
"test:api-unit": "jest \"server/.*.spec.js\" --verbose",
"test:api-unit:themes": "jest \"server/.*.spec.js\" -t \"theme bundle\" --verbose",
"test:api-unit:css": "jest \"server/.*.spec.js\" -t \"Get CSS\" --verbose",
"test:coverage": "jest --coverage --silent --runInBand",
"test:dev": "jest --verbose --watch",
"test:basic": "jest tests/markdown/basic.test.js --verbose",
@@ -33,6 +34,7 @@
"test:mustache-syntax:block": "jest \".*(mustache-syntax).*\" -t '^Block:.*' --verbose --noStackTrace",
"test:mustache-syntax:injection": "jest \".*(mustache-syntax).*\" -t '^Injection:.*' --verbose --noStackTrace",
"test:definition-lists": "jest tests/markdown/definition-lists.test.js --verbose --noStackTrace",
"test:hard-breaks": "jest tests/markdown/hard-breaks.test.js --verbose --noStackTrace",
"test:emojis": "jest tests/markdown/emojis.test.js --verbose --noStackTrace",
"test:route": "jest tests/routes/static-pages.test.js --verbose",
"phb": "node scripts/phb.js",
@@ -84,10 +86,10 @@
},
"dependencies": {
"@babel/core": "^7.25.2",
"@babel/plugin-transform-runtime": "^7.24.7",
"@babel/preset-env": "^7.25.3",
"@babel/plugin-transform-runtime": "^7.25.4",
"@babel/preset-env": "^7.25.4",
"@babel/preset-react": "^7.24.7",
"@googleapis/drive": "^8.11.0",
"@googleapis/drive": "^8.14.0",
"body-parser": "^1.20.2",
"classnames": "^2.5.1",
"codemirror": "^5.65.6",
@@ -98,6 +100,7 @@
"expr-eval": "^2.0.2",
"express": "^4.19.2",
"express-async-handler": "^1.2.0",
"express-rate-limit": "^7.4.0",
"express-static-gzip": "2.1.7",
"fs-extra": "11.2.0",
"js-yaml": "^4.1.0",
@@ -106,32 +109,33 @@
"lodash": "^4.17.21",
"marked": "11.2.0",
"marked-emoji": "^1.4.2",
"marked-extended-tables": "^1.0.8",
"marked-extended-tables": "^1.0.10",
"marked-gfm-heading-id": "^3.2.0",
"marked-smartypants-lite": "^1.0.2",
"markedLegacy": "npm:marked@^0.3.19",
"moment": "^2.30.1",
"mongoose": "^8.5.2",
"mongoose": "^8.6.1",
"nanoid": "3.3.4",
"nconf": "^0.12.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-frame-component": "^4.1.3",
"react-router-dom": "6.26.0",
"react-router-dom": "6.26.1",
"sanitize-filename": "1.6.3",
"superagent": "^9.0.2",
"superagent": "^10.1.0",
"vitreum": "git+https://git@github.com/calculuschild/vitreum.git"
},
"devDependencies": {
"@stylistic/stylelint-plugin": "^3.0.0",
"eslint": "^8.57.0",
"eslint-plugin-jest": "^28.8.0",
"eslint-plugin-react": "^7.35.0",
"@stylistic/stylelint-plugin": "^3.0.1",
"eslint": "^9.9.1",
"eslint-plugin-jest": "^28.8.3",
"eslint-plugin-react": "^7.35.2",
"globals": "^15.9.0",
"jest": "^29.7.0",
"jest-expect-message": "^1.1.3",
"postcss-less": "^6.0.0",
"stylelint": "^16.8.0",
"stylelint-config-recess-order": "^5.0.1",
"stylelint": "^16.9.0",
"stylelint-config-recess-order": "^5.1.0",
"stylelint-config-recommended": "^14.0.1",
"supertest": "^7.0.0"
}

View File

@@ -9,11 +9,12 @@ const yaml = require('js-yaml');
const app = express();
const config = require('./config.js');
const { homebrewApi, getBrew, getUsersBrewThemes } = require('./homebrew.api.js');
const { homebrewApi, getBrew, getUsersBrewThemes, getCSS } = require('./homebrew.api.js');
const GoogleActions = require('./googleActions.js');
const serveCompressedStaticAssets = require('./static-assets.mv.js');
const sanitizeFilename = require('sanitize-filename');
const asyncHandler = require('express-async-handler');
const templateFn = require('./../client/template.js');
const { DEFAULT_BREW } = require('./brewDefaults.js');
@@ -29,6 +30,10 @@ const sanitizeBrew = (brew, accessType)=>{
return brew;
};
app.set('trust proxy', 1 /* number of proxies between user and server */)
app.get('/ip', (request, response) => response.send(request.ip))
app.use('/', serveCompressedStaticAssets(`build`));
app.use(require('./middleware/content-negotiation.js'));
app.use(require('body-parser').json({ limit: '25mb' }));
@@ -54,6 +59,7 @@ app.use((req, res, next)=>{
app.use(homebrewApi);
app.use(require('./admin.api.js'));
app.use(require('./vault.api.js'));
const HomebrewModel = require('./homebrew.model.js').model;
const welcomeText = require('fs').readFileSync('client/homebrew/pages/homePage/welcome_msg.md', 'utf8');
@@ -200,6 +206,9 @@ app.get('/download/:id', asyncHandler(getBrew('share')), (req, res)=>{
res.status(200).send(brew.text);
});
//Serve brew styling
app.get('/css/:id', asyncHandler(getBrew('share')), (req, res)=>{getCSS(req, res);});
//User Page
app.get('/user/:username', async (req, res, next)=>{
const ownAccount = req.account && (req.account.username == req.params.username);
@@ -233,6 +242,8 @@ app.get('/user/:username', async (req, res, next)=>{
console.log(err);
});
brews.forEach(brew => brew.stubbed = true); //All brews from MongoDB are "stubbed"
if(ownAccount && req?.account?.googleId){
const auth = await GoogleActions.authCheck(req.account, res);
let googleBrews = await GoogleActions.listGoogleBrews(auth)
@@ -240,12 +251,12 @@ app.get('/user/:username', async (req, res, next)=>{
console.error(err);
});
// If stub matches file from Google, use Google metadata over stub metadata
if(googleBrews && googleBrews.length > 0) {
for (const brew of brews.filter((brew)=>brew.googleId)) {
const match = googleBrews.findIndex((b)=>b.editId === brew.editId);
if(match !== -1) {
brew.googleId = googleBrews[match].googleId;
brew.stubbed = true;
brew.pageCount = googleBrews[match].pageCount;
brew.renderer = googleBrews[match].renderer;
brew.version = googleBrews[match].version;
@@ -254,6 +265,7 @@ app.get('/user/:username', async (req, res, next)=>{
}
}
//Remaining unstubbed google brews display current user as author
googleBrews = googleBrews.map((brew)=>({ ...brew, authors: [req.account.username] }));
brews = _.concat(brews, googleBrews);
}
@@ -356,27 +368,26 @@ app.get('/share/:id', asyncHandler(getBrew('share')), asyncHandler(async (req, r
app.get('/account', asyncHandler(async (req, res, next)=>{
const data = {};
data.title = 'Account Information Page';
if(!req.account) {
res.set('WWW-Authenticate', 'Bearer realm="Authorization Required"');
const error = new Error('No valid account');
error.status = 401;
error.HBErrorCode = '50';
error.page = data.title;
return next(error);
};
let auth;
let googleCount = [];
if(req.account) {
if(req.account.googleId) {
try {
auth = await GoogleActions.authCheck(req.account, res, false);
} catch (e) {
auth = undefined;
console.log('Google auth check failed!');
console.log(e);
}
if(auth.credentials.access_token) {
try {
googleCount = await GoogleActions.listGoogleBrews(auth);
} catch (e) {
googleCount = undefined;
console.log('List Google files failed!');
console.log(e);
}
}
auth = await GoogleActions.authCheck(req.account, res, false)
googleCount = await GoogleActions.listGoogleBrews(auth)
.catch((err)=>{
console.error(err);
});
}
const query = { authors: req.account.username, googleId: { $exists: false } };
@@ -390,7 +401,7 @@ app.get('/account', asyncHandler(async (req, res, next)=>{
username : req.account.username,
issued : req.account.issued,
googleId : Boolean(req.account.googleId),
authCheck : Boolean(req.account.googleId && auth.credentials.access_token),
authCheck : Boolean(req.account.googleId && auth?.credentials.access_token),
mongoCount : mongoCount,
googleCount : googleCount?.length
};
@@ -420,8 +431,21 @@ if(isLocalEnvironment){
});
}
//Vault Page
app.get('/vault', asyncHandler(async(req, res, next)=>{
return next();
}));
//Send rendered page
app.use(asyncHandler(async (req, res, next)=>{
if (!req.route) return res.redirect('/'); // Catch-all for invalid routes
const page = await renderPage(req, res);
if(!page) return;
res.send(page);
}));
//Render the page
const templateFn = require('./../client/template.js');
const renderPage = async (req, res)=>{
// Create configuration object
const configuration = {
@@ -450,13 +474,6 @@ const renderPage = async (req, res)=>{
return page;
};
//Send rendered page
app.use(asyncHandler(async (req, res, next)=>{
const page = await renderPage(req, res);
if(!page) return;
res.send(page);
}));
//v=====----- Error-Handling Middleware -----=====v//
//Format Errors as plain objects so all fields will appear in the string sent
const formatErrors = (key, value)=>{
@@ -478,7 +495,7 @@ app.use(async (err, req, res, next)=>{
err.originalUrl = req.originalUrl;
console.error(err);
if(err.originalUrl?.startsWith('/api/')) {
if(err.originalUrl?.startsWith('/api')) {
// console.log('API error');
res.status(err.status || err.response?.status || 500).send(err);
return;

View File

@@ -25,6 +25,15 @@ if(!config.get('service_account')){
const defaultAuth = serviceAuth || config.get('google_api_key');
const retryConfig = {
retry: 3, // Number of retry attempts
retryDelay: 100, // Initial delay in milliseconds
retryDelayMultiplier: 2, // Multiplier for exponential backoff
maxRetryDelay: 32000, // Maximum delay in milliseconds
httpMethodsToRetry: ['PATCH'], // Only retry PATCH requests
statusCodesToRetry: [[429, 429]], // Only retry on 429 status code
};
const GoogleActions = {
authCheck : (account, res, updateTokens=true)=>{
@@ -112,9 +121,7 @@ const GoogleActions = {
})
.catch((err)=>{
console.log(`Error Listing Google Brews`);
console.error(err);
throw (err);
//TODO: Should break out here, but continues on for some reason.
});
fileList.push(...obj.data.files);
NextPageToken = obj.data.nextPageToken;
@@ -147,8 +154,9 @@ const GoogleActions = {
return brews;
},
updateGoogleBrew : async (brew)=>{
const drive = googleDrive.drive({ version: 'v3', auth: defaultAuth });
updateGoogleBrew : async (brew, auth = defaultAuth, userIp)=>{
const drive = googleDrive.drive({ version: 'v3', auth: auth });
console.log(auth == defaultAuth ? 'UPDATE w SERVICEACC' : 'UPDATE w USERACC')
await drive.files.update({
fileId : brew.googleId,
@@ -168,11 +176,14 @@ const GoogleActions = {
media : {
mimeType : 'text/plain',
body : brew.text
}
},
headers: {
'X-Forwarded-For': userIp, // Set the X-Forwarded-For header
},
retryConfig
})
.catch((err)=>{
console.log('Error saving to google');
console.error(err);
throw (err);
});

View File

@@ -9,6 +9,7 @@ const yaml = require('js-yaml');
const asyncHandler = require('express-async-handler');
const { nanoid } = require('nanoid');
const { splitTextStyleAndMetadata } = require('../shared/helpers.js');
const rateLimit = require('express-rate-limit');
const { DEFAULT_BREW, DEFAULT_BREW_LOAD } = require('./brewDefaults.js');
@@ -99,7 +100,7 @@ const api = {
stub = stub?.toObject();
if(stub?.lock?.locked && accessType != 'edit') {
throw { HBErrorCode: '100', code: stub.lock.code, message: stub.lock.shareMessage, brewId: stub.shareId, brewTitle: stub.title };
throw { HBErrorCode: '51', code: stub.lock.code, message: stub.lock.shareMessage, brewId: stub.shareId, brewTitle: stub.title };
}
// If there is a google id, try to find the google brew
@@ -148,6 +149,20 @@ const api = {
next();
};
},
getCSS : async (req, res)=>{
const { brew } = req;
if(!brew) return res.status(404).send('');
splitTextStyleAndMetadata(brew);
if(!brew.style) return res.status(404).send('');
res.set({
'Cache-Control' : 'no-cache',
'Content-Type' : 'text/css'
});
return res.status(200).send(brew.style);
},
mergeBrewText : (brew)=>{
let text = brew.text;
if(brew.style !== undefined) {
@@ -228,11 +243,8 @@ const api = {
let googleId, saved;
if(saveToGoogle) {
googleId = await api.newGoogleBrew(req.account, newHomebrew, res)
.catch((err)=>{
console.error(err);
res.status(err?.status || err?.response?.status || 500).send(err?.message || err);
});
googleId = await api.newGoogleBrew(req.account, newHomebrew, res);
if(!googleId) return;
api.excludeStubProps(newHomebrew);
newHomebrew.googleId = googleId;
@@ -337,19 +349,13 @@ const api = {
brew.googleId = undefined;
} else if(!brew.googleId && saveToGoogle) {
// If we don't have a google id and the user wants to save to google, create the google brew and set the google id on the brew
brew.googleId = await api.newGoogleBrew(req.account, api.excludeGoogleProps(brew), res)
.catch((err)=>{
console.error(err);
res.status(err.status || err.response.status).send(err.message || err);
});
brew.googleId = await api.newGoogleBrew(req.account, api.excludeGoogleProps(brew), res);
if(!brew.googleId) return;
} else if(brew.googleId) {
// If the google id exists and no other actions are being performed, update the google brew
const updated = await GoogleActions.updateGoogleBrew(api.excludeGoogleProps(brew))
.catch((err)=>{
console.error(err);
res.status(err?.response?.status || 500).send(err);
});
const updated = await api.updateGoogleBrew(req.account, api.excludeGoogleProps(brew), res, req);
if(!updated) return;
}
@@ -392,6 +398,15 @@ const api = {
res.status(200).send(saved);
},
updateGoogleBrew : async (account, brew, res, req)=>{
//let oAuth2Client;
//if(account.googleId)
// oAuth2Client = GoogleActions.authCheck(account, res);
return await GoogleActions.updateGoogleBrew(brew, undefined, req.ip);
},
deleteGoogleBrew : async (account, id, editId, res)=>{
const auth = await GoogleActions.authCheck(account, res);
await GoogleActions.deleteGoogleBrew(auth, id, editId);

View File

@@ -50,6 +50,7 @@ describe('Tests for api', ()=>{
res = {
status : jest.fn(()=>res),
send : jest.fn(()=>{}),
set : jest.fn(()=>{}),
setHeader : jest.fn(()=>{})
};
@@ -308,7 +309,7 @@ describe('Tests for api', ()=>{
const req = { brew: {} };
const next = jest.fn();
await expect(fn(req, null, next)).rejects.toEqual({ 'HBErrorCode': '100', 'brewId': '1', 'brewTitle': 'test brew', 'code': 404, 'message': 'brew locked' });
await expect(fn(req, null, next)).rejects.toEqual({ 'HBErrorCode': '51', 'brewId': '1', 'brewTitle': 'test brew', 'code': 404, 'message': 'brew locked' });
});
});
@@ -559,16 +560,6 @@ brew`);
views : 0
});
});
it('should handle google error', async()=>{
google.newGoogleBrew = jest.fn(()=>{
throw 'err';
});
await api.newBrew({ body: { text: 'asdf', title: '' }, query: { saveToGoogle: true }, account: { username: 'test user' } }, res);
expect(res.status).toHaveBeenCalledWith(500);
expect(res.send).toHaveBeenCalledWith('err');
});
});
describe('deleteGoogleBrew', ()=>{
@@ -916,4 +907,66 @@ brew`);
expect(saved.googleId).toEqual(brew.googleId);
});
});
describe('Get CSS', ()=>{
it('should return brew style content as CSS text', async ()=>{
const testBrew = { title: 'test brew', text: '```css\n\nI Have a style!\n````\n\n' };
const toBrewPromise = (brew)=>new Promise((res)=>res({ toObject: ()=>brew }));
api.getId = jest.fn(()=>({ id: '1', googleId: undefined }));
model.get = jest.fn(()=>toBrewPromise(testBrew));
const fn = api.getBrew('share', true);
const req = { brew: {} };
const next = jest.fn();
await fn(req, null, next);
await api.getCSS(req, res);
expect(req.brew).toEqual(testBrew);
expect(req.brew).toHaveProperty('style', '\nI Have a style!\n');
expect(res.status).toHaveBeenCalledWith(200);
expect(res.send).toHaveBeenCalledWith("\nI Have a style!\n");
expect(res.set).toHaveBeenCalledWith({
'Cache-Control' : 'no-cache',
'Content-Type' : 'text/css'
});
});
it('should return 404 when brew has no style content', async ()=>{
const testBrew = { title: 'test brew', text: 'I don\'t have a style!' };
const toBrewPromise = (brew)=>new Promise((res)=>res({ toObject: ()=>brew }));
api.getId = jest.fn(()=>({ id: '1', googleId: undefined }));
model.get = jest.fn(()=>toBrewPromise(testBrew));
const fn = api.getBrew('share', true);
const req = { brew: {} };
const next = jest.fn();
await fn(req, null, next);
await api.getCSS(req, res);
expect(req.brew).toEqual(testBrew);
expect(req.brew).toHaveProperty('style');
expect(res.status).toHaveBeenCalledWith(404);
expect(res.send).toHaveBeenCalledWith('');
});
it('should return 404 when brew does not exist', async ()=>{
const testBrew = { };
const toBrewPromise = (brew)=>new Promise((res)=>res({ toObject: ()=>brew }));
api.getId = jest.fn(()=>({ id: '1', googleId: undefined }));
model.get = jest.fn(()=>toBrewPromise(testBrew));
const fn = api.getBrew('share', true);
const req = { brew: {} };
const next = jest.fn();
await fn(req, null, next);
await api.getCSS(req, res);
expect(req.brew).toEqual(testBrew);
expect(req.brew).toHaveProperty('style');
expect(res.status).toHaveBeenCalledWith(404);
expect(res.send).toHaveBeenCalledWith('');
});
});
});

102
server/vault.api.js Normal file
View File

@@ -0,0 +1,102 @@
const express = require('express');
const asyncHandler = require('express-async-handler');
const HomebrewModel = require('./homebrew.model.js').model;
const router = express.Router();
const titleConditions = (title)=>{
if(!title) return {};
return {
$text : {
$search : title,
$caseSensitive : false,
},
};
};
const authorConditions = (author)=>{
if(!author) return {};
return { authors: author };
};
const rendererConditions = (legacy, v3)=>{
if(legacy === 'true' && v3 !== 'true')
return { renderer: 'legacy' };
if(v3 === 'true' && legacy !== 'true')
return { renderer: 'V3' };
return {}; // If all renderers selected, renderer field not needed in query for speed
};
const findBrews = async (req, res)=>{
const title = req.query.title || '';
const author = req.query.author || '';
const page = Math.max(parseInt(req.query.page) || 1, 1);
const count = Math.max(parseInt(req.query.count) || 20, 10);
const skip = (page - 1) * count;
const combinedQuery = {
$and : [
{ published: true },
rendererConditions(req.query.legacy, req.query.v3),
titleConditions(title),
authorConditions(author)
],
};
const projection = {
editId : 0,
googleId : 0,
text : 0,
textBin : 0,
version : 0
};
await HomebrewModel.find(combinedQuery, projection)
.skip(skip)
.limit(count)
.maxTimeMS(5000)
.exec()
.then((brews)=>{
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
const processedBrews = brews.map((brew)=>{
brew.authors = brew.authors.map((author)=>emailRegex.test(author) ? 'hidden' : author
);
return brew;
});
res.json({ brews: processedBrews, page });
})
.catch((error)=>{
throw { ...error, message: 'Error finding brews in Vault search', HBErrorCode: 90 };
});
};
const findTotal = async (req, res)=>{
const title = req.query.title || '';
const author = req.query.author || '';
const combinedQuery = {
$and : [
{ published: true },
rendererConditions(req.query.legacy, req.query.v3),
titleConditions(title),
authorConditions(author)
],
};
await HomebrewModel.countDocuments(combinedQuery)
.then((totalBrews)=>{
console.log(`when returning, the total of brews is ${totalBrews} for the query ${JSON.stringify(combinedQuery)}`);
res.json({ totalBrews });
})
.catch((error)=>{
throw { ...error, message: 'Error finding brews in Vault search findTotal function', HBErrorCode: 91 };
});
};
router.get('/api/vault/total', asyncHandler(findTotal));
router.get('/api/vault', asyncHandler(findBrews));
module.exports = router;

View File

@@ -35,6 +35,7 @@ const printCurrentBrew = ()=>{
};
const fetchThemeBundle = async (obj, renderer, theme)=>{
if(!renderer || !theme) return;
const res = await request
.get(`/api/theme/${renderer}/${theme}`)
.catch((err)=>{

View File

@@ -3,7 +3,7 @@ const _ = require('lodash');
const Marked = require('marked');
const MarkedExtendedTables = require('marked-extended-tables');
const { markedSmartypantsLite: MarkedSmartypantsLite } = require('marked-smartypants-lite');
const { gfmHeadingId: MarkedGFMHeadingId } = require('marked-gfm-heading-id');
const { gfmHeadingId: MarkedGFMHeadingId, resetHeadings: MarkedGFMResetHeadingIDs } = require('marked-gfm-heading-id');
const { markedEmoji: MarkedEmojis } = require('marked-emoji');
//Icon fonts included so they can appear in emoji autosuggest dropdown
@@ -86,7 +86,7 @@ renderer.link = function (href, title, text) {
if(href[0] == '#') {
self = true;
}
href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
href = cleanUrl(href);
if(href === null) {
return text;
@@ -102,6 +102,20 @@ renderer.link = function (href, title, text) {
return out;
};
// Expose `src` attribute as `--HB_src` to make the URL accessible via CSS
renderer.image = function (href, title, text) {
href = cleanUrl(href);
if (href === null)
return text;
let out = `<img src="${href}" alt="${text}" style="--HB_src:url(${href});"`;
if (title)
out += ` title="${title}"`;
out += '>';
return out;
}
// Disable default reflink behavior, as it steps on our variables extension
tokenizer.def = function () {
return undefined;
@@ -356,6 +370,27 @@ const superSubScripts = {
}
};
const forcedParagraphBreaks = {
name : 'hardBreaks',
level : 'block',
start(src) { return src.match(/\n:+$/m)?.index; }, // Hint to Marked.js to stop and check for a match
tokenizer(src, tokens) {
const regex = /^(:+)(?:\n|$)/ym;
const match = regex.exec(src);
if(match?.length) {
return {
type : 'hardBreaks', // Should match "name" above
raw : match[0], // Text to consume from the source
length : match[1].length,
text : ''
};
}
},
renderer(token) {
return `<div class='blank'></div>`.repeat(token.length).concat('\n');
}
};
const definitionListsSingleLine = {
name : 'definitionListsSingleLine',
level : 'block',
@@ -400,9 +435,9 @@ const definitionListsSingleLine = {
const definitionListsMultiLine = {
name : 'definitionListsMultiLine',
level : 'block',
start(src) { return src.match(/\n[^\n]*\n::/m)?.index; }, // Hint to Marked.js to stop and check for a match
start(src) { return src.match(/\n[^\n]*\n::[^:\n]/m)?.index; }, // Hint to Marked.js to stop and check for a match
tokenizer(src, tokens) {
const regex = /(\n?\n?(?!::)[^\n]+?(?=\n::))|\n::(.(?:.|\n)*?(?=(?:\n::)|(?:\n\n)|$))/y;
const regex = /(\n?\n?(?!::)[^\n]+?(?=\n::[^:\n]))|\n::([^:\n](?:.|\n)*?(?=(?:\n::)|(?:\n\n)|$))/y;
let match;
let endIndex = 0;
const definitions = [];
@@ -706,34 +741,27 @@ const MarkedEmojiOptions = {
renderer : (token)=>`<i class="${token.emoji}"></i>`
};
const tableTerminators = [
`:+\\n`, // hardBreak
` *{[^\n]+}`, // blockInjector
` *{{[^{\n]*\n.*?\n}}` // mustacheDiv
]
Marked.use(MarkedVariables());
Marked.use({ extensions: [definitionListsMultiLine, definitionListsSingleLine, superSubScripts, mustacheSpans, mustacheDivs, mustacheInjectInline] });
Marked.use({ extensions : [definitionListsMultiLine, definitionListsSingleLine, forcedParagraphBreaks, superSubScripts,
mustacheSpans, mustacheDivs, mustacheInjectInline] });
Marked.use(mustacheInjectBlock);
Marked.use({ renderer: renderer, tokenizer: tokenizer, mangle: false });
Marked.use(MarkedExtendedTables(), MarkedGFMHeadingId(), MarkedSmartypantsLite(), MarkedEmojis(MarkedEmojiOptions));
Marked.use(MarkedExtendedTables(tableTerminators), MarkedGFMHeadingId({ globalSlugs: true }), MarkedSmartypantsLite(), MarkedEmojis(MarkedEmojiOptions));
const nonWordAndColonTest = /[^\w:]/g;
const cleanUrl = function (sanitize, base, href) {
if(sanitize) {
let prot;
try {
prot = decodeURIComponent(unescape(href))
.replace(nonWordAndColonTest, '')
.toLowerCase();
} catch (e) {
return null;
}
if(prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) {
return null;
}
}
try {
href = encodeURI(href).replace(/%25/g, '%');
} catch (e) {
return null;
}
return href;
};
function cleanUrl(href) {
try {
href = encodeURI(href).replace(/%25/g, '%');
} catch {
return null;
}
return href;
}
const escapeTest = /[&<>"']/;
const escapeReplace = /[&<>"']/g;
@@ -828,13 +856,15 @@ let globalPageNumber = 0;
module.exports = {
marked : Marked,
render : (rawBrewText, pageNumber=1)=>{
globalVarsList[pageNumber] = {}; //Reset global links for current page, to ensure values are parsed in order
varsQueue = []; //Could move into MarkedVariables()
globalPageNumber = pageNumber;
render : (rawBrewText, pageNumber=0)=>{
globalVarsList[pageNumber] = {}; //Reset global links for current page, to ensure values are parsed in order
varsQueue = []; //Could move into MarkedVariables()
globalPageNumber = pageNumber;
if(pageNumber==0) {
MarkedGFMResetHeadingIDs();
}
rawBrewText = rawBrewText.replace(/^\\column$/gm, `\n<div class='columnSplit'></div>\n`)
.replace(/^(:+)$/gm, (match)=>`${`<div class='blank'></div>`.repeat(match.length)}\n`);
rawBrewText = rawBrewText.replace(/^\\column$/gm, `\n<div class='columnSplit'></div>\n`);
const opts = Marked.defaults;
rawBrewText = opts.hooks.preprocess(rawBrewText);

View File

@@ -7,8 +7,9 @@ const SplitPane = createClass({
displayName : 'SplitPane',
getDefaultProps : function() {
return {
storageKey : 'naturalcrit-pane-split',
onDragFinish : function(){} //fires when dragging
storageKey : 'naturalcrit-pane-split',
onDragFinish : function(){}, //fires when dragging
showDividerButtons : true
};
},
@@ -142,9 +143,11 @@ const SplitPane = createClass({
width={this.state.currentDividerPos}
>
{React.cloneElement(this.props.children[0], {
moveBrew : this.state.moveBrew,
moveSource : this.state.moveSource,
setMoveArrows : this.setMoveArrows
...(this.props.showDividerButtons && {
moveBrew: this.state.moveBrew,
moveSource: this.state.moveSource,
setMoveArrows: this.setMoveArrows,
}),
})}
</Pane>
{this.renderDivider()}

View File

@@ -88,4 +88,16 @@ describe('Multiline Definition Lists', ()=>{
const rendered = Markdown.render(source).trim();
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe('<dl><dt>Term 1</dt><dd>Inline definition 1</dd>\n<dt></dt><dd>Inline definition 2 (no DT)</dd>\n</dl>');
});
test('Multiline Definition Term must have at least one non-empty Definition', function() {
const source = 'Term 1\n::';
const rendered = Markdown.render(source).trim();
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<p>Term 1</p>\n<div class='blank'></div><div class='blank'></div>`);
});
test('Multiline Definition List must have at least one non-newline character after ::', function() {
const source = 'Term 1\n::\nDefinition 1\n\n';
const rendered = Markdown.render(source).trim();
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<p>Term 1</p>\n<div class='blank'></div><div class='blank'></div>\n<p>Definition 1</p>`);
});
});

View File

@@ -0,0 +1,47 @@
/* eslint-disable max-lines */
const Markdown = require('naturalcrit/markdown.js');
describe('Hard Breaks', ()=>{
test('Single Break', function() {
const source = ':\n\n';
const rendered = Markdown.render(source).trim();
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<div class='blank'></div>`);
});
test('Double Break', function() {
const source = '::\n\n';
const rendered = Markdown.render(source).trim();
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<div class='blank'></div><div class='blank'></div>`);
});
test('Triple Break', function() {
const source = ':::\n\n';
const rendered = Markdown.render(source).trim();
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<div class='blank'></div><div class='blank'></div><div class='blank'></div>`);
});
test('Many Break', function() {
const source = '::::::::::\n\n';
const rendered = Markdown.render(source).trim();
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<div class='blank'></div><div class='blank'></div><div class='blank'></div><div class='blank'></div><div class='blank'></div><div class='blank'></div><div class='blank'></div><div class='blank'></div><div class='blank'></div><div class='blank'></div>`);
});
test('Multiple sets of Breaks', function() {
const source = ':::\n:::\n:::';
const rendered = Markdown.render(source).trim();
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<div class='blank'></div><div class='blank'></div><div class='blank'></div>\n<div class='blank'></div><div class='blank'></div><div class='blank'></div>\n<div class='blank'></div><div class='blank'></div><div class='blank'></div>`);
});
test('Break directly between two paragraphs', function() {
const source = 'Line 1\n::\nLine 2';
const rendered = Markdown.render(source).trim();
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<p>Line 1</p>\n<div class='blank'></div><div class='blank'></div>\n<p>Line 2</p>`);
});
test('Ignored inside a code block', function() {
const source = '```\n\n:\n\n```\n';
const rendered = Markdown.render(source).trim();
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<pre><code>\n:\n</code></pre>`);
});
});

View File

@@ -322,9 +322,9 @@ describe('Injection: When an injection tag follows an element', ()=>{
});
it('Renders an image element with injected style', function() {
const source = '![alt text](http://i.imgur.com/hMna6G0.png){position:absolute}';
const source = '![alt text](https://i.imgur.com/hMna6G0.png){position:absolute}';
const rendered = Markdown.render(source).trimReturns();
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe('<p><img style="position:absolute;" src="http://i.imgur.com/hMna6G0.png" alt="alt text"></p>');
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe('<p><img style="--HB_src:url(https://i.imgur.com/hMna6G0.png); position:absolute;" src="https://i.imgur.com/hMna6G0.png" alt="alt text"></p>');
});
it('Renders an element modified by only the first of two consecutive injections', function() {
@@ -343,19 +343,19 @@ describe('Injection: When an injection tag follows an element', ()=>{
it('Renders an image with added attributes', function() {
const source = `![homebrew mug](https://i.imgur.com/hMna6G0.png) {position:absolute,bottom:20px,left:130px,width:220px,a="b and c",d=e}`;
const rendered = Markdown.render(source).trimReturns();
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<p><img style="position:absolute; bottom:20px; left:130px; width:220px;" src="https://i.imgur.com/hMna6G0.png" alt="homebrew mug" a="b and c" d="e"></p>`);
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<p><img style="--HB_src:url(https://i.imgur.com/hMna6G0.png); position:absolute; bottom:20px; left:130px; width:220px;" src="https://i.imgur.com/hMna6G0.png" alt="homebrew mug" a="b and c" d="e"></p>`);
});
it('Renders an image with "=" in the url, and added attributes', function() {
const source = `![homebrew mug](https://i.imgur.com/hMna6G0.png?auth=12345&height=1024) {position:absolute,bottom:20px,left:130px,width:220px,a="b and c",d=e}`;
const rendered = Markdown.render(source).trimReturns();
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<p><img style="position:absolute; bottom:20px; left:130px; width:220px;" src="https://i.imgur.com/hMna6G0.png?auth=12345&height=1024" alt="homebrew mug" a="b and c" d="e"></p>`);
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<p><img style="--HB_src:url(https://i.imgur.com/hMna6G0.png?auth=12345&height=1024); position:absolute; bottom:20px; left:130px; width:220px;" src="https://i.imgur.com/hMna6G0.png?auth=12345&height=1024" alt="homebrew mug" a="b and c" d="e"></p>`);
});
it('Renders an image and added attributes with "=" in the value, ', function() {
const source = `![homebrew mug](https://i.imgur.com/hMna6G0.png) {position:absolute,bottom:20px,left:130px,width:220px,a="b and c",d=e,otherUrl="url?auth=12345"}`;
const rendered = Markdown.render(source).trimReturns();
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<p><img style="position:absolute; bottom:20px; left:130px; width:220px;" src="https://i.imgur.com/hMna6G0.png" alt="homebrew mug" a="b and c" d="e" otherUrl="url?auth=12345"></p>`);
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`<p><img style="--HB_src:url(https://i.imgur.com/hMna6G0.png); position:absolute; bottom:20px; left:130px; width:220px;" src="https://i.imgur.com/hMna6G0.png" alt="homebrew mug" a="b and c" d="e" otherUrl="url?auth=12345"></p>`);
});
});

View File

@@ -315,21 +315,21 @@ describe('Normal Links and Images', ()=>{
const source = `![alt text](url)`;
const rendered = Markdown.render(source).trimReturns();
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(dedent`
<p><img src="url" alt="alt text"></p>`.trimReturns());
<p><img src="url" alt="alt text" style="--HB_src:url(url);"></p>`.trimReturns());
});
it('Renders normal images with a title', function() {
const source = 'An image ![alt text](url "and title")!';
const rendered = Markdown.render(source).trimReturns();
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(dedent`
<p>An image <img src="url" alt="alt text" title="and title">!</p>`.trimReturns());
<p>An image <img src="url" alt="alt text" style="--HB_src:url(url);" title="and title">!</p>`.trimReturns());
});
it('Applies curly injectors to images', function() {
const source = `![alt text](url){width:100px}`;
const rendered = Markdown.render(source).trimReturns();
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(dedent`
<p><img style="width:100px;" src="url" alt="alt text"></p>`.trimReturns());
<p><img style="--HB_src:url(url); width:100px;" src="url" alt="alt text"></p>`.trimReturns());
});
it('Renders normal links', function() {

View File

@@ -153,6 +153,18 @@ module.exports = [
gen : dedent`
![cat warrior](https://s-media-cache-ak0.pinimg.com/736x/4a/81/79/4a8179462cfdf39054a418efd4cb743e.jpg) {width:325px,mix-blend-mode:multiply}`
},
{
name : 'Image Wrap Left',
icon : 'fac image-wrap-left',
gen : dedent`
![homebrewery_mug](http://i.imgur.com/hMna6G0.png) {width:280px,margin-right:-3cm,wrapLeft}`
},
{
name : 'Image Wrap Right',
icon : 'fac image-wrap-right',
gen : dedent`
![homebrewery_mug](http://i.imgur.com/hMna6G0.png) {width:280px,margin-left:-3cm,wrapRight}`
},
{
name : 'Background Image',
icon : 'fas fa-tree',

View File

@@ -156,6 +156,19 @@ body { counter-reset : page-numbers; }
break-inside : avoid;
}
/* Wrap Text */
.wrapLeft {
shape-outside : var(--HB_src);
float : right;
shape-margin : 0.2cm;
}
.wrapRight {
shape-outside : var(--HB_src);
float : left;
shape-margin : 0.2cm;
}
/* Watermark */
.watermark {
position : absolute;
@@ -236,7 +249,7 @@ body { counter-reset : page-numbers; }
left : 50%;
width : 50%;
height : 50%;
transform : translateX(-50%) translateY(50%) rotate(calc(-1deg * var(--rotation))) scaleX(calc(1 / var(--scaleX))) scaleY(calc(1 / var(--scaleY)));
transform : translateX(-50%) translateY(50%) scaleX(calc(1 / var(--scaleX))) scaleY(calc(1 / var(--scaleY))) rotate(calc(-1deg * var(--rotation)));
}
& img {
position : absolute;