Commit Graph

1272 Commits

Author SHA1 Message Date
schroda
cc4bf7bb32 Fix initial infinite swr request for pages > 1 (#367)
In case more than 1 page was requested for the initial request, there was a problem in case the first page already had no results.
In that case the request for the second page always returned with the "isLoadMore" and "isLoading" flag set to true.
Thus, incorrectly indicating that the request is still active.
The "actual" request was already finished, but internally the "isLoadMore" flag was set incorrectly due to not considering if an actual request is active.
2023-06-16 00:14:22 +02:00
schroda
dcd5302a26 Fix/source mangas white screen when directly open page via url (#362)
* Correctly handle missing location state

In case the view gets opened directly via url, there won't be any location state.
This leads to a TypeError when trying to get "contentType" from the location state.
Issue was introduced with 4e8813b526 where the function was adapted incorrectly with code that will never work (good job me KEKW)

* Add info about dev mode + strict mode issue
2023-06-10 00:42:26 +02:00
schroda
26b48f15c5 Fix/library settings global update categories empty dialog after updating (#361)
* Prevent dialog not to showing any categories after updating them

After updating to react v18 the dialog categories were empty after updating the category changes

* Immediately close the dialog after starting update

Catalog was open as long as the update was running

* Remove unnecessary state
2023-06-10 00:42:10 +02:00
schroda
63c1ac95eb Feature/remove use back to util (#360)
* Remove "useBackTo"

Not needed

* Use browser back navigation to close the reader

This will cause the previous page (manga or updates) to be opened instead of always opening the manga page
2023-06-08 14:25:24 +02:00
schroda
87de016d6f Prevent chapter revalidation on focus event in the Reader (#359)
This caused the reader to scroll back to the beginning of the current page.
And with the latest changes of 7f83bb9a0a the loading state was shown.
2023-06-08 13:56:46 +02:00
schroda
bbdbccf235 Prevent chapter revalidation on focus event in the Reader (#359)
This caused the reader to scroll back to the beginning of the current page.
And with the latest changes of 7f83bb9a0a the loading state was shown.
2023-06-08 13:56:25 +02:00
schroda
7f83bb9a0a Do not use stale chapter data for the reader (#358)
This caused the chapter to be loaded with stale data (the old lastPageRead state) and then jumping to the actual lastPageRead after the latest data was received.

It's not possible to mutate the chapter when updating lastPageRead since this causes the reader to always jump back to the just set lastPageRead when scrolling
2023-06-08 13:46:55 +02:00
schroda
67e554ede6 Prevent updating "lastPageRead" of chapter to the initial chapters "lastPageRead" (#357)
This could cause racing conditions with the chapter load which lead to the lastPageRead to be reset to 0
2023-06-08 13:43:58 +02:00
schroda
21174dc04a Add the option to ignore SWR stale data (#356) 2023-06-08 13:40:50 +02:00
schroda
f979d207e8 Open reader via the correct url when using resume FAB (#355)
With the recent update to react-router-dom v6 the route "manga/:mangaId/chapter/:chapterIndex/page/:pageIndex" doesn't get matched anymore.
The "pageIndex" is also unnecessary since it doesn't get used and instead the chapters "lastReadPage" property gets used to resume the chapter.
2023-06-08 13:40:38 +02:00
schroda
cce6ec0113 Preserve "SourceMangas" location state (#354)
Due to setting the "defaultBackTo" url the back button was a Link instead of a normal Button.
The Link causes the page to get opened like it's the first time and to get put on top of the browsers history stack. Instead of actually going back in the history.
Thus, the previous location state of the "SourceMangas" page was lost and the content type (browse, latest, filter) couldn't be reopened.
2023-06-08 13:40:08 +02:00
schroda
0446a01e85 Remove unused dependency "web-vitals" (#353)
Was required by CRA
2023-06-05 01:49:13 +02:00
schroda
4b83ccc889 Feature/use alias for imports (#352)
* Use alias "@" for imports

* Use alias "@" for imports - Fix imports

* Use alias "@" for imports - Prevent faulty "import/extensions" linting issue

For some reason the rule throws an error for alias imports

* Use alias "@" for imports - Update "no-relative-imports" eslint rule
2023-06-05 01:42:39 +02:00
schroda
1ec6d77598 Fix/library title size info initial render flickering (#350)
* Rename variable

* Hide size tag until tabs data was loaded

The wrong loading state (mangas) was being used to check if the size tag can be shown.
2023-06-05 01:24:56 +02:00
schroda
00e403ce09 Use correct endpoint for deleting downloaded chapter (#351)
Instead of deleting the downloaded chapter, a request was made to remove the download from the download queue
2023-06-05 01:23:40 +02:00
schroda
bc99728dcd Feature/migrate to vite (#349)
* Install dependencies

* Remove dependency react-scripts

* Remove dependency "@babel/plugin-proposal-private-property-in-object"

Was necessary to prevent a react-scripts warning.

* Update scripts in package.json

* Add vite config

* Move "public/index.html" to root folder

* Remove "%PUBLIC_URL%" occurrences

* Link "src/index.tsx" in "index.html"

* Update tsconfig target to "esnext"

* Target latest LTS node version (v18.16.0)

* Add "@types/node" dependency
2023-06-05 00:58:21 +02:00
schroda
fa614a19d2 Update dependency "typescript" to v5.x (#348)
Update to 5.1.3
2023-06-04 21:42:41 +02:00
schroda
57b1c0f680 Update dependency "eslint" to v8.42.0 (#347) 2023-06-04 21:41:57 +02:00
schroda
61975b5c49 Feature/update dependency react to v18.x (#346)
* Update dependency "react" to v18.x

Update to v18.2.0

* Update dependency "react" to v18.x - Fix some dependency version issue

Something caused weird tsc issues, most likely a version mismatch since it got fixed by doing a clean install (deleting node_modules folder, yarn.lock and clearing the cache) of the dependencies

* Update dependency "react" to v18.x - Fix "i18n" tsc issues

* Update dependency "react" to v18.x - Fix tsc issue

Typography can only have a single child

* Update dependency "react" to v18.x - Prevent build warning

TODO: migrate to Vite

Gets used without being declared as a dependency.
Since CRA is unmaintained this will not get fixed.

* Update dependency "react" to v18.x - Use "createRoot"

* Update dependency "react" to v18.x - Fix dnd in strict mode
2023-06-04 21:40:04 +02:00
schroda
62bf6d66dc Update dependency "react-virtuoso" to v4.x (#345)
Update to v4.3.8
2023-06-04 21:38:41 +02:00
schroda
f2ac73891c Update dependency "file-selector" to v0.6.0 (#344) 2023-06-04 21:37:21 +02:00
schroda
c6f7cd7731 Feature/update dependency web vitals to v3.x (#343)
* Update dependency "@fontsource/roboto" to v5.x

Update to 5.0.2

* Update dependency "web-vitals" to v3.x

Update to 3.3.2
2023-06-04 21:35:39 +02:00
schroda
548b746ee4 Update dependency "@fontsource/roboto" to v5.x (#342)
Update to 5.0.2
2023-06-04 21:33:28 +02:00
schroda
7f4ec7a30c Update dependency "@mui/icons-material" to v5.11.16 (#341) 2023-06-04 21:31:49 +02:00
schroda
4e8813b526 Feature/update dependency react router dom to v6.x (#340)
* Update dependency "react-router-dom" to v6.x

Update to v6.11.2

* Update dependency "react-router-dom" to v6.x - Replace "Switch" with "Routes"

* Update dependency "react-router-dom" to v6.x - Relative paths

* Update dependency "react-router-dom" to v6.x - Nested routes

* Update dependency "react-router-dom" to v6.x - Prevent route warnings

 - Route without an element causes a warning message.
 - Routes with non-matching Route causes a warning message.

* Update dependency "react-router-dom" to v6.x - Replace "useHistory" with "useNavigate"

* Update dependency "react-router-dom" to v6.x - Fix "Link" usage

* Update dependency "react-router-dom" to v6.x - Overwrite "useParams" and "useLocations" typing

For both functions it's the users fault if they are getting used incorrectly.
It's inconvenient to always have to make sure the params exist (useParam) or to cast the return object to a specific type (useLocation)

 - "useParams": Make generic type non-optional
 - "useLocation": Add generic type

* Update dependency "react-router-dom" to v6.x - Fix use-query-params provider
2023-06-04 21:30:15 +02:00
schroda
fd5a1e240a Remove unused dependency "query-string" (#339)
Was required for "use-query-params" pre v2.x
2023-06-04 21:28:28 +02:00
schroda
6b05083d95 Feature/update dependency use query params to v2.x (#338)
* Update dependency "use-query-params" to v2.x

Update to 2.2.1

* Update dependency "use-query-params" to v2.x - Fix provider

Update to 2.2.1
2023-06-04 21:27:09 +02:00
schroda
ce02802888 Update dependency "@emotion" to v11.11.0 (#337) 2023-06-04 21:25:34 +02:00
schroda
c63b4acdf8 Update dependency "i18n" to v22.5.0 (#336) 2023-06-04 21:24:09 +02:00
schroda
31f2e0f839 Update dependency "react-beautiful-dnd" to v13.1.1 (#335) 2023-06-04 21:22:02 +02:00
schroda
8655fe1f6d Update dependency "@typescript-eslint" to v5.59.8 (#334) 2023-06-04 21:16:56 +02:00
schroda
647260f18c Update dependency "prettier" to v2.8.8 (#333) 2023-06-04 21:14:33 +02:00
schroda
1ce27ea939 Feature/update dependency mui to v5.x (#332)
* Update dependency "mui" to v5.x

Update to v5.13.3

Fixes issue of "SxProps" not being exported by "@mui/material"

* Update dependency "mui" to v5.x - Fix grid item size

Update to v5.13.3

Fixes issue of "SxProps" not being exported by "@mui/material"

* Update dependency "mui" to v5.x - Replace "ListItem" with "ListItemButton"

* Update dependency "mui" to v5.x - Fix tsc issue

* Update dependency "mui" to v5.x - Prevent reader white screen

Due to "initialChapter" being a function returning an object, it causes a re-render everytime due to it (the object) being used as a dependency.
This caused a white screen when skipping to the previous or next chapter
2023-06-04 21:13:07 +02:00
schroda
6911f60eb4 Feature/remove dependency mui system (#331)
* Remove duplicated dependency "@mui/system"

Already included in "@mui/material"

* Remove duplicated dependency "@mui/system" - Fix theme "custom" palette

Already included in "@mui/material"

* Remove duplicated dependency "@mui/system" - Fix imports

Already included in "@mui/material"
2023-06-04 21:08:39 +02:00
schroda
2a6950b015 Feature/remove dependency mui styles (#330)
* Remove deprecated dependency "@mui/styles"

* Remove deprecated dependency "@mui/styles" - Remove usage
2023-06-04 20:58:44 +02:00
schroda
3a82fd0abb Remove unused dependency "react-lazyload" (#329) 2023-06-04 20:57:13 +02:00
schroda
9e8c4254bd Remove unused dependency "p-queue" (#328) 2023-06-04 20:53:35 +02:00
schroda
9ae7b2e592 Remove console log (#327)
The 2nd time this happens... AINTNOWAY
2023-06-04 01:03:45 +02:00
schroda
0fb204f141 Feature/request manager remove get client usage (#325)
* Remove "getClient" usage from "metadata" util

* Remove "getClient" usage from "useRefreshManga" hook

* Remove "getClient" usage from "isDupChapter" util function

* Use correct endpoint for setting category metadata

"/meta" suffix was missing from url

* Use correct http method for updating manga metadata
2023-06-04 00:50:58 +02:00
schroda
207a87f3e9 Fix import backup file request (#326)
The file wasn't send correctly due to converting it to a string.
2023-06-04 00:32:08 +02:00
schroda
eaa8392789 Fix axios requests (#324)
The response was the expected data and not the actual axios response.
Thus, there was no "data" property and trying to use it could lead to errors like e.g. TypeErrors.
2023-06-04 00:30:48 +02:00
Alexandre
d60ed0c055 Add fit page to window reader setting (#323)
* Add fit page to window reader setting

* Renamed option and conditional rendering

* Rename translation key
2023-06-03 20:53:52 +02:00
schroda
46a7ff6e3b Feature/refactor source mangas screen (#314)
* Refactor "SourceMangas"

* Refactor "SourceMangas" - Show loading placeholder on filter reset or submit

Due to the url being the same for all "filter requests" the loading state doesn't get changed by SWR.
Instead, only the "isValidating" state gets updated.

* Refactor "SourceMangas" - Update routing

* Refactor "SourceMangas" - Prevent duplicated mangas in grid

There is a possibility that the "latest" endpoint returns the same manga on different pages

* Always set the toolbar content on the manga page

"setAction" wasn't called on the manga page, thus, in case the previous page didn't unset the action, it never got unset

* Rename source content type "Browse" to "Popular"
2023-05-28 12:16:06 +02:00
schroda
1480507c35 Fix/source options filters state (#320)
* Prevent mutating passed object

Causes the options to not get reset correctly and/or to get set without "submitting" them

* Always use local filter state instead of requested one

The local filter state sometimes got overwritten by the state from the server response.
This resulted in showing an incorrect filter state while still sending the correct one to the server when filtering

* Update text filter faster

The timeout (2.5s) is too long and can cause the filter state to not have been updated by the time the filters are getting submitted.
Thus, causing a request with outdated filters and requiring a "re-submit" for the actual filters to get used.
2023-05-28 02:18:37 +02:00
schroda
f852255d82 Add additional info about SWR infinite load to response (#321)
The SWR response only has "isLoading" and "isValidating".
"isLoading" only indicates the initial load.
For every subsequent load, only "isValidating" gets set to true.
2023-05-28 02:18:23 +02:00
schroda
606ee9de2d RequestManager make requests abortable - Fix missed usages (#318) 2023-05-23 13:54:14 +02:00
schroda
c32cb53592 Feature/improve refactored global search performance (#317)
* Move "search term" retrieval to parent component

Preparation for reducing re-renders.
Each "SourceSearchPreview" component would re-render at each key press.

* Memoize "SourceSearchPreview" components

Only re-render in case the "searchString" (or other props) changed.
Due to the query the components rendered everytime a key was pressed in the search field

* Hide "SourceSearchPreview" immediately in case the search query is empty

Do not wait for the debounced "searchString" in case it will be an empty string anyways

* Abort outdated search requests

In case many sources are being searched, the outdated requests can block the new ones.
To prevent this, the old ones will get canceled.

* Debounce source search result state changes

In case multiple search requests are finished in short succession, each state update would trigger an update.
By debouncing these updates, the search results do not "jump around" as much, since the sources get sorted by search request state and result
2023-05-23 13:35:09 +02:00
schroda
0d36d2dcfb Feature/request manager make requests abortable (#316)
* Make requests abortable

* Make requests abortable - Fix usage
2023-05-23 13:27:38 +02:00
schroda
95ceac335b Update to axios v1.x (#315)
Update to axious v1.4.0
2023-05-23 13:25:48 +02:00
schroda
84433ffff8 Support SWR infinite requests via POST (#313)
* Support SWR infinite requests via POST

* Correct "source quick-search" request
2023-05-22 14:04:05 +02:00