mirror of
https://github.com/Sonarr/Sonarr
synced 2025-12-06 16:32:24 +01:00
Compare commits
311 commits
v4.0.8.215
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
52972e7efc | ||
|
|
8c50919499 | ||
|
|
fdc07a47b1 | ||
|
|
36225c3709 | ||
|
|
bc037ae356 | ||
|
|
77a335de30 | ||
|
|
88d56361c4 | ||
|
|
d10107739b | ||
|
|
7db7567c8e | ||
|
|
2b2b973b30 | ||
|
|
bb954a7424 | ||
|
|
640e3e5d44 | ||
|
|
1260d3c800 | ||
|
|
feeed9a7cf | ||
|
|
c8cb74a976 | ||
|
|
7193acb5ee | ||
|
|
6f1fc1686f | ||
|
|
b7407837b7 | ||
|
|
4e65669c48 | ||
|
|
fa38498db0 | ||
|
|
3b024443c5 | ||
|
|
4ba9b21bb7 | ||
|
|
e37684e045 | ||
|
|
103ccd74f3 | ||
|
|
ba22992265 | ||
|
|
963395b969 | ||
|
|
970df1a1d8 | ||
|
|
2ac139ab4d | ||
|
|
c69db1ff92 | ||
|
|
6dae2f0d84 | ||
|
|
87934c7761 | ||
|
|
fe8478f42a | ||
|
|
a840bb5423 | ||
|
|
8f5d628c55 | ||
|
|
acebe87dba | ||
|
|
7d77500667 | ||
|
|
ec73a13396 | ||
|
|
fa0f77659c | ||
|
|
1609f0c964 | ||
|
|
1fea0b3d10 | ||
|
|
3c8268c428 | ||
|
|
c589c4f85e | ||
|
|
f843107c25 | ||
|
|
035c474f10 | ||
|
|
4dcc015fb1 | ||
|
|
1969e0107f | ||
|
|
ac7c05c050 | ||
|
|
8aad79fd3e | ||
|
|
f05e552e8e | ||
|
|
8cd5cd603a | ||
|
|
ef358e6f24 | ||
|
|
fae24e98fb | ||
|
|
c885fb81f9 | ||
|
|
514c04935f | ||
|
|
4b14368736 | ||
|
|
1c30ecd66d | ||
|
|
f7b54f9d6b | ||
|
|
ce7d8a175e | ||
|
|
ab49268bac | ||
|
|
608f67a074 | ||
|
|
9a69222c9a | ||
|
|
82c526e15c | ||
|
|
983b079c82 | ||
|
|
edfc12e27a | ||
|
|
ed10b63fa0 | ||
|
|
016b571838 | ||
|
|
bfcd017012 | ||
|
|
2e83d59f61 | ||
|
|
c39fb4fe6f | ||
|
|
220b4bc257 | ||
|
|
99e25cec0f | ||
|
|
5d1d44e09e | ||
|
|
3b00112447 | ||
|
|
cb7489ce8f | ||
|
|
b552d4e9f7 | ||
|
|
c0e264cfc5 | ||
|
|
811eb36c7b | ||
|
|
1484809099 | ||
|
|
024462c52d | ||
|
|
e70aef9690 | ||
|
|
36633b5d08 | ||
|
|
1374240321 | ||
|
|
f1d54d2a9a | ||
|
|
03b8c4c28e | ||
|
|
4e4bf3507f | ||
|
|
34ae65c087 | ||
|
|
ebe23104d4 | ||
|
|
e8c3aa20bd | ||
|
|
6c231cbe6a | ||
|
|
8ce688186e | ||
|
|
04ebf03fb5 | ||
|
|
c38debab1b | ||
|
|
32f66922e7 | ||
|
|
ed536a85ad | ||
|
|
c62fc9d05b | ||
|
|
fb9a5efe05 | ||
|
|
8cb58a63d8 | ||
|
|
4c41a4f368 | ||
|
|
e039dc45e2 | ||
|
|
776143cc81 | ||
|
|
8c67a3bdee | ||
|
|
160151c6e0 | ||
|
|
efd48710e4 | ||
|
|
00c16cd06b | ||
|
|
65d07fa99e | ||
|
|
bd656ae7f6 | ||
|
|
62bcf397dd | ||
|
|
f9606518ee | ||
|
|
40f4ef27b2 | ||
|
|
93c3f6d1d6 | ||
|
|
417af2b915 | ||
|
|
4491df3ae7 | ||
|
|
a90866a73e | ||
|
|
2f62494adc | ||
|
|
e361f18837 | ||
|
|
183b8b574a | ||
|
|
12c1eb86f2 | ||
|
|
5034d83062 | ||
|
|
dba3a82439 | ||
|
|
b51a490979 | ||
|
|
8b38ccfb63 | ||
|
|
91c5e6f122 | ||
|
|
dcbef6b7b7 | ||
|
|
ca0bb14027 | ||
|
|
3e99917e9d | ||
|
|
936cf699ff | ||
|
|
202190d032 | ||
|
|
f739fd0900 | ||
|
|
88f4016fe0 | ||
|
|
78fb20282d | ||
|
|
6677fd1116 | ||
|
|
e28b7c3df6 | ||
|
|
67a1ecb0fe | ||
|
|
5bc943583c | ||
|
|
ceeec091f8 | ||
|
|
675e3cd38a | ||
|
|
45a62a2e59 | ||
|
|
ae7c07e02f | ||
|
|
4e9ef57e3d | ||
|
|
59f3be0813 | ||
|
|
fb540040ef | ||
|
|
b8af3af9f1 | ||
|
|
78cf13d341 | ||
|
|
978349e241 | ||
|
|
a77bf64352 | ||
|
|
832de3e75e | ||
|
|
8d4ba77b12 | ||
|
|
409823c7e8 | ||
|
|
8e636d7a37 | ||
|
|
38c0135d7c | ||
|
|
22005dc8c5 | ||
|
|
73208e2f60 | ||
|
|
1df0ba9e5a | ||
|
|
020ed32fcf | ||
|
|
3ddc6ac6de | ||
|
|
0f225b05c0 | ||
|
|
e006b40532 | ||
|
|
e88f25d3bf | ||
|
|
1fcfb88d2a | ||
|
|
804eaa1227 | ||
|
|
c41e3ce1e3 | ||
|
|
682d2b4e1b | ||
|
|
c114e2ddb7 | ||
|
|
f8a879f4c1 | ||
|
|
33139d4b53 | ||
|
|
de69d8ec7e | ||
|
|
03b9c957b8 | ||
|
|
41ddacc395 | ||
|
|
8a558b379a | ||
|
|
240a0339be | ||
|
|
ff724b7f40 | ||
|
|
fcf68d9259 | ||
|
|
404e6d68ea | ||
|
|
df672487cf | ||
|
|
0bc4903954 | ||
|
|
10b55bbee6 | ||
|
|
20ef22be94 | ||
|
|
57534db2f8 | ||
|
|
1e89a1a3cb | ||
|
|
f502eaffe3 | ||
|
|
fe40d83aa4 | ||
|
|
07374de747 | ||
|
|
135b5c2ddd | ||
|
|
0784f56b9a | ||
|
|
562e0dd7c0 | ||
|
|
28599f87af | ||
|
|
86446a7686 | ||
|
|
2f1793d87a | ||
|
|
a641f2897a | ||
|
|
32fa63d24d | ||
|
|
ebfa000375 | ||
|
|
39074b0b1d | ||
|
|
354ed96572 | ||
|
|
c8f419b014 | ||
|
|
a001216957 | ||
|
|
a6735e7a3f | ||
|
|
ea0bfed700 | ||
|
|
620220b269 | ||
|
|
c435fcd685 | ||
|
|
3828e475cc | ||
|
|
e6e1078c15 | ||
|
|
6660db22ec | ||
|
|
bc0fc623ee | ||
|
|
da610a1f40 | ||
|
|
6d0f10b877 | ||
|
|
4f0e1c54c1 | ||
|
|
2f0ca42341 | ||
|
|
768af433d1 | ||
|
|
8bf0298227 | ||
|
|
a7cb264cc8 | ||
|
|
10302323af | ||
|
|
dc1524c64f | ||
|
|
4d7a3d0909 | ||
|
|
30a52d11aa | ||
|
|
be4a9e9491 | ||
|
|
e196c1be69 | ||
|
|
106ffd410c | ||
|
|
c199fd05d3 | ||
|
|
75fae9262c | ||
|
|
faf9173b3b | ||
|
|
0fa8e24f48 | ||
|
|
27da041388 | ||
|
|
ca38a9b577 | ||
|
|
4b72a0a4e8 | ||
|
|
9875e550a8 | ||
|
|
c9aa59340c | ||
|
|
30c36fdc3b | ||
|
|
3976e5daf7 | ||
|
|
fca8c36156 | ||
|
|
85f53e8cb1 | ||
|
|
a73a5cc85c | ||
|
|
89d730cdfd | ||
|
|
99fc52039f | ||
|
|
e6bd58453a | ||
|
|
9603f0b086 | ||
|
|
d84c450094 | ||
|
|
97ebaf2796 | ||
|
|
31bf9e313e | ||
|
|
6cccacd4d7 | ||
|
|
3c857135c5 | ||
|
|
750a9353f8 | ||
|
|
71a19377d9 | ||
|
|
4b5ff3927d | ||
|
|
4d8a443681 | ||
|
|
6a332b40ac | ||
|
|
a929548ae3 | ||
|
|
55363f4e3d | ||
|
|
f20ac9dc34 | ||
|
|
8b20a9449c | ||
|
|
24f03fc1e9 | ||
|
|
5513d7bc5d | ||
|
|
a9072ac460 | ||
|
|
55aaaa5c40 | ||
|
|
ee99c3895d | ||
|
|
e1e10e195c | ||
|
|
0b9a212f33 | ||
|
|
0e384ee3aa | ||
|
|
d903529389 | ||
|
|
6f51e72d00 | ||
|
|
66cead6b48 | ||
|
|
7f0696c574 | ||
|
|
1584311914 | ||
|
|
278c7891a3 | ||
|
|
0a0e03dca0 | ||
|
|
546e9fd1d0 | ||
|
|
c80bd81bb9 | ||
|
|
e1cbc4a782 | ||
|
|
53d8c9ba8d | ||
|
|
9136ee4ad9 | ||
|
|
44fab9a96c | ||
|
|
66e4b7c819 | ||
|
|
98c4cbdd13 | ||
|
|
25d9f09a43 | ||
|
|
7ea1301221 | ||
|
|
f033799d7a | ||
|
|
cfa2f4d4c6 | ||
|
|
882b54be61 | ||
|
|
041fdd3929 | ||
|
|
4548dcdf97 | ||
|
|
4e14ce022c | ||
|
|
a9b93dd9c6 | ||
|
|
50d7e8fed4 | ||
|
|
402db9128c | ||
|
|
846333ddf0 | ||
|
|
dde28cbd7e | ||
|
|
8ceb306bf1 | ||
|
|
8af4246ff9 | ||
|
|
a2e06e9e65 | ||
|
|
ae7b187e41 | ||
|
|
63b4998c8e | ||
|
|
45665886d6 | ||
|
|
860424ac22 | ||
|
|
14005d8d10 | ||
|
|
da7d17f5e8 | ||
|
|
ea331feb88 | ||
|
|
7dca9060ca | ||
|
|
8af12cc4e7 | ||
|
|
aa488019cf | ||
|
|
47a05ecb36 | ||
|
|
35baebaf72 | ||
|
|
aedcd046fc | ||
|
|
f45713bff8 | ||
|
|
911a3d4c1e | ||
|
|
e16ace54a8 | ||
|
|
84710a31bd | ||
|
|
093a239e77 | ||
|
|
ee69351733 | ||
|
|
e92a67ad78 | ||
|
|
3eca63a67c | ||
|
|
8484a8beba | ||
|
|
cd3a1c18ab |
967 changed files with 39886 additions and 24356 deletions
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
|
|
@ -22,7 +22,7 @@ env:
|
||||||
FRAMEWORK: net6.0
|
FRAMEWORK: net6.0
|
||||||
RAW_BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
|
RAW_BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
|
||||||
SONARR_MAJOR_VERSION: 4
|
SONARR_MAJOR_VERSION: 4
|
||||||
VERSION: 4.0.8
|
VERSION: 4.0.16
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
backend:
|
backend:
|
||||||
|
|
|
||||||
29
.github/workflows/support-requests.yml
vendored
Normal file
29
.github/workflows/support-requests.yml
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
name: 'Support Requests'
|
||||||
|
|
||||||
|
on:
|
||||||
|
issues:
|
||||||
|
types: [labeled, unlabeled, reopened]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
issues: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
action:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: github.repository == 'Sonarr/Sonarr'
|
||||||
|
steps:
|
||||||
|
- uses: dessant/support-requests@v4
|
||||||
|
with:
|
||||||
|
github-token: ${{ github.token }}
|
||||||
|
support-label: 'support'
|
||||||
|
issue-comment: >
|
||||||
|
:wave: @{issue-author}, we use the issue tracker exclusively
|
||||||
|
for bug reports and feature requests. However, this issue appears
|
||||||
|
to be a support request. Please use one of the support channels:
|
||||||
|
[forums](https://forums.sonarr.tv/), [subreddit](https://www.reddit.com/r/sonarr/),
|
||||||
|
[discord](https://discord.gg/Ex7FmFK), or [IRC](https://web.libera.chat/?channels=#sonarr)
|
||||||
|
for support/questions.
|
||||||
|
close-issue: true
|
||||||
|
issue-close-reason: 'not planned'
|
||||||
|
lock-issue: false
|
||||||
|
issue-lock-reason: 'off-topic'
|
||||||
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -162,3 +162,6 @@ src/.idea/
|
||||||
|
|
||||||
# API doc generation
|
# API doc generation
|
||||||
.config/
|
.config/
|
||||||
|
|
||||||
|
# Ignore Jetbrains IntelliJ Workspace Directories
|
||||||
|
.idea/
|
||||||
|
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
||||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
||||||
width="70px" height="70px" viewBox="0 0 70 70" style="enable-background:new 0 0 70 70;" xml:space="preserve">
|
|
||||||
<g>
|
|
||||||
<g>
|
|
||||||
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="-1.3318" y1="43.7371" x2="67.0419" y2="26.0967">
|
|
||||||
<stop offset="0.1237" style="stop-color:#7866FF"/>
|
|
||||||
<stop offset="0.5376" style="stop-color:#FE2EB6"/>
|
|
||||||
<stop offset="0.8548" style="stop-color:#FD0486"/>
|
|
||||||
</linearGradient>
|
|
||||||
<polygon style="fill:url(#SVGID_1_);" points="67.3,16 43.7,0 0,31.1 11.1,70 58.9,60.3 "/>
|
|
||||||
<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="45.9148" y1="38.9098" x2="67.6577" y2="9.0989">
|
|
||||||
<stop offset="0.1237" style="stop-color:#FF0080"/>
|
|
||||||
<stop offset="0.2587" style="stop-color:#FE0385"/>
|
|
||||||
<stop offset="0.4109" style="stop-color:#FA0C92"/>
|
|
||||||
<stop offset="0.5713" style="stop-color:#F41BA9"/>
|
|
||||||
<stop offset="0.7363" style="stop-color:#EB2FC8"/>
|
|
||||||
<stop offset="0.8656" style="stop-color:#E343E6"/>
|
|
||||||
</linearGradient>
|
|
||||||
<polygon style="fill:url(#SVGID_2_);" points="67.3,16 43.7,0 38,15.7 38,47.8 70,47.8 "/>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
<rect x="13.4" y="13.4" style="fill:#000000;" width="43.2" height="43.2"/>
|
|
||||||
<rect x="17.4" y="48.5" style="fill:#FFFFFF;" width="16.2" height="2.7"/>
|
|
||||||
<g>
|
|
||||||
<path style="fill:#FFFFFF;" d="M17.4,19.1h6.9c5.6,0,9.5,3.8,9.5,8.9V28c0,5-3.9,8.9-9.5,8.9h-6.9V19.1z M21.4,22.7v10.7h3
|
|
||||||
c3.2,0,5.4-2.2,5.4-5.3V28c0-3.2-2.2-5.4-5.4-5.4H21.4z"/>
|
|
||||||
<polygon style="fill:#FFFFFF;" points="40.3,22.7 34.9,22.7 34.9,19.1 49.6,19.1 49.6,22.7 44.2,22.7 44.2,37 40.3,37 "/>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 1.8 KiB |
|
|
@ -1,66 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
||||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
||||||
width="120.1px" height="130.2px" viewBox="0 0 120.1 130.2" style="enable-background:new 0 0 120.1 130.2;" xml:space="preserve"
|
|
||||||
>
|
|
||||||
<g>
|
|
||||||
<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="31.8412" y1="120.5578" x2="110.2402" y2="73.24">
|
|
||||||
<stop offset="0" style="stop-color:#FCEE39"/>
|
|
||||||
<stop offset="1" style="stop-color:#F37B3D"/>
|
|
||||||
</linearGradient>
|
|
||||||
<path id="XMLID_3041_" style="fill:url(#XMLID_2_);" d="M118.6,71.8c0.9-0.8,1.4-1.9,1.5-3.2c0.1-2.6-1.8-4.7-4.4-4.9
|
|
||||||
c-1.2-0.1-2.4,0.4-3.3,1.1l0,0l-83.8,45.9c-1.9,0.8-3.6,2.2-4.7,4.1c-2.9,4.8-1.3,11,3.6,13.9c3.4,2,7.5,1.8,10.7-0.2l0,0l0,0
|
|
||||||
c0.2-0.2,0.5-0.3,0.7-0.5l78-54.8C117.3,72.9,118.4,72.1,118.6,71.8L118.6,71.8L118.6,71.8z"/>
|
|
||||||
<linearGradient id="XMLID_3_" gradientUnits="userSpaceOnUse" x1="48.3607" y1="6.9083" x2="119.9179" y2="69.5546">
|
|
||||||
<stop offset="0" style="stop-color:#EF5A6B"/>
|
|
||||||
<stop offset="0.57" style="stop-color:#F26F4E"/>
|
|
||||||
<stop offset="1" style="stop-color:#F37B3D"/>
|
|
||||||
</linearGradient>
|
|
||||||
<path id="XMLID_3049_" style="fill:url(#XMLID_3_);" d="M118.8,65.1L118.8,65.1L55,2.5C53.6,1,51.6,0,49.3,0
|
|
||||||
c-4.3,0-7.7,3.5-7.7,7.7v0c0,2.1,0.8,3.9,2.1,5.3l0,0l0,0c0.4,0.4,0.8,0.7,1.2,1l67.4,57.7l0,0c0.8,0.7,1.8,1.2,3,1.3
|
|
||||||
c2.6,0.1,4.7-1.8,4.9-4.4C120.2,67.3,119.7,66,118.8,65.1z"/>
|
|
||||||
<linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="52.9467" y1="63.6407" x2="10.5379" y2="37.1562">
|
|
||||||
<stop offset="0" style="stop-color:#7C59A4"/>
|
|
||||||
<stop offset="0.3852" style="stop-color:#AF4C92"/>
|
|
||||||
<stop offset="0.7654" style="stop-color:#DC4183"/>
|
|
||||||
<stop offset="0.957" style="stop-color:#ED3D7D"/>
|
|
||||||
</linearGradient>
|
|
||||||
<path id="XMLID_3042_" style="fill:url(#XMLID_4_);" d="M57.1,59.5C57,59.5,17.7,28.5,16.9,28l0,0l0,0c-0.6-0.3-1.2-0.6-1.8-0.9
|
|
||||||
c-5.8-2.2-12.2,0.8-14.4,6.6c-1.9,5.1,0.2,10.7,4.6,13.4l0,0l0,0C6,47.5,6.6,47.8,7.3,48c0.4,0.2,45.4,18.8,45.4,18.8l0,0
|
|
||||||
c1.8,0.8,3.9,0.3,5.1-1.2C59.3,63.7,59,61,57.1,59.5z"/>
|
|
||||||
<linearGradient id="XMLID_5_" gradientUnits="userSpaceOnUse" x1="52.1736" y1="3.7019" x2="10.7706" y2="37.8971">
|
|
||||||
<stop offset="0" style="stop-color:#EF5A6B"/>
|
|
||||||
<stop offset="0.364" style="stop-color:#EE4E72"/>
|
|
||||||
<stop offset="1" style="stop-color:#ED3D7D"/>
|
|
||||||
</linearGradient>
|
|
||||||
<path id="XMLID_3057_" style="fill:url(#XMLID_5_);" d="M49.3,0c-1.7,0-3.3,0.6-4.6,1.5L4.9,28.3c-0.1,0.1-0.2,0.1-0.2,0.2l-0.1,0
|
|
||||||
l0,0c-1.7,1.2-3.1,3-3.9,5.1C-1.5,39.4,1.5,45.9,7.3,48c3.6,1.4,7.5,0.7,10.4-1.4l0,0l0,0c0.7-0.5,1.3-1,1.8-1.6l34.6-31.2l0,0
|
|
||||||
c1.8-1.4,3-3.6,3-6.1v0C57.1,3.5,53.6,0,49.3,0z"/>
|
|
||||||
<g id="XMLID_3008_">
|
|
||||||
<rect id="XMLID_3033_" x="34.6" y="37.4" style="fill:#000000;" width="51" height="51"/>
|
|
||||||
<rect id="XMLID_3032_" x="39" y="78.8" style="fill:#FFFFFF;" width="19.1" height="3.2"/>
|
|
||||||
<g id="XMLID_3009_">
|
|
||||||
<path id="XMLID_3030_" style="fill:#FFFFFF;" d="M38.8,50.8l1.5-1.4c0.4,0.5,0.8,0.8,1.3,0.8c0.6,0,0.9-0.4,0.9-1.2l0-5.3l2.3,0
|
|
||||||
l0,5.3c0,1-0.3,1.8-0.8,2.3c-0.5,0.5-1.3,0.8-2.3,0.8C40.2,52.2,39.4,51.6,38.8,50.8z"/>
|
|
||||||
<path id="XMLID_3028_" style="fill:#FFFFFF;" d="M45.3,43.8l6.7,0v1.9l-4.4,0V47l4,0l0,1.8l-4,0l0,1.3l4.5,0l0,2l-6.7,0
|
|
||||||
L45.3,43.8z"/>
|
|
||||||
<path id="XMLID_3026_" style="fill:#FFFFFF;" d="M55,45.8l-2.5,0l0-2l7.3,0l0,2l-2.5,0l0,6.3l-2.3,0L55,45.8z"/>
|
|
||||||
<path id="XMLID_3022_" style="fill:#FFFFFF;" d="M39,54l4.3,0c1,0,1.8,0.3,2.3,0.7c0.3,0.3,0.5,0.8,0.5,1.4v0
|
|
||||||
c0,1-0.5,1.5-1.3,1.9c1,0.3,1.6,0.9,1.6,2v0c0,1.4-1.2,2.3-3.1,2.3l-4.3,0L39,54z M43.8,56.6c0-0.5-0.4-0.7-1-0.7l-1.5,0l0,1.5
|
|
||||||
l1.4,0C43.4,57.3,43.8,57.1,43.8,56.6L43.8,56.6z M43,59l-1.8,0l0,1.5H43c0.7,0,1.1-0.3,1.1-0.8v0C44.1,59.2,43.7,59,43,59z"/>
|
|
||||||
<path id="XMLID_3019_" style="fill:#FFFFFF;" d="M46.8,54l3.9,0c1.3,0,2.1,0.3,2.7,0.9c0.5,0.5,0.7,1.1,0.7,1.9v0
|
|
||||||
c0,1.3-0.7,2.1-1.7,2.6l2,2.9l-2.6,0l-1.7-2.5h-1l0,2.5l-2.3,0L46.8,54z M50.6,58c0.8,0,1.2-0.4,1.2-1v0c0-0.7-0.5-1-1.2-1
|
|
||||||
l-1.5,0v2H50.6z"/>
|
|
||||||
<path id="XMLID_3016_" style="fill:#FFFFFF;" d="M56.8,54l2.2,0l3.5,8.4l-2.5,0l-0.6-1.5l-3.2,0l-0.6,1.5l-2.4,0L56.8,54z
|
|
||||||
M58.8,59l-0.9-2.3L57,59L58.8,59z"/>
|
|
||||||
<path id="XMLID_3014_" style="fill:#FFFFFF;" d="M62.8,54l2.3,0l0,8.3l-2.3,0L62.8,54z"/>
|
|
||||||
<path id="XMLID_3012_" style="fill:#FFFFFF;" d="M65.7,54l2.1,0l3.4,4.4l0-4.4l2.3,0l0,8.3l-2,0L68,57.8l0,4.6l-2.3,0L65.7,54z"
|
|
||||||
/>
|
|
||||||
<path id="XMLID_3010_" style="fill:#FFFFFF;" d="M73.7,61.1l1.3-1.5c0.8,0.7,1.7,1,2.7,1c0.6,0,1-0.2,1-0.6v0
|
|
||||||
c0-0.4-0.3-0.5-1.4-0.8c-1.8-0.4-3.1-0.9-3.1-2.6v0c0-1.5,1.2-2.7,3.2-2.7c1.4,0,2.5,0.4,3.4,1.1l-1.2,1.6
|
|
||||||
c-0.8-0.5-1.6-0.8-2.3-0.8c-0.6,0-0.8,0.2-0.8,0.5v0c0,0.4,0.3,0.5,1.4,0.8c1.9,0.4,3.1,1,3.1,2.6v0c0,1.7-1.3,2.7-3.4,2.7
|
|
||||||
C76.1,62.5,74.7,62,73.7,61.1z"/>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 4.8 KiB |
|
|
@ -1,50 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
||||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
||||||
width="70px" height="70px" viewBox="0 0 70 70" style="enable-background:new 0 0 70 70;" xml:space="preserve">
|
|
||||||
<g>
|
|
||||||
<g>
|
|
||||||
<g>
|
|
||||||
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="22.9451" y1="75.7869" x2="74.7868" y2="20.6415">
|
|
||||||
<stop offset="1.612903e-002" style="stop-color:#B35BA3"/>
|
|
||||||
<stop offset="0.4044" style="stop-color:#C41E57"/>
|
|
||||||
<stop offset="0.4677" style="stop-color:#C41E57"/>
|
|
||||||
<stop offset="0.6505" style="stop-color:#EB8523"/>
|
|
||||||
<stop offset="0.9516" style="stop-color:#FEBD11"/>
|
|
||||||
</linearGradient>
|
|
||||||
<polygon style="fill:url(#SVGID_1_);" points="49.8,15.2 36,36.7 58.4,70 70,23.1 "/>
|
|
||||||
<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="17.7187" y1="73.2922" x2="69.5556" y2="18.1519">
|
|
||||||
<stop offset="1.612903e-002" style="stop-color:#B35BA3"/>
|
|
||||||
<stop offset="0.4044" style="stop-color:#C41E57"/>
|
|
||||||
<stop offset="0.4677" style="stop-color:#C41E57"/>
|
|
||||||
<stop offset="0.7043" style="stop-color:#EB8523"/>
|
|
||||||
</linearGradient>
|
|
||||||
<polygon style="fill:url(#SVGID_2_);" points="51.1,15.7 49,0 18.8,33.6 27.6,42.3 20.8,70 58.4,70 "/>
|
|
||||||
</g>
|
|
||||||
<linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="1.8281" y1="53.4275" x2="48.8245" y2="9.2255">
|
|
||||||
<stop offset="1.612903e-002" style="stop-color:#B35BA3"/>
|
|
||||||
<stop offset="0.6613" style="stop-color:#C41E57"/>
|
|
||||||
</linearGradient>
|
|
||||||
<polygon style="fill:url(#SVGID_3_);" points="49,0 11.6,0 0,47.1 55.6,47.1 "/>
|
|
||||||
<linearGradient id="SVGID_4_" gradientUnits="userSpaceOnUse" x1="49.8935" y1="-11.5569" x2="48.8588" y2="24.0352">
|
|
||||||
<stop offset="0.5" style="stop-color:#C41E57"/>
|
|
||||||
<stop offset="0.6668" style="stop-color:#D13F48"/>
|
|
||||||
<stop offset="0.7952" style="stop-color:#D94F39"/>
|
|
||||||
<stop offset="0.8656" style="stop-color:#DD5433"/>
|
|
||||||
</linearGradient>
|
|
||||||
<polygon style="fill:url(#SVGID_4_);" points="55.3,47.1 51.1,15.7 49,0 41.7,23 "/>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
|
|
||||||
<rect x="13.4" y="13.5" transform="matrix(-1 2.577289e-003 -2.577289e-003 -1 70.0288 70.081)" style="fill:#000000;" width="43.2" height="43.2"/>
|
|
||||||
|
|
||||||
<rect x="17.6" y="48.6" transform="matrix(1 -2.577289e-003 2.577289e-003 1 -0.1287 6.634109e-002)" style="fill:#FFFFFF;" width="16.2" height="2.7"/>
|
|
||||||
<path style="fill:#FFFFFF;" d="M17.4,19.1l8.2,0c2.3,0,4,0.6,5.2,1.8c1,1,1.5,2.4,1.5,4.1l0,0.1c0,1.5-0.3,2.6-1.1,3.5
|
|
||||||
c-0.7,0.9-1.6,1.6-2.8,2l4.4,6.4l-4.6,0l-3.7-5.5l-3.3,0l0,5.5l-3.9,0L17.4,19.1z M25.3,27.8c1,0,1.7-0.2,2.2-0.7
|
|
||||||
c0.5-0.5,0.8-1.1,0.8-1.8l0-0.1c0-0.9-0.3-1.5-0.8-1.9c-0.5-0.4-1.3-0.6-2.3-0.6l-3.9,0l0,5.1L25.3,27.8z"/>
|
|
||||||
<path style="fill:#FFFFFF;" d="M36,33.2l-1.9,0l0-3.3l2.5,0l0.6-3.8l-2.3,0l0-3.3l2.8,0l0.6-3.7l3.4,0l-0.6,3.7l3.7,0l0.6-3.7
|
|
||||||
l3.4,0l-0.6,3.7l1.9,0l0,3.3l-2.5,0L47,29.9l2.3,0l0,3.3l-2.8,0L45.8,37l-3.4,0l0.7-3.8l-3.7,0L38.7,37l-3.4,0L36,33.2z
|
|
||||||
M43.7,29.9l0.6-3.8l-3.7,0L40,29.9L43.7,29.9z"/>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 3.1 KiB |
|
|
@ -1,64 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
||||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 70 70" style="enable-background:new 0 0 70 70;" xml:space="preserve">
|
|
||||||
<g>
|
|
||||||
<g>
|
|
||||||
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="1.7738" y1="31.2729" x2="40.1662" y2="31.2729">
|
|
||||||
<stop offset="0" style="stop-color:#905CFB"/>
|
|
||||||
<stop offset="6.772543e-002" style="stop-color:#776CF9"/>
|
|
||||||
<stop offset="0.1729" style="stop-color:#5681F7"/>
|
|
||||||
<stop offset="0.2865" style="stop-color:#3B92F5"/>
|
|
||||||
<stop offset="0.4097" style="stop-color:#269FF4"/>
|
|
||||||
<stop offset="0.5474" style="stop-color:#17A9F3"/>
|
|
||||||
<stop offset="0.7111" style="stop-color:#0FAEF2"/>
|
|
||||||
<stop offset="0.9677" style="stop-color:#0CB0F2"/>
|
|
||||||
</linearGradient>
|
|
||||||
<path style="fill:url(#SVGID_1_);" d="M39.7,47.9l-6.1-34c-0.4-2.4-1.2-4.8-2.7-7.1c-2-3.2-5.2-5.4-8.8-6.3
|
|
||||||
C7.9-2.9-2.6,11.3,3.6,23.9c0,0,0,0,0,0l14.8,31.7c0.4,1,1,2,1.7,2.9c1.2,1.6,2.8,2.8,4.7,3.4C34.4,64.9,42.1,56.4,39.7,47.9z"/>
|
|
||||||
<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="5.3113" y1="9.6691" x2="69.2278" y2="43.8664">
|
|
||||||
<stop offset="0" style="stop-color:#905CFB"/>
|
|
||||||
<stop offset="6.772543e-002" style="stop-color:#776CF9"/>
|
|
||||||
<stop offset="0.1729" style="stop-color:#5681F7"/>
|
|
||||||
<stop offset="0.2865" style="stop-color:#3B92F5"/>
|
|
||||||
<stop offset="0.4097" style="stop-color:#269FF4"/>
|
|
||||||
<stop offset="0.5474" style="stop-color:#17A9F3"/>
|
|
||||||
<stop offset="0.7111" style="stop-color:#0FAEF2"/>
|
|
||||||
<stop offset="0.9677" style="stop-color:#0CB0F2"/>
|
|
||||||
</linearGradient>
|
|
||||||
<path style="fill:url(#SVGID_2_);" d="M67.4,26.5c-1.4-2.2-3.4-3.9-5.7-4.9L25.5,1.7l0,0c-1-0.5-2.1-1-3.3-1.3
|
|
||||||
C6.7-3.2-4.4,13.8,5.5,27c1.5,2,3.6,3.6,6,4.5L48,47.9c0.8,0.5,1.6,0.8,2.5,1.1C64.5,53.4,75.1,38.6,67.4,26.5z"/>
|
|
||||||
<linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="-19.2836" y1="70.8198" x2="55.9833" y2="33.1863">
|
|
||||||
<stop offset="0" style="stop-color:#3BEA62"/>
|
|
||||||
<stop offset="0.117" style="stop-color:#31DE80"/>
|
|
||||||
<stop offset="0.3025" style="stop-color:#24CEA8"/>
|
|
||||||
<stop offset="0.4844" style="stop-color:#1AC1C9"/>
|
|
||||||
<stop offset="0.6592" style="stop-color:#12B7DF"/>
|
|
||||||
<stop offset="0.8238" style="stop-color:#0EB2ED"/>
|
|
||||||
<stop offset="0.9677" style="stop-color:#0CB0F2"/>
|
|
||||||
</linearGradient>
|
|
||||||
<path style="fill:url(#SVGID_3_);" d="M67.4,26.5c-1.8-2.8-4.6-4.8-7.9-5.6c-3.5-0.8-6.8-0.5-9.6,0.7L11.4,36.1
|
|
||||||
c0,0-0.2,0.1-0.6,0.4C0.9,40.4-4,53.3,4,64c1.8,2.4,4.3,4.2,7.1,5c5.3,1.6,10.1,1,14-1.1c0,0,0.1,0,0.1,0l37.6-20.1
|
|
||||||
c0,0,0,0,0.1-0.1C69.5,43.9,72.6,34.6,67.4,26.5z"/>
|
|
||||||
<linearGradient id="SVGID_4_" gradientUnits="userSpaceOnUse" x1="38.9439" y1="5.8503" x2="5.4232" y2="77.5093">
|
|
||||||
<stop offset="0" style="stop-color:#3BEA62"/>
|
|
||||||
<stop offset="9.397750e-002" style="stop-color:#2FDB87"/>
|
|
||||||
<stop offset="0.196" style="stop-color:#24CEA8"/>
|
|
||||||
<stop offset="0.3063" style="stop-color:#1BC3C3"/>
|
|
||||||
<stop offset="0.4259" style="stop-color:#14BAD8"/>
|
|
||||||
<stop offset="0.5596" style="stop-color:#10B5E7"/>
|
|
||||||
<stop offset="0.7185" style="stop-color:#0DB1EF"/>
|
|
||||||
<stop offset="0.9677" style="stop-color:#0CB0F2"/>
|
|
||||||
</linearGradient>
|
|
||||||
<path style="fill:url(#SVGID_4_);" d="M50.3,12.8c1.2-2.7,1.1-6-0.9-9c-1.1-1.8-2.9-3-4.9-3.5c-4.5-1.1-8.3,1-10.1,4.2L3.5,42
|
|
||||||
c0,0,0,0,0,0.1C-0.9,47.9-1.6,56.5,4,64c1.8,2.4,4.3,4.2,7.1,5c10.5,3.3,19.3-2.5,22.1-10.8L50.3,12.8z"/>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
<rect x="13.4" y="13.4" style="fill:#000000;" width="43.2" height="43.2"/>
|
|
||||||
<rect x="17.5" y="48.5" style="fill:#FFFFFF;" width="16.2" height="2.7"/>
|
|
||||||
<polygon style="fill:#FFFFFF;" points="22.9,22.7 17.5,22.7 17.5,19.1 32.3,19.1 32.3,22.7 26.8,22.7 26.8,37 22.9,37 "/>
|
|
||||||
<path style="fill:#FFFFFF;" d="M32.5,28.1L32.5,28.1c0-5.1,3.8-9.3,9.3-9.3c3.4,0,5.4,1.1,7.1,2.8l-2.5,2.9c-1.4-1.3-2.8-2-4.6-2
|
|
||||||
c-3,0-5.2,2.5-5.2,5.6V28c0,3.1,2.1,5.6,5.2,5.6c2,0,3.3-0.8,4.7-2.1l2.5,2.5c-1.8,2-3.9,3.2-7.3,3.2
|
|
||||||
C36.4,37.3,32.5,33.2,32.5,28.1"/>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 4 KiB |
18
README.md
18
README.md
|
|
@ -1,6 +1,6 @@
|
||||||
# <img width="24px" src="./Logo/256.png" alt="Sonarr"></img> Sonarr
|
# <img width="24px" src="./Logo/256.png" alt="Sonarr"></img> Sonarr
|
||||||
|
|
||||||
[](https://translate.servarr.com/engage/servarr/)
|
[](https://translate.servarr.com/engage/servarr/)
|
||||||
[](#backers)
|
[](#backers)
|
||||||
[](#sponsors)
|
[](#sponsors)
|
||||||
[](#mega-sponsors)
|
[](#mega-sponsors)
|
||||||
|
|
@ -33,7 +33,7 @@ Note: GitHub Issues are for Bugs and Feature Requests Only
|
||||||
- Support for major platforms: Windows, Linux, macOS, Raspberry Pi, etc.
|
- Support for major platforms: Windows, Linux, macOS, Raspberry Pi, etc.
|
||||||
- Automatically detects new episodes
|
- Automatically detects new episodes
|
||||||
- Can scan your existing library and download any missing episodes
|
- Can scan your existing library and download any missing episodes
|
||||||
- Can watch for better quality of the episodes you already have and do an automatic upgrade. *eg. from DVD to Blu-Ray*
|
- Can watch for better quality of the episodes you already have and do an automatic upgrade. _eg. from DVD to Blu-Ray_
|
||||||
- Automatic failed download handling will try another release if one fails
|
- Automatic failed download handling will try another release if one fails
|
||||||
- Manual search so you can pick any release or to see why a release was not downloaded automatically
|
- Manual search so you can pick any release or to see why a release was not downloaded automatically
|
||||||
- Fully configurable episode renaming
|
- Fully configurable episode renaming
|
||||||
|
|
@ -69,13 +69,17 @@ This project would not be possible without the support of our users and software
|
||||||
|
|
||||||
#### JetBrains
|
#### JetBrains
|
||||||
|
|
||||||
Thank you to [<img src="/Logo/Jetbrains/jetbrains.svg" alt="JetBrains" width="32"> JetBrains](http://www.jetbrains.com/) for providing us with free licenses to their great tools
|
Thank you to [<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jetbrains.png" alt="JetBrains" width="96">](http://www.jetbrains.com/) for providing us with free licenses to their great tools
|
||||||
|
|
||||||
* [<img src="/Logo/Jetbrains/teamcity.svg" alt="TeamCity" width="32"> TeamCity](http://www.jetbrains.com/teamcity/)
|
[<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/TeamCity.png" alt="TeamCity" width="64">](http://www.jetbrains.com/teamcity/)
|
||||||
* [<img src="/Logo/Jetbrains/resharper.svg" alt="ReSharper" width="32"> ReSharper](http://www.jetbrains.com/resharper/)
|
|
||||||
* [<img src="/Logo/Jetbrains/dottrace.svg" alt="dotTrace" width="32"> dotTrace](http://www.jetbrains.com/dottrace/)
|
[<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/ReSharper.png" alt="ReSharper" width="64">](http://www.jetbrains.com/resharper/)
|
||||||
|
|
||||||
|
[<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/dotTrace.png" alt="dotTrace" width="64">](http://www.jetbrains.com/dottrace/)
|
||||||
|
|
||||||
|
[<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/Rider.png" alt="Rider" width="64">](http://www.jetbrains.com/rider/)
|
||||||
|
|
||||||
### Licenses
|
### Licenses
|
||||||
|
|
||||||
- [GNU GPL v3](http://www.gnu.org/licenses/gpl.html)
|
- [GNU GPL v3](http://www.gnu.org/licenses/gpl.html)
|
||||||
- Copyright 2010-2023
|
- Copyright 2010-2024
|
||||||
|
|
|
||||||
|
|
@ -210,7 +210,6 @@ module.exports = {
|
||||||
'no-undef-init': 'off',
|
'no-undef-init': 'off',
|
||||||
'no-undefined': 'off',
|
'no-undefined': 'off',
|
||||||
'no-unused-vars': ['error', { args: 'none', ignoreRestSiblings: true }],
|
'no-unused-vars': ['error', { args: 'none', ignoreRestSiblings: true }],
|
||||||
'no-use-before-define': 'error',
|
|
||||||
|
|
||||||
// Node.js and CommonJS
|
// Node.js and CommonJS
|
||||||
|
|
||||||
|
|
@ -364,7 +363,11 @@ module.exports = {
|
||||||
{
|
{
|
||||||
args: 'after-used',
|
args: 'after-used',
|
||||||
argsIgnorePattern: '^_',
|
argsIgnorePattern: '^_',
|
||||||
|
caughtErrorsIgnorePattern: '^_',
|
||||||
|
destructuredArrayIgnorePattern: '^_',
|
||||||
|
varsIgnorePattern: '^_',
|
||||||
ignoreRestSiblings: true
|
ignoreRestSiblings: true
|
||||||
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||||
|
|
|
||||||
2
frontend/.vscode/settings.json
vendored
2
frontend/.vscode/settings.json
vendored
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
"editor.formatOnSave": false,
|
"editor.formatOnSave": false,
|
||||||
"editor.codeActionsOnSave": {
|
"editor.codeActionsOnSave": {
|
||||||
"source.fixAll": true
|
"source.fixAll": "explicit"
|
||||||
},
|
},
|
||||||
|
|
||||||
"typescript.preferences.quoteStyle": "single",
|
"typescript.preferences.quoteStyle": "single",
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ module.exports = (env) => {
|
||||||
const config = {
|
const config = {
|
||||||
mode: isProduction ? 'production' : 'development',
|
mode: isProduction ? 'production' : 'development',
|
||||||
devtool: isProduction ? 'source-map' : 'eval-source-map',
|
devtool: isProduction ? 'source-map' : 'eval-source-map',
|
||||||
|
target: 'web',
|
||||||
|
|
||||||
stats: {
|
stats: {
|
||||||
children: false
|
children: false
|
||||||
|
|
@ -51,8 +52,7 @@ module.exports = (env) => {
|
||||||
'node_modules'
|
'node_modules'
|
||||||
],
|
],
|
||||||
alias: {
|
alias: {
|
||||||
jquery: 'jquery/dist/jquery.min',
|
jquery: 'jquery/dist/jquery.min'
|
||||||
'react-middle-truncate': 'react-middle-truncate/lib/react-middle-truncate'
|
|
||||||
},
|
},
|
||||||
fallback: {
|
fallback: {
|
||||||
buffer: false,
|
buffer: false,
|
||||||
|
|
@ -134,6 +134,12 @@ module.exports = (env) => {
|
||||||
{
|
{
|
||||||
source: 'frontend/src/Content/robots.txt',
|
source: 'frontend/src/Content/robots.txt',
|
||||||
destination: path.join(distFolder, 'Content/robots.txt')
|
destination: path.join(distFolder, 'Content/robots.txt')
|
||||||
|
},
|
||||||
|
|
||||||
|
// manifest.json and browserconfig.xml
|
||||||
|
{
|
||||||
|
source: 'frontend/src/Content/*.(json|xml)',
|
||||||
|
destination: path.join(distFolder, 'Content')
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -181,7 +187,7 @@ module.exports = (env) => {
|
||||||
loose: true,
|
loose: true,
|
||||||
debug: false,
|
debug: false,
|
||||||
useBuiltIns: 'entry',
|
useBuiltIns: 'entry',
|
||||||
corejs: 3
|
corejs: '3.39'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ const mixinsFiles = [
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
plugins: [
|
plugins: [
|
||||||
|
'autoprefixer',
|
||||||
['postcss-mixins', {
|
['postcss-mixins', {
|
||||||
mixinsFiles
|
mixinsFiles
|
||||||
}],
|
}],
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,6 @@ interface HistoryDetailsProps {
|
||||||
sourceTitle: string;
|
sourceTitle: string;
|
||||||
data: HistoryData;
|
data: HistoryData;
|
||||||
downloadId?: string;
|
downloadId?: string;
|
||||||
shortDateFormat: string;
|
|
||||||
timeFormat: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function HistoryDetails(props: HistoryDetailsProps) {
|
function HistoryDetails(props: HistoryDetailsProps) {
|
||||||
|
|
@ -43,6 +41,7 @@ function HistoryDetails(props: HistoryDetailsProps) {
|
||||||
indexer,
|
indexer,
|
||||||
releaseGroup,
|
releaseGroup,
|
||||||
seriesMatchType,
|
seriesMatchType,
|
||||||
|
releaseSource,
|
||||||
customFormatScore,
|
customFormatScore,
|
||||||
nzbInfoUrl,
|
nzbInfoUrl,
|
||||||
downloadClient,
|
downloadClient,
|
||||||
|
|
@ -55,6 +54,31 @@ function HistoryDetails(props: HistoryDetailsProps) {
|
||||||
|
|
||||||
const downloadClientNameInfo = downloadClientName ?? downloadClient;
|
const downloadClientNameInfo = downloadClientName ?? downloadClient;
|
||||||
|
|
||||||
|
let releaseSourceMessage = '';
|
||||||
|
|
||||||
|
switch (releaseSource) {
|
||||||
|
case 'Unknown':
|
||||||
|
releaseSourceMessage = translate('Unknown');
|
||||||
|
break;
|
||||||
|
case 'Rss':
|
||||||
|
releaseSourceMessage = translate('Rss');
|
||||||
|
break;
|
||||||
|
case 'Search':
|
||||||
|
releaseSourceMessage = translate('Search');
|
||||||
|
break;
|
||||||
|
case 'UserInvokedSearch':
|
||||||
|
releaseSourceMessage = translate('UserInvokedSearch');
|
||||||
|
break;
|
||||||
|
case 'InteractiveSearch':
|
||||||
|
releaseSourceMessage = translate('InteractiveSearch');
|
||||||
|
break;
|
||||||
|
case 'ReleasePush':
|
||||||
|
releaseSourceMessage = translate('ReleasePush');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
releaseSourceMessage = '';
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DescriptionList>
|
<DescriptionList>
|
||||||
<DescriptionListItem
|
<DescriptionListItem
|
||||||
|
|
@ -90,6 +114,14 @@ function HistoryDetails(props: HistoryDetailsProps) {
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
|
{releaseSource ? (
|
||||||
|
<DescriptionListItem
|
||||||
|
descriptionClassName={styles.description}
|
||||||
|
title={translate('ReleaseSource')}
|
||||||
|
data={releaseSourceMessage}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
|
||||||
{nzbInfoUrl ? (
|
{nzbInfoUrl ? (
|
||||||
<span>
|
<span>
|
||||||
<DescriptionListItemTitle>
|
<DescriptionListItemTitle>
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,6 @@ interface HistoryDetailsModalProps {
|
||||||
data: HistoryData;
|
data: HistoryData;
|
||||||
downloadId?: string;
|
downloadId?: string;
|
||||||
isMarkingAsFailed: boolean;
|
isMarkingAsFailed: boolean;
|
||||||
shortDateFormat: string;
|
|
||||||
timeFormat: string;
|
|
||||||
onMarkAsFailedPress: () => void;
|
onMarkAsFailedPress: () => void;
|
||||||
onModalClose: () => void;
|
onModalClose: () => void;
|
||||||
}
|
}
|
||||||
|
|
@ -52,8 +50,6 @@ function HistoryDetailsModal(props: HistoryDetailsModalProps) {
|
||||||
data,
|
data,
|
||||||
downloadId,
|
downloadId,
|
||||||
isMarkingAsFailed = false,
|
isMarkingAsFailed = false,
|
||||||
shortDateFormat,
|
|
||||||
timeFormat,
|
|
||||||
onMarkAsFailedPress,
|
onMarkAsFailedPress,
|
||||||
onModalClose,
|
onModalClose,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
@ -69,8 +65,6 @@ function HistoryDetailsModal(props: HistoryDetailsModalProps) {
|
||||||
sourceTitle={sourceTitle}
|
sourceTitle={sourceTitle}
|
||||||
data={data}
|
data={data}
|
||||||
downloadId={downloadId}
|
downloadId={downloadId}
|
||||||
shortDateFormat={shortDateFormat}
|
|
||||||
timeFormat={timeFormat}
|
|
||||||
/>
|
/>
|
||||||
</ModalBody>
|
</ModalBody>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import React, { useCallback, useEffect, useState } from 'react';
|
import React, { useCallback, useEffect, useState } from 'react';
|
||||||
import { useDispatch, useSelector } from 'react-redux';
|
import { useDispatch } from 'react-redux';
|
||||||
import IconButton from 'Components/Link/IconButton';
|
import IconButton from 'Components/Link/IconButton';
|
||||||
import RelativeDateCell from 'Components/Table/Cells/RelativeDateCell';
|
import RelativeDateCell from 'Components/Table/Cells/RelativeDateCell';
|
||||||
import TableRowCell from 'Components/Table/Cells/TableRowCell';
|
import TableRowCell from 'Components/Table/Cells/TableRowCell';
|
||||||
|
|
@ -20,7 +20,6 @@ import { QualityModel } from 'Quality/Quality';
|
||||||
import SeriesTitleLink from 'Series/SeriesTitleLink';
|
import SeriesTitleLink from 'Series/SeriesTitleLink';
|
||||||
import useSeries from 'Series/useSeries';
|
import useSeries from 'Series/useSeries';
|
||||||
import { fetchHistory, markAsFailed } from 'Store/Actions/historyActions';
|
import { fetchHistory, markAsFailed } from 'Store/Actions/historyActions';
|
||||||
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
|
||||||
import CustomFormat from 'typings/CustomFormat';
|
import CustomFormat from 'typings/CustomFormat';
|
||||||
import { HistoryData, HistoryEventType } from 'typings/History';
|
import { HistoryData, HistoryEventType } from 'typings/History';
|
||||||
import formatCustomFormatScore from 'Utilities/Number/formatCustomFormatScore';
|
import formatCustomFormatScore from 'Utilities/Number/formatCustomFormatScore';
|
||||||
|
|
@ -72,10 +71,6 @@ function HistoryRow(props: HistoryRowProps) {
|
||||||
const series = useSeries(seriesId);
|
const series = useSeries(seriesId);
|
||||||
const episode = useEpisode(episodeId, 'episodes');
|
const episode = useEpisode(episodeId, 'episodes');
|
||||||
|
|
||||||
const { shortDateFormat, timeFormat } = useSelector(
|
|
||||||
createUISettingsSelector()
|
|
||||||
);
|
|
||||||
|
|
||||||
const [isDetailsModalOpen, setIsDetailsModalOpen] = useState(false);
|
const [isDetailsModalOpen, setIsDetailsModalOpen] = useState(false);
|
||||||
|
|
||||||
const handleDetailsPress = useCallback(() => {
|
const handleDetailsPress = useCallback(() => {
|
||||||
|
|
@ -200,9 +195,14 @@ function HistoryRow(props: HistoryRowProps) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name === 'downloadClient') {
|
if (name === 'downloadClient') {
|
||||||
|
const downloadClientName =
|
||||||
|
'downloadClientName' in data ? data.downloadClientName : null;
|
||||||
|
const downloadClient =
|
||||||
|
'downloadClient' in data ? data.downloadClient : null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TableRowCell key={name} className={styles.downloadClient}>
|
<TableRowCell key={name} className={styles.downloadClient}>
|
||||||
{'downloadClient' in data ? data.downloadClient : ''}
|
{downloadClientName ?? downloadClient ?? ''}
|
||||||
</TableRowCell>
|
</TableRowCell>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -260,8 +260,6 @@ function HistoryRow(props: HistoryRowProps) {
|
||||||
data={data}
|
data={data}
|
||||||
downloadId={downloadId}
|
downloadId={downloadId}
|
||||||
isMarkingAsFailed={isMarkingAsFailed}
|
isMarkingAsFailed={isMarkingAsFailed}
|
||||||
shortDateFormat={shortDateFormat}
|
|
||||||
timeFormat={timeFormat}
|
|
||||||
onMarkAsFailedPress={handleMarkAsFailedPress}
|
onMarkAsFailedPress={handleMarkAsFailedPress}
|
||||||
onModalClose={handleDetailsModalClose}
|
onModalClose={handleDetailsModalClose}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Icon from 'Components/Icon';
|
import Icon, { IconProps } from 'Components/Icon';
|
||||||
import Popover from 'Components/Tooltip/Popover';
|
import Popover from 'Components/Tooltip/Popover';
|
||||||
import { icons, kinds } from 'Helpers/Props';
|
import { icons, kinds } from 'Helpers/Props';
|
||||||
import TooltipPosition from 'Helpers/Props/TooltipPosition';
|
import { TooltipPosition } from 'Helpers/Props/tooltipPositions';
|
||||||
import {
|
import {
|
||||||
QueueTrackedDownloadState,
|
QueueTrackedDownloadState,
|
||||||
QueueTrackedDownloadStatus,
|
QueueTrackedDownloadStatus,
|
||||||
|
|
@ -61,7 +61,7 @@ function QueueStatus(props: QueueStatusProps) {
|
||||||
|
|
||||||
// status === 'downloading'
|
// status === 'downloading'
|
||||||
let iconName = icons.DOWNLOADING;
|
let iconName = icons.DOWNLOADING;
|
||||||
let iconKind = kinds.DEFAULT;
|
let iconKind: IconProps['kind'] = kinds.DEFAULT;
|
||||||
let title = translate('Downloading');
|
let title = translate('Downloading');
|
||||||
|
|
||||||
if (status === 'paused') {
|
if (status === 'paused') {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
|
import Alert from 'Components/Alert';
|
||||||
import TextInput from 'Components/Form/TextInput';
|
import TextInput from 'Components/Form/TextInput';
|
||||||
import Icon from 'Components/Icon';
|
import Icon from 'Components/Icon';
|
||||||
import Button from 'Components/Link/Button';
|
import Button from 'Components/Link/Button';
|
||||||
|
|
@ -129,7 +130,8 @@ class AddNewSeries extends Component {
|
||||||
<div className={styles.helpText}>
|
<div className={styles.helpText}>
|
||||||
{translate('AddNewSeriesError')}
|
{translate('AddNewSeriesError')}
|
||||||
</div>
|
</div>
|
||||||
<div>{getErrorMessage(error)}</div>
|
|
||||||
|
<Alert kind={kinds.DANGER}>{getErrorMessage(error)}</Alert>
|
||||||
</div> : null
|
</div> : null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,10 +70,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.originalLanguageName,
|
.originalLanguageName,
|
||||||
.network {
|
.network,
|
||||||
|
.genres {
|
||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.genres {
|
||||||
|
pointer-events: all;
|
||||||
|
}
|
||||||
|
|
||||||
.tvdbLink {
|
.tvdbLink {
|
||||||
composes: link from '~Components/Link/Link.css';
|
composes: link from '~Components/Link/Link.css';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
interface CssExports {
|
interface CssExports {
|
||||||
'alreadyExistsIcon': string;
|
'alreadyExistsIcon': string;
|
||||||
'content': string;
|
'content': string;
|
||||||
|
'genres': string;
|
||||||
'icons': string;
|
'icons': string;
|
||||||
'network': string;
|
'network': string;
|
||||||
'originalLanguageName': string;
|
'originalLanguageName': string;
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import Label from 'Components/Label';
|
||||||
import Link from 'Components/Link/Link';
|
import Link from 'Components/Link/Link';
|
||||||
import MetadataAttribution from 'Components/MetadataAttribution';
|
import MetadataAttribution from 'Components/MetadataAttribution';
|
||||||
import { icons, kinds, sizes } from 'Helpers/Props';
|
import { icons, kinds, sizes } from 'Helpers/Props';
|
||||||
|
import SeriesGenres from 'Series/SeriesGenres';
|
||||||
import SeriesPoster from 'Series/SeriesPoster';
|
import SeriesPoster from 'Series/SeriesPoster';
|
||||||
import translate from 'Utilities/String/translate';
|
import translate from 'Utilities/String/translate';
|
||||||
import AddNewSeriesModal from './AddNewSeriesModal';
|
import AddNewSeriesModal from './AddNewSeriesModal';
|
||||||
|
|
@ -56,6 +57,7 @@ class AddNewSeriesSearchResult extends Component {
|
||||||
year,
|
year,
|
||||||
network,
|
network,
|
||||||
originalLanguage,
|
originalLanguage,
|
||||||
|
genres,
|
||||||
status,
|
status,
|
||||||
overview,
|
overview,
|
||||||
statistics,
|
statistics,
|
||||||
|
|
@ -181,6 +183,18 @@ class AddNewSeriesSearchResult extends Component {
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
genres.length > 0 ?
|
||||||
|
<Label size={sizes.LARGE}>
|
||||||
|
<Icon
|
||||||
|
name={icons.GENRE}
|
||||||
|
size={13}
|
||||||
|
/>
|
||||||
|
<SeriesGenres className={styles.genres} genres={genres} />
|
||||||
|
</Label> :
|
||||||
|
null
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
seasonCount ?
|
seasonCount ?
|
||||||
<Label size={sizes.LARGE}>
|
<Label size={sizes.LARGE}>
|
||||||
|
|
@ -243,6 +257,7 @@ AddNewSeriesSearchResult.propTypes = {
|
||||||
year: PropTypes.number.isRequired,
|
year: PropTypes.number.isRequired,
|
||||||
network: PropTypes.string,
|
network: PropTypes.string,
|
||||||
originalLanguage: PropTypes.object,
|
originalLanguage: PropTypes.object,
|
||||||
|
genres: PropTypes.arrayOf(PropTypes.string),
|
||||||
status: PropTypes.string.isRequired,
|
status: PropTypes.string.isRequired,
|
||||||
overview: PropTypes.string,
|
overview: PropTypes.string,
|
||||||
statistics: PropTypes.object.isRequired,
|
statistics: PropTypes.object.isRequired,
|
||||||
|
|
@ -254,4 +269,8 @@ AddNewSeriesSearchResult.propTypes = {
|
||||||
isSmallScreen: PropTypes.bool.isRequired
|
isSmallScreen: PropTypes.bool.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
|
AddNewSeriesSearchResult.defaultProps = {
|
||||||
|
genres: []
|
||||||
|
};
|
||||||
|
|
||||||
export default AddNewSeriesSearchResult;
|
export default AddNewSeriesSearchResult;
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,10 @@
|
||||||
.inputContainer {
|
.inputContainer {
|
||||||
margin-right: 20px;
|
margin-right: 20px;
|
||||||
min-width: 150px;
|
min-width: 150px;
|
||||||
|
|
||||||
div {
|
|
||||||
margin-top: 10px;
|
|
||||||
|
|
||||||
&:first-child {
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.label {
|
.label {
|
||||||
margin-bottom: 3px;
|
margin-bottom: 10px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||||
import { ConnectedRouter, ConnectedRouterProps } from 'connected-react-router';
|
import { ConnectedRouter, ConnectedRouterProps } from 'connected-react-router';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import DocumentTitle from 'react-document-title';
|
import DocumentTitle from 'react-document-title';
|
||||||
|
|
@ -12,17 +13,21 @@ interface AppProps {
|
||||||
history: ConnectedRouterProps['history'];
|
history: ConnectedRouterProps['history'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const queryClient = new QueryClient();
|
||||||
|
|
||||||
function App({ store, history }: AppProps) {
|
function App({ store, history }: AppProps) {
|
||||||
return (
|
return (
|
||||||
<DocumentTitle title={window.Sonarr.instanceName}>
|
<DocumentTitle title={window.Sonarr.instanceName}>
|
||||||
<Provider store={store}>
|
<QueryClientProvider client={queryClient}>
|
||||||
<ConnectedRouter history={history}>
|
<Provider store={store}>
|
||||||
<ApplyTheme />
|
<ConnectedRouter history={history}>
|
||||||
<PageConnector>
|
<ApplyTheme />
|
||||||
<AppRoutes />
|
<PageConnector>
|
||||||
</PageConnector>
|
<AppRoutes />
|
||||||
</ConnectedRouter>
|
</PageConnector>
|
||||||
</Provider>
|
</ConnectedRouter>
|
||||||
|
</Provider>
|
||||||
|
</QueryClientProvider>
|
||||||
</DocumentTitle>
|
</DocumentTitle>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import History from 'Activity/History/History';
|
||||||
import Queue from 'Activity/Queue/Queue';
|
import Queue from 'Activity/Queue/Queue';
|
||||||
import AddNewSeriesConnector from 'AddSeries/AddNewSeries/AddNewSeriesConnector';
|
import AddNewSeriesConnector from 'AddSeries/AddNewSeries/AddNewSeriesConnector';
|
||||||
import ImportSeries from 'AddSeries/ImportSeries/ImportSeries';
|
import ImportSeries from 'AddSeries/ImportSeries/ImportSeries';
|
||||||
import CalendarPageConnector from 'Calendar/CalendarPageConnector';
|
import CalendarPage from 'Calendar/CalendarPage';
|
||||||
import NotFound from 'Components/NotFound';
|
import NotFound from 'Components/NotFound';
|
||||||
import Switch from 'Components/Router/Switch';
|
import Switch from 'Components/Router/Switch';
|
||||||
import SeriesDetailsPageConnector from 'Series/Details/SeriesDetailsPageConnector';
|
import SeriesDetailsPageConnector from 'Series/Details/SeriesDetailsPageConnector';
|
||||||
|
|
@ -72,7 +72,7 @@ function AppRoutes() {
|
||||||
Calendar
|
Calendar
|
||||||
*/}
|
*/}
|
||||||
|
|
||||||
<Route path="/calendar" component={CalendarPageConnector} />
|
<Route path="/calendar" component={CalendarPage} />
|
||||||
|
|
||||||
{/*
|
{/*
|
||||||
Activity
|
Activity
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,16 @@
|
||||||
import Column from 'Components/Table/Column';
|
import Column from 'Components/Table/Column';
|
||||||
import SortDirection from 'Helpers/Props/SortDirection';
|
import { SortDirection } from 'Helpers/Props/sortDirections';
|
||||||
|
import { ValidationFailure } from 'typings/pending';
|
||||||
import { FilterBuilderProp, PropertyFilter } from './AppState';
|
import { FilterBuilderProp, PropertyFilter } from './AppState';
|
||||||
|
|
||||||
export interface Error {
|
export interface Error {
|
||||||
responseJSON: {
|
status?: number;
|
||||||
message: string;
|
responseJSON:
|
||||||
};
|
| {
|
||||||
|
message: string | undefined;
|
||||||
|
}
|
||||||
|
| ValidationFailure[]
|
||||||
|
| undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AppSectionDeleteState {
|
export interface AppSectionDeleteState {
|
||||||
|
|
@ -58,6 +63,16 @@ export interface AppSectionItemState<T> {
|
||||||
item: T;
|
item: T;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface AppSectionProviderState<T>
|
||||||
|
extends AppSectionDeleteState,
|
||||||
|
AppSectionSaveState {
|
||||||
|
isFetching: boolean;
|
||||||
|
isPopulated: boolean;
|
||||||
|
error: Error;
|
||||||
|
items: T[];
|
||||||
|
pendingChanges: Partial<T>;
|
||||||
|
}
|
||||||
|
|
||||||
interface AppSectionState<T> {
|
interface AppSectionState<T> {
|
||||||
isFetching: boolean;
|
isFetching: boolean;
|
||||||
isPopulated: boolean;
|
isPopulated: boolean;
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,23 @@
|
||||||
import InteractiveImportAppState from 'App/State/InteractiveImportAppState';
|
|
||||||
import BlocklistAppState from './BlocklistAppState';
|
import BlocklistAppState from './BlocklistAppState';
|
||||||
import CalendarAppState from './CalendarAppState';
|
import CalendarAppState from './CalendarAppState';
|
||||||
|
import CaptchaAppState from './CaptchaAppState';
|
||||||
import CommandAppState from './CommandAppState';
|
import CommandAppState from './CommandAppState';
|
||||||
import EpisodeFilesAppState from './EpisodeFilesAppState';
|
import EpisodeFilesAppState from './EpisodeFilesAppState';
|
||||||
import EpisodesAppState from './EpisodesAppState';
|
import EpisodesAppState from './EpisodesAppState';
|
||||||
import HistoryAppState from './HistoryAppState';
|
import HistoryAppState from './HistoryAppState';
|
||||||
|
import InteractiveImportAppState from './InteractiveImportAppState';
|
||||||
|
import OAuthAppState from './OAuthAppState';
|
||||||
import ParseAppState from './ParseAppState';
|
import ParseAppState from './ParseAppState';
|
||||||
|
import PathsAppState from './PathsAppState';
|
||||||
|
import ProviderOptionsAppState from './ProviderOptionsAppState';
|
||||||
import QueueAppState from './QueueAppState';
|
import QueueAppState from './QueueAppState';
|
||||||
|
import ReleasesAppState from './ReleasesAppState';
|
||||||
import RootFolderAppState from './RootFolderAppState';
|
import RootFolderAppState from './RootFolderAppState';
|
||||||
import SeriesAppState, { SeriesIndexAppState } from './SeriesAppState';
|
import SeriesAppState, { SeriesIndexAppState } from './SeriesAppState';
|
||||||
import SettingsAppState from './SettingsAppState';
|
import SettingsAppState from './SettingsAppState';
|
||||||
import SystemAppState from './SystemAppState';
|
import SystemAppState from './SystemAppState';
|
||||||
import TagsAppState from './TagsAppState';
|
import TagsAppState from './TagsAppState';
|
||||||
|
import WantedAppState from './WantedAppState';
|
||||||
|
|
||||||
interface FilterBuilderPropOption {
|
interface FilterBuilderPropOption {
|
||||||
id: string;
|
id: string;
|
||||||
|
|
@ -48,10 +54,12 @@ export interface CustomFilter {
|
||||||
export interface AppSectionState {
|
export interface AppSectionState {
|
||||||
isConnected: boolean;
|
isConnected: boolean;
|
||||||
isReconnecting: boolean;
|
isReconnecting: boolean;
|
||||||
|
isSidebarVisible: boolean;
|
||||||
version: string;
|
version: string;
|
||||||
prevVersion?: string;
|
prevVersion?: string;
|
||||||
dimensions: {
|
dimensions: {
|
||||||
isSmallScreen: boolean;
|
isSmallScreen: boolean;
|
||||||
|
isLargeScreen: boolean;
|
||||||
width: number;
|
width: number;
|
||||||
height: number;
|
height: number;
|
||||||
};
|
};
|
||||||
|
|
@ -61,20 +69,27 @@ interface AppState {
|
||||||
app: AppSectionState;
|
app: AppSectionState;
|
||||||
blocklist: BlocklistAppState;
|
blocklist: BlocklistAppState;
|
||||||
calendar: CalendarAppState;
|
calendar: CalendarAppState;
|
||||||
|
captcha: CaptchaAppState;
|
||||||
commands: CommandAppState;
|
commands: CommandAppState;
|
||||||
episodes: EpisodesAppState;
|
|
||||||
episodeFiles: EpisodeFilesAppState;
|
episodeFiles: EpisodeFilesAppState;
|
||||||
|
episodeHistory: HistoryAppState;
|
||||||
|
episodes: EpisodesAppState;
|
||||||
episodesSelection: EpisodesAppState;
|
episodesSelection: EpisodesAppState;
|
||||||
history: HistoryAppState;
|
history: HistoryAppState;
|
||||||
interactiveImport: InteractiveImportAppState;
|
interactiveImport: InteractiveImportAppState;
|
||||||
|
oAuth: OAuthAppState;
|
||||||
parse: ParseAppState;
|
parse: ParseAppState;
|
||||||
|
paths: PathsAppState;
|
||||||
|
providerOptions: ProviderOptionsAppState;
|
||||||
queue: QueueAppState;
|
queue: QueueAppState;
|
||||||
|
releases: ReleasesAppState;
|
||||||
rootFolders: RootFolderAppState;
|
rootFolders: RootFolderAppState;
|
||||||
series: SeriesAppState;
|
series: SeriesAppState;
|
||||||
seriesIndex: SeriesIndexAppState;
|
seriesIndex: SeriesIndexAppState;
|
||||||
settings: SettingsAppState;
|
settings: SettingsAppState;
|
||||||
system: SystemAppState;
|
system: SystemAppState;
|
||||||
tags: TagsAppState;
|
tags: TagsAppState;
|
||||||
|
wanted: WantedAppState;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default AppState;
|
export default AppState;
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,29 @@
|
||||||
|
import moment from 'moment';
|
||||||
import AppSectionState, {
|
import AppSectionState, {
|
||||||
AppSectionFilterState,
|
AppSectionFilterState,
|
||||||
} from 'App/State/AppSectionState';
|
} from 'App/State/AppSectionState';
|
||||||
import Episode from 'Episode/Episode';
|
import { CalendarView } from 'Calendar/calendarViews';
|
||||||
|
import { CalendarItem } from 'typings/Calendar';
|
||||||
|
|
||||||
|
interface CalendarOptions {
|
||||||
|
showEpisodeInformation: boolean;
|
||||||
|
showFinaleIcon: boolean;
|
||||||
|
showSpecialIcon: boolean;
|
||||||
|
showCutoffUnmetIcon: boolean;
|
||||||
|
collapseMultipleEpisodes: boolean;
|
||||||
|
fullColorEvents: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
interface CalendarAppState
|
interface CalendarAppState
|
||||||
extends AppSectionState<Episode>,
|
extends AppSectionState<CalendarItem>,
|
||||||
AppSectionFilterState<Episode> {}
|
AppSectionFilterState<CalendarItem> {
|
||||||
|
searchMissingCommandId: number | null;
|
||||||
|
start: moment.Moment;
|
||||||
|
end: moment.Moment;
|
||||||
|
dates: string[];
|
||||||
|
time: string;
|
||||||
|
view: CalendarView;
|
||||||
|
options: CalendarOptions;
|
||||||
|
}
|
||||||
|
|
||||||
export default CalendarAppState;
|
export default CalendarAppState;
|
||||||
|
|
|
||||||
11
frontend/src/App/State/CaptchaAppState.ts
Normal file
11
frontend/src/App/State/CaptchaAppState.ts
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
interface CaptchaAppState {
|
||||||
|
refreshing: false;
|
||||||
|
token: string;
|
||||||
|
siteKey: unknown;
|
||||||
|
secretToken: unknown;
|
||||||
|
ray: unknown;
|
||||||
|
stoken: unknown;
|
||||||
|
responseUrl: unknown;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default CaptchaAppState;
|
||||||
|
|
@ -1,11 +1,20 @@
|
||||||
import AppSectionState from 'App/State/AppSectionState';
|
import AppSectionState from 'App/State/AppSectionState';
|
||||||
import RecentFolder from 'InteractiveImport/Folder/RecentFolder';
|
|
||||||
import ImportMode from 'InteractiveImport/ImportMode';
|
import ImportMode from 'InteractiveImport/ImportMode';
|
||||||
import InteractiveImport from 'InteractiveImport/InteractiveImport';
|
import InteractiveImport from 'InteractiveImport/InteractiveImport';
|
||||||
|
|
||||||
|
interface FavoriteFolder {
|
||||||
|
folder: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface RecentFolder {
|
||||||
|
folder: string;
|
||||||
|
lastUsed: string;
|
||||||
|
}
|
||||||
|
|
||||||
interface InteractiveImportAppState extends AppSectionState<InteractiveImport> {
|
interface InteractiveImportAppState extends AppSectionState<InteractiveImport> {
|
||||||
originalItems: InteractiveImport[];
|
originalItems: InteractiveImport[];
|
||||||
importMode: ImportMode;
|
importMode: ImportMode;
|
||||||
|
favoriteFolders: FavoriteFolder[];
|
||||||
recentFolders: RecentFolder[];
|
recentFolders: RecentFolder[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
6
frontend/src/App/State/MetadataAppState.ts
Normal file
6
frontend/src/App/State/MetadataAppState.ts
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
import { AppSectionProviderState } from 'App/State/AppSectionState';
|
||||||
|
import Metadata from 'typings/Metadata';
|
||||||
|
|
||||||
|
type MetadataAppState = AppSectionProviderState<Metadata>;
|
||||||
|
|
||||||
|
export default MetadataAppState;
|
||||||
9
frontend/src/App/State/OAuthAppState.ts
Normal file
9
frontend/src/App/State/OAuthAppState.ts
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
import { Error } from './AppSectionState';
|
||||||
|
|
||||||
|
interface OAuthAppState {
|
||||||
|
authorizing: boolean;
|
||||||
|
result: Record<string, unknown> | null;
|
||||||
|
error: Error;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default OAuthAppState;
|
||||||
29
frontend/src/App/State/PathsAppState.ts
Normal file
29
frontend/src/App/State/PathsAppState.ts
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
interface BasePath {
|
||||||
|
name: string;
|
||||||
|
path: string;
|
||||||
|
size: number;
|
||||||
|
lastModified: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface File extends BasePath {
|
||||||
|
type: 'file';
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Folder extends BasePath {
|
||||||
|
type: 'folder';
|
||||||
|
}
|
||||||
|
|
||||||
|
export type PathType = 'file' | 'folder' | 'drive' | 'computer' | 'parent';
|
||||||
|
export type Path = File | Folder;
|
||||||
|
|
||||||
|
interface PathsAppState {
|
||||||
|
currentPath: string;
|
||||||
|
isFetching: boolean;
|
||||||
|
isPopulated: boolean;
|
||||||
|
error: Error;
|
||||||
|
directories: Folder[];
|
||||||
|
files: File[];
|
||||||
|
parent: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default PathsAppState;
|
||||||
22
frontend/src/App/State/ProviderOptionsAppState.ts
Normal file
22
frontend/src/App/State/ProviderOptionsAppState.ts
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
import AppSectionState from 'App/State/AppSectionState';
|
||||||
|
import Field, { FieldSelectOption } from 'typings/Field';
|
||||||
|
|
||||||
|
export interface ProviderOptions {
|
||||||
|
fields?: Field[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ProviderOptionsDevice {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ProviderOptionsAppState {
|
||||||
|
devices: AppSectionState<ProviderOptionsDevice>;
|
||||||
|
servers: AppSectionState<FieldSelectOption<unknown>>;
|
||||||
|
newznabCategories: AppSectionState<FieldSelectOption<unknown>>;
|
||||||
|
getProfiles: AppSectionState<FieldSelectOption<unknown>>;
|
||||||
|
getTags: AppSectionState<FieldSelectOption<unknown>>;
|
||||||
|
getRootFolders: AppSectionState<FieldSelectOption<unknown>>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ProviderOptionsAppState;
|
||||||
10
frontend/src/App/State/ReleasesAppState.ts
Normal file
10
frontend/src/App/State/ReleasesAppState.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
import AppSectionState, {
|
||||||
|
AppSectionFilterState,
|
||||||
|
} from 'App/State/AppSectionState';
|
||||||
|
import Release from 'typings/Release';
|
||||||
|
|
||||||
|
interface ReleasesAppState
|
||||||
|
extends AppSectionState<Release>,
|
||||||
|
AppSectionFilterState<Release> {}
|
||||||
|
|
||||||
|
export default ReleasesAppState;
|
||||||
|
|
@ -3,7 +3,7 @@ import AppSectionState, {
|
||||||
AppSectionSaveState,
|
AppSectionSaveState,
|
||||||
} from 'App/State/AppSectionState';
|
} from 'App/State/AppSectionState';
|
||||||
import Column from 'Components/Table/Column';
|
import Column from 'Components/Table/Column';
|
||||||
import SortDirection from 'Helpers/Props/SortDirection';
|
import { SortDirection } from 'Helpers/Props/sortDirections';
|
||||||
import Series from 'Series/Series';
|
import Series from 'Series/Series';
|
||||||
import { Filter, FilterBuilderProp } from './AppState';
|
import { Filter, FilterBuilderProp } from './AppState';
|
||||||
|
|
||||||
|
|
@ -59,6 +59,8 @@ interface SeriesAppState
|
||||||
deleteOptions: {
|
deleteOptions: {
|
||||||
addImportListExclusion: boolean;
|
addImportListExclusion: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pendingChanges: Partial<Series>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default SeriesAppState;
|
export default SeriesAppState;
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import AppSectionState, {
|
||||||
PagedAppSectionState,
|
PagedAppSectionState,
|
||||||
} from 'App/State/AppSectionState';
|
} from 'App/State/AppSectionState';
|
||||||
import Language from 'Language/Language';
|
import Language from 'Language/Language';
|
||||||
|
import CustomFormat from 'typings/CustomFormat';
|
||||||
import DownloadClient from 'typings/DownloadClient';
|
import DownloadClient from 'typings/DownloadClient';
|
||||||
import ImportList from 'typings/ImportList';
|
import ImportList from 'typings/ImportList';
|
||||||
import ImportListExclusion from 'typings/ImportListExclusion';
|
import ImportListExclusion from 'typings/ImportListExclusion';
|
||||||
|
|
@ -15,7 +16,11 @@ import IndexerFlag from 'typings/IndexerFlag';
|
||||||
import Notification from 'typings/Notification';
|
import Notification from 'typings/Notification';
|
||||||
import QualityProfile from 'typings/QualityProfile';
|
import QualityProfile from 'typings/QualityProfile';
|
||||||
import General from 'typings/Settings/General';
|
import General from 'typings/Settings/General';
|
||||||
|
import NamingConfig from 'typings/Settings/NamingConfig';
|
||||||
|
import NamingExample from 'typings/Settings/NamingExample';
|
||||||
|
import ReleaseProfile from 'typings/Settings/ReleaseProfile';
|
||||||
import UiSettings from 'typings/Settings/UiSettings';
|
import UiSettings from 'typings/Settings/UiSettings';
|
||||||
|
import MetadataAppState from './MetadataAppState';
|
||||||
|
|
||||||
export interface DownloadClientAppState
|
export interface DownloadClientAppState
|
||||||
extends AppSectionState<DownloadClient>,
|
extends AppSectionState<DownloadClient>,
|
||||||
|
|
@ -24,7 +29,15 @@ export interface DownloadClientAppState
|
||||||
isTestingAll: boolean;
|
isTestingAll: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type GeneralAppState = AppSectionItemState<General>;
|
export interface GeneralAppState
|
||||||
|
extends AppSectionItemState<General>,
|
||||||
|
AppSectionSaveState {}
|
||||||
|
|
||||||
|
export interface NamingAppState
|
||||||
|
extends AppSectionItemState<NamingConfig>,
|
||||||
|
AppSectionSaveState {}
|
||||||
|
|
||||||
|
export type NamingExamplesAppState = AppSectionItemState<NamingExample>;
|
||||||
|
|
||||||
export interface ImportListAppState
|
export interface ImportListAppState
|
||||||
extends AppSectionState<ImportList>,
|
extends AppSectionState<ImportList>,
|
||||||
|
|
@ -46,6 +59,17 @@ export interface QualityProfilesAppState
|
||||||
extends AppSectionState<QualityProfile>,
|
extends AppSectionState<QualityProfile>,
|
||||||
AppSectionItemSchemaState<QualityProfile> {}
|
AppSectionItemSchemaState<QualityProfile> {}
|
||||||
|
|
||||||
|
export interface ReleaseProfilesAppState
|
||||||
|
extends AppSectionState<ReleaseProfile>,
|
||||||
|
AppSectionSaveState {
|
||||||
|
pendingChanges: Partial<ReleaseProfile>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CustomFormatAppState
|
||||||
|
extends AppSectionState<CustomFormat>,
|
||||||
|
AppSectionDeleteState,
|
||||||
|
AppSectionSaveState {}
|
||||||
|
|
||||||
export interface ImportListOptionsSettingsAppState
|
export interface ImportListOptionsSettingsAppState
|
||||||
extends AppSectionItemState<ImportListOptionsSettings>,
|
extends AppSectionItemState<ImportListOptionsSettings>,
|
||||||
AppSectionSaveState {}
|
AppSectionSaveState {}
|
||||||
|
|
@ -64,6 +88,7 @@ export type UiSettingsAppState = AppSectionItemState<UiSettings>;
|
||||||
|
|
||||||
interface SettingsAppState {
|
interface SettingsAppState {
|
||||||
advancedSettings: boolean;
|
advancedSettings: boolean;
|
||||||
|
customFormats: CustomFormatAppState;
|
||||||
downloadClients: DownloadClientAppState;
|
downloadClients: DownloadClientAppState;
|
||||||
general: GeneralAppState;
|
general: GeneralAppState;
|
||||||
importListExclusions: ImportListExclusionsSettingsAppState;
|
importListExclusions: ImportListExclusionsSettingsAppState;
|
||||||
|
|
@ -72,8 +97,12 @@ interface SettingsAppState {
|
||||||
indexerFlags: IndexerFlagSettingsAppState;
|
indexerFlags: IndexerFlagSettingsAppState;
|
||||||
indexers: IndexerAppState;
|
indexers: IndexerAppState;
|
||||||
languages: LanguageSettingsAppState;
|
languages: LanguageSettingsAppState;
|
||||||
|
metadata: MetadataAppState;
|
||||||
|
naming: NamingAppState;
|
||||||
|
namingExamples: NamingExamplesAppState;
|
||||||
notifications: NotificationAppState;
|
notifications: NotificationAppState;
|
||||||
qualityProfiles: QualityProfilesAppState;
|
qualityProfiles: QualityProfilesAppState;
|
||||||
|
releaseProfiles: ReleaseProfilesAppState;
|
||||||
ui: UiSettingsAppState;
|
ui: UiSettingsAppState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
13
frontend/src/App/State/WantedAppState.ts
Normal file
13
frontend/src/App/State/WantedAppState.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
import AppSectionState from 'App/State/AppSectionState';
|
||||||
|
import Episode from 'Episode/Episode';
|
||||||
|
|
||||||
|
type WantedCutoffUnmetAppState = AppSectionState<Episode>;
|
||||||
|
|
||||||
|
type WantedMissingAppState = AppSectionState<Episode>;
|
||||||
|
|
||||||
|
interface WantedAppState {
|
||||||
|
cutoffUnmet: WantedCutoffUnmetAppState;
|
||||||
|
missing: WantedMissingAppState;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default WantedAppState;
|
||||||
|
|
@ -1,38 +0,0 @@
|
||||||
import moment from 'moment';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import React from 'react';
|
|
||||||
import AgendaEventConnector from './AgendaEventConnector';
|
|
||||||
import styles from './Agenda.css';
|
|
||||||
|
|
||||||
function Agenda(props) {
|
|
||||||
const {
|
|
||||||
items
|
|
||||||
} = props;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className={styles.agenda}>
|
|
||||||
{
|
|
||||||
items.map((item, index) => {
|
|
||||||
const momentDate = moment(item.airDateUtc);
|
|
||||||
const showDate = index === 0 ||
|
|
||||||
!moment(items[index - 1].airDateUtc).isSame(momentDate, 'day');
|
|
||||||
|
|
||||||
return (
|
|
||||||
<AgendaEventConnector
|
|
||||||
key={item.id}
|
|
||||||
episodeId={item.id}
|
|
||||||
showDate={showDate}
|
|
||||||
{...item}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Agenda.propTypes = {
|
|
||||||
items: PropTypes.arrayOf(PropTypes.object).isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Agenda;
|
|
||||||
25
frontend/src/Calendar/Agenda/Agenda.tsx
Normal file
25
frontend/src/Calendar/Agenda/Agenda.tsx
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
import moment from 'moment';
|
||||||
|
import React from 'react';
|
||||||
|
import { useSelector } from 'react-redux';
|
||||||
|
import AppState from 'App/State/AppState';
|
||||||
|
import AgendaEvent from './AgendaEvent';
|
||||||
|
import styles from './Agenda.css';
|
||||||
|
|
||||||
|
function Agenda() {
|
||||||
|
const { items } = useSelector((state: AppState) => state.calendar);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={styles.agenda}>
|
||||||
|
{items.map((item, index) => {
|
||||||
|
const momentDate = moment(item.airDateUtc);
|
||||||
|
const showDate =
|
||||||
|
index === 0 ||
|
||||||
|
!moment(items[index - 1].airDateUtc).isSame(momentDate, 'day');
|
||||||
|
|
||||||
|
return <AgendaEvent key={item.id} showDate={showDate} {...item} />;
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Agenda;
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
import { connect } from 'react-redux';
|
|
||||||
import { createSelector } from 'reselect';
|
|
||||||
import Agenda from './Agenda';
|
|
||||||
|
|
||||||
function createMapStateToProps() {
|
|
||||||
return createSelector(
|
|
||||||
(state) => state.calendar,
|
|
||||||
(calendar) => {
|
|
||||||
return calendar;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default connect(createMapStateToProps)(Agenda);
|
|
||||||
|
|
@ -1,254 +0,0 @@
|
||||||
import classNames from 'classnames';
|
|
||||||
import moment from 'moment';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import CalendarEventQueueDetails from 'Calendar/Events/CalendarEventQueueDetails';
|
|
||||||
import getStatusStyle from 'Calendar/getStatusStyle';
|
|
||||||
import Icon from 'Components/Icon';
|
|
||||||
import Link from 'Components/Link/Link';
|
|
||||||
import EpisodeDetailsModal from 'Episode/EpisodeDetailsModal';
|
|
||||||
import episodeEntities from 'Episode/episodeEntities';
|
|
||||||
import getFinaleTypeName from 'Episode/getFinaleTypeName';
|
|
||||||
import { icons, kinds } from 'Helpers/Props';
|
|
||||||
import formatTime from 'Utilities/Date/formatTime';
|
|
||||||
import padNumber from 'Utilities/Number/padNumber';
|
|
||||||
import translate from 'Utilities/String/translate';
|
|
||||||
import styles from './AgendaEvent.css';
|
|
||||||
|
|
||||||
class AgendaEvent extends Component {
|
|
||||||
//
|
|
||||||
// Lifecycle
|
|
||||||
|
|
||||||
constructor(props, context) {
|
|
||||||
super(props, context);
|
|
||||||
|
|
||||||
this.state = {
|
|
||||||
isDetailsModalOpen: false
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Listeners
|
|
||||||
|
|
||||||
onPress = () => {
|
|
||||||
this.setState({ isDetailsModalOpen: true });
|
|
||||||
};
|
|
||||||
|
|
||||||
onDetailsModalClose = () => {
|
|
||||||
this.setState({ isDetailsModalOpen: false });
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const {
|
|
||||||
id,
|
|
||||||
series,
|
|
||||||
episodeFile,
|
|
||||||
title,
|
|
||||||
seasonNumber,
|
|
||||||
episodeNumber,
|
|
||||||
absoluteEpisodeNumber,
|
|
||||||
airDateUtc,
|
|
||||||
monitored,
|
|
||||||
unverifiedSceneNumbering,
|
|
||||||
finaleType,
|
|
||||||
hasFile,
|
|
||||||
grabbed,
|
|
||||||
queueItem,
|
|
||||||
showDate,
|
|
||||||
showEpisodeInformation,
|
|
||||||
showFinaleIcon,
|
|
||||||
showSpecialIcon,
|
|
||||||
showCutoffUnmetIcon,
|
|
||||||
timeFormat,
|
|
||||||
longDateFormat,
|
|
||||||
colorImpairedMode
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
const startTime = moment(airDateUtc);
|
|
||||||
const endTime = moment(airDateUtc).add(series.runtime, 'minutes');
|
|
||||||
const downloading = !!(queueItem || grabbed);
|
|
||||||
const isMonitored = series.monitored && monitored;
|
|
||||||
const statusStyle = getStatusStyle(hasFile, downloading, startTime, endTime, isMonitored);
|
|
||||||
const missingAbsoluteNumber = series.seriesType === 'anime' && seasonNumber > 0 && !absoluteEpisodeNumber;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className={styles.event}>
|
|
||||||
<Link
|
|
||||||
className={styles.underlay}
|
|
||||||
onPress={this.onPress}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<div className={styles.overlay}>
|
|
||||||
<div className={styles.date}>
|
|
||||||
{
|
|
||||||
showDate &&
|
|
||||||
startTime.format(longDateFormat)
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div
|
|
||||||
className={classNames(
|
|
||||||
styles.eventWrapper,
|
|
||||||
styles[statusStyle],
|
|
||||||
colorImpairedMode && 'colorImpaired'
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
<div className={styles.time}>
|
|
||||||
{formatTime(airDateUtc, timeFormat)} - {formatTime(endTime.toISOString(), timeFormat, { includeMinuteZero: true })}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className={styles.seriesTitle}>
|
|
||||||
{series.title}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{
|
|
||||||
showEpisodeInformation &&
|
|
||||||
<div className={styles.seasonEpisodeNumber}>
|
|
||||||
{seasonNumber}x{padNumber(episodeNumber, 2)}
|
|
||||||
|
|
||||||
{
|
|
||||||
series.seriesType === 'anime' && absoluteEpisodeNumber &&
|
|
||||||
<span className={styles.absoluteEpisodeNumber}>({absoluteEpisodeNumber})</span>
|
|
||||||
}
|
|
||||||
|
|
||||||
<div className={styles.episodeSeparator}> - </div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
<div className={styles.episodeTitle}>
|
|
||||||
{
|
|
||||||
showEpisodeInformation &&
|
|
||||||
title
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{
|
|
||||||
missingAbsoluteNumber &&
|
|
||||||
<Icon
|
|
||||||
className={styles.statusIcon}
|
|
||||||
name={icons.WARNING}
|
|
||||||
title={translate('EpisodeMissingAbsoluteNumber')}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
unverifiedSceneNumbering && !missingAbsoluteNumber ?
|
|
||||||
<Icon
|
|
||||||
className={styles.statusIcon}
|
|
||||||
name={icons.WARNING}
|
|
||||||
title={translate('SceneNumberNotVerified')}
|
|
||||||
/> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
!!queueItem &&
|
|
||||||
<span className={styles.statusIcon}>
|
|
||||||
<CalendarEventQueueDetails
|
|
||||||
seriesType={series.seriesType}
|
|
||||||
seasonNumber={seasonNumber}
|
|
||||||
absoluteEpisodeNumber={absoluteEpisodeNumber}
|
|
||||||
{...queueItem}
|
|
||||||
/>
|
|
||||||
</span>
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
!queueItem && grabbed &&
|
|
||||||
<Icon
|
|
||||||
className={styles.statusIcon}
|
|
||||||
name={icons.DOWNLOADING}
|
|
||||||
title={translate('EpisodeIsDownloading')}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
showCutoffUnmetIcon &&
|
|
||||||
!!episodeFile &&
|
|
||||||
episodeFile.qualityCutoffNotMet &&
|
|
||||||
<Icon
|
|
||||||
className={styles.statusIcon}
|
|
||||||
name={icons.EPISODE_FILE}
|
|
||||||
kind={kinds.WARNING}
|
|
||||||
title={translate('QualityCutoffNotMet')}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
episodeNumber === 1 && seasonNumber > 0 &&
|
|
||||||
<Icon
|
|
||||||
className={styles.statusIcon}
|
|
||||||
name={icons.INFO}
|
|
||||||
kind={kinds.INFO}
|
|
||||||
title={seasonNumber === 1 ? translate('SeriesPremiere') : translate('SeasonPremiere')}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
showFinaleIcon &&
|
|
||||||
finaleType ?
|
|
||||||
<Icon
|
|
||||||
className={styles.statusIcon}
|
|
||||||
name={icons.INFO}
|
|
||||||
kind={kinds.WARNING}
|
|
||||||
title={getFinaleTypeName(finaleType)}
|
|
||||||
/> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
showSpecialIcon &&
|
|
||||||
(episodeNumber === 0 || seasonNumber === 0) &&
|
|
||||||
<Icon
|
|
||||||
className={styles.statusIcon}
|
|
||||||
name={icons.INFO}
|
|
||||||
kind={kinds.PINK}
|
|
||||||
title={translate('Special')}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<EpisodeDetailsModal
|
|
||||||
isOpen={this.state.isDetailsModalOpen}
|
|
||||||
episodeId={id}
|
|
||||||
episodeEntity={episodeEntities.CALENDAR}
|
|
||||||
seriesId={series.id}
|
|
||||||
episodeTitle={title}
|
|
||||||
showOpenSeriesButton={true}
|
|
||||||
onModalClose={this.onDetailsModalClose}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
AgendaEvent.propTypes = {
|
|
||||||
id: PropTypes.number.isRequired,
|
|
||||||
series: PropTypes.object.isRequired,
|
|
||||||
episodeFile: PropTypes.object,
|
|
||||||
title: PropTypes.string.isRequired,
|
|
||||||
seasonNumber: PropTypes.number.isRequired,
|
|
||||||
episodeNumber: PropTypes.number.isRequired,
|
|
||||||
absoluteEpisodeNumber: PropTypes.number,
|
|
||||||
airDateUtc: PropTypes.string.isRequired,
|
|
||||||
monitored: PropTypes.bool.isRequired,
|
|
||||||
unverifiedSceneNumbering: PropTypes.bool,
|
|
||||||
finaleType: PropTypes.string,
|
|
||||||
hasFile: PropTypes.bool.isRequired,
|
|
||||||
grabbed: PropTypes.bool,
|
|
||||||
queueItem: PropTypes.object,
|
|
||||||
showDate: PropTypes.bool.isRequired,
|
|
||||||
showEpisodeInformation: PropTypes.bool.isRequired,
|
|
||||||
showFinaleIcon: PropTypes.bool.isRequired,
|
|
||||||
showSpecialIcon: PropTypes.bool.isRequired,
|
|
||||||
showCutoffUnmetIcon: PropTypes.bool.isRequired,
|
|
||||||
timeFormat: PropTypes.string.isRequired,
|
|
||||||
longDateFormat: PropTypes.string.isRequired,
|
|
||||||
colorImpairedMode: PropTypes.bool.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default AgendaEvent;
|
|
||||||
227
frontend/src/Calendar/Agenda/AgendaEvent.tsx
Normal file
227
frontend/src/Calendar/Agenda/AgendaEvent.tsx
Normal file
|
|
@ -0,0 +1,227 @@
|
||||||
|
import classNames from 'classnames';
|
||||||
|
import moment from 'moment';
|
||||||
|
import React, { useCallback, useState } from 'react';
|
||||||
|
import { useSelector } from 'react-redux';
|
||||||
|
import AppState from 'App/State/AppState';
|
||||||
|
import CalendarEventQueueDetails from 'Calendar/Events/CalendarEventQueueDetails';
|
||||||
|
import getStatusStyle from 'Calendar/getStatusStyle';
|
||||||
|
import Icon from 'Components/Icon';
|
||||||
|
import Link from 'Components/Link/Link';
|
||||||
|
import EpisodeDetailsModal from 'Episode/EpisodeDetailsModal';
|
||||||
|
import episodeEntities from 'Episode/episodeEntities';
|
||||||
|
import getFinaleTypeName from 'Episode/getFinaleTypeName';
|
||||||
|
import useEpisodeFile from 'EpisodeFile/useEpisodeFile';
|
||||||
|
import { icons, kinds } from 'Helpers/Props';
|
||||||
|
import useSeries from 'Series/useSeries';
|
||||||
|
import { createQueueItemSelectorForHook } from 'Store/Selectors/createQueueItemSelector';
|
||||||
|
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
||||||
|
import formatTime from 'Utilities/Date/formatTime';
|
||||||
|
import padNumber from 'Utilities/Number/padNumber';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
|
import styles from './AgendaEvent.css';
|
||||||
|
|
||||||
|
interface AgendaEventProps {
|
||||||
|
id: number;
|
||||||
|
seriesId: number;
|
||||||
|
episodeFileId: number;
|
||||||
|
title: string;
|
||||||
|
seasonNumber: number;
|
||||||
|
episodeNumber: number;
|
||||||
|
absoluteEpisodeNumber?: number;
|
||||||
|
airDateUtc: string;
|
||||||
|
monitored: boolean;
|
||||||
|
unverifiedSceneNumbering?: boolean;
|
||||||
|
finaleType?: string;
|
||||||
|
hasFile: boolean;
|
||||||
|
grabbed?: boolean;
|
||||||
|
showDate: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
function AgendaEvent(props: AgendaEventProps) {
|
||||||
|
const {
|
||||||
|
id,
|
||||||
|
seriesId,
|
||||||
|
episodeFileId,
|
||||||
|
title,
|
||||||
|
seasonNumber,
|
||||||
|
episodeNumber,
|
||||||
|
absoluteEpisodeNumber,
|
||||||
|
airDateUtc,
|
||||||
|
monitored,
|
||||||
|
unverifiedSceneNumbering,
|
||||||
|
finaleType,
|
||||||
|
hasFile,
|
||||||
|
grabbed,
|
||||||
|
showDate,
|
||||||
|
} = props;
|
||||||
|
|
||||||
|
const series = useSeries(seriesId)!;
|
||||||
|
const episodeFile = useEpisodeFile(episodeFileId);
|
||||||
|
const queueItem = useSelector(createQueueItemSelectorForHook(id));
|
||||||
|
const { timeFormat, longDateFormat, enableColorImpairedMode } = useSelector(
|
||||||
|
createUISettingsSelector()
|
||||||
|
);
|
||||||
|
|
||||||
|
const {
|
||||||
|
showEpisodeInformation,
|
||||||
|
showFinaleIcon,
|
||||||
|
showSpecialIcon,
|
||||||
|
showCutoffUnmetIcon,
|
||||||
|
} = useSelector((state: AppState) => state.calendar.options);
|
||||||
|
|
||||||
|
const [isDetailsModalOpen, setIsDetailsModalOpen] = useState(false);
|
||||||
|
|
||||||
|
const startTime = moment(airDateUtc);
|
||||||
|
const endTime = moment(airDateUtc).add(series.runtime, 'minutes');
|
||||||
|
const downloading = !!(queueItem || grabbed);
|
||||||
|
const isMonitored = series.monitored && monitored;
|
||||||
|
const statusStyle = getStatusStyle(
|
||||||
|
hasFile,
|
||||||
|
downloading,
|
||||||
|
startTime,
|
||||||
|
endTime,
|
||||||
|
isMonitored
|
||||||
|
);
|
||||||
|
const missingAbsoluteNumber =
|
||||||
|
series.seriesType === 'anime' && seasonNumber > 0 && !absoluteEpisodeNumber;
|
||||||
|
|
||||||
|
const handlePress = useCallback(() => {
|
||||||
|
setIsDetailsModalOpen(true);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleDetailsModalClose = useCallback(() => {
|
||||||
|
setIsDetailsModalOpen(false);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={styles.event}>
|
||||||
|
<Link className={styles.underlay} onPress={handlePress} />
|
||||||
|
|
||||||
|
<div className={styles.overlay}>
|
||||||
|
<div className={styles.date}>
|
||||||
|
{showDate && startTime.format(longDateFormat)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
className={classNames(
|
||||||
|
styles.eventWrapper,
|
||||||
|
styles[statusStyle],
|
||||||
|
enableColorImpairedMode && 'colorImpaired'
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<div className={styles.time}>
|
||||||
|
{formatTime(airDateUtc, timeFormat)} -{' '}
|
||||||
|
{formatTime(endTime.toISOString(), timeFormat, {
|
||||||
|
includeMinuteZero: true,
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className={styles.seriesTitle}>{series.title}</div>
|
||||||
|
|
||||||
|
{showEpisodeInformation ? (
|
||||||
|
<div className={styles.seasonEpisodeNumber}>
|
||||||
|
{seasonNumber}x{padNumber(episodeNumber, 2)}
|
||||||
|
{series.seriesType === 'anime' && absoluteEpisodeNumber && (
|
||||||
|
<span className={styles.absoluteEpisodeNumber}>
|
||||||
|
({absoluteEpisodeNumber})
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
<div className={styles.episodeSeparator}> - </div>
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
<div className={styles.episodeTitle}>
|
||||||
|
{showEpisodeInformation ? title : null}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{missingAbsoluteNumber ? (
|
||||||
|
<Icon
|
||||||
|
className={styles.statusIcon}
|
||||||
|
name={icons.WARNING}
|
||||||
|
title={translate('EpisodeMissingAbsoluteNumber')}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{unverifiedSceneNumbering && !missingAbsoluteNumber ? (
|
||||||
|
<Icon
|
||||||
|
className={styles.statusIcon}
|
||||||
|
name={icons.WARNING}
|
||||||
|
title={translate('SceneNumberNotVerified')}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{queueItem ? (
|
||||||
|
<span className={styles.statusIcon}>
|
||||||
|
<CalendarEventQueueDetails
|
||||||
|
seasonNumber={seasonNumber}
|
||||||
|
{...queueItem}
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{!queueItem && grabbed ? (
|
||||||
|
<Icon
|
||||||
|
className={styles.statusIcon}
|
||||||
|
name={icons.DOWNLOADING}
|
||||||
|
title={translate('EpisodeIsDownloading')}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{showCutoffUnmetIcon &&
|
||||||
|
episodeFile &&
|
||||||
|
episodeFile.qualityCutoffNotMet ? (
|
||||||
|
<Icon
|
||||||
|
className={styles.statusIcon}
|
||||||
|
name={icons.EPISODE_FILE}
|
||||||
|
kind={kinds.WARNING}
|
||||||
|
title={translate('QualityCutoffNotMet')}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{episodeNumber === 1 && seasonNumber > 0 && (
|
||||||
|
<Icon
|
||||||
|
className={styles.statusIcon}
|
||||||
|
name={icons.INFO}
|
||||||
|
kind={kinds.INFO}
|
||||||
|
title={
|
||||||
|
seasonNumber === 1
|
||||||
|
? translate('SeriesPremiere')
|
||||||
|
: translate('SeasonPremiere')
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{showFinaleIcon && finaleType ? (
|
||||||
|
<Icon
|
||||||
|
className={styles.statusIcon}
|
||||||
|
name={icons.INFO}
|
||||||
|
kind={kinds.WARNING}
|
||||||
|
title={getFinaleTypeName(finaleType)}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{showSpecialIcon && (episodeNumber === 0 || seasonNumber === 0) ? (
|
||||||
|
<Icon
|
||||||
|
className={styles.statusIcon}
|
||||||
|
name={icons.INFO}
|
||||||
|
kind={kinds.PINK}
|
||||||
|
title={translate('Special')}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<EpisodeDetailsModal
|
||||||
|
isOpen={isDetailsModalOpen}
|
||||||
|
episodeId={id}
|
||||||
|
episodeEntity={episodeEntities.CALENDAR}
|
||||||
|
seriesId={series.id}
|
||||||
|
episodeTitle={title}
|
||||||
|
showOpenSeriesButton={true}
|
||||||
|
onModalClose={handleDetailsModalClose}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default AgendaEvent;
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
import { connect } from 'react-redux';
|
|
||||||
import { createSelector } from 'reselect';
|
|
||||||
import createEpisodeFileSelector from 'Store/Selectors/createEpisodeFileSelector';
|
|
||||||
import createQueueItemSelector from 'Store/Selectors/createQueueItemSelector';
|
|
||||||
import createSeriesSelector from 'Store/Selectors/createSeriesSelector';
|
|
||||||
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
|
||||||
import AgendaEvent from './AgendaEvent';
|
|
||||||
|
|
||||||
function createMapStateToProps() {
|
|
||||||
return createSelector(
|
|
||||||
(state) => state.calendar.options,
|
|
||||||
createSeriesSelector(),
|
|
||||||
createEpisodeFileSelector(),
|
|
||||||
createQueueItemSelector(),
|
|
||||||
createUISettingsSelector(),
|
|
||||||
(calendarOptions, series, episodeFile, queueItem, uiSettings) => {
|
|
||||||
return {
|
|
||||||
series,
|
|
||||||
episodeFile,
|
|
||||||
queueItem,
|
|
||||||
...calendarOptions,
|
|
||||||
timeFormat: uiSettings.timeFormat,
|
|
||||||
longDateFormat: uiSettings.longDateFormat,
|
|
||||||
colorImpairedMode: uiSettings.enableColorImpairedMode
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default connect(createMapStateToProps)(AgendaEvent);
|
|
||||||
|
|
@ -1,67 +0,0 @@
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import Alert from 'Components/Alert';
|
|
||||||
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
|
||||||
import { kinds } from 'Helpers/Props';
|
|
||||||
import translate from 'Utilities/String/translate';
|
|
||||||
import AgendaConnector from './Agenda/AgendaConnector';
|
|
||||||
import * as calendarViews from './calendarViews';
|
|
||||||
import CalendarDaysConnector from './Day/CalendarDaysConnector';
|
|
||||||
import DaysOfWeekConnector from './Day/DaysOfWeekConnector';
|
|
||||||
import CalendarHeaderConnector from './Header/CalendarHeaderConnector';
|
|
||||||
import styles from './Calendar.css';
|
|
||||||
|
|
||||||
class Calendar extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const {
|
|
||||||
isFetching,
|
|
||||||
isPopulated,
|
|
||||||
error,
|
|
||||||
view
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className={styles.calendar}>
|
|
||||||
{
|
|
||||||
isFetching && !isPopulated &&
|
|
||||||
<LoadingIndicator />
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
!isFetching && !!error &&
|
|
||||||
<Alert kind={kinds.DANGER}>{translate('CalendarLoadError')}</Alert>
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
!error && isPopulated && view === calendarViews.AGENDA &&
|
|
||||||
<div className={styles.calendarContent}>
|
|
||||||
<CalendarHeaderConnector />
|
|
||||||
<AgendaConnector />
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
!error && isPopulated && view !== calendarViews.AGENDA &&
|
|
||||||
<div className={styles.calendarContent}>
|
|
||||||
<CalendarHeaderConnector />
|
|
||||||
<DaysOfWeekConnector />
|
|
||||||
<CalendarDaysConnector />
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Calendar.propTypes = {
|
|
||||||
isFetching: PropTypes.bool.isRequired,
|
|
||||||
isPopulated: PropTypes.bool.isRequired,
|
|
||||||
error: PropTypes.object,
|
|
||||||
view: PropTypes.string.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Calendar;
|
|
||||||
170
frontend/src/Calendar/Calendar.tsx
Normal file
170
frontend/src/Calendar/Calendar.tsx
Normal file
|
|
@ -0,0 +1,170 @@
|
||||||
|
import React, { useCallback, useEffect, useRef } from 'react';
|
||||||
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
|
import AppState from 'App/State/AppState';
|
||||||
|
import * as commandNames from 'Commands/commandNames';
|
||||||
|
import Alert from 'Components/Alert';
|
||||||
|
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||||
|
import Episode from 'Episode/Episode';
|
||||||
|
import useCurrentPage from 'Helpers/Hooks/useCurrentPage';
|
||||||
|
import usePrevious from 'Helpers/Hooks/usePrevious';
|
||||||
|
import { kinds } from 'Helpers/Props';
|
||||||
|
import {
|
||||||
|
clearCalendar,
|
||||||
|
fetchCalendar,
|
||||||
|
gotoCalendarToday,
|
||||||
|
} from 'Store/Actions/calendarActions';
|
||||||
|
import {
|
||||||
|
clearEpisodeFiles,
|
||||||
|
fetchEpisodeFiles,
|
||||||
|
} from 'Store/Actions/episodeFileActions';
|
||||||
|
import {
|
||||||
|
clearQueueDetails,
|
||||||
|
fetchQueueDetails,
|
||||||
|
} from 'Store/Actions/queueActions';
|
||||||
|
import createCommandExecutingSelector from 'Store/Selectors/createCommandExecutingSelector';
|
||||||
|
import hasDifferentItems from 'Utilities/Object/hasDifferentItems';
|
||||||
|
import selectUniqueIds from 'Utilities/Object/selectUniqueIds';
|
||||||
|
import {
|
||||||
|
registerPagePopulator,
|
||||||
|
unregisterPagePopulator,
|
||||||
|
} from 'Utilities/pagePopulator';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
|
import Agenda from './Agenda/Agenda';
|
||||||
|
import CalendarDays from './Day/CalendarDays';
|
||||||
|
import DaysOfWeek from './Day/DaysOfWeek';
|
||||||
|
import CalendarHeader from './Header/CalendarHeader';
|
||||||
|
import styles from './Calendar.css';
|
||||||
|
|
||||||
|
const UPDATE_DELAY = 3600000; // 1 hour
|
||||||
|
|
||||||
|
function Calendar() {
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
const requestCurrentPage = useCurrentPage();
|
||||||
|
const updateTimeout = useRef<ReturnType<typeof setTimeout>>();
|
||||||
|
|
||||||
|
const { isFetching, isPopulated, error, items, time, view } = useSelector(
|
||||||
|
(state: AppState) => state.calendar
|
||||||
|
);
|
||||||
|
|
||||||
|
const isRefreshingSeries = useSelector(
|
||||||
|
createCommandExecutingSelector(commandNames.REFRESH_SERIES)
|
||||||
|
);
|
||||||
|
|
||||||
|
const firstDayOfWeek = useSelector(
|
||||||
|
(state: AppState) => state.settings.ui.item.firstDayOfWeek
|
||||||
|
);
|
||||||
|
|
||||||
|
const wasRefreshingSeries = usePrevious(isRefreshingSeries);
|
||||||
|
const previousFirstDayOfWeek = usePrevious(firstDayOfWeek);
|
||||||
|
const previousItems = usePrevious(items);
|
||||||
|
|
||||||
|
const handleScheduleUpdate = useCallback(() => {
|
||||||
|
clearTimeout(updateTimeout.current);
|
||||||
|
|
||||||
|
function updateCalendar() {
|
||||||
|
dispatch(gotoCalendarToday());
|
||||||
|
updateTimeout.current = setTimeout(updateCalendar, UPDATE_DELAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateTimeout.current = setTimeout(updateCalendar, UPDATE_DELAY);
|
||||||
|
}, [dispatch]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
handleScheduleUpdate();
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
dispatch(clearCalendar());
|
||||||
|
dispatch(clearQueueDetails());
|
||||||
|
dispatch(clearEpisodeFiles());
|
||||||
|
clearTimeout(updateTimeout.current);
|
||||||
|
};
|
||||||
|
}, [dispatch, handleScheduleUpdate]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (requestCurrentPage) {
|
||||||
|
dispatch(fetchCalendar());
|
||||||
|
} else {
|
||||||
|
dispatch(gotoCalendarToday());
|
||||||
|
}
|
||||||
|
}, [requestCurrentPage, dispatch]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const repopulate = () => {
|
||||||
|
dispatch(fetchQueueDetails({ time, view }));
|
||||||
|
dispatch(fetchCalendar({ time, view }));
|
||||||
|
};
|
||||||
|
|
||||||
|
registerPagePopulator(repopulate, [
|
||||||
|
'episodeFileUpdated',
|
||||||
|
'episodeFileDeleted',
|
||||||
|
]);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
unregisterPagePopulator(repopulate);
|
||||||
|
};
|
||||||
|
}, [time, view, dispatch]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
handleScheduleUpdate();
|
||||||
|
}, [time, handleScheduleUpdate]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (
|
||||||
|
previousFirstDayOfWeek != null &&
|
||||||
|
firstDayOfWeek !== previousFirstDayOfWeek
|
||||||
|
) {
|
||||||
|
dispatch(fetchCalendar({ time, view }));
|
||||||
|
}
|
||||||
|
}, [time, view, firstDayOfWeek, previousFirstDayOfWeek, dispatch]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (wasRefreshingSeries && !isRefreshingSeries) {
|
||||||
|
dispatch(fetchCalendar({ time, view }));
|
||||||
|
}
|
||||||
|
}, [time, view, isRefreshingSeries, wasRefreshingSeries, dispatch]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!previousItems || hasDifferentItems(items, previousItems)) {
|
||||||
|
const episodeIds = selectUniqueIds<Episode, number>(items, 'id');
|
||||||
|
const episodeFileIds = selectUniqueIds<Episode, number>(
|
||||||
|
items,
|
||||||
|
'episodeFileId'
|
||||||
|
);
|
||||||
|
|
||||||
|
if (items.length) {
|
||||||
|
dispatch(fetchQueueDetails({ episodeIds }));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (episodeFileIds.length) {
|
||||||
|
dispatch(fetchEpisodeFiles({ episodeFileIds }));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [items, previousItems, dispatch]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={styles.calendar}>
|
||||||
|
{isFetching && !isPopulated ? <LoadingIndicator /> : null}
|
||||||
|
|
||||||
|
{!isFetching && error ? (
|
||||||
|
<Alert kind={kinds.DANGER}>{translate('CalendarLoadError')}</Alert>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{!error && isPopulated && view === 'agenda' ? (
|
||||||
|
<div className={styles.calendarContent}>
|
||||||
|
<CalendarHeader />
|
||||||
|
<Agenda />
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{!error && isPopulated && view !== 'agenda' ? (
|
||||||
|
<div className={styles.calendarContent}>
|
||||||
|
<CalendarHeader />
|
||||||
|
<DaysOfWeek />
|
||||||
|
<CalendarDays />
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Calendar;
|
||||||
|
|
@ -1,196 +0,0 @@
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import { connect } from 'react-redux';
|
|
||||||
import { createSelector } from 'reselect';
|
|
||||||
import * as commandNames from 'Commands/commandNames';
|
|
||||||
import * as calendarActions from 'Store/Actions/calendarActions';
|
|
||||||
import { clearEpisodeFiles, fetchEpisodeFiles } from 'Store/Actions/episodeFileActions';
|
|
||||||
import { clearQueueDetails, fetchQueueDetails } from 'Store/Actions/queueActions';
|
|
||||||
import createCommandExecutingSelector from 'Store/Selectors/createCommandExecutingSelector';
|
|
||||||
import hasDifferentItems from 'Utilities/Object/hasDifferentItems';
|
|
||||||
import selectUniqueIds from 'Utilities/Object/selectUniqueIds';
|
|
||||||
import { registerPagePopulator, unregisterPagePopulator } from 'Utilities/pagePopulator';
|
|
||||||
import Calendar from './Calendar';
|
|
||||||
|
|
||||||
const UPDATE_DELAY = 3600000; // 1 hour
|
|
||||||
|
|
||||||
function createMapStateToProps() {
|
|
||||||
return createSelector(
|
|
||||||
(state) => state.calendar,
|
|
||||||
(state) => state.settings.ui.item.firstDayOfWeek,
|
|
||||||
createCommandExecutingSelector(commandNames.REFRESH_SERIES),
|
|
||||||
(calendar, firstDayOfWeek, isRefreshingSeries) => {
|
|
||||||
return {
|
|
||||||
...calendar,
|
|
||||||
isRefreshingSeries,
|
|
||||||
firstDayOfWeek
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const mapDispatchToProps = {
|
|
||||||
...calendarActions,
|
|
||||||
fetchEpisodeFiles,
|
|
||||||
clearEpisodeFiles,
|
|
||||||
fetchQueueDetails,
|
|
||||||
clearQueueDetails
|
|
||||||
};
|
|
||||||
|
|
||||||
class CalendarConnector extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Lifecycle
|
|
||||||
|
|
||||||
constructor(props, context) {
|
|
||||||
super(props, context);
|
|
||||||
|
|
||||||
this.updateTimeoutId = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidMount() {
|
|
||||||
const {
|
|
||||||
useCurrentPage,
|
|
||||||
fetchCalendar,
|
|
||||||
gotoCalendarToday
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
registerPagePopulator(this.repopulate, ['episodeFileUpdated', 'episodeFileDeleted']);
|
|
||||||
|
|
||||||
if (useCurrentPage) {
|
|
||||||
fetchCalendar();
|
|
||||||
} else {
|
|
||||||
gotoCalendarToday();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.scheduleUpdate();
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidUpdate(prevProps) {
|
|
||||||
const {
|
|
||||||
items,
|
|
||||||
time,
|
|
||||||
view,
|
|
||||||
isRefreshingSeries,
|
|
||||||
firstDayOfWeek
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
if (hasDifferentItems(prevProps.items, items)) {
|
|
||||||
const episodeIds = selectUniqueIds(items, 'id');
|
|
||||||
const episodeFileIds = selectUniqueIds(items, 'episodeFileId');
|
|
||||||
|
|
||||||
if (items.length) {
|
|
||||||
this.props.fetchQueueDetails({ episodeIds });
|
|
||||||
}
|
|
||||||
|
|
||||||
if (episodeFileIds.length) {
|
|
||||||
this.props.fetchEpisodeFiles({ episodeFileIds });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (prevProps.time !== time) {
|
|
||||||
this.scheduleUpdate();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (prevProps.firstDayOfWeek !== firstDayOfWeek) {
|
|
||||||
this.props.fetchCalendar({ time, view });
|
|
||||||
}
|
|
||||||
|
|
||||||
if (prevProps.isRefreshingSeries && !isRefreshingSeries) {
|
|
||||||
this.props.fetchCalendar({ time, view });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillUnmount() {
|
|
||||||
unregisterPagePopulator(this.repopulate);
|
|
||||||
this.props.clearCalendar();
|
|
||||||
this.props.clearQueueDetails();
|
|
||||||
this.props.clearEpisodeFiles();
|
|
||||||
this.clearUpdateTimeout();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Control
|
|
||||||
|
|
||||||
repopulate = () => {
|
|
||||||
const {
|
|
||||||
time,
|
|
||||||
view
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
this.props.fetchQueueDetails({ time, view });
|
|
||||||
this.props.fetchCalendar({ time, view });
|
|
||||||
};
|
|
||||||
|
|
||||||
scheduleUpdate = () => {
|
|
||||||
this.clearUpdateTimeout();
|
|
||||||
|
|
||||||
this.updateTimeoutId = setTimeout(this.updateCalendar, UPDATE_DELAY);
|
|
||||||
};
|
|
||||||
|
|
||||||
clearUpdateTimeout = () => {
|
|
||||||
if (this.updateTimeoutId) {
|
|
||||||
clearTimeout(this.updateTimeoutId);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
updateCalendar = () => {
|
|
||||||
this.props.gotoCalendarToday();
|
|
||||||
this.scheduleUpdate();
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Listeners
|
|
||||||
|
|
||||||
onCalendarViewChange = (view) => {
|
|
||||||
this.props.setCalendarView({ view });
|
|
||||||
};
|
|
||||||
|
|
||||||
onTodayPress = () => {
|
|
||||||
this.props.gotoCalendarToday();
|
|
||||||
};
|
|
||||||
|
|
||||||
onPreviousPress = () => {
|
|
||||||
this.props.gotoCalendarPreviousRange();
|
|
||||||
};
|
|
||||||
|
|
||||||
onNextPress = () => {
|
|
||||||
this.props.gotoCalendarNextRange();
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
return (
|
|
||||||
<Calendar
|
|
||||||
{...this.props}
|
|
||||||
onCalendarViewChange={this.onCalendarViewChange}
|
|
||||||
onTodayPress={this.onTodayPress}
|
|
||||||
onPreviousPress={this.onPreviousPress}
|
|
||||||
onNextPress={this.onNextPress}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CalendarConnector.propTypes = {
|
|
||||||
useCurrentPage: PropTypes.bool.isRequired,
|
|
||||||
time: PropTypes.string,
|
|
||||||
view: PropTypes.string.isRequired,
|
|
||||||
firstDayOfWeek: PropTypes.number.isRequired,
|
|
||||||
items: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
||||||
isRefreshingSeries: PropTypes.bool.isRequired,
|
|
||||||
setCalendarView: PropTypes.func.isRequired,
|
|
||||||
gotoCalendarToday: PropTypes.func.isRequired,
|
|
||||||
gotoCalendarPreviousRange: PropTypes.func.isRequired,
|
|
||||||
gotoCalendarNextRange: PropTypes.func.isRequired,
|
|
||||||
clearCalendar: PropTypes.func.isRequired,
|
|
||||||
fetchCalendar: PropTypes.func.isRequired,
|
|
||||||
fetchEpisodeFiles: PropTypes.func.isRequired,
|
|
||||||
clearEpisodeFiles: PropTypes.func.isRequired,
|
|
||||||
fetchQueueDetails: PropTypes.func.isRequired,
|
|
||||||
clearQueueDetails: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default connect(createMapStateToProps, mapDispatchToProps)(CalendarConnector);
|
|
||||||
|
|
@ -1,197 +0,0 @@
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import Measure from 'Components/Measure';
|
|
||||||
import FilterMenu from 'Components/Menu/FilterMenu';
|
|
||||||
import PageContent from 'Components/Page/PageContent';
|
|
||||||
import PageContentBody from 'Components/Page/PageContentBody';
|
|
||||||
import PageToolbar from 'Components/Page/Toolbar/PageToolbar';
|
|
||||||
import PageToolbarButton from 'Components/Page/Toolbar/PageToolbarButton';
|
|
||||||
import PageToolbarSection from 'Components/Page/Toolbar/PageToolbarSection';
|
|
||||||
import PageToolbarSeparator from 'Components/Page/Toolbar/PageToolbarSeparator';
|
|
||||||
import { align, icons } from 'Helpers/Props';
|
|
||||||
import NoSeries from 'Series/NoSeries';
|
|
||||||
import translate from 'Utilities/String/translate';
|
|
||||||
import CalendarConnector from './CalendarConnector';
|
|
||||||
import CalendarFilterModal from './CalendarFilterModal';
|
|
||||||
import CalendarLinkModal from './iCal/CalendarLinkModal';
|
|
||||||
import LegendConnector from './Legend/LegendConnector';
|
|
||||||
import CalendarOptionsModal from './Options/CalendarOptionsModal';
|
|
||||||
import styles from './CalendarPage.css';
|
|
||||||
|
|
||||||
const MINIMUM_DAY_WIDTH = 120;
|
|
||||||
|
|
||||||
class CalendarPage extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Lifecycle
|
|
||||||
|
|
||||||
constructor(props, context) {
|
|
||||||
super(props, context);
|
|
||||||
|
|
||||||
this.state = {
|
|
||||||
isCalendarLinkModalOpen: false,
|
|
||||||
isOptionsModalOpen: false,
|
|
||||||
width: 0
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Listeners
|
|
||||||
|
|
||||||
onMeasure = ({ width }) => {
|
|
||||||
this.setState({ width });
|
|
||||||
const days = Math.max(3, Math.min(7, Math.floor(width / MINIMUM_DAY_WIDTH)));
|
|
||||||
|
|
||||||
this.props.onDaysCountChange(days);
|
|
||||||
};
|
|
||||||
|
|
||||||
onGetCalendarLinkPress = () => {
|
|
||||||
this.setState({ isCalendarLinkModalOpen: true });
|
|
||||||
};
|
|
||||||
|
|
||||||
onGetCalendarLinkModalClose = () => {
|
|
||||||
this.setState({ isCalendarLinkModalOpen: false });
|
|
||||||
};
|
|
||||||
|
|
||||||
onOptionsPress = () => {
|
|
||||||
this.setState({ isOptionsModalOpen: true });
|
|
||||||
};
|
|
||||||
|
|
||||||
onOptionsModalClose = () => {
|
|
||||||
this.setState({ isOptionsModalOpen: false });
|
|
||||||
};
|
|
||||||
|
|
||||||
onSearchMissingPress = () => {
|
|
||||||
const {
|
|
||||||
missingEpisodeIds,
|
|
||||||
onSearchMissingPress
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
onSearchMissingPress(missingEpisodeIds);
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const {
|
|
||||||
selectedFilterKey,
|
|
||||||
filters,
|
|
||||||
customFilters,
|
|
||||||
hasSeries,
|
|
||||||
missingEpisodeIds,
|
|
||||||
isRssSyncExecuting,
|
|
||||||
isSearchingForMissing,
|
|
||||||
useCurrentPage,
|
|
||||||
onRssSyncPress,
|
|
||||||
onFilterSelect
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
const {
|
|
||||||
isCalendarLinkModalOpen,
|
|
||||||
isOptionsModalOpen
|
|
||||||
} = this.state;
|
|
||||||
|
|
||||||
const isMeasured = this.state.width > 0;
|
|
||||||
const PageComponent = hasSeries ? CalendarConnector : NoSeries;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<PageContent title={translate('Calendar')}>
|
|
||||||
<PageToolbar>
|
|
||||||
<PageToolbarSection>
|
|
||||||
<PageToolbarButton
|
|
||||||
label={translate('ICalLink')}
|
|
||||||
iconName={icons.CALENDAR}
|
|
||||||
onPress={this.onGetCalendarLinkPress}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<PageToolbarSeparator />
|
|
||||||
|
|
||||||
<PageToolbarButton
|
|
||||||
label={translate('RssSync')}
|
|
||||||
iconName={icons.RSS}
|
|
||||||
isSpinning={isRssSyncExecuting}
|
|
||||||
onPress={onRssSyncPress}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<PageToolbarButton
|
|
||||||
label={translate('SearchForMissing')}
|
|
||||||
iconName={icons.SEARCH}
|
|
||||||
isDisabled={!missingEpisodeIds.length}
|
|
||||||
isSpinning={isSearchingForMissing}
|
|
||||||
onPress={this.onSearchMissingPress}
|
|
||||||
/>
|
|
||||||
</PageToolbarSection>
|
|
||||||
|
|
||||||
<PageToolbarSection alignContent={align.RIGHT}>
|
|
||||||
<PageToolbarButton
|
|
||||||
label={translate('Options')}
|
|
||||||
iconName={icons.POSTER}
|
|
||||||
onPress={this.onOptionsPress}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<FilterMenu
|
|
||||||
alignMenu={align.RIGHT}
|
|
||||||
isDisabled={!hasSeries}
|
|
||||||
selectedFilterKey={selectedFilterKey}
|
|
||||||
filters={filters}
|
|
||||||
customFilters={customFilters}
|
|
||||||
filterModalConnectorComponent={CalendarFilterModal}
|
|
||||||
onFilterSelect={onFilterSelect}
|
|
||||||
/>
|
|
||||||
</PageToolbarSection>
|
|
||||||
</PageToolbar>
|
|
||||||
|
|
||||||
<PageContentBody
|
|
||||||
className={styles.calendarPageBody}
|
|
||||||
innerClassName={styles.calendarInnerPageBody}
|
|
||||||
>
|
|
||||||
<Measure
|
|
||||||
whitelist={['width']}
|
|
||||||
onMeasure={this.onMeasure}
|
|
||||||
>
|
|
||||||
{
|
|
||||||
isMeasured ?
|
|
||||||
<PageComponent
|
|
||||||
useCurrentPage={useCurrentPage}
|
|
||||||
/> :
|
|
||||||
<div />
|
|
||||||
}
|
|
||||||
</Measure>
|
|
||||||
|
|
||||||
{
|
|
||||||
hasSeries &&
|
|
||||||
<LegendConnector />
|
|
||||||
}
|
|
||||||
</PageContentBody>
|
|
||||||
|
|
||||||
<CalendarLinkModal
|
|
||||||
isOpen={isCalendarLinkModalOpen}
|
|
||||||
onModalClose={this.onGetCalendarLinkModalClose}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<CalendarOptionsModal
|
|
||||||
isOpen={isOptionsModalOpen}
|
|
||||||
onModalClose={this.onOptionsModalClose}
|
|
||||||
/>
|
|
||||||
</PageContent>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CalendarPage.propTypes = {
|
|
||||||
selectedFilterKey: PropTypes.string.isRequired,
|
|
||||||
filters: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
||||||
customFilters: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
||||||
hasSeries: PropTypes.bool.isRequired,
|
|
||||||
missingEpisodeIds: PropTypes.arrayOf(PropTypes.number).isRequired,
|
|
||||||
isRssSyncExecuting: PropTypes.bool.isRequired,
|
|
||||||
isSearchingForMissing: PropTypes.bool.isRequired,
|
|
||||||
useCurrentPage: PropTypes.bool.isRequired,
|
|
||||||
onSearchMissingPress: PropTypes.func.isRequired,
|
|
||||||
onDaysCountChange: PropTypes.func.isRequired,
|
|
||||||
onRssSyncPress: PropTypes.func.isRequired,
|
|
||||||
onFilterSelect: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default CalendarPage;
|
|
||||||
226
frontend/src/Calendar/CalendarPage.tsx
Normal file
226
frontend/src/Calendar/CalendarPage.tsx
Normal file
|
|
@ -0,0 +1,226 @@
|
||||||
|
import moment from 'moment';
|
||||||
|
import React, { useCallback, useState } from 'react';
|
||||||
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
|
import { createSelector } from 'reselect';
|
||||||
|
import AppState from 'App/State/AppState';
|
||||||
|
import * as commandNames from 'Commands/commandNames';
|
||||||
|
import Measure from 'Components/Measure';
|
||||||
|
import FilterMenu from 'Components/Menu/FilterMenu';
|
||||||
|
import PageContent from 'Components/Page/PageContent';
|
||||||
|
import PageContentBody from 'Components/Page/PageContentBody';
|
||||||
|
import PageToolbar from 'Components/Page/Toolbar/PageToolbar';
|
||||||
|
import PageToolbarButton from 'Components/Page/Toolbar/PageToolbarButton';
|
||||||
|
import PageToolbarSection from 'Components/Page/Toolbar/PageToolbarSection';
|
||||||
|
import PageToolbarSeparator from 'Components/Page/Toolbar/PageToolbarSeparator';
|
||||||
|
import { align, icons } from 'Helpers/Props';
|
||||||
|
import NoSeries from 'Series/NoSeries';
|
||||||
|
import {
|
||||||
|
searchMissing,
|
||||||
|
setCalendarDaysCount,
|
||||||
|
setCalendarFilter,
|
||||||
|
} from 'Store/Actions/calendarActions';
|
||||||
|
import { executeCommand } from 'Store/Actions/commandActions';
|
||||||
|
import { createCustomFiltersSelector } from 'Store/Selectors/createClientSideCollectionSelector';
|
||||||
|
import createCommandExecutingSelector from 'Store/Selectors/createCommandExecutingSelector';
|
||||||
|
import createCommandsSelector from 'Store/Selectors/createCommandsSelector';
|
||||||
|
import createSeriesCountSelector from 'Store/Selectors/createSeriesCountSelector';
|
||||||
|
import { isCommandExecuting } from 'Utilities/Command';
|
||||||
|
import isBefore from 'Utilities/Date/isBefore';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
|
import Calendar from './Calendar';
|
||||||
|
import CalendarFilterModal from './CalendarFilterModal';
|
||||||
|
import CalendarLinkModal from './iCal/CalendarLinkModal';
|
||||||
|
import Legend from './Legend/Legend';
|
||||||
|
import CalendarOptionsModal from './Options/CalendarOptionsModal';
|
||||||
|
import styles from './CalendarPage.css';
|
||||||
|
|
||||||
|
const MINIMUM_DAY_WIDTH = 120;
|
||||||
|
|
||||||
|
function createMissingEpisodeIdsSelector() {
|
||||||
|
return createSelector(
|
||||||
|
(state: AppState) => state.calendar.start,
|
||||||
|
(state: AppState) => state.calendar.end,
|
||||||
|
(state: AppState) => state.calendar.items,
|
||||||
|
(state: AppState) => state.queue.details.items,
|
||||||
|
(start, end, episodes, queueDetails) => {
|
||||||
|
return episodes.reduce<number[]>((acc, episode) => {
|
||||||
|
const airDateUtc = episode.airDateUtc;
|
||||||
|
|
||||||
|
if (
|
||||||
|
!episode.episodeFileId &&
|
||||||
|
moment(airDateUtc).isAfter(start) &&
|
||||||
|
moment(airDateUtc).isBefore(end) &&
|
||||||
|
isBefore(episode.airDateUtc) &&
|
||||||
|
!queueDetails.some(
|
||||||
|
(details) => !!details.episode && details.episode.id === episode.id
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
acc.push(episode.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
return acc;
|
||||||
|
}, []);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function createIsSearchingSelector() {
|
||||||
|
return createSelector(
|
||||||
|
(state: AppState) => state.calendar.searchMissingCommandId,
|
||||||
|
createCommandsSelector(),
|
||||||
|
(searchMissingCommandId, commands) => {
|
||||||
|
if (searchMissingCommandId == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return isCommandExecuting(
|
||||||
|
commands.find((command) => {
|
||||||
|
return command.id === searchMissingCommandId;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function CalendarPage() {
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
|
const { selectedFilterKey, filters } = useSelector(
|
||||||
|
(state: AppState) => state.calendar
|
||||||
|
);
|
||||||
|
const missingEpisodeIds = useSelector(createMissingEpisodeIdsSelector());
|
||||||
|
const isSearchingForMissing = useSelector(createIsSearchingSelector());
|
||||||
|
const isRssSyncExecuting = useSelector(
|
||||||
|
createCommandExecutingSelector(commandNames.RSS_SYNC)
|
||||||
|
);
|
||||||
|
const customFilters = useSelector(createCustomFiltersSelector('calendar'));
|
||||||
|
const hasSeries = !!useSelector(createSeriesCountSelector());
|
||||||
|
|
||||||
|
const [isCalendarLinkModalOpen, setIsCalendarLinkModalOpen] = useState(false);
|
||||||
|
const [isOptionsModalOpen, setIsOptionsModalOpen] = useState(false);
|
||||||
|
const [width, setWidth] = useState(0);
|
||||||
|
|
||||||
|
const isMeasured = width > 0;
|
||||||
|
const PageComponent = hasSeries ? Calendar : NoSeries;
|
||||||
|
|
||||||
|
const handleMeasure = useCallback(
|
||||||
|
({ width: newWidth }: { width: number }) => {
|
||||||
|
setWidth(newWidth);
|
||||||
|
|
||||||
|
const dayCount = Math.max(
|
||||||
|
3,
|
||||||
|
Math.min(7, Math.floor(newWidth / MINIMUM_DAY_WIDTH))
|
||||||
|
);
|
||||||
|
|
||||||
|
dispatch(setCalendarDaysCount({ dayCount }));
|
||||||
|
},
|
||||||
|
[dispatch]
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleGetCalendarLinkPress = useCallback(() => {
|
||||||
|
setIsCalendarLinkModalOpen(true);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleGetCalendarLinkModalClose = useCallback(() => {
|
||||||
|
setIsCalendarLinkModalOpen(false);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleOptionsPress = useCallback(() => {
|
||||||
|
setIsOptionsModalOpen(true);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleOptionsModalClose = useCallback(() => {
|
||||||
|
setIsOptionsModalOpen(false);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleRssSyncPress = useCallback(() => {
|
||||||
|
dispatch(
|
||||||
|
executeCommand({
|
||||||
|
name: commandNames.RSS_SYNC,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}, [dispatch]);
|
||||||
|
|
||||||
|
const handleSearchMissingPress = useCallback(() => {
|
||||||
|
dispatch(searchMissing({ episodeIds: missingEpisodeIds }));
|
||||||
|
}, [missingEpisodeIds, dispatch]);
|
||||||
|
|
||||||
|
const handleFilterSelect = useCallback(
|
||||||
|
(key: string) => {
|
||||||
|
dispatch(setCalendarFilter({ selectedFilterKey: key }));
|
||||||
|
},
|
||||||
|
[dispatch]
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<PageContent title={translate('Calendar')}>
|
||||||
|
<PageToolbar>
|
||||||
|
<PageToolbarSection>
|
||||||
|
<PageToolbarButton
|
||||||
|
label={translate('ICalLink')}
|
||||||
|
iconName={icons.CALENDAR}
|
||||||
|
onPress={handleGetCalendarLinkPress}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<PageToolbarSeparator />
|
||||||
|
|
||||||
|
<PageToolbarButton
|
||||||
|
label={translate('RssSync')}
|
||||||
|
iconName={icons.RSS}
|
||||||
|
isSpinning={isRssSyncExecuting}
|
||||||
|
onPress={handleRssSyncPress}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<PageToolbarButton
|
||||||
|
label={translate('SearchForMissing')}
|
||||||
|
iconName={icons.SEARCH}
|
||||||
|
isDisabled={!missingEpisodeIds.length}
|
||||||
|
isSpinning={isSearchingForMissing}
|
||||||
|
onPress={handleSearchMissingPress}
|
||||||
|
/>
|
||||||
|
</PageToolbarSection>
|
||||||
|
|
||||||
|
<PageToolbarSection alignContent={align.RIGHT}>
|
||||||
|
<PageToolbarButton
|
||||||
|
label={translate('Options')}
|
||||||
|
iconName={icons.POSTER}
|
||||||
|
onPress={handleOptionsPress}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<FilterMenu
|
||||||
|
alignMenu={align.RIGHT}
|
||||||
|
isDisabled={!hasSeries}
|
||||||
|
selectedFilterKey={selectedFilterKey}
|
||||||
|
filters={filters}
|
||||||
|
customFilters={customFilters}
|
||||||
|
filterModalConnectorComponent={CalendarFilterModal}
|
||||||
|
onFilterSelect={handleFilterSelect}
|
||||||
|
/>
|
||||||
|
</PageToolbarSection>
|
||||||
|
</PageToolbar>
|
||||||
|
|
||||||
|
<PageContentBody
|
||||||
|
className={styles.calendarPageBody}
|
||||||
|
innerClassName={styles.calendarInnerPageBody}
|
||||||
|
>
|
||||||
|
<Measure whitelist={['width']} onMeasure={handleMeasure}>
|
||||||
|
{isMeasured ? <PageComponent totalItems={0} /> : <div />}
|
||||||
|
</Measure>
|
||||||
|
|
||||||
|
{hasSeries && <Legend />}
|
||||||
|
</PageContentBody>
|
||||||
|
|
||||||
|
<CalendarLinkModal
|
||||||
|
isOpen={isCalendarLinkModalOpen}
|
||||||
|
onModalClose={handleGetCalendarLinkModalClose}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<CalendarOptionsModal
|
||||||
|
isOpen={isOptionsModalOpen}
|
||||||
|
onModalClose={handleOptionsModalClose}
|
||||||
|
/>
|
||||||
|
</PageContent>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default CalendarPage;
|
||||||
|
|
@ -1,117 +0,0 @@
|
||||||
import moment from 'moment';
|
|
||||||
import { connect } from 'react-redux';
|
|
||||||
import { createSelector } from 'reselect';
|
|
||||||
import * as commandNames from 'Commands/commandNames';
|
|
||||||
import withCurrentPage from 'Components/withCurrentPage';
|
|
||||||
import { searchMissing, setCalendarDaysCount, setCalendarFilter } from 'Store/Actions/calendarActions';
|
|
||||||
import { executeCommand } from 'Store/Actions/commandActions';
|
|
||||||
import { createCustomFiltersSelector } from 'Store/Selectors/createClientSideCollectionSelector';
|
|
||||||
import createCommandExecutingSelector from 'Store/Selectors/createCommandExecutingSelector';
|
|
||||||
import createCommandsSelector from 'Store/Selectors/createCommandsSelector';
|
|
||||||
import createSeriesCountSelector from 'Store/Selectors/createSeriesCountSelector';
|
|
||||||
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
|
||||||
import { isCommandExecuting } from 'Utilities/Command';
|
|
||||||
import isBefore from 'Utilities/Date/isBefore';
|
|
||||||
import CalendarPage from './CalendarPage';
|
|
||||||
|
|
||||||
function createMissingEpisodeIdsSelector() {
|
|
||||||
return createSelector(
|
|
||||||
(state) => state.calendar.start,
|
|
||||||
(state) => state.calendar.end,
|
|
||||||
(state) => state.calendar.items,
|
|
||||||
(state) => state.queue.details.items,
|
|
||||||
(start, end, episodes, queueDetails) => {
|
|
||||||
return episodes.reduce((acc, episode) => {
|
|
||||||
const airDateUtc = episode.airDateUtc;
|
|
||||||
|
|
||||||
if (
|
|
||||||
!episode.episodeFileId &&
|
|
||||||
moment(airDateUtc).isAfter(start) &&
|
|
||||||
moment(airDateUtc).isBefore(end) &&
|
|
||||||
isBefore(episode.airDateUtc) &&
|
|
||||||
!queueDetails.some((details) => !!details.episode && details.episode.id === episode.id)
|
|
||||||
) {
|
|
||||||
acc.push(episode.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
return acc;
|
|
||||||
}, []);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function createIsSearchingSelector() {
|
|
||||||
return createSelector(
|
|
||||||
(state) => state.calendar.searchMissingCommandId,
|
|
||||||
createCommandsSelector(),
|
|
||||||
(searchMissingCommandId, commands) => {
|
|
||||||
if (searchMissingCommandId == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return isCommandExecuting(commands.find((command) => {
|
|
||||||
return command.id === searchMissingCommandId;
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function createMapStateToProps() {
|
|
||||||
return createSelector(
|
|
||||||
(state) => state.calendar.selectedFilterKey,
|
|
||||||
(state) => state.calendar.filters,
|
|
||||||
createCustomFiltersSelector('calendar'),
|
|
||||||
createSeriesCountSelector(),
|
|
||||||
createUISettingsSelector(),
|
|
||||||
createMissingEpisodeIdsSelector(),
|
|
||||||
createCommandExecutingSelector(commandNames.RSS_SYNC),
|
|
||||||
createIsSearchingSelector(),
|
|
||||||
(
|
|
||||||
selectedFilterKey,
|
|
||||||
filters,
|
|
||||||
customFilters,
|
|
||||||
seriesCount,
|
|
||||||
uiSettings,
|
|
||||||
missingEpisodeIds,
|
|
||||||
isRssSyncExecuting,
|
|
||||||
isSearchingForMissing
|
|
||||||
) => {
|
|
||||||
return {
|
|
||||||
selectedFilterKey,
|
|
||||||
filters,
|
|
||||||
customFilters,
|
|
||||||
colorImpairedMode: uiSettings.enableColorImpairedMode,
|
|
||||||
hasSeries: !!seriesCount,
|
|
||||||
missingEpisodeIds,
|
|
||||||
isRssSyncExecuting,
|
|
||||||
isSearchingForMissing
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function createMapDispatchToProps(dispatch, props) {
|
|
||||||
return {
|
|
||||||
onRssSyncPress() {
|
|
||||||
dispatch(executeCommand({
|
|
||||||
name: commandNames.RSS_SYNC
|
|
||||||
}));
|
|
||||||
},
|
|
||||||
|
|
||||||
onSearchMissingPress(episodeIds) {
|
|
||||||
dispatch(searchMissing({ episodeIds }));
|
|
||||||
},
|
|
||||||
|
|
||||||
onDaysCountChange(dayCount) {
|
|
||||||
dispatch(setCalendarDaysCount({ dayCount }));
|
|
||||||
},
|
|
||||||
|
|
||||||
onFilterSelect(selectedFilterKey) {
|
|
||||||
dispatch(setCalendarFilter({ selectedFilterKey }));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export default withCurrentPage(
|
|
||||||
connect(createMapStateToProps, createMapDispatchToProps)(CalendarPage)
|
|
||||||
);
|
|
||||||
|
|
@ -1,25 +1,104 @@
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { useSelector } from 'react-redux';
|
||||||
|
import { createSelector } from 'reselect';
|
||||||
|
import AppState from 'App/State/AppState';
|
||||||
import * as calendarViews from 'Calendar/calendarViews';
|
import * as calendarViews from 'Calendar/calendarViews';
|
||||||
import CalendarEventConnector from 'Calendar/Events/CalendarEventConnector';
|
import CalendarEvent from 'Calendar/Events/CalendarEvent';
|
||||||
import CalendarEventGroupConnector from 'Calendar/Events/CalendarEventGroupConnector';
|
import CalendarEventGroup from 'Calendar/Events/CalendarEventGroup';
|
||||||
import Series from 'Series/Series';
|
import {
|
||||||
import CalendarEventGroup, { CalendarEvent } from 'typings/CalendarEventGroup';
|
CalendarEvent as CalendarEventModel,
|
||||||
|
CalendarEventGroup as CalendarEventGroupModel,
|
||||||
|
CalendarItem,
|
||||||
|
} from 'typings/Calendar';
|
||||||
import styles from './CalendarDay.css';
|
import styles from './CalendarDay.css';
|
||||||
|
|
||||||
|
function sort(items: (CalendarEventModel | CalendarEventGroupModel)[]) {
|
||||||
|
return items.sort((a, b) => {
|
||||||
|
const aDate = a.isGroup
|
||||||
|
? moment(a.events[0].airDateUtc).unix()
|
||||||
|
: moment(a.airDateUtc).unix();
|
||||||
|
|
||||||
|
const bDate = b.isGroup
|
||||||
|
? moment(b.events[0].airDateUtc).unix()
|
||||||
|
: moment(b.airDateUtc).unix();
|
||||||
|
|
||||||
|
return aDate - bDate;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function createCalendarEventsConnector(date: string) {
|
||||||
|
return createSelector(
|
||||||
|
(state: AppState) => state.calendar.items,
|
||||||
|
(state: AppState) => state.calendar.options.collapseMultipleEpisodes,
|
||||||
|
(items, collapseMultipleEpisodes) => {
|
||||||
|
const momentDate = moment(date);
|
||||||
|
|
||||||
|
const filtered = items.filter((item) => {
|
||||||
|
return momentDate.isSame(moment(item.airDateUtc), 'day');
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!collapseMultipleEpisodes) {
|
||||||
|
return sort(
|
||||||
|
filtered.map((item) => ({
|
||||||
|
isGroup: false,
|
||||||
|
...item,
|
||||||
|
}))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const groupedObject = Object.groupBy(
|
||||||
|
filtered,
|
||||||
|
(item: CalendarItem) => `${item.seriesId}-${item.seasonNumber}`
|
||||||
|
);
|
||||||
|
|
||||||
|
const grouped = Object.entries(groupedObject).reduce<
|
||||||
|
(CalendarEventModel | CalendarEventGroupModel)[]
|
||||||
|
>((acc, [, events]) => {
|
||||||
|
if (!events) {
|
||||||
|
return acc;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (events.length === 1) {
|
||||||
|
acc.push({
|
||||||
|
isGroup: false,
|
||||||
|
...events[0],
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
acc.push({
|
||||||
|
isGroup: true,
|
||||||
|
seriesId: events[0].seriesId,
|
||||||
|
seasonNumber: events[0].seasonNumber,
|
||||||
|
episodeIds: events.map((event) => event.id),
|
||||||
|
events: events.sort(
|
||||||
|
(a, b) =>
|
||||||
|
moment(a.airDateUtc).unix() - moment(b.airDateUtc).unix()
|
||||||
|
),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return acc;
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return sort(grouped);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
interface CalendarDayProps {
|
interface CalendarDayProps {
|
||||||
date: string;
|
date: string;
|
||||||
time: string;
|
|
||||||
isTodaysDate: boolean;
|
isTodaysDate: boolean;
|
||||||
events: (CalendarEvent | CalendarEventGroup)[];
|
onEventModalOpenToggle(isOpen: boolean): unknown;
|
||||||
view: string;
|
|
||||||
onEventModalOpenToggle(...args: unknown[]): unknown;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function CalendarDay(props: CalendarDayProps) {
|
function CalendarDay({
|
||||||
const { date, time, isTodaysDate, events, view, onEventModalOpenToggle } =
|
date,
|
||||||
props;
|
isTodaysDate,
|
||||||
|
onEventModalOpenToggle,
|
||||||
|
}: CalendarDayProps) {
|
||||||
|
const { time, view } = useSelector((state: AppState) => state.calendar);
|
||||||
|
const events = useSelector(createCalendarEventsConnector(date));
|
||||||
|
|
||||||
const ref = React.useRef<HTMLDivElement>(null);
|
const ref = React.useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
|
|
@ -53,7 +132,7 @@ function CalendarDay(props: CalendarDayProps) {
|
||||||
{events.map((event) => {
|
{events.map((event) => {
|
||||||
if (event.isGroup) {
|
if (event.isGroup) {
|
||||||
return (
|
return (
|
||||||
<CalendarEventGroupConnector
|
<CalendarEventGroup
|
||||||
key={event.seriesId}
|
key={event.seriesId}
|
||||||
{...event}
|
{...event}
|
||||||
onEventModalOpenToggle={onEventModalOpenToggle}
|
onEventModalOpenToggle={onEventModalOpenToggle}
|
||||||
|
|
@ -62,11 +141,11 @@ function CalendarDay(props: CalendarDayProps) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<CalendarEventConnector
|
<CalendarEvent
|
||||||
key={event.id}
|
key={event.id}
|
||||||
{...event}
|
{...event}
|
||||||
episodeId={event.id}
|
episodeId={event.id}
|
||||||
series={event.series as Series}
|
seriesId={event.seriesId}
|
||||||
airDateUtc={event.airDateUtc as string}
|
airDateUtc={event.airDateUtc as string}
|
||||||
onEventModalOpenToggle={onEventModalOpenToggle}
|
onEventModalOpenToggle={onEventModalOpenToggle}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -1,91 +0,0 @@
|
||||||
import _ from 'lodash';
|
|
||||||
import moment from 'moment';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import { connect } from 'react-redux';
|
|
||||||
import { createSelector } from 'reselect';
|
|
||||||
import CalendarDay from './CalendarDay';
|
|
||||||
|
|
||||||
function sort(items) {
|
|
||||||
return _.sortBy(items, (item) => {
|
|
||||||
if (item.isGroup) {
|
|
||||||
return moment(item.events[0].airDateUtc).unix();
|
|
||||||
}
|
|
||||||
|
|
||||||
return moment(item.airDateUtc).unix();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function createCalendarEventsConnector() {
|
|
||||||
return createSelector(
|
|
||||||
(state, { date }) => date,
|
|
||||||
(state) => state.calendar.items,
|
|
||||||
(state) => state.calendar.options.collapseMultipleEpisodes,
|
|
||||||
(date, items, collapseMultipleEpisodes) => {
|
|
||||||
const filtered = _.filter(items, (item) => {
|
|
||||||
return moment(date).isSame(moment(item.airDateUtc), 'day');
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!collapseMultipleEpisodes) {
|
|
||||||
return sort(filtered);
|
|
||||||
}
|
|
||||||
|
|
||||||
const groupedObject = _.groupBy(filtered, (item) => `${item.seriesId}-${item.seasonNumber}`);
|
|
||||||
const grouped = [];
|
|
||||||
|
|
||||||
Object.keys(groupedObject).forEach((key) => {
|
|
||||||
const events = groupedObject[key];
|
|
||||||
|
|
||||||
if (events.length === 1) {
|
|
||||||
grouped.push(events[0]);
|
|
||||||
} else {
|
|
||||||
grouped.push({
|
|
||||||
isGroup: true,
|
|
||||||
seriesId: events[0].seriesId,
|
|
||||||
seasonNumber: events[0].seasonNumber,
|
|
||||||
episodeIds: events.map((event) => event.id),
|
|
||||||
events: _.sortBy(events, (item) => moment(item.airDateUtc).unix())
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const sorted = sort(grouped);
|
|
||||||
|
|
||||||
return sorted;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function createMapStateToProps() {
|
|
||||||
return createSelector(
|
|
||||||
(state) => state.calendar,
|
|
||||||
createCalendarEventsConnector(),
|
|
||||||
(calendar, events) => {
|
|
||||||
return {
|
|
||||||
time: calendar.time,
|
|
||||||
view: calendar.view,
|
|
||||||
events
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
class CalendarDayConnector extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
return (
|
|
||||||
<CalendarDay
|
|
||||||
{...this.props}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CalendarDayConnector.propTypes = {
|
|
||||||
date: PropTypes.string.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default connect(createMapStateToProps)(CalendarDayConnector);
|
|
||||||
|
|
@ -1,164 +0,0 @@
|
||||||
import classNames from 'classnames';
|
|
||||||
import moment from 'moment';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import * as calendarViews from 'Calendar/calendarViews';
|
|
||||||
import isToday from 'Utilities/Date/isToday';
|
|
||||||
import CalendarDayConnector from './CalendarDayConnector';
|
|
||||||
import styles from './CalendarDays.css';
|
|
||||||
|
|
||||||
class CalendarDays extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Lifecycle
|
|
||||||
|
|
||||||
constructor(props, context) {
|
|
||||||
super(props, context);
|
|
||||||
|
|
||||||
this._touchStart = null;
|
|
||||||
|
|
||||||
this.state = {
|
|
||||||
todaysDate: moment().startOf('day').toISOString(),
|
|
||||||
isEventModalOpen: false
|
|
||||||
};
|
|
||||||
|
|
||||||
this.updateTimeoutId = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Lifecycle
|
|
||||||
|
|
||||||
componentDidMount() {
|
|
||||||
const view = this.props.view;
|
|
||||||
|
|
||||||
if (view === calendarViews.MONTH) {
|
|
||||||
this.scheduleUpdate();
|
|
||||||
}
|
|
||||||
|
|
||||||
window.addEventListener('touchstart', this.onTouchStart);
|
|
||||||
window.addEventListener('touchend', this.onTouchEnd);
|
|
||||||
window.addEventListener('touchcancel', this.onTouchCancel);
|
|
||||||
window.addEventListener('touchmove', this.onTouchMove);
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillUnmount() {
|
|
||||||
this.clearUpdateTimeout();
|
|
||||||
|
|
||||||
window.removeEventListener('touchstart', this.onTouchStart);
|
|
||||||
window.removeEventListener('touchend', this.onTouchEnd);
|
|
||||||
window.removeEventListener('touchcancel', this.onTouchCancel);
|
|
||||||
window.removeEventListener('touchmove', this.onTouchMove);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Control
|
|
||||||
|
|
||||||
scheduleUpdate = () => {
|
|
||||||
this.clearUpdateTimeout();
|
|
||||||
const todaysDate = moment().startOf('day');
|
|
||||||
const diff = moment().diff(todaysDate.clone().add(1, 'day'));
|
|
||||||
|
|
||||||
this.setState({ todaysDate: todaysDate.toISOString() });
|
|
||||||
|
|
||||||
this.updateTimeoutId = setTimeout(this.scheduleUpdate, diff);
|
|
||||||
};
|
|
||||||
|
|
||||||
clearUpdateTimeout = () => {
|
|
||||||
if (this.updateTimeoutId) {
|
|
||||||
clearTimeout(this.updateTimeoutId);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Listeners
|
|
||||||
|
|
||||||
onEventModalOpenToggle = (isEventModalOpen) => {
|
|
||||||
this.setState({ isEventModalOpen });
|
|
||||||
};
|
|
||||||
|
|
||||||
onTouchStart = (event) => {
|
|
||||||
const touches = event.touches;
|
|
||||||
const touchStart = touches[0].pageX;
|
|
||||||
|
|
||||||
if (touches.length !== 1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
touchStart < 50 ||
|
|
||||||
this.props.isSidebarVisible ||
|
|
||||||
this.state.isEventModalOpen
|
|
||||||
) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this._touchStart = touchStart;
|
|
||||||
};
|
|
||||||
|
|
||||||
onTouchEnd = (event) => {
|
|
||||||
const touches = event.changedTouches;
|
|
||||||
const currentTouch = touches[0].pageX;
|
|
||||||
|
|
||||||
if (!this._touchStart) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currentTouch > this._touchStart && currentTouch - this._touchStart > 100) {
|
|
||||||
this.props.onNavigatePrevious();
|
|
||||||
} else if (currentTouch < this._touchStart && this._touchStart - currentTouch > 100) {
|
|
||||||
this.props.onNavigateNext();
|
|
||||||
}
|
|
||||||
|
|
||||||
this._touchStart = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
onTouchCancel = (event) => {
|
|
||||||
this._touchStart = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
onTouchMove = (event) => {
|
|
||||||
if (!this._touchStart) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const {
|
|
||||||
dates,
|
|
||||||
view
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className={classNames(
|
|
||||||
styles.days,
|
|
||||||
styles[view]
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
{
|
|
||||||
dates.map((date) => {
|
|
||||||
return (
|
|
||||||
<CalendarDayConnector
|
|
||||||
key={date}
|
|
||||||
date={date}
|
|
||||||
isTodaysDate={isToday(date)}
|
|
||||||
onEventModalOpenToggle={this.onEventModalOpenToggle}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CalendarDays.propTypes = {
|
|
||||||
dates: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
||||||
view: PropTypes.string.isRequired,
|
|
||||||
isSidebarVisible: PropTypes.bool.isRequired,
|
|
||||||
onNavigatePrevious: PropTypes.func.isRequired,
|
|
||||||
onNavigateNext: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default CalendarDays;
|
|
||||||
135
frontend/src/Calendar/Day/CalendarDays.tsx
Normal file
135
frontend/src/Calendar/Day/CalendarDays.tsx
Normal file
|
|
@ -0,0 +1,135 @@
|
||||||
|
import classNames from 'classnames';
|
||||||
|
import moment from 'moment';
|
||||||
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
||||||
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
|
import AppState from 'App/State/AppState';
|
||||||
|
import * as calendarViews from 'Calendar/calendarViews';
|
||||||
|
import {
|
||||||
|
gotoCalendarNextRange,
|
||||||
|
gotoCalendarPreviousRange,
|
||||||
|
} from 'Store/Actions/calendarActions';
|
||||||
|
import CalendarDay from './CalendarDay';
|
||||||
|
import styles from './CalendarDays.css';
|
||||||
|
|
||||||
|
function CalendarDays() {
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
const { dates, view } = useSelector((state: AppState) => state.calendar);
|
||||||
|
const isSidebarVisible = useSelector(
|
||||||
|
(state: AppState) => state.app.isSidebarVisible
|
||||||
|
);
|
||||||
|
|
||||||
|
const updateTimeout = useRef<ReturnType<typeof setTimeout>>();
|
||||||
|
const touchStart = useRef<number | null>(null);
|
||||||
|
const isEventModalOpen = useRef(false);
|
||||||
|
const [todaysDate, setTodaysDate] = useState(
|
||||||
|
moment().startOf('day').toISOString()
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleEventModalOpenToggle = useCallback((isOpen: boolean) => {
|
||||||
|
isEventModalOpen.current = isOpen;
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const scheduleUpdate = useCallback(() => {
|
||||||
|
clearTimeout(updateTimeout.current);
|
||||||
|
|
||||||
|
const todaysDate = moment().startOf('day');
|
||||||
|
const diff = moment().diff(todaysDate.clone().add(1, 'day'));
|
||||||
|
|
||||||
|
setTodaysDate(todaysDate.toISOString());
|
||||||
|
|
||||||
|
updateTimeout.current = setTimeout(scheduleUpdate, diff);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleTouchStart = useCallback(
|
||||||
|
(event: TouchEvent) => {
|
||||||
|
const touches = event.touches;
|
||||||
|
const currentTouch = touches[0].pageX;
|
||||||
|
|
||||||
|
if (touches.length !== 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentTouch < 50 || isSidebarVisible || isEventModalOpen.current) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
touchStart.current = currentTouch;
|
||||||
|
},
|
||||||
|
[isSidebarVisible]
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleTouchEnd = useCallback(
|
||||||
|
(event: TouchEvent) => {
|
||||||
|
const touches = event.changedTouches;
|
||||||
|
const currentTouch = touches[0].pageX;
|
||||||
|
|
||||||
|
if (!touchStart.current) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
currentTouch > touchStart.current &&
|
||||||
|
currentTouch - touchStart.current > 100
|
||||||
|
) {
|
||||||
|
dispatch(gotoCalendarPreviousRange());
|
||||||
|
} else if (
|
||||||
|
currentTouch < touchStart.current &&
|
||||||
|
touchStart.current - currentTouch > 100
|
||||||
|
) {
|
||||||
|
dispatch(gotoCalendarNextRange());
|
||||||
|
}
|
||||||
|
|
||||||
|
touchStart.current = null;
|
||||||
|
},
|
||||||
|
[dispatch]
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleTouchCancel = useCallback(() => {
|
||||||
|
touchStart.current = null;
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleTouchMove = useCallback(() => {
|
||||||
|
if (!touchStart.current) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (view === calendarViews.MONTH) {
|
||||||
|
scheduleUpdate();
|
||||||
|
}
|
||||||
|
}, [view, scheduleUpdate]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
window.addEventListener('touchstart', handleTouchStart);
|
||||||
|
window.addEventListener('touchend', handleTouchEnd);
|
||||||
|
window.addEventListener('touchcancel', handleTouchCancel);
|
||||||
|
window.addEventListener('touchmove', handleTouchMove);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
window.removeEventListener('touchstart', handleTouchStart);
|
||||||
|
window.removeEventListener('touchend', handleTouchEnd);
|
||||||
|
window.removeEventListener('touchcancel', handleTouchCancel);
|
||||||
|
window.removeEventListener('touchmove', handleTouchMove);
|
||||||
|
};
|
||||||
|
}, [handleTouchStart, handleTouchEnd, handleTouchCancel, handleTouchMove]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={classNames(styles.days, styles[view as keyof typeof styles])}
|
||||||
|
>
|
||||||
|
{dates.map((date) => {
|
||||||
|
return (
|
||||||
|
<CalendarDay
|
||||||
|
key={date}
|
||||||
|
date={date}
|
||||||
|
isTodaysDate={date === todaysDate}
|
||||||
|
onEventModalOpenToggle={handleEventModalOpenToggle}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default CalendarDays;
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
import { connect } from 'react-redux';
|
|
||||||
import { createSelector } from 'reselect';
|
|
||||||
import { gotoCalendarNextRange, gotoCalendarPreviousRange } from 'Store/Actions/calendarActions';
|
|
||||||
import CalendarDays from './CalendarDays';
|
|
||||||
|
|
||||||
function createMapStateToProps() {
|
|
||||||
return createSelector(
|
|
||||||
(state) => state.calendar,
|
|
||||||
(state) => state.app.isSidebarVisible,
|
|
||||||
(calendar, isSidebarVisible) => {
|
|
||||||
return {
|
|
||||||
dates: calendar.dates,
|
|
||||||
view: calendar.view,
|
|
||||||
isSidebarVisible
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const mapDispatchToProps = {
|
|
||||||
onNavigatePrevious: gotoCalendarPreviousRange,
|
|
||||||
onNavigateNext: gotoCalendarNextRange
|
|
||||||
};
|
|
||||||
|
|
||||||
export default connect(createMapStateToProps, mapDispatchToProps)(CalendarDays);
|
|
||||||
|
|
@ -1,56 +0,0 @@
|
||||||
import classNames from 'classnames';
|
|
||||||
import moment from 'moment';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import * as calendarViews from 'Calendar/calendarViews';
|
|
||||||
import getRelativeDate from 'Utilities/Date/getRelativeDate';
|
|
||||||
import styles from './DayOfWeek.css';
|
|
||||||
|
|
||||||
class DayOfWeek extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const {
|
|
||||||
date,
|
|
||||||
view,
|
|
||||||
isTodaysDate,
|
|
||||||
calendarWeekColumnHeader,
|
|
||||||
shortDateFormat,
|
|
||||||
showRelativeDates
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
const highlightToday = view !== calendarViews.MONTH && isTodaysDate;
|
|
||||||
const momentDate = moment(date);
|
|
||||||
let formatedDate = momentDate.format('dddd');
|
|
||||||
|
|
||||||
if (view === calendarViews.WEEK) {
|
|
||||||
formatedDate = momentDate.format(calendarWeekColumnHeader);
|
|
||||||
} else if (view === calendarViews.FORECAST) {
|
|
||||||
formatedDate = getRelativeDate({ date, shortDateFormat, showRelativeDates });
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className={classNames(
|
|
||||||
styles.dayOfWeek,
|
|
||||||
view === calendarViews.DAY && styles.isSingleDay,
|
|
||||||
highlightToday && styles.isToday
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
{formatedDate}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DayOfWeek.propTypes = {
|
|
||||||
date: PropTypes.string.isRequired,
|
|
||||||
view: PropTypes.string.isRequired,
|
|
||||||
isTodaysDate: PropTypes.bool.isRequired,
|
|
||||||
calendarWeekColumnHeader: PropTypes.string.isRequired,
|
|
||||||
shortDateFormat: PropTypes.string.isRequired,
|
|
||||||
showRelativeDates: PropTypes.bool.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default DayOfWeek;
|
|
||||||
54
frontend/src/Calendar/Day/DayOfWeek.tsx
Normal file
54
frontend/src/Calendar/Day/DayOfWeek.tsx
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
import classNames from 'classnames';
|
||||||
|
import moment from 'moment';
|
||||||
|
import React from 'react';
|
||||||
|
import * as calendarViews from 'Calendar/calendarViews';
|
||||||
|
import getRelativeDate from 'Utilities/Date/getRelativeDate';
|
||||||
|
import styles from './DayOfWeek.css';
|
||||||
|
|
||||||
|
interface DayOfWeekProps {
|
||||||
|
date: string;
|
||||||
|
view: string;
|
||||||
|
isTodaysDate: boolean;
|
||||||
|
calendarWeekColumnHeader: string;
|
||||||
|
shortDateFormat: string;
|
||||||
|
showRelativeDates: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
function DayOfWeek(props: DayOfWeekProps) {
|
||||||
|
const {
|
||||||
|
date,
|
||||||
|
view,
|
||||||
|
isTodaysDate,
|
||||||
|
calendarWeekColumnHeader,
|
||||||
|
shortDateFormat,
|
||||||
|
showRelativeDates,
|
||||||
|
} = props;
|
||||||
|
|
||||||
|
const highlightToday = view !== calendarViews.MONTH && isTodaysDate;
|
||||||
|
const momentDate = moment(date);
|
||||||
|
let formatedDate = momentDate.format('dddd');
|
||||||
|
|
||||||
|
if (view === calendarViews.WEEK) {
|
||||||
|
formatedDate = momentDate.format(calendarWeekColumnHeader);
|
||||||
|
} else if (view === calendarViews.FORECAST) {
|
||||||
|
formatedDate = getRelativeDate({
|
||||||
|
date,
|
||||||
|
shortDateFormat,
|
||||||
|
showRelativeDates,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={classNames(
|
||||||
|
styles.dayOfWeek,
|
||||||
|
view === calendarViews.DAY && styles.isSingleDay,
|
||||||
|
highlightToday && styles.isToday
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{formatedDate}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default DayOfWeek;
|
||||||
|
|
@ -1,97 +0,0 @@
|
||||||
import moment from 'moment';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import * as calendarViews from 'Calendar/calendarViews';
|
|
||||||
import DayOfWeek from './DayOfWeek';
|
|
||||||
import styles from './DaysOfWeek.css';
|
|
||||||
|
|
||||||
class DaysOfWeek extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Lifecycle
|
|
||||||
|
|
||||||
constructor(props, context) {
|
|
||||||
super(props, context);
|
|
||||||
|
|
||||||
this.state = {
|
|
||||||
todaysDate: moment().startOf('day').toISOString()
|
|
||||||
};
|
|
||||||
|
|
||||||
this.updateTimeoutId = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Lifecycle
|
|
||||||
|
|
||||||
componentDidMount() {
|
|
||||||
const view = this.props.view;
|
|
||||||
|
|
||||||
if (view !== calendarViews.AGENDA || view !== calendarViews.MONTH) {
|
|
||||||
this.scheduleUpdate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillUnmount() {
|
|
||||||
this.clearUpdateTimeout();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Control
|
|
||||||
|
|
||||||
scheduleUpdate = () => {
|
|
||||||
this.clearUpdateTimeout();
|
|
||||||
const todaysDate = moment().startOf('day');
|
|
||||||
const diff = todaysDate.clone().add(1, 'day').diff(moment());
|
|
||||||
|
|
||||||
this.setState({
|
|
||||||
todaysDate: todaysDate.toISOString()
|
|
||||||
});
|
|
||||||
|
|
||||||
this.updateTimeoutId = setTimeout(this.scheduleUpdate, diff);
|
|
||||||
};
|
|
||||||
|
|
||||||
clearUpdateTimeout = () => {
|
|
||||||
if (this.updateTimeoutId) {
|
|
||||||
clearTimeout(this.updateTimeoutId);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const {
|
|
||||||
dates,
|
|
||||||
view,
|
|
||||||
...otherProps
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
if (view === calendarViews.AGENDA) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className={styles.daysOfWeek}>
|
|
||||||
{
|
|
||||||
dates.map((date) => {
|
|
||||||
return (
|
|
||||||
<DayOfWeek
|
|
||||||
key={date}
|
|
||||||
date={date}
|
|
||||||
view={view}
|
|
||||||
isTodaysDate={date === this.state.todaysDate}
|
|
||||||
{...otherProps}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DaysOfWeek.propTypes = {
|
|
||||||
dates: PropTypes.arrayOf(PropTypes.string),
|
|
||||||
view: PropTypes.string.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default DaysOfWeek;
|
|
||||||
60
frontend/src/Calendar/Day/DaysOfWeek.tsx
Normal file
60
frontend/src/Calendar/Day/DaysOfWeek.tsx
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
import moment from 'moment';
|
||||||
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
||||||
|
import { useSelector } from 'react-redux';
|
||||||
|
import AppState from 'App/State/AppState';
|
||||||
|
import * as calendarViews from 'Calendar/calendarViews';
|
||||||
|
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
||||||
|
import DayOfWeek from './DayOfWeek';
|
||||||
|
import styles from './DaysOfWeek.css';
|
||||||
|
|
||||||
|
function DaysOfWeek() {
|
||||||
|
const { dates, view } = useSelector((state: AppState) => state.calendar);
|
||||||
|
const { calendarWeekColumnHeader, shortDateFormat, showRelativeDates } =
|
||||||
|
useSelector(createUISettingsSelector());
|
||||||
|
|
||||||
|
const updateTimeout = useRef<ReturnType<typeof setTimeout>>();
|
||||||
|
const [todaysDate, setTodaysDate] = useState(
|
||||||
|
moment().startOf('day').toISOString()
|
||||||
|
);
|
||||||
|
|
||||||
|
const scheduleUpdate = useCallback(() => {
|
||||||
|
clearTimeout(updateTimeout.current);
|
||||||
|
|
||||||
|
const todaysDate = moment().startOf('day');
|
||||||
|
const diff = moment().diff(todaysDate.clone().add(1, 'day'));
|
||||||
|
|
||||||
|
setTodaysDate(todaysDate.toISOString());
|
||||||
|
|
||||||
|
updateTimeout.current = setTimeout(scheduleUpdate, diff);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (view !== calendarViews.AGENDA && view !== calendarViews.MONTH) {
|
||||||
|
scheduleUpdate();
|
||||||
|
}
|
||||||
|
}, [view, scheduleUpdate]);
|
||||||
|
|
||||||
|
if (view === calendarViews.AGENDA) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={styles.daysOfWeek}>
|
||||||
|
{dates.map((date) => {
|
||||||
|
return (
|
||||||
|
<DayOfWeek
|
||||||
|
key={date}
|
||||||
|
date={date}
|
||||||
|
view={view}
|
||||||
|
isTodaysDate={date === todaysDate}
|
||||||
|
calendarWeekColumnHeader={calendarWeekColumnHeader}
|
||||||
|
shortDateFormat={shortDateFormat}
|
||||||
|
showRelativeDates={showRelativeDates}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default DaysOfWeek;
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
import { connect } from 'react-redux';
|
|
||||||
import { createSelector } from 'reselect';
|
|
||||||
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
|
||||||
import DaysOfWeek from './DaysOfWeek';
|
|
||||||
|
|
||||||
function createMapStateToProps() {
|
|
||||||
return createSelector(
|
|
||||||
(state) => state.calendar,
|
|
||||||
createUISettingsSelector(),
|
|
||||||
(calendar, UiSettings) => {
|
|
||||||
return {
|
|
||||||
dates: calendar.dates.slice(0, 7),
|
|
||||||
view: calendar.view,
|
|
||||||
calendarWeekColumnHeader: UiSettings.calendarWeekColumnHeader,
|
|
||||||
shortDateFormat: UiSettings.shortDateFormat,
|
|
||||||
showRelativeDates: UiSettings.showRelativeDates
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default connect(createMapStateToProps)(DaysOfWeek);
|
|
||||||
|
|
@ -1,267 +0,0 @@
|
||||||
import classNames from 'classnames';
|
|
||||||
import moment from 'moment';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import getStatusStyle from 'Calendar/getStatusStyle';
|
|
||||||
import Icon from 'Components/Icon';
|
|
||||||
import Link from 'Components/Link/Link';
|
|
||||||
import EpisodeDetailsModal from 'Episode/EpisodeDetailsModal';
|
|
||||||
import episodeEntities from 'Episode/episodeEntities';
|
|
||||||
import getFinaleTypeName from 'Episode/getFinaleTypeName';
|
|
||||||
import { icons, kinds } from 'Helpers/Props';
|
|
||||||
import formatTime from 'Utilities/Date/formatTime';
|
|
||||||
import padNumber from 'Utilities/Number/padNumber';
|
|
||||||
import translate from 'Utilities/String/translate';
|
|
||||||
import CalendarEventQueueDetails from './CalendarEventQueueDetails';
|
|
||||||
import styles from './CalendarEvent.css';
|
|
||||||
|
|
||||||
class CalendarEvent extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Lifecycle
|
|
||||||
|
|
||||||
constructor(props, context) {
|
|
||||||
super(props, context);
|
|
||||||
|
|
||||||
this.state = {
|
|
||||||
isDetailsModalOpen: false
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Listeners
|
|
||||||
|
|
||||||
onPress = () => {
|
|
||||||
this.setState({ isDetailsModalOpen: true }, () => {
|
|
||||||
this.props.onEventModalOpenToggle(true);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
onDetailsModalClose = () => {
|
|
||||||
this.setState({ isDetailsModalOpen: false }, () => {
|
|
||||||
this.props.onEventModalOpenToggle(false);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const {
|
|
||||||
id,
|
|
||||||
series,
|
|
||||||
episodeFile,
|
|
||||||
title,
|
|
||||||
seasonNumber,
|
|
||||||
episodeNumber,
|
|
||||||
absoluteEpisodeNumber,
|
|
||||||
airDateUtc,
|
|
||||||
monitored,
|
|
||||||
unverifiedSceneNumbering,
|
|
||||||
finaleType,
|
|
||||||
hasFile,
|
|
||||||
grabbed,
|
|
||||||
queueItem,
|
|
||||||
showEpisodeInformation,
|
|
||||||
showFinaleIcon,
|
|
||||||
showSpecialIcon,
|
|
||||||
showCutoffUnmetIcon,
|
|
||||||
fullColorEvents,
|
|
||||||
timeFormat,
|
|
||||||
colorImpairedMode
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
if (!series) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const startTime = moment(airDateUtc);
|
|
||||||
const endTime = moment(airDateUtc).add(series.runtime, 'minutes');
|
|
||||||
const isDownloading = !!(queueItem || grabbed);
|
|
||||||
const isMonitored = series.monitored && monitored;
|
|
||||||
const statusStyle = getStatusStyle(hasFile, isDownloading, startTime, endTime, isMonitored);
|
|
||||||
const missingAbsoluteNumber = series.seriesType === 'anime' && seasonNumber > 0 && !absoluteEpisodeNumber;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
className={classNames(
|
|
||||||
styles.event,
|
|
||||||
styles[statusStyle],
|
|
||||||
colorImpairedMode && 'colorImpaired',
|
|
||||||
fullColorEvents && 'fullColor'
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
<Link
|
|
||||||
className={styles.underlay}
|
|
||||||
onPress={this.onPress}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<div className={styles.overlay} >
|
|
||||||
<div className={styles.info}>
|
|
||||||
<div className={styles.seriesTitle}>
|
|
||||||
{series.title}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div
|
|
||||||
className={classNames(
|
|
||||||
styles.statusContainer,
|
|
||||||
fullColorEvents && 'fullColor'
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
{
|
|
||||||
missingAbsoluteNumber ?
|
|
||||||
<Icon
|
|
||||||
className={styles.statusIcon}
|
|
||||||
name={icons.WARNING}
|
|
||||||
title={translate('EpisodeMissingAbsoluteNumber')}
|
|
||||||
/> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
unverifiedSceneNumbering && !missingAbsoluteNumber ?
|
|
||||||
<Icon
|
|
||||||
className={styles.statusIcon}
|
|
||||||
name={icons.WARNING}
|
|
||||||
title={translate('SceneNumberNotVerified')}
|
|
||||||
/> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
queueItem ?
|
|
||||||
<span className={styles.statusIcon}>
|
|
||||||
<CalendarEventQueueDetails
|
|
||||||
{...queueItem}
|
|
||||||
fullColorEvents={fullColorEvents}
|
|
||||||
/>
|
|
||||||
</span> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
!queueItem && grabbed ?
|
|
||||||
<Icon
|
|
||||||
className={styles.statusIcon}
|
|
||||||
name={icons.DOWNLOADING}
|
|
||||||
title={translate('EpisodeIsDownloading')}
|
|
||||||
/> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
showCutoffUnmetIcon &&
|
|
||||||
!!episodeFile &&
|
|
||||||
episodeFile.qualityCutoffNotMet ?
|
|
||||||
<Icon
|
|
||||||
className={styles.statusIcon}
|
|
||||||
name={icons.EPISODE_FILE}
|
|
||||||
kind={kinds.WARNING}
|
|
||||||
title={translate('QualityCutoffNotMet')}
|
|
||||||
/> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
episodeNumber === 1 && seasonNumber > 0 ?
|
|
||||||
<Icon
|
|
||||||
className={styles.statusIcon}
|
|
||||||
name={icons.PREMIERE}
|
|
||||||
kind={kinds.INFO}
|
|
||||||
title={seasonNumber === 1 ? translate('SeriesPremiere') : translate('SeasonPremiere')}
|
|
||||||
/> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
showFinaleIcon &&
|
|
||||||
finaleType ?
|
|
||||||
<Icon
|
|
||||||
className={styles.statusIcon}
|
|
||||||
name={finaleType === 'series' ? icons.FINALE_SERIES : icons.FINALE_SEASON}
|
|
||||||
kind={finaleType === 'series' ? kinds.DANGER : kinds.WARNING}
|
|
||||||
title={getFinaleTypeName(finaleType)}
|
|
||||||
/> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
showSpecialIcon &&
|
|
||||||
(episodeNumber === 0 || seasonNumber === 0) ?
|
|
||||||
<Icon
|
|
||||||
className={styles.statusIcon}
|
|
||||||
name={icons.INFO}
|
|
||||||
kind={kinds.PINK}
|
|
||||||
title={translate('Special')}
|
|
||||||
/> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{
|
|
||||||
showEpisodeInformation ?
|
|
||||||
<div className={styles.episodeInfo}>
|
|
||||||
<div className={styles.episodeTitle}>
|
|
||||||
{title}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
{seasonNumber}x{padNumber(episodeNumber, 2)}
|
|
||||||
|
|
||||||
{
|
|
||||||
series.seriesType === 'anime' && absoluteEpisodeNumber ?
|
|
||||||
<span className={styles.absoluteEpisodeNumber}>({absoluteEpisodeNumber})</span> : null
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
|
|
||||||
<div className={styles.airTime}>
|
|
||||||
{formatTime(airDateUtc, timeFormat)} - {formatTime(endTime.toISOString(), timeFormat, { includeMinuteZero: true })}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<EpisodeDetailsModal
|
|
||||||
isOpen={this.state.isDetailsModalOpen}
|
|
||||||
episodeId={id}
|
|
||||||
episodeEntity={episodeEntities.CALENDAR}
|
|
||||||
seriesId={series.id}
|
|
||||||
episodeTitle={title}
|
|
||||||
showOpenSeriesButton={true}
|
|
||||||
onModalClose={this.onDetailsModalClose}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CalendarEvent.propTypes = {
|
|
||||||
id: PropTypes.number.isRequired,
|
|
||||||
episodeId: PropTypes.number.isRequired,
|
|
||||||
series: PropTypes.object.isRequired,
|
|
||||||
episodeFile: PropTypes.object,
|
|
||||||
title: PropTypes.string.isRequired,
|
|
||||||
seasonNumber: PropTypes.number.isRequired,
|
|
||||||
episodeNumber: PropTypes.number.isRequired,
|
|
||||||
absoluteEpisodeNumber: PropTypes.number,
|
|
||||||
airDateUtc: PropTypes.string.isRequired,
|
|
||||||
monitored: PropTypes.bool.isRequired,
|
|
||||||
unverifiedSceneNumbering: PropTypes.bool,
|
|
||||||
finaleType: PropTypes.string,
|
|
||||||
hasFile: PropTypes.bool.isRequired,
|
|
||||||
grabbed: PropTypes.bool,
|
|
||||||
queueItem: PropTypes.object,
|
|
||||||
// These props come from the connector, not marked as required to appease TS for now.
|
|
||||||
showEpisodeInformation: PropTypes.bool,
|
|
||||||
showFinaleIcon: PropTypes.bool,
|
|
||||||
showSpecialIcon: PropTypes.bool,
|
|
||||||
showCutoffUnmetIcon: PropTypes.bool,
|
|
||||||
fullColorEvents: PropTypes.bool,
|
|
||||||
timeFormat: PropTypes.string,
|
|
||||||
colorImpairedMode: PropTypes.bool,
|
|
||||||
onEventModalOpenToggle: PropTypes.func
|
|
||||||
};
|
|
||||||
|
|
||||||
export default CalendarEvent;
|
|
||||||
240
frontend/src/Calendar/Events/CalendarEvent.tsx
Normal file
240
frontend/src/Calendar/Events/CalendarEvent.tsx
Normal file
|
|
@ -0,0 +1,240 @@
|
||||||
|
import classNames from 'classnames';
|
||||||
|
import moment from 'moment';
|
||||||
|
import React, { useCallback, useState } from 'react';
|
||||||
|
import { useSelector } from 'react-redux';
|
||||||
|
import AppState from 'App/State/AppState';
|
||||||
|
import getStatusStyle from 'Calendar/getStatusStyle';
|
||||||
|
import Icon from 'Components/Icon';
|
||||||
|
import Link from 'Components/Link/Link';
|
||||||
|
import EpisodeDetailsModal from 'Episode/EpisodeDetailsModal';
|
||||||
|
import episodeEntities from 'Episode/episodeEntities';
|
||||||
|
import getFinaleTypeName from 'Episode/getFinaleTypeName';
|
||||||
|
import useEpisodeFile from 'EpisodeFile/useEpisodeFile';
|
||||||
|
import { icons, kinds } from 'Helpers/Props';
|
||||||
|
import useSeries from 'Series/useSeries';
|
||||||
|
import { createQueueItemSelectorForHook } from 'Store/Selectors/createQueueItemSelector';
|
||||||
|
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
||||||
|
import formatTime from 'Utilities/Date/formatTime';
|
||||||
|
import padNumber from 'Utilities/Number/padNumber';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
|
import CalendarEventQueueDetails from './CalendarEventQueueDetails';
|
||||||
|
import styles from './CalendarEvent.css';
|
||||||
|
|
||||||
|
interface CalendarEventProps {
|
||||||
|
id: number;
|
||||||
|
episodeId: number;
|
||||||
|
seriesId: number;
|
||||||
|
episodeFileId?: number;
|
||||||
|
title: string;
|
||||||
|
seasonNumber: number;
|
||||||
|
episodeNumber: number;
|
||||||
|
absoluteEpisodeNumber?: number;
|
||||||
|
airDateUtc: string;
|
||||||
|
monitored: boolean;
|
||||||
|
unverifiedSceneNumbering?: boolean;
|
||||||
|
finaleType?: string;
|
||||||
|
hasFile: boolean;
|
||||||
|
grabbed?: boolean;
|
||||||
|
onEventModalOpenToggle: (isOpen: boolean) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function CalendarEvent(props: CalendarEventProps) {
|
||||||
|
const {
|
||||||
|
id,
|
||||||
|
seriesId,
|
||||||
|
episodeFileId,
|
||||||
|
title,
|
||||||
|
seasonNumber,
|
||||||
|
episodeNumber,
|
||||||
|
absoluteEpisodeNumber,
|
||||||
|
airDateUtc,
|
||||||
|
monitored,
|
||||||
|
unverifiedSceneNumbering,
|
||||||
|
finaleType,
|
||||||
|
hasFile,
|
||||||
|
grabbed,
|
||||||
|
onEventModalOpenToggle,
|
||||||
|
} = props;
|
||||||
|
|
||||||
|
const series = useSeries(seriesId);
|
||||||
|
const episodeFile = useEpisodeFile(episodeFileId);
|
||||||
|
const queueItem = useSelector(createQueueItemSelectorForHook(id));
|
||||||
|
|
||||||
|
const { timeFormat, enableColorImpairedMode } = useSelector(
|
||||||
|
createUISettingsSelector()
|
||||||
|
);
|
||||||
|
|
||||||
|
const {
|
||||||
|
showEpisodeInformation,
|
||||||
|
showFinaleIcon,
|
||||||
|
showSpecialIcon,
|
||||||
|
showCutoffUnmetIcon,
|
||||||
|
fullColorEvents,
|
||||||
|
} = useSelector((state: AppState) => state.calendar.options);
|
||||||
|
|
||||||
|
const [isDetailsModalOpen, setIsDetailsModalOpen] = useState(false);
|
||||||
|
|
||||||
|
const handlePress = useCallback(() => {
|
||||||
|
setIsDetailsModalOpen(true);
|
||||||
|
onEventModalOpenToggle(true);
|
||||||
|
}, [onEventModalOpenToggle]);
|
||||||
|
|
||||||
|
const handleDetailsModalClose = useCallback(() => {
|
||||||
|
setIsDetailsModalOpen(false);
|
||||||
|
onEventModalOpenToggle(false);
|
||||||
|
}, [onEventModalOpenToggle]);
|
||||||
|
|
||||||
|
if (!series) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const startTime = moment(airDateUtc);
|
||||||
|
const endTime = moment(airDateUtc).add(series.runtime, 'minutes');
|
||||||
|
const isDownloading = !!(queueItem || grabbed);
|
||||||
|
const isMonitored = series.monitored && monitored;
|
||||||
|
const statusStyle = getStatusStyle(
|
||||||
|
hasFile,
|
||||||
|
isDownloading,
|
||||||
|
startTime,
|
||||||
|
endTime,
|
||||||
|
isMonitored
|
||||||
|
);
|
||||||
|
const missingAbsoluteNumber =
|
||||||
|
series.seriesType === 'anime' && seasonNumber > 0 && !absoluteEpisodeNumber;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={classNames(
|
||||||
|
styles.event,
|
||||||
|
styles[statusStyle],
|
||||||
|
enableColorImpairedMode && 'colorImpaired',
|
||||||
|
fullColorEvents && 'fullColor'
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<Link className={styles.underlay} onPress={handlePress} />
|
||||||
|
|
||||||
|
<div className={styles.overlay}>
|
||||||
|
<div className={styles.info}>
|
||||||
|
<div className={styles.seriesTitle}>{series.title}</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
className={classNames(
|
||||||
|
styles.statusContainer,
|
||||||
|
fullColorEvents && 'fullColor'
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{missingAbsoluteNumber ? (
|
||||||
|
<Icon
|
||||||
|
className={styles.statusIcon}
|
||||||
|
name={icons.WARNING}
|
||||||
|
title={translate('EpisodeMissingAbsoluteNumber')}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{unverifiedSceneNumbering && !missingAbsoluteNumber ? (
|
||||||
|
<Icon
|
||||||
|
className={styles.statusIcon}
|
||||||
|
name={icons.WARNING}
|
||||||
|
title={translate('SceneNumberNotVerified')}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{queueItem ? (
|
||||||
|
<span className={styles.statusIcon}>
|
||||||
|
<CalendarEventQueueDetails {...queueItem} />
|
||||||
|
</span>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{!queueItem && grabbed ? (
|
||||||
|
<Icon
|
||||||
|
className={styles.statusIcon}
|
||||||
|
name={icons.DOWNLOADING}
|
||||||
|
title={translate('EpisodeIsDownloading')}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{showCutoffUnmetIcon &&
|
||||||
|
!!episodeFile &&
|
||||||
|
episodeFile.qualityCutoffNotMet ? (
|
||||||
|
<Icon
|
||||||
|
className={styles.statusIcon}
|
||||||
|
name={icons.EPISODE_FILE}
|
||||||
|
kind={kinds.WARNING}
|
||||||
|
title={translate('QualityCutoffNotMet')}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{episodeNumber === 1 && seasonNumber > 0 ? (
|
||||||
|
<Icon
|
||||||
|
className={styles.statusIcon}
|
||||||
|
name={icons.PREMIERE}
|
||||||
|
kind={kinds.INFO}
|
||||||
|
title={
|
||||||
|
seasonNumber === 1
|
||||||
|
? translate('SeriesPremiere')
|
||||||
|
: translate('SeasonPremiere')
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{showFinaleIcon && finaleType ? (
|
||||||
|
<Icon
|
||||||
|
className={styles.statusIcon}
|
||||||
|
name={
|
||||||
|
finaleType === 'series'
|
||||||
|
? icons.FINALE_SERIES
|
||||||
|
: icons.FINALE_SEASON
|
||||||
|
}
|
||||||
|
kind={finaleType === 'series' ? kinds.DANGER : kinds.WARNING}
|
||||||
|
title={getFinaleTypeName(finaleType)}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{showSpecialIcon && (episodeNumber === 0 || seasonNumber === 0) ? (
|
||||||
|
<Icon
|
||||||
|
className={styles.statusIcon}
|
||||||
|
name={icons.INFO}
|
||||||
|
kind={kinds.PINK}
|
||||||
|
title={translate('Special')}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{showEpisodeInformation ? (
|
||||||
|
<div className={styles.episodeInfo}>
|
||||||
|
<div className={styles.episodeTitle}>{title}</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
{seasonNumber}x{padNumber(episodeNumber, 2)}
|
||||||
|
{series.seriesType === 'anime' && absoluteEpisodeNumber ? (
|
||||||
|
<span className={styles.absoluteEpisodeNumber}>
|
||||||
|
({absoluteEpisodeNumber})
|
||||||
|
</span>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
<div className={styles.airTime}>
|
||||||
|
{formatTime(airDateUtc, timeFormat)} -{' '}
|
||||||
|
{formatTime(endTime.toISOString(), timeFormat, {
|
||||||
|
includeMinuteZero: true,
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<EpisodeDetailsModal
|
||||||
|
isOpen={isDetailsModalOpen}
|
||||||
|
episodeId={id}
|
||||||
|
episodeEntity={episodeEntities.CALENDAR}
|
||||||
|
seriesId={series.id}
|
||||||
|
episodeTitle={title}
|
||||||
|
showOpenSeriesButton={true}
|
||||||
|
onModalClose={handleDetailsModalClose}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default CalendarEvent;
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
import { connect } from 'react-redux';
|
|
||||||
import { createSelector } from 'reselect';
|
|
||||||
import createEpisodeFileSelector from 'Store/Selectors/createEpisodeFileSelector';
|
|
||||||
import createQueueItemSelector from 'Store/Selectors/createQueueItemSelector';
|
|
||||||
import createSeriesSelector from 'Store/Selectors/createSeriesSelector';
|
|
||||||
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
|
||||||
import CalendarEvent from './CalendarEvent';
|
|
||||||
|
|
||||||
function createMapStateToProps() {
|
|
||||||
return createSelector(
|
|
||||||
(state) => state.calendar.options,
|
|
||||||
createSeriesSelector(),
|
|
||||||
createEpisodeFileSelector(),
|
|
||||||
createQueueItemSelector(),
|
|
||||||
createUISettingsSelector(),
|
|
||||||
(calendarOptions, series, episodeFile, queueItem, uiSettings) => {
|
|
||||||
return {
|
|
||||||
series,
|
|
||||||
episodeFile,
|
|
||||||
queueItem,
|
|
||||||
...calendarOptions,
|
|
||||||
timeFormat: uiSettings.timeFormat,
|
|
||||||
colorImpairedMode: uiSettings.enableColorImpairedMode
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default connect(createMapStateToProps)(CalendarEvent);
|
|
||||||
|
|
@ -1,259 +0,0 @@
|
||||||
import classNames from 'classnames';
|
|
||||||
import moment from 'moment';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import CalendarEventConnector from 'Calendar/Events/CalendarEventConnector';
|
|
||||||
import getStatusStyle from 'Calendar/getStatusStyle';
|
|
||||||
import Icon from 'Components/Icon';
|
|
||||||
import Link from 'Components/Link/Link';
|
|
||||||
import getFinaleTypeName from 'Episode/getFinaleTypeName';
|
|
||||||
import { icons, kinds } from 'Helpers/Props';
|
|
||||||
import formatTime from 'Utilities/Date/formatTime';
|
|
||||||
import padNumber from 'Utilities/Number/padNumber';
|
|
||||||
import translate from 'Utilities/String/translate';
|
|
||||||
import styles from './CalendarEventGroup.css';
|
|
||||||
|
|
||||||
function getEventsInfo(series, events) {
|
|
||||||
let files = 0;
|
|
||||||
let queued = 0;
|
|
||||||
let monitored = 0;
|
|
||||||
let absoluteEpisodeNumbers = 0;
|
|
||||||
|
|
||||||
events.forEach((event) => {
|
|
||||||
if (event.episodeFileId) {
|
|
||||||
files++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.queued) {
|
|
||||||
queued++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (series.monitored && event.monitored) {
|
|
||||||
monitored++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.absoluteEpisodeNumber) {
|
|
||||||
absoluteEpisodeNumbers++;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return {
|
|
||||||
allDownloaded: files === events.length,
|
|
||||||
anyQueued: queued > 0,
|
|
||||||
anyMonitored: monitored > 0,
|
|
||||||
allAbsoluteEpisodeNumbers: absoluteEpisodeNumbers === events.length
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
class CalendarEventGroup extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Lifecycle
|
|
||||||
|
|
||||||
constructor(props, context) {
|
|
||||||
super(props, context);
|
|
||||||
|
|
||||||
this.state = {
|
|
||||||
isExpanded: false
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Listeners
|
|
||||||
|
|
||||||
onExpandPress = () => {
|
|
||||||
this.setState({ isExpanded: !this.state.isExpanded });
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const {
|
|
||||||
series,
|
|
||||||
events,
|
|
||||||
isDownloading,
|
|
||||||
showEpisodeInformation,
|
|
||||||
showFinaleIcon,
|
|
||||||
timeFormat,
|
|
||||||
fullColorEvents,
|
|
||||||
colorImpairedMode,
|
|
||||||
onEventModalOpenToggle
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
const { isExpanded } = this.state;
|
|
||||||
const {
|
|
||||||
allDownloaded,
|
|
||||||
anyQueued,
|
|
||||||
anyMonitored,
|
|
||||||
allAbsoluteEpisodeNumbers
|
|
||||||
} = getEventsInfo(series, events);
|
|
||||||
const anyDownloading = isDownloading || anyQueued;
|
|
||||||
const firstEpisode = events[0];
|
|
||||||
const lastEpisode = events[events.length -1];
|
|
||||||
const airDateUtc = firstEpisode.airDateUtc;
|
|
||||||
const startTime = moment(airDateUtc);
|
|
||||||
const endTime = moment(lastEpisode.airDateUtc).add(series.runtime, 'minutes');
|
|
||||||
const seasonNumber = firstEpisode.seasonNumber;
|
|
||||||
const statusStyle = getStatusStyle(allDownloaded, anyDownloading, startTime, endTime, anyMonitored);
|
|
||||||
const isMissingAbsoluteNumber = series.seriesType === 'anime' && seasonNumber > 0 && !allAbsoluteEpisodeNumbers;
|
|
||||||
|
|
||||||
if (isExpanded) {
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
{
|
|
||||||
events.map((event) => {
|
|
||||||
if (event.isGroup) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<CalendarEventConnector
|
|
||||||
key={event.id}
|
|
||||||
episodeId={event.id}
|
|
||||||
{...event}
|
|
||||||
onEventModalOpenToggle={onEventModalOpenToggle}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
<Link
|
|
||||||
className={styles.collapseContainer}
|
|
||||||
component="div"
|
|
||||||
onPress={this.onExpandPress}
|
|
||||||
>
|
|
||||||
<Icon
|
|
||||||
name={icons.COLLAPSE}
|
|
||||||
/>
|
|
||||||
</Link>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
className={classNames(
|
|
||||||
styles.eventGroup,
|
|
||||||
styles[statusStyle],
|
|
||||||
colorImpairedMode && 'colorImpaired',
|
|
||||||
fullColorEvents && 'fullColor'
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
<div className={styles.info}>
|
|
||||||
<div className={styles.seriesTitle}>
|
|
||||||
{series.title}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div
|
|
||||||
className={classNames(
|
|
||||||
styles.statusContainer,
|
|
||||||
fullColorEvents && 'fullColor'
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
{
|
|
||||||
isMissingAbsoluteNumber &&
|
|
||||||
<Icon
|
|
||||||
containerClassName={styles.statusIcon}
|
|
||||||
name={icons.WARNING}
|
|
||||||
title={translate('EpisodeMissingAbsoluteNumber')}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
anyDownloading &&
|
|
||||||
<Icon
|
|
||||||
containerClassName={styles.statusIcon}
|
|
||||||
name={icons.DOWNLOADING}
|
|
||||||
title={translate('AnEpisodeIsDownloading')}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
firstEpisode.episodeNumber === 1 && seasonNumber > 0 &&
|
|
||||||
<Icon
|
|
||||||
containerClassName={styles.statusIcon}
|
|
||||||
name={icons.PREMIERE}
|
|
||||||
kind={kinds.INFO}
|
|
||||||
title={seasonNumber === 1 ? translate('SeriesPremiere') : translate('SeasonPremiere')}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
showFinaleIcon &&
|
|
||||||
lastEpisode.finaleType ?
|
|
||||||
<Icon
|
|
||||||
containerClassName={styles.statusIcon}
|
|
||||||
name={lastEpisode.finaleType === 'series' ? icons.FINALE_SERIES : icons.FINALE_SEASON}
|
|
||||||
kind={lastEpisode.finaleType === 'series' ? kinds.DANGER : kinds.WARNING}
|
|
||||||
title={getFinaleTypeName(lastEpisode.finaleType)}
|
|
||||||
/> : null
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className={styles.airingInfo}>
|
|
||||||
<div className={styles.airTime}>
|
|
||||||
{formatTime(airDateUtc, timeFormat)} - {formatTime(endTime.toISOString(), timeFormat, { includeMinuteZero: true })}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{
|
|
||||||
showEpisodeInformation ?
|
|
||||||
<div className={styles.episodeInfo}>
|
|
||||||
{seasonNumber}x{padNumber(firstEpisode.episodeNumber, 2)}-{padNumber(lastEpisode.episodeNumber, 2)}
|
|
||||||
|
|
||||||
{
|
|
||||||
series.seriesType === 'anime' &&
|
|
||||||
firstEpisode.absoluteEpisodeNumber &&
|
|
||||||
lastEpisode.absoluteEpisodeNumber &&
|
|
||||||
<span className={styles.absoluteEpisodeNumber}>
|
|
||||||
({firstEpisode.absoluteEpisodeNumber}-{lastEpisode.absoluteEpisodeNumber})
|
|
||||||
</span>
|
|
||||||
}
|
|
||||||
</div> :
|
|
||||||
<Link
|
|
||||||
className={styles.expandContainerInline}
|
|
||||||
component="div"
|
|
||||||
onPress={this.onExpandPress}
|
|
||||||
>
|
|
||||||
<Icon
|
|
||||||
name={icons.EXPAND}
|
|
||||||
/>
|
|
||||||
</Link>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{
|
|
||||||
showEpisodeInformation ?
|
|
||||||
<Link
|
|
||||||
className={styles.expandContainer}
|
|
||||||
component="div"
|
|
||||||
onPress={this.onExpandPress}
|
|
||||||
>
|
|
||||||
|
|
||||||
<Icon
|
|
||||||
name={icons.EXPAND}
|
|
||||||
/>
|
|
||||||
|
|
||||||
</Link> :
|
|
||||||
null
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CalendarEventGroup.propTypes = {
|
|
||||||
// Most of these props come from the connector and are required, but TS is confused.
|
|
||||||
series: PropTypes.object,
|
|
||||||
events: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
||||||
isDownloading: PropTypes.bool,
|
|
||||||
showEpisodeInformation: PropTypes.bool,
|
|
||||||
showFinaleIcon: PropTypes.bool,
|
|
||||||
fullColorEvents: PropTypes.bool,
|
|
||||||
timeFormat: PropTypes.string,
|
|
||||||
colorImpairedMode: PropTypes.bool,
|
|
||||||
onEventModalOpenToggle: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default CalendarEventGroup;
|
|
||||||
253
frontend/src/Calendar/Events/CalendarEventGroup.tsx
Normal file
253
frontend/src/Calendar/Events/CalendarEventGroup.tsx
Normal file
|
|
@ -0,0 +1,253 @@
|
||||||
|
import classNames from 'classnames';
|
||||||
|
import moment from 'moment';
|
||||||
|
import React, { useCallback, useMemo, useState } from 'react';
|
||||||
|
import { useSelector } from 'react-redux';
|
||||||
|
import { createSelector } from 'reselect';
|
||||||
|
import AppState from 'App/State/AppState';
|
||||||
|
import getStatusStyle from 'Calendar/getStatusStyle';
|
||||||
|
import Icon from 'Components/Icon';
|
||||||
|
import Link from 'Components/Link/Link';
|
||||||
|
import getFinaleTypeName from 'Episode/getFinaleTypeName';
|
||||||
|
import { icons, kinds } from 'Helpers/Props';
|
||||||
|
import useSeries from 'Series/useSeries';
|
||||||
|
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
||||||
|
import { CalendarItem } from 'typings/Calendar';
|
||||||
|
import formatTime from 'Utilities/Date/formatTime';
|
||||||
|
import padNumber from 'Utilities/Number/padNumber';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
|
import CalendarEvent from './CalendarEvent';
|
||||||
|
import styles from './CalendarEventGroup.css';
|
||||||
|
|
||||||
|
function createIsDownloadingSelector(episodeIds: number[]) {
|
||||||
|
return createSelector(
|
||||||
|
(state: AppState) => state.queue.details,
|
||||||
|
(details) => {
|
||||||
|
return details.items.some((item) => {
|
||||||
|
return !!(item.episodeId && episodeIds.includes(item.episodeId));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
interface CalendarEventGroupProps {
|
||||||
|
episodeIds: number[];
|
||||||
|
seriesId: number;
|
||||||
|
events: CalendarItem[];
|
||||||
|
onEventModalOpenToggle: (isOpen: boolean) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function CalendarEventGroup({
|
||||||
|
episodeIds,
|
||||||
|
seriesId,
|
||||||
|
events,
|
||||||
|
onEventModalOpenToggle,
|
||||||
|
}: CalendarEventGroupProps) {
|
||||||
|
const isDownloading = useSelector(createIsDownloadingSelector(episodeIds));
|
||||||
|
const series = useSeries(seriesId)!;
|
||||||
|
|
||||||
|
const { timeFormat, enableColorImpairedMode } = useSelector(
|
||||||
|
createUISettingsSelector()
|
||||||
|
);
|
||||||
|
|
||||||
|
const { showEpisodeInformation, showFinaleIcon, fullColorEvents } =
|
||||||
|
useSelector((state: AppState) => state.calendar.options);
|
||||||
|
|
||||||
|
const [isExpanded, setIsExpanded] = useState(false);
|
||||||
|
|
||||||
|
const firstEpisode = events[0];
|
||||||
|
const lastEpisode = events[events.length - 1];
|
||||||
|
const airDateUtc = firstEpisode.airDateUtc;
|
||||||
|
const startTime = moment(airDateUtc);
|
||||||
|
const endTime = moment(lastEpisode.airDateUtc).add(series.runtime, 'minutes');
|
||||||
|
const seasonNumber = firstEpisode.seasonNumber;
|
||||||
|
|
||||||
|
const { allDownloaded, anyQueued, anyMonitored, allAbsoluteEpisodeNumbers } =
|
||||||
|
useMemo(() => {
|
||||||
|
let files = 0;
|
||||||
|
let queued = 0;
|
||||||
|
let monitored = 0;
|
||||||
|
let absoluteEpisodeNumbers = 0;
|
||||||
|
|
||||||
|
events.forEach((event) => {
|
||||||
|
if (event.episodeFileId) {
|
||||||
|
files++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.queued) {
|
||||||
|
queued++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (series.monitored && event.monitored) {
|
||||||
|
monitored++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.absoluteEpisodeNumber) {
|
||||||
|
absoluteEpisodeNumbers++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
allDownloaded: files === events.length,
|
||||||
|
anyQueued: queued > 0,
|
||||||
|
anyMonitored: monitored > 0,
|
||||||
|
allAbsoluteEpisodeNumbers: absoluteEpisodeNumbers === events.length,
|
||||||
|
};
|
||||||
|
}, [series, events]);
|
||||||
|
|
||||||
|
const anyDownloading = isDownloading || anyQueued;
|
||||||
|
|
||||||
|
const statusStyle = getStatusStyle(
|
||||||
|
allDownloaded,
|
||||||
|
anyDownloading,
|
||||||
|
startTime,
|
||||||
|
endTime,
|
||||||
|
anyMonitored
|
||||||
|
);
|
||||||
|
const isMissingAbsoluteNumber =
|
||||||
|
series.seriesType === 'anime' &&
|
||||||
|
seasonNumber > 0 &&
|
||||||
|
!allAbsoluteEpisodeNumbers;
|
||||||
|
|
||||||
|
const handleExpandPress = useCallback(() => {
|
||||||
|
setIsExpanded((state) => !state);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
if (isExpanded) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{events.map((event) => {
|
||||||
|
return (
|
||||||
|
<CalendarEvent
|
||||||
|
key={event.id}
|
||||||
|
episodeId={event.id}
|
||||||
|
{...event}
|
||||||
|
onEventModalOpenToggle={onEventModalOpenToggle}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
|
||||||
|
<Link
|
||||||
|
className={styles.collapseContainer}
|
||||||
|
component="div"
|
||||||
|
onPress={handleExpandPress}
|
||||||
|
>
|
||||||
|
<Icon name={icons.COLLAPSE} />
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={classNames(
|
||||||
|
styles.eventGroup,
|
||||||
|
styles[statusStyle],
|
||||||
|
enableColorImpairedMode && 'colorImpaired',
|
||||||
|
fullColorEvents && 'fullColor'
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<div className={styles.info}>
|
||||||
|
<div className={styles.seriesTitle}>{series.title}</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
className={classNames(
|
||||||
|
styles.statusContainer,
|
||||||
|
fullColorEvents && 'fullColor'
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{isMissingAbsoluteNumber ? (
|
||||||
|
<Icon
|
||||||
|
containerClassName={styles.statusIcon}
|
||||||
|
name={icons.WARNING}
|
||||||
|
title={translate('EpisodeMissingAbsoluteNumber')}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{anyDownloading ? (
|
||||||
|
<Icon
|
||||||
|
containerClassName={styles.statusIcon}
|
||||||
|
name={icons.DOWNLOADING}
|
||||||
|
title={translate('AnEpisodeIsDownloading')}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{firstEpisode.episodeNumber === 1 && seasonNumber > 0 ? (
|
||||||
|
<Icon
|
||||||
|
containerClassName={styles.statusIcon}
|
||||||
|
name={icons.PREMIERE}
|
||||||
|
kind={kinds.INFO}
|
||||||
|
title={
|
||||||
|
seasonNumber === 1
|
||||||
|
? translate('SeriesPremiere')
|
||||||
|
: translate('SeasonPremiere')
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{showFinaleIcon && lastEpisode.finaleType ? (
|
||||||
|
<Icon
|
||||||
|
containerClassName={styles.statusIcon}
|
||||||
|
name={
|
||||||
|
lastEpisode.finaleType === 'series'
|
||||||
|
? icons.FINALE_SERIES
|
||||||
|
: icons.FINALE_SEASON
|
||||||
|
}
|
||||||
|
kind={
|
||||||
|
lastEpisode.finaleType === 'series'
|
||||||
|
? kinds.DANGER
|
||||||
|
: kinds.WARNING
|
||||||
|
}
|
||||||
|
title={getFinaleTypeName(lastEpisode.finaleType)}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className={styles.airingInfo}>
|
||||||
|
<div className={styles.airTime}>
|
||||||
|
{formatTime(airDateUtc, timeFormat)} -{' '}
|
||||||
|
{formatTime(endTime.toISOString(), timeFormat, {
|
||||||
|
includeMinuteZero: true,
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{showEpisodeInformation ? (
|
||||||
|
<div className={styles.episodeInfo}>
|
||||||
|
{seasonNumber}x{padNumber(firstEpisode.episodeNumber, 2)}-
|
||||||
|
{padNumber(lastEpisode.episodeNumber, 2)}
|
||||||
|
{series.seriesType === 'anime' &&
|
||||||
|
firstEpisode.absoluteEpisodeNumber &&
|
||||||
|
lastEpisode.absoluteEpisodeNumber ? (
|
||||||
|
<span className={styles.absoluteEpisodeNumber}>
|
||||||
|
({firstEpisode.absoluteEpisodeNumber}-
|
||||||
|
{lastEpisode.absoluteEpisodeNumber})
|
||||||
|
</span>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<Link
|
||||||
|
className={styles.expandContainerInline}
|
||||||
|
component="div"
|
||||||
|
onPress={handleExpandPress}
|
||||||
|
>
|
||||||
|
<Icon name={icons.EXPAND} />
|
||||||
|
</Link>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{showEpisodeInformation ? (
|
||||||
|
<Link
|
||||||
|
className={styles.expandContainer}
|
||||||
|
component="div"
|
||||||
|
onPress={handleExpandPress}
|
||||||
|
>
|
||||||
|
|
||||||
|
<Icon name={icons.EXPAND} />
|
||||||
|
|
||||||
|
</Link>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default CalendarEventGroup;
|
||||||
|
|
@ -1,37 +0,0 @@
|
||||||
import { connect } from 'react-redux';
|
|
||||||
import { createSelector } from 'reselect';
|
|
||||||
import createSeriesSelector from 'Store/Selectors/createSeriesSelector';
|
|
||||||
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
|
||||||
import CalendarEventGroup from './CalendarEventGroup';
|
|
||||||
|
|
||||||
function createIsDownloadingSelector() {
|
|
||||||
return createSelector(
|
|
||||||
(state, { episodeIds }) => episodeIds,
|
|
||||||
(state) => state.queue.details,
|
|
||||||
(episodeIds, details) => {
|
|
||||||
return details.items.some((item) => {
|
|
||||||
return !!(item.episodeId && episodeIds.includes(item.episodeId));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function createMapStateToProps() {
|
|
||||||
return createSelector(
|
|
||||||
(state) => state.calendar.options,
|
|
||||||
createSeriesSelector(),
|
|
||||||
createIsDownloadingSelector(),
|
|
||||||
createUISettingsSelector(),
|
|
||||||
(calendarOptions, series, isDownloading, uiSettings) => {
|
|
||||||
return {
|
|
||||||
series,
|
|
||||||
isDownloading,
|
|
||||||
...calendarOptions,
|
|
||||||
timeFormat: uiSettings.timeFormat,
|
|
||||||
colorImpairedMode: uiSettings.enableColorImpairedMode
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default connect(createMapStateToProps)(CalendarEventGroup);
|
|
||||||
|
|
@ -1,56 +0,0 @@
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import React from 'react';
|
|
||||||
import QueueDetails from 'Activity/Queue/QueueDetails';
|
|
||||||
import CircularProgressBar from 'Components/CircularProgressBar';
|
|
||||||
|
|
||||||
function CalendarEventQueueDetails(props) {
|
|
||||||
const {
|
|
||||||
title,
|
|
||||||
size,
|
|
||||||
sizeleft,
|
|
||||||
estimatedCompletionTime,
|
|
||||||
status,
|
|
||||||
trackedDownloadState,
|
|
||||||
trackedDownloadStatus,
|
|
||||||
statusMessages,
|
|
||||||
errorMessage
|
|
||||||
} = props;
|
|
||||||
|
|
||||||
const progress = size ? (100 - sizeleft / size * 100) : 0;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<QueueDetails
|
|
||||||
title={title}
|
|
||||||
size={size}
|
|
||||||
sizeleft={sizeleft}
|
|
||||||
estimatedCompletionTime={estimatedCompletionTime}
|
|
||||||
status={status}
|
|
||||||
trackedDownloadState={trackedDownloadState}
|
|
||||||
trackedDownloadStatus={trackedDownloadStatus}
|
|
||||||
statusMessages={statusMessages}
|
|
||||||
errorMessage={errorMessage}
|
|
||||||
progressBar={
|
|
||||||
<CircularProgressBar
|
|
||||||
progress={progress}
|
|
||||||
size={20}
|
|
||||||
strokeWidth={2}
|
|
||||||
strokeColor={'#7a43b6'}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
CalendarEventQueueDetails.propTypes = {
|
|
||||||
title: PropTypes.string.isRequired,
|
|
||||||
size: PropTypes.number.isRequired,
|
|
||||||
sizeleft: PropTypes.number.isRequired,
|
|
||||||
estimatedCompletionTime: PropTypes.string,
|
|
||||||
status: PropTypes.string.isRequired,
|
|
||||||
trackedDownloadState: PropTypes.string.isRequired,
|
|
||||||
trackedDownloadStatus: PropTypes.string.isRequired,
|
|
||||||
statusMessages: PropTypes.arrayOf(PropTypes.object),
|
|
||||||
errorMessage: PropTypes.string
|
|
||||||
};
|
|
||||||
|
|
||||||
export default CalendarEventQueueDetails;
|
|
||||||
58
frontend/src/Calendar/Events/CalendarEventQueueDetails.tsx
Normal file
58
frontend/src/Calendar/Events/CalendarEventQueueDetails.tsx
Normal file
|
|
@ -0,0 +1,58 @@
|
||||||
|
import React from 'react';
|
||||||
|
import QueueDetails from 'Activity/Queue/QueueDetails';
|
||||||
|
import CircularProgressBar from 'Components/CircularProgressBar';
|
||||||
|
import {
|
||||||
|
QueueTrackedDownloadState,
|
||||||
|
QueueTrackedDownloadStatus,
|
||||||
|
StatusMessage,
|
||||||
|
} from 'typings/Queue';
|
||||||
|
|
||||||
|
interface CalendarEventQueueDetailsProps {
|
||||||
|
title: string;
|
||||||
|
size: number;
|
||||||
|
sizeleft: number;
|
||||||
|
estimatedCompletionTime?: string;
|
||||||
|
status: string;
|
||||||
|
trackedDownloadState: QueueTrackedDownloadState;
|
||||||
|
trackedDownloadStatus: QueueTrackedDownloadStatus;
|
||||||
|
statusMessages?: StatusMessage[];
|
||||||
|
errorMessage?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
function CalendarEventQueueDetails({
|
||||||
|
title,
|
||||||
|
size,
|
||||||
|
sizeleft,
|
||||||
|
estimatedCompletionTime,
|
||||||
|
status,
|
||||||
|
trackedDownloadState,
|
||||||
|
trackedDownloadStatus,
|
||||||
|
statusMessages,
|
||||||
|
errorMessage,
|
||||||
|
}: CalendarEventQueueDetailsProps) {
|
||||||
|
const progress = size ? 100 - (sizeleft / size) * 100 : 0;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<QueueDetails
|
||||||
|
title={title}
|
||||||
|
size={size}
|
||||||
|
sizeleft={sizeleft}
|
||||||
|
estimatedCompletionTime={estimatedCompletionTime}
|
||||||
|
status={status}
|
||||||
|
trackedDownloadState={trackedDownloadState}
|
||||||
|
trackedDownloadStatus={trackedDownloadStatus}
|
||||||
|
statusMessages={statusMessages}
|
||||||
|
errorMessage={errorMessage}
|
||||||
|
progressBar={
|
||||||
|
<CircularProgressBar
|
||||||
|
progress={progress}
|
||||||
|
size={20}
|
||||||
|
strokeWidth={2}
|
||||||
|
strokeColor="#7a43b6"
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default CalendarEventQueueDetails;
|
||||||
|
|
@ -1,268 +0,0 @@
|
||||||
import moment from 'moment';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import * as calendarViews from 'Calendar/calendarViews';
|
|
||||||
import Icon from 'Components/Icon';
|
|
||||||
import Button from 'Components/Link/Button';
|
|
||||||
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
|
||||||
import Menu from 'Components/Menu/Menu';
|
|
||||||
import MenuButton from 'Components/Menu/MenuButton';
|
|
||||||
import MenuContent from 'Components/Menu/MenuContent';
|
|
||||||
import ViewMenuItem from 'Components/Menu/ViewMenuItem';
|
|
||||||
import { align, icons } from 'Helpers/Props';
|
|
||||||
import translate from 'Utilities/String/translate';
|
|
||||||
import CalendarHeaderViewButton from './CalendarHeaderViewButton';
|
|
||||||
import styles from './CalendarHeader.css';
|
|
||||||
|
|
||||||
function getTitle(time, start, end, view, longDateFormat) {
|
|
||||||
const timeMoment = moment(time);
|
|
||||||
const startMoment = moment(start);
|
|
||||||
const endMoment = moment(end);
|
|
||||||
|
|
||||||
if (view === 'day') {
|
|
||||||
return timeMoment.format(longDateFormat);
|
|
||||||
} else if (view === 'month') {
|
|
||||||
return timeMoment.format('MMMM YYYY');
|
|
||||||
} else if (view === 'agenda') {
|
|
||||||
return translate('Agenda');
|
|
||||||
}
|
|
||||||
|
|
||||||
let startFormat = 'MMM D YYYY';
|
|
||||||
let endFormat = 'MMM D YYYY';
|
|
||||||
|
|
||||||
if (startMoment.isSame(endMoment, 'month')) {
|
|
||||||
startFormat = 'MMM D';
|
|
||||||
endFormat = 'D YYYY';
|
|
||||||
} else if (startMoment.isSame(endMoment, 'year')) {
|
|
||||||
startFormat = 'MMM D';
|
|
||||||
endFormat = 'MMM D YYYY';
|
|
||||||
}
|
|
||||||
|
|
||||||
return `${startMoment.format(startFormat)} \u2014 ${endMoment.format(endFormat)}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO Convert to a stateful Component so we can track view internally when changed
|
|
||||||
|
|
||||||
class CalendarHeader extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Lifecycle
|
|
||||||
|
|
||||||
constructor(props, context) {
|
|
||||||
super(props, context);
|
|
||||||
|
|
||||||
this.state = {
|
|
||||||
view: props.view
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidUpdate(prevProps) {
|
|
||||||
const view = this.props.view;
|
|
||||||
|
|
||||||
if (prevProps.view !== view) {
|
|
||||||
this.setState({ view });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Listeners
|
|
||||||
|
|
||||||
onViewChange = (view) => {
|
|
||||||
this.setState({ view }, () => {
|
|
||||||
this.props.onViewChange(view);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const {
|
|
||||||
isFetching,
|
|
||||||
time,
|
|
||||||
start,
|
|
||||||
end,
|
|
||||||
longDateFormat,
|
|
||||||
isSmallScreen,
|
|
||||||
collapseViewButtons,
|
|
||||||
onTodayPress,
|
|
||||||
onPreviousPress,
|
|
||||||
onNextPress
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
const view = this.state.view;
|
|
||||||
|
|
||||||
const title = getTitle(time, start, end, view, longDateFormat);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
{
|
|
||||||
isSmallScreen &&
|
|
||||||
<div className={styles.titleMobile}>
|
|
||||||
{title}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
<div className={styles.header}>
|
|
||||||
<div className={styles.navigationButtons}>
|
|
||||||
<Button
|
|
||||||
buttonGroupPosition={align.LEFT}
|
|
||||||
isDisabled={view === calendarViews.AGENDA}
|
|
||||||
onPress={onPreviousPress}
|
|
||||||
>
|
|
||||||
<Icon name={icons.PAGE_PREVIOUS} />
|
|
||||||
</Button>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
buttonGroupPosition={align.RIGHT}
|
|
||||||
isDisabled={view === calendarViews.AGENDA}
|
|
||||||
onPress={onNextPress}
|
|
||||||
>
|
|
||||||
<Icon name={icons.PAGE_NEXT} />
|
|
||||||
</Button>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
className={styles.todayButton}
|
|
||||||
isDisabled={view === calendarViews.AGENDA}
|
|
||||||
onPress={onTodayPress}
|
|
||||||
>
|
|
||||||
{translate('Today')}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{
|
|
||||||
!isSmallScreen &&
|
|
||||||
<div className={styles.titleDesktop}>
|
|
||||||
{title}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
<div className={styles.viewButtonsContainer}>
|
|
||||||
{
|
|
||||||
isFetching &&
|
|
||||||
<LoadingIndicator
|
|
||||||
className={styles.loading}
|
|
||||||
size={20}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
collapseViewButtons ?
|
|
||||||
<Menu
|
|
||||||
className={styles.viewMenu}
|
|
||||||
alignMenu={align.RIGHT}
|
|
||||||
>
|
|
||||||
<MenuButton>
|
|
||||||
<Icon
|
|
||||||
name={icons.VIEW}
|
|
||||||
size={22}
|
|
||||||
/>
|
|
||||||
</MenuButton>
|
|
||||||
|
|
||||||
<MenuContent>
|
|
||||||
{
|
|
||||||
isSmallScreen ?
|
|
||||||
null :
|
|
||||||
<ViewMenuItem
|
|
||||||
name={calendarViews.MONTH}
|
|
||||||
selectedView={view}
|
|
||||||
onPress={this.onViewChange}
|
|
||||||
>
|
|
||||||
{translate('Month')}
|
|
||||||
</ViewMenuItem>
|
|
||||||
}
|
|
||||||
|
|
||||||
<ViewMenuItem
|
|
||||||
name={calendarViews.WEEK}
|
|
||||||
selectedView={view}
|
|
||||||
onPress={this.onViewChange}
|
|
||||||
>
|
|
||||||
{translate('Week')}
|
|
||||||
</ViewMenuItem>
|
|
||||||
|
|
||||||
<ViewMenuItem
|
|
||||||
name={calendarViews.FORECAST}
|
|
||||||
selectedView={view}
|
|
||||||
onPress={this.onViewChange}
|
|
||||||
>
|
|
||||||
{translate('Forecast')}
|
|
||||||
</ViewMenuItem>
|
|
||||||
|
|
||||||
<ViewMenuItem
|
|
||||||
name={calendarViews.DAY}
|
|
||||||
selectedView={view}
|
|
||||||
onPress={this.onViewChange}
|
|
||||||
>
|
|
||||||
{translate('Day')}
|
|
||||||
</ViewMenuItem>
|
|
||||||
|
|
||||||
<ViewMenuItem
|
|
||||||
name={calendarViews.AGENDA}
|
|
||||||
selectedView={view}
|
|
||||||
onPress={this.onViewChange}
|
|
||||||
>
|
|
||||||
{translate('Agenda')}
|
|
||||||
</ViewMenuItem>
|
|
||||||
</MenuContent>
|
|
||||||
</Menu> :
|
|
||||||
|
|
||||||
<div className={styles.viewButtons}>
|
|
||||||
<CalendarHeaderViewButton
|
|
||||||
view={calendarViews.MONTH}
|
|
||||||
selectedView={view}
|
|
||||||
buttonGroupPosition={align.LEFT}
|
|
||||||
onPress={this.onViewChange}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<CalendarHeaderViewButton
|
|
||||||
view={calendarViews.WEEK}
|
|
||||||
selectedView={view}
|
|
||||||
buttonGroupPosition={align.CENTER}
|
|
||||||
onPress={this.onViewChange}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<CalendarHeaderViewButton
|
|
||||||
view={calendarViews.FORECAST}
|
|
||||||
selectedView={view}
|
|
||||||
buttonGroupPosition={align.CENTER}
|
|
||||||
onPress={this.onViewChange}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<CalendarHeaderViewButton
|
|
||||||
view={calendarViews.DAY}
|
|
||||||
selectedView={view}
|
|
||||||
buttonGroupPosition={align.CENTER}
|
|
||||||
onPress={this.onViewChange}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<CalendarHeaderViewButton
|
|
||||||
view={calendarViews.AGENDA}
|
|
||||||
selectedView={view}
|
|
||||||
buttonGroupPosition={align.RIGHT}
|
|
||||||
onPress={this.onViewChange}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CalendarHeader.propTypes = {
|
|
||||||
isFetching: PropTypes.bool.isRequired,
|
|
||||||
time: PropTypes.string.isRequired,
|
|
||||||
start: PropTypes.string.isRequired,
|
|
||||||
end: PropTypes.string.isRequired,
|
|
||||||
view: PropTypes.oneOf(calendarViews.all).isRequired,
|
|
||||||
isSmallScreen: PropTypes.bool.isRequired,
|
|
||||||
collapseViewButtons: PropTypes.bool.isRequired,
|
|
||||||
longDateFormat: PropTypes.string.isRequired,
|
|
||||||
onViewChange: PropTypes.func.isRequired,
|
|
||||||
onTodayPress: PropTypes.func.isRequired,
|
|
||||||
onPreviousPress: PropTypes.func.isRequired,
|
|
||||||
onNextPress: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default CalendarHeader;
|
|
||||||
221
frontend/src/Calendar/Header/CalendarHeader.tsx
Normal file
221
frontend/src/Calendar/Header/CalendarHeader.tsx
Normal file
|
|
@ -0,0 +1,221 @@
|
||||||
|
import moment from 'moment';
|
||||||
|
import React, { useCallback, useMemo } from 'react';
|
||||||
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
|
import AppState from 'App/State/AppState';
|
||||||
|
import { CalendarView } from 'Calendar/calendarViews';
|
||||||
|
import Icon from 'Components/Icon';
|
||||||
|
import Button from 'Components/Link/Button';
|
||||||
|
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||||
|
import Menu from 'Components/Menu/Menu';
|
||||||
|
import MenuButton from 'Components/Menu/MenuButton';
|
||||||
|
import MenuContent from 'Components/Menu/MenuContent';
|
||||||
|
import ViewMenuItem from 'Components/Menu/ViewMenuItem';
|
||||||
|
import { align, icons } from 'Helpers/Props';
|
||||||
|
import {
|
||||||
|
gotoCalendarNextRange,
|
||||||
|
gotoCalendarPreviousRange,
|
||||||
|
gotoCalendarToday,
|
||||||
|
setCalendarView,
|
||||||
|
} from 'Store/Actions/calendarActions';
|
||||||
|
import createDimensionsSelector from 'Store/Selectors/createDimensionsSelector';
|
||||||
|
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
|
import CalendarHeaderViewButton from './CalendarHeaderViewButton';
|
||||||
|
import styles from './CalendarHeader.css';
|
||||||
|
|
||||||
|
function CalendarHeader() {
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
|
const { isFetching, view, time, start, end } = useSelector(
|
||||||
|
(state: AppState) => state.calendar
|
||||||
|
);
|
||||||
|
|
||||||
|
const { isSmallScreen, isLargeScreen } = useSelector(
|
||||||
|
createDimensionsSelector()
|
||||||
|
);
|
||||||
|
|
||||||
|
const { longDateFormat } = useSelector(createUISettingsSelector());
|
||||||
|
|
||||||
|
const handleViewChange = useCallback(
|
||||||
|
(newView: CalendarView) => {
|
||||||
|
dispatch(setCalendarView({ view: newView }));
|
||||||
|
},
|
||||||
|
[dispatch]
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleTodayPress = useCallback(() => {
|
||||||
|
dispatch(gotoCalendarToday());
|
||||||
|
}, [dispatch]);
|
||||||
|
|
||||||
|
const handlePreviousPress = useCallback(() => {
|
||||||
|
dispatch(gotoCalendarPreviousRange());
|
||||||
|
}, [dispatch]);
|
||||||
|
|
||||||
|
const handleNextPress = useCallback(() => {
|
||||||
|
dispatch(gotoCalendarNextRange());
|
||||||
|
}, [dispatch]);
|
||||||
|
|
||||||
|
const title = useMemo(() => {
|
||||||
|
const timeMoment = moment(time);
|
||||||
|
const startMoment = moment(start);
|
||||||
|
const endMoment = moment(end);
|
||||||
|
|
||||||
|
if (view === 'day') {
|
||||||
|
return timeMoment.format(longDateFormat);
|
||||||
|
} else if (view === 'month') {
|
||||||
|
return timeMoment.format('MMMM YYYY');
|
||||||
|
} else if (view === 'agenda') {
|
||||||
|
return translate('Agenda');
|
||||||
|
}
|
||||||
|
|
||||||
|
let startFormat = 'MMM D YYYY';
|
||||||
|
let endFormat = 'MMM D YYYY';
|
||||||
|
|
||||||
|
if (startMoment.isSame(endMoment, 'month')) {
|
||||||
|
startFormat = 'MMM D';
|
||||||
|
endFormat = 'D YYYY';
|
||||||
|
} else if (startMoment.isSame(endMoment, 'year')) {
|
||||||
|
startFormat = 'MMM D';
|
||||||
|
endFormat = 'MMM D YYYY';
|
||||||
|
}
|
||||||
|
|
||||||
|
return `${startMoment.format(startFormat)} \u2014 ${endMoment.format(
|
||||||
|
endFormat
|
||||||
|
)}`;
|
||||||
|
}, [time, start, end, view, longDateFormat]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{isSmallScreen ? <div className={styles.titleMobile}>{title}</div> : null}
|
||||||
|
|
||||||
|
<div className={styles.header}>
|
||||||
|
<div className={styles.navigationButtons}>
|
||||||
|
<Button
|
||||||
|
buttonGroupPosition="left"
|
||||||
|
isDisabled={view === 'agenda'}
|
||||||
|
onPress={handlePreviousPress}
|
||||||
|
>
|
||||||
|
<Icon name={icons.PAGE_PREVIOUS} />
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
buttonGroupPosition="right"
|
||||||
|
isDisabled={view === 'agenda'}
|
||||||
|
onPress={handleNextPress}
|
||||||
|
>
|
||||||
|
<Icon name={icons.PAGE_NEXT} />
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
className={styles.todayButton}
|
||||||
|
isDisabled={view === 'agenda'}
|
||||||
|
onPress={handleTodayPress}
|
||||||
|
>
|
||||||
|
{translate('Today')}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{isSmallScreen ? null : (
|
||||||
|
<div className={styles.titleDesktop}>{title}</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<div className={styles.viewButtonsContainer}>
|
||||||
|
{isFetching ? (
|
||||||
|
<LoadingIndicator className={styles.loading} size={20} />
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{isLargeScreen ? (
|
||||||
|
<Menu className={styles.viewMenu} alignMenu={align.RIGHT}>
|
||||||
|
<MenuButton>
|
||||||
|
<Icon name={icons.VIEW} size={22} />
|
||||||
|
</MenuButton>
|
||||||
|
|
||||||
|
<MenuContent>
|
||||||
|
{isSmallScreen ? null : (
|
||||||
|
<ViewMenuItem
|
||||||
|
name="month"
|
||||||
|
selectedView={view}
|
||||||
|
onPress={handleViewChange}
|
||||||
|
>
|
||||||
|
{translate('Month')}
|
||||||
|
</ViewMenuItem>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<ViewMenuItem
|
||||||
|
name="week"
|
||||||
|
selectedView={view}
|
||||||
|
onPress={handleViewChange}
|
||||||
|
>
|
||||||
|
{translate('Week')}
|
||||||
|
</ViewMenuItem>
|
||||||
|
|
||||||
|
<ViewMenuItem
|
||||||
|
name="forecast"
|
||||||
|
selectedView={view}
|
||||||
|
onPress={handleViewChange}
|
||||||
|
>
|
||||||
|
{translate('Forecast')}
|
||||||
|
</ViewMenuItem>
|
||||||
|
|
||||||
|
<ViewMenuItem
|
||||||
|
name="day"
|
||||||
|
selectedView={view}
|
||||||
|
onPress={handleViewChange}
|
||||||
|
>
|
||||||
|
{translate('Day')}
|
||||||
|
</ViewMenuItem>
|
||||||
|
|
||||||
|
<ViewMenuItem
|
||||||
|
name="agenda"
|
||||||
|
selectedView={view}
|
||||||
|
onPress={handleViewChange}
|
||||||
|
>
|
||||||
|
{translate('Agenda')}
|
||||||
|
</ViewMenuItem>
|
||||||
|
</MenuContent>
|
||||||
|
</Menu>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<CalendarHeaderViewButton
|
||||||
|
view="month"
|
||||||
|
selectedView={view}
|
||||||
|
buttonGroupPosition="left"
|
||||||
|
onPress={handleViewChange}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<CalendarHeaderViewButton
|
||||||
|
view="week"
|
||||||
|
selectedView={view}
|
||||||
|
buttonGroupPosition="center"
|
||||||
|
onPress={handleViewChange}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<CalendarHeaderViewButton
|
||||||
|
view="forecast"
|
||||||
|
selectedView={view}
|
||||||
|
buttonGroupPosition="center"
|
||||||
|
onPress={handleViewChange}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<CalendarHeaderViewButton
|
||||||
|
view="day"
|
||||||
|
selectedView={view}
|
||||||
|
buttonGroupPosition="center"
|
||||||
|
onPress={handleViewChange}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<CalendarHeaderViewButton
|
||||||
|
view="agenda"
|
||||||
|
selectedView={view}
|
||||||
|
buttonGroupPosition="right"
|
||||||
|
onPress={handleViewChange}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default CalendarHeader;
|
||||||
|
|
@ -1,85 +0,0 @@
|
||||||
import _ from 'lodash';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import { connect } from 'react-redux';
|
|
||||||
import { createSelector } from 'reselect';
|
|
||||||
import { gotoCalendarNextRange, gotoCalendarPreviousRange, gotoCalendarToday, setCalendarView } from 'Store/Actions/calendarActions';
|
|
||||||
import createDimensionsSelector from 'Store/Selectors/createDimensionsSelector';
|
|
||||||
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
|
||||||
import CalendarHeader from './CalendarHeader';
|
|
||||||
|
|
||||||
function createMapStateToProps() {
|
|
||||||
return createSelector(
|
|
||||||
(state) => state.calendar,
|
|
||||||
createDimensionsSelector(),
|
|
||||||
createUISettingsSelector(),
|
|
||||||
(calendar, dimensions, uiSettings) => {
|
|
||||||
const result = _.pick(calendar, [
|
|
||||||
'isFetching',
|
|
||||||
'view',
|
|
||||||
'time',
|
|
||||||
'start',
|
|
||||||
'end'
|
|
||||||
]);
|
|
||||||
|
|
||||||
result.isSmallScreen = dimensions.isSmallScreen;
|
|
||||||
result.collapseViewButtons = dimensions.isLargeScreen;
|
|
||||||
result.longDateFormat = uiSettings.longDateFormat;
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const mapDispatchToProps = {
|
|
||||||
setCalendarView,
|
|
||||||
gotoCalendarToday,
|
|
||||||
gotoCalendarPreviousRange,
|
|
||||||
gotoCalendarNextRange
|
|
||||||
};
|
|
||||||
|
|
||||||
class CalendarHeaderConnector extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Listeners
|
|
||||||
|
|
||||||
onViewChange = (view) => {
|
|
||||||
this.props.setCalendarView({ view });
|
|
||||||
};
|
|
||||||
|
|
||||||
onTodayPress = () => {
|
|
||||||
this.props.gotoCalendarToday();
|
|
||||||
};
|
|
||||||
|
|
||||||
onPreviousPress = () => {
|
|
||||||
this.props.gotoCalendarPreviousRange();
|
|
||||||
};
|
|
||||||
|
|
||||||
onNextPress = () => {
|
|
||||||
this.props.gotoCalendarNextRange();
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
return (
|
|
||||||
<CalendarHeader
|
|
||||||
{...this.props}
|
|
||||||
onViewChange={this.onViewChange}
|
|
||||||
onTodayPress={this.onTodayPress}
|
|
||||||
onPreviousPress={this.onPreviousPress}
|
|
||||||
onNextPress={this.onNextPress}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CalendarHeaderConnector.propTypes = {
|
|
||||||
setCalendarView: PropTypes.func.isRequired,
|
|
||||||
gotoCalendarToday: PropTypes.func.isRequired,
|
|
||||||
gotoCalendarPreviousRange: PropTypes.func.isRequired,
|
|
||||||
gotoCalendarNextRange: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default connect(createMapStateToProps, mapDispatchToProps)(CalendarHeaderConnector);
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import * as calendarViews from 'Calendar/calendarViews';
|
|
||||||
import Button from 'Components/Link/Button';
|
|
||||||
import titleCase from 'Utilities/String/titleCase';
|
|
||||||
// import styles from './CalendarHeaderViewButton.css';
|
|
||||||
|
|
||||||
class CalendarHeaderViewButton extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Listeners
|
|
||||||
|
|
||||||
onPress = () => {
|
|
||||||
this.props.onPress(this.props.view);
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const {
|
|
||||||
view,
|
|
||||||
selectedView,
|
|
||||||
...otherProps
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Button
|
|
||||||
isDisabled={selectedView === view}
|
|
||||||
{...otherProps}
|
|
||||||
onPress={this.onPress}
|
|
||||||
>
|
|
||||||
{titleCase(view)}
|
|
||||||
</Button>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CalendarHeaderViewButton.propTypes = {
|
|
||||||
view: PropTypes.oneOf(calendarViews.all).isRequired,
|
|
||||||
selectedView: PropTypes.oneOf(calendarViews.all).isRequired,
|
|
||||||
onPress: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default CalendarHeaderViewButton;
|
|
||||||
34
frontend/src/Calendar/Header/CalendarHeaderViewButton.tsx
Normal file
34
frontend/src/Calendar/Header/CalendarHeaderViewButton.tsx
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
import React, { useCallback } from 'react';
|
||||||
|
import { CalendarView } from 'Calendar/calendarViews';
|
||||||
|
import Button, { ButtonProps } from 'Components/Link/Button';
|
||||||
|
import titleCase from 'Utilities/String/titleCase';
|
||||||
|
|
||||||
|
interface CalendarHeaderViewButtonProps
|
||||||
|
extends Omit<ButtonProps, 'children' | 'onPress'> {
|
||||||
|
view: CalendarView;
|
||||||
|
selectedView: CalendarView;
|
||||||
|
onPress: (view: CalendarView) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function CalendarHeaderViewButton({
|
||||||
|
view,
|
||||||
|
selectedView,
|
||||||
|
onPress,
|
||||||
|
...otherProps
|
||||||
|
}: CalendarHeaderViewButtonProps) {
|
||||||
|
const handlePress = useCallback(() => {
|
||||||
|
onPress(view);
|
||||||
|
}, [view, onPress]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Button
|
||||||
|
isDisabled={selectedView === view}
|
||||||
|
{...otherProps}
|
||||||
|
onPress={handlePress}
|
||||||
|
>
|
||||||
|
{titleCase(view)}
|
||||||
|
</Button>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default CalendarHeaderViewButton;
|
||||||
|
|
@ -1,20 +1,22 @@
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { useSelector } from 'react-redux';
|
||||||
|
import AppState from 'App/State/AppState';
|
||||||
import { icons, kinds } from 'Helpers/Props';
|
import { icons, kinds } from 'Helpers/Props';
|
||||||
|
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
||||||
import translate from 'Utilities/String/translate';
|
import translate from 'Utilities/String/translate';
|
||||||
import LegendIconItem from './LegendIconItem';
|
import LegendIconItem from './LegendIconItem';
|
||||||
import LegendItem from './LegendItem';
|
import LegendItem from './LegendItem';
|
||||||
import styles from './Legend.css';
|
import styles from './Legend.css';
|
||||||
|
|
||||||
function Legend(props) {
|
function Legend() {
|
||||||
|
const view = useSelector((state: AppState) => state.calendar.view);
|
||||||
const {
|
const {
|
||||||
view,
|
|
||||||
showFinaleIcon,
|
showFinaleIcon,
|
||||||
showSpecialIcon,
|
showSpecialIcon,
|
||||||
showCutoffUnmetIcon,
|
showCutoffUnmetIcon,
|
||||||
fullColorEvents,
|
fullColorEvents,
|
||||||
colorImpairedMode
|
} = useSelector((state: AppState) => state.calendar.options);
|
||||||
} = props;
|
const { enableColorImpairedMode } = useSelector(createUISettingsSelector());
|
||||||
|
|
||||||
const iconsToShow = [];
|
const iconsToShow = [];
|
||||||
const isAgendaView = view === 'agenda';
|
const isAgendaView = view === 'agenda';
|
||||||
|
|
@ -56,7 +58,7 @@ function Legend(props) {
|
||||||
if (showCutoffUnmetIcon) {
|
if (showCutoffUnmetIcon) {
|
||||||
iconsToShow.push(
|
iconsToShow.push(
|
||||||
<LegendIconItem
|
<LegendIconItem
|
||||||
name={translate('Cutoff Not Met')}
|
name={translate('CutoffNotMet')}
|
||||||
icon={icons.EPISODE_FILE}
|
icon={icons.EPISODE_FILE}
|
||||||
kind={kinds.WARNING}
|
kind={kinds.WARNING}
|
||||||
fullColorEvents={fullColorEvents}
|
fullColorEvents={fullColorEvents}
|
||||||
|
|
@ -73,7 +75,7 @@ function Legend(props) {
|
||||||
tooltip={translate('CalendarLegendEpisodeUnairedTooltip')}
|
tooltip={translate('CalendarLegendEpisodeUnairedTooltip')}
|
||||||
isAgendaView={isAgendaView}
|
isAgendaView={isAgendaView}
|
||||||
fullColorEvents={fullColorEvents}
|
fullColorEvents={fullColorEvents}
|
||||||
colorImpairedMode={colorImpairedMode}
|
colorImpairedMode={enableColorImpairedMode}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<LegendItem
|
<LegendItem
|
||||||
|
|
@ -81,7 +83,7 @@ function Legend(props) {
|
||||||
tooltip={translate('CalendarLegendEpisodeUnmonitoredTooltip')}
|
tooltip={translate('CalendarLegendEpisodeUnmonitoredTooltip')}
|
||||||
isAgendaView={isAgendaView}
|
isAgendaView={isAgendaView}
|
||||||
fullColorEvents={fullColorEvents}
|
fullColorEvents={fullColorEvents}
|
||||||
colorImpairedMode={colorImpairedMode}
|
colorImpairedMode={enableColorImpairedMode}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -92,7 +94,7 @@ function Legend(props) {
|
||||||
tooltip={translate('CalendarLegendEpisodeOnAirTooltip')}
|
tooltip={translate('CalendarLegendEpisodeOnAirTooltip')}
|
||||||
isAgendaView={isAgendaView}
|
isAgendaView={isAgendaView}
|
||||||
fullColorEvents={fullColorEvents}
|
fullColorEvents={fullColorEvents}
|
||||||
colorImpairedMode={colorImpairedMode}
|
colorImpairedMode={enableColorImpairedMode}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<LegendItem
|
<LegendItem
|
||||||
|
|
@ -100,7 +102,7 @@ function Legend(props) {
|
||||||
tooltip={translate('CalendarLegendEpisodeMissingTooltip')}
|
tooltip={translate('CalendarLegendEpisodeMissingTooltip')}
|
||||||
isAgendaView={isAgendaView}
|
isAgendaView={isAgendaView}
|
||||||
fullColorEvents={fullColorEvents}
|
fullColorEvents={fullColorEvents}
|
||||||
colorImpairedMode={colorImpairedMode}
|
colorImpairedMode={enableColorImpairedMode}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -110,7 +112,7 @@ function Legend(props) {
|
||||||
tooltip={translate('CalendarLegendEpisodeDownloadingTooltip')}
|
tooltip={translate('CalendarLegendEpisodeDownloadingTooltip')}
|
||||||
isAgendaView={isAgendaView}
|
isAgendaView={isAgendaView}
|
||||||
fullColorEvents={fullColorEvents}
|
fullColorEvents={fullColorEvents}
|
||||||
colorImpairedMode={colorImpairedMode}
|
colorImpairedMode={enableColorImpairedMode}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<LegendItem
|
<LegendItem
|
||||||
|
|
@ -118,7 +120,7 @@ function Legend(props) {
|
||||||
tooltip={translate('CalendarLegendEpisodeDownloadedTooltip')}
|
tooltip={translate('CalendarLegendEpisodeDownloadedTooltip')}
|
||||||
isAgendaView={isAgendaView}
|
isAgendaView={isAgendaView}
|
||||||
fullColorEvents={fullColorEvents}
|
fullColorEvents={fullColorEvents}
|
||||||
colorImpairedMode={colorImpairedMode}
|
colorImpairedMode={enableColorImpairedMode}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -134,30 +136,15 @@ function Legend(props) {
|
||||||
{iconsToShow[0]}
|
{iconsToShow[0]}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{
|
{iconsToShow.length > 1 ? (
|
||||||
iconsToShow.length > 1 &&
|
<div>
|
||||||
<div>
|
{iconsToShow[1]}
|
||||||
{iconsToShow[1]}
|
{iconsToShow[2]}
|
||||||
{iconsToShow[2]}
|
</div>
|
||||||
</div>
|
) : null}
|
||||||
}
|
{iconsToShow.length > 3 ? <div>{iconsToShow[3]}</div> : null}
|
||||||
{
|
|
||||||
iconsToShow.length > 3 &&
|
|
||||||
<div>
|
|
||||||
{iconsToShow[3]}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Legend.propTypes = {
|
|
||||||
view: PropTypes.string.isRequired,
|
|
||||||
showFinaleIcon: PropTypes.bool.isRequired,
|
|
||||||
showSpecialIcon: PropTypes.bool.isRequired,
|
|
||||||
showCutoffUnmetIcon: PropTypes.bool.isRequired,
|
|
||||||
fullColorEvents: PropTypes.bool.isRequired,
|
|
||||||
colorImpairedMode: PropTypes.bool.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Legend;
|
export default Legend;
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
import { connect } from 'react-redux';
|
|
||||||
import { createSelector } from 'reselect';
|
|
||||||
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
|
||||||
import Legend from './Legend';
|
|
||||||
|
|
||||||
function createMapStateToProps() {
|
|
||||||
return createSelector(
|
|
||||||
(state) => state.calendar.options,
|
|
||||||
(state) => state.calendar.view,
|
|
||||||
createUISettingsSelector(),
|
|
||||||
(calendarOptions, view, uiSettings) => {
|
|
||||||
return {
|
|
||||||
...calendarOptions,
|
|
||||||
view,
|
|
||||||
colorImpairedMode: uiSettings.enableColorImpairedMode
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default connect(createMapStateToProps)(Legend);
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
import classNames from 'classnames';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import React from 'react';
|
|
||||||
import Icon from 'Components/Icon';
|
|
||||||
import styles from './LegendIconItem.css';
|
|
||||||
|
|
||||||
function LegendIconItem(props) {
|
|
||||||
const {
|
|
||||||
name,
|
|
||||||
fullColorEvents,
|
|
||||||
icon,
|
|
||||||
kind,
|
|
||||||
tooltip
|
|
||||||
} = props;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
className={styles.legendIconItem}
|
|
||||||
title={tooltip}
|
|
||||||
>
|
|
||||||
<Icon
|
|
||||||
className={classNames(
|
|
||||||
styles.icon,
|
|
||||||
fullColorEvents && 'fullColorEvents'
|
|
||||||
)}
|
|
||||||
name={icon}
|
|
||||||
kind={kind}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{name}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
LegendIconItem.propTypes = {
|
|
||||||
name: PropTypes.string.isRequired,
|
|
||||||
fullColorEvents: PropTypes.bool.isRequired,
|
|
||||||
icon: PropTypes.object.isRequired,
|
|
||||||
kind: PropTypes.string.isRequired,
|
|
||||||
tooltip: PropTypes.string.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default LegendIconItem;
|
|
||||||
33
frontend/src/Calendar/Legend/LegendIconItem.tsx
Normal file
33
frontend/src/Calendar/Legend/LegendIconItem.tsx
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
import { FontAwesomeIconProps } from '@fortawesome/react-fontawesome';
|
||||||
|
import classNames from 'classnames';
|
||||||
|
import React from 'react';
|
||||||
|
import Icon, { IconProps } from 'Components/Icon';
|
||||||
|
import styles from './LegendIconItem.css';
|
||||||
|
|
||||||
|
interface LegendIconItemProps extends Pick<IconProps, 'kind'> {
|
||||||
|
name: string;
|
||||||
|
fullColorEvents: boolean;
|
||||||
|
icon: FontAwesomeIconProps['icon'];
|
||||||
|
tooltip: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
function LegendIconItem(props: LegendIconItemProps) {
|
||||||
|
const { name, fullColorEvents, icon, kind, tooltip } = props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={styles.legendIconItem} title={tooltip}>
|
||||||
|
<Icon
|
||||||
|
className={classNames(
|
||||||
|
styles.icon,
|
||||||
|
fullColorEvents && 'fullColorEvents'
|
||||||
|
)}
|
||||||
|
name={icon}
|
||||||
|
kind={kind}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{name}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default LegendIconItem;
|
||||||
|
|
@ -1,17 +1,26 @@
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { CalendarStatus } from 'typings/Calendar';
|
||||||
import titleCase from 'Utilities/String/titleCase';
|
import titleCase from 'Utilities/String/titleCase';
|
||||||
import styles from './LegendItem.css';
|
import styles from './LegendItem.css';
|
||||||
|
|
||||||
function LegendItem(props) {
|
interface LegendItemProps {
|
||||||
|
name?: string;
|
||||||
|
status: CalendarStatus;
|
||||||
|
tooltip: string;
|
||||||
|
isAgendaView: boolean;
|
||||||
|
fullColorEvents: boolean;
|
||||||
|
colorImpairedMode: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
function LegendItem(props: LegendItemProps) {
|
||||||
const {
|
const {
|
||||||
name,
|
name,
|
||||||
status,
|
status,
|
||||||
tooltip,
|
tooltip,
|
||||||
isAgendaView,
|
isAgendaView,
|
||||||
fullColorEvents,
|
fullColorEvents,
|
||||||
colorImpairedMode
|
colorImpairedMode,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
@ -29,13 +38,4 @@ function LegendItem(props) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
LegendItem.propTypes = {
|
|
||||||
name: PropTypes.string,
|
|
||||||
status: PropTypes.string.isRequired,
|
|
||||||
tooltip: PropTypes.string.isRequired,
|
|
||||||
isAgendaView: PropTypes.bool.isRequired,
|
|
||||||
fullColorEvents: PropTypes.bool.isRequired,
|
|
||||||
colorImpairedMode: PropTypes.bool.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default LegendItem;
|
export default LegendItem;
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import React from 'react';
|
|
||||||
import Modal from 'Components/Modal/Modal';
|
|
||||||
import CalendarOptionsModalContentConnector from './CalendarOptionsModalContentConnector';
|
|
||||||
|
|
||||||
function CalendarOptionsModal(props) {
|
|
||||||
const {
|
|
||||||
isOpen,
|
|
||||||
onModalClose
|
|
||||||
} = props;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Modal
|
|
||||||
isOpen={isOpen}
|
|
||||||
onModalClose={onModalClose}
|
|
||||||
>
|
|
||||||
<CalendarOptionsModalContentConnector
|
|
||||||
onModalClose={onModalClose}
|
|
||||||
/>
|
|
||||||
</Modal>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
CalendarOptionsModal.propTypes = {
|
|
||||||
isOpen: PropTypes.bool.isRequired,
|
|
||||||
onModalClose: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default CalendarOptionsModal;
|
|
||||||
21
frontend/src/Calendar/Options/CalendarOptionsModal.tsx
Normal file
21
frontend/src/Calendar/Options/CalendarOptionsModal.tsx
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
import React from 'react';
|
||||||
|
import Modal from 'Components/Modal/Modal';
|
||||||
|
import CalendarOptionsModalContent from './CalendarOptionsModalContent';
|
||||||
|
|
||||||
|
interface CalendarOptionsModalProps {
|
||||||
|
isOpen: boolean;
|
||||||
|
onModalClose: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function CalendarOptionsModal({
|
||||||
|
isOpen,
|
||||||
|
onModalClose,
|
||||||
|
}: CalendarOptionsModalProps) {
|
||||||
|
return (
|
||||||
|
<Modal isOpen={isOpen} onModalClose={onModalClose}>
|
||||||
|
<CalendarOptionsModalContent onModalClose={onModalClose} />
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default CalendarOptionsModal;
|
||||||
|
|
@ -1,276 +0,0 @@
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import FieldSet from 'Components/FieldSet';
|
|
||||||
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 Button from 'Components/Link/Button';
|
|
||||||
import ModalBody from 'Components/Modal/ModalBody';
|
|
||||||
import ModalContent from 'Components/Modal/ModalContent';
|
|
||||||
import ModalFooter from 'Components/Modal/ModalFooter';
|
|
||||||
import ModalHeader from 'Components/Modal/ModalHeader';
|
|
||||||
import { inputTypes } from 'Helpers/Props';
|
|
||||||
import { firstDayOfWeekOptions, timeFormatOptions, weekColumnOptions } from 'Settings/UI/UISettings';
|
|
||||||
import translate from 'Utilities/String/translate';
|
|
||||||
|
|
||||||
class CalendarOptionsModalContent extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Lifecycle
|
|
||||||
|
|
||||||
constructor(props, context) {
|
|
||||||
super(props, context);
|
|
||||||
|
|
||||||
const {
|
|
||||||
firstDayOfWeek,
|
|
||||||
calendarWeekColumnHeader,
|
|
||||||
timeFormat,
|
|
||||||
enableColorImpairedMode,
|
|
||||||
fullColorEvents
|
|
||||||
} = props;
|
|
||||||
|
|
||||||
this.state = {
|
|
||||||
firstDayOfWeek,
|
|
||||||
calendarWeekColumnHeader,
|
|
||||||
timeFormat,
|
|
||||||
enableColorImpairedMode,
|
|
||||||
fullColorEvents
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidUpdate(prevProps) {
|
|
||||||
const {
|
|
||||||
firstDayOfWeek,
|
|
||||||
calendarWeekColumnHeader,
|
|
||||||
timeFormat,
|
|
||||||
enableColorImpairedMode
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
if (
|
|
||||||
prevProps.firstDayOfWeek !== firstDayOfWeek ||
|
|
||||||
prevProps.calendarWeekColumnHeader !== calendarWeekColumnHeader ||
|
|
||||||
prevProps.timeFormat !== timeFormat ||
|
|
||||||
prevProps.enableColorImpairedMode !== enableColorImpairedMode
|
|
||||||
) {
|
|
||||||
this.setState({
|
|
||||||
firstDayOfWeek,
|
|
||||||
calendarWeekColumnHeader,
|
|
||||||
timeFormat,
|
|
||||||
enableColorImpairedMode
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Listeners
|
|
||||||
|
|
||||||
onOptionInputChange = ({ name, value }) => {
|
|
||||||
const {
|
|
||||||
dispatchSetCalendarOption
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
dispatchSetCalendarOption({ [name]: value });
|
|
||||||
};
|
|
||||||
|
|
||||||
onGlobalInputChange = ({ name, value }) => {
|
|
||||||
const {
|
|
||||||
dispatchSaveUISettings
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
const setting = { [name]: value };
|
|
||||||
|
|
||||||
this.setState(setting, () => {
|
|
||||||
dispatchSaveUISettings(setting);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
onLinkFocus = (event) => {
|
|
||||||
event.target.select();
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const {
|
|
||||||
collapseMultipleEpisodes,
|
|
||||||
showEpisodeInformation,
|
|
||||||
showFinaleIcon,
|
|
||||||
showSpecialIcon,
|
|
||||||
showCutoffUnmetIcon,
|
|
||||||
fullColorEvents,
|
|
||||||
onModalClose
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
const {
|
|
||||||
firstDayOfWeek,
|
|
||||||
calendarWeekColumnHeader,
|
|
||||||
timeFormat,
|
|
||||||
enableColorImpairedMode
|
|
||||||
} = this.state;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<ModalContent onModalClose={onModalClose}>
|
|
||||||
<ModalHeader>
|
|
||||||
{translate('CalendarOptions')}
|
|
||||||
</ModalHeader>
|
|
||||||
|
|
||||||
<ModalBody>
|
|
||||||
<FieldSet legend={translate('Local')}>
|
|
||||||
<Form>
|
|
||||||
<FormGroup>
|
|
||||||
<FormLabel>{translate('CollapseMultipleEpisodes')}</FormLabel>
|
|
||||||
|
|
||||||
<FormInputGroup
|
|
||||||
type={inputTypes.CHECK}
|
|
||||||
name="collapseMultipleEpisodes"
|
|
||||||
value={collapseMultipleEpisodes}
|
|
||||||
helpText={translate('CollapseMultipleEpisodesHelpText')}
|
|
||||||
onChange={this.onOptionInputChange}
|
|
||||||
/>
|
|
||||||
</FormGroup>
|
|
||||||
|
|
||||||
<FormGroup>
|
|
||||||
<FormLabel>{translate('ShowEpisodeInformation')}</FormLabel>
|
|
||||||
|
|
||||||
<FormInputGroup
|
|
||||||
type={inputTypes.CHECK}
|
|
||||||
name="showEpisodeInformation"
|
|
||||||
value={showEpisodeInformation}
|
|
||||||
helpText={translate('ShowEpisodeInformationHelpText')}
|
|
||||||
onChange={this.onOptionInputChange}
|
|
||||||
/>
|
|
||||||
</FormGroup>
|
|
||||||
|
|
||||||
<FormGroup>
|
|
||||||
<FormLabel>{translate('IconForFinales')}</FormLabel>
|
|
||||||
|
|
||||||
<FormInputGroup
|
|
||||||
type={inputTypes.CHECK}
|
|
||||||
name="showFinaleIcon"
|
|
||||||
value={showFinaleIcon}
|
|
||||||
helpText={translate('IconForFinalesHelpText')}
|
|
||||||
onChange={this.onOptionInputChange}
|
|
||||||
/>
|
|
||||||
</FormGroup>
|
|
||||||
|
|
||||||
<FormGroup>
|
|
||||||
<FormLabel>{translate('IconForSpecials')}</FormLabel>
|
|
||||||
|
|
||||||
<FormInputGroup
|
|
||||||
type={inputTypes.CHECK}
|
|
||||||
name="showSpecialIcon"
|
|
||||||
value={showSpecialIcon}
|
|
||||||
helpText={translate('IconForSpecialsHelpText')}
|
|
||||||
onChange={this.onOptionInputChange}
|
|
||||||
/>
|
|
||||||
</FormGroup>
|
|
||||||
|
|
||||||
<FormGroup>
|
|
||||||
<FormLabel>{translate('IconForCutoffUnmet')}</FormLabel>
|
|
||||||
|
|
||||||
<FormInputGroup
|
|
||||||
type={inputTypes.CHECK}
|
|
||||||
name="showCutoffUnmetIcon"
|
|
||||||
value={showCutoffUnmetIcon}
|
|
||||||
helpText={translate('IconForCutoffUnmetHelpText')}
|
|
||||||
onChange={this.onOptionInputChange}
|
|
||||||
/>
|
|
||||||
</FormGroup>
|
|
||||||
|
|
||||||
<FormGroup>
|
|
||||||
<FormLabel>{translate('FullColorEvents')}</FormLabel>
|
|
||||||
|
|
||||||
<FormInputGroup
|
|
||||||
type={inputTypes.CHECK}
|
|
||||||
name="fullColorEvents"
|
|
||||||
value={fullColorEvents}
|
|
||||||
helpText={translate('FullColorEventsHelpText')}
|
|
||||||
onChange={this.onOptionInputChange}
|
|
||||||
/>
|
|
||||||
</FormGroup>
|
|
||||||
</Form>
|
|
||||||
</FieldSet>
|
|
||||||
|
|
||||||
<FieldSet legend={translate('Global')}>
|
|
||||||
<Form>
|
|
||||||
<FormGroup>
|
|
||||||
<FormLabel>{translate('FirstDayOfWeek')}</FormLabel>
|
|
||||||
|
|
||||||
<FormInputGroup
|
|
||||||
type={inputTypes.SELECT}
|
|
||||||
name="firstDayOfWeek"
|
|
||||||
values={firstDayOfWeekOptions}
|
|
||||||
value={firstDayOfWeek}
|
|
||||||
onChange={this.onGlobalInputChange}
|
|
||||||
/>
|
|
||||||
</FormGroup>
|
|
||||||
|
|
||||||
<FormGroup>
|
|
||||||
<FormLabel>{translate('WeekColumnHeader')}</FormLabel>
|
|
||||||
|
|
||||||
<FormInputGroup
|
|
||||||
type={inputTypes.SELECT}
|
|
||||||
name="calendarWeekColumnHeader"
|
|
||||||
values={weekColumnOptions}
|
|
||||||
value={calendarWeekColumnHeader}
|
|
||||||
onChange={this.onGlobalInputChange}
|
|
||||||
helpText={translate('WeekColumnHeaderHelpText')}
|
|
||||||
/>
|
|
||||||
</FormGroup>
|
|
||||||
|
|
||||||
<FormGroup>
|
|
||||||
<FormLabel>{translate('TimeFormat')}</FormLabel>
|
|
||||||
|
|
||||||
<FormInputGroup
|
|
||||||
type={inputTypes.SELECT}
|
|
||||||
name="timeFormat"
|
|
||||||
values={timeFormatOptions}
|
|
||||||
value={timeFormat}
|
|
||||||
onChange={this.onGlobalInputChange}
|
|
||||||
/>
|
|
||||||
</FormGroup>
|
|
||||||
|
|
||||||
<FormGroup>
|
|
||||||
<FormLabel>{translate('EnableColorImpairedMode')}</FormLabel>
|
|
||||||
|
|
||||||
<FormInputGroup
|
|
||||||
type={inputTypes.CHECK}
|
|
||||||
name="enableColorImpairedMode"
|
|
||||||
value={enableColorImpairedMode}
|
|
||||||
helpText={translate('EnableColorImpairedModeHelpText')}
|
|
||||||
onChange={this.onGlobalInputChange}
|
|
||||||
/>
|
|
||||||
</FormGroup>
|
|
||||||
</Form>
|
|
||||||
</FieldSet>
|
|
||||||
</ModalBody>
|
|
||||||
|
|
||||||
<ModalFooter>
|
|
||||||
<Button onPress={onModalClose}>
|
|
||||||
{translate('Close')}
|
|
||||||
</Button>
|
|
||||||
</ModalFooter>
|
|
||||||
</ModalContent>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CalendarOptionsModalContent.propTypes = {
|
|
||||||
collapseMultipleEpisodes: PropTypes.bool.isRequired,
|
|
||||||
showEpisodeInformation: PropTypes.bool.isRequired,
|
|
||||||
showFinaleIcon: PropTypes.bool.isRequired,
|
|
||||||
showSpecialIcon: PropTypes.bool.isRequired,
|
|
||||||
showCutoffUnmetIcon: PropTypes.bool.isRequired,
|
|
||||||
firstDayOfWeek: PropTypes.number.isRequired,
|
|
||||||
calendarWeekColumnHeader: PropTypes.string.isRequired,
|
|
||||||
timeFormat: PropTypes.string.isRequired,
|
|
||||||
enableColorImpairedMode: PropTypes.bool.isRequired,
|
|
||||||
fullColorEvents: PropTypes.bool.isRequired,
|
|
||||||
dispatchSetCalendarOption: PropTypes.func.isRequired,
|
|
||||||
dispatchSaveUISettings: PropTypes.func.isRequired,
|
|
||||||
onModalClose: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default CalendarOptionsModalContent;
|
|
||||||
228
frontend/src/Calendar/Options/CalendarOptionsModalContent.tsx
Normal file
228
frontend/src/Calendar/Options/CalendarOptionsModalContent.tsx
Normal file
|
|
@ -0,0 +1,228 @@
|
||||||
|
import React, { useCallback, useEffect, useState } from 'react';
|
||||||
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
|
import AppState from 'App/State/AppState';
|
||||||
|
import FieldSet from 'Components/FieldSet';
|
||||||
|
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 Button from 'Components/Link/Button';
|
||||||
|
import ModalBody from 'Components/Modal/ModalBody';
|
||||||
|
import ModalContent from 'Components/Modal/ModalContent';
|
||||||
|
import ModalFooter from 'Components/Modal/ModalFooter';
|
||||||
|
import ModalHeader from 'Components/Modal/ModalHeader';
|
||||||
|
import { inputTypes } from 'Helpers/Props';
|
||||||
|
import {
|
||||||
|
firstDayOfWeekOptions,
|
||||||
|
timeFormatOptions,
|
||||||
|
weekColumnOptions,
|
||||||
|
} from 'Settings/UI/UISettings';
|
||||||
|
import { setCalendarOption } from 'Store/Actions/calendarActions';
|
||||||
|
import { saveUISettings } from 'Store/Actions/settingsActions';
|
||||||
|
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
||||||
|
import { InputChanged } from 'typings/inputs';
|
||||||
|
import UiSettings from 'typings/Settings/UiSettings';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
|
|
||||||
|
interface CalendarOptionsModalContentProps {
|
||||||
|
onModalClose: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function CalendarOptionsModalContent({
|
||||||
|
onModalClose,
|
||||||
|
}: CalendarOptionsModalContentProps) {
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
|
const {
|
||||||
|
collapseMultipleEpisodes,
|
||||||
|
showEpisodeInformation,
|
||||||
|
showFinaleIcon,
|
||||||
|
showSpecialIcon,
|
||||||
|
showCutoffUnmetIcon,
|
||||||
|
fullColorEvents,
|
||||||
|
} = useSelector((state: AppState) => state.calendar.options);
|
||||||
|
|
||||||
|
const uiSettings = useSelector(createUISettingsSelector());
|
||||||
|
|
||||||
|
const [state, setState] = useState<Partial<UiSettings>>({
|
||||||
|
firstDayOfWeek: uiSettings.firstDayOfWeek,
|
||||||
|
calendarWeekColumnHeader: uiSettings.calendarWeekColumnHeader,
|
||||||
|
timeFormat: uiSettings.timeFormat,
|
||||||
|
enableColorImpairedMode: uiSettings.enableColorImpairedMode,
|
||||||
|
});
|
||||||
|
|
||||||
|
const {
|
||||||
|
firstDayOfWeek,
|
||||||
|
calendarWeekColumnHeader,
|
||||||
|
timeFormat,
|
||||||
|
enableColorImpairedMode,
|
||||||
|
} = state;
|
||||||
|
|
||||||
|
const handleOptionInputChange = useCallback(
|
||||||
|
({ name, value }: InputChanged) => {
|
||||||
|
dispatch(setCalendarOption({ [name]: value }));
|
||||||
|
},
|
||||||
|
[dispatch]
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleGlobalInputChange = useCallback(
|
||||||
|
({ name, value }: InputChanged) => {
|
||||||
|
setState((prevState) => ({ ...prevState, [name]: value }));
|
||||||
|
|
||||||
|
dispatch(saveUISettings({ [name]: value }));
|
||||||
|
},
|
||||||
|
[dispatch]
|
||||||
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setState({
|
||||||
|
firstDayOfWeek: uiSettings.firstDayOfWeek,
|
||||||
|
calendarWeekColumnHeader: uiSettings.calendarWeekColumnHeader,
|
||||||
|
timeFormat: uiSettings.timeFormat,
|
||||||
|
enableColorImpairedMode: uiSettings.enableColorImpairedMode,
|
||||||
|
});
|
||||||
|
}, [uiSettings]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ModalContent onModalClose={onModalClose}>
|
||||||
|
<ModalHeader>{translate('CalendarOptions')}</ModalHeader>
|
||||||
|
|
||||||
|
<ModalBody>
|
||||||
|
<FieldSet legend={translate('Local')}>
|
||||||
|
<Form>
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('CollapseMultipleEpisodes')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.CHECK}
|
||||||
|
name="collapseMultipleEpisodes"
|
||||||
|
value={collapseMultipleEpisodes}
|
||||||
|
helpText={translate('CollapseMultipleEpisodesHelpText')}
|
||||||
|
onChange={handleOptionInputChange}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('ShowEpisodeInformation')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.CHECK}
|
||||||
|
name="showEpisodeInformation"
|
||||||
|
value={showEpisodeInformation}
|
||||||
|
helpText={translate('ShowEpisodeInformationHelpText')}
|
||||||
|
onChange={handleOptionInputChange}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('IconForFinales')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.CHECK}
|
||||||
|
name="showFinaleIcon"
|
||||||
|
value={showFinaleIcon}
|
||||||
|
helpText={translate('IconForFinalesHelpText')}
|
||||||
|
onChange={handleOptionInputChange}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('IconForSpecials')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.CHECK}
|
||||||
|
name="showSpecialIcon"
|
||||||
|
value={showSpecialIcon}
|
||||||
|
helpText={translate('IconForSpecialsHelpText')}
|
||||||
|
onChange={handleOptionInputChange}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('IconForCutoffUnmet')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.CHECK}
|
||||||
|
name="showCutoffUnmetIcon"
|
||||||
|
value={showCutoffUnmetIcon}
|
||||||
|
helpText={translate('IconForCutoffUnmetHelpText')}
|
||||||
|
onChange={handleOptionInputChange}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('FullColorEvents')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.CHECK}
|
||||||
|
name="fullColorEvents"
|
||||||
|
value={fullColorEvents}
|
||||||
|
helpText={translate('FullColorEventsHelpText')}
|
||||||
|
onChange={handleOptionInputChange}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
</Form>
|
||||||
|
</FieldSet>
|
||||||
|
|
||||||
|
<FieldSet legend={translate('Global')}>
|
||||||
|
<Form>
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('FirstDayOfWeek')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.SELECT}
|
||||||
|
name="firstDayOfWeek"
|
||||||
|
values={firstDayOfWeekOptions}
|
||||||
|
value={firstDayOfWeek}
|
||||||
|
onChange={handleGlobalInputChange}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('WeekColumnHeader')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.SELECT}
|
||||||
|
name="calendarWeekColumnHeader"
|
||||||
|
values={weekColumnOptions}
|
||||||
|
value={calendarWeekColumnHeader}
|
||||||
|
helpText={translate('WeekColumnHeaderHelpText')}
|
||||||
|
onChange={handleGlobalInputChange}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('TimeFormat')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.SELECT}
|
||||||
|
name="timeFormat"
|
||||||
|
values={timeFormatOptions}
|
||||||
|
value={timeFormat}
|
||||||
|
onChange={handleGlobalInputChange}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('EnableColorImpairedMode')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.CHECK}
|
||||||
|
name="enableColorImpairedMode"
|
||||||
|
value={enableColorImpairedMode}
|
||||||
|
helpText={translate('EnableColorImpairedModeHelpText')}
|
||||||
|
onChange={handleGlobalInputChange}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
</Form>
|
||||||
|
</FieldSet>
|
||||||
|
</ModalBody>
|
||||||
|
|
||||||
|
<ModalFooter>
|
||||||
|
<Button onPress={onModalClose}>{translate('Close')}</Button>
|
||||||
|
</ModalFooter>
|
||||||
|
</ModalContent>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default CalendarOptionsModalContent;
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
import { connect } from 'react-redux';
|
|
||||||
import { createSelector } from 'reselect';
|
|
||||||
import { setCalendarOption } from 'Store/Actions/calendarActions';
|
|
||||||
import { saveUISettings } from 'Store/Actions/settingsActions';
|
|
||||||
import CalendarOptionsModalContent from './CalendarOptionsModalContent';
|
|
||||||
|
|
||||||
function createMapStateToProps() {
|
|
||||||
return createSelector(
|
|
||||||
(state) => state.calendar.options,
|
|
||||||
(state) => state.settings.ui.item,
|
|
||||||
(options, uiSettings) => {
|
|
||||||
return {
|
|
||||||
...options,
|
|
||||||
...uiSettings
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const mapDispatchToProps = {
|
|
||||||
dispatchSetCalendarOption: setCalendarOption,
|
|
||||||
dispatchSaveUISettings: saveUISettings
|
|
||||||
};
|
|
||||||
|
|
||||||
export default connect(createMapStateToProps, mapDispatchToProps)(CalendarOptionsModalContent);
|
|
||||||
|
|
@ -5,3 +5,5 @@ export const FORECAST = 'forecast';
|
||||||
export const AGENDA = 'agenda';
|
export const AGENDA = 'agenda';
|
||||||
|
|
||||||
export const all = [DAY, WEEK, MONTH, FORECAST, AGENDA];
|
export const all = [DAY, WEEK, MONTH, FORECAST, AGENDA];
|
||||||
|
|
||||||
|
export type CalendarView = 'agenda' | 'day' | 'forecast' | 'month' | 'week';
|
||||||
|
|
@ -1,7 +1,13 @@
|
||||||
/* eslint max-params: 0 */
|
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
import { CalendarStatus } from 'typings/Calendar';
|
||||||
|
|
||||||
function getStatusStyle(hasFile, downloading, startTime, endTime, isMonitored) {
|
function getStatusStyle(
|
||||||
|
hasFile: boolean,
|
||||||
|
downloading: boolean,
|
||||||
|
startTime: moment.Moment,
|
||||||
|
endTime: moment.Moment,
|
||||||
|
isMonitored: boolean
|
||||||
|
): CalendarStatus {
|
||||||
const currentTime = moment();
|
const currentTime = moment();
|
||||||
|
|
||||||
if (hasFile) {
|
if (hasFile) {
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import React from 'react';
|
|
||||||
import Modal from 'Components/Modal/Modal';
|
|
||||||
import CalendarLinkModalContentConnector from './CalendarLinkModalContentConnector';
|
|
||||||
|
|
||||||
function CalendarLinkModal(props) {
|
|
||||||
const {
|
|
||||||
isOpen,
|
|
||||||
onModalClose
|
|
||||||
} = props;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Modal
|
|
||||||
isOpen={isOpen}
|
|
||||||
onModalClose={onModalClose}
|
|
||||||
>
|
|
||||||
<CalendarLinkModalContentConnector
|
|
||||||
onModalClose={onModalClose}
|
|
||||||
/>
|
|
||||||
</Modal>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
CalendarLinkModal.propTypes = {
|
|
||||||
isOpen: PropTypes.bool.isRequired,
|
|
||||||
onModalClose: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default CalendarLinkModal;
|
|
||||||
20
frontend/src/Calendar/iCal/CalendarLinkModal.tsx
Normal file
20
frontend/src/Calendar/iCal/CalendarLinkModal.tsx
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
import React from 'react';
|
||||||
|
import Modal from 'Components/Modal/Modal';
|
||||||
|
import CalendarLinkModalContent from './CalendarLinkModalContent';
|
||||||
|
|
||||||
|
interface CalendarLinkModalProps {
|
||||||
|
isOpen: boolean;
|
||||||
|
onModalClose: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function CalendarLinkModal(props: CalendarLinkModalProps) {
|
||||||
|
const { isOpen, onModalClose } = props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal isOpen={isOpen} onModalClose={onModalClose}>
|
||||||
|
<CalendarLinkModalContent onModalClose={onModalClose} />
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default CalendarLinkModal;
|
||||||
|
|
@ -1,222 +0,0 @@
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import Form from 'Components/Form/Form';
|
|
||||||
import FormGroup from 'Components/Form/FormGroup';
|
|
||||||
import FormInputButton from 'Components/Form/FormInputButton';
|
|
||||||
import FormInputGroup from 'Components/Form/FormInputGroup';
|
|
||||||
import FormLabel from 'Components/Form/FormLabel';
|
|
||||||
import Icon from 'Components/Icon';
|
|
||||||
import Button from 'Components/Link/Button';
|
|
||||||
import ClipboardButton from 'Components/Link/ClipboardButton';
|
|
||||||
import ModalBody from 'Components/Modal/ModalBody';
|
|
||||||
import ModalContent from 'Components/Modal/ModalContent';
|
|
||||||
import ModalFooter from 'Components/Modal/ModalFooter';
|
|
||||||
import ModalHeader from 'Components/Modal/ModalHeader';
|
|
||||||
import { icons, inputTypes, kinds, sizes } from 'Helpers/Props';
|
|
||||||
import translate from 'Utilities/String/translate';
|
|
||||||
|
|
||||||
function getUrls(state) {
|
|
||||||
const {
|
|
||||||
unmonitored,
|
|
||||||
premieresOnly,
|
|
||||||
asAllDay,
|
|
||||||
tags
|
|
||||||
} = state;
|
|
||||||
|
|
||||||
let icalUrl = `${window.location.host}${window.Sonarr.urlBase}/feed/v3/calendar/Sonarr.ics?`;
|
|
||||||
|
|
||||||
if (unmonitored) {
|
|
||||||
icalUrl += 'unmonitored=true&';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (premieresOnly) {
|
|
||||||
icalUrl += 'premieresOnly=true&';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (asAllDay) {
|
|
||||||
icalUrl += 'asAllDay=true&';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tags.length) {
|
|
||||||
icalUrl += `tags=${tags.toString()}&`;
|
|
||||||
}
|
|
||||||
|
|
||||||
icalUrl += `apikey=${encodeURIComponent(window.Sonarr.apiKey)}`;
|
|
||||||
|
|
||||||
const iCalHttpUrl = `${window.location.protocol}//${icalUrl}`;
|
|
||||||
const iCalWebCalUrl = `webcal://${icalUrl}`;
|
|
||||||
|
|
||||||
return {
|
|
||||||
iCalHttpUrl,
|
|
||||||
iCalWebCalUrl
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
class CalendarLinkModalContent extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Lifecycle
|
|
||||||
|
|
||||||
constructor(props, context) {
|
|
||||||
super(props, context);
|
|
||||||
|
|
||||||
const defaultState = {
|
|
||||||
unmonitored: false,
|
|
||||||
premieresOnly: false,
|
|
||||||
asAllDay: false,
|
|
||||||
tags: []
|
|
||||||
};
|
|
||||||
|
|
||||||
const urls = getUrls(defaultState);
|
|
||||||
|
|
||||||
this.state = {
|
|
||||||
...defaultState,
|
|
||||||
...urls
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Listeners
|
|
||||||
|
|
||||||
onInputChange = ({ name, value }) => {
|
|
||||||
const state = {
|
|
||||||
...this.state,
|
|
||||||
[name]: value
|
|
||||||
};
|
|
||||||
|
|
||||||
const urls = getUrls(state);
|
|
||||||
|
|
||||||
this.setState({
|
|
||||||
[name]: value,
|
|
||||||
...urls
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
onLinkFocus = (event) => {
|
|
||||||
event.target.select();
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const {
|
|
||||||
onModalClose
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
const {
|
|
||||||
unmonitored,
|
|
||||||
premieresOnly,
|
|
||||||
asAllDay,
|
|
||||||
tags,
|
|
||||||
iCalHttpUrl,
|
|
||||||
iCalWebCalUrl
|
|
||||||
} = this.state;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<ModalContent onModalClose={onModalClose}>
|
|
||||||
<ModalHeader>
|
|
||||||
{translate('CalendarFeed')}
|
|
||||||
</ModalHeader>
|
|
||||||
|
|
||||||
<ModalBody>
|
|
||||||
<Form>
|
|
||||||
<FormGroup>
|
|
||||||
<FormLabel>{translate('IncludeUnmonitored')}</FormLabel>
|
|
||||||
|
|
||||||
<FormInputGroup
|
|
||||||
type={inputTypes.CHECK}
|
|
||||||
name="unmonitored"
|
|
||||||
value={unmonitored}
|
|
||||||
helpText={translate('ICalIncludeUnmonitoredEpisodesHelpText')}
|
|
||||||
onChange={this.onInputChange}
|
|
||||||
/>
|
|
||||||
</FormGroup>
|
|
||||||
|
|
||||||
<FormGroup>
|
|
||||||
<FormLabel>{translate('SeasonPremieresOnly')}</FormLabel>
|
|
||||||
|
|
||||||
<FormInputGroup
|
|
||||||
type={inputTypes.CHECK}
|
|
||||||
name="premieresOnly"
|
|
||||||
value={premieresOnly}
|
|
||||||
helpText={translate('ICalSeasonPremieresOnlyHelpText')}
|
|
||||||
onChange={this.onInputChange}
|
|
||||||
/>
|
|
||||||
</FormGroup>
|
|
||||||
|
|
||||||
<FormGroup>
|
|
||||||
<FormLabel>{translate('ICalShowAsAllDayEvents')}</FormLabel>
|
|
||||||
|
|
||||||
<FormInputGroup
|
|
||||||
type={inputTypes.CHECK}
|
|
||||||
name="asAllDay"
|
|
||||||
value={asAllDay}
|
|
||||||
helpText={translate('ICalShowAsAllDayEventsHelpText')}
|
|
||||||
onChange={this.onInputChange}
|
|
||||||
/>
|
|
||||||
</FormGroup>
|
|
||||||
|
|
||||||
<FormGroup>
|
|
||||||
<FormLabel>{translate('Tags')}</FormLabel>
|
|
||||||
|
|
||||||
<FormInputGroup
|
|
||||||
type={inputTypes.TAG}
|
|
||||||
name="tags"
|
|
||||||
value={tags}
|
|
||||||
helpText={translate('ICalTagsSeriesHelpText')}
|
|
||||||
onChange={this.onInputChange}
|
|
||||||
/>
|
|
||||||
</FormGroup>
|
|
||||||
|
|
||||||
<FormGroup
|
|
||||||
size={sizes.LARGE}
|
|
||||||
>
|
|
||||||
<FormLabel>{translate('ICalFeed')}</FormLabel>
|
|
||||||
|
|
||||||
<FormInputGroup
|
|
||||||
type={inputTypes.TEXT}
|
|
||||||
name="iCalHttpUrl"
|
|
||||||
value={iCalHttpUrl}
|
|
||||||
readOnly={true}
|
|
||||||
helpText={translate('ICalFeedHelpText')}
|
|
||||||
buttons={[
|
|
||||||
<ClipboardButton
|
|
||||||
key="copy"
|
|
||||||
value={iCalHttpUrl}
|
|
||||||
kind={kinds.DEFAULT}
|
|
||||||
/>,
|
|
||||||
|
|
||||||
<FormInputButton
|
|
||||||
key="webcal"
|
|
||||||
kind={kinds.DEFAULT}
|
|
||||||
to={iCalWebCalUrl}
|
|
||||||
target="_blank"
|
|
||||||
noRouter={true}
|
|
||||||
>
|
|
||||||
<Icon name={icons.CALENDAR_O} />
|
|
||||||
</FormInputButton>
|
|
||||||
]}
|
|
||||||
onChange={this.onInputChange}
|
|
||||||
onFocus={this.onLinkFocus}
|
|
||||||
/>
|
|
||||||
</FormGroup>
|
|
||||||
</Form>
|
|
||||||
</ModalBody>
|
|
||||||
|
|
||||||
<ModalFooter>
|
|
||||||
<Button onPress={onModalClose}>
|
|
||||||
{translate('Close')}
|
|
||||||
</Button>
|
|
||||||
</ModalFooter>
|
|
||||||
</ModalContent>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CalendarLinkModalContent.propTypes = {
|
|
||||||
tagList: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
||||||
onModalClose: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default CalendarLinkModalContent;
|
|
||||||
166
frontend/src/Calendar/iCal/CalendarLinkModalContent.tsx
Normal file
166
frontend/src/Calendar/iCal/CalendarLinkModalContent.tsx
Normal file
|
|
@ -0,0 +1,166 @@
|
||||||
|
import React, { FocusEvent, useCallback, useMemo, useState } from 'react';
|
||||||
|
import Form from 'Components/Form/Form';
|
||||||
|
import FormGroup from 'Components/Form/FormGroup';
|
||||||
|
import FormInputButton from 'Components/Form/FormInputButton';
|
||||||
|
import FormInputGroup from 'Components/Form/FormInputGroup';
|
||||||
|
import FormLabel from 'Components/Form/FormLabel';
|
||||||
|
import Icon from 'Components/Icon';
|
||||||
|
import Button from 'Components/Link/Button';
|
||||||
|
import ClipboardButton from 'Components/Link/ClipboardButton';
|
||||||
|
import ModalBody from 'Components/Modal/ModalBody';
|
||||||
|
import ModalContent from 'Components/Modal/ModalContent';
|
||||||
|
import ModalFooter from 'Components/Modal/ModalFooter';
|
||||||
|
import ModalHeader from 'Components/Modal/ModalHeader';
|
||||||
|
import { icons, inputTypes, kinds, sizes } from 'Helpers/Props';
|
||||||
|
import { InputChanged } from 'typings/inputs';
|
||||||
|
import translate from 'Utilities/String/translate';
|
||||||
|
|
||||||
|
interface CalendarLinkModalContentProps {
|
||||||
|
onModalClose: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function CalendarLinkModalContent({
|
||||||
|
onModalClose,
|
||||||
|
}: CalendarLinkModalContentProps) {
|
||||||
|
const [state, setState] = useState({
|
||||||
|
unmonitored: false,
|
||||||
|
premieresOnly: false,
|
||||||
|
asAllDay: false,
|
||||||
|
tags: [],
|
||||||
|
});
|
||||||
|
|
||||||
|
const { unmonitored, premieresOnly, asAllDay, tags } = state;
|
||||||
|
|
||||||
|
const handleInputChange = useCallback(({ name, value }: InputChanged) => {
|
||||||
|
setState((prevState) => ({ ...prevState, [name]: value }));
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleLinkFocus = useCallback(
|
||||||
|
(event: FocusEvent<HTMLInputElement, Element>) => {
|
||||||
|
event.target.select();
|
||||||
|
},
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
|
const { iCalHttpUrl, iCalWebCalUrl } = useMemo(() => {
|
||||||
|
let icalUrl = `${window.location.host}${window.Sonarr.urlBase}/feed/v3/calendar/Sonarr.ics?`;
|
||||||
|
|
||||||
|
if (unmonitored) {
|
||||||
|
icalUrl += 'unmonitored=true&';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (premieresOnly) {
|
||||||
|
icalUrl += 'premieresOnly=true&';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (asAllDay) {
|
||||||
|
icalUrl += 'asAllDay=true&';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tags.length) {
|
||||||
|
icalUrl += `tags=${tags.toString()}&`;
|
||||||
|
}
|
||||||
|
|
||||||
|
icalUrl += `apikey=${encodeURIComponent(window.Sonarr.apiKey)}`;
|
||||||
|
|
||||||
|
return {
|
||||||
|
iCalHttpUrl: `${window.location.protocol}//${icalUrl}`,
|
||||||
|
iCalWebCalUrl: `webcal://${icalUrl}`,
|
||||||
|
};
|
||||||
|
}, [unmonitored, premieresOnly, asAllDay, tags]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ModalContent onModalClose={onModalClose}>
|
||||||
|
<ModalHeader>{translate('CalendarFeed')}</ModalHeader>
|
||||||
|
|
||||||
|
<ModalBody>
|
||||||
|
<Form>
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('IncludeUnmonitored')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.CHECK}
|
||||||
|
name="unmonitored"
|
||||||
|
value={unmonitored}
|
||||||
|
helpText={translate('ICalIncludeUnmonitoredEpisodesHelpText')}
|
||||||
|
onChange={handleInputChange}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('SeasonPremieresOnly')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.CHECK}
|
||||||
|
name="premieresOnly"
|
||||||
|
value={premieresOnly}
|
||||||
|
helpText={translate('ICalSeasonPremieresOnlyHelpText')}
|
||||||
|
onChange={handleInputChange}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('ICalShowAsAllDayEvents')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.CHECK}
|
||||||
|
name="asAllDay"
|
||||||
|
value={asAllDay}
|
||||||
|
helpText={translate('ICalShowAsAllDayEventsHelpText')}
|
||||||
|
onChange={handleInputChange}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('Tags')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.SERIES_TAG}
|
||||||
|
name="tags"
|
||||||
|
value={tags}
|
||||||
|
helpText={translate('ICalTagsSeriesHelpText')}
|
||||||
|
onChange={handleInputChange}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup size={sizes.LARGE}>
|
||||||
|
<FormLabel>{translate('ICalFeed')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.TEXT}
|
||||||
|
name="iCalHttpUrl"
|
||||||
|
value={iCalHttpUrl}
|
||||||
|
readOnly={true}
|
||||||
|
helpText={translate('ICalFeedHelpText')}
|
||||||
|
buttons={[
|
||||||
|
<ClipboardButton
|
||||||
|
key="copy"
|
||||||
|
value={iCalHttpUrl}
|
||||||
|
kind={kinds.DEFAULT}
|
||||||
|
/>,
|
||||||
|
|
||||||
|
<FormInputButton
|
||||||
|
key="webcal"
|
||||||
|
kind={kinds.DEFAULT}
|
||||||
|
to={iCalWebCalUrl}
|
||||||
|
target="_blank"
|
||||||
|
noRouter={true}
|
||||||
|
>
|
||||||
|
<Icon name={icons.CALENDAR_O} />
|
||||||
|
</FormInputButton>,
|
||||||
|
]}
|
||||||
|
onChange={handleInputChange}
|
||||||
|
onFocus={handleLinkFocus}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
</Form>
|
||||||
|
</ModalBody>
|
||||||
|
|
||||||
|
<ModalFooter>
|
||||||
|
<Button onPress={onModalClose}>{translate('Close')}</Button>
|
||||||
|
</ModalFooter>
|
||||||
|
</ModalContent>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default CalendarLinkModalContent;
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
import { connect } from 'react-redux';
|
|
||||||
import { createSelector } from 'reselect';
|
|
||||||
import createTagsSelector from 'Store/Selectors/createTagsSelector';
|
|
||||||
import CalendarLinkModalContent from './CalendarLinkModalContent';
|
|
||||||
|
|
||||||
function createMapStateToProps() {
|
|
||||||
return createSelector(
|
|
||||||
createTagsSelector(),
|
|
||||||
(tagList) => {
|
|
||||||
return {
|
|
||||||
tagList
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default connect(createMapStateToProps)(CalendarLinkModalContent);
|
|
||||||
|
|
@ -26,6 +26,7 @@ export interface CommandBody {
|
||||||
seriesId?: number;
|
seriesId?: number;
|
||||||
seriesIds?: number[];
|
seriesIds?: number[];
|
||||||
seasonNumber?: number;
|
seasonNumber?: number;
|
||||||
|
episodeIds?: number[];
|
||||||
[key: string]: string | number | boolean | number[] | undefined;
|
[key: string]: string | number | boolean | number[] | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
import classNames from 'classnames';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import React from 'react';
|
|
||||||
import { kinds } from 'Helpers/Props';
|
|
||||||
import styles from './Alert.css';
|
|
||||||
|
|
||||||
function Alert(props) {
|
|
||||||
const { className, kind, children, ...otherProps } = props;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
className={classNames(
|
|
||||||
className,
|
|
||||||
styles[kind]
|
|
||||||
)}
|
|
||||||
{...otherProps}
|
|
||||||
>
|
|
||||||
{children}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Alert.propTypes = {
|
|
||||||
className: PropTypes.string,
|
|
||||||
kind: PropTypes.oneOf(kinds.all),
|
|
||||||
children: PropTypes.node.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
Alert.defaultProps = {
|
|
||||||
className: styles.alert,
|
|
||||||
kind: kinds.INFO
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Alert;
|
|
||||||
18
frontend/src/Components/Alert.tsx
Normal file
18
frontend/src/Components/Alert.tsx
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
import classNames from 'classnames';
|
||||||
|
import React from 'react';
|
||||||
|
import { Kind } from 'Helpers/Props/kinds';
|
||||||
|
import styles from './Alert.css';
|
||||||
|
|
||||||
|
interface AlertProps {
|
||||||
|
className?: string;
|
||||||
|
kind?: Extract<Kind, keyof typeof styles>;
|
||||||
|
children: React.ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
function Alert(props: AlertProps) {
|
||||||
|
const { className = styles.alert, kind = 'info', children } = props;
|
||||||
|
|
||||||
|
return <div className={classNames(className, styles[kind])}>{children}</div>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Alert;
|
||||||
|
|
@ -1,60 +0,0 @@
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import Link from 'Components/Link/Link';
|
|
||||||
import styles from './Card.css';
|
|
||||||
|
|
||||||
class Card extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const {
|
|
||||||
className,
|
|
||||||
overlayClassName,
|
|
||||||
overlayContent,
|
|
||||||
children,
|
|
||||||
onPress
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
if (overlayContent) {
|
|
||||||
return (
|
|
||||||
<div className={className}>
|
|
||||||
<Link
|
|
||||||
className={styles.underlay}
|
|
||||||
onPress={onPress}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<div className={overlayClassName}>
|
|
||||||
{children}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Link
|
|
||||||
className={className}
|
|
||||||
onPress={onPress}
|
|
||||||
>
|
|
||||||
{children}
|
|
||||||
</Link>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Card.propTypes = {
|
|
||||||
className: PropTypes.string.isRequired,
|
|
||||||
overlayClassName: PropTypes.string.isRequired,
|
|
||||||
overlayContent: PropTypes.bool.isRequired,
|
|
||||||
children: PropTypes.node.isRequired,
|
|
||||||
onPress: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
Card.defaultProps = {
|
|
||||||
className: styles.card,
|
|
||||||
overlayClassName: styles.overlay,
|
|
||||||
overlayContent: false
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Card;
|
|
||||||
39
frontend/src/Components/Card.tsx
Normal file
39
frontend/src/Components/Card.tsx
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
import React from 'react';
|
||||||
|
import Link, { LinkProps } from 'Components/Link/Link';
|
||||||
|
import styles from './Card.css';
|
||||||
|
|
||||||
|
interface CardProps extends Pick<LinkProps, 'onPress'> {
|
||||||
|
// TODO: Consider using different properties for classname depending if it's overlaying content or not
|
||||||
|
className?: string;
|
||||||
|
overlayClassName?: string;
|
||||||
|
overlayContent?: boolean;
|
||||||
|
children: React.ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
function Card(props: CardProps) {
|
||||||
|
const {
|
||||||
|
className = styles.card,
|
||||||
|
overlayClassName = styles.overlay,
|
||||||
|
overlayContent = false,
|
||||||
|
children,
|
||||||
|
onPress,
|
||||||
|
} = props;
|
||||||
|
|
||||||
|
if (overlayContent) {
|
||||||
|
return (
|
||||||
|
<div className={className}>
|
||||||
|
<Link className={styles.underlay} onPress={onPress} />
|
||||||
|
|
||||||
|
<div className={overlayClassName}>{children}</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Link className={className} onPress={onPress}>
|
||||||
|
{children}
|
||||||
|
</Link>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Card;
|
||||||
|
|
@ -1,138 +0,0 @@
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import styles from './CircularProgressBar.css';
|
|
||||||
|
|
||||||
class CircularProgressBar extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Lifecycle
|
|
||||||
|
|
||||||
constructor(props, context) {
|
|
||||||
super(props, context);
|
|
||||||
|
|
||||||
this.state = {
|
|
||||||
progress: 0
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidMount() {
|
|
||||||
this._progressStep();
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidUpdate(prevProps) {
|
|
||||||
const progress = this.props.progress;
|
|
||||||
|
|
||||||
if (prevProps.progress !== progress) {
|
|
||||||
this._cancelProgressStep();
|
|
||||||
this._progressStep();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillUnmount() {
|
|
||||||
this._cancelProgressStep();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Control
|
|
||||||
|
|
||||||
_progressStep() {
|
|
||||||
this.requestAnimationFrame = window.requestAnimationFrame(() => {
|
|
||||||
this.setState({
|
|
||||||
progress: this.state.progress + 1
|
|
||||||
}, () => {
|
|
||||||
if (this.state.progress < this.props.progress) {
|
|
||||||
this._progressStep();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
_cancelProgressStep() {
|
|
||||||
if (this.requestAnimationFrame) {
|
|
||||||
window.cancelAnimationFrame(this.requestAnimationFrame);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const {
|
|
||||||
className,
|
|
||||||
containerClassName,
|
|
||||||
size,
|
|
||||||
strokeWidth,
|
|
||||||
strokeColor,
|
|
||||||
showProgressText
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
const progress = this.state.progress;
|
|
||||||
|
|
||||||
const center = size / 2;
|
|
||||||
const radius = center - strokeWidth;
|
|
||||||
const circumference = Math.PI * (radius * 2);
|
|
||||||
const sizeInPixels = `${size}px`;
|
|
||||||
const strokeDashoffset = ((100 - progress) / 100) * circumference;
|
|
||||||
const progressText = `${Math.round(progress)}%`;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
className={containerClassName}
|
|
||||||
style={{
|
|
||||||
width: sizeInPixels,
|
|
||||||
height: sizeInPixels,
|
|
||||||
lineHeight: sizeInPixels
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
className={className}
|
|
||||||
version="1.1"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
width={size}
|
|
||||||
height={size}
|
|
||||||
>
|
|
||||||
<circle
|
|
||||||
fill="transparent"
|
|
||||||
r={radius}
|
|
||||||
cx={center}
|
|
||||||
cy={center}
|
|
||||||
strokeDasharray={circumference}
|
|
||||||
style={{
|
|
||||||
stroke: strokeColor,
|
|
||||||
strokeWidth,
|
|
||||||
strokeDashoffset
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
|
|
||||||
{
|
|
||||||
showProgressText &&
|
|
||||||
<div className={styles.circularProgressBarText}>
|
|
||||||
{progressText}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CircularProgressBar.propTypes = {
|
|
||||||
className: PropTypes.string,
|
|
||||||
containerClassName: PropTypes.string,
|
|
||||||
size: PropTypes.number,
|
|
||||||
progress: PropTypes.number.isRequired,
|
|
||||||
strokeWidth: PropTypes.number,
|
|
||||||
strokeColor: PropTypes.string,
|
|
||||||
showProgressText: PropTypes.bool
|
|
||||||
};
|
|
||||||
|
|
||||||
CircularProgressBar.defaultProps = {
|
|
||||||
className: styles.circularProgressBar,
|
|
||||||
containerClassName: styles.circularProgressBarContainer,
|
|
||||||
size: 60,
|
|
||||||
strokeWidth: 5,
|
|
||||||
strokeColor: '#35c5f4',
|
|
||||||
showProgressText: false
|
|
||||||
};
|
|
||||||
|
|
||||||
export default CircularProgressBar;
|
|
||||||
99
frontend/src/Components/CircularProgressBar.tsx
Normal file
99
frontend/src/Components/CircularProgressBar.tsx
Normal file
|
|
@ -0,0 +1,99 @@
|
||||||
|
import React, { useCallback, useEffect, useState } from 'react';
|
||||||
|
import styles from './CircularProgressBar.css';
|
||||||
|
|
||||||
|
interface CircularProgressBarProps {
|
||||||
|
className?: string;
|
||||||
|
containerClassName?: string;
|
||||||
|
size?: number;
|
||||||
|
progress: number;
|
||||||
|
strokeWidth?: number;
|
||||||
|
strokeColor?: string;
|
||||||
|
showProgressText?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
function CircularProgressBar({
|
||||||
|
className = styles.circularProgressBar,
|
||||||
|
containerClassName = styles.circularProgressBarContainer,
|
||||||
|
size = 60,
|
||||||
|
strokeWidth = 5,
|
||||||
|
strokeColor = '#35c5f4',
|
||||||
|
showProgressText = false,
|
||||||
|
progress,
|
||||||
|
}: CircularProgressBarProps) {
|
||||||
|
const [currentProgress, setCurrentProgress] = useState(0);
|
||||||
|
const raf = React.useRef<number>(0);
|
||||||
|
const center = size / 2;
|
||||||
|
const radius = center - strokeWidth;
|
||||||
|
const circumference = Math.PI * (radius * 2);
|
||||||
|
const sizeInPixels = `${size}px`;
|
||||||
|
const strokeDashoffset = ((100 - currentProgress) / 100) * circumference;
|
||||||
|
const progressText = `${Math.round(currentProgress)}%`;
|
||||||
|
|
||||||
|
const handleAnimation = useCallback(
|
||||||
|
(p: number) => {
|
||||||
|
setCurrentProgress((prevProgress) => {
|
||||||
|
if (prevProgress < p) {
|
||||||
|
return prevProgress + Math.min(1, p - prevProgress);
|
||||||
|
}
|
||||||
|
|
||||||
|
return prevProgress;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
[setCurrentProgress]
|
||||||
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (progress > currentProgress) {
|
||||||
|
cancelAnimationFrame(raf.current);
|
||||||
|
|
||||||
|
raf.current = requestAnimationFrame(() => handleAnimation(progress));
|
||||||
|
}
|
||||||
|
}, [progress, currentProgress, handleAnimation]);
|
||||||
|
|
||||||
|
useEffect(
|
||||||
|
() => {
|
||||||
|
return () => cancelAnimationFrame(raf.current);
|
||||||
|
},
|
||||||
|
// We only want to run this effect once
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={containerClassName}
|
||||||
|
style={{
|
||||||
|
width: sizeInPixels,
|
||||||
|
height: sizeInPixels,
|
||||||
|
lineHeight: sizeInPixels,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
className={className}
|
||||||
|
version="1.1"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width={size}
|
||||||
|
height={size}
|
||||||
|
>
|
||||||
|
<circle
|
||||||
|
fill="transparent"
|
||||||
|
r={radius}
|
||||||
|
cx={center}
|
||||||
|
cy={center}
|
||||||
|
strokeDasharray={circumference}
|
||||||
|
style={{
|
||||||
|
stroke: strokeColor,
|
||||||
|
strokeWidth,
|
||||||
|
strokeDashoffset,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
{showProgressText && (
|
||||||
|
<div className={styles.circularProgressBarText}>{progressText}</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default CircularProgressBar;
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import styles from './DescriptionList.css';
|
|
||||||
|
|
||||||
class DescriptionList extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const {
|
|
||||||
className,
|
|
||||||
children
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<dl className={className}>
|
|
||||||
{children}
|
|
||||||
</dl>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DescriptionList.propTypes = {
|
|
||||||
className: PropTypes.string.isRequired,
|
|
||||||
children: PropTypes.node
|
|
||||||
};
|
|
||||||
|
|
||||||
DescriptionList.defaultProps = {
|
|
||||||
className: styles.descriptionList
|
|
||||||
};
|
|
||||||
|
|
||||||
export default DescriptionList;
|
|
||||||
15
frontend/src/Components/DescriptionList/DescriptionList.tsx
Normal file
15
frontend/src/Components/DescriptionList/DescriptionList.tsx
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
import React from 'react';
|
||||||
|
import styles from './DescriptionList.css';
|
||||||
|
|
||||||
|
interface DescriptionListProps {
|
||||||
|
className?: string;
|
||||||
|
children?: React.ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
function DescriptionList(props: DescriptionListProps) {
|
||||||
|
const { className = styles.descriptionList, children } = props;
|
||||||
|
|
||||||
|
return <dl className={className}>{children}</dl>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default DescriptionList;
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
|
||||||
import DescriptionListItemDescription from './DescriptionListItemDescription';
|
|
||||||
import DescriptionListItemTitle from './DescriptionListItemTitle';
|
|
||||||
|
|
||||||
class DescriptionListItem extends Component {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Render
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const {
|
|
||||||
className,
|
|
||||||
titleClassName,
|
|
||||||
descriptionClassName,
|
|
||||||
title,
|
|
||||||
data
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className={className}>
|
|
||||||
<DescriptionListItemTitle
|
|
||||||
className={titleClassName}
|
|
||||||
>
|
|
||||||
{title}
|
|
||||||
</DescriptionListItemTitle>
|
|
||||||
|
|
||||||
<DescriptionListItemDescription
|
|
||||||
className={descriptionClassName}
|
|
||||||
>
|
|
||||||
{data}
|
|
||||||
</DescriptionListItemDescription>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DescriptionListItem.propTypes = {
|
|
||||||
className: PropTypes.string,
|
|
||||||
titleClassName: PropTypes.string,
|
|
||||||
descriptionClassName: PropTypes.string,
|
|
||||||
title: PropTypes.string,
|
|
||||||
data: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.node])
|
|
||||||
};
|
|
||||||
|
|
||||||
export default DescriptionListItem;
|
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
import React from 'react';
|
||||||
|
import DescriptionListItemDescription, {
|
||||||
|
DescriptionListItemDescriptionProps,
|
||||||
|
} from './DescriptionListItemDescription';
|
||||||
|
import DescriptionListItemTitle, {
|
||||||
|
DescriptionListItemTitleProps,
|
||||||
|
} from './DescriptionListItemTitle';
|
||||||
|
|
||||||
|
interface DescriptionListItemProps {
|
||||||
|
className?: string;
|
||||||
|
titleClassName?: DescriptionListItemTitleProps['className'];
|
||||||
|
descriptionClassName?: DescriptionListItemDescriptionProps['className'];
|
||||||
|
title?: DescriptionListItemTitleProps['children'];
|
||||||
|
data?: DescriptionListItemDescriptionProps['children'];
|
||||||
|
}
|
||||||
|
|
||||||
|
function DescriptionListItem(props: DescriptionListItemProps) {
|
||||||
|
const { className, titleClassName, descriptionClassName, title, data } =
|
||||||
|
props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={className}>
|
||||||
|
<DescriptionListItemTitle className={titleClassName}>
|
||||||
|
{title}
|
||||||
|
</DescriptionListItemTitle>
|
||||||
|
|
||||||
|
<DescriptionListItemDescription className={descriptionClassName}>
|
||||||
|
{data}
|
||||||
|
</DescriptionListItemDescription>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default DescriptionListItem;
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import React from 'react';
|
|
||||||
import styles from './DescriptionListItemDescription.css';
|
|
||||||
|
|
||||||
function DescriptionListItemDescription(props) {
|
|
||||||
const {
|
|
||||||
className,
|
|
||||||
children
|
|
||||||
} = props;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<dd className={className}>
|
|
||||||
{children}
|
|
||||||
</dd>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
DescriptionListItemDescription.propTypes = {
|
|
||||||
className: PropTypes.string.isRequired,
|
|
||||||
children: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.node])
|
|
||||||
};
|
|
||||||
|
|
||||||
DescriptionListItemDescription.defaultProps = {
|
|
||||||
className: styles.description
|
|
||||||
};
|
|
||||||
|
|
||||||
export default DescriptionListItemDescription;
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue