1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-03-05 13:20:20 -05:00

Compare commits

..

269 Commits

Author SHA1 Message Date
Mark McDowall
720371c1fd Upgraded SixLabors.ImageSharp to 3.1.11 2025-08-01 09:20:12 -07:00
Weblate
6f1d461dad Multiple Translations updated by Weblate
ignore-downstream

Co-authored-by: Weblate <noreply@weblate.org>
Co-authored-by: wavybox <leeviervoemil@gmail.com>
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/fi/
Translation: Servarr/Sonarr
2025-07-07 17:38:19 -07:00
Stevie Robinson
6ccab3cfc8 Fixed: Improve parsing of bit depth 2025-07-07 17:37:45 -07:00
Mark McDowall
5e47cc3baa Fixed: Improve parsing of 4-digit absolute numbering batches 2025-07-07 17:37:19 -07:00
Mark McDowall
78ca30d1f8 Don't log debug messages for API key validation
Closes #7934
2025-07-07 17:37:10 -07:00
Mark McDowall
f9d0abada3 Fixed: Manual Import could lead to duplicate notifications
Closes #7922
2025-07-07 17:37:02 -07:00
Mark McDowall
4bdb0408f1 Return error if Manual Import called without items
Closes #7942
2025-07-07 17:36:53 -07:00
Stevie Robinson
40ea6ce4e5 New: Persist queue removal option in browser
Closes #7938
2025-07-07 17:36:45 -07:00
nuxen
ccf33033dc Fixed: xvid not always detected correctly 2025-07-07 17:36:06 -07:00
Mark McDowall
996c0e9f50 Upgrade MonoTorrent to 3.0.2
Closes #7270
2025-07-07 17:35:37 -07:00
Stevie Robinson
8b7f9daab0 Improve Emby/Jellyfin connection test 2025-07-07 17:35:32 -07:00
Mark McDowall
dfb6fdfbeb Change authentication to Forms if set to Basic 2025-07-07 17:34:34 -07:00
Mark McDowall
29d0073ee6 Make remove root folder Sonarr specific 2025-07-07 17:34:34 -07:00
Mark McDowall
9cf6be32fa Fixed deleting tags from UI 2025-07-07 17:34:34 -07:00
Ben Martin
fee3f8150e New: Option to add series tags when adding torrents to qbit
Closes #7930
2025-07-07 17:34:25 -07:00
nuxen
010bbbd222 Support for multiple seriesIds in Rename API endpoint 2025-07-07 17:33:40 -07:00
ricecrackerfiend
d3c3a6ebce Fixed: Prevent long series titles from cutting off synopsis
Closes #7875
2025-07-07 17:33:15 -07:00
Stevie Robinson
f26344ae75 New: Allow user to define additional rejected extensions
Closes #7721
2025-07-07 17:32:34 -07:00
Weblate
034f731308 Multiple Translations updated by Weblate
ignore-downstream

Co-authored-by: Gallyam Biktashev <gallyamb@gmail.com>
Co-authored-by: Gjur0 <denjy0@gmail.com>
Co-authored-by: GkhnGRBZ <gkhn.gurbuz@hotmail.com>
Co-authored-by: HanaO00 <lwin24452@gmail.com>
Co-authored-by: Havok Dan <havokdan@yahoo.com.br>
Co-authored-by: Hugoren Martinako <aumpfbahn@gmail.com>
Co-authored-by: Marius Nechifor <flm.marius@gmail.com>
Co-authored-by: Weblate <noreply@weblate.org>
Co-authored-by: fordas <fordas15@gmail.com>
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/ca/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/es/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/fr/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/hr/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/pt_BR/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/ro/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/ru/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/tr/
Translation: Servarr/Sonarr
2025-07-07 17:32:02 -07:00
Mark McDowall
4b50861a6b Revert "Added 'libicu72' as a required package for Debian install script"
This reverts commit 103b1335b9.
2025-06-10 06:33:52 -07:00
Weblate
f977b8ba1b Multiple Translations updated by Weblate
ignore-downstream

Co-authored-by: Weblate <noreply@weblate.org>
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/
Translation: Servarr/Sonarr
2025-06-09 17:22:15 -07:00
Bogdan
8374ebc25b Fixed: Buttons cutoff when page toolbar shows all buttons on smaller screens 2025-06-09 17:16:19 -07:00
Michael Peleshenko
71851d038c Fixed: Prevent series without IMDB ID from being removed erroneously 2025-06-09 17:15:36 -07:00
Stevie Robinson
9ffcd141a5 Fixed: Include network drive types in Disk Space 2025-06-09 17:14:13 -07:00
Bogdan
a6f50408f2 Fixed: Quality sliders on some browsers 2025-06-09 17:13:41 -07:00
Bogdan
6e43b08dab Typings for iCal state options 2025-06-09 17:13:17 -07:00
Bogdan
90c4791d5f Fix status for grabbed episodes part of grouped calendar events 2025-06-09 17:13:17 -07:00
v3DJG6GL
030910babc New: Map Swiss German to German 2025-06-09 17:12:58 -07:00
Stevie Robinson
59af86cea4 New: Rename Series Monitoring to Episode Monitoring 2025-06-09 17:12:33 -07:00
Bogdan
4cb25228b6 Cleanup series title normalizer 2025-06-09 17:12:09 -07:00
Stevie Robinson
bf34b43094 Fixed validation for Remote Path Mapping 2025-06-09 17:12:04 -07:00
Bogdan
1cdca8ef3e Follow redirects for usenet grabs on non-prod builds 2025-06-09 17:11:26 -07:00
Cybertinus
103b1335b9 Added 'libicu72' as a required package for Debian install script 2025-06-09 17:11:17 -07:00
Ghworg
b3d830c475 Fixed: Bitrate showing as Megabytes instead of Megabits
Closes #7879
2025-06-09 17:10:33 -07:00
Mark McDowall
a279240335 Fixed: Trakt Import List authentication after 24 hours
Closes #7874
2025-06-09 17:09:53 -07:00
Mark McDowall
3eed84c679 Prevent should refresh series from failing
Fixed: Prevent error checking if series should be refreshed from failing refresh series task
2025-06-09 17:09:41 -07:00
Mark McDowall
51c17fd312 New: Update wording when removing a root folder
Closes #7868
2025-06-09 17:09:28 -07:00
Mark McDowall
70c74fc176 Fixed: Escape backticks in discord notifications
Closes #7836
2025-06-09 17:09:23 -07:00
Weblate
cfda24536c Multiple Translations updated by Weblate
ignore-downstream

Co-authored-by: Gallyam Biktashev <gallyamb@gmail.com>
Co-authored-by: GkhnGRBZ <gkhn.gurbuz@hotmail.com>
Co-authored-by: Havok Dan <havokdan@yahoo.com.br>
Co-authored-by: Ilbebino <tommasobellandi08@gmail.com>
Co-authored-by: NanderTGA <nander.roobaert@gmail.com>
Co-authored-by: Weblate <noreply@weblate.org>
Co-authored-by: fordas <fordas15@gmail.com>
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/es/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/it/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/nl/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/pt_BR/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/ru/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/tr/
Translation: Servarr/Sonarr
2025-06-09 16:56:03 -07:00
Bogdan
14e324ee30 Use the thrown exception in http timeout handling 2025-05-22 01:58:54 +01:00
Bogdan
32ba06ecd0 Bump babel, fontawesome icons, fuse.js, react-lazyload, react-use-measure and react-window 2025-05-22 01:58:17 +01:00
Bogdan
61807fede0 Bump core-js to 3.42 2025-05-22 01:58:17 +01:00
Bogdan
2a1efe5f59 Fixed: Searching all missing from Wanted 2025-05-22 01:58:10 +01:00
Bogdan
0f43f8c9f6 Fixed: Loading suggestions for header search input 2025-05-22 01:58:04 +01:00
Stevie Robinson
a853c537db new: ignore volumes containing .timemachine from Disk Space 2025-05-22 01:57:50 +01:00
Bogdan
f9dccd6ec7 New: Include series poster for Apprise 2025-05-22 01:57:41 +01:00
v3DJG6GL
72b3b825eb New: Add Romansh language 2025-05-21 17:57:33 -07:00
carrossos
818ae02a7a Treat HTTP 410 response for failed download similarly to HTTP 404 2025-05-21 17:57:11 -07:00
Stevie Robinson
5ba3ff5987 New: Don't allow remote path to start with space 2025-05-21 17:56:15 -07:00
Mark McDowall
e38deb3422 Increase maximum backup restoration size to 5GB
Closes #7840
2025-05-22 01:52:30 +01:00
Bogdan
f35888e053 Avoid varying logging message template between calls 2025-05-22 01:52:24 +01:00
Stevie Robinson
a50d256264 Ensure Custom Format Maximum Size won't overflow 2025-05-21 17:52:16 -07:00
Weblate
70165bddc8 Multiple Translations updated by Weblate
ignore-downstream

Co-authored-by: Gallyam Biktashev <gallyamb@gmail.com>
Co-authored-by: GkhnGRBZ <gkhn.gurbuz@hotmail.com>
Co-authored-by: Havok Dan <havokdan@yahoo.com.br>
Co-authored-by: Hugoren Martinako <aumpfbahn@gmail.com>
Co-authored-by: Oskari Lavinto <olavinto@protonmail.com>
Co-authored-by: Weblate <noreply@weblate.org>
Co-authored-by: fordas <fordas15@gmail.com>
Co-authored-by: warkurre86 <tom.novo.86@gmail.com>
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/ca/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/cs/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/es/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/fi/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/pt_BR/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/ru/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/tr/
Translation: Servarr/Sonarr
2025-05-22 01:41:49 +01:00
Sonarr
4258e94e90 Automated API Docs update
ignore-downstream
2025-04-28 17:18:44 -07:00
Mark McDowall
066b39032b Fixed: Parsing titles with 3 digit season numbers
Closes #7826
2025-04-28 17:14:19 -07:00
Mark McDowall
728df146ad Improve messaging when NZB contains invalid XML
Closes #7829
2025-04-28 17:14:09 -07:00
Bogdan
751a07bb40 Fixed sidebar flickering on mobile 2025-04-28 17:13:59 -07:00
Bogdan
d4ce60bd41 Bump caniuse db 2025-04-28 17:13:43 -07:00
Bogdan
4b868d3f06 Bump core-js to 3.41 2025-04-28 17:13:43 -07:00
Bogdan
817d13e85c Update default log level message 2025-04-28 17:12:51 -07:00
Bogdan
fae014c8be Fix various typos 2025-04-28 17:12:41 -07:00
Bogdan
2fa02472ee Fixed auto tagging tag specification 2025-04-28 17:12:33 -07:00
Bogdan
7c3c577811 Fixed selecting No Change for quality profile inputs 2025-04-28 17:12:10 -07:00
Bogdan
9fdf545f47 Improve typings for enhanced select options 2025-04-28 17:11:50 -07:00
Bogdan
e537a2dc8f Improve typings for Select Input options 2025-04-28 17:11:50 -07:00
Bogdan
1047e71b7d Log when expected episode file is missing from disk on upgrade 2025-04-28 17:11:25 -07:00
Bogdan
415498efb3 Fixed free space and missing for selected root folder value 2025-04-28 17:11:13 -07:00
Bogdan
cf08e947c4 Fixed grouping qualities inside a quality profile 2025-04-28 17:10:54 -07:00
Bogdan
bb872ee35b Add SeriesFolderController for v5 2025-04-28 17:10:09 -07:00
Bogdan
ab0d8352e8 Clean up progress log messages in ImportListSyncService 2025-04-28 17:09:32 -07:00
Bogdan
9683b0af35 Pass messages with arguments to NLog in LoggerExtensions 2025-04-28 17:09:32 -07:00
Bogdan
76b1130b68 Fixed: Sending Manual Interaction Needed for Custom Script with unparsed series
Closes #7807
2025-04-28 17:09:14 -07:00
Jamie Bartlett
5be58249f8 New: Auto tag based on network
Closes #7793
2025-04-28 17:08:57 -07:00
Weblate
4d67b8ae2b Multiple Translations updated by Weblate
ignore-downstream

Co-authored-by: Gallyam Biktashev <gallyamb@gmail.com>
Co-authored-by: GkhnGRBZ <gkhn.gurbuz@hotmail.com>
Co-authored-by: Havok Dan <havokdan@yahoo.com.br>
Co-authored-by: Hugoren Martinako <aumpfbahn@gmail.com>
Co-authored-by: José Fonseca <jpof88@gmail.com>
Co-authored-by: Weblate <noreply@weblate.org>
Co-authored-by: fordas <fordas15@gmail.com>
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/ca/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/es/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/pt/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/pt_BR/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/ru/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/tr/
Translation: Servarr/Sonarr
2025-04-28 17:08:12 -07:00
ojmaster
66633b9b07 New: Add Urdu language 2025-04-07 17:02:48 -07:00
Bogdan
4728fa29ef Fixed: Avoid requests without categories for FileList 2025-04-07 16:45:02 -07:00
Bogdan
9cb9c711be Fixed: Respect series type in Newznab/Torznab searches for specials
Closes #7783
2025-04-07 16:45:02 -07:00
Bogdan
d62eea604a Validation for tags label 2025-04-07 16:43:58 -07:00
Weblate
3185315343 Multiple Translations updated by Weblate
ignore-downstream

Co-authored-by: Hugoren Martinako <aumpfbahn@gmail.com>
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/ca/
Translation: Servarr/Sonarr
2025-04-07 16:43:11 -07:00
Mark McDowall
e52b68ee7d Fix issues with Floating UI 2025-04-07 16:42:47 -07:00
Bogdan
f7eece32e7 Log delete statements only once 2025-04-07 16:42:36 -07:00
Stevie Robinson
c96c47af9e Add size validation for Quality Profiles 2025-04-07 16:41:22 -07:00
Tim Gunter
a5999b1410 Add command-line argument and unattended mode for Debian installs 2025-04-07 16:40:53 -07:00
Mark McDowall
ac1bb497ef Fixed: Default runtime to 45 minutes if unavailable when importing episode files
Closes #7780
2025-04-07 16:38:33 -07:00
Mark McDowall
9bd619ccfe Update WikiUrl type in API docs
Closes #7788
2025-04-07 16:38:24 -07:00
Mark McDowall
dfbf12b711 Fixed: Delete orphaned extra and subtitle files during housekeeping
Closes #7785
2025-04-07 16:38:20 -07:00
Bogdan
0ae07898ba Fixed: Improve error message for queue items from Transmission 2025-04-07 16:38:09 -07:00
Stevie Robinson
2314d0b506 New: Ability to clone Import Lists
Closes #7758
2025-04-07 16:34:41 -07:00
Josh Archer
2093f08a57 Fixed: Include total space in root folder endpoint
Closes #7769
2025-04-07 16:33:44 -07:00
Bogdan
0a7ffb64f0 Save Publish Dates as UTC for grabbed episodes 2025-04-07 16:33:16 -07:00
Mark McDowall
41b65abd1d New: Show episode count in season interactive search modal
Closes #7747
2025-04-07 16:33:09 -07:00
Mark McDowall
0f904e0917 New: Prevent Remote Path Mapping local folder being set to System folder or '/'
Closes #7686
2025-04-07 16:32:50 -07:00
Mark McDowall
f8e57b0985 Fixed: Set output encoding to UTF-8 when running external processes
Closes #7622
2025-04-07 16:32:46 -07:00
Bogdan
9e774f4026 New: Indexer Flags in Webhook Import Notifications 2025-04-07 16:32:40 -07:00
Stevie Robinson
2acc4c8865 New: Indexer Flags in Webhook On Grab Notifications
Closes #7741
2025-04-07 16:32:13 -07:00
Weblate
0fcd92e441 Multiple Translations updated by Weblate
ignore-downstream

Co-authored-by: Gallyam Biktashev <gallyamb@gmail.com>
Co-authored-by: Hugoren Martinako <aumpfbahn@gmail.com>
Co-authored-by: José Fonseca <jpof88@gmail.com>
Co-authored-by: Oskari Lavinto <olavinto@protonmail.com>
Co-authored-by: Weblate <noreply@weblate.org>
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/ca/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/fi/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/pt/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/ru/
Translation: Servarr/Sonarr
2025-04-07 16:31:37 -07:00
Mark McDowall
b103005aa2 Add XML declaration and clean up Kodi metadata generation
Closes #7753
2025-03-24 19:40:20 -07:00
Sonarr
41b5118938 Automated API Docs update
ignore-downstream
2025-03-24 19:38:54 -07:00
Mark McDowall
c84699ed5d Fixed: Deleting series folder fails when files/folders aren't instantly removed
Closes #7749
2025-03-24 19:38:53 -07:00
Mark McDowall
bdd975da0f Fixed: Trakt yearly lists no longer supported
Closes #7759
2025-03-24 19:38:53 -07:00
Mark McDowall
08d1bcb351 Fixed: Series search input when URL base is configured 2025-03-24 19:32:11 -07:00
Mark McDowall
5fb632eb46 Fixed: Allow tables to scroll on tablets in portrait mode
Closes #7723
2025-03-24 19:30:31 -07:00
Mark McDowall
da29de4cfe Fixed: Don't allow pushed releases to bypass pending releases that recently expired
Closes #7725
2025-03-24 19:30:08 -07:00
Mark McDowall
83b2c9e97a New: Parse TAoE as release group exception
Closes #7736
2025-03-24 19:30:01 -07:00
Mark McDowall
095126bfe8 New: Parse UK date based release format
Closes #7695
2025-03-24 19:29:53 -07:00
Bogdan
6aee9c7fd5 Don't allow to set episode files with 'Original' language 2025-03-24 19:28:20 -07:00
Bogdan
20c2d59e9a Deprecate /api/v3/episodefile/editor 2025-03-24 19:28:20 -07:00
Bogdan
7ee90fb05d Bump Swashbuckle to 8.0.0 2025-03-24 19:28:20 -07:00
Bogdan
1a8ba51260 Improve Series Details loading 2025-03-24 19:28:11 -07:00
Stevie Robinson
2e66cd2a1e New: Add series progress to details header 2025-03-24 19:27:59 -07:00
Bogdan
6115236d38 Cleanup unused sorting fields for bulk manage providers 2025-03-24 19:27:24 -07:00
Bogdan
7ff8c9e18d New: Bulk manage Maximum Single Episode Age for indexers 2025-03-24 19:27:24 -07:00
Bogdan
f0e320f3aa Fixed: Priority validation for indexers and download clients 2025-03-24 19:27:24 -07:00
Bogdan
9f29b06ca4 Fixed: Close modal when deleting series from index 2025-03-24 19:26:47 -07:00
Bogdan
08c0c5aa30 Fixed: Manual importing queued items with seriesId to avoid title parsing 2025-03-24 19:26:39 -07:00
fezster
64956d7be7 New: Add HDR Type to XBMC metadata video stream details
(cherry picked from commit a7dbdadd2146b60efa7ebe8e2b65d32bc075232c)
Co-Authored-By: Bogdan <mynameisbogdan@users.noreply.github.com>
2025-03-24 19:26:28 -07:00
Sonarr
b598795262 Automated API Docs update
ignore-downstream
2025-03-24 19:25:51 -07:00
Weblate
9756a3df38 Multiple Translations updated by Weblate
ignore-downstream

Co-authored-by: Alex <despedo@gmail.com>
Co-authored-by: Gallyam Biktashev <gallyamb@gmail.com>
Co-authored-by: GkhnGRBZ <gkhn.gurbuz@hotmail.com>
Co-authored-by: Hugoren Martinako <aumpfbahn@gmail.com>
Co-authored-by: Lizandra Candido da Silva <lizandra.c.s@gmail.com>
Co-authored-by: Weblate <noreply@weblate.org>
Co-authored-by: fordas <fordas15@gmail.com>
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/ca/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/es/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/pt_BR/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/ru/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/tr/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/uk/
Translation: Servarr/Sonarr
2025-03-24 19:25:43 -07:00
Bogdan
94f64435f5 Fixed: Spinning icon on toggling series monitoring 2025-03-15 16:40:20 -07:00
Bogdan
a324052deb New: Display indexer in download failed details 2025-03-15 16:40:10 -07:00
Bogdan
e08c9d5501 Fixed: Inherit indexer, size and release group for marked as failed history 2025-03-15 16:40:10 -07:00
Mark McDowall
1449941471 Improve logging when login fails due to CryptographicException 2025-03-15 16:39:40 -07:00
Mark McDowall
28c4f0cef2 Remove react-popper 2025-03-15 16:39:19 -07:00
Mark McDowall
e199710c15 Fix multi-select checkboxes not appearing 2025-03-15 16:39:19 -07:00
Mark McDowall
e3a048790d Use floading UI for EnhancedSelectInput 2025-03-15 16:39:19 -07:00
Mark McDowall
6dc47755ec Use floating UI for ImportSeriesSelectSeries 2025-03-15 16:39:19 -07:00
Mark McDowall
01f7783519 Use floating UI for AutoSuggestInput 2025-03-15 16:39:19 -07:00
Mark McDowall
e9f59188b1 Use floating UI for Menu 2025-03-15 16:39:19 -07:00
Mark McDowall
a6e6b7518d Use floating UI for Tooltip
Fixed: Tooltips cutoff by edge of screen
Closes #7705
2025-03-15 16:39:19 -07:00
luzpaz
38cd63ec04 Fix typos 2025-03-15 16:39:09 -07:00
Bogdan
71f1593fd9 Fix import typo for QualityProfileName 2025-03-15 16:38:11 -07:00
Mark McDowall
3d951f6db8 Convert Updates to React Query 2025-03-15 16:38:01 -07:00
Mark McDowall
0f16837b59 Improve RestController usage for non-ID based items 2025-03-15 16:38:01 -07:00
Mark McDowall
f0d0eb9a7a Re-add repopulate reasons lost during TS conversion 2025-03-15 16:37:52 -07:00
Mark McDowall
608fc29086 Fixed: Unknown series slug redirecting back to home instad of error screen 2025-03-15 16:37:52 -07:00
Mark McDowall
8acd154206 Fixed: UI does not always reflect series being refreshed 2025-03-15 16:37:52 -07:00
Denis Gheorghescu
6f451b2206 New: Options to send Image and Metadata links for Pushcut Notifications
Co-authored-by: Mark McDowall <mark@mcdowall.ca>
2025-03-15 16:37:40 -07:00
Sonarr
3cb6f866cc Automated API Docs update
ignore-downstream
2025-03-15 16:37:07 -07:00
Weblate
649ed04f8a Multiple Translations updated by Weblate
ignore-downstream

Co-authored-by: GkhnGRBZ <gkhn.gurbuz@hotmail.com>
Co-authored-by: Havok Dan <havokdan@yahoo.com.br>
Co-authored-by: Oskari Lavinto <olavinto@protonmail.com>
Co-authored-by: Weblate <noreply@weblate.org>
Co-authored-by: fordas <fordas15@gmail.com>
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/es/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/fi/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/pt_BR/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/tr/
Translation: Servarr/Sonarr
2025-03-15 16:36:59 -07:00
Mark McDowall
fef00dccf8 Fix uTorrent after stylecop upgrade 2025-03-08 12:57:42 -08:00
Bogdan
cbc5127a14 Bump SixLabors.ImageSharp, Dapper, MailKit, Polly and Npgsql 2025-03-08 12:57:42 -08:00
Weblate
38746fc95b Multiple Translations updated by Weblate
ignore-downstream

Co-authored-by: Oskari Lavinto <olavinto@protonmail.com>
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/fi/
Translation: Servarr/Sonarr
2025-03-08 12:57:33 -08:00
Mark McDowall
24ce10006e Show Remove Failed option in torrent download clients 2025-03-08 12:34:14 -08:00
Mark McDowall
c034282f45 Fixed: Downloads failed for file contents will be removed from client 2025-03-08 12:34:14 -08:00
Stevie Robinson
b2214fd912 Align quality profile translations with Radarr 2025-03-08 12:34:06 -08:00
Stevie Robinson
4db4388236 Fixed: Improve rejected download handling 2025-03-08 12:33:59 -08:00
Mark McDowall
093ee5b88d New: Truncate button text
Closes #7691
2025-03-08 12:33:11 -08:00
Mark McDowall
f58dfc5605 Improve wrapping of text in sidebar 2025-03-08 12:33:11 -08:00
Mark McDowall
1c9a0232ad Fix log event details not closing 2025-03-08 12:33:03 -08:00
Mark McDowall
c86822b114 Upgrade 'eslint-plugin-react-hooks' to 5.2.0 2025-03-08 12:33:03 -08:00
Mark McDowall
5342416659 Convert Log Events to React Query 2025-03-08 12:33:03 -08:00
Mark McDowall
5d7c94f8e9 Upgrade StyleCop.Analyzers to Unstable 1.2.0.556 2025-03-08 12:33:03 -08:00
Bogdan
6d8c3f15b3 New: Recommend against using uTorrent 2025-03-08 12:32:52 -08:00
Weblate
efef9f88ff Multiple Translations updated by Weblate
ignore-downstream

Co-authored-by: Gallyam Biktashev <gallyamb@gmail.com>
Co-authored-by: Mark McDowall <mark@mcdowall.ca>
Co-authored-by: Weblate <noreply@weblate.org>
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/ru/
Translation: Servarr/Sonarr
2025-03-08 12:32:26 -08:00
Mark McDowall
8748cdb1bf Upgrade Microsoft.Data.SqlClient to 6.0.1 2025-03-01 20:54:19 -08:00
Stevie Robinson
7a9b6d3262 Remove information that Remove settings were moved to individual download clients 2025-03-01 20:54:10 -08:00
Stevie Robinson
c902735927 Enhance failed download warning for items not grabbed by Sonarr 2025-03-01 20:53:29 -08:00
Bogdan
156d306334 Fixed: Replace diacritics in Clean Title naming tokens
Closes #454
2025-03-01 20:53:04 -08:00
Bogdan
d09e7893b3 Fixed: Parsing some titles with ITA as Italian
(cherry picked from commit a3b1512552a8a5bc0c0d399d961ccbf0dba97749)
2025-03-01 20:52:46 -08:00
bakerboy448
3e2e8e9388 New: Parse 'FRA' and 'FRE' as French language
(cherry picked from commit 4ce98d689d7a7c5e33d4c63d78c099db379210fa)

Fixed: Parsing of French Language at end of release names

(cherry picked from commit f8a82dbb904acf68bc4b7fc9980f3765c8b88369)

Fixed: Parsing some titles with FRA and FRE as French

(cherry picked from commit a3b1512552a8a5bc0c0d399d961ccbf0dba97749)
2025-03-01 20:52:46 -08:00
Mark McDowall
99fc61e636 New: Add Azerbaijani, Uzbek and Malay languages
Closes #6285
Closes #7560
2025-03-01 20:52:18 -08:00
Bogdan
271979d637 Fix Watch List Sorting translation for Trakt settings 2025-03-01 20:52:06 -08:00
Weblate
b572a6f759 Multiple Translations updated by Weblate
ignore-downstream

Co-authored-by: GkhnGRBZ <gkhn.gurbuz@hotmail.com>
Co-authored-by: Oskari Lavinto <olavinto@protonmail.com>
Co-authored-by: Weblate <noreply@weblate.org>
Co-authored-by: keysuck <joshkkim@gmail.com>
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/fi/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/ko/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/tr/
Translation: Servarr/Sonarr
2025-03-01 20:51:56 -08:00
Mark McDowall
950330b091 Use yarn as package manager 2025-02-22 12:42:06 -08:00
Mark McDowall
8940ef8b81 Ensure scripts are executable 2025-02-22 12:42:06 -08:00
Mark McDowall
91bdf06214 Update LibHarmony to 2.3.5 2025-02-22 12:42:05 -08:00
Mark McDowall
5678f98344 API docs for v5 series 2025-02-22 12:42:05 -08:00
Mark McDowall
05d57aa913 Ensure API docs are generated before exiting 2025-02-22 12:42:05 -08:00
Mark McDowall
b22d598ebf Move test.sh to scripts folder 2025-02-22 12:42:05 -08:00
Bogdan
e22dd15443 Fixed: Avoid checking for free space if other specifications fail first 2025-02-22 12:42:05 -08:00
Stevie Robinson
1fa532dd3e Fixed: Don't return warning in title field for rejected downloads
Closes #7663
2025-02-22 12:42:00 -08:00
Bogdan
350dea10dd Fixed: Prevent 8/10/24-bit from being parsed as release group 2025-02-22 12:30:51 -08:00
Bogdan
d3777dd43c Update translations for Trakt settings to be series specific 2025-02-22 12:30:28 -08:00
v3DJG6GL
a72288a14e New: .arj and .lzh extensions are potentially dangerous 2025-02-22 12:30:10 -08:00
Weblate
e506eb6d03 Multiple Translations updated by Weblate
ignore-downstream

Co-authored-by: Havok Dan <havokdan@yahoo.com.br>
Co-authored-by: corwin007x <skopal.ondrej@gmail.com>
Co-authored-by: fordas <fordas15@gmail.com>
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/cs/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/es/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/pt_BR/
Translation: Servarr/Sonarr
2025-02-22 12:29:01 -08:00
Mark McDowall
591b569bdd Add Series with ReactQuery Mutation 2025-02-18 19:27:02 -08:00
Mark McDowall
094df71301 New: Option for Telegram link previews
Closes #7500
2025-02-18 19:26:48 -08:00
Stevie Robinson
31e02bdead Fixed: Rejected Imports with no associated release or indexer 2025-02-18 19:26:38 -08:00
Mark McDowall
b122ee9670 Fixed: Only show Additional Parameters on Trakt Popular list
Closes #7575
2025-02-18 19:25:52 -08:00
Mark McDowall
0f9e063e21 New: Remove Basic Auth
Closes #7597
2025-02-18 19:25:35 -08:00
Mark McDowall
609e964794 Cleanse console log messages
Closes #7632
2025-02-18 19:25:23 -08:00
Mark McDowall
5cebec6ae4 New: Support TMDb and IMDB IDs in Custom Import Lists 2025-02-18 19:25:12 -08:00
Mark McDowall
33da537a63 New: Remove defunct IMDB Import Lists
Closes #6915
2025-02-18 19:25:12 -08:00
Bogdan
11c945c2dc Fixed: Download links for FileList when passkey contains spaces 2025-02-18 19:24:54 -08:00
Bogdan
1b0a20535c New: Remove deprecated Kometa metadata 2025-02-18 19:24:37 -08:00
Bogdan
1734fcaa8f Fixed: Close Metadata settings modal on saving 2025-02-18 19:23:51 -08:00
Stevie Robinson
b99e06acc0 Fixed: Fallback to Instance Name for Discord notifications 2025-02-18 19:23:43 -08:00
Bogdan
5d16169e52 Fixed: Improve parsing of some episodes using day-month-year format 2025-02-18 19:23:05 -08:00
Weblate
a2670a5804 Multiple Translations updated by Weblate
ignore-downstream

Co-authored-by: Gallyam Biktashev <gallyamb@gmail.com>
Co-authored-by: GkhnGRBZ <gkhn.gurbuz@hotmail.com>
Co-authored-by: Havok Dan <havokdan@yahoo.com.br>
Co-authored-by: Oskari Lavinto <olavinto@protonmail.com>
Co-authored-by: Weblate <noreply@weblate.org>
Co-authored-by: fordas <fordas15@gmail.com>
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/es/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/fi/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/pt_BR/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/ru/
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/tr/
Translation: Servarr/Sonarr
2025-02-18 19:22:08 -08:00
Stevie Robinson
9e5ebdc624 Fixed: Parse GER/DE releases as German language
Closes #7635

Co-authored-by: epmt7w3ugk <epmt7w3ugk@bypfk.anonbox.net>
2025-02-11 19:37:15 -08:00
Stevie Robinson
e62aa5e041 Fixed: SABnzbd sorting mode not reflected in heath check 2025-02-11 19:37:15 -08:00
Connor Gallopo
80a8176c58 Update date in readme to 2025 2025-02-11 19:37:14 -08:00
Bogdan
39f1c669b8 Fix typo in Deleted Episode File Specification 2025-02-11 19:37:14 -08:00
Bogdan
5208f5e966 New: Refresh cache for tracked queue on series update 2025-02-11 19:37:14 -08:00
Bogdan
bb0ad312f1 Fixed: Health warning for downloading inside root folders 2025-02-11 19:37:14 -08:00
Mark McDowall
413d6b996b Fixed: Ignore special folders inside Blackhole watch folders 2025-02-11 19:37:13 -08:00
Bogdan
79474f26e9 New: Prefer newer Usenet releases 2025-02-11 19:37:13 -08:00
Mark McDowall
18bbb8bbd1 Add MediaInfo AudioLanguagesAll and update styling
Closes #7587
2025-02-11 19:37:13 -08:00
Bogdan
374c6d13f6 Fixed: Format bitrate for primary streams in media info
Co-authored-by: Mark McDowall <markus.mcd5@gmail.com>
2025-02-11 19:37:12 -08:00
Sonarr
92f0aa4e8f Automated API Docs update
ignore-downstream
2025-02-11 19:37:12 -08:00
Mark McDowall
7345c06003 Don't publish v5 builds yet 2025-02-11 19:37:12 -08:00
Mark McDowall
ff08b914f3 Fix tests for v5 2025-02-11 19:37:12 -08:00
Mark McDowall
e40c8f3e3e Improve build speed 2025-02-11 19:37:11 -08:00
Mark McDowall
2fd1fea4cb Fix builds with v5 API 2025-02-11 19:36:00 -08:00
Mark McDowall
a72bc164a9 Fix import order after TS 2025-02-11 19:35:59 -08:00
Mark McDowall
d9a86bcb31 Build and conflict labeler for PRs against v5-develop 2025-02-11 19:35:59 -08:00
Mark McDowall
553c4aeae1 v5 API docs 2025-02-11 19:35:59 -08:00
Mark McDowall
5a47f34ef9 Add v5 API 2025-02-11 19:35:59 -08:00
Mark McDowall
15b070119d Fix signalR 2025-02-11 19:35:58 -08:00
Steel City Phantom
7b133bd80d Auto-detect building on macOS ARM 2025-02-11 19:35:58 -08:00
Stevie Robinson
ce6536f8ab New: Show size in history details
Closes #7594
2025-02-11 19:35:58 -08:00
Bogdan
c6eb6c3cd8 Typing for Interactive Search payload 2025-02-11 19:35:58 -08:00
Bogdan
f4f3fdfb0b New: Migrate appdata folder for .NET 8 on OSX 2025-02-11 19:35:57 -08:00
Bogdan
6b92627004 New: Bump to .NET 8 2025-02-11 19:35:57 -08:00
Mark McDowall
c3f9cd12af Convert signalR to TypeScript 2025-02-11 19:35:57 -08:00
Mark McDowall
6f871a1bfb Convert Import Series to TypeScript 2025-02-11 19:35:57 -08:00
Mark McDowall
ab1f8bdbd9 Remove pnpm-lock.yaml 2025-02-11 19:35:56 -08:00
Mark McDowall
b72b1d5e5c Remove defaultProps from SeriesIndexFilterMenu 2025-02-11 19:35:56 -08:00
Mark McDowall
87c840974b Convert Add New Series to TypeScript 2025-02-11 19:35:56 -08:00
Mark McDowall
ee46e6378a Remove Measure 2025-02-11 19:34:46 -08:00
Mark McDowall
7644cec376 Convert Series Details to TypeScript 2025-02-11 19:34:46 -08:00
Mark McDowall
d3153685ac Convert Delete Series Modal to TypeScript 2025-02-11 19:34:46 -08:00
Mark McDowall
7035bb2944 Convert Series History to TypeScript 2025-02-11 19:34:46 -08:00
Mark McDowall
6dc16f3ddd Fixed Import List CleanLibraryLevel Options 2025-02-11 19:34:45 -08:00
Mark McDowall
0e1474579a Convert Monitoring Options to TypeScript 2025-02-11 19:34:45 -08:00
Mark McDowall
7b4bd50f18 Convert MoveSeriesModal to TypeScript 2025-02-11 19:34:45 -08:00
Mark McDowall
4849d1da10 Convert FilterBuilder types to TypeScript 2025-02-11 19:34:44 -08:00
Mark McDowall
8482f3da1a Convert Date utilties to TypeScript 2025-02-11 19:34:44 -08:00
Mark McDowall
782af002d6 Convert TableOptionsWrapper to TypeScript 2025-02-11 19:34:44 -08:00
Mark McDowall
8f6d9f3bf4 Convert Series Popovers to TypeScript 2025-02-11 19:34:44 -08:00
Mark McDowall
699120a8fd Convert Table to TypeScript 2025-02-11 19:34:43 -08:00
Mark McDowall
0fdeb05663 Convert Messages to TypeScript 2025-02-11 19:34:43 -08:00
Mark McDowall
7c64911b6b Remove withCurrentPage 2025-02-11 19:34:43 -08:00
Mark McDowall
3035521b93 Convert Missing to TypeScript 2025-02-11 19:34:42 -08:00
Mark McDowall
45c53bea86 Convert Cutoff Unmet to TypeScript 2025-02-11 19:34:42 -08:00
Mark McDowall
4c6d6b726e Convert Custom Format settings to TypeScript 2025-02-11 19:34:42 -08:00
Mark McDowall
1765feac03 Convert Notifications to TypeScript 2025-02-11 19:34:41 -08:00
Mark McDowall
92db4769be Convert Download Client settings to TypeScript 2025-02-11 19:34:41 -08:00
Mark McDowall
6838f068bc Improve typings in FormInputGroup 2025-02-11 19:34:41 -08:00
Mark McDowall
b218461678 Convert General Settings to TypeScript 2025-02-11 19:34:41 -08:00
Mark McDowall
10e3a237ef Convert ImportLists to TypeScript 2025-02-11 19:34:40 -08:00
Mark McDowall
6e008a8e85 Convert Indexer settings to TypeScript 2025-02-11 19:34:40 -08:00
Mark McDowall
27f81117ed Convert Media Management settings to TypeScript 2025-02-11 19:34:40 -08:00
Mark McDowall
839658a698 Convert MetadataSource to TypeScript 2025-02-11 19:34:40 -08:00
Mark McDowall
1bc1b080d1 Upgrade react-dnd and DnD Components to TypeScript 2025-02-11 19:34:39 -08:00
Mark McDowall
572bdc979c New: Quality limits are part of Quality Profile
Closes #613
2025-02-11 19:34:39 -08:00
Mark McDowall
cde0a31ff0 Convert Quality Settings to TypeScript 2025-02-11 19:34:39 -08:00
Mark McDowall
60529f0bac Convert Tags to TypeScript 2025-02-11 19:34:39 -08:00
Mark McDowall
5ed7780ed7 Convert MetadataSettings to TypeScript 2025-02-11 19:34:38 -08:00
Mark McDowall
89c8a10e0d Convert UI Settings to TypeScript 2025-02-11 19:34:38 -08:00
Mark McDowall
fd09ca6e71 Convert SettingsToolbar to TypeScript 2025-02-11 19:34:38 -08:00
Mark McDowall
95929dd9c2 Convert Log FIles to TypeScript 2025-02-11 19:34:38 -08:00
Mark McDowall
23bc6a157c Convert Log Events to TypeScript 2025-02-11 19:34:37 -08:00
Mark McDowall
756e985b66 Convert Backup and Restore to TypeScript 2025-02-11 19:34:37 -08:00
Mark McDowall
a2fd23c84d Convert Preview Rename to TypeScript 2025-02-11 19:34:37 -08:00
Mark McDowall
32ce09648c Convert SelectSeriesRow to TypeScript 2025-02-11 19:34:37 -08:00
Mark McDowall
20e1a8d116 Convert TagList components to TypeScript 2025-02-11 19:34:36 -08:00
Mark McDowall
12a1ef0387 Convert Menu components to TypeScript 2025-02-11 19:34:36 -08:00
Mark McDowall
2935d148a8 Convert ProviderFieldFormGroup to TypeScript 2025-02-11 19:34:36 -08:00
Mark McDowall
a90c13e86f Remove defaultProps from TypeScript components 2025-02-11 19:34:36 -08:00
Mark McDowall
9a7ddd751e Convert Filter components to TypeScript 2025-02-11 19:34:35 -08:00
Mark McDowall
a1d4bb5399 Convert Spinner button components to TypeScript 2025-02-11 19:34:35 -08:00
Mark McDowall
9d0acba000 Convert Modal components to TypeScript 2025-02-11 19:34:35 -08:00
Mark McDowall
ee1a0a1f71 useMeasure instead of Measure in TypeScript components 2025-02-11 19:34:34 -08:00
Mark McDowall
f35a27449d Convert Page components to TypeScript 2025-02-11 19:34:34 -08:00
Mark McDowall
4e65669c48 Bump version to 4.0.13 2025-02-11 19:25:11 -08:00
Weblate
fa38498db0 Multiple Translations updated by Weblate
ignore-downstream

Co-authored-by: Magnus5405 <magnus5405@outlook.com>
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/da/
Translation: Servarr/Sonarr
2025-02-11 19:24:56 -08:00
Mark McDowall
3b024443c5 Fixed: Drop downs flickering in some cases
Closes #7608
2025-01-30 20:58:11 -08:00
Weblate
4ba9b21bb7 Multiple Translations updated by Weblate
ignore-downstream

Co-authored-by: Oskari Lavinto <olavinto@protonmail.com>
Translate-URL: https://translate.servarr.com/projects/servarr/sonarr/fi/
Translation: Servarr/Sonarr
2025-01-30 20:57:59 -08:00
584 changed files with 14291 additions and 5233 deletions

View File

@@ -170,7 +170,7 @@ runs:
framework="${{ inputs.framework }}"
runtime="${{ inputs.runtime }}"
cp test.sh "_tests/$framework/$runtime/publish"
cp scripts/test.sh "_tests/$framework/$runtime/publish"
rm -f _tests/$framework/$runtime/*.log.config

View File

@@ -33,7 +33,7 @@ jobs:
id: setup-dotnet
- name: Create openapi.json
run: ./docs.sh Linux x64
run: ./scripts/docs.sh Linux x64
- name: Commit API Docs Change
continue-on-error: true
@@ -50,3 +50,16 @@ jobs:
else
echo "No changes since last run"
fi
- name: Notify
if: failure()
uses: tsickert/discord-webhook@v6.0.0
with:
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
username: "GitHub Actions"
avatar-url: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png"
embed-title: "${{ github.workflow }}: Failure"
embed-url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
embed-description: |
Failed to update API docs
embed-color: "15158332"

View File

@@ -82,4 +82,4 @@ Thank you to [<img src="https://resources.jetbrains.com/storage/products/company
### Licenses
- [GNU GPL v3](http://www.gnu.org/licenses/gpl.html)
- Copyright 2010-2024
- Copyright 2010-2025

103
distribution/debian/install.sh Normal file → Executable file
View File

@@ -6,6 +6,7 @@
### Version V1.0.1 2024-01-02 - StevieTV - remove UTF8-BOM
### Version V1.0.2 2024-01-03 - markus101 - Get user input from /dev/tty
### Version V1.0.3 2024-01-06 - StevieTV - exit script when it is ran from install directory
### Version V1.0.4 2025-04-05 - kaecyra - Allow user/group to be supplied via CLI, add unattended mode
### Boilerplate Warning
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
@@ -16,8 +17,8 @@
#OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
#WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
scriptversion="1.0.3"
scriptdate="2024-01-06"
scriptversion="1.0.4"
scriptdate="2025-04-05"
set -euo pipefail
@@ -49,18 +50,106 @@ if [ "$installdir" == "$(dirname -- "$( readlink -f -- "$0"; )")" ] || [ "$bindi
exit
fi
# Prompt User
read -r -p "What user should ${app^} run as? (Default: $app): " app_uid < /dev/tty
show_help() {
cat <<EOF
Usage: $(basename "$0") [OPTIONS]
Options:
--user <name> What user will $app run under?
User will be created if it doesn't already exist.
--group <name> What group will $app run under?
Group will be created if it doesn't already exist.
-u Unattended mode
The installer will not prompt or pause, making it suitable for automated installations.
This option requires the use of --user and --group to supply those inputs for the script.
-h, --help Show this help message and exit
EOF
}
# Default values for command-line arguments
arg_user=""
arg_group=""
arg_unattended=false
# Parse command-line arguments
while [[ $# -gt 0 ]]; do
case "$1" in
--user=*)
arg_user="${1#*=}"
shift
;;
--user)
if [[ -n "$2" && "$2" != -* ]]; then
arg_user="$2"
shift 2
else
echo "Error: --user requires a value." >&2
exit 1
fi
;;
--group=*)
arg_group="${1#*=}"
shift
;;
--group)
if [[ -n "$2" && "$2" != -* ]]; then
arg_group="$2"
shift 2
else
echo "Error: --group requires a value." >&2
exit 1
fi
;;
-u)
arg_unattended=true
shift
;;
-h|--help)
show_help
exit 0
;;
*)
echo "Unknown option: $1" >&2
echo "Use --help to see valid options." >&2
exit 1
;;
esac
done
# If unattended mode is requested, require user and group
if $arg_unattended; then
if [[ -z "$arg_user" || -z "$arg_group" ]]; then
echo "Error: --user and --group are required when using -u (unattended mode)." >&2
exit 1
fi
fi
# Prompt User if necessary
if [ -n "$arg_user" ]; then
app_uid="$arg_user"
else
read -r -p "What user should ${app^} run as? (Default: $app): " app_uid < /dev/tty
fi
app_uid=$(echo "$app_uid" | tr -d ' ')
app_uid=${app_uid:-$app}
# Prompt Group
read -r -p "What group should ${app^} run as? (Default: media): " app_guid < /dev/tty
# Prompt Group if necessary
if [ -n "$arg_group" ]; then
app_guid="$arg_group"
else
read -r -p "What group should ${app^} run as? (Default: media): " app_guid < /dev/tty
fi
app_guid=$(echo "$app_guid" | tr -d ' ')
app_guid=${app_guid:-media}
echo "This will install [${app^}] to [$bindir] and use [$datadir] for the AppData Directory"
echo "${app^} will run as the user [$app_uid] and group [$app_guid]. By continuing, you've confirmed that the selected user and group will have READ and WRITE access to your Media Library and Download Client Completed Download directories"
read -n 1 -r -s -p $'Press enter to continue or ctrl+c to exit...\n' < /dev/tty
if ! $arg_unattended; then
read -n 1 -r -s -p $'Press enter to continue or ctrl+c to exit...\n' < /dev/tty
fi
# Create User / Group as needed
if [ "$app_guid" != "$app_uid" ]; then

View File

@@ -7,9 +7,9 @@ cd /data/test
runTest()
{
bash test.sh Linux $1
bash scripts/test.sh Linux $1
cp TestResult.xml /data/_tests_results/TestResult_$1.xml
}
runTest Integration
runTest Unit
runTest Unit

View File

@@ -65,7 +65,7 @@ module.exports = (env) => {
output: {
path: distFolder,
publicPath: '/',
publicPath: 'auto',
filename: isProduction ? '[name]-[contenthash].js' : '[name].js',
sourceMapFilename: '[file].map'
},
@@ -176,7 +176,7 @@ module.exports = (env) => {
loose: true,
debug: false,
useBuiltIns: 'entry',
corejs: '3.39'
corejs: '3.42'
}
]
]

View File

@@ -174,7 +174,7 @@ function HistoryDetails(props: HistoryDetailsProps) {
}
if (eventType === 'downloadFailed') {
const { message } = data as DownloadFailedHistory;
const { message, indexer } = data as DownloadFailedHistory;
return (
<DescriptionList>
@@ -188,6 +188,10 @@ function HistoryDetails(props: HistoryDetailsProps) {
<DescriptionListItem title={translate('GrabId')} data={downloadId} />
) : null}
{indexer ? (
<DescriptionListItem title={translate('Indexer')} data={indexer} />
) : null}
{message ? (
<DescriptionListItem title={translate('Message')} data={message} />
) : null}

View File

@@ -61,7 +61,7 @@ function QueueDetails(props: QueueDetailsProps) {
anchor={progressBar!}
title={`${state} - ${progress.toFixed(1)}%`}
body={<div>{title}</div>}
position={tooltipPositions.LEFT}
position="bottom-start"
/>
);
}

View File

@@ -1,7 +1,10 @@
import React, { useCallback, useMemo, useState } from 'react';
import React, { useCallback, useMemo } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import AppState from 'App/State/AppState';
import FormGroup from 'Components/Form/FormGroup';
import FormInputGroup from 'Components/Form/FormInputGroup';
import FormLabel from 'Components/Form/FormLabel';
import { EnhancedSelectInputValue } from 'Components/Form/Select/EnhancedSelectInput';
import Button from 'Components/Link/Button';
import Modal from 'Components/Modal/Modal';
import ModalBody from 'Components/Modal/ModalBody';
@@ -9,6 +12,8 @@ import ModalContent from 'Components/Modal/ModalContent';
import ModalFooter from 'Components/Modal/ModalFooter';
import ModalHeader from 'Components/Modal/ModalHeader';
import { inputTypes, kinds, sizes } from 'Helpers/Props';
import { setQueueRemovalOption } from 'Store/Actions/queueActions';
import { InputChanged } from 'typings/inputs';
import translate from 'Utilities/String/translate';
import styles from './RemoveQueueItemModal.css';
@@ -30,12 +35,6 @@ interface RemoveQueueItemModalProps {
onModalClose: () => void;
}
type RemovalMethod = 'removeFromClient' | 'changeCategory' | 'ignore';
type BlocklistMethod =
| 'doNotBlocklist'
| 'blocklistAndSearch'
| 'blocklistOnly';
function RemoveQueueItemModal(props: RemoveQueueItemModalProps) {
const {
isOpen,
@@ -48,12 +47,13 @@ function RemoveQueueItemModal(props: RemoveQueueItemModalProps) {
onModalClose,
} = props;
const dispatch = useDispatch();
const multipleSelected = selectedCount && selectedCount > 1;
const [removalMethod, setRemovalMethod] =
useState<RemovalMethod>('removeFromClient');
const [blocklistMethod, setBlocklistMethod] =
useState<BlocklistMethod>('doNotBlocklist');
const { removalMethod, blocklistMethod } = useSelector(
(state: AppState) => state.queue.removalOptions
);
const { title, message } = useMemo(() => {
if (!selectedCount) {
@@ -79,7 +79,7 @@ function RemoveQueueItemModal(props: RemoveQueueItemModalProps) {
}, [sourceTitle, selectedCount]);
const removalMethodOptions = useMemo(() => {
return [
const options: EnhancedSelectInputValue<string>[] = [
{
key: 'removeFromClient',
value: translate('RemoveFromDownloadClient'),
@@ -106,10 +106,12 @@ function RemoveQueueItemModal(props: RemoveQueueItemModalProps) {
: translate('IgnoreDownloadHint'),
},
];
return options;
}, [canChangeCategory, canIgnore, multipleSelected]);
const blocklistMethodOptions = useMemo(() => {
return [
const options: EnhancedSelectInputValue<string>[] = [
{
key: 'doNotBlocklist',
value: translate('DoNotBlocklist'),
@@ -131,20 +133,15 @@ function RemoveQueueItemModal(props: RemoveQueueItemModalProps) {
: translate('BlocklistOnlyHint'),
},
];
return options;
}, [isPending, multipleSelected]);
const handleRemovalMethodChange = useCallback(
({ value }: { value: RemovalMethod }) => {
setRemovalMethod(value);
const handleRemovalOptionInputChange = useCallback(
({ name, value }: InputChanged) => {
dispatch(setQueueRemovalOption({ [name]: value }));
},
[setRemovalMethod]
);
const handleBlocklistMethodChange = useCallback(
({ value }: { value: BlocklistMethod }) => {
setBlocklistMethod(value);
},
[setBlocklistMethod]
[dispatch]
);
const handleConfirmRemove = useCallback(() => {
@@ -154,23 +151,11 @@ function RemoveQueueItemModal(props: RemoveQueueItemModalProps) {
blocklist: blocklistMethod !== 'doNotBlocklist',
skipRedownload: blocklistMethod === 'blocklistOnly',
});
setRemovalMethod('removeFromClient');
setBlocklistMethod('doNotBlocklist');
}, [
removalMethod,
blocklistMethod,
setRemovalMethod,
setBlocklistMethod,
onRemovePress,
]);
}, [removalMethod, blocklistMethod, onRemovePress]);
const handleModalClose = useCallback(() => {
setRemovalMethod('removeFromClient');
setBlocklistMethod('doNotBlocklist');
onModalClose();
}, [setRemovalMethod, setBlocklistMethod, onModalClose]);
}, [onModalClose]);
return (
<Modal isOpen={isOpen} size={sizes.MEDIUM} onModalClose={handleModalClose}>
@@ -193,7 +178,7 @@ function RemoveQueueItemModal(props: RemoveQueueItemModalProps) {
helpTextWarning={translate(
'RemoveQueueItemRemovalMethodHelpTextWarning'
)}
onChange={handleRemovalMethodChange}
onChange={handleRemovalOptionInputChange}
/>
</FormGroup>
)}
@@ -211,7 +196,7 @@ function RemoveQueueItemModal(props: RemoveQueueItemModalProps) {
value={blocklistMethod}
values={blocklistMethodOptions}
helpText={translate('BlocklistReleaseHelpText')}
onChange={handleBlocklistMethodChange}
onChange={handleRemovalOptionInputChange}
/>
</FormGroup>
</ModalBody>

View File

@@ -1,6 +1,5 @@
import React, { useCallback, useEffect, useState } from 'react';
import { useSelector } from 'react-redux';
import { AddSeries } from 'App/State/AddSeriesAppState';
import AppState from 'App/State/AppState';
import Alert from 'Components/Alert';
import TextInput from 'Components/Form/TextInput';
@@ -10,7 +9,6 @@ import Link from 'Components/Link/Link';
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
import PageContent from 'Components/Page/PageContent';
import PageContentBody from 'Components/Page/PageContentBody';
import useApiQuery from 'Helpers/Hooks/useApiQuery';
import useDebounce from 'Helpers/Hooks/useDebounce';
import useQueryParams from 'Helpers/Hooks/useQueryParams';
import { icons, kinds } from 'Helpers/Props';
@@ -18,6 +16,7 @@ import { InputChanged } from 'typings/inputs';
import getErrorMessage from 'Utilities/Object/getErrorMessage';
import translate from 'Utilities/String/translate';
import AddNewSeriesSearchResult from './AddNewSeriesSearchResult';
import { useLookupSeries } from './useAddSeries';
import styles from './AddNewSeries.css';
function AddNewSeries() {
@@ -48,12 +47,7 @@ function AddNewSeries() {
isFetching: isFetchingApi,
error,
data = [],
} = useApiQuery<AddSeries[]>({
path: `/series/lookup?term=${query}`,
queryOptions: {
enabled: !!query,
},
});
} = useLookupSeries(query);
useEffect(() => {
setIsFetching(isFetchingApi);
@@ -103,7 +97,9 @@ function AddNewSeries() {
{!isFetching && !error && !!data.length ? (
<div className={styles.searchResults}>
{data.map((item) => {
return <AddNewSeriesSearchResult key={item.tvdbId} {...item} />;
return (
<AddNewSeriesSearchResult key={item.tvdbId} series={item} />
);
})}
</div>
) : null}

View File

@@ -1,9 +1,13 @@
import React, { useCallback, useEffect, useMemo, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { useSelector } from 'react-redux';
import AddSeries from 'AddSeries/AddSeries';
import {
AddSeriesOptions,
setAddSeriesOption,
useAddSeriesOptions,
} from 'AddSeries/addSeriesOptionsStore';
import SeriesMonitoringOptionsPopoverContent from 'AddSeries/SeriesMonitoringOptionsPopoverContent';
import SeriesTypePopoverContent from 'AddSeries/SeriesTypePopoverContent';
import { AddSeries } from 'App/State/AddSeriesAppState';
import AppState from 'App/State/AppState';
import CheckInput from 'Components/Form/CheckInput';
import Form from 'Components/Form/Form';
import FormGroup from 'Components/Form/FormGroup';
@@ -17,46 +21,43 @@ import ModalFooter from 'Components/Modal/ModalFooter';
import ModalHeader from 'Components/Modal/ModalHeader';
import Popover from 'Components/Tooltip/Popover';
import { icons, inputTypes, kinds, tooltipPositions } from 'Helpers/Props';
import { SeriesType } from 'Series/Series';
import SeriesPoster from 'Series/SeriesPoster';
import { addSeries, setAddSeriesDefault } from 'Store/Actions/addSeriesActions';
import createDimensionsSelector from 'Store/Selectors/createDimensionsSelector';
import selectSettings from 'Store/Selectors/selectSettings';
import useIsWindows from 'System/useIsWindows';
import { InputChanged } from 'typings/inputs';
import translate from 'Utilities/String/translate';
import { useAddSeries } from './useAddSeries';
import styles from './AddNewSeriesModalContent.css';
export interface AddNewSeriesModalContentProps
extends Pick<
AddSeries,
'tvdbId' | 'title' | 'year' | 'overview' | 'images' | 'folder'
> {
initialSeriesType: string;
export interface AddNewSeriesModalContentProps {
series: AddSeries;
initialSeriesType: SeriesType;
onModalClose: () => void;
}
function AddNewSeriesModalContent({
tvdbId,
title,
year,
overview,
images,
folder,
series,
initialSeriesType,
onModalClose,
}: AddNewSeriesModalContentProps) {
const dispatch = useDispatch();
const { isAdding, addError, defaults } = useSelector(
(state: AppState) => state.addSeries
);
const { title, year, overview, images, folder } = series;
const options = useAddSeriesOptions();
const { isSmallScreen } = useSelector(createDimensionsSelector());
const isWindows = useIsWindows();
const { settings, validationErrors, validationWarnings } = useMemo(() => {
return selectSettings(defaults, {}, addError);
}, [defaults, addError]);
const {
isPending: isAdding,
error: addError,
mutate: addSeries,
} = useAddSeries();
const [seriesType, setSeriesType] = useState(
const { settings, validationErrors, validationWarnings } = useMemo(() => {
return selectSettings(options, {}, addError);
}, [options, addError]);
const [seriesType, setSeriesType] = useState<SeriesType>(
initialSeriesType === 'standard'
? settings.seriesType.value
: initialSeriesType
@@ -74,35 +75,33 @@ function AddNewSeriesModalContent({
} = settings;
const handleInputChange = useCallback(
({ name, value }: InputChanged) => {
dispatch(setAddSeriesDefault({ [name]: value }));
({ name, value }: InputChanged<string | number | boolean | number[]>) => {
setAddSeriesOption(name as keyof AddSeriesOptions, value);
},
[dispatch]
[]
);
const handleQualityProfileIdChange = useCallback(
({ value }: InputChanged<string | number>) => {
dispatch(setAddSeriesDefault({ qualityProfileId: value }));
setAddSeriesOption('qualityProfileId', value as number);
},
[dispatch]
[]
);
const handleAddSeriesPress = useCallback(() => {
dispatch(
addSeries({
tvdbId,
rootFolderPath: rootFolderPath.value,
monitor: monitor.value,
qualityProfileId: qualityProfileId.value,
seriesType,
seasonFolder: seasonFolder.value,
searchForMissingEpisodes: searchForMissingEpisodes.value,
searchForCutoffUnmetEpisodes: searchForCutoffUnmetEpisodes.value,
tags: tags.value,
})
);
addSeries({
...series,
rootFolderPath: rootFolderPath.value,
monitor: monitor.value,
qualityProfileId: qualityProfileId.value,
seriesType,
seasonFolder: seasonFolder.value,
searchForMissingEpisodes: searchForMissingEpisodes.value,
searchForCutoffUnmetEpisodes: searchForCutoffUnmetEpisodes.value,
tags: tags.value,
});
}, [
tvdbId,
series,
seriesType,
rootFolderPath,
monitor,
@@ -111,7 +110,7 @@ function AddNewSeriesModalContent({
searchForMissingEpisodes,
searchForCutoffUnmetEpisodes,
tags,
dispatch,
addSeries,
]);
useEffect(() => {

View File

@@ -1,6 +1,6 @@
import React, { useCallback, useState } from 'react';
import { useSelector } from 'react-redux';
import { AddSeries } from 'App/State/AddSeriesAppState';
import AddSeries from 'AddSeries/AddSeries';
import HeartRating from 'Components/HeartRating';
import Icon from 'Components/Icon';
import Label from 'Components/Label';
@@ -16,24 +16,27 @@ import translate from 'Utilities/String/translate';
import AddNewSeriesModal from './AddNewSeriesModal';
import styles from './AddNewSeriesSearchResult.css';
type AddNewSeriesSearchResultProps = AddSeries;
interface AddNewSeriesSearchResultProps {
series: AddSeries;
}
function AddNewSeriesSearchResult({ series }: AddNewSeriesSearchResultProps) {
const {
tvdbId,
titleSlug,
title,
year,
network,
originalLanguage,
genres = [],
status,
statistics = {} as Statistics,
ratings,
overview,
seriesType,
images,
} = series;
function AddNewSeriesSearchResult({
tvdbId,
titleSlug,
title,
year,
network,
originalLanguage,
genres = [],
status,
statistics = {} as Statistics,
ratings,
folder,
overview,
seriesType,
images,
}: AddNewSeriesSearchResultProps) {
const isExistingSeries = useSelector(createExistingSeriesSelector(tvdbId));
const { isSmallScreen } = useSelector(createDimensionsSelector());
const [isNewAddSeriesModalOpen, setIsNewAddSeriesModalOpen] = useState(false);
@@ -168,13 +171,8 @@ function AddNewSeriesSearchResult({
<AddNewSeriesModal
isOpen={isNewAddSeriesModalOpen && !isExistingSeries}
tvdbId={tvdbId}
title={title}
year={year}
overview={overview}
folder={folder}
series={series}
initialSeriesType={seriesType}
images={images}
onModalClose={handleAddSeriesModalClose}
/>
</div>

View File

@@ -0,0 +1,43 @@
import { useCallback } from 'react';
import { useDispatch } from 'react-redux';
import AddSeries from 'AddSeries/AddSeries';
import { AddSeriesOptions } from 'AddSeries/addSeriesOptionsStore';
import useApiMutation from 'Helpers/Hooks/useApiMutation';
import useApiQuery from 'Helpers/Hooks/useApiQuery';
import Series from 'Series/Series';
import { updateItem } from 'Store/Actions/baseActions';
type AddSeriesPayload = AddSeries & AddSeriesOptions;
export const useLookupSeries = (query: string) => {
return useApiQuery<AddSeries[]>({
path: '/series/lookup',
queryParams: {
term: query,
},
queryOptions: {
enabled: !!query,
// Disable refetch on window focus to prevent refetching when the user switch tabs
refetchOnWindowFocus: false,
},
});
};
export const useAddSeries = () => {
const dispatch = useDispatch();
const onAddSuccess = useCallback(
(data: Series) => {
dispatch(updateItem({ section: 'series', ...data }));
},
[dispatch]
);
return useApiMutation<Series, AddSeriesPayload>({
path: '/series',
method: 'POST',
mutationOptions: {
onSuccess: onAddSuccess,
},
});
};

View File

@@ -0,0 +1,7 @@
import Series from 'Series/Series';
interface AddSeries extends Series {
folder: string;
}
export default AddSeries;

View File

@@ -1,6 +1,10 @@
import React, { useEffect, useMemo, useRef } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { useParams } from 'react-router';
import {
setAddSeriesOption,
useAddSeriesOption,
} from 'AddSeries/addSeriesOptionsStore';
import { SelectProvider } from 'App/SelectContext';
import AppState from 'App/State/AppState';
import Alert from 'Components/Alert';
@@ -8,7 +12,6 @@ import LoadingIndicator from 'Components/Loading/LoadingIndicator';
import PageContent from 'Components/Page/PageContent';
import PageContentBody from 'Components/Page/PageContentBody';
import { kinds } from 'Helpers/Props';
import { setAddSeriesDefault } from 'Store/Actions/addSeriesActions';
import { clearImportSeries } from 'Store/Actions/importSeriesActions';
import { fetchRootFolders } from 'Store/Actions/rootFolderActions';
import translate from 'Utilities/String/translate';
@@ -48,9 +51,7 @@ function ImportSeries() {
(state: AppState) => state.settings.qualityProfiles.items
);
const defaultQualityProfileId = useSelector(
(state: AppState) => state.addSeries.defaults.qualityProfileId
);
const defaultQualityProfileId = useAddSeriesOption('qualityProfileId');
const scrollerRef = useRef<HTMLDivElement>(null);
@@ -76,9 +77,7 @@ function ImportSeries() {
!defaultQualityProfileId ||
!qualityProfiles.some((p) => p.id === defaultQualityProfileId)
) {
dispatch(
setAddSeriesDefault({ qualityProfileId: qualityProfiles[0].id })
);
setAddSeriesOption('qualityProfileId', qualityProfiles[0].id);
}
}, [defaultQualityProfileId, qualityProfiles, dispatch]);

View File

@@ -1,5 +1,10 @@
import React, { useCallback, useEffect, useMemo, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import {
AddSeriesOptions,
setAddSeriesOption,
useAddSeriesOptions,
} from 'AddSeries/addSeriesOptionsStore';
import { useSelect } from 'App/SelectContext';
import AppState from 'App/State/AppState';
import CheckInput from 'Components/Form/CheckInput';
@@ -12,7 +17,6 @@ import PageContentFooter from 'Components/Page/PageContentFooter';
import Popover from 'Components/Tooltip/Popover';
import { icons, inputTypes, kinds, tooltipPositions } from 'Helpers/Props';
import { SeriesMonitor, SeriesType } from 'Series/Series';
import { setAddSeriesDefault } from 'Store/Actions/addSeriesActions';
import {
cancelLookupSeries,
importSeries,
@@ -33,7 +37,7 @@ function ImportSeriesFooter() {
qualityProfileId: defaultQualityProfileId,
seriesType: defaultSeriesType,
seasonFolder: defaultSeasonFolder,
} = useSelector((state: AppState) => state.addSeries.defaults);
} = useAddSeriesOptions();
const { isLookingUpSeries, isImporting, items, importError } = useSelector(
(state: AppState) => state.importSeries
@@ -110,7 +114,7 @@ function ImportSeriesFooter() {
]);
const handleInputChange = useCallback(
({ name, value }: InputChanged) => {
({ name, value }: InputChanged<string | number | boolean | number[]>) => {
if (name === 'monitor') {
setMonitor(value as SeriesMonitor);
} else if (name === 'qualityProfileId') {
@@ -121,7 +125,7 @@ function ImportSeriesFooter() {
setSeasonFolder(value as boolean);
}
dispatch(setAddSeriesDefault({ [name]: value }));
setAddSeriesOption(name as keyof AddSeriesOptions, value);
selectedIds.forEach((id) => {
dispatch(

View File

@@ -75,11 +75,6 @@ function ImportSeriesRow({ id }: ImportSeriesRowProps) {
[selectDispatch]
);
console.info(
'\x1b[36m[MarkTest] is selected\x1b[0m',
selectState.selectedState[id]
);
return (
<>
<VirtualTableSelectCell

View File

@@ -1,6 +1,7 @@
import React, { RefObject, useCallback, useEffect, useRef } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { FixedSizeList, ListChildComponentProps } from 'react-window';
import { useAddSeriesOptions } from 'AddSeries/addSeriesOptionsStore';
import { useSelect } from 'App/SelectContext';
import AppState from 'App/State/AppState';
import { ImportSeries } from 'App/State/ImportSeriesAppState';
@@ -59,9 +60,8 @@ function ImportSeriesTable({
}: ImportSeriesTableProps) {
const dispatch = useDispatch();
const { monitor, qualityProfileId, seriesType, seasonFolder } = useSelector(
(state: AppState) => state.addSeries.defaults
);
const { monitor, qualityProfileId, seriesType, seasonFolder } =
useAddSeriesOptions();
const items = useSelector((state: AppState) => state.importSeries.items);
const { isSmallScreen } = useSelector(createDimensionsSelector());

View File

@@ -1,5 +1,13 @@
import React, { useCallback, useEffect, useId, useRef, useState } from 'react';
import { Manager, Popper, Reference } from 'react-popper';
import {
autoUpdate,
flip,
FloatingPortal,
useClick,
useDismiss,
useFloating,
useInteractions,
} from '@floating-ui/react';
import React, { useCallback, useEffect, useRef, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import AppState from 'App/State/AppState';
import FormInputButton from 'Components/Form/FormInputButton';
@@ -7,7 +15,6 @@ import TextInput from 'Components/Form/TextInput';
import Icon from 'Components/Icon';
import Link from 'Components/Link/Link';
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
import Portal from 'Components/Portal';
import { icons, kinds } from 'Helpers/Props';
import {
queueLookupSeries,
@@ -47,9 +54,6 @@ function ImportSeriesSelectSeries({
// @ts-expect-error - ignoring this for now
} = useSelector(createImportSeriesItemSelector(id, { id }));
const buttonId = useId();
const contentId = useId();
const updater = useRef<(() => void) | null>(null);
const seriesLookupTimeout = useRef<ReturnType<typeof setTimeout>>();
const [term, setTerm] = useState('');
@@ -57,37 +61,6 @@ function ImportSeriesSelectSeries({
const errorMessage = getErrorMessage(error);
const handleWindowClick = useCallback(
(event: MouseEvent) => {
const button = document.getElementById(buttonId);
const content = document.getElementById(contentId);
const eventTarget = event.target as HTMLElement;
if (!button || !eventTarget.isConnected) {
return;
}
if (
!button.contains(eventTarget) &&
content &&
!content.contains(eventTarget) &&
isOpen
) {
setIsOpen(false);
window.removeEventListener('click', handleWindowClick);
}
},
[isOpen, buttonId, contentId, setIsOpen]
);
const addListener = useCallback(() => {
window.addEventListener('click', handleWindowClick);
}, [handleWindowClick]);
const removeListener = useCallback(() => {
window.removeEventListener('click', handleWindowClick);
}, [handleWindowClick]);
const handlePress = useCallback(() => {
setIsOpen((prevIsOpen) => !prevIsOpen);
}, []);
@@ -147,157 +120,139 @@ function ImportSeriesSelectSeries({
[id, items, dispatch, onInputChange]
);
useEffect(() => {
if (updater.current) {
updater.current();
}
});
useEffect(() => {
if (isOpen) {
addListener();
} else {
removeListener();
}
return removeListener;
}, [isOpen, addListener, removeListener]);
useEffect(() => {
setTerm(itemTerm);
}, [itemTerm]);
const { refs, context, floatingStyles } = useFloating({
middleware: [
flip({
crossAxis: false,
mainAxis: true,
}),
],
open: isOpen,
placement: 'bottom',
whileElementsMounted: autoUpdate,
onOpenChange: setIsOpen,
});
const click = useClick(context);
const dismiss = useDismiss(context);
const { getReferenceProps, getFloatingProps } = useInteractions([
click,
dismiss,
]);
return (
<Manager>
<Reference>
{({ ref }) => (
<div ref={ref} id={buttonId}>
<Link
// ref={ref}
className={styles.button}
component="div"
onPress={handlePress}
>
{isLookingUpSeries && isQueued && !isPopulated ? (
<LoadingIndicator className={styles.loading} size={20} />
) : null}
<>
<div ref={refs.setReference} {...getReferenceProps()}>
<Link className={styles.button} component="div" onPress={handlePress}>
{isLookingUpSeries && isQueued && !isPopulated ? (
<LoadingIndicator className={styles.loading} size={20} />
) : null}
{isPopulated && selectedSeries && isExistingSeries ? (
<Icon
className={styles.warningIcon}
name={icons.WARNING}
kind={kinds.WARNING}
/>
) : null}
{isPopulated && selectedSeries && isExistingSeries ? (
<Icon
className={styles.warningIcon}
name={icons.WARNING}
kind={kinds.WARNING}
/>
) : null}
{isPopulated && selectedSeries ? (
<ImportSeriesTitle
title={selectedSeries.title}
year={selectedSeries.year}
network={selectedSeries.network}
isExistingSeries={isExistingSeries}
/>
) : null}
{isPopulated && selectedSeries ? (
<ImportSeriesTitle
title={selectedSeries.title}
year={selectedSeries.year}
network={selectedSeries.network}
isExistingSeries={isExistingSeries}
/>
) : null}
{isPopulated && !selectedSeries ? (
<div>
<Icon
className={styles.warningIcon}
name={icons.WARNING}
kind={kinds.WARNING}
/>
{isPopulated && !selectedSeries ? (
<div>
<Icon
className={styles.warningIcon}
name={icons.WARNING}
kind={kinds.WARNING}
/>
{translate('NoMatchFound')}
</div>
) : null}
{translate('NoMatchFound')}
</div>
) : null}
{!isFetching && !!error ? (
<div>
<Icon
className={styles.warningIcon}
title={errorMessage}
name={icons.WARNING}
kind={kinds.WARNING}
/>
{!isFetching && !!error ? (
<div>
<Icon
className={styles.warningIcon}
title={errorMessage}
name={icons.WARNING}
kind={kinds.WARNING}
/>
{translate('SearchFailedError')}
</div>
) : null}
{translate('SearchFailedError')}
</div>
) : null}
<div className={styles.dropdownArrowContainer}>
<Icon name={icons.CARET_DOWN} />
</div>
</Link>
<div className={styles.dropdownArrowContainer}>
<Icon name={icons.CARET_DOWN} />
</div>
)}
</Reference>
<Portal>
<Popper
placement="bottom"
modifiers={{
preventOverflow: {
boundariesElement: 'viewport',
},
}}
>
{({ ref, style, scheduleUpdate }) => {
updater.current = scheduleUpdate;
return (
<div
ref={ref}
id={contentId}
className={styles.contentContainer}
style={style}
>
{isOpen ? (
<div className={styles.content}>
<div className={styles.searchContainer}>
<div className={styles.searchIconContainer}>
<Icon name={icons.SEARCH} />
</div>
<TextInput
className={styles.searchInput}
name={`${name}_textInput`}
value={term}
onChange={handleSearchInputChange}
/>
<FormInputButton
kind={kinds.DEFAULT}
spinnerIcon={icons.REFRESH}
canSpin={true}
isSpinning={isFetching}
onPress={handleRefreshPress}
>
<Icon name={icons.REFRESH} />
</FormInputButton>
</div>
<div className={styles.results}>
{items.map((item) => {
return (
<ImportSeriesSearchResult
key={item.tvdbId}
tvdbId={item.tvdbId}
title={item.title}
year={item.year}
network={item.network}
onPress={handleSeriesSelect}
/>
);
})}
</div>
</Link>
</div>
{isOpen ? (
<FloatingPortal id="portal-root">
<div
ref={refs.setFloating}
className={styles.contentContainer}
style={floatingStyles}
{...getFloatingProps()}
>
{isOpen ? (
<div className={styles.content}>
<div className={styles.searchContainer}>
<div className={styles.searchIconContainer}>
<Icon name={icons.SEARCH} />
</div>
) : null}
<TextInput
className={styles.searchInput}
name={`${name}_textInput`}
value={term}
onChange={handleSearchInputChange}
/>
<FormInputButton
kind={kinds.DEFAULT}
spinnerIcon={icons.REFRESH}
canSpin={true}
isSpinning={isFetching}
onPress={handleRefreshPress}
>
<Icon name={icons.REFRESH} />
</FormInputButton>
</div>
<div className={styles.results}>
{items.map((item) => {
return (
<ImportSeriesSearchResult
key={item.tvdbId}
tvdbId={item.tvdbId}
title={item.title}
year={item.year}
network={item.network}
onPress={handleSeriesSelect}
/>
);
})}
</div>
</div>
);
}}
</Popper>
</Portal>
</Manager>
) : null}
</div>
</FloatingPortal>
) : null}
</>
);
}

View File

@@ -0,0 +1,49 @@
import { createPersist } from 'Helpers/createPersist';
import { SeriesMonitor, SeriesType } from 'Series/Series';
export interface AddSeriesOptions {
rootFolderPath: string;
monitor: SeriesMonitor;
qualityProfileId: number;
seriesType: SeriesType;
seasonFolder: boolean;
searchForMissingEpisodes: boolean;
searchForCutoffUnmetEpisodes: boolean;
tags: number[];
}
const addSeriesOptionsStore = createPersist<AddSeriesOptions>(
'add_series_options',
() => {
return {
rootFolderPath: '',
monitor: 'all',
qualityProfileId: 0,
seriesType: 'standard',
seasonFolder: true,
searchForMissingEpisodes: false,
searchForCutoffUnmetEpisodes: false,
tags: [],
};
}
);
export const useAddSeriesOptions = () => {
return addSeriesOptionsStore((state) => state);
};
export const useAddSeriesOption = <K extends keyof AddSeriesOptions>(
key: K
) => {
return addSeriesOptionsStore((state) => state[key]);
};
export const setAddSeriesOption = <K extends keyof AddSeriesOptions>(
key: K,
value: AddSeriesOptions[K]
) => {
addSeriesOptionsStore.setState((state) => ({
...state,
[key]: value,
}));
};

View File

@@ -11,6 +11,7 @@ import usePrevious from 'Helpers/Hooks/usePrevious';
import { kinds } from 'Helpers/Props';
import { fetchUpdates } from 'Store/Actions/systemActions';
import UpdateChanges from 'System/Updates/UpdateChanges';
import useUpdates from 'System/Updates/useUpdates';
import Update from 'typings/Update';
import translate from 'Utilities/String/translate';
import AppState from './State/AppState';
@@ -65,14 +66,12 @@ interface AppUpdatedModalContentProps {
function AppUpdatedModalContent(props: AppUpdatedModalContentProps) {
const dispatch = useDispatch();
const { version, prevVersion } = useSelector((state: AppState) => state.app);
const { isPopulated, error, items } = useSelector(
(state: AppState) => state.system.updates
);
const { isFetched, error, data } = useUpdates();
const previousVersion = usePrevious(version);
const { onModalClose } = props;
const update = mergeUpdates(items, version, prevVersion);
const update = mergeUpdates(data, version, prevVersion);
const handleSeeChangesPress = useCallback(() => {
window.location.href = `${window.Sonarr.urlBase}/system/updates`;
@@ -100,7 +99,7 @@ function AppUpdatedModalContent(props: AppUpdatedModalContentProps) {
/>
</div>
{isPopulated && !error && !!update ? (
{isFetched && !error && !!update ? (
<div>
{update.changes ? (
<div className={styles.maintenance}>
@@ -126,7 +125,7 @@ function AppUpdatedModalContent(props: AppUpdatedModalContentProps) {
</div>
) : null}
{!isPopulated && !error ? <LoadingIndicator /> : null}
{!isFetched && !error ? <LoadingIndicator /> : null}
</ModalBody>
<ModalFooter>

View File

@@ -1,20 +1,9 @@
import { useCallback, useEffect } from 'react';
import { useSelector } from 'react-redux';
import { createSelector } from 'reselect';
import useTheme from 'Helpers/Hooks/useTheme';
import themes from 'Styles/Themes';
import AppState from './State/AppState';
function createThemeSelector() {
return createSelector(
(state: AppState) => state.settings.ui.item.theme || window.Sonarr.theme,
(theme) => {
return theme;
}
);
}
function ApplyTheme() {
const theme = useSelector(createThemeSelector());
const theme = useTheme();
const updateCSSVariables = useCallback(() => {
Object.entries(themes[theme]).forEach(([key, value]) => {

View File

@@ -1,25 +0,0 @@
import AppSectionState, { Error } from 'App/State/AppSectionState';
import Series, { SeriesMonitor, SeriesType } from 'Series/Series';
export interface AddSeries extends Series {
folder: string;
}
interface AddSeriesAppState extends AppSectionState<AddSeries> {
isAdding: boolean;
isAdded: boolean;
addError: Error | undefined;
defaults: {
rootFolderPath: string;
monitor: SeriesMonitor;
qualityProfileId: number;
seriesType: SeriesType;
seasonFolder: boolean;
tags: number[];
searchForMissingEpisodes: boolean;
searchForCutoffUnmetEpisodes: boolean;
};
}
export default AddSeriesAppState;

View File

@@ -1,7 +1,6 @@
import ModelBase from 'App/ModelBase';
import { FilterBuilderTypes } from 'Helpers/Props/filterBuilderTypes';
import { DateFilterValue, FilterType } from 'Helpers/Props/filterTypes';
import AddSeriesAppState from './AddSeriesAppState';
import { Error } from './AppSectionState';
import BlocklistAppState from './BlocklistAppState';
import CalendarAppState from './CalendarAppState';
@@ -50,7 +49,6 @@ export interface PropertyFilter {
export interface Filter {
key: string;
label: string | (() => string);
type: string;
filters: PropertyFilter[];
}
@@ -83,7 +81,6 @@ export interface AppSectionState {
}
interface AppState {
addSeries: AddSeriesAppState;
app: AppSectionState;
blocklist: BlocklistAppState;
calendar: CalendarAppState;

View File

@@ -1,14 +0,0 @@
import AppSectionState, {
AppSectionFilterState,
PagedAppSectionState,
TableAppSectionState,
} from 'App/State/AppSectionState';
import LogEvent from 'typings/LogEvent';
interface LogsAppState
extends AppSectionState<LogEvent>,
AppSectionFilterState<LogEvent>,
PagedAppSectionState,
TableAppSectionState {}
export default LogsAppState;

View File

@@ -32,6 +32,17 @@ export interface QueuePagedAppState
removeError: Error;
}
export type RemovalMethod = 'removeFromClient' | 'changeCategory' | 'ignore';
export type BlocklistMethod =
| 'doNotBlocklist'
| 'blocklistAndSearch'
| 'blocklistOnly';
interface RemovalOptions {
removalMethod: RemovalMethod;
blocklistMethod: BlocklistMethod;
}
interface QueueAppState {
status: AppSectionItemState<QueueStatus>;
details: QueueDetailsAppState;
@@ -39,6 +50,7 @@ interface QueueAppState {
options: {
includeUnknownSeriesItems: boolean;
};
removalOptions: RemovalOptions;
}
export default QueueAppState;

View File

@@ -3,28 +3,23 @@ import Health from 'typings/Health';
import LogFile from 'typings/LogFile';
import SystemStatus from 'typings/SystemStatus';
import Task from 'typings/Task';
import Update from 'typings/Update';
import AppSectionState, { AppSectionItemState } from './AppSectionState';
import BackupAppState from './BackupAppState';
import LogsAppState from './LogsAppState';
export type DiskSpaceAppState = AppSectionState<DiskSpace>;
export type HealthAppState = AppSectionState<Health>;
export type SystemStatusAppState = AppSectionItemState<SystemStatus>;
export type TaskAppState = AppSectionState<Task>;
export type LogFilesAppState = AppSectionState<LogFile>;
export type UpdateAppState = AppSectionState<Update>;
interface SystemAppState {
backups: BackupAppState;
diskSpace: DiskSpaceAppState;
health: HealthAppState;
logFiles: LogFilesAppState;
logs: LogsAppState;
status: SystemStatusAppState;
tasks: TaskAppState;
updateLogFiles: LogFilesAppState;
updates: UpdateAppState;
}
export default SystemAppState;

View File

@@ -22,9 +22,9 @@ function createIsDownloadingSelector(episodeIds: number[]) {
return createSelector(
(state: AppState) => state.queue.details,
(details) => {
return details.items.some((item) => {
return !!(item.episodeId && episodeIds.includes(item.episodeId));
});
return details.items.some(
(item) => item.episodeId && episodeIds.includes(item.episodeId)
);
}
);
}
@@ -61,10 +61,10 @@ function CalendarEventGroup({
const endTime = moment(lastEpisode.airDateUtc).add(series.runtime, 'minutes');
const seasonNumber = firstEpisode.seasonNumber;
const { allDownloaded, anyQueued, anyMonitored, allAbsoluteEpisodeNumbers } =
const { allDownloaded, anyGrabbed, anyMonitored, allAbsoluteEpisodeNumbers } =
useMemo(() => {
let files = 0;
let queued = 0;
let grabbed = 0;
let monitored = 0;
let absoluteEpisodeNumbers = 0;
@@ -73,8 +73,8 @@ function CalendarEventGroup({
files++;
}
if (event.queued) {
queued++;
if (event.grabbed) {
grabbed++;
}
if (series.monitored && event.monitored) {
@@ -88,13 +88,13 @@ function CalendarEventGroup({
return {
allDownloaded: files === events.length,
anyQueued: queued > 0,
anyGrabbed: grabbed > 0,
anyMonitored: monitored > 0,
allAbsoluteEpisodeNumbers: absoluteEpisodeNumbers === events.length,
};
}, [series, events]);
const anyDownloading = isDownloading || anyQueued;
const anyDownloading = isDownloading || anyGrabbed;
const statusStyle = getStatusStyle(
allDownloaded,

View File

@@ -22,7 +22,12 @@ interface CalendarLinkModalContentProps {
function CalendarLinkModalContent({
onModalClose,
}: CalendarLinkModalContentProps) {
const [state, setState] = useState({
const [state, setState] = useState<{
unmonitored: boolean;
premieresOnly: boolean;
asAllDay: boolean;
tags: number[];
}>({
unmonitored: false,
premieresOnly: false,
asAllDay: false,

View File

@@ -1,3 +1,4 @@
import { autoUpdate, flip, size, useFloating } from '@floating-ui/react-dom';
import classNames from 'classnames';
import React, {
FocusEvent,
@@ -19,8 +20,6 @@ import Autosuggest, {
RenderInputComponentProps,
RenderSuggestionsContainerParams,
} from 'react-autosuggest';
import { Manager, Popper, Reference } from 'react-popper';
import Portal from 'Components/Portal';
import usePrevious from 'Helpers/Hooks/usePrevious';
import { InputChanged } from 'typings/inputs';
import styles from './AutoSuggestInput.css';
@@ -37,7 +36,6 @@ interface AutoSuggestInputProps<T>
hasError?: boolean;
hasWarning?: boolean;
enforceMaxHeight?: boolean;
minHeight?: number;
maxHeight?: number;
renderInputComponent?: (
inputProps: RenderInputComponentProps,
@@ -70,7 +68,6 @@ function AutoSuggestInput<T = any>(props: AutoSuggestInputProps<T>) {
enforceMaxHeight = true,
hasError,
hasWarning,
minHeight = 50,
maxHeight = 200,
getSuggestionValue,
renderSuggestion,
@@ -89,95 +86,60 @@ function AutoSuggestInput<T = any>(props: AutoSuggestInputProps<T>) {
const updater = useRef<(() => void) | null>(null);
const previousSuggestions = usePrevious(suggestions);
const handleComputeMaxHeight = useCallback(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(data: any) => {
const { top, bottom, width } = data.offsets.reference;
if (enforceMaxHeight) {
data.styles.maxHeight = maxHeight;
} else {
const windowHeight = window.innerHeight;
if (/^botton/.test(data.placement)) {
data.styles.maxHeight = windowHeight - bottom;
} else {
data.styles.maxHeight = top;
}
}
data.styles.width = width;
return data;
},
[enforceMaxHeight, maxHeight]
);
const { refs, floatingStyles } = useFloating({
middleware: [
flip({
crossAxis: false,
mainAxis: true,
}),
size({
apply({ availableHeight, elements, rects }) {
Object.assign(elements.floating.style, {
minWidth: `${rects.reference.width}px`,
maxHeight: `${Math.max(0, availableHeight)}px`,
});
},
}),
],
placement: 'bottom-start',
whileElementsMounted: autoUpdate,
});
const createRenderInputComponent = useCallback(
(inputProps: RenderInputComponentProps) => {
return (
<Reference>
{({ ref }) => {
if (renderInputComponent) {
return renderInputComponent(inputProps, ref);
}
if (renderInputComponent) {
return renderInputComponent(inputProps, refs.setReference);
}
return (
<div ref={ref}>
<input {...inputProps} />
</div>
);
}}
</Reference>
return (
<div ref={refs.setReference}>
<input {...inputProps} />
</div>
);
},
[renderInputComponent]
[refs.setReference, renderInputComponent]
);
const renderSuggestionsContainer = useCallback(
({ containerProps, children }: RenderSuggestionsContainerParams) => {
return (
<Portal>
<Popper
placement="bottom-start"
modifiers={{
computeMaxHeight: {
order: 851,
enabled: true,
fn: handleComputeMaxHeight,
},
flip: {
padding: minHeight,
},
<div
ref={refs.setFloating}
style={floatingStyles}
className={children ? styles.suggestionsContainerOpen : undefined}
>
<div
{...containerProps}
style={{
maxHeight: enforceMaxHeight ? maxHeight : undefined,
}}
>
{({ ref: popperRef, style, scheduleUpdate }) => {
updater.current = scheduleUpdate;
return (
<div
ref={popperRef}
style={style}
className={
children ? styles.suggestionsContainerOpen : undefined
}
>
<div
{...containerProps}
style={{
maxHeight: style.maxHeight,
}}
>
{children}
</div>
</div>
);
}}
</Popper>
</Portal>
{children}
</div>
</div>
);
},
[minHeight, handleComputeMaxHeight]
[enforceMaxHeight, floatingStyles, maxHeight, refs.setFloating]
);
const handleInputKeyDown = useCallback(
@@ -236,23 +198,21 @@ function AutoSuggestInput<T = any>(props: AutoSuggestInputProps<T>) {
}, [suggestions, previousSuggestions]);
return (
<Manager>
<Autosuggest
{...otherProps}
ref={forwardedRef}
id={name}
inputProps={inputProps}
theme={theme}
suggestions={suggestions}
getSuggestionValue={getSuggestionValue}
renderInputComponent={createRenderInputComponent}
renderSuggestionsContainer={renderSuggestionsContainer}
renderSuggestion={renderSuggestion}
onSuggestionSelected={onSuggestionSelected}
onSuggestionsFetchRequested={onSuggestionsFetchRequested}
onSuggestionsClearRequested={onSuggestionsClearRequested}
/>
</Manager>
<Autosuggest
{...otherProps}
ref={forwardedRef}
id={name}
inputProps={inputProps}
theme={theme}
suggestions={suggestions}
getSuggestionValue={getSuggestionValue}
renderInputComponent={createRenderInputComponent}
renderSuggestionsContainer={renderSuggestionsContainer}
renderSuggestion={renderSuggestion}
onSuggestionSelected={onSuggestionSelected}
onSuggestionsFetchRequested={onSuggestionsFetchRequested}
onSuggestionsClearRequested={onSuggestionsClearRequested}
/>
);
}

View File

@@ -139,11 +139,11 @@ type PickProps<V, C extends InputType> = C extends 'text'
? // eslint-disable-next-line @typescript-eslint/no-explicit-any
EnhancedSelectInputProps<any, V>
: C extends 'seriesTag'
? SeriesTagInputProps
? SeriesTagInputProps<V>
: C extends 'seriesTypeSelect'
? SeriesTypeSelectInputProps
: C extends 'tag'
? SeriesTagInputProps
? SeriesTagInputProps<V>
: C extends 'tagSelect'
? TagSelectInputProps
: C extends 'text'
@@ -222,7 +222,7 @@ function FormInputGroup<T, C extends InputType>(
<div className={containerClassName}>
<div className={className}>
<div className={styles.inputContainer}>
{/* @ts-expect-error - tpyes are validated already */}
{/* @ts-expect-error - types are validated already */}
<InputComponent
className={inputClassName}
helpText={helpText}

View File

@@ -120,7 +120,7 @@ function ProviderFieldFormGroup<T>({
helpTextWarning={helpTextWarning}
helpLink={helpLink}
placeholder={placeholder}
// @ts-expect-error - this isn;'t available on all types
// @ts-expect-error - this isn't available on all types
selectOptionsProviderAction={selectOptionsProviderAction}
value={value}
values={selectValues}

View File

@@ -42,15 +42,10 @@
color: var(--disabledInputColor);
}
.optionsContainer {
z-index: $popperZIndex;
max-height: vh(50);
width: auto;
}
.options {
composes: scroller from '~Components/Scroller/Scroller.css';
z-index: $popperZIndex;
border: 1px solid var(--inputBorderColor);
border-radius: 4px;
background-color: var(--inputBackgroundColor);

View File

@@ -13,7 +13,6 @@ interface CssExports {
'mobileCloseButton': string;
'mobileCloseButtonContainer': string;
'options': string;
'optionsContainer': string;
'optionsInnerModalBody': string;
'optionsModal': string;
'optionsModalBody': string;

View File

@@ -1,3 +1,13 @@
import {
autoUpdate,
flip,
FloatingPortal,
size,
useClick,
useDismiss,
useFloating,
useInteractions,
} from '@floating-ui/react';
import classNames from 'classnames';
import React, {
ElementType,
@@ -6,31 +16,24 @@ import React, {
useCallback,
useEffect,
useMemo,
useRef,
useState,
} from 'react';
import { Manager, Popper, Reference } from 'react-popper';
import Icon from 'Components/Icon';
import Link from 'Components/Link/Link';
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
import Modal from 'Components/Modal/Modal';
import ModalBody from 'Components/Modal/ModalBody';
import Portal from 'Components/Portal';
import Scroller from 'Components/Scroller/Scroller';
import useMeasure from 'Helpers/Hooks/useMeasure';
import { icons } from 'Helpers/Props';
import ArrayElement from 'typings/Helpers/ArrayElement';
import { EnhancedSelectInputChanged, InputChanged } from 'typings/inputs';
import { isMobile as isMobileUtil } from 'Utilities/browser';
import * as keyCodes from 'Utilities/Constants/keyCodes';
import getUniqueElementId from 'Utilities/getUniqueElementId';
import TextInput from '../TextInput';
import HintedSelectInputOption from './HintedSelectInputOption';
import HintedSelectInputSelectedValue from './HintedSelectInputSelectedValue';
import styles from './EnhancedSelectInput.css';
const MINIMUM_DISTANCE_FROM_EDGE = 30;
function isArrowKey(keyCode: number) {
return keyCode === keyCodes.UP_ARROW || keyCode === keyCodes.DOWN_ARROW;
}
@@ -162,10 +165,6 @@ function EnhancedSelectInput<T extends EnhancedSelectInputValue<V>, V>(
onOpen,
} = props;
const [measureRef, { width }] = useMeasure();
const updater = useRef<(() => void) | null>(null);
const buttonId = useMemo(() => getUniqueElementId(), []);
const optionsId = useMemo(() => getUniqueElementId(), []);
const [selectedIndex, setSelectedIndex] = useState(
getSelectedIndex(value, values)
);
@@ -175,6 +174,38 @@ function EnhancedSelectInput<T extends EnhancedSelectInputValue<V>, V>(
const isMultiSelect = Array.isArray(value);
const selectedOption = getSelectedOption(selectedIndex, values);
const { refs, context, floatingStyles } = useFloating({
middleware: [
flip({
crossAxis: false,
mainAxis: true,
}),
size({
apply({ availableHeight, elements, rects }) {
Object.assign(elements.floating.style, {
minWidth: `${rects.reference.width}px`,
maxHeight: `${Math.max(
0,
Math.min(window.innerHeight / 2, availableHeight)
)}px`,
});
},
}),
],
open: isOpen,
placement: 'bottom-start',
whileElementsMounted: autoUpdate,
onOpenChange: setIsOpen,
});
const click = useClick(context);
const dismiss = useDismiss(context);
const { getReferenceProps, getFloatingProps } = useInteractions([
click,
dismiss,
]);
const selectedValue = useMemo(() => {
if (values.length) {
return value;
@@ -189,59 +220,9 @@ function EnhancedSelectInput<T extends EnhancedSelectInputValue<V>, V>(
return '';
}, [value, values, isMultiSelect]);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const handleComputeMaxHeight = useCallback((data: any) => {
const { top, bottom } = data.offsets.reference;
const windowHeight = window.innerHeight;
if (/^bottom/.test(data.placement)) {
data.styles.maxHeight =
windowHeight - bottom - MINIMUM_DISTANCE_FROM_EDGE;
} else {
data.styles.maxHeight = top - MINIMUM_DISTANCE_FROM_EDGE;
}
return data;
}, []);
const handleWindowClick = useCallback(
(event: MouseEvent) => {
const button = document.getElementById(buttonId);
const options = document.getElementById(optionsId);
const eventTarget = event.target as HTMLElement;
if (!button || !eventTarget.isConnected || isMobile) {
return;
}
if (
!button.contains(eventTarget) &&
options &&
!options.contains(eventTarget) &&
isOpen
) {
setIsOpen(false);
window.removeEventListener('click', handleWindowClick);
}
},
[isMobile, isOpen, buttonId, optionsId, setIsOpen]
);
const addListener = useCallback(() => {
window.addEventListener('click', handleWindowClick);
}, [handleWindowClick]);
const removeListener = useCallback(() => {
window.removeEventListener('click', handleWindowClick);
}, [handleWindowClick]);
const handlePress = useCallback(() => {
if (!isOpen && onOpen) {
onOpen();
}
setIsOpen(!isOpen);
}, [isOpen, setIsOpen, onOpen]);
setIsOpen((prevIsOpen) => !prevIsOpen);
}, []);
const handleSelect = useCallback(
(newValue: ArrayElement<V>) => {
@@ -298,10 +279,9 @@ function EnhancedSelectInput<T extends EnhancedSelectInputValue<V>, V>(
const handleFocus = useCallback(() => {
if (isOpen) {
removeListener();
setIsOpen(false);
}
}, [isOpen, setIsOpen, removeListener]);
}, [isOpen, setIsOpen]);
const handleKeyDown = useCallback(
(event: KeyboardEvent<HTMLButtonElement>) => {
@@ -395,172 +375,122 @@ function EnhancedSelectInput<T extends EnhancedSelectInputValue<V>, V>(
[onChange]
);
useEffect(() => {
if (updater.current) {
updater.current();
}
});
useEffect(() => {
if (isOpen) {
addListener();
} else {
removeListener();
onOpen?.();
}
return removeListener;
}, [isOpen, addListener, removeListener]);
}, [isOpen, onOpen]);
return (
<div>
<Manager>
<Reference>
{({ ref }) => (
<div ref={ref} id={buttonId}>
<div ref={measureRef}>
{isEditable && typeof value === 'string' ? (
<div className={styles.editableContainer}>
<TextInput
className={className}
name={name}
value={value}
readOnly={isDisabled}
hasError={hasError}
hasWarning={hasWarning}
onFocus={handleFocus}
onBlur={handleBlur}
onChange={handleEditChange}
/>
<Link
className={classNames(
styles.dropdownArrowContainerEditable,
isDisabled
? styles.dropdownArrowContainerDisabled
: styles.dropdownArrowContainer
)}
onPress={handlePress}
>
{isFetching ? (
<LoadingIndicator
className={styles.loading}
size={20}
/>
) : null}
<>
<div ref={refs.setReference} {...getReferenceProps()}>
{isEditable && typeof value === 'string' ? (
<div className={styles.editableContainer}>
<TextInput
className={className}
name={name}
value={value}
readOnly={isDisabled}
hasError={hasError}
hasWarning={hasWarning}
onFocus={handleFocus}
onBlur={handleBlur}
onChange={handleEditChange}
/>
<Link
className={classNames(
styles.dropdownArrowContainerEditable,
isDisabled
? styles.dropdownArrowContainerDisabled
: styles.dropdownArrowContainer
)}
onPress={handlePress}
>
{isFetching ? (
<LoadingIndicator className={styles.loading} size={20} />
) : null}
{isFetching ? null : <Icon name={icons.CARET_DOWN} />}
</Link>
</div>
) : (
<Link
className={classNames(
className,
hasError && styles.hasError,
hasWarning && styles.hasWarning,
isDisabled && disabledClassName
)}
isDisabled={isDisabled}
onBlur={handleBlur}
onKeyDown={handleKeyDown}
onPress={handlePress}
>
<SelectedValueComponent
values={values}
{...selectedValueOptions}
selectedValue={selectedValue}
isDisabled={isDisabled}
isMultiSelect={isMultiSelect}
>
{selectedOption ? selectedOption.value : selectedValue}
</SelectedValueComponent>
<div
className={
isDisabled
? styles.dropdownArrowContainerDisabled
: styles.dropdownArrowContainer
}
>
{isFetching ? (
<LoadingIndicator
className={styles.loading}
size={20}
/>
) : null}
{isFetching ? null : <Icon name={icons.CARET_DOWN} />}
</div>
</Link>
)}
</div>
</div>
)}
</Reference>
<Portal>
<Popper
placement="bottom-start"
modifiers={{
computeMaxHeight: {
order: 851,
enabled: true,
fn: handleComputeMaxHeight,
},
}}
{isFetching ? null : <Icon name={icons.CARET_DOWN} />}
</Link>
</div>
) : (
<Link
className={classNames(
className,
hasError && styles.hasError,
hasWarning && styles.hasWarning,
isDisabled && disabledClassName
)}
isDisabled={isDisabled}
onBlur={handleBlur}
onKeyDown={handleKeyDown}
onPress={handlePress}
>
{({ ref, style, scheduleUpdate }) => {
updater.current = scheduleUpdate;
<SelectedValueComponent
values={values}
{...selectedValueOptions}
selectedValue={selectedValue}
isDisabled={isDisabled}
isMultiSelect={isMultiSelect}
>
{selectedOption ? selectedOption.value : selectedValue}
</SelectedValueComponent>
<div
className={
isDisabled
? styles.dropdownArrowContainerDisabled
: styles.dropdownArrowContainer
}
>
{isFetching ? (
<LoadingIndicator className={styles.loading} size={20} />
) : null}
{isFetching ? null : <Icon name={icons.CARET_DOWN} />}
</div>
</Link>
)}
</div>
{!isMobile && isOpen ? (
<FloatingPortal id="portal-root">
<Scroller
ref={refs.setFloating}
className={styles.options}
style={floatingStyles}
{...getFloatingProps()}
>
{values.map((v, index) => {
const hasParent = v.parentKey !== undefined;
const depth = hasParent ? 1 : 0;
const parentSelected =
v.parentKey !== undefined &&
Array.isArray(value) &&
value.includes(v.parentKey);
const { key, ...other } = v;
return (
<div
ref={ref}
id={optionsId}
className={styles.optionsContainer}
style={{
...style,
minWidth: width,
}}
<OptionComponent
key={v.key}
id={v.key}
depth={depth}
isSelected={isSelectedItem(index, value, values)}
isDisabled={parentSelected}
isMultiSelect={isMultiSelect}
{...valueOptions}
{...other}
isMobile={false}
onSelect={handleSelect}
>
{isOpen && !isMobile ? (
<Scroller
className={styles.options}
style={{
maxHeight: style.maxHeight,
}}
>
{values.map((v, index) => {
const hasParent = v.parentKey !== undefined;
const depth = hasParent ? 1 : 0;
const parentSelected =
v.parentKey !== undefined &&
Array.isArray(value) &&
value.includes(v.parentKey);
const { key, ...other } = v;
return (
<OptionComponent
key={v.key}
id={v.key}
depth={depth}
isSelected={isSelectedItem(index, value, values)}
isDisabled={parentSelected}
isMultiSelect={isMultiSelect}
{...valueOptions}
{...other}
isMobile={false}
onSelect={handleSelect}
>
{v.value}
</OptionComponent>
);
})}
</Scroller>
) : null}
</div>
{v.value}
</OptionComponent>
);
}}
</Popper>
</Portal>
</Manager>
})}
</Scroller>
</FloatingPortal>
) : null}
{isMobile ? (
<Modal
@@ -615,7 +545,7 @@ function EnhancedSelectInput<T extends EnhancedSelectInputValue<V>, V>(
</ModalBody>
</Modal>
) : null}
</div>
</>
);
}

View File

@@ -19,7 +19,6 @@ function HintedSelectInputOption(props: HintedSelectInputOptionProps) {
hint,
depth,
isSelected = false,
isMultiSelect,
isMobile,
...otherProps
} = props;

View File

@@ -88,13 +88,10 @@ function QualityProfileSelectInput({
);
const handleChange = useCallback(
({ value: newValue }: EnhancedSelectInputChanged<string | number>) => {
onChange({
name,
value: newValue === 'noChange' ? value : newValue,
});
({ value }: EnhancedSelectInputChanged<string | number>) => {
onChange({ name, value });
},
[name, value, onChange]
[name, onChange]
);
useEffect(() => {

View File

@@ -21,6 +21,7 @@ const ADD_NEW_KEY = 'addNew';
export interface RootFolderSelectInputValue
extends EnhancedSelectInputValue<string> {
freeSpace?: number;
isMissing?: boolean;
}
@@ -42,66 +43,58 @@ function createRootFolderOptionsSelector(
includeNoChange: boolean,
includeNoChangeDisabled: boolean
) {
return createSelector(
createRootFoldersSelector(),
(rootFolders) => {
const values: RootFolderSelectInputValue[] = rootFolders.items.map(
(rootFolder) => {
return {
key: rootFolder.path,
value: rootFolder.path,
freeSpace: rootFolder.freeSpace,
isMissing: false,
};
}
);
if (includeNoChange) {
values.unshift({
key: 'noChange',
get value() {
return translate('NoChange');
},
isDisabled: includeNoChangeDisabled,
return createSelector(createRootFoldersSelector(), (rootFolders) => {
const values: RootFolderSelectInputValue[] = rootFolders.items.map(
(rootFolder) => {
return {
key: rootFolder.path,
value: rootFolder.path,
freeSpace: rootFolder.freeSpace,
isMissing: false,
});
};
}
);
if (!values.length) {
values.push({
key: '',
value: '',
isDisabled: true,
isHidden: true,
});
}
if (
includeMissingValue &&
value &&
!values.find((v) => v.key === value)
) {
values.push({
key: value,
value,
isMissing: true,
isDisabled: true,
});
}
values.push({
key: ADD_NEW_KEY,
value: translate('AddANewPath'),
if (includeNoChange) {
values.unshift({
key: 'noChange',
get value() {
return translate('NoChange');
},
isDisabled: includeNoChangeDisabled,
isMissing: false,
});
return {
values,
isSaving: rootFolders.isSaving,
saveError: rootFolders.saveError,
};
}
);
if (!values.length) {
values.push({
key: '',
value: '',
isDisabled: true,
isHidden: true,
});
}
if (includeMissingValue && value && !values.find((v) => v.key === value)) {
values.push({
key: value,
value,
isMissing: true,
isDisabled: true,
});
}
values.push({
key: ADD_NEW_KEY,
value: translate('AddANewPath'),
});
return {
values,
isSaving: rootFolders.isSaving,
saveError: rootFolders.saveError,
};
});
}
function RootFolderSelectInput({

View File

@@ -18,18 +18,16 @@ interface RootFolderSelectInputOptionProps
isWindows?: boolean;
}
function RootFolderSelectInputOption(props: RootFolderSelectInputOptionProps) {
const {
id,
value,
freeSpace,
isMissing,
seriesFolder,
isMobile,
isWindows,
...otherProps
} = props;
function RootFolderSelectInputOption({
id,
value,
freeSpace,
isMissing,
seriesFolder,
isMobile,
isWindows,
...otherProps
}: RootFolderSelectInputOptionProps) {
const slashCharacter = isWindows ? '\\' : '/';
return (

View File

@@ -30,3 +30,11 @@
text-align: right;
font-size: $smallFontSize;
}
.isMissing {
flex: 0 0 auto;
margin-left: 15px;
color: var(--dangerColor);
text-align: right;
font-size: $smallFontSize;
}

View File

@@ -2,6 +2,7 @@
// Please do not change this file!
interface CssExports {
'freeSpace': string;
'isMissing': string;
'path': string;
'pathContainer': string;
'selectedValue': string;

View File

@@ -8,27 +8,23 @@ import styles from './RootFolderSelectInputSelectedValue.css';
interface RootFolderSelectInputSelectedValueProps {
selectedValue: string;
values: RootFolderSelectInputValue[];
freeSpace?: number;
seriesFolder?: string;
isWindows?: boolean;
includeFreeSpace?: boolean;
}
function RootFolderSelectInputSelectedValue(
props: RootFolderSelectInputSelectedValueProps
) {
const {
selectedValue,
values,
freeSpace,
seriesFolder,
includeFreeSpace = true,
isWindows,
...otherProps
} = props;
function RootFolderSelectInputSelectedValue({
selectedValue,
values,
seriesFolder,
includeFreeSpace = true,
isWindows,
...otherProps
}: RootFolderSelectInputSelectedValueProps) {
const slashCharacter = isWindows ? '\\' : '/';
const value = values.find((v) => v.key === selectedValue)?.value;
const { value, freeSpace, isMissing } =
values.find((v) => v.key === selectedValue) ||
({} as RootFolderSelectInputValue);
return (
<EnhancedSelectInputSelectedValue
@@ -53,6 +49,10 @@ function RootFolderSelectInputSelectedValue(
})}
</div>
) : null}
{isMissing ? (
<div className={styles.isMissing}>{translate('Missing')}</div>
) : null}
</EnhancedSelectInputSelectedValue>
);
}

View File

@@ -2,10 +2,12 @@
import React, { SyntheticEvent } from 'react';
import { InputChanged } from 'typings/inputs';
import translate from 'Utilities/String/translate';
import EnhancedSelectInput from './EnhancedSelectInput';
import EnhancedSelectInput, {
EnhancedSelectInputValue,
} from './EnhancedSelectInput';
import styles from './UMaskInput.css';
const umaskOptions = [
const umaskOptions: EnhancedSelectInputValue<string>[] = [
{
key: '755',
get value() {

View File

@@ -1,9 +1,15 @@
import classNames from 'classnames';
import React, { ChangeEvent, SyntheticEvent, useCallback } from 'react';
import React, {
ChangeEvent,
ComponentProps,
SyntheticEvent,
useCallback,
} from 'react';
import { InputChanged } from 'typings/inputs';
import styles from './SelectInput.css';
interface SelectInputOption {
export interface SelectInputOption
extends Pick<ComponentProps<'option'>, 'disabled'> {
key: string | number;
value: string | number | (() => string | number);
}

View File

@@ -1,4 +1,4 @@
import React, { useCallback } from 'react';
import React, { useCallback, useMemo } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { createSelector } from 'reselect';
import { addTag } from 'Store/Actions/tagActions';
@@ -12,10 +12,10 @@ interface SeriesTag extends TagBase {
name: string;
}
export interface SeriesTagInputProps {
export interface SeriesTagInputProps<V> {
name: string;
value: number[];
onChange: (change: InputChanged<number[]>) => void;
value: V;
onChange: (change: InputChanged<V>) => void;
}
const VALID_TAG_REGEX = new RegExp('[^-_a-z0-9]', 'i');
@@ -59,28 +59,48 @@ function createSeriesTagsSelector(tags: number[]) {
});
}
export default function SeriesTagInput({
export default function SeriesTagInput<V extends number | number[]>({
name,
value,
onChange,
}: SeriesTagInputProps) {
}: SeriesTagInputProps<V>) {
const dispatch = useDispatch();
const isArray = Array.isArray(value);
const arrayValue = useMemo(() => {
if (isArray) {
return value as number[];
}
return value === 0 ? [] : [value as number];
}, [isArray, value]);
const { tags, tagList, allTags } = useSelector(
createSeriesTagsSelector(value)
createSeriesTagsSelector(arrayValue)
);
const handleTagCreated = useCallback(
(tag: SeriesTag) => {
onChange({ name, value: [...value, tag.id] });
if (isArray) {
onChange({ name, value: [...value, tag.id] as V });
} else {
onChange({
name,
value: tag.id as V,
});
}
},
[name, value, onChange]
[name, value, isArray, onChange]
);
const handleTagAdd = useCallback(
(newTag: SeriesTag) => {
if (newTag.id) {
onChange({ name, value: [...value, newTag.id] });
if (isArray) {
onChange({ name, value: [...value, newTag.id] as V });
} else {
onChange({ name, value: newTag.id as V });
}
return;
}
@@ -96,17 +116,21 @@ export default function SeriesTagInput({
);
}
},
[name, value, allTags, handleTagCreated, onChange, dispatch]
[name, value, isArray, allTags, handleTagCreated, onChange, dispatch]
);
const handleTagDelete = useCallback(
({ index }: { index: number }) => {
const newValue = value.slice();
newValue.splice(index, 1);
if (isArray) {
const newValue = value.slice();
newValue.splice(index, 1);
onChange({ name, value: newValue });
onChange({ name, value: newValue as V });
} else {
onChange({ name, value: 0 as V });
}
},
[name, value, onChange]
[name, value, isArray, onChange]
);
return (

View File

@@ -14,7 +14,7 @@ import {
RenderSuggestion,
SuggestionsFetchRequestedParams,
} from 'react-autosuggest';
import useDebouncedCallback from 'Helpers/Hooks/useDebouncedCallback';
import { useDebouncedCallback } from 'use-debounce';
import { Kind } from 'Helpers/Props/kinds';
import { InputChanged } from 'typings/inputs';
import AutoSuggestInput from '../AutoSuggestInput';

View File

@@ -1,41 +1,22 @@
import {
autoUpdate,
flip,
FloatingPortal,
shift,
useClick,
useDismiss,
useFloating,
useInteractions,
} from '@floating-ui/react';
import React, {
ReactElement,
useCallback,
useEffect,
useId,
useRef,
useState,
} from 'react';
import { Manager, Popper, PopperProps, Reference } from 'react-popper';
import Portal from 'Components/Portal';
import styles from './Menu.css';
const sharedPopperOptions = {
modifiers: {
preventOverflow: {
padding: 0,
},
flip: {
padding: 0,
},
},
};
const popperOptions: {
right: Partial<PopperProps>;
left: Partial<PopperProps>;
} = {
right: {
...sharedPopperOptions,
placement: 'bottom-end',
},
left: {
...sharedPopperOptions,
placement: 'bottom-start',
},
};
interface MenuProps {
className?: string;
children: React.ReactNode;
@@ -49,9 +30,7 @@ function Menu({
alignMenu = 'left',
enforceMaxHeight = true,
}: MenuProps) {
const updater = useRef<(() => void) | null>(null);
const menuButtonId = useId();
const menuContentId = useId();
const [maxHeight, setMaxHeight] = useState(0);
const [isMenuOpen, setIsMenuOpen] = useState(false);
@@ -70,45 +49,14 @@ function Menu({
setMaxHeight(height);
}, [menuButtonId]);
const handleWindowClick = useCallback(
(event: MouseEvent) => {
const menuButton = document.getElementById(menuButtonId);
const handleMenuButtonPress = useCallback(() => {
setIsMenuOpen((isOpen) => !isOpen);
}, []);
if (!menuButton) {
return;
}
if (!menuButton.contains(event.target as Node)) {
setIsMenuOpen(false);
}
},
[menuButtonId]
);
const handleTouchStart = useCallback(
(event: TouchEvent) => {
const menuButton = document.getElementById(menuButtonId);
const menuContent = document.getElementById(menuContentId);
if (!menuButton || !menuContent) {
return;
}
if (event.targetTouches.length !== 1) {
return;
}
const target = event.targetTouches[0].target;
if (
!menuButton.contains(target as Node) &&
!menuContent.contains(target as Node)
) {
setIsMenuOpen(false);
}
},
[menuButtonId, menuContentId]
);
const childrenArray = React.Children.toArray(children);
const button = React.cloneElement(childrenArray[0] as ReactElement, {
onPress: handleMenuButtonPress,
});
const handleWindowResize = useCallback(() => {
updateMaxHeight();
@@ -120,32 +68,15 @@ function Menu({
}
}, [isMenuOpen, updateMaxHeight]);
const handleMenuButtonPress = useCallback(() => {
setIsMenuOpen((isOpen) => !isOpen);
}, []);
const childrenArray = React.Children.toArray(children);
const button = React.cloneElement(childrenArray[0] as ReactElement, {
onPress: handleMenuButtonPress,
});
useEffect(() => {
if (enforceMaxHeight) {
updateMaxHeight();
}
}, [enforceMaxHeight, updateMaxHeight]);
useEffect(() => {
if (updater.current && isMenuOpen) {
updater.current();
}
}, [isMenuOpen]);
useEffect(() => {
// Listen to resize events on the window and scroll events
// on all elements to ensure the menu is the best size possible.
// Listen for click events on the window to support closing the
// menu on clicks outside.
if (!isMenuOpen) {
return;
@@ -153,52 +84,88 @@ function Menu({
window.addEventListener('resize', handleWindowResize);
window.addEventListener('scroll', handleWindowScroll, { capture: true });
window.addEventListener('click', handleWindowClick);
window.addEventListener('touchstart', handleTouchStart);
return () => {
window.removeEventListener('resize', handleWindowResize);
window.removeEventListener('scroll', handleWindowScroll, {
capture: true,
});
window.removeEventListener('click', handleWindowClick);
window.removeEventListener('touchstart', handleTouchStart);
};
}, [
isMenuOpen,
handleWindowResize,
handleWindowScroll,
handleWindowClick,
handleTouchStart,
}, [isMenuOpen, handleWindowResize, handleWindowScroll]);
const { refs, context, floatingStyles } = useFloating({
middleware: [
flip({
crossAxis: false,
mainAxis: true,
}),
// offset({ mainAxis: 10 }),
shift(),
],
open: isMenuOpen,
placement: alignMenu === 'left' ? 'bottom-start' : 'bottom-end',
whileElementsMounted: autoUpdate,
onOpenChange: setIsMenuOpen,
});
const handleFloaterPress = useCallback(
(event: MouseEvent) => {
if (
refs.reference &&
(refs.reference.current as HTMLElement).contains(
event.target as HTMLElement
)
) {
return false;
}
// TODO: Menu items should handle closing when they are clicked.
// This is handled before the menu item click event is handled, so wait 100ms before closing.
setTimeout(() => {
setIsMenuOpen(false);
}, 100);
return true;
},
[refs.reference]
);
const click = useClick(context);
const dismiss = useDismiss(context, {
outsidePressEvent: 'click',
outsidePress: handleFloaterPress,
});
const { getReferenceProps, getFloatingProps } = useInteractions([
click,
dismiss,
]);
return (
<Manager>
<Reference>
{({ ref }) => (
<div ref={ref} id={menuButtonId} className={className}>
{button}
</div>
)}
</Reference>
<>
<div
ref={refs.setReference}
{...getReferenceProps()}
id={menuButtonId}
className={className}
>
{button}
</div>
<Portal>
<Popper {...popperOptions[alignMenu]}>
{({ ref, style, scheduleUpdate }) => {
updater.current = scheduleUpdate;
return React.cloneElement(childrenArray[1] as ReactElement, {
forwardedRef: ref,
style: {
...style,
maxHeight,
},
isOpen: isMenuOpen,
});
}}
</Popper>
</Portal>
</Manager>
{isMenuOpen ? (
<FloatingPortal id="portal-root">
{React.cloneElement(childrenArray[1] as ReactElement, {
forwardedRef: refs.setFloating,
style: {
maxHeight,
...floatingStyles,
},
isOpen: isMenuOpen,
...getFloatingProps(),
})}
</FloatingPortal>
) : null}
</>
);
}

View File

@@ -88,13 +88,6 @@
}
@media only screen and (max-width: $breakpointMedium) {
.modal.small,
.modal.medium {
width: 90%;
}
}
@media only screen and (max-width: $breakpointSmall) {
.modalContainer {
position: fixed;
}

View File

@@ -13,10 +13,10 @@ import React, {
import Autosuggest from 'react-autosuggest';
import { useDispatch, useSelector } from 'react-redux';
import { createSelector } from 'reselect';
import { useDebouncedCallback } from 'use-debounce';
import { Tag } from 'App/State/TagsAppState';
import Icon from 'Components/Icon';
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
import useDebouncedCallback from 'Helpers/Hooks/useDebouncedCallback';
import useKeyboardShortcuts from 'Helpers/Hooks/useKeyboardShortcuts';
import { icons } from 'Helpers/Props';
import Series from 'Series/Series';
@@ -316,7 +316,7 @@ function SeriesSearchInput() {
return;
}
// If an suggestion is not selected go to the first series,
// If a suggestion is not selected go to the first series,
// otherwise go to the selected series.
const selectedSuggestion =

View File

@@ -359,34 +359,37 @@ function PageSidebar({ isSidebarVisible, isSmallScreen }: PageSidebarProps) {
});
}, []);
const handleTouchEnd = useCallback((event: TouchEvent) => {
const touches = event.changedTouches;
const currentTouch = touches[0].pageX;
const handleTouchEnd = useCallback(
(event: TouchEvent) => {
const touches = event.changedTouches;
const currentTouch = touches[0].pageX;
if (!touchStartX.current) {
return;
}
if (!touchStartX.current) {
return;
}
if (currentTouch > touchStartX.current && currentTouch > 50) {
setSidebarTransform({
transition: 'none',
transform: 0,
});
} else if (currentTouch < touchStartX.current && currentTouch < 80) {
setSidebarTransform({
transition: 'transform 50ms ease-in-out',
transform: SIDEBAR_WIDTH * -1,
});
} else {
setSidebarTransform({
transition: 'none',
transform: 0,
});
}
if (currentTouch > touchStartX.current && currentTouch > 50) {
setSidebarTransform({
transition: 'none',
transform: 0,
});
} else if (currentTouch < touchStartX.current && currentTouch < 80) {
setSidebarTransform({
transition: 'transform 50ms ease-in-out',
transform: SIDEBAR_WIDTH * -1,
});
} else {
setSidebarTransform({
transition: 'none',
transform: isSidebarVisible ? 0 : SIDEBAR_WIDTH * -1,
});
}
touchStartX.current = null;
touchStartY.current = null;
}, []);
touchStartX.current = null;
touchStartY.current = null;
},
[isSidebarVisible]
);
const handleTouchCancel = useCallback(() => {
touchStartX.current = null;

View File

@@ -24,6 +24,7 @@
composes: link;
padding: 10px 24px;
padding-left: 35px;
}
.isActiveLink {
@@ -41,10 +42,6 @@
text-align: center;
}
.noIcon {
margin-left: 25px;
}
.status {
float: right;
}

View File

@@ -8,7 +8,6 @@ interface CssExports {
'isActiveParentLink': string;
'item': string;
'link': string;
'noIcon': string;
'status': string;
}
export const cssExports: CssExports;

View File

@@ -54,9 +54,7 @@ function PageSidebarItem({
</span>
)}
<span className={isChildItem ? styles.noIcon : undefined}>
{typeof title === 'function' ? title() : title}
</span>
{typeof title === 'function' ? title() : title}
{!!StatusComponent && (
<span className={styles.status}>

View File

@@ -22,11 +22,14 @@
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
height: 24px;
}
.label {
padding: 0 3px;
max-width: 100%;
max-height: 100%;
color: var(--toolbarLabelColor);
font-size: $extraSmallFontSize;
line-height: calc($extraSmallFontSize + 1px);

View File

@@ -31,6 +31,7 @@ function PageToolbarButton({
isDisabled && styles.isDisabled
)}
isDisabled={isDisabled || isSpinning}
title={label}
{...otherProps}
>
<Icon

View File

@@ -80,8 +80,12 @@ function PageToolbarSection({
if (buttonCount - 1 === maxButtons) {
const overflowItems: PageToolbarButtonProps[] = [];
const buttonsWithoutSeparators = validChildren.filter(
(child) => Object.keys(child.props).length > 0
);
return {
buttons: validChildren,
buttons: buttonsWithoutSeparators,
buttonCount,
overflowItems,
};

View File

@@ -4,7 +4,7 @@
line-height: 1.52857143;
}
@media only screen and (max-width: $breakpointSmall) {
@media only screen and (max-width: $breakpointMedium) {
.cell {
white-space: nowrap;
}

View File

@@ -7,7 +7,7 @@
white-space: nowrap;
}
@media only screen and (max-width: $breakpointSmall) {
@media only screen and (max-width: $breakpointMedium) {
.cell {
white-space: nowrap;
}

View File

@@ -8,7 +8,7 @@ interface Column {
name: string;
label: string | PropertyFunction<string> | React.ReactNode;
className?: string;
columnLabel?: string;
columnLabel?: string | PropertyFunction<string>;
isSortable?: boolean;
fixedSortDirection?: SortDirection;
isVisible: boolean;

View File

@@ -10,7 +10,7 @@
border-collapse: collapse;
}
@media only screen and (max-width: $breakpointSmall) {
@media only screen and (max-width: $breakpointMedium) {
.tableContainer {
min-width: 100%;
width: fit-content;

View File

@@ -9,7 +9,7 @@
margin-left: 10px;
}
@media only screen and (max-width: $breakpointSmall) {
@media only screen and (max-width: $breakpointMedium) {
.headerCell {
white-space: nowrap;
}

View File

@@ -60,7 +60,7 @@
height: 25px;
}
@media only screen and (max-width: $breakpointSmall) {
@media only screen and (max-width: $breakpointMedium) {
.pager {
flex-wrap: wrap;
}

View File

@@ -1,6 +1,6 @@
import classNames from 'classnames';
import React, { useCallback, useMemo, useState } from 'react';
import SelectInput from 'Components/Form/SelectInput';
import SelectInput, { SelectInputOption } from 'Components/Form/SelectInput';
import Icon from 'Components/Icon';
import Link from 'Components/Link/Link';
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
@@ -14,10 +14,10 @@ interface TablePagerProps {
totalPages?: number;
totalRecords?: number;
isFetching?: boolean;
onFirstPagePress: () => void;
onPreviousPagePress: () => void;
onNextPagePress: () => void;
onLastPagePress: () => void;
onFirstPagePress?: () => void;
onPreviousPagePress?: () => void;
onNextPagePress?: () => void;
onLastPagePress?: () => void;
onPageSelect: (page: number) => void;
}
@@ -26,10 +26,6 @@ function TablePager({
totalPages,
totalRecords = 0,
isFetching,
onFirstPagePress,
onPreviousPagePress,
onNextPagePress,
onLastPagePress,
onPageSelect,
}: TablePagerProps) {
const [isShowingPageSelect, setIsShowingPageSelect] = useState(false);
@@ -38,7 +34,7 @@ function TablePager({
const isLastPage = page === totalPages;
const pages = useMemo(() => {
return Array.from(new Array(totalPages), (_x, i) => {
return Array.from(new Array(totalPages), (_x, i): SelectInputOption => {
const pageNumber = i + 1;
return {
@@ -64,6 +60,34 @@ function TablePager({
setIsShowingPageSelect(false);
}, []);
const handleFirstPagePress = useCallback(() => {
onPageSelect(1);
}, [onPageSelect]);
const onPreviousPagePress = useCallback(() => {
if (!page) {
return;
}
onPageSelect(page - 1);
}, [onPageSelect, page]);
const onNextPagePress = useCallback(() => {
if (!page) {
return;
}
onPageSelect(page + 1);
}, [onPageSelect, page]);
const onLastPagePress = useCallback(() => {
if (!totalPages) {
return;
}
onPageSelect(totalPages);
}, [onPageSelect, totalPages]);
if (!page) {
return null;
}
@@ -84,7 +108,7 @@ function TablePager({
isFirstPage && styles.disabledPageButton
)}
isDisabled={isFirstPage}
onPress={onFirstPagePress}
onPress={handleFirstPagePress}
>
<Icon name={icons.PAGE_FIRST} />
</Link>

View File

@@ -9,7 +9,7 @@
margin-left: 10px;
}
@media only screen and (max-width: $breakpointSmall) {
@media only screen and (max-width: $breakpointMedium) {
.headerCell {
white-space: nowrap;
}

View File

@@ -1,6 +1,5 @@
.tooltipContainer {
z-index: $popperZIndex;
margin: 10px;
}
.tooltip {
@@ -18,174 +17,24 @@
}
}
.arrow,
.arrow::after {
position: absolute;
display: block;
width: 0;
height: 0;
border-width: 11px;
border-style: solid;
border-color: transparent;
}
.arrowDisabled {
display: none;
}
.arrow::after {
border-width: 10px;
content: '';
}
.top {
bottom: -11px;
margin-left: -11px;
border-bottom-width: 0;
&::after {
bottom: 1px;
margin-left: -10px;
border-bottom-width: 0;
content: ' ';
&.default {
border-top-color: var(--popoverArrowBorderColor);
}
&.inverse {
border-top-color: var(--popoverArrowBorderInverseColor);
}
}
&.default {
border-top-color: var(--popoverArrowBorderColor);
}
&.inverse {
border-top-color: var(--popoverArrowBorderInverseColor);
}
}
.right {
left: -11px;
margin-top: -11px;
border-left-width: 0;
&::after {
bottom: -10px;
left: 1px;
border-left-width: 0;
content: ' ';
&.default {
border-right-color: var(--popoverArrowBorderColor);
}
&.inverse {
border-right-color: var(--popoverArrowBorderInverseColor);
}
}
&.default {
border-right-color: var(--popoverArrowBorderColor);
}
&.inverse {
border-right-color: var(--popoverArrowBorderInverseColor);
}
}
.bottom {
top: -11px;
margin-left: -11px;
border-top-width: 0;
&::after {
top: 1px;
margin-left: -10px;
border-top-width: 0;
content: ' ';
&.default {
border-bottom-color: var(--popoverArrowBorderColor);
}
&.inverse {
border-bottom-color: var(--popoverArrowBorderInverseColor);
}
}
&.default {
border-bottom-color: var(--popoverArrowBorderColor);
}
&.inverse {
border-bottom-color: var(--popoverArrowBorderInverseColor);
}
}
.left {
right: -11px;
margin-top: -11px;
border-right-width: 0;
&::after {
right: 1px;
bottom: -10px;
border-right-width: 0;
content: ' ';
&.default {
border-left-color: var(--popoverArrowBorderColor);
}
&.inverse {
border-left-color: var(--popoverArrowBorderInverseColor);
}
}
&.default {
border-left-color: var(--popoverArrowBorderColor);
}
&.inverse {
border-left-color: var(--popoverArrowBorderInverseColor);
}
}
.body {
padding: 5px;
}
.verticalContainer {
max-height: 300px;
}
.horizontalContainer {
max-width: calc($breakpointExtraSmall - 20px);
}
@media only screen and (min-width: $breakpointExtraSmall) {
.horizontalContainer {
.tooltip {
max-width: calc($breakpointSmall * 0.8);
}
}
@media only screen and (min-width: $breakpointSmall) {
.horizontalContainer {
.tooltip {
max-width: calc($breakpointMedium * 0.8);
}
}
@media only screen and (min-width: $breakpointMedium) {
.horizontalContainer {
.tooltip {
max-width: calc($breakpointLarge * 0.8);
}
}
/* @media only screen and (max-width: $breakpointLarge) {
.horizontalContainer {
max-width: calc($breakpointLarge * 0.8);
}
} */

View File

@@ -1,19 +1,11 @@
// This file is automatically generated.
// Please do not change this file!
interface CssExports {
'arrow': string;
'arrowDisabled': string;
'body': string;
'bottom': string;
'default': string;
'horizontalContainer': string;
'inverse': string;
'left': string;
'right': string;
'tooltip': string;
'tooltipContainer': string;
'top': string;
'verticalContainer': string;
}
export const cssExports: CssExports;
export default cssExports;

View File

@@ -1,17 +1,25 @@
import {
arrow,
autoUpdate,
flip,
FloatingArrow,
FloatingPortal,
offset,
Placement,
safePolygon,
shift,
useClick,
useDismiss,
useFloating,
useHover,
useInteractions,
} from '@floating-ui/react';
import classNames from 'classnames';
import React, {
useCallback,
useEffect,
useMemo,
useRef,
useState,
} from 'react';
import { Manager, Popper, Reference } from 'react-popper';
import Portal from 'Components/Portal';
import { kinds, tooltipPositions } from 'Helpers/Props';
import React, { useRef, useState } from 'react';
import { useThemeColor } from 'Helpers/Hooks/useTheme';
import { kinds } from 'Helpers/Props';
import { Kind } from 'Helpers/Props/kinds';
import dimensions from 'Styles/Variables/dimensions';
import { isMobile as isMobileUtil } from 'Utilities/browser';
import { isMobile } from 'Utilities/browser';
import styles from './Tooltip.css';
export interface TooltipProps {
@@ -19,8 +27,8 @@ export interface TooltipProps {
bodyClassName?: string;
anchor: React.ReactNode;
tooltip: string | React.ReactNode;
kind?: Extract<Kind, keyof typeof styles>;
position?: (typeof tooltipPositions.all)[number];
kind?: Extract<Kind, 'default' | 'inverse'>;
position?: Placement;
canFlip?: boolean;
}
function Tooltip(props: TooltipProps) {
@@ -30,196 +38,76 @@ function Tooltip(props: TooltipProps) {
anchor,
tooltip,
kind = kinds.DEFAULT,
position = tooltipPositions.TOP,
canFlip = false,
position,
canFlip = true,
} = props;
const closeTimeout = useRef<ReturnType<typeof setTimeout>>();
const updater = useRef<(() => void) | null>(null);
const arrowColor = useThemeColor(
kind === 'inverse'
? 'popoverArrowBorderInverseColor'
: 'popoverArrowBorderColor'
);
const [isOpen, setIsOpen] = useState(false);
const handleClick = useCallback(() => {
if (!isMobileUtil()) {
return;
}
const arrowRef = useRef(null);
setIsOpen((isOpen) => {
return !isOpen;
});
}, [setIsOpen]);
const handleMouseEnterAnchor = useCallback(() => {
// Mobile will fire mouse enter and click events rapidly,
// this causes the tooltip not to open on the first press.
// Ignore the mouse enter event on mobile.
if (isMobileUtil()) {
return;
}
if (closeTimeout.current) {
clearTimeout(closeTimeout.current);
}
setIsOpen(true);
}, [setIsOpen]);
const handleMouseEnterTooltip = useCallback(() => {
if (closeTimeout.current) {
clearTimeout(closeTimeout.current);
}
setIsOpen(true);
}, [setIsOpen]);
const handleMouseLeave = useCallback(() => {
// Still listen for mouse leave on mobile to allow clicks outside to close the tooltip.
clearTimeout(closeTimeout.current);
closeTimeout.current = setTimeout(() => {
setIsOpen(false);
}, 100);
}, [setIsOpen]);
const maxWidth = useMemo(() => {
const windowWidth = window.innerWidth;
if (windowWidth >= parseInt(dimensions.breakpointLarge)) {
return 800;
} else if (windowWidth >= parseInt(dimensions.breakpointMedium)) {
return 650;
} else if (windowWidth >= parseInt(dimensions.breakpointSmall)) {
return 500;
}
return 450;
}, []);
const computeMaxSize = useCallback(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(data: any) => {
const { top, right, bottom, left } = data.offsets.reference;
const windowWidth = window.innerWidth;
const windowHeight = window.innerHeight;
if (/^top/.test(data.placement)) {
data.styles.maxHeight = top - 20;
} else if (/^bottom/.test(data.placement)) {
data.styles.maxHeight = windowHeight - bottom - 20;
} else if (/^right/.test(data.placement)) {
data.styles.maxWidth = Math.min(maxWidth, windowWidth - right - 20);
data.styles.maxHeight = top - 20;
} else {
data.styles.maxWidth = Math.min(maxWidth, left - 20);
data.styles.maxHeight = top - 20;
}
return data;
},
[maxWidth]
);
useEffect(() => {
if (updater.current && isOpen) {
updater.current();
}
const { refs, context, floatingStyles } = useFloating({
middleware: [
arrow({
element: arrowRef,
}),
flip({
crossAxis: canFlip,
mainAxis: canFlip,
}),
offset({ mainAxis: 10 }),
shift(),
],
open: isOpen,
placement: position,
whileElementsMounted: autoUpdate,
onOpenChange: setIsOpen,
});
useEffect(() => {
return () => {
if (closeTimeout.current) {
clearTimeout(closeTimeout.current);
}
};
}, []);
const click = useClick(context, {
enabled: isMobile(),
});
const dismiss = useDismiss(context);
const hover = useHover(context, {
handleClose: safePolygon(),
});
const { getReferenceProps, getFloatingProps } = useInteractions([
click,
dismiss,
hover,
]);
return (
<Manager>
<Reference>
{({ ref }) => (
<span
ref={ref}
className={className}
onClick={handleClick}
onMouseEnter={handleMouseEnterAnchor}
onMouseLeave={handleMouseLeave}
<>
<span
ref={refs.setReference}
{...getReferenceProps()}
className={className}
>
{anchor}
</span>
{isOpen ? (
<FloatingPortal id="portal-root">
<div
ref={refs.setFloating}
className={styles.tooltipContainer}
style={floatingStyles}
{...getFloatingProps()}
>
{anchor}
</span>
)}
</Reference>
<Portal>
<Popper
// @ts-expect-error - PopperJS types are not in sync with our position types.
placement={position}
// Disable events to improve performance when many tooltips
// are shown (Quality Definitions for example).
eventsEnabled={false}
modifiers={{
computeMaxHeight: {
order: 851,
enabled: true,
fn: computeMaxSize,
},
preventOverflow: {
// Fixes positioning for tooltips in the queue
// and likely others.
escapeWithReference: false,
},
flip: {
enabled: canFlip,
},
}}
>
{({ ref, style, placement, arrowProps, scheduleUpdate }) => {
updater.current = scheduleUpdate;
const popperPlacement = placement
? placement.split('-')[0]
: position;
const vertical =
popperPlacement === 'top' || popperPlacement === 'bottom';
return (
<div
ref={ref}
className={classNames(
styles.tooltipContainer,
vertical
? styles.verticalContainer
: styles.horizontalContainer
)}
style={style}
onMouseEnter={handleMouseEnterTooltip}
onMouseLeave={handleMouseLeave}
>
<div
ref={arrowProps.ref}
className={
isOpen
? classNames(
styles.arrow,
styles[kind],
// @ts-expect-error - is a string that may not exist in styles
styles[popperPlacement]
)
: styles.arrowDisabled
}
style={arrowProps.style}
/>
{isOpen ? (
<div className={classNames(styles.tooltip, styles[kind])}>
<div className={bodyClassName}>{tooltip}</div>
</div>
) : null}
</div>
);
}}
</Popper>
</Portal>
</Manager>
<FloatingArrow ref={arrowRef} context={context} fill={arrowColor} />
<div className={classNames(styles.tooltip, styles[kind])}>
<div className={bodyClassName}>{tooltip}</div>
</div>
</div>
</FloatingPortal>
) : null}
</>
);
}

View File

@@ -22,10 +22,6 @@ interface Episode extends ModelBase {
monitored: boolean;
grabbed?: boolean;
unverifiedSceneNumbering: boolean;
endTime?: string;
grabDate?: string;
seriesTitle?: string;
queued?: boolean;
series?: Series;
finaleType?: string;
}

View File

@@ -11,7 +11,7 @@ import useEpisodeFile from 'EpisodeFile/useEpisodeFile';
import { icons, kinds, sizes } from 'Helpers/Props';
import Series from 'Series/Series';
import useSeries from 'Series/useSeries';
import QualityProfileNameConnector from 'Settings/Profiles/Quality/QualityProfileName';
import QualityProfileName from 'Settings/Profiles/Quality/QualityProfileName';
import {
deleteEpisodeFile,
fetchEpisodeFile,
@@ -128,7 +128,7 @@ function EpisodeSummary(props: EpisodeSummaryProps) {
<span className={styles.infoTitle}>{translate('QualityProfile')}</span>
<Label kind={kinds.PRIMARY} size={sizes.MEDIUM}>
<QualityProfileNameConnector qualityProfileId={qualityProfileId} />
<QualityProfileName qualityProfileId={qualityProfileId} />
</Label>
</div>

View File

@@ -2,6 +2,7 @@ import React from 'react';
import DescriptionList from 'Components/DescriptionList/DescriptionList';
import DescriptionListItem from 'Components/DescriptionList/DescriptionListItem';
import MediaInfoProps from 'typings/MediaInfo';
import formatBitrate from 'Utilities/Number/formatBitrate';
import getEntries from 'Utilities/Object/getEntries';
function MediaInfo(props: MediaInfoProps) {
@@ -16,9 +17,19 @@ function MediaInfo(props: MediaInfoProps) {
return null;
}
return (
<DescriptionListItem key={key} title={title} data={props[key]} />
);
if (key === 'audioBitrate' || key === 'videoBitrate') {
return (
<DescriptionListItem
key={key}
title={title}
data={
<span title={value.toString()}>{formatBitrate(value)}</span>
}
/>
);
}
return <DescriptionListItem key={key} title={title} data={value} />;
})}
</DescriptionList>
);

View File

@@ -0,0 +1,34 @@
import { useMutation, UseMutationOptions } from '@tanstack/react-query';
import { useMemo } from 'react';
import { Error } from 'App/State/AppSectionState';
import fetchJson, {
apiRoot,
FetchJsonOptions,
} from 'Utilities/Fetch/fetchJson';
interface MutationOptions<T, TData>
extends Omit<FetchJsonOptions<TData>, 'method'> {
method: 'POST' | 'PUT' | 'DELETE';
mutationOptions?: Omit<UseMutationOptions<T, Error, TData>, 'mutationFn'>;
}
function useApiMutation<T, TData>(options: MutationOptions<T, TData>) {
const requestOptions = useMemo(() => {
return {
...options,
path: apiRoot + options.path,
headers: {
...options.headers,
'X-Api-Key': window.Sonarr.apiKey,
},
};
}, [options]);
return useMutation<T, Error, TData>({
...options.mutationOptions,
mutationFn: async (data: TData) =>
fetchJson<T, TData>({ ...requestOptions, body: data }),
});
}
export default useApiMutation;

View File

@@ -1,46 +1,26 @@
import { UndefinedInitialDataOptions, useQuery } from '@tanstack/react-query';
import { useMemo } from 'react';
import fetchJson, {
ApiError,
FetchJsonOptions,
} from 'Utilities/Fetch/fetchJson';
import getQueryPath from 'Utilities/Fetch/getQueryPath';
import getQueryString, { QueryParams } from 'Utilities/Fetch/getQueryString';
interface ApiErrorResponse {
message: string;
details: string;
}
export class ApiError extends Error {
public statusCode: number;
public statusText: string;
public statusBody?: ApiErrorResponse;
public constructor(
path: string,
statusCode: number,
statusText: string,
statusBody?: ApiErrorResponse
) {
super(`Request Error: (${statusCode}) ${path}`);
this.statusCode = statusCode;
this.statusText = statusText;
this.statusBody = statusBody;
Object.setPrototypeOf(this, new.target.prototype);
}
}
interface QueryOptions<T> {
path: string;
headers?: HeadersInit;
export interface QueryOptions<T> extends FetchJsonOptions<unknown> {
queryParams?: QueryParams;
queryOptions?:
| Omit<UndefinedInitialDataOptions<T, ApiError>, 'queryKey' | 'queryFn'>
| undefined;
}
const apiRoot = '/api/v5'; // window.Sonarr.apiRoot;
const useApiQuery = <T>(options: QueryOptions<T>) => {
const requestOptions = useMemo(() => {
const { path: path, queryOptions, queryParams, ...otherOptions } = options;
function useApiQuery<T>(options: QueryOptions<T>) {
const { path, headers } = useMemo(() => {
return {
path: apiRoot + options.path,
...otherOptions,
path: getQueryPath(path) + getQueryString(queryParams),
headers: {
...options.headers,
'X-Api-Key': window.Sonarr.apiKey,
@@ -50,29 +30,10 @@ function useApiQuery<T>(options: QueryOptions<T>) {
return useQuery({
...options.queryOptions,
queryKey: [path, headers],
queryFn: async ({ signal }) => {
const response = await fetch(path, {
headers,
signal,
});
if (!response.ok) {
// eslint-disable-next-line init-declarations
let body;
try {
body = (await response.json()) as ApiErrorResponse;
} catch {
throw new ApiError(path, response.status, response.statusText);
}
throw new ApiError(path, response.status, response.statusText, body);
}
return response.json() as T;
},
queryKey: [requestOptions.path],
queryFn: async ({ signal }) =>
fetchJson<T, unknown>({ ...requestOptions, signal }),
});
}
};
export default useApiQuery;

View File

@@ -1,16 +0,0 @@
import { debounce, DebouncedFunc, DebounceSettings } from 'lodash';
import { useCallback } from 'react';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export default function useDebouncedCallback<T extends (...args: any) => any>(
callback: T,
delay: number,
options?: DebounceSettings
): DebouncedFunc<T> {
// eslint-disable-next-line react-hooks/exhaustive-deps
return useCallback(debounce(callback, delay, options), [
callback,
delay,
options,
]);
}

View File

@@ -0,0 +1,36 @@
import { useEffect } from 'react';
import { useHistory } from 'react-router';
import { create } from 'zustand';
interface PageStore {
events: number;
}
const pageStore = create<PageStore>(() => ({
events: 1,
}));
const usePage = (kind: keyof PageStore) => {
const { action } = useHistory();
const goToPage = (page: number) => {
pageStore.setState({ [kind]: page });
};
useEffect(() => {
if (action === 'POP') {
pageStore.setState({ [kind]: 1 });
}
}, [action, kind]);
return {
page: pageStore((state) => state[kind]),
goToPage,
};
};
export default usePage;
export const resetPage = (kind: keyof PageStore) => {
pageStore.setState({ [kind]: 1 });
};

View File

@@ -0,0 +1,81 @@
import { useQuery } from '@tanstack/react-query';
import { useMemo } from 'react';
import { PropertyFilter } from 'App/State/AppState';
import { SortDirection } from 'Helpers/Props/sortDirections';
import fetchJson from 'Utilities/Fetch/fetchJson';
import getQueryPath from 'Utilities/Fetch/getQueryPath';
import getQueryString from 'Utilities/Fetch/getQueryString';
import { QueryOptions } from './useApiQuery';
interface PagedQueryOptions<T> extends QueryOptions<PagedQueryResponse<T>> {
page: number;
pageSize: number;
sortKey?: string;
sortDirection?: SortDirection;
filters?: PropertyFilter[];
}
interface PagedQueryResponse<T> {
page: number;
pageSize: number;
sortKey: string;
sortDirection: string;
totalRecords: number;
totalPages: number;
records: T[];
}
const usePagedApiQuery = <T>(options: PagedQueryOptions<T>) => {
const requestOptions = useMemo(() => {
const {
path,
page,
pageSize,
sortKey,
sortDirection,
filters,
queryParams,
queryOptions,
...otherOptions
} = options;
return {
...otherOptions,
path:
getQueryPath(path) +
getQueryString({
...queryParams,
page,
pageSize,
sortKey,
sortDirection,
filters,
}),
headers: {
...options.headers,
'X-Api-Key': window.Sonarr.apiKey,
},
};
}, [options]);
return useQuery({
...options.queryOptions,
queryKey: [requestOptions.path],
queryFn: async ({ signal }) => {
const response = await fetchJson<PagedQueryResponse<T>, unknown>({
...requestOptions,
signal,
});
return {
...response,
totalPages: Math.max(
Math.ceil(response.totalRecords / options.pageSize),
1
),
};
},
});
};
export default usePagedApiQuery;

View File

@@ -0,0 +1,27 @@
import { useSelector } from 'react-redux';
import { createSelector } from 'reselect';
import AppState from 'App/State/AppState';
import themes from 'Styles/Themes';
function createThemeSelector() {
return createSelector(
(state: AppState) => state.settings.ui.item.theme || window.Sonarr.theme,
(theme) => {
return theme;
}
);
}
const useTheme = () => {
return useSelector(createThemeSelector());
};
export default useTheme;
export const useThemeColor = (color: string) => {
const theme = useTheme();
const themeVariables = themes[theme];
// @ts-expect-error - themeVariables is a string indexable type
return themeVariables[color];
};

View File

@@ -0,0 +1,74 @@
import { create, type StateCreator } from 'zustand';
import { persist, type PersistOptions } from 'zustand/middleware';
import Column from 'Components/Table/Column';
export const createPersist = <T>(
name: string,
state: StateCreator<T>,
options: Omit<PersistOptions<T>, 'name' | 'storage'> = {}
) => {
const instanceName =
window.Sonarr.instanceName.toLowerCase().replace(/ /g, '_') ?? 'sonarr';
const finalName = `${instanceName}_${name}`;
return create(
persist<T>(state, {
...options,
name: finalName,
})
);
};
export const mergeColumns = <T extends { columns: Column[] }>(
persistedState: unknown,
currentState: T
) => {
const currentColumns = currentState.columns;
const persistedColumns = (persistedState as T).columns;
const columns: Column[] = [];
// Add persisted columns in the same order they're currently in
// as long as they haven't been removed.
persistedColumns.forEach((persistedColumn) => {
const column = currentColumns.find((i) => i.name === persistedColumn.name);
if (column) {
const newColumn: Partial<Column> = {};
// We can't use a spread operator or Object.assign to clone the column
// or any accessors are lost and can break translations.
for (const prop of Object.keys(column)) {
const attributes = Object.getOwnPropertyDescriptor(column, prop);
if (!attributes) {
return;
}
Object.defineProperty(newColumn, prop, attributes);
}
newColumn.isVisible = persistedColumn.isVisible;
columns.push(newColumn as Column);
}
});
// Add any columns added to the app in the initial position.
currentColumns.forEach((currentColumn, index) => {
const persistedColumnIndex = persistedColumns.findIndex(
(i) => i.name === currentColumn.name
);
const column = Object.assign({}, currentColumn);
if (persistedColumnIndex === -1) {
columns.splice(index, 0, column);
}
});
return {
...(persistedState as T),
columns,
};
};

View File

@@ -5,7 +5,7 @@ import { createSelector } from 'reselect';
import AppState from 'App/State/AppState';
import InteractiveImportAppState from 'App/State/InteractiveImportAppState';
import * as commandNames from 'Commands/commandNames';
import SelectInput from 'Components/Form/SelectInput';
import SelectInput, { SelectInputOption } from 'Components/Form/SelectInput';
import Icon from 'Components/Icon';
import Button from 'Components/Link/Button';
import SpinnerButton from 'Components/Link/SpinnerButton';
@@ -164,7 +164,7 @@ const COLUMNS = [
},
];
const importModeOptions = [
const importModeOptions: SelectInputOption[] = [
{
key: 'chooseImportMode',
value: () => translate('ChooseImportMode'),
@@ -343,7 +343,7 @@ function InteractiveImportModalContent(
}
);
const options = [
const options: SelectInputOption[] = [
{
key: 'select',
value: translate('SelectDropdown'),

View File

@@ -7,6 +7,7 @@ import Form from 'Components/Form/Form';
import FormGroup from 'Components/Form/FormGroup';
import FormInputGroup from 'Components/Form/FormInputGroup';
import FormLabel from 'Components/Form/FormLabel';
import { EnhancedSelectInputValue } from 'Components/Form/Select/EnhancedSelectInput';
import Button from 'Components/Link/Button';
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
import ModalBody from 'Components/Modal/ModalBody';
@@ -69,7 +70,7 @@ function SelectQualityModalContent(props: SelectQualityModalContentProps) {
);
const qualityOptions = useMemo(() => {
return items.map(({ id, name }) => {
return items.map(({ id, name }): EnhancedSelectInputValue<number> => {
return {
key: id,
value: name,

View File

@@ -82,9 +82,9 @@ function RootFolderRow(props: RootFolderRowProps) {
<ConfirmModal
isOpen={isDeleteModalOpen}
kind={kinds.DANGER}
title={translate('DeleteRootFolder')}
message={translate('DeleteRootFolderMessageText', { path })}
confirmLabel={translate('Delete')}
title={translate('RemoveRootFolder')}
message={translate('RemoveRootFolderWithSeriesMessageText', { path })}
confirmLabel={translate('Remove')}
onConfirm={onConfirmDelete}
onCancel={onDeleteModalClose}
/>

View File

@@ -50,7 +50,9 @@ function DeleteSeriesModalContent({
dispatch(
deleteSeries({ id: seriesId, deleteFiles, addImportListExclusion })
);
}, [seriesId, addImportListExclusion, deleteFiles, dispatch]);
onModalClose();
}, [seriesId, addImportListExclusion, deleteFiles, dispatch, onModalClose]);
const handleDeleteOptionChange = useCallback(
({ name, value }: CheckInputChanged) => {

View File

@@ -5,7 +5,6 @@
.header {
position: relative;
width: 100%;
height: 425px;
}
.backdrop {
@@ -30,20 +29,18 @@
width: 100%;
height: 100%;
color: var(--white);
gap: 35px;
}
.poster {
flex-shrink: 0;
margin-right: 35px;
width: 250px;
height: 368px;
}
.info {
display: flex;
flex-direction: column;
flex-grow: 1;
overflow: hidden;
width: 100%;
}
.titleRow {
@@ -59,10 +56,13 @@
}
.title {
overflow: auto;
max-height: calc(3 * 50px);
text-wrap: balance;
font-weight: 300;
font-size: 50px;
line-height: 50px;
line-clamp: 3;
}
.toggleMonitoredContainer {
@@ -153,6 +153,13 @@
padding: 20px;
}
.seriesProgressLabel {
composes: label from '~Components/Label.css';
margin: 0;
font-size: 17px;
}
@media only screen and (max-width: $breakpointSmall) {
.contentContainer {
padding: 20px 0;
@@ -163,6 +170,8 @@
}
.title {
overflow: hidden;
max-height: calc(3 * 30px);
font-weight: 300;
font-size: 30px;
line-height: 30px;

View File

@@ -24,6 +24,7 @@ interface CssExports {
'runtime': string;
'seriesNavigationButton': string;
'seriesNavigationButtons': string;
'seriesProgressLabel': string;
'sizeOnDisk': string;
'statusName': string;
'tags': string;

View File

@@ -1,7 +1,6 @@
import moment from 'moment';
import React, { useCallback, useEffect, useMemo, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import TextTruncate from 'react-text-truncate';
import { createSelector } from 'reselect';
import AppState from 'App/State/AppState';
import * as commandNames from 'Commands/commandNames';
@@ -21,7 +20,6 @@ import PageToolbarSection from 'Components/Page/Toolbar/PageToolbarSection';
import PageToolbarSeparator from 'Components/Page/Toolbar/PageToolbarSeparator';
import Popover from 'Components/Tooltip/Popover';
import Tooltip from 'Components/Tooltip/Tooltip';
import useMeasure from 'Helpers/Hooks/useMeasure';
import usePrevious from 'Helpers/Hooks/usePrevious';
import {
align,
@@ -41,7 +39,8 @@ import { Image, Statistics } from 'Series/Series';
import SeriesGenres from 'Series/SeriesGenres';
import SeriesPoster from 'Series/SeriesPoster';
import { getSeriesStatusDetails } from 'Series/SeriesStatus';
import QualityProfileNameConnector from 'Settings/Profiles/Quality/QualityProfileName';
import useSeries from 'Series/useSeries';
import QualityProfileName from 'Settings/Profiles/Quality/QualityProfileName';
import { executeCommand } from 'Store/Actions/commandActions';
import { clearEpisodes, fetchEpisodes } from 'Store/Actions/episodeActions';
import {
@@ -55,7 +54,6 @@ import {
import { toggleSeriesMonitored } from 'Store/Actions/seriesActions';
import createAllSeriesSelector from 'Store/Selectors/createAllSeriesSelector';
import createCommandsSelector from 'Store/Selectors/createCommandsSelector';
import fonts from 'Styles/Variables/fonts';
import sortByProp from 'Utilities/Array/sortByProp';
import { findCommand, isCommandExecuting } from 'Utilities/Command';
import formatBytes from 'Utilities/Number/formatBytes';
@@ -70,12 +68,10 @@ import toggleSelected from 'Utilities/Table/toggleSelected';
import SeriesAlternateTitles from './SeriesAlternateTitles';
import SeriesDetailsLinks from './SeriesDetailsLinks';
import SeriesDetailsSeason from './SeriesDetailsSeason';
import SeriesProgressLabel from './SeriesProgressLabel';
import SeriesTags from './SeriesTags';
import styles from './SeriesDetails.css';
const defaultFontSize = parseInt(fonts.defaultFontSize);
const lineHeight = parseFloat(fonts.lineHeight);
function getFanartUrl(images: Image[]) {
return images.find((image) => image.coverType === 'fanart')?.url;
}
@@ -124,40 +120,6 @@ function createEpisodeFilesSelector() {
);
}
function createSeriesSelector(seriesId: number) {
return createSelector(createAllSeriesSelector(), (allSeries) => {
const sortedSeries = [...allSeries].sort(sortByProp('sortTitle'));
const seriesIndex = sortedSeries.findIndex(
(series) => series.id === seriesId
);
if (seriesIndex === -1) {
return {
series: undefined,
nextSeries: undefined,
previousSeries: undefined,
};
}
const series = sortedSeries[seriesIndex];
const nextSeries = sortedSeries[seriesIndex + 1] ?? sortedSeries[0];
const previousSeries =
sortedSeries[seriesIndex - 1] ?? sortedSeries[sortedSeries.length - 1];
return {
series,
nextSeries: {
title: nextSeries.title,
titleSlug: nextSeries.titleSlug,
},
previousSeries: {
title: previousSeries.title,
titleSlug: previousSeries.titleSlug,
},
};
});
}
interface ExpandedState {
allExpanded: boolean;
allCollapsed: boolean;
@@ -170,9 +132,10 @@ interface SeriesDetailsProps {
function SeriesDetails({ seriesId }: SeriesDetailsProps) {
const dispatch = useDispatch();
const { series, nextSeries, previousSeries } = useSelector(
createSeriesSelector(seriesId)
);
const series = useSeries(seriesId);
const allSeries = useSelector(createAllSeriesSelector());
const {
isEpisodesFetching,
isEpisodesPopulated,
@@ -188,22 +151,23 @@ function SeriesDetails({ seriesId }: SeriesDetailsProps) {
} = useSelector(createEpisodeFilesSelector());
const commands = useSelector(createCommandsSelector());
const isSaving = useSelector((state: AppState) => state.series.isSaving);
const { isRefreshing, isRenaming, isSearching } = useMemo(() => {
const isSeriesRefreshing = isCommandExecuting(
findCommand(commands, {
name: commandNames.REFRESH_SERIES,
seriesId,
})
);
const seriesRefreshingCommand = findCommand(commands, {
name: commandNames.REFRESH_SERIES,
});
const isSeriesRefreshingCommandExecuting = isCommandExecuting(
seriesRefreshingCommand
);
const allSeriesRefreshing =
isCommandExecuting(seriesRefreshingCommand) &&
!seriesRefreshingCommand?.body.seriesId;
isSeriesRefreshingCommandExecuting &&
!seriesRefreshingCommand?.body.seriesIds?.length;
const isSeriesRefreshing =
isSeriesRefreshingCommandExecuting &&
seriesRefreshingCommand?.body.seriesIds?.includes(seriesId);
const isSearchingExecuting = isCommandExecuting(
findCommand(commands, {
@@ -234,6 +198,35 @@ function SeriesDetails({ seriesId }: SeriesDetailsProps) {
};
}, [seriesId, commands]);
const { nextSeries, previousSeries } = useMemo(() => {
const sortedSeries = [...allSeries].sort(sortByProp('sortTitle'));
const seriesIndex = sortedSeries.findIndex(
(series) => series.id === seriesId
);
if (seriesIndex === -1) {
return {
nextSeries: undefined,
previousSeries: undefined,
};
}
const nextSeries = sortedSeries[seriesIndex + 1] ?? sortedSeries[0];
const previousSeries =
sortedSeries[seriesIndex - 1] ?? sortedSeries[sortedSeries.length - 1];
return {
nextSeries: {
title: nextSeries.title,
titleSlug: nextSeries.titleSlug,
},
previousSeries: {
title: previousSeries.title,
titleSlug: previousSeries.titleSlug,
},
};
}, [seriesId, allSeries]);
const [isOrganizeModalOpen, setIsOrganizeModalOpen] = useState(false);
const [isManageEpisodesOpen, setIsManageEpisodesOpen] = useState(false);
const [isEditSeriesModalOpen, setIsEditSeriesModalOpen] = useState(false);
@@ -247,7 +240,6 @@ function SeriesDetails({ seriesId }: SeriesDetailsProps) {
allCollapsed: false,
seasons: {},
});
const [overviewRef, { height: overviewHeight }] = useMeasure();
const wasRefreshing = usePrevious(isRefreshing);
const wasRenaming = usePrevious(isRenaming);
@@ -396,7 +388,7 @@ function SeriesDetails({ seriesId }: SeriesDetailsProps) {
}, [populate]);
useEffect(() => {
registerPagePopulator(populate);
registerPagePopulator(populate, ['seriesUpdated']);
return () => {
unregisterPagePopulator(populate);
@@ -437,9 +429,15 @@ function SeriesDetails({ seriesId }: SeriesDetailsProps) {
genres,
tags,
year,
isSaving = false,
} = series;
const { episodeFileCount = 0, sizeOnDisk = 0, lastAired } = statistics;
const {
episodeCount = 0,
episodeFileCount = 0,
sizeOnDisk = 0,
lastAired,
} = statistics;
const statusDetails = getSeriesStatusDetails(status);
const runningYears =
@@ -518,7 +516,7 @@ function SeriesDetails({ seriesId }: SeriesDetailsProps) {
<PageToolbarSeparator />
<PageToolbarButton
label={translate('SeriesMonitoring')}
label={translate('EpisodeMonitoring')}
iconName={icons.MONITORED}
onPress={handleMonitorOptionsPress}
/>
@@ -602,25 +600,29 @@ function SeriesDetails({ seriesId }: SeriesDetailsProps) {
</div>
<div className={styles.seriesNavigationButtons}>
<IconButton
className={styles.seriesNavigationButton}
name={icons.ARROW_LEFT}
size={30}
title={translate('SeriesDetailsGoTo', {
title: previousSeries.title,
})}
to={`/series/${previousSeries.titleSlug}`}
/>
{previousSeries ? (
<IconButton
className={styles.seriesNavigationButton}
name={icons.ARROW_LEFT}
size={30}
title={translate('SeriesDetailsGoTo', {
title: previousSeries.title,
})}
to={`/series/${previousSeries.titleSlug}`}
/>
) : null}
<IconButton
className={styles.seriesNavigationButton}
name={icons.ARROW_RIGHT}
size={30}
title={translate('SeriesDetailsGoTo', {
title: nextSeries.title,
})}
to={`/series/${nextSeries.titleSlug}`}
/>
{nextSeries ? (
<IconButton
className={styles.seriesNavigationButton}
name={icons.ARROW_RIGHT}
size={30}
title={translate('SeriesDetailsGoTo', {
title: nextSeries.title,
})}
to={`/series/${nextSeries.titleSlug}`}
/>
) : null}
</div>
</div>
@@ -679,9 +681,7 @@ function SeriesDetails({ seriesId }: SeriesDetailsProps) {
<div>
<Icon name={icons.PROFILE} size={17} />
<span className={styles.qualityProfileName}>
<QualityProfileNameConnector
qualityProfileId={qualityProfileId}
/>
<QualityProfileName qualityProfileId={qualityProfileId} />
</span>
</div>
</Label>
@@ -779,19 +779,18 @@ function SeriesDetails({ seriesId }: SeriesDetailsProps) {
position={tooltipPositions.BOTTOM}
/>
) : null}
</div>
<div ref={overviewRef} className={styles.overview}>
<TextTruncate
line={
Math.floor(
overviewHeight / (defaultFontSize * lineHeight)
) - 1
}
text={overview}
<SeriesProgressLabel
className={styles.seriesProgressLabel}
seriesId={seriesId}
monitored={monitored}
episodeCount={episodeCount}
episodeFileCount={episodeFileCount}
/>
</div>
<div className={styles.overview}>{overview}</div>
<MetadataAttribution />
</div>
</div>

View File

@@ -19,7 +19,11 @@ function SeriesDetailsPage() {
const previousIndex = usePrevious(seriesIndex);
useEffect(() => {
if (seriesIndex === -1 && previousIndex !== -1) {
if (
seriesIndex === -1 &&
previousIndex !== -1 &&
previousIndex !== undefined
) {
history.push(`${window.Sonarr.urlBase}/`);
}
}, [seriesIndex, previousIndex, history]);

View File

@@ -562,6 +562,7 @@ function SeriesDetailsSeason({
<SeasonInteractiveSearchModal
isOpen={isInteractiveSearchModalOpen}
episodeCount={totalEpisodeCount}
seriesId={seriesId}
seasonNumber={seasonNumber}
onModalClose={handleInteractiveSearchModalClose}

View File

@@ -0,0 +1,70 @@
import React from 'react';
import { useSelector } from 'react-redux';
import Label from 'Components/Label';
import { kinds, sizes } from 'Helpers/Props';
import createSeriesQueueItemsDetailsSelector, {
SeriesQueueDetails,
} from 'Series/Index/createSeriesQueueDetailsSelector';
function getEpisodeCountKind(
monitored: boolean,
episodeFileCount: number,
episodeCount: number,
isDownloading: boolean
) {
if (isDownloading) {
return kinds.PURPLE;
}
if (episodeFileCount === episodeCount && episodeCount > 0) {
return kinds.SUCCESS;
}
if (!monitored) {
return kinds.WARNING;
}
return kinds.DANGER;
}
interface SeriesProgressLabelProps {
className: string;
seriesId: number;
monitored: boolean;
episodeCount: number;
episodeFileCount: number;
}
function SeriesProgressLabel({
className,
seriesId,
monitored,
episodeCount,
episodeFileCount,
}: SeriesProgressLabelProps) {
const queueDetails: SeriesQueueDetails = useSelector(
createSeriesQueueItemsDetailsSelector(seriesId)
);
const newDownloads = queueDetails.count - queueDetails.episodesWithFiles;
const text = newDownloads
? `${episodeFileCount} + ${newDownloads} / ${episodeCount}`
: `${episodeFileCount} / ${episodeCount}`;
return (
<Label
className={className}
kind={getEpisodeCountKind(
monitored,
episodeFileCount,
episodeCount,
queueDetails.count > 0
)}
size={sizes.LARGE}
>
<span>{text}</span>
</Label>
);
}
export default SeriesProgressLabel;

View File

@@ -4,6 +4,7 @@ import Form from 'Components/Form/Form';
import FormGroup from 'Components/Form/FormGroup';
import FormInputGroup from 'Components/Form/FormInputGroup';
import FormLabel from 'Components/Form/FormLabel';
import { EnhancedSelectInputValue } from 'Components/Form/Select/EnhancedSelectInput';
import Button from 'Components/Link/Button';
import ModalBody from 'Components/Modal/ModalBody';
import ModalContent from 'Components/Modal/ModalContent';
@@ -14,7 +15,7 @@ import { setSeriesOverviewOption } from 'Store/Actions/seriesIndexActions';
import translate from 'Utilities/String/translate';
import selectOverviewOptions from '../selectOverviewOptions';
const posterSizeOptions = [
const posterSizeOptions: EnhancedSelectInputValue<string>[] = [
{
key: 'small',
get value() {

View File

@@ -92,7 +92,7 @@ function SeriesIndexOverview(props: SeriesIndexOverviewProps) {
dispatch(
executeCommand({
name: REFRESH_SERIES,
seriesId,
seriesIds: [seriesId],
})
);
}, [seriesId, dispatch]);

View File

@@ -1,11 +0,0 @@
.grid {
flex: 1 0 auto;
}
.container {
&:hover {
.content {
background-color: var(--tableRowHoverBackgroundColor);
}
}
}

View File

@@ -80,17 +80,17 @@ function SeriesIndexOverviews(props: SeriesIndexOverviewsProps) {
const [size, setSize] = useState({ width: 0, height: 0 });
const posterWidth = useMemo(() => {
const maxiumPosterWidth = isSmallScreen ? 152 : 162;
const maximumPosterWidth = isSmallScreen ? 152 : 162;
if (posterSize === 'large') {
return maxiumPosterWidth;
return maximumPosterWidth;
}
if (posterSize === 'medium') {
return Math.floor(maxiumPosterWidth * 0.75);
return Math.floor(maximumPosterWidth * 0.75);
}
return Math.floor(maxiumPosterWidth * 0.5);
return Math.floor(maximumPosterWidth * 0.5);
}, [posterSize, isSmallScreen]);
const posterHeight = useMemo(() => {

View File

@@ -4,6 +4,7 @@ import Form from 'Components/Form/Form';
import FormGroup from 'Components/Form/FormGroup';
import FormInputGroup from 'Components/Form/FormInputGroup';
import FormLabel from 'Components/Form/FormLabel';
import { EnhancedSelectInputValue } from 'Components/Form/Select/EnhancedSelectInput';
import Button from 'Components/Link/Button';
import ModalBody from 'Components/Modal/ModalBody';
import ModalContent from 'Components/Modal/ModalContent';
@@ -14,7 +15,7 @@ import selectPosterOptions from 'Series/Index/Posters/selectPosterOptions';
import { setSeriesPosterOption } from 'Store/Actions/seriesIndexActions';
import translate from 'Utilities/String/translate';
const posterSizeOptions = [
const posterSizeOptions: EnhancedSelectInputValue<string>[] = [
{
key: 'small',
get value() {

View File

@@ -83,7 +83,7 @@ function SeriesIndexPoster(props: SeriesIndexPosterProps) {
dispatch(
executeCommand({
name: REFRESH_SERIES,
seriesId,
seriesIds: [seriesId],
})
);
}, [seriesId, dispatch]);

View File

@@ -2,6 +2,7 @@ import React, { useCallback, useState } from 'react';
import FormGroup from 'Components/Form/FormGroup';
import FormInputGroup from 'Components/Form/FormInputGroup';
import FormLabel from 'Components/Form/FormLabel';
import { EnhancedSelectInputValue } from 'Components/Form/Select/EnhancedSelectInput';
import Button from 'Components/Link/Button';
import ModalBody from 'Components/Modal/ModalBody';
import ModalContent from 'Components/Modal/ModalContent';
@@ -31,7 +32,7 @@ interface EditSeriesModalContentProps {
const NO_CHANGE = 'noChange';
const monitoredOptions = [
const monitoredOptions: EnhancedSelectInputValue<string>[] = [
{
key: NO_CHANGE,
get value() {
@@ -53,7 +54,7 @@ const monitoredOptions = [
},
];
const seasonFolderOptions = [
const seasonFolderOptions: EnhancedSelectInputValue<string>[] = [
{
key: NO_CHANGE,
get value() {

View File

@@ -1,5 +1,6 @@
import React, { useCallback, useState } from 'react';
import SeriesMonitoringOptionsPopoverContent from 'AddSeries/SeriesMonitoringOptionsPopoverContent';
import Alert from 'Components/Alert';
import Form from 'Components/Form/Form';
import FormGroup from 'Components/Form/FormGroup';
import FormInputGroup from 'Components/Form/FormInputGroup';
@@ -11,7 +12,7 @@ import ModalContent from 'Components/Modal/ModalContent';
import ModalFooter from 'Components/Modal/ModalFooter';
import ModalHeader from 'Components/Modal/ModalHeader';
import Popover from 'Components/Tooltip/Popover';
import { icons, inputTypes, tooltipPositions } from 'Helpers/Props';
import { icons, inputTypes, kinds, tooltipPositions } from 'Helpers/Props';
import translate from 'Utilities/String/translate';
import styles from './ChangeMonitoringModalContent.css';
@@ -46,9 +47,12 @@ function ChangeMonitoringModalContent(
return (
<ModalContent onModalClose={onModalClose}>
<ModalHeader>{translate('MonitorSeries')}</ModalHeader>
<ModalHeader>{translate('MonitorEpisodes')}</ModalHeader>
<ModalBody>
<Alert kind={kinds.INFO}>
<div>{translate('MonitorEpisodesModalInfo')}</div>
</Alert>
<Form {...otherProps}>
<FormGroup>
<FormLabel>

View File

@@ -6,6 +6,7 @@ import Form from 'Components/Form/Form';
import FormGroup from 'Components/Form/FormGroup';
import FormInputGroup from 'Components/Form/FormInputGroup';
import FormLabel from 'Components/Form/FormLabel';
import { EnhancedSelectInputValue } from 'Components/Form/Select/EnhancedSelectInput';
import Label from 'Components/Label';
import Button from 'Components/Link/Button';
import ModalBody from 'Components/Modal/ModalBody';
@@ -66,7 +67,7 @@ function TagsModalContent(props: TagsModalContentProps) {
onApplyTagsPress(tags, applyTags);
}, [tags, applyTags, onApplyTagsPress]);
const applyTagsOptions = [
const applyTagsOptions: EnhancedSelectInputValue<string>[] = [
{
key: 'add',
value: translate('Add'),

View File

@@ -97,7 +97,7 @@ function SeriesIndexRow(props: SeriesIndexRowProps) {
dispatch(
executeCommand({
name: REFRESH_SERIES,
seriesId,
seriesIds: [seriesId],
})
);
}, [seriesId, dispatch]);

View File

@@ -15,7 +15,8 @@ function createSeriesIndexItemSelector(seriesId: number) {
(series: Series, qualityProfile, executingCommands: Command[]) => {
const isRefreshingSeries = executingCommands.some((command) => {
return (
command.name === REFRESH_SERIES && command.body.seriesId === seriesId
command.name === REFRESH_SERIES &&
command.body.seriesIds?.includes(series.id)
);
});

View File

@@ -2,6 +2,7 @@ import React, { useCallback, useEffect, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import SeriesMonitoringOptionsPopoverContent from 'AddSeries/SeriesMonitoringOptionsPopoverContent';
import AppState from 'App/State/AppState';
import Alert from 'Components/Alert';
import Form from 'Components/Form/Form';
import FormGroup from 'Components/Form/FormGroup';
import FormInputGroup from 'Components/Form/FormInputGroup';
@@ -15,7 +16,7 @@ import ModalFooter from 'Components/Modal/ModalFooter';
import ModalHeader from 'Components/Modal/ModalHeader';
import Popover from 'Components/Tooltip/Popover';
import usePrevious from 'Helpers/Hooks/usePrevious';
import { icons, tooltipPositions } from 'Helpers/Props';
import { icons, kinds, tooltipPositions } from 'Helpers/Props';
import { updateSeriesMonitor } from 'Store/Actions/seriesActions';
import { InputChanged } from 'typings/inputs';
import translate from 'Utilities/String/translate';
@@ -66,9 +67,12 @@ function MonitoringOptionsModalContent({
return (
<ModalContent onModalClose={onModalClose}>
<ModalHeader>{translate('MonitorSeries')}</ModalHeader>
<ModalHeader>{translate('MonitorEpisodes')}</ModalHeader>
<ModalBody>
<Alert kind={kinds.INFO}>
<div>{translate('MonitorEpisodesModalInfo')}</div>
</Alert>
<Form>
<FormGroup>
<FormLabel>

View File

@@ -6,19 +6,19 @@ import {
cancelFetchReleases,
clearReleases,
} from 'Store/Actions/releaseActions';
import SeasonInteractiveSearchModalContent from './SeasonInteractiveSearchModalContent';
import SeasonInteractiveSearchModalContent, {
SeasonInteractiveSearchModalContentProps,
} from './SeasonInteractiveSearchModalContent';
interface SeasonInteractiveSearchModalProps {
interface SeasonInteractiveSearchModalProps
extends SeasonInteractiveSearchModalContentProps {
isOpen: boolean;
seriesId: number;
seasonNumber: number;
onModalClose(): void;
}
function SeasonInteractiveSearchModal(
props: SeasonInteractiveSearchModalProps
) {
const { isOpen, seriesId, seasonNumber, onModalClose } = props;
const { isOpen, episodeCount, seriesId, seasonNumber, onModalClose } = props;
const dispatch = useDispatch();
@@ -44,6 +44,7 @@ function SeasonInteractiveSearchModal(
onModalClose={handleModalClose}
>
<SeasonInteractiveSearchModalContent
episodeCount={episodeCount}
seriesId={seriesId}
seasonNumber={seasonNumber}
onModalClose={handleModalClose}

Some files were not shown because too many files have changed in this diff Show More