diff --git a/.devcontainer/Lidarr.code-workspace b/.devcontainer/Lidarr.code-workspace deleted file mode 100644 index a46158e44..000000000 --- a/.devcontainer/Lidarr.code-workspace +++ /dev/null @@ -1,13 +0,0 @@ -// This file is used to open the backend and frontend in the same workspace, which is necessary as -// the frontend has vscode settings that are distinct from the backend -{ - "folders": [ - { - "path": ".." - }, - { - "path": "../frontend" - } - ], - "settings": {} -} diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json deleted file mode 100644 index d0fa03d5f..000000000 --- a/.devcontainer/devcontainer.json +++ /dev/null @@ -1,19 +0,0 @@ -// For format details, see https://aka.ms/devcontainer.json. For config options, see the -// README at: https://github.com/devcontainers/templates/tree/main/src/dotnet -{ - "name": "Lidarr", - "image": "mcr.microsoft.com/devcontainers/dotnet:1-6.0", - "features": { - "ghcr.io/devcontainers/features/node:1": { - "nodeGypDependencies": true, - "version": "20", - "nvmVersion": "latest" - } - }, - "forwardPorts": [8686], - "customizations": { - "vscode": { - "extensions": ["esbenp.prettier-vscode"] - } - } -} diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 57d971bc4..000000000 --- a/.editorconfig +++ /dev/null @@ -1,286 +0,0 @@ -# This file is for unifying the coding style for different editors and IDEs -# editorconfig.org -root = true - -# NOTE: Requires **VS2019 16.3** or later - -# Stylecop.ruleset -# Description: Rules for Lidarr - -# Code files -[*.cs] -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true -indent_style = space -indent_size = 4 - -# Sort using and Import directives with System.* appearing first -dotnet_sort_system_directives_first = true - -# Avoid "this." and "Me." if not necessary -dotnet_style_qualification_for_field = false:warning -dotnet_style_qualification_for_property = false:warning -dotnet_style_qualification_for_method = false:warning -dotnet_style_qualification_for_event = false:warning - -# Indentation preferences -csharp_indent_block_contents = true -csharp_indent_braces = false -csharp_indent_case_contents = true -csharp_indent_case_contents_when_block = true -csharp_indent_switch_labels = true -csharp_indent_labels = flush_left - -dotnet_style_qualification_for_field = false:suggestion -dotnet_style_qualification_for_property = false:suggestion -dotnet_style_qualification_for_method = false:suggestion -dotnet_style_qualification_for_event = false:suggestion -dotnet_naming_style.instance_field_style.capitalization = camel_case -dotnet_naming_style.instance_field_style.required_prefix = _ - -# Prefer "var" everywhere -csharp_style_var_for_built_in_types = true -csharp_style_var_when_type_is_apparent = true -csharp_style_var_elsewhere = true -# Prefer "out" variables to be declared inline -csharp_style_inlined_variable_declaration = true - -# Using directive is unnecessary. -dotnet_diagnostic.IDE0005.severity = error -# Use var instead of explicit type -dotnet_diagnostic.IDE0007.severity = error -# Inline variable declaration -dotnet_diagnostic.IDE0018.severity = error - -# Stylecop Rules -dotnet_diagnostic.SA0001.severity = none -dotnet_diagnostic.SA1025.severity = none -dotnet_diagnostic.SA1101.severity = none -dotnet_diagnostic.SA1116.severity = none -dotnet_diagnostic.SA1118.severity = none -dotnet_diagnostic.SA1122.severity = none -dotnet_diagnostic.SA1201.severity = suggestion -dotnet_diagnostic.SA1202.severity = suggestion -dotnet_diagnostic.SA1204.severity = suggestion -dotnet_diagnostic.SA1300.severity = none -dotnet_diagnostic.SA1303.severity = none -dotnet_diagnostic.SA1304.severity = none -dotnet_diagnostic.SA1306.severity = none -dotnet_diagnostic.SA1309.severity = none -dotnet_diagnostic.SA1310.severity = none -dotnet_diagnostic.SA1401.severity = none -dotnet_diagnostic.SA1402.severity = none -dotnet_diagnostic.SA1404.severity = suggestion -dotnet_diagnostic.SA1405.severity = suggestion -dotnet_diagnostic.SA1406.severity = suggestion -dotnet_diagnostic.SA1410.severity = suggestion -dotnet_diagnostic.SA1411.severity = suggestion -dotnet_diagnostic.SA1413.severity = none -dotnet_diagnostic.SA1512.severity = none -dotnet_diagnostic.SA1516.severity = none -dotnet_diagnostic.SA1600.severity = none -dotnet_diagnostic.SA1601.severity = none -dotnet_diagnostic.SA1602.severity = none -dotnet_diagnostic.SA1604.severity = none -dotnet_diagnostic.SA1605.severity = none -dotnet_diagnostic.SA1606.severity = none -dotnet_diagnostic.SA1607.severity = none -dotnet_diagnostic.SA1608.severity = none -dotnet_diagnostic.SA1610.severity = none -dotnet_diagnostic.SA1611.severity = none -dotnet_diagnostic.SA1612.severity = none -dotnet_diagnostic.SA1613.severity = none -dotnet_diagnostic.SA1614.severity = none -dotnet_diagnostic.SA1615.severity = none -dotnet_diagnostic.SA1616.severity = none -dotnet_diagnostic.SA1617.severity = none -dotnet_diagnostic.SA1618.severity = none -dotnet_diagnostic.SA1619.severity = none -dotnet_diagnostic.SA1620.severity = none -dotnet_diagnostic.SA1621.severity = none -dotnet_diagnostic.SA1622.severity = none -dotnet_diagnostic.SA1623.severity = none -dotnet_diagnostic.SA1624.severity = none -dotnet_diagnostic.SA1625.severity = none -dotnet_diagnostic.SA1626.severity = none -dotnet_diagnostic.SA1627.severity = none -dotnet_diagnostic.SA1629.severity = none -dotnet_diagnostic.SA1633.severity = none -dotnet_diagnostic.SA1634.severity = none -dotnet_diagnostic.SA1635.severity = none -dotnet_diagnostic.SA1636.severity = none -dotnet_diagnostic.SA1637.severity = none -dotnet_diagnostic.SA1638.severity = none -dotnet_diagnostic.SA1640.severity = none -dotnet_diagnostic.SA1641.severity = none -dotnet_diagnostic.SA1642.severity = none -dotnet_diagnostic.SA1643.severity = none -dotnet_diagnostic.SA1648.severity = none -dotnet_diagnostic.SA1649.severity = none -dotnet_diagnostic.SA1651.severity = none -dotnet_diagnostic.SX1309.severity = warning - -# Microsoft Analyzers that fail and need to be sorted thru -dotnet_diagnostic.ASP0000.severity = suggestion -dotnet_diagnostic.CA1000.severity = suggestion -dotnet_diagnostic.CA1001.severity = suggestion -dotnet_diagnostic.CA1002.severity = suggestion -dotnet_diagnostic.CA1003.severity = suggestion -dotnet_diagnostic.CA1008.severity = suggestion -dotnet_diagnostic.CA1010.severity = suggestion -dotnet_diagnostic.CA1012.severity = suggestion -dotnet_diagnostic.CA1014.severity = suggestion -dotnet_diagnostic.CA1016.severity = suggestion -dotnet_diagnostic.CA1017.severity = suggestion -dotnet_diagnostic.CA1018.severity = suggestion -dotnet_diagnostic.CA1019.severity = suggestion -dotnet_diagnostic.CA1021.severity = suggestion -dotnet_diagnostic.CA1024.severity = suggestion -dotnet_diagnostic.CA1027.severity = suggestion -dotnet_diagnostic.CA1028.severity = suggestion -dotnet_diagnostic.CA1030.severity = suggestion -dotnet_diagnostic.CA1031.severity = suggestion -dotnet_diagnostic.CA1032.severity = suggestion -dotnet_diagnostic.CA1033.severity = suggestion -dotnet_diagnostic.CA1034.severity = suggestion -dotnet_diagnostic.CA1036.severity = suggestion -dotnet_diagnostic.CA1040.severity = suggestion -dotnet_diagnostic.CA1041.severity = suggestion -dotnet_diagnostic.CA1043.severity = suggestion -dotnet_diagnostic.CA1044.severity = suggestion -dotnet_diagnostic.CA1050.severity = suggestion -dotnet_diagnostic.CA1051.severity = suggestion -dotnet_diagnostic.CA1052.severity = suggestion -dotnet_diagnostic.CA1054.severity = suggestion -dotnet_diagnostic.CA1055.severity = suggestion -dotnet_diagnostic.CA1056.severity = suggestion -dotnet_diagnostic.CA1058.severity = suggestion -dotnet_diagnostic.CA1060.severity = suggestion -dotnet_diagnostic.CA1061.severity = suggestion -dotnet_diagnostic.CA1062.severity = suggestion -dotnet_diagnostic.CA1063.severity = suggestion -dotnet_diagnostic.CA1064.severity = suggestion -dotnet_diagnostic.CA1065.severity = suggestion -dotnet_diagnostic.CA1066.severity = suggestion -dotnet_diagnostic.CA1067.severity = suggestion -dotnet_diagnostic.CA1068.severity = suggestion -dotnet_diagnostic.CA1069.severity = suggestion -dotnet_diagnostic.CA1200.severity = suggestion -dotnet_diagnostic.CA1303.severity = suggestion -dotnet_diagnostic.CA1304.severity = suggestion -dotnet_diagnostic.CA1305.severity = suggestion -dotnet_diagnostic.CA1307.severity = suggestion -dotnet_diagnostic.CA1308.severity = suggestion -dotnet_diagnostic.CA1309.severity = suggestion -dotnet_diagnostic.CA1310.severity = suggestion -dotnet_diagnostic.CA1401.severity = suggestion -dotnet_diagnostic.CA1416.severity = suggestion -dotnet_diagnostic.CA1419.severity = suggestion -dotnet_diagnostic.CA1507.severity = suggestion -dotnet_diagnostic.CA1508.severity = suggestion -dotnet_diagnostic.CA1707.severity = suggestion -dotnet_diagnostic.CA1708.severity = suggestion -dotnet_diagnostic.CA1710.severity = suggestion -dotnet_diagnostic.CA1711.severity = suggestion -dotnet_diagnostic.CA1712.severity = suggestion -dotnet_diagnostic.CA1714.severity = suggestion -dotnet_diagnostic.CA1715.severity = suggestion -dotnet_diagnostic.CA1716.severity = suggestion -dotnet_diagnostic.CA1717.severity = suggestion -dotnet_diagnostic.CA1720.severity = suggestion -dotnet_diagnostic.CA1721.severity = suggestion -dotnet_diagnostic.CA1724.severity = suggestion -dotnet_diagnostic.CA1725.severity = suggestion -dotnet_diagnostic.CA1806.severity = suggestion -dotnet_diagnostic.CA1810.severity = suggestion -dotnet_diagnostic.CA1812.severity = suggestion -dotnet_diagnostic.CA1813.severity = suggestion -dotnet_diagnostic.CA1814.severity = suggestion -dotnet_diagnostic.CA1815.severity = suggestion -dotnet_diagnostic.CA1816.severity = suggestion -dotnet_diagnostic.CA1819.severity = suggestion -dotnet_diagnostic.CA1822.severity = suggestion -dotnet_diagnostic.CA1823.severity = suggestion -dotnet_diagnostic.CA1824.severity = suggestion -dotnet_diagnostic.CA1848.severity = suggestion -dotnet_diagnostic.CA2000.severity = suggestion -dotnet_diagnostic.CA2002.severity = suggestion -dotnet_diagnostic.CA2007.severity = suggestion -dotnet_diagnostic.CA2008.severity = suggestion -dotnet_diagnostic.CA2012.severity = suggestion -dotnet_diagnostic.CA2013.severity = suggestion -dotnet_diagnostic.CA2100.severity = suggestion -dotnet_diagnostic.CA2101.severity = suggestion -dotnet_diagnostic.CA2119.severity = suggestion -dotnet_diagnostic.CA2153.severity = suggestion -dotnet_diagnostic.CA2200.severity = suggestion -dotnet_diagnostic.CA2201.severity = suggestion -dotnet_diagnostic.CA2207.severity = suggestion -dotnet_diagnostic.CA2208.severity = suggestion -dotnet_diagnostic.CA2211.severity = suggestion -dotnet_diagnostic.CA2213.severity = suggestion -dotnet_diagnostic.CA2214.severity = suggestion -dotnet_diagnostic.CA2215.severity = suggestion -dotnet_diagnostic.CA2216.severity = suggestion -dotnet_diagnostic.CA2219.severity = suggestion -dotnet_diagnostic.CA2225.severity = suggestion -dotnet_diagnostic.CA2226.severity = suggestion -dotnet_diagnostic.CA2227.severity = suggestion -dotnet_diagnostic.CA2229.severity = suggestion -dotnet_diagnostic.CA2231.severity = suggestion -dotnet_diagnostic.CA2234.severity = suggestion -dotnet_diagnostic.CA2235.severity = suggestion -dotnet_diagnostic.CA2237.severity = suggestion -dotnet_diagnostic.CA2241.severity = suggestion -dotnet_diagnostic.CA2242.severity = suggestion -dotnet_diagnostic.CA2243.severity = suggestion -dotnet_diagnostic.CA2244.severity = suggestion -dotnet_diagnostic.CA2245.severity = suggestion -dotnet_diagnostic.CA2246.severity = suggestion -dotnet_diagnostic.CA2249.severity = suggestion -dotnet_diagnostic.CA2251.severity = suggestion -dotnet_diagnostic.CA2254.severity = suggestion -dotnet_diagnostic.CA3061.severity = suggestion -dotnet_diagnostic.CA3075.severity = suggestion -dotnet_diagnostic.CA3076.severity = suggestion -dotnet_diagnostic.CA3077.severity = suggestion -dotnet_diagnostic.CA3147.severity = suggestion -dotnet_diagnostic.CA5350.severity = suggestion -dotnet_diagnostic.CA5351.severity = suggestion -dotnet_diagnostic.CA5359.severity = suggestion -dotnet_diagnostic.CA5360.severity = suggestion -dotnet_diagnostic.CA5363.severity = suggestion -dotnet_diagnostic.CA5364.severity = suggestion -dotnet_diagnostic.CA5365.severity = suggestion -dotnet_diagnostic.CA5366.severity = suggestion -dotnet_diagnostic.CA5368.severity = suggestion -dotnet_diagnostic.CA5369.severity = suggestion -dotnet_diagnostic.CA5370.severity = suggestion -dotnet_diagnostic.CA5371.severity = suggestion -dotnet_diagnostic.CA5372.severity = suggestion -dotnet_diagnostic.CA5373.severity = suggestion -dotnet_diagnostic.CA5374.severity = suggestion -dotnet_diagnostic.CA5379.severity = suggestion -dotnet_diagnostic.CA5384.severity = suggestion -dotnet_diagnostic.CA5385.severity = suggestion -dotnet_diagnostic.CA5392.severity = suggestion -dotnet_diagnostic.CA5394.severity = suggestion -dotnet_diagnostic.CA5397.severity = suggestion - -dotnet_diagnostic.SYSLIB0006.severity = none - -[*.{js,html,hbs,less,css,ts,tsx}] -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true -indent_style = space -indent_size = 2 - -# They have troubles with TABS. Use 2 spaces -[{package.json,.travis.yml}] -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true -indent_style = space -indent_size = 2 diff --git a/.gitattributes b/.gitattributes index d98f8fb96..1b274cb93 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,10 +1,22 @@ # Auto detect text files and perform LF normalization -* text=auto - -# Explicitly set bash scripts to have unix endings -*.sh text eol=lf -distribution/osx/Lidarr text eol=lf +*text eol=lf # Custom for Visual Studio *.cs diff=csharp -*.sln merge=union \ No newline at end of file +*.sln merge=union +*.csproj merge=union +*.vbproj merge=union +*.fsproj merge=union +*.dbproj merge=union + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain \ No newline at end of file diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index 49c3e2d71..000000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1,9 +0,0 @@ -# These are supported funding model platforms - -github: lidarr # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] -patreon: # Replace with a single Patreon username -open_collective: lidarr -ko_fi: # Replace with a single Ko-fi username -tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel -community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry -custom: # Replace with a single custom sponsorship URL diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml deleted file mode 100644 index 491815370..000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ /dev/null @@ -1,83 +0,0 @@ -name: Bug Report -description: 'Report a new bug, if you are not 100% certain this is a bug please go to our Discord first' -labels: ['Type: Bug', 'Status: Needs Triage'] -body: -- type: checkboxes - attributes: - label: Is there an existing issue for this? - description: Please search to see if an open or closed issue already exists for the bug you encountered. If a bug exists and is closed note that it may only be fixed in an unstable branch. - options: - - label: I have searched the existing open and closed issues - required: true -- type: textarea - attributes: - label: Current Behavior - description: A concise description of what you're experiencing. - validations: - required: true -- type: textarea - attributes: - label: Expected Behavior - description: A concise description of what you expected to happen. - validations: - required: true -- type: textarea - attributes: - label: Steps To Reproduce - description: Steps to reproduce the behavior. - placeholder: | - 1. In this environment... - 2. With this config... - 3. Run '...' - 4. See error... - validations: - required: false -- type: textarea - attributes: - label: Environment - description: | - examples: - - **OS**: Ubuntu 20.04 - - **Lidarr**: Lidarr 0.8.1.2135 - - **Docker Install**: Yes - - **Using Reverse Proxy**: No - - **Browser**: Firefox 90 (If UI related) - - **Database**: Sqlite 3.36.0 - value: | - - OS: - - Lidarr: - - Docker Install: - - Using Reverse Proxy: - - Browser: - - Database: - render: markdown - validations: - required: true -- type: dropdown - attributes: - label: What branch are you running? - options: - - Master - - Develop - - Nightly - - Plugins (experimental) - - Other (This issue will be closed) - validations: - required: true -- type: textarea - attributes: - label: Trace Logs? - description: | - Trace Logs (https://wiki.servarr.com/lidarr/troubleshooting#logging-and-log-files) - ***Generally speaking, all bug reports must have trace logs provided.*** - Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in. - Additionally, any additional info? Screenshots? References? Anything that will give us more context about the issue you are encountering! - validations: - required: true -- type: checkboxes - attributes: - label: Trace Logs have been provided as applicable. Reports may be closed if the required logs are not provided. - description: Trace logs are generally required for all bug reports and contain `trace`. Info logs are invalid for bug reports and do not contain `debug` nor `trace` - options: - - label: I have read and followed the steps in the wiki link above and provided the required trace logs - the logs contain `trace` - that are relevant and show this issue. - required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml deleted file mode 100644 index 880a682f4..000000000 --- a/.github/ISSUE_TEMPLATE/config.yml +++ /dev/null @@ -1,5 +0,0 @@ -blank_issues_enabled: false -contact_links: - - name: Support via Discord - url: https://lidarr.audio/discord - about: Chat with users and devs on support and setup related topics. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml deleted file mode 100644 index ef142b0ad..000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Feature Request -description: 'Suggest an idea for Lidarr' -labels: ['Type: Feature Request', 'Status: Needs Triage'] -body: -- type: checkboxes - attributes: - label: Is there an existing issue for this? - description: Please search to see if an open or closed issue already exists for the feature you are requesting. If a request exists and is closed note that it may only be fixed in an unstable branch. - options: - - label: I have searched the existing open and closed issues - required: true -- type: textarea - attributes: - label: Is your feature request related to a problem? Please describe - description: A clear and concise description of what the problem is. - validations: - required: true -- type: textarea - attributes: - label: Describe the solution you'd like - description: A clear and concise description of what you want to happen. - validations: - required: true -- type: textarea - attributes: - label: Describe alternatives you've considered - description: A clear and concise description of any alternative solutions or features you've considered. - validations: - required: true -- type: textarea - attributes: - label: Anything else? - description: | - Links? References? Mockups? Anything that will give us more context about the feature you are encountering! - - Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in. - validations: - required: true diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 2fcae05cc..000000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,16 +0,0 @@ -#### Database Migration -YES - XXXX | NO - -#### Description -A few sentences describing the overall goals of the pull request's commits. - -#### Screenshot (if UI related) - -#### Todos -- [ ] Tests -- [ ] Translation Keys (./src/NzbDrone.Core/Localization/Core/en.json) -- [ ] [Wiki Updates](https://wiki.servarr.com) - -#### Issues Fixed or Closed by this PR - -* Fixes #XXXX \ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index f33a02cd1..000000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,12 +0,0 @@ -# To get started with Dependabot version updates, you'll need to specify which -# package ecosystems to update and where the package manifests are located. -# Please see the documentation for more information: -# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates -# https://containers.dev/guide/dependabot - -version: 2 -updates: - - package-ecosystem: "devcontainers" - directory: "/" - schedule: - interval: weekly diff --git a/.github/label-actions.yml b/.github/label-actions.yml deleted file mode 100644 index 3979401b1..000000000 --- a/.github/label-actions.yml +++ /dev/null @@ -1,16 +0,0 @@ -# Configuration for Label Actions - https://github.com/dessant/label-actions - -'Type: Support': - 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 hop over onto our [Discord](https://lidarr.audio/discord). - close: true - close-reason: 'not planned' - -'Status: Logs Needed': - comment: > - :wave: @{issue-author}, In order to help you further we'll need to see logs. - You'll need to enable trace logging and replicate the problem that you encountered. - Guidance on how to enable trace logging can be found in - our [troubleshooting guide](https://wiki.servarr.com/lidarr/troubleshooting#logging-and-log-files). diff --git a/.github/labeler.yml b/.github/labeler.yml deleted file mode 100644 index 4203e4418..000000000 --- a/.github/labeler.yml +++ /dev/null @@ -1,28 +0,0 @@ -'Area: API': - - src/Lidarr.Api.V1/**/* - -'Area: Db-migration': - - src/NzbDrone.Core/Datastore/Migration/* - -'Area: Download Clients': - - src/NzbDrone.Core/Download/Clients/**/* - -'Area: Import Lists': - - src/NzbDrone.Core/ImportLists/**/* - -'Area: Indexer': - - src/NzbDrone.Core/Indexers/**/* - -'Area: Notifications': - - src/NzbDrone.Core/Notifications/**/* - -'Area: Organizer': - - src/NzbDrone.Core/Organizer/**/* - -'Area: Parser': - - src/NzbDrone.Core/Parser/**/* - -'Area: UI': - - frontend/**/* - - package.json - - yarn.lock diff --git a/.github/workflows/label-actions.yml b/.github/workflows/label-actions.yml deleted file mode 100644 index a6246a6b3..000000000 --- a/.github/workflows/label-actions.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: 'Label Actions' - -on: - issues: - types: [labeled, unlabeled] - -permissions: - contents: read - issues: write - -jobs: - action: - runs-on: ubuntu-latest - steps: - - uses: dessant/label-actions@v4 - with: - process-only: 'issues' diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml deleted file mode 100644 index 857cfb4a7..000000000 --- a/.github/workflows/labeler.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: "Pull Request Labeler" -on: - - pull_request_target - -jobs: - triage: - permissions: - contents: read - pull-requests: write - runs-on: ubuntu-latest - steps: - - uses: actions/labeler@v4 diff --git a/.github/workflows/lock.yml b/.github/workflows/lock.yml deleted file mode 100644 index 1d50cb1f1..000000000 --- a/.github/workflows/lock.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: 'Lock threads' - -on: - workflow_dispatch: - schedule: - - cron: '0 0 * * *' - -jobs: - lock: - runs-on: ubuntu-latest - steps: - - uses: dessant/lock-threads@v5 - with: - github-token: ${{ github.token }} - issue-inactive-days: '90' - exclude-issue-created-before: '' - exclude-any-issue-labels: '' - add-issue-labels: '' - issue-comment: '' - issue-lock-reason: 'resolved' - process-only: '' diff --git a/.gitignore b/.gitignore index a5d6bb7c8..bc1e543ec 100644 --- a/.gitignore +++ b/.gitignore @@ -10,8 +10,6 @@ src/**/[Oo]bj/ *.suo *.user *.sln.docstates -.vs/ -.vscode/ # Build results *_i.c @@ -43,13 +41,6 @@ src/**/[Oo]bj/ _ReSharper* _dotCover* -# DevExpress CodeRush -src/.cr/ - -# Emacs -*~ -\#*\# - # NCrunch *.ncrunch* .*crunch*.local.xml @@ -85,6 +76,7 @@ TestResults [Tt]est[Rr]esult* *.Cache ClientBin +[Ss]tyle[Cc]op.* ~$* *.dbmdl Generated_Code #added for RIA/Silverlight projects @@ -105,7 +97,7 @@ App_Data/*.ldf _NCrunch_* _TeamCity* -# Lidarr +# NzbDrone config.xml nzbdrone.log*txt UpdateLogs/ @@ -113,57 +105,21 @@ UpdateLogs/ *.test-cache *.userprefs */test-results/* -src/UI/.idea/* +.idea/* *log.txt node_modules/ _output* -_artifacts _rawPackage/ _dotTrace* _tests/ -_temp* *.Result.xml -coverage*.xml -coverage*.json +wix/*.msi +wix/*.wixobj +wix/*.wixpdb setup/Output/ *.~is -.mono -# VS outout folders +#VS outout folders bin obj output/* - -# .NET Core -project.lock.json -project.fragment.lock.json -artifacts/ -**/Properties/launchSettings.json - -# macOS metadata files -._* -.DS_Store - -_start -_temp_*/**/* - -# Windows thumbnail cache files -Thumbs.db - -# AppVeyor -/tools/cake/ -/_artifacts/ - -# Cake -/tools/Addins/* -packages.config.md5sum - -# ignore node_modules symlink -node_modules -node_modules.nosync - -# API doc generation -.config/ - -# Ignore Jetbrains IntelliJ Workspace Directories -.idea/ diff --git a/.vscode/extensions.json b/.vscode/extensions.json deleted file mode 100644 index 7a36fefe1..000000000 --- a/.vscode/extensions.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "recommendations": [ - "esbenp.prettier-vscode", - "ms-dotnettools.csdevkit", - "ms-vscode-remote.remote-containers" - ] -} diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index 74b8d418b..000000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "version": "0.2.0", - "configurations": [ - { - // Use IntelliSense to find out which attributes exist for C# debugging - // Use hover for the description of the existing attributes - // For further information visit https://github.com/dotnet/vscode-csharp/blob/main/debugger-launchjson.md - "name": "Run Lidarr", - "type": "coreclr", - "request": "launch", - "preLaunchTask": "build dotnet", - // If you have changed target frameworks, make sure to update the program path. - "program": "${workspaceFolder}/_output/net6.0/Lidarr", - "args": [], - "cwd": "${workspaceFolder}", - // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console - "console": "integratedTerminal", - "stopAtEntry": false - }, - { - "name": ".NET Core Attach", - "type": "coreclr", - "request": "attach" - } - ] -} diff --git a/.vscode/tasks.json b/.vscode/tasks.json deleted file mode 100644 index 4b3b00b89..000000000 --- a/.vscode/tasks.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "version": "2.0.0", - "tasks": [ - { - "label": "build dotnet", - "command": "dotnet", - "type": "process", - "args": [ - "msbuild", - "-restore", - "${workspaceFolder}/src/Lidarr.sln", - "-p:GenerateFullPaths=true", - "-p:Configuration=Debug", - "-p:Platform=Posix", - "-consoleloggerparameters:NoSummary;ForceNoAlign" - ], - "problemMatcher": "$msCompile" - }, - { - "label": "publish", - "command": "dotnet", - "type": "process", - "args": [ - "publish", - "${workspaceFolder}/src/Lidarr.sln", - "-property:GenerateFullPaths=true", - "-consoleloggerparameters:NoSummary;ForceNoAlign" - ], - "problemMatcher": "$msCompile" - }, - { - "label": "watch", - "command": "dotnet", - "type": "process", - "args": [ - "watch", - "run", - "--project", - "${workspaceFolder}/src/Lidarr.sln" - ], - "problemMatcher": "$msCompile" - } - ] -} diff --git a/.yarnrc b/.yarnrc deleted file mode 100644 index fdd705c63..000000000 --- a/.yarnrc +++ /dev/null @@ -1 +0,0 @@ -save-prefix "" diff --git a/CLA.md b/CLA.md index 463c6c14c..3198fdb1e 100644 --- a/CLA.md +++ b/CLA.md @@ -1,6 +1,6 @@ -# Lidarr Individual Contributor License Agreement # +# NzbDrone Individual Contributor License Agreement # -Thank you for your interest in contributing to Lidarr ("We" or "Us"). +Thank you for your interest in contributing to NzbDrone ("We" or "Us"). This contributor agreement ("Agreement") documents the rights granted by contributors to Us. To make this document effective, please complete the form below. This is a legally binding document, so please read it carefully before agreeing to it. The Agreement may cover more than one software project managed by Us. ## 1. Definitions ## diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md deleted file mode 100644 index 52e67a0a4..000000000 --- a/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,132 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -We as members, contributors, and leaders pledge to make participation in our -community a harassment-free experience for everyone, regardless of age, body -size, visible or invisible disability, ethnicity, sex characteristics, gender -identity and expression, level of experience, education, socio-economic status, -nationality, personal appearance, race, caste, color, religion, or sexual -identity and orientation. - -We pledge to act and interact in ways that contribute to an open, welcoming, -diverse, inclusive, and healthy community. - -## Our Standards - -Examples of behavior that contributes to a positive environment for our -community include: - -* Demonstrating empathy and kindness toward other people -* Being respectful of differing opinions, viewpoints, and experiences -* Giving and gracefully accepting constructive feedback -* Accepting responsibility and apologizing to those affected by our mistakes, - and learning from the experience -* Focusing on what is best not just for us as individuals, but for the overall - community - -Examples of unacceptable behavior include: - -* The use of sexualized language or imagery, and sexual attention or advances of - any kind -* Trolling, insulting or derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or email address, - without their explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting - -## Enforcement Responsibilities - -Community leaders are responsible for clarifying and enforcing our standards of -acceptable behavior and will take appropriate and fair corrective action in -response to any behavior that they deem inappropriate, threatening, offensive, -or harmful. - -Community leaders have the right and responsibility to remove, edit, or reject -comments, commits, code, wiki edits, issues, and other contributions that are -not aligned to this Code of Conduct, and will communicate reasons for moderation -decisions when appropriate. - -## Scope - -This Code of Conduct applies within all community spaces, and also applies when -an individual is officially representing the community in public spaces. -Examples of representing our community include using an official e-mail address, -posting via an official social media account, or acting as an appointed -representative at an online or offline event. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported to the community leaders responsible for enforcement at -. -All complaints will be reviewed and investigated promptly and fairly. - -All community leaders are obligated to respect the privacy and security of the -reporter of any incident. - -## Enforcement Guidelines - -Community leaders will follow these Community Impact Guidelines in determining -the consequences for any action they deem in violation of this Code of Conduct: - -### 1. Correction - -**Community Impact**: Use of inappropriate language or other behavior deemed -unprofessional or unwelcome in the community. - -**Consequence**: A private, written warning from community leaders, providing -clarity around the nature of the violation and an explanation of why the -behavior was inappropriate. A public apology may be requested. - -### 2. Warning - -**Community Impact**: A violation through a single incident or series of -actions. - -**Consequence**: A warning with consequences for continued behavior. No -interaction with the people involved, including unsolicited interaction with -those enforcing the Code of Conduct, for a specified period of time. This -includes avoiding interactions in community spaces as well as external channels -like social media. Violating these terms may lead to a temporary or permanent -ban. - -### 3. Temporary Ban - -**Community Impact**: A serious violation of community standards, including -sustained inappropriate behavior. - -**Consequence**: A temporary ban from any sort of interaction or public -communication with the community for a specified period of time. No public or -private interaction with the people involved, including unsolicited interaction -with those enforcing the Code of Conduct, is allowed during this period. -Violating these terms may lead to a permanent ban. - -### 4. Permanent Ban - -**Community Impact**: Demonstrating a pattern of violation of community -standards, including sustained inappropriate behavior, harassment of an -individual, or aggression toward or disparagement of classes of individuals. - -**Consequence**: A permanent ban from any sort of public interaction within the -community. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], -version 2.1, available at -[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. - -Community Impact Guidelines were inspired by -[Mozilla's code of conduct enforcement ladder][Mozilla CoC]. - -For answers to common questions about this code of conduct, see the FAQ at -[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at -[https://www.contributor-covenant.org/translations][translations]. - -[homepage]: https://www.contributor-covenant.org -[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html -[Mozilla CoC]: https://github.com/mozilla/diversity -[FAQ]: https://www.contributor-covenant.org/faq -[translations]: https://www.contributor-covenant.org/translations diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 36d901f18..3109d94f7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,13 +1,45 @@ -# How to Contribute +# How to Contribute # -We're always looking for people to help make Lidarr even better, there are a number of ways to contribute. +We're always looking for people to help make NzbDrone even better, there are a number of ways to contribute. To get started, sign the Contributor License Agreement. -This file has been moved to the wiki for the latest details please see the [contributing wiki page](https://wiki.servarr.com/lidarr/contributing). +## Documentation ## +Setup guides, FAQ, the more information we have on the wiki the better. -## Documentation +## Development ## -Setup guides, [FAQ](https://wiki.servarr.com/lidarr/faq), the more information we have on the [wiki](https://wiki.servarr.com/lidarr) the better. +### Tools required ### +- Visual Studio 2013 +- HTML/Javascript editor of choice (Sublime Text/Webstorm/etc) +- npm (node package manager) +- git -## Development +### Getting started ### -See the [Wiki Page](https://wiki.servarr.com/lidarr/contributing) +1. Fork NzbDrone +2. Clone (develop branch) +3. Run `npm install` +4. Run `gulp watch` - Used to compile the UI components and copy them (leave this window open) +5. Compile in Visual Studio + +### Contributing Code ### +- If you're adding a new, already requested feature, please comment on [Trello](https://trello.sonarr.tv "Trello") so work is not duplicated (If you want to add something not already on there, please talk to us first) +- Rebase from NzbDrone's develop branch, don't merge +- Make meaningful commits, or squash them +- Feel free to make a pull request before work is complete, this will let us see where its at and make comments/suggest improvements +- Reach out to us on the forums or on IRC if you have any questions +- Add tests (unit/integration) +- Commit with *nix line endings for consistency (We checkout Windows and commit *nix) +- One feature/bug fix per pull request to keep things clean and easy to understand +- Use 4 spaces instead of tabs, this is the default for VS 2012 and WebStorm (to my knowledge) + +### Pull Requesting ### +- Only make pull requests to develop, never master, if you make a PR to master we'll comment on it and close it +- You're probably going to get some comments or questions from us, they will be to ensure consistency and maintainability +- We'll try to respond to pull requests as soon as possible, if its been a day or two, please reach out to us, we may have missed it +- Each PR should come from its own [feature branch](http://martinfowler.com/bliki/FeatureBranch.html) not develop in your fork, it should have a meaningful branch name (what is being added/fixed) + - new-feature (Good) + - fix-bug (Good) + - patch (Bad) + - develop (Bad) + +If you have any questions about any of this, please let us know. diff --git a/LICENSE.md b/LICENSE.md deleted file mode 100644 index 9cecc1d46..000000000 --- a/LICENSE.md +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - {one line to give the program's name and a brief idea of what it does.} - Copyright (C) {year} {name of author} - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - {project} Copyright (C) {year} {fullname} - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/Log4ViewConfig.l4v b/Log4ViewConfig.l4v new file mode 100644 index 000000000..d6c1f2252 --- /dev/null +++ b/Log4ViewConfig.l4v @@ -0,0 +1,720 @@ + + + 1 + + + + 2 + + 17 + <_receivers z:Id="3" z:Size="1"> + + + 16 + + + 0 + + 2 + 4293654015 + + 500000 + Windows-1252 + + ALL + + Log4net + NzbDrone + XML + 0 + 0001-01-01T00:00:00 + 0001-01-01T00:00:00 + 0 + 0 + Pacific Standard Time + false + 18 + localhost + 20480 + Udp + + + <_sources z:Id="12" z:Size="0" /> + + + + 3 + + + false + true + true + true + false + + OFF + + 17 + <_charts z:Id="16" z:Size="0" /> + <_columns z:Id="17" z:Size="29"> + + + 78 + + ClipRight + Id + + -1 + 45 + 18 + + + + 79 + + ClipRight + OriginalTime + + -1 + 120 + 18 + + + + 80 + + ClipRight + Time + + 1 + 80 + 18 + + + + 81 + + ClipRight + LocalTime + + -1 + 120 + 18 + + + + 82 + + ClipRight + UtcTime + + -1 + 120 + 18 + + + + 83 + + ClipRight + Date + + -1 + 70 + 18 + + + + 84 + + ClipRight + Key + + -1 + 120 + 18 + + + + 85 + + ClipRight + Level + + -1 + 85 + 18 + + + + 86 + + ClipMiddle + Logger + + 2 + 120 + 18 + + + + 87 + + ClipRight + Source + + -1 + 90 + 18 + + + + 88 + + ClipRight + Message + + 3 + 874 + 18 + + + + 89 + + ClipRight + Thread + + -1 + 95 + 18 + + + + 90 + + ClipRight + Host + + -1 + 90 + 18 + + + + 91 + + ClipRight + Exception + + -1 + 120 + 18 + + + + 92 + + ClipRight + Domain + + -1 + 90 + 18 + + + + 93 + + ClipRight + Identity + + -1 + 120 + 18 + + + + 94 + + ClipRight + User + + -1 + 90 + 18 + + + + 95 + + ClipRight + Class + + -1 + 90 + 18 + + + + 96 + + ClipRight + Method + + -1 + 120 + 18 + + + + 97 + + ClipRight + File + + -1 + 120 + 18 + + + + 98 + + ClipRight + Line + + -1 + 45 + 18 + + + + 99 + + ClipRight + NDC + + -1 + 120 + 18 + + + + 100 + + ClipRight + MDC + + -1 + 120 + 18 + + + + 101 + + ClipRight + Comment + + -1 + 120 + 18 + + + + 102 + + ClipRight + StackTrace + + -1 + 120 + 18 + + + + 103 + + ClipRight + ProcessId + + -1 + 120 + 18 + + + + 104 + + ClipRight + ThreadId + + -1 + 120 + 18 + + + + 105 + + ClipRight + CallStack + + -1 + 120 + 18 + + + + 106 + + ClipRight + assembly + + -1 + 120 + 18 + + + <_filters z:Id="76" z:Size="0" /> + <_formats z:Id="77" z:Size="1"> + + + 0 + + + + + + + + VERBOSE + + + + 4 + + + 0 + + 0 + 0 + + Tahoma + + 0 + + 2 + 4290032820 + + + 8.25 + + + + + + TRACE + + + + 5 + + + 0 + + 0 + 0 + + Tahoma + + 0 + + 2 + 4288716960 + + + 8.25 + + + + + + DEBUG + + + + 6 + + + 0 + + 0 + 0 + + Tahoma + + 0 + + 2 + 4286743170 + + + 8.25 + + + + + + INFO + + + + 7 + + + 0 + + 0 + 0 + + Tahoma + + 0 + + 2 + 4278190080 + + + 8.25 + + + + + + NOTICE + + + + 8 + + + 0 + + 0 + 0 + + Tahoma + + 0 + + 2 + 4281957177 + + + 8.25 + + + + + + WARN + + + + 9 + + + 0 + + 0 + 0 + + Tahoma + + 0 + + 2 + 4294934528 + + + 8.25 + + + + + + ERROR + + + + 10 + + + 0 + + 0 + 0 + + Tahoma + + 0 + + 2 + 4294901760 + + + 8.25 + + + + + + SEVERE + + + + 11 + + + 0 + + 0 + 0 + + Tahoma + + 0 + + 2 + 4293067295 + + + 8.25 + + + + + + CRITICAL + + + + 12 + + + 0 + + 0 + 0 + + Tahoma + + 0 + + 2 + 4289400377 + + + 8.25 + + + + + + ALERT + + + + 13 + + + 0 + + 0 + 0 + + Tahoma + + 0 + + 2 + 4294902015 + + + 8.25 + + + + + + FATAL + + + + 14 + + + 0 + + 0 + 0 + + Tahoma + + 0 + + 2 + 4287309977 + + + 8.25 + + + + + + EMERGENCY + + + + 15 + + + 0 + + 0 + 0 + + Tahoma + + 0 + + 2 + 4285932413 + + + 8.25 + + + + + false + Default Format Settings + + + <_logLevels z:Id="130" z:Size="0" /> + <_loggers z:Id="131" z:Size="1"> + + + 77 + + + + 16 + + + + 17 + \ No newline at end of file diff --git a/Logo/1024.png b/Logo/1024.png index f048bf77d..9979d55d4 100644 Binary files a/Logo/1024.png and b/Logo/1024.png differ diff --git a/Logo/128.png b/Logo/128.png index 09682d112..ae8cf56c7 100644 Binary files a/Logo/128.png and b/Logo/128.png differ diff --git a/Logo/16.png b/Logo/16.png index 810d2bc51..00078bfdd 100644 Binary files a/Logo/16.png and b/Logo/16.png differ diff --git a/Logo/256.png b/Logo/256.png index 10bff98c0..815750aa0 100644 Binary files a/Logo/256.png and b/Logo/256.png differ diff --git a/Logo/32.png b/Logo/32.png index 661067300..a079d7afc 100644 Binary files a/Logo/32.png and b/Logo/32.png differ diff --git a/Logo/400.png b/Logo/400.png index 33bed87ef..f445977bf 100644 Binary files a/Logo/400.png and b/Logo/400.png differ diff --git a/Logo/48.png b/Logo/48.png index 2ff9a0cb7..b4a009323 100644 Binary files a/Logo/48.png and b/Logo/48.png differ diff --git a/Logo/512.png b/Logo/512.png index a93794418..36e87c0da 100644 Binary files a/Logo/512.png and b/Logo/512.png differ diff --git a/Logo/64.png b/Logo/64.png index 1b82050c3..33387d7f9 100644 Binary files a/Logo/64.png and b/Logo/64.png differ diff --git a/Logo/800.png b/Logo/800.png index f802b07dd..a0081ab5c 100644 Binary files a/Logo/800.png and b/Logo/800.png differ diff --git a/Logo/96-Outline-White.png b/Logo/96-Outline-White.png deleted file mode 100644 index 469fe37a9..000000000 Binary files a/Logo/96-Outline-White.png and /dev/null differ diff --git a/Logo/Lidarr.svg b/Logo/Lidarr.svg deleted file mode 100644 index 41c5fb58a..000000000 --- a/Logo/Lidarr.svg +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/Logo/Sonarr.svg b/Logo/Sonarr.svg new file mode 100644 index 000000000..cc8e1370e --- /dev/null +++ b/Logo/Sonarr.svg @@ -0,0 +1,240 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Logo/dottrace.svg b/Logo/dottrace.svg deleted file mode 100644 index b879517cd..000000000 --- a/Logo/dottrace.svg +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Logo/jetbrains.svg b/Logo/jetbrains.svg deleted file mode 100644 index 75d4d2177..000000000 --- a/Logo/jetbrains.svg +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Logo/resharper.svg b/Logo/resharper.svg deleted file mode 100644 index 24c987a78..000000000 --- a/Logo/resharper.svg +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Logo/rider.svg b/Logo/rider.svg deleted file mode 100644 index 82da35b0b..000000000 --- a/Logo/rider.svg +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - rider - - - - - - - - - - - - - - diff --git a/Logo/webstorm.svg b/Logo/webstorm.svg deleted file mode 100644 index 39ab7eb97..000000000 --- a/Logo/webstorm.svg +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/NzbDrone.sln.DotSettings b/NzbDrone.sln.DotSettings new file mode 100644 index 000000000..4657be0e3 --- /dev/null +++ b/NzbDrone.sln.DotSettings @@ -0,0 +1,2 @@ + + True \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index 4aa47575c..000000000 --- a/README.md +++ /dev/null @@ -1,74 +0,0 @@ -# Lidarr - -[![Build Status](https://dev.azure.com/Lidarr/Lidarr/_apis/build/status/lidarr.Lidarr?branchName=develop)](https://dev.azure.com/Lidarr/Lidarr/_build/latest?definitionId=1&branchName=develop) -[![Translation status](https://translate.servarr.com/widget/servarr/lidarr/svg-badge.svg)](https://translate.servarr.com/engage/servarr/?utm_source=widget) -[![Docker Pulls](https://img.shields.io/docker/pulls/linuxserver/lidarr.svg)](https://wiki.servarr.com/lidarr/installation#docker) -![Github Downloads](https://img.shields.io/github/downloads/lidarr/lidarr/total.svg) -[![Backers on Open Collective](https://opencollective.com/lidarr/backers/badge.svg)](#backers) -[![Sponsors on Open Collective](https://opencollective.com/lidarr/sponsors/badge.svg)](#sponsors) - -Lidarr is a music collection manager for Usenet and BitTorrent users. It can monitor multiple RSS feeds for new tracks from your favorite artists and will grab, sort and rename them. It can also be configured to automatically upgrade the quality of files already downloaded when a better quality format becomes available. - -## Major Features Include: - -* Support for major platforms: Windows, Linux, macOS, Raspberry Pi, etc. -* Automatically detects new tracks. -* Can scan your existing library and download any missing tracks. -* Can watch for better quality of the tracks you already have and do an automatic upgrade. -* 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 -* Fully configurable track renaming -* Full integration with SABnzbd and NZBGet -* Full integration with Kodi, Plex (notification, library update, metadata) -* Full support for specials and multi-album releases -* And a beautiful UI - -## Support - -Note: GitHub Issues are for Bugs and Feature Requests Only - -[![Discord](https://img.shields.io/badge/discord-chat-7289DA.svg?maxAge=60)](https://lidarr.audio/discord) -[![GitHub - Bugs and Feature Requests Only](https://img.shields.io/badge/github-issues-red.svg?maxAge=60)](https://github.com/Lidarr/Lidarr/issues) -[![Wiki](https://img.shields.io/badge/servarr-wiki-181717.svg?maxAge=60)](https://wiki.servarr.com/lidarr) - -## Contributors - -This project exists thanks to all the people who contribute. [Contribute](CONTRIBUTING.md). - - -## Backers - -Thank you to all our backers! 🙠[Become a backer](https://opencollective.com/Lidarr#backer) - - - -## Sponsors - -Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor](https://opencollective.com/Lidarr#sponsor) - - - -## Mega Sponsors - - -## JetBrains -Thank you to [JetBrains JetBrains](http://www.jetbrains.com/) for providing us with free licenses to their great tools. - -* [ReSharper ReSharper](http://www.jetbrains.com/resharper/) -* [WebStorm WebStorm](http://www.jetbrains.com/webstorm/) -* [Rider Rider](http://www.jetbrains.com/rider/) -* [dotTrace dotTrace](http://www.jetbrains.com/dottrace/) - -## DigitalOcean - -This project is also supported by DigitalOcean -

- - - -

- -### License - -* [GNU GPL v3](http://www.gnu.org/licenses/gpl.html) -* Copyright 2010-2021 diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 765e24fbc..000000000 --- a/SECURITY.md +++ /dev/null @@ -1,8 +0,0 @@ -# Security Policy - -## Reporting a Vulnerability - -Please report (suspected) security vulnerabilities on Discord (preferred) to -any of the Servarr Dev role holders (red names) or via email: development@servarr.com. You will receive a response from -us within 72 hours. If the issue is confirmed, we will release a patch as soon -as possible depending on complexity/severity. diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index ba0800fee..000000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,1269 +0,0 @@ -# Starter pipeline -# Start with a minimal pipeline that you can customize to build and deploy your code. -# Add steps that build, run tests, deploy, and more: -# https://aka.ms/yaml - -variables: - outputFolder: './_output' - artifactsFolder: './_artifacts' - testsFolder: './_tests' - yarnCacheFolder: $(Pipeline.Workspace)/.yarn - nugetCacheFolder: $(Pipeline.Workspace)/.nuget/packages - majorVersion: '2.13.1' - minorVersion: $[counter('minorVersion', 1076)] - lidarrVersion: '$(majorVersion).$(minorVersion)' - buildName: '$(Build.SourceBranchName).$(lidarrVersion)' - sentryOrg: 'servarr' - sentryUrl: 'https://sentry.servarr.com' - dotnetVersion: '6.0.427' - nodeVersion: '20.X' - innoVersion: '6.2.0' - windowsImage: 'windows-2022' - linuxImage: 'ubuntu-22.04' - macImage: 'macOS-13' - -trigger: - branches: - include: - - develop - - master - paths: - exclude: - - .github - - src/Lidarr.Api.*/openapi.json - -pr: - branches: - include: - - develop - paths: - exclude: - - .github - - src/NzbDrone.Core/Localization/Core - - src/Lidarr.Api.*/openapi.json - -stages: - - stage: Setup - displayName: Setup - jobs: - - job: - displayName: Build Variables - pool: - vmImage: ${{ variables.linuxImage }} - steps: - # Set the build name properly. The 'name' property won't recursively expand so hack here: - - bash: echo "##vso[build.updatebuildnumber]$LIDARRVERSION" - displayName: Set Build Name - - bash: | - if [[ $BUILD_REASON == "PullRequest" ]]; then - git diff origin/develop...HEAD --name-only | grep -E "^(src/|azure-pipelines.yml)" - echo $? > not_backend_update - else - echo 0 > not_backend_update - fi - cat not_backend_update - displayName: Check for Backend File Changes - - publish: not_backend_update - artifact: not_backend_update - displayName: Publish update type - - stage: Build_Backend - displayName: Build Backend - dependsOn: Setup - jobs: - - job: Backend - strategy: - matrix: - Linux: - osName: 'Linux' - imageName: ${{ variables.linuxImage }} - enableAnalysis: 'true' - Mac: - osName: 'Mac' - imageName: ${{ variables.macImage }} - enableAnalysis: 'false' - Windows: - osName: 'Windows' - imageName: ${{ variables.windowsImage }} - enableAnalysis: 'false' - - pool: - vmImage: $(imageName) - variables: - # Disable stylecop here - linting errors get caught by the analyze task - EnableAnalyzers: $(enableAnalysis) - steps: - - checkout: self - submodules: true - fetchDepth: 1 - - task: UseDotNet@2 - displayName: 'Install .net core' - inputs: - version: $(dotnetVersion) - - bash: | - BUNDLEDVERSIONS=${AGENT_TOOLSDIRECTORY}/dotnet/sdk/${DOTNETVERSION}/Microsoft.NETCoreSdk.BundledVersions.props - echo $BUNDLEDVERSIONS - if grep -q freebsd-x64 $BUNDLEDVERSIONS; then - echo "Extra platforms already enabled" - else - echo "Enabling extra platform support" - sed -i.ORI 's/osx-x64/osx-x64;freebsd-x64;linux-x86/' $BUNDLEDVERSIONS - fi - displayName: Enable Extra Platform Support - - bash: ./build.sh --backend --enable-extra-platforms - displayName: Build Lidarr Backend - - bash: | - find ${OUTPUTFOLDER} -type f ! -path "*/publish/*" -exec rm -rf {} \; - find ${OUTPUTFOLDER} -depth -empty -type d -exec rm -r "{}" \; - find ${TESTSFOLDER} -type f ! -path "*/publish/*" -exec rm -rf {} \; - find ${TESTSFOLDER} -depth -empty -type d -exec rm -r "{}" \; - displayName: Clean up intermediate output - condition: and(succeeded(), ne(variables['osName'], 'Windows')) - - publish: $(outputFolder) - artifact: '$(osName)Backend' - displayName: Publish Backend - condition: and(succeeded(), eq(variables['osName'], 'Windows')) - - publish: '$(testsFolder)/net6.0/win-x64/publish' - artifact: win-x64-tests - displayName: Publish win-x64 Test Package - condition: and(succeeded(), eq(variables['osName'], 'Windows')) - - publish: '$(testsFolder)/net6.0/linux-x64/publish' - artifact: linux-x64-tests - displayName: Publish linux-x64 Test Package - condition: and(succeeded(), eq(variables['osName'], 'Windows')) - - publish: '$(testsFolder)/net6.0/linux-x86/publish' - artifact: linux-x86-tests - displayName: Publish linux-x86 Test Package - condition: and(succeeded(), eq(variables['osName'], 'Windows')) - - publish: '$(testsFolder)/net6.0/linux-musl-x64/publish' - artifact: linux-musl-x64-tests - displayName: Publish linux-musl-x64 Test Package - condition: and(succeeded(), eq(variables['osName'], 'Windows')) - - publish: '$(testsFolder)/net6.0/freebsd-x64/publish' - artifact: freebsd-x64-tests - displayName: Publish freebsd-x64 Test Package - condition: and(succeeded(), eq(variables['osName'], 'Windows')) - - publish: '$(testsFolder)/net6.0/osx-x64/publish' - artifact: osx-x64-tests - displayName: Publish osx-x64 Test Package - condition: and(succeeded(), eq(variables['osName'], 'Windows')) - - - stage: Build_Frontend - displayName: Frontend - dependsOn: Setup - jobs: - - job: Build - strategy: - matrix: - Linux: - osName: 'Linux' - imageName: ${{ variables.linuxImage }} - Mac: - osName: 'Mac' - imageName: ${{ variables.macImage }} - Windows: - osName: 'Windows' - imageName: ${{ variables.windowsImage }} - pool: - vmImage: $(imageName) - steps: - - task: UseNode@1 - displayName: Set Node.js version - inputs: - version: $(nodeVersion) - - checkout: self - submodules: true - fetchDepth: 1 - - task: Cache@2 - inputs: - key: 'yarn | "$(osName)" | yarn.lock' - restoreKeys: | - yarn | "$(osName)" - path: $(yarnCacheFolder) - displayName: Cache Yarn packages - - bash: ./build.sh --frontend - displayName: Build Lidarr Frontend - env: - FORCE_COLOR: 0 - YARN_CACHE_FOLDER: $(yarnCacheFolder) - - publish: $(outputFolder) - artifact: '$(osName)Frontend' - displayName: Publish Frontend - condition: and(succeeded(), eq(variables['osName'], 'Windows')) - - - stage: Installer - dependsOn: - - Build_Backend - - Build_Frontend - jobs: - - job: Windows_Installer - displayName: Create Installer - pool: - vmImage: ${{ variables.windowsImage }} - steps: - - checkout: self - fetchDepth: 1 - - task: DownloadPipelineArtifact@2 - inputs: - buildType: 'current' - artifactName: WindowsBackend - targetPath: _output - displayName: Fetch Backend - - task: DownloadPipelineArtifact@2 - inputs: - buildType: 'current' - artifactName: WindowsFrontend - targetPath: _output - displayName: Fetch Frontend - - bash: | - ./build.sh --packages --installer - cp distribution/windows/setup/output/Lidarr.*win-x64.exe ${BUILD_ARTIFACTSTAGINGDIRECTORY}/Lidarr.${BUILDNAME}.windows-core-x64-installer.exe - cp distribution/windows/setup/output/Lidarr.*win-x86.exe ${BUILD_ARTIFACTSTAGINGDIRECTORY}/Lidarr.${BUILDNAME}.windows-core-x86-installer.exe - displayName: Create Installers - - publish: $(Build.ArtifactStagingDirectory) - artifact: 'WindowsInstaller' - displayName: Publish Installer - - - stage: Packages - dependsOn: - - Build_Backend - - Build_Frontend - jobs: - - job: Other_Packages - displayName: Create Standard Packages - pool: - vmImage: ${{ variables.linuxImage }} - steps: - - checkout: self - fetchDepth: 1 - - task: DownloadPipelineArtifact@2 - inputs: - buildType: 'current' - artifactName: WindowsBackend - targetPath: _output - displayName: Fetch Backend - - task: DownloadPipelineArtifact@2 - inputs: - buildType: 'current' - artifactName: WindowsFrontend - targetPath: _output - displayName: Fetch Frontend - - bash: ./build.sh --packages --enable-extra-platforms - displayName: Create Packages - - bash: | - find . -name "fpcalc" -exec chmod a+x {} \; - find . -name "Lidarr" -exec chmod a+x {} \; - find . -name "Lidarr.Update" -exec chmod a+x {} \; - displayName: Set executable bits - - task: ArchiveFiles@2 - displayName: Create win-x64 zip - inputs: - archiveFile: '$(Build.ArtifactStagingDirectory)/Lidarr.$(buildName).windows-core-x64.zip' - archiveType: 'zip' - includeRootFolder: false - rootFolderOrFile: $(artifactsFolder)/win-x64/net6.0 - - task: ArchiveFiles@2 - displayName: Create win-x86 zip - inputs: - archiveFile: '$(Build.ArtifactStagingDirectory)/Lidarr.$(buildName).windows-core-x86.zip' - archiveType: 'zip' - includeRootFolder: false - rootFolderOrFile: $(artifactsFolder)/win-x86/net6.0 - - task: ArchiveFiles@2 - displayName: Create osx-x64 app - inputs: - archiveFile: '$(Build.ArtifactStagingDirectory)/Lidarr.$(buildName).osx-app-core-x64.zip' - archiveType: 'zip' - includeRootFolder: false - rootFolderOrFile: $(artifactsFolder)/osx-x64-app/net6.0 - - task: ArchiveFiles@2 - displayName: Create osx-x64 tar - inputs: - archiveFile: '$(Build.ArtifactStagingDirectory)/Lidarr.$(buildName).osx-core-x64.tar.gz' - archiveType: 'tar' - tarCompression: 'gz' - includeRootFolder: false - rootFolderOrFile: $(artifactsFolder)/osx-x64/net6.0 - - task: ArchiveFiles@2 - displayName: Create osx-arm64 app - inputs: - archiveFile: '$(Build.ArtifactStagingDirectory)/Lidarr.$(buildName).osx-app-core-arm64.zip' - archiveType: 'zip' - includeRootFolder: false - rootFolderOrFile: $(artifactsFolder)/osx-arm64-app/net6.0 - - task: ArchiveFiles@2 - displayName: Create osx-arm64 tar - inputs: - archiveFile: '$(Build.ArtifactStagingDirectory)/Lidarr.$(buildName).osx-core-arm64.tar.gz' - archiveType: 'tar' - tarCompression: 'gz' - includeRootFolder: false - rootFolderOrFile: $(artifactsFolder)/osx-arm64/net6.0 - - task: ArchiveFiles@2 - displayName: Create linux-x64 tar - inputs: - archiveFile: '$(Build.ArtifactStagingDirectory)/Lidarr.$(buildName).linux-core-x64.tar.gz' - archiveType: 'tar' - tarCompression: 'gz' - includeRootFolder: false - rootFolderOrFile: $(artifactsFolder)/linux-x64/net6.0 - - task: ArchiveFiles@2 - displayName: Create linux-musl-x64 tar - inputs: - archiveFile: '$(Build.ArtifactStagingDirectory)/Lidarr.$(buildName).linux-musl-core-x64.tar.gz' - archiveType: 'tar' - tarCompression: 'gz' - includeRootFolder: false - rootFolderOrFile: $(artifactsFolder)/linux-musl-x64/net6.0 - - task: ArchiveFiles@2 - displayName: Create linux-x86 tar - inputs: - archiveFile: '$(Build.ArtifactStagingDirectory)/Lidarr.$(buildName).linux-core-x86.tar.gz' - archiveType: 'tar' - tarCompression: 'gz' - includeRootFolder: false - rootFolderOrFile: $(artifactsFolder)/linux-x86/net6.0 - - task: ArchiveFiles@2 - displayName: Create linux-arm tar - inputs: - archiveFile: '$(Build.ArtifactStagingDirectory)/Lidarr.$(buildName).linux-core-arm.tar.gz' - archiveType: 'tar' - tarCompression: 'gz' - includeRootFolder: false - rootFolderOrFile: $(artifactsFolder)/linux-arm/net6.0 - - task: ArchiveFiles@2 - displayName: Create linux-musl-arm tar - inputs: - archiveFile: '$(Build.ArtifactStagingDirectory)/Lidarr.$(buildName).linux-musl-core-arm.tar.gz' - archiveType: 'tar' - tarCompression: 'gz' - includeRootFolder: false - rootFolderOrFile: $(artifactsFolder)/linux-musl-arm/net6.0 - - task: ArchiveFiles@2 - displayName: Create linux-arm64 tar - inputs: - archiveFile: '$(Build.ArtifactStagingDirectory)/Lidarr.$(buildName).linux-core-arm64.tar.gz' - archiveType: 'tar' - tarCompression: 'gz' - includeRootFolder: false - rootFolderOrFile: $(artifactsFolder)/linux-arm64/net6.0 - - task: ArchiveFiles@2 - displayName: Create linux-musl-arm64 tar - inputs: - archiveFile: '$(Build.ArtifactStagingDirectory)/Lidarr.$(buildName).linux-musl-core-arm64.tar.gz' - archiveType: 'tar' - tarCompression: 'gz' - includeRootFolder: false - rootFolderOrFile: $(artifactsFolder)/linux-musl-arm64/net6.0 - - task: ArchiveFiles@2 - displayName: Create freebsd-x64 tar - inputs: - archiveFile: '$(Build.ArtifactStagingDirectory)/Lidarr.$(buildName).freebsd-core-x64.tar.gz' - archiveType: 'tar' - tarCompression: 'gz' - includeRootFolder: false - rootFolderOrFile: $(artifactsFolder)/freebsd-x64/net6.0 - - publish: $(Build.ArtifactStagingDirectory) - artifact: 'Packages' - displayName: Publish Packages - - bash: | - echo "Uploading source maps to sentry" - curl -sL https://sentry.io/get-cli/ | bash - RELEASENAME="Lidarr@${LIDARRVERSION}-${BUILD_SOURCEBRANCHNAME}" - sentry-cli releases new --finalize -p lidarr -p lidarr-ui -p lidarr-update "${RELEASENAME}" - sentry-cli releases -p lidarr-ui files "${RELEASENAME}" upload-sourcemaps _output/UI/ --rewrite - sentry-cli releases set-commits --auto "${RELEASENAME}" - if [[ ${BUILD_SOURCEBRANCH} == "refs/heads/develop" ]]; then - sentry-cli releases deploys "${RELEASENAME}" new -e nightly - else - sentry-cli releases deploys "${RELEASENAME}" new -e production - fi - if [ $? -gt 0 ]; then - echo "##vso[task.logissue type=warning]Error uploading source maps." - fi - exit 0 - displayName: Publish Sentry Source Maps - condition: | - or - ( - and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/develop')), - and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) - ) - env: - SENTRY_AUTH_TOKEN: $(sentryAuthTokenServarr) - SENTRY_ORG: $(sentryOrg) - SENTRY_URL: $(sentryUrl) - - - stage: Unit_Test - displayName: Unit Tests - dependsOn: Build_Backend - condition: succeeded() - - jobs: - - job: Prepare - pool: - vmImage: ${{ variables.linuxImage }} - steps: - - checkout: none - - task: DownloadPipelineArtifact@2 - inputs: - buildType: 'current' - artifactName: 'not_backend_update' - targetPath: '.' - - bash: echo "##vso[task.setvariable variable=backendNotUpdated;isOutput=true]$(cat not_backend_update)" - name: setVar - - - job: Unit - displayName: Unit Native - dependsOn: Prepare - condition: and(succeeded(), eq(dependencies.Prepare.outputs['setVar.backendNotUpdated'], '0')) - workspace: - clean: all - - strategy: - matrix: - MacCore: - osName: 'Mac' - testName: 'osx-x64' - poolName: 'Azure Pipelines' - imageName: ${{ variables.macImage }} - WindowsCore: - osName: 'Windows' - testName: 'win-x64' - poolName: 'Azure Pipelines' - imageName: ${{ variables.windowsImage }} - LinuxCore: - osName: 'Linux' - testName: 'linux-x64' - poolName: 'Azure Pipelines' - imageName: ${{ variables.linuxImage }} - FreebsdCore: - osName: 'Linux' - testName: 'freebsd-x64' - poolName: 'FreeBSD' - imageName: - - pool: - name: $(poolName) - vmImage: $(imageName) - - steps: - - checkout: none - - task: UseDotNet@2 - displayName: 'Install .net core' - inputs: - version: $(dotnetVersion) - condition: ne(variables['poolName'], 'FreeBSD') - - task: DownloadPipelineArtifact@2 - displayName: Download Test Artifact - inputs: - buildType: 'current' - artifactName: '$(testName)-tests' - targetPath: $(testsFolder) - - powershell: Set-Service SCardSvr -StartupType Manual - displayName: Enable Windows Test Service - condition: and(succeeded(), eq(variables['osName'], 'Windows')) - - bash: | - chmod a+x _tests/fpcalc - displayName: Make fpcalc Executable - condition: and(succeeded(), and(ne(variables['osName'], 'Windows'), ne(variables['poolName'], 'FreeBSD'))) - - bash: find ${TESTSFOLDER} -name "Lidarr.Test.Dummy" -exec chmod a+x {} \; - displayName: Make Test Dummy Executable - condition: and(succeeded(), ne(variables['osName'], 'Windows')) - - bash: | - chmod a+x ${TESTSFOLDER}/test.sh - ${TESTSFOLDER}/test.sh ${OSNAME} Unit Test - displayName: Run Tests - env: - TEST_DIR: $(Build.SourcesDirectory)/_tests - - task: PublishTestResults@2 - displayName: Publish Test Results - inputs: - testResultsFormat: 'NUnit' - testResultsFiles: '**/TestResult.xml' - testRunTitle: '$(testName) Unit Tests' - failTaskOnFailedTests: true - - - job: Unit_Docker - displayName: Unit Docker - dependsOn: Prepare - condition: and(succeeded(), eq(dependencies.Prepare.outputs['setVar.backendNotUpdated'], '0')) - strategy: - matrix: - alpine: - testName: 'Musl Net Core' - artifactName: linux-musl-x64-tests - containerImage: ghcr.io/servarr/testimages:alpine - linux-x86: - testName: 'linux-x86' - artifactName: linux-x86-tests - containerImage: ghcr.io/servarr/testimages:linux-x86 - - pool: - vmImage: ${{ variables.linuxImage }} - - container: $[ variables['containerImage'] ] - - timeoutInMinutes: 10 - - steps: - - task: UseDotNet@2 - displayName: 'Install .NET' - inputs: - version: $(dotnetVersion) - condition: and(succeeded(), ne(variables['testName'], 'linux-x86')) - - bash: | - SDKURL=$(curl -s https://api.github.com/repos/Servarr/dotnet-linux-x86/releases | jq -rc '.[].assets[].browser_download_url' | grep sdk-${DOTNETVERSION}.*gz$) - curl -fsSL $SDKURL | tar xzf - -C /opt/dotnet - displayName: 'Install .NET' - condition: and(succeeded(), eq(variables['testName'], 'linux-x86')) - - checkout: none - - task: DownloadPipelineArtifact@2 - displayName: Download Test Artifact - inputs: - buildType: 'current' - artifactName: $(artifactName) - targetPath: $(testsFolder) - - bash: | - chmod a+x _tests/fpcalc - displayName: Make fpcalc Executable - condition: and(succeeded(), ne(variables['osName'], 'Windows')) - - bash: find ${TESTSFOLDER} -name "Lidarr.Test.Dummy" -exec chmod a+x {} \; - displayName: Make Test Dummy Executable - condition: and(succeeded(), ne(variables['osName'], 'Windows')) - - bash: | - chmod a+x ${TESTSFOLDER}/test.sh - ls -lR ${TESTSFOLDER} - ${TESTSFOLDER}/test.sh Linux Unit Test - displayName: Run Tests - - task: PublishTestResults@2 - displayName: Publish Test Results - inputs: - testResultsFormat: 'NUnit' - testResultsFiles: '**/TestResult.xml' - testRunTitle: '$(testName) Unit Tests' - failTaskOnFailedTests: true - - - job: Unit_LinuxCore_Postgres14 - displayName: Unit Native LinuxCore with Postgres14 Database - dependsOn: Prepare - condition: and(succeeded(), eq(dependencies.Prepare.outputs['setVar.backendNotUpdated'], '0')) - variables: - pattern: 'Lidarr.*.linux-core-x64.tar.gz' - artifactName: linux-x64-tests - Lidarr__Postgres__Host: 'localhost' - Lidarr__Postgres__Port: '5432' - Lidarr__Postgres__User: 'lidarr' - Lidarr__Postgres__Password: 'lidarr' - - pool: - vmImage: ${{ variables.linuxImage }} - - timeoutInMinutes: 10 - - steps: - - task: UseDotNet@2 - displayName: 'Install .net core' - inputs: - version: $(dotnetVersion) - - checkout: none - - task: DownloadPipelineArtifact@2 - displayName: Download Test Artifact - inputs: - buildType: 'current' - artifactName: $(artifactName) - targetPath: $(testsFolder) - - bash: | - chmod a+x _tests/fpcalc - displayName: Make fpcalc Executable - condition: and(succeeded(), ne(variables['osName'], 'Windows')) - - bash: find ${TESTSFOLDER} -name "Lidarr.Test.Dummy" -exec chmod a+x {} \; - displayName: Make Test Dummy Executable - condition: and(succeeded(), ne(variables['osName'], 'Windows')) - - bash: | - docker run -d --name=postgres14 \ - -e POSTGRES_PASSWORD=lidarr \ - -e POSTGRES_USER=lidarr \ - -p 5432:5432/tcp \ - -v /usr/share/zoneinfo/America/Chicago:/etc/localtime:ro \ - postgres:14 - displayName: Start postgres - - bash: | - chmod a+x ${TESTSFOLDER}/test.sh - ls -lR ${TESTSFOLDER} - ${TESTSFOLDER}/test.sh Linux Unit Test - displayName: Run Tests - - task: PublishTestResults@2 - displayName: Publish Test Results - inputs: - testResultsFormat: 'NUnit' - testResultsFiles: '**/TestResult.xml' - testRunTitle: 'LinuxCore Postgres14 Unit Tests' - failTaskOnFailedTests: true - - - job: Unit_LinuxCore_Postgres15 - displayName: Unit Native LinuxCore with Postgres15 Database - dependsOn: Prepare - condition: and(succeeded(), eq(dependencies.Prepare.outputs['setVar.backendNotUpdated'], '0')) - variables: - pattern: 'Lidarr.*.linux-core-x64.tar.gz' - artifactName: linux-x64-tests - Lidarr__Postgres__Host: 'localhost' - Lidarr__Postgres__Port: '5432' - Lidarr__Postgres__User: 'lidarr' - Lidarr__Postgres__Password: 'lidarr' - - pool: - vmImage: ${{ variables.linuxImage }} - - timeoutInMinutes: 10 - - steps: - - task: UseDotNet@2 - displayName: 'Install .net core' - inputs: - version: $(dotnetVersion) - - checkout: none - - task: DownloadPipelineArtifact@2 - displayName: Download Test Artifact - inputs: - buildType: 'current' - artifactName: $(artifactName) - targetPath: $(testsFolder) - - bash: | - chmod a+x _tests/fpcalc - displayName: Make fpcalc Executable - condition: and(succeeded(), ne(variables['osName'], 'Windows')) - - bash: find ${TESTSFOLDER} -name "Lidarr.Test.Dummy" -exec chmod a+x {} \; - displayName: Make Test Dummy Executable - condition: and(succeeded(), ne(variables['osName'], 'Windows')) - - bash: | - docker run -d --name=postgres15 \ - -e POSTGRES_PASSWORD=lidarr \ - -e POSTGRES_USER=lidarr \ - -p 5432:5432/tcp \ - -v /usr/share/zoneinfo/America/Chicago:/etc/localtime:ro \ - postgres:15 - displayName: Start postgres - - bash: | - chmod a+x ${TESTSFOLDER}/test.sh - ls -lR ${TESTSFOLDER} - ${TESTSFOLDER}/test.sh Linux Unit Test - displayName: Run Tests - - task: PublishTestResults@2 - displayName: Publish Test Results - inputs: - testResultsFormat: 'NUnit' - testResultsFiles: '**/TestResult.xml' - testRunTitle: 'LinuxCore Postgres15 Unit Tests' - failTaskOnFailedTests: true - - - stage: Integration - displayName: Integration - dependsOn: Packages - - jobs: - - job: Prepare - pool: - vmImage: ${{ variables.linuxImage }} - steps: - - checkout: none - - task: DownloadPipelineArtifact@2 - inputs: - buildType: 'current' - artifactName: 'not_backend_update' - targetPath: '.' - - bash: echo "##vso[task.setvariable variable=backendNotUpdated;isOutput=true]$(cat not_backend_update)" - name: setVar - - - job: Integration_Native - displayName: Integration Native - dependsOn: Prepare - condition: and(succeeded(), eq(dependencies.Prepare.outputs['setVar.backendNotUpdated'], '0')) - strategy: - matrix: - MacCore: - osName: 'Mac' - testName: 'osx-x64' - imageName: ${{ variables.macImage }} - pattern: 'Lidarr.*.osx-core-x64.tar.gz' - WindowsCore: - osName: 'Windows' - testName: 'win-x64' - imageName: ${{ variables.windowsImage }} - pattern: 'Lidarr.*.windows-core-x64.zip' - LinuxCore: - osName: 'Linux' - testName: 'linux-x64' - imageName: ${{ variables.linuxImage }} - pattern: 'Lidarr.*.linux-core-x64.tar.gz' - - pool: - vmImage: $(imageName) - - steps: - - task: UseDotNet@2 - displayName: 'Install .net core' - inputs: - version: $(dotnetVersion) - - checkout: none - - task: DownloadPipelineArtifact@2 - displayName: Download Test Artifact - inputs: - buildType: 'current' - artifactName: '$(testName)-tests' - targetPath: $(testsFolder) - - task: DownloadPipelineArtifact@2 - displayName: Download Build Artifact - inputs: - buildType: 'current' - artifactName: Packages - itemPattern: '**/$(pattern)' - targetPath: $(Build.ArtifactStagingDirectory) - - task: ExtractFiles@1 - inputs: - archiveFilePatterns: '$(Build.ArtifactStagingDirectory)/**/$(pattern)' - destinationFolder: '$(Build.ArtifactStagingDirectory)/bin' - displayName: Extract Package - - bash: | - mkdir -p ./bin/ - cp -r -v ${BUILD_ARTIFACTSTAGINGDIRECTORY}/bin/Lidarr/. ./bin/ - displayName: Move Package Contents - - bash: | - chmod a+x ${TESTSFOLDER}/test.sh - ${TESTSFOLDER}/test.sh ${OSNAME} Integration Test - displayName: Run Integration Tests - - task: PublishTestResults@2 - inputs: - testResultsFormat: 'NUnit' - testResultsFiles: '**/TestResult.xml' - testRunTitle: '$(testName) Integration Tests' - failTaskOnFailedTests: true - displayName: Publish Test Results - - - job: Integration_LinuxCore_Postgres14 - displayName: Integration Native LinuxCore with Postgres14 Database - dependsOn: Prepare - condition: and(succeeded(), eq(dependencies.Prepare.outputs['setVar.backendNotUpdated'], '0')) - variables: - pattern: 'Lidarr.*.linux-core-x64.tar.gz' - Lidarr__Postgres__Host: 'localhost' - Lidarr__Postgres__Port: '5432' - Lidarr__Postgres__User: 'lidarr' - Lidarr__Postgres__Password: 'lidarr' - - pool: - vmImage: ${{ variables.linuxImage }} - - steps: - - task: UseDotNet@2 - displayName: 'Install .net core' - inputs: - version: $(dotnetVersion) - - checkout: none - - task: DownloadPipelineArtifact@2 - displayName: Download Test Artifact - inputs: - buildType: 'current' - artifactName: 'linux-x64-tests' - targetPath: $(testsFolder) - - task: DownloadPipelineArtifact@2 - displayName: Download Build Artifact - inputs: - buildType: 'current' - artifactName: Packages - itemPattern: '**/$(pattern)' - targetPath: $(Build.ArtifactStagingDirectory) - - task: ExtractFiles@1 - inputs: - archiveFilePatterns: '$(Build.ArtifactStagingDirectory)/**/$(pattern)' - destinationFolder: '$(Build.ArtifactStagingDirectory)/bin' - displayName: Extract Package - - bash: | - mkdir -p ./bin/ - cp -r -v ${BUILD_ARTIFACTSTAGINGDIRECTORY}/bin/Lidarr/. ./bin/ - displayName: Move Package Contents - - bash: | - docker run -d --name=postgres14 \ - -e POSTGRES_PASSWORD=lidarr \ - -e POSTGRES_USER=lidarr \ - -p 5432:5432/tcp \ - -v /usr/share/zoneinfo/America/Chicago:/etc/localtime:ro \ - postgres:14 - displayName: Start postgres - - bash: | - chmod a+x ${TESTSFOLDER}/test.sh - ${TESTSFOLDER}/test.sh Linux Integration Test - displayName: Run Integration Tests - - task: PublishTestResults@2 - inputs: - testResultsFormat: 'NUnit' - testResultsFiles: '**/TestResult.xml' - testRunTitle: 'Integration LinuxCore Postgres14 Database Integration Tests' - failTaskOnFailedTests: true - displayName: Publish Test Results - - - - job: Integration_LinuxCore_Postgres15 - displayName: Integration Native LinuxCore with Postgres Database - dependsOn: Prepare - condition: and(succeeded(), eq(dependencies.Prepare.outputs['setVar.backendNotUpdated'], '0')) - variables: - pattern: 'Lidarr.*.linux-core-x64.tar.gz' - Lidarr__Postgres__Host: 'localhost' - Lidarr__Postgres__Port: '5432' - Lidarr__Postgres__User: 'lidarr' - Lidarr__Postgres__Password: 'lidarr' - - pool: - vmImage: ${{ variables.linuxImage }} - - steps: - - task: UseDotNet@2 - displayName: 'Install .net core' - inputs: - version: $(dotnetVersion) - - checkout: none - - task: DownloadPipelineArtifact@2 - displayName: Download Test Artifact - inputs: - buildType: 'current' - artifactName: 'linux-x64-tests' - targetPath: $(testsFolder) - - task: DownloadPipelineArtifact@2 - displayName: Download Build Artifact - inputs: - buildType: 'current' - artifactName: Packages - itemPattern: '**/$(pattern)' - targetPath: $(Build.ArtifactStagingDirectory) - - task: ExtractFiles@1 - inputs: - archiveFilePatterns: '$(Build.ArtifactStagingDirectory)/**/$(pattern)' - destinationFolder: '$(Build.ArtifactStagingDirectory)/bin' - displayName: Extract Package - - bash: | - mkdir -p ./bin/ - cp -r -v ${BUILD_ARTIFACTSTAGINGDIRECTORY}/bin/Lidarr/. ./bin/ - displayName: Move Package Contents - - bash: | - docker run -d --name=postgres15 \ - -e POSTGRES_PASSWORD=lidarr \ - -e POSTGRES_USER=lidarr \ - -p 5432:5432/tcp \ - -v /usr/share/zoneinfo/America/Chicago:/etc/localtime:ro \ - postgres:15 - displayName: Start postgres - - bash: | - chmod a+x ${TESTSFOLDER}/test.sh - ${TESTSFOLDER}/test.sh Linux Integration Test - displayName: Run Integration Tests - - task: PublishTestResults@2 - inputs: - testResultsFormat: 'NUnit' - testResultsFiles: '**/TestResult.xml' - testRunTitle: 'Integration LinuxCore Postgres15 Database Integration Tests' - failTaskOnFailedTests: true - displayName: Publish Test Results - - - job: Integration_FreeBSD - displayName: Integration Native FreeBSD - dependsOn: Prepare - condition: and(succeeded(), eq(dependencies.Prepare.outputs['setVar.backendNotUpdated'], '0')) - workspace: - clean: all - variables: - pattern: 'Lidarr.*.freebsd-core-x64.tar.gz' - pool: - name: 'FreeBSD' - - steps: - - checkout: none - - task: DownloadPipelineArtifact@2 - displayName: Download Test Artifact - inputs: - buildType: 'current' - artifactName: 'freebsd-x64-tests' - targetPath: $(testsFolder) - - task: DownloadPipelineArtifact@2 - displayName: Download Build Artifact - inputs: - buildType: 'current' - artifactName: Packages - itemPattern: '**/$(pattern)' - targetPath: $(Build.ArtifactStagingDirectory) - - bash: | - mkdir -p ${BUILD_ARTIFACTSTAGINGDIRECTORY}/bin - tar xf ${BUILD_ARTIFACTSTAGINGDIRECTORY}/$(pattern) -C ${BUILD_ARTIFACTSTAGINGDIRECTORY}/bin - displayName: Extract Package - - bash: | - mkdir -p ./bin/ - cp -r -v ${BUILD_ARTIFACTSTAGINGDIRECTORY}/bin/Lidarr/. ./bin/ - displayName: Move Package Contents - - bash: | - chmod a+x ${TESTSFOLDER}/test.sh - ${TESTSFOLDER}/test.sh Linux Integration Test - displayName: Run Integration Tests - - task: PublishTestResults@2 - inputs: - testResultsFormat: 'NUnit' - testResultsFiles: '**/TestResult.xml' - testRunTitle: 'FreeBSD Integration Tests' - failTaskOnFailedTests: true - displayName: Publish Test Results - - - job: Integration_Docker - displayName: Integration Docker - dependsOn: Prepare - condition: and(succeeded(), eq(dependencies.Prepare.outputs['setVar.backendNotUpdated'], '0')) - strategy: - matrix: - alpine: - testName: 'linux-musl-x64' - artifactName: linux-musl-x64-tests - containerImage: ghcr.io/servarr/testimages:alpine - pattern: 'Lidarr.*.linux-musl-core-x64.tar.gz' - linux-x86: - testName: 'linux-x86' - artifactName: linux-x86-tests - containerImage: ghcr.io/servarr/testimages:linux-x86 - pattern: 'Lidarr.*.linux-core-x86.tar.gz' - pool: - vmImage: ${{ variables.linuxImage }} - - container: $[ variables['containerImage'] ] - - timeoutInMinutes: 15 - - steps: - - task: UseDotNet@2 - displayName: 'Install .NET' - inputs: - version: $(dotnetVersion) - condition: and(succeeded(), ne(variables['testName'], 'linux-x86')) - - bash: | - SDKURL=$(curl -s https://api.github.com/repos/Servarr/dotnet-linux-x86/releases | jq -rc '.[].assets[].browser_download_url' | grep sdk-${DOTNETVERSION}.*gz$) - curl -fsSL $SDKURL | tar xzf - -C /opt/dotnet - displayName: 'Install .NET' - condition: and(succeeded(), eq(variables['testName'], 'linux-x86')) - - checkout: none - - task: DownloadPipelineArtifact@2 - displayName: Download Test Artifact - inputs: - buildType: 'current' - artifactName: $(artifactName) - targetPath: $(testsFolder) - - task: DownloadPipelineArtifact@2 - displayName: Download Build Artifact - inputs: - buildType: 'current' - artifactName: Packages - itemPattern: '**/$(pattern)' - targetPath: $(Build.ArtifactStagingDirectory) - - task: ExtractFiles@1 - inputs: - archiveFilePatterns: '$(Build.ArtifactStagingDirectory)/**/$(pattern)' - destinationFolder: '$(Build.ArtifactStagingDirectory)/bin' - displayName: Extract Package - - bash: | - mkdir -p ./bin/ - cp -r -v ${BUILD_ARTIFACTSTAGINGDIRECTORY}/bin/Lidarr/. ./bin/ - displayName: Move Package Contents - - bash: | - chmod a+x ${TESTSFOLDER}/test.sh - ${TESTSFOLDER}/test.sh Linux Integration Test - displayName: Run Integration Tests - - task: PublishTestResults@2 - inputs: - testResultsFormat: 'NUnit' - testResultsFiles: '**/TestResult.xml' - testRunTitle: '$(testName) Integration Tests' - failTaskOnFailedTests: true - displayName: Publish Test Results - - - stage: Automation - displayName: Automation - dependsOn: Packages - - jobs: - - job: Automation - strategy: - matrix: - Linux: - osName: 'Linux' - artifactName: 'linux-x64' - imageName: ${{ variables.linuxImage }} - pattern: 'Lidarr.*.linux-core-x64.tar.gz' - failBuild: true - Mac: - osName: 'Mac' - artifactName: 'osx-x64' - imageName: ${{ variables.macImage }} - pattern: 'Lidarr.*.osx-core-x64.tar.gz' - failBuild: true - Windows: - osName: 'Windows' - artifactName: 'win-x64' - imageName: ${{ variables.windowsImage }} - pattern: 'Lidarr.*.windows-core-x64.zip' - failBuild: true - - pool: - vmImage: $(imageName) - - steps: - - task: UseDotNet@2 - displayName: 'Install .net core' - inputs: - version: $(dotnetVersion) - - checkout: none - - task: DownloadPipelineArtifact@2 - displayName: Download Test Artifact - inputs: - buildType: 'current' - artifactName: '$(artifactName)-tests' - targetPath: $(testsFolder) - - task: DownloadPipelineArtifact@2 - displayName: Download Build Artifact - inputs: - buildType: 'current' - artifactName: Packages - itemPattern: '**/$(pattern)' - targetPath: $(Build.ArtifactStagingDirectory) - - task: ExtractFiles@1 - inputs: - archiveFilePatterns: '$(Build.ArtifactStagingDirectory)/**/$(pattern)' - destinationFolder: '$(Build.ArtifactStagingDirectory)/bin' - displayName: Extract Package - - bash: | - mkdir -p ./bin/ - cp -r -v ${BUILD_ARTIFACTSTAGINGDIRECTORY}/bin/Lidarr/. ./bin/ - displayName: Move Package Contents - - bash: | - chmod a+x ${TESTSFOLDER}/test.sh - ${TESTSFOLDER}/test.sh ${OSNAME} Automation Test - displayName: Run Automation Tests - - task: CopyFiles@2 - displayName: 'Copy Screenshot to: $(Build.ArtifactStagingDirectory)' - inputs: - SourceFolder: '$(Build.SourcesDirectory)' - Contents: | - **/*_test_screenshot.png - TargetFolder: '$(Build.ArtifactStagingDirectory)/screenshots' - - publish: $(Build.ArtifactStagingDirectory)/screenshots - artifact: '$(osName)AutomationScreenshots' - displayName: Publish Screenshot Bundle - condition: and(succeeded(), eq(variables['System.JobAttempt'], '1')) - - task: PublishTestResults@2 - inputs: - testResultsFormat: 'NUnit' - testResultsFiles: '**/TestResult.xml' - testRunTitle: '$(osName) Automation Tests' - failTaskOnFailedTests: $(failBuild) - displayName: Publish Test Results - - - stage: Analyze - dependsOn: - - Setup - displayName: Analyze - - jobs: - - job: Prepare - pool: - vmImage: ${{ variables.linuxImage }} - steps: - - checkout: none - - task: DownloadPipelineArtifact@2 - inputs: - buildType: 'current' - artifactName: 'not_backend_update' - targetPath: '.' - - bash: echo "##vso[task.setvariable variable=backendNotUpdated;isOutput=true]$(cat not_backend_update)" - name: setVar - - - job: Lint_Frontend - displayName: Lint Frontend - strategy: - matrix: - Linux: - osName: 'Linux' - imageName: ${{ variables.linuxImage }} - Windows: - osName: 'Windows' - imageName: ${{ variables.windowsImage }} - pool: - vmImage: $(imageName) - steps: - - task: UseNode@1 - displayName: Set Node.js version - inputs: - version: $(nodeVersion) - - checkout: self - submodules: true - fetchDepth: 1 - - task: Cache@2 - inputs: - key: 'yarn | "$(osName)" | yarn.lock' - restoreKeys: | - yarn | "$(osName)" - path: $(yarnCacheFolder) - displayName: Cache Yarn packages - - bash: ./build.sh --lint - displayName: Lint Lidarr Frontend - env: - FORCE_COLOR: 0 - YARN_CACHE_FOLDER: $(yarnCacheFolder) - - - job: Analyze_Frontend - displayName: Frontend - condition: eq(variables['System.PullRequest.IsFork'], 'False') - pool: - vmImage: ${{ variables.windowsImage }} - steps: - - checkout: self # Need history for Sonar analysis - - task: SonarCloudPrepare@3 - env: - SONAR_SCANNER_OPTS: '' - inputs: - SonarCloud: 'SonarCloud' - organization: 'lidarr' - scannerMode: 'cli' - configMode: 'manual' - cliProjectKey: 'lidarr_Lidarr.UI' - cliProjectName: 'LidarrUI' - cliProjectVersion: '$(lidarrVersion)' - cliSources: './frontend' - - task: SonarCloudAnalyze@3 - - - job: Api_Docs - displayName: API Docs - dependsOn: Prepare - condition: | - and - ( - and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/develop')), - and(succeeded(), eq(dependencies.Prepare.outputs['setVar.backendNotUpdated'], '0')) - ) - - pool: - vmImage: ${{ variables.windowsImage }} - - steps: - - task: UseDotNet@2 - displayName: 'Install .net core' - inputs: - version: $(dotnetVersion) - - checkout: self - submodules: true - persistCredentials: true - fetchDepth: 1 - - bash: ./docs.sh Windows - displayName: Create openapi.json - - bash: | - git config --global user.email "development@lidarr.audio" - git config --global user.name "Servarr" - git checkout -b api-docs - git add . - if git status | grep -q modified - then - git commit -am 'Automated API Docs update' - git push -f --set-upstream origin api-docs - curl -X POST -H "Authorization: token ${GITHUBTOKEN}" -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/lidarr/lidarr/pulls -d '{"head":"api-docs","base":"develop","title":"Update API docs"}' - else - echo "No changes since last run" - fi - displayName: Commit API Doc Change - continueOnError: true - env: - GITHUBTOKEN: $(githubToken) - - task: CopyFiles@2 - displayName: 'Copy openapi.json to: $(Build.ArtifactStagingDirectory)' - inputs: - SourceFolder: '$(Build.SourcesDirectory)' - Contents: | - **/*openapi.json - TargetFolder: '$(Build.ArtifactStagingDirectory)/api_docs' - - publish: $(Build.ArtifactStagingDirectory)/api_docs - artifact: 'APIDocs' - displayName: Publish API Docs Bundle - condition: and(succeeded(), eq(variables['System.JobAttempt'], '1')) - - - job: Analyze_Backend - displayName: Backend - dependsOn: Prepare - condition: and(succeeded(), eq(dependencies.Prepare.outputs['setVar.backendNotUpdated'], '0')) - - variables: - disable.coverage.autogenerate: 'true' - EnableAnalyzers: 'false' - - pool: - vmImage: ${{ variables.windowsImage }} - - steps: - - task: UseDotNet@2 - displayName: 'Install .net core' - inputs: - version: $(dotnetVersion) - - checkout: self # Need history for Sonar analysis - submodules: true - - powershell: Set-Service SCardSvr -StartupType Manual - displayName: Enable Windows Test Service - - task: SonarCloudPrepare@3 - condition: eq(variables['System.PullRequest.IsFork'], 'False') - inputs: - SonarCloud: 'SonarCloud' - organization: 'lidarr' - scannerMode: 'dotnet' - projectKey: 'lidarr_Lidarr' - projectName: 'Lidarr' - projectVersion: '$(lidarrVersion)' - extraProperties: | - sonar.exclusions=**/obj/**,**/*.dll,**/NzbDrone.Core.Test/Files/**/*,./frontend/**,**/ExternalModules/**,./src/Libraries/** - sonar.coverage.exclusions=**/Lidarr.Api.V1/**/* - sonar.cs.opencover.reportsPaths=$(Build.SourcesDirectory)/CoverageResults/**/coverage.opencover.xml - sonar.cs.nunit.reportsPaths=$(Build.SourcesDirectory)/TestResult.xml - - bash: | - ./build.sh --backend -f net6.0 -r win-x64 - TEST_DIR=_tests/net6.0/win-x64/publish/ ./test.sh Windows Unit Coverage - displayName: Coverage Unit Tests - - task: SonarCloudAnalyze@3 - condition: eq(variables['System.PullRequest.IsFork'], 'False') - displayName: Publish SonarCloud Results - - task: reportgenerator@5.3.11 - displayName: Generate Coverage Report - inputs: - reports: '$(Build.SourcesDirectory)/CoverageResults/**/coverage.opencover.xml' - targetdir: '$(Build.SourcesDirectory)/CoverageResults/combined' - reporttypes: 'HtmlInline_AzurePipelines;Cobertura;Badges' - publishCodeCoverageResults: true - - - stage: Report_Out - dependsOn: - - Analyze - - Unit_Test - - Integration - - Automation - condition: eq(variables['system.pullrequest.isfork'], false) - displayName: Build Status Report - jobs: - - job: - displayName: Discord Notification - pool: - vmImage: ${{ variables.linuxImage }} - steps: - - task: DownloadPipelineArtifact@2 - continueOnError: true - displayName: Download Screenshot Artifact - inputs: - buildType: 'current' - artifactName: 'WindowsAutomationScreenshots' - targetPath: $(Build.SourcesDirectory) - - checkout: none - - pwsh: | - iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/Servarr/AzureDiscordNotify/master/DiscordNotify.ps1')) - env: - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - DISCORDCHANNELID: $(discordChannelId) - DISCORDWEBHOOKKEY: $(discordWebhookKey) - DISCORDTHREADID: $(discordThreadId) - diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 000000000..0ca821f4a --- /dev/null +++ b/build.ps1 @@ -0,0 +1,257 @@ +$msBuild = 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe' +$outputFolder = '.\_output' +$outputFolderMono = '.\_output_mono' +$outputFolderOsx = '.\_output_osx' +$outputFolderOsxApp = '.\_output_osx_app' +$testPackageFolder = '.\_tests\' +$testSearchPattern = '*.Test\bin\x86\Release' +$sourceFolder = '.\src' +$updateFolder = $outputFolder + '\NzbDrone.Update' +$updateFolderMono = $outputFolderMono + '\NzbDrone.Update' + +Function Build() +{ + Write-Host "##teamcity[progressStart 'Build']" + + $clean = $msbuild + " src\nzbdrone.sln /t:Clean /m" + $build = $msbuild + " src\nzbdrone.sln /p:Configuration=Release /p:Platform=x86 /t:Build /m" + + if(Test-Path $outputFolder) + { + Remove-Item -Recurse -Force $outputFolder -ErrorAction Continue + } + + Invoke-Expression $clean + CheckExitCode + + Invoke-Expression $build + CheckExitCode + + CleanFolder $outputFolder + + AddJsonNet + + Write-Host "Removing Mono.Posix.dll" + Remove-Item "$outputFolder\Mono.Posix.dll" + + Write-Host "##teamcity[progressFinish 'Build']" +} + +Function CleanFolder($path, $keepConfigFiles) +{ + Write-Host Removing XMLDoc files + get-childitem $path -File -Filter *.xml -Recurse | foreach ($_) { + + $filename = $_.FullName + $exeFilename = $filename -replace "xml", "exe" + $dllFilename = $filename -replace "xml", "dll" + + if (Test-Path $exeFilename) { + remove-item $_.fullname + } + + if (Test-Path $dllFilename) { + remove-item $_.fullname + } + } + + get-childitem $path -File -Filter *.transform -Recurse | foreach ($_) {remove-item $_.fullname} + + if($keepConfigFiles -ne $true) + { + get-childitem $path -File -Filter *.dll.config -Recurse | foreach ($_) {remove-item $_.fullname} + } + + Write-Host Removing FluentValidation.Resources files + get-childitem $path -File -Filter FluentValidation.resources.dll -recurse | foreach ($_) {remove-item $_.fullname} + + get-childitem $path -File -Filter app.config -Recurse | foreach ($_) {remove-item $_.fullname} + + Write-Host Removing .less files + get-childitem $path -File -Filter *.less -Recurse | foreach ($_) {remove-item $_.fullname} + + Write-Host Removing vshost files + get-childitem $path -File -Filter *.vshost.exe -Recurse | foreach ($_) {remove-item $_.fullname} + + if(Test-Path $$path\NuGet) + { + Write-Host Removing NuGet + Remove-Item -Recurse -Force "$path\NuGet" + } + + Write-Host Removing Empty folders + while (Get-ChildItem $path -recurse | where {!@(Get-ChildItem -force $_.fullname)} | Test-Path) + { + Get-ChildItem $path -Directory -recurse | where {!@(Get-ChildItem -force $_.fullname)} | Remove-Item + } +} + +Function PackageMono() +{ + Write-Host "##teamcity[progressStart 'Creating Mono Package']" + + if(Test-Path $outputFolderMono) + { + Remove-Item -Recurse -Force $outputFolderMono -ErrorAction Continue + } + + Copy-Item $outputFolder $outputFolderMono -recurse + + Write-Host Creating MDBs + get-childitem $outputFolderMono -File -Include @("*.exe", "*.dll") -Exclude @("MediaInfo.dll", "sqlite3.dll") -Recurse | foreach ($_) { + Write-Host "Creating .mdb for $_" + & "tools\pdb2mdb\pdb2mdb.exe" $_.fullname + } + + Write-Host Removing PDBs + get-childitem $outputFolderMono -File -Filter *.pdb -Recurse | foreach ($_) {remove-item $_.fullname} + + Write-Host Removing Service helpers + get-childitem $outputFolderMono -File -Filter ServiceUninstall.* -Recurse | foreach ($_) {remove-item $_.fullname} + get-childitem $outputFolderMono -File -Filter ServiceInstall.* -Recurse | foreach ($_) {remove-item $_.fullname} + + Write-Host Removing native windows binaries Sqlite, MediaInfo + get-childitem $outputFolderMono -File -Filter sqlite3.* -Recurse | foreach ($_) {remove-item $_.fullname} + get-childitem $outputFolderMono -File -Filter MediaInfo.* -Recurse | foreach ($_) {remove-item $_.fullname} + + Write-Host "Adding NzbDrone.Core.dll.config (for dllmap)" + Copy-Item "$sourceFolder\NzbDrone.Core\NzbDrone.Core.dll.config" $outputFolderMono + + Write-Host Renaming NzbDrone.Console.exe to NzbDrone.exe + Get-ChildItem $outputFolderMono -File -Filter "NzbDrone.exe*" -Recurse | foreach ($_) {remove-item $_.fullname} + + Write-Host Removing NzbDrone.Windows + get-childitem $outputFolderMono -File -Filter NzbDrone.Windows.* -Recurse | foreach ($_) {remove-item $_.fullname} + + Get-ChildItem $outputFolderMono -File -Filter "NzbDrone.Console.exe*" -Recurse | foreach ($_) { + $newName = $_.fullname -Replace ".Console","" + + Rename-Item $_.fullname $newName + } + + Write-Host Adding NzbDrone.Mono to UpdatePackage + Copy-Item $outputFolderMono\* $updateFolderMono -Filter NzbDrone.Mono.* + + Write-Host "##teamcity[progressFinish 'Creating Mono Package']" +} + +Function PackageOsx() +{ + Write-Host "##teamcity[progressStart 'Creating OS X Package']" + + if(Test-Path $outputFolderOsx) + { + Remove-Item -Recurse -Force $outputFolderOsx -ErrorAction Continue + } + + Copy-Item $outputFolderMono $outputFolderOsx -recurse + + Write-Host "Adding sqlite dylibs" + Copy-Item "$sourceFolder\Libraries\sqlite\*.dylib" "$outputFolderOsx" + + Write-Host "Adding MediaInfo dylib" + Copy-Item "$sourceFolder\Libraries\MediaInfo\*.dylib" "$outputFolderOsx" + + Write-Host "Adding Startup script" + Copy-Item .\osx\Sonarr "$outputFolderOsx" + + Write-Host "##teamcity[progressFinish 'Creating OS X Package']" +} + + +Function PackageOsxApp() +{ + Write-Host "##teamcity[progressStart 'Creating OS X App Package']" + + if(Test-Path $outputFolderOsxApp) + { + Remove-Item -Recurse -Force $outputFolderOsxApp -ErrorAction Continue + } + + Copy-Item .\osx\Sonarr.app $outputFolderOsxApp\Sonarr.app -recurse + Copy-Item $outputFolderOsx $outputFolderOsxApp\Sonarr.app\Contents\MacOS -recurse + + Write-Host "##teamcity[progressFinish 'Creating OS X App Package']" +} + +Function AddJsonNet() +{ + get-childitem $outputFolder -File -Filter Newtonsoft.Json.* -Recurse | foreach ($_) {remove-item $_.fullname} + Copy-Item .\src\packages\Newtonsoft.Json.*.*\lib\net35\*.dll -Destination $outputFolder + Copy-Item .\src\packages\Newtonsoft.Json.*.*\lib\net35\*.dll -Destination $outputFolder\NzbDrone.Update +} + +Function PackageTests() +{ + + Write-Host Packaging Tests + Write-Host "##teamcity[progressStart 'Creating Test Package']" + + if(Test-Path $testPackageFolder) + { + Remove-Item -Recurse -Force $testPackageFolder -ErrorAction Continue + } + + Get-ChildItem -Recurse -Directory | Where-Object {$_.FullName -like $testSearchPattern} | foreach($_){ + Copy-Item -Recurse ($_.FullName + "\*") $testPackageFolder -ErrorAction Ignore + } + + .\src\.nuget\NuGet.exe install NUnit.Runners -Version 2.6.1 -Output $testPackageFolder + + Copy-Item $outputFolder\*.dll -Destination $testPackageFolder -Force + Copy-Item $outputFolder\*.pdb -Destination $testPackageFolder -Force + Copy-Item .\*.sh -Destination $testPackageFolder -Force + + Write-Host Creating MDBs for tests + get-childitem $testPackageFolder -File -Include @("*.exe", "*.dll") -Exclude @("MediaInfo.dll", "sqlite3.dll") -Recurse | foreach ($_) { + Write-Host "Creating .mdb for $_" + & "tools\pdb2mdb\pdb2mdb.exe" $_.fullname + } + + get-childitem $testPackageFolder -File -Filter *log.config | foreach ($_) {remove-item $_.fullname} + + CleanFolder $testPackageFolder $true + + Write-Host "Adding NzbDrone.Core.dll.config (for dllmap)" + Copy-Item "$sourceFolder\NzbDrone.Core\NzbDrone.Core.dll.config" -Destination $testPackageFolder -Force + + Write-Host "##teamcity[progressFinish 'Creating Test Package']" +} + +Function RunGulp() +{ + Write-Host "##teamcity[progressStart 'Running Gulp']" + Invoke-Expression 'npm install' + CheckExitCode + + Invoke-Expression 'gulp build' -ErrorAction Continue -Verbose + CheckExitCode + + Write-Host "##teamcity[progressFinish 'Running Gulp']" +} + +Function CheckExitCode() +{ + if ($lastexitcode -ne 0) + { + Write-Host $errorMessage + exit 1 + } +} + +Function CleanupWindowsPackage() +{ + Write-Host Removing NzbDrone.Mono + get-childitem $outputFolder -File -Filter NzbDrone.Mono.* -Recurse | foreach ($_) {remove-item $_.fullname} + + Write-Host Adding NzbDrone.Windows to UpdatePackage + Copy-Item $outputFolder\* $updateFolder -Filter NzbDrone.Windows.* +} + +Build +RunGulp +PackageMono +PackageOsx +PackageOsxApp +PackageTests +CleanupWindowsPackage diff --git a/build.sh b/build.sh deleted file mode 100755 index ca2ab01ef..000000000 --- a/build.sh +++ /dev/null @@ -1,442 +0,0 @@ -#! /usr/bin/env bash -set -e - -outputFolder='_output' -testPackageFolder='_tests' -artifactsFolder="_artifacts"; - -ProgressStart() -{ - echo "Start '$1'" -} - -ProgressEnd() -{ - echo "Finish '$1'" -} - -UpdateVersionNumber() -{ - if [ "$LIDARRVERSION" != "" ]; then - echo "Updating Version Info" - sed -i'' -e "s/[0-9.*]\+<\/AssemblyVersion>/$LIDARRVERSION<\/AssemblyVersion>/g" src/Directory.Build.props - sed -i'' -e "s/[\$()A-Za-z-]\+<\/AssemblyConfiguration>/${BUILD_SOURCEBRANCHNAME}<\/AssemblyConfiguration>/g" src/Directory.Build.props - sed -i'' -e "s/10.0.0.0<\/string>/$LIDARRVERSION<\/string>/g" distribution/osx/Lidarr.app/Contents/Info.plist - fi -} - -EnableExtraPlatformsInSDK() -{ - SDK_PATH=$(dotnet --list-sdks | grep -P '6\.\d\.\d+' | head -1 | sed 's/\(6\.[0-9]*\.[0-9]*\).*\[\(.*\)\]/\2\/\1/g') - BUNDLEDVERSIONS="${SDK_PATH}/Microsoft.NETCoreSdk.BundledVersions.props" - if grep -q freebsd-x64 $BUNDLEDVERSIONS; then - echo "Extra platforms already enabled" - else - echo "Enabling extra platform support" - sed -i.ORI 's/osx-x64/osx-x64;freebsd-x64;linux-x86/' $BUNDLEDVERSIONS - fi -} - -EnableExtraPlatforms() -{ - if grep -qv freebsd-x64 src/Directory.Build.props; then - sed -i'' -e "s^\(.*\)^\1;freebsd-x64;linux-x86^g" src/Directory.Build.props - fi -} - -LintUI() -{ - ProgressStart 'ESLint' - yarn lint - ProgressEnd 'ESLint' - - ProgressStart 'Stylelint' - if [ "$os" = "windows" ]; then - yarn stylelint-windows - else - yarn stylelint-linux - fi - ProgressEnd 'Stylelint' -} - -Build() -{ - ProgressStart 'Build' - - rm -rf $outputFolder - rm -rf $testPackageFolder - - slnFile=src/Lidarr.sln - - if [ $os = "windows" ]; then - platform=Windows - else - platform=Posix - fi - - dotnet clean $slnFile -c Debug - dotnet clean $slnFile -c Release - - if [[ -z "$RID" || -z "$FRAMEWORK" ]]; - then - dotnet msbuild -restore $slnFile -p:Configuration=Release -p:Platform=$platform -t:PublishAllRids - else - dotnet msbuild -restore $slnFile -p:Configuration=Release -p:Platform=$platform -p:RuntimeIdentifiers=$RID -t:PublishAllRids - fi - - ProgressEnd 'Build' -} - -YarnInstall() -{ - ProgressStart 'yarn install' - yarn install --frozen-lockfile --network-timeout 120000 - ProgressEnd 'yarn install' -} - -RunWebpack() -{ - ProgressStart 'Running webpack' - yarn run build --env production - ProgressEnd 'Running webpack' -} - -PackageFiles() -{ - local folder="$1" - local framework="$2" - local runtime="$3" - - rm -rf $folder - mkdir -p $folder - cp -r $outputFolder/$framework/$runtime/publish/* $folder - cp -r $outputFolder/Lidarr.Update/$framework/$runtime/publish $folder/Lidarr.Update - cp -r $outputFolder/UI $folder - - echo "Adding LICENSE" - cp LICENSE.md $folder -} - -PackageLinux() -{ - local framework="$1" - local runtime="$2" - - ProgressStart "Creating $runtime Package for $framework" - - local folder=$artifactsFolder/$runtime/$framework/Lidarr - - PackageFiles "$folder" "$framework" "$runtime" - - echo "Removing Service helpers" - rm -f $folder/ServiceUninstall.* - rm -f $folder/ServiceInstall.* - - echo "Removing Lidarr.Windows" - rm $folder/Lidarr.Windows.* - - echo "Adding Lidarr.Mono to UpdatePackage" - cp $folder/Lidarr.Mono.* $folder/Lidarr.Update - if [ "$framework" = "net6.0" ]; then - cp $folder/Mono.Posix.NETStandard.* $folder/Lidarr.Update - cp $folder/libMonoPosixHelper.* $folder/Lidarr.Update - fi - - ProgressEnd "Creating $runtime Package for $framework" -} - -PackageMacOS() -{ - local framework="$1" - local runtime="$2" - - ProgressStart "Creating $runtime Package for $framework" - - local folder=$artifactsFolder/$runtime/$framework/Lidarr - - PackageFiles "$folder" "$framework" "$runtime" - - echo "Removing Service helpers" - rm -f $folder/ServiceUninstall.* - rm -f $folder/ServiceInstall.* - - echo "Removing Lidarr.Windows" - rm $folder/Lidarr.Windows.* - - echo "Adding Lidarr.Mono to UpdatePackage" - cp $folder/Lidarr.Mono.* $folder/Lidarr.Update - if [ "$framework" = "net6.0" ]; then - cp $folder/Mono.Posix.NETStandard.* $folder/Lidarr.Update - cp $folder/libMonoPosixHelper.* $folder/Lidarr.Update - fi - - ProgressEnd 'Creating MacOS Package' -} - -PackageMacOSApp() -{ - local framework="$1" - local runtime="$2" - - ProgressStart "Creating $runtime App Package for $framework" - - local folder=$artifactsFolder/$runtime-app/$framework - - rm -rf $folder - mkdir -p $folder - cp -r distribution/osx/Lidarr.app $folder - mkdir -p $folder/Lidarr.app/Contents/MacOS - - echo "Copying Binaries" - cp -r $artifactsFolder/$runtime/$framework/Lidarr/* $folder/Lidarr.app/Contents/MacOS - - echo "Removing Update Folder" - rm -r $folder/Lidarr.app/Contents/MacOS/Lidarr.Update - - ProgressEnd 'Creating macOS App Package' -} - -PackageWindows() -{ - local framework="$1" - local runtime="$2" - - ProgressStart "Creating Windows Package for $framework" - - local folder=$artifactsFolder/$runtime/$framework/Lidarr - - PackageFiles "$folder" "$framework" "$runtime" - cp -r $outputFolder/$framework-windows/$runtime/publish/* $folder - - echo "Removing Lidarr.Mono" - rm -f $folder/Lidarr.Mono.* - rm -f $folder/Mono.Posix.NETStandard.* - rm -f $folder/libMonoPosixHelper.* - - echo "Adding Lidarr.Windows to UpdatePackage" - cp $folder/Lidarr.Windows.* $folder/Lidarr.Update - - ProgressEnd "Creating $runtime Package for $framework" -} - -Package() -{ - local framework="$1" - local runtime="$2" - local SPLIT - - IFS='-' read -ra SPLIT <<< "$runtime" - - case "${SPLIT[0]}" in - linux|freebsd*) - PackageLinux "$framework" "$runtime" - ;; - win) - PackageWindows "$framework" "$runtime" - ;; - osx) - PackageMacOS "$framework" "$runtime" - PackageMacOSApp "$framework" "$runtime" - ;; - esac -} - -BuildInstaller() -{ - local framework="$1" - local runtime="$2" - - ./_inno/ISCC.exe distribution/windows/setup/lidarr.iss "//DFramework=$framework" "//DRuntime=$runtime" -} - -InstallInno() -{ - ProgressStart "Installing portable Inno Setup" - - rm -rf _inno - curl -s --output innosetup.exe "https://files.jrsoftware.org/is/6/innosetup-${INNOVERSION:-6.2.0}.exe" - mkdir _inno - ./innosetup.exe //portable=1 //silent //currentuser //dir=.\\_inno - rm innosetup.exe - - ProgressEnd "Installed portable Inno Setup" -} - -RemoveInno() -{ - rm -rf _inno -} - -PackageTests() -{ - local framework="$1" - local runtime="$2" - - cp test.sh "$testPackageFolder/$framework/$runtime/publish" - - rm -f $testPackageFolder/$framework/$runtime/*.log.config - - ProgressEnd 'Creating Test Package' -} - -# Use mono or .net depending on OS -case "$(uname -s)" in - CYGWIN*|MINGW32*|MINGW64*|MSYS*) - # on windows, use dotnet - os="windows" - ;; - *) - # otherwise use mono - os="posix" - ;; -esac - -POSITIONAL=() - -if [ $# -eq 0 ]; then - echo "No arguments provided, building everything" - BACKEND=YES - FRONTEND=YES - PACKAGES=YES - INSTALLER=NO - LINT=YES - ENABLE_EXTRA_PLATFORMS=NO - ENABLE_EXTRA_PLATFORMS_IN_SDK=NO -fi - -while [[ $# -gt 0 ]] -do -key="$1" - -case $key in - --backend) - BACKEND=YES - shift # past argument - ;; - --enable-bsd|--enable-extra-platforms) - ENABLE_EXTRA_PLATFORMS=YES - shift # past argument - ;; - --enable-extra-platforms-in-sdk) - ENABLE_EXTRA_PLATFORMS_IN_SDK=YES - shift # past argument - ;; - -r|--runtime) - RID="$2" - shift # past argument - shift # past value - ;; - -f|--framework) - FRAMEWORK="$2" - shift # past argument - shift # past value - ;; - --frontend) - FRONTEND=YES - shift # past argument - ;; - --packages) - PACKAGES=YES - shift # past argument - ;; - --installer) - INSTALLER=YES - shift # past argument - ;; - --lint) - LINT=YES - shift # past argument - ;; - --all) - BACKEND=YES - FRONTEND=YES - PACKAGES=YES - LINT=YES - shift # past argument - ;; - *) # unknown option - POSITIONAL+=("$1") # save it in an array for later - shift # past argument - ;; -esac -done -set -- "${POSITIONAL[@]}" # restore positional parameters - -if [ "$ENABLE_EXTRA_PLATFORMS_IN_SDK" = "YES" ]; -then - EnableExtraPlatformsInSDK -fi - -if [ "$BACKEND" = "YES" ]; -then - UpdateVersionNumber - if [ "$ENABLE_EXTRA_PLATFORMS" = "YES" ]; - then - EnableExtraPlatforms - fi - Build - if [[ -z "$RID" || -z "$FRAMEWORK" ]]; - then - PackageTests "net6.0" "win-x64" - PackageTests "net6.0" "win-x86" - PackageTests "net6.0" "linux-x64" - PackageTests "net6.0" "linux-musl-x64" - PackageTests "net6.0" "osx-x64" - if [ "$ENABLE_EXTRA_PLATFORMS" = "YES" ]; - then - PackageTests "net6.0" "freebsd-x64" - PackageTests "net6.0" "linux-x86" - fi - else - PackageTests "$FRAMEWORK" "$RID" - fi -fi - -if [[ "$LINT" = "YES" || "$FRONTEND" = "YES" ]]; -then - YarnInstall -fi - -if [ "$LINT" = "YES" ]; -then - LintUI -fi - -if [ "$FRONTEND" = "YES" ]; -then - RunWebpack -fi - -if [ "$PACKAGES" = "YES" ]; -then - UpdateVersionNumber - - if [[ -z "$RID" || -z "$FRAMEWORK" ]]; - then - Package "net6.0" "win-x64" - Package "net6.0" "win-x86" - Package "net6.0" "linux-x64" - Package "net6.0" "linux-musl-x64" - Package "net6.0" "linux-arm64" - Package "net6.0" "linux-musl-arm64" - Package "net6.0" "linux-arm" - Package "net6.0" "linux-musl-arm" - Package "net6.0" "osx-x64" - Package "net6.0" "osx-arm64" - if [ "$ENABLE_EXTRA_PLATFORMS" = "YES" ]; - then - Package "net6.0" "freebsd-x64" - Package "net6.0" "linux-x86" - fi - else - Package "$FRAMEWORK" "$RID" - fi -fi - -if [ "$INSTALLER" = "YES" ]; -then - InstallInno - BuildInstaller "net6.0" "win-x64" - BuildInstaller "net6.0" "win-x86" - RemoveInno -fi diff --git a/commonjsCleanup.linq b/commonjsCleanup.linq new file mode 100644 index 000000000..d9df781c6 --- /dev/null +++ b/commonjsCleanup.linq @@ -0,0 +1,50 @@ + + +void Main() +{ + var files = Directory.GetFiles("c:\\git\\sonarr\\src\\UI","*.js", SearchOption.AllDirectories); + + var moduleRegex = new Regex(@"module.exports\s*=\s*\(function\s*\(\)\s*{\n\s*return\s*(\w|\W)*\)\.call\(this\);$"); + var functionHead = new Regex(@"\s*\(function\s*\(\)\s*{\n\s*return\s*"); + var functionTail = new Regex(@"\}\).call\(this\);$"); + var multiVar = new Regex(@"^(?var\s*\w*\s*=\s*require\(.*\)),"); + var seperateDeclearatuin = new Regex(@"^((\w|\$|_)*\s=\srequire\(.*\))(,|;)", RegexOptions.Multiline); + + foreach (var filePath in files) + { + var text = File.ReadAllText(filePath); + + var newContent = text.Replace("// Generated by uRequire v0.7.0-beta.14 template: 'nodejs'",""); + + newContent = newContent.Replace("var __isAMD = !!(typeof define === 'function' && define.amd),",""); + newContent = newContent.Replace("__isNode = (typeof exports === 'object'),",""); + newContent = newContent.Replace("__isWeb = !__isNode;",""); + newContent = newContent.Replace("\"use strict\";","'use strict';"); + + newContent = newContent.Trim(); + + + + if(moduleRegex.IsMatch(newContent)) + { + filePath.Dump(); + + newContent = functionHead.Replace(newContent," "); + newContent = functionTail.Replace(newContent,""); + } + + if(multiVar.IsMatch(newContent)) + { + newContent = multiVar.Replace(newContent,"$1;"); //first one + + } + + newContent = seperateDeclearatuin.Replace(newContent,"var $1;"); //ones after + newContent.Replace("var $ = require('jquery'), var","var $ = require('jquery');"); + + File.WriteAllText(filePath,newContent.Trim()); + + } +} + +// Define other methods and classes here diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 000000000..eb8f841a6 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +nzbdrone {version} {branch}; urgency=low + + * Automatic Release. + + -- NzbDrone Mon, 26 Aug 2013 00:00:00 -0700 diff --git a/debian/compat b/debian/compat new file mode 100644 index 000000000..45a4fb75d --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +8 diff --git a/debian/control b/debian/control new file mode 100644 index 000000000..ba30c02ee --- /dev/null +++ b/debian/control @@ -0,0 +1,12 @@ +Section: web +Priority: optional +Maintainer: Sonarr +Source: nzbdrone +Homepage: https://sonarr.tv +Vcs-Git: git@github.com:Sonarr/Sonarr.git +Vcs-Browser: https://github.com/Sonarr/Sonarr + +Package: nzbdrone +Architecture: all +Depends: libmono-cil-dev (>= 3.2), sqlite3 (>= 3.7), mediainfo (>= 0.7.52) +Description: Sonarr is an internet PVR diff --git a/debian/copyright b/debian/copyright new file mode 100755 index 000000000..53f3f3826 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,24 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: nzbdrone +Source: https://github.com/Sonarr/Sonarr + +Files: * +Copyright: 2010-2014 Sonarr + +License: GPL-3.0+ + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + . + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see . + . + On Debian systems, the complete text of the GNU General + Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". diff --git a/debian/install b/debian/install new file mode 100755 index 000000000..106b06a9b --- /dev/null +++ b/debian/install @@ -0,0 +1 @@ +nzbdrone_bin/* opt/NzbDrone diff --git a/debian/rules b/debian/rules new file mode 100755 index 000000000..b760bee7f --- /dev/null +++ b/debian/rules @@ -0,0 +1,13 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +%: + dh $@ diff --git a/distribution/debian/install.sh b/distribution/debian/install.sh deleted file mode 100644 index b71eb20c9..000000000 --- a/distribution/debian/install.sh +++ /dev/null @@ -1,182 +0,0 @@ -#!/bin/bash -### Description: Lidarr .NET Debian install -### Originally written for Radarr by: DoctorArr - doctorarr@the-rowlands.co.uk on 2021-10-01 v1.0 -### Updates for servarr suite made by Bakerboy448, DoctorArr, brightghost, aeramor and VP-EN -### Version v1.0.0 2023-12-29 - StevieTV - adapted from servarr script for Lidarr installs -### Version V1.0.1 2024-01-02 - StevieTV - remove UTF8-BOM -### Version V1.0.2 2024-01-03 - markus101 - Get user input from /dev/tty -### Version V1.0.3 2024-01-06 - StevieTV - exit script when it is ran from install directory - -### Boilerplate Warning -#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -#EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -#MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -#NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -#LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -#OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -#WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -scriptversion="1.0.3" -scriptdate="2024-01-06" - -set -euo pipefail - -echo "Running Lidarr Install Script - Version [$scriptversion] as of [$scriptdate]" - -# Am I root?, need root! - -if [ "$EUID" -ne 0 ]; then - echo "Please run as root." - exit -fi - -app="lidarr" -app_port="8686" -app_prereq="curl sqlite3 wget" -app_umask="0002" -branch="main" - -# Constants -### Update these variables as required for your specific instance -installdir="/opt" # {Update me if needed} Install Location -bindir="${installdir}/${app^}" # Full Path to Install Location -datadir="/var/lib/$app/" # {Update me if needed} AppData directory to use -app_bin=${app^} # Binary Name of the app - -# This script should not be ran from installdir, otherwise later in the script the extracted files will be removed before they can be moved to installdir. -if [ "$installdir" == "$(dirname -- "$( readlink -f -- "$0"; )")" ] || [ "$bindir" == "$(dirname -- "$( readlink -f -- "$0"; )")" ]; then - echo "You should not run this script from the intended install directory. The script will exit. Please re-run it from another directory" - exit -fi - -# Prompt User -read -r -p "What user should ${app^} run as? (Default: $app): " app_uid < /dev/tty -app_uid=$(echo "$app_uid" | tr -d ' ') -app_uid=${app_uid:-$app} -# Prompt Group -read -r -p "What group should ${app^} run as? (Default: media): " app_guid < /dev/tty -app_guid=$(echo "$app_guid" | tr -d ' ') -app_guid=${app_guid:-media} - -echo "This will install [${app^}] to [$bindir] and use [$datadir] for the AppData Directory" -echo "${app^} will run as the user [$app_uid] and group [$app_guid]. By continuing, you've confirmed that the selected user and group will have READ and WRITE access to your Media Library and Download Client Completed Download directories" -read -n 1 -r -s -p $'Press enter to continue or ctrl+c to exit...\n' < /dev/tty - -# Create User / Group as needed -if [ "$app_guid" != "$app_uid" ]; then - if ! getent group "$app_guid" >/dev/null; then - groupadd "$app_guid" - fi -fi -if ! getent passwd "$app_uid" >/dev/null; then - adduser --system --no-create-home --ingroup "$app_guid" "$app_uid" - echo "Created and added User [$app_uid] to Group [$app_guid]" -fi -if ! getent group "$app_guid" | grep -qw "$app_uid"; then - echo "User [$app_uid] did not exist in Group [$app_guid]" - usermod -a -G "$app_guid" "$app_uid" - echo "Added User [$app_uid] to Group [$app_guid]" -fi - -# Stop the App if running -if service --status-all | grep -Fq "$app"; then - systemctl stop "$app" - systemctl disable "$app".service - echo "Stopped existing $app" -fi - -# Create Appdata Directory - -# AppData -mkdir -p "$datadir" -chown -R "$app_uid":"$app_guid" "$datadir" -chmod 775 "$datadir" -echo "Directories created" -# Download and install the App - -# prerequisite packages -echo "" -echo "Installing pre-requisite Packages" -# shellcheck disable=SC2086 -apt update && apt install -y $app_prereq -echo "" -ARCH=$(dpkg --print-architecture) -# get arch -dlbase="https://lidarr.servarr.com/v1/update/$branch/updatefile?os=linux&runtime=netcore" -case "$ARCH" in -"amd64") DLURL="${dlbase}&arch=x64" ;; -"armhf") DLURL="${dlbase}&arch=arm" ;; -"arm64") DLURL="${dlbase}&arch=arm64" ;; -*) - echo "Arch not supported" - exit 1 - ;; -esac -echo "" -echo "Removing previous tarballs" -# -f to Force so we fail if it doesn't exist -rm -f "${app^}".*.tar.gz -echo "" -echo "Downloading..." -wget --content-disposition "$DLURL" -tar -xvzf "${app^}".*.tar.gz -echo "" -echo "Installation files downloaded and extracted" - -# remove existing installs -echo "Removing existing installation" -rm -rf "$bindir" -echo "Installing..." -mv "${app^}" $installdir -chown "$app_uid":"$app_guid" -R "$bindir" -chmod 775 "$bindir" -rm -rf "${app^}.*.tar.gz" -# Ensure we check for an update in case user installs older version or different branch -touch "$datadir"/update_required -chown "$app_uid":"$app_guid" "$datadir"/update_required -echo "App Installed" -# Configure Autostart - -# Remove any previous app .service -echo "Removing old service file" -rm -rf /etc/systemd/system/"$app".service - -# Create app .service with correct user startup -echo "Creating service file" -cat </dev/null -[Unit] -Description=${app^} Daemon -After=syslog.target network.target -[Service] -User=$app_uid -Group=$app_guid -UMask=$app_umask -Type=simple -ExecStart=$bindir/$app_bin -nobrowser -data=$datadir -TimeoutStopSec=20 -KillMode=process -Restart=on-failure -[Install] -WantedBy=multi-user.target -EOF - -# Start the App -echo "Service file created. Attempting to start the app" -systemctl -q daemon-reload -systemctl enable --now -q "$app" - -# Finish Update/Installation -host=$(hostname -I) -ip_local=$(grep -oP '^\S*' <<<"$host") -echo "" -echo "Install complete" -sleep 10 -STATUS="$(systemctl is-active "$app")" -if [ "${STATUS}" = "active" ]; then - echo "Browse to http://$ip_local:$app_port for the ${app^} GUI" -else - echo "${app^} failed to start" -fi - -# Exit -exit 0 diff --git a/distribution/debian/lidarr.service b/distribution/debian/lidarr.service deleted file mode 100644 index 8ec5b5b1d..000000000 --- a/distribution/debian/lidarr.service +++ /dev/null @@ -1,20 +0,0 @@ -# This file is owned by the lidarr package, DO NOT MODIFY MANUALLY -# Instead use 'dpkg-reconfigure -plow lidarr' to modify User/Group/UMask/-data -# Or use systemd built-in override functionality using 'systemctl edit lidarr' -[Unit] -Description=Lidarr Daemon -After=network.target - -[Service] -User=lidarr -Group=lidarr -UMask=002 - -Type=simple -ExecStart=/opt/Lidarr/Lidarr -nobrowser -data=/var/lib/lidarr -TimeoutStopSec=20 -KillMode=process -Restart=on-failure - -[Install] -WantedBy=multi-user.target diff --git a/distribution/osx/Lidarr.app/Contents/Resources/lidarr.icns b/distribution/osx/Lidarr.app/Contents/Resources/lidarr.icns deleted file mode 100644 index 0d92b5b00..000000000 Binary files a/distribution/osx/Lidarr.app/Contents/Resources/lidarr.icns and /dev/null differ diff --git a/distribution/windows/setup/lidarr.iss b/distribution/windows/setup/lidarr.iss deleted file mode 100644 index f5c0cf791..000000000 --- a/distribution/windows/setup/lidarr.iss +++ /dev/null @@ -1,84 +0,0 @@ -; Script generated by the Inno Setup Script Wizard. -; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! - -#define AppName "Lidarr" -#define AppPublisher "Team Lidarr" -#define AppURL "https://lidarr.audio/" -#define ForumsURL "https://lidarr.audio/discord" -#define AppExeName "Lidarr.exe" -#define BaseVersion GetEnv('MAJORVERSION') -#define BuildNumber GetEnv('MINORVERSION') -#define BuildVersion GetEnv('LIDARRVERSION') - -[Setup] -; NOTE: The value of AppId uniquely identifies this application. -; Do not use the same AppId value in installers for other applications. -; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) -AppId={{56C1065D-3523-4025-B76D-6F73F67F7F93} -AppName={#AppName} -AppVersion={#BaseVersion} -AppPublisher={#AppPublisher} -AppPublisherURL={#AppURL} -AppSupportURL={#ForumsURL} -AppUpdatesURL={#AppURL} -DefaultDirName={commonappdata}\Lidarr -DisableDirPage=yes -DefaultGroupName={#AppName} -DisableProgramGroupPage=yes -OutputBaseFilename=Lidarr.{#BuildVersion}.{#Runtime} -SolidCompression=yes -AppCopyright=Creative Commons 3.0 License -AllowUNCPath=False -UninstallDisplayIcon={app}\bin\Lidarr.exe -DisableReadyPage=True -CompressionThreads=2 -Compression=lzma2/normal -AppContact={#ForumsURL} -VersionInfoVersion={#BaseVersion}.{#BuildNumber} -SetupLogging=yes -OutputDir=output -WizardStyle=modern - -[Languages] -Name: "english"; MessagesFile: "compiler:Default.isl" - -[Tasks] -Name: "desktopIcon"; Description: "{cm:CreateDesktopIcon}" -Name: "windowsService"; Description: "Install Windows Service (Starts when the computer starts as the LocalService user, you will need to change the user to access network shares)"; GroupDescription: "Start automatically"; Flags: exclusive -Name: "startupShortcut"; Description: "Create shortcut in Startup folder (Starts when you log into Windows)"; GroupDescription: "Start automatically"; Flags: exclusive unchecked -Name: "none"; Description: "Do not start automatically"; GroupDescription: "Start automatically"; Flags: exclusive unchecked - -[Dirs] -Name: "{app}"; Permissions: users-modify - -[Files] -Source: "..\..\..\_artifacts\{#Runtime}\{#Framework}\Lidarr\Lidarr.exe"; DestDir: "{app}\bin"; Flags: ignoreversion -Source: "..\..\..\_artifacts\{#Runtime}\{#Framework}\Lidarr\*"; Excludes: "Lidarr.Update"; DestDir: "{app}\bin"; Flags: ignoreversion recursesubdirs createallsubdirs -; NOTE: Don't use "Flags: ignoreversion" on any shared system files - -[Icons] -Name: "{group}\{#AppName}"; Filename: "{app}\bin\{#AppExeName}"; Parameters: "/icon" -Name: "{commondesktop}\{#AppName}"; Filename: "{app}\bin\{#AppExeName}"; Parameters: "/icon"; Tasks: desktopIcon -Name: "{userstartup}\{#AppName}"; Filename: "{app}\bin\Lidarr.exe"; WorkingDir: "{app}\bin"; Tasks: startupShortcut - -[InstallDelete] -Name: "{app}\bin"; Type: filesandordirs - -[Run] -Filename: "{app}\bin\Lidarr.Console.exe"; StatusMsg: "Removing previous Windows Service"; Parameters: "/u /exitimmediately"; Flags: runhidden waituntilterminated; -Filename: "{app}\bin\Lidarr.Console.exe"; Description: "Enable Access from Other Devices"; StatusMsg: "Enabling Remote access"; Parameters: "/registerurl /exitimmediately"; Flags: postinstall runascurrentuser runhidden waituntilterminated; Tasks: startupShortcut none; -Filename: "{app}\bin\Lidarr.Console.exe"; StatusMsg: "Installing Windows Service"; Parameters: "/i /exitimmediately"; Flags: runhidden waituntilterminated; Tasks: windowsService -Filename: "{app}\bin\Lidarr.exe"; Description: "Open Lidarr Web UI"; Flags: postinstall skipifsilent nowait; Tasks: windowsService; -Filename: "{app}\bin\Lidarr.exe"; Description: "Start Lidarr"; Flags: postinstall skipifsilent nowait; Tasks: startupShortcut none; - -[UninstallRun] -Filename: "{app}\bin\lidarr.console.exe"; Parameters: "/u"; Flags: waituntilterminated skipifdoesntexist - -[Code] -function PrepareToInstall(var NeedsRestart: Boolean): String; -var - ResultCode: Integer; -begin - Exec('net', 'stop lidarr', '', 0, ewWaitUntilTerminated, ResultCode) - Exec('sc', 'delete lidarr', '', 0, ewWaitUntilTerminated, ResultCode) -end; diff --git a/docs.sh b/docs.sh deleted file mode 100644 index a44dc90ce..000000000 --- a/docs.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash -set -e - -FRAMEWORK="net6.0" -PLATFORM=$1 -ARCHITECTURE="${2:-x64}" - -if [ "$PLATFORM" = "Windows" ]; then - RUNTIME="win-$ARCHITECTURE" -elif [ "$PLATFORM" = "Linux" ]; then - RUNTIME="linux-$ARCHITECTURE" -elif [ "$PLATFORM" = "Mac" ]; then - RUNTIME="osx-$ARCHITECTURE" -else - echo "Platform must be provided as first argument: Windows, Linux or Mac" - exit 1 -fi - -outputFolder='_output' -testPackageFolder='_tests' - -rm -rf $outputFolder -rm -rf $testPackageFolder - -slnFile=src/Lidarr.sln - -platform=Posix - -if [ "$PLATFORM" = "Windows" ]; then - application=Lidarr.Console.dll -else - application=Lidarr.dll -fi - -dotnet clean $slnFile -c Debug -dotnet clean $slnFile -c Release - -dotnet msbuild -restore $slnFile -p:Configuration=Debug -p:Platform=$platform -p:RuntimeIdentifiers=$RUNTIME -t:PublishAllRids - -dotnet new tool-manifest -dotnet tool install --version 6.6.2 Swashbuckle.AspNetCore.Cli - -dotnet tool run swagger tofile --output ./src/Lidarr.Api.V1/openapi.json "$outputFolder/$FRAMEWORK/$RUNTIME/$application" v1 & - -sleep 45 - -kill %1 - -exit 0 diff --git a/frontend/.eslintignore b/frontend/.eslintignore deleted file mode 100644 index e6d49ec4d..000000000 --- a/frontend/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -**/JsLibraries/** -**/*.css.d.ts diff --git a/frontend/.eslintrc.js b/frontend/.eslintrc.js deleted file mode 100644 index cc26a2633..000000000 --- a/frontend/.eslintrc.js +++ /dev/null @@ -1,393 +0,0 @@ -// eslint-disable-next-line @typescript-eslint/no-var-requires -const fs = require('fs'); -// eslint-disable-next-line @typescript-eslint/no-var-requires -const path = require('path'); -// eslint-disable-next-line @typescript-eslint/no-var-requires -const typescriptEslintRecommended = require('@typescript-eslint/eslint-plugin').configs.recommended; - -const frontendFolder = __dirname; - -const dirs = fs - .readdirSync(path.join(frontendFolder, 'src'), { withFileTypes: true }) - .filter((dirent) => dirent.isDirectory()) - .map((dirent) => dirent.name) - .join('|'); - -module.exports = { - root: true, - - parser: '@babel/eslint-parser', - - env: { - browser: true, - commonjs: true, - node: true, - es6: true - }, - - globals: { - expect: false, - chai: false, - sinon: false, - JSX: true - }, - - parserOptions: { - ecmaVersion: 6, - sourceType: 'module', - babelOptions: { - configFile: `${frontendFolder}/babel.config.js` - }, - ecmaFeatures: { - modules: true, - impliedStrict: true - } - }, - - plugins: [ - 'filenames', - 'react', - 'react-hooks', - 'simple-import-sort', - 'import', - '@typescript-eslint', - 'prettier' - ], - - settings: { - react: { - version: 'detect' - } - }, - - rules: { - 'filenames/match-exported': ['error'], - - // ECMAScript 6 - - 'arrow-body-style': [0], - 'arrow-parens': ['error', 'always'], - 'arrow-spacing': ['error', { before: true, after: true }], - 'constructor-super': 'error', - 'generator-star-spacing': 'off', - 'no-class-assign': 'error', - 'no-confusing-arrow': 'error', - 'no-const-assign': 'error', - 'no-dupe-class-members': 'error', - 'no-duplicate-imports': 'error', - 'no-new-symbol': 'error', - 'no-this-before-super': 'error', - 'no-useless-escape': 'error', - 'no-useless-computed-key': 'error', - 'no-useless-constructor': 'error', - 'no-var': 'warn', - 'object-shorthand': ['error', 'properties'], - 'prefer-arrow-callback': 'error', - 'prefer-const': 'warn', - 'prefer-reflect': 'off', - 'prefer-rest-params': 'off', - 'prefer-spread': 'warn', - 'prefer-template': 'error', - 'require-yield': 'off', - 'template-curly-spacing': ['error', 'never'], - 'yield-star-spacing': 'off', - - // Possible Errors - - 'comma-dangle': 'error', - 'no-cond-assign': 'error', - 'no-console': 'off', - 'no-constant-condition': 'warn', - 'no-control-regex': 'error', - 'no-debugger': 'off', - 'no-dupe-args': 'error', - 'no-dupe-keys': 'error', - 'no-duplicate-case': 'error', - 'no-empty': 'warn', - 'no-empty-character-class': 'error', - 'no-ex-assign': 'error', - 'no-extra-boolean-cast': 'error', - 'no-extra-parens': ['error', 'functions'], - 'no-extra-semi': 'error', - 'no-func-assign': 'error', - 'no-inner-declarations': 'error', - 'no-invalid-regexp': 'error', - 'no-irregular-whitespace': 'error', - 'no-negated-in-lhs': 'error', - 'no-obj-calls': 'error', - 'no-regex-spaces': 'error', - 'no-sparse-arrays': 'error', - 'no-unexpected-multiline': 'error', - 'no-unreachable': 'warn', - 'no-unsafe-finally': 'error', - 'use-isnan': 'error', - 'valid-jsdoc': 'off', - 'valid-typeof': 'error', - - // Best Practices - - 'accessor-pairs': 'off', - 'array-callback-return': 'warn', - 'block-scoped-var': 'warn', - 'consistent-return': 'off', - curly: 'error', - 'default-case': 'error', - 'dot-location': ['error', 'property'], - 'dot-notation': 'error', - eqeqeq: ['error', 'smart'], - 'guard-for-in': 'error', - 'no-alert': 'warn', - 'no-caller': 'error', - 'no-case-declarations': 'error', - 'no-div-regex': 'error', - 'no-else-return': 'error', - 'no-empty-function': ['error', { allow: ['arrowFunctions'] }], - 'no-empty-pattern': 'error', - 'no-eval': 'error', - 'no-extend-native': 'error', - 'no-extra-bind': 'error', - 'no-fallthrough': 'error', - 'no-floating-decimal': 'error', - 'no-implicit-coercion': ['error', { - boolean: false, - number: true, - string: true, - allow: [/* "!!", "~", "*", "+" */] - }], - 'no-implicit-globals': 'error', - 'no-implied-eval': 'error', - 'no-invalid-this': 'off', - 'no-iterator': 'error', - 'no-labels': 'error', - 'no-lone-blocks': 'error', - 'no-loop-func': 'error', - 'no-magic-numbers': ['off', { ignoreArrayIndexes: true, ignore: [0, 1] }], - 'no-multi-spaces': 'error', - 'no-multi-str': 'error', - 'no-native-reassign': ['error', { exceptions: ['console'] }], - 'no-new': 'off', - 'no-new-func': 'error', - 'no-new-wrappers': 'error', - 'no-octal': 'error', - 'no-octal-escape': 'error', - 'no-param-reassign': 'off', - 'no-process-env': 'off', - 'no-proto': 'error', - 'no-redeclare': 'error', - 'no-return-assign': 'warn', - 'no-script-url': 'error', - 'no-self-assign': 'error', - 'no-self-compare': 'error', - 'no-sequences': 'error', - 'no-throw-literal': 'error', - 'no-unmodified-loop-condition': 'error', - 'no-unused-expressions': 'error', - 'no-unused-labels': 'error', - 'no-useless-call': 'error', - 'no-useless-concat': 'error', - 'no-void': 'error', - 'no-warning-comments': 'off', - 'no-with': 'error', - radix: ['error', 'as-needed'], - 'vars-on-top': 'off', - 'wrap-iife': ['error', 'inside'], - yoda: 'error', - - // Strict Mode - - strict: ['error', 'never'], - - // Variables - - 'init-declarations': ['error', 'always'], - 'no-catch-shadow': 'error', - 'no-delete-var': 'error', - 'no-label-var': 'error', - 'no-restricted-globals': 'off', - 'no-shadow': 'error', - 'no-shadow-restricted-names': 'error', - 'no-undef': 'error', - 'no-undef-init': 'off', - 'no-undefined': 'off', - 'no-unused-vars': ['error', { args: 'none', ignoreRestSiblings: true }], - 'no-use-before-define': 'error', - - // Node.js and CommonJS - - 'callback-return': 'warn', - 'global-require': 'error', - 'handle-callback-err': 'warn', - 'no-mixed-requires': 'error', - 'no-new-require': 'error', - 'no-path-concat': 'error', - 'no-process-exit': 'error', - - // Stylistic Issues - - 'array-bracket-spacing': ['error', 'never'], - 'block-spacing': ['error', 'always'], - 'brace-style': ['error', '1tbs', { allowSingleLine: false }], - camelcase: 'off', - 'comma-spacing': ['error', { before: false, after: true }], - 'comma-style': ['error', 'last'], - 'computed-property-spacing': ['error', 'never'], - 'consistent-this': ['error', 'self'], - 'eol-last': 'error', - 'func-names': 'off', - 'func-style': ['error', 'declaration', { allowArrowFunctions: true }], - indent: ['error', 2, { SwitchCase: 1 }], - 'key-spacing': ['error', { beforeColon: false, afterColon: true }], - 'keyword-spacing': ['error', { before: true, after: true }], - 'lines-around-comment': ['error', { beforeBlockComment: true, afterBlockComment: false }], - 'max-depth': ['error', { maximum: 5 }], - 'max-nested-callbacks': ['error', 4], - 'max-statements': 'off', - 'max-statements-per-line': ['error', { max: 1 }], - 'new-cap': ['error', { capIsNewExceptions: ['$.Deferred', 'DragDropContext', 'DragLayer', 'DragSource', 'DropTarget'] }], - 'new-parens': 'error', - 'newline-after-var': 'off', - 'newline-before-return': 'off', - 'newline-per-chained-call': 'off', - 'no-array-constructor': 'error', - 'no-bitwise': 'error', - 'no-continue': 'error', - 'no-inline-comments': 'off', - 'no-lonely-if': 'warn', - 'no-mixed-spaces-and-tabs': 'error', - 'no-multiple-empty-lines': ['error', { max: 1 }], - 'no-negated-condition': 'warn', - 'no-nested-ternary': 'error', - 'no-new-object': 'error', - 'no-plusplus': 'off', - 'no-restricted-syntax': 'off', - 'no-spaced-func': 'error', - 'no-ternary': 'off', - 'no-trailing-spaces': 'error', - 'no-underscore-dangle': ['error', { allowAfterThis: true }], - 'no-unneeded-ternary': 'error', - 'no-whitespace-before-property': 'error', - 'object-curly-spacing': ['error', 'always'], - 'one-var': ['error', 'never'], - 'one-var-declaration-per-line': ['error', 'always'], - 'operator-assignment': ['off', 'never'], - 'operator-linebreak': ['error', 'after'], - 'quote-props': ['error', 'as-needed'], - quotes: ['error', 'single'], - 'require-jsdoc': 'off', - semi: 'error', - 'semi-spacing': ['error', { before: false, after: true }], - 'sort-vars': 'off', - 'space-before-blocks': ['error', 'always'], - 'space-before-function-paren': ['error', 'never'], - 'space-in-parens': 'off', - 'space-infix-ops': 'off', - 'space-unary-ops': 'off', - 'spaced-comment': 'error', - 'wrap-regex': 'error', - - // ImportSort - - 'simple-import-sort/imports': 'error', - 'import/newline-after-import': 'error', - - // React - - 'react/jsx-boolean-value': [2, 'always'], - 'react/jsx-uses-vars': 2, - 'react/jsx-closing-bracket-location': 2, - 'react/jsx-tag-spacing': ['error'], - 'react/jsx-curly-spacing': [2, 'never'], - 'react/jsx-equals-spacing': [2, 'never'], - 'react/jsx-indent-props': [2, 2], - 'react/jsx-indent': [2, 2, { indentLogicalExpressions: true }], - 'react/jsx-key': 2, - 'react/jsx-no-bind': [2, { allowArrowFunctions: true }], - 'react/jsx-no-duplicate-props': [2, { ignoreCase: true }], - 'react/jsx-max-props-per-line': [2, { maximum: 2 }], - 'react/jsx-handler-names': [2, { eventHandlerPrefix: '(on|dispatch)', eventHandlerPropPrefix: 'on' }], - 'react/jsx-no-undef': 2, - 'react/jsx-pascal-case': 2, - 'react/jsx-uses-react': 2, - // Explicitly disabled in case we want to enable them again - 'react/no-did-mount-set-state': 0, - 'react/no-did-update-set-state': 0, - 'react/no-direct-mutation-state': 2, - 'react/no-multi-comp': [2, { ignoreStateless: true }], - 'react/no-unknown-property': 2, - 'react/prefer-es6-class': 2, - 'react/prop-types': 2, - 'react/react-in-jsx-scope': 2, - 'react/self-closing-comp': 2, - 'react/sort-comp': 2, - 'react/jsx-wrap-multilines': 2, - 'react-hooks/rules-of-hooks': 'error', - 'react-hooks/exhaustive-deps': 'error' - }, - overrides: [ - { - files: [ - '*.js' - ], - rules: { - 'simple-import-sort/imports': [ - 'error', - { - groups: [ - // Packages - // Absolute Paths - // Relative Paths - // Css - ['^@?\\w', `^(${dirs})(/.*|$)`, '^\\.', '^\\..*css$'] - ] - } - ] - } - }, - { - files: [ - '*.ts', - '*.tsx' - ], - - parser: '@typescript-eslint/parser', - parserOptions: { - project: './tsconfig.json' - }, - - extends: [ - 'prettier' - ], - - rules: Object.assign(typescriptEslintRecommended.rules, { - 'no-shadow': 'off', - // These should be enabled after cleaning things up - '@typescript-eslint/no-unused-vars': 'warn', - '@typescript-eslint/explicit-function-return-type': 'off', - 'react/prop-types': 'off', - 'prettier/prettier': 'error', - 'simple-import-sort/imports': [ - 'error', - { - groups: [ - // Packages - // Absolute Paths - // Relative Paths - // Css - ['^@?\\w', `^(${dirs})(/.*|$)`, '^\\.', '^\\..*css$'] - ] - } - ] - }) - }, - { - files: [ - '*.css.d.ts' - ], - rules: { - 'filenames/match-exported': 'off', - 'init-declarations': 'off', - 'prettier/prettier': 'off' - } - } - ] -}; diff --git a/frontend/.prettierignore b/frontend/.prettierignore deleted file mode 100644 index 3e6367c54..000000000 --- a/frontend/.prettierignore +++ /dev/null @@ -1,10 +0,0 @@ -# Ignore everything recursively -* - -# But not the .ts files -!*.ts* - -*css.d.ts - -# Check subdirectories too -!*/ diff --git a/frontend/.prettierrc.json b/frontend/.prettierrc.json deleted file mode 100644 index 2f91ee691..000000000 --- a/frontend/.prettierrc.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "arrowParens": "always", - "endOfLine": "auto", - "singleQuote": true, - "trailingComma": "es5" -} diff --git a/frontend/.stylelintrc b/frontend/.stylelintrc deleted file mode 100644 index f19357a4c..000000000 --- a/frontend/.stylelintrc +++ /dev/null @@ -1,326 +0,0 @@ -{ - "plugins": [ - "stylelint-order" - ], - "ignoreFiles": [ - "frontend/src/Styles/scaffolding.css", - "**/*.js" - ], - "rules": { - "at-rule-empty-line-before": [ - "always", - { - "except": [ - "inside-block" - ] - } - ], - "at-rule-no-unknown": [ - true, - { - "ignoreAtRules": [ - "/^add\\-mixin$/", - "/^define\\-mixin$/" - ] - } - ], - "at-rule-no-vendor-prefix": true, - "block-no-empty": true, - "color-hex-length": "short", - "color-named": "never", - "color-no-invalid-hex": true, - "comment-whitespace-inside": "always", - "declaration-block-no-duplicate-properties": [ - true, - { - "ignoreProperties": [ - "composes" - ] - } - ], - "declaration-block-no-redundant-longhand-properties": true, - "declaration-block-no-shorthand-property-overrides": true, - "declaration-block-single-line-max-declarations": 1, - "font-family-name-quotes": "always-unless-keyword", - "function-calc-no-unspaced-operator": true, - "function-linear-gradient-no-nonstandard-direction": true, - "function-name-case": "lower", - "function-url-quotes": "always", - "function-url-scheme-disallowed-list": [ - "data" - ], - "keyframe-declaration-no-important": true, - "length-zero-no-unit": true, - "max-nesting-depth": 2, - "media-feature-name-no-vendor-prefix": true, - "no-empty-source": true, - "no-invalid-double-slash-comments": true, - "order/order": [ - "custom-properties", - "dollar-variables", - { - "hasBlock": false, - "name": "add-mixin", - "type": "at-rule" - }, - "declarations", - "rules", - "at-rules" - ], - "order/properties-order": [ - { - "emptyLineBefore": "always", - "properties": [ - "composes" - ] - }, - { - "emptyLineBefore": "always", - "properties": [ - "position", - "top", - "right", - "bottom", - "left", - "inset", - "z-index", - "display", - "visibility", - "align-content", - "align-items", - "align-self", - "justify-content", - "flex", - "flex-direction", - "flex-order", - "flex-pack", - "flex-align", - "flex-grow", - "flex-shrink", - "flex-basis", - "flex-wrap", - "flex-flow", - "float", - "clear", - "overflow", - "overflow-x", - "overflow-y", - "-webkit-overflow-scrolling", - "clip", - "box-sizing", - "margin", - "margin-top", - "margin-right", - "margin-bottom", - "margin-left", - "padding", - "padding-top", - "padding-right", - "padding-bottom", - "padding-left", - "min-width", - "min-height", - "max-width", - "max-height", - "width", - "height", - "outline", - "outline-width", - "outline-style", - "outline-color", - "outline-offset", - "border", - "border-spacing", - "border-collapse", - "border-width", - "border-style", - "border-color", - "border-top", - "border-top-width", - "border-top-style", - "border-top-color", - "border-right", - "border-right-width", - "border-right-style", - "border-right-color", - "border-bottom", - "border-bottom-width", - "border-bottom-style", - "border-bottom-color", - "border-left", - "border-left-width", - "border-left-style", - "border-left-color", - "border-radius", - "border-top-left-radius", - "border-top-right-radius", - "border-bottom-right-radius", - "border-bottom-left-radius", - "border-image", - "border-image-source", - "border-image-slice", - "border-image-width", - "border-image-outset", - "border-image-repeat", - "border-top-image", - "border-right-image", - "border-bottom-image", - "border-left-image", - "border-corner-image", - "border-top-left-image", - "border-top-right-image", - "border-bottom-right-image", - "border-bottom-left-image", - "background", - "background-color", - "background-image", - "background-attachment", - "background-position", - "background-position-x", - "background-position-y", - "background-clip", - "background-origin", - "background-size", - "background-repeat", - "box-decoration-break", - "box-shadow", - "color", - "table-layout", - "caption-side", - "empty-cells", - "list-style", - "list-style-position", - "list-style-type", - "list-style-image", - "quotes", - "content", - "counter-increment", - "counter-reset", - "-ms-writing-mode", - "vertical-align", - "text-align", - "text-align-last", - "text-decoration", - "text-emphasis", - "text-emphasis-position", - "text-emphasis-style", - "text-emphasis-color", - "text-indent", - "text-justify", - "text-outline", - "text-transform", - "text-wrap", - "text-overflow", - "text-overflow-ellipsis", - "text-overflow-mode", - "text-shadow", - "white-space", - "word-spacing", - "word-wrap", - "word-break", - "tab-size", - "hyphens", - "letter-spacing", - "font", - "font-weight", - "font-style", - "font-variant", - "font-size-adjust", - "font-stretch", - "font-size", - "font-family", - "font-smoothing", - "-moz-osx-font-smoothing", - "-webkit-font-smoothing", - "src", - "line-height", - "opacity", - "filter", - "resize", - "cursor", - "appearance", - "nav-index", - "nav-up", - "nav-right", - "nav-down", - "nav-left", - "transition", - "transition-delay", - "transition-timing-function", - "transition-duration", - "transition-property", - "transform", - "transform-origin", - "transform-style", - "backface-visibility", - "animation", - "animation-name", - "animation-duration", - "animation-play-state", - "animation-timing-function", - "animation-delay", - "animation-iteration-count", - "animation-direction", - "animation-fill-mode", - "pointer-events", - "user-select", - "touch-action", - "-webkit-tap-highlight-color", - "unicode-bidi", - "direction", - "columns", - "column-span", - "column-width", - "column-count", - "column-fill", - "column-gap", - "column-rule", - "column-rule-width", - "column-rule-style", - "column-rule-color", - "break-before", - "break-inside", - "break-after", - "page-break-before", - "page-break-inside", - "page-break-after", - "orphans", - "widows", - "zoom", - "max-zoom", - "min-zoom", - "user-zoom", - "orientation" - ] - } - ], - "property-no-vendor-prefix": true, - "rule-empty-line-before": [ - "always", - { - "except": [ - "first-nested" - ], - "ignore": [ - "after-comment" - ] - } - ], - "selector-attribute-quotes": "never", - "selector-class-pattern": "^[A-Za-z0-9]+$", - "selector-max-attribute": 0, - "selector-max-class": 3, - "selector-max-compound-selectors": 3, - "selector-max-id": 0, - "selector-max-universal": 0, - "selector-pseudo-element-colon-notation": "double", - "selector-pseudo-element-no-unknown": true, - "selector-type-case": "lower", - "selector-type-no-unknown": true, - "shorthand-property-no-redundant-values": true, - "string-no-newline": true, - "time-min-milliseconds": 100, - "unit-no-unknown": true, - "value-no-vendor-prefix": true - } -} \ No newline at end of file diff --git a/frontend/.tern-project b/frontend/.tern-project deleted file mode 100644 index aa9d76407..000000000 --- a/frontend/.tern-project +++ /dev/null @@ -1,7 +0,0 @@ -{ - "ecmaVersion": 6, - "libs": [ - "browser", - "jquery" - ] -} diff --git a/frontend/.vscode/extensions.json b/frontend/.vscode/extensions.json deleted file mode 100644 index 0e005a3cd..000000000 --- a/frontend/.vscode/extensions.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "recommendations": [ - "stylelint.vscode-stylelint", - "dbaeumer.vscode-eslint", - "esbenp.prettier-vscode" - ] -} \ No newline at end of file diff --git a/frontend/.vscode/settings.json b/frontend/.vscode/settings.json deleted file mode 100644 index 8da95337f..000000000 --- a/frontend/.vscode/settings.json +++ /dev/null @@ -1,23 +0,0 @@ -// Place your settings in this file to overwrite default and user settings. -{ - "files.insertFinalNewline": true, - - "files.exclude": { - "**/node_modules": true, - "**/*.d.css": true - }, - - "editor.formatOnSave": false, - "editor.codeActionsOnSave": { - "source.fixAll": "explicit" - }, - - "typescript.preferences.quoteStyle": "single", - - "eslint.validate": [ - "javascript", - "javascriptreact", - "typescript", - "typescriptreact" - ], -} diff --git a/frontend/babel.config.js b/frontend/babel.config.js deleted file mode 100644 index ade9f24a2..000000000 --- a/frontend/babel.config.js +++ /dev/null @@ -1,39 +0,0 @@ -const loose = true; - -module.exports = { - plugins: [ - '@babel/plugin-transform-logical-assignment-operators', - - // Stage 1 - '@babel/plugin-proposal-export-default-from', - ['@babel/plugin-transform-optional-chaining', { loose }], - ['@babel/plugin-transform-nullish-coalescing-operator', { loose }], - - // Stage 2 - '@babel/plugin-transform-export-namespace-from', - - // Stage 3 - ['@babel/plugin-transform-class-properties', { loose }], - '@babel/plugin-syntax-dynamic-import' - ], - env: { - development: { - presets: [ - ['@babel/preset-react', { development: true }], - '@babel/preset-typescript' - ], - plugins: [ - 'babel-plugin-inline-classnames' - ] - }, - production: { - presets: [ - '@babel/preset-react', - '@babel/preset-typescript' - ], - plugins: [ - 'babel-plugin-transform-react-remove-prop-types' - ] - } - } -}; diff --git a/frontend/build/webpack.config.js b/frontend/build/webpack.config.js deleted file mode 100644 index d1873380e..000000000 --- a/frontend/build/webpack.config.js +++ /dev/null @@ -1,291 +0,0 @@ -/* eslint-disable @typescript-eslint/no-var-requires */ -const path = require('path'); -const webpack = require('webpack'); -const FileManagerPlugin = require('filemanager-webpack-plugin'); -const HtmlWebpackPlugin = require('html-webpack-plugin'); -const LiveReloadPlugin = require('webpack-livereload-plugin'); -const MiniCssExtractPlugin = require('mini-css-extract-plugin'); -const TerserPlugin = require('terser-webpack-plugin'); -const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin'); - -module.exports = (env) => { - const uiFolder = 'UI'; - const frontendFolder = path.join(__dirname, '..'); - const srcFolder = path.join(frontendFolder, 'src'); - const isProduction = !!env.production; - const isProfiling = isProduction && !!env.profile; - const inlineWebWorkers = 'no-fallback'; - - const distFolder = path.resolve(frontendFolder, '..', '_output', uiFolder); - - console.log('Source Folder:', srcFolder); - console.log('Output Folder:', distFolder); - console.log('isProduction:', isProduction); - console.log('isProfiling:', isProfiling); - - const config = { - mode: isProduction ? 'production' : 'development', - devtool: isProduction ? 'source-map' : 'eval-source-map', - target: 'web', - - stats: { - children: false - }, - - watchOptions: { - ignored: /node_modules/ - }, - - entry: { - index: 'index.ts' - }, - - resolve: { - extensions: [ - '.ts', - '.tsx', - '.js' - ], - modules: [ - srcFolder, - path.join(srcFolder, 'Shims'), - 'node_modules' - ], - alias: { - jquery: 'jquery/dist/jquery.min', - 'react-middle-truncate': 'react-middle-truncate/lib/react-middle-truncate' - }, - fallback: { - buffer: false, - http: false, - https: false, - url: false, - util: false, - net: false - } - }, - - output: { - path: distFolder, - publicPath: '/', - filename: isProduction ? '[name]-[contenthash].js' : '[name].js', - sourceMapFilename: '[file].map' - }, - - optimization: { - moduleIds: 'deterministic', - chunkIds: isProduction ? 'deterministic' : 'named' - }, - - performance: { - hints: false - }, - - experiments: { - topLevelAwait: true - }, - - plugins: [ - new webpack.DefinePlugin({ - __DEV__: !isProduction, - 'process.env.NODE_ENV': isProduction ? JSON.stringify('production') : JSON.stringify('development') - }), - - new MiniCssExtractPlugin({ - filename: 'Content/styles.css', - chunkFilename: isProduction ? 'Content/[id]-[chunkhash].css' : 'Content/[id].css' - }), - - new HtmlWebpackPlugin({ - template: 'frontend/src/index.ejs', - filename: 'index.html', - publicPath: '/', - inject: false - }), - - new FileManagerPlugin({ - events: { - onEnd: { - copy: [ - // HTML - { - source: 'frontend/src/*.html', - destination: distFolder - }, - - // Fonts - { - source: 'frontend/src/Content/Fonts/*.*', - destination: path.join(distFolder, 'Content/Fonts') - }, - - // Icon Images - { - source: 'frontend/src/Content/Images/Icons/*.*', - destination: path.join(distFolder, 'Content/Images/Icons') - }, - - // Images - { - source: 'frontend/src/Content/Images/*.*', - destination: path.join(distFolder, 'Content/Images') - }, - - // Robots - { - source: 'frontend/src/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') - } - ] - } - } - }), - - new ForkTsCheckerWebpackPlugin(), - - new LiveReloadPlugin() - ], - - resolveLoader: { - modules: [ - 'node_modules', - 'frontend/build/webpack/' - ] - }, - - module: { - rules: [ - { - test: /\.worker\.js$/, - use: { - loader: 'worker-loader', - options: { - filename: '[name].js', - inline: inlineWebWorkers - } - } - }, - { - test: [/\.jsx?$/, /\.tsx?$/], - exclude: /(node_modules|JsLibraries)/, - use: [ - { - loader: 'babel-loader', - options: { - configFile: `${frontendFolder}/babel.config.js`, - envName: isProduction ? 'production' : 'development', - presets: [ - [ - '@babel/preset-env', - { - modules: false, - loose: true, - debug: false, - useBuiltIns: 'entry', - corejs: '3.41' - } - ] - ] - } - } - ] - }, - - // CSS Modules - { - test: /\.css$/, - exclude: /(node_modules|globals.css)/, - use: [ - { loader: MiniCssExtractPlugin.loader }, - { loader: 'css-modules-typescript-loader' }, - { - loader: 'css-loader', - options: { - importLoaders: 1, - modules: { - localIdentName: isProduction ? '[name]/[local]/[hash:base64:5]' : '[name]/[local]' - } - } - }, - { - loader: 'postcss-loader', - options: { - postcssOptions: { - config: 'frontend/postcss.config.js' - } - } - } - ] - }, - - // Global styles - { - test: /\.css$/, - include: /(node_modules|globals.css)/, - use: [ - 'style-loader', - { - loader: 'css-loader' - } - ] - }, - - // Fonts - { - test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, - use: [ - { - loader: 'url-loader', - options: { - limit: 10240, - mimetype: 'application/font-woff', - emitFile: false, - name: 'Content/Fonts/[name].[ext]' - } - } - ] - }, - - { - test: /\.(ttf|eot|eot?#iefix|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, - use: [ - { - loader: 'file-loader', - options: { - emitFile: false, - name: 'Content/Fonts/[name].[ext]' - } - } - ] - } - ] - } - }; - - if (isProfiling) { - config.resolve.alias['react-dom$'] = 'react-dom/profiling'; - config.resolve.alias['scheduler/tracing'] = 'scheduler/tracing-profiling'; - - config.optimization = { - minimize: true, - minimizer: [ - new TerserPlugin({ - terserOptions: { - sourceMap: true, // Must be set to true if using source-maps in production - mangle: false, - keep_classnames: true, - keep_fnames: true - } - }) - ] - }; - } - - return config; -}; diff --git a/frontend/build/webpack/css-variables-loader.js b/frontend/build/webpack/css-variables-loader.js deleted file mode 100644 index 717d7d323..000000000 --- a/frontend/build/webpack/css-variables-loader.js +++ /dev/null @@ -1,12 +0,0 @@ -// eslint-disable-next-line filenames/match-exported -const loaderUtils = require('loader-utils'); - -module.exports = function cssVariablesLoader(source) { - const options = loaderUtils.getOptions(this); - - options.cssVarsFiles.forEach((cssVarsFile) => { - this.addDependency(cssVarsFile); - }); - - return source; -}; diff --git a/frontend/jsconfig.json b/frontend/jsconfig.json deleted file mode 100644 index 329edb2e3..000000000 --- a/frontend/jsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "target": "es6", - "checkJs": false, - "baseUrl": "src", - "jsx": "react", - "module": "commonjs", - "moduleResolution": "node", - "paths": { - "*": [ - "*" - ] - } - }, - "include": [ - "./src/**/*" - ], - "exclude": [ - ] -} diff --git a/frontend/postcss.config.js b/frontend/postcss.config.js deleted file mode 100644 index 89db00f8c..000000000 --- a/frontend/postcss.config.js +++ /dev/null @@ -1,32 +0,0 @@ -const reload = require('require-nocache')(module); - -const cssVarsFiles = [ - './src/Styles/Variables/dimensions', - './src/Styles/Variables/fonts', - './src/Styles/Variables/animations', - './src/Styles/Variables/zIndexes' -].map(require.resolve); - -const mixinsFiles = [ - 'frontend/src/Styles/Mixins/cover.css', - 'frontend/src/Styles/Mixins/linkOverlay.css', - 'frontend/src/Styles/Mixins/scroller.css', - 'frontend/src/Styles/Mixins/truncate.css' -]; - -module.exports = { - plugins: [ - 'autoprefixer', - ['postcss-mixins', { - mixinsFiles - }], - ['postcss-simple-vars', { - variables: () => - cssVarsFiles.reduce((acc, vars) => { - return Object.assign(acc, reload(vars)); - }, {}) - }], - 'postcss-color-function', - 'postcss-nested' - ] -}; diff --git a/frontend/src/Activity/Blocklist/Blocklist.js b/frontend/src/Activity/Blocklist/Blocklist.js deleted file mode 100644 index ab43c106d..000000000 --- a/frontend/src/Activity/Blocklist/Blocklist.js +++ /dev/null @@ -1,268 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import Alert from 'Components/Alert'; -import LoadingIndicator from 'Components/Loading/LoadingIndicator'; -import ConfirmModal from 'Components/Modal/ConfirmModal'; -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 Table from 'Components/Table/Table'; -import TableBody from 'Components/Table/TableBody'; -import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper'; -import TablePager from 'Components/Table/TablePager'; -import { align, icons, kinds } from 'Helpers/Props'; -import getRemovedItems from 'Utilities/Object/getRemovedItems'; -import hasDifferentItems from 'Utilities/Object/hasDifferentItems'; -import translate from 'Utilities/String/translate'; -import getSelectedIds from 'Utilities/Table/getSelectedIds'; -import removeOldSelectedState from 'Utilities/Table/removeOldSelectedState'; -import selectAll from 'Utilities/Table/selectAll'; -import toggleSelected from 'Utilities/Table/toggleSelected'; -import BlocklistRowConnector from './BlocklistRowConnector'; - -class Blocklist extends Component { - - // - // Lifecycle - - constructor(props, context) { - super(props, context); - - this.state = { - allSelected: false, - allUnselected: false, - lastToggled: null, - selectedState: {}, - isConfirmRemoveModalOpen: false, - isConfirmClearModalOpen: false, - items: props.items - }; - } - - componentDidUpdate(prevProps) { - const { - items - } = this.props; - - if (hasDifferentItems(prevProps.items, items)) { - this.setState((state) => { - return { - ...removeOldSelectedState(state, getRemovedItems(prevProps.items, items)), - items - }; - }); - - return; - } - } - - // - // Control - - getSelectedIds = () => { - return getSelectedIds(this.state.selectedState); - }; - - // - // Listeners - - onSelectAllChange = ({ value }) => { - this.setState(selectAll(this.state.selectedState, value)); - }; - - onSelectedChange = ({ id, value, shiftKey = false }) => { - this.setState((state) => { - return toggleSelected(state, this.props.items, id, value, shiftKey); - }); - }; - - onRemoveSelectedPress = () => { - this.setState({ isConfirmRemoveModalOpen: true }); - }; - - onRemoveSelectedConfirmed = () => { - this.props.onRemoveSelected(this.getSelectedIds()); - this.setState({ isConfirmRemoveModalOpen: false }); - }; - - onConfirmRemoveModalClose = () => { - this.setState({ isConfirmRemoveModalOpen: false }); - }; - - onClearBlocklistPress = () => { - this.setState({ isConfirmClearModalOpen: true }); - }; - - onClearBlocklistConfirmed = () => { - this.props.onClearBlocklistPress(); - this.setState({ isConfirmClearModalOpen: false }); - }; - - onConfirmClearModalClose = () => { - this.setState({ isConfirmClearModalOpen: false }); - }; - - // - // Render - - render() { - const { - isFetching, - isPopulated, - isArtistFetching, - isArtistPopulated, - error, - items, - columns, - totalRecords, - isRemoving, - isClearingBlocklistExecuting, - ...otherProps - } = this.props; - - const isAllPopulated = isPopulated && isArtistPopulated; - const isAnyFetching = isFetching || isArtistFetching; - - const { - allSelected, - allUnselected, - selectedState, - isConfirmRemoveModalOpen, - isConfirmClearModalOpen - } = this.state; - - const selectedIds = this.getSelectedIds(); - - return ( - - - - - - - - - - - - - - - - - { - isAnyFetching && !isAllPopulated && - - } - - { - !isAnyFetching && !!error && - - {translate('UnableToLoadBlocklist')} - - } - - { - isAllPopulated && !error && !items.length && - - {translate('NoHistoryBlocklist')} - - } - - { - isAllPopulated && !error && !!items.length && -
- - - { - items.map((item) => { - return ( - - ); - }) - } - -
- - -
- } -
- - - - -
- ); - } -} - -Blocklist.propTypes = { - isArtistFetching: PropTypes.bool.isRequired, - isArtistPopulated: PropTypes.bool.isRequired, - isFetching: PropTypes.bool.isRequired, - isPopulated: PropTypes.bool.isRequired, - error: PropTypes.object, - items: PropTypes.arrayOf(PropTypes.object).isRequired, - columns: PropTypes.arrayOf(PropTypes.object).isRequired, - totalRecords: PropTypes.number, - isRemoving: PropTypes.bool.isRequired, - isClearingBlocklistExecuting: PropTypes.bool.isRequired, - onRemoveSelected: PropTypes.func.isRequired, - onClearBlocklistPress: PropTypes.func.isRequired -}; - -export default Blocklist; diff --git a/frontend/src/Activity/Blocklist/BlocklistConnector.js b/frontend/src/Activity/Blocklist/BlocklistConnector.js deleted file mode 100644 index d810d1c0f..000000000 --- a/frontend/src/Activity/Blocklist/BlocklistConnector.js +++ /dev/null @@ -1,155 +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 withCurrentPage from 'Components/withCurrentPage'; -import * as blocklistActions from 'Store/Actions/blocklistActions'; -import { executeCommand } from 'Store/Actions/commandActions'; -import createCommandExecutingSelector from 'Store/Selectors/createCommandExecutingSelector'; -import { registerPagePopulator, unregisterPagePopulator } from 'Utilities/pagePopulator'; -import Blocklist from './Blocklist'; - -function createMapStateToProps() { - return createSelector( - (state) => state.blocklist, - (state) => state.artist, - createCommandExecutingSelector(commandNames.CLEAR_BLOCKLIST), - (blocklist, artist, isClearingBlocklistExecuting) => { - return { - isArtistFetching: artist.isFetching, - isArtistPopulated: artist.isPopulated, - isClearingBlocklistExecuting, - ...blocklist - }; - } - ); -} - -const mapDispatchToProps = { - ...blocklistActions, - executeCommand -}; - -class BlocklistConnector extends Component { - - // - // Lifecycle - - componentDidMount() { - const { - useCurrentPage, - fetchBlocklist, - gotoBlocklistFirstPage - } = this.props; - - registerPagePopulator(this.repopulate); - - if (useCurrentPage) { - fetchBlocklist(); - } else { - gotoBlocklistFirstPage(); - } - } - - componentDidUpdate(prevProps) { - if (prevProps.isClearingBlocklistExecuting && !this.props.isClearingBlocklistExecuting) { - this.props.gotoBlocklistFirstPage(); - } - } - - componentWillUnmount() { - this.props.clearBlocklist(); - unregisterPagePopulator(this.repopulate); - } - - // - // Control - - repopulate = () => { - this.props.fetchBlocklist(); - }; - // - // Listeners - - onFirstPagePress = () => { - this.props.gotoBlocklistFirstPage(); - }; - - onPreviousPagePress = () => { - this.props.gotoBlocklistPreviousPage(); - }; - - onNextPagePress = () => { - this.props.gotoBlocklistNextPage(); - }; - - onLastPagePress = () => { - this.props.gotoBlocklistLastPage(); - }; - - onPageSelect = (page) => { - this.props.gotoBlocklistPage({ page }); - }; - - onRemoveSelected = (ids) => { - this.props.removeBlocklistItems({ ids }); - }; - - onSortPress = (sortKey) => { - this.props.setBlocklistSort({ sortKey }); - }; - - onTableOptionChange = (payload) => { - this.props.setBlocklistTableOption(payload); - - if (payload.pageSize) { - this.props.gotoBlocklistFirstPage(); - } - }; - - onClearBlocklistPress = () => { - this.props.executeCommand({ name: commandNames.CLEAR_BLOCKLIST }); - }; - - // - // Render - - render() { - return ( - - ); - } -} - -BlocklistConnector.propTypes = { - useCurrentPage: PropTypes.bool.isRequired, - isClearingBlocklistExecuting: PropTypes.bool.isRequired, - items: PropTypes.arrayOf(PropTypes.object).isRequired, - fetchBlocklist: PropTypes.func.isRequired, - gotoBlocklistFirstPage: PropTypes.func.isRequired, - gotoBlocklistPreviousPage: PropTypes.func.isRequired, - gotoBlocklistNextPage: PropTypes.func.isRequired, - gotoBlocklistLastPage: PropTypes.func.isRequired, - gotoBlocklistPage: PropTypes.func.isRequired, - removeBlocklistItems: PropTypes.func.isRequired, - setBlocklistSort: PropTypes.func.isRequired, - setBlocklistTableOption: PropTypes.func.isRequired, - clearBlocklist: PropTypes.func.isRequired, - executeCommand: PropTypes.func.isRequired -}; - -export default withCurrentPage( - connect(createMapStateToProps, mapDispatchToProps)(BlocklistConnector) -); diff --git a/frontend/src/Activity/Blocklist/BlocklistDetailsModal.js b/frontend/src/Activity/Blocklist/BlocklistDetailsModal.js deleted file mode 100644 index 506fa0129..000000000 --- a/frontend/src/Activity/Blocklist/BlocklistDetailsModal.js +++ /dev/null @@ -1,90 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import DescriptionList from 'Components/DescriptionList/DescriptionList'; -import DescriptionListItem from 'Components/DescriptionList/DescriptionListItem'; -import Button from 'Components/Link/Button'; -import Modal from 'Components/Modal/Modal'; -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 translate from 'Utilities/String/translate'; - -class BlocklistDetailsModal extends Component { - - // - // Render - - render() { - const { - isOpen, - sourceTitle, - protocol, - indexer, - message, - onModalClose - } = this.props; - - return ( - - - - Details - - - - - - - - - { - !!message && - - } - - { - !!message && - - } - - - - - - - - - ); - } -} - -BlocklistDetailsModal.propTypes = { - isOpen: PropTypes.bool.isRequired, - sourceTitle: PropTypes.string.isRequired, - protocol: PropTypes.string.isRequired, - indexer: PropTypes.string, - message: PropTypes.string, - onModalClose: PropTypes.func.isRequired -}; - -export default BlocklistDetailsModal; diff --git a/frontend/src/Activity/Blocklist/BlocklistRow.css b/frontend/src/Activity/Blocklist/BlocklistRow.css deleted file mode 100644 index fe431c64a..000000000 --- a/frontend/src/Activity/Blocklist/BlocklistRow.css +++ /dev/null @@ -1,17 +0,0 @@ -.quality { - composes: cell from '~Components/Table/Cells/TableRowCell.css'; - - width: 100px; -} - -.indexer { - composes: cell from '~Components/Table/Cells/TableRowCell.css'; - - width: 80px; -} - -.actions { - composes: cell from '~Components/Table/Cells/TableRowCell.css'; - - width: 70px; -} diff --git a/frontend/src/Activity/Blocklist/BlocklistRow.css.d.ts b/frontend/src/Activity/Blocklist/BlocklistRow.css.d.ts deleted file mode 100644 index a608ab3d2..000000000 --- a/frontend/src/Activity/Blocklist/BlocklistRow.css.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'actions': string; - 'indexer': string; - 'quality': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Activity/Blocklist/BlocklistRow.js b/frontend/src/Activity/Blocklist/BlocklistRow.js deleted file mode 100644 index 9dcfc47cd..000000000 --- a/frontend/src/Activity/Blocklist/BlocklistRow.js +++ /dev/null @@ -1,200 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import AlbumFormats from 'Album/AlbumFormats'; -import TrackQuality from 'Album/TrackQuality'; -import ArtistNameLink from 'Artist/ArtistNameLink'; -import IconButton from 'Components/Link/IconButton'; -import RelativeDateCellConnector from 'Components/Table/Cells/RelativeDateCellConnector'; -import TableRowCell from 'Components/Table/Cells/TableRowCell'; -import TableSelectCell from 'Components/Table/Cells/TableSelectCell'; -import TableRow from 'Components/Table/TableRow'; -import { icons, kinds } from 'Helpers/Props'; -import translate from 'Utilities/String/translate'; -import BlocklistDetailsModal from './BlocklistDetailsModal'; -import styles from './BlocklistRow.css'; - -class BlocklistRow extends Component { - - // - // Lifecycle - - constructor(props, context) { - super(props, context); - - this.state = { - isDetailsModalOpen: false - }; - } - - // - // Listeners - - onDetailsPress = () => { - this.setState({ isDetailsModalOpen: true }); - }; - - onDetailsModalClose = () => { - this.setState({ isDetailsModalOpen: false }); - }; - - // - // Render - - render() { - const { - id, - artist, - sourceTitle, - quality, - customFormats, - date, - protocol, - indexer, - message, - isSelected, - columns, - onSelectedChange, - onRemovePress - } = this.props; - - if (!artist) { - return null; - } - - return ( - - - - { - columns.map((column) => { - const { - name, - isVisible - } = column; - - if (!isVisible) { - return null; - } - - if (name === 'artists.sortName') { - return ( - - - - ); - } - - if (name === 'sourceTitle') { - return ( - - {sourceTitle} - - ); - } - - if (name === 'quality') { - return ( - - - - ); - } - - if (name === 'customFormats') { - return ( - - - - ); - } - - if (name === 'date') { - return ( - - ); - } - - if (name === 'indexer') { - return ( - - {indexer} - - ); - } - - if (name === 'actions') { - return ( - - - - - - ); - } - - return null; - }) - } - - - - ); - } - -} - -BlocklistRow.propTypes = { - id: PropTypes.number.isRequired, - artist: PropTypes.object.isRequired, - sourceTitle: PropTypes.string.isRequired, - quality: PropTypes.object.isRequired, - customFormats: PropTypes.arrayOf(PropTypes.object).isRequired, - date: PropTypes.string.isRequired, - protocol: PropTypes.string.isRequired, - indexer: PropTypes.string, - message: PropTypes.string, - isSelected: PropTypes.bool.isRequired, - columns: PropTypes.arrayOf(PropTypes.object).isRequired, - onSelectedChange: PropTypes.func.isRequired, - onRemovePress: PropTypes.func.isRequired -}; - -export default BlocklistRow; diff --git a/frontend/src/Activity/Blocklist/BlocklistRowConnector.js b/frontend/src/Activity/Blocklist/BlocklistRowConnector.js deleted file mode 100644 index 05b1d8f73..000000000 --- a/frontend/src/Activity/Blocklist/BlocklistRowConnector.js +++ /dev/null @@ -1,26 +0,0 @@ -import { connect } from 'react-redux'; -import { createSelector } from 'reselect'; -import { removeBlocklistItem } from 'Store/Actions/blocklistActions'; -import createArtistSelector from 'Store/Selectors/createArtistSelector'; -import BlocklistRow from './BlocklistRow'; - -function createMapStateToProps() { - return createSelector( - createArtistSelector(), - (artist) => { - return { - artist - }; - } - ); -} - -function createMapDispatchToProps(dispatch, props) { - return { - onRemovePress() { - dispatch(removeBlocklistItem({ id: props.id })); - } - }; -} - -export default connect(createMapStateToProps, createMapDispatchToProps)(BlocklistRow); diff --git a/frontend/src/Activity/History/Details/HistoryDetails.css b/frontend/src/Activity/History/Details/HistoryDetails.css deleted file mode 100644 index 383f08afd..000000000 --- a/frontend/src/Activity/History/Details/HistoryDetails.css +++ /dev/null @@ -1,5 +0,0 @@ -.description { - composes: description from '~Components/DescriptionList/DescriptionListItemDescription.css'; - - overflow-wrap: break-word; -} diff --git a/frontend/src/Activity/History/Details/HistoryDetails.css.d.ts b/frontend/src/Activity/History/Details/HistoryDetails.css.d.ts deleted file mode 100644 index ff7055b0f..000000000 --- a/frontend/src/Activity/History/Details/HistoryDetails.css.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'description': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Activity/History/Details/HistoryDetails.js b/frontend/src/Activity/History/Details/HistoryDetails.js deleted file mode 100644 index 84aa3e0f2..000000000 --- a/frontend/src/Activity/History/Details/HistoryDetails.js +++ /dev/null @@ -1,538 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import DescriptionList from 'Components/DescriptionList/DescriptionList'; -import DescriptionListItem from 'Components/DescriptionList/DescriptionListItem'; -import DescriptionListItemDescription from 'Components/DescriptionList/DescriptionListItemDescription'; -import DescriptionListItemTitle from 'Components/DescriptionList/DescriptionListItemTitle'; -import Icon from 'Components/Icon'; -import Link from 'Components/Link/Link'; -import { icons } from 'Helpers/Props'; -import formatDateTime from 'Utilities/Date/formatDateTime'; -import formatAge from 'Utilities/Number/formatAge'; -import formatCustomFormatScore from 'Utilities/Number/formatCustomFormatScore'; -import translate from 'Utilities/String/translate'; -import styles from './HistoryDetails.css'; - -function getDetailedList(statusMessages) { - return ( -
- { - statusMessages.map(({ title, messages }) => { - return ( -
- {title} -
    - { - messages.map((message) => { - return ( -
  • - {message} -
  • - ); - }) - } -
-
- ); - }) - } -
- ); -} - -function formatMissing(value) { - if (value === undefined || value === 0 || value === '0') { - return (); - } - return value; -} - -function formatChange(oldValue, newValue) { - return ( -
- {formatMissing(oldValue)} {formatMissing(newValue)} -
- ); -} - -function HistoryDetails(props) { - const { - eventType, - sourceTitle, - data, - downloadId, - shortDateFormat, - timeFormat - } = props; - - if (eventType === 'grabbed') { - const { - indexer, - releaseGroup, - customFormatScore, - nzbInfoUrl, - downloadClient, - downloadClientName, - age, - ageHours, - ageMinutes, - publishedDate - } = data; - - const downloadClientNameInfo = downloadClientName ?? downloadClient; - - return ( - - - - { - indexer ? - : - null - } - - { - releaseGroup ? - : - null - } - - { - customFormatScore && customFormatScore !== '0' ? - : - null - } - - { - nzbInfoUrl ? - - - {translate('InfoUrl')} - - - - {nzbInfoUrl} - - : - null - } - - { - downloadClientNameInfo ? - : - null - } - - { - downloadId ? - : - null - } - - { - age || ageHours || ageMinutes ? - : - null - } - - { - publishedDate ? - : - null - } - - ); - } - - if (eventType === 'downloadFailed') { - const { - message, - indexer - } = data; - - return ( - - - - { - downloadId ? - : - null - } - - { - indexer ? ( - - ) : null} - - { - message ? - : - null - } - - ); - } - - if (eventType === 'trackFileImported') { - const { - customFormatScore, - droppedPath, - importedPath - } = data; - - return ( - - - - { - droppedPath ? - : - null - } - - { - importedPath ? - : - null - } - - { - customFormatScore && customFormatScore !== '0' ? - : - null - } - - ); - } - - if (eventType === 'trackFileDeleted') { - const { - reason, - customFormatScore - } = data; - - let reasonMessage = ''; - - switch (reason) { - case 'Manual': - reasonMessage = 'File was deleted by via UI'; - break; - case 'MissingFromDisk': - reasonMessage = 'Lidarr was unable to find the file on disk so the file was unlinked from the album/track in the database'; - break; - case 'Upgrade': - reasonMessage = 'File was deleted to import an upgrade'; - break; - default: - reasonMessage = ''; - } - - return ( - - - - - - { - customFormatScore && customFormatScore !== '0' ? - : - null - } - - ); - } - - if (eventType === 'trackFileRenamed') { - const { - sourcePath, - path - } = data; - - return ( - - - - - - ); - } - - if (eventType === 'trackFileRetagged') { - const { - diff, - tagsScrubbed - } = data; - - return ( - - - { - JSON.parse(diff).map(({ field, oldValue, newValue }) => { - return ( - - ); - }) - } - : } - /> - - ); - } - - if (eventType === 'albumImportIncomplete') { - const { - statusMessages - } = data; - - return ( - - - - { - !!statusMessages && - - } - - ); - } - - if (eventType === 'downloadImported') { - const { - indexer, - releaseGroup, - customFormatScore, - nzbInfoUrl, - downloadClient, - age, - ageHours, - ageMinutes, - publishedDate - } = data; - - return ( - - - - { - indexer ? - : - null - } - - { - releaseGroup ? - : - null - } - - { - customFormatScore && customFormatScore !== '0' ? - : - null - } - - { - nzbInfoUrl ? - - - {translate('InfoUrl')} - - - - {nzbInfoUrl} - - : - null - } - - { - downloadClient ? - : - null - } - - { - downloadId ? - : - null - } - - { - age || ageHours || ageMinutes ? - : - null - } - - { - publishedDate ? - : - null - } - - ); - } - - if (eventType === 'downloadIgnored') { - const { - message - } = data; - - return ( - - - - { - downloadId ? - : - null - } - - { - message ? - : - null - } - - ); - } - - return ( - - - - ); -} - -HistoryDetails.propTypes = { - eventType: PropTypes.string.isRequired, - sourceTitle: PropTypes.string.isRequired, - data: PropTypes.object.isRequired, - downloadId: PropTypes.string, - shortDateFormat: PropTypes.string.isRequired, - timeFormat: PropTypes.string.isRequired -}; - -export default HistoryDetails; diff --git a/frontend/src/Activity/History/Details/HistoryDetailsConnector.js b/frontend/src/Activity/History/Details/HistoryDetailsConnector.js deleted file mode 100644 index 0848c7905..000000000 --- a/frontend/src/Activity/History/Details/HistoryDetailsConnector.js +++ /dev/null @@ -1,19 +0,0 @@ -import _ from 'lodash'; -import { connect } from 'react-redux'; -import { createSelector } from 'reselect'; -import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector'; -import HistoryDetails from './HistoryDetails'; - -function createMapStateToProps() { - return createSelector( - createUISettingsSelector(), - (uiSettings) => { - return _.pick(uiSettings, [ - 'shortDateFormat', - 'timeFormat' - ]); - } - ); -} - -export default connect(createMapStateToProps)(HistoryDetails); diff --git a/frontend/src/Activity/History/Details/HistoryDetailsModal.css b/frontend/src/Activity/History/Details/HistoryDetailsModal.css deleted file mode 100644 index 271d422ff..000000000 --- a/frontend/src/Activity/History/Details/HistoryDetailsModal.css +++ /dev/null @@ -1,5 +0,0 @@ -.markAsFailedButton { - composes: button from '~Components/Link/Button.css'; - - margin-right: auto; -} diff --git a/frontend/src/Activity/History/Details/HistoryDetailsModal.css.d.ts b/frontend/src/Activity/History/Details/HistoryDetailsModal.css.d.ts deleted file mode 100644 index a8cc499e2..000000000 --- a/frontend/src/Activity/History/Details/HistoryDetailsModal.css.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'markAsFailedButton': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Activity/History/Details/HistoryDetailsModal.js b/frontend/src/Activity/History/Details/HistoryDetailsModal.js deleted file mode 100644 index 5362a2f43..000000000 --- a/frontend/src/Activity/History/Details/HistoryDetailsModal.js +++ /dev/null @@ -1,115 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import Button from 'Components/Link/Button'; -import SpinnerButton from 'Components/Link/SpinnerButton'; -import Modal from 'Components/Modal/Modal'; -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 { kinds } from 'Helpers/Props'; -import HistoryDetails from './HistoryDetails'; -import styles from './HistoryDetailsModal.css'; - -function getHeaderTitle(eventType) { - switch (eventType) { - case 'grabbed': - return 'Grabbed'; - case 'downloadFailed': - return 'Download Failed'; - case 'trackFileImported': - return 'Track Imported'; - case 'trackFileDeleted': - return 'Track File Deleted'; - case 'trackFileRenamed': - return 'Track File Renamed'; - case 'trackFileRetagged': - return 'Track File Tags Updated'; - case 'albumImportIncomplete': - return 'Album Import Incomplete'; - case 'downloadImported': - return 'Download Completed'; - case 'downloadIgnored': - return 'Download Ignored'; - default: - return 'Unknown'; - } -} - -function HistoryDetailsModal(props) { - const { - isOpen, - eventType, - sourceTitle, - data, - downloadId, - isMarkingAsFailed, - shortDateFormat, - timeFormat, - onMarkAsFailedPress, - onModalClose - } = props; - - return ( - - - - {getHeaderTitle(eventType)} - - - - - - - - { - eventType === 'grabbed' && - - Mark as Failed - - } - - - - - - ); -} - -HistoryDetailsModal.propTypes = { - isOpen: PropTypes.bool.isRequired, - eventType: PropTypes.string.isRequired, - sourceTitle: PropTypes.string.isRequired, - data: PropTypes.object.isRequired, - downloadId: PropTypes.string, - isMarkingAsFailed: PropTypes.bool.isRequired, - shortDateFormat: PropTypes.string.isRequired, - timeFormat: PropTypes.string.isRequired, - onMarkAsFailedPress: PropTypes.func.isRequired, - onModalClose: PropTypes.func.isRequired -}; - -HistoryDetailsModal.defaultProps = { - isMarkingAsFailed: false -}; - -export default HistoryDetailsModal; diff --git a/frontend/src/Activity/History/History.js b/frontend/src/Activity/History/History.js deleted file mode 100644 index d144a5402..000000000 --- a/frontend/src/Activity/History/History.js +++ /dev/null @@ -1,184 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import Alert from 'Components/Alert'; -import LoadingIndicator from 'Components/Loading/LoadingIndicator'; -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 Table from 'Components/Table/Table'; -import TableBody from 'Components/Table/TableBody'; -import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper'; -import TablePager from 'Components/Table/TablePager'; -import { align, icons, kinds } from 'Helpers/Props'; -import hasDifferentItems from 'Utilities/Object/hasDifferentItems'; -import translate from 'Utilities/String/translate'; -import HistoryFilterModal from './HistoryFilterModal'; -import HistoryRowConnector from './HistoryRowConnector'; - -class History extends Component { - - // - // Lifecycle - - shouldComponentUpdate(nextProps) { - // Don't update when fetching has completed if items have changed, - // before albums start fetching or when albums start fetching. - - if ( - ( - this.props.isFetching && - nextProps.isPopulated && - hasDifferentItems(this.props.items, nextProps.items) - ) || - (!this.props.isAlbumsFetching && nextProps.isAlbumsFetching) - ) { - return false; - } - - return true; - } - - // - // Render - - render() { - const { - isFetching, - isPopulated, - error, - items, - columns, - selectedFilterKey, - filters, - customFilters, - totalRecords, - isArtistFetching, - isArtistPopulated, - isAlbumsFetching, - isAlbumsPopulated, - albumsError, - onFilterSelect, - onFirstPagePress, - ...otherProps - } = this.props; - - const isFetchingAny = isFetching || isArtistFetching || isAlbumsFetching; - const isAllPopulated = isPopulated && ((isArtistPopulated && isAlbumsPopulated) || !items.length); - const hasError = error || albumsError; - - return ( - - - - - - - - - - - - - - - - - { - isFetchingAny && !isAllPopulated && - - } - - { - !isFetchingAny && hasError && - - {translate('UnableToLoadHistory')} - - } - - { - // If history isPopulated and it's empty show no history found and don't - // wait for the albums to populate because they are never coming. - - isPopulated && !hasError && !items.length && - - {translate('NoHistory')} - - } - - { - isAllPopulated && !hasError && !!items.length && -
- - - { - items.map((item) => { - return ( - - ); - }) - } - -
- - -
- } -
-
- ); - } -} - -History.propTypes = { - isFetching: PropTypes.bool.isRequired, - isPopulated: PropTypes.bool.isRequired, - error: PropTypes.object, - items: PropTypes.arrayOf(PropTypes.object).isRequired, - columns: PropTypes.arrayOf(PropTypes.object).isRequired, - selectedFilterKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired, - filters: PropTypes.arrayOf(PropTypes.object).isRequired, - customFilters: PropTypes.arrayOf(PropTypes.object).isRequired, - totalRecords: PropTypes.number, - isArtistFetching: PropTypes.bool.isRequired, - isArtistPopulated: PropTypes.bool.isRequired, - isAlbumsFetching: PropTypes.bool.isRequired, - isAlbumsPopulated: PropTypes.bool.isRequired, - albumsError: PropTypes.object, - onFilterSelect: PropTypes.func.isRequired, - onFirstPagePress: PropTypes.func.isRequired -}; - -export default History; diff --git a/frontend/src/Activity/History/HistoryConnector.js b/frontend/src/Activity/History/HistoryConnector.js deleted file mode 100644 index 2b3354bc5..000000000 --- a/frontend/src/Activity/History/HistoryConnector.js +++ /dev/null @@ -1,179 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import { connect } from 'react-redux'; -import { createSelector } from 'reselect'; -import withCurrentPage from 'Components/withCurrentPage'; -import { clearAlbums, fetchAlbums } from 'Store/Actions/albumActions'; -import * as historyActions from 'Store/Actions/historyActions'; -import { clearTracks, fetchTracks } from 'Store/Actions/trackActions'; -import { createCustomFiltersSelector } from 'Store/Selectors/createClientSideCollectionSelector'; -import hasDifferentItems from 'Utilities/Object/hasDifferentItems'; -import selectUniqueIds from 'Utilities/Object/selectUniqueIds'; -import { registerPagePopulator, unregisterPagePopulator } from 'Utilities/pagePopulator'; -import History from './History'; - -function createMapStateToProps() { - return createSelector( - (state) => state.history, - (state) => state.artist, - (state) => state.albums, - (state) => state.tracks, - createCustomFiltersSelector('history'), - (history, artist, albums, tracks, customFilters) => { - return { - isArtistFetching: artist.isFetching, - isArtistPopulated: artist.isPopulated, - isAlbumsFetching: albums.isFetching, - isAlbumsPopulated: albums.isPopulated, - albumsError: albums.error, - isTracksFetching: tracks.isFetching, - isTracksPopulated: tracks.isPopulated, - tracksError: tracks.error, - customFilters, - ...history - }; - } - ); -} - -const mapDispatchToProps = { - ...historyActions, - fetchAlbums, - clearAlbums, - fetchTracks, - clearTracks -}; - -class HistoryConnector extends Component { - - // - // Lifecycle - - componentDidMount() { - const { - useCurrentPage, - fetchHistory, - gotoHistoryFirstPage - } = this.props; - - registerPagePopulator(this.repopulate); - - if (useCurrentPage) { - fetchHistory(); - } else { - gotoHistoryFirstPage(); - } - } - - componentDidUpdate(prevProps) { - if (hasDifferentItems(prevProps.items, this.props.items)) { - const albumIds = selectUniqueIds(this.props.items, 'albumId'); - const trackIds = selectUniqueIds(this.props.items, 'trackId'); - if (albumIds.length) { - this.props.fetchAlbums({ albumIds }); - } else { - this.props.clearAlbums(); - } - if (trackIds.length) { - this.props.fetchTracks({ trackIds }); - } else { - this.props.clearTracks(); - } - } - } - - componentWillUnmount() { - unregisterPagePopulator(this.repopulate); - this.props.clearHistory(); - this.props.clearAlbums(); - this.props.clearTracks(); - } - - // - // Control - - repopulate = () => { - this.props.fetchHistory(); - }; - - // - // Listeners - - onFirstPagePress = () => { - this.props.gotoHistoryFirstPage(); - }; - - onPreviousPagePress = () => { - this.props.gotoHistoryPreviousPage(); - }; - - onNextPagePress = () => { - this.props.gotoHistoryNextPage(); - }; - - onLastPagePress = () => { - this.props.gotoHistoryLastPage(); - }; - - onPageSelect = (page) => { - this.props.gotoHistoryPage({ page }); - }; - - onSortPress = (sortKey) => { - this.props.setHistorySort({ sortKey }); - }; - - onFilterSelect = (selectedFilterKey) => { - this.props.setHistoryFilter({ selectedFilterKey }); - }; - - onTableOptionChange = (payload) => { - this.props.setHistoryTableOption(payload); - - if (payload.pageSize) { - this.props.gotoHistoryFirstPage(); - } - }; - - // - // Render - - render() { - return ( - - ); - } -} - -HistoryConnector.propTypes = { - useCurrentPage: PropTypes.bool.isRequired, - items: PropTypes.arrayOf(PropTypes.object).isRequired, - fetchHistory: PropTypes.func.isRequired, - gotoHistoryFirstPage: PropTypes.func.isRequired, - gotoHistoryPreviousPage: PropTypes.func.isRequired, - gotoHistoryNextPage: PropTypes.func.isRequired, - gotoHistoryLastPage: PropTypes.func.isRequired, - gotoHistoryPage: PropTypes.func.isRequired, - setHistorySort: PropTypes.func.isRequired, - setHistoryFilter: PropTypes.func.isRequired, - setHistoryTableOption: PropTypes.func.isRequired, - clearHistory: PropTypes.func.isRequired, - fetchAlbums: PropTypes.func.isRequired, - clearAlbums: PropTypes.func.isRequired, - fetchTracks: PropTypes.func.isRequired, - clearTracks: PropTypes.func.isRequired -}; - -export default withCurrentPage( - connect(createMapStateToProps, mapDispatchToProps)(HistoryConnector) -); diff --git a/frontend/src/Activity/History/HistoryEventTypeCell.css b/frontend/src/Activity/History/HistoryEventTypeCell.css deleted file mode 100644 index 63d79e18c..000000000 --- a/frontend/src/Activity/History/HistoryEventTypeCell.css +++ /dev/null @@ -1,6 +0,0 @@ -.cell { - composes: cell from '~Components/Table/Cells/TableRowCell.css'; - - width: 35px; - text-align: center; -} diff --git a/frontend/src/Activity/History/HistoryEventTypeCell.css.d.ts b/frontend/src/Activity/History/HistoryEventTypeCell.css.d.ts deleted file mode 100644 index c748f6f97..000000000 --- a/frontend/src/Activity/History/HistoryEventTypeCell.css.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'cell': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Activity/History/HistoryEventTypeCell.js b/frontend/src/Activity/History/HistoryEventTypeCell.js deleted file mode 100644 index 937cedd98..000000000 --- a/frontend/src/Activity/History/HistoryEventTypeCell.js +++ /dev/null @@ -1,101 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import Icon from 'Components/Icon'; -import TableRowCell from 'Components/Table/Cells/TableRowCell'; -import { icons, kinds } from 'Helpers/Props'; -import translate from 'Utilities/String/translate'; -import styles from './HistoryEventTypeCell.css'; - -function getIconName(eventType, data) { - switch (eventType) { - case 'grabbed': - return icons.DOWNLOADING; - case 'artistFolderImported': - return icons.DRIVE; - case 'trackFileImported': - return icons.DOWNLOADED; - case 'downloadFailed': - return icons.DOWNLOADING; - case 'trackFileDeleted': - return data.reason === 'MissingFromDisk' ? icons.FILE_MISSING : icons.DELETE; - case 'trackFileRenamed': - return icons.ORGANIZE; - case 'trackFileRetagged': - return icons.RETAG; - case 'albumImportIncomplete': - return icons.DOWNLOADED; - case 'downloadImported': - return icons.DOWNLOADED; - case 'downloadIgnored': - return icons.IGNORE; - default: - return icons.UNKNOWN; - } -} - -function getIconKind(eventType) { - switch (eventType) { - case 'downloadFailed': - return kinds.DANGER; - case 'albumImportIncomplete': - return kinds.WARNING; - default: - return kinds.DEFAULT; - } -} - -function getTooltip(eventType, data) { - switch (eventType) { - case 'grabbed': - return `Album grabbed from ${data.indexer} and sent to ${data.downloadClient}`; - case 'artistFolderImported': - return 'Track imported from artist folder'; - case 'trackFileImported': - return 'Track downloaded successfully and picked up from download client'; - case 'downloadFailed': - return 'Album download failed'; - case 'trackFileDeleted': - return data.reason === 'MissingFromDisk' ? translate('TrackFileMissingTooltip') : translate('TrackFileDeletedTooltip'); - case 'trackFileRenamed': - return translate('TrackFileRenamedTooltip'); - case 'trackFileRetagged': - return translate('TrackFileTagsUpdatedTooltip'); - case 'albumImportIncomplete': - return 'Files downloaded but not all could be imported'; - case 'downloadImported': - return 'Download completed and successfully imported'; - case 'downloadIgnored': - return 'Album Download Ignored'; - default: - return 'Unknown event'; - } -} - -function HistoryEventTypeCell({ eventType, data }) { - const iconName = getIconName(eventType, data); - const iconKind = getIconKind(eventType); - const tooltip = getTooltip(eventType, data); - - return ( - - - - ); -} - -HistoryEventTypeCell.propTypes = { - eventType: PropTypes.string.isRequired, - data: PropTypes.object -}; - -HistoryEventTypeCell.defaultProps = { - data: {} -}; - -export default HistoryEventTypeCell; diff --git a/frontend/src/Activity/History/HistoryFilterModal.tsx b/frontend/src/Activity/History/HistoryFilterModal.tsx deleted file mode 100644 index f4ad2e57c..000000000 --- a/frontend/src/Activity/History/HistoryFilterModal.tsx +++ /dev/null @@ -1,54 +0,0 @@ -import React, { useCallback } from 'react'; -import { useDispatch, useSelector } from 'react-redux'; -import { createSelector } from 'reselect'; -import AppState from 'App/State/AppState'; -import FilterModal from 'Components/Filter/FilterModal'; -import { setHistoryFilter } from 'Store/Actions/historyActions'; - -function createHistorySelector() { - return createSelector( - (state: AppState) => state.history.items, - (queueItems) => { - return queueItems; - } - ); -} - -function createFilterBuilderPropsSelector() { - return createSelector( - (state: AppState) => state.history.filterBuilderProps, - (filterBuilderProps) => { - return filterBuilderProps; - } - ); -} - -interface HistoryFilterModalProps { - isOpen: boolean; -} - -export default function HistoryFilterModal(props: HistoryFilterModalProps) { - const sectionItems = useSelector(createHistorySelector()); - const filterBuilderProps = useSelector(createFilterBuilderPropsSelector()); - const customFilterType = 'history'; - - const dispatch = useDispatch(); - - const dispatchSetFilter = useCallback( - (payload: unknown) => { - dispatch(setHistoryFilter(payload)); - }, - [dispatch] - ); - - return ( - - ); -} diff --git a/frontend/src/Activity/History/HistoryRow.css b/frontend/src/Activity/History/HistoryRow.css deleted file mode 100644 index 039804b63..000000000 --- a/frontend/src/Activity/History/HistoryRow.css +++ /dev/null @@ -1,29 +0,0 @@ -.downloadClient { - composes: cell from '~Components/Table/Cells/TableRowCell.css'; - - width: 120px; -} - -.indexer { - composes: cell from '~Components/Table/Cells/TableRowCell.css'; - - width: 80px; -} - -.customFormatScore { - composes: cell from '~Components/Table/Cells/TableRowCell.css'; - - width: 55px; -} - -.releaseGroup { - composes: cell from '~Components/Table/Cells/TableRowCell.css'; - - width: 110px; -} - -.details { - composes: cell from '~Components/Table/Cells/TableRowCell.css'; - - width: 30px; -} diff --git a/frontend/src/Activity/History/HistoryRow.css.d.ts b/frontend/src/Activity/History/HistoryRow.css.d.ts deleted file mode 100644 index e1f54bc96..000000000 --- a/frontend/src/Activity/History/HistoryRow.css.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'customFormatScore': string; - 'details': string; - 'downloadClient': string; - 'indexer': string; - 'releaseGroup': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Activity/History/HistoryRow.js b/frontend/src/Activity/History/HistoryRow.js deleted file mode 100644 index 9f2da78d0..000000000 --- a/frontend/src/Activity/History/HistoryRow.js +++ /dev/null @@ -1,290 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import AlbumFormats from 'Album/AlbumFormats'; -import AlbumTitleLink from 'Album/AlbumTitleLink'; -import TrackQuality from 'Album/TrackQuality'; -import ArtistNameLink from 'Artist/ArtistNameLink'; -import IconButton from 'Components/Link/IconButton'; -import RelativeDateCellConnector from 'Components/Table/Cells/RelativeDateCellConnector'; -import TableRowCell from 'Components/Table/Cells/TableRowCell'; -import TableRow from 'Components/Table/TableRow'; -import Tooltip from 'Components/Tooltip/Tooltip'; -import { icons, tooltipPositions } from 'Helpers/Props'; -import formatCustomFormatScore from 'Utilities/Number/formatCustomFormatScore'; -import HistoryDetailsModal from './Details/HistoryDetailsModal'; -import HistoryEventTypeCell from './HistoryEventTypeCell'; -import styles from './HistoryRow.css'; - -class HistoryRow extends Component { - - // - // Lifecycle - - constructor(props, context) { - super(props, context); - - this.state = { - isDetailsModalOpen: false - }; - } - - componentDidUpdate(prevProps) { - if ( - prevProps.isMarkingAsFailed && - !this.props.isMarkingAsFailed && - !this.props.markAsFailedError - ) { - this.setState({ isDetailsModalOpen: false }); - } - } - - // - // Listeners - - onDetailsPress = () => { - this.setState({ isDetailsModalOpen: true }); - }; - - onDetailsModalClose = () => { - this.setState({ isDetailsModalOpen: false }); - }; - - // - // Render - - render() { - const { - artist, - album, - track, - quality, - customFormats, - customFormatScore, - qualityCutoffNotMet, - eventType, - sourceTitle, - date, - data, - downloadId, - isMarkingAsFailed, - columns, - shortDateFormat, - timeFormat, - onMarkAsFailedPress - } = this.props; - - if (!artist || !album) { - return null; - } - - return ( - - { - columns.map((column) => { - const { - name, - isVisible - } = column; - - if (!isVisible) { - return null; - } - - if (name === 'eventType') { - return ( - - ); - } - - if (name === 'artists.sortName') { - return ( - - - - ); - } - - if (name === 'albums.title') { - return ( - - - - ); - } - - if (name === 'trackTitle') { - return ( - - {track.title} - - ); - } - - if (name === 'quality') { - return ( - - - - ); - } - - if (name === 'customFormats') { - return ( - - - - ); - } - - if (name === 'date') { - return ( - - ); - } - - if (name === 'downloadClient') { - return ( - - {data.downloadClient} - - ); - } - - if (name === 'indexer') { - return ( - - {data.indexer} - - ); - } - - if (name === 'customFormatScore') { - return ( - - } - position={tooltipPositions.BOTTOM} - /> - - ); - } - - if (name === 'releaseGroup') { - return ( - - {data.releaseGroup} - - ); - } - - if (name === 'sourceTitle') { - return ( - - {sourceTitle} - - ); - } - - if (name === 'details') { - return ( - - - - ); - } - - return null; - }) - } - - - - ); - } - -} - -HistoryRow.propTypes = { - albumId: PropTypes.number, - artist: PropTypes.object.isRequired, - album: PropTypes.object, - track: PropTypes.object, - quality: PropTypes.object.isRequired, - customFormats: PropTypes.arrayOf(PropTypes.object), - customFormatScore: PropTypes.number.isRequired, - qualityCutoffNotMet: PropTypes.bool.isRequired, - eventType: PropTypes.string.isRequired, - sourceTitle: PropTypes.string.isRequired, - date: PropTypes.string.isRequired, - data: PropTypes.object.isRequired, - downloadId: PropTypes.string, - isMarkingAsFailed: PropTypes.bool, - markAsFailedError: PropTypes.object, - columns: PropTypes.arrayOf(PropTypes.object).isRequired, - shortDateFormat: PropTypes.string.isRequired, - timeFormat: PropTypes.string.isRequired, - onMarkAsFailedPress: PropTypes.func.isRequired -}; - -HistoryRow.defaultProps = { - track: { - title: '' - }, - customFormats: [] -}; - -export default HistoryRow; diff --git a/frontend/src/Activity/History/HistoryRowConnector.js b/frontend/src/Activity/History/HistoryRowConnector.js deleted file mode 100644 index 53492d894..000000000 --- a/frontend/src/Activity/History/HistoryRowConnector.js +++ /dev/null @@ -1,78 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import { connect } from 'react-redux'; -import { createSelector } from 'reselect'; -import { fetchHistory, markAsFailed } from 'Store/Actions/historyActions'; -import createAlbumSelector from 'Store/Selectors/createAlbumSelector'; -import createArtistSelector from 'Store/Selectors/createArtistSelector'; -import createTrackSelector from 'Store/Selectors/createTrackSelector'; -import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector'; -import HistoryRow from './HistoryRow'; - -function createMapStateToProps() { - return createSelector( - createArtistSelector(), - createAlbumSelector(), - createTrackSelector(), - createUISettingsSelector(), - (artist, album, track, uiSettings) => { - return { - artist, - album, - track, - shortDateFormat: uiSettings.shortDateFormat, - timeFormat: uiSettings.timeFormat - }; - } - ); -} - -const mapDispatchToProps = { - fetchHistory, - markAsFailed -}; - -class HistoryRowConnector extends Component { - - // - // Lifecycle - - componentDidUpdate(prevProps) { - if ( - prevProps.isMarkingAsFailed && - !this.props.isMarkingAsFailed && - !this.props.markAsFailedError - ) { - this.props.fetchHistory(); - } - } - - // - // Listeners - - onMarkAsFailedPress = () => { - this.props.markAsFailed({ id: this.props.id }); - }; - - // - // Render - - render() { - return ( - - ); - } -} - -HistoryRowConnector.propTypes = { - id: PropTypes.number.isRequired, - isMarkingAsFailed: PropTypes.bool, - markAsFailedError: PropTypes.object, - fetchHistory: PropTypes.func.isRequired, - markAsFailed: PropTypes.func.isRequired -}; - -export default connect(createMapStateToProps, mapDispatchToProps)(HistoryRowConnector); diff --git a/frontend/src/Activity/Queue/ProtocolLabel.css b/frontend/src/Activity/Queue/ProtocolLabel.css deleted file mode 100644 index 110c7e01c..000000000 --- a/frontend/src/Activity/Queue/ProtocolLabel.css +++ /dev/null @@ -1,13 +0,0 @@ -.torrent { - composes: label from '~Components/Label.css'; - - border-color: var(--torrentColor); - background-color: var(--torrentColor); -} - -.usenet { - composes: label from '~Components/Label.css'; - - border-color: var(--usenetColor); - background-color: var(--usenetColor); -} diff --git a/frontend/src/Activity/Queue/ProtocolLabel.css.d.ts b/frontend/src/Activity/Queue/ProtocolLabel.css.d.ts deleted file mode 100644 index f3b389e3d..000000000 --- a/frontend/src/Activity/Queue/ProtocolLabel.css.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'torrent': string; - 'usenet': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Activity/Queue/ProtocolLabel.js b/frontend/src/Activity/Queue/ProtocolLabel.js deleted file mode 100644 index e8a08943c..000000000 --- a/frontend/src/Activity/Queue/ProtocolLabel.js +++ /dev/null @@ -1,20 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import Label from 'Components/Label'; -import styles from './ProtocolLabel.css'; - -function ProtocolLabel({ protocol }) { - const protocolName = protocol === 'usenet' ? 'nzb' : protocol; - - return ( - - ); -} - -ProtocolLabel.propTypes = { - protocol: PropTypes.string.isRequired -}; - -export default ProtocolLabel; diff --git a/frontend/src/Activity/Queue/Queue.js b/frontend/src/Activity/Queue/Queue.js deleted file mode 100644 index 0efc29f21..000000000 --- a/frontend/src/Activity/Queue/Queue.js +++ /dev/null @@ -1,377 +0,0 @@ -import _ from 'lodash'; -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import Alert from 'Components/Alert'; -import LoadingIndicator from 'Components/Loading/LoadingIndicator'; -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 Table from 'Components/Table/Table'; -import TableBody from 'Components/Table/TableBody'; -import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper'; -import TablePager from 'Components/Table/TablePager'; -import { align, icons, kinds } from 'Helpers/Props'; -import getRemovedItems from 'Utilities/Object/getRemovedItems'; -import hasDifferentItems from 'Utilities/Object/hasDifferentItems'; -import translate from 'Utilities/String/translate'; -import getSelectedIds from 'Utilities/Table/getSelectedIds'; -import removeOldSelectedState from 'Utilities/Table/removeOldSelectedState'; -import selectAll from 'Utilities/Table/selectAll'; -import toggleSelected from 'Utilities/Table/toggleSelected'; -import QueueFilterModal from './QueueFilterModal'; -import QueueOptionsConnector from './QueueOptionsConnector'; -import QueueRowConnector from './QueueRowConnector'; -import RemoveQueueItemModal from './RemoveQueueItemModal'; - -class Queue extends Component { - - // - // Lifecycle - - constructor(props, context) { - super(props, context); - - this._shouldBlockRefresh = false; - - this.state = { - allSelected: false, - allUnselected: false, - lastToggled: null, - selectedState: {}, - isPendingSelected: false, - isConfirmRemoveModalOpen: false, - items: props.items - }; - } - - shouldComponentUpdate() { - if (this._shouldBlockRefresh) { - return false; - } - - return true; - } - - componentDidUpdate(prevProps) { - const { - items, - isFetching, - isAlbumsFetching - } = this.props; - - if ( - (!isAlbumsFetching && prevProps.isAlbumsFetching) || - (!isFetching && prevProps.isFetching) || - (hasDifferentItems(prevProps.items, items) && !items.some((e) => e.albumId)) - ) { - this.setState((state) => { - return { - ...removeOldSelectedState(state, getRemovedItems(prevProps.items, items)), - items - }; - }); - - return; - } - - const nextState = {}; - - if (prevProps.items !== items) { - nextState.items = items; - } - - const selectedIds = this.getSelectedIds(); - const isPendingSelected = _.some(this.props.items, (item) => { - return selectedIds.indexOf(item.id) > -1 && item.status === 'delay'; - }); - - if (isPendingSelected !== this.state.isPendingSelected) { - nextState.isPendingSelected = isPendingSelected; - } - - if (!_.isEmpty(nextState)) { - this.setState(nextState); - } - } - - // - // Control - - getSelectedIds = () => { - return getSelectedIds(this.state.selectedState); - }; - - // - // Listeners - - onQueueRowModalOpenOrClose = (isOpen) => { - this._shouldBlockRefresh = isOpen; - }; - - onSelectAllChange = ({ value }) => { - this.setState(selectAll(this.state.selectedState, value)); - }; - - onSelectedChange = ({ id, value, shiftKey = false }) => { - this.setState((state) => { - return toggleSelected(state, this.props.items, id, value, shiftKey); - }); - }; - - onGrabSelectedPress = () => { - this.props.onGrabSelectedPress(this.getSelectedIds()); - }; - - onRemoveSelectedPress = () => { - this.setState({ isConfirmRemoveModalOpen: true }, () => { - this._shouldBlockRefresh = true; - }); - }; - - onRemoveSelectedConfirmed = (payload) => { - this._shouldBlockRefresh = false; - this.props.onRemoveSelectedPress({ ids: this.getSelectedIds(), ...payload }); - this.setState({ isConfirmRemoveModalOpen: false }); - }; - - onConfirmRemoveModalClose = () => { - this._shouldBlockRefresh = false; - this.setState({ isConfirmRemoveModalOpen: false }); - }; - - // - // Render - - render() { - const { - isFetching, - isPopulated, - error, - isArtistFetching, - isArtistPopulated, - isAlbumsFetching, - isAlbumsPopulated, - albumsError, - columns, - selectedFilterKey, - filters, - customFilters, - count, - totalRecords, - isGrabbing, - isRemoving, - isRefreshMonitoredDownloadsExecuting, - onRefreshPress, - onFilterSelect, - ...otherProps - } = this.props; - - const { - allSelected, - allUnselected, - selectedState, - isConfirmRemoveModalOpen, - isPendingSelected, - items - } = this.state; - - const isRefreshing = isFetching || isArtistFetching || isAlbumsFetching || isRefreshMonitoredDownloadsExecuting; - const isAllPopulated = isPopulated && ((isArtistPopulated && isAlbumsPopulated) || !items.length || items.every((e) => !e.albumId)); - const hasError = error || albumsError; - const selectedIds = this.getSelectedIds(); - const selectedCount = selectedIds.length; - const disableSelectedActions = selectedCount === 0; - - return ( - - - - - - - - - - - - - - - - - - - - - - - { - isRefreshing && !isAllPopulated ? - : - null - } - - { - !isRefreshing && hasError ? - - {translate('FailedToLoadQueue')} - : - null - } - - { - isAllPopulated && !hasError && !items.length ? - - { - selectedFilterKey !== 'all' && count > 0 ? - translate('QueueFilterHasNoItems') : - translate('QueueIsEmpty') - } - : - null - } - - { - isAllPopulated && !hasError && !!items.length ? -
- - - { - items.map((item) => { - return ( - - ); - }) - } - -
- - -
: - null - } -
- - { - const item = items.find((i) => i.id === id); - - return !!(item && item.downloadClientHasPostImportCategory); - }) - )} - canIgnore={isConfirmRemoveModalOpen && ( - selectedIds.every((id) => { - const item = items.find((i) => i.id === id); - - return !!(item && item.artistId && item.albumId); - }) - )} - pending={isConfirmRemoveModalOpen && ( - selectedIds.every((id) => { - const item = items.find((i) => i.id === id); - - if (!item) { - return false; - } - - return item.status === 'delay' || item.status === 'downloadClientUnavailable'; - }) - )} - onRemovePress={this.onRemoveSelectedConfirmed} - onModalClose={this.onConfirmRemoveModalClose} - /> -
- ); - } -} - -Queue.propTypes = { - isFetching: PropTypes.bool.isRequired, - isPopulated: PropTypes.bool.isRequired, - error: PropTypes.object, - items: PropTypes.arrayOf(PropTypes.object).isRequired, - isArtistFetching: PropTypes.bool.isRequired, - isArtistPopulated: PropTypes.bool.isRequired, - isAlbumsFetching: PropTypes.bool.isRequired, - isAlbumsPopulated: PropTypes.bool.isRequired, - albumsError: PropTypes.object, - columns: PropTypes.arrayOf(PropTypes.object).isRequired, - selectedFilterKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired, - filters: PropTypes.arrayOf(PropTypes.object).isRequired, - customFilters: PropTypes.arrayOf(PropTypes.object).isRequired, - count: PropTypes.number.isRequired, - totalRecords: PropTypes.number, - isGrabbing: PropTypes.bool.isRequired, - isRemoving: PropTypes.bool.isRequired, - isRefreshMonitoredDownloadsExecuting: PropTypes.bool.isRequired, - onRefreshPress: PropTypes.func.isRequired, - onGrabSelectedPress: PropTypes.func.isRequired, - onRemoveSelectedPress: PropTypes.func.isRequired, - onFilterSelect: PropTypes.func.isRequired -}; - -Queue.defaultProps = { - count: 0 -}; - -export default Queue; diff --git a/frontend/src/Activity/Queue/QueueConnector.js b/frontend/src/Activity/Queue/QueueConnector.js deleted file mode 100644 index fc0bb4699..000000000 --- a/frontend/src/Activity/Queue/QueueConnector.js +++ /dev/null @@ -1,206 +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 withCurrentPage from 'Components/withCurrentPage'; -import { clearAlbums, fetchAlbums } from 'Store/Actions/albumActions'; -import { executeCommand } from 'Store/Actions/commandActions'; -import * as queueActions from 'Store/Actions/queueActions'; -import { createCustomFiltersSelector } from 'Store/Selectors/createClientSideCollectionSelector'; -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 Queue from './Queue'; - -function createMapStateToProps() { - return createSelector( - (state) => state.artist, - (state) => state.albums, - (state) => state.queue.options, - (state) => state.queue.paged, - (state) => state.queue.status.item, - createCustomFiltersSelector('queue'), - createCommandExecutingSelector(commandNames.REFRESH_MONITORED_DOWNLOADS), - (artist, albums, options, queue, status, customFilters, isRefreshMonitoredDownloadsExecuting) => { - return { - count: options.includeUnknownArtistItems ? status.totalCount : status.count, - isArtistFetching: artist.isFetching, - isArtistPopulated: artist.isPopulated, - isAlbumsFetching: albums.isFetching, - isAlbumsPopulated: albums.isPopulated, - albumsError: albums.error, - customFilters, - isRefreshMonitoredDownloadsExecuting, - ...options, - ...queue - }; - } - ); -} - -const mapDispatchToProps = { - ...queueActions, - fetchAlbums, - clearAlbums, - executeCommand -}; - -class QueueConnector extends Component { - - // - // Lifecycle - - componentDidMount() { - const { - useCurrentPage, - fetchQueue, - fetchQueueStatus, - gotoQueueFirstPage - } = this.props; - - registerPagePopulator(this.repopulate); - - if (useCurrentPage) { - fetchQueue(); - } else { - gotoQueueFirstPage(); - } - - fetchQueueStatus(); - } - - componentDidUpdate(prevProps) { - if (hasDifferentItems(prevProps.items, this.props.items)) { - const albumIds = selectUniqueIds(this.props.items, 'albumId'); - - if (albumIds.length) { - this.props.fetchAlbums({ albumIds }); - } else { - this.props.clearAlbums(); - } - } - - if ( - this.props.includeUnknownArtistItems !== - prevProps.includeUnknownArtistItems - ) { - this.repopulate(); - } - } - - componentWillUnmount() { - unregisterPagePopulator(this.repopulate); - this.props.clearQueue(); - this.props.clearAlbums(); - } - - // - // Control - - repopulate = () => { - this.props.fetchQueue(); - }; - - // - // Listeners - - onFirstPagePress = () => { - this.props.gotoQueueFirstPage(); - }; - - onPreviousPagePress = () => { - this.props.gotoQueuePreviousPage(); - }; - - onNextPagePress = () => { - this.props.gotoQueueNextPage(); - }; - - onLastPagePress = () => { - this.props.gotoQueueLastPage(); - }; - - onPageSelect = (page) => { - this.props.gotoQueuePage({ page }); - }; - - onSortPress = (sortKey) => { - this.props.setQueueSort({ sortKey }); - }; - - onFilterSelect = (selectedFilterKey) => { - this.props.setQueueFilter({ selectedFilterKey }); - }; - - onTableOptionChange = (payload) => { - this.props.setQueueTableOption(payload); - - if (payload.pageSize) { - this.props.gotoQueueFirstPage(); - } - }; - - onRefreshPress = () => { - this.props.executeCommand({ - name: commandNames.REFRESH_MONITORED_DOWNLOADS - }); - }; - - onGrabSelectedPress = (ids) => { - this.props.grabQueueItems({ ids }); - }; - - onRemoveSelectedPress = (payload) => { - this.props.removeQueueItems(payload); - }; - - // - // Render - - render() { - return ( - - ); - } -} - -QueueConnector.propTypes = { - useCurrentPage: PropTypes.bool.isRequired, - items: PropTypes.arrayOf(PropTypes.object).isRequired, - includeUnknownArtistItems: PropTypes.bool.isRequired, - fetchQueue: PropTypes.func.isRequired, - fetchQueueStatus: PropTypes.func.isRequired, - gotoQueueFirstPage: PropTypes.func.isRequired, - gotoQueuePreviousPage: PropTypes.func.isRequired, - gotoQueueNextPage: PropTypes.func.isRequired, - gotoQueueLastPage: PropTypes.func.isRequired, - gotoQueuePage: PropTypes.func.isRequired, - setQueueSort: PropTypes.func.isRequired, - setQueueFilter: PropTypes.func.isRequired, - setQueueTableOption: PropTypes.func.isRequired, - clearQueue: PropTypes.func.isRequired, - grabQueueItems: PropTypes.func.isRequired, - removeQueueItems: PropTypes.func.isRequired, - fetchAlbums: PropTypes.func.isRequired, - clearAlbums: PropTypes.func.isRequired, - executeCommand: PropTypes.func.isRequired -}; - -export default withCurrentPage( - connect(createMapStateToProps, mapDispatchToProps)(QueueConnector) -); diff --git a/frontend/src/Activity/Queue/QueueDetails.js b/frontend/src/Activity/Queue/QueueDetails.js deleted file mode 100644 index 208f50f4c..000000000 --- a/frontend/src/Activity/Queue/QueueDetails.js +++ /dev/null @@ -1,128 +0,0 @@ -import moment from 'moment'; -import PropTypes from 'prop-types'; -import React from 'react'; -import Icon from 'Components/Icon'; -import { icons, kinds } from 'Helpers/Props'; -import translate from 'Utilities/String/translate'; - -function QueueDetails(props) { - const { - title, - size, - sizeleft, - estimatedCompletionTime, - status, - trackedDownloadState, - trackedDownloadStatus, - errorMessage, - progressBar - } = props; - - const progress = (100 - sizeleft / size * 100); - - if (status === 'pending') { - return ( - - ); - } - - if (status === 'completed') { - if (errorMessage) { - return ( - - ); - } - - if (trackedDownloadStatus === 'warning') { - return ( - - ); - } - - if (trackedDownloadState === 'importPending') { - return ( - - ); - } - - if (trackedDownloadState === 'importing') { - return ( - - ); - } - } - - if (errorMessage) { - return ( - - ); - } - - if (status === 'failed') { - return ( - - ); - } - - if (status === 'warning') { - return ( - - ); - } - - if (progress < 5) { - return ( - - ); - } - - return progressBar; -} - -QueueDetails.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, - errorMessage: PropTypes.string, - progressBar: PropTypes.node.isRequired -}; - -export default QueueDetails; diff --git a/frontend/src/Activity/Queue/QueueFilterModal.tsx b/frontend/src/Activity/Queue/QueueFilterModal.tsx deleted file mode 100644 index 3fce6c166..000000000 --- a/frontend/src/Activity/Queue/QueueFilterModal.tsx +++ /dev/null @@ -1,54 +0,0 @@ -import React, { useCallback } from 'react'; -import { useDispatch, useSelector } from 'react-redux'; -import { createSelector } from 'reselect'; -import AppState from 'App/State/AppState'; -import FilterModal from 'Components/Filter/FilterModal'; -import { setQueueFilter } from 'Store/Actions/queueActions'; - -function createQueueSelector() { - return createSelector( - (state: AppState) => state.queue.paged.items, - (queueItems) => { - return queueItems; - } - ); -} - -function createFilterBuilderPropsSelector() { - return createSelector( - (state: AppState) => state.queue.paged.filterBuilderProps, - (filterBuilderProps) => { - return filterBuilderProps; - } - ); -} - -interface QueueFilterModalProps { - isOpen: boolean; -} - -export default function QueueFilterModal(props: QueueFilterModalProps) { - const sectionItems = useSelector(createQueueSelector()); - const filterBuilderProps = useSelector(createFilterBuilderPropsSelector()); - const customFilterType = 'queue'; - - const dispatch = useDispatch(); - - const dispatchSetFilter = useCallback( - (payload: unknown) => { - dispatch(setQueueFilter(payload)); - }, - [dispatch] - ); - - return ( - - ); -} diff --git a/frontend/src/Activity/Queue/QueueOptions.js b/frontend/src/Activity/Queue/QueueOptions.js deleted file mode 100644 index 2ca0d7663..000000000 --- a/frontend/src/Activity/Queue/QueueOptions.js +++ /dev/null @@ -1,80 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component, Fragment } from 'react'; -import FormGroup from 'Components/Form/FormGroup'; -import FormInputGroup from 'Components/Form/FormInputGroup'; -import FormLabel from 'Components/Form/FormLabel'; -import { inputTypes } from 'Helpers/Props'; -import translate from 'Utilities/String/translate'; - -class QueueOptions extends Component { - - // - // Lifecycle - - constructor(props, context) { - super(props, context); - - this.state = { - includeUnknownArtistItems: props.includeUnknownArtistItems - }; - } - - componentDidUpdate(prevProps) { - const { - includeUnknownArtistItems - } = this.props; - - if (includeUnknownArtistItems !== prevProps.includeUnknownArtistItems) { - this.setState({ - includeUnknownArtistItems - }); - } - } - - // - // Listeners - - onOptionChange = ({ name, value }) => { - this.setState({ - [name]: value - }, () => { - this.props.onOptionChange({ - [name]: value - }); - }); - }; - - // - // Render - - render() { - const { - includeUnknownArtistItems - } = this.state; - - return ( - - - - {translate('ShowUnknownArtistItems')} - - - - - - ); - } -} - -QueueOptions.propTypes = { - includeUnknownArtistItems: PropTypes.bool.isRequired, - onOptionChange: PropTypes.func.isRequired -}; - -export default QueueOptions; diff --git a/frontend/src/Activity/Queue/QueueOptionsConnector.js b/frontend/src/Activity/Queue/QueueOptionsConnector.js deleted file mode 100644 index b2c99511c..000000000 --- a/frontend/src/Activity/Queue/QueueOptionsConnector.js +++ /dev/null @@ -1,19 +0,0 @@ -import { connect } from 'react-redux'; -import { createSelector } from 'reselect'; -import { setQueueOption } from 'Store/Actions/queueActions'; -import QueueOptions from './QueueOptions'; - -function createMapStateToProps() { - return createSelector( - (state) => state.queue.options, - (options) => { - return options; - } - ); -} - -const mapDispatchToProps = { - onOptionChange: setQueueOption -}; - -export default connect(createMapStateToProps, mapDispatchToProps)(QueueOptions); diff --git a/frontend/src/Activity/Queue/QueueRow.css b/frontend/src/Activity/Queue/QueueRow.css deleted file mode 100644 index 2a0df3595..000000000 --- a/frontend/src/Activity/Queue/QueueRow.css +++ /dev/null @@ -1,30 +0,0 @@ -.quality { - composes: cell from '~Components/Table/Cells/TableRowCell.css'; - - width: 150px; -} - -.protocol { - composes: cell from '~Components/Table/Cells/TableRowCell.css'; - - width: 100px; -} - -.progress { - composes: cell from '~Components/Table/Cells/TableRowCell.css'; - - width: 150px; -} - -.customFormatScore { - composes: cell from '~Components/Table/Cells/TableRowCell.css'; - - width: 55px; -} - -.actions { - composes: cell from '~Components/Table/Cells/TableRowCell.css'; - - width: 90px; - text-align: right; -} diff --git a/frontend/src/Activity/Queue/QueueRow.css.d.ts b/frontend/src/Activity/Queue/QueueRow.css.d.ts deleted file mode 100644 index 13d67ea3a..000000000 --- a/frontend/src/Activity/Queue/QueueRow.css.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'actions': string; - 'customFormatScore': string; - 'progress': string; - 'protocol': string; - 'quality': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Activity/Queue/QueueRow.js b/frontend/src/Activity/Queue/QueueRow.js deleted file mode 100644 index d0f1fbacf..000000000 --- a/frontend/src/Activity/Queue/QueueRow.js +++ /dev/null @@ -1,464 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import ProtocolLabel from 'Activity/Queue/ProtocolLabel'; -import AlbumFormats from 'Album/AlbumFormats'; -import AlbumTitleLink from 'Album/AlbumTitleLink'; -import TrackQuality from 'Album/TrackQuality'; -import ArtistNameLink from 'Artist/ArtistNameLink'; -import Icon from 'Components/Icon'; -import IconButton from 'Components/Link/IconButton'; -import SpinnerIconButton from 'Components/Link/SpinnerIconButton'; -import ProgressBar from 'Components/ProgressBar'; -import RelativeDateCellConnector from 'Components/Table/Cells/RelativeDateCellConnector'; -import TableRowCell from 'Components/Table/Cells/TableRowCell'; -import TableSelectCell from 'Components/Table/Cells/TableSelectCell'; -import TableRow from 'Components/Table/TableRow'; -import Popover from 'Components/Tooltip/Popover'; -import Tooltip from 'Components/Tooltip/Tooltip'; -import { icons, kinds, tooltipPositions } from 'Helpers/Props'; -import InteractiveImportModal from 'InteractiveImport/InteractiveImportModal'; -import formatBytes from 'Utilities/Number/formatBytes'; -import formatCustomFormatScore from 'Utilities/Number/formatCustomFormatScore'; -import translate from 'Utilities/String/translate'; -import QueueStatusCell from './QueueStatusCell'; -import RemoveQueueItemModal from './RemoveQueueItemModal'; -import TimeleftCell from './TimeleftCell'; -import styles from './QueueRow.css'; - -class QueueRow extends Component { - - // - // Lifecycle - - constructor(props, context) { - super(props, context); - - this.state = { - isRemoveQueueItemModalOpen: false, - isInteractiveImportModalOpen: false - }; - } - - // - // Listeners - - onRemoveQueueItemPress = () => { - this.setState({ isRemoveQueueItemModalOpen: true }); - }; - - onRemoveQueueItemModalConfirmed = (blocklist, skipRedownload) => { - const { - onRemoveQueueItemPress, - onQueueRowModalOpenOrClose - } = this.props; - - onQueueRowModalOpenOrClose(false); - onRemoveQueueItemPress(blocklist, skipRedownload); - - this.setState({ isRemoveQueueItemModalOpen: false }); - }; - - onRemoveQueueItemModalClose = () => { - this.props.onQueueRowModalOpenOrClose(false); - - this.setState({ isRemoveQueueItemModalOpen: false }); - }; - - onInteractiveImportPress = () => { - this.props.onQueueRowModalOpenOrClose(true); - - this.setState({ isInteractiveImportModalOpen: true }); - }; - - onInteractiveImportModalClose = () => { - this.props.onQueueRowModalOpenOrClose(false); - - this.setState({ isInteractiveImportModalOpen: false }); - }; - - // - // Render - - render() { - const { - id, - downloadId, - title, - status, - trackedDownloadStatus, - trackedDownloadState, - statusMessages, - errorMessage, - artist, - album, - quality, - customFormats, - customFormatScore, - protocol, - indexer, - outputPath, - downloadClient, - downloadClientHasPostImportCategory, - downloadForced, - estimatedCompletionTime, - added, - timeleft, - size, - sizeleft, - showRelativeDates, - shortDateFormat, - timeFormat, - isGrabbing, - grabError, - isRemoving, - isSelected, - columns, - onSelectedChange, - onGrabPress - } = this.props; - - const { - isRemoveQueueItemModalOpen, - isInteractiveImportModalOpen - } = this.state; - - const progress = 100 - (sizeleft / size * 100); - const showInteractiveImport = status === 'completed' && trackedDownloadStatus === 'warning'; - const isPending = status === 'delay' || status === 'downloadClientUnavailable'; - - return ( - - - - { - columns.map((column) => { - const { - name, - isVisible - } = column; - - if (!isVisible) { - return null; - } - - if (name === 'status') { - return ( - - ); - } - - if (name === 'artists.sortName') { - return ( - - { - artist ? - : - title - } - - ); - } - - if (name === 'albums.title') { - return ( - - { - album ? - : - '-' - } - - ); - } - - if (name === 'albums.releaseDate') { - if (album) { - return ( - - ); - } - - return ( - - - - - ); - } - - if (name === 'quality') { - return ( - - { - quality ? - : - null - } - - ); - } - - if (name === 'customFormats') { - return ( - - - - ); - } - - if (name === 'customFormatScore') { - return ( - - } - position={tooltipPositions.BOTTOM} - /> - - ); - } - - if (name === 'protocol') { - return ( - - - - ); - } - - if (name === 'indexer') { - return ( - - {indexer} - - ); - } - - if (name === 'downloadClient') { - return ( - - {downloadClient} - - ); - } - - if (name === 'title') { - return ( - - {title} - - ); - } - - if (name === 'size') { - return ( - {formatBytes(size)} - ); - } - - if (name === 'outputPath') { - return ( - - {outputPath} - - ); - } - - if (name === 'estimatedCompletionTime') { - return ( - - ); - } - - if (name === 'progress') { - return ( - - { - !!progress && - - } - - ); - } - - if (name === 'added') { - return ( - - ); - } - - if (name === 'actions') { - return ( - - { - downloadForced && - - } - title={translate('ManualDownload')} - body="This release failed parsing checks and was manually downloaded from an interactive search. Import is likely to fail." - position={tooltipPositions.LEFT} - /> - } - - { - showInteractiveImport && - - } - - { - isPending && - - } - - - - ); - } - - return null; - }) - } - - - - - - ); - } - -} - -QueueRow.propTypes = { - id: PropTypes.number.isRequired, - downloadId: PropTypes.string, - title: PropTypes.string.isRequired, - status: PropTypes.string.isRequired, - trackedDownloadStatus: PropTypes.string, - trackedDownloadState: PropTypes.string, - statusMessages: PropTypes.arrayOf(PropTypes.object), - errorMessage: PropTypes.string, - artist: PropTypes.object, - album: PropTypes.object, - quality: PropTypes.object.isRequired, - customFormats: PropTypes.arrayOf(PropTypes.object), - customFormatScore: PropTypes.number.isRequired, - protocol: PropTypes.string.isRequired, - indexer: PropTypes.string, - outputPath: PropTypes.string, - downloadClient: PropTypes.string, - downloadClientHasPostImportCategory: PropTypes.bool, - downloadForced: PropTypes.bool.isRequired, - estimatedCompletionTime: PropTypes.string, - added: PropTypes.string, - timeleft: PropTypes.string, - size: PropTypes.number, - sizeleft: PropTypes.number, - showRelativeDates: PropTypes.bool.isRequired, - shortDateFormat: PropTypes.string.isRequired, - timeFormat: PropTypes.string.isRequired, - isGrabbing: PropTypes.bool.isRequired, - grabError: PropTypes.object, - isRemoving: PropTypes.bool.isRequired, - isSelected: PropTypes.bool, - columns: PropTypes.arrayOf(PropTypes.object).isRequired, - onSelectedChange: PropTypes.func.isRequired, - onGrabPress: PropTypes.func.isRequired, - onRemoveQueueItemPress: PropTypes.func.isRequired, - onQueueRowModalOpenOrClose: PropTypes.func.isRequired -}; - -QueueRow.defaultProps = { - customFormats: [], - isGrabbing: false, - isRemoving: false -}; - -export default QueueRow; diff --git a/frontend/src/Activity/Queue/QueueRowConnector.js b/frontend/src/Activity/Queue/QueueRowConnector.js deleted file mode 100644 index e2a5ba368..000000000 --- a/frontend/src/Activity/Queue/QueueRowConnector.js +++ /dev/null @@ -1,70 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import { connect } from 'react-redux'; -import { createSelector } from 'reselect'; -import { grabQueueItem, removeQueueItem } from 'Store/Actions/queueActions'; -import createAlbumSelector from 'Store/Selectors/createAlbumSelector'; -import createArtistSelector from 'Store/Selectors/createArtistSelector'; -import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector'; -import QueueRow from './QueueRow'; - -function createMapStateToProps() { - return createSelector( - createArtistSelector(), - createAlbumSelector(), - createUISettingsSelector(), - (artist, album, uiSettings) => { - const result = { - showRelativeDates: uiSettings.showRelativeDates, - shortDateFormat: uiSettings.shortDateFormat, - timeFormat: uiSettings.timeFormat - }; - - result.artist = artist; - result.album = album; - - return result; - } - ); -} - -const mapDispatchToProps = { - grabQueueItem, - removeQueueItem -}; - -class QueueRowConnector extends Component { - - // - // Listeners - - onGrabPress = () => { - this.props.grabQueueItem({ id: this.props.id }); - }; - - onRemoveQueueItemPress = (payload) => { - this.props.removeQueueItem({ id: this.props.id, ...payload }); - }; - - // - // Render - - render() { - return ( - - ); - } -} - -QueueRowConnector.propTypes = { - id: PropTypes.number.isRequired, - album: PropTypes.object, - grabQueueItem: PropTypes.func.isRequired, - removeQueueItem: PropTypes.func.isRequired -}; - -export default connect(createMapStateToProps, mapDispatchToProps)(QueueRowConnector); diff --git a/frontend/src/Activity/Queue/QueueStatusCell.css b/frontend/src/Activity/Queue/QueueStatusCell.css deleted file mode 100644 index 538d5a15d..000000000 --- a/frontend/src/Activity/Queue/QueueStatusCell.css +++ /dev/null @@ -1,9 +0,0 @@ -.status { - composes: cell from '~Components/Table/Cells/TableRowCell.css'; - - width: 30px; -} - -.noMessages { - margin-bottom: 10px; -} diff --git a/frontend/src/Activity/Queue/QueueStatusCell.css.d.ts b/frontend/src/Activity/Queue/QueueStatusCell.css.d.ts deleted file mode 100644 index aefdc03b9..000000000 --- a/frontend/src/Activity/Queue/QueueStatusCell.css.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'noMessages': string; - 'status': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Activity/Queue/QueueStatusCell.js b/frontend/src/Activity/Queue/QueueStatusCell.js deleted file mode 100644 index d4dcdfeee..000000000 --- a/frontend/src/Activity/Queue/QueueStatusCell.js +++ /dev/null @@ -1,171 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import Icon from 'Components/Icon'; -import TableRowCell from 'Components/Table/Cells/TableRowCell'; -import Popover from 'Components/Tooltip/Popover'; -import { icons, kinds, tooltipPositions } from 'Helpers/Props'; -import translate from 'Utilities/String/translate'; -import styles from './QueueStatusCell.css'; - -function getDetailedPopoverBody(statusMessages) { - return ( -
- { - statusMessages.map(({ title, messages }) => { - return ( -
- {title} -
    - { - messages.map((message) => { - return ( -
  • - {message} -
  • - ); - }) - } -
-
- ); - }) - } -
- ); -} - -function QueueStatusCell(props) { - const { - sourceTitle, - status, - trackedDownloadStatus, - trackedDownloadState, - statusMessages, - errorMessage - } = props; - - const hasWarning = trackedDownloadStatus === 'warning'; - const hasError = trackedDownloadStatus === 'error'; - - // status === 'downloading' - let iconName = icons.DOWNLOADING; - let iconKind = kinds.DEFAULT; - let title = translate('Downloading'); - - if (status === 'paused') { - iconName = icons.PAUSED; - title = translate('Paused'); - } - - if (status === 'queued') { - iconName = icons.QUEUED; - title = translate('Queued'); - } - - if (status === 'completed') { - iconName = icons.DOWNLOADED; - title = translate('Downloaded'); - - if (trackedDownloadState === 'importBlocked') { - title += ` - ${translate('UnableToImportAutomatically')}`; - iconKind = kinds.WARNING; - } - - if (trackedDownloadState === 'importFailed') { - title += ` - ${translate('ImportFailed', { sourceTitle })}`; - iconKind = kinds.WARNING; - } - - if (trackedDownloadState === 'importPending') { - title += ` - ${translate('WaitingToImport')}`; - iconKind = kinds.PURPLE; - } - - if (trackedDownloadState === 'importing') { - title += ` - ${translate('Importing')}`; - iconKind = kinds.PURPLE; - } - - if (trackedDownloadState === 'failedPending') { - title += ` - ${translate('WaitingToProcess')}`; - iconKind = kinds.DANGER; - } - } - - if (hasWarning) { - iconKind = kinds.WARNING; - } - - if (status === 'delay') { - iconName = icons.PENDING; - title = translate('Pending'); - } - - if (status === 'downloadClientUnavailable') { - iconName = icons.PENDING; - iconKind = kinds.WARNING; - title = translate('PendingDownloadClientUnavailable'); - } - - if (status === 'failed') { - iconName = icons.DOWNLOADING; - iconKind = kinds.DANGER; - title = translate('DownloadFailed'); - } - - if (status === 'warning') { - iconName = icons.DOWNLOADING; - iconKind = kinds.WARNING; - const warningMessage = - errorMessage || translate('CheckDownloadClientForDetails'); - title = translate('DownloadWarning', { warningMessage }); - } - - if (hasError) { - if (status === 'completed') { - iconName = icons.DOWNLOAD; - iconKind = kinds.DANGER; - title = translate('ImportFailed', { sourceTitle }); - } else { - iconName = icons.DOWNLOADING; - iconKind = kinds.DANGER; - title = translate('DownloadFailed'); - } - } - - return ( - - - } - title={title} - body={hasWarning || hasError ? getDetailedPopoverBody(statusMessages) : sourceTitle} - position={tooltipPositions.RIGHT} - canFlip={false} - /> - - ); -} - -QueueStatusCell.propTypes = { - sourceTitle: PropTypes.string.isRequired, - status: PropTypes.string.isRequired, - trackedDownloadStatus: PropTypes.string.isRequired, - trackedDownloadState: PropTypes.string.isRequired, - statusMessages: PropTypes.arrayOf(PropTypes.object), - errorMessage: PropTypes.string -}; - -QueueStatusCell.defaultProps = { - trackedDownloadStatus: 'Ok', - trackedDownloadState: 'Downloading' -}; - -export default QueueStatusCell; diff --git a/frontend/src/Activity/Queue/RemoveQueueItemModal.css b/frontend/src/Activity/Queue/RemoveQueueItemModal.css deleted file mode 100644 index c9ef59ec1..000000000 --- a/frontend/src/Activity/Queue/RemoveQueueItemModal.css +++ /dev/null @@ -1,3 +0,0 @@ -.message { - margin-bottom: 30px; -} diff --git a/frontend/src/Activity/Queue/RemoveQueueItemModal.css.d.ts b/frontend/src/Activity/Queue/RemoveQueueItemModal.css.d.ts deleted file mode 100644 index 65c237dff..000000000 --- a/frontend/src/Activity/Queue/RemoveQueueItemModal.css.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'message': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Activity/Queue/RemoveQueueItemModal.tsx b/frontend/src/Activity/Queue/RemoveQueueItemModal.tsx deleted file mode 100644 index f25bb0d1b..000000000 --- a/frontend/src/Activity/Queue/RemoveQueueItemModal.tsx +++ /dev/null @@ -1,231 +0,0 @@ -import React, { useCallback, useMemo, useState } from 'react'; -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 Modal from 'Components/Modal/Modal'; -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, kinds, sizes } from 'Helpers/Props'; -import translate from 'Utilities/String/translate'; -import styles from './RemoveQueueItemModal.css'; - -interface RemovePressProps { - removeFromClient: boolean; - changeCategory: boolean; - blocklist: boolean; - skipRedownload: boolean; -} - -interface RemoveQueueItemModalProps { - isOpen: boolean; - sourceTitle: string; - canChangeCategory: boolean; - canIgnore: boolean; - isPending: boolean; - selectedCount?: number; - onRemovePress(props: RemovePressProps): void; - onModalClose: () => void; -} - -type RemovalMethod = 'removeFromClient' | 'changeCategory' | 'ignore'; -type BlocklistMethod = - | 'doNotBlocklist' - | 'blocklistAndSearch' - | 'blocklistOnly'; - -function RemoveQueueItemModal(props: RemoveQueueItemModalProps) { - const { - isOpen, - sourceTitle, - canIgnore, - canChangeCategory, - isPending, - selectedCount, - onRemovePress, - onModalClose, - } = props; - - const multipleSelected = selectedCount && selectedCount > 1; - - const [removalMethod, setRemovalMethod] = - useState('removeFromClient'); - const [blocklistMethod, setBlocklistMethod] = - useState('doNotBlocklist'); - - const { title, message } = useMemo(() => { - if (!selectedCount) { - return { - title: translate('RemoveQueueItem', { sourceTitle }), - message: translate('RemoveQueueItemConfirmation', { sourceTitle }), - }; - } - - if (selectedCount === 1) { - return { - title: translate('RemoveSelectedItem'), - message: translate('RemoveSelectedItemQueueMessageText'), - }; - } - - return { - title: translate('RemoveSelectedItems'), - message: translate('RemoveSelectedItemsQueueMessageText', { - selectedCount, - }), - }; - }, [sourceTitle, selectedCount]); - - const removalMethodOptions = useMemo(() => { - return [ - { - key: 'removeFromClient', - value: translate('RemoveFromDownloadClient'), - hint: multipleSelected - ? translate('RemoveMultipleFromDownloadClientHint') - : translate('RemoveFromDownloadClientHint'), - }, - { - key: 'changeCategory', - value: translate('ChangeCategory'), - isDisabled: !canChangeCategory, - hint: multipleSelected - ? translate('ChangeCategoryMultipleHint') - : translate('ChangeCategoryHint'), - }, - { - key: 'ignore', - value: multipleSelected - ? translate('IgnoreDownloads') - : translate('IgnoreDownload'), - isDisabled: !canIgnore, - hint: multipleSelected - ? translate('IgnoreDownloadsHint') - : translate('IgnoreDownloadHint'), - }, - ]; - }, [canChangeCategory, canIgnore, multipleSelected]); - - const blocklistMethodOptions = useMemo(() => { - return [ - { - key: 'doNotBlocklist', - value: translate('DoNotBlocklist'), - hint: translate('DoNotBlocklistHint'), - }, - { - key: 'blocklistAndSearch', - value: translate('BlocklistAndSearch'), - isDisabled: isPending, - hint: multipleSelected - ? translate('BlocklistAndSearchMultipleHint') - : translate('BlocklistAndSearchHint'), - }, - { - key: 'blocklistOnly', - value: translate('BlocklistOnly'), - hint: multipleSelected - ? translate('BlocklistMultipleOnlyHint') - : translate('BlocklistOnlyHint'), - }, - ]; - }, [isPending, multipleSelected]); - - const handleRemovalMethodChange = useCallback( - ({ value }: { value: RemovalMethod }) => { - setRemovalMethod(value); - }, - [setRemovalMethod] - ); - - const handleBlocklistMethodChange = useCallback( - ({ value }: { value: BlocklistMethod }) => { - setBlocklistMethod(value); - }, - [setBlocklistMethod] - ); - - const handleConfirmRemove = useCallback(() => { - onRemovePress({ - removeFromClient: removalMethod === 'removeFromClient', - changeCategory: removalMethod === 'changeCategory', - blocklist: blocklistMethod !== 'doNotBlocklist', - skipRedownload: blocklistMethod === 'blocklistOnly', - }); - - setRemovalMethod('removeFromClient'); - setBlocklistMethod('doNotBlocklist'); - }, [ - removalMethod, - blocklistMethod, - setRemovalMethod, - setBlocklistMethod, - onRemovePress, - ]); - - const handleModalClose = useCallback(() => { - setRemovalMethod('removeFromClient'); - setBlocklistMethod('doNotBlocklist'); - - onModalClose(); - }, [setRemovalMethod, setBlocklistMethod, onModalClose]); - - return ( - - - {title} - - -
{message}
- - {isPending ? null : ( - - {translate('RemoveQueueItemRemovalMethod')} - - - - )} - - - - {multipleSelected - ? translate('BlocklistReleases') - : translate('BlocklistRelease')} - - - - -
- - - - - - -
-
- ); -} - -export default RemoveQueueItemModal; diff --git a/frontend/src/Activity/Queue/Status/QueueStatusConnector.js b/frontend/src/Activity/Queue/Status/QueueStatusConnector.js deleted file mode 100644 index 7f58f2810..000000000 --- a/frontend/src/Activity/Queue/Status/QueueStatusConnector.js +++ /dev/null @@ -1,76 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import { connect } from 'react-redux'; -import { createSelector } from 'reselect'; -import PageSidebarStatus from 'Components/Page/Sidebar/PageSidebarStatus'; -import { fetchQueueStatus } from 'Store/Actions/queueActions'; - -function createMapStateToProps() { - return createSelector( - (state) => state.app, - (state) => state.queue.status, - (state) => state.queue.options.includeUnknownArtistItems, - (app, status, includeUnknownArtistItems) => { - const { - errors, - warnings, - unknownErrors, - unknownWarnings, - count, - totalCount - } = status.item; - - return { - isConnected: app.isConnected, - isReconnecting: app.isReconnecting, - isPopulated: status.isPopulated, - ...status.item, - count: includeUnknownArtistItems ? totalCount : count, - errors: includeUnknownArtistItems ? errors || unknownErrors : errors, - warnings: includeUnknownArtistItems ? warnings || unknownWarnings : warnings - }; - } - ); -} - -const mapDispatchToProps = { - fetchQueueStatus -}; - -class QueueStatusConnector extends Component { - - // - // Lifecycle - - componentDidMount() { - if (!this.props.isPopulated) { - this.props.fetchQueueStatus(); - } - } - - componentDidUpdate(prevProps) { - if (this.props.isConnected && prevProps.isReconnecting) { - this.props.fetchQueueStatus(); - } - } - - // - // Render - - render() { - return ( - - ); - } -} - -QueueStatusConnector.propTypes = { - isConnected: PropTypes.bool.isRequired, - isReconnecting: PropTypes.bool.isRequired, - isPopulated: PropTypes.bool.isRequired, - fetchQueueStatus: PropTypes.func.isRequired -}; - -export default connect(createMapStateToProps, mapDispatchToProps)(QueueStatusConnector); diff --git a/frontend/src/Activity/Queue/TimeleftCell.css b/frontend/src/Activity/Queue/TimeleftCell.css deleted file mode 100644 index cc6001a22..000000000 --- a/frontend/src/Activity/Queue/TimeleftCell.css +++ /dev/null @@ -1,5 +0,0 @@ -.timeleft { - composes: cell from '~Components/Table/Cells/TableRowCell.css'; - - width: 100px; -} diff --git a/frontend/src/Activity/Queue/TimeleftCell.css.d.ts b/frontend/src/Activity/Queue/TimeleftCell.css.d.ts deleted file mode 100644 index f5c9402d1..000000000 --- a/frontend/src/Activity/Queue/TimeleftCell.css.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'timeleft': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Activity/Queue/TimeleftCell.js b/frontend/src/Activity/Queue/TimeleftCell.js deleted file mode 100644 index b280b5a06..000000000 --- a/frontend/src/Activity/Queue/TimeleftCell.js +++ /dev/null @@ -1,90 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import Icon from 'Components/Icon'; -import TableRowCell from 'Components/Table/Cells/TableRowCell'; -import Tooltip from 'Components/Tooltip/Tooltip'; -import { icons, kinds, tooltipPositions } from 'Helpers/Props'; -import formatTime from 'Utilities/Date/formatTime'; -import formatTimeSpan from 'Utilities/Date/formatTimeSpan'; -import getRelativeDate from 'Utilities/Date/getRelativeDate'; -import formatBytes from 'Utilities/Number/formatBytes'; -import translate from 'Utilities/String/translate'; -import styles from './TimeleftCell.css'; - -function TimeleftCell(props) { - const { - estimatedCompletionTime, - timeleft, - status, - size, - sizeleft, - showRelativeDates, - shortDateFormat, - timeFormat - } = props; - - if (status === 'delay') { - const date = getRelativeDate(estimatedCompletionTime, shortDateFormat, showRelativeDates); - const time = formatTime(estimatedCompletionTime, timeFormat, { includeMinuteZero: true }); - - return ( - - } - tooltip={translate('DelayingDownloadUntil', { date, time })} - kind={kinds.INVERSE} - position={tooltipPositions.TOP} - /> - - ); - } - - if (status === 'downloadClientUnavailable') { - const date = getRelativeDate(estimatedCompletionTime, shortDateFormat, showRelativeDates); - const time = formatTime(estimatedCompletionTime, timeFormat, { includeMinuteZero: true }); - - return ( - - } - tooltip={translate('RetryingDownloadOn', { date, time })} - kind={kinds.INVERSE} - position={tooltipPositions.TOP} - /> - - ); - } - - if (!timeleft || status === 'completed' || status === 'failed') { - return ( - - - - - ); - } - - const totalSize = formatBytes(size); - const remainingSize = formatBytes(sizeleft); - - return ( - - {formatTimeSpan(timeleft)} - - ); -} - -TimeleftCell.propTypes = { - estimatedCompletionTime: PropTypes.string, - timeleft: PropTypes.string, - status: PropTypes.string.isRequired, - size: PropTypes.number.isRequired, - sizeleft: PropTypes.number.isRequired, - showRelativeDates: PropTypes.bool.isRequired, - shortDateFormat: PropTypes.string.isRequired, - timeFormat: PropTypes.string.isRequired -}; - -export default TimeleftCell; diff --git a/frontend/src/AddArtist/ArtistMetadataProfilePopoverContent.js b/frontend/src/AddArtist/ArtistMetadataProfilePopoverContent.js deleted file mode 100644 index d7c663674..000000000 --- a/frontend/src/AddArtist/ArtistMetadataProfilePopoverContent.js +++ /dev/null @@ -1,11 +0,0 @@ -import React from 'react'; - -function ArtistMetadataProfilePopoverContent() { - return ( -
- Select 'None' to only include items manually added via search or that match files on disk -
- ); -} - -export default ArtistMetadataProfilePopoverContent; diff --git a/frontend/src/AddArtist/ArtistMonitorNewItemsOptionsPopoverContent.js b/frontend/src/AddArtist/ArtistMonitorNewItemsOptionsPopoverContent.js deleted file mode 100644 index 5a837b1eb..000000000 --- a/frontend/src/AddArtist/ArtistMonitorNewItemsOptionsPopoverContent.js +++ /dev/null @@ -1,27 +0,0 @@ -import React from 'react'; -import DescriptionList from 'Components/DescriptionList/DescriptionList'; -import DescriptionListItem from 'Components/DescriptionList/DescriptionListItem'; -import translate from 'Utilities/String/translate'; - -function ArtistMonitorNewItemsOptionsPopoverContent() { - return ( - - - - - - - - ); -} - -export default ArtistMonitorNewItemsOptionsPopoverContent; diff --git a/frontend/src/AddArtist/ArtistMonitoringOptionsPopoverContent.css b/frontend/src/AddArtist/ArtistMonitoringOptionsPopoverContent.css deleted file mode 100644 index 7393b9c35..000000000 --- a/frontend/src/AddArtist/ArtistMonitoringOptionsPopoverContent.css +++ /dev/null @@ -1,5 +0,0 @@ -.message { - composes: alert from '~Components/Alert.css'; - - margin-bottom: 30px; -} diff --git a/frontend/src/AddArtist/ArtistMonitoringOptionsPopoverContent.css.d.ts b/frontend/src/AddArtist/ArtistMonitoringOptionsPopoverContent.css.d.ts deleted file mode 100644 index 65c237dff..000000000 --- a/frontend/src/AddArtist/ArtistMonitoringOptionsPopoverContent.css.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'message': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/AddArtist/ArtistMonitoringOptionsPopoverContent.js b/frontend/src/AddArtist/ArtistMonitoringOptionsPopoverContent.js deleted file mode 100644 index d53bda8e3..000000000 --- a/frontend/src/AddArtist/ArtistMonitoringOptionsPopoverContent.js +++ /dev/null @@ -1,56 +0,0 @@ -import React from 'react'; -import Alert from 'Components/Alert'; -import DescriptionList from 'Components/DescriptionList/DescriptionList'; -import DescriptionListItem from 'Components/DescriptionList/DescriptionListItem'; -import { kinds } from 'Helpers/Props'; -import translate from 'Utilities/String/translate'; -import styles from './ArtistMonitoringOptionsPopoverContent.css'; - -function ArtistMonitoringOptionsPopoverContent() { - return ( - <> - - This is a one time adjustment to set which albums are monitored - - - - - - - - - - - - - - - - - - - ); -} - -export default ArtistMonitoringOptionsPopoverContent; diff --git a/frontend/src/Album/Album.ts b/frontend/src/Album/Album.ts deleted file mode 100644 index 86f1ed5fe..000000000 --- a/frontend/src/Album/Album.ts +++ /dev/null @@ -1,27 +0,0 @@ -import ModelBase from 'App/ModelBase'; -import Artist from 'Artist/Artist'; - -export interface Statistics { - trackCount: number; - trackFileCount: number; - percentOfTracks: number; - sizeOnDisk: number; - totalTrackCount: number; -} - -interface Album extends ModelBase { - artistId: number; - artist: Artist; - foreignAlbumId: string; - title: string; - overview: string; - disambiguation?: string; - albumType: string; - monitored: boolean; - releaseDate: string; - statistics: Statistics; - lastSearchTime?: string; - isSaving?: boolean; -} - -export default Album; diff --git a/frontend/src/Album/AlbumCover.js b/frontend/src/Album/AlbumCover.js deleted file mode 100644 index 538fa5db8..000000000 --- a/frontend/src/Album/AlbumCover.js +++ /dev/null @@ -1,25 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import ArtistImage from 'Artist/ArtistImage'; - -const coverPlaceholder = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPcAAAD3AgMAAAC84irAAAAADFBMVEUyMjI7Ozs1NTU4ODjgOsZvAAAAAWJLR0QAiAUdSAAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB+EJEBIzDdm9OfoAAAbkSURBVGje7Zq9b9s4FMBZFgUkBR27C3cw0MromL1jxwyVZASB67G4qWPgoSAyBdm9CwECKCp8nbIccGj/Ce/BTUb3Lh3aI997pCjnTnyyt0JcIif5+ZHvPZLvQ0KMYxzjGMc4xjGOcYxjHOP4JUfSfP7RVPvSH3MYX/eC5aecxne1v+w95WebFs/rwVO/8+h8PnT6t3ln/DFQuJ06/SyHiX9pxa7o5/lewkuLDxLvhM8tPki8g07dU8Gnj5zGlw7P79n4pDVYi8/YuHO4n03z0z6XXDom4G3TXDdN840+LobN/W1Ty2slHD8bNvevlUgutLmTj4NmT3pf6mMGcJGth+gefaZsDCjB2Wj65wN8ZmnAGnE6eFieI1FvcEISLjIUr9hm+w7PFeHiE9t0E7dyIatE48odXTPu0j/A3BMnXf7NXDxudTxbE2VxMWVu+sfwf3i1ZMLiaQLf+iWIP4VtjtTzFhc35vfveZrb4nPt4R95ulu1cxeVh8Psw7rzbgWp8dWHyr83WJpbgjypjS5XeZnqRxmJNUd3MS1d6ue/tOn0WuayNd2CoTlaeqwnIVeOgcWHdHdMS9cSN1vCy3bxZwzFm6VL7QA14WTudVj1sFvf4ReZNSCO0IvwngXFV3hkFcriuPokrPrYbYxjVAHiZ24zLYIeP7/E4xZUgHiZWt29D9ptGemHR7mPo9B10HLGbucRfs/Ww2f2CD4L2u0+wofKwwvrd0XoqCmr38CAZa1d58LesEpvgqtN4MCR1mVj2nZWOiweVB/CAXuyi59Y1auA2eekg6Xw8Tfm013A8LFV8mYXL61ZF4Hb8Zx8d9vBtbdG7s99XvOOZlF38QVtmlkAv0ffxTOjxU/o5p8FvKbSszw2ik87+Iz23Lwf134RiWf2tG3xN2T4oh8vDO4U33z+5qnefFnR77OA2wheh2WfbJBHeI/XgtNJEaHdtJNrvPn8E8eV/kW/2xn8FDc77LemOyq4J1XvSbds7SZ3cAV+86UXP283TGaFUk4ZwmNyugne8FaqxdHtFkH8GNewg2cc3PjsM7CbbNdMwQJ47aL3mP5H308ar5XOn2nUwpx+4hrx/z+qn5DBNqD4rMUpWACnPwnhkfa9SnZwvX1MnHLVi08cPle+0wBuAsykd8dO0KkS9L0dPCO37MVLxJc6nPHdTeNT/ZeLDQN/DEFpBzc33Bfckhx8K1q7IS5vuPgjbTf5AL97zcALxFUHN76QrF7heTHru54RN3bbxTeEn4Xx04f4NOfhSuPLncmnQk3z1yLlSE8fabtFHVyZyIQlXes8zrdSJR5ea7k3+asUooXg2mO4oDprT/XdHpROhouL/8A3edBw5DYxBhYdn08Q53jd0elDfApHbHjL6Hk/pvvNd1rEWdLl9iG+hpMgiMMdVEM64B8X5nq6ZBwX5rCSeK/4uInJROiwetLi0jtpG0yJBPOkTVQXryEPKqMQbq6JeyUTvUOkilq/EVGmo5NIpP3XRIzhXIafrjzF30JUIqecKxIjOpF6il9jbHTLxjs3rN5voPH+GxbDA1m7GrM9a4zdTigdCUUXD2MSSEAXQRxDo2QHl2iwV+h7gchqLrLrhmKxH/Z6nqLUQD5AYSHWAEwk+Z1Ck1vEAmEhBaVtufDtj8Zmv6U+PQNBqbDf/szVR5XNvQteSAzRyeQhzgnIKR2Invq43gQb4+oRaJCTTcRd6RkzGXlJQe3vDq8gsDB2S0QaSoViwKNW9Sh9zUzEMA2MWtU7nJUGYhIa4bnjcLthgkkopMAGj3dxXgoMCbg+laTFL8luSn9pFkrAMf031cmVJz0jXzsKFm6OSfVqYnEILPKZDjeicPFhQoaHbMhKX+NmZ5Q+ntr8n5obhGPVKlx48cs+FteKP3MlswWv6CSPHK4Dmntm0ckreW0snmxKbsnLFdyo4mrwjLYJo+Dmyn0k3uDTEpMRTrnPKza+IHy9wGSEU2yMvSrvHeJ/Qt2UV+p0hVacvsah0psKXqEVy7y2tPu3xhM1oMxLReY00tAlJG9JFZktzCwyU4lbuqQ7U22VN1zi9gvsIP05PjAL7H55H/C6rREzyvu41bbS4VXb1OV0FLG1YVsa1J1gtzaosVJbHO3Gb6z4bR2H89s61FRqCIcgL+E3lfyWlsaN3eR6QDP0pSdeKqOEZjOgoda285SUl5W+Jga181wz0WQFF2poM7FtZTZKXlXZ0Fam10htroY3Ug9s43pN5OJ2jyZy28Iu1nu0sNsGenGzRwO9bd8Xd/u0793LA8Vmn5cHnPhiH+Gt+HIv4Ye+tnHoSyMHvrJy6Aszh76uc+DLQuLQV5XGMY5xjGMc4xjHOMYxjnH80uNfW99BeoyzJCoAAAAASUVORK5CYII='; - -function AlbumCover(props) { - return ( - - ); -} - -AlbumCover.propTypes = { - size: PropTypes.number.isRequired -}; - -AlbumCover.defaultProps = { - size: 250 -}; - -export default AlbumCover; diff --git a/frontend/src/Album/AlbumFormats.js b/frontend/src/Album/AlbumFormats.js deleted file mode 100644 index 1591fa714..000000000 --- a/frontend/src/Album/AlbumFormats.js +++ /dev/null @@ -1,33 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import Label from 'Components/Label'; -import { kinds } from 'Helpers/Props'; - -function AlbumFormats({ formats }) { - return ( -
- { - formats.map((format) => { - return ( - - ); - }) - } -
- ); -} - -AlbumFormats.propTypes = { - formats: PropTypes.arrayOf(PropTypes.object).isRequired -}; - -AlbumFormats.defaultProps = { - formats: [] -}; - -export default AlbumFormats; diff --git a/frontend/src/Album/AlbumSearchCell.css b/frontend/src/Album/AlbumSearchCell.css deleted file mode 100644 index ba099e8c0..000000000 --- a/frontend/src/Album/AlbumSearchCell.css +++ /dev/null @@ -1,6 +0,0 @@ -.AlbumSearchCell { - composes: cell from '~Components/Table/Cells/TableRowCell.css'; - - width: 70px; - white-space: nowrap; -} diff --git a/frontend/src/Album/AlbumSearchCell.css.d.ts b/frontend/src/Album/AlbumSearchCell.css.d.ts deleted file mode 100644 index 154740212..000000000 --- a/frontend/src/Album/AlbumSearchCell.css.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'AlbumSearchCell': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Album/AlbumSearchCell.js b/frontend/src/Album/AlbumSearchCell.js deleted file mode 100644 index f9ca44800..000000000 --- a/frontend/src/Album/AlbumSearchCell.js +++ /dev/null @@ -1,83 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import IconButton from 'Components/Link/IconButton'; -import SpinnerIconButton from 'Components/Link/SpinnerIconButton'; -import TableRowCell from 'Components/Table/Cells/TableRowCell'; -import { icons } from 'Helpers/Props'; -import translate from 'Utilities/String/translate'; -import AlbumInteractiveSearchModalConnector from './Search/AlbumInteractiveSearchModalConnector'; -import styles from './AlbumSearchCell.css'; - -class AlbumSearchCell extends Component { - - // - // Lifecycle - - constructor(props, context) { - super(props, context); - - this.state = { - isDetailsModalOpen: false - }; - } - - // - // Listeners - - onManualSearchPress = () => { - this.setState({ isDetailsModalOpen: true }); - }; - - onDetailsModalClose = () => { - this.setState({ isDetailsModalOpen: false }); - }; - - // - // Render - - render() { - const { - albumId, - albumTitle, - isSearching, - onSearchPress, - ...otherProps - } = this.props; - - return ( - - - - - - - - - ); - } -} - -AlbumSearchCell.propTypes = { - albumId: PropTypes.number.isRequired, - artistId: PropTypes.number.isRequired, - albumTitle: PropTypes.string.isRequired, - isSearching: PropTypes.bool.isRequired, - onSearchPress: PropTypes.func.isRequired -}; - -export default AlbumSearchCell; diff --git a/frontend/src/Album/AlbumSearchCellConnector.js b/frontend/src/Album/AlbumSearchCellConnector.js deleted file mode 100644 index 41360efeb..000000000 --- a/frontend/src/Album/AlbumSearchCellConnector.js +++ /dev/null @@ -1,49 +0,0 @@ -import { connect } from 'react-redux'; -import { createSelector } from 'reselect'; -import * as commandNames from 'Commands/commandNames'; -import { executeCommand } from 'Store/Actions/commandActions'; -import createArtistSelector from 'Store/Selectors/createArtistSelector'; -import createCommandsSelector from 'Store/Selectors/createCommandsSelector'; -import { isCommandExecuting } from 'Utilities/Command'; -import AlbumSearchCell from './AlbumSearchCell'; - -function createMapStateToProps() { - return createSelector( - (state, { albumId }) => albumId, - createArtistSelector(), - createCommandsSelector(), - (albumId, artist, commands) => { - const isSearching = commands.some((command) => { - const albumSearch = command.name === commandNames.ALBUM_SEARCH; - - if (!albumSearch) { - return false; - } - - return ( - isCommandExecuting(command) && - command.body.albumIds.indexOf(albumId) > -1 - ); - }); - - return { - artistMonitored: artist.monitored, - artistType: artist.artistType, - isSearching - }; - } - ); -} - -function createMapDispatchToProps(dispatch, props) { - return { - onSearchPress(name, path) { - dispatch(executeCommand({ - name: commandNames.ALBUM_SEARCH, - albumIds: [props.albumId] - })); - } - }; -} - -export default connect(createMapStateToProps, createMapDispatchToProps)(AlbumSearchCell); diff --git a/frontend/src/Album/AlbumTitleLink.css b/frontend/src/Album/AlbumTitleLink.css deleted file mode 100644 index 7fd85c836..000000000 --- a/frontend/src/Album/AlbumTitleLink.css +++ /dev/null @@ -1,8 +0,0 @@ -.link { - composes: link from '~Components/Link/Link.css'; - - &:hover { - color: var(--linkHoverColor); - text-decoration: underline; - } -} diff --git a/frontend/src/Album/AlbumTitleLink.js b/frontend/src/Album/AlbumTitleLink.js deleted file mode 100644 index e55fadfc0..000000000 --- a/frontend/src/Album/AlbumTitleLink.js +++ /dev/null @@ -1,22 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import Link from 'Components/Link/Link'; - -function AlbumTitleLink({ foreignAlbumId, title, disambiguation }) { - const link = `/album/${foreignAlbumId}`; - const albumTitle = `${title}${disambiguation ? ` (${disambiguation})` : ''}`; - - return ( - - {albumTitle} - - ); -} - -AlbumTitleLink.propTypes = { - foreignAlbumId: PropTypes.string.isRequired, - title: PropTypes.string.isRequired, - disambiguation: PropTypes.string -}; - -export default AlbumTitleLink; diff --git a/frontend/src/Album/Delete/DeleteAlbumModal.js b/frontend/src/Album/Delete/DeleteAlbumModal.js deleted file mode 100644 index 303010ca3..000000000 --- a/frontend/src/Album/Delete/DeleteAlbumModal.js +++ /dev/null @@ -1,33 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import Modal from 'Components/Modal/Modal'; -import { sizes } from 'Helpers/Props'; -import DeleteAlbumModalContentConnector from './DeleteAlbumModalContentConnector'; - -function DeleteAlbumModal(props) { - const { - isOpen, - onModalClose, - ...otherProps - } = props; - - return ( - - - - ); -} - -DeleteAlbumModal.propTypes = { - isOpen: PropTypes.bool.isRequired, - onModalClose: PropTypes.func.isRequired -}; - -export default DeleteAlbumModal; diff --git a/frontend/src/Album/Delete/DeleteAlbumModalContent.css b/frontend/src/Album/Delete/DeleteAlbumModalContent.css deleted file mode 100644 index df8e4822e..000000000 --- a/frontend/src/Album/Delete/DeleteAlbumModalContent.css +++ /dev/null @@ -1,12 +0,0 @@ -.pathContainer { - margin-bottom: 20px; -} - -.pathIcon { - margin-right: 8px; -} - -.deleteFilesMessage { - margin-top: 20px; - color: var(--dangerColor); -} diff --git a/frontend/src/Album/Delete/DeleteAlbumModalContent.css.d.ts b/frontend/src/Album/Delete/DeleteAlbumModalContent.css.d.ts deleted file mode 100644 index e55686abe..000000000 --- a/frontend/src/Album/Delete/DeleteAlbumModalContent.css.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'deleteFilesMessage': string; - 'pathContainer': string; - 'pathIcon': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Album/Delete/DeleteAlbumModalContent.js b/frontend/src/Album/Delete/DeleteAlbumModalContent.js deleted file mode 100644 index 28505ea75..000000000 --- a/frontend/src/Album/Delete/DeleteAlbumModalContent.js +++ /dev/null @@ -1,164 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -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, kinds } from 'Helpers/Props'; -import formatBytes from 'Utilities/Number/formatBytes'; -import translate from 'Utilities/String/translate'; -import styles from './DeleteAlbumModalContent.css'; - -class DeleteAlbumModalContent extends Component { - - // - // Lifecycle - - constructor(props, context) { - super(props, context); - - this.state = { - deleteFiles: false, - addImportListExclusion: true - }; - } - - // - // Listeners - - onDeleteFilesChange = ({ value }) => { - this.setState({ deleteFiles: value }); - }; - - onAddImportListExclusionChange = ({ value }) => { - this.setState({ addImportListExclusion: value }); - }; - - onDeleteAlbumConfirmed = () => { - const deleteFiles = this.state.deleteFiles; - const addImportListExclusion = this.state.addImportListExclusion; - - this.setState({ deleteFiles: false }); - this.setState({ addImportListExclusion: false }); - this.props.onDeletePress(deleteFiles, addImportListExclusion); - }; - - // - // Render - - render() { - const { - title, - statistics = {}, - onModalClose - } = this.props; - - const { - trackFileCount = 0, - sizeOnDisk = 0 - } = statistics; - - const deleteFiles = this.state.deleteFiles; - const addImportListExclusion = this.state.addImportListExclusion; - - const deleteFilesLabel = `Delete ${trackFileCount} Track Files`; - const deleteFilesHelpText = 'Delete the track files'; - - return ( - - - Delete - {title} - - - - - - {deleteFilesLabel} - - - - - - - {translate('AddListExclusion')} - - - - - - { - !addImportListExclusion && -
-
- {translate('IfYouDontAddAnImportListExclusionAndTheArtistHasAMetadataProfileOtherThanNoneThenThisAlbumMayBeReaddedDuringTheNextArtistRefresh')} -
-
- } - - { - deleteFiles && -
-
- {translate('TheAlbumsFilesWillBeDeleted')} -
- - { - !!trackFileCount && -
{trackFileCount} track files totaling {formatBytes(sizeOnDisk)}
- } -
- } - -
- - - - - - -
- ); - } -} - -DeleteAlbumModalContent.propTypes = { - title: PropTypes.string.isRequired, - statistics: PropTypes.object.isRequired, - onDeletePress: PropTypes.func.isRequired, - onModalClose: PropTypes.func.isRequired -}; - -DeleteAlbumModalContent.defaultProps = { - statistics: { - trackFileCount: 0 - } -}; - -export default DeleteAlbumModalContent; diff --git a/frontend/src/Album/Delete/DeleteAlbumModalContentConnector.js b/frontend/src/Album/Delete/DeleteAlbumModalContentConnector.js deleted file mode 100644 index 45ae4ceb3..000000000 --- a/frontend/src/Album/Delete/DeleteAlbumModalContentConnector.js +++ /dev/null @@ -1,62 +0,0 @@ -import { push } from 'connected-react-router'; -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import { connect } from 'react-redux'; -import { createSelector } from 'reselect'; -import { deleteAlbum } from 'Store/Actions/albumActions'; -import createAlbumSelector from 'Store/Selectors/createAlbumSelector'; -import DeleteAlbumModalContent from './DeleteAlbumModalContent'; - -function createMapStateToProps() { - return createSelector( - createAlbumSelector(), - (album) => { - return album; - } - ); -} - -const mapDispatchToProps = { - push, - deleteAlbum -}; - -class DeleteAlbumModalContentConnector extends Component { - - // - // Listeners - - onDeletePress = (deleteFiles, addImportListExclusion) => { - this.props.deleteAlbum({ - id: this.props.albumId, - deleteFiles, - addImportListExclusion - }); - - this.props.onModalClose(true); - - this.props.push(`${window.Lidarr.urlBase}/artist/${this.props.foreignArtistId}`); - }; - - // - // Render - - render() { - return ( - - ); - } -} - -DeleteAlbumModalContentConnector.propTypes = { - albumId: PropTypes.number.isRequired, - foreignArtistId: PropTypes.string.isRequired, - push: PropTypes.func.isRequired, - onModalClose: PropTypes.func.isRequired, - deleteAlbum: PropTypes.func.isRequired -}; - -export default connect(createMapStateToProps, mapDispatchToProps)(DeleteAlbumModalContentConnector); diff --git a/frontend/src/Album/Details/AlbumDetails.css b/frontend/src/Album/Details/AlbumDetails.css deleted file mode 100644 index a676ae574..000000000 --- a/frontend/src/Album/Details/AlbumDetails.css +++ /dev/null @@ -1,165 +0,0 @@ -.innerContentBody { - padding: 0; -} - -.header { - position: relative; - width: 100%; - height: 310px; -} - -.backdrop { - position: absolute; - z-index: -1; - width: 100%; - height: 100%; - background-size: cover; -} - -.backdropOverlay { - position: absolute; - width: 100%; - height: 100%; - background: var(--black); - opacity: 0.7; -} - -.headerContent { - display: flex; - padding: 30px; - width: 100%; - height: 100%; - color: var(--white); -} - -.cover { - flex-shrink: 0; - margin-right: 35px; - width: 250px; - height: 250px; -} - -.info { - display: flex; - flex-direction: column; - flex-grow: 1; - overflow: hidden; -} - -.titleRow { - position: relative; - display: flex; - justify-content: space-between; - flex: 0 0 auto; -} - -.titleContainer { - display: flex; - margin-bottom: 5px; -} - -.title { - font-weight: 300; - font-size: 50px; - line-height: 50px; -} - -.toggleMonitoredContainer { - align-self: center; - margin-right: 10px; -} - -.monitorToggleButton { - composes: toggleButton from '~Components/MonitorToggleButton.css'; - - width: 40px; - - &:hover { - color: var(--iconButtonHoverLightColor); - } -} - -.alternateTitlesIconContainer { - align-self: flex-end; - margin-left: 20px; -} - -.albumNavigationButtons { - position: absolute; - right: 0; - white-space: nowrap; -} - -.albumNavigationButton { - composes: button from '~Components/Link/IconButton.css'; - - margin-left: 5px; - width: 30px; - color: #e1e2e3; - white-space: nowrap; - - &:hover { - color: var(--iconButtonHoverLightColor); - } -} - -.details { - margin-bottom: 8px; - font-weight: 300; - font-size: 20px; -} - -.duration { - margin-right: 15px; -} - -.detailsLabel { - composes: label from '~Components/Label.css'; - - margin: 5px 10px 5px 0; -} - -.releaseDate, -.sizeOnDisk, -.albumType, -.secondaryTypes, -.qualityProfileName, -.links, -.tags { - margin-left: 8px; - font-weight: 300; - font-size: 17px; -} - -.overview { - flex: 1 0 auto; - margin-top: 8px; - min-height: 0; - font-size: $intermediateFontSize; -} - -.contentContainer { - padding: 20px; -} - -@media only screen and (max-width: $breakpointSmall) { - .contentContainer { - padding: 20px 0; - } - - .headerContent { - padding: 15px; - } - - .title { - font-weight: 300; - font-size: 30px; - line-height: 30px; - } -} - -@media only screen and (max-width: $breakpointLarge) { - .cover { - display: none; - } -} diff --git a/frontend/src/Album/Details/AlbumDetails.css.d.ts b/frontend/src/Album/Details/AlbumDetails.css.d.ts deleted file mode 100644 index 1d14a0ccf..000000000 --- a/frontend/src/Album/Details/AlbumDetails.css.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'albumNavigationButton': string; - 'albumNavigationButtons': string; - 'albumType': string; - 'alternateTitlesIconContainer': string; - 'backdrop': string; - 'backdropOverlay': string; - 'contentContainer': string; - 'cover': string; - 'details': string; - 'detailsLabel': string; - 'duration': string; - 'header': string; - 'headerContent': string; - 'info': string; - 'innerContentBody': string; - 'links': string; - 'monitorToggleButton': string; - 'overview': string; - 'qualityProfileName': string; - 'releaseDate': string; - 'secondaryTypes': string; - 'sizeOnDisk': string; - 'tags': string; - 'title': string; - 'titleContainer': string; - 'titleRow': string; - 'toggleMonitoredContainer': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Album/Details/AlbumDetails.js b/frontend/src/Album/Details/AlbumDetails.js deleted file mode 100644 index fe007e168..000000000 --- a/frontend/src/Album/Details/AlbumDetails.js +++ /dev/null @@ -1,711 +0,0 @@ -import _ from 'lodash'; -import moment from 'moment'; -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import TextTruncate from 'react-text-truncate'; -import AlbumCover from 'Album/AlbumCover'; -import DeleteAlbumModal from 'Album/Delete/DeleteAlbumModal'; -import EditAlbumModalConnector from 'Album/Edit/EditAlbumModalConnector'; -import AlbumInteractiveSearchModalConnector from 'Album/Search/AlbumInteractiveSearchModalConnector'; -import ArtistGenres from 'Artist/Details/ArtistGenres'; -import ArtistHistoryModal from 'Artist/History/ArtistHistoryModal'; -import Alert from 'Components/Alert'; -import HeartRating from 'Components/HeartRating'; -import Icon from 'Components/Icon'; -import Label from 'Components/Label'; -import IconButton from 'Components/Link/IconButton'; -import LoadingIndicator from 'Components/Loading/LoadingIndicator'; -import MonitorToggleButton from 'Components/MonitorToggleButton'; -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 Tooltip from 'Components/Tooltip/Tooltip'; -import { align, icons, kinds, sizes, tooltipPositions } from 'Helpers/Props'; -import OrganizePreviewModalConnector from 'Organize/OrganizePreviewModalConnector'; -import RetagPreviewModalConnector from 'Retag/RetagPreviewModalConnector'; -import fonts from 'Styles/Variables/fonts'; -import TrackFileEditorModal from 'TrackFile/Editor/TrackFileEditorModal'; -import formatBytes from 'Utilities/Number/formatBytes'; -import translate from 'Utilities/String/translate'; -import selectAll from 'Utilities/Table/selectAll'; -import toggleSelected from 'Utilities/Table/toggleSelected'; -import AlbumDetailsLinks from './AlbumDetailsLinks'; -import AlbumDetailsMediumConnector from './AlbumDetailsMediumConnector'; -import styles from './AlbumDetails.css'; - -const intermediateFontSize = parseInt(fonts.intermediateFontSize); -const lineHeight = parseFloat(fonts.lineHeight); - -function getFanartUrl(images) { - return _.find(images, { coverType: 'fanart' })?.url; -} - -function formatDuration(timeSpan) { - const duration = moment.duration(timeSpan); - const hours = duration.get('hours'); - const minutes = duration.get('minutes'); - let hoursText = 'Hours'; - let minText = 'Minutes'; - - if (minutes === 1) { - minText = 'Minute'; - } - - if (hours === 0) { - return `${minutes} ${minText}`; - } - - if (hours === 1) { - hoursText = 'Hour'; - } - - return `${hours} ${hoursText} ${minutes} ${minText}`; -} - -function getExpandedState(newState) { - return { - allExpanded: newState.allSelected, - allCollapsed: newState.allUnselected, - expandedState: newState.selectedState - }; -} - -class AlbumDetails extends Component { - - // - // Lifecycle - - constructor(props, context) { - super(props, context); - - this.state = { - isOrganizeModalOpen: false, - isRetagModalOpen: false, - isArtistHistoryModalOpen: false, - isInteractiveSearchModalOpen: false, - isManageTracksOpen: false, - isEditAlbumModalOpen: false, - isDeleteAlbumModalOpen: false, - allExpanded: false, - allCollapsed: false, - expandedState: {} - }; - } - - // - // Listeners - - onOrganizePress = () => { - this.setState({ isOrganizeModalOpen: true }); - }; - - onOrganizeModalClose = () => { - this.setState({ isOrganizeModalOpen: false }); - }; - - onRetagPress = () => { - this.setState({ isRetagModalOpen: true }); - }; - - onRetagModalClose = () => { - this.setState({ isRetagModalOpen: false }); - }; - - onEditAlbumPress = () => { - this.setState({ isEditAlbumModalOpen: true }); - }; - - onEditAlbumModalClose = () => { - this.setState({ isEditAlbumModalOpen: false }); - }; - - onDeleteAlbumPress = () => { - this.setState({ - isEditAlbumModalOpen: false, - isDeleteAlbumModalOpen: true - }); - }; - - onDeleteAlbumModalClose = () => { - this.setState({ isDeleteAlbumModalOpen: false }); - }; - - onManageTracksPress = () => { - this.setState({ isManageTracksOpen: true }); - }; - - onManageTracksModalClose = () => { - this.setState({ isManageTracksOpen: false }); - }; - - onInteractiveSearchPress = () => { - this.setState({ isInteractiveSearchModalOpen: true }); - }; - - onInteractiveSearchModalClose = () => { - this.setState({ isInteractiveSearchModalOpen: false }); - }; - - onArtistHistoryPress = () => { - this.setState({ isArtistHistoryModalOpen: true }); - }; - - onArtistHistoryModalClose = () => { - this.setState({ isArtistHistoryModalOpen: false }); - }; - - onExpandAllPress = () => { - const { - allExpanded, - expandedState - } = this.state; - - this.setState(getExpandedState(selectAll(expandedState, !allExpanded))); - }; - - onExpandPress = (albumId, isExpanded) => { - this.setState((state) => { - const convertedState = { - allSelected: state.allExpanded, - allUnselected: state.allCollapsed, - selectedState: state.expandedState - }; - - const newState = toggleSelected(convertedState, [], albumId, isExpanded, false); - - return getExpandedState(newState); - }); - }; - - // - // Render - - render() { - const { - id, - foreignAlbumId, - title, - disambiguation, - duration, - overview, - albumType, - secondaryTypes, - statistics = {}, - monitored, - releaseDate, - ratings, - images, - genres, - links, - media, - isSaving, - isFetching, - isPopulated, - albumsError, - tracksError, - trackFilesError, - hasTrackFiles, - shortDateFormat, - artist, - previousAlbum, - nextAlbum, - isSearching, - onMonitorTogglePress, - onSearchPress - } = this.props; - - const { - trackFileCount = 0, - sizeOnDisk = 0 - } = statistics; - - const { - isOrganizeModalOpen, - isRetagModalOpen, - isArtistHistoryModalOpen, - isInteractiveSearchModalOpen, - isEditAlbumModalOpen, - isDeleteAlbumModalOpen, - isManageTracksOpen, - allExpanded, - allCollapsed, - expandedState - } = this.state; - - const fanartUrl = getFanartUrl(artist.images); - - let expandIcon = icons.EXPAND_INDETERMINATE; - let trackFilesCountMessage = translate('TrackFilesCountMessage'); - - if (trackFileCount === 1) { - trackFilesCountMessage = '1 track file'; - } else if (trackFileCount > 1) { - trackFilesCountMessage = `${trackFileCount} track files`; - } - - if (allExpanded) { - expandIcon = icons.COLLAPSE; - } else if (allCollapsed) { - expandIcon = icons.EXPAND; - } - - return ( - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
- -
- - -
-
-
- -
- -
- -
- -
-
- -
- - - - - -
-
- -
-
- { - duration ? - - {formatDuration(duration)} - : - null - } - - - - -
-
- -
- - - - -
- - - {formatBytes(sizeOnDisk)} - -
- - } - tooltip={ - - {trackFilesCountMessage} - - } - kind={kinds.INVERSE} - position={tooltipPositions.BOTTOM} - /> - - - - { - albumType ? - : - null - } - - { - secondaryTypes.length ? - : - null - } - - -
- - - {translate('Links')} - -
- - } - tooltip={ - - } - kind={kinds.INVERSE} - position={tooltipPositions.BOTTOM} - /> - -
-
- -
-
-
-
- -
- { - !isPopulated && !albumsError && !tracksError && !trackFilesError ? - : - null - } - - { - !isFetching && albumsError ? - - {translate('AlbumsLoadError')} - : - null - } - - { - !isFetching && tracksError ? - - {translate('TracksLoadError')} - : - null - } - - { - !isFetching && trackFilesError ? - - {translate('TrackFilesLoadError')} - : - null - } - - { - isPopulated && !!media.length && -
- { - media.slice(0).map((medium) => { - return ( - - ); - }) - } -
- } - - { - isPopulated && !media.length ? - - {translate('NoMediumInformation')} - : - null - } - -
- - - - - - - - - - - - - - - - - - ); - } -} - -AlbumDetails.propTypes = { - id: PropTypes.number.isRequired, - foreignAlbumId: PropTypes.string.isRequired, - title: PropTypes.string.isRequired, - disambiguation: PropTypes.string, - duration: PropTypes.number, - overview: PropTypes.string, - albumType: PropTypes.string.isRequired, - secondaryTypes: PropTypes.arrayOf(PropTypes.string).isRequired, - statistics: PropTypes.object.isRequired, - releaseDate: PropTypes.string.isRequired, - ratings: PropTypes.object.isRequired, - images: PropTypes.arrayOf(PropTypes.object).isRequired, - genres: PropTypes.arrayOf(PropTypes.string).isRequired, - links: PropTypes.arrayOf(PropTypes.object).isRequired, - media: PropTypes.arrayOf(PropTypes.object).isRequired, - monitored: PropTypes.bool.isRequired, - shortDateFormat: PropTypes.string.isRequired, - isSaving: PropTypes.bool.isRequired, - isSearching: PropTypes.bool, - isFetching: PropTypes.bool, - isPopulated: PropTypes.bool, - albumsError: PropTypes.object, - tracksError: PropTypes.object, - trackFilesError: PropTypes.object, - hasTrackFiles: PropTypes.bool.isRequired, - artist: PropTypes.object, - previousAlbum: PropTypes.object, - nextAlbum: PropTypes.object, - onMonitorTogglePress: PropTypes.func.isRequired, - onRefreshPress: PropTypes.func, - onSearchPress: PropTypes.func.isRequired -}; - -AlbumDetails.defaultProps = { - secondaryTypes: [], - statistics: {}, - isSaving: false -}; - -export default AlbumDetails; diff --git a/frontend/src/Album/Details/AlbumDetailsConnector.js b/frontend/src/Album/Details/AlbumDetailsConnector.js deleted file mode 100644 index 7a5dbc95e..000000000 --- a/frontend/src/Album/Details/AlbumDetailsConnector.js +++ /dev/null @@ -1,217 +0,0 @@ -/* eslint max-params: 0 */ -import _ from 'lodash'; -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 { toggleAlbumsMonitored } from 'Store/Actions/albumActions'; -import { executeCommand } from 'Store/Actions/commandActions'; -import { clearTracks, fetchTracks } from 'Store/Actions/trackActions'; -import { clearTrackFiles, fetchTrackFiles } from 'Store/Actions/trackFileActions'; -import createAllArtistSelector from 'Store/Selectors/createAllArtistSelector'; -import createCommandsSelector from 'Store/Selectors/createCommandsSelector'; -import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector'; -import { findCommand, isCommandExecuting } from 'Utilities/Command'; -import { registerPagePopulator, unregisterPagePopulator } from 'Utilities/pagePopulator'; -import AlbumDetails from './AlbumDetails'; - -const selectTrackFiles = createSelector( - (state) => state.trackFiles, - (trackFiles) => { - const { - items, - isFetching, - isPopulated, - error - } = trackFiles; - - const hasTrackFiles = !!items.length; - - return { - isTrackFilesFetching: isFetching, - isTrackFilesPopulated: isPopulated, - trackFilesError: error, - hasTrackFiles - }; - } -); - -function createMapStateToProps() { - return createSelector( - (state, { foreignAlbumId }) => foreignAlbumId, - (state) => state.tracks, - selectTrackFiles, - (state) => state.albums, - createAllArtistSelector(), - createCommandsSelector(), - createUISettingsSelector(), - (foreignAlbumId, tracks, trackFiles, albums, artists, commands, uiSettings) => { - const sortedAlbums = _.orderBy(albums.items, 'releaseDate'); - const albumIndex = _.findIndex(sortedAlbums, { foreignAlbumId }); - const album = sortedAlbums[albumIndex]; - const artist = _.find(artists, { id: album.artistId }); - - if (!album) { - return {}; - } - - const { - isTrackFilesFetching, - isTrackFilesPopulated, - trackFilesError, - hasTrackFiles - } = trackFiles; - - const previousAlbum = sortedAlbums[albumIndex - 1] || _.last(sortedAlbums); - const nextAlbum = sortedAlbums[albumIndex + 1] || _.first(sortedAlbums); - const isSearchingCommand = findCommand(commands, { name: commandNames.ALBUM_SEARCH }); - const isSearching = ( - isCommandExecuting(isSearchingCommand) && - isSearchingCommand.body.albumIds.indexOf(album.id) > -1 - ); - const isRenamingFiles = isCommandExecuting(findCommand(commands, { name: commandNames.RENAME_FILES, artistId: artist.id })); - const isRenamingArtistCommand = findCommand(commands, { name: commandNames.RENAME_ARTIST }); - const isRenamingArtist = ( - isCommandExecuting(isRenamingArtistCommand) && - isRenamingArtistCommand.body.artistIds.indexOf(artist.id) > -1 - ); - - const isFetching = tracks.isFetching || isTrackFilesFetching; - const isPopulated = tracks.isPopulated && isTrackFilesPopulated; - const tracksError = tracks.error; - - return { - ...album, - shortDateFormat: uiSettings.shortDateFormat, - artist, - isSearching, - isRenamingFiles, - isRenamingArtist, - isFetching, - isPopulated, - tracksError, - trackFilesError, - hasTrackFiles, - previousAlbum, - nextAlbum - }; - } - ); -} - -const mapDispatchToProps = { - executeCommand, - fetchTracks, - clearTracks, - fetchTrackFiles, - clearTrackFiles, - toggleAlbumsMonitored -}; - -function getMonitoredReleases(props) { - return _.map(_.filter(props.releases, { monitored: true }), 'id').sort(); -} - -class AlbumDetailsConnector extends Component { - - componentDidMount() { - registerPagePopulator(this.populate); - this.populate(); - } - - componentDidUpdate(prevProps) { - const { - id, - anyReleaseOk, - isRenamingFiles, - isRenamingArtist - } = this.props; - - if ( - (prevProps.isRenamingFiles && !isRenamingFiles) || - (prevProps.isRenamingArtist && !isRenamingArtist) || - !_.isEqual(getMonitoredReleases(prevProps), getMonitoredReleases(this.props)) || - (prevProps.anyReleaseOk === false && anyReleaseOk === true) - ) { - this.unpopulate(); - this.populate(); - } - - // If the id has changed we need to clear the album - // files and fetch from the server. - - if (prevProps.id !== id) { - this.unpopulate(); - this.populate(); - } - } - - componentWillUnmount() { - unregisterPagePopulator(this.populate); - this.unpopulate(); - } - - // - // Control - - populate = () => { - const albumId = this.props.id; - - this.props.fetchTracks({ albumId }); - this.props.fetchTrackFiles({ albumId }); - }; - - unpopulate = () => { - this.props.clearTracks(); - this.props.clearTrackFiles(); - }; - - // - // Listeners - - onMonitorTogglePress = (monitored) => { - this.props.toggleAlbumsMonitored({ - albumIds: [this.props.id], - monitored - }); - }; - - onSearchPress = () => { - this.props.executeCommand({ - name: commandNames.ALBUM_SEARCH, - albumIds: [this.props.id] - }); - }; - - // - // Render - - render() { - return ( - - ); - } -} - -AlbumDetailsConnector.propTypes = { - id: PropTypes.number, - anyReleaseOk: PropTypes.bool, - isRenamingFiles: PropTypes.bool.isRequired, - isRenamingArtist: PropTypes.bool.isRequired, - isAlbumFetching: PropTypes.bool, - isAlbumPopulated: PropTypes.bool, - foreignAlbumId: PropTypes.string.isRequired, - fetchTracks: PropTypes.func.isRequired, - clearTracks: PropTypes.func.isRequired, - fetchTrackFiles: PropTypes.func.isRequired, - clearTrackFiles: PropTypes.func.isRequired, - toggleAlbumsMonitored: PropTypes.func.isRequired, - executeCommand: PropTypes.func.isRequired -}; - -export default connect(createMapStateToProps, mapDispatchToProps)(AlbumDetailsConnector); diff --git a/frontend/src/Album/Details/AlbumDetailsLinks.css b/frontend/src/Album/Details/AlbumDetailsLinks.css deleted file mode 100644 index d37a082a1..000000000 --- a/frontend/src/Album/Details/AlbumDetailsLinks.css +++ /dev/null @@ -1,13 +0,0 @@ -.links { - margin: 0; -} - -.link { - white-space: nowrap; -} - -.linkLabel { - composes: label from '~Components/Label.css'; - - cursor: pointer; -} diff --git a/frontend/src/Album/Details/AlbumDetailsLinks.css.d.ts b/frontend/src/Album/Details/AlbumDetailsLinks.css.d.ts deleted file mode 100644 index 9f91f93a4..000000000 --- a/frontend/src/Album/Details/AlbumDetailsLinks.css.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'link': string; - 'linkLabel': string; - 'links': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Album/Details/AlbumDetailsLinks.js b/frontend/src/Album/Details/AlbumDetailsLinks.js deleted file mode 100644 index 241836bd4..000000000 --- a/frontend/src/Album/Details/AlbumDetailsLinks.js +++ /dev/null @@ -1,63 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import Label from 'Components/Label'; -import Link from 'Components/Link/Link'; -import { kinds, sizes } from 'Helpers/Props'; -import styles from './AlbumDetailsLinks.css'; - -function AlbumDetailsLinks(props) { - const { - foreignAlbumId, - links - } = props; - - return ( -
- - - - - - {links.map((link, index) => { - return ( - - - - - {(index > 0 && index % 5 === 0) && -
- } - -
- ); - })} - -
- - ); -} - -AlbumDetailsLinks.propTypes = { - foreignAlbumId: PropTypes.string.isRequired, - links: PropTypes.arrayOf(PropTypes.object).isRequired -}; - -export default AlbumDetailsLinks; diff --git a/frontend/src/Album/Details/AlbumDetailsMedium.css b/frontend/src/Album/Details/AlbumDetailsMedium.css deleted file mode 100644 index 2bf1f6b1e..000000000 --- a/frontend/src/Album/Details/AlbumDetailsMedium.css +++ /dev/null @@ -1,114 +0,0 @@ -.medium { - margin-bottom: 20px; - border: 1px solid var(--borderColor); - border-radius: 4px; - background-color: var(--cardBackgroundColor); - - &:last-of-type { - margin-bottom: 0; - } -} - -.header { - position: relative; - display: flex; - align-items: center; - width: 100%; - font-size: 24px; -} - -.mediumNumber { - margin-right: 10px; - margin-left: 5px; -} - -.mediumFormat { - color: #8895aa; - font-style: italic; - font-size: 18px; -} - -.expandButton { - composes: link from '~Components/Link/Link.css'; - - flex-grow: 1; - margin: 0 20px; - text-align: center; -} - -.left { - display: flex; - align-items: center; - flex: 0 1 300px; -} - -.left, -.actions { - padding: 15px 10px; -} - -.actionsMenu { - composes: menu from '~Components/Menu/Menu.css'; - - flex: 0 0 45px; -} - -.actionsMenuContent { - composes: menuContent from '~Components/Menu/MenuContent.css'; - - white-space: nowrap; - font-size: 14px; -} - -.actionMenuIcon { - margin-right: 8px; -} - -.actionButton { - composes: button from '~Components/Link/IconButton.css'; - - width: 30px; -} - -.tracks { - padding-top: 15px; - border-top: 1px solid var(--borderColor); -} - -.collapseButtonContainer { - padding: 10px 15px; - width: 100%; - border-top: 1px solid var(--borderColor); - border-bottom-right-radius: 4px; - border-bottom-left-radius: 4px; - background-color: var(--cardBackgroundColor); - text-align: center; -} - -.expandButtonIcon { - composes: actionButton; - - position: absolute; - top: 50%; - left: 50%; - margin-top: -12px; - margin-left: -15px; -} - -.noTracks { - margin-bottom: 15px; - text-align: center; -} - -@media only screen and (max-width: $breakpointSmall) { - .medium { - border-right: 0; - border-left: 0; - border-radius: 0; - } - - .expandButtonIcon { - position: static; - margin: 0; - } -} diff --git a/frontend/src/Album/Details/AlbumDetailsMedium.css.d.ts b/frontend/src/Album/Details/AlbumDetailsMedium.css.d.ts deleted file mode 100644 index 94964280a..000000000 --- a/frontend/src/Album/Details/AlbumDetailsMedium.css.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'actionButton': string; - 'actionMenuIcon': string; - 'actions': string; - 'actionsMenu': string; - 'actionsMenuContent': string; - 'collapseButtonContainer': string; - 'expandButton': string; - 'expandButtonIcon': string; - 'header': string; - 'left': string; - 'medium': string; - 'mediumFormat': string; - 'mediumNumber': string; - 'noTracks': string; - 'tracks': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Album/Details/AlbumDetailsMedium.js b/frontend/src/Album/Details/AlbumDetailsMedium.js deleted file mode 100644 index 9e80e2c7a..000000000 --- a/frontend/src/Album/Details/AlbumDetailsMedium.js +++ /dev/null @@ -1,208 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import Icon from 'Components/Icon'; -import Label from 'Components/Label'; -import IconButton from 'Components/Link/IconButton'; -import Link from 'Components/Link/Link'; -import Table from 'Components/Table/Table'; -import TableBody from 'Components/Table/TableBody'; -import { icons, kinds, sizes } from 'Helpers/Props'; -import translate from 'Utilities/String/translate'; -import TrackRowConnector from './TrackRowConnector'; -import styles from './AlbumDetailsMedium.css'; - -function getMediumStatistics(tracks) { - const trackCount = tracks.length; - let trackFileCount = 0; - let totalTrackCount = 0; - - tracks.forEach((track) => { - if (track.trackFileId) { - trackFileCount++; - } - - totalTrackCount++; - }); - - return { - trackCount, - trackFileCount, - totalTrackCount - }; -} - -function getTrackCountKind(monitored, trackFileCount, trackCount) { - if (trackFileCount === trackCount && trackCount > 0) { - return kinds.SUCCESS; - } - - if (!monitored) { - return kinds.WARNING; - } - - return kinds.DANGER; -} - -class AlbumDetailsMedium extends Component { - - // - // Lifecycle - - componentDidMount() { - this._expandByDefault(); - } - - componentDidUpdate(prevProps) { - if (prevProps.albumId !== this.props.albumId) { - this._expandByDefault(); - } - } - - // - // Control - - _expandByDefault() { - const { - mediumNumber, - onExpandPress - } = this.props; - - onExpandPress(mediumNumber, mediumNumber === 1); - } - - // - // Listeners - - onExpandPress = () => { - const { - mediumNumber, - isExpanded - } = this.props; - - this.props.onExpandPress(mediumNumber, !isExpanded); - }; - - // - // Render - - render() { - const { - mediumNumber, - mediumFormat, - albumMonitored, - items, - columns, - onTableOptionChange, - isExpanded, - isSmallScreen - } = this.props; - - const { - trackCount, - trackFileCount, - totalTrackCount - } = getMediumStatistics(items); - - return ( -
-
-
- { -
- - {mediumFormat} {mediumNumber} - -
- } - - -
- - - - { - !isSmallScreen && -   - } - - -
- -
- { - isExpanded && -
- { - items.length ? - - - { - items.map((item) => { - return ( - - ); - }) - } - -
: - -
- {translate('NoTracksInThisMedium')} -
- } -
- -
-
- } -
-
- ); - } -} - -AlbumDetailsMedium.propTypes = { - albumId: PropTypes.number.isRequired, - albumMonitored: PropTypes.bool.isRequired, - mediumNumber: PropTypes.number.isRequired, - mediumFormat: PropTypes.string.isRequired, - items: PropTypes.arrayOf(PropTypes.object).isRequired, - columns: PropTypes.arrayOf(PropTypes.object).isRequired, - isSaving: PropTypes.bool, - isExpanded: PropTypes.bool, - isSmallScreen: PropTypes.bool.isRequired, - onTableOptionChange: PropTypes.func.isRequired, - onExpandPress: PropTypes.func.isRequired -}; - -export default AlbumDetailsMedium; diff --git a/frontend/src/Album/Details/AlbumDetailsMediumConnector.js b/frontend/src/Album/Details/AlbumDetailsMediumConnector.js deleted file mode 100644 index 17c6969e3..000000000 --- a/frontend/src/Album/Details/AlbumDetailsMediumConnector.js +++ /dev/null @@ -1,65 +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 { executeCommand } from 'Store/Actions/commandActions'; -import { setTracksTableOption } from 'Store/Actions/trackActions'; -import createDimensionsSelector from 'Store/Selectors/createDimensionsSelector'; -import AlbumDetailsMedium from './AlbumDetailsMedium'; - -function createMapStateToProps() { - return createSelector( - (state, { mediumNumber }) => mediumNumber, - (state) => state.tracks, - createDimensionsSelector(), - (mediumNumber, tracks, dimensions) => { - - const tracksInMedium = _.filter(tracks.items, { mediumNumber }); - const sortedTracks = _.orderBy(tracksInMedium, ['absoluteTrackNumber'], ['asc']); - - return { - items: sortedTracks, - columns: tracks.columns, - isSmallScreen: dimensions.isSmallScreen - }; - } - ); -} - -const mapDispatchToProps = { - setTracksTableOption, - executeCommand -}; - -class AlbumDetailsMediumConnector extends Component { - - // - // Listeners - - onTableOptionChange = (payload) => { - this.props.setTracksTableOption(payload); - }; - - // - // Render - - render() { - return ( - - ); - } -} - -AlbumDetailsMediumConnector.propTypes = { - albumId: PropTypes.number.isRequired, - albumMonitored: PropTypes.bool.isRequired, - mediumNumber: PropTypes.number.isRequired, - setTracksTableOption: PropTypes.func.isRequired, - executeCommand: PropTypes.func.isRequired -}; - -export default connect(createMapStateToProps, mapDispatchToProps)(AlbumDetailsMediumConnector); diff --git a/frontend/src/Album/Details/AlbumDetailsPageConnector.js b/frontend/src/Album/Details/AlbumDetailsPageConnector.js deleted file mode 100644 index ad0cdbdb7..000000000 --- a/frontend/src/Album/Details/AlbumDetailsPageConnector.js +++ /dev/null @@ -1,134 +0,0 @@ -import { push } from 'connected-react-router'; -import _ from 'lodash'; -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import { connect } from 'react-redux'; -import { createSelector } from 'reselect'; -import LoadingIndicator from 'Components/Loading/LoadingIndicator'; -import NotFound from 'Components/NotFound'; -import PageContent from 'Components/Page/PageContent'; -import PageContentBody from 'Components/Page/PageContentBody'; -import { clearAlbums, fetchAlbums } from 'Store/Actions/albumActions'; -import translate from 'Utilities/String/translate'; -import AlbumDetailsConnector from './AlbumDetailsConnector'; - -function createMapStateToProps() { - return createSelector( - (state, { match }) => match, - (state) => state.albums, - (state) => state.artist, - (match, albums, artist) => { - const foreignAlbumId = match.params.foreignAlbumId; - const isFetching = albums.isFetching || artist.isFetching; - const isPopulated = albums.isPopulated && artist.isPopulated; - - // if albums have been fetched, make sure requested one exists - // otherwise don't map foreignAlbumId to trigger not found page - if (!isFetching && isPopulated) { - const albumIndex = _.findIndex(albums.items, { foreignAlbumId }); - if (albumIndex === -1) { - return { - isFetching, - isPopulated - }; - } - } - - return { - foreignAlbumId, - isFetching, - isPopulated - }; - } - ); -} - -const mapDispatchToProps = { - push, - fetchAlbums, - clearAlbums -}; - -class AlbumDetailsPageConnector extends Component { - - constructor(props) { - super(props); - this.state = { hasMounted: false }; - } - // - // Lifecycle - - componentDidMount() { - this.populate(); - } - - componentWillUnmount() { - this.unpopulate(); - } - - // - // Control - - populate = () => { - const foreignAlbumId = this.props.foreignAlbumId; - this.setState({ hasMounted: true }); - this.props.fetchAlbums({ - foreignAlbumId, - includeAllArtistAlbums: true - }); - }; - - unpopulate = () => { - this.props.clearAlbums(); - }; - - // - // Render - - render() { - const { - foreignAlbumId, - isFetching, - isPopulated - } = this.props; - - if (!foreignAlbumId) { - return ( - - ); - } - - if ((isFetching || !this.state.hasMounted) || - (!isFetching && !isPopulated)) { - return ( - - - - - - ); - } - - if (!isFetching && isPopulated && this.state.hasMounted) { - return ( - - ); - } - } -} - -AlbumDetailsPageConnector.propTypes = { - foreignAlbumId: PropTypes.string, - match: PropTypes.shape({ params: PropTypes.shape({ foreignAlbumId: PropTypes.string.isRequired }).isRequired }).isRequired, - push: PropTypes.func.isRequired, - fetchAlbums: PropTypes.func.isRequired, - clearAlbums: PropTypes.func.isRequired, - isFetching: PropTypes.bool.isRequired, - isPopulated: PropTypes.bool.isRequired -}; - -export default connect(createMapStateToProps, mapDispatchToProps)(AlbumDetailsPageConnector); diff --git a/frontend/src/Album/Details/TrackActionsCell.css b/frontend/src/Album/Details/TrackActionsCell.css deleted file mode 100644 index 6b80ba0e0..000000000 --- a/frontend/src/Album/Details/TrackActionsCell.css +++ /dev/null @@ -1,6 +0,0 @@ -.TrackActionsCell { - composes: cell from '~Components/Table/Cells/TableRowCell.css'; - - width: 70px; - white-space: nowrap; -} diff --git a/frontend/src/Album/Details/TrackActionsCell.css.d.ts b/frontend/src/Album/Details/TrackActionsCell.css.d.ts deleted file mode 100644 index 0f432ca4c..000000000 --- a/frontend/src/Album/Details/TrackActionsCell.css.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'TrackActionsCell': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Album/Details/TrackActionsCell.js b/frontend/src/Album/Details/TrackActionsCell.js deleted file mode 100644 index 8e2a2ade4..000000000 --- a/frontend/src/Album/Details/TrackActionsCell.js +++ /dev/null @@ -1,110 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import IconButton from 'Components/Link/IconButton'; -import ConfirmModal from 'Components/Modal/ConfirmModal'; -import TableRowCell from 'Components/Table/Cells/TableRowCell'; -import { icons, kinds } from 'Helpers/Props'; -import FileDetailsModal from 'TrackFile/FileDetailsModal'; -import translate from 'Utilities/String/translate'; -import styles from './TrackActionsCell.css'; - -class TrackActionsCell extends Component { - - // - // Lifecycle - - constructor(props, context) { - super(props, context); - - this.state = { - isDetailsModalOpen: false, - isConfirmDeleteModalOpen: false - }; - } - - // - // Listeners - - onDetailsPress = () => { - this.setState({ isDetailsModalOpen: true }); - }; - - onDetailsModalClose = () => { - this.setState({ isDetailsModalOpen: false }); - }; - - onDeleteFilePress = () => { - this.setState({ isConfirmDeleteModalOpen: true }); - }; - - onConfirmDelete = () => { - this.setState({ isConfirmDeleteModalOpen: false }); - this.props.deleteTrackFile({ id: this.props.trackFileId }); - }; - - onConfirmDeleteModalClose = () => { - this.setState({ isConfirmDeleteModalOpen: false }); - }; - - // - // Render - - render() { - - const { - trackFileId, - trackFilePath - } = this.props; - - const { - isDetailsModalOpen, - isConfirmDeleteModalOpen - } = this.state; - - return ( - - { - trackFilePath && - - } - { - trackFilePath && - - } - - - - - - - ); - } -} - -TrackActionsCell.propTypes = { - id: PropTypes.number.isRequired, - albumId: PropTypes.number.isRequired, - trackFilePath: PropTypes.string, - trackFileId: PropTypes.number.isRequired, - deleteTrackFile: PropTypes.func.isRequired -}; - -export default TrackActionsCell; diff --git a/frontend/src/Album/Details/TrackRow.css b/frontend/src/Album/Details/TrackRow.css deleted file mode 100644 index 912c00101..000000000 --- a/frontend/src/Album/Details/TrackRow.css +++ /dev/null @@ -1,43 +0,0 @@ -.title { - composes: cell from '~Components/Table/Cells/TableRowCell.css'; - - white-space: nowrap; -} - -.monitored { - composes: cell from '~Components/Table/Cells/TableRowCell.css'; - - width: 42px; -} - -.trackNumber { - composes: cell from '~Components/Table/Cells/TableRowCell.css'; - - width: 50px; -} - -.audio { - composes: cell from '~Components/Table/Cells/TableRowCell.css'; - - width: 300px; -} - -.duration, -.size, -.status { - composes: cell from '~Components/Table/Cells/TableRowCell.css'; - - width: 100px; -} - -.customFormatScore { - composes: cell from '~Components/Table/Cells/TableRowCell.css'; - - width: 55px; -} - -.indexerFlags { - composes: cell from '~Components/Table/Cells/TableRowCell.css'; - - width: 50px; -} diff --git a/frontend/src/Album/Details/TrackRow.css.d.ts b/frontend/src/Album/Details/TrackRow.css.d.ts deleted file mode 100644 index 79bbdaf43..000000000 --- a/frontend/src/Album/Details/TrackRow.css.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'audio': string; - 'customFormatScore': string; - 'duration': string; - 'indexerFlags': string; - 'monitored': string; - 'size': string; - 'status': string; - 'title': string; - 'trackNumber': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Album/Details/TrackRow.js b/frontend/src/Album/Details/TrackRow.js deleted file mode 100644 index db128d493..000000000 --- a/frontend/src/Album/Details/TrackRow.js +++ /dev/null @@ -1,244 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import AlbumFormats from 'Album/AlbumFormats'; -import EpisodeStatusConnector from 'Album/EpisodeStatusConnector'; -import IndexerFlags from 'Album/IndexerFlags'; -import Icon from 'Components/Icon'; -import TableRowCell from 'Components/Table/Cells/TableRowCell'; -import TableRow from 'Components/Table/TableRow'; -import Popover from 'Components/Tooltip/Popover'; -import Tooltip from 'Components/Tooltip/Tooltip'; -import { icons, kinds, tooltipPositions } from 'Helpers/Props'; -import MediaInfoConnector from 'TrackFile/MediaInfoConnector'; -import * as mediaInfoTypes from 'TrackFile/mediaInfoTypes'; -import formatTimeSpan from 'Utilities/Date/formatTimeSpan'; -import formatBytes from 'Utilities/Number/formatBytes'; -import formatCustomFormatScore from 'Utilities/Number/formatCustomFormatScore'; -import translate from 'Utilities/String/translate'; -import TrackActionsCell from './TrackActionsCell'; -import styles from './TrackRow.css'; - -class TrackRow extends Component { - - // - // Render - - render() { - const { - id, - albumId, - mediumNumber, - trackFileId, - absoluteTrackNumber, - title, - duration, - trackFilePath, - trackFileSize, - customFormats, - customFormatScore, - indexerFlags, - columns, - deleteTrackFile - } = this.props; - - return ( - - { - columns.map((column) => { - const { - name, - isVisible - } = column; - - if (!isVisible) { - return null; - } - - if (name === 'medium') { - return ( - - {mediumNumber} - - ); - } - - if (name === 'absoluteTrackNumber') { - return ( - - {absoluteTrackNumber} - - ); - } - - if (name === 'title') { - return ( - - {title} - - ); - } - - if (name === 'path') { - return ( - - { - trackFilePath - } - - ); - } - - if (name === 'duration') { - return ( - - { - formatTimeSpan(duration) - } - - ); - } - - if (name === 'audioInfo') { - return ( - - - - ); - } - - if (name === 'customFormats') { - return ( - - - - ); - } - - if (name === 'customFormatScore') { - return ( - - } - position={tooltipPositions.LEFT} - /> - - ); - } - - if (name === 'indexerFlags') { - return ( - - {indexerFlags ? ( - } - title={translate('IndexerFlags')} - body={} - position={tooltipPositions.LEFT} - /> - ) : null} - - ); - } - - if (name === 'size') { - return ( - - {!!trackFileSize && formatBytes(trackFileSize)} - - ); - } - - if (name === 'status') { - return ( - - - - ); - } - - if (name === 'actions') { - return ( - - ); - } - - return null; - }) - } - - ); - } -} - -TrackRow.propTypes = { - deleteTrackFile: PropTypes.func.isRequired, - id: PropTypes.number.isRequired, - albumId: PropTypes.number.isRequired, - trackFileId: PropTypes.number, - mediumNumber: PropTypes.number.isRequired, - trackNumber: PropTypes.string.isRequired, - absoluteTrackNumber: PropTypes.number, - title: PropTypes.string.isRequired, - duration: PropTypes.number.isRequired, - isSaving: PropTypes.bool, - trackFilePath: PropTypes.string, - trackFileSize: PropTypes.number, - customFormats: PropTypes.arrayOf(PropTypes.object), - customFormatScore: PropTypes.number.isRequired, - indexerFlags: PropTypes.number.isRequired, - mediaInfo: PropTypes.object, - columns: PropTypes.arrayOf(PropTypes.object).isRequired -}; - -TrackRow.defaultProps = { - customFormats: [], - indexerFlags: 0 -}; - -export default TrackRow; diff --git a/frontend/src/Album/Details/TrackRowConnector.js b/frontend/src/Album/Details/TrackRowConnector.js deleted file mode 100644 index 6cb31a527..000000000 --- a/frontend/src/Album/Details/TrackRowConnector.js +++ /dev/null @@ -1,27 +0,0 @@ -import { connect } from 'react-redux'; -import { createSelector } from 'reselect'; -import { deleteTrackFile } from 'Store/Actions/trackFileActions'; -import createTrackFileSelector from 'Store/Selectors/createTrackFileSelector'; -import TrackRow from './TrackRow'; - -function createMapStateToProps() { - return createSelector( - (state, { id }) => id, - createTrackFileSelector(), - (id, trackFile) => { - return { - trackFilePath: trackFile ? trackFile.path : null, - trackFileSize: trackFile ? trackFile.size : null, - customFormats: trackFile ? trackFile.customFormats : [], - customFormatScore: trackFile ? trackFile.customFormatScore : 0, - indexerFlags: trackFile ? trackFile.indexerFlags : 0 - }; - } - ); -} - -const mapDispatchToProps = { - deleteTrackFile -}; - -export default connect(createMapStateToProps, mapDispatchToProps)(TrackRow); diff --git a/frontend/src/Album/Edit/EditAlbumModal.js b/frontend/src/Album/Edit/EditAlbumModal.js deleted file mode 100644 index d47bb284f..000000000 --- a/frontend/src/Album/Edit/EditAlbumModal.js +++ /dev/null @@ -1,25 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import Modal from 'Components/Modal/Modal'; -import EditAlbumModalContentConnector from './EditAlbumModalContentConnector'; - -function EditAlbumModal({ isOpen, onModalClose, ...otherProps }) { - return ( - - - - ); -} - -EditAlbumModal.propTypes = { - isOpen: PropTypes.bool.isRequired, - onModalClose: PropTypes.func.isRequired -}; - -export default EditAlbumModal; diff --git a/frontend/src/Album/Edit/EditAlbumModalConnector.js b/frontend/src/Album/Edit/EditAlbumModalConnector.js deleted file mode 100644 index 2aadcd955..000000000 --- a/frontend/src/Album/Edit/EditAlbumModalConnector.js +++ /dev/null @@ -1,39 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import { connect } from 'react-redux'; -import { clearPendingChanges } from 'Store/Actions/baseActions'; -import EditAlbumModal from './EditAlbumModal'; - -const mapDispatchToProps = { - clearPendingChanges -}; - -class EditAlbumModalConnector extends Component { - - // - // Listeners - - onModalClose = () => { - this.props.clearPendingChanges({ section: 'albums' }); - this.props.onModalClose(); - }; - - // - // Render - - render() { - return ( - - ); - } -} - -EditAlbumModalConnector.propTypes = { - onModalClose: PropTypes.func.isRequired, - clearPendingChanges: PropTypes.func.isRequired -}; - -export default connect(undefined, mapDispatchToProps)(EditAlbumModalConnector); diff --git a/frontend/src/Album/Edit/EditAlbumModalContent.js b/frontend/src/Album/Edit/EditAlbumModalContent.js deleted file mode 100644 index dafc0312d..000000000 --- a/frontend/src/Album/Edit/EditAlbumModalContent.js +++ /dev/null @@ -1,144 +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 FormInputGroup from 'Components/Form/FormInputGroup'; -import FormLabel from 'Components/Form/FormLabel'; -import Button from 'Components/Link/Button'; -import SpinnerButton from 'Components/Link/SpinnerButton'; -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, sizes } from 'Helpers/Props'; -import translate from 'Utilities/String/translate'; - -class EditAlbumModalContent extends Component { - - // - // Listeners - - onSavePress = () => { - const { - onSavePress - } = this.props; - - onSavePress(false); - - }; - - // - // Render - - render() { - const { - title, - artistName, - albumType, - statistics = {}, - item, - isSaving, - onInputChange, - onModalClose, - ...otherProps - } = this.props; - - const { - trackFileCount = 0 - } = statistics; - - const { - monitored, - anyReleaseOk, - releases - } = item; - - return ( - - - Edit - {artistName} - {title} [{albumType}] - - - -
- - - {translate('Monitored')} - - - - - - - - {translate('AutomaticallySwitchRelease')} - - - - - - - - {translate('Release')} - - - 0} - albumReleases={releases} - onChange={onInputChange} - /> - - -
-
- - - - - {translate('Save')} - - - -
- ); - } -} - -EditAlbumModalContent.propTypes = { - albumId: PropTypes.number.isRequired, - title: PropTypes.string.isRequired, - artistName: PropTypes.string.isRequired, - albumType: PropTypes.string.isRequired, - statistics: PropTypes.object.isRequired, - item: PropTypes.object.isRequired, - isSaving: PropTypes.bool.isRequired, - onInputChange: PropTypes.func.isRequired, - onSavePress: PropTypes.func.isRequired, - onModalClose: PropTypes.func.isRequired -}; - -export default EditAlbumModalContent; diff --git a/frontend/src/Album/Edit/EditAlbumModalContentConnector.js b/frontend/src/Album/Edit/EditAlbumModalContentConnector.js deleted file mode 100644 index e9c49bd75..000000000 --- a/frontend/src/Album/Edit/EditAlbumModalContentConnector.js +++ /dev/null @@ -1,98 +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 { saveAlbum, setAlbumValue } from 'Store/Actions/albumActions'; -import createAlbumSelector from 'Store/Selectors/createAlbumSelector'; -import createArtistSelector from 'Store/Selectors/createArtistSelector'; -import selectSettings from 'Store/Selectors/selectSettings'; -import EditAlbumModalContent from './EditAlbumModalContent'; - -function createMapStateToProps() { - return createSelector( - (state) => state.albums, - createAlbumSelector(), - createArtistSelector(), - (albumState, album, artist) => { - const { - isSaving, - saveError, - pendingChanges - } = albumState; - - const albumSettings = _.pick(album, [ - 'monitored', - 'anyReleaseOk', - 'releases' - ]); - - const settings = selectSettings(albumSettings, pendingChanges, saveError); - - return { - title: album.title, - artistName: artist.artistName, - albumType: album.albumType, - statistics: album.statistics, - isSaving, - saveError, - item: settings.settings, - ...settings - }; - } - ); -} - -const mapDispatchToProps = { - dispatchSetAlbumValue: setAlbumValue, - dispatchSaveAlbum: saveAlbum -}; - -class EditAlbumModalContentConnector extends Component { - - // - // Lifecycle - - componentDidUpdate(prevProps, prevState) { - if (prevProps.isSaving && !this.props.isSaving && !this.props.saveError) { - this.props.onModalClose(); - } - } - - // - // Listeners - - onInputChange = ({ name, value }) => { - this.props.dispatchSetAlbumValue({ name, value }); - }; - - onSavePress = () => { - this.props.dispatchSaveAlbum({ - id: this.props.albumId - }); - }; - - // - // Render - - render() { - return ( - - ); - } -} - -EditAlbumModalContentConnector.propTypes = { - albumId: PropTypes.number, - isSaving: PropTypes.bool.isRequired, - saveError: PropTypes.object, - dispatchSetAlbumValue: PropTypes.func.isRequired, - dispatchSaveAlbum: PropTypes.func.isRequired, - onModalClose: PropTypes.func.isRequired -}; - -export default connect(createMapStateToProps, mapDispatchToProps)(EditAlbumModalContentConnector); diff --git a/frontend/src/Album/EpisodeNumber.css b/frontend/src/Album/EpisodeNumber.css deleted file mode 100644 index 1c5072d02..000000000 --- a/frontend/src/Album/EpisodeNumber.css +++ /dev/null @@ -1,7 +0,0 @@ -.absoluteEpisodeNumber { - margin-left: 5px; -} - -.warning { - margin-left: 8px; -} diff --git a/frontend/src/Album/EpisodeNumber.js b/frontend/src/Album/EpisodeNumber.js deleted file mode 100644 index 37d46686c..000000000 --- a/frontend/src/Album/EpisodeNumber.js +++ /dev/null @@ -1,108 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import Icon from 'Components/Icon'; -import Popover from 'Components/Tooltip/Popover'; -import { icons, kinds, tooltipPositions } from 'Helpers/Props'; -import translate from 'Utilities/String/translate'; -import SceneInfo from './SceneInfo'; -import styles from './EpisodeNumber.css'; - -function EpisodeNumber(props) { - const { - episodeNumber, - absoluteEpisodeNumber, - sceneSeasonNumber, - sceneEpisodeNumber, - sceneAbsoluteEpisodeNumber, - unverifiedSceneNumbering, - alternateTitles, - artistType - } = props; - - const hasSceneInformation = sceneSeasonNumber !== undefined || - sceneEpisodeNumber !== undefined || - (artistType === 'anime' && sceneAbsoluteEpisodeNumber !== undefined) || - !!alternateTitles.length; - - return ( - - { - hasSceneInformation ? - - {episodeNumber} - - { - artistType === 'anime' && !!absoluteEpisodeNumber && - - ({absoluteEpisodeNumber}) - - } - - } - title={translate('SceneInformation')} - body={ - - } - position={tooltipPositions.RIGHT} - /> : - - {episodeNumber} - - { - artistType === 'anime' && !!absoluteEpisodeNumber && - - ({absoluteEpisodeNumber}) - - } - - } - - { - unverifiedSceneNumbering && - - } - - { - artistType === 'anime' && !absoluteEpisodeNumber && - - } - - ); -} - -EpisodeNumber.propTypes = { - seasonNumber: PropTypes.number.isRequired, - episodeNumber: PropTypes.number.isRequired, - absoluteEpisodeNumber: PropTypes.number, - sceneSeasonNumber: PropTypes.number, - sceneEpisodeNumber: PropTypes.number, - sceneAbsoluteEpisodeNumber: PropTypes.number, - unverifiedSceneNumbering: PropTypes.bool.isRequired, - alternateTitles: PropTypes.arrayOf(PropTypes.object).isRequired, - artistType: PropTypes.string -}; - -EpisodeNumber.defaultProps = { - unverifiedSceneNumbering: false, - alternateTitles: [] -}; - -export default EpisodeNumber; diff --git a/frontend/src/Album/EpisodeStatus.css b/frontend/src/Album/EpisodeStatus.css deleted file mode 100644 index 3833887df..000000000 --- a/frontend/src/Album/EpisodeStatus.css +++ /dev/null @@ -1,4 +0,0 @@ -.center { - display: flex; - justify-content: center; -} diff --git a/frontend/src/Album/EpisodeStatus.css.d.ts b/frontend/src/Album/EpisodeStatus.css.d.ts deleted file mode 100644 index a49c06d3a..000000000 --- a/frontend/src/Album/EpisodeStatus.css.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'center': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Album/EpisodeStatus.js b/frontend/src/Album/EpisodeStatus.js deleted file mode 100644 index fc976103b..000000000 --- a/frontend/src/Album/EpisodeStatus.js +++ /dev/null @@ -1,128 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import QueueDetails from 'Activity/Queue/QueueDetails'; -import Icon from 'Components/Icon'; -import ProgressBar from 'Components/ProgressBar'; -import { icons, kinds, sizes } from 'Helpers/Props'; -import isBefore from 'Utilities/Date/isBefore'; -import translate from 'Utilities/String/translate'; -import TrackQuality from './TrackQuality'; -import styles from './EpisodeStatus.css'; - -function EpisodeStatus(props) { - const { - airDateUtc, - monitored, - grabbed, - queueItem, - trackFile - } = props; - - const hasTrackFile = !!trackFile; - const isQueued = !!queueItem; - const hasAired = isBefore(airDateUtc); - - if (isQueued) { - const { - sizeleft, - size - } = queueItem; - - const progress = size ? (100 - sizeleft / size * 100) : 0; - - return ( -
- - } - /> -
- ); - } - - if (grabbed) { - return ( -
- -
- ); - } - - if (hasTrackFile) { - const quality = trackFile.quality; - const isCutoffNotMet = trackFile.qualityCutoffNotMet; - - return ( -
- -
- ); - } - - if (!airDateUtc) { - return ( -
- -
- ); - } - - if (!monitored) { - return ( -
- -
- ); - } - - if (hasAired) { - return ( -
- -
- ); - } - - return ( -
- -
- ); -} - -EpisodeStatus.propTypes = { - airDateUtc: PropTypes.string, - monitored: PropTypes.bool, - grabbed: PropTypes.bool, - queueItem: PropTypes.object, - trackFile: PropTypes.object -}; - -export default EpisodeStatus; diff --git a/frontend/src/Album/EpisodeStatusConnector.js b/frontend/src/Album/EpisodeStatusConnector.js deleted file mode 100644 index f3a390748..000000000 --- a/frontend/src/Album/EpisodeStatusConnector.js +++ /dev/null @@ -1,53 +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 createAlbumSelector from 'Store/Selectors/createAlbumSelector'; -import createQueueItemSelector from 'Store/Selectors/createQueueItemSelector'; -import createTrackFileSelector from 'Store/Selectors/createTrackFileSelector'; -import EpisodeStatus from './EpisodeStatus'; - -function createMapStateToProps() { - return createSelector( - createAlbumSelector(), - createQueueItemSelector(), - createTrackFileSelector(), - (album, queueItem, trackFile) => { - const result = _.pick(album, [ - 'airDateUtc', - 'monitored', - 'grabbed' - ]); - - result.queueItem = queueItem; - result.trackFile = trackFile; - - return result; - } - ); -} - -const mapDispatchToProps = { -}; - -class EpisodeStatusConnector extends Component { - - // - // Render - - render() { - return ( - - ); - } -} - -EpisodeStatusConnector.propTypes = { - albumId: PropTypes.number.isRequired, - trackFileId: PropTypes.number.isRequired -}; - -export default connect(createMapStateToProps, mapDispatchToProps)(EpisodeStatusConnector); diff --git a/frontend/src/Album/IndexerFlags.tsx b/frontend/src/Album/IndexerFlags.tsx deleted file mode 100644 index 74e2e033c..000000000 --- a/frontend/src/Album/IndexerFlags.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import React from 'react'; -import { useSelector } from 'react-redux'; -import createIndexerFlagsSelector from 'Store/Selectors/createIndexerFlagsSelector'; - -interface IndexerFlagsProps { - indexerFlags: number; -} - -function IndexerFlags({ indexerFlags = 0 }: IndexerFlagsProps) { - const allIndexerFlags = useSelector(createIndexerFlagsSelector); - - const flags = allIndexerFlags.items.filter( - // eslint-disable-next-line no-bitwise - (item) => (indexerFlags & item.id) === item.id - ); - - return flags.length ? ( -
    - {flags.map((flag, index) => { - return
  • {flag.name}
  • ; - })} -
- ) : null; -} - -export default IndexerFlags; diff --git a/frontend/src/Album/SceneInfo.css b/frontend/src/Album/SceneInfo.css deleted file mode 100644 index 6f1155494..000000000 --- a/frontend/src/Album/SceneInfo.css +++ /dev/null @@ -1,22 +0,0 @@ -.descriptionList { - composes: descriptionList from '~Components/DescriptionList/DescriptionList.css'; - - margin-right: 10px; -} - -.title { - composes: title from '~Components/DescriptionList/DescriptionListItemTitle.css'; - - width: 80px; -} - -.description { - composes: title from '~Components/DescriptionList/DescriptionListItemDescription.css'; - - margin-left: 100px; -} - -.comment { - color: var(--darkGray); - font-size: $smallFontSize; -} diff --git a/frontend/src/Album/SceneInfo.js b/frontend/src/Album/SceneInfo.js deleted file mode 100644 index 061c54c10..000000000 --- a/frontend/src/Album/SceneInfo.js +++ /dev/null @@ -1,84 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import DescriptionList from 'Components/DescriptionList/DescriptionList'; -import DescriptionListItem from 'Components/DescriptionList/DescriptionListItem'; -import translate from 'Utilities/String/translate'; -import styles from './SceneInfo.css'; - -function SceneInfo(props) { - const { - sceneSeasonNumber, - sceneEpisodeNumber, - sceneAbsoluteEpisodeNumber, - alternateTitles, - artistType - } = props; - - return ( - - { - sceneSeasonNumber !== undefined && - - } - - { - sceneEpisodeNumber !== undefined && - - } - - { - artistType === 'anime' && sceneAbsoluteEpisodeNumber !== undefined && - - } - - { - !!alternateTitles.length && - - { - alternateTitles.map((alternateTitle) => { - return ( -
- {alternateTitle.title} -
- ); - }) - } -
- } - /> - } - - ); -} - -SceneInfo.propTypes = { - sceneSeasonNumber: PropTypes.number, - sceneEpisodeNumber: PropTypes.number, - sceneAbsoluteEpisodeNumber: PropTypes.number, - alternateTitles: PropTypes.arrayOf(PropTypes.object).isRequired, - artistType: PropTypes.string -}; - -export default SceneInfo; diff --git a/frontend/src/Album/Search/AlbumInteractiveSearchModal.js b/frontend/src/Album/Search/AlbumInteractiveSearchModal.js deleted file mode 100644 index 6ce488615..000000000 --- a/frontend/src/Album/Search/AlbumInteractiveSearchModal.js +++ /dev/null @@ -1,38 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import Modal from 'Components/Modal/Modal'; -import { sizes } from 'Helpers/Props'; -import AlbumInteractiveSearchModalContent from './AlbumInteractiveSearchModalContent'; - -function AlbumInteractiveSearchModal(props) { - const { - isOpen, - albumId, - albumTitle, - onModalClose - } = props; - - return ( - - - - ); -} - -AlbumInteractiveSearchModal.propTypes = { - isOpen: PropTypes.bool.isRequired, - albumId: PropTypes.number.isRequired, - albumTitle: PropTypes.string.isRequired, - onModalClose: PropTypes.func.isRequired -}; - -export default AlbumInteractiveSearchModal; diff --git a/frontend/src/Album/Search/AlbumInteractiveSearchModalConnector.js b/frontend/src/Album/Search/AlbumInteractiveSearchModalConnector.js deleted file mode 100644 index ac10cd146..000000000 --- a/frontend/src/Album/Search/AlbumInteractiveSearchModalConnector.js +++ /dev/null @@ -1,59 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import { connect } from 'react-redux'; -import { cancelFetchReleases, clearReleases } from 'Store/Actions/releaseActions'; -import AlbumInteractiveSearchModal from './AlbumInteractiveSearchModal'; - -function createMapDispatchToProps(dispatch, props) { - return { - dispatchCancelFetchReleases() { - dispatch(cancelFetchReleases()); - }, - - dispatchClearReleases() { - dispatch(clearReleases()); - }, - - onModalClose() { - dispatch(cancelFetchReleases()); - dispatch(clearReleases()); - props.onModalClose(); - } - }; -} - -class AlbumInteractiveSearchModalConnector extends Component { - - // - // Lifecycle - - componentWillUnmount() { - this.props.dispatchCancelFetchReleases(); - this.props.dispatchClearReleases(); - } - - // - // Render - - render() { - const { - dispatchCancelFetchReleases, - dispatchClearReleases, - ...otherProps - } = this.props; - - return ( - - ); - } -} - -AlbumInteractiveSearchModalConnector.propTypes = { - ...AlbumInteractiveSearchModal.propTypes, - dispatchCancelFetchReleases: PropTypes.func.isRequired, - dispatchClearReleases: PropTypes.func.isRequired -}; - -export default connect(null, createMapDispatchToProps)(AlbumInteractiveSearchModalConnector); diff --git a/frontend/src/Album/Search/AlbumInteractiveSearchModalContent.js b/frontend/src/Album/Search/AlbumInteractiveSearchModalContent.js deleted file mode 100644 index 370f67ab1..000000000 --- a/frontend/src/Album/Search/AlbumInteractiveSearchModalContent.js +++ /dev/null @@ -1,52 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -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 { scrollDirections } from 'Helpers/Props'; -import InteractiveSearchConnector from 'InteractiveSearch/InteractiveSearchConnector'; -import translate from 'Utilities/String/translate'; - -function AlbumInteractiveSearchModalContent(props) { - const { - albumId, - albumTitle, - onModalClose - } = props; - - return ( - - - {albumTitle === undefined ? - translate('InteractiveSearchModalHeader') : - translate('InteractiveSearchModalHeaderTitle', { title: albumTitle }) - } - - - - - - - - - - - ); -} - -AlbumInteractiveSearchModalContent.propTypes = { - albumId: PropTypes.number.isRequired, - albumTitle: PropTypes.string.isRequired, - onModalClose: PropTypes.func.isRequired -}; - -export default AlbumInteractiveSearchModalContent; diff --git a/frontend/src/Album/SeasonEpisodeNumber.js b/frontend/src/Album/SeasonEpisodeNumber.js deleted file mode 100644 index 7242ebfcc..000000000 --- a/frontend/src/Album/SeasonEpisodeNumber.js +++ /dev/null @@ -1,32 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import EpisodeNumber from './EpisodeNumber'; - -function SeasonEpisodeNumber(props) { - const { - airDate, - artistType, - ...otherProps - } = props; - - if (artistType === 'daily' && airDate) { - return ( - {airDate} - ); - } - - return ( - - ); -} - -SeasonEpisodeNumber.propTypes = { - airDate: PropTypes.string, - artistType: PropTypes.string -}; - -export default SeasonEpisodeNumber; diff --git a/frontend/src/Album/TrackQuality.js b/frontend/src/Album/TrackQuality.js deleted file mode 100644 index 6eac5d2f8..000000000 --- a/frontend/src/Album/TrackQuality.js +++ /dev/null @@ -1,101 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import Label from 'Components/Label'; -import { kinds } from 'Helpers/Props'; -import formatBytes from 'Utilities/Number/formatBytes'; -import translate from 'Utilities/String/translate'; - -function getTooltip(title, quality, size) { - if (!title) { - return; - } - - const revision = quality.revision; - - if (revision.real && revision.real > 0) { - title += ' [REAL]'; - } - - if (revision.version && revision.version > 1) { - title += ' [PROPER]'; - } - - if (size) { - title += ` - ${formatBytes(size)}`; - } - - return title; -} - -function revisionLabel(className, quality, showRevision) { - if (!showRevision) { - return; - } - - if (quality.revision.isRepack) { - return ( - - ); - } - - if (quality.revision.version && quality.revision.version > 1) { - return ( - - ); - } -} - -function TrackQuality(props) { - const { - className, - title, - quality, - size, - isCutoffNotMet, - showRevision - } = props; - - if (!quality) { - return null; - } - - return ( - - {revisionLabel(className, quality, showRevision)} - - ); -} - -TrackQuality.propTypes = { - className: PropTypes.string, - title: PropTypes.string, - quality: PropTypes.object.isRequired, - size: PropTypes.number, - isCutoffNotMet: PropTypes.bool, - showRevision: PropTypes.bool -}; - -TrackQuality.defaultProps = { - title: '', - showRevision: false -}; - -export default TrackQuality; diff --git a/frontend/src/Album/albumEntities.js b/frontend/src/Album/albumEntities.js deleted file mode 100644 index 4f5a26a61..000000000 --- a/frontend/src/Album/albumEntities.js +++ /dev/null @@ -1,13 +0,0 @@ -export const CALENDAR = 'calendar'; -export const ALBUMS = 'albums'; -export const INTERACTIVE_IMPORT = 'interactiveImport.albums'; -export const WANTED_CUTOFF_UNMET = 'wanted.cutoffUnmet'; -export const WANTED_MISSING = 'wanted.missing'; - -export default { - CALENDAR, - ALBUMS, - INTERACTIVE_IMPORT, - WANTED_CUTOFF_UNMET, - WANTED_MISSING -}; diff --git a/frontend/src/App/App.js b/frontend/src/App/App.js deleted file mode 100644 index 9e8d508ac..000000000 --- a/frontend/src/App/App.js +++ /dev/null @@ -1,30 +0,0 @@ -import { ConnectedRouter } from 'connected-react-router'; -import PropTypes from 'prop-types'; -import React from 'react'; -import DocumentTitle from 'react-document-title'; -import { Provider } from 'react-redux'; -import PageConnector from 'Components/Page/PageConnector'; -import ApplyTheme from './ApplyTheme'; -import AppRoutes from './AppRoutes'; - -function App({ store, history }) { - return ( - - - - - - - - - - - ); -} - -App.propTypes = { - store: PropTypes.object.isRequired, - history: PropTypes.object.isRequired -}; - -export default App; diff --git a/frontend/src/App/AppRoutes.js b/frontend/src/App/AppRoutes.js deleted file mode 100644 index c1004d36d..000000000 --- a/frontend/src/App/AppRoutes.js +++ /dev/null @@ -1,281 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import { Redirect, Route } from 'react-router-dom'; -import BlocklistConnector from 'Activity/Blocklist/BlocklistConnector'; -import HistoryConnector from 'Activity/History/HistoryConnector'; -import QueueConnector from 'Activity/Queue/QueueConnector'; -import AlbumDetailsPageConnector from 'Album/Details/AlbumDetailsPageConnector'; -import ArtistDetailsPageConnector from 'Artist/Details/ArtistDetailsPageConnector'; -import ArtistIndex from 'Artist/Index/ArtistIndex'; -import CalendarPageConnector from 'Calendar/CalendarPageConnector'; -import NotFound from 'Components/NotFound'; -import Switch from 'Components/Router/Switch'; -import AddNewItemConnector from 'Search/AddNewItemConnector'; -import CustomFormatSettingsPage from 'Settings/CustomFormats/CustomFormatSettingsPage'; -import DownloadClientSettingsConnector from 'Settings/DownloadClients/DownloadClientSettingsConnector'; -import GeneralSettingsConnector from 'Settings/General/GeneralSettingsConnector'; -import ImportListSettingsConnector from 'Settings/ImportLists/ImportListSettingsConnector'; -import IndexerSettingsConnector from 'Settings/Indexers/IndexerSettingsConnector'; -import MediaManagementConnector from 'Settings/MediaManagement/MediaManagementConnector'; -import MetadataSettings from 'Settings/Metadata/MetadataSettings'; -import NotificationSettings from 'Settings/Notifications/NotificationSettings'; -import Profiles from 'Settings/Profiles/Profiles'; -import QualityConnector from 'Settings/Quality/QualityConnector'; -import Settings from 'Settings/Settings'; -import TagSettings from 'Settings/Tags/TagSettings'; -import UISettingsConnector from 'Settings/UI/UISettingsConnector'; -import BackupsConnector from 'System/Backup/BackupsConnector'; -import LogsTableConnector from 'System/Events/LogsTableConnector'; -import Logs from 'System/Logs/Logs'; -import Status from 'System/Status/Status'; -import Tasks from 'System/Tasks/Tasks'; -import Updates from 'System/Updates/Updates'; -import UnmappedFilesTableConnector from 'UnmappedFiles/UnmappedFilesTableConnector'; -import getPathWithUrlBase from 'Utilities/getPathWithUrlBase'; -import CutoffUnmetConnector from 'Wanted/CutoffUnmet/CutoffUnmetConnector'; -import MissingConnector from 'Wanted/Missing/MissingConnector'; - -function AppRoutes(props) { - const { - app - } = props; - - return ( - - {/* - Artist - */} - - - - { - window.Lidarr.urlBase && - { - return ( - - ); - }} - /> - } - - - - { - return ( - - ); - }} - /> - - { - return ( - - ); - }} - /> - - - - - - - - {/* - Calendar - */} - - - - {/* - Activity - */} - - - - - - - - {/* - Wanted - */} - - - - - - {/* - Settings - */} - - - - - - - - - - - - - - - - - - - - - - - - - - - - {/* - System - */} - - - - - - - - - - - - - - {/* - Not Found - */} - - - - - ); -} - -AppRoutes.propTypes = { - app: PropTypes.func.isRequired -}; - -export default AppRoutes; diff --git a/frontend/src/App/AppUpdatedModal.js b/frontend/src/App/AppUpdatedModal.js deleted file mode 100644 index abc7f8832..000000000 --- a/frontend/src/App/AppUpdatedModal.js +++ /dev/null @@ -1,30 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import Modal from 'Components/Modal/Modal'; -import AppUpdatedModalContentConnector from './AppUpdatedModalContentConnector'; - -function AppUpdatedModal(props) { - const { - isOpen, - onModalClose - } = props; - - return ( - - - - ); -} - -AppUpdatedModal.propTypes = { - isOpen: PropTypes.bool.isRequired, - onModalClose: PropTypes.func.isRequired -}; - -export default AppUpdatedModal; diff --git a/frontend/src/App/AppUpdatedModalConnector.js b/frontend/src/App/AppUpdatedModalConnector.js deleted file mode 100644 index a21afbc5a..000000000 --- a/frontend/src/App/AppUpdatedModalConnector.js +++ /dev/null @@ -1,12 +0,0 @@ -import { connect } from 'react-redux'; -import AppUpdatedModal from './AppUpdatedModal'; - -function createMapDispatchToProps(dispatch, props) { - return { - onModalClose() { - location.reload(); - } - }; -} - -export default connect(null, createMapDispatchToProps)(AppUpdatedModal); diff --git a/frontend/src/App/AppUpdatedModalContent.css b/frontend/src/App/AppUpdatedModalContent.css deleted file mode 100644 index 0df4183a6..000000000 --- a/frontend/src/App/AppUpdatedModalContent.css +++ /dev/null @@ -1,16 +0,0 @@ -.version { - margin: 0 3px; - font-weight: bold; - font-family: var(--defaultFontFamily); -} - -.maintenance { - margin-top: 20px; -} - -.changes { - margin-top: 20px; - padding-bottom: 5px; - border-bottom: 1px solid #e5e5e5; - font-size: 18px; -} diff --git a/frontend/src/App/AppUpdatedModalContent.css.d.ts b/frontend/src/App/AppUpdatedModalContent.css.d.ts deleted file mode 100644 index 70ddbf6a1..000000000 --- a/frontend/src/App/AppUpdatedModalContent.css.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'changes': string; - 'maintenance': string; - 'version': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/App/AppUpdatedModalContent.js b/frontend/src/App/AppUpdatedModalContent.js deleted file mode 100644 index 8cce1bc16..000000000 --- a/frontend/src/App/AppUpdatedModalContent.js +++ /dev/null @@ -1,139 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import Button from 'Components/Link/Button'; -import LoadingIndicator from 'Components/Loading/LoadingIndicator'; -import InlineMarkdown from 'Components/Markdown/InlineMarkdown'; -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 { kinds } from 'Helpers/Props'; -import UpdateChanges from 'System/Updates/UpdateChanges'; -import translate from 'Utilities/String/translate'; -import styles from './AppUpdatedModalContent.css'; - -function mergeUpdates(items, version, prevVersion) { - let installedIndex = items.findIndex((u) => u.version === version); - let installedPreviouslyIndex = items.findIndex((u) => u.version === prevVersion); - - if (installedIndex === -1) { - installedIndex = 0; - } - - if (installedPreviouslyIndex === -1) { - installedPreviouslyIndex = items.length; - } else if (installedPreviouslyIndex === installedIndex && items.length) { - installedPreviouslyIndex += 1; - } - - const appliedUpdates = items.slice(installedIndex, installedPreviouslyIndex); - - if (!appliedUpdates.length) { - return null; - } - - const appliedChanges = { new: [], fixed: [] }; - appliedUpdates.forEach((u) => { - if (u.changes) { - appliedChanges.new.push(... u.changes.new); - appliedChanges.fixed.push(... u.changes.fixed); - } - }); - - const mergedUpdate = Object.assign({}, appliedUpdates[0], { changes: appliedChanges }); - - if (!appliedChanges.new.length && !appliedChanges.fixed.length) { - mergedUpdate.changes = null; - } - - return mergedUpdate; -} - -function AppUpdatedModalContent(props) { - const { - version, - prevVersion, - isPopulated, - error, - items, - onSeeChangesPress, - onModalClose - } = props; - - const update = mergeUpdates(items, version, prevVersion); - - return ( - - - {translate('AppUpdated')} - - - -
- -
- - { - isPopulated && !error && !!update && -
- { - !update.changes && -
{translate('MaintenanceRelease')}
- } - - { - !!update.changes && -
-
- {translate('WhatsNew')} -
- - - - -
- } -
- } - - { - !isPopulated && !error && - - } -
- - - - - - -
- ); -} - -AppUpdatedModalContent.propTypes = { - version: PropTypes.string.isRequired, - prevVersion: PropTypes.string, - isPopulated: PropTypes.bool.isRequired, - error: PropTypes.object, - items: PropTypes.arrayOf(PropTypes.object).isRequired, - onSeeChangesPress: PropTypes.func.isRequired, - onModalClose: PropTypes.func.isRequired -}; - -export default AppUpdatedModalContent; diff --git a/frontend/src/App/AppUpdatedModalContentConnector.js b/frontend/src/App/AppUpdatedModalContentConnector.js deleted file mode 100644 index 5a991f236..000000000 --- a/frontend/src/App/AppUpdatedModalContentConnector.js +++ /dev/null @@ -1,78 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import { connect } from 'react-redux'; -import { createSelector } from 'reselect'; -import { fetchUpdates } from 'Store/Actions/systemActions'; -import AppUpdatedModalContent from './AppUpdatedModalContent'; - -function createMapStateToProps() { - return createSelector( - (state) => state.app.version, - (state) => state.app.prevVersion, - (state) => state.system.updates, - (version, prevVersion, updates) => { - const { - isPopulated, - error, - items - } = updates; - - return { - version, - prevVersion, - isPopulated, - error, - items - }; - } - ); -} - -function createMapDispatchToProps(dispatch, props) { - return { - dispatchFetchUpdates() { - dispatch(fetchUpdates()); - }, - - onSeeChangesPress() { - window.location = `${window.Lidarr.urlBase}/system/updates`; - } - }; -} - -class AppUpdatedModalContentConnector extends Component { - - // - // Lifecycle - - componentDidMount() { - this.props.dispatchFetchUpdates(); - } - - componentDidUpdate(prevProps) { - if (prevProps.version !== this.props.version) { - this.props.dispatchFetchUpdates(); - } - } - - // - // Render - - render() { - const { - dispatchFetchUpdates, - ...otherProps - } = this.props; - - return ( - - ); - } -} - -AppUpdatedModalContentConnector.propTypes = { - version: PropTypes.string.isRequired, - dispatchFetchUpdates: PropTypes.func.isRequired -}; - -export default connect(createMapStateToProps, createMapDispatchToProps)(AppUpdatedModalContentConnector); diff --git a/frontend/src/App/ApplyTheme.tsx b/frontend/src/App/ApplyTheme.tsx deleted file mode 100644 index e04dda8c4..000000000 --- a/frontend/src/App/ApplyTheme.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import React, { Fragment, ReactNode, useCallback, useEffect } from 'react'; -import { useSelector } from 'react-redux'; -import { createSelector } from 'reselect'; -import themes from 'Styles/Themes'; -import AppState from './State/AppState'; - -interface ApplyThemeProps { - children: ReactNode; -} - -function createThemeSelector() { - return createSelector( - (state: AppState) => state.settings.ui.item.theme || window.Lidarr.theme, - (theme) => { - return theme; - } - ); -} - -function ApplyTheme({ children }: ApplyThemeProps) { - const theme = useSelector(createThemeSelector()); - - const updateCSSVariables = useCallback(() => { - Object.entries(themes[theme]).forEach(([key, value]) => { - document.documentElement.style.setProperty(`--${key}`, value); - }); - }, [theme]); - - // On Component Mount and Component Update - useEffect(() => { - updateCSSVariables(); - }, [updateCSSVariables, theme]); - - return {children}; -} - -export default ApplyTheme; diff --git a/frontend/src/App/ColorImpairedContext.js b/frontend/src/App/ColorImpairedContext.js deleted file mode 100644 index de98ac8fb..000000000 --- a/frontend/src/App/ColorImpairedContext.js +++ /dev/null @@ -1,6 +0,0 @@ -import React from 'react'; - -const ColorImpairedContext = React.createContext(false); -export const ColorImpairedConsumer = ColorImpairedContext.Consumer; - -export default ColorImpairedContext; diff --git a/frontend/src/App/ConnectionLostModal.css b/frontend/src/App/ConnectionLostModal.css deleted file mode 100644 index f0a9d220f..000000000 --- a/frontend/src/App/ConnectionLostModal.css +++ /dev/null @@ -1,3 +0,0 @@ -.automatic { - margin-top: 20px; -} diff --git a/frontend/src/App/ConnectionLostModal.css.d.ts b/frontend/src/App/ConnectionLostModal.css.d.ts deleted file mode 100644 index 027f2a9a3..000000000 --- a/frontend/src/App/ConnectionLostModal.css.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'automatic': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/App/ConnectionLostModal.js b/frontend/src/App/ConnectionLostModal.js deleted file mode 100644 index 5c08f491f..000000000 --- a/frontend/src/App/ConnectionLostModal.js +++ /dev/null @@ -1,56 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import Button from 'Components/Link/Button'; -import Modal from 'Components/Modal/Modal'; -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 { kinds } from 'Helpers/Props'; -import translate from 'Utilities/String/translate'; -import styles from './ConnectionLostModal.css'; - -function ConnectionLostModal(props) { - const { - isOpen, - onModalClose - } = props; - - return ( - - - - {translate('ConnectionLost')} - - - -
- {translate('ConnectionLostToBackend')} -
- -
- {translate('ConnectionLostReconnect')} -
-
- - - -
-
- ); -} - -ConnectionLostModal.propTypes = { - isOpen: PropTypes.bool.isRequired, - onModalClose: PropTypes.func.isRequired -}; - -export default ConnectionLostModal; diff --git a/frontend/src/App/ConnectionLostModalConnector.js b/frontend/src/App/ConnectionLostModalConnector.js deleted file mode 100644 index 8ab8e3cd0..000000000 --- a/frontend/src/App/ConnectionLostModalConnector.js +++ /dev/null @@ -1,12 +0,0 @@ -import { connect } from 'react-redux'; -import ConnectionLostModal from './ConnectionLostModal'; - -function createMapDispatchToProps(dispatch, props) { - return { - onModalClose() { - location.reload(); - } - }; -} - -export default connect(undefined, createMapDispatchToProps)(ConnectionLostModal); diff --git a/frontend/src/App/ModelBase.ts b/frontend/src/App/ModelBase.ts deleted file mode 100644 index 187b12fb2..000000000 --- a/frontend/src/App/ModelBase.ts +++ /dev/null @@ -1,5 +0,0 @@ -interface ModelBase { - id: number; -} - -export default ModelBase; diff --git a/frontend/src/App/SelectContext.tsx b/frontend/src/App/SelectContext.tsx deleted file mode 100644 index 66be388ce..000000000 --- a/frontend/src/App/SelectContext.tsx +++ /dev/null @@ -1,83 +0,0 @@ -import { cloneDeep } from 'lodash'; -import React, { useCallback, useEffect } from 'react'; -import useSelectState, { SelectState } from 'Helpers/Hooks/useSelectState'; -import ModelBase from './ModelBase'; - -export type SelectContextAction = - | { type: 'reset' } - | { type: 'selectAll' } - | { type: 'unselectAll' } - | { - type: 'toggleSelected'; - id: number; - isSelected: boolean; - shiftKey: boolean; - } - | { - type: 'removeItem'; - id: number; - } - | { - type: 'updateItems'; - items: ModelBase[]; - }; - -export type SelectDispatch = (action: SelectContextAction) => void; - -interface SelectProviderOptions { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - children: any; - items: Array; -} - -const SelectContext = React.createContext< - [SelectState, SelectDispatch] | undefined ->(cloneDeep(undefined)); - -export function SelectProvider( - props: SelectProviderOptions -) { - const { items } = props; - const [state, dispatch] = useSelectState(); - - const dispatchWrapper = useCallback( - (action: SelectContextAction) => { - switch (action.type) { - case 'reset': - case 'removeItem': - dispatch(action); - break; - - default: - dispatch({ - ...action, - items, - }); - break; - } - }, - [items, dispatch] - ); - - const value: [SelectState, SelectDispatch] = [state, dispatchWrapper]; - - useEffect(() => { - dispatch({ type: 'updateItems', items }); - }, [items, dispatch]); - - return ( - - {props.children} - - ); -} - -export function useSelect() { - const context = React.useContext(SelectContext); - - if (context === undefined) { - throw new Error('useSelect must be used within a SelectProvider'); - } - - return context; -} diff --git a/frontend/src/App/State/AlbumAppState.ts b/frontend/src/App/State/AlbumAppState.ts deleted file mode 100644 index e03d4a497..000000000 --- a/frontend/src/App/State/AlbumAppState.ts +++ /dev/null @@ -1,8 +0,0 @@ -import Album from 'Album/Album'; -import AppSectionState, { - AppSectionDeleteState, -} from 'App/State/AppSectionState'; - -interface AlbumAppState extends AppSectionState, AppSectionDeleteState {} - -export default AlbumAppState; diff --git a/frontend/src/App/State/AppSectionState.ts b/frontend/src/App/State/AppSectionState.ts deleted file mode 100644 index cabc39b1c..000000000 --- a/frontend/src/App/State/AppSectionState.ts +++ /dev/null @@ -1,53 +0,0 @@ -import SortDirection from 'Helpers/Props/SortDirection'; -import { FilterBuilderProp } from './AppState'; - -export interface Error { - responseJSON: { - message: string; - }; -} - -export interface AppSectionDeleteState { - isDeleting: boolean; - deleteError: Error; -} - -export interface AppSectionSaveState { - isSaving: boolean; - saveError: Error; -} - -export interface PagedAppSectionState { - pageSize: number; -} - -export interface AppSectionFilterState { - filterBuilderProps: FilterBuilderProp[]; -} - -export interface AppSectionSchemaState { - isSchemaFetching: boolean; - isSchemaPopulated: boolean; - schemaError: Error; - schema: { - items: T[]; - }; -} - -export interface AppSectionItemState { - isFetching: boolean; - isPopulated: boolean; - error: Error; - item: T; -} - -interface AppSectionState { - isFetching: boolean; - isPopulated: boolean; - error: Error; - items: T[]; - sortKey: string; - sortDirection: SortDirection; -} - -export default AppSectionState; diff --git a/frontend/src/App/State/AppState.ts b/frontend/src/App/State/AppState.ts deleted file mode 100644 index cb8da5987..000000000 --- a/frontend/src/App/State/AppState.ts +++ /dev/null @@ -1,72 +0,0 @@ -import ParseAppState from 'App/State/ParseAppState'; -import AlbumAppState from './AlbumAppState'; -import ArtistAppState, { ArtistIndexAppState } from './ArtistAppState'; -import CalendarAppState from './CalendarAppState'; -import CommandAppState from './CommandAppState'; -import HistoryAppState from './HistoryAppState'; -import QueueAppState from './QueueAppState'; -import SettingsAppState from './SettingsAppState'; -import SystemAppState from './SystemAppState'; -import TagsAppState from './TagsAppState'; -import TrackFilesAppState from './TrackFilesAppState'; -import TracksAppState from './TracksAppState'; - -interface FilterBuilderPropOption { - id: string; - name: string; -} - -export interface FilterBuilderProp { - name: string; - label: string; - type: string; - valueType?: string; - optionsSelector?: (items: T[]) => FilterBuilderPropOption[]; -} - -export interface PropertyFilter { - key: string; - value: boolean | string | number | string[] | number[]; - type: string; -} - -export interface Filter { - key: string; - label: string; - filers: PropertyFilter[]; -} - -export interface CustomFilter { - id: number; - type: string; - label: string; - filers: PropertyFilter[]; -} - -export interface AppSectionState { - version: string; - dimensions: { - isSmallScreen: boolean; - width: number; - height: number; - }; -} - -interface AppState { - albums: AlbumAppState; - app: AppSectionState; - artist: ArtistAppState; - artistIndex: ArtistIndexAppState; - calendar: CalendarAppState; - commands: CommandAppState; - history: HistoryAppState; - parse: ParseAppState; - queue: QueueAppState; - settings: SettingsAppState; - tags: TagsAppState; - trackFiles: TrackFilesAppState; - tracksSelection: TracksAppState; - system: SystemAppState; -} - -export default AppState; diff --git a/frontend/src/App/State/ArtistAppState.ts b/frontend/src/App/State/ArtistAppState.ts deleted file mode 100644 index 9e0628df7..000000000 --- a/frontend/src/App/State/ArtistAppState.ts +++ /dev/null @@ -1,72 +0,0 @@ -import AppSectionState, { - AppSectionDeleteState, - AppSectionSaveState, -} from 'App/State/AppSectionState'; -import Artist from 'Artist/Artist'; -import Column from 'Components/Table/Column'; -import SortDirection from 'Helpers/Props/SortDirection'; -import { Filter, FilterBuilderProp } from './AppState'; - -export interface ArtistIndexAppState { - sortKey: string; - sortDirection: SortDirection; - secondarySortKey: string; - secondarySortDirection: SortDirection; - view: string; - - posterOptions: { - detailedProgressBar: boolean; - size: string; - showTitle: boolean; - showMonitored: boolean; - showQualityProfile: boolean; - showNextAlbum: boolean; - showSearchAction: boolean; - }; - - bannerOptions: { - detailedProgressBar: boolean; - size: string; - showTitle: boolean; - showMonitored: boolean; - showQualityProfile: boolean; - showNextAlbum: boolean; - showSearchAction: boolean; - }; - - overviewOptions: { - detailedProgressBar: boolean; - size: string; - showMonitored: boolean; - showQualityProfile: boolean; - showLastAlbum: boolean; - showAdded: boolean; - showAlbumCount: boolean; - showPath: boolean; - showSizeOnDisk: boolean; - showSearchAction: boolean; - }; - - tableOptions: { - showBanners: boolean; - showSearchAction: boolean; - }; - - selectedFilterKey: string; - filterBuilderProps: FilterBuilderProp[]; - filters: Filter[]; - columns: Column[]; -} - -interface ArtistAppState - extends AppSectionState, - AppSectionDeleteState, - AppSectionSaveState { - itemMap: Record; - - deleteOptions: { - addImportListExclusion: boolean; - }; -} - -export default ArtistAppState; diff --git a/frontend/src/App/State/CalendarAppState.ts b/frontend/src/App/State/CalendarAppState.ts deleted file mode 100644 index 503d2c25b..000000000 --- a/frontend/src/App/State/CalendarAppState.ts +++ /dev/null @@ -1,10 +0,0 @@ -import Album from 'Album/Album'; -import AppSectionState, { - AppSectionFilterState, -} from 'App/State/AppSectionState'; - -interface CalendarAppState - extends AppSectionState, - AppSectionFilterState {} - -export default CalendarAppState; diff --git a/frontend/src/App/State/ClientSideCollectionAppState.ts b/frontend/src/App/State/ClientSideCollectionAppState.ts deleted file mode 100644 index f4110ef73..000000000 --- a/frontend/src/App/State/ClientSideCollectionAppState.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { CustomFilter } from './AppState'; - -interface ClientSideCollectionAppState { - totalItems: number; - customFilters: CustomFilter[]; -} - -export default ClientSideCollectionAppState; diff --git a/frontend/src/App/State/CommandAppState.ts b/frontend/src/App/State/CommandAppState.ts deleted file mode 100644 index 1bde37371..000000000 --- a/frontend/src/App/State/CommandAppState.ts +++ /dev/null @@ -1,6 +0,0 @@ -import AppSectionState from 'App/State/AppSectionState'; -import Command from 'Commands/Command'; - -export type CommandAppState = AppSectionState; - -export default CommandAppState; diff --git a/frontend/src/App/State/CustomFiltersAppState.ts b/frontend/src/App/State/CustomFiltersAppState.ts deleted file mode 100644 index 6ac4820c7..000000000 --- a/frontend/src/App/State/CustomFiltersAppState.ts +++ /dev/null @@ -1,10 +0,0 @@ -import AppSectionState, { - AppSectionDeleteState, -} from 'App/State/AppSectionState'; -import { CustomFilter } from './AppState'; - -interface CustomFiltersAppState - extends AppSectionState, - AppSectionDeleteState {} - -export default CustomFiltersAppState; diff --git a/frontend/src/App/State/HistoryAppState.ts b/frontend/src/App/State/HistoryAppState.ts deleted file mode 100644 index e368ff86e..000000000 --- a/frontend/src/App/State/HistoryAppState.ts +++ /dev/null @@ -1,10 +0,0 @@ -import AppSectionState, { - AppSectionFilterState, -} from 'App/State/AppSectionState'; -import History from 'typings/History'; - -interface HistoryAppState - extends AppSectionState, - AppSectionFilterState {} - -export default HistoryAppState; diff --git a/frontend/src/App/State/ParseAppState.ts b/frontend/src/App/State/ParseAppState.ts deleted file mode 100644 index 827d5b1a7..000000000 --- a/frontend/src/App/State/ParseAppState.ts +++ /dev/null @@ -1,35 +0,0 @@ -import Album from 'Album/Album'; -import ModelBase from 'App/ModelBase'; -import { AppSectionItemState } from 'App/State/AppSectionState'; -import Artist from 'Artist/Artist'; -import { QualityModel } from 'Quality/Quality'; -import CustomFormat from 'typings/CustomFormat'; - -export interface ArtistTitleInfo { - title: string; -} - -export interface ParsedAlbumInfo { - albumTitle: string; - artistName: string; - artistTitleInfo: ArtistTitleInfo; - discography: boolean; - quality: QualityModel; - releaseGroup?: string; - releaseHash: string; - releaseTitle: string; - releaseTokens: string; -} - -export interface ParseModel extends ModelBase { - title: string; - parsedAlbumInfo: ParsedAlbumInfo; - artist?: Artist; - albums: Album[]; - customFormats?: CustomFormat[]; - customFormatScore?: number; -} - -type ParseAppState = AppSectionItemState; - -export default ParseAppState; diff --git a/frontend/src/App/State/QueueAppState.ts b/frontend/src/App/State/QueueAppState.ts deleted file mode 100644 index 05d74acac..000000000 --- a/frontend/src/App/State/QueueAppState.ts +++ /dev/null @@ -1,27 +0,0 @@ -import Queue from 'typings/Queue'; -import AppSectionState, { - AppSectionFilterState, - AppSectionItemState, - Error, -} from './AppSectionState'; - -export interface QueueDetailsAppState extends AppSectionState { - params: unknown; -} - -export interface QueuePagedAppState - extends AppSectionState, - AppSectionFilterState { - isGrabbing: boolean; - grabError: Error; - isRemoving: boolean; - removeError: Error; -} - -interface QueueAppState { - status: AppSectionItemState; - details: QueueDetailsAppState; - paged: QueuePagedAppState; -} - -export default QueueAppState; diff --git a/frontend/src/App/State/SettingsAppState.ts b/frontend/src/App/State/SettingsAppState.ts deleted file mode 100644 index b387e13fd..000000000 --- a/frontend/src/App/State/SettingsAppState.ts +++ /dev/null @@ -1,76 +0,0 @@ -import AppSectionState, { - AppSectionDeleteState, - AppSectionItemState, - AppSectionSaveState, - AppSectionSchemaState, -} from 'App/State/AppSectionState'; -import CustomFormat from 'typings/CustomFormat'; -import DownloadClient from 'typings/DownloadClient'; -import ImportList from 'typings/ImportList'; -import Indexer from 'typings/Indexer'; -import IndexerFlag from 'typings/IndexerFlag'; -import MetadataProfile from 'typings/MetadataProfile'; -import Notification from 'typings/Notification'; -import QualityProfile from 'typings/QualityProfile'; -import RootFolder from 'typings/RootFolder'; -import General from 'typings/Settings/General'; -import UiSettings from 'typings/Settings/UiSettings'; - -export interface DownloadClientAppState - extends AppSectionState, - AppSectionDeleteState, - AppSectionSaveState {} - -export type GeneralAppState = AppSectionItemState; - -export interface ImportListAppState - extends AppSectionState, - AppSectionDeleteState, - AppSectionSaveState {} - -export interface IndexerAppState - extends AppSectionState, - AppSectionDeleteState, - AppSectionSaveState {} - -export interface NotificationAppState - extends AppSectionState, - AppSectionDeleteState {} - -export interface QualityProfilesAppState - extends AppSectionState, - AppSectionSchemaState {} - -export interface MetadataProfilesAppState - extends AppSectionState, - AppSectionSchemaState {} - -export interface CustomFormatAppState - extends AppSectionState, - AppSectionDeleteState, - AppSectionSaveState {} - -export interface RootFolderAppState - extends AppSectionState, - AppSectionDeleteState, - AppSectionSaveState {} - -export type IndexerFlagSettingsAppState = AppSectionState; -export type UiSettingsAppState = AppSectionItemState; - -interface SettingsAppState { - advancedSettings: boolean; - customFormats: CustomFormatAppState; - downloadClients: DownloadClientAppState; - general: GeneralAppState; - importLists: ImportListAppState; - indexerFlags: IndexerFlagSettingsAppState; - indexers: IndexerAppState; - metadataProfiles: MetadataProfilesAppState; - notifications: NotificationAppState; - qualityProfiles: QualityProfilesAppState; - rootFolders: RootFolderAppState; - ui: UiSettingsAppState; -} - -export default SettingsAppState; diff --git a/frontend/src/App/State/SystemAppState.ts b/frontend/src/App/State/SystemAppState.ts deleted file mode 100644 index 3c150fcfb..000000000 --- a/frontend/src/App/State/SystemAppState.ts +++ /dev/null @@ -1,13 +0,0 @@ -import SystemStatus from 'typings/SystemStatus'; -import Update from 'typings/Update'; -import AppSectionState, { AppSectionItemState } from './AppSectionState'; - -export type SystemStatusAppState = AppSectionItemState; -export type UpdateAppState = AppSectionState; - -interface SystemAppState { - updates: UpdateAppState; - status: SystemStatusAppState; -} - -export default SystemAppState; diff --git a/frontend/src/App/State/TagsAppState.ts b/frontend/src/App/State/TagsAppState.ts deleted file mode 100644 index edaf3a158..000000000 --- a/frontend/src/App/State/TagsAppState.ts +++ /dev/null @@ -1,32 +0,0 @@ -import ModelBase from 'App/ModelBase'; -import AppSectionState, { - AppSectionDeleteState, - AppSectionSaveState, -} from 'App/State/AppSectionState'; - -export interface Tag extends ModelBase { - label: string; -} - -export interface TagDetail extends ModelBase { - label: string; - autoTagIds: number[]; - delayProfileIds: number[]; - downloadClientIds: []; - importListIds: number[]; - indexerIds: number[]; - notificationIds: number[]; - restrictionIds: number[]; - artistIds: number[]; -} - -export interface TagDetailAppState - extends AppSectionState, - AppSectionDeleteState, - AppSectionSaveState {} - -interface TagsAppState extends AppSectionState, AppSectionDeleteState { - details: TagDetailAppState; -} - -export default TagsAppState; diff --git a/frontend/src/App/State/TrackFilesAppState.ts b/frontend/src/App/State/TrackFilesAppState.ts deleted file mode 100644 index 403ba904d..000000000 --- a/frontend/src/App/State/TrackFilesAppState.ts +++ /dev/null @@ -1,10 +0,0 @@ -import AppSectionState, { - AppSectionDeleteState, -} from 'App/State/AppSectionState'; -import { TrackFile } from 'TrackFile/TrackFile'; - -interface TrackFilesAppState - extends AppSectionState, - AppSectionDeleteState {} - -export default TrackFilesAppState; diff --git a/frontend/src/App/State/TracksAppState.ts b/frontend/src/App/State/TracksAppState.ts deleted file mode 100644 index 22aaabed9..000000000 --- a/frontend/src/App/State/TracksAppState.ts +++ /dev/null @@ -1,6 +0,0 @@ -import AppSectionState from 'App/State/AppSectionState'; -import Track from 'Track/Track'; - -type TracksAppState = AppSectionState; - -export default TracksAppState; diff --git a/frontend/src/Artist/Artist.ts b/frontend/src/Artist/Artist.ts deleted file mode 100644 index 813dbea08..000000000 --- a/frontend/src/Artist/Artist.ts +++ /dev/null @@ -1,51 +0,0 @@ -import Album from 'Album/Album'; -import ModelBase from 'App/ModelBase'; - -export interface Image { - coverType: string; - url: string; - remoteUrl: string; -} - -export interface Statistics { - albumCount: number; - trackCount: number; - trackFileCount: number; - percentOfTracks: number; - sizeOnDisk: number; - totalTrackCount: number; -} - -export interface Ratings { - votes: number; - value: number; -} - -interface Artist extends ModelBase { - added: string; - foreignArtistId: string; - cleanName: string; - ended: boolean; - genres: string[]; - images: Image[]; - monitored: boolean; - overview: string; - path: string; - lastAlbum?: Album; - nextAlbum?: Album; - qualityProfileId: number; - metadataProfileId: number; - monitorNewItems: string; - ratings: Ratings; - rootFolderPath: string; - sortName: string; - statistics: Statistics; - status: string; - tags: number[]; - artistName: string; - artistType?: string; - disambiguation?: string; - isSaving?: boolean; -} - -export default Artist; diff --git a/frontend/src/Artist/ArtistBanner.js b/frontend/src/Artist/ArtistBanner.js deleted file mode 100644 index 5483912e1..000000000 --- a/frontend/src/Artist/ArtistBanner.js +++ /dev/null @@ -1,29 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import ArtistImage from './ArtistImage'; - -const bannerPlaceholder = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA+gAAAC5AgMAAADG9/24AAAADFBMVEUyMjI7Ozs1NTU4ODjgOsZvAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4QkRBgAc5PUQ8QAAB7tJREFUeNrtnb1rHEsMwMdjArtrUrpf3uMg2cOl+5QpXWRvjQkXlyHVK8MVYXFl3F+/GAzrNfdSuXkQnH9ie/Oqw32aFM6bkTQfd85rHrwi0qjJJql+pxlJo9FISv0XqX8mKkmSJEmSJEmSJEmSJEmSJEmS5NeVYrh7HDqJ5DeY23kQB64/u7zW91amzgXqvRqjfGYvarnfxqncuaQlf72Zxv4gSOluudOfjRy1Hzh1L+nPj+KU3jh0MWr3Sp87dDFq98An/msmg3zPW/aFR6/vRaBPglML6Mci0H0g92MYfrjvRgJ5TrDvhuFyGIZv9NdTOev93dDry1Z59mM56/2hU8WZcefFjZgVT/Z90SlEV9VKio3HeKYZLLSGII6WPP+oBv3ZwkL3iE4JG/ZRjUYb16mAripUO/c4Hl3bd/juCF19FuHeJn6nK90VBh0s3SjBvcFW/wTrvfBa118EbHY8qmMOtmgdupoKOLTvAmOH1k059LKAX+Qra/TncExH4hcBXV3Zf/+Dv5Vb43cfod/wt3PLsN5VF6HDiudt56IbB23Ql5/oZ8A7CfZWbgF61sap62XdlOZTZ2rF3c7ltNW1+f7LuDez/uc6uDfO8dwkbPXcKF8vPS9sds527pC2utH0uCb0Jmz2t8wNvN3q2jj4ntDJna94m3g4sb7HH8Gue0RH4Je8z61g4GGr79Wz1qHjbi94m/jcH1IOccsj+lt/sOFr4m0EPz+3XyNueURvSmfn+Ebx1rctMvOxU8foqOwVa+9mfdvHDH+DdYQOxAesvZslvc/wo4vQZy6eY+vdrCVrut/AyTW9CWvO3E1ra4L6i5Fxoka7MDan45vTOmx2MPGc0QH52Tb6kTPxXNGtW5/Tnl+oGP2N/dstY8eeO2M+bqM3zvVxRT+gS8Vdl5/z6CaCzfx/c41o3pP2+030UzrAHDNGv8d4FvMVAf1I4c07V/QlnNsyG9TN23ID/ZjObnO+6CZmydS+y8oG9Dfk2Gd80WcW3Rv44e5bZOLtD8EUHbRq0V0F/DAMn8fQ2UUv2UayEMxplaFvM0G7QR/ufqBcmH/gG85Z9BM8rMO5bdiUDu4ceaLvUjqWfJveQm8hpvnKFv1jOLxUTtkoBWf0nIK5Cd6wO207dAznTlmjH+K630KvuKPbOHYffJsOexykx0iWJ7pNRf+ttEXvW1U49F7ZbJ26RHSe6ehn5NRGMPBVQAfP12EQf8QZPTMxXac30M1RxtaWXLBFn3j0eRsHNIBuCycLtqfWCQZrBcZ0W+gVhXts0RtEXyit4zDOoE/N/5yNzNF3oVB0A93I6ise7bijr1XwbYiurySg7xjfpp+g375mjj5D9HYD3fr6YvkKcxU80Q8duvVt2+gjob/ljX7yFH1a80dvDfpia8GXqp3Wr1XJXevljvFt2QZ6a6tJ2Gvd2Pa8Xuu2iNB7o++r+lUJlQas93oOl04be73Ut7y1Ts4tn/0EfaxZOzcKaXIsqNiI4QtE5x7N7Z08RZ9CKpb38cWs9V26b4sDWURnr3W9foq+gpM8a3S4V+rhKUCcqrBXTufMUxU2QWUTkFtZGls3pjgnqJ4FdB1lZAd8/qMEZGRtAlJvJqONb2syzuj2CuK+1YU5reg2CzGNyqq6fpOpku8VRI7lchX+7SIy8NdQSaKn3K8bsWJOlZGBX2Ed0bUIdBXftJpzG1h2vjetWFqgHXrhczTWtx2h8llXVTytI4FHnaes0bGMqNhC1+jUXmFMx7iCaq6qy4HqxR7dFfMUtc34LQCVDPppcM13Kie5RmTGJYNUKBraDL57xEKalS0UzTgXiiqn1X3fRxR0bBf6TLEvD4aKkslTdO5F4fQUIHseo5ugfrShewbWjvsriHxT65WAByAHVCT7u0fvoKDC+rZClZyf/eSAngUTj1pfCXjshU/8smDiPTr7J374sDPDfI1Hd4cX1g874TmvRc+30U8V9+e88Ig7U6V26Ofk21rzg1ScH3Hj033bTXIZab2iGG6PdWOaQzLx7cShQ0FFfdxqlfFu2DAhxw4vf5zWV3hYZ96m47l7u0+DMAgdu1Dxbs4St+Rx6MbAwzIveLfk8Y2Y9J5HP1tij3DmjZii9lujQy9GXO/M22/5pmvUVdWiV3RkYd50zbfaI7Vb9GmDD0C4t9qLGiy+JPTVKT4A4d5gMY866N4i+p9KuUM767aavpkqLnmDDl10S8W/mSq20O3I3n8x6AXufP4tdKlxcpkZ4HN43FZ0mT3GCmicTO2ysW2uVXmFWp/yb5cdN0kHrb/ADwFN0uPW+ICOt+0SWuPjkW2tPTr+CjcSphjiGIzWodPQGwljMGj4Se/Q0bfJGH4Sj7zx6DJG3tCgo4HQoYiukDHoKB5vZdCtb9MrIUM7DyK169Zu+mEUMtQsjLJrtT7vWl2IGWXnBxjaFwFnraQBhmFs5dDqi66SNLYyGlY6XMgaVip4RG00mHh2LWwwcRhHPVsJG0cdhpDProQNIQ+j52e30kbPa19B5T64H9Wfqn0mTelB7Y04pWMFfCQf5JDTjYOTuSClu5QUSa9EyU0gf5BF7iaP2zxdq6TJjUydgxTD3aPvm5wkSZIkSZIkSZIkSZIkSZIk+Z9kv/534U2+Uyf0XwP9H83PZBlAqkdjAAAAAElFTkSuQmCC'; - -function ArtistBanner(props) { - return ( - - ); -} - -ArtistBanner.propTypes = { - ...ArtistImage.propTypes, - coverType: PropTypes.string, - placeholder: PropTypes.string, - overflow: PropTypes.bool, - size: PropTypes.number.isRequired -}; - -ArtistBanner.defaultProps = { - size: 70 -}; - -export default ArtistBanner; diff --git a/frontend/src/Artist/ArtistImage.js b/frontend/src/Artist/ArtistImage.js deleted file mode 100644 index 669cba8d8..000000000 --- a/frontend/src/Artist/ArtistImage.js +++ /dev/null @@ -1,198 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import LazyLoad from 'react-lazyload'; - -function findImage(images, coverType) { - return images.find((image) => image.coverType === coverType); -} - -function getUrl(image, coverType, size) { - const imageUrl = image?.url; - - if (imageUrl) { - return imageUrl.replace(`${coverType}.jpg`, `${coverType}-${size}.jpg`); - } -} - -class ArtistImage extends Component { - - // - // Lifecycle - - constructor(props, context) { - super(props, context); - - const pixelRatio = Math.ceil(window.devicePixelRatio); - - const { - images, - coverType, - size - } = props; - - const image = findImage(images, coverType); - - this.state = { - pixelRatio, - image, - url: getUrl(image, coverType, pixelRatio * size), - isLoaded: false, - hasError: false - }; - } - - componentDidMount() { - if (!this.state.url && this.props.onError) { - this.props.onError(); - } - } - - componentDidUpdate() { - const { - images, - coverType, - placeholder, - size, - onError - } = this.props; - - const { - image, - pixelRatio - } = this.state; - - const nextImage = findImage(images, coverType); - - if (nextImage && (!image || nextImage.url !== image.url)) { - this.setState({ - image: nextImage, - url: getUrl(nextImage, coverType, pixelRatio * size), - hasError: false - // Don't reset isLoaded, as we want to immediately try to - // show the new image, whether an image was shown previously - // or the placeholder was shown. - }); - } else if (!nextImage && image) { - this.setState({ - image: nextImage, - url: placeholder, - hasError: false - }); - - if (onError) { - onError(); - } - } - } - - // - // Listeners - - onError = () => { - this.setState({ - hasError: true - }); - - if (this.props.onError) { - this.props.onError(); - } - }; - - onLoad = () => { - this.setState({ - isLoaded: true, - hasError: false - }); - - if (this.props.onLoad) { - this.props.onLoad(); - } - }; - - // - // Render - - render() { - const { - className, - style, - placeholder, - size, - lazy, - overflow - } = this.props; - - const { - url, - hasError, - isLoaded - } = this.state; - - if (hasError || !url) { - return ( - - ); - } - - if (lazy) { - return ( - - } - > - - - ); - } - - return ( - - ); - } -} - -ArtistImage.propTypes = { - className: PropTypes.string, - style: PropTypes.object, - images: PropTypes.arrayOf(PropTypes.object).isRequired, - coverType: PropTypes.string.isRequired, - placeholder: PropTypes.string.isRequired, - size: PropTypes.number.isRequired, - lazy: PropTypes.bool.isRequired, - overflow: PropTypes.bool.isRequired, - onError: PropTypes.func, - onLoad: PropTypes.func -}; - -ArtistImage.defaultProps = { - size: 250, - lazy: true, - overflow: false -}; - -export default ArtistImage; diff --git a/frontend/src/Artist/ArtistLogo.js b/frontend/src/Artist/ArtistLogo.js deleted file mode 100644 index 93b91c2da..000000000 --- a/frontend/src/Artist/ArtistLogo.js +++ /dev/null @@ -1,158 +0,0 @@ -import _ from 'lodash'; -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import LazyLoad from 'react-lazyload'; - -const logoPlaceholder = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPcAAAD3AgMAAAC84irAAAAADFBMVEUyMjI7Ozs1NTU4ODjgOsZvAAAAAWJLR0QAiAUdSAAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB+EJEBIzDdm9OfoAAAbkSURBVGje7Zq9b9s4FMBZFgUkBR27C3cw0MromL1jxwyVZASB67G4qWPgoSAyBdm9CwECKCp8nbIccGj/Ce/BTUb3Lh3aI997pCjnTnyyt0JcIif5+ZHvPZLvQ0KMYxzjGMc4xjGOcYxjHOP4JUfSfP7RVPvSH3MYX/eC5aecxne1v+w95WebFs/rwVO/8+h8PnT6t3ln/DFQuJ06/SyHiX9pxa7o5/lewkuLDxLvhM8tPki8g07dU8Gnj5zGlw7P79n4pDVYi8/YuHO4n03z0z6XXDom4G3TXDdN840+LobN/W1Ty2slHD8bNvevlUgutLmTj4NmT3pf6mMGcJGth+gefaZsDCjB2Wj65wN8ZmnAGnE6eFieI1FvcEISLjIUr9hm+w7PFeHiE9t0E7dyIatE48odXTPu0j/A3BMnXf7NXDxudTxbE2VxMWVu+sfwf3i1ZMLiaQLf+iWIP4VtjtTzFhc35vfveZrb4nPt4R95ulu1cxeVh8Psw7rzbgWp8dWHyr83WJpbgjypjS5XeZnqRxmJNUd3MS1d6ue/tOn0WuayNd2CoTlaeqwnIVeOgcWHdHdMS9cSN1vCy3bxZwzFm6VL7QA14WTudVj1sFvf4ReZNSCO0IvwngXFV3hkFcriuPokrPrYbYxjVAHiZ24zLYIeP7/E4xZUgHiZWt29D9ptGemHR7mPo9B10HLGbucRfs/Ww2f2CD4L2u0+wofKwwvrd0XoqCmr38CAZa1d58LesEpvgqtN4MCR1mVj2nZWOiweVB/CAXuyi59Y1auA2eekg6Xw8Tfm013A8LFV8mYXL61ZF4Hb8Zx8d9vBtbdG7s99XvOOZlF38QVtmlkAv0ffxTOjxU/o5p8FvKbSszw2ik87+Iz23Lwf134RiWf2tG3xN2T4oh8vDO4U33z+5qnefFnR77OA2wheh2WfbJBHeI/XgtNJEaHdtJNrvPn8E8eV/kW/2xn8FDc77LemOyq4J1XvSbds7SZ3cAV+86UXP283TGaFUk4ZwmNyugne8FaqxdHtFkH8GNewg2cc3PjsM7CbbNdMwQJ47aL3mP5H308ar5XOn2nUwpx+4hrx/z+qn5DBNqD4rMUpWACnPwnhkfa9SnZwvX1MnHLVi08cPle+0wBuAsykd8dO0KkS9L0dPCO37MVLxJc6nPHdTeNT/ZeLDQN/DEFpBzc33Bfckhx8K1q7IS5vuPgjbTf5AL97zcALxFUHN76QrF7heTHru54RN3bbxTeEn4Xx04f4NOfhSuPLncmnQk3z1yLlSE8fabtFHVyZyIQlXes8zrdSJR5ea7k3+asUooXg2mO4oDprT/XdHpROhouL/8A3edBw5DYxBhYdn08Q53jd0elDfApHbHjL6Hk/pvvNd1rEWdLl9iG+hpMgiMMdVEM64B8X5nq6ZBwX5rCSeK/4uInJROiwetLi0jtpG0yJBPOkTVQXryEPKqMQbq6JeyUTvUOkilq/EVGmo5NIpP3XRIzhXIafrjzF30JUIqecKxIjOpF6il9jbHTLxjs3rN5voPH+GxbDA1m7GrM9a4zdTigdCUUXD2MSSEAXQRxDo2QHl2iwV+h7gchqLrLrhmKxH/Z6nqLUQD5AYSHWAEwk+Z1Ck1vEAmEhBaVtufDtj8Zmv6U+PQNBqbDf/szVR5XNvQteSAzRyeQhzgnIKR2Invq43gQb4+oRaJCTTcRd6RkzGXlJQe3vDq8gsDB2S0QaSoViwKNW9Sh9zUzEMA2MWtU7nJUGYhIa4bnjcLthgkkopMAGj3dxXgoMCbg+laTFL8luSn9pFkrAMf031cmVJz0jXzsKFm6OSfVqYnEILPKZDjeicPFhQoaHbMhKX+NmZ5Q+ntr8n5obhGPVKlx48cs+FteKP3MlswWv6CSPHK4Dmntm0ckreW0snmxKbsnLFdyo4mrwjLYJo+Dmyn0k3uDTEpMRTrnPKza+IHy9wGSEU2yMvSrvHeJ/Qt2UV+p0hVacvsah0psKXqEVy7y2tPu3xhM1oMxLReY00tAlJG9JFZktzCwyU4lbuqQ7U22VN1zi9gvsIP05PjAL7H55H/C6rREzyvu41bbS4VXb1OV0FLG1YVsa1J1gtzaosVJbHO3Gb6z4bR2H89s61FRqCIcgL+E3lfyWlsaN3eR6QDP0pSdeKqOEZjOgoda285SUl5W+Jga181wz0WQFF2poM7FtZTZKXlXZ0Fam10htroY3Ug9s43pN5OJ2jyZy28Iu1nu0sNsGenGzRwO9bd8Xd/u0793LA8Vmn5cHnPhiH+Gt+HIv4Ye+tnHoSyMHvrJy6Aszh76uc+DLQuLQV5XGMY5xjGMc4xjHOMYxjnH80uNfW99BeoyzJCoAAAAASUVORK5CYII='; - -function findLogo(images) { - return _.find(images, { coverType: 'logo' }); -} - -function getLogoUrl(logo, size) { - const logoUrl = logo?.url; - - if (logoUrl) { - return logoUrl.replace('logo.jpg', `logo-${size}.jpg`); - } -} - -class ArtistLogo extends Component { - - // - // Lifecycle - - constructor(props, context) { - super(props, context); - - const pixelRatio = Math.floor(window.devicePixelRatio); - - const { - images, - size - } = props; - - const logo = findLogo(images); - - this.state = { - pixelRatio, - logo, - logoUrl: getLogoUrl(logo, pixelRatio * size), - hasError: false, - isLoaded: false - }; - } - - componentDidUpdate(prevProps) { - const { - images, - size - } = this.props; - - const { - pixelRatio - } = this.state; - - const logo = findLogo(images); - - if (logo && logo.url !== this.state.logo.url) { - this.setState({ - logo, - logoUrl: getLogoUrl(logo, pixelRatio * size), - hasError: false, - isLoaded: false - }); - } - } - - // - // Listeners - - onError = () => { - this.setState({ hasError: true }); - }; - - onLoad = () => { - this.setState({ isLoaded: true }); - }; - - // - // Render - - render() { - const { - className, - style, - size, - lazy, - overflow - } = this.props; - - const { - logoUrl, - hasError, - isLoaded - } = this.state; - - if (hasError || !logoUrl) { - return ( - - ); - } - - if (lazy) { - return ( - - } - > - - - ); - } - - return ( - - ); - } -} - -ArtistLogo.propTypes = { - className: PropTypes.string, - style: PropTypes.object, - images: PropTypes.arrayOf(PropTypes.object).isRequired, - size: PropTypes.number.isRequired, - lazy: PropTypes.bool.isRequired, - overflow: PropTypes.bool.isRequired -}; - -ArtistLogo.defaultProps = { - size: 250, - lazy: true, - overflow: false -}; - -export default ArtistLogo; diff --git a/frontend/src/Artist/ArtistNameLink.js b/frontend/src/Artist/ArtistNameLink.js deleted file mode 100644 index fab1cb974..000000000 --- a/frontend/src/Artist/ArtistNameLink.js +++ /dev/null @@ -1,20 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import Link from 'Components/Link/Link'; - -function ArtistNameLink({ foreignArtistId, artistName }) { - const link = `/artist/${foreignArtistId}`; - - return ( - - {artistName} - - ); -} - -ArtistNameLink.propTypes = { - foreignArtistId: PropTypes.string.isRequired, - artistName: PropTypes.string.isRequired -}; - -export default ArtistNameLink; diff --git a/frontend/src/Artist/ArtistPoster.js b/frontend/src/Artist/ArtistPoster.js deleted file mode 100644 index de594e5b9..000000000 --- a/frontend/src/Artist/ArtistPoster.js +++ /dev/null @@ -1,29 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import ArtistImage from './ArtistImage'; - -const posterPlaceholder = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPcAAAD3AgMAAAC84irAAAAADFBMVEUyMjI7Ozs1NTU4ODjgOsZvAAAAAWJLR0QAiAUdSAAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB+EJEBIzDdm9OfoAAAbkSURBVGje7Zq9b9s4FMBZFgUkBR27C3cw0MromL1jxwyVZASB67G4qWPgoSAyBdm9CwECKCp8nbIccGj/Ce/BTUb3Lh3aI997pCjnTnyyt0JcIif5+ZHvPZLvQ0KMYxzjGMc4xjGOcYxjHOP4JUfSfP7RVPvSH3MYX/eC5aecxne1v+w95WebFs/rwVO/8+h8PnT6t3ln/DFQuJ06/SyHiX9pxa7o5/lewkuLDxLvhM8tPki8g07dU8Gnj5zGlw7P79n4pDVYi8/YuHO4n03z0z6XXDom4G3TXDdN840+LobN/W1Ty2slHD8bNvevlUgutLmTj4NmT3pf6mMGcJGth+gefaZsDCjB2Wj65wN8ZmnAGnE6eFieI1FvcEISLjIUr9hm+w7PFeHiE9t0E7dyIatE48odXTPu0j/A3BMnXf7NXDxudTxbE2VxMWVu+sfwf3i1ZMLiaQLf+iWIP4VtjtTzFhc35vfveZrb4nPt4R95ulu1cxeVh8Psw7rzbgWp8dWHyr83WJpbgjypjS5XeZnqRxmJNUd3MS1d6ue/tOn0WuayNd2CoTlaeqwnIVeOgcWHdHdMS9cSN1vCy3bxZwzFm6VL7QA14WTudVj1sFvf4ReZNSCO0IvwngXFV3hkFcriuPokrPrYbYxjVAHiZ24zLYIeP7/E4xZUgHiZWt29D9ptGemHR7mPo9B10HLGbucRfs/Ww2f2CD4L2u0+wofKwwvrd0XoqCmr38CAZa1d58LesEpvgqtN4MCR1mVj2nZWOiweVB/CAXuyi59Y1auA2eekg6Xw8Tfm013A8LFV8mYXL61ZF4Hb8Zx8d9vBtbdG7s99XvOOZlF38QVtmlkAv0ffxTOjxU/o5p8FvKbSszw2ik87+Iz23Lwf134RiWf2tG3xN2T4oh8vDO4U33z+5qnefFnR77OA2wheh2WfbJBHeI/XgtNJEaHdtJNrvPn8E8eV/kW/2xn8FDc77LemOyq4J1XvSbds7SZ3cAV+86UXP283TGaFUk4ZwmNyugne8FaqxdHtFkH8GNewg2cc3PjsM7CbbNdMwQJ47aL3mP5H308ar5XOn2nUwpx+4hrx/z+qn5DBNqD4rMUpWACnPwnhkfa9SnZwvX1MnHLVi08cPle+0wBuAsykd8dO0KkS9L0dPCO37MVLxJc6nPHdTeNT/ZeLDQN/DEFpBzc33Bfckhx8K1q7IS5vuPgjbTf5AL97zcALxFUHN76QrF7heTHru54RN3bbxTeEn4Xx04f4NOfhSuPLncmnQk3z1yLlSE8fabtFHVyZyIQlXes8zrdSJR5ea7k3+asUooXg2mO4oDprT/XdHpROhouL/8A3edBw5DYxBhYdn08Q53jd0elDfApHbHjL6Hk/pvvNd1rEWdLl9iG+hpMgiMMdVEM64B8X5nq6ZBwX5rCSeK/4uInJROiwetLi0jtpG0yJBPOkTVQXryEPKqMQbq6JeyUTvUOkilq/EVGmo5NIpP3XRIzhXIafrjzF30JUIqecKxIjOpF6il9jbHTLxjs3rN5voPH+GxbDA1m7GrM9a4zdTigdCUUXD2MSSEAXQRxDo2QHl2iwV+h7gchqLrLrhmKxH/Z6nqLUQD5AYSHWAEwk+Z1Ck1vEAmEhBaVtufDtj8Zmv6U+PQNBqbDf/szVR5XNvQteSAzRyeQhzgnIKR2Invq43gQb4+oRaJCTTcRd6RkzGXlJQe3vDq8gsDB2S0QaSoViwKNW9Sh9zUzEMA2MWtU7nJUGYhIa4bnjcLthgkkopMAGj3dxXgoMCbg+laTFL8luSn9pFkrAMf031cmVJz0jXzsKFm6OSfVqYnEILPKZDjeicPFhQoaHbMhKX+NmZ5Q+ntr8n5obhGPVKlx48cs+FteKP3MlswWv6CSPHK4Dmntm0ckreW0snmxKbsnLFdyo4mrwjLYJo+Dmyn0k3uDTEpMRTrnPKza+IHy9wGSEU2yMvSrvHeJ/Qt2UV+p0hVacvsah0psKXqEVy7y2tPu3xhM1oMxLReY00tAlJG9JFZktzCwyU4lbuqQ7U22VN1zi9gvsIP05PjAL7H55H/C6rREzyvu41bbS4VXb1OV0FLG1YVsa1J1gtzaosVJbHO3Gb6z4bR2H89s61FRqCIcgL+E3lfyWlsaN3eR6QDP0pSdeKqOEZjOgoda285SUl5W+Jga181wz0WQFF2poM7FtZTZKXlXZ0Fam10htroY3Ug9s43pN5OJ2jyZy28Iu1nu0sNsGenGzRwO9bd8Xd/u0793LA8Vmn5cHnPhiH+Gt+HIv4Ye+tnHoSyMHvrJy6Aszh76uc+DLQuLQV5XGMY5xjGMc4xjHOMYxjnH80uNfW99BeoyzJCoAAAAASUVORK5CYII='; - -function ArtistPoster(props) { - return ( - - ); -} - -ArtistPoster.propTypes = { - ...ArtistImage.propTypes, - coverType: PropTypes.string, - placeholder: PropTypes.string, - overflow: PropTypes.bool, - size: PropTypes.number.isRequired -}; - -ArtistPoster.defaultProps = { - size: 250 -}; - -export default ArtistPoster; diff --git a/frontend/src/Artist/Delete/DeleteArtistModal.js b/frontend/src/Artist/Delete/DeleteArtistModal.js deleted file mode 100644 index c647b7735..000000000 --- a/frontend/src/Artist/Delete/DeleteArtistModal.js +++ /dev/null @@ -1,34 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import Modal from 'Components/Modal/Modal'; -import { sizes } from 'Helpers/Props'; -import DeleteArtistModalContentConnector from './DeleteArtistModalContentConnector'; - -function DeleteArtistModal(props) { - const { - isOpen, - onModalClose, - ...otherProps - } = props; - - return ( - - - - ); -} - -DeleteArtistModal.propTypes = { - ...DeleteArtistModalContentConnector.propTypes, - isOpen: PropTypes.bool.isRequired, - onModalClose: PropTypes.func.isRequired -}; - -export default DeleteArtistModal; diff --git a/frontend/src/Artist/Delete/DeleteArtistModalContent.css b/frontend/src/Artist/Delete/DeleteArtistModalContent.css deleted file mode 100644 index df8e4822e..000000000 --- a/frontend/src/Artist/Delete/DeleteArtistModalContent.css +++ /dev/null @@ -1,12 +0,0 @@ -.pathContainer { - margin-bottom: 20px; -} - -.pathIcon { - margin-right: 8px; -} - -.deleteFilesMessage { - margin-top: 20px; - color: var(--dangerColor); -} diff --git a/frontend/src/Artist/Delete/DeleteArtistModalContent.css.d.ts b/frontend/src/Artist/Delete/DeleteArtistModalContent.css.d.ts deleted file mode 100644 index e55686abe..000000000 --- a/frontend/src/Artist/Delete/DeleteArtistModalContent.css.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'deleteFilesMessage': string; - 'pathContainer': string; - 'pathIcon': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Delete/DeleteArtistModalContent.js b/frontend/src/Artist/Delete/DeleteArtistModalContent.js deleted file mode 100644 index ac1e2b041..000000000 --- a/frontend/src/Artist/Delete/DeleteArtistModalContent.js +++ /dev/null @@ -1,167 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import FormGroup from 'Components/Form/FormGroup'; -import FormInputGroup from 'Components/Form/FormInputGroup'; -import FormLabel from 'Components/Form/FormLabel'; -import Icon from 'Components/Icon'; -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 { icons, inputTypes, kinds } from 'Helpers/Props'; -import formatBytes from 'Utilities/Number/formatBytes'; -import translate from 'Utilities/String/translate'; -import styles from './DeleteArtistModalContent.css'; - -class DeleteArtistModalContent extends Component { - - // - // Lifecycle - - constructor(props, context) { - super(props, context); - - this.state = { - deleteFiles: false - }; - } - - // - // Listeners - - onDeleteFilesChange = ({ value }) => { - this.setState({ deleteFiles: value }); - }; - - onDeleteArtistConfirmed = () => { - const deleteFiles = this.state.deleteFiles; - const addImportListExclusion = this.props.deleteOptions.addImportListExclusion; - - this.setState({ deleteFiles: false }); - this.props.onDeletePress(deleteFiles, addImportListExclusion); - }; - - // - // Render - - render() { - const { - artistName, - path, - statistics, - deleteOptions, - onModalClose, - onDeleteOptionChange - } = this.props; - - const { - trackFileCount = 0, - sizeOnDisk = 0 - } = statistics; - - const deleteFiles = this.state.deleteFiles; - const addImportListExclusion = deleteOptions.addImportListExclusion; - - let deleteFilesLabel = `Delete ${trackFileCount} Track Files`; - let deleteFilesHelpText = translate('DeleteFilesHelpText'); - - if (trackFileCount === 0) { - deleteFilesLabel = 'Delete Artist Folder'; - deleteFilesHelpText = 'Delete the artist folder and its contents'; - } - - return ( - - - Delete - {artistName} - - - -
- - - {path} -
- - - {deleteFilesLabel} - - - - - - - {translate('AddListExclusion')} - - - - - - { - deleteFiles && -
-
- {translate('TheArtistFolderStrongpathstrongAndAllOfItsContentWillBeDeleted', [path])} -
- - { - !!trackFileCount && -
{trackFileCount} track files totaling {formatBytes(sizeOnDisk)}
- } -
- } - -
- - - - - - -
- ); - } -} - -DeleteArtistModalContent.propTypes = { - artistName: PropTypes.string.isRequired, - path: PropTypes.string.isRequired, - statistics: PropTypes.object.isRequired, - deleteOptions: PropTypes.object.isRequired, - onDeleteOptionChange: PropTypes.func.isRequired, - onDeletePress: PropTypes.func.isRequired, - onModalClose: PropTypes.func.isRequired -}; - -DeleteArtistModalContent.defaultProps = { - statistics: {} -}; - -export default DeleteArtistModalContent; diff --git a/frontend/src/Artist/Delete/DeleteArtistModalContentConnector.js b/frontend/src/Artist/Delete/DeleteArtistModalContentConnector.js deleted file mode 100644 index 321dc63a6..000000000 --- a/frontend/src/Artist/Delete/DeleteArtistModalContentConnector.js +++ /dev/null @@ -1,44 +0,0 @@ -import { connect } from 'react-redux'; -import { createSelector } from 'reselect'; -import { deleteArtist, setDeleteOption } from 'Store/Actions/artistActions'; -import createArtistSelector from 'Store/Selectors/createArtistSelector'; -import DeleteArtistModalContent from './DeleteArtistModalContent'; - -function createMapStateToProps() { - return createSelector( - (state) => state.artist.deleteOptions, - createArtistSelector(), - (deleteOptions, artist) => { - return { - ...artist, - deleteOptions - }; - } - ); -} - -function createMapDispatchToProps(dispatch, props) { - return { - onDeleteOptionChange(option) { - dispatch( - setDeleteOption({ - [option.name]: option.value - }) - ); - }, - - onDeletePress(deleteFiles, addImportListExclusion) { - dispatch( - deleteArtist({ - id: props.artistId, - deleteFiles, - addImportListExclusion - }) - ); - - props.onModalClose(true); - } - }; -} - -export default connect(createMapStateToProps, createMapDispatchToProps)(DeleteArtistModalContent); diff --git a/frontend/src/Artist/Details/AlbumGroupInfo.css b/frontend/src/Artist/Details/AlbumGroupInfo.css deleted file mode 100644 index 9a414e728..000000000 --- a/frontend/src/Artist/Details/AlbumGroupInfo.css +++ /dev/null @@ -1,11 +0,0 @@ -.title { - composes: title from '~Components/DescriptionList/DescriptionListItemTitle.css'; - - width: 90px; -} - -.description { - composes: description from '~Components/DescriptionList/DescriptionListItemDescription.css'; - - margin-left: 110px; -} diff --git a/frontend/src/Artist/Details/AlbumGroupInfo.css.d.ts b/frontend/src/Artist/Details/AlbumGroupInfo.css.d.ts deleted file mode 100644 index e0d8c2f6b..000000000 --- a/frontend/src/Artist/Details/AlbumGroupInfo.css.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'description': string; - 'title': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Details/AlbumGroupInfo.js b/frontend/src/Artist/Details/AlbumGroupInfo.js deleted file mode 100644 index 139cd7765..000000000 --- a/frontend/src/Artist/Details/AlbumGroupInfo.js +++ /dev/null @@ -1,66 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import DescriptionList from 'Components/DescriptionList/DescriptionList'; -import DescriptionListItem from 'Components/DescriptionList/DescriptionListItem'; -import formatBytes from 'Utilities/Number/formatBytes'; -import translate from 'Utilities/String/translate'; -import styles from './AlbumGroupInfo.css'; - -function AlbumGroupInfo(props) { - const { - totalAlbumCount, - monitoredAlbumCount, - albumFileCount, - trackFileCount, - sizeOnDisk - } = props; - - return ( - - - - - - - - - - - - ); -} - -AlbumGroupInfo.propTypes = { - totalAlbumCount: PropTypes.number.isRequired, - monitoredAlbumCount: PropTypes.number.isRequired, - albumFileCount: PropTypes.number.isRequired, - trackFileCount: PropTypes.number.isRequired, - sizeOnDisk: PropTypes.number.isRequired -}; - -export default AlbumGroupInfo; diff --git a/frontend/src/Artist/Details/AlbumRow.css b/frontend/src/Artist/Details/AlbumRow.css deleted file mode 100644 index 383d97746..000000000 --- a/frontend/src/Artist/Details/AlbumRow.css +++ /dev/null @@ -1,18 +0,0 @@ -.title { - composes: cell from '~Components/Table/Cells/TableRowCell.css'; - - word-break: break-word; -} - -.monitored { - composes: cell from '~Components/Table/Cells/TableRowCell.css'; - - width: 42px; -} - -.size, -.status { - composes: cell from '~Components/Table/Cells/TableRowCell.css'; - - width: 100px; -} diff --git a/frontend/src/Artist/Details/AlbumRow.css.d.ts b/frontend/src/Artist/Details/AlbumRow.css.d.ts deleted file mode 100644 index 90377b53b..000000000 --- a/frontend/src/Artist/Details/AlbumRow.css.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'monitored': string; - 'size': string; - 'status': string; - 'title': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Details/AlbumRow.js b/frontend/src/Artist/Details/AlbumRow.js deleted file mode 100644 index b5c8fa2cf..000000000 --- a/frontend/src/Artist/Details/AlbumRow.js +++ /dev/null @@ -1,276 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import AlbumSearchCellConnector from 'Album/AlbumSearchCellConnector'; -import AlbumTitleLink from 'Album/AlbumTitleLink'; -import Label from 'Components/Label'; -import MonitorToggleButton from 'Components/MonitorToggleButton'; -import StarRating from 'Components/StarRating'; -import RelativeDateCellConnector from 'Components/Table/Cells/RelativeDateCellConnector'; -import TableRowCell from 'Components/Table/Cells/TableRowCell'; -import TableRow from 'Components/Table/TableRow'; -import { kinds, sizes } from 'Helpers/Props'; -import formatTimeSpan from 'Utilities/Date/formatTimeSpan'; -import formatBytes from 'Utilities/Number/formatBytes'; -import translate from 'Utilities/String/translate'; -import styles from './AlbumRow.css'; - -function getTrackCountKind(monitored, trackFileCount, trackCount) { - if (trackFileCount === trackCount && trackCount > 0) { - return kinds.SUCCESS; - } - - if (!monitored) { - return kinds.WARNING; - } - - return kinds.DANGER; -} - -class AlbumRow extends Component { - - // - // Lifecycle - - constructor(props, context) { - super(props, context); - - this.state = { - isDetailsModalOpen: false, - isEditAlbumModalOpen: false - }; - } - - // - // Listeners - - onManualSearchPress = () => { - this.setState({ isDetailsModalOpen: true }); - }; - - onDetailsModalClose = () => { - this.setState({ isDetailsModalOpen: false }); - }; - - onEditAlbumPress = () => { - this.setState({ isEditAlbumModalOpen: true }); - }; - - onEditAlbumModalClose = () => { - this.setState({ isEditAlbumModalOpen: false }); - }; - - onMonitorAlbumPress = (monitored, options) => { - this.props.onMonitorAlbumPress(this.props.id, monitored, options); - }; - - // - // Render - - render() { - const { - id, - artistId, - monitored, - statistics, - duration, - releaseDate, - mediumCount, - secondaryTypes, - title, - ratings, - disambiguation, - isSaving, - artistMonitored, - foreignAlbumId, - columns - } = this.props; - - const { - trackCount = 0, - trackFileCount = 0, - totalTrackCount = 0, - sizeOnDisk = 0 - } = statistics; - - return ( - - { - columns.map((column) => { - const { - name, - isVisible - } = column; - - if (!isVisible) { - return null; - } - - if (name === 'monitored') { - return ( - - - - ); - } - - if (name === 'title') { - return ( - - - - ); - } - - if (name === 'mediumCount') { - return ( - - { - mediumCount - } - - ); - } - - if (name === 'secondaryTypes') { - return ( - - {secondaryTypes.join(', ')} - - ); - } - - if (name === 'trackCount') { - return ( - - { - totalTrackCount - } - - ); - } - - if (name === 'duration') { - return ( - - { - formatTimeSpan(duration) - } - - ); - } - - if (name === 'rating') { - return ( - - { - - } - - ); - } - - if (name === 'releaseDate') { - return ( - - ); - } - - if (name === 'size') { - return ( - - {!!sizeOnDisk && formatBytes(sizeOnDisk)} - - ); - } - - if (name === 'status') { - return ( - - - - ); - } - - if (name === 'actions') { - return ( - - ); - } - return null; - }) - } - - ); - } -} - -AlbumRow.propTypes = { - id: PropTypes.number.isRequired, - artistId: PropTypes.number.isRequired, - monitored: PropTypes.bool.isRequired, - releaseDate: PropTypes.string.isRequired, - mediumCount: PropTypes.number.isRequired, - duration: PropTypes.number.isRequired, - title: PropTypes.string.isRequired, - ratings: PropTypes.object.isRequired, - disambiguation: PropTypes.string, - secondaryTypes: PropTypes.arrayOf(PropTypes.string).isRequired, - foreignAlbumId: PropTypes.string.isRequired, - isSaving: PropTypes.bool, - unverifiedSceneNumbering: PropTypes.bool, - artistMonitored: PropTypes.bool.isRequired, - statistics: PropTypes.object.isRequired, - mediaInfo: PropTypes.object, - columns: PropTypes.arrayOf(PropTypes.object).isRequired, - onMonitorAlbumPress: PropTypes.func.isRequired -}; - -AlbumRow.defaultProps = { - statistics: { - trackCount: 0, - trackFileCount: 0, - totalTrackCount: 0 - } -}; - -export default AlbumRow; diff --git a/frontend/src/Artist/Details/AlbumRowConnector.js b/frontend/src/Artist/Details/AlbumRowConnector.js deleted file mode 100644 index f00bd3fce..000000000 --- a/frontend/src/Artist/Details/AlbumRowConnector.js +++ /dev/null @@ -1,21 +0,0 @@ -/* eslint max-params: 0 */ -import { connect } from 'react-redux'; -import { createSelector } from 'reselect'; -import createArtistSelector from 'Store/Selectors/createArtistSelector'; -import createTrackFileSelector from 'Store/Selectors/createTrackFileSelector'; -import AlbumRow from './AlbumRow'; - -function createMapStateToProps() { - return createSelector( - createArtistSelector(), - createTrackFileSelector(), - (artist = {}, trackFile) => { - return { - foreignArtistId: artist.foreignArtistId, - artistMonitored: artist.monitored, - trackFilePath: trackFile ? trackFile.path : null - }; - } - ); -} -export default connect(createMapStateToProps)(AlbumRow); diff --git a/frontend/src/Artist/Details/ArtistAlternateTitles.css b/frontend/src/Artist/Details/ArtistAlternateTitles.css deleted file mode 100644 index 1af1ae68b..000000000 --- a/frontend/src/Artist/Details/ArtistAlternateTitles.css +++ /dev/null @@ -1,3 +0,0 @@ -.alternateTitle { - white-space: nowrap; -} diff --git a/frontend/src/Artist/Details/ArtistAlternateTitles.css.d.ts b/frontend/src/Artist/Details/ArtistAlternateTitles.css.d.ts deleted file mode 100644 index 6a526456a..000000000 --- a/frontend/src/Artist/Details/ArtistAlternateTitles.css.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'alternateTitle': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Details/ArtistAlternateTitles.js b/frontend/src/Artist/Details/ArtistAlternateTitles.js deleted file mode 100644 index e1fde52e6..000000000 --- a/frontend/src/Artist/Details/ArtistAlternateTitles.js +++ /dev/null @@ -1,28 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import styles from './ArtistAlternateTitles.css'; - -function ArtistAlternateTitles({ alternateTitles }) { - return ( -
    - { - alternateTitles.map((alternateTitle) => { - return ( -
  • - {alternateTitle} -
  • - ); - }) - } -
- ); -} - -ArtistAlternateTitles.propTypes = { - alternateTitles: PropTypes.arrayOf(PropTypes.string).isRequired -}; - -export default ArtistAlternateTitles; diff --git a/frontend/src/Artist/Details/ArtistDetails.css b/frontend/src/Artist/Details/ArtistDetails.css deleted file mode 100644 index 43daa40d0..000000000 --- a/frontend/src/Artist/Details/ArtistDetails.css +++ /dev/null @@ -1,176 +0,0 @@ -.innerContentBody { - padding: 0; -} - -.header { - position: relative; - width: 100%; - height: 310px; -} - -.errorMessage { - margin-top: 20px; - text-align: center; - font-size: 20px; -} - -.backdrop { - position: absolute; - z-index: -1; - width: 100%; - height: 100%; - background-size: cover; -} - -.backdropOverlay { - position: absolute; - width: 100%; - height: 100%; - background: var(--black); - opacity: 0.7; -} - -.headerContent { - display: flex; - padding: 30px; - width: 100%; - height: 100%; - color: var(--white); -} - -.poster { - flex-shrink: 0; - margin-right: 35px; - width: 250px; - height: 250px; -} - -.info { - display: flex; - flex-direction: column; - flex-grow: 1; - overflow: hidden; -} - -.metadataMessage { - color: var(--helpTextColor); - text-align: center; - font-weight: 300; - font-size: 20px; -} - -.titleRow { - position: relative; - display: flex; - justify-content: space-between; - flex: 0 0 auto; -} - -.titleContainer { - display: flex; - margin-bottom: 5px; -} - -.title { - font-weight: 300; - font-size: 50px; - line-height: 50px; -} - -.toggleMonitoredContainer { - align-self: center; - margin-right: 10px; -} - -.monitorToggleButton { - composes: toggleButton from '~Components/MonitorToggleButton.css'; - - width: 40px; - - &:hover { - color: var(--iconButtonHoverLightColor); - } -} - -.alternateTitlesIconContainer { - align-self: flex-end; - margin-left: 20px; -} - -.artistNavigationButtons { - position: absolute; - right: 0; - white-space: nowrap; -} - -.artistNavigationButton { - composes: button from '~Components/Link/IconButton.css'; - - margin-left: 5px; - width: 30px; - color: #e1e2e3; - white-space: nowrap; - - &:hover { - color: var(--iconButtonHoverLightColor); - } -} - -.details { - margin-bottom: 8px; - font-weight: 300; - font-size: 20px; -} - -.runtime { - margin-right: 15px; -} - -.detailsLabel { - composes: label from '~Components/Label.css'; - - margin: 5px 10px 5px 0; -} - -.path, -.sizeOnDisk, -.qualityProfileName, -.links, -.tags { - margin-left: 8px; - font-weight: 300; - font-size: 17px; -} - -.overview { - flex: 1 0 auto; - margin-top: 8px; - min-height: 0; - font-size: $intermediateFontSize; -} - -.contentContainer { - padding: 20px; -} - -@media only screen and (max-width: $breakpointSmall) { - .contentContainer { - padding: 20px 0; - } - - .headerContent { - padding: 15px; - } - - .title { - font-weight: 300; - font-size: 30px; - line-height: 30px; - } -} - -@media only screen and (max-width: $breakpointLarge) { - .poster { - display: none; - } -} diff --git a/frontend/src/Artist/Details/ArtistDetails.css.d.ts b/frontend/src/Artist/Details/ArtistDetails.css.d.ts deleted file mode 100644 index ca3bdbd97..000000000 --- a/frontend/src/Artist/Details/ArtistDetails.css.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'alternateTitlesIconContainer': string; - 'artistNavigationButton': string; - 'artistNavigationButtons': string; - 'backdrop': string; - 'backdropOverlay': string; - 'contentContainer': string; - 'details': string; - 'detailsLabel': string; - 'errorMessage': string; - 'header': string; - 'headerContent': string; - 'info': string; - 'innerContentBody': string; - 'links': string; - 'metadataMessage': string; - 'monitorToggleButton': string; - 'overview': string; - 'path': string; - 'poster': string; - 'qualityProfileName': string; - 'runtime': string; - 'sizeOnDisk': string; - 'tags': string; - 'title': string; - 'titleContainer': string; - 'titleRow': string; - 'toggleMonitoredContainer': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Details/ArtistDetails.js b/frontend/src/Artist/Details/ArtistDetails.js deleted file mode 100644 index 1bfa767c3..000000000 --- a/frontend/src/Artist/Details/ArtistDetails.js +++ /dev/null @@ -1,766 +0,0 @@ -import _ from 'lodash'; -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import TextTruncate from 'react-text-truncate'; -import ArtistPoster from 'Artist/ArtistPoster'; -import DeleteArtistModal from 'Artist/Delete/DeleteArtistModal'; -import EditArtistModalConnector from 'Artist/Edit/EditArtistModalConnector'; -import ArtistHistoryModal from 'Artist/History/ArtistHistoryModal'; -import MonitoringOptionsModal from 'Artist/MonitoringOptions/MonitoringOptionsModal'; -import ArtistInteractiveSearchModalConnector from 'Artist/Search/ArtistInteractiveSearchModalConnector'; -import Alert from 'Components/Alert'; -import HeartRating from 'Components/HeartRating'; -import Icon from 'Components/Icon'; -import Label from 'Components/Label'; -import IconButton from 'Components/Link/IconButton'; -import Link from 'Components/Link/Link'; -import LoadingIndicator from 'Components/Loading/LoadingIndicator'; -import MonitorToggleButton from 'Components/MonitorToggleButton'; -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 Popover from 'Components/Tooltip/Popover'; -import Tooltip from 'Components/Tooltip/Tooltip'; -import { align, icons, kinds, sizes, tooltipPositions } from 'Helpers/Props'; -import OrganizePreviewModalConnector from 'Organize/OrganizePreviewModalConnector'; -import RetagPreviewModalConnector from 'Retag/RetagPreviewModalConnector'; -import QualityProfileNameConnector from 'Settings/Profiles/Quality/QualityProfileNameConnector'; -import fonts from 'Styles/Variables/fonts'; -import TrackFileEditorModal from 'TrackFile/Editor/TrackFileEditorModal'; -import formatBytes from 'Utilities/Number/formatBytes'; -import translate from 'Utilities/String/translate'; -import selectAll from 'Utilities/Table/selectAll'; -import toggleSelected from 'Utilities/Table/toggleSelected'; -import InteractiveImportModal from '../../InteractiveImport/InteractiveImportModal'; -import ArtistAlternateTitles from './ArtistAlternateTitles'; -import ArtistDetailsLinks from './ArtistDetailsLinks'; -import ArtistDetailsSeasonConnector from './ArtistDetailsSeasonConnector'; -import ArtistGenres from './ArtistGenres'; -import ArtistTagsConnector from './ArtistTagsConnector'; -import styles from './ArtistDetails.css'; - -const defaultFontSize = parseInt(fonts.defaultFontSize); -const lineHeight = parseFloat(fonts.lineHeight); - -function getFanartUrl(images) { - return _.find(images, { coverType: 'fanart' })?.url; -} - -function getExpandedState(newState) { - return { - allExpanded: newState.allSelected, - allCollapsed: newState.allUnselected, - expandedState: newState.selectedState - }; -} - -class ArtistDetails extends Component { - - // - // Lifecycle - - constructor(props, context) { - super(props, context); - - this.state = { - isOrganizeModalOpen: false, - isRetagModalOpen: false, - isManageTracksOpen: false, - isEditArtistModalOpen: false, - isDeleteArtistModalOpen: false, - isArtistHistoryModalOpen: false, - isInteractiveImportModalOpen: false, - isInteractiveSearchModalOpen: false, - isMonitorOptionsModalOpen: false, - allExpanded: false, - allCollapsed: false, - expandedState: {} - }; - } - - // - // Listeners - - onOrganizePress = () => { - this.setState({ isOrganizeModalOpen: true }); - }; - - onOrganizeModalClose = () => { - this.setState({ isOrganizeModalOpen: false }); - }; - - onRetagPress = () => { - this.setState({ isRetagModalOpen: true }); - }; - - onRetagModalClose = () => { - this.setState({ isRetagModalOpen: false }); - }; - - onManageTracksPress = () => { - this.setState({ isManageTracksOpen: true }); - }; - - onManageTracksModalClose = () => { - this.setState({ isManageTracksOpen: false }); - }; - - onInteractiveImportPress = () => { - this.setState({ isInteractiveImportModalOpen: true }); - }; - - onInteractiveImportModalClose = () => { - this.setState({ isInteractiveImportModalOpen: false }); - }; - - onInteractiveSearchPress = () => { - this.setState({ isInteractiveSearchModalOpen: true }); - }; - - onInteractiveSearchModalClose = () => { - this.setState({ isInteractiveSearchModalOpen: false }); - }; - - onEditArtistPress = () => { - this.setState({ isEditArtistModalOpen: true }); - }; - - onEditArtistModalClose = () => { - this.setState({ isEditArtistModalOpen: false }); - }; - - onDeleteArtistPress = () => { - this.setState({ - isEditArtistModalOpen: false, - isDeleteArtistModalOpen: true - }); - }; - - onDeleteArtistModalClose = () => { - this.setState({ isDeleteArtistModalOpen: false }); - }; - - onArtistHistoryPress = () => { - this.setState({ isArtistHistoryModalOpen: true }); - }; - - onArtistHistoryModalClose = () => { - this.setState({ isArtistHistoryModalOpen: false }); - }; - - onMonitorOptionsPress = () => { - this.setState({ isMonitorOptionsModalOpen: true }); - }; - - onMonitorOptionsClose = () => { - this.setState({ isMonitorOptionsModalOpen: false }); - }; - - onExpandAllPress = () => { - const { - allExpanded, - expandedState - } = this.state; - - this.setState(getExpandedState(selectAll(expandedState, !allExpanded))); - }; - - onExpandPress = (albumId, isExpanded) => { - this.setState((state) => { - const convertedState = { - allSelected: state.allExpanded, - allUnselected: state.allCollapsed, - selectedState: state.expandedState - }; - - const newState = toggleSelected(convertedState, [], albumId, isExpanded, false); - - return getExpandedState(newState); - }); - }; - - // - // Render - - render() { - const { - id, - foreignArtistId, - artistName, - ratings, - path, - statistics = {}, - qualityProfileId, - monitored, - genres, - albumTypes, - status, - overview, - links, - images, - artistType, - alternateTitles, - tags, - isSaving, - isRefreshing, - isSearching, - isFetching, - isPopulated, - albumsError, - trackFilesError, - hasAlbums, - hasMonitoredAlbums, - hasTrackFiles, - previousArtist, - nextArtist, - onMonitorTogglePress, - onRefreshPress, - onSearchPress - } = this.props; - - const { - trackFileCount = 0, - sizeOnDisk = 0 - } = statistics; - - const { - isOrganizeModalOpen, - isRetagModalOpen, - isManageTracksOpen, - isEditArtistModalOpen, - isDeleteArtistModalOpen, - isArtistHistoryModalOpen, - isInteractiveImportModalOpen, - isInteractiveSearchModalOpen, - isMonitorOptionsModalOpen, - allExpanded, - allCollapsed, - expandedState - } = this.state; - - const continuing = status === 'continuing'; - const endedString = artistType === 'Person' ? translate('Deceased') : translate('Inactive'); - - let trackFilesCountMessage = translate('TrackFilesCountMessage'); - - if (trackFileCount === 1) { - trackFilesCountMessage = '1 track file'; - } else if (trackFileCount > 1) { - trackFilesCountMessage = `${trackFileCount} track files`; - } - - let expandIcon = icons.EXPAND_INDETERMINATE; - - if (allExpanded) { - expandIcon = icons.COLLAPSE; - } else if (allCollapsed) { - expandIcon = icons.EXPAND; - } - - const fanartUrl = getFanartUrl(images); - - return ( - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
- -
- - -
-
-
-
- -
- -
- {artistName} -
- - { - !!alternateTitles.length && -
- - } - title={translate('AlternateTitles')} - body={} - position={tooltipPositions.BOTTOM} - /> -
- } -
- -
- - - - - -
-
- -
-
- - - -
-
- -
- - - - - - - { - formatBytes(sizeOnDisk || 0) - } - - - } - tooltip={ - - {trackFilesCountMessage} - - } - kind={kinds.INVERSE} - position={tooltipPositions.BOTTOM} - /> - - - - - - - - - - - - {translate('Links')} - - - } - tooltip={ - - } - kind={kinds.INVERSE} - position={tooltipPositions.BOTTOM} - /> - - { - !!tags.length && - - - - - Tags - - - } - tooltip={} - kind={kinds.INVERSE} - position={tooltipPositions.BOTTOM} - /> - - } -
-
- -
-
-
-
- -
- { - !isPopulated && !albumsError && !trackFilesError && - - } - - { - !isFetching && albumsError ? - - {translate('AlbumsLoadError')} - : - null - } - - { - !isFetching && trackFilesError ? - - {translate('TrackFilesLoadError')} - : - null - } - - { - isPopulated && !!albumTypes.length && -
- { - albumTypes.slice(0).map((albumType) => { - return ( - - ); - }) - } -
- } - -
- -
- Missing Albums, Singles, or Other Types? Modify or create a new - Metadata Profile - or manually - Search - for new items! -
- - - - - - - - - - - - - - - - - - - - - ); - } -} - -ArtistDetails.propTypes = { - id: PropTypes.number.isRequired, - foreignArtistId: PropTypes.string.isRequired, - artistName: PropTypes.string.isRequired, - ratings: PropTypes.object.isRequired, - path: PropTypes.string.isRequired, - statistics: PropTypes.object.isRequired, - qualityProfileId: PropTypes.number.isRequired, - monitored: PropTypes.bool.isRequired, - artistType: PropTypes.string, - albumTypes: PropTypes.arrayOf(PropTypes.string), - genres: PropTypes.arrayOf(PropTypes.string), - status: PropTypes.string.isRequired, - overview: PropTypes.string.isRequired, - links: PropTypes.arrayOf(PropTypes.object).isRequired, - images: PropTypes.arrayOf(PropTypes.object).isRequired, - alternateTitles: PropTypes.arrayOf(PropTypes.string).isRequired, - tags: PropTypes.arrayOf(PropTypes.number).isRequired, - isSaving: PropTypes.bool.isRequired, - isRefreshing: PropTypes.bool.isRequired, - isSearching: PropTypes.bool.isRequired, - isFetching: PropTypes.bool.isRequired, - isPopulated: PropTypes.bool.isRequired, - albumsError: PropTypes.object, - trackFilesError: PropTypes.object, - hasAlbums: PropTypes.bool.isRequired, - hasMonitoredAlbums: PropTypes.bool.isRequired, - hasTrackFiles: PropTypes.bool.isRequired, - previousArtist: PropTypes.object.isRequired, - nextArtist: PropTypes.object.isRequired, - onMonitorTogglePress: PropTypes.func.isRequired, - onRefreshPress: PropTypes.func.isRequired, - onSearchPress: PropTypes.func.isRequired -}; - -ArtistDetails.defaultProps = { - statistics: {}, - tags: [], - isSaving: false -}; - -export default ArtistDetails; diff --git a/frontend/src/Artist/Details/ArtistDetailsConnector.js b/frontend/src/Artist/Details/ArtistDetailsConnector.js deleted file mode 100644 index bed30a937..000000000 --- a/frontend/src/Artist/Details/ArtistDetailsConnector.js +++ /dev/null @@ -1,279 +0,0 @@ -/* eslint max-params: 0 */ -import _ from 'lodash'; -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 { clearAlbums, fetchAlbums } from 'Store/Actions/albumActions'; -import { toggleArtistMonitored } from 'Store/Actions/artistActions'; -import { executeCommand } from 'Store/Actions/commandActions'; -import { clearQueueDetails, fetchQueueDetails } from 'Store/Actions/queueActions'; -import { clearTrackFiles, fetchTrackFiles } from 'Store/Actions/trackFileActions'; -import createAllArtistSelector from 'Store/Selectors/createAllArtistSelector'; -import createCommandsSelector from 'Store/Selectors/createCommandsSelector'; -import { findCommand, isCommandExecuting } from 'Utilities/Command'; -import { registerPagePopulator, unregisterPagePopulator } from 'Utilities/pagePopulator'; -import ArtistDetails from './ArtistDetails'; - -const selectAlbums = createSelector( - (state) => state.albums, - (albums) => { - const { - items, - isFetching, - isPopulated, - error - } = albums; - - const hasAlbums = !!items.length; - const hasMonitoredAlbums = items.some((e) => e.monitored); - const albumTypes = _.uniq(_.map(items, 'albumType')); - - return { - isAlbumsFetching: isFetching, - isAlbumsPopulated: isPopulated, - albumsError: error, - hasAlbums, - hasMonitoredAlbums, - albumTypes - }; - } -); - -const selectTrackFiles = createSelector( - (state) => state.trackFiles, - (trackFiles) => { - const { - items, - isFetching, - isPopulated, - error - } = trackFiles; - - const hasTrackFiles = !!items.length; - - return { - isTrackFilesFetching: isFetching, - isTrackFilesPopulated: isPopulated, - trackFilesError: error, - hasTrackFiles - }; - } -); - -function createMapStateToProps() { - return createSelector( - (state, { foreignArtistId }) => foreignArtistId, - selectAlbums, - selectTrackFiles, - createAllArtistSelector(), - createCommandsSelector(), - (foreignArtistId, albums, trackFiles, allArtists, commands) => { - const sortedArtist = _.orderBy(allArtists, 'sortName'); - const artistIndex = _.findIndex(sortedArtist, { foreignArtistId }); - const artist = sortedArtist[artistIndex]; - - if (!artist) { - return {}; - } - - const { - isAlbumsFetching, - isAlbumsPopulated, - albumsError, - hasAlbums, - hasMonitoredAlbums, - albumTypes - } = albums; - - const { - isTrackFilesFetching, - isTrackFilesPopulated, - trackFilesError, - hasTrackFiles - } = trackFiles; - - const sortedAlbumTypes = _.orderBy(albumTypes); - - const previousArtist = sortedArtist[artistIndex - 1] || _.last(sortedArtist); - const nextArtist = sortedArtist[artistIndex + 1] || _.first(sortedArtist); - const isArtistRefreshing = isCommandExecuting(findCommand(commands, { name: commandNames.REFRESH_ARTIST, artistId: artist.id })); - const artistRefreshingCommand = findCommand(commands, { name: commandNames.REFRESH_ARTIST }); - const allArtistRefreshing = ( - isCommandExecuting(artistRefreshingCommand) && - !artistRefreshingCommand.body.artistId - ); - const isRefreshing = isArtistRefreshing || allArtistRefreshing; - const isSearching = isCommandExecuting(findCommand(commands, { name: commandNames.ARTIST_SEARCH, artistId: artist.id })); - const isRenamingFiles = isCommandExecuting(findCommand(commands, { name: commandNames.RENAME_FILES, artistId: artist.id })); - const isRenamingArtistCommand = findCommand(commands, { name: commandNames.RENAME_ARTIST }); - const isRenamingArtist = ( - isCommandExecuting(isRenamingArtistCommand) && - isRenamingArtistCommand.body.artistIds.indexOf(artist.id) > -1 - ); - - const isFetching = isAlbumsFetching || isTrackFilesFetching; - const isPopulated = isAlbumsPopulated && isTrackFilesPopulated; - - const alternateTitles = _.reduce(artist.alternateTitles, (acc, alternateTitle) => { - if ((alternateTitle.seasonNumber === -1 || alternateTitle.seasonNumber === undefined) && - (alternateTitle.sceneSeasonNumber === -1 || alternateTitle.sceneSeasonNumber === undefined)) { - acc.push(alternateTitle.title); - } - - return acc; - }, []); - - return { - ...artist, - albumTypes: sortedAlbumTypes, - alternateTitles, - isArtistRefreshing, - allArtistRefreshing, - isRefreshing, - isSearching, - isRenamingFiles, - isRenamingArtist, - isFetching, - isPopulated, - albumsError, - trackFilesError, - hasAlbums, - hasMonitoredAlbums, - hasTrackFiles, - previousArtist, - nextArtist - }; - } - ); -} - -const mapDispatchToProps = { - fetchAlbums, - clearAlbums, - fetchTrackFiles, - clearTrackFiles, - toggleArtistMonitored, - fetchQueueDetails, - clearQueueDetails, - executeCommand -}; - -class ArtistDetailsConnector extends Component { - - // - // Lifecycle - - componentDidMount() { - registerPagePopulator(this.populate); - this.populate(); - } - - componentDidUpdate(prevProps) { - const { - id, - isArtistRefreshing, - allArtistRefreshing, - isRenamingFiles, - isRenamingArtist - } = this.props; - - if ( - (prevProps.isArtistRefreshing && !isArtistRefreshing) || - (prevProps.allArtistRefreshing && !allArtistRefreshing) || - (prevProps.isRenamingFiles && !isRenamingFiles) || - (prevProps.isRenamingArtist && !isRenamingArtist) - ) { - this.populate(); - } - - // If the id has changed we need to clear the albums - // files and fetch from the server. - - if (prevProps.id !== id) { - this.unpopulate(); - this.populate(); - } - } - - componentWillUnmount() { - unregisterPagePopulator(this.populate); - this.unpopulate(); - } - - // - // Control - - populate = () => { - const artistId = this.props.id; - - this.props.fetchAlbums({ artistId }); - this.props.fetchTrackFiles({ artistId }); - this.props.fetchQueueDetails({ artistId }); - }; - - unpopulate = () => { - this.props.clearAlbums(); - this.props.clearTrackFiles(); - this.props.clearQueueDetails(); - }; - - // - // Listeners - - onMonitorTogglePress = (monitored) => { - this.props.toggleArtistMonitored({ - artistId: this.props.id, - monitored - }); - }; - - onRefreshPress = () => { - this.props.executeCommand({ - name: commandNames.REFRESH_ARTIST, - artistId: this.props.id - }); - }; - - onSearchPress = () => { - this.props.executeCommand({ - name: commandNames.ARTIST_SEARCH, - artistId: this.props.id - }); - }; - - // - // Render - - render() { - return ( - - ); - } -} - -ArtistDetailsConnector.propTypes = { - id: PropTypes.number.isRequired, - foreignArtistId: PropTypes.string.isRequired, - isArtistRefreshing: PropTypes.bool.isRequired, - allArtistRefreshing: PropTypes.bool.isRequired, - isRefreshing: PropTypes.bool.isRequired, - isRenamingFiles: PropTypes.bool.isRequired, - isRenamingArtist: PropTypes.bool.isRequired, - fetchAlbums: PropTypes.func.isRequired, - clearAlbums: PropTypes.func.isRequired, - fetchTrackFiles: PropTypes.func.isRequired, - clearTrackFiles: PropTypes.func.isRequired, - toggleArtistMonitored: PropTypes.func.isRequired, - fetchQueueDetails: PropTypes.func.isRequired, - clearQueueDetails: PropTypes.func.isRequired, - executeCommand: PropTypes.func.isRequired -}; - -export default connect(createMapStateToProps, mapDispatchToProps)(ArtistDetailsConnector); diff --git a/frontend/src/Artist/Details/ArtistDetailsLinks.css b/frontend/src/Artist/Details/ArtistDetailsLinks.css deleted file mode 100644 index d37a082a1..000000000 --- a/frontend/src/Artist/Details/ArtistDetailsLinks.css +++ /dev/null @@ -1,13 +0,0 @@ -.links { - margin: 0; -} - -.link { - white-space: nowrap; -} - -.linkLabel { - composes: label from '~Components/Label.css'; - - cursor: pointer; -} diff --git a/frontend/src/Artist/Details/ArtistDetailsLinks.css.d.ts b/frontend/src/Artist/Details/ArtistDetailsLinks.css.d.ts deleted file mode 100644 index 9f91f93a4..000000000 --- a/frontend/src/Artist/Details/ArtistDetailsLinks.css.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'link': string; - 'linkLabel': string; - 'links': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Details/ArtistDetailsLinks.js b/frontend/src/Artist/Details/ArtistDetailsLinks.js deleted file mode 100644 index d6229b484..000000000 --- a/frontend/src/Artist/Details/ArtistDetailsLinks.js +++ /dev/null @@ -1,63 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import Label from 'Components/Label'; -import Link from 'Components/Link/Link'; -import { kinds, sizes } from 'Helpers/Props'; -import styles from './ArtistDetailsLinks.css'; - -function ArtistDetailsLinks(props) { - const { - foreignArtistId, - links - } = props; - - return ( -
- - - - - - {links.map((link, index) => { - return ( - - - - - {(index > 0 && index % 5 === 0) && -
- } - -
- ); - })} - -
- - ); -} - -ArtistDetailsLinks.propTypes = { - foreignArtistId: PropTypes.string.isRequired, - links: PropTypes.arrayOf(PropTypes.object).isRequired -}; - -export default ArtistDetailsLinks; diff --git a/frontend/src/Artist/Details/ArtistDetailsPageConnector.js b/frontend/src/Artist/Details/ArtistDetailsPageConnector.js deleted file mode 100644 index cb379af26..000000000 --- a/frontend/src/Artist/Details/ArtistDetailsPageConnector.js +++ /dev/null @@ -1,118 +0,0 @@ -import { push } from 'connected-react-router'; -import _ from 'lodash'; -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import { connect } from 'react-redux'; -import { createSelector } from 'reselect'; -import LoadingIndicator from 'Components/Loading/LoadingIndicator'; -import NotFound from 'Components/NotFound'; -import PageContent from 'Components/Page/PageContent'; -import PageContentBody from 'Components/Page/PageContentBody'; -import getErrorMessage from 'Utilities/Object/getErrorMessage'; -import translate from 'Utilities/String/translate'; -import ArtistDetailsConnector from './ArtistDetailsConnector'; -import styles from './ArtistDetails.css'; - -function createMapStateToProps() { - return createSelector( - (state, { match }) => match, - (state) => state.artist, - (match, artist) => { - const foreignArtistId = match.params.foreignArtistId; - const { - isFetching, - isPopulated, - error, - items - } = artist; - - const artistIndex = _.findIndex(items, { foreignArtistId }); - - if (artistIndex > -1) { - return { - isFetching, - isPopulated, - foreignArtistId - }; - } - - return { - isFetching, - isPopulated, - error - }; - } - ); -} - -const mapDispatchToProps = { - push -}; - -class ArtistDetailsPageConnector extends Component { - - // - // Lifecycle - - componentDidUpdate(prevProps) { - if (!this.props.foreignArtistId) { - this.props.push(`${window.Lidarr.urlBase}/`); - return; - } - } - - // - // Render - - render() { - const { - foreignArtistId, - isFetching, - isPopulated, - error - } = this.props; - - if (isFetching && !isPopulated) { - return ( - - - - - - ); - } - - if (!isFetching && !!error) { - return ( -
- {getErrorMessage(error, 'Failed to load artist from API')} -
- ); - } - - if (!foreignArtistId) { - return ( - - ); - } - - return ( - - ); - } -} - -ArtistDetailsPageConnector.propTypes = { - foreignArtistId: PropTypes.string, - isFetching: PropTypes.bool.isRequired, - isPopulated: PropTypes.bool.isRequired, - error: PropTypes.object, - match: PropTypes.shape({ params: PropTypes.shape({ foreignArtistId: PropTypes.string.isRequired }).isRequired }).isRequired, - push: PropTypes.func.isRequired -}; - -export default connect(createMapStateToProps, mapDispatchToProps)(ArtistDetailsPageConnector); diff --git a/frontend/src/Artist/Details/ArtistDetailsSeason.css b/frontend/src/Artist/Details/ArtistDetailsSeason.css deleted file mode 100644 index 4421fe7a7..000000000 --- a/frontend/src/Artist/Details/ArtistDetailsSeason.css +++ /dev/null @@ -1,134 +0,0 @@ -.albumType { - margin-bottom: 20px; - border: 1px solid var(--borderColor); - border-radius: 4px; - background-color: var(--cardBackgroundColor); - - &:last-of-type { - margin-bottom: 0; - } -} - -.header { - position: relative; - display: flex; - align-items: center; - width: 100%; - font-size: 24px; -} - -.albumTypeLabel { - margin-right: 10px; - margin-left: 5px; -} - -.albumCount { - color: #8895aa; - font-style: italic; - font-size: 18px; -} - -.albumCountTooltip { - display: flex; -} - -.sizeOnDisk { - margin-left: 10px; - color: #777; - font-size: $defaultFontSize; -} - -.expandButton { - composes: link from '~Components/Link/Link.css'; - - flex-grow: 1; - width: 100%; - text-align: center; -} - -.left { - display: flex; - align-items: center; - flex: 0 1 350px; -} - -.left, -.actions { - padding: 15px 10px; -} - -.actionsMenu { - composes: menu from '~Components/Menu/Menu.css'; - - flex: 0 0 45px; -} - -.actionsMenuContent { - composes: menuContent from '~Components/Menu/MenuContent.css'; - - white-space: nowrap; - font-size: $defaultFontSize; -} - -.actionMenuIcon { - margin-right: 8px; -} - -.actionButton { - composes: button from '~Components/Link/IconButton.css'; - - width: 30px; -} - -.albums { - padding-top: 15px; - border-top: 1px solid var(--borderColor); -} - -.collapseButtonContainer { - display: flex; - align-items: center; - justify-content: center; - padding: 10px 15px; - width: 100%; - border-top: 1px solid var(--borderColor); - border-bottom-right-radius: 4px; - border-bottom-left-radius: 4px; - background-color: var(--collapseButtonBackgroundColor); -} - -.collapseButtonIcon { - margin-bottom: -4px; -} - -.expandButtonIcon { - composes: actionButton; - - position: absolute; - top: 50%; - left: 50%; - margin-top: -12px; - margin-left: -12px; -} - -.noAlbums { - margin-bottom: 15px; - text-align: center; -} - -@media only screen and (max-width: $breakpointSmall) { - .albumType { - border-right: 0; - border-left: 0; - border-radius: 0; - } - - .expandButtonIcon { - position: static; - margin: 0; - } - - .sizeOnDisk { - display: none; - } -} diff --git a/frontend/src/Artist/Details/ArtistDetailsSeason.css.d.ts b/frontend/src/Artist/Details/ArtistDetailsSeason.css.d.ts deleted file mode 100644 index c3c20ac42..000000000 --- a/frontend/src/Artist/Details/ArtistDetailsSeason.css.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'actionButton': string; - 'actionMenuIcon': string; - 'actions': string; - 'actionsMenu': string; - 'actionsMenuContent': string; - 'albumCount': string; - 'albumCountTooltip': string; - 'albumType': string; - 'albumTypeLabel': string; - 'albums': string; - 'collapseButtonContainer': string; - 'collapseButtonIcon': string; - 'expandButton': string; - 'expandButtonIcon': string; - 'header': string; - 'left': string; - 'noAlbums': string; - 'sizeOnDisk': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Details/ArtistDetailsSeason.js b/frontend/src/Artist/Details/ArtistDetailsSeason.js deleted file mode 100644 index 004613e30..000000000 --- a/frontend/src/Artist/Details/ArtistDetailsSeason.js +++ /dev/null @@ -1,371 +0,0 @@ -import _ from 'lodash'; -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import Icon from 'Components/Icon'; -import Label from 'Components/Label'; -import IconButton from 'Components/Link/IconButton'; -import Link from 'Components/Link/Link'; -import MonitorToggleButton from 'Components/MonitorToggleButton'; -import Table from 'Components/Table/Table'; -import TableBody from 'Components/Table/TableBody'; -import Popover from 'Components/Tooltip/Popover'; -import { icons, kinds, sizes, sortDirections, tooltipPositions } from 'Helpers/Props'; -import OrganizePreviewModalConnector from 'Organize/OrganizePreviewModalConnector'; -import TrackFileEditorModal from 'TrackFile/Editor/TrackFileEditorModal'; -import isBefore from 'Utilities/Date/isBefore'; -import formatBytes from 'Utilities/Number/formatBytes'; -import translate from 'Utilities/String/translate'; -import getToggledRange from 'Utilities/Table/getToggledRange'; -import AlbumGroupInfo from './AlbumGroupInfo'; -import AlbumRowConnector from './AlbumRowConnector'; -import styles from './ArtistDetailsSeason.css'; - -function getAlbumStatistics(albums) { - let albumCount = 0; - let albumFileCount = 0; - let trackFileCount = 0; - let totalAlbumCount = 0; - let monitoredAlbumCount = 0; - let hasMonitoredAlbums = false; - let sizeOnDisk = 0; - - albums.forEach(({ monitored, releaseDate, statistics = {} }) => { - const { - trackFileCount: albumTrackFileCount = 0, - totalTrackCount: albumTotalTrackCount = 0, - sizeOnDisk: albumSizeOnDisk = 0 - } = statistics; - - const hasFiles = albumTrackFileCount > 0 && albumTrackFileCount === albumTotalTrackCount; - - if (hasFiles || (monitored && isBefore(releaseDate))) { - albumCount++; - } - - if (hasFiles) { - albumFileCount++; - } - - if (monitored) { - monitoredAlbumCount++; - hasMonitoredAlbums = true; - } - - totalAlbumCount++; - trackFileCount = trackFileCount + albumTrackFileCount; - sizeOnDisk = sizeOnDisk + albumSizeOnDisk; - }); - - return { - albumCount, - albumFileCount, - totalAlbumCount, - trackFileCount, - monitoredAlbumCount, - sizeOnDisk, - hasMonitoredAlbums - }; -} - -function getAlbumCountKind(monitored, albumCount, albumFileCount) { - if (albumCount === albumFileCount && albumFileCount > 0) { - return kinds.SUCCESS; - } - - if (!monitored) { - return kinds.WARNING; - } - - return kinds.DANGER; -} - -class ArtistDetailsSeason extends Component { - - // - // Lifecycle - - constructor(props, context) { - super(props, context); - - this.state = { - isOrganizeModalOpen: false, - isManageTracksOpen: false, - lastToggledAlbum: null - }; - } - - componentDidMount() { - this._expandByDefault(); - } - - componentDidUpdate(prevProps) { - const { - artistId - } = this.props; - - if (prevProps.artistId !== artistId) { - this._expandByDefault(); - return; - } - } - - // - // Control - - _expandByDefault() { - const { - name, - onExpandPress, - items, - uiSettings - } = this.props; - - const expand = _.some(items, (item) => - ((item.albumType === 'Album') && uiSettings.expandAlbumByDefault) || - ((item.albumType === 'Single') && uiSettings.expandSingleByDefault) || - ((item.albumType === 'EP') && uiSettings.expandEPByDefault) || - ((item.albumType === 'Broadcast') && uiSettings.expandBroadcastByDefault) || - ((item.albumType === 'Other') && uiSettings.expandOtherByDefault)); - - onExpandPress(name, expand); - } - - // - // Listeners - - onOrganizePress = () => { - this.setState({ isOrganizeModalOpen: true }); - }; - - onOrganizeModalClose = () => { - this.setState({ isOrganizeModalOpen: false }); - }; - - onManageTracksPress = () => { - this.setState({ isManageTracksOpen: true }); - }; - - onManageTracksModalClose = () => { - this.setState({ isManageTracksOpen: false }); - }; - - onExpandPress = () => { - const { - name, - isExpanded - } = this.props; - - this.props.onExpandPress(name, !isExpanded); - }; - - onMonitorAlbumPress = (albumId, monitored, { shiftKey }) => { - const lastToggled = this.state.lastToggledAlbum; - const albumIds = [albumId]; - - if (shiftKey && lastToggled) { - const { lower, upper } = getToggledRange(this.props.items, albumId, lastToggled); - const items = this.props.items; - - for (let i = lower; i < upper; i++) { - albumIds.push(items[i].id); - } - } - - this.setState({ lastToggledAlbum: albumId }); - - this.props.onMonitorAlbumsPress(_.uniq(albumIds), monitored); - }; - - onMonitorAlbumsPress = (monitored, { shiftKey }) => { - const albumIds = this.props.items.map((a) => a.id); - - this.props.onMonitorAlbumsPress(_.uniq(albumIds), monitored); - }; - - // - // Render - - render() { - const { - artistId, - label, - items, - columns, - isSaving, - isExpanded, - artistMonitored, - sortKey, - sortDirection, - onSortPress, - isSmallScreen, - onTableOptionChange - } = this.props; - - const { - albumCount, - albumFileCount, - totalAlbumCount, - trackFileCount, - monitoredAlbumCount, - hasMonitoredAlbums, - sizeOnDisk = 0 - } = getAlbumStatistics(items); - - const { - isOrganizeModalOpen, - isManageTracksOpen - } = this.state; - - return ( -
-
-
- - - {label} - - - {albumFileCount} / {albumCount} - - } - title={translate('GroupInformation')} - body={ -
- -
- } - position={tooltipPositions.BOTTOM} - /> - - { - sizeOnDisk ? -
- {formatBytes(sizeOnDisk)} -
: - null - } -
- - - - - - { - !isSmallScreen && -   - } - - -
- -
- { - isExpanded && -
- { - items.length ? - - - { - items.map((item) => { - return ( - - ); - }) - } - -
: - -
- No releases in this group -
- } -
- -
-
- } -
- - - - -
- ); - } -} - -ArtistDetailsSeason.propTypes = { - artistId: PropTypes.number.isRequired, - name: PropTypes.string.isRequired, - label: PropTypes.string.isRequired, - artistMonitored: PropTypes.bool.isRequired, - sortKey: PropTypes.string, - sortDirection: PropTypes.oneOf(sortDirections.all), - items: PropTypes.arrayOf(PropTypes.object).isRequired, - columns: PropTypes.arrayOf(PropTypes.object).isRequired, - isSaving: PropTypes.bool, - isExpanded: PropTypes.bool, - isSmallScreen: PropTypes.bool.isRequired, - onTableOptionChange: PropTypes.func.isRequired, - onExpandPress: PropTypes.func.isRequired, - onSortPress: PropTypes.func.isRequired, - onMonitorAlbumsPress: PropTypes.func.isRequired, - uiSettings: PropTypes.object.isRequired -}; - -export default ArtistDetailsSeason; diff --git a/frontend/src/Artist/Details/ArtistDetailsSeasonConnector.js b/frontend/src/Artist/Details/ArtistDetailsSeasonConnector.js deleted file mode 100644 index 6eb98cd52..000000000 --- a/frontend/src/Artist/Details/ArtistDetailsSeasonConnector.js +++ /dev/null @@ -1,99 +0,0 @@ -/* eslint max-params: 0 */ -import _ from 'lodash'; -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import { connect } from 'react-redux'; -import { createSelector } from 'reselect'; -import { setAlbumsSort, setAlbumsTableOption, toggleAlbumsMonitored } from 'Store/Actions/albumActions'; -import { executeCommand } from 'Store/Actions/commandActions'; -import createArtistSelector from 'Store/Selectors/createArtistSelector'; -import createClientSideCollectionSelector from 'Store/Selectors/createClientSideCollectionSelector'; -import createCommandsSelector from 'Store/Selectors/createCommandsSelector'; -import createDimensionsSelector from 'Store/Selectors/createDimensionsSelector'; -import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector'; -import ArtistDetailsSeason from './ArtistDetailsSeason'; - -function createMapStateToProps() { - return createSelector( - (state, { label }) => label, - createClientSideCollectionSelector('albums'), - createArtistSelector(), - createCommandsSelector(), - createDimensionsSelector(), - createUISettingsSelector(), - (label, albums, artist, commands, dimensions, uiSettings) => { - - const albumsInGroup = _.filter(albums.items, { albumType: label }); - - let sortDir = 'asc'; - - if (albums.sortDirection === 'descending') { - sortDir = 'desc'; - } - - const sortedAlbums = _.orderBy(albumsInGroup, albums.sortKey, sortDir); - - return { - items: sortedAlbums, - columns: albums.columns, - artistMonitored: artist.monitored, - sortKey: albums.sortKey, - sortDirection: albums.sortDirection, - isSmallScreen: dimensions.isSmallScreen, - uiSettings - }; - } - ); -} - -const mapDispatchToProps = { - toggleAlbumsMonitored, - setAlbumsTableOption, - dispatchSetAlbumSort: setAlbumsSort, - executeCommand -}; - -class ArtistDetailsSeasonConnector extends Component { - - // - // Listeners - - onTableOptionChange = (payload) => { - this.props.setAlbumsTableOption(payload); - }; - - onSortPress = (sortKey) => { - this.props.dispatchSetAlbumSort({ sortKey }); - }; - - onMonitorAlbumsPress = (albumIds, monitored) => { - this.props.toggleAlbumsMonitored({ - albumIds, - monitored - }); - }; - - // - // Render - - render() { - return ( - - ); - } -} - -ArtistDetailsSeasonConnector.propTypes = { - artistId: PropTypes.number.isRequired, - toggleAlbumsMonitored: PropTypes.func.isRequired, - setAlbumsTableOption: PropTypes.func.isRequired, - dispatchSetAlbumSort: PropTypes.func.isRequired, - executeCommand: PropTypes.func.isRequired -}; - -export default connect(createMapStateToProps, mapDispatchToProps)(ArtistDetailsSeasonConnector); diff --git a/frontend/src/Artist/Details/ArtistGenres.css b/frontend/src/Artist/Details/ArtistGenres.css deleted file mode 100644 index 93a028748..000000000 --- a/frontend/src/Artist/Details/ArtistGenres.css +++ /dev/null @@ -1,3 +0,0 @@ -.genres { - margin-right: 15px; -} diff --git a/frontend/src/Artist/Details/ArtistGenres.css.d.ts b/frontend/src/Artist/Details/ArtistGenres.css.d.ts deleted file mode 100644 index 83399e63b..000000000 --- a/frontend/src/Artist/Details/ArtistGenres.css.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'genres': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Details/ArtistGenres.js b/frontend/src/Artist/Details/ArtistGenres.js deleted file mode 100644 index 15f3505d8..000000000 --- a/frontend/src/Artist/Details/ArtistGenres.js +++ /dev/null @@ -1,53 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import Label from 'Components/Label'; -import Tooltip from 'Components/Tooltip/Tooltip'; -import { kinds, sizes, tooltipPositions } from 'Helpers/Props'; -import styles from './ArtistGenres.css'; - -function ArtistGenres({ genres }) { - const [firstGenre, ...otherGenres] = genres; - - if (otherGenres.length) { - return ( - - {firstGenre} - - } - tooltip={ -
- { - otherGenres.map((tag) => { - return ( - - ); - }) - } -
- } - kind={kinds.INVERSE} - position={tooltipPositions.TOP} - /> - ); - } - - return ( - - {firstGenre} - - ); -} - -ArtistGenres.propTypes = { - genres: PropTypes.arrayOf(PropTypes.string).isRequired -}; - -export default ArtistGenres; diff --git a/frontend/src/Artist/Details/ArtistTags.css b/frontend/src/Artist/Details/ArtistTags.css deleted file mode 100644 index ec340a041..000000000 --- a/frontend/src/Artist/Details/ArtistTags.css +++ /dev/null @@ -1,8 +0,0 @@ -.tags { - margin: 0; - padding-left: 20px; -} - -.tag { - white-space: nowrap; -} diff --git a/frontend/src/Artist/Details/ArtistTags.js b/frontend/src/Artist/Details/ArtistTags.js deleted file mode 100644 index b5f8a6e89..000000000 --- a/frontend/src/Artist/Details/ArtistTags.js +++ /dev/null @@ -1,30 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import Label from 'Components/Label'; -import { kinds, sizes } from 'Helpers/Props'; - -function ArtistTags({ tags }) { - return ( -
- { - tags.map((tag) => { - return ( - - ); - }) - } -
- ); -} - -ArtistTags.propTypes = { - tags: PropTypes.arrayOf(PropTypes.string).isRequired -}; - -export default ArtistTags; diff --git a/frontend/src/Artist/Details/ArtistTagsConnector.js b/frontend/src/Artist/Details/ArtistTagsConnector.js deleted file mode 100644 index 1d24a5755..000000000 --- a/frontend/src/Artist/Details/ArtistTagsConnector.js +++ /dev/null @@ -1,26 +0,0 @@ -import { connect } from 'react-redux'; -import { createSelector } from 'reselect'; -import createArtistSelector from 'Store/Selectors/createArtistSelector'; -import createTagsSelector from 'Store/Selectors/createTagsSelector'; -import sortByProp from 'Utilities/Array/sortByProp'; -import ArtistTags from './ArtistTags'; - -function createMapStateToProps() { - return createSelector( - createArtistSelector(), - createTagsSelector(), - (artist, tagList) => { - const tags = artist.tags - .map((tagId) => tagList.find((tag) => tag.id === tagId)) - .filter((tag) => !!tag) - .sort(sortByProp('label')) - .map((tag) => tag.label); - - return { - tags - }; - } - ); -} - -export default connect(createMapStateToProps)(ArtistTags); diff --git a/frontend/src/Artist/Edit/EditArtistModal.js b/frontend/src/Artist/Edit/EditArtistModal.js deleted file mode 100644 index f221e728c..000000000 --- a/frontend/src/Artist/Edit/EditArtistModal.js +++ /dev/null @@ -1,26 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import Modal from 'Components/Modal/Modal'; -import EditArtistModalContentConnector from './EditArtistModalContentConnector'; - -function EditArtistModal({ isOpen, onModalClose, ...otherProps }) { - return ( - - - - ); -} - -EditArtistModal.propTypes = { - ...EditArtistModalContentConnector.propTypes, - isOpen: PropTypes.bool.isRequired, - onModalClose: PropTypes.func.isRequired -}; - -export default EditArtistModal; diff --git a/frontend/src/Artist/Edit/EditArtistModalConnector.js b/frontend/src/Artist/Edit/EditArtistModalConnector.js deleted file mode 100644 index 9c4e6325f..000000000 --- a/frontend/src/Artist/Edit/EditArtistModalConnector.js +++ /dev/null @@ -1,40 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import { connect } from 'react-redux'; -import { clearPendingChanges } from 'Store/Actions/baseActions'; -import EditArtistModal from './EditArtistModal'; - -const mapDispatchToProps = { - clearPendingChanges -}; - -class EditArtistModalConnector extends Component { - - // - // Listeners - - onModalClose = () => { - this.props.clearPendingChanges({ section: 'artist' }); - this.props.onModalClose(); - }; - - // - // Render - - render() { - return ( - - ); - } -} - -EditArtistModalConnector.propTypes = { - ...EditArtistModal.propTypes, - onModalClose: PropTypes.func.isRequired, - clearPendingChanges: PropTypes.func.isRequired -}; - -export default connect(undefined, mapDispatchToProps)(EditArtistModalConnector); diff --git a/frontend/src/Artist/Edit/EditArtistModalContent.css b/frontend/src/Artist/Edit/EditArtistModalContent.css deleted file mode 100644 index fd7ddf093..000000000 --- a/frontend/src/Artist/Edit/EditArtistModalContent.css +++ /dev/null @@ -1,9 +0,0 @@ -.deleteButton { - composes: button from '~Components/Link/Button.css'; - - margin-right: auto; -} - -.labelIcon { - margin-left: 8px; -} diff --git a/frontend/src/Artist/Edit/EditArtistModalContent.css.d.ts b/frontend/src/Artist/Edit/EditArtistModalContent.css.d.ts deleted file mode 100644 index 238343ae5..000000000 --- a/frontend/src/Artist/Edit/EditArtistModalContent.css.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'deleteButton': string; - 'labelIcon': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Edit/EditArtistModalContent.js b/frontend/src/Artist/Edit/EditArtistModalContent.js deleted file mode 100644 index bca6e3ea6..000000000 --- a/frontend/src/Artist/Edit/EditArtistModalContent.js +++ /dev/null @@ -1,259 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import ArtistMetadataProfilePopoverContent from 'AddArtist/ArtistMetadataProfilePopoverContent'; -import ArtistMonitorNewItemsOptionsPopoverContent from 'AddArtist/ArtistMonitorNewItemsOptionsPopoverContent'; -import MoveArtistModal from 'Artist/MoveArtist/MoveArtistModal'; -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 Icon from 'Components/Icon'; -import Button from 'Components/Link/Button'; -import SpinnerButton from 'Components/Link/SpinnerButton'; -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 Popover from 'Components/Tooltip/Popover'; -import { icons, inputTypes, kinds, sizes, tooltipPositions } from 'Helpers/Props'; -import translate from 'Utilities/String/translate'; -import styles from './EditArtistModalContent.css'; - -class EditArtistModalContent extends Component { - - // - // Lifecycle - - constructor(props, context) { - super(props, context); - - this.state = { - isConfirmMoveModalOpen: false - }; - } - - // - // Listeners - - onCancelPress = () => { - this.setState({ isConfirmMoveModalOpen: false }); - }; - - onSavePress = () => { - const { - isPathChanging, - onSavePress - } = this.props; - - if (isPathChanging && !this.state.isConfirmMoveModalOpen) { - this.setState({ isConfirmMoveModalOpen: true }); - } else { - this.setState({ isConfirmMoveModalOpen: false }); - - onSavePress(false); - } - }; - - onMoveArtistPress = () => { - this.setState({ isConfirmMoveModalOpen: false }); - - this.props.onSavePress(true); - }; - - // - // Render - - render() { - const { - artistName, - item, - isSaving, - showMetadataProfile, - originalPath, - onInputChange, - onModalClose, - onDeleteArtistPress, - ...otherProps - } = this.props; - - const { - monitored, - monitorNewItems, - qualityProfileId, - metadataProfileId, - path, - tags - } = item; - - return ( - - - Edit - {artistName} - - - -
- - - {translate('Monitored')} - - - - - - - - {translate('MonitorNewItems')} - - - } - title={translate('MonitorNewItems')} - body={} - position={tooltipPositions.RIGHT} - /> - - - - - - - - {translate('QualityProfile')} - - - - - - { - showMetadataProfile ? - - - {translate('MetadataProfile')} - - - } - title={translate('MetadataProfile')} - body={} - position={tooltipPositions.RIGHT} - /> - - - - - : - null - } - - - - {translate('Path')} - - - - - - - - {translate('Tags')} - - - - -
-
- - - - - - - {translate('Save')} - - - - - -
- ); - } -} - -EditArtistModalContent.propTypes = { - artistId: PropTypes.number.isRequired, - artistName: PropTypes.string.isRequired, - item: PropTypes.object.isRequired, - isSaving: PropTypes.bool.isRequired, - showMetadataProfile: PropTypes.bool.isRequired, - isPathChanging: PropTypes.bool.isRequired, - originalPath: PropTypes.string.isRequired, - onInputChange: PropTypes.func.isRequired, - onSavePress: PropTypes.func.isRequired, - onModalClose: PropTypes.func.isRequired, - onDeleteArtistPress: PropTypes.func.isRequired -}; - -export default EditArtistModalContent; diff --git a/frontend/src/Artist/Edit/EditArtistModalContentConnector.js b/frontend/src/Artist/Edit/EditArtistModalContentConnector.js deleted file mode 100644 index bd9592d42..000000000 --- a/frontend/src/Artist/Edit/EditArtistModalContentConnector.js +++ /dev/null @@ -1,119 +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 { saveArtist, setArtistValue } from 'Store/Actions/artistActions'; -import createArtistSelector from 'Store/Selectors/createArtistSelector'; -import selectSettings from 'Store/Selectors/selectSettings'; -import EditArtistModalContent from './EditArtistModalContent'; - -function createIsPathChangingSelector() { - return createSelector( - (state) => state.artist.pendingChanges, - createArtistSelector(), - (pendingChanges, artist) => { - const path = pendingChanges.path; - - if (path == null) { - return false; - } - - return artist.path !== path; - } - ); -} - -function createMapStateToProps() { - return createSelector( - (state) => state.artist, - (state) => state.settings.metadataProfiles, - createArtistSelector(), - createIsPathChangingSelector(), - (artistState, metadataProfiles, artist, isPathChanging) => { - const { - isSaving, - saveError, - pendingChanges - } = artistState; - - const artistSettings = _.pick(artist, [ - 'monitored', - 'monitorNewItems', - 'qualityProfileId', - 'metadataProfileId', - 'path', - 'tags' - ]); - - const settings = selectSettings(artistSettings, pendingChanges, saveError); - - return { - artistName: artist.artistName, - isSaving, - saveError, - isPathChanging, - originalPath: artist.path, - item: settings.settings, - showMetadataProfile: metadataProfiles.items.length > 1, - ...settings - }; - } - ); -} - -const mapDispatchToProps = { - dispatchSetArtistValue: setArtistValue, - dispatchSaveArtist: saveArtist -}; - -class EditArtistModalContentConnector extends Component { - - // - // Lifecycle - - componentDidUpdate(prevProps, prevState) { - if (prevProps.isSaving && !this.props.isSaving && !this.props.saveError) { - this.props.onModalClose(); - } - } - - // - // Listeners - - onInputChange = ({ name, value }) => { - this.props.dispatchSetArtistValue({ name, value }); - }; - - onSavePress = (moveFiles) => { - this.props.dispatchSaveArtist({ - id: this.props.artistId, - moveFiles - }); - }; - - // - // Render - - render() { - return ( - - ); - } -} - -EditArtistModalContentConnector.propTypes = { - artistId: PropTypes.number, - isSaving: PropTypes.bool.isRequired, - saveError: PropTypes.object, - dispatchSetArtistValue: PropTypes.func.isRequired, - dispatchSaveArtist: PropTypes.func.isRequired, - onModalClose: PropTypes.func.isRequired -}; - -export default connect(createMapStateToProps, mapDispatchToProps)(EditArtistModalContentConnector); diff --git a/frontend/src/Artist/History/ArtistHistoryModal.js b/frontend/src/Artist/History/ArtistHistoryModal.js deleted file mode 100644 index a4362484c..000000000 --- a/frontend/src/Artist/History/ArtistHistoryModal.js +++ /dev/null @@ -1,33 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import Modal from 'Components/Modal/Modal'; -import { sizes } from 'Helpers/Props'; -import ArtistHistoryModalContentConnector from './ArtistHistoryModalContentConnector'; - -function ArtistHistoryModal(props) { - const { - isOpen, - onModalClose, - ...otherProps - } = props; - - return ( - - - - ); -} - -ArtistHistoryModal.propTypes = { - isOpen: PropTypes.bool.isRequired, - onModalClose: PropTypes.func.isRequired -}; - -export default ArtistHistoryModal; diff --git a/frontend/src/Artist/History/ArtistHistoryModalContent.js b/frontend/src/Artist/History/ArtistHistoryModalContent.js deleted file mode 100644 index f791f9ed7..000000000 --- a/frontend/src/Artist/History/ArtistHistoryModalContent.js +++ /dev/null @@ -1,149 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import Alert from 'Components/Alert'; -import Icon from 'Components/Icon'; -import Button from 'Components/Link/Button'; -import LoadingIndicator from 'Components/Loading/LoadingIndicator'; -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 Table from 'Components/Table/Table'; -import TableBody from 'Components/Table/TableBody'; -import { icons, kinds } from 'Helpers/Props'; -import translate from 'Utilities/String/translate'; -import ArtistHistoryRowConnector from './ArtistHistoryRowConnector'; - -const columns = [ - { - name: 'eventType', - isVisible: true - }, - { - name: 'album', - label: () => translate('Album'), - isVisible: true - }, - { - name: 'sourceTitle', - label: () => translate('SourceTitle'), - isVisible: true - }, - { - name: 'quality', - label: () => translate('Quality'), - isVisible: true - }, - { - name: 'customFormats', - label: () => translate('CustomFormats'), - isSortable: false, - isVisible: true - }, - { - name: 'customFormatScore', - label: React.createElement(Icon, { - name: icons.SCORE, - title: 'Custom format score' - }), - isSortable: true, - isVisible: true - }, - { - name: 'date', - label: () => translate('Date'), - isVisible: true - }, - { - name: 'actions', - isVisible: true - } -]; - -class ArtistHistoryModalContent extends Component { - - // - // Render - - render() { - const { - albumId, - isFetching, - isPopulated, - error, - items, - onMarkAsFailedPress, - onModalClose - } = this.props; - - const fullArtist = albumId == null; - const hasItems = !!items.length; - - return ( - - - History - - - - { - isFetching && - - } - - { - !isFetching && !!error && - - {translate('UnableToLoadHistory')} - - } - - { - isPopulated && !hasItems && !error && - - {translate('NoHistory')} - - } - - { - isPopulated && hasItems && !error && - - - { - items.map((item) => { - return ( - - ); - }) - } - -
- } -
- - - - -
- ); - } -} - -ArtistHistoryModalContent.propTypes = { - albumId: PropTypes.number, - isFetching: PropTypes.bool.isRequired, - isPopulated: PropTypes.bool.isRequired, - error: PropTypes.object, - items: PropTypes.arrayOf(PropTypes.object).isRequired, - onMarkAsFailedPress: PropTypes.func.isRequired, - onModalClose: PropTypes.func.isRequired -}; - -export default ArtistHistoryModalContent; diff --git a/frontend/src/Artist/History/ArtistHistoryModalContentConnector.js b/frontend/src/Artist/History/ArtistHistoryModalContentConnector.js deleted file mode 100644 index f5f93ed7d..000000000 --- a/frontend/src/Artist/History/ArtistHistoryModalContentConnector.js +++ /dev/null @@ -1,81 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import { connect } from 'react-redux'; -import { createSelector } from 'reselect'; -import { artistHistoryMarkAsFailed, clearArtistHistory, fetchArtistHistory } from 'Store/Actions/artistHistoryActions'; -import ArtistHistoryModalContent from './ArtistHistoryModalContent'; - -function createMapStateToProps() { - return createSelector( - (state) => state.artistHistory, - (artistHistory) => { - return artistHistory; - } - ); -} - -const mapDispatchToProps = { - fetchArtistHistory, - clearArtistHistory, - artistHistoryMarkAsFailed -}; - -class ArtistHistoryModalContentConnector extends Component { - - // - // Lifecycle - - componentDidMount() { - const { - artistId, - albumId - } = this.props; - - this.props.fetchArtistHistory({ - artistId, - albumId - }); - } - - componentWillUnmount() { - this.props.clearArtistHistory(); - } - - // - // Listeners - - onMarkAsFailedPress = (historyId) => { - const { - artistId, - albumId - } = this.props; - - this.props.artistHistoryMarkAsFailed({ - historyId, - artistId, - albumId - }); - }; - - // - // Render - - render() { - return ( - - ); - } -} - -ArtistHistoryModalContentConnector.propTypes = { - artistId: PropTypes.number.isRequired, - albumId: PropTypes.number, - fetchArtistHistory: PropTypes.func.isRequired, - clearArtistHistory: PropTypes.func.isRequired, - artistHistoryMarkAsFailed: PropTypes.func.isRequired -}; - -export default connect(createMapStateToProps, mapDispatchToProps)(ArtistHistoryModalContentConnector); diff --git a/frontend/src/Artist/History/ArtistHistoryRow.css b/frontend/src/Artist/History/ArtistHistoryRow.css deleted file mode 100644 index 33dba8df9..000000000 --- a/frontend/src/Artist/History/ArtistHistoryRow.css +++ /dev/null @@ -1,11 +0,0 @@ -.sourceTitle { - composes: cell from '~Components/Table/Cells/TableRowCell.css'; - - word-break: break-word; -} - -.actions { - composes: cell from '~Components/Table/Cells/TableRowCell.css'; - - width: 65px; -} diff --git a/frontend/src/Artist/History/ArtistHistoryRow.css.d.ts b/frontend/src/Artist/History/ArtistHistoryRow.css.d.ts deleted file mode 100644 index b0b91a6b8..000000000 --- a/frontend/src/Artist/History/ArtistHistoryRow.css.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'actions': string; - 'sourceTitle': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/History/ArtistHistoryRow.js b/frontend/src/Artist/History/ArtistHistoryRow.js deleted file mode 100644 index fe8326378..000000000 --- a/frontend/src/Artist/History/ArtistHistoryRow.js +++ /dev/null @@ -1,191 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import HistoryDetailsConnector from 'Activity/History/Details/HistoryDetailsConnector'; -import HistoryEventTypeCell from 'Activity/History/HistoryEventTypeCell'; -import AlbumFormats from 'Album/AlbumFormats'; -import TrackQuality from 'Album/TrackQuality'; -import Icon from 'Components/Icon'; -import IconButton from 'Components/Link/IconButton'; -import ConfirmModal from 'Components/Modal/ConfirmModal'; -import RelativeDateCellConnector from 'Components/Table/Cells/RelativeDateCellConnector'; -import TableRowCell from 'Components/Table/Cells/TableRowCell'; -import TableRow from 'Components/Table/TableRow'; -import Popover from 'Components/Tooltip/Popover'; -import { icons, kinds, tooltipPositions } from 'Helpers/Props'; -import formatCustomFormatScore from 'Utilities/Number/formatCustomFormatScore'; -import translate from 'Utilities/String/translate'; -import styles from './ArtistHistoryRow.css'; - -function getTitle(eventType) { - switch (eventType) { - case 'grabbed': - return 'Grabbed'; - case 'downloadImported': - return 'Download Completed'; - case 'trackFileImported': - return 'Track Imported'; - case 'downloadFailed': - return 'Download Failed'; - case 'trackFileDeleted': - return 'Track File Deleted'; - case 'trackFileRenamed': - return 'Track File Renamed'; - case 'trackFileRetagged': - return 'Track File Tags Updated'; - case 'albumImportIncomplete': - return 'Album Import Incomplete'; - default: - return 'Unknown'; - } -} - -class ArtistHistoryRow extends Component { - - // - // Lifecycle - - constructor(props, context) { - super(props, context); - - this.state = { - isMarkAsFailedModalOpen: false - }; - } - - // - // Listeners - - onMarkAsFailedPress = () => { - this.setState({ isMarkAsFailedModalOpen: true }); - }; - - onConfirmMarkAsFailed = () => { - this.props.onMarkAsFailedPress(this.props.id); - this.setState({ isMarkAsFailedModalOpen: false }); - }; - - onMarkAsFailedModalClose = () => { - this.setState({ isMarkAsFailedModalOpen: false }); - }; - - // - // Render - - render() { - const { - eventType, - sourceTitle, - quality, - qualityCutoffNotMet, - customFormats, - customFormatScore, - date, - data, - downloadId, - album - } = this.props; - - const { - isMarkAsFailedModalOpen - } = this.state; - - return ( - - - - - {album.title} - - - - {sourceTitle} - - - - - - - - - - - - {formatCustomFormatScore(customFormatScore, customFormats.length)} - - - - - - - } - title={getTitle(eventType)} - body={ - - } - position={tooltipPositions.LEFT} - /> - - { - eventType === 'grabbed' && - - } - - - - - ); - } -} - -ArtistHistoryRow.propTypes = { - id: PropTypes.number.isRequired, - eventType: PropTypes.string.isRequired, - sourceTitle: PropTypes.string.isRequired, - quality: PropTypes.object.isRequired, - qualityCutoffNotMet: PropTypes.bool.isRequired, - customFormats: PropTypes.arrayOf(PropTypes.object), - customFormatScore: PropTypes.number.isRequired, - date: PropTypes.string.isRequired, - data: PropTypes.object.isRequired, - downloadId: PropTypes.string, - fullArtist: PropTypes.bool.isRequired, - artist: PropTypes.object.isRequired, - album: PropTypes.object.isRequired, - onMarkAsFailedPress: PropTypes.func.isRequired -}; - -ArtistHistoryRow.defaultProps = { - customFormats: [] -}; - -export default ArtistHistoryRow; diff --git a/frontend/src/Artist/History/ArtistHistoryRowConnector.js b/frontend/src/Artist/History/ArtistHistoryRowConnector.js deleted file mode 100644 index 65249aca6..000000000 --- a/frontend/src/Artist/History/ArtistHistoryRowConnector.js +++ /dev/null @@ -1,26 +0,0 @@ -import { connect } from 'react-redux'; -import { createSelector } from 'reselect'; -import { fetchHistory, markAsFailed } from 'Store/Actions/historyActions'; -import createAlbumSelector from 'Store/Selectors/createAlbumSelector'; -import createArtistSelector from 'Store/Selectors/createArtistSelector'; -import ArtistHistoryRow from './ArtistHistoryRow'; - -function createMapStateToProps() { - return createSelector( - createArtistSelector(), - createAlbumSelector(), - (artist, album) => { - return { - artist, - album - }; - } - ); -} - -const mapDispatchToProps = { - fetchHistory, - markAsFailed -}; - -export default connect(createMapStateToProps, mapDispatchToProps)(ArtistHistoryRow); diff --git a/frontend/src/Artist/Index/ArtistIndex.css b/frontend/src/Artist/Index/ArtistIndex.css deleted file mode 100644 index 908cb2d16..000000000 --- a/frontend/src/Artist/Index/ArtistIndex.css +++ /dev/null @@ -1,73 +0,0 @@ -.pageContentBodyWrapper { - display: flex; - flex: 1 0 1px; - overflow: hidden; -} - -.errorMessage { - margin-top: 20px; - text-align: center; - font-size: 20px; -} - -.contentBody { - composes: contentBody from '~Components/Page/PageContentBody.css'; - - position: relative; - display: flex; - flex-direction: column; -} - -.postersInnerContentBody { - composes: innerContentBody from '~Components/Page/PageContentBody.css'; - - display: flex; - flex-direction: column; - flex-grow: 1; - - /* 5px less padding than normal to handle poster's 5px margin */ - padding: calc($pageContentBodyPadding - 5px); -} - -.bannersInnerContentBody { - composes: innerContentBody from '~Components/Page/PageContentBody.css'; - - display: flex; - flex-direction: column; - flex-grow: 1; - - /* 5px less padding than normal to handle poster's 5px margin */ - padding: calc($pageContentBodyPadding - 5px); -} - -.tableInnerContentBody { - composes: innerContentBody from '~Components/Page/PageContentBody.css'; - - display: flex; - flex-direction: column; - flex-grow: 1; -} - -.contentBodyContainer { - display: flex; - flex-direction: column; - flex-grow: 1; -} - -@media only screen and (max-width: $breakpointSmall) { - .pageContentBodyWrapper { - flex-basis: auto; - } - - .contentBody { - flex-basis: 1px; - } - - .postersInnerContentBody { - padding: calc($pageContentBodyPaddingSmallScreen - 5px); - } - - .bannersInnerContentBody { - padding: calc($pageContentBodyPaddingSmallScreen - 5px); - } -} diff --git a/frontend/src/Artist/Index/ArtistIndex.css.d.ts b/frontend/src/Artist/Index/ArtistIndex.css.d.ts deleted file mode 100644 index ec08fc921..000000000 --- a/frontend/src/Artist/Index/ArtistIndex.css.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'bannersInnerContentBody': string; - 'contentBody': string; - 'contentBodyContainer': string; - 'errorMessage': string; - 'pageContentBodyWrapper': string; - 'postersInnerContentBody': string; - 'tableInnerContentBody': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Index/ArtistIndex.tsx b/frontend/src/Artist/Index/ArtistIndex.tsx deleted file mode 100644 index 2fcc0fadf..000000000 --- a/frontend/src/Artist/Index/ArtistIndex.tsx +++ /dev/null @@ -1,375 +0,0 @@ -import React, { - useCallback, - useEffect, - useMemo, - useRef, - useState, -} from 'react'; -import { useDispatch, useSelector } from 'react-redux'; -import { SelectProvider } from 'App/SelectContext'; -import ArtistAppState, { ArtistIndexAppState } from 'App/State/ArtistAppState'; -import ClientSideCollectionAppState from 'App/State/ClientSideCollectionAppState'; -import NoArtist from 'Artist/NoArtist'; -import { RSS_SYNC } from 'Commands/commandNames'; -import LoadingIndicator from 'Components/Loading/LoadingIndicator'; -import PageContent from 'Components/Page/PageContent'; -import PageContentBody from 'Components/Page/PageContentBody'; -import PageJumpBar from 'Components/Page/PageJumpBar'; -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 TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper'; -import withScrollPosition from 'Components/withScrollPosition'; -import { align, icons } from 'Helpers/Props'; -import SortDirection from 'Helpers/Props/SortDirection'; -import { - setArtistFilter, - setArtistSort, - setArtistTableOption, - setArtistView, -} from 'Store/Actions/artistIndexActions'; -import { executeCommand } from 'Store/Actions/commandActions'; -import { fetchQueueDetails } from 'Store/Actions/queueActions'; -import scrollPositions from 'Store/scrollPositions'; -import createArtistClientSideCollectionItemsSelector from 'Store/Selectors/createArtistClientSideCollectionItemsSelector'; -import createCommandExecutingSelector from 'Store/Selectors/createCommandExecutingSelector'; -import createDimensionsSelector from 'Store/Selectors/createDimensionsSelector'; -import getErrorMessage from 'Utilities/Object/getErrorMessage'; -import translate from 'Utilities/String/translate'; -import ArtistIndexFooter from './ArtistIndexFooter'; -import ArtistIndexRefreshArtistsButton from './ArtistIndexRefreshArtistsButton'; -import ArtistIndexBanners from './Banners/ArtistIndexBanners'; -import ArtistIndexBannerOptionsModal from './Banners/Options/ArtistIndexBannerOptionsModal'; -import ArtistIndexFilterMenu from './Menus/ArtistIndexFilterMenu'; -import ArtistIndexSortMenu from './Menus/ArtistIndexSortMenu'; -import ArtistIndexViewMenu from './Menus/ArtistIndexViewMenu'; -import ArtistIndexOverviews from './Overview/ArtistIndexOverviews'; -import ArtistIndexOverviewOptionsModal from './Overview/Options/ArtistIndexOverviewOptionsModal'; -import ArtistIndexPosters from './Posters/ArtistIndexPosters'; -import ArtistIndexPosterOptionsModal from './Posters/Options/ArtistIndexPosterOptionsModal'; -import ArtistIndexSelectAllButton from './Select/ArtistIndexSelectAllButton'; -import ArtistIndexSelectAllMenuItem from './Select/ArtistIndexSelectAllMenuItem'; -import ArtistIndexSelectFooter from './Select/ArtistIndexSelectFooter'; -import ArtistIndexSelectModeButton from './Select/ArtistIndexSelectModeButton'; -import ArtistIndexSelectModeMenuItem from './Select/ArtistIndexSelectModeMenuItem'; -import ArtistIndexTable from './Table/ArtistIndexTable'; -import ArtistIndexTableOptions from './Table/ArtistIndexTableOptions'; -import styles from './ArtistIndex.css'; - -function getViewComponent(view: string) { - if (view === 'posters') { - return ArtistIndexPosters; - } - - if (view === 'banners') { - return ArtistIndexBanners; - } - - if (view === 'overview') { - return ArtistIndexOverviews; - } - - return ArtistIndexTable; -} - -interface ArtistIndexProps { - initialScrollTop?: number; -} - -const ArtistIndex = withScrollPosition((props: ArtistIndexProps) => { - const { - isFetching, - isPopulated, - error, - totalItems, - items, - columns, - selectedFilterKey, - filters, - customFilters, - sortKey, - sortDirection, - view, - }: ArtistAppState & ArtistIndexAppState & ClientSideCollectionAppState = - useSelector(createArtistClientSideCollectionItemsSelector('artistIndex')); - - const isRssSyncExecuting = useSelector( - createCommandExecutingSelector(RSS_SYNC) - ); - const { isSmallScreen } = useSelector(createDimensionsSelector()); - const dispatch = useDispatch(); - const scrollerRef = useRef(null); - const [isOptionsModalOpen, setIsOptionsModalOpen] = useState(false); - const [jumpToCharacter, setJumpToCharacter] = useState( - undefined - ); - const [isSelectMode, setIsSelectMode] = useState(false); - - useEffect(() => { - dispatch(fetchQueueDetails({ all: true })); - }, [dispatch]); - - const onRssSyncPress = useCallback(() => { - dispatch( - executeCommand({ - name: RSS_SYNC, - }) - ); - }, [dispatch]); - - const onSelectModePress = useCallback(() => { - setIsSelectMode(!isSelectMode); - }, [isSelectMode, setIsSelectMode]); - - const onTableOptionChange = useCallback( - (payload: unknown) => { - dispatch(setArtistTableOption(payload)); - }, - [dispatch] - ); - - const onViewSelect = useCallback( - (value: string) => { - dispatch(setArtistView({ view: value })); - - if (scrollerRef.current) { - scrollerRef.current.scrollTo(0, 0); - } - }, - [scrollerRef, dispatch] - ); - - const onSortSelect = useCallback( - (value: string) => { - dispatch(setArtistSort({ sortKey: value })); - }, - [dispatch] - ); - - const onFilterSelect = useCallback( - (value: string) => { - dispatch(setArtistFilter({ selectedFilterKey: value })); - }, - [dispatch] - ); - - const onOptionsPress = useCallback(() => { - setIsOptionsModalOpen(true); - }, [setIsOptionsModalOpen]); - - const onOptionsModalClose = useCallback(() => { - setIsOptionsModalOpen(false); - }, [setIsOptionsModalOpen]); - - const onJumpBarItemPress = useCallback( - (character: string) => { - setJumpToCharacter(character); - }, - [setJumpToCharacter] - ); - - const onScroll = useCallback( - ({ scrollTop }: { scrollTop: number }) => { - setJumpToCharacter(undefined); - scrollPositions.artistIndex = scrollTop; - }, - [setJumpToCharacter] - ); - - const jumpBarItems = useMemo(() => { - // Reset if not sorting by sortName - if (sortKey !== 'sortName') { - return { - order: [], - }; - } - - const characters = items.reduce((acc: Record, item) => { - let char = item.sortName.charAt(0); - - if (!isNaN(Number(char))) { - char = '#'; - } - - if (char in acc) { - acc[char] = acc[char] + 1; - } else { - acc[char] = 1; - } - - return acc; - }, {}); - - const order = Object.keys(characters).sort(); - - // Reverse if sorting descending - if (sortDirection === SortDirection.Descending) { - order.reverse(); - } - - return { - characters, - order, - }; - }, [items, sortKey, sortDirection]); - const ViewComponent = useMemo(() => getViewComponent(view), [view]); - - const isLoaded = !!(!error && isPopulated && items.length); - const hasNoArtist = !totalItems; - - return ( - - - - - - - - - - - - - - - - - {view === 'table' ? ( - - - - ) : ( - - )} - - - - - - - - - - -
- - {isFetching && !isPopulated ? : null} - - {!isFetching && !!error ? ( -
- {getErrorMessage(error, 'Failed to load artist from API')} -
- ) : null} - - {isLoaded ? ( -
- - - -
- ) : null} - - {!error && isPopulated && !items.length ? ( - - ) : null} -
- {isLoaded && !!jumpBarItems.order.length ? ( - - ) : null} -
- - {isSelectMode ? : null} - - {view === 'posters' ? ( - - ) : null} - {view === 'banners' ? ( - - ) : null} - {view === 'overview' ? ( - - ) : null} -
-
- ); -}, 'artistIndex'); - -export default ArtistIndex; diff --git a/frontend/src/Artist/Index/ArtistIndexFilterModal.tsx b/frontend/src/Artist/Index/ArtistIndexFilterModal.tsx deleted file mode 100644 index 07e454fc2..000000000 --- a/frontend/src/Artist/Index/ArtistIndexFilterModal.tsx +++ /dev/null @@ -1,56 +0,0 @@ -import React, { useCallback } from 'react'; -import { useDispatch, useSelector } from 'react-redux'; -import { createSelector } from 'reselect'; -import AppState from 'App/State/AppState'; -import FilterModal from 'Components/Filter/FilterModal'; -import { setArtistFilter } from 'Store/Actions/artistIndexActions'; - -function createArtistSelector() { - return createSelector( - (state: AppState) => state.artist.items, - (artist) => { - return artist; - } - ); -} - -function createFilterBuilderPropsSelector() { - return createSelector( - (state: AppState) => state.artistIndex.filterBuilderProps, - (filterBuilderProps) => { - return filterBuilderProps; - } - ); -} - -interface ArtistIndexFilterModalProps { - isOpen: boolean; -} - -export default function ArtistIndexFilterModal( - props: ArtistIndexFilterModalProps -) { - const sectionItems = useSelector(createArtistSelector()); - const filterBuilderProps = useSelector(createFilterBuilderPropsSelector()); - const customFilterType = 'artist'; - - const dispatch = useDispatch(); - - const dispatchSetFilter = useCallback( - (payload: unknown) => { - dispatch(setArtistFilter(payload)); - }, - [dispatch] - ); - - return ( - - ); -} diff --git a/frontend/src/Artist/Index/ArtistIndexFooter.css b/frontend/src/Artist/Index/ArtistIndexFooter.css deleted file mode 100644 index bf3fedfd6..000000000 --- a/frontend/src/Artist/Index/ArtistIndexFooter.css +++ /dev/null @@ -1,80 +0,0 @@ -.footer { - display: flex; - flex-wrap: wrap; - margin-top: 20px; - font-size: $smallFontSize; -} - -.legendItem { - display: flex; - margin-bottom: 4px; - line-height: 16px; -} - -.legendItemColor { - margin-right: 8px; - width: 30px; - height: 16px; - border-radius: 4px; -} - -.continuing { - composes: legendItemColor; - - background-color: var(--primaryColor); -} - -.ended { - composes: legendItemColor; - - background-color: var(--successColor); -} - -.missingMonitored { - composes: legendItemColor; - - background-color: var(--dangerColor); - - &:global(.colorImpaired) { - background: repeating-linear-gradient(90deg, color(#f05050 shade(5%)), color(#f05050 shade(5%)) 5px, color(#f05050 shade(15%)) 5px, color(#f05050 shade(15%)) 10px); - } -} - -.missingUnmonitored { - composes: legendItemColor; - - background-color: var(--warningColor); - - &:global(.colorImpaired) { - background: repeating-linear-gradient(45deg, #ffa500, #ffa500 5px, color(#ffa500 tint(15%)) 5px, color(#ffa500 tint(15%)) 10px); - } -} - -.downloading { - composes: legendItemColor; - - background-color: var(--purple); -} - -.statistics { - display: flex; - justify-content: space-between; - flex-wrap: wrap; -} - -@media (max-width: $breakpointLarge) { - .statistics { - display: block; - } -} - -@media (max-width: $breakpointSmall) { - .footer { - display: block; - } - - .statistics { - display: flex; - margin-top: 20px; - } -} diff --git a/frontend/src/Artist/Index/ArtistIndexFooter.css.d.ts b/frontend/src/Artist/Index/ArtistIndexFooter.css.d.ts deleted file mode 100644 index 29f693a8c..000000000 --- a/frontend/src/Artist/Index/ArtistIndexFooter.css.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'continuing': string; - 'downloading': string; - 'ended': string; - 'footer': string; - 'legendItem': string; - 'legendItemColor': string; - 'missingMonitored': string; - 'missingUnmonitored': string; - 'statistics': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Index/ArtistIndexFooter.tsx b/frontend/src/Artist/Index/ArtistIndexFooter.tsx deleted file mode 100644 index 47241b224..000000000 --- a/frontend/src/Artist/Index/ArtistIndexFooter.tsx +++ /dev/null @@ -1,179 +0,0 @@ -import classNames from 'classnames'; -import React from 'react'; -import { useSelector } from 'react-redux'; -import { createSelector } from 'reselect'; -import { ColorImpairedConsumer } from 'App/ColorImpairedContext'; -import ArtistAppState from 'App/State/ArtistAppState'; -import DescriptionList from 'Components/DescriptionList/DescriptionList'; -import DescriptionListItem from 'Components/DescriptionList/DescriptionListItem'; -import createClientSideCollectionSelector from 'Store/Selectors/createClientSideCollectionSelector'; -import createDeepEqualSelector from 'Store/Selectors/createDeepEqualSelector'; -import formatBytes from 'Utilities/Number/formatBytes'; -import translate from 'Utilities/String/translate'; -import styles from './ArtistIndexFooter.css'; - -function createUnoptimizedSelector() { - return createSelector( - createClientSideCollectionSelector('artist', 'artistIndex'), - (artist: ArtistAppState) => { - return artist.items.map((s) => { - const { monitored, status, statistics } = s; - - return { - monitored, - status, - statistics, - }; - }); - } - ); -} - -function createArtistSelector() { - return createDeepEqualSelector( - createUnoptimizedSelector(), - (artist) => artist - ); -} - -export default function ArtistIndexFooter() { - const artist = useSelector(createArtistSelector()); - const count = artist.length; - let tracks = 0; - let trackFiles = 0; - let ended = 0; - let continuing = 0; - let monitored = 0; - let totalFileSize = 0; - - artist.forEach((a) => { - const { statistics = { trackCount: 0, trackFileCount: 0, sizeOnDisk: 0 } } = - a; - - const { trackCount = 0, trackFileCount = 0, sizeOnDisk = 0 } = statistics; - - tracks += trackCount; - trackFiles += trackFileCount; - - if (a.status === 'ended') { - ended++; - } else { - continuing++; - } - - if (a.monitored) { - monitored++; - } - - totalFileSize += sizeOnDisk; - }); - - return ( - - {(enableColorImpairedMode) => { - return ( -
-
-
-
-
{translate('ContinuingAllTracksDownloaded')}
-
- -
-
-
{translate('EndedAllTracksDownloaded')}
-
- -
-
-
{translate('MissingTracksArtistMonitored')}
-
- -
-
-
{translate('MissingTracksArtistNotMonitored')}
-
- -
-
-
{translate('ArtistIndexFooterDownloading')}
-
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
-
- ); - }} - - ); -} diff --git a/frontend/src/Artist/Index/ArtistIndexRefreshArtistsButton.tsx b/frontend/src/Artist/Index/ArtistIndexRefreshArtistsButton.tsx deleted file mode 100644 index 07a180857..000000000 --- a/frontend/src/Artist/Index/ArtistIndexRefreshArtistsButton.tsx +++ /dev/null @@ -1,74 +0,0 @@ -import React, { useCallback, useMemo } from 'react'; -import { useDispatch, useSelector } from 'react-redux'; -import { useSelect } from 'App/SelectContext'; -import ArtistAppState, { ArtistIndexAppState } from 'App/State/ArtistAppState'; -import ClientSideCollectionAppState from 'App/State/ClientSideCollectionAppState'; -import { REFRESH_ARTIST } from 'Commands/commandNames'; -import PageToolbarButton from 'Components/Page/Toolbar/PageToolbarButton'; -import { icons } from 'Helpers/Props'; -import { executeCommand } from 'Store/Actions/commandActions'; -import createArtistClientSideCollectionItemsSelector from 'Store/Selectors/createArtistClientSideCollectionItemsSelector'; -import createCommandExecutingSelector from 'Store/Selectors/createCommandExecutingSelector'; -import translate from 'Utilities/String/translate'; -import getSelectedIds from 'Utilities/Table/getSelectedIds'; - -interface ArtistIndexRefreshArtistsButtonProps { - isSelectMode: boolean; - selectedFilterKey: string; -} - -function ArtistIndexRefreshArtistsButton( - props: ArtistIndexRefreshArtistsButtonProps -) { - const isRefreshing = useSelector( - createCommandExecutingSelector(REFRESH_ARTIST) - ); - const { - items, - totalItems, - }: ArtistAppState & ArtistIndexAppState & ClientSideCollectionAppState = - useSelector(createArtistClientSideCollectionItemsSelector('artistIndex')); - - const dispatch = useDispatch(); - const { isSelectMode, selectedFilterKey } = props; - const [selectState] = useSelect(); - const { selectedState } = selectState; - - const selectedArtistIds = useMemo(() => { - return getSelectedIds(selectedState); - }, [selectedState]); - - const artistsToRefresh = - isSelectMode && selectedArtistIds.length > 0 - ? selectedArtistIds - : items.map((m) => m.id); - - let refreshLabel = translate('UpdateAll'); - - if (selectedArtistIds.length > 0) { - refreshLabel = translate('UpdateSelected'); - } else if (selectedFilterKey !== 'all') { - refreshLabel = translate('UpdateFiltered'); - } - - const onPress = useCallback(() => { - dispatch( - executeCommand({ - name: REFRESH_ARTIST, - artistIds: artistsToRefresh, - }) - ); - }, [dispatch, artistsToRefresh]); - - return ( - - ); -} - -export default ArtistIndexRefreshArtistsButton; diff --git a/frontend/src/Artist/Index/Banners/ArtistIndexBanner.css b/frontend/src/Artist/Index/Banners/ArtistIndexBanner.css deleted file mode 100644 index 7f1fc71c6..000000000 --- a/frontend/src/Artist/Index/Banners/ArtistIndexBanner.css +++ /dev/null @@ -1,98 +0,0 @@ -$hoverScale: 1.05; - -.content { - transition: all 200ms ease-in; - - &:hover { - z-index: 2; - box-shadow: 0 0 12px var(--black); - transition: all 200ms ease-in; - - .controls { - opacity: 0.9; - transition: opacity 200ms linear 150ms; - } - } -} - -.bannerContainer { - position: relative; -} - -.link { - composes: link from '~Components/Link/Link.css'; - - position: relative; - display: block; - height: 50px; - background-color: var(--defaultColor); -} - -.overlayTitle { - position: absolute; - top: 0; - left: 0; - display: flex; - align-items: center; - justify-content: center; - padding: 5px; - width: 100%; - height: 100%; - color: var(--offWhite); - text-align: center; - font-size: 20px; -} - -.nextAlbum { - background-color: var(--artistBackgroundColor); - text-align: center; - font-size: $smallFontSize; -} - -.title { - @add-mixin truncate; - - background-color: var(--artistBackgroundColor); - text-align: center; - font-size: $smallFontSize; -} - -.ended { - position: absolute; - top: 0; - right: 0; - z-index: 1; - width: 0; - height: 0; - border-width: 0 25px 25px 0; - border-style: solid; - border-color: transparent var(--dangerColor) transparent transparent; - color: var(--white); -} - -.controls { - position: absolute; - bottom: 10px; - left: 10px; - z-index: 3; - border-radius: 4px; - background-color: #216044; - color: var(--white); - font-size: $smallFontSize; - opacity: 0; - transition: opacity 0; -} - -.action { - composes: button from '~Components/Link/IconButton.css'; - - &:hover { - color: #ccc; - } -} - -@media only screen and (max-width: $breakpointSmall) { - .container { - padding: 5px; - } -} diff --git a/frontend/src/Artist/Index/Banners/ArtistIndexBanner.css.d.ts b/frontend/src/Artist/Index/Banners/ArtistIndexBanner.css.d.ts deleted file mode 100644 index bd6cb4ac9..000000000 --- a/frontend/src/Artist/Index/Banners/ArtistIndexBanner.css.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'action': string; - 'bannerContainer': string; - 'container': string; - 'content': string; - 'controls': string; - 'ended': string; - 'link': string; - 'nextAlbum': string; - 'overlayTitle': string; - 'title': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Index/Banners/ArtistIndexBanner.tsx b/frontend/src/Artist/Index/Banners/ArtistIndexBanner.tsx deleted file mode 100644 index f6a03c521..000000000 --- a/frontend/src/Artist/Index/Banners/ArtistIndexBanner.tsx +++ /dev/null @@ -1,263 +0,0 @@ -import React, { useCallback, useState } from 'react'; -import { useDispatch, useSelector } from 'react-redux'; -import { Statistics } from 'Artist/Artist'; -import ArtistBanner from 'Artist/ArtistBanner'; -import DeleteArtistModal from 'Artist/Delete/DeleteArtistModal'; -import EditArtistModalConnector from 'Artist/Edit/EditArtistModalConnector'; -import ArtistIndexBannerInfo from 'Artist/Index/Banners/ArtistIndexBannerInfo'; -import createArtistIndexItemSelector from 'Artist/Index/createArtistIndexItemSelector'; -import ArtistIndexProgressBar from 'Artist/Index/ProgressBar/ArtistIndexProgressBar'; -import ArtistIndexPosterSelect from 'Artist/Index/Select/ArtistIndexPosterSelect'; -import { ARTIST_SEARCH, REFRESH_ARTIST } from 'Commands/commandNames'; -import Label from 'Components/Label'; -import IconButton from 'Components/Link/IconButton'; -import Link from 'Components/Link/Link'; -import SpinnerIconButton from 'Components/Link/SpinnerIconButton'; -import { icons } from 'Helpers/Props'; -import { executeCommand } from 'Store/Actions/commandActions'; -import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector'; -import getRelativeDate from 'Utilities/Date/getRelativeDate'; -import translate from 'Utilities/String/translate'; -import selectBannerOptions from './selectBannerOptions'; -import styles from './ArtistIndexBanner.css'; - -interface ArtistIndexBannerProps { - artistId: number; - sortKey: string; - isSelectMode: boolean; - bannerWidth: number; - bannerHeight: number; -} - -function ArtistIndexBanner(props: ArtistIndexBannerProps) { - const { artistId, sortKey, isSelectMode, bannerWidth, bannerHeight } = props; - - const { - artist, - qualityProfile, - metadataProfile, - isRefreshingArtist, - isSearchingArtist, - } = useSelector(createArtistIndexItemSelector(props.artistId)); - - const { - detailedProgressBar, - showTitle, - showMonitored, - showQualityProfile, - showNextAlbum, - showSearchAction, - } = useSelector(selectBannerOptions); - - const { showRelativeDates, shortDateFormat, longDateFormat, timeFormat } = - useSelector(createUISettingsSelector()); - - const { - artistName, - artistType, - monitored, - status, - path, - foreignArtistId, - nextAlbum, - added, - statistics = {} as Statistics, - images, - tags, - } = artist; - - const { - albumCount = 0, - trackCount = 0, - trackFileCount = 0, - totalTrackCount = 0, - sizeOnDisk = 0, - } = statistics; - - const dispatch = useDispatch(); - const [hasBannerError, setHasBannerError] = useState(false); - const [isEditArtistModalOpen, setIsEditArtistModalOpen] = useState(false); - const [isDeleteArtistModalOpen, setIsDeleteArtistModalOpen] = useState(false); - - const onRefreshPress = useCallback(() => { - dispatch( - executeCommand({ - name: REFRESH_ARTIST, - artistId, - }) - ); - }, [artistId, dispatch]); - - const onSearchPress = useCallback(() => { - dispatch( - executeCommand({ - name: ARTIST_SEARCH, - artistId, - }) - ); - }, [artistId, dispatch]); - - const onBannerLoadError = useCallback(() => { - setHasBannerError(true); - }, [setHasBannerError]); - - const onBannerLoad = useCallback(() => { - setHasBannerError(false); - }, [setHasBannerError]); - - const onEditArtistPress = useCallback(() => { - setIsEditArtistModalOpen(true); - }, [setIsEditArtistModalOpen]); - - const onEditArtistModalClose = useCallback(() => { - setIsEditArtistModalOpen(false); - }, [setIsEditArtistModalOpen]); - - const onDeleteArtistPress = useCallback(() => { - setIsEditArtistModalOpen(false); - setIsDeleteArtistModalOpen(true); - }, [setIsDeleteArtistModalOpen]); - - const onDeleteArtistModalClose = useCallback(() => { - setIsDeleteArtistModalOpen(false); - }, [setIsDeleteArtistModalOpen]); - - const link = `/artist/${foreignArtistId}`; - - const elementStyle = { - width: `${bannerWidth}px`, - height: `${bannerHeight}px`, - }; - - return ( -
-
- {isSelectMode ? : null} - - - - {status === 'ended' ? ( -
- ) : null} - - - - - {hasBannerError ? ( -
{artistName}
- ) : null} - -
- - - - {showTitle ? ( -
- {artistName} -
- ) : null} - - {showMonitored ? ( -
- {monitored ? translate('Monitored') : translate('Unmonitored')} -
- ) : null} - - {showQualityProfile && !!qualityProfile?.name ? ( -
- {qualityProfile.name} -
- ) : null} - - {showNextAlbum && !!nextAlbum?.releaseDate ? ( -
- {getRelativeDate( - nextAlbum.releaseDate, - shortDateFormat, - showRelativeDates, - { - timeFormat, - timeForToday: true, - } - )} -
- ) : null} - - - - - - -
- ); -} - -export default ArtistIndexBanner; diff --git a/frontend/src/Artist/Index/Banners/ArtistIndexBannerInfo.css b/frontend/src/Artist/Index/Banners/ArtistIndexBannerInfo.css deleted file mode 100644 index 22ed2d528..000000000 --- a/frontend/src/Artist/Index/Banners/ArtistIndexBannerInfo.css +++ /dev/null @@ -1,5 +0,0 @@ -.info { - background-color: var(--artistBackgroundColor); - text-align: center; - font-size: $smallFontSize; -} diff --git a/frontend/src/Artist/Index/Banners/ArtistIndexBannerInfo.css.d.ts b/frontend/src/Artist/Index/Banners/ArtistIndexBannerInfo.css.d.ts deleted file mode 100644 index 062365d36..000000000 --- a/frontend/src/Artist/Index/Banners/ArtistIndexBannerInfo.css.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'info': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Index/Banners/ArtistIndexBannerInfo.tsx b/frontend/src/Artist/Index/Banners/ArtistIndexBannerInfo.tsx deleted file mode 100644 index a93b0bafc..000000000 --- a/frontend/src/Artist/Index/Banners/ArtistIndexBannerInfo.tsx +++ /dev/null @@ -1,187 +0,0 @@ -import React from 'react'; -import Album from 'Album/Album'; -import TagListConnector from 'Components/TagListConnector'; -import MetadataProfile from 'typings/MetadataProfile'; -import QualityProfile from 'typings/QualityProfile'; -import formatDateTime from 'Utilities/Date/formatDateTime'; -import getRelativeDate from 'Utilities/Date/getRelativeDate'; -import formatBytes from 'Utilities/Number/formatBytes'; -import translate from 'Utilities/String/translate'; -import styles from './ArtistIndexBannerInfo.css'; - -interface ArtistIndexBannerInfoProps { - artistType?: string; - showQualityProfile: boolean; - qualityProfile?: QualityProfile; - metadataProfile?: MetadataProfile; - showNextAlbum: boolean; - nextAlbum?: Album; - lastAlbum?: Album; - added?: string; - albumCount: number; - path: string; - sizeOnDisk?: number; - tags?: number[]; - sortKey: string; - showRelativeDates: boolean; - shortDateFormat: string; - longDateFormat: string; - timeFormat: string; -} - -function ArtistIndexBannerInfo(props: ArtistIndexBannerInfoProps) { - const { - artistType, - qualityProfile, - metadataProfile, - showQualityProfile, - showNextAlbum, - nextAlbum, - lastAlbum, - added, - albumCount, - path, - sizeOnDisk, - tags, - sortKey, - showRelativeDates, - shortDateFormat, - longDateFormat, - timeFormat, - } = props; - - if (sortKey === 'artistType' && artistType) { - return ( -
- {artistType} -
- ); - } - - if ( - sortKey === 'qualityProfileId' && - !showQualityProfile && - !!qualityProfile?.name - ) { - return ( -
- {qualityProfile.name} -
- ); - } - - if (sortKey === 'metadataProfileId' && !!metadataProfile?.name) { - return ( -
- {metadataProfile.name} -
- ); - } - - if (sortKey === 'nextAlbum' && !showNextAlbum && !!nextAlbum?.releaseDate) { - return ( -
- {getRelativeDate( - nextAlbum.releaseDate, - shortDateFormat, - showRelativeDates, - { - timeFormat, - timeForToday: true, - } - )} -
- ); - } - - if (sortKey === 'lastAlbum' && !!lastAlbum?.releaseDate) { - return ( -
- {getRelativeDate( - lastAlbum.releaseDate, - shortDateFormat, - showRelativeDates, - { - timeFormat, - timeForToday: true, - } - )} -
- ); - } - - if (sortKey === 'added' && added) { - const addedDate = getRelativeDate( - added, - shortDateFormat, - showRelativeDates, - { - timeFormat, - timeForToday: false, - } - ); - - return ( -
- {translate('Added')}: {addedDate} -
- ); - } - - if (sortKey === 'albumCount') { - let albums = translate('OneAlbum'); - - if (albumCount === 0) { - albums = translate('NoAlbums'); - } else if (albumCount > 1) { - albums = translate('CountAlbums', { albumCount }); - } - - return
{albums}
; - } - - if (sortKey === 'path') { - return ( -
- {path} -
- ); - } - - if (sortKey === 'sizeOnDisk') { - return ( -
- {formatBytes(sizeOnDisk)} -
- ); - } - - if (sortKey === 'tags' && tags) { - return ( -
- -
- ); - } - - return null; -} - -export default ArtistIndexBannerInfo; diff --git a/frontend/src/Artist/Index/Banners/ArtistIndexBanners.css b/frontend/src/Artist/Index/Banners/ArtistIndexBanners.css deleted file mode 100644 index 9c6520fb5..000000000 --- a/frontend/src/Artist/Index/Banners/ArtistIndexBanners.css +++ /dev/null @@ -1,3 +0,0 @@ -.grid { - flex: 1 0 auto; -} diff --git a/frontend/src/Artist/Index/Banners/ArtistIndexBanners.css.d.ts b/frontend/src/Artist/Index/Banners/ArtistIndexBanners.css.d.ts deleted file mode 100644 index b97436b41..000000000 --- a/frontend/src/Artist/Index/Banners/ArtistIndexBanners.css.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'grid': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Index/Banners/ArtistIndexBanners.tsx b/frontend/src/Artist/Index/Banners/ArtistIndexBanners.tsx deleted file mode 100644 index 3582da097..000000000 --- a/frontend/src/Artist/Index/Banners/ArtistIndexBanners.tsx +++ /dev/null @@ -1,304 +0,0 @@ -import { throttle } from 'lodash'; -import React, { RefObject, useEffect, useMemo, useRef, useState } from 'react'; -import { useSelector } from 'react-redux'; -import { FixedSizeGrid as Grid, GridChildComponentProps } from 'react-window'; -import { createSelector } from 'reselect'; -import AppState from 'App/State/AppState'; -import Artist from 'Artist/Artist'; -import ArtistIndexBanner from 'Artist/Index/Banners/ArtistIndexBanner'; -import useMeasure from 'Helpers/Hooks/useMeasure'; -import SortDirection from 'Helpers/Props/SortDirection'; -import dimensions from 'Styles/Variables/dimensions'; -import getIndexOfFirstCharacter from 'Utilities/Array/getIndexOfFirstCharacter'; - -const bodyPadding = parseInt(dimensions.pageContentBodyPadding); -const bodyPaddingSmallScreen = parseInt( - dimensions.pageContentBodyPaddingSmallScreen -); -const columnPadding = parseInt(dimensions.artistIndexColumnPadding); -const columnPaddingSmallScreen = parseInt( - dimensions.artistIndexColumnPaddingSmallScreen -); -const progressBarHeight = parseInt(dimensions.progressBarSmallHeight); -const detailedProgressBarHeight = parseInt(dimensions.progressBarMediumHeight); - -const ADDITIONAL_COLUMN_COUNT: Record = { - small: 3, - medium: 2, - large: 1, -}; - -interface CellItemData { - layout: { - columnCount: number; - padding: number; - bannerWidth: number; - bannerHeight: number; - }; - items: Artist[]; - sortKey: string; - isSelectMode: boolean; -} - -interface ArtistIndexBannersProps { - items: Artist[]; - sortKey: string; - sortDirection?: SortDirection; - jumpToCharacter?: string; - scrollTop?: number; - scrollerRef: RefObject; - isSelectMode: boolean; - isSmallScreen: boolean; -} - -const artistIndexSelector = createSelector( - (state: AppState) => state.artistIndex.bannerOptions, - (bannerOptions) => { - return { - bannerOptions, - }; - } -); - -const Cell: React.FC> = ({ - columnIndex, - rowIndex, - style, - data, -}) => { - const { layout, items, sortKey, isSelectMode } = data; - const { columnCount, padding, bannerWidth, bannerHeight } = layout; - const index = rowIndex * columnCount + columnIndex; - - if (index >= items.length) { - return null; - } - - const artist = items[index]; - - return ( -
- -
- ); -}; - -function getWindowScrollTopPosition() { - return document.documentElement.scrollTop || document.body.scrollTop || 0; -} - -export default function ArtistIndexBanners(props: ArtistIndexBannersProps) { - const { - scrollerRef, - items, - sortKey, - jumpToCharacter, - isSelectMode, - isSmallScreen, - } = props; - - const { bannerOptions } = useSelector(artistIndexSelector); - const ref = useRef(null); - const [measureRef, bounds] = useMeasure(); - const [size, setSize] = useState({ width: 0, height: 0 }); - - const columnWidth = useMemo(() => { - const { width } = size; - const maximumColumnWidth = isSmallScreen ? 344 : 364; - const columns = Math.floor(width / maximumColumnWidth); - const remainder = width % maximumColumnWidth; - return remainder === 0 - ? maximumColumnWidth - : Math.floor( - width / (columns + ADDITIONAL_COLUMN_COUNT[bannerOptions.size]) - ); - }, [isSmallScreen, bannerOptions, size]); - - const columnCount = useMemo( - () => Math.max(Math.floor(size.width / columnWidth), 1), - [size, columnWidth] - ); - const padding = props.isSmallScreen - ? columnPaddingSmallScreen - : columnPadding; - const bannerWidth = columnWidth - padding * 2; - const bannerHeight = Math.ceil((88 / 476) * bannerWidth); - - const rowHeight = useMemo(() => { - const { - detailedProgressBar, - showTitle, - showMonitored, - showQualityProfile, - showNextAlbum, - } = bannerOptions; - - const nextAiringHeight = 19; - - const heights = [ - bannerHeight, - detailedProgressBar ? detailedProgressBarHeight : progressBarHeight, - nextAiringHeight, - isSmallScreen ? columnPaddingSmallScreen : columnPadding, - ]; - - if (showTitle) { - heights.push(19); - } - - if (showMonitored) { - heights.push(19); - } - - if (showQualityProfile) { - heights.push(19); - } - - if (showNextAlbum) { - heights.push(19); - } - - switch (sortKey) { - case 'artistType': - case 'metadataProfileId': - case 'lastAlbum': - case 'added': - case 'albumCount': - case 'path': - case 'sizeOnDisk': - case 'tags': - heights.push(19); - break; - case 'qualityProfileId': - if (!showQualityProfile) { - heights.push(19); - } - break; - case 'nextAlbum': - if (!showNextAlbum) { - heights.push(19); - } - break; - default: - // No need to add a height of 0 - } - - return heights.reduce((acc, height) => acc + height, 0); - }, [isSmallScreen, bannerOptions, sortKey, bannerHeight]); - - useEffect(() => { - const current = scrollerRef.current; - - if (isSmallScreen) { - const padding = bodyPaddingSmallScreen - 5; - - setSize({ - width: window.innerWidth - padding * 2, - height: window.innerHeight, - }); - - return; - } - - if (current) { - const width = current.clientWidth; - const padding = bodyPadding - 5; - - setSize({ - width: width - padding * 2, - height: window.innerHeight, - }); - } - }, [isSmallScreen, scrollerRef, bounds]); - - useEffect(() => { - const currentScrollerRef = scrollerRef.current as HTMLElement; - const currentScrollListener = isSmallScreen ? window : currentScrollerRef; - - const handleScroll = throttle(() => { - const { offsetTop = 0 } = currentScrollerRef; - const scrollTop = - (isSmallScreen - ? getWindowScrollTopPosition() - : currentScrollerRef.scrollTop) - offsetTop; - - ref.current?.scrollTo({ scrollLeft: 0, scrollTop }); - }, 10); - - currentScrollListener.addEventListener('scroll', handleScroll); - - return () => { - handleScroll.cancel(); - - if (currentScrollListener) { - currentScrollListener.removeEventListener('scroll', handleScroll); - } - }; - }, [isSmallScreen, ref, scrollerRef]); - - useEffect(() => { - if (jumpToCharacter) { - const index = getIndexOfFirstCharacter(items, jumpToCharacter); - - if (index != null) { - const rowIndex = Math.floor(index / columnCount); - - const scrollTop = rowIndex * rowHeight + padding; - - ref.current?.scrollTo({ scrollLeft: 0, scrollTop }); - scrollerRef.current?.scrollTo(0, scrollTop); - } - } - }, [ - jumpToCharacter, - rowHeight, - columnCount, - padding, - items, - scrollerRef, - ref, - ]); - - return ( -
- - ref={ref} - style={{ - width: '100%', - height: '100%', - overflow: 'none', - }} - width={size.width} - height={size.height} - columnCount={columnCount} - columnWidth={columnWidth} - rowCount={Math.ceil(items.length / columnCount)} - rowHeight={rowHeight} - itemData={{ - layout: { - columnCount, - padding, - bannerWidth, - bannerHeight, - }, - items, - sortKey, - isSelectMode, - }} - > - {Cell} - -
- ); -} diff --git a/frontend/src/Artist/Index/Banners/Options/ArtistIndexBannerOptionsModal.tsx b/frontend/src/Artist/Index/Banners/Options/ArtistIndexBannerOptionsModal.tsx deleted file mode 100644 index 156e06079..000000000 --- a/frontend/src/Artist/Index/Banners/Options/ArtistIndexBannerOptionsModal.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import React from 'react'; -import Modal from 'Components/Modal/Modal'; -import ArtistIndexBannerOptionsModalContent from './ArtistIndexBannerOptionsModalContent'; - -interface ArtistIndexBannerOptionsModalProps { - isOpen: boolean; - onModalClose(...args: unknown[]): unknown; -} - -function ArtistIndexBannerOptionsModal({ - isOpen, - onModalClose, -}: ArtistIndexBannerOptionsModalProps) { - return ( - - - - ); -} - -export default ArtistIndexBannerOptionsModal; diff --git a/frontend/src/Artist/Index/Banners/Options/ArtistIndexBannerOptionsModalContent.tsx b/frontend/src/Artist/Index/Banners/Options/ArtistIndexBannerOptionsModalContent.tsx deleted file mode 100644 index f889ea450..000000000 --- a/frontend/src/Artist/Index/Banners/Options/ArtistIndexBannerOptionsModalContent.tsx +++ /dev/null @@ -1,167 +0,0 @@ -import React, { useCallback } from 'react'; -import { useDispatch, useSelector } from 'react-redux'; -import selectBannerOptions from 'Artist/Index/Banners/selectBannerOptions'; -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 { setArtistBannerOption } from 'Store/Actions/artistIndexActions'; -import translate from 'Utilities/String/translate'; - -const bannerSizeOptions = [ - { - key: 'small', - get value() { - return translate('Small'); - }, - }, - { - key: 'medium', - get value() { - return translate('Medium'); - }, - }, - { - key: 'large', - get value() { - return translate('Large'); - }, - }, -]; - -interface ArtistIndexBannerOptionsModalContentProps { - onModalClose(...args: unknown[]): unknown; -} - -function ArtistIndexBannerOptionsModalContent( - props: ArtistIndexBannerOptionsModalContentProps -) { - const { onModalClose } = props; - - const bannerOptions = useSelector(selectBannerOptions); - - const { - detailedProgressBar, - size, - showTitle, - showMonitored, - showQualityProfile, - showNextAlbum, - showSearchAction, - } = bannerOptions; - - const dispatch = useDispatch(); - - const onBannerOptionChange = useCallback( - ({ name, value }: { name: string; value: unknown }) => { - dispatch(setArtistBannerOption({ [name]: value })); - }, - [dispatch] - ); - - return ( - - {translate('BannerOptions')} - - -
- - {translate('BannerSize')} - - - - - - {translate('DetailedProgressBar')} - - - - - - {translate('ShowName')} - - - - - - {translate('ShowMonitored')} - - - - - - {translate('ShowQualityProfile')} - - - - - - {translate('ShowNextAlbum')} - - - - - - {translate('ShowSearch')} - - - -
-
- - - - -
- ); -} - -export default ArtistIndexBannerOptionsModalContent; diff --git a/frontend/src/Artist/Index/Banners/selectBannerOptions.ts b/frontend/src/Artist/Index/Banners/selectBannerOptions.ts deleted file mode 100644 index 529c15e06..000000000 --- a/frontend/src/Artist/Index/Banners/selectBannerOptions.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { createSelector } from 'reselect'; -import AppState from 'App/State/AppState'; - -const selectBannerOptions = createSelector( - (state: AppState) => state.artistIndex.bannerOptions, - (bannerOptions) => bannerOptions -); - -export default selectBannerOptions; diff --git a/frontend/src/Artist/Index/Menus/ArtistIndexFilterMenu.tsx b/frontend/src/Artist/Index/Menus/ArtistIndexFilterMenu.tsx deleted file mode 100644 index 91ebbef2d..000000000 --- a/frontend/src/Artist/Index/Menus/ArtistIndexFilterMenu.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import React from 'react'; -import { CustomFilter } from 'App/State/AppState'; -import ArtistIndexFilterModal from 'Artist/Index/ArtistIndexFilterModal'; -import FilterMenu from 'Components/Menu/FilterMenu'; -import { align } from 'Helpers/Props'; - -interface ArtistIndexFilterMenuProps { - selectedFilterKey: string | number; - filters: object[]; - customFilters: CustomFilter[]; - isDisabled: boolean; - onFilterSelect(filterName: string): unknown; -} - -function ArtistIndexFilterMenu(props: ArtistIndexFilterMenuProps) { - const { - selectedFilterKey, - filters, - customFilters, - isDisabled, - onFilterSelect, - } = props; - - return ( - - ); -} - -ArtistIndexFilterMenu.defaultProps = { - showCustomFilters: false, -}; - -export default ArtistIndexFilterMenu; diff --git a/frontend/src/Artist/Index/Menus/ArtistIndexSortMenu.tsx b/frontend/src/Artist/Index/Menus/ArtistIndexSortMenu.tsx deleted file mode 100644 index 1b72d0f4c..000000000 --- a/frontend/src/Artist/Index/Menus/ArtistIndexSortMenu.tsx +++ /dev/null @@ -1,152 +0,0 @@ -import React from 'react'; -import MenuContent from 'Components/Menu/MenuContent'; -import SortMenu from 'Components/Menu/SortMenu'; -import SortMenuItem from 'Components/Menu/SortMenuItem'; -import { align } from 'Helpers/Props'; -import SortDirection from 'Helpers/Props/SortDirection'; -import translate from 'Utilities/String/translate'; - -interface SeriesIndexSortMenuProps { - sortKey?: string; - sortDirection?: SortDirection; - isDisabled: boolean; - onSortSelect(sortKey: string): unknown; -} - -function ArtistIndexSortMenu(props: SeriesIndexSortMenuProps) { - const { sortKey, sortDirection, isDisabled, onSortSelect } = props; - - return ( - - - - {translate('MonitoredStatus')} - - - - {translate('Name')} - - - - {translate('Type')} - - - - {translate('QualityProfile')} - - - - {translate('MetadataProfile')} - - - - {translate('NextAlbum')} - - - - {translate('LastAlbum')} - - - - {translate('Added')} - - - - {translate('Albums')} - - - - {translate('Tracks')} - - - - {translate('TrackCount')} - - - - {translate('Path')} - - - - {translate('SizeOnDisk')} - - - - {translate('Tags')} - - - - ); -} - -export default ArtistIndexSortMenu; diff --git a/frontend/src/Artist/Index/Menus/ArtistIndexViewMenu.tsx b/frontend/src/Artist/Index/Menus/ArtistIndexViewMenu.tsx deleted file mode 100644 index bb88d9149..000000000 --- a/frontend/src/Artist/Index/Menus/ArtistIndexViewMenu.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import React from 'react'; -import MenuContent from 'Components/Menu/MenuContent'; -import ViewMenu from 'Components/Menu/ViewMenu'; -import ViewMenuItem from 'Components/Menu/ViewMenuItem'; -import { align } from 'Helpers/Props'; -import translate from 'Utilities/String/translate'; - -interface ArtistIndexViewMenuProps { - view: string; - isDisabled: boolean; - onViewSelect(value: string): unknown; -} - -function ArtistIndexViewMenu(props: ArtistIndexViewMenuProps) { - const { view, isDisabled, onViewSelect } = props; - - return ( - - - - {translate('Table')} - - - - {translate('Posters')} - - - - {translate('Banners')} - - - - {translate('Overview')} - - - - ); -} - -export default ArtistIndexViewMenu; diff --git a/frontend/src/Artist/Index/Overview/ArtistIndexOverview.css b/frontend/src/Artist/Index/Overview/ArtistIndexOverview.css deleted file mode 100644 index 1f482a2d6..000000000 --- a/frontend/src/Artist/Index/Overview/ArtistIndexOverview.css +++ /dev/null @@ -1,88 +0,0 @@ -$hoverScale: 1.05; - -.content { - display: flex; - flex-grow: 1; -} - -.poster { - position: relative; -} - -.posterContainer { - position: relative; -} - -.link { - composes: link from '~Components/Link/Link.css'; - - display: block; - color: var(--defaultColor); - - &:hover { - color: var(--defaultColor); - text-decoration: none; - } -} - -.ended { - position: absolute; - top: 0; - right: 0; - z-index: 1; - width: 0; - height: 0; - border-width: 0 25px 25px 0; - border-style: solid; - border-color: transparent var(--dangerColor) transparent transparent; - color: var(--white); -} - -.info { - display: flex; - flex: 1 0 1px; - flex-direction: column; - overflow: hidden; - padding-left: 10px; -} - -.titleRow { - display: flex; - justify-content: space-between; - flex: 0 0 auto; - margin-bottom: 10px; - line-height: 32px; -} - -.title { - @add-mixin truncate; - composes: link; - - flex: 1 0 1px; - font-weight: 300; - font-size: 30px; -} - -.actions { - white-space: nowrap; -} - -.details { - display: flex; - justify-content: space-between; - flex: 1 0 auto; -} - -.overview { - composes: link; - - flex: 0 1 1000px; - overflow: hidden; - min-height: 0; -} - -@media only screen and (max-width: $breakpointSmall) { - .overview { - display: none; - } -} diff --git a/frontend/src/Artist/Index/Overview/ArtistIndexOverview.css.d.ts b/frontend/src/Artist/Index/Overview/ArtistIndexOverview.css.d.ts deleted file mode 100644 index de94277cc..000000000 --- a/frontend/src/Artist/Index/Overview/ArtistIndexOverview.css.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'actions': string; - 'content': string; - 'details': string; - 'ended': string; - 'info': string; - 'link': string; - 'overview': string; - 'poster': string; - 'posterContainer': string; - 'title': string; - 'titleRow': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Index/Overview/ArtistIndexOverview.tsx b/frontend/src/Artist/Index/Overview/ArtistIndexOverview.tsx deleted file mode 100644 index ebef28264..000000000 --- a/frontend/src/Artist/Index/Overview/ArtistIndexOverview.tsx +++ /dev/null @@ -1,249 +0,0 @@ -import React, { useCallback, useMemo, useState } from 'react'; -import { useDispatch, useSelector } from 'react-redux'; -import TextTruncate from 'react-text-truncate'; -import { Statistics } from 'Artist/Artist'; -import ArtistPoster from 'Artist/ArtistPoster'; -import DeleteArtistModal from 'Artist/Delete/DeleteArtistModal'; -import EditArtistModalConnector from 'Artist/Edit/EditArtistModalConnector'; -import ArtistIndexProgressBar from 'Artist/Index/ProgressBar/ArtistIndexProgressBar'; -import ArtistIndexPosterSelect from 'Artist/Index/Select/ArtistIndexPosterSelect'; -import { ARTIST_SEARCH, REFRESH_ARTIST } from 'Commands/commandNames'; -import IconButton from 'Components/Link/IconButton'; -import Link from 'Components/Link/Link'; -import SpinnerIconButton from 'Components/Link/SpinnerIconButton'; -import { icons } from 'Helpers/Props'; -import { executeCommand } from 'Store/Actions/commandActions'; -import dimensions from 'Styles/Variables/dimensions'; -import fonts from 'Styles/Variables/fonts'; -import translate from 'Utilities/String/translate'; -import createArtistIndexItemSelector from '../createArtistIndexItemSelector'; -import ArtistIndexOverviewInfo from './ArtistIndexOverviewInfo'; -import selectOverviewOptions from './selectOverviewOptions'; -import styles from './ArtistIndexOverview.css'; - -const columnPadding = parseInt(dimensions.artistIndexColumnPadding); -const columnPaddingSmallScreen = parseInt( - dimensions.artistIndexColumnPaddingSmallScreen -); -const defaultFontSize = parseInt(fonts.defaultFontSize); -const lineHeight = parseFloat(fonts.lineHeight); - -// Hardcoded height based on line-height of 32 + bottom margin of 10. -// Less side-effecty than using react-measure. -const TITLE_HEIGHT = 42; - -interface ArtistIndexOverviewProps { - artistId: number; - sortKey: string; - posterWidth: number; - posterHeight: number; - rowHeight: number; - isSelectMode: boolean; - isSmallScreen: boolean; -} - -function ArtistIndexOverview(props: ArtistIndexOverviewProps) { - const { - artistId, - sortKey, - posterWidth, - posterHeight, - rowHeight, - isSelectMode, - isSmallScreen, - } = props; - - const { artist, qualityProfile, isRefreshingArtist, isSearchingArtist } = - useSelector(createArtistIndexItemSelector(props.artistId)); - - const overviewOptions = useSelector(selectOverviewOptions); - - const { - artistName, - monitored, - status, - path, - foreignArtistId, - nextAlbum, - lastAlbum, - added, - overview, - statistics = {} as Statistics, - images, - } = artist; - - const { - albumCount = 0, - sizeOnDisk = 0, - trackCount = 0, - trackFileCount = 0, - totalTrackCount = 0, - } = statistics; - - const dispatch = useDispatch(); - const [isEditArtistModalOpen, setIsEditArtistModalOpen] = useState(false); - const [isDeleteArtistModalOpen, setIsDeleteArtistModalOpen] = useState(false); - - const onRefreshPress = useCallback(() => { - dispatch( - executeCommand({ - name: REFRESH_ARTIST, - artistId, - }) - ); - }, [artistId, dispatch]); - - const onSearchPress = useCallback(() => { - dispatch( - executeCommand({ - name: ARTIST_SEARCH, - artistId, - }) - ); - }, [artistId, dispatch]); - - const onEditArtistPress = useCallback(() => { - setIsEditArtistModalOpen(true); - }, [setIsEditArtistModalOpen]); - - const onEditArtistModalClose = useCallback(() => { - setIsEditArtistModalOpen(false); - }, [setIsEditArtistModalOpen]); - - const onDeleteArtistPress = useCallback(() => { - setIsEditArtistModalOpen(false); - setIsDeleteArtistModalOpen(true); - }, [setIsDeleteArtistModalOpen]); - - const onDeleteArtistModalClose = useCallback(() => { - setIsDeleteArtistModalOpen(false); - }, [setIsDeleteArtistModalOpen]); - - const link = `/artist/${foreignArtistId}`; - - const elementStyle = { - width: `${posterWidth}px`, - height: `${posterHeight}px`, - }; - - const contentHeight = useMemo(() => { - const padding = isSmallScreen ? columnPaddingSmallScreen : columnPadding; - - return rowHeight - padding; - }, [rowHeight, isSmallScreen]); - - const overviewHeight = contentHeight - TITLE_HEIGHT; - - return ( -
-
-
-
- {isSelectMode ? ( - - ) : null} - - {status === 'ended' && ( -
- )} - - - - -
- - -
- -
-
- - {artistName} - - -
- - - {overviewOptions.showSearchAction ? ( - - ) : null} - - -
-
- -
- - - - - -
-
-
- - - - -
- ); -} - -export default ArtistIndexOverview; diff --git a/frontend/src/Artist/Index/Overview/ArtistIndexOverviewInfo.css b/frontend/src/Artist/Index/Overview/ArtistIndexOverviewInfo.css deleted file mode 100644 index 5dc53762f..000000000 --- a/frontend/src/Artist/Index/Overview/ArtistIndexOverviewInfo.css +++ /dev/null @@ -1,12 +0,0 @@ -.infos { - display: flex; - flex: 0 0 250px; - flex-direction: column; - margin-left: 10px; -} - -@media only screen and (max-width: $breakpointSmall) { - .infos { - margin-left: 0; - } -} diff --git a/frontend/src/Artist/Index/Overview/ArtistIndexOverviewInfo.css.d.ts b/frontend/src/Artist/Index/Overview/ArtistIndexOverviewInfo.css.d.ts deleted file mode 100644 index eb2309a64..000000000 --- a/frontend/src/Artist/Index/Overview/ArtistIndexOverviewInfo.css.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'infos': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Index/Overview/ArtistIndexOverviewInfo.tsx b/frontend/src/Artist/Index/Overview/ArtistIndexOverviewInfo.tsx deleted file mode 100644 index c95d34b84..000000000 --- a/frontend/src/Artist/Index/Overview/ArtistIndexOverviewInfo.tsx +++ /dev/null @@ -1,260 +0,0 @@ -import { IconDefinition } from '@fortawesome/free-regular-svg-icons'; -import React, { useMemo } from 'react'; -import { useSelector } from 'react-redux'; -import Album from 'Album/Album'; -import { icons } from 'Helpers/Props'; -import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector'; -import dimensions from 'Styles/Variables/dimensions'; -import QualityProfile from 'typings/QualityProfile'; -import UiSettings from 'typings/Settings/UiSettings'; -import formatDateTime from 'Utilities/Date/formatDateTime'; -import getRelativeDate from 'Utilities/Date/getRelativeDate'; -import formatBytes from 'Utilities/Number/formatBytes'; -import translate from 'Utilities/String/translate'; -import ArtistIndexOverviewInfoRow from './ArtistIndexOverviewInfoRow'; -import styles from './ArtistIndexOverviewInfo.css'; - -interface RowProps { - name: string; - showProp: string; - valueProp: string; -} - -interface RowInfoProps { - title: string; - iconName: IconDefinition; - label: string; -} - -interface ArtistIndexOverviewInfoProps { - height: number; - showMonitored: boolean; - showQualityProfile: boolean; - showLastAlbum: boolean; - showAdded: boolean; - showAlbumCount: boolean; - showPath: boolean; - showSizeOnDisk: boolean; - monitored: boolean; - nextAlbum?: Album; - qualityProfile?: QualityProfile; - lastAlbum?: Album; - added?: string; - albumCount: number; - path: string; - sizeOnDisk?: number; - sortKey: string; -} - -const infoRowHeight = parseInt(dimensions.artistIndexOverviewInfoRowHeight); - -const rows = [ - { - name: 'monitored', - showProp: 'showMonitored', - valueProp: 'monitored', - }, - { - name: 'qualityProfileId', - showProp: 'showQualityProfile', - valueProp: 'qualityProfile', - }, - { - name: 'lastAlbum', - showProp: 'showLastAlbum', - valueProp: 'lastAlbum', - }, - { - name: 'added', - showProp: 'showAdded', - valueProp: 'added', - }, - { - name: 'albumCount', - showProp: 'showAlbumCount', - valueProp: 'albumCount', - }, - { - name: 'path', - showProp: 'showPath', - valueProp: 'path', - }, - { - name: 'sizeOnDisk', - showProp: 'showSizeOnDisk', - valueProp: 'sizeOnDisk', - }, -]; - -function getInfoRowProps( - row: RowProps, - props: ArtistIndexOverviewInfoProps, - uiSettings: UiSettings -): RowInfoProps | null { - const { name } = row; - - if (name === 'monitored') { - const monitoredText = props.monitored - ? translate('Monitored') - : translate('Unmonitored'); - - return { - title: monitoredText, - iconName: props.monitored ? icons.MONITORED : icons.UNMONITORED, - label: monitoredText, - }; - } - - if (name === 'qualityProfileId' && !!props.qualityProfile?.name) { - return { - title: translate('QualityProfile'), - iconName: icons.PROFILE, - label: props.qualityProfile.name, - }; - } - - if (name === 'lastAlbum' && !!props.lastAlbum?.title) { - const lastAlbum = props.lastAlbum; - const { showRelativeDates, shortDateFormat, timeFormat } = uiSettings; - - return { - title: `Last Album: ${lastAlbum.title}`, - iconName: icons.CALENDAR, - label: - getRelativeDate( - lastAlbum.releaseDate, - shortDateFormat, - showRelativeDates, - { - timeFormat, - timeForToday: true, - } - ) ?? '', - }; - } - - if (name === 'added') { - const added = props.added; - const { showRelativeDates, shortDateFormat, longDateFormat, timeFormat } = - uiSettings; - - return { - title: `Added: ${formatDateTime(added, longDateFormat, timeFormat)}`, - iconName: icons.ADD, - label: - getRelativeDate(added, shortDateFormat, showRelativeDates, { - timeFormat, - timeForToday: true, - }) ?? '', - }; - } - - if (name === 'albumCount') { - const { albumCount } = props; - let albums = '1 album'; - - if (albumCount === 0) { - albums = 'No albums'; - } else if (albumCount > 1) { - albums = `${albumCount} albums`; - } - - return { - title: translate('AlbumCount'), - iconName: icons.CIRCLE, - label: albums, - }; - } - - if (name === 'path') { - return { - title: translate('Path'), - iconName: icons.FOLDER, - label: props.path, - }; - } - - if (name === 'sizeOnDisk') { - return { - title: translate('SizeOnDisk'), - iconName: icons.DRIVE, - label: formatBytes(props.sizeOnDisk), - }; - } - - return null; -} - -function ArtistIndexOverviewInfo(props: ArtistIndexOverviewInfoProps) { - const { height, nextAlbum } = props; - - const uiSettings = useSelector(createUISettingsSelector()); - - const { shortDateFormat, showRelativeDates, longDateFormat, timeFormat } = - uiSettings; - - let shownRows = 1; - const maxRows = Math.floor(height / (infoRowHeight + 4)); - - const rowInfo = useMemo(() => { - return rows.map((row) => { - const { name, showProp, valueProp } = row; - - const isVisible = - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore ts(7053) - props[valueProp] != null && (props[showProp] || props.sortKey === name); - - return { - ...row, - isVisible, - }; - }); - }, [props]); - - return ( -
- {!!nextAlbum?.releaseDate && ( - - )} - - {rowInfo.map((row) => { - if (!row.isVisible) { - return null; - } - - if (shownRows >= maxRows) { - return null; - } - - shownRows++; - - const infoRowProps = getInfoRowProps(row, props, uiSettings); - - if (infoRowProps == null) { - return null; - } - - return ; - })} -
- ); -} - -export default ArtistIndexOverviewInfo; diff --git a/frontend/src/Artist/Index/Overview/ArtistIndexOverviewInfoRow.css b/frontend/src/Artist/Index/Overview/ArtistIndexOverviewInfoRow.css deleted file mode 100644 index 1fcd432a3..000000000 --- a/frontend/src/Artist/Index/Overview/ArtistIndexOverviewInfoRow.css +++ /dev/null @@ -1,10 +0,0 @@ -.infoRow { - flex: 0 0 $artistIndexOverviewInfoRowHeight; - margin: 2px 0; -} - -.icon { - margin-right: 5px; - width: 25px !important; - text-align: center; -} diff --git a/frontend/src/Artist/Index/Overview/ArtistIndexOverviewInfoRow.css.d.ts b/frontend/src/Artist/Index/Overview/ArtistIndexOverviewInfoRow.css.d.ts deleted file mode 100644 index 04f22fc2e..000000000 --- a/frontend/src/Artist/Index/Overview/ArtistIndexOverviewInfoRow.css.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'icon': string; - 'infoRow': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Index/Overview/ArtistIndexOverviewInfoRow.tsx b/frontend/src/Artist/Index/Overview/ArtistIndexOverviewInfoRow.tsx deleted file mode 100644 index 5d9b4a069..000000000 --- a/frontend/src/Artist/Index/Overview/ArtistIndexOverviewInfoRow.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { IconDefinition } from '@fortawesome/free-regular-svg-icons'; -import React from 'react'; -import Icon from 'Components/Icon'; -import styles from './ArtistIndexOverviewInfoRow.css'; - -interface ArtistIndexOverviewInfoRowProps { - title?: string; - iconName?: IconDefinition; - label: string | null; -} - -function ArtistIndexOverviewInfoRow(props: ArtistIndexOverviewInfoRowProps) { - const { title, iconName, label } = props; - - return ( -
- - - {label} -
- ); -} - -export default ArtistIndexOverviewInfoRow; diff --git a/frontend/src/Artist/Index/Overview/ArtistIndexOverviews.css b/frontend/src/Artist/Index/Overview/ArtistIndexOverviews.css deleted file mode 100644 index 9c6520fb5..000000000 --- a/frontend/src/Artist/Index/Overview/ArtistIndexOverviews.css +++ /dev/null @@ -1,3 +0,0 @@ -.grid { - flex: 1 0 auto; -} diff --git a/frontend/src/Artist/Index/Overview/ArtistIndexOverviews.css.d.ts b/frontend/src/Artist/Index/Overview/ArtistIndexOverviews.css.d.ts deleted file mode 100644 index b97436b41..000000000 --- a/frontend/src/Artist/Index/Overview/ArtistIndexOverviews.css.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'grid': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Index/Overview/ArtistIndexOverviews.tsx b/frontend/src/Artist/Index/Overview/ArtistIndexOverviews.tsx deleted file mode 100644 index 11285c1b3..000000000 --- a/frontend/src/Artist/Index/Overview/ArtistIndexOverviews.tsx +++ /dev/null @@ -1,213 +0,0 @@ -import { throttle } from 'lodash'; -import React, { RefObject, useEffect, useMemo, useRef, useState } from 'react'; -import { useSelector } from 'react-redux'; -import { FixedSizeList as List, ListChildComponentProps } from 'react-window'; -import Artist from 'Artist/Artist'; -import useMeasure from 'Helpers/Hooks/useMeasure'; -import dimensions from 'Styles/Variables/dimensions'; -import getIndexOfFirstCharacter from 'Utilities/Array/getIndexOfFirstCharacter'; -import ArtistIndexOverview from './ArtistIndexOverview'; -import selectOverviewOptions from './selectOverviewOptions'; - -// Poster container dimensions -const columnPadding = parseInt(dimensions.artistIndexColumnPadding); -const columnPaddingSmallScreen = parseInt( - dimensions.artistIndexColumnPaddingSmallScreen -); -const progressBarHeight = parseInt(dimensions.progressBarSmallHeight); -const detailedProgressBarHeight = parseInt(dimensions.progressBarMediumHeight); -const bodyPadding = parseInt(dimensions.pageContentBodyPadding); -const bodyPaddingSmallScreen = parseInt( - dimensions.pageContentBodyPaddingSmallScreen -); - -interface RowItemData { - items: Artist[]; - sortKey: string; - posterWidth: number; - posterHeight: number; - rowHeight: number; - isSelectMode: boolean; - isSmallScreen: boolean; -} - -interface ArtistIndexOverviewsProps { - items: Artist[]; - sortKey: string; - sortDirection?: string; - jumpToCharacter?: string; - scrollTop?: number; - scrollerRef: RefObject; - isSelectMode: boolean; - isSmallScreen: boolean; -} - -const Row: React.FC> = ({ - index, - style, - data, -}) => { - const { items, ...otherData } = data; - - if (index >= items.length) { - return null; - } - - const artist = items[index]; - - return ( -
- -
- ); -}; - -function getWindowScrollTopPosition() { - return document.documentElement.scrollTop || document.body.scrollTop || 0; -} - -function ArtistIndexOverviews(props: ArtistIndexOverviewsProps) { - const { - items, - sortKey, - jumpToCharacter, - scrollerRef, - isSelectMode, - isSmallScreen, - } = props; - - const { size: posterSize, detailedProgressBar } = useSelector( - selectOverviewOptions - ); - const listRef = useRef(null); - const [measureRef, bounds] = useMeasure(); - const [size, setSize] = useState({ width: 0, height: 0 }); - - const posterWidth = useMemo(() => { - const maxiumPosterWidth = isSmallScreen ? 192 : 202; - - if (posterSize === 'large') { - return maxiumPosterWidth; - } - - if (posterSize === 'medium') { - return Math.floor(maxiumPosterWidth * 0.75); - } - - return Math.floor(maxiumPosterWidth * 0.5); - }, [posterSize, isSmallScreen]); - - const posterHeight = useMemo(() => { - return posterWidth; - }, [posterWidth]); - - const rowHeight = useMemo(() => { - const heights = [ - posterHeight, - detailedProgressBar ? detailedProgressBarHeight : progressBarHeight, - isSmallScreen ? columnPaddingSmallScreen : columnPadding, - ]; - - return heights.reduce((acc, height) => acc + height, 0); - }, [detailedProgressBar, posterHeight, isSmallScreen]); - - useEffect(() => { - const current = scrollerRef.current as HTMLElement; - - if (isSmallScreen) { - setSize({ - width: window.innerWidth, - height: window.innerHeight, - }); - - return; - } - - if (current) { - const width = current.clientWidth; - const padding = - (isSmallScreen ? bodyPaddingSmallScreen : bodyPadding) - 5; - - setSize({ - width: width - padding * 2, - height: window.innerHeight, - }); - } - }, [isSmallScreen, scrollerRef, bounds]); - - useEffect(() => { - const currentScrollerRef = scrollerRef.current as HTMLElement; - const currentScrollListener = isSmallScreen ? window : currentScrollerRef; - - const handleScroll = throttle(() => { - const { offsetTop = 0 } = currentScrollerRef; - const scrollTop = - (isSmallScreen - ? getWindowScrollTopPosition() - : currentScrollerRef.scrollTop) - offsetTop; - - listRef.current?.scrollTo(scrollTop); - }, 10); - - currentScrollListener.addEventListener('scroll', handleScroll); - - return () => { - handleScroll.cancel(); - - if (currentScrollListener) { - currentScrollListener.removeEventListener('scroll', handleScroll); - } - }; - }, [isSmallScreen, listRef, scrollerRef]); - - useEffect(() => { - if (jumpToCharacter) { - const index = getIndexOfFirstCharacter(items, jumpToCharacter); - - if (index != null) { - let scrollTop = index * rowHeight; - - // If the offset is zero go to the top, otherwise offset - // by the approximate size of the header + padding (37 + 20). - if (scrollTop > 0) { - const offset = 57; - - scrollTop += offset; - } - - listRef.current?.scrollTo(scrollTop); - scrollerRef.current?.scrollTo(0, scrollTop); - } - } - }, [jumpToCharacter, rowHeight, items, scrollerRef, listRef]); - - return ( -
- - ref={listRef} - style={{ - width: '100%', - height: '100%', - overflow: 'none', - }} - width={size.width} - height={size.height} - itemCount={items.length} - itemSize={rowHeight} - itemData={{ - items, - sortKey, - posterWidth, - posterHeight, - rowHeight, - isSelectMode, - isSmallScreen, - }} - > - {Row} - -
- ); -} - -export default ArtistIndexOverviews; diff --git a/frontend/src/Artist/Index/Overview/Options/ArtistIndexOverviewOptionsModal.tsx b/frontend/src/Artist/Index/Overview/Options/ArtistIndexOverviewOptionsModal.tsx deleted file mode 100644 index bc999cee4..000000000 --- a/frontend/src/Artist/Index/Overview/Options/ArtistIndexOverviewOptionsModal.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import React from 'react'; -import Modal from 'Components/Modal/Modal'; -import ArtistIndexOverviewOptionsModalContent from './ArtistIndexOverviewOptionsModalContent'; - -interface ArtistIndexOverviewOptionsModalProps { - isOpen: boolean; - onModalClose(...args: unknown[]): void; -} - -function ArtistIndexOverviewOptionsModal({ - isOpen, - onModalClose, - ...otherProps -}: ArtistIndexOverviewOptionsModalProps) { - return ( - - - - ); -} - -export default ArtistIndexOverviewOptionsModal; diff --git a/frontend/src/Artist/Index/Overview/Options/ArtistIndexOverviewOptionsModalContent.tsx b/frontend/src/Artist/Index/Overview/Options/ArtistIndexOverviewOptionsModalContent.tsx deleted file mode 100644 index 4ab9391e3..000000000 --- a/frontend/src/Artist/Index/Overview/Options/ArtistIndexOverviewOptionsModalContent.tsx +++ /dev/null @@ -1,197 +0,0 @@ -import React, { useCallback } from 'react'; -import { useDispatch, useSelector } from 'react-redux'; -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 { setArtistOverviewOption } from 'Store/Actions/artistIndexActions'; -import translate from 'Utilities/String/translate'; -import selectOverviewOptions from '../selectOverviewOptions'; - -const posterSizeOptions = [ - { - key: 'small', - get value() { - return translate('Small'); - }, - }, - { - key: 'medium', - get value() { - return translate('Medium'); - }, - }, - { - key: 'large', - get value() { - return translate('Large'); - }, - }, -]; - -interface ArtistIndexOverviewOptionsModalContentProps { - onModalClose(...args: unknown[]): void; -} - -function ArtistIndexOverviewOptionsModalContent( - props: ArtistIndexOverviewOptionsModalContentProps -) { - const { onModalClose } = props; - - const { - detailedProgressBar, - size, - showMonitored, - showQualityProfile, - showLastAlbum, - showAdded, - showAlbumCount, - showPath, - showSizeOnDisk, - showSearchAction, - } = useSelector(selectOverviewOptions); - - const dispatch = useDispatch(); - - const onOverviewOptionChange = useCallback( - ({ name, value }: { name: string; value: unknown }) => { - dispatch(setArtistOverviewOption({ [name]: value })); - }, - [dispatch] - ); - - return ( - - {translate('OverviewOptions')} - - -
- - {translate('PosterSize')} - - - - - - {translate('DetailedProgressBar')} - - - - - - {translate('ShowMonitored')} - - - - - - {translate('ShowQualityProfile')} - - - - - - {translate('ShowLastAlbum')} - - - - - - {translate('ShowDateAdded')} - - - - - - {translate('ShowAlbumCount')} - - - - - - {translate('ShowPath')} - - - - - - {translate('ShowSizeOnDisk')} - - - - - - {translate('ShowSearch')} - - - -
-
- - - - -
- ); -} - -export default ArtistIndexOverviewOptionsModalContent; diff --git a/frontend/src/Artist/Index/Overview/selectOverviewOptions.ts b/frontend/src/Artist/Index/Overview/selectOverviewOptions.ts deleted file mode 100644 index 5875163c8..000000000 --- a/frontend/src/Artist/Index/Overview/selectOverviewOptions.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { createSelector } from 'reselect'; -import AppState from 'App/State/AppState'; - -const selectOverviewOptions = createSelector( - (state: AppState) => state.artistIndex.overviewOptions, - (overviewOptions) => overviewOptions -); - -export default selectOverviewOptions; diff --git a/frontend/src/Artist/Index/Posters/ArtistIndexPoster.css b/frontend/src/Artist/Index/Posters/ArtistIndexPoster.css deleted file mode 100644 index aaccec8a8..000000000 --- a/frontend/src/Artist/Index/Posters/ArtistIndexPoster.css +++ /dev/null @@ -1,98 +0,0 @@ -$hoverScale: 1.05; - -.content { - transition: all 200ms ease-in; - - &:hover { - z-index: 2; - box-shadow: 0 0 12px var(--black); - transition: all 200ms ease-in; - - .controls { - opacity: 0.9; - transition: opacity 200ms linear 150ms; - } - } -} - -.posterContainer { - position: relative; -} - -.link { - composes: link from '~Components/Link/Link.css'; - - position: relative; - display: block; - height: 70px; - background-color: var(--defaultColor); -} - -.overlayTitle { - position: absolute; - top: 0; - left: 0; - display: flex; - align-items: center; - justify-content: center; - padding: 5px; - width: 100%; - height: 100%; - color: var(--offWhite); - text-align: center; - font-size: 20px; -} - -.nextAlbum { - background-color: var(--artistBackgroundColor); - text-align: center; - font-size: $smallFontSize; -} - -.title { - @add-mixin truncate; - - background-color: var(--artistBackgroundColor); - text-align: center; - font-size: $smallFontSize; -} - -.ended { - position: absolute; - top: 0; - right: 0; - z-index: 1; - width: 0; - height: 0; - border-width: 0 25px 25px 0; - border-style: solid; - border-color: transparent var(--dangerColor) transparent transparent; - color: var(--white); -} - -.controls { - position: absolute; - bottom: 10px; - left: 10px; - z-index: 3; - border-radius: 4px; - background-color: #216044; - color: var(--white); - font-size: $smallFontSize; - opacity: 0; - transition: opacity 0; -} - -.action { - composes: button from '~Components/Link/IconButton.css'; - - &:hover { - color: #ccc; - } -} - -@media only screen and (max-width: $breakpointSmall) { - .container { - padding: 5px; - } -} diff --git a/frontend/src/Artist/Index/Posters/ArtistIndexPoster.css.d.ts b/frontend/src/Artist/Index/Posters/ArtistIndexPoster.css.d.ts deleted file mode 100644 index b1eeccf08..000000000 --- a/frontend/src/Artist/Index/Posters/ArtistIndexPoster.css.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'action': string; - 'container': string; - 'content': string; - 'controls': string; - 'ended': string; - 'link': string; - 'nextAlbum': string; - 'overlayTitle': string; - 'posterContainer': string; - 'title': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Index/Posters/ArtistIndexPoster.tsx b/frontend/src/Artist/Index/Posters/ArtistIndexPoster.tsx deleted file mode 100644 index 67c37c00d..000000000 --- a/frontend/src/Artist/Index/Posters/ArtistIndexPoster.tsx +++ /dev/null @@ -1,263 +0,0 @@ -import React, { useCallback, useState } from 'react'; -import { useDispatch, useSelector } from 'react-redux'; -import { Statistics } from 'Artist/Artist'; -import ArtistPoster from 'Artist/ArtistPoster'; -import DeleteArtistModal from 'Artist/Delete/DeleteArtistModal'; -import EditArtistModalConnector from 'Artist/Edit/EditArtistModalConnector'; -import createArtistIndexItemSelector from 'Artist/Index/createArtistIndexItemSelector'; -import ArtistIndexPosterInfo from 'Artist/Index/Posters/ArtistIndexPosterInfo'; -import ArtistIndexProgressBar from 'Artist/Index/ProgressBar/ArtistIndexProgressBar'; -import ArtistIndexPosterSelect from 'Artist/Index/Select/ArtistIndexPosterSelect'; -import { ARTIST_SEARCH, REFRESH_ARTIST } from 'Commands/commandNames'; -import Label from 'Components/Label'; -import IconButton from 'Components/Link/IconButton'; -import Link from 'Components/Link/Link'; -import SpinnerIconButton from 'Components/Link/SpinnerIconButton'; -import { icons } from 'Helpers/Props'; -import { executeCommand } from 'Store/Actions/commandActions'; -import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector'; -import getRelativeDate from 'Utilities/Date/getRelativeDate'; -import translate from 'Utilities/String/translate'; -import selectPosterOptions from './selectPosterOptions'; -import styles from './ArtistIndexPoster.css'; - -interface ArtistIndexPosterProps { - artistId: number; - sortKey: string; - isSelectMode: boolean; - posterWidth: number; - posterHeight: number; -} - -function ArtistIndexPoster(props: ArtistIndexPosterProps) { - const { artistId, sortKey, isSelectMode, posterWidth, posterHeight } = props; - - const { - artist, - qualityProfile, - metadataProfile, - isRefreshingArtist, - isSearchingArtist, - } = useSelector(createArtistIndexItemSelector(props.artistId)); - - const { - detailedProgressBar, - showTitle, - showMonitored, - showQualityProfile, - showNextAlbum, - showSearchAction, - } = useSelector(selectPosterOptions); - - const { showRelativeDates, shortDateFormat, longDateFormat, timeFormat } = - useSelector(createUISettingsSelector()); - - const { - artistName, - artistType, - monitored, - status, - path, - foreignArtistId, - nextAlbum, - added, - statistics = {} as Statistics, - images, - tags, - } = artist; - - const { - albumCount = 0, - trackCount = 0, - trackFileCount = 0, - totalTrackCount = 0, - sizeOnDisk = 0, - } = statistics; - - const dispatch = useDispatch(); - const [hasPosterError, setHasPosterError] = useState(false); - const [isEditArtistModalOpen, setIsEditArtistModalOpen] = useState(false); - const [isDeleteArtistModalOpen, setIsDeleteArtistModalOpen] = useState(false); - - const onRefreshPress = useCallback(() => { - dispatch( - executeCommand({ - name: REFRESH_ARTIST, - artistId, - }) - ); - }, [artistId, dispatch]); - - const onSearchPress = useCallback(() => { - dispatch( - executeCommand({ - name: ARTIST_SEARCH, - artistId, - }) - ); - }, [artistId, dispatch]); - - const onPosterLoadError = useCallback(() => { - setHasPosterError(true); - }, [setHasPosterError]); - - const onPosterLoad = useCallback(() => { - setHasPosterError(false); - }, [setHasPosterError]); - - const onEditArtistPress = useCallback(() => { - setIsEditArtistModalOpen(true); - }, [setIsEditArtistModalOpen]); - - const onEditArtistModalClose = useCallback(() => { - setIsEditArtistModalOpen(false); - }, [setIsEditArtistModalOpen]); - - const onDeleteArtistPress = useCallback(() => { - setIsEditArtistModalOpen(false); - setIsDeleteArtistModalOpen(true); - }, [setIsDeleteArtistModalOpen]); - - const onDeleteArtistModalClose = useCallback(() => { - setIsDeleteArtistModalOpen(false); - }, [setIsDeleteArtistModalOpen]); - - const link = `/artist/${foreignArtistId}`; - - const elementStyle = { - width: `${posterWidth}px`, - height: `${posterHeight}px`, - }; - - return ( -
-
- {isSelectMode ? : null} - - - - {status === 'ended' ? ( -
- ) : null} - - - - - {hasPosterError ? ( -
{artistName}
- ) : null} - -
- - - - {showTitle ? ( -
- {artistName} -
- ) : null} - - {showMonitored ? ( -
- {monitored ? translate('Monitored') : translate('Unmonitored')} -
- ) : null} - - {showQualityProfile && !!qualityProfile?.name ? ( -
- {qualityProfile.name} -
- ) : null} - - {showNextAlbum && !!nextAlbum?.releaseDate ? ( -
- {getRelativeDate( - nextAlbum.releaseDate, - shortDateFormat, - showRelativeDates, - { - timeFormat, - timeForToday: true, - } - )} -
- ) : null} - - - - - - -
- ); -} - -export default ArtistIndexPoster; diff --git a/frontend/src/Artist/Index/Posters/ArtistIndexPosterInfo.css b/frontend/src/Artist/Index/Posters/ArtistIndexPosterInfo.css deleted file mode 100644 index 22ed2d528..000000000 --- a/frontend/src/Artist/Index/Posters/ArtistIndexPosterInfo.css +++ /dev/null @@ -1,5 +0,0 @@ -.info { - background-color: var(--artistBackgroundColor); - text-align: center; - font-size: $smallFontSize; -} diff --git a/frontend/src/Artist/Index/Posters/ArtistIndexPosterInfo.css.d.ts b/frontend/src/Artist/Index/Posters/ArtistIndexPosterInfo.css.d.ts deleted file mode 100644 index 062365d36..000000000 --- a/frontend/src/Artist/Index/Posters/ArtistIndexPosterInfo.css.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'info': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Index/Posters/ArtistIndexPosterInfo.tsx b/frontend/src/Artist/Index/Posters/ArtistIndexPosterInfo.tsx deleted file mode 100644 index 0d4ff9135..000000000 --- a/frontend/src/Artist/Index/Posters/ArtistIndexPosterInfo.tsx +++ /dev/null @@ -1,187 +0,0 @@ -import React from 'react'; -import Album from 'Album/Album'; -import TagListConnector from 'Components/TagListConnector'; -import MetadataProfile from 'typings/MetadataProfile'; -import QualityProfile from 'typings/QualityProfile'; -import formatDateTime from 'Utilities/Date/formatDateTime'; -import getRelativeDate from 'Utilities/Date/getRelativeDate'; -import formatBytes from 'Utilities/Number/formatBytes'; -import translate from 'Utilities/String/translate'; -import styles from './ArtistIndexPosterInfo.css'; - -interface ArtistIndexPosterInfoProps { - artistType?: string; - showQualityProfile: boolean; - qualityProfile?: QualityProfile; - metadataProfile?: MetadataProfile; - showNextAlbum: boolean; - nextAlbum?: Album; - lastAlbum?: Album; - added?: string; - albumCount: number; - path: string; - sizeOnDisk?: number; - tags?: number[]; - sortKey: string; - showRelativeDates: boolean; - shortDateFormat: string; - longDateFormat: string; - timeFormat: string; -} - -function ArtistIndexPosterInfo(props: ArtistIndexPosterInfoProps) { - const { - artistType, - qualityProfile, - metadataProfile, - showQualityProfile, - showNextAlbum, - nextAlbum, - lastAlbum, - added, - albumCount, - path, - sizeOnDisk, - tags, - sortKey, - showRelativeDates, - shortDateFormat, - longDateFormat, - timeFormat, - } = props; - - if (sortKey === 'artistType' && artistType) { - return ( -
- {artistType} -
- ); - } - - if ( - sortKey === 'qualityProfileId' && - !showQualityProfile && - !!qualityProfile?.name - ) { - return ( -
- {qualityProfile.name} -
- ); - } - - if (sortKey === 'metadataProfileId' && !!metadataProfile?.name) { - return ( -
- {metadataProfile.name} -
- ); - } - - if (sortKey === 'nextAlbum' && !showNextAlbum && !!nextAlbum?.releaseDate) { - return ( -
- {getRelativeDate( - nextAlbum.releaseDate, - shortDateFormat, - showRelativeDates, - { - timeFormat, - timeForToday: true, - } - )} -
- ); - } - - if (sortKey === 'lastAlbum' && !!lastAlbum?.releaseDate) { - return ( -
- {getRelativeDate( - lastAlbum.releaseDate, - shortDateFormat, - showRelativeDates, - { - timeFormat, - timeForToday: true, - } - )} -
- ); - } - - if (sortKey === 'added' && added) { - const addedDate = getRelativeDate( - added, - shortDateFormat, - showRelativeDates, - { - timeFormat, - timeForToday: false, - } - ); - - return ( -
- {translate('Added')}: {addedDate} -
- ); - } - - if (sortKey === 'albumCount') { - let albums = translate('OneAlbum'); - - if (albumCount === 0) { - albums = translate('NoAlbums'); - } else if (albumCount > 1) { - albums = translate('CountAlbums', { albumCount }); - } - - return
{albums}
; - } - - if (sortKey === 'path') { - return ( -
- {path} -
- ); - } - - if (sortKey === 'sizeOnDisk') { - return ( -
- {formatBytes(sizeOnDisk)} -
- ); - } - - if (sortKey === 'tags' && tags) { - return ( -
- -
- ); - } - - return null; -} - -export default ArtistIndexPosterInfo; diff --git a/frontend/src/Artist/Index/Posters/ArtistIndexPosters.css b/frontend/src/Artist/Index/Posters/ArtistIndexPosters.css deleted file mode 100644 index 9c6520fb5..000000000 --- a/frontend/src/Artist/Index/Posters/ArtistIndexPosters.css +++ /dev/null @@ -1,3 +0,0 @@ -.grid { - flex: 1 0 auto; -} diff --git a/frontend/src/Artist/Index/Posters/ArtistIndexPosters.css.d.ts b/frontend/src/Artist/Index/Posters/ArtistIndexPosters.css.d.ts deleted file mode 100644 index b97436b41..000000000 --- a/frontend/src/Artist/Index/Posters/ArtistIndexPosters.css.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'grid': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Index/Posters/ArtistIndexPosters.tsx b/frontend/src/Artist/Index/Posters/ArtistIndexPosters.tsx deleted file mode 100644 index c478ac1ae..000000000 --- a/frontend/src/Artist/Index/Posters/ArtistIndexPosters.tsx +++ /dev/null @@ -1,313 +0,0 @@ -import { throttle } from 'lodash'; -import React, { RefObject, useEffect, useMemo, useRef, useState } from 'react'; -import { useSelector } from 'react-redux'; -import { FixedSizeGrid as Grid, GridChildComponentProps } from 'react-window'; -import { createSelector } from 'reselect'; -import AppState from 'App/State/AppState'; -import Artist from 'Artist/Artist'; -import ArtistIndexPoster from 'Artist/Index/Posters/ArtistIndexPoster'; -import useMeasure from 'Helpers/Hooks/useMeasure'; -import SortDirection from 'Helpers/Props/SortDirection'; -import dimensions from 'Styles/Variables/dimensions'; -import getIndexOfFirstCharacter from 'Utilities/Array/getIndexOfFirstCharacter'; - -const bodyPadding = parseInt(dimensions.pageContentBodyPadding); -const bodyPaddingSmallScreen = parseInt( - dimensions.pageContentBodyPaddingSmallScreen -); -const columnPadding = parseInt(dimensions.artistIndexColumnPadding); -const columnPaddingSmallScreen = parseInt( - dimensions.artistIndexColumnPaddingSmallScreen -); -const progressBarHeight = parseInt(dimensions.progressBarSmallHeight); -const detailedProgressBarHeight = parseInt(dimensions.progressBarMediumHeight); - -const ADDITIONAL_COLUMN_COUNT: Record = { - small: 3, - medium: 2, - large: 1, -}; - -interface CellItemData { - layout: { - columnCount: number; - padding: number; - posterWidth: number; - posterHeight: number; - }; - items: Artist[]; - sortKey: string; - isSelectMode: boolean; -} - -interface ArtistIndexPostersProps { - items: Artist[]; - sortKey: string; - sortDirection?: SortDirection; - jumpToCharacter?: string; - scrollTop?: number; - scrollerRef: RefObject; - isSelectMode: boolean; - isSmallScreen: boolean; -} - -const artistIndexSelector = createSelector( - (state: AppState) => state.artistIndex.posterOptions, - (posterOptions) => { - return { - posterOptions, - }; - } -); - -const Cell: React.FC> = ({ - columnIndex, - rowIndex, - style, - data, -}) => { - const { layout, items, sortKey, isSelectMode } = data; - const { columnCount, padding, posterWidth, posterHeight } = layout; - const index = rowIndex * columnCount + columnIndex; - - if (index >= items.length) { - return null; - } - - const artist = items[index]; - - return ( -
- -
- ); -}; - -function getWindowScrollTopPosition() { - return document.documentElement.scrollTop || document.body.scrollTop || 0; -} - -export default function ArtistIndexPosters(props: ArtistIndexPostersProps) { - const { - scrollerRef, - items, - sortKey, - jumpToCharacter, - isSelectMode, - isSmallScreen, - } = props; - - const { posterOptions } = useSelector(artistIndexSelector); - const ref = useRef(null); - const [measureRef, bounds] = useMeasure(); - const [size, setSize] = useState({ width: 0, height: 0 }); - - const columnWidth = useMemo(() => { - const { width } = size; - const maximumColumnWidth = isSmallScreen ? 172 : 182; - const columns = Math.floor(width / maximumColumnWidth); - const remainder = width % maximumColumnWidth; - return remainder === 0 - ? maximumColumnWidth - : Math.floor( - width / (columns + ADDITIONAL_COLUMN_COUNT[posterOptions.size]) - ); - }, [isSmallScreen, posterOptions, size]); - - const columnCount = useMemo( - () => Math.max(Math.floor(size.width / columnWidth), 1), - [size, columnWidth] - ); - const padding = props.isSmallScreen - ? columnPaddingSmallScreen - : columnPadding; - const posterWidth = columnWidth - padding * 2; - const posterHeight = Math.ceil(posterWidth); - - const rowHeight = useMemo(() => { - const { - detailedProgressBar, - showTitle, - showMonitored, - showQualityProfile, - showNextAlbum, - } = posterOptions; - - const nextAiringHeight = 19; - - const heights = [ - posterHeight, - detailedProgressBar ? detailedProgressBarHeight : progressBarHeight, - nextAiringHeight, - isSmallScreen ? columnPaddingSmallScreen : columnPadding, - ]; - - if (showTitle) { - heights.push(19); - } - - if (showMonitored) { - heights.push(19); - } - - if (showQualityProfile) { - heights.push(19); - } - - if (showNextAlbum) { - heights.push(19); - } - - switch (sortKey) { - case 'artistType': - case 'metadataProfileId': - case 'lastAlbum': - case 'added': - case 'albumCount': - case 'path': - case 'sizeOnDisk': - case 'tags': - heights.push(19); - break; - case 'qualityProfileId': - if (!showQualityProfile) { - heights.push(19); - } - break; - case 'nextAlbum': - if (!showNextAlbum) { - heights.push(19); - } - break; - default: - // No need to add a height of 0 - } - - return heights.reduce((acc, height) => acc + height, 0); - }, [isSmallScreen, posterOptions, sortKey, posterHeight]); - - useEffect(() => { - const current = scrollerRef.current; - - if (isSmallScreen) { - const padding = bodyPaddingSmallScreen - 5; - const width = window.innerWidth - padding * 2; - const height = window.innerHeight; - - if (width !== size.width || height !== size.height) { - setSize({ - width, - height, - }); - } - - return; - } - - if (current) { - const width = current.clientWidth; - const padding = bodyPadding - 5; - const finalWidth = width - padding * 2; - - if (Math.abs(size.width - finalWidth) < 20 || size.width === finalWidth) { - return; - } - - setSize({ - width: finalWidth, - height: window.innerHeight, - }); - } - }, [isSmallScreen, size, scrollerRef, bounds]); - - useEffect(() => { - const currentScrollerRef = scrollerRef.current as HTMLElement; - const currentScrollListener = isSmallScreen ? window : currentScrollerRef; - - const handleScroll = throttle(() => { - const { offsetTop = 0 } = currentScrollerRef; - const scrollTop = - (isSmallScreen - ? getWindowScrollTopPosition() - : currentScrollerRef.scrollTop) - offsetTop; - - ref.current?.scrollTo({ scrollLeft: 0, scrollTop }); - }, 10); - - currentScrollListener.addEventListener('scroll', handleScroll); - - return () => { - handleScroll.cancel(); - - if (currentScrollListener) { - currentScrollListener.removeEventListener('scroll', handleScroll); - } - }; - }, [isSmallScreen, ref, scrollerRef]); - - useEffect(() => { - if (jumpToCharacter) { - const index = getIndexOfFirstCharacter(items, jumpToCharacter); - - if (index != null) { - const rowIndex = Math.floor(index / columnCount); - - const scrollTop = rowIndex * rowHeight + padding; - - ref.current?.scrollTo({ scrollLeft: 0, scrollTop }); - scrollerRef.current?.scrollTo(0, scrollTop); - } - } - }, [ - jumpToCharacter, - rowHeight, - columnCount, - padding, - items, - scrollerRef, - ref, - ]); - - return ( -
- - ref={ref} - style={{ - width: '100%', - height: '100%', - overflow: 'none', - }} - width={size.width} - height={size.height} - columnCount={columnCount} - columnWidth={columnWidth} - rowCount={Math.ceil(items.length / columnCount)} - rowHeight={rowHeight} - itemData={{ - layout: { - columnCount, - padding, - posterWidth, - posterHeight, - }, - items, - sortKey, - isSelectMode, - }} - > - {Cell} - -
- ); -} diff --git a/frontend/src/Artist/Index/Posters/Options/ArtistIndexPosterOptionsModal.tsx b/frontend/src/Artist/Index/Posters/Options/ArtistIndexPosterOptionsModal.tsx deleted file mode 100644 index 69368807a..000000000 --- a/frontend/src/Artist/Index/Posters/Options/ArtistIndexPosterOptionsModal.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import React from 'react'; -import Modal from 'Components/Modal/Modal'; -import ArtistIndexPosterOptionsModalContent from './ArtistIndexPosterOptionsModalContent'; - -interface ArtistIndexPosterOptionsModalProps { - isOpen: boolean; - onModalClose(...args: unknown[]): unknown; -} - -function ArtistIndexPosterOptionsModal({ - isOpen, - onModalClose, -}: ArtistIndexPosterOptionsModalProps) { - return ( - - - - ); -} - -export default ArtistIndexPosterOptionsModal; diff --git a/frontend/src/Artist/Index/Posters/Options/ArtistIndexPosterOptionsModalContent.tsx b/frontend/src/Artist/Index/Posters/Options/ArtistIndexPosterOptionsModalContent.tsx deleted file mode 100644 index 2560d855a..000000000 --- a/frontend/src/Artist/Index/Posters/Options/ArtistIndexPosterOptionsModalContent.tsx +++ /dev/null @@ -1,167 +0,0 @@ -import React, { useCallback } from 'react'; -import { useDispatch, useSelector } from 'react-redux'; -import selectPosterOptions from 'Artist/Index/Posters/selectPosterOptions'; -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 { setArtistPosterOption } from 'Store/Actions/artistIndexActions'; -import translate from 'Utilities/String/translate'; - -const posterSizeOptions = [ - { - key: 'small', - get value() { - return translate('Small'); - }, - }, - { - key: 'medium', - get value() { - return translate('Medium'); - }, - }, - { - key: 'large', - get value() { - return translate('Large'); - }, - }, -]; - -interface ArtistIndexPosterOptionsModalContentProps { - onModalClose(...args: unknown[]): unknown; -} - -function ArtistIndexPosterOptionsModalContent( - props: ArtistIndexPosterOptionsModalContentProps -) { - const { onModalClose } = props; - - const posterOptions = useSelector(selectPosterOptions); - - const { - detailedProgressBar, - size, - showTitle, - showMonitored, - showQualityProfile, - showNextAlbum, - showSearchAction, - } = posterOptions; - - const dispatch = useDispatch(); - - const onPosterOptionChange = useCallback( - ({ name, value }: { name: string; value: unknown }) => { - dispatch(setArtistPosterOption({ [name]: value })); - }, - [dispatch] - ); - - return ( - - {translate('PosterOptions')} - - -
- - {translate('PosterSize')} - - - - - - {translate('DetailedProgressBar')} - - - - - - {translate('ShowName')} - - - - - - {translate('ShowMonitored')} - - - - - - {translate('ShowQualityProfile')} - - - - - - {translate('ShowNextAlbum')} - - - - - - {translate('ShowSearch')} - - - -
-
- - - - -
- ); -} - -export default ArtistIndexPosterOptionsModalContent; diff --git a/frontend/src/Artist/Index/Posters/selectPosterOptions.ts b/frontend/src/Artist/Index/Posters/selectPosterOptions.ts deleted file mode 100644 index 1a53a0add..000000000 --- a/frontend/src/Artist/Index/Posters/selectPosterOptions.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { createSelector } from 'reselect'; -import AppState from 'App/State/AppState'; - -const selectPosterOptions = createSelector( - (state: AppState) => state.artistIndex.posterOptions, - (posterOptions) => posterOptions -); - -export default selectPosterOptions; diff --git a/frontend/src/Artist/Index/ProgressBar/ArtistIndexProgressBar.css b/frontend/src/Artist/Index/ProgressBar/ArtistIndexProgressBar.css deleted file mode 100644 index 9b5777117..000000000 --- a/frontend/src/Artist/Index/ProgressBar/ArtistIndexProgressBar.css +++ /dev/null @@ -1,13 +0,0 @@ -.progress { - composes: container from '~Components/ProgressBar.css'; - - border-radius: 0; - background-color: #5b5b5b; - color: var(--white); -} - -.progressBar { - composes: progressBar from '~Components/ProgressBar.css'; - - transition: width 200ms ease; -} diff --git a/frontend/src/Artist/Index/ProgressBar/ArtistIndexProgressBar.css.d.ts b/frontend/src/Artist/Index/ProgressBar/ArtistIndexProgressBar.css.d.ts deleted file mode 100644 index dab280261..000000000 --- a/frontend/src/Artist/Index/ProgressBar/ArtistIndexProgressBar.css.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'progress': string; - 'progressBar': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Index/ProgressBar/ArtistIndexProgressBar.tsx b/frontend/src/Artist/Index/ProgressBar/ArtistIndexProgressBar.tsx deleted file mode 100644 index 2a8167b99..000000000 --- a/frontend/src/Artist/Index/ProgressBar/ArtistIndexProgressBar.tsx +++ /dev/null @@ -1,72 +0,0 @@ -import React from 'react'; -import { useSelector } from 'react-redux'; -import createArtistQueueItemsDetailsSelector, { - ArtistQueueDetails, -} from 'Artist/Index/createArtistQueueDetailsSelector'; -import ProgressBar from 'Components/ProgressBar'; -import { sizes } from 'Helpers/Props'; -import getProgressBarKind from 'Utilities/Artist/getProgressBarKind'; -import translate from 'Utilities/String/translate'; -import styles from './ArtistIndexProgressBar.css'; - -interface ArtistIndexProgressBarProps { - artistId: number; - monitored: boolean; - status: string; - trackCount: number; - trackFileCount: number; - totalTrackCount: number; - width: number; - detailedProgressBar: boolean; - isStandalone: boolean; -} - -function ArtistIndexProgressBar(props: ArtistIndexProgressBarProps) { - const { - artistId, - monitored, - status, - trackCount, - trackFileCount, - totalTrackCount, - width, - detailedProgressBar, - isStandalone, - } = props; - - const queueDetails: ArtistQueueDetails = useSelector( - createArtistQueueItemsDetailsSelector(artistId) - ); - - const newDownloads = queueDetails.count - queueDetails.tracksWithFiles; - const progress = trackCount ? (trackFileCount / trackCount) * 100 : 100; - const text = newDownloads - ? `${trackFileCount} + ${newDownloads} / ${trackCount}` - : `${trackFileCount} / ${trackCount}`; - - return ( - 0 - )} - size={detailedProgressBar ? sizes.MEDIUM : sizes.SMALL} - showText={detailedProgressBar} - text={text} - title={translate('ArtistProgressBarText', { - trackFileCount, - trackCount, - totalTrackCount, - downloadingCount: queueDetails.count, - })} - width={width} - /> - ); -} - -export default ArtistIndexProgressBar; diff --git a/frontend/src/Artist/Index/Select/AlbumStudio/AlbumDetails.css b/frontend/src/Artist/Index/Select/AlbumStudio/AlbumDetails.css deleted file mode 100644 index 5f6ee37c1..000000000 --- a/frontend/src/Artist/Index/Select/AlbumStudio/AlbumDetails.css +++ /dev/null @@ -1,10 +0,0 @@ -.albums { - display: flex; - flex-wrap: wrap; -} - -.truncated { - align-self: center; - flex: 0 0 100%; - padding: 4px 6px; -} diff --git a/frontend/src/Artist/Index/Select/AlbumStudio/AlbumDetails.css.d.ts b/frontend/src/Artist/Index/Select/AlbumStudio/AlbumDetails.css.d.ts deleted file mode 100644 index 13c576f2c..000000000 --- a/frontend/src/Artist/Index/Select/AlbumStudio/AlbumDetails.css.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'albums': string; - 'truncated': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Index/Select/AlbumStudio/AlbumDetails.tsx b/frontend/src/Artist/Index/Select/AlbumStudio/AlbumDetails.tsx deleted file mode 100644 index 255bd9ba4..000000000 --- a/frontend/src/Artist/Index/Select/AlbumStudio/AlbumDetails.tsx +++ /dev/null @@ -1,89 +0,0 @@ -import _ from 'lodash'; -import React, { useEffect, useMemo } from 'react'; -import { useDispatch, useSelector } from 'react-redux'; -import { Statistics } from 'Album/Album'; -import Alert from 'Components/Alert'; -import LoadingIndicator from 'Components/Loading/LoadingIndicator'; -import { kinds } from 'Helpers/Props'; -import { clearAlbums, fetchAlbums } from 'Store/Actions/albumActions'; -import createArtistAlbumsSelector from 'Store/Selectors/createArtistAlbumsSelector'; -import translate from 'Utilities/String/translate'; -import AlbumStudioAlbum from './AlbumStudioAlbum'; -import styles from './AlbumDetails.css'; - -interface AlbumDetailsProps { - artistId: number; -} - -function AlbumDetails(props: AlbumDetailsProps) { - const { artistId } = props; - - const { - isFetching, - isPopulated, - error, - items: albums, - } = useSelector(createArtistAlbumsSelector(artistId)); - - const dispatch = useDispatch(); - - useEffect(() => { - dispatch(fetchAlbums({ artistId })); - - return () => { - dispatch(clearAlbums()); - }; - }, [dispatch, artistId]); - - const latestAlbums = useMemo(() => { - const sortedAlbums = _.orderBy(albums, 'releaseDate', 'desc'); - - return sortedAlbums.slice(0, 20); - }, [albums]); - - return ( -
- {isFetching ? : null} - - {!isFetching && error ? ( - {translate('AlbumsLoadError')} - ) : null} - - {isPopulated && !error - ? latestAlbums.map((album) => { - const { - id: albumId, - title, - disambiguation, - albumType, - monitored, - statistics = {} as Statistics, - isSaving = false, - } = album; - - return ( - - ); - }) - : null} - - {latestAlbums.length < albums.length ? ( -
- {translate('AlbumStudioTruncated')} -
- ) : null} -
- ); -} - -export default AlbumDetails; diff --git a/frontend/src/Artist/Index/Select/AlbumStudio/AlbumStudioAlbum.css b/frontend/src/Artist/Index/Select/AlbumStudio/AlbumStudioAlbum.css deleted file mode 100644 index c568a2489..000000000 --- a/frontend/src/Artist/Index/Select/AlbumStudio/AlbumStudioAlbum.css +++ /dev/null @@ -1,39 +0,0 @@ -.album { - display: flex; - align-items: stretch; - overflow: hidden; - margin: 2px 4px; - border: 1px solid var(--borderColor); - border-radius: 4px; - background-color: var(--albumBackgroundColor); - cursor: default; -} - -.info { - padding: 0 4px; -} - -.albumType { - padding: 0 4px; - border-width: 0 1px; - border-style: solid; - border-color: var(--borderColor); - background-color: var(--albumBackgroundColor); - color: var(--defaultColor); -} - -.tracks { - padding: 0 4px; - background-color: var(--trackBackgroundColor); - color: var(--defaultColor); -} - -.allTracks { - background-color: color(#27c24c saturation(-25%)); - color: var(--white); -} - -.missingWanted { - background-color: color(#f05050 saturation(-20%)); - color: var(--white); -} diff --git a/frontend/src/Artist/Index/Select/AlbumStudio/AlbumStudioAlbum.css.d.ts b/frontend/src/Artist/Index/Select/AlbumStudio/AlbumStudioAlbum.css.d.ts deleted file mode 100644 index 31142374e..000000000 --- a/frontend/src/Artist/Index/Select/AlbumStudio/AlbumStudioAlbum.css.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'album': string; - 'albumType': string; - 'allTracks': string; - 'info': string; - 'missingWanted': string; - 'tracks': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Index/Select/AlbumStudio/AlbumStudioAlbum.tsx b/frontend/src/Artist/Index/Select/AlbumStudio/AlbumStudioAlbum.tsx deleted file mode 100644 index 3e7e0578f..000000000 --- a/frontend/src/Artist/Index/Select/AlbumStudio/AlbumStudioAlbum.tsx +++ /dev/null @@ -1,87 +0,0 @@ -import classNames from 'classnames'; -import React, { useCallback } from 'react'; -import { useDispatch } from 'react-redux'; -import { Statistics } from 'Album/Album'; -import MonitorToggleButton from 'Components/MonitorToggleButton'; -import { toggleAlbumsMonitored } from 'Store/Actions/albumActions'; -import translate from 'Utilities/String/translate'; -import styles from './AlbumStudioAlbum.css'; - -interface AlbumStudioAlbumProps { - artistId: number; - albumId: number; - title: string; - disambiguation?: string; - albumType: string; - monitored: boolean; - statistics: Statistics; - isSaving: boolean; -} - -function AlbumStudioAlbum(props: AlbumStudioAlbumProps) { - const { - albumId, - title, - disambiguation, - albumType, - monitored, - statistics = { - trackFileCount: 0, - totalTrackCount: 0, - percentOfTracks: 0, - }, - isSaving = false, - } = props; - - const { - trackFileCount = 0, - totalTrackCount = 0, - percentOfTracks = 0, - } = statistics; - - const dispatch = useDispatch(); - const onAlbumMonitoredPress = useCallback(() => { - dispatch( - toggleAlbumsMonitored({ - albumIds: [albumId], - monitored: !monitored, - }) - ); - }, [albumId, monitored, dispatch]); - - return ( -
-
- - - - {disambiguation ? `${title} (${disambiguation})` : `${title}`} - -
- -
- {albumType} -
- -
- {totalTrackCount === 0 ? '0/0' : `${trackFileCount}/${totalTrackCount}`} -
-
- ); -} - -export default AlbumStudioAlbum; diff --git a/frontend/src/Artist/Index/Select/AlbumStudio/ChangeMonitoringModal.tsx b/frontend/src/Artist/Index/Select/AlbumStudio/ChangeMonitoringModal.tsx deleted file mode 100644 index b48717af0..000000000 --- a/frontend/src/Artist/Index/Select/AlbumStudio/ChangeMonitoringModal.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import React from 'react'; -import Modal from 'Components/Modal/Modal'; -import ChangeMonitoringModalContent from './ChangeMonitoringModalContent'; - -interface ChangeMonitoringModalProps { - isOpen: boolean; - artistIds: number[]; - onSavePress(monitor: string): void; - onModalClose(): void; -} - -function ChangeMonitoringModal(props: ChangeMonitoringModalProps) { - const { isOpen, artistIds, onSavePress, onModalClose } = props; - - return ( - - - - ); -} - -export default ChangeMonitoringModal; diff --git a/frontend/src/Artist/Index/Select/AlbumStudio/ChangeMonitoringModalContent.css b/frontend/src/Artist/Index/Select/AlbumStudio/ChangeMonitoringModalContent.css deleted file mode 100644 index 29dc69dc4..000000000 --- a/frontend/src/Artist/Index/Select/AlbumStudio/ChangeMonitoringModalContent.css +++ /dev/null @@ -1,26 +0,0 @@ -.labelIcon { - margin-left: 8px; -} - -.message { - composes: alert from '~Components/Alert.css'; - - margin-bottom: 30px; -} - -.modalFooter { - composes: modalFooter from '~Components/Modal/ModalFooter.css'; - - justify-content: space-between; -} - -.selected { - font-weight: bold; -} - -@media only screen and (max-width: $breakpointExtraSmall) { - .modalFooter { - flex-direction: column; - gap: 10px; - } -} diff --git a/frontend/src/Artist/Index/Select/AlbumStudio/ChangeMonitoringModalContent.css.d.ts b/frontend/src/Artist/Index/Select/AlbumStudio/ChangeMonitoringModalContent.css.d.ts deleted file mode 100644 index 4c59f6545..000000000 --- a/frontend/src/Artist/Index/Select/AlbumStudio/ChangeMonitoringModalContent.css.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'labelIcon': string; - 'message': string; - 'modalFooter': string; - 'selected': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Index/Select/AlbumStudio/ChangeMonitoringModalContent.tsx b/frontend/src/Artist/Index/Select/AlbumStudio/ChangeMonitoringModalContent.tsx deleted file mode 100644 index b3c2abbbe..000000000 --- a/frontend/src/Artist/Index/Select/AlbumStudio/ChangeMonitoringModalContent.tsx +++ /dev/null @@ -1,96 +0,0 @@ -import React, { useCallback, useState } from 'react'; -import ArtistMonitoringOptionsPopoverContent from 'AddArtist/ArtistMonitoringOptionsPopoverContent'; -import Alert from 'Components/Alert'; -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 Icon from 'Components/Icon'; -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 Popover from 'Components/Tooltip/Popover'; -import { icons, inputTypes, kinds, tooltipPositions } from 'Helpers/Props'; -import translate from 'Utilities/String/translate'; -import styles from './ChangeMonitoringModalContent.css'; - -const NO_CHANGE = 'noChange'; - -interface ChangeMonitoringModalContentProps { - artistIds: number[]; - saveError?: object; - onSavePress(monitor: string): void; - onModalClose(): void; -} - -function ChangeMonitoringModalContent( - props: ChangeMonitoringModalContentProps -) { - const { artistIds, onSavePress, onModalClose, ...otherProps } = props; - - const [monitor, setMonitor] = useState(NO_CHANGE); - - const onInputChange = useCallback( - ({ value }: { value: string }) => { - setMonitor(value); - }, - [setMonitor] - ); - - const onSavePressWrapper = useCallback(() => { - onSavePress(monitor); - }, [monitor, onSavePress]); - - const selectedCount = artistIds.length; - - return ( - - {translate('MonitorArtists')} - - - - {translate('MonitorAlbumExistingOnlyWarning')} - - -
- - - {translate('MonitorExistingAlbums')} - - } - title={translate('MonitoringOptions')} - body={} - position={tooltipPositions.RIGHT} - /> - - - - -
-
- - -
- {translate('CountArtistsSelected', { count: selectedCount })} -
- -
- - - -
-
-
- ); -} - -export default ChangeMonitoringModalContent; diff --git a/frontend/src/Artist/Index/Select/ArtistIndexPosterSelect.css b/frontend/src/Artist/Index/Select/ArtistIndexPosterSelect.css deleted file mode 100644 index eccb80f87..000000000 --- a/frontend/src/Artist/Index/Select/ArtistIndexPosterSelect.css +++ /dev/null @@ -1,38 +0,0 @@ -.checkButton { - position: absolute; - top: 0; - left: 0; - z-index: 3; - width: 36px; - height: 36px; -} - -.checkContainer { - position: absolute; - top: 8px; - left: 8px; - width: 20px; - height: 20px; - border-radius: 50%; - background-color: var(--defaultColor); -} - -.selected { - color: var(--lidarrGreen); -} - -.unselected { - color: var(--white); -} - -.checkButton { - &:hover { - .selected { - color: var(--white); - } - - .unselected { - color: var(--lidarrGreen); - } - } -} diff --git a/frontend/src/Artist/Index/Select/ArtistIndexPosterSelect.css.d.ts b/frontend/src/Artist/Index/Select/ArtistIndexPosterSelect.css.d.ts deleted file mode 100644 index d4de0b5f5..000000000 --- a/frontend/src/Artist/Index/Select/ArtistIndexPosterSelect.css.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'checkButton': string; - 'checkContainer': string; - 'selected': string; - 'unselected': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Index/Select/ArtistIndexPosterSelect.tsx b/frontend/src/Artist/Index/Select/ArtistIndexPosterSelect.tsx deleted file mode 100644 index 86b41e8ba..000000000 --- a/frontend/src/Artist/Index/Select/ArtistIndexPosterSelect.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import React, { SyntheticEvent, useCallback } from 'react'; -import { useSelect } from 'App/SelectContext'; -import Icon from 'Components/Icon'; -import Link from 'Components/Link/Link'; -import { icons } from 'Helpers/Props'; -import styles from './ArtistIndexPosterSelect.css'; - -interface ArtistIndexPosterSelectProps { - artistId: number; -} - -function ArtistIndexPosterSelect(props: ArtistIndexPosterSelectProps) { - const { artistId } = props; - const [selectState, selectDispatch] = useSelect(); - const isSelected = selectState.selectedState[artistId]; - - const onSelectPress = useCallback( - (event: SyntheticEvent) => { - const nativeEvent = event.nativeEvent as PointerEvent; - const shiftKey = nativeEvent.shiftKey; - - selectDispatch({ - type: 'toggleSelected', - id: artistId, - isSelected: !isSelected, - shiftKey, - }); - }, - [artistId, isSelected, selectDispatch] - ); - - return ( - - - - - - ); -} - -export default ArtistIndexPosterSelect; diff --git a/frontend/src/Artist/Index/Select/ArtistIndexSelectAllButton.tsx b/frontend/src/Artist/Index/Select/ArtistIndexSelectAllButton.tsx deleted file mode 100644 index 2b3e9c01c..000000000 --- a/frontend/src/Artist/Index/Select/ArtistIndexSelectAllButton.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import React, { useCallback } from 'react'; -import { useSelect } from 'App/SelectContext'; -import PageToolbarButton from 'Components/Page/Toolbar/PageToolbarButton'; -import { icons } from 'Helpers/Props'; - -interface ArtistIndexSelectAllButtonProps { - label: string; - isSelectMode: boolean; - overflowComponent: React.FunctionComponent; -} - -function ArtistIndexSelectAllButton(props: ArtistIndexSelectAllButtonProps) { - const { isSelectMode } = props; - const [selectState, selectDispatch] = useSelect(); - const { allSelected, allUnselected } = selectState; - - let icon = icons.SQUARE_MINUS; - - if (allSelected) { - icon = icons.CHECK_SQUARE; - } else if (allUnselected) { - icon = icons.SQUARE; - } - - const onPress = useCallback(() => { - selectDispatch({ - type: allSelected ? 'unselectAll' : 'selectAll', - }); - }, [allSelected, selectDispatch]); - - return isSelectMode ? ( - - ) : null; -} - -export default ArtistIndexSelectAllButton; diff --git a/frontend/src/Artist/Index/Select/ArtistIndexSelectAllMenuItem.tsx b/frontend/src/Artist/Index/Select/ArtistIndexSelectAllMenuItem.tsx deleted file mode 100644 index 2340b65b6..000000000 --- a/frontend/src/Artist/Index/Select/ArtistIndexSelectAllMenuItem.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import React, { useCallback } from 'react'; -import { useSelect } from 'App/SelectContext'; -import PageToolbarOverflowMenuItem from 'Components/Page/Toolbar/PageToolbarOverflowMenuItem'; -import { icons } from 'Helpers/Props'; - -interface ArtistIndexSelectAllMenuItemProps { - label: string; - isSelectMode: boolean; -} - -function ArtistIndexSelectAllMenuItem( - props: ArtistIndexSelectAllMenuItemProps -) { - const { isSelectMode } = props; - const [selectState, selectDispatch] = useSelect(); - const { allSelected, allUnselected } = selectState; - - let iconName = icons.SQUARE_MINUS; - - if (allSelected) { - iconName = icons.CHECK_SQUARE; - } else if (allUnselected) { - iconName = icons.SQUARE; - } - - const onPressWrapper = useCallback(() => { - selectDispatch({ - type: allSelected ? 'unselectAll' : 'selectAll', - }); - }, [allSelected, selectDispatch]); - - return isSelectMode ? ( - - ) : null; -} - -export default ArtistIndexSelectAllMenuItem; diff --git a/frontend/src/Artist/Index/Select/ArtistIndexSelectFooter.css b/frontend/src/Artist/Index/Select/ArtistIndexSelectFooter.css deleted file mode 100644 index d385923ef..000000000 --- a/frontend/src/Artist/Index/Select/ArtistIndexSelectFooter.css +++ /dev/null @@ -1,72 +0,0 @@ -.footer { - composes: contentFooter from '~Components/Page/PageContentFooter.css'; - - align-items: center; -} - -.buttons { - display: flex; -} - -.actionButtons, -.deleteButtons { - display: flex; - gap: 10px; -} - -.deleteButtons { - margin-left: 50px; -} - -.selected { - display: flex; - justify-content: flex-end; - flex-grow: 1; - font-weight: bold; -} - -@media only screen and (max-width: $breakpointMedium) { - .buttons { - justify-content: center; - width: 100%; - } - - .selected { - justify-content: center; - margin-bottom: 20px; - width: 100%; - order: -1; - } -} - -@media only screen and (max-width: $breakpointSmall) { - .footer { - display: flex; - flex-direction: column; - } - - .buttons { - flex-direction: column; - margin-top: 20px; - gap: 20px; - } - - .actionButtons { - flex-wrap: wrap; - } - - .actionButtons, - .deleteButtons { - display: flex; - justify-content: center; - } - - .deleteButtons { - margin-left: 0; - } - - .selected { - justify-content: center; - order: -1; - } -} diff --git a/frontend/src/Artist/Index/Select/ArtistIndexSelectFooter.css.d.ts b/frontend/src/Artist/Index/Select/ArtistIndexSelectFooter.css.d.ts deleted file mode 100644 index 7f02229e3..000000000 --- a/frontend/src/Artist/Index/Select/ArtistIndexSelectFooter.css.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'actionButtons': string; - 'buttons': string; - 'deleteButtons': string; - 'footer': string; - 'selected': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Index/Select/ArtistIndexSelectFooter.tsx b/frontend/src/Artist/Index/Select/ArtistIndexSelectFooter.tsx deleted file mode 100644 index f0569d607..000000000 --- a/frontend/src/Artist/Index/Select/ArtistIndexSelectFooter.tsx +++ /dev/null @@ -1,300 +0,0 @@ -import React, { useCallback, useEffect, useMemo, useState } from 'react'; -import { useDispatch, useSelector } from 'react-redux'; -import { createSelector } from 'reselect'; -import { useSelect } from 'App/SelectContext'; -import AppState from 'App/State/AppState'; -import { RENAME_ARTIST, RETAG_ARTIST } from 'Commands/commandNames'; -import SpinnerButton from 'Components/Link/SpinnerButton'; -import PageContentFooter from 'Components/Page/PageContentFooter'; -import usePrevious from 'Helpers/Hooks/usePrevious'; -import { kinds } from 'Helpers/Props'; -import { - saveArtistEditor, - updateArtistsMonitor, -} from 'Store/Actions/artistActions'; -import { fetchRootFolders } from 'Store/Actions/settingsActions'; -import createCommandExecutingSelector from 'Store/Selectors/createCommandExecutingSelector'; -import translate from 'Utilities/String/translate'; -import getSelectedIds from 'Utilities/Table/getSelectedIds'; -import ChangeMonitoringModal from './AlbumStudio/ChangeMonitoringModal'; -import RetagArtistModal from './AudioTags/RetagArtistModal'; -import DeleteArtistModal from './Delete/DeleteArtistModal'; -import EditArtistModal from './Edit/EditArtistModal'; -import OrganizeArtistModal from './Organize/OrganizeArtistModal'; -import TagsModal from './Tags/TagsModal'; -import styles from './ArtistIndexSelectFooter.css'; - -interface SavePayload { - monitored?: boolean; - qualityProfileId?: number; - metadataProfileId?: number; - rootFolderPath?: string; - moveFiles?: boolean; -} - -const artistEditorSelector = createSelector( - (state: AppState) => state.artist, - (artist) => { - const { isSaving, isDeleting, deleteError } = artist; - - return { - isSaving, - isDeleting, - deleteError, - }; - } -); - -function ArtistIndexSelectFooter() { - const { isSaving, isDeleting, deleteError } = - useSelector(artistEditorSelector); - - const isOrganizingArtist = useSelector( - createCommandExecutingSelector(RENAME_ARTIST) - ); - const isRetaggingArtist = useSelector( - createCommandExecutingSelector(RETAG_ARTIST) - ); - - const dispatch = useDispatch(); - - const [isEditModalOpen, setIsEditModalOpen] = useState(false); - const [isOrganizeModalOpen, setIsOrganizeModalOpen] = useState(false); - const [isRetaggingModalOpen, setIsRetaggingModalOpen] = useState(false); - const [isTagsModalOpen, setIsTagsModalOpen] = useState(false); - const [isMonitoringModalOpen, setIsMonitoringModalOpen] = useState(false); - const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false); - const [isSavingArtist, setIsSavingArtist] = useState(false); - const [isSavingTags, setIsSavingTags] = useState(false); - const [isSavingMonitoring, setIsSavingMonitoring] = useState(false); - const previousIsDeleting = usePrevious(isDeleting); - - const [selectState, selectDispatch] = useSelect(); - const { selectedState } = selectState; - - const artistIds = useMemo(() => { - return getSelectedIds(selectedState); - }, [selectedState]); - - const selectedCount = artistIds.length; - - const onEditPress = useCallback(() => { - setIsEditModalOpen(true); - }, [setIsEditModalOpen]); - - const onEditModalClose = useCallback(() => { - setIsEditModalOpen(false); - }, [setIsEditModalOpen]); - - const onSavePress = useCallback( - (payload: SavePayload) => { - setIsSavingArtist(true); - setIsEditModalOpen(false); - - dispatch( - saveArtistEditor({ - ...payload, - artistIds, - }) - ); - }, - [artistIds, dispatch] - ); - - const onOrganizePress = useCallback(() => { - setIsOrganizeModalOpen(true); - }, [setIsOrganizeModalOpen]); - - const onOrganizeModalClose = useCallback(() => { - setIsOrganizeModalOpen(false); - }, [setIsOrganizeModalOpen]); - - const onRetagPress = useCallback(() => { - setIsRetaggingModalOpen(true); - }, [setIsRetaggingModalOpen]); - - const onRetagModalClose = useCallback(() => { - setIsRetaggingModalOpen(false); - }, [setIsRetaggingModalOpen]); - - const onTagsPress = useCallback(() => { - setIsTagsModalOpen(true); - }, [setIsTagsModalOpen]); - - const onTagsModalClose = useCallback(() => { - setIsTagsModalOpen(false); - }, [setIsTagsModalOpen]); - - const onApplyTagsPress = useCallback( - (tags: number[], applyTags: string) => { - setIsSavingTags(true); - setIsTagsModalOpen(false); - - dispatch( - saveArtistEditor({ - artistIds, - tags, - applyTags, - }) - ); - }, - [artistIds, dispatch] - ); - - const onMonitoringPress = useCallback(() => { - setIsMonitoringModalOpen(true); - }, [setIsMonitoringModalOpen]); - - const onMonitoringClose = useCallback(() => { - setIsMonitoringModalOpen(false); - }, [setIsMonitoringModalOpen]); - - const onMonitoringSavePress = useCallback( - (monitor: string) => { - setIsSavingMonitoring(true); - setIsMonitoringModalOpen(false); - - dispatch( - updateArtistsMonitor({ - artistIds, - monitor, - }) - ); - }, - [artistIds, dispatch] - ); - - const onDeletePress = useCallback(() => { - setIsDeleteModalOpen(true); - }, [setIsDeleteModalOpen]); - - const onDeleteModalClose = useCallback(() => { - setIsDeleteModalOpen(false); - }, []); - - useEffect(() => { - if (!isSaving) { - setIsSavingArtist(false); - setIsSavingTags(false); - setIsSavingMonitoring(false); - } - }, [isSaving]); - - useEffect(() => { - if (previousIsDeleting && !isDeleting && !deleteError) { - selectDispatch({ type: 'unselectAll' }); - } - }, [previousIsDeleting, isDeleting, deleteError, selectDispatch]); - - useEffect(() => { - dispatch(fetchRootFolders()); - }, [dispatch]); - - const anySelected = selectedCount > 0; - - return ( - -
-
- - {translate('Edit')} - - - - {translate('RenameFiles')} - - - - {translate('WriteMetadataTags')} - - - - {translate('SetAppTags')} - - - - {translate('UpdateMonitoring')} - -
- -
- - {translate('Delete')} - -
-
- -
- {translate('CountArtistsSelected', { count: selectedCount })} -
- - - - - - - - - - - - -
- ); -} - -export default ArtistIndexSelectFooter; diff --git a/frontend/src/Artist/Index/Select/ArtistIndexSelectModeButton.tsx b/frontend/src/Artist/Index/Select/ArtistIndexSelectModeButton.tsx deleted file mode 100644 index 8679bba99..000000000 --- a/frontend/src/Artist/Index/Select/ArtistIndexSelectModeButton.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import { IconDefinition } from '@fortawesome/fontawesome-common-types'; -import React, { useCallback } from 'react'; -import { useSelect } from 'App/SelectContext'; -import PageToolbarButton from 'Components/Page/Toolbar/PageToolbarButton'; - -interface ArtistIndexSelectModeButtonProps { - label: string; - iconName: IconDefinition; - isSelectMode: boolean; - overflowComponent: React.FunctionComponent; - onPress: () => void; -} - -function ArtistIndexSelectModeButton(props: ArtistIndexSelectModeButtonProps) { - const { label, iconName, isSelectMode, onPress } = props; - const [, selectDispatch] = useSelect(); - - const onPressWrapper = useCallback(() => { - if (isSelectMode) { - selectDispatch({ - type: 'reset', - }); - } - - onPress(); - }, [isSelectMode, onPress, selectDispatch]); - - return ( - - ); -} - -export default ArtistIndexSelectModeButton; diff --git a/frontend/src/Artist/Index/Select/ArtistIndexSelectModeMenuItem.tsx b/frontend/src/Artist/Index/Select/ArtistIndexSelectModeMenuItem.tsx deleted file mode 100644 index b5a7a6de4..000000000 --- a/frontend/src/Artist/Index/Select/ArtistIndexSelectModeMenuItem.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import { IconDefinition } from '@fortawesome/fontawesome-common-types'; -import React, { useCallback } from 'react'; -import { useSelect } from 'App/SelectContext'; -import PageToolbarOverflowMenuItem from 'Components/Page/Toolbar/PageToolbarOverflowMenuItem'; - -interface ArtistIndexSelectModeMenuItemProps { - label: string; - iconName: IconDefinition; - isSelectMode: boolean; - onPress: () => void; -} - -function ArtistIndexSelectModeMenuItem( - props: ArtistIndexSelectModeMenuItemProps -) { - const { label, iconName, isSelectMode, onPress } = props; - const [, selectDispatch] = useSelect(); - - const onPressWrapper = useCallback(() => { - if (isSelectMode) { - selectDispatch({ - type: 'reset', - }); - } - - onPress(); - }, [isSelectMode, onPress, selectDispatch]); - - return ( - - ); -} - -export default ArtistIndexSelectModeMenuItem; diff --git a/frontend/src/Artist/Index/Select/AudioTags/RetagArtistModal.tsx b/frontend/src/Artist/Index/Select/AudioTags/RetagArtistModal.tsx deleted file mode 100644 index 5d5f1fb6a..000000000 --- a/frontend/src/Artist/Index/Select/AudioTags/RetagArtistModal.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import React from 'react'; -import Modal from 'Components/Modal/Modal'; -import RetagArtistModalContent from './RetagArtistModalContent'; - -interface RetagArtistModalProps { - isOpen: boolean; - artistIds: number[]; - onModalClose: () => void; -} - -function RetagArtistModal(props: RetagArtistModalProps) { - const { isOpen, onModalClose, ...otherProps } = props; - - return ( - - - - ); -} - -export default RetagArtistModal; diff --git a/frontend/src/Artist/Index/Select/AudioTags/RetagArtistModalContent.css b/frontend/src/Artist/Index/Select/AudioTags/RetagArtistModalContent.css deleted file mode 100644 index 02c52edc8..000000000 --- a/frontend/src/Artist/Index/Select/AudioTags/RetagArtistModalContent.css +++ /dev/null @@ -1,8 +0,0 @@ -.retagIcon { - margin-left: 5px; -} - -.message { - margin-top: 20px; - margin-bottom: 10px; -} diff --git a/frontend/src/Artist/Index/Select/AudioTags/RetagArtistModalContent.css.d.ts b/frontend/src/Artist/Index/Select/AudioTags/RetagArtistModalContent.css.d.ts deleted file mode 100644 index c2556006e..000000000 --- a/frontend/src/Artist/Index/Select/AudioTags/RetagArtistModalContent.css.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'message': string; - 'retagIcon': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Index/Select/AudioTags/RetagArtistModalContent.tsx b/frontend/src/Artist/Index/Select/AudioTags/RetagArtistModalContent.tsx deleted file mode 100644 index b67ee60aa..000000000 --- a/frontend/src/Artist/Index/Select/AudioTags/RetagArtistModalContent.tsx +++ /dev/null @@ -1,91 +0,0 @@ -import { orderBy } from 'lodash'; -import React, { useCallback, useMemo } from 'react'; -import { useDispatch, useSelector } from 'react-redux'; -import Artist from 'Artist/Artist'; -import { RETAG_ARTIST } from 'Commands/commandNames'; -import Alert from 'Components/Alert'; -import Icon from 'Components/Icon'; -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 { icons, kinds } from 'Helpers/Props'; -import { executeCommand } from 'Store/Actions/commandActions'; -import createAllArtistSelector from 'Store/Selectors/createAllArtistSelector'; -import translate from 'Utilities/String/translate'; -import styles from './RetagArtistModalContent.css'; - -interface RetagArtistModalContentProps { - artistIds: number[]; - onModalClose: () => void; -} - -function RetagArtistModalContent(props: RetagArtistModalContentProps) { - const { artistIds, onModalClose } = props; - - const allArtists: Artist[] = useSelector(createAllArtistSelector()); - const dispatch = useDispatch(); - - const artistNames = useMemo(() => { - const artists = artistIds.reduce((acc: Artist[], id) => { - const a = allArtists.find((a) => a.id === id); - - if (a) { - acc.push(a); - } - - return acc; - }, []); - - const sorted = orderBy(artists, ['sortName']); - - return sorted.map((a) => a.artistName); - }, [artistIds, allArtists]); - - const onRetagPress = useCallback(() => { - dispatch( - executeCommand({ - name: RETAG_ARTIST, - artistIds, - }) - ); - - onModalClose(); - }, [artistIds, onModalClose, dispatch]); - - return ( - - {translate('RetagSelectedArtists')} - - - - Tip: To preview the tags that will be written, select "Cancel", then - select any artist name and use the - - - -
- Are you sure you want to retag all files in the {artistNames.length}{' '} - selected artist? -
- -
    - {artistNames.map((artistName) => { - return
  • {artistName}
  • ; - })} -
-
- - - - - - -
- ); -} - -export default RetagArtistModalContent; diff --git a/frontend/src/Artist/Index/Select/Delete/DeleteArtistModal.tsx b/frontend/src/Artist/Index/Select/Delete/DeleteArtistModal.tsx deleted file mode 100644 index c909d7406..000000000 --- a/frontend/src/Artist/Index/Select/Delete/DeleteArtistModal.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import React from 'react'; -import Modal from 'Components/Modal/Modal'; -import DeleteArtistModalContent from './DeleteArtistModalContent'; - -interface DeleteArtistModalProps { - isOpen: boolean; - artistIds: number[]; - onModalClose(): void; -} - -function DeleteArtistModal(props: DeleteArtistModalProps) { - const { isOpen, artistIds, onModalClose } = props; - - return ( - - - - ); -} - -export default DeleteArtistModal; diff --git a/frontend/src/Artist/Index/Select/Delete/DeleteArtistModalContent.css b/frontend/src/Artist/Index/Select/Delete/DeleteArtistModalContent.css deleted file mode 100644 index 02a0514be..000000000 --- a/frontend/src/Artist/Index/Select/Delete/DeleteArtistModalContent.css +++ /dev/null @@ -1,13 +0,0 @@ -.message { - margin-top: 20px; - margin-bottom: 10px; -} - -.pathContainer { - margin-left: 5px; -} - -.path { - margin-left: 5px; - color: var(--dangerColor); -} diff --git a/frontend/src/Artist/Index/Select/Delete/DeleteArtistModalContent.css.d.ts b/frontend/src/Artist/Index/Select/Delete/DeleteArtistModalContent.css.d.ts deleted file mode 100644 index bcc2e2492..000000000 --- a/frontend/src/Artist/Index/Select/Delete/DeleteArtistModalContent.css.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'message': string; - 'path': string; - 'pathContainer': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Index/Select/Delete/DeleteArtistModalContent.tsx b/frontend/src/Artist/Index/Select/Delete/DeleteArtistModalContent.tsx deleted file mode 100644 index 4accc9f0e..000000000 --- a/frontend/src/Artist/Index/Select/Delete/DeleteArtistModalContent.tsx +++ /dev/null @@ -1,166 +0,0 @@ -import { orderBy } from 'lodash'; -import React, { useCallback, useMemo, useState } from 'react'; -import { useDispatch, useSelector } from 'react-redux'; -import { createSelector } from 'reselect'; -import AppState from 'App/State/AppState'; -import Artist from 'Artist/Artist'; -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, kinds } from 'Helpers/Props'; -import { bulkDeleteArtist, setDeleteOption } from 'Store/Actions/artistActions'; -import createAllArtistSelector from 'Store/Selectors/createAllArtistSelector'; -import { CheckInputChanged } from 'typings/inputs'; -import translate from 'Utilities/String/translate'; -import styles from './DeleteArtistModalContent.css'; - -interface DeleteArtistModalContentProps { - artistIds: number[]; - onModalClose(): void; -} - -const selectDeleteOptions = createSelector( - (state: AppState) => state.artist.deleteOptions, - (deleteOptions) => deleteOptions -); - -function DeleteArtistModalContent(props: DeleteArtistModalContentProps) { - const { artistIds, onModalClose } = props; - - const { addImportListExclusion } = useSelector(selectDeleteOptions); - const allArtists: Artist[] = useSelector(createAllArtistSelector()); - const dispatch = useDispatch(); - - const [deleteFiles, setDeleteFiles] = useState(false); - - const artists = useMemo((): Artist[] => { - const artistList = artistIds.map((id) => { - return allArtists.find((a) => a.id === id); - }) as Artist[]; - - return orderBy(artistList, ['sortName']); - }, [artistIds, allArtists]); - - const onDeleteFilesChange = useCallback( - ({ value }: CheckInputChanged) => { - setDeleteFiles(value); - }, - [setDeleteFiles] - ); - - const onDeleteOptionChange = useCallback( - ({ name, value }: { name: string; value: boolean }) => { - dispatch( - setDeleteOption({ - [name]: value, - }) - ); - }, - [dispatch] - ); - - const onDeleteArtistConfirmed = useCallback(() => { - setDeleteFiles(false); - - dispatch( - bulkDeleteArtist({ - artistIds, - deleteFiles, - addImportListExclusion, - }) - ); - - onModalClose(); - }, [ - artistIds, - deleteFiles, - addImportListExclusion, - setDeleteFiles, - dispatch, - onModalClose, - ]); - - return ( - - {translate('DeleteSelectedArtists')} - - -
- - {translate('AddListExclusion')} - - - - - - - {artists.length > 1 - ? translate('DeleteArtistFolders') - : translate('DeleteArtistFolder')} - - - 1 - ? translate('DeleteArtistFoldersHelpText') - : translate('DeleteArtistFolderHelpText') - } - kind={kinds.DANGER} - onChange={onDeleteFilesChange} - /> - -
- -
- {deleteFiles - ? translate('DeleteArtistFolderCountWithFilesConfirmation', { - count: artists.length, - }) - : translate('DeleteArtistFolderCountConfirmation', { - count: artists.length, - })} -
- -
    - {artists.map((a) => { - return ( -
  • - {a.artistName} - - {deleteFiles && ( - - -{a.path} - - )} -
  • - ); - })} -
-
- - - - - - -
- ); -} - -export default DeleteArtistModalContent; diff --git a/frontend/src/Artist/Index/Select/Edit/EditArtistModal.tsx b/frontend/src/Artist/Index/Select/Edit/EditArtistModal.tsx deleted file mode 100644 index bdb6726be..000000000 --- a/frontend/src/Artist/Index/Select/Edit/EditArtistModal.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import React from 'react'; -import Modal from 'Components/Modal/Modal'; -import EditArtistModalContent from './EditArtistModalContent'; - -interface EditArtistModalProps { - isOpen: boolean; - artistIds: number[]; - onSavePress(payload: object): void; - onModalClose(): void; -} - -function EditArtistModal(props: EditArtistModalProps) { - const { isOpen, artistIds, onSavePress, onModalClose } = props; - - return ( - - - - ); -} - -export default EditArtistModal; diff --git a/frontend/src/Artist/Index/Select/Edit/EditArtistModalContent.css b/frontend/src/Artist/Index/Select/Edit/EditArtistModalContent.css deleted file mode 100644 index ea406894e..000000000 --- a/frontend/src/Artist/Index/Select/Edit/EditArtistModalContent.css +++ /dev/null @@ -1,16 +0,0 @@ -.modalFooter { - composes: modalFooter from '~Components/Modal/ModalFooter.css'; - - justify-content: space-between; -} - -.selected { - font-weight: bold; -} - -@media only screen and (max-width: $breakpointExtraSmall) { - .modalFooter { - flex-direction: column; - gap: 10px; - } -} diff --git a/frontend/src/Artist/Index/Select/Edit/EditArtistModalContent.css.d.ts b/frontend/src/Artist/Index/Select/Edit/EditArtistModalContent.css.d.ts deleted file mode 100644 index cbf2d6328..000000000 --- a/frontend/src/Artist/Index/Select/Edit/EditArtistModalContent.css.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'modalFooter': string; - 'selected': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Index/Select/Edit/EditArtistModalContent.tsx b/frontend/src/Artist/Index/Select/Edit/EditArtistModalContent.tsx deleted file mode 100644 index 993be8ce5..000000000 --- a/frontend/src/Artist/Index/Select/Edit/EditArtistModalContent.tsx +++ /dev/null @@ -1,264 +0,0 @@ -import React, { useCallback, useState } from 'react'; -import MoveArtistModal from 'Artist/MoveArtist/MoveArtistModal'; -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 translate from 'Utilities/String/translate'; -import styles from './EditArtistModalContent.css'; - -interface SavePayload { - monitored?: boolean; - monitorNewItems?: string; - qualityProfileId?: number; - metadataProfileId?: number; - rootFolderPath?: string; - moveFiles?: boolean; -} - -interface EditArtistModalContentProps { - artistIds: number[]; - onSavePress(payload: object): void; - onModalClose(): void; -} - -const NO_CHANGE = 'noChange'; - -const monitoredOptions = [ - { - key: NO_CHANGE, - get value() { - return translate('NoChange'); - }, - isDisabled: true, - }, - { - key: 'monitored', - get value() { - return translate('Monitored'); - }, - }, - { - key: 'unmonitored', - get value() { - return translate('Unmonitored'); - }, - }, -]; - -function EditArtistModalContent(props: EditArtistModalContentProps) { - const { artistIds, onSavePress, onModalClose } = props; - - const [monitored, setMonitored] = useState(NO_CHANGE); - const [monitorNewItems, setMonitorNewItems] = useState(NO_CHANGE); - const [qualityProfileId, setQualityProfileId] = useState( - NO_CHANGE - ); - const [metadataProfileId, setMetadataProfileId] = useState( - NO_CHANGE - ); - const [rootFolderPath, setRootFolderPath] = useState(NO_CHANGE); - const [isConfirmMoveModalOpen, setIsConfirmMoveModalOpen] = useState(false); - - const save = useCallback( - (moveFiles: boolean) => { - let hasChanges = false; - const payload: SavePayload = {}; - - if (monitored !== NO_CHANGE) { - hasChanges = true; - payload.monitored = monitored === 'monitored'; - } - - if (monitorNewItems !== NO_CHANGE) { - hasChanges = true; - payload.monitorNewItems = monitorNewItems; - } - - if (qualityProfileId !== NO_CHANGE) { - hasChanges = true; - payload.qualityProfileId = qualityProfileId as number; - } - - if (metadataProfileId !== NO_CHANGE) { - hasChanges = true; - payload.metadataProfileId = metadataProfileId as number; - } - - if (rootFolderPath !== NO_CHANGE) { - hasChanges = true; - payload.rootFolderPath = rootFolderPath; - payload.moveFiles = moveFiles; - } - - if (hasChanges) { - onSavePress(payload); - } - - onModalClose(); - }, - [ - monitored, - monitorNewItems, - qualityProfileId, - metadataProfileId, - rootFolderPath, - onSavePress, - onModalClose, - ] - ); - - const onInputChange = useCallback( - ({ name, value }: { name: string; value: string }) => { - switch (name) { - case 'monitored': - setMonitored(value); - break; - case 'monitorNewItems': - setMonitorNewItems(value); - break; - case 'qualityProfileId': - setQualityProfileId(value); - break; - case 'metadataProfileId': - setMetadataProfileId(value); - break; - case 'rootFolderPath': - setRootFolderPath(value); - break; - default: - console.warn('EditArtistModalContent Unknown Input'); - } - }, - [setMonitored] - ); - - const onSavePressWrapper = useCallback(() => { - if (rootFolderPath === NO_CHANGE) { - save(false); - } else { - setIsConfirmMoveModalOpen(true); - } - }, [rootFolderPath, save]); - - const onCancelPress = useCallback(() => { - setIsConfirmMoveModalOpen(false); - }, [setIsConfirmMoveModalOpen]); - - const onDoNotMoveArtistPress = useCallback(() => { - setIsConfirmMoveModalOpen(false); - save(false); - }, [setIsConfirmMoveModalOpen, save]); - - const onMoveArtistPress = useCallback(() => { - setIsConfirmMoveModalOpen(false); - save(true); - }, [setIsConfirmMoveModalOpen, save]); - - const selectedCount = artistIds.length; - - return ( - - {translate('EditSelectedArtists')} - - - - {translate('Monitored')} - - - - - - {translate('MonitorNewItems')} - - - - - - {translate('QualityProfile')} - - - - - - {translate('MetadataProfile')} - - - - - - {translate('RootFolder')} - - - - - - -
- {translate('CountArtistsSelected', { count: selectedCount })} -
- -
- - - -
-
- - -
- ); -} - -export default EditArtistModalContent; diff --git a/frontend/src/Artist/Index/Select/Organize/OrganizeArtistModal.tsx b/frontend/src/Artist/Index/Select/Organize/OrganizeArtistModal.tsx deleted file mode 100644 index bec35222b..000000000 --- a/frontend/src/Artist/Index/Select/Organize/OrganizeArtistModal.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import React from 'react'; -import Modal from 'Components/Modal/Modal'; -import OrganizeArtistModalContent from './OrganizeArtistModalContent'; - -interface OrganizeArtistModalProps { - isOpen: boolean; - artistIds: number[]; - onModalClose: () => void; -} - -function OrganizeArtistModal(props: OrganizeArtistModalProps) { - const { isOpen, onModalClose, ...otherProps } = props; - - return ( - - - - ); -} - -export default OrganizeArtistModal; diff --git a/frontend/src/Artist/Index/Select/Organize/OrganizeArtistModalContent.css b/frontend/src/Artist/Index/Select/Organize/OrganizeArtistModalContent.css deleted file mode 100644 index 0b896f4ef..000000000 --- a/frontend/src/Artist/Index/Select/Organize/OrganizeArtistModalContent.css +++ /dev/null @@ -1,8 +0,0 @@ -.renameIcon { - margin-left: 5px; -} - -.message { - margin-top: 20px; - margin-bottom: 10px; -} diff --git a/frontend/src/Artist/Index/Select/Organize/OrganizeArtistModalContent.css.d.ts b/frontend/src/Artist/Index/Select/Organize/OrganizeArtistModalContent.css.d.ts deleted file mode 100644 index ae2303476..000000000 --- a/frontend/src/Artist/Index/Select/Organize/OrganizeArtistModalContent.css.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'message': string; - 'renameIcon': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Index/Select/Organize/OrganizeArtistModalContent.tsx b/frontend/src/Artist/Index/Select/Organize/OrganizeArtistModalContent.tsx deleted file mode 100644 index 8184abba7..000000000 --- a/frontend/src/Artist/Index/Select/Organize/OrganizeArtistModalContent.tsx +++ /dev/null @@ -1,91 +0,0 @@ -import { orderBy } from 'lodash'; -import React, { useCallback, useMemo } from 'react'; -import { useDispatch, useSelector } from 'react-redux'; -import Artist from 'Artist/Artist'; -import { RENAME_ARTIST } from 'Commands/commandNames'; -import Alert from 'Components/Alert'; -import Icon from 'Components/Icon'; -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 { icons, kinds } from 'Helpers/Props'; -import { executeCommand } from 'Store/Actions/commandActions'; -import createAllArtistSelector from 'Store/Selectors/createAllArtistSelector'; -import translate from 'Utilities/String/translate'; -import styles from './OrganizeArtistModalContent.css'; - -interface OrganizeArtistModalContentProps { - artistIds: number[]; - onModalClose: () => void; -} - -function OrganizeArtistModalContent(props: OrganizeArtistModalContentProps) { - const { artistIds, onModalClose } = props; - - const allArtists: Artist[] = useSelector(createAllArtistSelector()); - const dispatch = useDispatch(); - - const artistNames = useMemo(() => { - const artists = artistIds.reduce((acc: Artist[], id) => { - const a = allArtists.find((a) => a.id === id); - - if (a) { - acc.push(a); - } - - return acc; - }, []); - - const sorted = orderBy(artists, ['sortName']); - - return sorted.map((a) => a.artistName); - }, [artistIds, allArtists]); - - const onOrganizePress = useCallback(() => { - dispatch( - executeCommand({ - name: RENAME_ARTIST, - artistIds, - }) - ); - - onModalClose(); - }, [artistIds, onModalClose, dispatch]); - - return ( - - {translate('OrganizeSelectedArtists')} - - - - Tip: To preview a rename, select "Cancel", then select any artist name - and use the - - - -
- Are you sure you want to organize all files in the{' '} - {artistNames.length} selected artist? -
- -
    - {artistNames.map((artistName) => { - return
  • {artistName}
  • ; - })} -
-
- - - - - - -
- ); -} - -export default OrganizeArtistModalContent; diff --git a/frontend/src/Artist/Index/Select/Tags/TagsModal.tsx b/frontend/src/Artist/Index/Select/Tags/TagsModal.tsx deleted file mode 100644 index 8635867e4..000000000 --- a/frontend/src/Artist/Index/Select/Tags/TagsModal.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import React from 'react'; -import Modal from 'Components/Modal/Modal'; -import TagsModalContent from './TagsModalContent'; - -interface TagsModalProps { - isOpen: boolean; - artistIds: number[]; - onApplyTagsPress: (tags: number[], applyTags: string) => void; - onModalClose: () => void; -} - -function TagsModal(props: TagsModalProps) { - const { isOpen, onModalClose, ...otherProps } = props; - - return ( - - - - ); -} - -export default TagsModal; diff --git a/frontend/src/Artist/Index/Select/Tags/TagsModalContent.css b/frontend/src/Artist/Index/Select/Tags/TagsModalContent.css deleted file mode 100644 index 63be9aadd..000000000 --- a/frontend/src/Artist/Index/Select/Tags/TagsModalContent.css +++ /dev/null @@ -1,12 +0,0 @@ -.renameIcon { - margin-left: 5px; -} - -.message { - margin-top: 20px; - margin-bottom: 10px; -} - -.result { - padding-top: 4px; -} diff --git a/frontend/src/Artist/Index/Select/Tags/TagsModalContent.css.d.ts b/frontend/src/Artist/Index/Select/Tags/TagsModalContent.css.d.ts deleted file mode 100644 index 9b4321dcc..000000000 --- a/frontend/src/Artist/Index/Select/Tags/TagsModalContent.css.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'message': string; - 'renameIcon': string; - 'result': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Index/Select/Tags/TagsModalContent.tsx b/frontend/src/Artist/Index/Select/Tags/TagsModalContent.tsx deleted file mode 100644 index 95a7eaae2..000000000 --- a/frontend/src/Artist/Index/Select/Tags/TagsModalContent.tsx +++ /dev/null @@ -1,189 +0,0 @@ -import { uniq } from 'lodash'; -import React, { useCallback, useMemo, useState } from 'react'; -import { useSelector } from 'react-redux'; -import { Tag } from 'App/State/TagsAppState'; -import Artist from 'Artist/Artist'; -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 Label from 'Components/Label'; -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, kinds, sizes } from 'Helpers/Props'; -import createAllArtistSelector from 'Store/Selectors/createAllArtistSelector'; -import createTagsSelector from 'Store/Selectors/createTagsSelector'; -import translate from 'Utilities/String/translate'; -import styles from './TagsModalContent.css'; - -interface TagsModalContentProps { - artistIds: number[]; - onApplyTagsPress: (tags: number[], applyTags: string) => void; - onModalClose: () => void; -} - -function TagsModalContent(props: TagsModalContentProps) { - const { artistIds, onModalClose, onApplyTagsPress } = props; - - const allArtists: Artist[] = useSelector(createAllArtistSelector()); - const tagList: Tag[] = useSelector(createTagsSelector()); - - const [tags, setTags] = useState([]); - const [applyTags, setApplyTags] = useState('add'); - - const artistTags = useMemo(() => { - const tags = artistIds.reduce((acc: number[], id) => { - const a = allArtists.find((a) => a.id === id); - - if (a) { - acc.push(...a.tags); - } - - return acc; - }, []); - - return uniq(tags); - }, [artistIds, allArtists]); - - const onTagsChange = useCallback( - ({ value }: { value: number[] }) => { - setTags(value); - }, - [setTags] - ); - - const onApplyTagsChange = useCallback( - ({ value }: { value: string }) => { - setApplyTags(value); - }, - [setApplyTags] - ); - - const onApplyPress = useCallback(() => { - onApplyTagsPress(tags, applyTags); - }, [tags, applyTags, onApplyTagsPress]); - - const applyTagsOptions = [ - { - key: 'add', - value: translate('Add'), - }, - { - key: 'remove', - value: translate('Remove'), - }, - { - key: 'replace', - value: translate('Replace'), - }, - ]; - - return ( - - {translate('Tags')} - - -
- - {translate('Tags')} - - - - - - {translate('ApplyTags')} - - - - - - {translate('Result')} - -
- {artistTags.map((id) => { - const tag = tagList.find((t) => t.id === id); - - if (!tag) { - return null; - } - - const removeTag = - (applyTags === 'remove' && tags.indexOf(id) > -1) || - (applyTags === 'replace' && tags.indexOf(id) === -1); - - return ( - - ); - })} - - {(applyTags === 'add' || applyTags === 'replace') && - tags.map((id) => { - const tag = tagList.find((t) => t.id === id); - - if (!tag) { - return null; - } - - if (artistTags.indexOf(id) > -1) { - return null; - } - - return ( - - ); - })} -
-
-
-
- - - - - - -
- ); -} - -export default TagsModalContent; diff --git a/frontend/src/Artist/Index/Table/AlbumsCell.css b/frontend/src/Artist/Index/Table/AlbumsCell.css deleted file mode 100644 index 307c5d406..000000000 --- a/frontend/src/Artist/Index/Table/AlbumsCell.css +++ /dev/null @@ -1,4 +0,0 @@ -.albumCount { - width: 100%; - cursor: default; -} diff --git a/frontend/src/Artist/Index/Table/AlbumsCell.css.d.ts b/frontend/src/Artist/Index/Table/AlbumsCell.css.d.ts deleted file mode 100644 index 93d667287..000000000 --- a/frontend/src/Artist/Index/Table/AlbumsCell.css.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'albumCount': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Index/Table/AlbumsCell.tsx b/frontend/src/Artist/Index/Table/AlbumsCell.tsx deleted file mode 100644 index b42298b5d..000000000 --- a/frontend/src/Artist/Index/Table/AlbumsCell.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import React from 'react'; -import AlbumDetails from 'Artist/Index/Select/AlbumStudio/AlbumDetails'; -import VirtualTableRowCell from 'Components/Table/Cells/VirtualTableRowCell'; -import Popover from 'Components/Tooltip/Popover'; -import TooltipPosition from 'Helpers/Props/TooltipPosition'; -import translate from 'Utilities/String/translate'; -import styles from './AlbumsCell.css'; - -interface SeriesStatusCellProps { - className: string; - artistId: number; - albumCount: number; - isSelectMode: boolean; -} - -function AlbumsCell(props: SeriesStatusCellProps) { - const { className, artistId, albumCount, isSelectMode, ...otherProps } = - props; - - return ( - - {isSelectMode && albumCount > 0 ? ( - } - position={TooltipPosition.Left} - canFlip={true} - /> - ) : ( - albumCount - )} - - ); -} - -export default AlbumsCell; diff --git a/frontend/src/Artist/Index/Table/ArtistIndexRow.css b/frontend/src/Artist/Index/Table/ArtistIndexRow.css deleted file mode 100644 index 35d03c263..000000000 --- a/frontend/src/Artist/Index/Table/ArtistIndexRow.css +++ /dev/null @@ -1,142 +0,0 @@ -.cell { - composes: cell from '~Components/Table/Cells/VirtualTableRowCell.css'; - - display: flex; - align-items: center; -} - -.status { - composes: cell; - - flex: 0 0 60px; -} - -.sortName { - composes: cell; - - flex: 4 0 110px; -} - -.artistType { - composes: cell; - - flex: 0 0 100px; -} - -.banner { - flex: 0 0 379px; -} - -.bannerGrow { - flex-grow: 1; -} - -.link { - composes: link from '~Components/Link/Link.css'; - - position: relative; - display: block; - height: 70px; - background-color: var(--defaultColor); -} - -.bannerImage { - width: 379px; - height: 70px; -} - -.overlayTitle { - position: absolute; - top: 0; - left: 0; - display: flex; - align-items: center; - justify-content: center; - padding: 5px; - width: 100%; - height: 100%; - color: var(--offWhite); - text-align: center; - font-size: 20px; -} - -.qualityProfileId, -.metadataProfileId { - composes: cell; - - flex: 1 0 125px; -} - -.monitorNewItems, -.nextAlbum, -.lastAlbum, -.added, -.genres { - composes: cell; - - flex: 0 0 180px; -} - -.albumCount { - composes: cell; - - flex: 0 0 100px; -} - -.trackProgress { - composes: cell; - - display: flex; - justify-content: center; - flex: 0 0 150px; - flex-direction: column; -} - -.trackCount { - composes: cell; - - flex: 0 0 130px; -} - -.path { - composes: cell; - - flex: 1 0 150px; -} - -.sizeOnDisk { - composes: cell; - - flex: 0 0 120px; -} - -.ratings { - composes: cell from '~Components/Table/Cells/VirtualTableRowCell.css'; - - flex: 0 0 80px; -} - -.tags { - composes: cell; - - flex: 1 0 60px; -} - -.useSceneNumbering { - composes: cell; - - flex: 0 0 145px; -} - -.actions { - composes: cell; - - flex: 0 1 90px; - min-width: 60px; -} - -.checkInput { - composes: input from '~Components/Form/CheckInput.css'; - - margin-top: 0; -} diff --git a/frontend/src/Artist/Index/Table/ArtistIndexRow.css.d.ts b/frontend/src/Artist/Index/Table/ArtistIndexRow.css.d.ts deleted file mode 100644 index 4855aec75..000000000 --- a/frontend/src/Artist/Index/Table/ArtistIndexRow.css.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'actions': string; - 'added': string; - 'albumCount': string; - 'artistType': string; - 'banner': string; - 'bannerGrow': string; - 'bannerImage': string; - 'cell': string; - 'checkInput': string; - 'genres': string; - 'lastAlbum': string; - 'link': string; - 'metadataProfileId': string; - 'monitorNewItems': string; - 'nextAlbum': string; - 'overlayTitle': string; - 'path': string; - 'qualityProfileId': string; - 'ratings': string; - 'sizeOnDisk': string; - 'sortName': string; - 'status': string; - 'tags': string; - 'trackCount': string; - 'trackProgress': string; - 'useSceneNumbering': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Index/Table/ArtistIndexRow.tsx b/frontend/src/Artist/Index/Table/ArtistIndexRow.tsx deleted file mode 100644 index 0398f5502..000000000 --- a/frontend/src/Artist/Index/Table/ArtistIndexRow.tsx +++ /dev/null @@ -1,422 +0,0 @@ -import classNames from 'classnames'; -import React, { useCallback, useState } from 'react'; -import { useDispatch, useSelector } from 'react-redux'; -import AlbumTitleLink from 'Album/AlbumTitleLink'; -import { useSelect } from 'App/SelectContext'; -import { Statistics } from 'Artist/Artist'; -import ArtistBanner from 'Artist/ArtistBanner'; -import ArtistNameLink from 'Artist/ArtistNameLink'; -import DeleteArtistModal from 'Artist/Delete/DeleteArtistModal'; -import EditArtistModalConnector from 'Artist/Edit/EditArtistModalConnector'; -import createArtistIndexItemSelector from 'Artist/Index/createArtistIndexItemSelector'; -import ArtistIndexProgressBar from 'Artist/Index/ProgressBar/ArtistIndexProgressBar'; -import ArtistStatusCell from 'Artist/Index/Table/ArtistStatusCell'; -import { ARTIST_SEARCH, REFRESH_ARTIST } from 'Commands/commandNames'; -import HeartRating from 'Components/HeartRating'; -import IconButton from 'Components/Link/IconButton'; -import Link from 'Components/Link/Link'; -import SpinnerIconButton from 'Components/Link/SpinnerIconButton'; -import RelativeDateCellConnector from 'Components/Table/Cells/RelativeDateCellConnector'; -import VirtualTableRowCell from 'Components/Table/Cells/VirtualTableRowCell'; -import VirtualTableSelectCell from 'Components/Table/Cells/VirtualTableSelectCell'; -import Column from 'Components/Table/Column'; -import TagListConnector from 'Components/TagListConnector'; -import { icons } from 'Helpers/Props'; -import { executeCommand } from 'Store/Actions/commandActions'; -import { SelectStateInputProps } from 'typings/props'; -import formatBytes from 'Utilities/Number/formatBytes'; -import firstCharToUpper from 'Utilities/String/firstCharToUpper'; -import translate from 'Utilities/String/translate'; -import AlbumsCell from './AlbumsCell'; -import hasGrowableColumns from './hasGrowableColumns'; -import selectTableOptions from './selectTableOptions'; -import styles from './ArtistIndexRow.css'; - -interface ArtistIndexRowProps { - artistId: number; - sortKey: string; - columns: Column[]; - isSelectMode: boolean; -} - -function ArtistIndexRow(props: ArtistIndexRowProps) { - const { artistId, columns, isSelectMode } = props; - - const { - artist, - qualityProfile, - metadataProfile, - isRefreshingArtist, - isSearchingArtist, - } = useSelector(createArtistIndexItemSelector(props.artistId)); - - const { showBanners, showSearchAction } = useSelector(selectTableOptions); - - const { - artistName, - foreignArtistId, - monitored, - status, - path, - monitorNewItems, - nextAlbum, - lastAlbum, - added, - statistics = {} as Statistics, - images, - artistType, - genres = [], - ratings, - tags = [], - isSaving = false, - } = artist; - - const { - albumCount = 0, - trackCount = 0, - trackFileCount = 0, - totalTrackCount = 0, - sizeOnDisk = 0, - } = statistics; - - const dispatch = useDispatch(); - const [hasBannerError, setHasBannerError] = useState(false); - const [isEditArtistModalOpen, setIsEditArtistModalOpen] = useState(false); - const [isDeleteArtistModalOpen, setIsDeleteArtistModalOpen] = useState(false); - const [selectState, selectDispatch] = useSelect(); - - const onRefreshPress = useCallback(() => { - dispatch( - executeCommand({ - name: REFRESH_ARTIST, - artistId, - }) - ); - }, [artistId, dispatch]); - - const onSearchPress = useCallback(() => { - dispatch( - executeCommand({ - name: ARTIST_SEARCH, - artistId, - }) - ); - }, [artistId, dispatch]); - - const onBannerLoadError = useCallback(() => { - setHasBannerError(true); - }, [setHasBannerError]); - - const onBannerLoad = useCallback(() => { - setHasBannerError(false); - }, [setHasBannerError]); - - const onEditArtistPress = useCallback(() => { - setIsEditArtistModalOpen(true); - }, [setIsEditArtistModalOpen]); - - const onEditArtistModalClose = useCallback(() => { - setIsEditArtistModalOpen(false); - }, [setIsEditArtistModalOpen]); - - const onDeleteArtistPress = useCallback(() => { - setIsEditArtistModalOpen(false); - setIsDeleteArtistModalOpen(true); - }, [setIsDeleteArtistModalOpen]); - - const onDeleteArtistModalClose = useCallback(() => { - setIsDeleteArtistModalOpen(false); - }, [setIsDeleteArtistModalOpen]); - - const onSelectedChange = useCallback( - ({ id, value, shiftKey }: SelectStateInputProps) => { - selectDispatch({ - type: 'toggleSelected', - id, - isSelected: value, - shiftKey, - }); - }, - [selectDispatch] - ); - - return ( - <> - {isSelectMode ? ( - - ) : null} - - {columns.map((column) => { - const { name, isVisible } = column; - - if (!isVisible) { - return null; - } - - if (name === 'status') { - return ( - - ); - } - - if (name === 'sortName') { - return ( - - {showBanners ? ( - - - - {hasBannerError && ( -
{artistName}
- )} - - ) : ( - - )} -
- ); - } - - if (name === 'artistType') { - return ( - - {artistType} - - ); - } - - if (name === 'qualityProfileId') { - return ( - - {qualityProfile?.name ?? ''} - - ); - } - - if (name === 'metadataProfileId') { - return ( - - {metadataProfile?.name ?? ''} - - ); - } - - if (name === 'monitorNewItems') { - return ( - - {translate(firstCharToUpper(monitorNewItems))} - - ); - } - - if (name === 'nextAlbum') { - if (nextAlbum) { - return ( - - - - ); - } - return ( - - {translate('None')} - - ); - } - - if (name === 'lastAlbum') { - if (lastAlbum) { - return ( - - - - ); - } - return ( - - {translate('None')} - - ); - } - - if (name === 'added') { - return ( - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore ts(2739) - - ); - } - - if (name === 'albumCount') { - return ( - - ); - } - - if (name === 'trackProgress') { - return ( - - - - ); - } - - if (name === 'trackCount') { - return ( - - {totalTrackCount} - - ); - } - - if (name === 'path') { - return ( - - {path} - - ); - } - - if (name === 'sizeOnDisk') { - return ( - - {formatBytes(sizeOnDisk)} - - ); - } - - if (name === 'genres') { - const joinedGenres = genres.join(', '); - - return ( - - {joinedGenres} - - ); - } - - if (name === 'ratings') { - return ( - - - - ); - } - - if (name === 'tags') { - return ( - - - - ); - } - - if (name === 'actions') { - return ( - - - - {showSearchAction ? ( - - ) : null} - - - - ); - } - - return null; - })} - - - - - - ); -} - -export default ArtistIndexRow; diff --git a/frontend/src/Artist/Index/Table/ArtistIndexTable.css b/frontend/src/Artist/Index/Table/ArtistIndexTable.css deleted file mode 100644 index 0bfc5fec4..000000000 --- a/frontend/src/Artist/Index/Table/ArtistIndexTable.css +++ /dev/null @@ -1,11 +0,0 @@ -.tableScroller { - position: relative; -} - -.row { - transition: background-color 500ms; - - &:hover { - background-color: var(--tableRowHoverBackgroundColor); - } -} diff --git a/frontend/src/Artist/Index/Table/ArtistIndexTable.css.d.ts b/frontend/src/Artist/Index/Table/ArtistIndexTable.css.d.ts deleted file mode 100644 index ff35c263f..000000000 --- a/frontend/src/Artist/Index/Table/ArtistIndexTable.css.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'row': string; - 'tableScroller': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Index/Table/ArtistIndexTable.tsx b/frontend/src/Artist/Index/Table/ArtistIndexTable.tsx deleted file mode 100644 index c3c8044ce..000000000 --- a/frontend/src/Artist/Index/Table/ArtistIndexTable.tsx +++ /dev/null @@ -1,215 +0,0 @@ -import { throttle } from 'lodash'; -import React, { RefObject, useEffect, useMemo, useRef, useState } from 'react'; -import { useSelector } from 'react-redux'; -import { FixedSizeList as List, ListChildComponentProps } from 'react-window'; -import { createSelector } from 'reselect'; -import AppState from 'App/State/AppState'; -import Artist from 'Artist/Artist'; -import ArtistIndexRow from 'Artist/Index/Table/ArtistIndexRow'; -import ArtistIndexTableHeader from 'Artist/Index/Table/ArtistIndexTableHeader'; -import Scroller from 'Components/Scroller/Scroller'; -import Column from 'Components/Table/Column'; -import useMeasure from 'Helpers/Hooks/useMeasure'; -import ScrollDirection from 'Helpers/Props/ScrollDirection'; -import SortDirection from 'Helpers/Props/SortDirection'; -import dimensions from 'Styles/Variables/dimensions'; -import getIndexOfFirstCharacter from 'Utilities/Array/getIndexOfFirstCharacter'; -import selectTableOptions from './selectTableOptions'; -import styles from './ArtistIndexTable.css'; - -const bodyPadding = parseInt(dimensions.pageContentBodyPadding); -const bodyPaddingSmallScreen = parseInt( - dimensions.pageContentBodyPaddingSmallScreen -); - -interface RowItemData { - items: Artist[]; - sortKey: string; - columns: Column[]; - isSelectMode: boolean; -} - -interface ArtistIndexTableProps { - items: Artist[]; - sortKey: string; - sortDirection?: SortDirection; - jumpToCharacter?: string; - scrollTop?: number; - scrollerRef: RefObject; - isSelectMode: boolean; - isSmallScreen: boolean; -} - -const columnsSelector = createSelector( - (state: AppState) => state.artistIndex.columns, - (columns) => columns -); - -const Row: React.FC> = ({ - index, - style, - data, -}) => { - const { items, sortKey, columns, isSelectMode } = data; - - if (index >= items.length) { - return null; - } - - const artist = items[index]; - - return ( -
- -
- ); -}; - -function getWindowScrollTopPosition() { - return document.documentElement.scrollTop || document.body.scrollTop || 0; -} - -function ArtistIndexTable(props: ArtistIndexTableProps) { - const { - items, - sortKey, - sortDirection, - jumpToCharacter, - isSelectMode, - isSmallScreen, - scrollerRef, - } = props; - - const columns = useSelector(columnsSelector); - const { showBanners } = useSelector(selectTableOptions); - const listRef = useRef>(null); - const [measureRef, bounds] = useMeasure(); - const [size, setSize] = useState({ width: 0, height: 0 }); - const windowWidth = window.innerWidth; - const windowHeight = window.innerHeight; - - const rowHeight = useMemo(() => { - return showBanners ? 70 : 38; - }, [showBanners]); - - useEffect(() => { - const current = scrollerRef?.current as HTMLElement; - - if (isSmallScreen) { - setSize({ - width: windowWidth, - height: windowHeight, - }); - - return; - } - - if (current) { - const width = current.clientWidth; - const padding = - (isSmallScreen ? bodyPaddingSmallScreen : bodyPadding) - 5; - - setSize({ - width: width - padding * 2, - height: windowHeight, - }); - } - }, [isSmallScreen, windowWidth, windowHeight, scrollerRef, bounds]); - - useEffect(() => { - const currentScrollerRef = scrollerRef.current as HTMLElement; - const currentScrollListener = isSmallScreen ? window : currentScrollerRef; - - const handleScroll = throttle(() => { - const { offsetTop = 0 } = currentScrollerRef; - const scrollTop = - (isSmallScreen - ? getWindowScrollTopPosition() - : currentScrollerRef.scrollTop) - offsetTop; - - listRef.current?.scrollTo(scrollTop); - }, 10); - - currentScrollListener.addEventListener('scroll', handleScroll); - - return () => { - handleScroll.cancel(); - - if (currentScrollListener) { - currentScrollListener.removeEventListener('scroll', handleScroll); - } - }; - }, [isSmallScreen, listRef, scrollerRef]); - - useEffect(() => { - if (jumpToCharacter) { - const index = getIndexOfFirstCharacter(items, jumpToCharacter); - - if (index != null) { - let scrollTop = index * rowHeight; - - // If the offset is zero go to the top, otherwise offset - // by the approximate size of the header + padding (37 + 20). - if (scrollTop > 0) { - const offset = 57; - - scrollTop += offset; - } - - listRef.current?.scrollTo(scrollTop); - scrollerRef?.current?.scrollTo(0, scrollTop); - } - } - }, [jumpToCharacter, rowHeight, items, scrollerRef, listRef]); - - return ( -
- - - - ref={listRef} - style={{ - width: '100%', - height: '100%', - overflow: 'none', - }} - width={size.width} - height={size.height} - itemCount={items.length} - itemSize={rowHeight} - itemData={{ - items, - sortKey, - columns, - isSelectMode, - }} - > - {Row} - - -
- ); -} - -export default ArtistIndexTable; diff --git a/frontend/src/Artist/Index/Table/ArtistIndexTableHeader.css b/frontend/src/Artist/Index/Table/ArtistIndexTableHeader.css deleted file mode 100644 index 7ea4e94aa..000000000 --- a/frontend/src/Artist/Index/Table/ArtistIndexTableHeader.css +++ /dev/null @@ -1,97 +0,0 @@ -.status { - composes: headerCell from '~Components/Table/VirtualTableHeaderCell.css'; - - flex: 0 0 60px; -} - -.sortName { - composes: headerCell from '~Components/Table/VirtualTableHeaderCell.css'; - - flex: 4 0 110px; -} - -.banner { - flex: 0 0 379px; -} - -.bannerGrow { - flex-grow: 1; -} - -.artistType { - composes: headerCell from '~Components/Table/VirtualTableHeaderCell.css'; - - flex: 0 0 100px; -} - -.qualityProfileId, -.metadataProfileId { - composes: headerCell from '~Components/Table/VirtualTableHeaderCell.css'; - - flex: 1 0 125px; -} - -.monitorNewItems, -.nextAlbum, -.lastAlbum, -.added, -.genres { - composes: headerCell from '~Components/Table/VirtualTableHeaderCell.css'; - - flex: 0 0 180px; -} - -.albumCount { - composes: headerCell from '~Components/Table/VirtualTableHeaderCell.css'; - - flex: 0 0 100px; -} - -.trackProgress, -.latestAlbum { - composes: headerCell from '~Components/Table/VirtualTableHeaderCell.css'; - - flex: 0 0 150px; -} - -.trackCount { - composes: headerCell from '~Components/Table/VirtualTableHeaderCell.css'; - - flex: 0 0 130px; -} - -.path { - composes: headerCell from '~Components/Table/VirtualTableHeaderCell.css'; - - flex: 1 0 150px; -} - -.sizeOnDisk { - composes: headerCell from '~Components/Table/VirtualTableHeaderCell.css'; - - flex: 0 0 120px; -} - -.ratings { - composes: headerCell from '~Components/Table/VirtualTableHeaderCell.css'; - - flex: 0 0 80px; -} - -.tags { - composes: headerCell from '~Components/Table/VirtualTableHeaderCell.css'; - - flex: 1 0 60px; -} - -.useSceneNumbering { - composes: headerCell from '~Components/Table/VirtualTableHeaderCell.css'; - - flex: 0 0 145px; -} - -.actions { - composes: headerCell from '~Components/Table/VirtualTableHeaderCell.css'; - - flex: 0 1 90px; -} diff --git a/frontend/src/Artist/Index/Table/ArtistIndexTableHeader.css.d.ts b/frontend/src/Artist/Index/Table/ArtistIndexTableHeader.css.d.ts deleted file mode 100644 index 467b401bb..000000000 --- a/frontend/src/Artist/Index/Table/ArtistIndexTableHeader.css.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'actions': string; - 'added': string; - 'albumCount': string; - 'artistType': string; - 'banner': string; - 'bannerGrow': string; - 'genres': string; - 'lastAlbum': string; - 'latestAlbum': string; - 'metadataProfileId': string; - 'monitorNewItems': string; - 'nextAlbum': string; - 'path': string; - 'qualityProfileId': string; - 'ratings': string; - 'sizeOnDisk': string; - 'sortName': string; - 'status': string; - 'tags': string; - 'trackCount': string; - 'trackProgress': string; - 'useSceneNumbering': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Index/Table/ArtistIndexTableHeader.tsx b/frontend/src/Artist/Index/Table/ArtistIndexTableHeader.tsx deleted file mode 100644 index 1b325c225..000000000 --- a/frontend/src/Artist/Index/Table/ArtistIndexTableHeader.tsx +++ /dev/null @@ -1,121 +0,0 @@ -import classNames from 'classnames'; -import React, { useCallback } from 'react'; -import { useDispatch } from 'react-redux'; -import { useSelect } from 'App/SelectContext'; -import ArtistIndexTableOptions from 'Artist/Index/Table/ArtistIndexTableOptions'; -import IconButton from 'Components/Link/IconButton'; -import Column from 'Components/Table/Column'; -import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper'; -import VirtualTableHeader from 'Components/Table/VirtualTableHeader'; -import VirtualTableHeaderCell from 'Components/Table/VirtualTableHeaderCell'; -import VirtualTableSelectAllHeaderCell from 'Components/Table/VirtualTableSelectAllHeaderCell'; -import { icons } from 'Helpers/Props'; -import SortDirection from 'Helpers/Props/SortDirection'; -import { - setArtistSort, - setArtistTableOption, -} from 'Store/Actions/artistIndexActions'; -import { CheckInputChanged } from 'typings/inputs'; -import hasGrowableColumns from './hasGrowableColumns'; -import styles from './ArtistIndexTableHeader.css'; - -interface ArtistIndexTableHeaderProps { - showBanners: boolean; - columns: Column[]; - sortKey?: string; - sortDirection?: SortDirection; - isSelectMode: boolean; -} - -function ArtistIndexTableHeader(props: ArtistIndexTableHeaderProps) { - const { showBanners, columns, sortKey, sortDirection, isSelectMode } = props; - const dispatch = useDispatch(); - const [selectState, selectDispatch] = useSelect(); - - const onSortPress = useCallback( - (value: string) => { - dispatch(setArtistSort({ sortKey: value })); - }, - [dispatch] - ); - - const onTableOptionChange = useCallback( - (payload: unknown) => { - dispatch(setArtistTableOption(payload)); - }, - [dispatch] - ); - - const onSelectAllChange = useCallback( - ({ value }: CheckInputChanged) => { - selectDispatch({ - type: value ? 'selectAll' : 'unselectAll', - }); - }, - [selectDispatch] - ); - - return ( - - {isSelectMode ? ( - - ) : null} - - {columns.map((column) => { - const { name, label, isSortable, isVisible } = column; - - if (!isVisible) { - return null; - } - - if (name === 'actions') { - return ( - - - - - - ); - } - - return ( - - {typeof label === 'function' ? label() : label} - - ); - })} - - ); -} - -export default ArtistIndexTableHeader; diff --git a/frontend/src/Artist/Index/Table/ArtistIndexTableOptions.tsx b/frontend/src/Artist/Index/Table/ArtistIndexTableOptions.tsx deleted file mode 100644 index 9c10d859d..000000000 --- a/frontend/src/Artist/Index/Table/ArtistIndexTableOptions.tsx +++ /dev/null @@ -1,63 +0,0 @@ -import React, { Fragment, useCallback } from 'react'; -import { useSelector } from 'react-redux'; -import FormGroup from 'Components/Form/FormGroup'; -import FormInputGroup from 'Components/Form/FormInputGroup'; -import FormLabel from 'Components/Form/FormLabel'; -import { inputTypes } from 'Helpers/Props'; -import { CheckInputChanged } from 'typings/inputs'; -import translate from 'Utilities/String/translate'; -import selectTableOptions from './selectTableOptions'; - -interface ArtistIndexTableOptionsProps { - onTableOptionChange(...args: unknown[]): unknown; -} - -function ArtistIndexTableOptions(props: ArtistIndexTableOptionsProps) { - const { onTableOptionChange } = props; - - const tableOptions = useSelector(selectTableOptions); - - const { showBanners, showSearchAction } = tableOptions; - - const onTableOptionChangeWrapper = useCallback( - ({ name, value }: CheckInputChanged) => { - onTableOptionChange({ - tableOptions: { - ...tableOptions, - [name]: value, - }, - }); - }, - [tableOptions, onTableOptionChange] - ); - - return ( - - - {translate('ShowBanners')} - - - - - - {translate('ShowSearch')} - - - - - ); -} - -export default ArtistIndexTableOptions; diff --git a/frontend/src/Artist/Index/Table/ArtistStatusCell.css b/frontend/src/Artist/Index/Table/ArtistStatusCell.css deleted file mode 100644 index a4cb08a22..000000000 --- a/frontend/src/Artist/Index/Table/ArtistStatusCell.css +++ /dev/null @@ -1,17 +0,0 @@ -.status { - composes: cell from '~Components/Table/Cells/TableRowCell.css'; - - width: 60px; -} - -.monitorToggle { - composes: toggleButton from '~Components/MonitorToggleButton.css'; - - margin: 0; - width: 20px !important; -} - -.statusIcon { - width: 20px !important; - text-align: center; -} diff --git a/frontend/src/Artist/Index/Table/ArtistStatusCell.css.d.ts b/frontend/src/Artist/Index/Table/ArtistStatusCell.css.d.ts deleted file mode 100644 index eff3e0343..000000000 --- a/frontend/src/Artist/Index/Table/ArtistStatusCell.css.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'monitorToggle': string; - 'status': string; - 'statusIcon': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/Index/Table/ArtistStatusCell.tsx b/frontend/src/Artist/Index/Table/ArtistStatusCell.tsx deleted file mode 100644 index 00c7ae4c8..000000000 --- a/frontend/src/Artist/Index/Table/ArtistStatusCell.tsx +++ /dev/null @@ -1,75 +0,0 @@ -import React, { useCallback } from 'react'; -import { useDispatch } from 'react-redux'; -import Icon from 'Components/Icon'; -import MonitorToggleButton from 'Components/MonitorToggleButton'; -import VirtualTableRowCell from 'Components/Table/Cells/TableRowCell'; -import { icons } from 'Helpers/Props'; -import { toggleArtistMonitored } from 'Store/Actions/artistActions'; -import translate from 'Utilities/String/translate'; -import styles from './ArtistStatusCell.css'; - -interface ArtistStatusCellProps { - className: string; - artistId: number; - artistType?: string; - monitored: boolean; - status: string; - isSelectMode: boolean; - isSaving: boolean; - component?: React.ElementType; -} - -function ArtistStatusCell(props: ArtistStatusCellProps) { - const { - className, - artistId, - artistType, - monitored, - status, - isSelectMode, - isSaving, - component: Component = VirtualTableRowCell, - ...otherProps - } = props; - - const endedString = - artistType === 'Person' ? translate('Deceased') : translate('Inactive'); - const dispatch = useDispatch(); - - const onMonitoredPress = useCallback(() => { - dispatch(toggleArtistMonitored({ artistId, monitored: !monitored })); - }, [artistId, monitored, dispatch]); - - return ( - - {isSelectMode ? ( - - ) : ( - - )} - - - - ); -} - -export default ArtistStatusCell; diff --git a/frontend/src/Artist/Index/Table/hasGrowableColumns.ts b/frontend/src/Artist/Index/Table/hasGrowableColumns.ts deleted file mode 100644 index ed0cc6c58..000000000 --- a/frontend/src/Artist/Index/Table/hasGrowableColumns.ts +++ /dev/null @@ -1,11 +0,0 @@ -import Column from 'Components/Table/Column'; - -const growableColumns = ['qualityProfileId', 'path', 'tags']; - -export default function hasGrowableColumns(columns: Column[]) { - return columns.some((column) => { - const { name, isVisible } = column; - - return growableColumns.includes(name) && isVisible; - }); -} diff --git a/frontend/src/Artist/Index/Table/selectTableOptions.ts b/frontend/src/Artist/Index/Table/selectTableOptions.ts deleted file mode 100644 index b6a2a6a94..000000000 --- a/frontend/src/Artist/Index/Table/selectTableOptions.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { createSelector } from 'reselect'; -import AppState from 'App/State/AppState'; - -const selectTableOptions = createSelector( - (state: AppState) => state.artistIndex.tableOptions, - (tableOptions) => tableOptions -); - -export default selectTableOptions; diff --git a/frontend/src/Artist/Index/createArtistIndexItemSelector.ts b/frontend/src/Artist/Index/createArtistIndexItemSelector.ts deleted file mode 100644 index 4388a3aeb..000000000 --- a/frontend/src/Artist/Index/createArtistIndexItemSelector.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { createSelector } from 'reselect'; -import Artist from 'Artist/Artist'; -import Command from 'Commands/Command'; -import { ARTIST_SEARCH, REFRESH_ARTIST } from 'Commands/commandNames'; -import createArtistMetadataProfileSelector from 'Store/Selectors/createArtistMetadataProfileSelector'; -import createArtistQualityProfileSelector from 'Store/Selectors/createArtistQualityProfileSelector'; -import { createArtistSelectorForHook } from 'Store/Selectors/createArtistSelector'; -import createExecutingCommandsSelector from 'Store/Selectors/createExecutingCommandsSelector'; - -function createArtistIndexItemSelector(artistId: number) { - return createSelector( - createArtistSelectorForHook(artistId), - createArtistQualityProfileSelector(artistId), - createArtistMetadataProfileSelector(artistId), - createExecutingCommandsSelector(), - ( - artist: Artist, - qualityProfile, - metadataProfile, - executingCommands: Command[] - ) => { - const isRefreshingArtist = executingCommands.some((command) => { - return ( - command.name === REFRESH_ARTIST && command.body.artistId === artistId - ); - }); - - const isSearchingArtist = executingCommands.some((command) => { - return ( - command.name === ARTIST_SEARCH && command.body.artistId === artistId - ); - }); - - return { - artist, - qualityProfile, - metadataProfile, - isRefreshingArtist, - isSearchingArtist, - }; - } - ); -} - -export default createArtistIndexItemSelector; diff --git a/frontend/src/Artist/Index/createArtistQueueDetailsSelector.ts b/frontend/src/Artist/Index/createArtistQueueDetailsSelector.ts deleted file mode 100644 index 34a9c3910..000000000 --- a/frontend/src/Artist/Index/createArtistQueueDetailsSelector.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { createSelector } from 'reselect'; -import AppState from 'App/State/AppState'; - -export interface ArtistQueueDetails { - count: number; - tracksWithFiles: number; -} - -function createArtistQueueDetailsSelector(artistId: number) { - return createSelector( - (state: AppState) => state.queue.details.items, - (queueItems) => { - return queueItems.reduce( - (acc: ArtistQueueDetails, item) => { - if ( - item.trackedDownloadState === 'imported' || - item.artistId !== artistId - ) { - return acc; - } - - acc.count += item.trackFileCount ?? 0; - - if (item.trackHasFileCount) { - acc.tracksWithFiles += item.trackHasFileCount; - } - - return acc; - }, - { - count: 0, - tracksWithFiles: 0, - } - ); - } - ); -} - -export default createArtistQueueDetailsSelector; diff --git a/frontend/src/Artist/MonitoringOptions/MonitoringOptionModalConnector.js b/frontend/src/Artist/MonitoringOptions/MonitoringOptionModalConnector.js deleted file mode 100644 index 6ea9e8290..000000000 --- a/frontend/src/Artist/MonitoringOptions/MonitoringOptionModalConnector.js +++ /dev/null @@ -1,39 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import { connect } from 'react-redux'; -import { clearPendingChanges } from 'Store/Actions/baseActions'; -import MonitoringOptionsModal from './MonitoringOptionsModal'; - -const mapDispatchToProps = { - clearPendingChanges -}; - -class MonitoringOptionsModalConnector extends Component { - - // - // Listeners - - onModalClose = () => { - this.props.clearPendingChanges({ section: 'artist' }); - this.props.onModalClose(); - }; - - // - // Render - - render() { - return ( - - ); - } -} - -MonitoringOptionsModalConnector.propTypes = { - onModalClose: PropTypes.func.isRequired, - clearPendingChanges: PropTypes.func.isRequired -}; - -export default connect(undefined, mapDispatchToProps)(MonitoringOptionsModalConnector); diff --git a/frontend/src/Artist/MonitoringOptions/MonitoringOptionsModal.js b/frontend/src/Artist/MonitoringOptions/MonitoringOptionsModal.js deleted file mode 100644 index 4071e7f9a..000000000 --- a/frontend/src/Artist/MonitoringOptions/MonitoringOptionsModal.js +++ /dev/null @@ -1,25 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import Modal from 'Components/Modal/Modal'; -import MonitoringOptionsModalContentConnector from './MonitoringOptionsModalContentConnector'; - -function MonitoringOptionsModal({ isOpen, onModalClose, ...otherProps }) { - return ( - - - - ); -} - -MonitoringOptionsModal.propTypes = { - isOpen: PropTypes.bool.isRequired, - onModalClose: PropTypes.func.isRequired -}; - -export default MonitoringOptionsModal; diff --git a/frontend/src/Artist/MonitoringOptions/MonitoringOptionsModalContent.css b/frontend/src/Artist/MonitoringOptions/MonitoringOptionsModalContent.css deleted file mode 100644 index 3e9e3ffd0..000000000 --- a/frontend/src/Artist/MonitoringOptions/MonitoringOptionsModalContent.css +++ /dev/null @@ -1,9 +0,0 @@ -.labelIcon { - margin-left: 8px; -} - -.message { - composes: alert from '~Components/Alert.css'; - - margin-bottom: 30px; -} diff --git a/frontend/src/Artist/MonitoringOptions/MonitoringOptionsModalContent.css.d.ts b/frontend/src/Artist/MonitoringOptions/MonitoringOptionsModalContent.css.d.ts deleted file mode 100644 index af0f6cd46..000000000 --- a/frontend/src/Artist/MonitoringOptions/MonitoringOptionsModalContent.css.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'labelIcon': string; - 'message': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/MonitoringOptions/MonitoringOptionsModalContent.js b/frontend/src/Artist/MonitoringOptions/MonitoringOptionsModalContent.js deleted file mode 100644 index b1550d39e..000000000 --- a/frontend/src/Artist/MonitoringOptions/MonitoringOptionsModalContent.js +++ /dev/null @@ -1,156 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import ArtistMonitoringOptionsPopoverContent from 'AddArtist/ArtistMonitoringOptionsPopoverContent'; -import Alert from 'Components/Alert'; -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 Icon from 'Components/Icon'; -import Button from 'Components/Link/Button'; -import SpinnerButton from 'Components/Link/SpinnerButton'; -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 Popover from 'Components/Tooltip/Popover'; -import { icons, inputTypes, kinds, tooltipPositions } from 'Helpers/Props'; -import translate from 'Utilities/String/translate'; -import styles from './MonitoringOptionsModalContent.css'; - -const NO_CHANGE = 'noChange'; - -class MonitoringOptionsModalContent extends Component { - - // - // Lifecycle - - constructor(props, context) { - super(props, context); - - this.state = { - monitor: NO_CHANGE - }; - } - - componentDidUpdate(prevProps) { - const { - isSaving, - saveError - } = this.props; - - if (prevProps.isSaving && !isSaving && !saveError) { - this.setState({ - monitor: NO_CHANGE - }); - } - } - - onInputChange = ({ name, value }) => { - this.setState({ [name]: value }); - }; - - // - // Listeners - - onSavePress = () => { - const { - onSavePress - } = this.props; - const { - monitor - } = this.state; - - if (monitor !== NO_CHANGE) { - onSavePress({ monitor }); - } - }; - - // - // Render - - render() { - const { - isSaving, - onInputChange, - onModalClose, - ...otherProps - } = this.props; - - const { - monitor - } = this.state; - - return ( - - - {translate('MonitorArtist')} - - - - - {translate('MonitorAlbumExistingOnlyWarning')} - - -
- - - {translate('MonitorExistingAlbums')} - - - } - title={translate('MonitoringOptions')} - body={} - position={tooltipPositions.RIGHT} - /> - - - - -
-
- - - - - - {translate('Save')} - - -
- ); - } -} - -MonitoringOptionsModalContent.propTypes = { - artistId: PropTypes.number.isRequired, - saveError: PropTypes.object, - isSaving: PropTypes.bool.isRequired, - onInputChange: PropTypes.func.isRequired, - onSavePress: PropTypes.func.isRequired, - onModalClose: PropTypes.func.isRequired -}; - -MonitoringOptionsModalContent.defaultProps = { - isSaving: false -}; - -export default MonitoringOptionsModalContent; diff --git a/frontend/src/Artist/MonitoringOptions/MonitoringOptionsModalContentConnector.js b/frontend/src/Artist/MonitoringOptions/MonitoringOptionsModalContentConnector.js deleted file mode 100644 index 1901e1d21..000000000 --- a/frontend/src/Artist/MonitoringOptions/MonitoringOptionsModalContentConnector.js +++ /dev/null @@ -1,77 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import { connect } from 'react-redux'; -import { createSelector } from 'reselect'; -import { updateArtistsMonitor } from 'Store/Actions/artistActions'; -import MonitoringOptionsModalContent from './MonitoringOptionsModalContent'; - -function createMapStateToProps() { - return createSelector( - (state) => state.artist, - (artistState) => { - const { - isSaving, - saveError - } = artistState; - - return { - isSaving, - saveError - }; - } - ); -} - -const mapDispatchToProps = { - dispatchUpdateMonitoringOptions: updateArtistsMonitor -}; - -class MonitoringOptionsModalContentConnector extends Component { - - // - // Lifecycle - - componentDidUpdate(prevProps, prevState) { - if (prevProps.isSaving && !this.props.isSaving && !this.props.saveError) { - this.props.onModalClose(true); - } - } - - // - // Listeners - - onInputChange = ({ name, value }) => { - this.setState({ name, value }); - }; - - onSavePress = ({ monitor }) => { - this.props.dispatchUpdateMonitoringOptions({ - artistIds: [this.props.artistId], - monitor, - shouldFetchAlbumsAfterUpdate: true - }); - }; - - // - // Render - - render() { - return ( - - ); - } -} - -MonitoringOptionsModalContentConnector.propTypes = { - artistId: PropTypes.number.isRequired, - isSaving: PropTypes.bool.isRequired, - saveError: PropTypes.object, - dispatchUpdateMonitoringOptions: PropTypes.func.isRequired, - onModalClose: PropTypes.func.isRequired -}; - -export default connect(createMapStateToProps, mapDispatchToProps)(MonitoringOptionsModalContentConnector); diff --git a/frontend/src/Artist/MoveArtist/MoveArtistModal.css b/frontend/src/Artist/MoveArtist/MoveArtistModal.css deleted file mode 100644 index c1e247a50..000000000 --- a/frontend/src/Artist/MoveArtist/MoveArtistModal.css +++ /dev/null @@ -1,5 +0,0 @@ -.doNotMoveButton { - composes: button from '~Components/Link/Button.css'; - - margin-right: auto; -} diff --git a/frontend/src/Artist/MoveArtist/MoveArtistModal.css.d.ts b/frontend/src/Artist/MoveArtist/MoveArtistModal.css.d.ts deleted file mode 100644 index 0475f5a86..000000000 --- a/frontend/src/Artist/MoveArtist/MoveArtistModal.css.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'doNotMoveButton': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/MoveArtist/MoveArtistModal.js b/frontend/src/Artist/MoveArtist/MoveArtistModal.js deleted file mode 100644 index 1bad51151..000000000 --- a/frontend/src/Artist/MoveArtist/MoveArtistModal.js +++ /dev/null @@ -1,85 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import Button from 'Components/Link/Button'; -import Modal from 'Components/Modal/Modal'; -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 { kinds, sizes } from 'Helpers/Props'; -import styles from './MoveArtistModal.css'; - -function MoveArtistModal(props) { - const { - originalPath, - destinationPath, - destinationRootFolder, - isOpen, - onModalClose, - onSavePress, - onMoveArtistPress - } = props; - - if ( - isOpen && - !originalPath && - !destinationPath && - !destinationRootFolder - ) { - console.error('orginalPath and destinationPath OR destinationRootFolder must be provided'); - } - - return ( - - - - Move Files - - - - { - destinationRootFolder ? - `Would you like to move the artist folders to '${destinationRootFolder}'?` : - `Would you like to move the artist files from '${originalPath}' to '${destinationPath}'?` - } - - - - - - - - - - ); -} - -MoveArtistModal.propTypes = { - originalPath: PropTypes.string, - destinationPath: PropTypes.string, - destinationRootFolder: PropTypes.string, - isOpen: PropTypes.bool.isRequired, - onModalClose: PropTypes.func.isRequired, - onSavePress: PropTypes.func.isRequired, - onMoveArtistPress: PropTypes.func.isRequired -}; - -export default MoveArtistModal; diff --git a/frontend/src/Artist/NoArtist.css b/frontend/src/Artist/NoArtist.css deleted file mode 100644 index 38a01f391..000000000 --- a/frontend/src/Artist/NoArtist.css +++ /dev/null @@ -1,11 +0,0 @@ -.message { - margin-top: 10px; - margin-bottom: 30px; - text-align: center; - font-size: 20px; -} - -.buttonContainer { - margin-top: 20px; - text-align: center; -} diff --git a/frontend/src/Artist/NoArtist.css.d.ts b/frontend/src/Artist/NoArtist.css.d.ts deleted file mode 100644 index 054af6200..000000000 --- a/frontend/src/Artist/NoArtist.css.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'buttonContainer': string; - 'message': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Artist/NoArtist.js b/frontend/src/Artist/NoArtist.js deleted file mode 100644 index ec812fc84..000000000 --- a/frontend/src/Artist/NoArtist.js +++ /dev/null @@ -1,52 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import Button from 'Components/Link/Button'; -import { kinds } from 'Helpers/Props'; -import translate from 'Utilities/String/translate'; -import styles from './NoArtist.css'; - -function NoArtist(props) { - const { totalItems } = props; - - if (totalItems > 0) { - return ( -
-
- All artists are hidden due to the applied filter. -
-
- ); - } - - return ( -
-
- No artists found, to get started you'll want to add a new artist or album or add an existing library location (Root Folder) and update. -
- -
- -
- -
- -
-
- ); -} - -NoArtist.propTypes = { - totalItems: PropTypes.number.isRequired -}; - -export default NoArtist; diff --git a/frontend/src/Artist/Search/ArtistInteractiveSearchModal.js b/frontend/src/Artist/Search/ArtistInteractiveSearchModal.js deleted file mode 100644 index 9ce7e8f9a..000000000 --- a/frontend/src/Artist/Search/ArtistInteractiveSearchModal.js +++ /dev/null @@ -1,35 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import Modal from 'Components/Modal/Modal'; -import { sizes } from 'Helpers/Props'; -import ArtistInteractiveSearchModalContent from './ArtistInteractiveSearchModalContent'; - -function ArtistInteractiveSearchModal(props) { - const { - isOpen, - artistId, - onModalClose - } = props; - - return ( - - - - ); -} - -ArtistInteractiveSearchModal.propTypes = { - isOpen: PropTypes.bool.isRequired, - artistId: PropTypes.number.isRequired, - onModalClose: PropTypes.func.isRequired -}; - -export default ArtistInteractiveSearchModal; diff --git a/frontend/src/Artist/Search/ArtistInteractiveSearchModalConnector.js b/frontend/src/Artist/Search/ArtistInteractiveSearchModalConnector.js deleted file mode 100644 index 6706a27fa..000000000 --- a/frontend/src/Artist/Search/ArtistInteractiveSearchModalConnector.js +++ /dev/null @@ -1,59 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import { connect } from 'react-redux'; -import { cancelFetchReleases, clearReleases } from 'Store/Actions/releaseActions'; -import ArtistInteractiveSearchModal from './ArtistInteractiveSearchModal'; - -function createMapDispatchToProps(dispatch, props) { - return { - dispatchCancelFetchReleases() { - dispatch(cancelFetchReleases()); - }, - - dispatchClearReleases() { - dispatch(clearReleases()); - }, - - onModalClose() { - dispatch(cancelFetchReleases()); - dispatch(clearReleases()); - props.onModalClose(); - } - }; -} - -class ArtistInteractiveSearchModalConnector extends Component { - - // - // Lifecycle - - componentWillUnmount() { - this.props.dispatchCancelFetchReleases(); - this.props.dispatchClearReleases(); - } - - // - // Render - - render() { - const { - dispatchCancelFetchReleases, - dispatchClearReleases, - ...otherProps - } = this.props; - - return ( - - ); - } -} - -ArtistInteractiveSearchModalConnector.propTypes = { - ...ArtistInteractiveSearchModal.propTypes, - dispatchCancelFetchReleases: PropTypes.func.isRequired, - dispatchClearReleases: PropTypes.func.isRequired -}; - -export default connect(null, createMapDispatchToProps)(ArtistInteractiveSearchModalConnector); diff --git a/frontend/src/Artist/Search/ArtistInteractiveSearchModalContent.js b/frontend/src/Artist/Search/ArtistInteractiveSearchModalContent.js deleted file mode 100644 index 2a203499e..000000000 --- a/frontend/src/Artist/Search/ArtistInteractiveSearchModalContent.js +++ /dev/null @@ -1,45 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -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 InteractiveSearchConnector from 'InteractiveSearch/InteractiveSearchConnector'; - -function ArtistInteractiveSearchModalContent(props) { - const { - artistId, - onModalClose - } = props; - - return ( - - - Interactive Search - - - - - - - - - - - ); -} - -ArtistInteractiveSearchModalContent.propTypes = { - artistId: PropTypes.number.isRequired, - onModalClose: PropTypes.func.isRequired -}; - -export default ArtistInteractiveSearchModalContent; diff --git a/frontend/src/Calendar/Agenda/Agenda.css b/frontend/src/Calendar/Agenda/Agenda.css deleted file mode 100644 index 0304d9db5..000000000 --- a/frontend/src/Calendar/Agenda/Agenda.css +++ /dev/null @@ -1,3 +0,0 @@ -.agenda { - margin-top: 10px; -} diff --git a/frontend/src/Calendar/Agenda/Agenda.css.d.ts b/frontend/src/Calendar/Agenda/Agenda.css.d.ts deleted file mode 100644 index 44421cc99..000000000 --- a/frontend/src/Calendar/Agenda/Agenda.css.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'agenda': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Calendar/Agenda/Agenda.js b/frontend/src/Calendar/Agenda/Agenda.js deleted file mode 100644 index 33d02cd79..000000000 --- a/frontend/src/Calendar/Agenda/Agenda.js +++ /dev/null @@ -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 ( -
- { - items.map((item, index) => { - const momentDate = moment(item.releaseDate); - const showDate = index === 0 || - !moment(items[index - 1].releaseDate).isSame(momentDate, 'day'); - - return ( - - ); - }) - } -
- ); -} - -Agenda.propTypes = { - items: PropTypes.arrayOf(PropTypes.object).isRequired -}; - -export default Agenda; diff --git a/frontend/src/Calendar/Agenda/AgendaConnector.js b/frontend/src/Calendar/Agenda/AgendaConnector.js deleted file mode 100644 index b6f238873..000000000 --- a/frontend/src/Calendar/Agenda/AgendaConnector.js +++ /dev/null @@ -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); diff --git a/frontend/src/Calendar/Agenda/AgendaEvent.css b/frontend/src/Calendar/Agenda/AgendaEvent.css deleted file mode 100644 index a987a4b8c..000000000 --- a/frontend/src/Calendar/Agenda/AgendaEvent.css +++ /dev/null @@ -1,113 +0,0 @@ -.event { - display: flex; - overflow-x: hidden; - padding: 5px; - border-bottom: 1px solid var(--borderColor); - font-size: $defaultFontSize; - - &:hover { - background-color: var(--tableRowHoverBackgroundColor); - } -} - -.eventWrapper { - display: flex; - flex: 1 0 1px; - overflow-x: hidden; - padding-left: 6px; - border-left-width: 4px; - border-left-style: solid; -} - -.date { - flex: 0 0 250px; - font-weight: bold; -} - -.time { - flex: 0 0 125px; - margin-right: 10px; - border: none !important; -} - -.artistName, -.albumTitle { - @add-mixin truncate; - - flex: 0 1 300px; - margin-right: 10px; -} - -.albumTitle { - flex: 1 1 1px; -} - -.seasonEpisodeNumber { - flex: 0 0 100px; -} - -.albumSeparator { - display: none; -} - -.absoluteEpisodeNumber { - margin-left: 3px; -} - -/* - * Status - */ - -.downloaded { - composes: downloaded from '~Calendar/Events/CalendarEvent.css'; -} - -.partial { - composes: partial from '~Calendar/Events/CalendarEvent.css'; -} - -.downloading { - composes: downloading from '~Calendar/Events/CalendarEvent.css'; -} - -.unmonitored { - composes: unmonitored from '~Calendar/Events/CalendarEvent.css'; -} - -.missing { - composes: missing from '~Calendar/Events/CalendarEvent.css'; -} - -.unreleased { - composes: unreleased from '~Calendar/Events/CalendarEvent.css'; -} - -@media only screen and (max-width: $breakpointSmall) { - .event { - flex-direction: column; - } - - .eventWrapper { - display: block; - flex: 0 0 auto; - } - - .date { - margin-left: 10px; - } - - .date, - .time, - .artistName { - flex: 0 0 100%; - } - - .seasonEpisodeNumber { - flex: 0 0 auto; - } - - .albumSeparator { - display: inline-block; - margin: 0 5px; - } -} diff --git a/frontend/src/Calendar/Agenda/AgendaEvent.css.d.ts b/frontend/src/Calendar/Agenda/AgendaEvent.css.d.ts deleted file mode 100644 index 5bf39a6de..000000000 --- a/frontend/src/Calendar/Agenda/AgendaEvent.css.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'absoluteEpisodeNumber': string; - 'albumSeparator': string; - 'albumTitle': string; - 'artistName': string; - 'date': string; - 'downloaded': string; - 'downloading': string; - 'event': string; - 'eventWrapper': string; - 'missing': string; - 'partial': string; - 'seasonEpisodeNumber': string; - 'time': string; - 'unmonitored': string; - 'unreleased': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Calendar/Agenda/AgendaEvent.js b/frontend/src/Calendar/Agenda/AgendaEvent.js deleted file mode 100644 index d21b1aaa2..000000000 --- a/frontend/src/Calendar/Agenda/AgendaEvent.js +++ /dev/null @@ -1,146 +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 { icons } from 'Helpers/Props'; -import formatTime from 'Utilities/Date/formatTime'; -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, - artist, - title, - foreignAlbumId, - releaseDate, - monitored, - statistics, - grabbed, - queueItem, - showDate, - timeFormat, - longDateFormat, - colorImpairedMode - } = this.props; - - const startTime = moment(releaseDate); - // const endTime = startTime.add(artist.runtime, 'minutes'); - const downloading = !!(queueItem || grabbed); - const isMonitored = artist.monitored && monitored; - const statusStyle = getStatusStyle(id, downloading, startTime, isMonitored, statistics.percentOfTracks); - - return ( -
- -
- { - showDate && - startTime.format(longDateFormat) - } -
- -
- -
- {formatTime(releaseDate, timeFormat)} -
- -
- - {artist.artistName} - -
- -
-
- -
- - {title} - -
- - { - !!queueItem && - - } - - { - !queueItem && grabbed && - - } - -
- ); - } -} - -AgendaEvent.propTypes = { - id: PropTypes.number.isRequired, - artist: PropTypes.object.isRequired, - title: PropTypes.string.isRequired, - foreignAlbumId: PropTypes.string.isRequired, - albumType: PropTypes.string.isRequired, - releaseDate: PropTypes.string.isRequired, - monitored: PropTypes.bool.isRequired, - statistics: PropTypes.object.isRequired, - grabbed: PropTypes.bool, - queueItem: PropTypes.object, - showDate: PropTypes.bool.isRequired, - timeFormat: PropTypes.string.isRequired, - colorImpairedMode: PropTypes.bool.isRequired, - longDateFormat: PropTypes.string.isRequired -}; - -AgendaEvent.defaultProps = { - statistics: { - percentOfTracks: 0 - } -}; - -export default AgendaEvent; diff --git a/frontend/src/Calendar/Agenda/AgendaEventConnector.js b/frontend/src/Calendar/Agenda/AgendaEventConnector.js deleted file mode 100644 index b0ab00f1b..000000000 --- a/frontend/src/Calendar/Agenda/AgendaEventConnector.js +++ /dev/null @@ -1,25 +0,0 @@ -import { connect } from 'react-redux'; -import { createSelector } from 'reselect'; -import createArtistSelector from 'Store/Selectors/createArtistSelector'; -import createQueueItemSelector from 'Store/Selectors/createQueueItemSelector'; -import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector'; -import AgendaEvent from './AgendaEvent'; - -function createMapStateToProps() { - return createSelector( - createArtistSelector(), - createQueueItemSelector(), - createUISettingsSelector(), - (artist, queueItem, uiSettings) => { - return { - artist, - queueItem, - timeFormat: uiSettings.timeFormat, - longDateFormat: uiSettings.longDateFormat, - colorImpairedMode: uiSettings.enableColorImpairedMode - }; - } - ); -} - -export default connect(createMapStateToProps)(AgendaEvent); diff --git a/frontend/src/Calendar/Calendar.css b/frontend/src/Calendar/Calendar.css deleted file mode 100644 index 37e6ff618..000000000 --- a/frontend/src/Calendar/Calendar.css +++ /dev/null @@ -1,8 +0,0 @@ -.calendar { - flex-grow: 1; - width: 100%; -} - -.calendarContent { - width: 100%; -} diff --git a/frontend/src/Calendar/Calendar.css.d.ts b/frontend/src/Calendar/Calendar.css.d.ts deleted file mode 100644 index 503034402..000000000 --- a/frontend/src/Calendar/Calendar.css.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'calendar': string; - 'calendarContent': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Calendar/Calendar.js b/frontend/src/Calendar/Calendar.js deleted file mode 100644 index a0b22f92f..000000000 --- a/frontend/src/Calendar/Calendar.js +++ /dev/null @@ -1,69 +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 ( -
- { - isFetching && !isPopulated && - - } - - { - !isFetching && !!error && - - {translate('UnableToLoadTheCalendar')} - - } - - { - !error && isPopulated && view === calendarViews.AGENDA && -
- - -
- } - - { - !error && isPopulated && view !== calendarViews.AGENDA && -
- - - -
- } -
- ); - } -} - -Calendar.propTypes = { - isFetching: PropTypes.bool.isRequired, - isPopulated: PropTypes.bool.isRequired, - error: PropTypes.object, - view: PropTypes.string.isRequired -}; - -export default Calendar; diff --git a/frontend/src/Calendar/CalendarConnector.js b/frontend/src/Calendar/CalendarConnector.js deleted file mode 100644 index 17221eb34..000000000 --- a/frontend/src/Calendar/CalendarConnector.js +++ /dev/null @@ -1,174 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import { connect } from 'react-redux'; -import { createSelector } from 'reselect'; -import * as calendarActions from 'Store/Actions/calendarActions'; -import { clearQueueDetails, fetchQueueDetails } from 'Store/Actions/queueActions'; -import { clearTrackFiles, fetchTrackFiles } from 'Store/Actions/trackFileActions'; -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, - (calendar) => { - return calendar; - } - ); -} - -const mapDispatchToProps = { - ...calendarActions, - fetchTrackFiles, - clearTrackFiles, - 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, ['trackFileUpdated', 'trackFileDeleted']); - - if (useCurrentPage) { - fetchCalendar(); - } else { - gotoCalendarToday(); - } - - this.scheduleUpdate(); - } - - componentDidUpdate(prevProps) { - const { - items, - time - } = this.props; - - if (hasDifferentItems(prevProps.items, items)) { - const albumIds = selectUniqueIds(items, 'id'); - // const trackFileIds = selectUniqueIds(items, 'trackFileId'); - - if (items.length) { - this.props.fetchQueueDetails({ albumIds }); - } - - // if (trackFileIds.length) { - // this.props.fetchTrackFiles({ trackFileIds }); - // } - } - - if (prevProps.time !== time) { - this.scheduleUpdate(); - } - } - - componentWillUnmount() { - unregisterPagePopulator(this.repopulate); - this.props.clearCalendar(); - this.props.clearQueueDetails(); - this.props.clearTrackFiles(); - 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 ( - - ); - } -} - -CalendarConnector.propTypes = { - useCurrentPage: PropTypes.bool.isRequired, - time: PropTypes.string, - view: PropTypes.string.isRequired, - items: PropTypes.arrayOf(PropTypes.object).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, - fetchTrackFiles: PropTypes.func.isRequired, - clearTrackFiles: PropTypes.func.isRequired, - fetchQueueDetails: PropTypes.func.isRequired, - clearQueueDetails: PropTypes.func.isRequired -}; - -export default connect(createMapStateToProps, mapDispatchToProps)(CalendarConnector); diff --git a/frontend/src/Calendar/CalendarFilterModal.tsx b/frontend/src/Calendar/CalendarFilterModal.tsx deleted file mode 100644 index e26b2928b..000000000 --- a/frontend/src/Calendar/CalendarFilterModal.tsx +++ /dev/null @@ -1,54 +0,0 @@ -import React, { useCallback } from 'react'; -import { useDispatch, useSelector } from 'react-redux'; -import { createSelector } from 'reselect'; -import AppState from 'App/State/AppState'; -import FilterModal from 'Components/Filter/FilterModal'; -import { setCalendarFilter } from 'Store/Actions/calendarActions'; - -function createCalendarSelector() { - return createSelector( - (state: AppState) => state.calendar.items, - (calendar) => { - return calendar; - } - ); -} - -function createFilterBuilderPropsSelector() { - return createSelector( - (state: AppState) => state.calendar.filterBuilderProps, - (filterBuilderProps) => { - return filterBuilderProps; - } - ); -} - -interface CalendarFilterModalProps { - isOpen: boolean; -} - -export default function CalendarFilterModal(props: CalendarFilterModalProps) { - const sectionItems = useSelector(createCalendarSelector()); - const filterBuilderProps = useSelector(createFilterBuilderPropsSelector()); - const customFilterType = 'calendar'; - - const dispatch = useDispatch(); - - const dispatchSetFilter = useCallback( - (payload: unknown) => { - dispatch(setCalendarFilter(payload)); - }, - [dispatch] - ); - - return ( - - ); -} diff --git a/frontend/src/Calendar/CalendarPage.css b/frontend/src/Calendar/CalendarPage.css deleted file mode 100644 index b6839c467..000000000 --- a/frontend/src/Calendar/CalendarPage.css +++ /dev/null @@ -1,20 +0,0 @@ -.calendarPageBody { - composes: contentBody from '~Components/Page/PageContentBody.css'; - - display: flex; -} - -.calendarInnerPageBody { - composes: innerContentBody from '~Components/Page/PageContentBody.css'; - - display: flex; - flex-direction: column; - flex-grow: 1; - width: 100%; -} - -.errorMessage { - margin-top: 20px; - text-align: center; - font-size: 20px; -} diff --git a/frontend/src/Calendar/CalendarPage.css.d.ts b/frontend/src/Calendar/CalendarPage.css.d.ts deleted file mode 100644 index 943329132..000000000 --- a/frontend/src/Calendar/CalendarPage.css.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'calendarInnerPageBody': string; - 'calendarPageBody': string; - 'errorMessage': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Calendar/CalendarPage.js b/frontend/src/Calendar/CalendarPage.js deleted file mode 100644 index bf7f46c10..000000000 --- a/frontend/src/Calendar/CalendarPage.js +++ /dev/null @@ -1,225 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import NoArtist from 'Artist/NoArtist'; -import LoadingIndicator from 'Components/Loading/LoadingIndicator'; -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 getErrorMessage from 'Utilities/Object/getErrorMessage'; -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 { - missingAlbumIds, - onSearchMissingPress - } = this.props; - - onSearchMissingPress(missingAlbumIds); - }; - - // - // Render - - render() { - const { - selectedFilterKey, - filters, - customFilters, - hasArtist, - artistError, - artistIsFetching, - artistIsPopulated, - missingAlbumIds, - isRssSyncExecuting, - isSearchingForMissing, - useCurrentPage, - onRssSyncPress, - onFilterSelect - } = this.props; - - const { - isCalendarLinkModalOpen, - isOptionsModalOpen - } = this.state; - - const isMeasured = this.state.width > 0; - - return ( - - - - - - - - - - - - - - - - - - - - - { - artistIsFetching && !artistIsPopulated && - - } - - { - artistError && -
- {getErrorMessage(artistError, 'Failed to load artist from API')} -
- } - - { - !artistError && artistIsPopulated && hasArtist && - - { - isMeasured ? - : -
- } - - } - - { - !artistError && artistIsPopulated && !hasArtist && - - } - - { - hasArtist && !!artistError && - - } - - - - - - - - ); - } -} - -CalendarPage.propTypes = { - selectedFilterKey: PropTypes.string.isRequired, - filters: PropTypes.arrayOf(PropTypes.object).isRequired, - customFilters: PropTypes.arrayOf(PropTypes.object).isRequired, - hasArtist: PropTypes.bool.isRequired, - artistError: PropTypes.object, - artistIsFetching: PropTypes.bool.isRequired, - artistIsPopulated: PropTypes.bool.isRequired, - missingAlbumIds: 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; diff --git a/frontend/src/Calendar/CalendarPageConnector.js b/frontend/src/Calendar/CalendarPageConnector.js deleted file mode 100644 index 4221c0339..000000000 --- a/frontend/src/Calendar/CalendarPageConnector.js +++ /dev/null @@ -1,120 +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 createArtistCountSelector from 'Store/Selectors/createArtistCountSelector'; -import { createCustomFiltersSelector } from 'Store/Selectors/createClientSideCollectionSelector'; -import createCommandExecutingSelector from 'Store/Selectors/createCommandExecutingSelector'; -import createCommandsSelector from 'Store/Selectors/createCommandsSelector'; -import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector'; -import { isCommandExecuting } from 'Utilities/Command'; -import isBefore from 'Utilities/Date/isBefore'; -import CalendarPage from './CalendarPage'; - -function createMissingAlbumIdsSelector() { - return createSelector( - (state) => state.calendar.start, - (state) => state.calendar.end, - (state) => state.calendar.items, - (state) => state.queue.details.items, - (start, end, albums, queueDetails) => { - return albums.reduce((acc, album) => { - const releaseDate = album.releaseDate; - - if ( - album.percentOfTracks < 100 && - moment(releaseDate).isAfter(start) && - moment(releaseDate).isBefore(end) && - isBefore(album.releaseDate) && - !queueDetails.some((details) => !!details.album && details.album.id === album.id) - ) { - acc.push(album.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'), - createArtistCountSelector(), - createUISettingsSelector(), - createMissingAlbumIdsSelector(), - createCommandExecutingSelector(commandNames.RSS_SYNC), - createIsSearchingSelector(), - ( - selectedFilterKey, - filters, - customFilters, - artistCount, - uiSettings, - missingAlbumIds, - isRssSyncExecuting, - isSearchingForMissing - ) => { - return { - selectedFilterKey, - filters, - customFilters, - colorImpairedMode: uiSettings.enableColorImpairedMode, - hasArtist: !!artistCount.count, - artistError: artistCount.error, - artistIsFetching: artistCount.isFetching, - artistIsPopulated: artistCount.isPopulated, - missingAlbumIds, - isRssSyncExecuting, - isSearchingForMissing - }; - } - ); -} - -function createMapDispatchToProps(dispatch, props) { - return { - onRssSyncPress() { - dispatch(executeCommand({ - name: commandNames.RSS_SYNC - })); - }, - - onSearchMissingPress(albumIds) { - dispatch(searchMissing({ albumIds })); - }, - - onDaysCountChange(dayCount) { - dispatch(setCalendarDaysCount({ dayCount })); - }, - - onFilterSelect(selectedFilterKey) { - dispatch(setCalendarFilter({ selectedFilterKey })); - } - }; -} - -export default withCurrentPage( - connect(createMapStateToProps, createMapDispatchToProps)(CalendarPage) -); diff --git a/frontend/src/Calendar/Day/CalendarDay.css b/frontend/src/Calendar/Day/CalendarDay.css deleted file mode 100644 index 22d1b1ccf..000000000 --- a/frontend/src/Calendar/Day/CalendarDay.css +++ /dev/null @@ -1,25 +0,0 @@ -.day { - flex: 1 0 14.28%; - overflow: hidden; - min-height: 70px; - border-bottom: 1px solid var(--calendarBorderColor); - border-left: 1px solid var(--calendarBorderColor); -} - -.isSingleDay { - width: 100%; -} - -.dayOfMonth { - padding-right: 5px; - border-bottom: 1px solid var(--calendarBorderColor); - text-align: right; -} - -.isToday { - background-color: var(--calendarTodayBackgroundColor); -} - -.isDifferentMonth { - color: var(--disabledColor); -} diff --git a/frontend/src/Calendar/Day/CalendarDay.css.d.ts b/frontend/src/Calendar/Day/CalendarDay.css.d.ts deleted file mode 100644 index f32def3dd..000000000 --- a/frontend/src/Calendar/Day/CalendarDay.css.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'day': string; - 'dayOfMonth': string; - 'isDifferentMonth': string; - 'isSingleDay': string; - 'isToday': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Calendar/Day/CalendarDay.js b/frontend/src/Calendar/Day/CalendarDay.js deleted file mode 100644 index 50bf9fc92..000000000 --- a/frontend/src/Calendar/Day/CalendarDay.js +++ /dev/null @@ -1,63 +0,0 @@ -import classNames from 'classnames'; -import moment from 'moment'; -import PropTypes from 'prop-types'; -import React from 'react'; -import * as calendarViews from 'Calendar/calendarViews'; -import CalendarEventConnector from 'Calendar/Events/CalendarEventConnector'; -import styles from './CalendarDay.css'; - -function CalendarDay(props) { - const { - date, - time, - isTodaysDate, - events, - view, - onEventModalOpenToggle - } = props; - - return ( -
- { - view === calendarViews.MONTH && -
- {moment(date).date()} -
- } -
- { - events.map((event) => { - return ( - - ); - }) - } -
-
- ); -} - -CalendarDay.propTypes = { - date: PropTypes.string.isRequired, - time: PropTypes.string.isRequired, - isTodaysDate: PropTypes.bool.isRequired, - events: PropTypes.arrayOf(PropTypes.object).isRequired, - view: PropTypes.string.isRequired, - onEventModalOpenToggle: PropTypes.func.isRequired -}; - -export default CalendarDay; diff --git a/frontend/src/Calendar/Day/CalendarDayConnector.js b/frontend/src/Calendar/Day/CalendarDayConnector.js deleted file mode 100644 index 6206ef4c6..000000000 --- a/frontend/src/Calendar/Day/CalendarDayConnector.js +++ /dev/null @@ -1,55 +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 createCalendarEventsConnector() { - return createSelector( - (state, { date }) => date, - (state) => state.calendar.items, - (date, items) => { - const filtered = _.filter(items, (item) => { - return moment(date).isSame(moment(item.releaseDate), 'day'); - }); - - return _.sortBy(filtered, (item) => moment(item.releaseDate).unix()); - } - ); -} - -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 ( - - ); - } -} - -CalendarDayConnector.propTypes = { - date: PropTypes.string.isRequired -}; - -export default connect(createMapStateToProps)(CalendarDayConnector); diff --git a/frontend/src/Calendar/Day/CalendarDays.css b/frontend/src/Calendar/Day/CalendarDays.css deleted file mode 100644 index 507dd0ede..000000000 --- a/frontend/src/Calendar/Day/CalendarDays.css +++ /dev/null @@ -1,14 +0,0 @@ -.days { - display: flex; - border-right: 1px solid var(--calendarBorderColor); -} - -.day, -.week, -.forecast { - flex-wrap: nowrap; -} - -.month { - flex-wrap: wrap; -} diff --git a/frontend/src/Calendar/Day/CalendarDays.css.d.ts b/frontend/src/Calendar/Day/CalendarDays.css.d.ts deleted file mode 100644 index ae3e7aebc..000000000 --- a/frontend/src/Calendar/Day/CalendarDays.css.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'day': string; - 'days': string; - 'forecast': string; - 'month': string; - 'week': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Calendar/Day/CalendarDays.js b/frontend/src/Calendar/Day/CalendarDays.js deleted file mode 100644 index f2bb4c8d4..000000000 --- a/frontend/src/Calendar/Day/CalendarDays.js +++ /dev/null @@ -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 ( -
- { - dates.map((date) => { - return ( - - ); - }) - } -
- ); - } -} - -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; diff --git a/frontend/src/Calendar/Day/CalendarDaysConnector.js b/frontend/src/Calendar/Day/CalendarDaysConnector.js deleted file mode 100644 index 0acce70b9..000000000 --- a/frontend/src/Calendar/Day/CalendarDaysConnector.js +++ /dev/null @@ -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); diff --git a/frontend/src/Calendar/Day/DayOfWeek.css b/frontend/src/Calendar/Day/DayOfWeek.css deleted file mode 100644 index 2d31a30be..000000000 --- a/frontend/src/Calendar/Day/DayOfWeek.css +++ /dev/null @@ -1,13 +0,0 @@ -.dayOfWeek { - flex: 1 0 14.28%; - background-color: var(--calendarBackgroundColor); - text-align: center; -} - -.isSingleDay { - width: 100%; -} - -.isToday { - background-color: var(--calendarTodayBackgroundColor); -} diff --git a/frontend/src/Calendar/Day/DayOfWeek.css.d.ts b/frontend/src/Calendar/Day/DayOfWeek.css.d.ts deleted file mode 100644 index a377e4a8e..000000000 --- a/frontend/src/Calendar/Day/DayOfWeek.css.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'dayOfWeek': string; - 'isSingleDay': string; - 'isToday': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Calendar/Day/DayOfWeek.js b/frontend/src/Calendar/Day/DayOfWeek.js deleted file mode 100644 index 39e40fce8..000000000 --- a/frontend/src/Calendar/Day/DayOfWeek.js +++ /dev/null @@ -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 ( -
- {formatedDate} -
- ); - } -} - -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; diff --git a/frontend/src/Calendar/Day/DaysOfWeek.css b/frontend/src/Calendar/Day/DaysOfWeek.css deleted file mode 100644 index 518664633..000000000 --- a/frontend/src/Calendar/Day/DaysOfWeek.css +++ /dev/null @@ -1,4 +0,0 @@ -.daysOfWeek { - display: flex; - margin-top: 10px; -} diff --git a/frontend/src/Calendar/Day/DaysOfWeek.css.d.ts b/frontend/src/Calendar/Day/DaysOfWeek.css.d.ts deleted file mode 100644 index 5bc224b68..000000000 --- a/frontend/src/Calendar/Day/DaysOfWeek.css.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'daysOfWeek': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Calendar/Day/DaysOfWeek.js b/frontend/src/Calendar/Day/DaysOfWeek.js deleted file mode 100644 index 9f94b1079..000000000 --- a/frontend/src/Calendar/Day/DaysOfWeek.js +++ /dev/null @@ -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 ( -
- { - dates.map((date) => { - return ( - - ); - }) - } -
- ); - } -} - -DaysOfWeek.propTypes = { - dates: PropTypes.arrayOf(PropTypes.string), - view: PropTypes.string.isRequired -}; - -export default DaysOfWeek; diff --git a/frontend/src/Calendar/Day/DaysOfWeekConnector.js b/frontend/src/Calendar/Day/DaysOfWeekConnector.js deleted file mode 100644 index 7f5cdef19..000000000 --- a/frontend/src/Calendar/Day/DaysOfWeekConnector.js +++ /dev/null @@ -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); diff --git a/frontend/src/Calendar/Events/CalendarEvent.css b/frontend/src/Calendar/Events/CalendarEvent.css deleted file mode 100644 index b317c72ce..000000000 --- a/frontend/src/Calendar/Events/CalendarEvent.css +++ /dev/null @@ -1,93 +0,0 @@ -$fullColorGradient: rgba(244, 245, 246, 0.2); - -.event { - overflow-x: hidden; - margin: 4px 2px; - padding: 5px; - border-bottom: 1px solid var(--calendarBorderColor); - border-left: 4px solid var(--calendarBorderColor); - font-size: 12px; - - &:global(.colorImpaired) { - border-left-width: 5px; - } -} - -.info, -.albumInfo { - display: flex; -} - -.artistName, -.albumTitle { - @add-mixin truncate; - - flex: 1 0 1px; - margin-right: 10px; -} - -.artistName { - color: var(--calendarTextDimAlternate); - font-size: $defaultFontSize; -} - -.absoluteEpisodeNumber { - margin-left: 3px; -} - -.statusIcon { - margin-left: 3px; -} - -/* - * Status - */ - -.downloaded { - border-left-color: var(--successColor) !important; - - &:global(.colorImpaired) { - border-left-color: color(#27c24c saturation(+15%)) !important; - } -} - -.downloading { - border-left-color: var(--purple) !important; - - &:global(.fullColor) { - background-color: rgba(122, 67, 182, 0.4) !important; - } -} - -.unmonitored { - border-left-color: var(--gray) !important; - - &:global(.fullColor) { - background-color: rgba(173, 173, 173, 0.5) !important; - } - - &:global(.colorImpaired) { - background: repeating-linear-gradient(45deg, var(--colorImpairedGradientDark), var(--colorImpairedGradientDark) 5px, var(--colorImpairedGradient) 5px, var(--colorImpairedGradient) 10px); - } - - &:global(.fullColor.colorImpaired) { - background: repeating-linear-gradient(45deg, $fullColorGradient, $fullColorGradient 5px, transparent 5px, transparent 10px); - } -} - -.missing { - border-left-color: var(--dangerColor) !important; - - &:global(.colorImpaired) { - border-left-color: color(#f05050 saturation(+15%)) !important; - background: repeating-linear-gradient(90deg, var(--colorImpairedGradientDark), var(--colorImpairedGradientDark) 5px, var(--colorImpairedGradient) 5px, var(--colorImpairedGradient) 10px); - } -} - -.unreleased { - border-left-color: var(--primaryColor) !important; - - &:global(.colorImpaired) { - background: repeating-linear-gradient(90deg, var(--colorImpairedGradientDark), var(--colorImpairedGradientDark) 5px, var(--colorImpairedGradient) 5px, var(--colorImpairedGradient) 10px); - } -} diff --git a/frontend/src/Calendar/Events/CalendarEvent.css.d.ts b/frontend/src/Calendar/Events/CalendarEvent.css.d.ts deleted file mode 100644 index 61bc8c539..000000000 --- a/frontend/src/Calendar/Events/CalendarEvent.css.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'absoluteEpisodeNumber': string; - 'albumInfo': string; - 'albumTitle': string; - 'artistName': string; - 'downloaded': string; - 'downloading': string; - 'event': string; - 'info': string; - 'missing': string; - 'statusIcon': string; - 'unmonitored': string; - 'unreleased': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Calendar/Events/CalendarEvent.js b/frontend/src/Calendar/Events/CalendarEvent.js deleted file mode 100644 index 115314b92..000000000 --- a/frontend/src/Calendar/Events/CalendarEvent.js +++ /dev/null @@ -1,140 +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 { icons } from 'Helpers/Props'; -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, - artist, - title, - foreignAlbumId, - releaseDate, - monitored, - statistics, - grabbed, - queueItem, - // timeFormat, - colorImpairedMode - } = this.props; - - if (!artist) { - return null; - } - - const startTime = moment(releaseDate); - // const endTime = startTime.add(artist.runtime, 'minutes'); - const downloading = !!(queueItem || grabbed); - const isMonitored = artist.monitored && monitored; - const statusStyle = getStatusStyle(id, downloading, startTime, isMonitored, statistics.percentOfTracks); - - return ( -
- -
-
- - {artist.artistName} - -
- - { - !!queueItem && - - - - } - - { - !queueItem && grabbed && - - } -
- -
-
- - {title} - -
-
- -
- ); - } -} - -CalendarEvent.propTypes = { - id: PropTypes.number.isRequired, - artist: PropTypes.object.isRequired, - title: PropTypes.string.isRequired, - foreignAlbumId: PropTypes.string.isRequired, - statistics: PropTypes.object.isRequired, - releaseDate: PropTypes.string.isRequired, - monitored: PropTypes.bool.isRequired, - grabbed: PropTypes.bool, - queueItem: PropTypes.object, - // timeFormat: PropTypes.string.isRequired, - colorImpairedMode: PropTypes.bool.isRequired, - onEventModalOpenToggle: PropTypes.func.isRequired -}; - -CalendarEvent.defaultProps = { - statistics: { - percentOfTracks: 0 - } -}; - -export default CalendarEvent; diff --git a/frontend/src/Calendar/Events/CalendarEventConnector.js b/frontend/src/Calendar/Events/CalendarEventConnector.js deleted file mode 100644 index 31706e2f7..000000000 --- a/frontend/src/Calendar/Events/CalendarEventConnector.js +++ /dev/null @@ -1,24 +0,0 @@ -import { connect } from 'react-redux'; -import { createSelector } from 'reselect'; -import createArtistSelector from 'Store/Selectors/createArtistSelector'; -import createQueueItemSelector from 'Store/Selectors/createQueueItemSelector'; -import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector'; -import CalendarEvent from './CalendarEvent'; - -function createMapStateToProps() { - return createSelector( - createArtistSelector(), - createQueueItemSelector(), - createUISettingsSelector(), - (artist, queueItem, uiSettings) => { - return { - artist, - queueItem, - timeFormat: uiSettings.timeFormat, - colorImpairedMode: uiSettings.enableColorImpairedMode - }; - } - ); -} - -export default connect(createMapStateToProps)(CalendarEvent); diff --git a/frontend/src/Calendar/Events/CalendarEventQueueDetails.js b/frontend/src/Calendar/Events/CalendarEventQueueDetails.js deleted file mode 100644 index 5df7e8ea4..000000000 --- a/frontend/src/Calendar/Events/CalendarEventQueueDetails.js +++ /dev/null @@ -1,56 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import QueueDetails from 'Activity/Queue/QueueDetails'; -import CircularProgressBar from 'Components/CircularProgressBar'; -import translate from 'Utilities/String/translate'; - -function CalendarEventQueueDetails(props) { - const { - title, - size, - sizeleft, - estimatedCompletionTime, - status, - trackedDownloadState, - trackedDownloadStatus, - errorMessage - } = props; - - const progress = size ? (100 - sizeleft / size * 100) : 0; - - return ( - - -
- } - /> - ); -} - -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, - errorMessage: PropTypes.string -}; - -export default CalendarEventQueueDetails; diff --git a/frontend/src/Calendar/Header/CalendarHeader.css b/frontend/src/Calendar/Header/CalendarHeader.css deleted file mode 100644 index 4b6915406..000000000 --- a/frontend/src/Calendar/Header/CalendarHeader.css +++ /dev/null @@ -1,53 +0,0 @@ -.header { - display: flex; -} - -.navigationButtons { - flex: 1 1 33%; - text-align: left; -} - -.todayButton { - composes: button from '~Components/Link/Button.css'; - - margin-left: 5px; -} - -.titleDesktop, -.titleMobile { - text-align: center; - font-size: 18px; -} - -.titleMobile { - margin-bottom: 5px; -} - -.viewButtonsContainer { - display: flex; - justify-content: flex-end; - flex: 1 1 33%; -} - -.viewMenu { - composes: menu from '~Components/Menu/Menu.css'; - - line-height: 31px; -} - -.loading { - composes: loading from '~Components/Loading/LoadingIndicator.css'; - - margin-top: 5px; - margin-right: 10px; -} - -@media only screen and (max-width: $breakpointSmall) { - .navigationButtons { - flex: 1 0 50%; - } - - .viewButtonsContainer { - flex: 0 0 100px; - } -} diff --git a/frontend/src/Calendar/Header/CalendarHeader.css.d.ts b/frontend/src/Calendar/Header/CalendarHeader.css.d.ts deleted file mode 100644 index 700b53652..000000000 --- a/frontend/src/Calendar/Header/CalendarHeader.css.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'header': string; - 'loading': string; - 'navigationButtons': string; - 'titleDesktop': string; - 'titleMobile': string; - 'todayButton': string; - 'viewButtonsContainer': string; - 'viewMenu': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Calendar/Header/CalendarHeader.js b/frontend/src/Calendar/Header/CalendarHeader.js deleted file mode 100644 index 24b397eb4..000000000 --- a/frontend/src/Calendar/Header/CalendarHeader.js +++ /dev/null @@ -1,268 +0,0 @@ -/* eslint max-params: 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 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 '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 ( -
- { - isSmallScreen && -
- {title} -
- } - -
-
- - - - - -
- - { - !isSmallScreen && -
- {title} -
- } - -
- { - isFetching && - - } - - { - collapseViewButtons ? - - - - - - - { - isSmallScreen ? - null : - - Month - - } - - - Week - - - - Forecast - - - - Day - - - - Agenda - - - : - -
- - - - - - - - - -
- } -
-
-
- ); - } -} - -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; diff --git a/frontend/src/Calendar/Header/CalendarHeaderConnector.js b/frontend/src/Calendar/Header/CalendarHeaderConnector.js deleted file mode 100644 index 616e48650..000000000 --- a/frontend/src/Calendar/Header/CalendarHeaderConnector.js +++ /dev/null @@ -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 ( - - ); - } -} - -CalendarHeaderConnector.propTypes = { - setCalendarView: PropTypes.func.isRequired, - gotoCalendarToday: PropTypes.func.isRequired, - gotoCalendarPreviousRange: PropTypes.func.isRequired, - gotoCalendarNextRange: PropTypes.func.isRequired -}; - -export default connect(createMapStateToProps, mapDispatchToProps)(CalendarHeaderConnector); diff --git a/frontend/src/Calendar/Header/CalendarHeaderViewButton.js b/frontend/src/Calendar/Header/CalendarHeaderViewButton.js deleted file mode 100644 index 98958af03..000000000 --- a/frontend/src/Calendar/Header/CalendarHeaderViewButton.js +++ /dev/null @@ -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 ( - - ); - } -} - -CalendarHeaderViewButton.propTypes = { - view: PropTypes.oneOf(calendarViews.all).isRequired, - selectedView: PropTypes.oneOf(calendarViews.all).isRequired, - onPress: PropTypes.func.isRequired -}; - -export default CalendarHeaderViewButton; diff --git a/frontend/src/Calendar/Legend/Legend.css b/frontend/src/Calendar/Legend/Legend.css deleted file mode 100644 index 296cbd9d5..000000000 --- a/frontend/src/Calendar/Legend/Legend.css +++ /dev/null @@ -1,6 +0,0 @@ -.legend { - display: flex; - flex-wrap: wrap; - margin-top: 10px; - padding: 3px 0; -} diff --git a/frontend/src/Calendar/Legend/Legend.css.d.ts b/frontend/src/Calendar/Legend/Legend.css.d.ts deleted file mode 100644 index 19c0339b4..000000000 --- a/frontend/src/Calendar/Legend/Legend.css.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'legend': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Calendar/Legend/Legend.js b/frontend/src/Calendar/Legend/Legend.js deleted file mode 100644 index 88ddc82c7..000000000 --- a/frontend/src/Calendar/Legend/Legend.js +++ /dev/null @@ -1,91 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import { icons, kinds } from 'Helpers/Props'; -import LegendIconItem from './LegendIconItem'; -import LegendItem from './LegendItem'; -import styles from './Legend.css'; - -function Legend(props) { - const { - showCutoffUnmetIcon, - colorImpairedMode - } = props; - - const iconsToShow = []; - - if (showCutoffUnmetIcon) { - iconsToShow.push( - - ); - } - - return ( -
-
- - - -
- -
- - - -
- -
- - - -
- -
- {iconsToShow[0]} -
- - { - iconsToShow.length > 1 && -
- {iconsToShow[1]} - {iconsToShow[2]} -
- } -
- ); -} - -Legend.propTypes = { - showCutoffUnmetIcon: PropTypes.bool.isRequired, - colorImpairedMode: PropTypes.bool.isRequired -}; - -export default Legend; diff --git a/frontend/src/Calendar/Legend/LegendConnector.js b/frontend/src/Calendar/Legend/LegendConnector.js deleted file mode 100644 index 30bbc4adb..000000000 --- a/frontend/src/Calendar/Legend/LegendConnector.js +++ /dev/null @@ -1,19 +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, - createUISettingsSelector(), - (calendarOptions, uiSettings) => { - return { - ...calendarOptions, - colorImpairedMode: uiSettings.enableColorImpairedMode - }; - } - ); -} - -export default connect(createMapStateToProps)(Legend); diff --git a/frontend/src/Calendar/Legend/LegendIconItem.css b/frontend/src/Calendar/Legend/LegendIconItem.css deleted file mode 100644 index 01db0ba5a..000000000 --- a/frontend/src/Calendar/Legend/LegendIconItem.css +++ /dev/null @@ -1,10 +0,0 @@ -.legendIconItem { - margin: 3px 0; - margin-right: 6px; - width: 150px; - cursor: default; -} - -.icon { - margin-right: 5px; -} diff --git a/frontend/src/Calendar/Legend/LegendIconItem.css.d.ts b/frontend/src/Calendar/Legend/LegendIconItem.css.d.ts deleted file mode 100644 index 5d618d24b..000000000 --- a/frontend/src/Calendar/Legend/LegendIconItem.css.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'icon': string; - 'legendIconItem': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Calendar/Legend/LegendIconItem.js b/frontend/src/Calendar/Legend/LegendIconItem.js deleted file mode 100644 index 13e106784..000000000 --- a/frontend/src/Calendar/Legend/LegendIconItem.js +++ /dev/null @@ -1,37 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import Icon from 'Components/Icon'; -import styles from './LegendIconItem.css'; - -function LegendIconItem(props) { - const { - name, - icon, - kind, - tooltip - } = props; - - return ( -
- - - {name} -
- ); -} - -LegendIconItem.propTypes = { - name: PropTypes.string.isRequired, - icon: PropTypes.object.isRequired, - kind: PropTypes.string.isRequired, - tooltip: PropTypes.string.isRequired -}; - -export default LegendIconItem; diff --git a/frontend/src/Calendar/Legend/LegendItem.css b/frontend/src/Calendar/Legend/LegendItem.css deleted file mode 100644 index 82e16c543..000000000 --- a/frontend/src/Calendar/Legend/LegendItem.css +++ /dev/null @@ -1,41 +0,0 @@ -.legendItem { - margin: 3px 0; - margin-right: 6px; - padding-left: 5px; - width: 150px; - border-left-width: 4px; - border-left-style: solid; - cursor: default; -} - -/* - * Status - */ - -.downloaded { - composes: downloaded from '~Calendar/Events/CalendarEvent.css'; -} - -.partial { - composes: partial from '~Calendar/Events/CalendarEvent.css'; -} - -.downloading { - composes: downloading from '~Calendar/Events/CalendarEvent.css'; -} - -.unmonitored { - composes: unmonitored from '~Calendar/Events/CalendarEvent.css'; -} - -.onAir { - composes: onAir from '~Calendar/Events/CalendarEvent.css'; -} - -.missing { - composes: missing from '~Calendar/Events/CalendarEvent.css'; -} - -.unreleased { - composes: unreleased from '~Calendar/Events/CalendarEvent.css'; -} diff --git a/frontend/src/Calendar/Legend/LegendItem.css.d.ts b/frontend/src/Calendar/Legend/LegendItem.css.d.ts deleted file mode 100644 index 954aafd90..000000000 --- a/frontend/src/Calendar/Legend/LegendItem.css.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'downloaded': string; - 'downloading': string; - 'legendItem': string; - 'missing': string; - 'onAir': string; - 'partial': string; - 'unmonitored': string; - 'unreleased': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Calendar/Legend/LegendItem.js b/frontend/src/Calendar/Legend/LegendItem.js deleted file mode 100644 index 5da15baba..000000000 --- a/frontend/src/Calendar/Legend/LegendItem.js +++ /dev/null @@ -1,36 +0,0 @@ -import classNames from 'classnames'; -import PropTypes from 'prop-types'; -import React from 'react'; -import titleCase from 'Utilities/String/titleCase'; -import styles from './LegendItem.css'; - -function LegendItem(props) { - const { - name, - status, - tooltip, - colorImpairedMode - } = props; - - return ( -
- {name ? name : titleCase(status)} -
- ); -} - -LegendItem.propTypes = { - name: PropTypes.string, - status: PropTypes.string.isRequired, - tooltip: PropTypes.string.isRequired, - colorImpairedMode: PropTypes.bool.isRequired -}; - -export default LegendItem; diff --git a/frontend/src/Calendar/Options/CalendarOptionsModal.js b/frontend/src/Calendar/Options/CalendarOptionsModal.js deleted file mode 100644 index b68c83f30..000000000 --- a/frontend/src/Calendar/Options/CalendarOptionsModal.js +++ /dev/null @@ -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 ( - - - - ); -} - -CalendarOptionsModal.propTypes = { - isOpen: PropTypes.bool.isRequired, - onModalClose: PropTypes.func.isRequired -}; - -export default CalendarOptionsModal; diff --git a/frontend/src/Calendar/Options/CalendarOptionsModalContent.js b/frontend/src/Calendar/Options/CalendarOptionsModalContent.js deleted file mode 100644 index a291570bb..000000000 --- a/frontend/src/Calendar/Options/CalendarOptionsModalContent.js +++ /dev/null @@ -1,229 +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 - } = props; - - this.state = { - firstDayOfWeek, - calendarWeekColumnHeader, - timeFormat, - enableColorImpairedMode - }; - } - - 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 { - collapseMultipleAlbums, - showCutoffUnmetIcon, - onModalClose - } = this.props; - - const { - firstDayOfWeek, - calendarWeekColumnHeader, - timeFormat, - enableColorImpairedMode - } = this.state; - - return ( - - - Calendar Options - - - -
-
- - - {translate('CollapseMultipleAlbums')} - - - - - - - - {translate('IconForCutoffUnmet')} - - - - -
-
- -
-
- - - {translate('FirstDayOfWeek')} - - - - - - - - {translate('WeekColumnHeader')} - - - - - - - - {translate('TimeFormat')} - - - - - - {translate('EnableColorImpairedMode')} - - - - - -
-
-
- - - - -
- ); - } -} - -CalendarOptionsModalContent.propTypes = { - collapseMultipleAlbums: PropTypes.bool.isRequired, - showCutoffUnmetIcon: PropTypes.bool.isRequired, - firstDayOfWeek: PropTypes.number.isRequired, - calendarWeekColumnHeader: PropTypes.string.isRequired, - timeFormat: PropTypes.string.isRequired, - enableColorImpairedMode: PropTypes.bool.isRequired, - dispatchSetCalendarOption: PropTypes.func.isRequired, - dispatchSaveUISettings: PropTypes.func.isRequired, - onModalClose: PropTypes.func.isRequired -}; - -export default CalendarOptionsModalContent; diff --git a/frontend/src/Calendar/Options/CalendarOptionsModalContentConnector.js b/frontend/src/Calendar/Options/CalendarOptionsModalContentConnector.js deleted file mode 100644 index 1f517b698..000000000 --- a/frontend/src/Calendar/Options/CalendarOptionsModalContentConnector.js +++ /dev/null @@ -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); diff --git a/frontend/src/Calendar/calendarViews.js b/frontend/src/Calendar/calendarViews.js deleted file mode 100644 index 929958b66..000000000 --- a/frontend/src/Calendar/calendarViews.js +++ /dev/null @@ -1,7 +0,0 @@ -export const DAY = 'day'; -export const WEEK = 'week'; -export const MONTH = 'month'; -export const FORECAST = 'forecast'; -export const AGENDA = 'agenda'; - -export const all = [DAY, WEEK, MONTH, FORECAST, AGENDA]; diff --git a/frontend/src/Calendar/getStatusStyle.js b/frontend/src/Calendar/getStatusStyle.js deleted file mode 100644 index c02ae0ee5..000000000 --- a/frontend/src/Calendar/getStatusStyle.js +++ /dev/null @@ -1,30 +0,0 @@ -/* eslint max-params: 0 */ -import moment from 'moment'; - -function getStatusStyle(episodeNumber, downloading, startTime, isMonitored, percentOfTracks) { - const currentTime = moment(); - - if (percentOfTracks === 100) { - return 'downloaded'; - } - - if (percentOfTracks > 0) { - return 'partial'; - } - - if (downloading) { - return 'downloading'; - } - - if (!isMonitored) { - return 'unmonitored'; - } - - if (currentTime.isAfter(startTime)) { - return 'missing'; - } - - return 'unreleased'; -} - -export default getStatusStyle; diff --git a/frontend/src/Calendar/iCal/CalendarLinkModal.js b/frontend/src/Calendar/iCal/CalendarLinkModal.js deleted file mode 100644 index 8cc487c16..000000000 --- a/frontend/src/Calendar/iCal/CalendarLinkModal.js +++ /dev/null @@ -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 ( - - - - ); -} - -CalendarLinkModal.propTypes = { - isOpen: PropTypes.bool.isRequired, - onModalClose: PropTypes.func.isRequired -}; - -export default CalendarLinkModal; diff --git a/frontend/src/Calendar/iCal/CalendarLinkModalContent.js b/frontend/src/Calendar/iCal/CalendarLinkModalContent.js deleted file mode 100644 index 3473f4c31..000000000 --- a/frontend/src/Calendar/iCal/CalendarLinkModalContent.js +++ /dev/null @@ -1,224 +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, - pastDays, - futureDays, - tags - } = state; - - let icalUrl = `${window.location.host}${window.Lidarr.urlBase}/feed/v1/calendar/Lidarr.ics?`; - - if (unmonitored) { - icalUrl += 'unmonitored=true&'; - } - - if (tags.length) { - icalUrl += `tags=${tags.toString()}&`; - } - - icalUrl += `pastDays=${pastDays}&futureDays=${futureDays}&apikey=${encodeURIComponent(window.Lidarr.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, - pastDays: 7, - futureDays: 28, - 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, - pastDays, - futureDays, - tags, - iCalHttpUrl, - iCalWebCalUrl - } = this.state; - - return ( - - - Lidarr Calendar Feed - - - -
- - - {translate('IncludeUnmonitored')} - - - - - - - - {translate('PastDays')} - - - - - - - - {translate('FutureDays')} - - - - - - - - {translate('Tags')} - - - - - - - - {translate('ICalFeed')} - - - , - - - - - ]} - onChange={this.onInputChange} - onFocus={this.onLinkFocus} - /> - -
-
- - - - -
- ); - } -} - -CalendarLinkModalContent.propTypes = { - tagList: PropTypes.arrayOf(PropTypes.object).isRequired, - onModalClose: PropTypes.func.isRequired -}; - -export default CalendarLinkModalContent; diff --git a/frontend/src/Calendar/iCal/CalendarLinkModalContentConnector.js b/frontend/src/Calendar/iCal/CalendarLinkModalContentConnector.js deleted file mode 100644 index e10c5c3f9..000000000 --- a/frontend/src/Calendar/iCal/CalendarLinkModalContentConnector.js +++ /dev/null @@ -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); diff --git a/frontend/src/Commands/Command.ts b/frontend/src/Commands/Command.ts deleted file mode 100644 index 09a03865d..000000000 --- a/frontend/src/Commands/Command.ts +++ /dev/null @@ -1,38 +0,0 @@ -import ModelBase from 'App/ModelBase'; - -export interface CommandBody { - sendUpdatesToClient: boolean; - updateScheduledTask: boolean; - completionMessage: string; - requiresDiskAccess: boolean; - isExclusive: boolean; - isLongRunning: boolean; - name: string; - lastExecutionTime: string; - lastStartTime: string; - trigger: string; - suppressMessages: boolean; - artistId?: number; - artistIds?: number[]; -} - -interface Command extends ModelBase { - name: string; - commandName: string; - message: string; - body: CommandBody; - priority: string; - status: string; - result: string; - queued: string; - started: string; - ended: string; - duration: string; - trigger: string; - stateChangeTime: string; - sendUpdatesToClient: boolean; - updateScheduledTask: boolean; - lastExecutionTime: string; -} - -export default Command; diff --git a/frontend/src/Commands/commandNames.js b/frontend/src/Commands/commandNames.js deleted file mode 100644 index b8ee54956..000000000 --- a/frontend/src/Commands/commandNames.js +++ /dev/null @@ -1,24 +0,0 @@ -export const APPLICATION_UPDATE = 'ApplicationUpdate'; -export const BACKUP = 'Backup'; -export const REFRESH_MONITORED_DOWNLOADS = 'RefreshMonitoredDownloads'; -export const CLEAR_BLOCKLIST = 'ClearBlocklist'; -export const CLEAR_LOGS = 'ClearLog'; -export const CUTOFF_UNMET_ALBUM_SEARCH = 'CutoffUnmetAlbumSearch'; -export const DELETE_LOG_FILES = 'DeleteLogFiles'; -export const DELETE_UPDATE_LOG_FILES = 'DeleteUpdateLogFiles'; -export const DOWNLOADED_ALBUMS_SCAN = 'DownloadedAlbumsScan'; -export const ALBUM_SEARCH = 'AlbumSearch'; -export const INTERACTIVE_IMPORT = 'ManualImport'; -export const MISSING_ALBUM_SEARCH = 'MissingAlbumSearch'; -export const MOVE_ARTIST = 'MoveArtist'; -export const REFRESH_ARTIST = 'RefreshArtist'; -export const RENAME_FILES = 'RenameFiles'; -export const RENAME_ARTIST = 'RenameArtist'; -export const RESCAN_FOLDERS = 'RescanFolders'; -export const RETAG_FILES = 'RetagFiles'; -export const RETAG_ARTIST = 'RetagArtist'; -export const RESET_API_KEY = 'ResetApiKey'; -export const RESET_QUALITY_DEFINITIONS = 'ResetQualityDefinitions'; -export const RSS_SYNC = 'RssSync'; -export const SEASON_SEARCH = 'AlbumSearch'; -export const ARTIST_SEARCH = 'ArtistSearch'; diff --git a/frontend/src/Components/Alert.css b/frontend/src/Components/Alert.css deleted file mode 100644 index 135d1ee2b..000000000 --- a/frontend/src/Components/Alert.css +++ /dev/null @@ -1,31 +0,0 @@ -.alert { - display: block; - margin: 5px; - padding: 15px; - border: 1px solid transparent; - border-radius: 4px; -} - -.danger { - border-color: var(--alertDangerBorderColor); - background-color: var(--alertDangerBackgroundColor); - color: var(--alertDangerColor); -} - -.info { - border-color: var(--alertInfoBorderColor); - background-color: var(--alertInfoBackgroundColor); - color: var(--alertInfoColor); -} - -.success { - border-color: var(--alertSuccessBorderColor); - background-color: var(--alertSuccessBackgroundColor); - color: var(--alertSuccessColor); -} - -.warning { - border-color: var(--alertWarningBorderColor); - background-color: var(--alertWarningBackgroundColor); - color: var(--alertWarningColor); -} diff --git a/frontend/src/Components/Alert.css.d.ts b/frontend/src/Components/Alert.css.d.ts deleted file mode 100644 index daffec2e6..000000000 --- a/frontend/src/Components/Alert.css.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'alert': string; - 'danger': string; - 'info': string; - 'success': string; - 'warning': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Components/Alert.js b/frontend/src/Components/Alert.js deleted file mode 100644 index 418cbf5e6..000000000 --- a/frontend/src/Components/Alert.js +++ /dev/null @@ -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 ( -
- {children} -
- ); -} - -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; diff --git a/frontend/src/Components/Card.css b/frontend/src/Components/Card.css deleted file mode 100644 index 49a9abd76..000000000 --- a/frontend/src/Components/Card.css +++ /dev/null @@ -1,19 +0,0 @@ -.card { - position: relative; - margin: 10px; - padding: 10px; - border-radius: 3px; - background-color: var(--cardBackgroundColor); - box-shadow: 0 0 10px 1px var(--cardShadowColor); - color: var(--defaultColor); -} - -.underlay { - @add-mixin cover; -} - -.overlay { - @add-mixin linkOverlay; - - position: relative; -} diff --git a/frontend/src/Components/Card.css.d.ts b/frontend/src/Components/Card.css.d.ts deleted file mode 100644 index fb3ea792e..000000000 --- a/frontend/src/Components/Card.css.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'card': string; - 'overlay': string; - 'underlay': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Components/Card.js b/frontend/src/Components/Card.js deleted file mode 100644 index c5a4d164c..000000000 --- a/frontend/src/Components/Card.js +++ /dev/null @@ -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 ( -
- - -
- {children} -
-
- ); - } - - return ( - - {children} - - ); - } -} - -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; diff --git a/frontend/src/Components/CircularProgressBar.css b/frontend/src/Components/CircularProgressBar.css deleted file mode 100644 index 32b349404..000000000 --- a/frontend/src/Components/CircularProgressBar.css +++ /dev/null @@ -1,21 +0,0 @@ -.circularProgressBarContainer { - position: relative; - display: inline-block; - vertical-align: top; - text-align: center; -} - -.circularProgressBar { - position: absolute; - top: 0; - left: 0; - transform: rotate(-90deg); - transform-origin: center center; -} - -.circularProgressBarText { - position: absolute; - width: 100%; - height: 100%; - font-weight: bold; -} diff --git a/frontend/src/Components/CircularProgressBar.css.d.ts b/frontend/src/Components/CircularProgressBar.css.d.ts deleted file mode 100644 index 45179620c..000000000 --- a/frontend/src/Components/CircularProgressBar.css.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'circularProgressBar': string; - 'circularProgressBarContainer': string; - 'circularProgressBarText': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Components/CircularProgressBar.js b/frontend/src/Components/CircularProgressBar.js deleted file mode 100644 index 6fc47aed9..000000000 --- a/frontend/src/Components/CircularProgressBar.js +++ /dev/null @@ -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 ( -
- - - - - { - showProgressText && -
- {progressText} -
- } -
- ); - } -} - -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: '#00A65B', - showProgressText: false -}; - -export default CircularProgressBar; diff --git a/frontend/src/Components/DescriptionList/DescriptionList.css b/frontend/src/Components/DescriptionList/DescriptionList.css deleted file mode 100644 index 230347f80..000000000 --- a/frontend/src/Components/DescriptionList/DescriptionList.css +++ /dev/null @@ -1,4 +0,0 @@ -.descriptionList { - margin-top: 0; - margin-bottom: 0; -} diff --git a/frontend/src/Components/DescriptionList/DescriptionList.css.d.ts b/frontend/src/Components/DescriptionList/DescriptionList.css.d.ts deleted file mode 100644 index 34c1578a4..000000000 --- a/frontend/src/Components/DescriptionList/DescriptionList.css.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'descriptionList': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Components/DescriptionList/DescriptionList.js b/frontend/src/Components/DescriptionList/DescriptionList.js deleted file mode 100644 index be2c87c55..000000000 --- a/frontend/src/Components/DescriptionList/DescriptionList.js +++ /dev/null @@ -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 ( -
- {children} -
- ); - } -} - -DescriptionList.propTypes = { - className: PropTypes.string.isRequired, - children: PropTypes.node -}; - -DescriptionList.defaultProps = { - className: styles.descriptionList -}; - -export default DescriptionList; diff --git a/frontend/src/Components/DescriptionList/DescriptionListItem.js b/frontend/src/Components/DescriptionList/DescriptionListItem.js deleted file mode 100644 index 931557045..000000000 --- a/frontend/src/Components/DescriptionList/DescriptionListItem.js +++ /dev/null @@ -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 ( -
- - {title} - - - - {data} - -
- ); - } -} - -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; diff --git a/frontend/src/Components/DescriptionList/DescriptionListItemDescription.css b/frontend/src/Components/DescriptionList/DescriptionListItemDescription.css deleted file mode 100644 index 786123fb7..000000000 --- a/frontend/src/Components/DescriptionList/DescriptionListItemDescription.css +++ /dev/null @@ -1,11 +0,0 @@ -.description { - margin-left: 0; - line-height: $lineHeight; - overflow-wrap: break-word; -} - -@media (min-width: 768px) { - .description { - margin-left: 180px; - } -} diff --git a/frontend/src/Components/DescriptionList/DescriptionListItemDescription.css.d.ts b/frontend/src/Components/DescriptionList/DescriptionListItemDescription.css.d.ts deleted file mode 100644 index ff7055b0f..000000000 --- a/frontend/src/Components/DescriptionList/DescriptionListItemDescription.css.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'description': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Components/DescriptionList/DescriptionListItemDescription.js b/frontend/src/Components/DescriptionList/DescriptionListItemDescription.js deleted file mode 100644 index 4ef3c015e..000000000 --- a/frontend/src/Components/DescriptionList/DescriptionListItemDescription.js +++ /dev/null @@ -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 ( -
- {children} -
- ); -} - -DescriptionListItemDescription.propTypes = { - className: PropTypes.string.isRequired, - children: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.node]) -}; - -DescriptionListItemDescription.defaultProps = { - className: styles.description -}; - -export default DescriptionListItemDescription; diff --git a/frontend/src/Components/DescriptionList/DescriptionListItemTitle.css b/frontend/src/Components/DescriptionList/DescriptionListItemTitle.css deleted file mode 100644 index e496e463d..000000000 --- a/frontend/src/Components/DescriptionList/DescriptionListItemTitle.css +++ /dev/null @@ -1,18 +0,0 @@ -.title { - line-height: $lineHeight; -} - -.title { - font-weight: bold; -} - -@media (min-width: 768px) { - .title { - @add-mixin truncate; - - float: left; - clear: left; - width: 160px; - text-align: right; - } -} diff --git a/frontend/src/Components/DescriptionList/DescriptionListItemTitle.css.d.ts b/frontend/src/Components/DescriptionList/DescriptionListItemTitle.css.d.ts deleted file mode 100644 index 86bceec06..000000000 --- a/frontend/src/Components/DescriptionList/DescriptionListItemTitle.css.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'title': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Components/DescriptionList/DescriptionListItemTitle.js b/frontend/src/Components/DescriptionList/DescriptionListItemTitle.js deleted file mode 100644 index e1632c1cf..000000000 --- a/frontend/src/Components/DescriptionList/DescriptionListItemTitle.js +++ /dev/null @@ -1,27 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import styles from './DescriptionListItemTitle.css'; - -function DescriptionListItemTitle(props) { - const { - className, - children - } = props; - - return ( -
- {children} -
- ); -} - -DescriptionListItemTitle.propTypes = { - className: PropTypes.string.isRequired, - children: PropTypes.string -}; - -DescriptionListItemTitle.defaultProps = { - className: styles.title -}; - -export default DescriptionListItemTitle; diff --git a/frontend/src/Components/DragPreviewLayer.css b/frontend/src/Components/DragPreviewLayer.css deleted file mode 100644 index 46f721fef..000000000 --- a/frontend/src/Components/DragPreviewLayer.css +++ /dev/null @@ -1,9 +0,0 @@ -.dragLayer { - position: fixed; - top: 0; - left: 0; - z-index: 9999; - width: 100%; - height: 100%; - pointer-events: none; -} diff --git a/frontend/src/Components/DragPreviewLayer.css.d.ts b/frontend/src/Components/DragPreviewLayer.css.d.ts deleted file mode 100644 index 6944a829d..000000000 --- a/frontend/src/Components/DragPreviewLayer.css.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'dragLayer': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Components/DragPreviewLayer.js b/frontend/src/Components/DragPreviewLayer.js deleted file mode 100644 index a111df70e..000000000 --- a/frontend/src/Components/DragPreviewLayer.js +++ /dev/null @@ -1,22 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import styles from './DragPreviewLayer.css'; - -function DragPreviewLayer({ children, ...otherProps }) { - return ( -
- {children} -
- ); -} - -DragPreviewLayer.propTypes = { - children: PropTypes.node, - className: PropTypes.string -}; - -DragPreviewLayer.defaultProps = { - className: styles.dragLayer -}; - -export default DragPreviewLayer; diff --git a/frontend/src/Components/Error/ErrorBoundary.js b/frontend/src/Components/Error/ErrorBoundary.js deleted file mode 100644 index 88412ad19..000000000 --- a/frontend/src/Components/Error/ErrorBoundary.js +++ /dev/null @@ -1,62 +0,0 @@ -import * as sentry from '@sentry/browser'; -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; - -class ErrorBoundary extends Component { - - // - // Lifecycle - - constructor(props, context) { - super(props, context); - - this.state = { - error: null, - info: null - }; - } - - componentDidCatch(error, info) { - this.setState({ - error, - info - }); - - sentry.captureException(error); - } - - // - // Render - - render() { - const { - children, - errorComponent: ErrorComponent, - ...otherProps - } = this.props; - - const { - error, - info - } = this.state; - - if (error) { - return ( - - ); - } - - return children; - } -} - -ErrorBoundary.propTypes = { - children: PropTypes.node.isRequired, - errorComponent: PropTypes.elementType.isRequired -}; - -export default ErrorBoundary; diff --git a/frontend/src/Components/Error/ErrorBoundaryError.css b/frontend/src/Components/Error/ErrorBoundaryError.css deleted file mode 100644 index 3e7a04302..000000000 --- a/frontend/src/Components/Error/ErrorBoundaryError.css +++ /dev/null @@ -1,42 +0,0 @@ -.container { - text-align: center; -} - -.message { - margin: 50px 0; - text-align: center; - font-weight: 300; - font-size: 36px; -} - -.imageContainer { - display: flex; - justify-content: center; - flex: 0 0 auto; -} - -.image { - height: 350px; -} - -.details { - margin: 20px; - text-align: left; - white-space: pre-wrap; -} - -.version { - margin-top: 20px; -} - -@media only screen and (max-width: $breakpointMedium) { - .image { - height: 250px; - } -} - -@media only screen and (max-width: $breakpointSmall) { - .image { - height: 150px; - } -} diff --git a/frontend/src/Components/Error/ErrorBoundaryError.css.d.ts b/frontend/src/Components/Error/ErrorBoundaryError.css.d.ts deleted file mode 100644 index e19fd804d..000000000 --- a/frontend/src/Components/Error/ErrorBoundaryError.css.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'container': string; - 'details': string; - 'image': string; - 'imageContainer': string; - 'message': string; - 'version': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Components/Error/ErrorBoundaryError.tsx b/frontend/src/Components/Error/ErrorBoundaryError.tsx deleted file mode 100644 index e7e74d10a..000000000 --- a/frontend/src/Components/Error/ErrorBoundaryError.tsx +++ /dev/null @@ -1,73 +0,0 @@ -import React, { useEffect, useState } from 'react'; -import StackTrace from 'stacktrace-js'; -import translate from 'Utilities/String/translate'; -import styles from './ErrorBoundaryError.css'; - -interface ErrorBoundaryErrorProps { - className: string; - messageClassName: string; - detailsClassName: string; - message: string; - error: Error; - info: { - componentStack: string; - }; -} - -function ErrorBoundaryError(props: ErrorBoundaryErrorProps) { - const { - className = styles.container, - messageClassName = styles.message, - detailsClassName = styles.details, - message = translate('ErrorLoadingContent'), - error, - info, - } = props; - - const [detailedError, setDetailedError] = useState< - StackTrace.StackFrame[] | null - >(null); - - useEffect(() => { - if (error) { - StackTrace.fromError(error).then((de) => { - setDetailedError(de); - }); - } else { - setDetailedError(null); - } - }, [error, setDetailedError]); - - return ( -
-
{message}
- -
- -
- -
- {error ?
{error.message}
: null} - - {detailedError ? ( - detailedError.map((d, index) => { - return ( -
- {` at ${d.functionName} (${d.fileName}:${d.lineNumber}:${d.columnNumber})`} -
- ); - }) - ) : ( -
{info.componentStack}
- )} - - {
Version: {window.Lidarr.version}
} -
-
- ); -} - -export default ErrorBoundaryError; diff --git a/frontend/src/Components/FieldSet.css b/frontend/src/Components/FieldSet.css deleted file mode 100644 index 9ea0dbab1..000000000 --- a/frontend/src/Components/FieldSet.css +++ /dev/null @@ -1,24 +0,0 @@ -.fieldSet { - margin: 0; - margin-bottom: 20px; - padding: 0; - min-width: 0; - border: 0; -} - -.legend { - display: block; - margin-bottom: 21px; - padding: 0; - width: 100%; - border: 0; - border-bottom: 1px solid #e5e5e5; - color: var(--textColor); - font-size: 21px; - line-height: inherit; - - &.small { - color: #909293; - font-size: 18px; - } -} diff --git a/frontend/src/Components/FieldSet.css.d.ts b/frontend/src/Components/FieldSet.css.d.ts deleted file mode 100644 index 74e99779a..000000000 --- a/frontend/src/Components/FieldSet.css.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'fieldSet': string; - 'legend': string; - 'small': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Components/FieldSet.js b/frontend/src/Components/FieldSet.js deleted file mode 100644 index 8243fd00c..000000000 --- a/frontend/src/Components/FieldSet.js +++ /dev/null @@ -1,41 +0,0 @@ -import classNames from 'classnames'; -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import { sizes } from 'Helpers/Props'; -import styles from './FieldSet.css'; - -class FieldSet extends Component { - - // - // Render - - render() { - const { - size, - legend, - children - } = this.props; - - return ( -
- - {legend} - - {children} -
- ); - } - -} - -FieldSet.propTypes = { - size: PropTypes.oneOf(sizes.all).isRequired, - legend: PropTypes.oneOfType([PropTypes.node, PropTypes.string]), - children: PropTypes.node -}; - -FieldSet.defaultProps = { - size: sizes.MEDIUM -}; - -export default FieldSet; diff --git a/frontend/src/Components/FileBrowser/FileBrowserModal.css b/frontend/src/Components/FileBrowser/FileBrowserModal.css deleted file mode 100644 index 59dba1397..000000000 --- a/frontend/src/Components/FileBrowser/FileBrowserModal.css +++ /dev/null @@ -1,5 +0,0 @@ -.modal { - composes: modal from '~Components/Modal/Modal.css'; - - height: 600px; -} diff --git a/frontend/src/Components/FileBrowser/FileBrowserModal.css.d.ts b/frontend/src/Components/FileBrowser/FileBrowserModal.css.d.ts deleted file mode 100644 index 5d00cca7e..000000000 --- a/frontend/src/Components/FileBrowser/FileBrowserModal.css.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'modal': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Components/FileBrowser/FileBrowserModal.js b/frontend/src/Components/FileBrowser/FileBrowserModal.js deleted file mode 100644 index 6b58dbb8c..000000000 --- a/frontend/src/Components/FileBrowser/FileBrowserModal.js +++ /dev/null @@ -1,39 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import Modal from 'Components/Modal/Modal'; -import FileBrowserModalContentConnector from './FileBrowserModalContentConnector'; -import styles from './FileBrowserModal.css'; - -class FileBrowserModal extends Component { - - // - // Render - - render() { - const { - isOpen, - onModalClose, - ...otherProps - } = this.props; - - return ( - - - - ); - } -} - -FileBrowserModal.propTypes = { - isOpen: PropTypes.bool.isRequired, - onModalClose: PropTypes.func.isRequired -}; - -export default FileBrowserModal; diff --git a/frontend/src/Components/FileBrowser/FileBrowserModalContent.css b/frontend/src/Components/FileBrowser/FileBrowserModalContent.css deleted file mode 100644 index db31d6f86..000000000 --- a/frontend/src/Components/FileBrowser/FileBrowserModalContent.css +++ /dev/null @@ -1,33 +0,0 @@ -.modalBody { - composes: modalBody from '~Components/Modal/ModalBody.css'; - - display: flex; - flex-direction: column; -} - -.mappedDrivesWarning { - composes: alert from '~Components/Alert.css'; - - margin: 0; - margin-bottom: 20px; -} - -.faqLink { - color: var(--alertWarningColor); - font-weight: bold; -} - -.pathInput { - composes: inputWrapper from '~Components/Form/PathInput.css'; - - flex: 0 0 auto; -} - -.scroller { - margin-top: 20px; -} - -.loading { - display: inline-block; - margin-right: auto; -} diff --git a/frontend/src/Components/FileBrowser/FileBrowserModalContent.css.d.ts b/frontend/src/Components/FileBrowser/FileBrowserModalContent.css.d.ts deleted file mode 100644 index e83c13075..000000000 --- a/frontend/src/Components/FileBrowser/FileBrowserModalContent.css.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'faqLink': string; - 'loading': string; - 'mappedDrivesWarning': string; - 'modalBody': string; - 'pathInput': string; - 'scroller': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Components/FileBrowser/FileBrowserModalContent.js b/frontend/src/Components/FileBrowser/FileBrowserModalContent.js deleted file mode 100644 index dff1fbf6e..000000000 --- a/frontend/src/Components/FileBrowser/FileBrowserModalContent.js +++ /dev/null @@ -1,248 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import Alert from 'Components/Alert'; -import PathInput from 'Components/Form/PathInput'; -import Button from 'Components/Link/Button'; -import LoadingIndicator from 'Components/Loading/LoadingIndicator'; -import InlineMarkdown from 'Components/Markdown/InlineMarkdown'; -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 Scroller from 'Components/Scroller/Scroller'; -import Table from 'Components/Table/Table'; -import TableBody from 'Components/Table/TableBody'; -import { kinds, scrollDirections } from 'Helpers/Props'; -import translate from 'Utilities/String/translate'; -import FileBrowserRow from './FileBrowserRow'; -import styles from './FileBrowserModalContent.css'; - -const columns = [ - { - name: 'type', - label: () => translate('Type'), - isVisible: true - }, - { - name: 'name', - label: () => translate('Name'), - isVisible: true - } -]; - -class FileBrowserModalContent extends Component { - - // - // Lifecycle - - constructor(props, context) { - super(props, context); - - this._scrollerRef = React.createRef(); - - this.state = { - isFileBrowserModalOpen: false, - currentPath: props.value - }; - } - - componentDidUpdate(prevProps, prevState) { - const { - currentPath - } = this.props; - - if ( - currentPath !== this.state.currentPath && - currentPath !== prevState.currentPath - ) { - this.setState({ currentPath }); - this._scrollerRef.current.scrollTop = 0; - } - } - - // - // Listeners - - onPathInputChange = ({ value }) => { - this.setState({ currentPath: value }); - }; - - onRowPress = (path) => { - this.props.onFetchPaths(path); - }; - - onOkPress = () => { - this.props.onChange({ - name: this.props.name, - value: this.state.currentPath - }); - - this.props.onClearPaths(); - this.props.onModalClose(); - }; - - // - // Render - - render() { - const { - isFetching, - isPopulated, - error, - parent, - directories, - files, - isWindowsService, - onModalClose, - ...otherProps - } = this.props; - - const emptyParent = parent === ''; - - return ( - - - File Browser - - - - { - isWindowsService && - - - - } - - - - - { - !!error && -
- {translate('ErrorLoadingContents')} -
- } - - { - isPopulated && !error && - - - { - emptyParent && - - } - - { - !emptyParent && parent && - - } - - { - directories.map((directory) => { - return ( - - ); - }) - } - - { - files.map((file) => { - return ( - - ); - }) - } - -
- } -
-
- - - { - isFetching && - - } - - - - - -
- ); - } -} - -FileBrowserModalContent.propTypes = { - name: PropTypes.string.isRequired, - value: PropTypes.string.isRequired, - isFetching: PropTypes.bool.isRequired, - isPopulated: PropTypes.bool.isRequired, - error: PropTypes.object, - parent: PropTypes.string, - currentPath: PropTypes.string.isRequired, - directories: PropTypes.arrayOf(PropTypes.object).isRequired, - files: PropTypes.arrayOf(PropTypes.object).isRequired, - isWindowsService: PropTypes.bool.isRequired, - onFetchPaths: PropTypes.func.isRequired, - onClearPaths: PropTypes.func.isRequired, - onChange: PropTypes.func.isRequired, - onModalClose: PropTypes.func.isRequired -}; - -export default FileBrowserModalContent; diff --git a/frontend/src/Components/FileBrowser/FileBrowserModalContentConnector.js b/frontend/src/Components/FileBrowser/FileBrowserModalContentConnector.js deleted file mode 100644 index 1a3a41ef0..000000000 --- a/frontend/src/Components/FileBrowser/FileBrowserModalContentConnector.js +++ /dev/null @@ -1,119 +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 { clearPaths, fetchPaths } from 'Store/Actions/pathActions'; -import createSystemStatusSelector from 'Store/Selectors/createSystemStatusSelector'; -import FileBrowserModalContent from './FileBrowserModalContent'; - -function createMapStateToProps() { - return createSelector( - (state) => state.paths, - createSystemStatusSelector(), - (paths, systemStatus) => { - const { - isFetching, - isPopulated, - error, - parent, - currentPath, - directories, - files - } = paths; - - const filteredPaths = _.filter([...directories, ...files], ({ path }) => { - return path.toLowerCase().startsWith(currentPath.toLowerCase()); - }); - - return { - isFetching, - isPopulated, - error, - parent, - currentPath, - directories, - files, - paths: filteredPaths, - isWindowsService: systemStatus.isWindows && systemStatus.mode === 'service' - }; - } - ); -} - -const mapDispatchToProps = { - dispatchFetchPaths: fetchPaths, - dispatchClearPaths: clearPaths -}; - -class FileBrowserModalContentConnector extends Component { - - // Lifecycle - - componentDidMount() { - const { - value, - includeFiles, - dispatchFetchPaths - } = this.props; - - dispatchFetchPaths({ - path: value, - allowFoldersWithoutTrailingSlashes: true, - includeFiles - }); - } - - // - // Listeners - - onFetchPaths = (path) => { - const { - includeFiles, - dispatchFetchPaths - } = this.props; - - dispatchFetchPaths({ - path, - allowFoldersWithoutTrailingSlashes: true, - includeFiles - }); - }; - - onClearPaths = () => { - // this.props.dispatchClearPaths(); - }; - - onModalClose = () => { - this.props.dispatchClearPaths(); - this.props.onModalClose(); - }; - - // - // Render - - render() { - return ( - - ); - } -} - -FileBrowserModalContentConnector.propTypes = { - value: PropTypes.string, - includeFiles: PropTypes.bool.isRequired, - dispatchFetchPaths: PropTypes.func.isRequired, - dispatchClearPaths: PropTypes.func.isRequired, - onModalClose: PropTypes.func.isRequired -}; - -FileBrowserModalContentConnector.defaultProps = { - includeFiles: false -}; - -export default connect(createMapStateToProps, mapDispatchToProps)(FileBrowserModalContentConnector); diff --git a/frontend/src/Components/FileBrowser/FileBrowserRow.css b/frontend/src/Components/FileBrowser/FileBrowserRow.css deleted file mode 100644 index 9f111ed5d..000000000 --- a/frontend/src/Components/FileBrowser/FileBrowserRow.css +++ /dev/null @@ -1,5 +0,0 @@ -.type { - composes: cell from '~Components/Table/Cells/TableRowCell.css'; - - width: 32px; -} diff --git a/frontend/src/Components/FileBrowser/FileBrowserRow.css.d.ts b/frontend/src/Components/FileBrowser/FileBrowserRow.css.d.ts deleted file mode 100644 index 127d00928..000000000 --- a/frontend/src/Components/FileBrowser/FileBrowserRow.css.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'type': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Components/FileBrowser/FileBrowserRow.js b/frontend/src/Components/FileBrowser/FileBrowserRow.js deleted file mode 100644 index 06bb3029d..000000000 --- a/frontend/src/Components/FileBrowser/FileBrowserRow.js +++ /dev/null @@ -1,62 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import Icon from 'Components/Icon'; -import TableRowCell from 'Components/Table/Cells/TableRowCell'; -import TableRowButton from 'Components/Table/TableRowButton'; -import { icons } from 'Helpers/Props'; -import styles from './FileBrowserRow.css'; - -function getIconName(type) { - switch (type) { - case 'computer': - return icons.COMPUTER; - case 'drive': - return icons.DRIVE; - case 'file': - return icons.FILE; - case 'parent': - return icons.PARENT; - default: - return icons.FOLDER; - } -} - -class FileBrowserRow extends Component { - - // - // Listeners - - onPress = () => { - this.props.onPress(this.props.path); - }; - - // - // Render - - render() { - const { - type, - name - } = this.props; - - return ( - - - - - - {name} - - ); - } - -} - -FileBrowserRow.propTypes = { - type: PropTypes.string.isRequired, - name: PropTypes.string.isRequired, - path: PropTypes.string.isRequired, - onPress: PropTypes.func.isRequired -}; - -export default FileBrowserRow; diff --git a/frontend/src/Components/Filter/Builder/ArtistFilterBuilderRowValue.tsx b/frontend/src/Components/Filter/Builder/ArtistFilterBuilderRowValue.tsx deleted file mode 100644 index 486027f35..000000000 --- a/frontend/src/Components/Filter/Builder/ArtistFilterBuilderRowValue.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import React from 'react'; -import { useSelector } from 'react-redux'; -import Artist from 'Artist/Artist'; -import createAllArtistSelector from 'Store/Selectors/createAllArtistSelector'; -import sortByProp from 'Utilities/Array/sortByProp'; -import FilterBuilderRowValue from './FilterBuilderRowValue'; -import FilterBuilderRowValueProps from './FilterBuilderRowValueProps'; - -function ArtistFilterBuilderRowValue(props: FilterBuilderRowValueProps) { - const allArtists: Artist[] = useSelector(createAllArtistSelector()); - - const tagList = allArtists - .map((artist) => ({ id: artist.id, name: artist.artistName })) - .sort(sortByProp('name')); - - return ; -} - -export default ArtistFilterBuilderRowValue; diff --git a/frontend/src/Components/Filter/Builder/ArtistStatusFilterBuilderRowValue.js b/frontend/src/Components/Filter/Builder/ArtistStatusFilterBuilderRowValue.js deleted file mode 100644 index 2b28e0f42..000000000 --- a/frontend/src/Components/Filter/Builder/ArtistStatusFilterBuilderRowValue.js +++ /dev/null @@ -1,18 +0,0 @@ -import React from 'react'; -import FilterBuilderRowValue from './FilterBuilderRowValue'; - -const protocols = [ - { id: 'continuing', name: 'Continuing' }, - { id: 'ended', name: 'Inactive' } -]; - -function ArtistStatusFilterBuilderRowValue(props) { - return ( - - ); -} - -export default ArtistStatusFilterBuilderRowValue; diff --git a/frontend/src/Components/Filter/Builder/BoolFilterBuilderRowValue.js b/frontend/src/Components/Filter/Builder/BoolFilterBuilderRowValue.js deleted file mode 100644 index eea574dd1..000000000 --- a/frontend/src/Components/Filter/Builder/BoolFilterBuilderRowValue.js +++ /dev/null @@ -1,18 +0,0 @@ -import React from 'react'; -import FilterBuilderRowValue from './FilterBuilderRowValue'; - -const protocols = [ - { id: true, name: 'true' }, - { id: false, name: 'false' } -]; - -function BoolFilterBuilderRowValue(props) { - return ( - - ); -} - -export default BoolFilterBuilderRowValue; diff --git a/frontend/src/Components/Filter/Builder/DateFilterBuilderRowValue.css b/frontend/src/Components/Filter/Builder/DateFilterBuilderRowValue.css deleted file mode 100644 index 39db60700..000000000 --- a/frontend/src/Components/Filter/Builder/DateFilterBuilderRowValue.css +++ /dev/null @@ -1,15 +0,0 @@ -.container { - display: flex; -} - -.numberInput { - composes: input from '~Components/Form/TextInput.css'; - - margin-right: 3px; -} - -.selectInput { - composes: select from '~Components/Form/SelectInput.css'; - - margin-left: 3px; -} diff --git a/frontend/src/Components/Filter/Builder/DateFilterBuilderRowValue.css.d.ts b/frontend/src/Components/Filter/Builder/DateFilterBuilderRowValue.css.d.ts deleted file mode 100644 index d391a1f30..000000000 --- a/frontend/src/Components/Filter/Builder/DateFilterBuilderRowValue.css.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'container': string; - 'numberInput': string; - 'selectInput': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Components/Filter/Builder/DateFilterBuilderRowValue.js b/frontend/src/Components/Filter/Builder/DateFilterBuilderRowValue.js deleted file mode 100644 index 0193cf44f..000000000 --- a/frontend/src/Components/Filter/Builder/DateFilterBuilderRowValue.js +++ /dev/null @@ -1,177 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import NumberInput from 'Components/Form/NumberInput'; -import SelectInput from 'Components/Form/SelectInput'; -import TextInput from 'Components/Form/TextInput'; -import { IN_LAST, IN_NEXT, NOT_IN_LAST, NOT_IN_NEXT } from 'Helpers/Props/filterTypes'; -import isString from 'Utilities/String/isString'; -import { NAME } from './FilterBuilderRowValue'; -import styles from './DateFilterBuilderRowValue.css'; - -const timeOptions = [ - { key: 'seconds', value: 'seconds' }, - { key: 'minutes', value: 'minutes' }, - { key: 'hours', value: 'hours' }, - { key: 'days', value: 'days' }, - { key: 'weeks', value: 'weeks' }, - { key: 'months', value: 'months' } -]; - -function isInFilter(filterType) { - return ( - filterType === IN_LAST || - filterType === NOT_IN_LAST || - filterType === IN_NEXT || - filterType === NOT_IN_NEXT - ); -} - -class DateFilterBuilderRowValue extends Component { - - // - // Lifecycle - - componentDidMount() { - const { - filterType, - filterValue, - onChange - } = this.props; - - if (isInFilter(filterType) && isString(filterValue)) { - onChange({ - name: NAME, - value: { - time: timeOptions[0].key, - value: null - } - }); - } - } - - componentDidUpdate(prevProps) { - const { - filterType, - filterValue, - onChange - } = this.props; - - if (prevProps.filterType === filterType) { - return; - } - - if (isInFilter(filterType) && isString(filterValue)) { - onChange({ - name: NAME, - value: { - time: timeOptions[0].key, - value: null - } - }); - - return; - } - - if (!isInFilter(filterType) && !isString(filterValue)) { - onChange({ - name: NAME, - value: '' - }); - } - } - - // - // Listeners - - onValueChange = ({ value }) => { - const { - filterValue, - onChange - } = this.props; - - let newValue = value; - - if (!isString(value)) { - newValue = { - time: filterValue.time, - value - }; - } - - onChange({ - name: NAME, - value: newValue - }); - }; - - onTimeChange = ({ value }) => { - const { - filterValue, - onChange - } = this.props; - - onChange({ - name: NAME, - value: { - time: value, - value: filterValue.value - } - }); - }; - - // - // Render - - render() { - const { - filterType, - filterValue - } = this.props; - - if ( - (isInFilter(filterType) && isString(filterValue)) || - (!isInFilter(filterType) && !isString(filterValue)) - ) { - return null; - } - - if (isInFilter(filterType)) { - return ( -
- - - -
- ); - } - - return ( - - ); - } -} - -DateFilterBuilderRowValue.propTypes = { - filterType: PropTypes.string, - filterValue: PropTypes.oneOfType([PropTypes.string, PropTypes.object]).isRequired, - onChange: PropTypes.func.isRequired -}; - -export default DateFilterBuilderRowValue; diff --git a/frontend/src/Components/Filter/Builder/FilterBuilderModalContent.css b/frontend/src/Components/Filter/Builder/FilterBuilderModalContent.css deleted file mode 100644 index 6cc8fab67..000000000 --- a/frontend/src/Components/Filter/Builder/FilterBuilderModalContent.css +++ /dev/null @@ -1,16 +0,0 @@ -.labelContainer { - margin-bottom: 20px; -} - -.label { - margin-bottom: 5px; - font-weight: bold; -} - -.labelInputContainer { - width: 300px; -} - -.rows { - margin-bottom: 100px; -} diff --git a/frontend/src/Components/Filter/Builder/FilterBuilderModalContent.css.d.ts b/frontend/src/Components/Filter/Builder/FilterBuilderModalContent.css.d.ts deleted file mode 100644 index 033d2edca..000000000 --- a/frontend/src/Components/Filter/Builder/FilterBuilderModalContent.css.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'label': string; - 'labelContainer': string; - 'labelInputContainer': string; - 'rows': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Components/Filter/Builder/FilterBuilderModalContent.js b/frontend/src/Components/Filter/Builder/FilterBuilderModalContent.js deleted file mode 100644 index 0c4a31657..000000000 --- a/frontend/src/Components/Filter/Builder/FilterBuilderModalContent.js +++ /dev/null @@ -1,232 +0,0 @@ -import { maxBy } from 'lodash'; -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import FormInputGroup from 'Components/Form/FormInputGroup'; -import Button from 'Components/Link/Button'; -import SpinnerErrorButton from 'Components/Link/SpinnerErrorButton'; -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 translate from 'Utilities/String/translate'; -import FilterBuilderRow from './FilterBuilderRow'; -import styles from './FilterBuilderModalContent.css'; - -class FilterBuilderModalContent extends Component { - - // - // Lifecycle - - constructor(props, context) { - super(props, context); - - const filters = [...props.filters]; - - // Push an empty filter if there aren't any filters. FilterBuilderRow - // will handle initializing the filter. - - if (!filters.length) { - filters.push({}); - } - - this.state = { - label: props.label, - filters, - labelErrors: [] - }; - } - - componentDidUpdate(prevProps) { - const { - id, - customFilters, - isSaving, - saveError, - dispatchSetFilter, - onModalClose - } = this.props; - - if (prevProps.isSaving && !isSaving && !saveError) { - if (id) { - dispatchSetFilter({ selectedFilterKey: id }); - } else { - const last = maxBy(customFilters, 'id'); - dispatchSetFilter({ selectedFilterKey: last.id }); - } - - onModalClose(); - } - } - - // - // Listeners - - onLabelChange = ({ value }) => { - this.setState({ label: value }); - }; - - onFilterChange = (index, filter) => { - const filters = [...this.state.filters]; - filters.splice(index, 1, filter); - - this.setState({ - filters - }); - }; - - onAddFilterPress = () => { - const filters = [...this.state.filters]; - filters.push({}); - - this.setState({ - filters - }); - }; - - onRemoveFilterPress = (index) => { - const filters = [...this.state.filters]; - filters.splice(index, 1); - - this.setState({ - filters - }); - }; - - onSaveFilterPress = () => { - const { - id, - customFilterType, - onSaveCustomFilterPress - } = this.props; - - const { - label, - filters - } = this.state; - - if (!label) { - this.setState({ - labelErrors: [ - { - message: translate('LabelIsRequired') - } - ] - }); - - return; - } - - onSaveCustomFilterPress({ - id, - type: customFilterType, - label, - filters - }); - }; - - // - // Render - - render() { - const { - sectionItems, - filterBuilderProps, - isSaving, - saveError, - onCancelPress, - onModalClose - } = this.props; - - const { - label, - filters, - labelErrors - } = this.state; - - return ( - - - {translate('CustomFilter')} - - - -
-
- {translate('Label')} -
- -
- -
-
- -
- {translate('Filters')} -
- -
- { - filters.map((filter, index) => { - return ( - - ); - }) - } -
-
- - - - - - {translate('Save')} - - -
- ); - } -} - -FilterBuilderModalContent.propTypes = { - id: PropTypes.number, - label: PropTypes.string.isRequired, - customFilterType: PropTypes.string.isRequired, - sectionItems: PropTypes.arrayOf(PropTypes.object).isRequired, - filters: PropTypes.arrayOf(PropTypes.object).isRequired, - filterBuilderProps: PropTypes.arrayOf(PropTypes.object).isRequired, - customFilters: PropTypes.arrayOf(PropTypes.object).isRequired, - isSaving: PropTypes.bool.isRequired, - saveError: PropTypes.object, - dispatchDeleteCustomFilter: PropTypes.func.isRequired, - onSaveCustomFilterPress: PropTypes.func.isRequired, - dispatchSetFilter: PropTypes.func.isRequired, - onCancelPress: PropTypes.func.isRequired, - onModalClose: PropTypes.func.isRequired -}; - -export default FilterBuilderModalContent; diff --git a/frontend/src/Components/Filter/Builder/FilterBuilderModalContentConnector.js b/frontend/src/Components/Filter/Builder/FilterBuilderModalContentConnector.js deleted file mode 100644 index 17633172b..000000000 --- a/frontend/src/Components/Filter/Builder/FilterBuilderModalContentConnector.js +++ /dev/null @@ -1,42 +0,0 @@ -import { connect } from 'react-redux'; -import { createSelector } from 'reselect'; -import { deleteCustomFilter, saveCustomFilter } from 'Store/Actions/customFilterActions'; -import FilterBuilderModalContent from './FilterBuilderModalContent'; - -function createMapStateToProps() { - return createSelector( - (state, { customFilters }) => customFilters, - (state, { id }) => id, - (state) => state.customFilters.isSaving, - (state) => state.customFilters.saveError, - (customFilters, id, isSaving, saveError) => { - if (id) { - const customFilter = customFilters.find((c) => c.id === id); - - return { - id: customFilter.id, - label: customFilter.label, - filters: customFilter.filters, - customFilters, - isSaving, - saveError - }; - } - - return { - label: '', - filters: [], - customFilters, - isSaving, - saveError - }; - } - ); -} - -const mapDispatchToProps = { - onSaveCustomFilterPress: saveCustomFilter, - dispatchDeleteCustomFilter: deleteCustomFilter -}; - -export default connect(createMapStateToProps, mapDispatchToProps)(FilterBuilderModalContent); diff --git a/frontend/src/Components/Filter/Builder/FilterBuilderRow.css b/frontend/src/Components/Filter/Builder/FilterBuilderRow.css deleted file mode 100644 index bcfc3b04e..000000000 --- a/frontend/src/Components/Filter/Builder/FilterBuilderRow.css +++ /dev/null @@ -1,32 +0,0 @@ -.filterRow { - display: flex; - margin-bottom: 5px; - - &:hover { - background-color: var(--tableRowHoverBackgroundColor); - } -} - -.inputContainer { - flex: 0 1 200px; - margin-right: 10px; -} - -.valueInputContainer { - flex: 0 1 300px; - margin-right: 10px; -} - -.actionsContainer { - display: flex; -} - -@media only screen and (max-width: $breakpointSmall) { - .filterRow { - display: block; - } - - .inputContainer { - margin-bottom: 10px; - } -} diff --git a/frontend/src/Components/Filter/Builder/FilterBuilderRow.css.d.ts b/frontend/src/Components/Filter/Builder/FilterBuilderRow.css.d.ts deleted file mode 100644 index aba698af4..000000000 --- a/frontend/src/Components/Filter/Builder/FilterBuilderRow.css.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'actionsContainer': string; - 'filterRow': string; - 'inputContainer': string; - 'valueInputContainer': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Components/Filter/Builder/FilterBuilderRow.js b/frontend/src/Components/Filter/Builder/FilterBuilderRow.js deleted file mode 100644 index 77dad7173..000000000 --- a/frontend/src/Components/Filter/Builder/FilterBuilderRow.js +++ /dev/null @@ -1,301 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import SelectInput from 'Components/Form/SelectInput'; -import IconButton from 'Components/Link/IconButton'; -import { filterBuilderTypes, filterBuilderValueTypes, icons } from 'Helpers/Props'; -import sortByProp from 'Utilities/Array/sortByProp'; -import ArtistFilterBuilderRowValue from './ArtistFilterBuilderRowValue'; -import ArtistStatusFilterBuilderRowValue from './ArtistStatusFilterBuilderRowValue'; -import BoolFilterBuilderRowValue from './BoolFilterBuilderRowValue'; -import DateFilterBuilderRowValue from './DateFilterBuilderRowValue'; -import FilterBuilderRowValueConnector from './FilterBuilderRowValueConnector'; -import HistoryEventTypeFilterBuilderRowValue from './HistoryEventTypeFilterBuilderRowValue'; -import IndexerFilterBuilderRowValueConnector from './IndexerFilterBuilderRowValueConnector'; -import MetadataProfileFilterBuilderRowValue from './MetadataProfileFilterBuilderRowValue'; -import MonitorNewItemsFilterBuilderRowValue from './MonitorNewItemsFilterBuilderRowValue'; -import ProtocolFilterBuilderRowValue from './ProtocolFilterBuilderRowValue'; -import QualityFilterBuilderRowValueConnector from './QualityFilterBuilderRowValueConnector'; -import QualityProfileFilterBuilderRowValue from './QualityProfileFilterBuilderRowValue'; -import TagFilterBuilderRowValueConnector from './TagFilterBuilderRowValueConnector'; -import styles from './FilterBuilderRow.css'; - -function getselectedFilterBuilderProp(filterBuilderProps, name) { - return filterBuilderProps.find((a) => { - return a.name === name; - }); -} - -function getFilterTypeOptions(filterBuilderProps, filterKey) { - const selectedFilterBuilderProp = getselectedFilterBuilderProp(filterBuilderProps, filterKey); - - if (!selectedFilterBuilderProp) { - return []; - } - - return filterBuilderTypes.possibleFilterTypes[selectedFilterBuilderProp.type]; -} - -function getDefaultFilterType(selectedFilterBuilderProp) { - return filterBuilderTypes.possibleFilterTypes[selectedFilterBuilderProp.type][0].key; -} - -function getDefaultFilterValue(selectedFilterBuilderProp) { - if (selectedFilterBuilderProp.type === filterBuilderTypes.DATE) { - return ''; - } - - return []; -} - -function getRowValueConnector(selectedFilterBuilderProp) { - if (!selectedFilterBuilderProp) { - return FilterBuilderRowValueConnector; - } - - const valueType = selectedFilterBuilderProp.valueType; - - switch (valueType) { - case filterBuilderValueTypes.BOOL: - return BoolFilterBuilderRowValue; - - case filterBuilderValueTypes.DATE: - return DateFilterBuilderRowValue; - - case filterBuilderValueTypes.HISTORY_EVENT_TYPE: - return HistoryEventTypeFilterBuilderRowValue; - - case filterBuilderValueTypes.INDEXER: - return IndexerFilterBuilderRowValueConnector; - - case filterBuilderValueTypes.METADATA_PROFILE: - return MetadataProfileFilterBuilderRowValue; - - case filterBuilderValueTypes.MONITOR_NEW_ITEMS: - return MonitorNewItemsFilterBuilderRowValue; - - case filterBuilderValueTypes.PROTOCOL: - return ProtocolFilterBuilderRowValue; - - case filterBuilderValueTypes.QUALITY: - return QualityFilterBuilderRowValueConnector; - - case filterBuilderValueTypes.QUALITY_PROFILE: - return QualityProfileFilterBuilderRowValue; - - case filterBuilderValueTypes.ARTIST: - return ArtistFilterBuilderRowValue; - - case filterBuilderValueTypes.ARTIST_STATUS: - return ArtistStatusFilterBuilderRowValue; - - case filterBuilderValueTypes.TAG: - return TagFilterBuilderRowValueConnector; - - default: - return FilterBuilderRowValueConnector; - } -} - -class FilterBuilderRow extends Component { - - // - // Lifecycle - - constructor(props, context) { - super(props, context); - - const { - filterKey, - filterBuilderProps - } = props; - - if (filterKey) { - const selectedFilterBuilderProp = filterBuilderProps.find((a) => a.name === filterKey); - this.selectedFilterBuilderProp = selectedFilterBuilderProp; - } - } - - componentDidMount() { - const { - index, - filterKey, - filterBuilderProps, - onFilterChange - } = this.props; - - if (filterKey) { - const selectedFilterBuilderProp = filterBuilderProps.find((a) => a.name === filterKey); - this.selectedFilterBuilderProp = selectedFilterBuilderProp; - - return; - } - - const selectedFilterBuilderProp = filterBuilderProps[0]; - - const filter = { - key: selectedFilterBuilderProp.name, - value: getDefaultFilterValue(selectedFilterBuilderProp), - type: getDefaultFilterType(selectedFilterBuilderProp) - }; - - this.selectedFilterBuilderProp = selectedFilterBuilderProp; - onFilterChange(index, filter); - } - - // - // Listeners - - onFilterKeyChange = ({ value: key }) => { - const { - index, - filterBuilderProps, - onFilterChange - } = this.props; - - const selectedFilterBuilderProp = getselectedFilterBuilderProp(filterBuilderProps, key); - const type = getDefaultFilterType(selectedFilterBuilderProp); - - const filter = { - key, - value: getDefaultFilterValue(selectedFilterBuilderProp), - type - }; - - this.selectedFilterBuilderProp = selectedFilterBuilderProp; - onFilterChange(index, filter); - }; - - onFilterChange = ({ name, value }) => { - const { - index, - filterKey, - filterValue, - filterType, - onFilterChange - } = this.props; - - const filter = { - key: filterKey, - value: filterValue, - type: filterType - }; - - filter[name] = value; - - onFilterChange(index, filter); - }; - - onAddPress = () => { - const { - index, - onAddPress - } = this.props; - - onAddPress(index); - }; - - onRemovePress = () => { - const { - index, - onRemovePress - } = this.props; - - onRemovePress(index); - }; - - // - // Render - - render() { - const { - filterKey, - filterType, - filterValue, - filterCount, - filterBuilderProps, - sectionItems - } = this.props; - - const selectedFilterBuilderProp = this.selectedFilterBuilderProp; - - const keyOptions = filterBuilderProps.map((availablePropFilter) => { - const { name, label } = availablePropFilter; - - return { - key: name, - value: typeof label === 'function' ? label() : label - }; - }).sort(sortByProp('value')); - - const ValueComponent = getRowValueConnector(selectedFilterBuilderProp); - - return ( -
-
- { - filterKey && - - } -
- -
- { - filterType && - - } -
- -
- { - filterValue != null && !!selectedFilterBuilderProp && - - } -
- -
- - - -
-
- ); - } -} - -FilterBuilderRow.propTypes = { - index: PropTypes.number.isRequired, - filterKey: PropTypes.string, - filterValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array, PropTypes.object]), - filterType: PropTypes.string, - filterCount: PropTypes.number.isRequired, - filterBuilderProps: PropTypes.arrayOf(PropTypes.object).isRequired, - sectionItems: PropTypes.arrayOf(PropTypes.object).isRequired, - onFilterChange: PropTypes.func.isRequired, - onAddPress: PropTypes.func.isRequired, - onRemovePress: PropTypes.func.isRequired -}; - -export default FilterBuilderRow; diff --git a/frontend/src/Components/Filter/Builder/FilterBuilderRowValue.js b/frontend/src/Components/Filter/Builder/FilterBuilderRowValue.js deleted file mode 100644 index 68fa5c557..000000000 --- a/frontend/src/Components/Filter/Builder/FilterBuilderRowValue.js +++ /dev/null @@ -1,160 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import TagInput from 'Components/Form/TagInput'; -import { filterBuilderTypes, filterBuilderValueTypes, kinds } from 'Helpers/Props'; -import tagShape from 'Helpers/Props/Shapes/tagShape'; -import convertToBytes from 'Utilities/Number/convertToBytes'; -import formatBytes from 'Utilities/Number/formatBytes'; -import FilterBuilderRowValueTag from './FilterBuilderRowValueTag'; - -export const NAME = 'value'; - -function getTagDisplayValue(value, selectedFilterBuilderProp) { - if (selectedFilterBuilderProp.valueType === filterBuilderValueTypes.BYTES) { - return formatBytes(value); - } - - return value; -} - -function getValue(input, selectedFilterBuilderProp) { - if (selectedFilterBuilderProp.valueType === filterBuilderValueTypes.BYTES) { - const match = input.match(/^(\d+)([kmgt](i?b)?)$/i); - - if (match && match.length > 1) { - const [, value, unit] = input.match(/^(\d+)([kmgt](i?b)?)$/i); - - switch (unit.toLowerCase()) { - case 'k': - return convertToBytes(value, 1, true); - case 'm': - return convertToBytes(value, 2, true); - case 'g': - return convertToBytes(value, 3, true); - case 't': - return convertToBytes(value, 4, true); - case 'kb': - return convertToBytes(value, 1, true); - case 'mb': - return convertToBytes(value, 2, true); - case 'gb': - return convertToBytes(value, 3, true); - case 'tb': - return convertToBytes(value, 4, true); - case 'kib': - return convertToBytes(value, 1, true); - case 'mib': - return convertToBytes(value, 2, true); - case 'gib': - return convertToBytes(value, 3, true); - case 'tib': - return convertToBytes(value, 4, true); - default: - return parseInt(value); - } - } - } - - if (selectedFilterBuilderProp.type === filterBuilderTypes.NUMBER) { - return parseInt(input); - } - - return input; -} - -class FilterBuilderRowValue extends Component { - - // - // Listeners - - onTagAdd = (tag) => { - const { - filterValue, - selectedFilterBuilderProp, - onChange - } = this.props; - - let value = tag.id; - - if (value == null) { - value = getValue(tag.name, selectedFilterBuilderProp); - } - - onChange({ - name: NAME, - value: [...filterValue, value] - }); - }; - - onTagDelete = ({ index }) => { - const { - filterValue, - onChange - } = this.props; - - const value = filterValue.filter((v, i) => i !== index); - - onChange({ - name: NAME, - value - }); - }; - - // - // Render - - render() { - const { - filterValue, - selectedFilterBuilderProp, - tagList - } = this.props; - - const hasItems = !!tagList.length; - - const tags = filterValue.map((id) => { - if (hasItems) { - const tag = tagList.find((t) => t.id === id); - - return { - id, - name: tag && tag.name - }; - } - - return { - id, - name: getTagDisplayValue(id, selectedFilterBuilderProp) - }; - }); - - return ( - - ); - } -} - -FilterBuilderRowValue.propTypes = { - filterValue: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.bool, PropTypes.string, PropTypes.number])).isRequired, - selectedFilterBuilderProp: PropTypes.object.isRequired, - tagList: PropTypes.arrayOf(PropTypes.shape(tagShape)).isRequired, - onChange: PropTypes.func.isRequired -}; - -FilterBuilderRowValue.defaultProps = { - filterValue: [] -}; - -export default FilterBuilderRowValue; diff --git a/frontend/src/Components/Filter/Builder/FilterBuilderRowValueConnector.js b/frontend/src/Components/Filter/Builder/FilterBuilderRowValueConnector.js deleted file mode 100644 index d1419327a..000000000 --- a/frontend/src/Components/Filter/Builder/FilterBuilderRowValueConnector.js +++ /dev/null @@ -1,60 +0,0 @@ -import _ from 'lodash'; -import { connect } from 'react-redux'; -import { createSelector } from 'reselect'; -import { filterBuilderTypes } from 'Helpers/Props'; -import * as filterTypes from 'Helpers/Props/filterTypes'; -import sortByProp from 'Utilities/Array/sortByProp'; -import FilterBuilderRowValue from './FilterBuilderRowValue'; - -function createTagListSelector() { - return createSelector( - (state, { filterType }) => filterType, - (state, { sectionItems }) => sectionItems, - (state, { selectedFilterBuilderProp }) => selectedFilterBuilderProp, - (filterType, sectionItems, selectedFilterBuilderProp) => { - if ( - (selectedFilterBuilderProp.type === filterBuilderTypes.NUMBER || - selectedFilterBuilderProp.type === filterBuilderTypes.STRING) && - filterType !== filterTypes.EQUAL && - filterType !== filterTypes.NOT_EQUAL || - !selectedFilterBuilderProp.optionsSelector - ) { - return []; - } - - let items = []; - - if (selectedFilterBuilderProp.optionsSelector) { - items = selectedFilterBuilderProp.optionsSelector(sectionItems); - } else { - items = sectionItems.reduce((acc, item) => { - const name = item[selectedFilterBuilderProp.name]; - - if (name) { - acc.push({ - id: name, - name - }); - } - - return acc; - }, []).sort(sortByProp('name')); - } - - return _.uniqBy(items, 'id'); - } - ); -} - -function createMapStateToProps() { - return createSelector( - createTagListSelector(), - (tagList) => { - return { - tagList - }; - } - ); -} - -export default connect(createMapStateToProps)(FilterBuilderRowValue); diff --git a/frontend/src/Components/Filter/Builder/FilterBuilderRowValueProps.ts b/frontend/src/Components/Filter/Builder/FilterBuilderRowValueProps.ts deleted file mode 100644 index 5bf9e5785..000000000 --- a/frontend/src/Components/Filter/Builder/FilterBuilderRowValueProps.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { FilterBuilderProp } from 'App/State/AppState'; - -interface FilterBuilderRowOnChangeProps { - name: string; - value: unknown[]; -} - -interface FilterBuilderRowValueProps { - filterType?: string; - filterValue: string | number | object | string[] | number[] | object[]; - selectedFilterBuilderProp: FilterBuilderProp; - sectionItem: unknown[]; - onChange: (payload: FilterBuilderRowOnChangeProps) => void; -} - -export default FilterBuilderRowValueProps; diff --git a/frontend/src/Components/Filter/Builder/FilterBuilderRowValueTag.css b/frontend/src/Components/Filter/Builder/FilterBuilderRowValueTag.css deleted file mode 100644 index 807f383dd..000000000 --- a/frontend/src/Components/Filter/Builder/FilterBuilderRowValueTag.css +++ /dev/null @@ -1,22 +0,0 @@ -.tag { - display: flex; - - &.isLastTag { - .or { - display: none; - } - } -} - -.label { - composes: label from '~Components/Label.css'; - - border-style: none; - font-size: 13px; -} - -.or { - margin: 0 3px; - color: var(--themeDarkColor); - line-height: 31px; -} diff --git a/frontend/src/Components/Filter/Builder/FilterBuilderRowValueTag.css.d.ts b/frontend/src/Components/Filter/Builder/FilterBuilderRowValueTag.css.d.ts deleted file mode 100644 index 80bcf1464..000000000 --- a/frontend/src/Components/Filter/Builder/FilterBuilderRowValueTag.css.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'isLastTag': string; - 'label': string; - 'or': string; - 'tag': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Components/Filter/Builder/FilterBuilderRowValueTag.js b/frontend/src/Components/Filter/Builder/FilterBuilderRowValueTag.js deleted file mode 100644 index 6b5846594..000000000 --- a/frontend/src/Components/Filter/Builder/FilterBuilderRowValueTag.js +++ /dev/null @@ -1,32 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import TagInputTag from 'Components/Form/TagInputTag'; -import { kinds } from 'Helpers/Props'; -import styles from './FilterBuilderRowValueTag.css'; - -function FilterBuilderRowValueTag(props) { - return ( -
- - - { - props.isLastTag ? - null : -
- or -
- } -
- ); -} - -FilterBuilderRowValueTag.propTypes = { - isLastTag: PropTypes.bool.isRequired -}; - -export default FilterBuilderRowValueTag; diff --git a/frontend/src/Components/Filter/Builder/HistoryEventTypeFilterBuilderRowValue.tsx b/frontend/src/Components/Filter/Builder/HistoryEventTypeFilterBuilderRowValue.tsx deleted file mode 100644 index 1b3b369be..000000000 --- a/frontend/src/Components/Filter/Builder/HistoryEventTypeFilterBuilderRowValue.tsx +++ /dev/null @@ -1,69 +0,0 @@ -import React from 'react'; -import translate from 'Utilities/String/translate'; -import FilterBuilderRowValue from './FilterBuilderRowValue'; -import FilterBuilderRowValueProps from './FilterBuilderRowValueProps'; - -const EVENT_TYPE_OPTIONS = [ - { - id: 1, - get name() { - return translate('Grabbed'); - }, - }, - { - id: 3, - get name() { - return translate('TrackImported'); - }, - }, - { - id: 4, - get name() { - return translate('DownloadFailed'); - }, - }, - { - id: 7, - get name() { - return translate('ImportCompleteFailed'); - }, - }, - { - id: 8, - get name() { - return translate('DownloadImported'); - }, - }, - { - id: 5, - get name() { - return translate('Deleted'); - }, - }, - { - id: 6, - get name() { - return translate('Renamed'); - }, - }, - { - id: 9, - get name() { - return translate('Retagged'); - }, - }, - { - id: 7, - get name() { - return translate('Ignored'); - }, - }, -]; - -function HistoryEventTypeFilterBuilderRowValue( - props: FilterBuilderRowValueProps -) { - return ; -} - -export default HistoryEventTypeFilterBuilderRowValue; diff --git a/frontend/src/Components/Filter/Builder/IndexerFilterBuilderRowValueConnector.js b/frontend/src/Components/Filter/Builder/IndexerFilterBuilderRowValueConnector.js deleted file mode 100644 index e834b79a3..000000000 --- a/frontend/src/Components/Filter/Builder/IndexerFilterBuilderRowValueConnector.js +++ /dev/null @@ -1,79 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import { connect } from 'react-redux'; -import { createSelector } from 'reselect'; -import tagShape from 'Helpers/Props/Shapes/tagShape'; -import { fetchIndexers } from 'Store/Actions/settingsActions'; -import FilterBuilderRowValue from './FilterBuilderRowValue'; - -function createMapStateToProps() { - return createSelector( - (state) => state.settings.indexers, - (qualityProfiles) => { - const { - isFetching, - isPopulated, - error, - items - } = qualityProfiles; - - const tagList = items.map((item) => { - return { - id: item.id, - name: item.name - }; - }); - - return { - isFetching, - isPopulated, - error, - tagList - }; - } - ); -} - -const mapDispatchToProps = { - dispatchFetchIndexers: fetchIndexers -}; - -class IndexerFilterBuilderRowValueConnector extends Component { - - // - // Lifecycle - - componentDidMount = () => { - if (!this.props.isPopulated) { - this.props.dispatchFetchIndexers(); - } - }; - - // - // Render - - render() { - const { - isFetching, - isPopulated, - error, - ...otherProps - } = this.props; - - return ( - - ); - } -} - -IndexerFilterBuilderRowValueConnector.propTypes = { - tagList: PropTypes.arrayOf(PropTypes.shape(tagShape)).isRequired, - isFetching: PropTypes.bool.isRequired, - isPopulated: PropTypes.bool.isRequired, - error: PropTypes.object, - dispatchFetchIndexers: PropTypes.func.isRequired -}; - -export default connect(createMapStateToProps, mapDispatchToProps)(IndexerFilterBuilderRowValueConnector); diff --git a/frontend/src/Components/Filter/Builder/MetadataProfileFilterBuilderRowValue.tsx b/frontend/src/Components/Filter/Builder/MetadataProfileFilterBuilderRowValue.tsx deleted file mode 100644 index bbd9a8274..000000000 --- a/frontend/src/Components/Filter/Builder/MetadataProfileFilterBuilderRowValue.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import React from 'react'; -import { useSelector } from 'react-redux'; -import { createSelector } from 'reselect'; -import AppState from 'App/State/AppState'; -import FilterBuilderRowValueProps from 'Components/Filter/Builder/FilterBuilderRowValueProps'; -import sortByProp from 'Utilities/Array/sortByProp'; -import FilterBuilderRowValue from './FilterBuilderRowValue'; - -function createMetadataProfilesSelector() { - return createSelector( - (state: AppState) => state.settings.metadataProfiles.items, - (metadataProfiles) => { - return metadataProfiles; - } - ); -} - -function MetadataProfileFilterBuilderRowValue( - props: FilterBuilderRowValueProps -) { - const metadataProfiles = useSelector(createMetadataProfilesSelector()); - - const tagList = metadataProfiles - .map(({ id, name }) => ({ id, name })) - .sort(sortByProp('name')); - - return ; -} - -export default MetadataProfileFilterBuilderRowValue; diff --git a/frontend/src/Components/Filter/Builder/MonitorNewItemsFilterBuilderRowValue.tsx b/frontend/src/Components/Filter/Builder/MonitorNewItemsFilterBuilderRowValue.tsx deleted file mode 100644 index 812d8c5b1..000000000 --- a/frontend/src/Components/Filter/Builder/MonitorNewItemsFilterBuilderRowValue.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import React from 'react'; -import FilterBuilderRowValueProps from 'Components/Filter/Builder/FilterBuilderRowValueProps'; -import translate from 'Utilities/String/translate'; -import FilterBuilderRowValue from './FilterBuilderRowValue'; - -const options = [ - { - id: 'all', - get name() { - return translate('AllAlbums'); - }, - }, - { - id: 'new', - get name() { - return translate('New'); - }, - }, - { - id: 'none', - get name() { - return translate('None'); - }, - }, -]; - -function MonitorNewItemsFilterBuilderRowValue( - props: FilterBuilderRowValueProps -) { - return ; -} - -export default MonitorNewItemsFilterBuilderRowValue; diff --git a/frontend/src/Components/Filter/Builder/ProtocolFilterBuilderRowValue.js b/frontend/src/Components/Filter/Builder/ProtocolFilterBuilderRowValue.js deleted file mode 100644 index ae63ae0eb..000000000 --- a/frontend/src/Components/Filter/Builder/ProtocolFilterBuilderRowValue.js +++ /dev/null @@ -1,18 +0,0 @@ -import React from 'react'; -import FilterBuilderRowValue from './FilterBuilderRowValue'; - -const protocols = [ - { id: 'torrent', name: 'Torrent' }, - { id: 'usenet', name: 'Usenet' } -]; - -function ProtocolFilterBuilderRowValue(props) { - return ( - - ); -} - -export default ProtocolFilterBuilderRowValue; diff --git a/frontend/src/Components/Filter/Builder/QualityFilterBuilderRowValueConnector.js b/frontend/src/Components/Filter/Builder/QualityFilterBuilderRowValueConnector.js deleted file mode 100644 index fd6e466d4..000000000 --- a/frontend/src/Components/Filter/Builder/QualityFilterBuilderRowValueConnector.js +++ /dev/null @@ -1,75 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import { connect } from 'react-redux'; -import { createSelector } from 'reselect'; -import tagShape from 'Helpers/Props/Shapes/tagShape'; -import { fetchQualityProfileSchema } from 'Store/Actions/settingsActions'; -import getQualities from 'Utilities/Quality/getQualities'; -import FilterBuilderRowValue from './FilterBuilderRowValue'; - -function createMapStateToProps() { - return createSelector( - (state) => state.settings.qualityProfiles, - (qualityProfiles) => { - const { - isSchemaFetching: isFetching, - isSchemaPopulated: isPopulated, - schemaError: error, - schema - } = qualityProfiles; - - const tagList = getQualities(schema.items); - - return { - isFetching, - isPopulated, - error, - tagList - }; - } - ); -} - -const mapDispatchToProps = { - dispatchFetchQualityProfileSchema: fetchQualityProfileSchema -}; - -class QualityFilterBuilderRowValueConnector extends Component { - - // - // Lifecycle - - componentDidMount = () => { - if (!this.props.isPopulated) { - this.props.dispatchFetchQualityProfileSchema(); - } - }; - - // - // Render - - render() { - const { - isFetching, - isPopulated, - error, - ...otherProps - } = this.props; - - return ( - - ); - } -} - -QualityFilterBuilderRowValueConnector.propTypes = { - tagList: PropTypes.arrayOf(PropTypes.shape(tagShape)).isRequired, - isFetching: PropTypes.bool.isRequired, - isPopulated: PropTypes.bool.isRequired, - error: PropTypes.object, - dispatchFetchQualityProfileSchema: PropTypes.func.isRequired -}; - -export default connect(createMapStateToProps, mapDispatchToProps)(QualityFilterBuilderRowValueConnector); diff --git a/frontend/src/Components/Filter/Builder/QualityProfileFilterBuilderRowValue.tsx b/frontend/src/Components/Filter/Builder/QualityProfileFilterBuilderRowValue.tsx deleted file mode 100644 index 50036cb90..000000000 --- a/frontend/src/Components/Filter/Builder/QualityProfileFilterBuilderRowValue.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import React from 'react'; -import { useSelector } from 'react-redux'; -import { createSelector } from 'reselect'; -import AppState from 'App/State/AppState'; -import FilterBuilderRowValueProps from 'Components/Filter/Builder/FilterBuilderRowValueProps'; -import sortByProp from 'Utilities/Array/sortByProp'; -import FilterBuilderRowValue from './FilterBuilderRowValue'; - -function createQualityProfilesSelector() { - return createSelector( - (state: AppState) => state.settings.qualityProfiles.items, - (qualityProfiles) => { - return qualityProfiles; - } - ); -} - -function QualityProfileFilterBuilderRowValue( - props: FilterBuilderRowValueProps -) { - const qualityProfiles = useSelector(createQualityProfilesSelector()); - - const tagList = qualityProfiles - .map(({ id, name }) => ({ id, name })) - .sort(sortByProp('name')); - - return ; -} - -export default QualityProfileFilterBuilderRowValue; diff --git a/frontend/src/Components/Filter/Builder/TagFilterBuilderRowValueConnector.js b/frontend/src/Components/Filter/Builder/TagFilterBuilderRowValueConnector.js deleted file mode 100644 index 60e04c446..000000000 --- a/frontend/src/Components/Filter/Builder/TagFilterBuilderRowValueConnector.js +++ /dev/null @@ -1,27 +0,0 @@ -import { connect } from 'react-redux'; -import { createSelector } from 'reselect'; -import createTagsSelector from 'Store/Selectors/createTagsSelector'; -import FilterBuilderRowValue from './FilterBuilderRowValue'; - -function createMapStateToProps() { - return createSelector( - createTagsSelector(), - (tagList) => { - return { - tagList: tagList.map((tag) => { - const { - id, - label: name - } = tag; - - return { - id, - name - }; - }) - }; - } - ); -} - -export default connect(createMapStateToProps)(FilterBuilderRowValue); diff --git a/frontend/src/Components/Filter/CustomFilters/CustomFilter.css b/frontend/src/Components/Filter/CustomFilters/CustomFilter.css deleted file mode 100644 index e2b8c72bf..000000000 --- a/frontend/src/Components/Filter/CustomFilters/CustomFilter.css +++ /dev/null @@ -1,17 +0,0 @@ -.customFilter { - display: flex; - margin-bottom: 5px; - padding: 5px; - - &:hover { - background-color: var(--tableRowHoverBackgroundColor); - } -} - -.label { - flex: 0 1 300px; -} - -.actions { - flex: 0 0 60px; -} diff --git a/frontend/src/Components/Filter/CustomFilters/CustomFilter.css.d.ts b/frontend/src/Components/Filter/CustomFilters/CustomFilter.css.d.ts deleted file mode 100644 index af5bfa967..000000000 --- a/frontend/src/Components/Filter/CustomFilters/CustomFilter.css.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'actions': string; - 'customFilter': string; - 'label': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Components/Filter/CustomFilters/CustomFilter.js b/frontend/src/Components/Filter/CustomFilters/CustomFilter.js deleted file mode 100644 index 9f378d5a2..000000000 --- a/frontend/src/Components/Filter/CustomFilters/CustomFilter.js +++ /dev/null @@ -1,115 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import IconButton from 'Components/Link/IconButton'; -import SpinnerIconButton from 'Components/Link/SpinnerIconButton'; -import { icons } from 'Helpers/Props'; -import translate from 'Utilities/String/translate'; -import styles from './CustomFilter.css'; - -class CustomFilter extends Component { - - // - // Lifecycle - - constructor(props, context) { - super(props, context); - - this.state = { - isDeleting: false - }; - } - - componentDidUpdate(prevProps) { - const { - isDeleting, - deleteError - } = this.props; - - if (prevProps.isDeleting && !isDeleting && this.state.isDeleting && deleteError) { - this.setState({ isDeleting: false }); - } - } - - componentWillUnmount() { - const { - id, - selectedFilterKey, - dispatchSetFilter - } = this.props; - - // Assume that delete and then unmounting means the deletion was successful. - // Moving this check to an ancestor would be more accurate, but would have - // more boilerplate. - if (this.state.isDeleting && id === selectedFilterKey) { - dispatchSetFilter({ selectedFilterKey: 'all' }); - } - } - - // - // Listeners - - onEditPress = () => { - const { - id, - onEditPress - } = this.props; - - onEditPress(id); - }; - - onRemovePress = () => { - const { - id, - dispatchDeleteCustomFilter - } = this.props; - - this.setState({ isDeleting: true }, () => { - dispatchDeleteCustomFilter({ id }); - }); - - }; - - // - // Render - - render() { - const { - label - } = this.props; - - return ( -
-
- {label} -
- -
- - - -
-
- ); - } -} - -CustomFilter.propTypes = { - id: PropTypes.number.isRequired, - label: PropTypes.string.isRequired, - selectedFilterKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired, - isDeleting: PropTypes.bool.isRequired, - deleteError: PropTypes.object, - dispatchSetFilter: PropTypes.func.isRequired, - onEditPress: PropTypes.func.isRequired, - dispatchDeleteCustomFilter: PropTypes.func.isRequired -}; - -export default CustomFilter; diff --git a/frontend/src/Components/Filter/CustomFilters/CustomFiltersModalContent.css b/frontend/src/Components/Filter/CustomFilters/CustomFiltersModalContent.css deleted file mode 100644 index c391764dc..000000000 --- a/frontend/src/Components/Filter/CustomFilters/CustomFiltersModalContent.css +++ /dev/null @@ -1,3 +0,0 @@ -.addButtonContainer { - margin-top: 15px; -} diff --git a/frontend/src/Components/Filter/CustomFilters/CustomFiltersModalContent.css.d.ts b/frontend/src/Components/Filter/CustomFilters/CustomFiltersModalContent.css.d.ts deleted file mode 100644 index b505d0767..000000000 --- a/frontend/src/Components/Filter/CustomFilters/CustomFiltersModalContent.css.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'addButtonContainer': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Components/Filter/CustomFilters/CustomFiltersModalContent.js b/frontend/src/Components/Filter/CustomFilters/CustomFiltersModalContent.js deleted file mode 100644 index d70b97e44..000000000 --- a/frontend/src/Components/Filter/CustomFilters/CustomFiltersModalContent.js +++ /dev/null @@ -1,84 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -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 sortByProp from 'Utilities/Array/sortByProp'; -import translate from 'Utilities/String/translate'; -import CustomFilter from './CustomFilter'; -import styles from './CustomFiltersModalContent.css'; - -function CustomFiltersModalContent(props) { - const { - selectedFilterKey, - customFilters, - isDeleting, - deleteError, - dispatchDeleteCustomFilter, - dispatchSetFilter, - onAddCustomFilter, - onEditCustomFilter, - onModalClose - } = props; - - return ( - - - {translate('CustomFilters')} - - - - { - customFilters - .sort((a, b) => sortByProp(a, b, 'label')) - .map((customFilter) => { - return ( - - ); - }) - } - -
- -
-
- - - - -
- ); -} - -CustomFiltersModalContent.propTypes = { - selectedFilterKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired, - customFilters: PropTypes.arrayOf(PropTypes.object).isRequired, - isDeleting: PropTypes.bool.isRequired, - deleteError: PropTypes.object, - dispatchDeleteCustomFilter: PropTypes.func.isRequired, - dispatchSetFilter: PropTypes.func.isRequired, - onAddCustomFilter: PropTypes.func.isRequired, - onEditCustomFilter: PropTypes.func.isRequired, - onModalClose: PropTypes.func.isRequired -}; - -export default CustomFiltersModalContent; diff --git a/frontend/src/Components/Filter/CustomFilters/CustomFiltersModalContentConnector.js b/frontend/src/Components/Filter/CustomFilters/CustomFiltersModalContentConnector.js deleted file mode 100644 index 32425d766..000000000 --- a/frontend/src/Components/Filter/CustomFilters/CustomFiltersModalContentConnector.js +++ /dev/null @@ -1,23 +0,0 @@ -import { connect } from 'react-redux'; -import { createSelector } from 'reselect'; -import { deleteCustomFilter } from 'Store/Actions/customFilterActions'; -import CustomFiltersModalContent from './CustomFiltersModalContent'; - -function createMapStateToProps() { - return createSelector( - (state) => state.customFilters.isDeleting, - (state) => state.customFilters.deleteError, - (isDeleting, deleteError) => { - return { - isDeleting, - deleteError - }; - } - ); -} - -const mapDispatchToProps = { - dispatchDeleteCustomFilter: deleteCustomFilter -}; - -export default connect(createMapStateToProps, mapDispatchToProps)(CustomFiltersModalContent); diff --git a/frontend/src/Components/Filter/FilterModal.js b/frontend/src/Components/Filter/FilterModal.js deleted file mode 100644 index d52362d7b..000000000 --- a/frontend/src/Components/Filter/FilterModal.js +++ /dev/null @@ -1,102 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import Modal from 'Components/Modal/Modal'; -import FilterBuilderModalContentConnector from './Builder/FilterBuilderModalContentConnector'; -import CustomFiltersModalContentConnector from './CustomFilters/CustomFiltersModalContentConnector'; - -class FilterModal extends Component { - - // - // Lifecycle - - constructor(props, context) { - super(props, context); - - this.state = { - filterBuilder: !props.customFilters.length, - id: null - }; - } - - // - // Listeners - - onAddCustomFilter = () => { - this.setState({ - filterBuilder: true - }); - }; - - onEditCustomFilter = (id) => { - this.setState({ - filterBuilder: true, - id - }); - }; - - onCancelPress = () => { - if (this.state.filterBuilder) { - this.setState({ - filterBuilder: false, - id: null - }); - } else { - this.onModalClose(); - } - }; - - onModalClose = () => { - this.setState({ - filterBuilder: false, - id: null - }, () => { - this.props.onModalClose(); - }); - }; - - // - // Render - - render() { - const { - isOpen, - ...otherProps - } = this.props; - - const { - filterBuilder, - id - } = this.state; - - return ( - - { - filterBuilder ? - : - - } - - ); - } -} - -FilterModal.propTypes = { - isOpen: PropTypes.bool.isRequired, - customFilters: PropTypes.arrayOf(PropTypes.object).isRequired, - onModalClose: PropTypes.func.isRequired -}; - -export default FilterModal; diff --git a/frontend/src/Components/Form/AlbumReleaseSelectInputConnector.js b/frontend/src/Components/Form/AlbumReleaseSelectInputConnector.js deleted file mode 100644 index 4433fac6e..000000000 --- a/frontend/src/Components/Form/AlbumReleaseSelectInputConnector.js +++ /dev/null @@ -1,81 +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 shortenList from 'Utilities/String/shortenList'; -import titleCase from 'Utilities/String/titleCase'; -import SelectInput from './SelectInput'; - -function createMapStateToProps() { - return createSelector( - (state, { albumReleases }) => albumReleases, - (albumReleases) => { - const values = _.map(albumReleases.value, (albumRelease) => { - - const { - foreignReleaseId, - title, - disambiguation, - mediumCount, - trackCount, - country, - format - } = albumRelease; - - return { - key: foreignReleaseId, - value: `${title}` + - `${disambiguation ? ' (' : ''}${titleCase(disambiguation)}${disambiguation ? ')' : ''}` + - `, ${mediumCount} med, ${trackCount} tracks` + - `${country && country.length > 0 ? `, ${shortenList(country)}` : ''}` + - `${format ? `, [${format}]` : ''}` - }; - }); - - const sortedValues = _.orderBy(values, ['value']); - - const value = _.find(albumReleases.value, { monitored: true }).foreignReleaseId; - - return { - values: sortedValues, - value - }; - } - ); -} - -class AlbumReleaseSelectInputConnector extends Component { - - // - // Listeners - - onChange = ({ name, value }) => { - const { - albumReleases - } = this.props; - - const updatedReleases = _.map(albumReleases.value, (e) => ({ ...e, monitored: false })); - _.find(updatedReleases, { foreignReleaseId: value }).monitored = true; - - this.props.onChange({ name, value: updatedReleases }); - }; - - render() { - - return ( - - ); - } -} - -AlbumReleaseSelectInputConnector.propTypes = { - name: PropTypes.string.isRequired, - onChange: PropTypes.func.isRequired, - albumReleases: PropTypes.object -}; - -export default connect(createMapStateToProps)(AlbumReleaseSelectInputConnector); diff --git a/frontend/src/Components/Form/ArtistTagInput.tsx b/frontend/src/Components/Form/ArtistTagInput.tsx deleted file mode 100644 index 3edb46ec4..000000000 --- a/frontend/src/Components/Form/ArtistTagInput.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import React, { useCallback } from 'react'; -import TagInputConnector from './TagInputConnector'; - -interface ArtistTagInputProps { - name: string; - value: number | number[]; - onChange: ({ - name, - value, - }: { - name: string; - value: number | number[]; - }) => void; -} - -export default function ArtistTagInput(props: ArtistTagInputProps) { - const { value, onChange, ...otherProps } = props; - const isArray = Array.isArray(value); - - const handleChange = useCallback( - ({ name, value: newValue }: { name: string; value: number[] }) => { - if (isArray) { - onChange({ name, value: newValue }); - } else { - onChange({ - name, - value: newValue.length ? newValue[newValue.length - 1] : 0, - }); - } - }, - [isArray, onChange] - ); - - let finalValue: number[] = []; - - if (isArray) { - finalValue = value; - } else if (value === 0) { - finalValue = []; - } else { - finalValue = [value]; - } - - return ( - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore 2786 'TagInputConnector' isn't typed yet - - ); -} diff --git a/frontend/src/Components/Form/AutoCompleteInput.js b/frontend/src/Components/Form/AutoCompleteInput.js deleted file mode 100644 index d35969c4c..000000000 --- a/frontend/src/Components/Form/AutoCompleteInput.js +++ /dev/null @@ -1,98 +0,0 @@ -import jdu from 'jdu'; -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import AutoSuggestInput from './AutoSuggestInput'; - -class AutoCompleteInput extends Component { - - // - // Lifecycle - - constructor(props, context) { - super(props, context); - - this.state = { - suggestions: [] - }; - } - - // - // Control - - getSuggestionValue(item) { - return item; - } - - renderSuggestion(item) { - return item; - } - - // - // Listeners - - onInputChange = (event, { newValue }) => { - this.props.onChange({ - name: this.props.name, - value: newValue - }); - }; - - onInputBlur = () => { - this.setState({ suggestions: [] }); - }; - - onSuggestionsFetchRequested = ({ value }) => { - const { values } = this.props; - const lowerCaseValue = jdu.replace(value).toLowerCase(); - - const filteredValues = values.filter((v) => { - return jdu.replace(v).toLowerCase().contains(lowerCaseValue); - }); - - this.setState({ suggestions: filteredValues }); - }; - - onSuggestionsClearRequested = () => { - this.setState({ suggestions: [] }); - }; - - // - // Render - - render() { - const { - name, - value, - ...otherProps - } = this.props; - - const { suggestions } = this.state; - - return ( - - ); - } -} - -AutoCompleteInput.propTypes = { - name: PropTypes.string.isRequired, - value: PropTypes.string, - values: PropTypes.arrayOf(PropTypes.string).isRequired, - onChange: PropTypes.func.isRequired -}; - -AutoCompleteInput.defaultProps = { - value: '' -}; - -export default AutoCompleteInput; diff --git a/frontend/src/Components/Form/AutoSuggestInput.css b/frontend/src/Components/Form/AutoSuggestInput.css deleted file mode 100644 index 7dc416960..000000000 --- a/frontend/src/Components/Form/AutoSuggestInput.css +++ /dev/null @@ -1,50 +0,0 @@ -.input { - composes: input from '~Components/Form/Input.css'; -} - -.hasError { - composes: hasError from '~Components/Form/Input.css'; -} - -.hasWarning { - composes: hasWarning from '~Components/Form/Input.css'; -} - -.inputContainer { - flex-grow: 1; -} - -.suggestionsContainer { - @add-mixin scrollbar; - @add-mixin scrollbarTrack; - @add-mixin scrollbarThumb; -} - -.suggestionsContainerOpen { - z-index: $popperZIndex; - - .suggestionsContainer { - overflow-y: auto; - max-height: 200px; - width: 100%; - border: 1px solid var(--inputBorderColor); - border-radius: 4px; - background-color: var(--inputBackgroundColor); - box-shadow: inset 0 1px 1px var(--inputBoxShadowColor); - } -} - -.suggestionsList { - margin: 5px 0; - padding-left: 0; - max-height: 200px; - list-style-type: none; -} - -.suggestion { - padding: 0 16px; -} - -.suggestionHighlighted { - background-color: var(--menuItemHoverBackgroundColor); -} diff --git a/frontend/src/Components/Form/AutoSuggestInput.css.d.ts b/frontend/src/Components/Form/AutoSuggestInput.css.d.ts deleted file mode 100644 index 2b8f51924..000000000 --- a/frontend/src/Components/Form/AutoSuggestInput.css.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'hasError': string; - 'hasWarning': string; - 'input': string; - 'inputContainer': string; - 'suggestion': string; - 'suggestionHighlighted': string; - 'suggestionsContainer': string; - 'suggestionsContainerOpen': string; - 'suggestionsList': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Components/Form/AutoSuggestInput.js b/frontend/src/Components/Form/AutoSuggestInput.js deleted file mode 100644 index 34ec7530b..000000000 --- a/frontend/src/Components/Form/AutoSuggestInput.js +++ /dev/null @@ -1,257 +0,0 @@ -import classNames from 'classnames'; -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import Autosuggest from 'react-autosuggest'; -import { Manager, Popper, Reference } from 'react-popper'; -import Portal from 'Components/Portal'; -import styles from './AutoSuggestInput.css'; - -class AutoSuggestInput extends Component { - - // - // Lifecycle - - constructor(props, context) { - super(props, context); - - this._scheduleUpdate = null; - } - - componentDidUpdate(prevProps) { - if ( - this._scheduleUpdate && - prevProps.suggestions !== this.props.suggestions - ) { - this._scheduleUpdate(); - } - } - - // - // Control - - renderInputComponent = (inputProps) => { - const { renderInputComponent } = this.props; - - return ( - - {({ ref }) => { - if (renderInputComponent) { - return renderInputComponent(inputProps, ref); - } - - return ( -
- -
- ); - }} -
- ); - }; - - renderSuggestionsContainer = ({ containerProps, children }) => { - return ( - - - {({ ref: popperRef, style, scheduleUpdate }) => { - this._scheduleUpdate = scheduleUpdate; - - return ( -
-
- {children} -
-
- ); - }} -
-
- ); - }; - - // - // Listeners - - onComputeMaxHeight = (data) => { - const { - top, - bottom, - width - } = data.offsets.reference; - - const windowHeight = window.innerHeight; - - if ((/^botton/).test(data.placement)) { - data.styles.maxHeight = windowHeight - bottom; - } else { - data.styles.maxHeight = top; - } - - data.styles.width = width; - - return data; - }; - - onInputChange = (event, { newValue }) => { - this.props.onChange({ - name: this.props.name, - value: newValue - }); - }; - - onInputKeyDown = (event) => { - const { - name, - value, - suggestions, - onChange - } = this.props; - - if ( - event.key === 'Tab' && - suggestions.length && - suggestions[0] !== this.props.value - ) { - event.preventDefault(); - - if (value) { - onChange({ - name, - value: suggestions[0] - }); - } - } - }; - - // - // Render - - render() { - const { - forwardedRef, - className, - inputContainerClassName, - name, - value, - placeholder, - suggestions, - hasError, - hasWarning, - getSuggestionValue, - renderSuggestion, - onInputChange, - onInputKeyDown, - onInputFocus, - onInputBlur, - onSuggestionsFetchRequested, - onSuggestionsClearRequested, - onSuggestionSelected, - ...otherProps - } = this.props; - - const inputProps = { - className: classNames( - className, - hasError && styles.hasError, - hasWarning && styles.hasWarning - ), - name, - value, - placeholder, - autoComplete: 'off', - spellCheck: false, - onChange: onInputChange || this.onInputChange, - onKeyDown: onInputKeyDown || this.onInputKeyDown, - onFocus: onInputFocus, - onBlur: onInputBlur - }; - - const theme = { - container: inputContainerClassName, - containerOpen: styles.suggestionsContainerOpen, - suggestionsContainer: styles.suggestionsContainer, - suggestionsList: styles.suggestionsList, - suggestion: styles.suggestion, - suggestionHighlighted: styles.suggestionHighlighted - }; - - return ( - - - - ); - } -} - -AutoSuggestInput.propTypes = { - forwardedRef: PropTypes.func, - className: PropTypes.string.isRequired, - inputContainerClassName: PropTypes.string.isRequired, - name: PropTypes.string.isRequired, - value: PropTypes.oneOfType([PropTypes.string, PropTypes.array]), - placeholder: PropTypes.string, - suggestions: PropTypes.array.isRequired, - hasError: PropTypes.bool, - hasWarning: PropTypes.bool, - enforceMaxHeight: PropTypes.bool.isRequired, - minHeight: PropTypes.number.isRequired, - maxHeight: PropTypes.number.isRequired, - getSuggestionValue: PropTypes.func.isRequired, - renderInputComponent: PropTypes.elementType, - renderSuggestion: PropTypes.func.isRequired, - onInputChange: PropTypes.func, - onInputKeyDown: PropTypes.func, - onInputFocus: PropTypes.func, - onInputBlur: PropTypes.func.isRequired, - onSuggestionsFetchRequested: PropTypes.func.isRequired, - onSuggestionsClearRequested: PropTypes.func.isRequired, - onSuggestionSelected: PropTypes.func, - onChange: PropTypes.func.isRequired -}; - -AutoSuggestInput.defaultProps = { - className: styles.input, - inputContainerClassName: styles.inputContainer, - enforceMaxHeight: true, - minHeight: 50, - maxHeight: 200 -}; - -export default AutoSuggestInput; diff --git a/frontend/src/Components/Form/CaptchaInput.css b/frontend/src/Components/Form/CaptchaInput.css deleted file mode 100644 index 76c076834..000000000 --- a/frontend/src/Components/Form/CaptchaInput.css +++ /dev/null @@ -1,23 +0,0 @@ -.captchaInputWrapper { - display: flex; -} - -.input { - composes: input from '~Components/Form/Input.css'; -} - -.hasError { - composes: hasError from '~Components/Form/Input.css'; -} - -.hasWarning { - composes: hasWarning from '~Components/Form/Input.css'; -} - -.hasButton { - composes: hasButton from '~Components/Form/Input.css'; -} - -.recaptchaWrapper { - margin-top: 10px; -} diff --git a/frontend/src/Components/Form/CaptchaInput.css.d.ts b/frontend/src/Components/Form/CaptchaInput.css.d.ts deleted file mode 100644 index b6844144e..000000000 --- a/frontend/src/Components/Form/CaptchaInput.css.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'captchaInputWrapper': string; - 'hasButton': string; - 'hasError': string; - 'hasWarning': string; - 'input': string; - 'recaptchaWrapper': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Components/Form/CaptchaInput.js b/frontend/src/Components/Form/CaptchaInput.js deleted file mode 100644 index b422198b5..000000000 --- a/frontend/src/Components/Form/CaptchaInput.js +++ /dev/null @@ -1,84 +0,0 @@ -import classNames from 'classnames'; -import PropTypes from 'prop-types'; -import React from 'react'; -import ReCAPTCHA from 'react-google-recaptcha'; -import Icon from 'Components/Icon'; -import { icons } from 'Helpers/Props'; -import FormInputButton from './FormInputButton'; -import TextInput from './TextInput'; -import styles from './CaptchaInput.css'; - -function CaptchaInput(props) { - const { - className, - name, - value, - hasError, - hasWarning, - refreshing, - siteKey, - secretToken, - onChange, - onRefreshPress, - onCaptchaChange - } = props; - - return ( -
-
- - - - - -
- - { - !!siteKey && !!secretToken && -
- -
- } -
- ); -} - -CaptchaInput.propTypes = { - className: PropTypes.string.isRequired, - name: PropTypes.string.isRequired, - value: PropTypes.string.isRequired, - hasError: PropTypes.bool, - hasWarning: PropTypes.bool, - refreshing: PropTypes.bool.isRequired, - siteKey: PropTypes.string, - secretToken: PropTypes.string, - onChange: PropTypes.func.isRequired, - onRefreshPress: PropTypes.func.isRequired, - onCaptchaChange: PropTypes.func.isRequired -}; - -CaptchaInput.defaultProps = { - className: styles.input, - value: '' -}; - -export default CaptchaInput; diff --git a/frontend/src/Components/Form/CaptchaInputConnector.js b/frontend/src/Components/Form/CaptchaInputConnector.js deleted file mode 100644 index ad83bf02f..000000000 --- a/frontend/src/Components/Form/CaptchaInputConnector.js +++ /dev/null @@ -1,98 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import { connect } from 'react-redux'; -import { createSelector } from 'reselect'; -import { getCaptchaCookie, refreshCaptcha, resetCaptcha } from 'Store/Actions/captchaActions'; -import CaptchaInput from './CaptchaInput'; - -function createMapStateToProps() { - return createSelector( - (state) => state.captcha, - (captcha) => { - return captcha; - } - ); -} - -const mapDispatchToProps = { - refreshCaptcha, - getCaptchaCookie, - resetCaptcha -}; - -class CaptchaInputConnector extends Component { - - // - // Lifecycle - - componentDidUpdate(prevProps) { - const { - name, - token, - onChange - } = this.props; - - if (token && token !== prevProps.token) { - onChange({ name, value: token }); - } - } - - componentWillUnmount = () => { - this.props.resetCaptcha(); - }; - - // - // Listeners - - onRefreshPress = () => { - const { - provider, - providerData - } = this.props; - - this.props.refreshCaptcha({ provider, providerData }); - }; - - onCaptchaChange = (captchaResponse) => { - // If the captcha has expired `captchaResponse` will be null. - // In the event it's null don't try to get the captchaCookie. - // TODO: Should we clear the cookie? or reset the captcha? - - if (!captchaResponse) { - return; - } - - const { - provider, - providerData - } = this.props; - - this.props.getCaptchaCookie({ provider, providerData, captchaResponse }); - }; - - // - // Render - - render() { - return ( - - ); - } -} - -CaptchaInputConnector.propTypes = { - provider: PropTypes.string.isRequired, - providerData: PropTypes.object.isRequired, - name: PropTypes.string.isRequired, - token: PropTypes.string, - onChange: PropTypes.func.isRequired, - refreshCaptcha: PropTypes.func.isRequired, - getCaptchaCookie: PropTypes.func.isRequired, - resetCaptcha: PropTypes.func.isRequired -}; - -export default connect(createMapStateToProps, mapDispatchToProps)(CaptchaInputConnector); diff --git a/frontend/src/Components/Form/CheckInput.css b/frontend/src/Components/Form/CheckInput.css deleted file mode 100644 index cf9f27f91..000000000 --- a/frontend/src/Components/Form/CheckInput.css +++ /dev/null @@ -1,105 +0,0 @@ -.container { - position: relative; - display: flex; - flex: 1 1 65%; - user-select: none; -} - -.label { - display: flex; - margin-bottom: 0; - min-height: 21px; - font-weight: normal; - cursor: pointer; -} - -.checkbox { - position: absolute; - opacity: 0; - cursor: pointer; - pointer-events: none; - - &:global(.isDisabled) { - cursor: not-allowed; - } -} - -.input { - flex: 1 0 auto; - margin-top: 7px; - margin-right: 5px; - width: 20px; - height: 20px; - border: 1px solid #ccc; - border-radius: 2px; - background-color: var(--white); - color: var(--white); - text-align: center; - line-height: 20px; -} - -.checkbox:focus + .input { - outline: 0; - border-color: var(--inputFocusBorderColor); - box-shadow: inset 0 1px 1px var(--inputBoxShadowColor), 0 0 8px var(--inputFocusBoxShadowColor); -} - -.dangerIsChecked { - border-color: var(--dangerColor); - background-color: var(--dangerColor); - - &.isDisabled { - opacity: 0.7; - } -} - -.primaryIsChecked { - border-color: var(--lidarrGreen); - background-color: var(--lidarrGreen); - - &.isDisabled { - opacity: 0.7; - } -} - -.successIsChecked { - border-color: var(--successColor); - background-color: var(--successColor); - - &.isDisabled { - opacity: 0.7; - } -} - -.warningIsChecked { - border-color: var(--warningColor); - background-color: var(--warningColor); - - &.isDisabled { - opacity: 0.7; - } -} - -.isNotChecked { - &.isDisabled { - border-color: var(--disabledCheckInputColor); - background-color: var(--disabledCheckInputColor); - opacity: 0.7; - } -} - -.isIndeterminate { - border-color: var(--gray); - background-color: var(--gray); -} - -.helpText { - composes: helpText from '~Components/Form/FormInputHelpText.css'; - - margin-top: 8px; - margin-left: 5px; -} - -.isDisabled { - cursor: not-allowed; -} diff --git a/frontend/src/Components/Form/CheckInput.css.d.ts b/frontend/src/Components/Form/CheckInput.css.d.ts deleted file mode 100644 index bba6b63bb..000000000 --- a/frontend/src/Components/Form/CheckInput.css.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'checkbox': string; - 'container': string; - 'dangerIsChecked': string; - 'helpText': string; - 'input': string; - 'isDisabled': string; - 'isIndeterminate': string; - 'isNotChecked': string; - 'label': string; - 'primaryIsChecked': string; - 'successIsChecked': string; - 'warningIsChecked': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Components/Form/CheckInput.js b/frontend/src/Components/Form/CheckInput.js deleted file mode 100644 index 26d915880..000000000 --- a/frontend/src/Components/Form/CheckInput.js +++ /dev/null @@ -1,191 +0,0 @@ -import classNames from 'classnames'; -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import Icon from 'Components/Icon'; -import { icons, kinds } from 'Helpers/Props'; -import FormInputHelpText from './FormInputHelpText'; -import styles from './CheckInput.css'; - -class CheckInput extends Component { - - // - // Lifecycle - - constructor(props, context) { - super(props, context); - - this._checkbox = null; - } - - componentDidMount() { - this.setIndeterminate(); - } - - componentDidUpdate() { - this.setIndeterminate(); - } - - // - // Control - - setIndeterminate() { - if (!this._checkbox) { - return; - } - - const { - value, - uncheckedValue, - checkedValue - } = this.props; - - this._checkbox.indeterminate = value !== uncheckedValue && value !== checkedValue; - } - - toggleChecked = (checked, shiftKey) => { - const { - name, - value, - checkedValue, - uncheckedValue - } = this.props; - - const newValue = checked ? checkedValue : uncheckedValue; - - if (value !== newValue) { - this.props.onChange({ - name, - value: newValue, - shiftKey - }); - } - }; - - // - // Listeners - - setRef = (ref) => { - this._checkbox = ref; - }; - - onClick = (event) => { - if (this.props.isDisabled) { - return; - } - - const shiftKey = event.nativeEvent.shiftKey; - const checked = !this._checkbox.checked; - - event.preventDefault(); - this.toggleChecked(checked, shiftKey); - }; - - onChange = (event) => { - const checked = event.target.checked; - const shiftKey = event.nativeEvent.shiftKey; - - this.toggleChecked(checked, shiftKey); - }; - - // - // Render - - render() { - const { - className, - containerClassName, - name, - value, - checkedValue, - uncheckedValue, - helpText, - helpTextWarning, - isDisabled, - kind - } = this.props; - - const isChecked = value === checkedValue; - const isUnchecked = value === uncheckedValue; - const isIndeterminate = !isChecked && !isUnchecked; - const isCheckClass = `${kind}IsChecked`; - - return ( -
- -
- ); - } -} - -CheckInput.propTypes = { - className: PropTypes.string.isRequired, - containerClassName: PropTypes.string.isRequired, - name: PropTypes.string.isRequired, - checkedValue: PropTypes.bool, - uncheckedValue: PropTypes.bool, - value: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]), - helpText: PropTypes.string, - helpTextWarning: PropTypes.string, - isDisabled: PropTypes.bool, - kind: PropTypes.oneOf(kinds.all).isRequired, - onChange: PropTypes.func.isRequired -}; - -CheckInput.defaultProps = { - className: styles.input, - containerClassName: styles.container, - checkedValue: true, - uncheckedValue: false, - kind: kinds.PRIMARY -}; - -export default CheckInput; diff --git a/frontend/src/Components/Form/DeviceInput.css b/frontend/src/Components/Form/DeviceInput.css deleted file mode 100644 index 7abe83db5..000000000 --- a/frontend/src/Components/Form/DeviceInput.css +++ /dev/null @@ -1,8 +0,0 @@ -.deviceInputWrapper { - display: flex; -} - -.input { - composes: input from '~./TagInput.css'; - composes: hasButton from '~Components/Form/Input.css'; -} diff --git a/frontend/src/Components/Form/DeviceInput.css.d.ts b/frontend/src/Components/Form/DeviceInput.css.d.ts deleted file mode 100644 index e44e3fce0..000000000 --- a/frontend/src/Components/Form/DeviceInput.css.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'deviceInputWrapper': string; - 'input': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Components/Form/DeviceInput.js b/frontend/src/Components/Form/DeviceInput.js deleted file mode 100644 index 55c239cb8..000000000 --- a/frontend/src/Components/Form/DeviceInput.js +++ /dev/null @@ -1,106 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import Icon from 'Components/Icon'; -import { icons } from 'Helpers/Props'; -import tagShape from 'Helpers/Props/Shapes/tagShape'; -import FormInputButton from './FormInputButton'; -import TagInput from './TagInput'; -import styles from './DeviceInput.css'; - -class DeviceInput extends Component { - - onTagAdd = (device) => { - const { - name, - value, - onChange - } = this.props; - - // New tags won't have an ID, only a name. - const deviceId = device.id || device.name; - - onChange({ - name, - value: [...value, deviceId] - }); - }; - - onTagDelete = ({ index }) => { - const { - name, - value, - onChange - } = this.props; - - const newValue = value.slice(); - newValue.splice(index, 1); - - onChange({ - name, - value: newValue - }); - }; - - // - // Render - - render() { - const { - className, - name, - items, - selectedDevices, - hasError, - hasWarning, - isFetching, - onRefreshPress - } = this.props; - - return ( -
- - - - - -
- ); - } -} - -DeviceInput.propTypes = { - className: PropTypes.string.isRequired, - name: PropTypes.string.isRequired, - value: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])).isRequired, - items: PropTypes.arrayOf(PropTypes.shape(tagShape)).isRequired, - selectedDevices: PropTypes.arrayOf(PropTypes.shape(tagShape)).isRequired, - hasError: PropTypes.bool, - hasWarning: PropTypes.bool, - isFetching: PropTypes.bool.isRequired, - isPopulated: PropTypes.bool.isRequired, - onChange: PropTypes.func.isRequired, - onRefreshPress: PropTypes.func.isRequired -}; - -DeviceInput.defaultProps = { - className: styles.deviceInputWrapper, - inputClassName: styles.input -}; - -export default DeviceInput; diff --git a/frontend/src/Components/Form/DeviceInputConnector.js b/frontend/src/Components/Form/DeviceInputConnector.js deleted file mode 100644 index 2af9a79f6..000000000 --- a/frontend/src/Components/Form/DeviceInputConnector.js +++ /dev/null @@ -1,104 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import { connect } from 'react-redux'; -import { createSelector } from 'reselect'; -import { clearOptions, defaultState, fetchOptions } from 'Store/Actions/providerOptionActions'; -import DeviceInput from './DeviceInput'; - -function createMapStateToProps() { - return createSelector( - (state, { value }) => value, - (state) => state.providerOptions.devices || defaultState, - (value, devices) => { - - return { - ...devices, - selectedDevices: value.map((valueDevice) => { - // Disable equality ESLint rule so we don't need to worry about - // a type mismatch between the value items and the device ID. - // eslint-disable-next-line eqeqeq - const device = devices.items.find((d) => d.id == valueDevice); - - if (device) { - return { - id: device.id, - name: `${device.name} (${device.id})` - }; - } - - return { - id: valueDevice, - name: `Unknown (${valueDevice})` - }; - }) - }; - } - ); -} - -const mapDispatchToProps = { - dispatchFetchOptions: fetchOptions, - dispatchClearOptions: clearOptions -}; - -class DeviceInputConnector extends Component { - - // - // Lifecycle - - componentDidMount = () => { - this._populate(); - }; - - componentWillUnmount = () => { - this.props.dispatchClearOptions({ section: 'devices' }); - }; - - // - // Control - - _populate() { - const { - provider, - providerData, - dispatchFetchOptions - } = this.props; - - dispatchFetchOptions({ - section: 'devices', - action: 'getDevices', - provider, - providerData - }); - } - - // - // Listeners - - onRefreshPress = () => { - this._populate(); - }; - - // - // Render - - render() { - return ( - - ); - } -} - -DeviceInputConnector.propTypes = { - provider: PropTypes.string.isRequired, - providerData: PropTypes.object.isRequired, - name: PropTypes.string.isRequired, - onChange: PropTypes.func.isRequired, - dispatchFetchOptions: PropTypes.func.isRequired, - dispatchClearOptions: PropTypes.func.isRequired -}; - -export default connect(createMapStateToProps, mapDispatchToProps)(DeviceInputConnector); diff --git a/frontend/src/Components/Form/DownloadClientSelectInputConnector.js b/frontend/src/Components/Form/DownloadClientSelectInputConnector.js deleted file mode 100644 index c21f0ded6..000000000 --- a/frontend/src/Components/Form/DownloadClientSelectInputConnector.js +++ /dev/null @@ -1,102 +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 { fetchDownloadClients } from 'Store/Actions/settingsActions'; -import sortByProp from 'Utilities/Array/sortByProp'; -import translate from 'Utilities/String/translate'; -import EnhancedSelectInput from './EnhancedSelectInput'; - -function createMapStateToProps() { - return createSelector( - (state) => state.settings.downloadClients, - (state, { includeAny }) => includeAny, - (state, { protocol }) => protocol, - (downloadClients, includeAny, protocolFilter) => { - const { - isFetching, - isPopulated, - error, - items - } = downloadClients; - - const filteredItems = items.filter((item) => item.protocol === protocolFilter); - - const values = _.map(filteredItems.sort(sortByProp('name')), (downloadClient) => { - return { - key: downloadClient.id, - value: downloadClient.name, - hint: `(${downloadClient.id})` - }; - }); - - if (includeAny) { - values.unshift({ - key: 0, - value: `(${translate('Any')})` - }); - } - - return { - isFetching, - isPopulated, - error, - values - }; - } - ); -} - -const mapDispatchToProps = { - dispatchFetchDownloadClients: fetchDownloadClients -}; - -class DownloadClientSelectInputConnector extends Component { - - // - // Lifecycle - - componentDidMount() { - if (!this.props.isPopulated) { - this.props.dispatchFetchDownloadClients(); - } - } - - // - // Listeners - - onChange = ({ name, value }) => { - this.props.onChange({ name, value: parseInt(value) }); - }; - - // - // Render - - render() { - return ( - - ); - } -} - -DownloadClientSelectInputConnector.propTypes = { - isFetching: PropTypes.bool.isRequired, - isPopulated: PropTypes.bool.isRequired, - name: PropTypes.string.isRequired, - value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired, - values: PropTypes.arrayOf(PropTypes.object).isRequired, - includeAny: PropTypes.bool.isRequired, - onChange: PropTypes.func.isRequired, - dispatchFetchDownloadClients: PropTypes.func.isRequired -}; - -DownloadClientSelectInputConnector.defaultProps = { - includeAny: false, - protocol: 'torrent' -}; - -export default connect(createMapStateToProps, mapDispatchToProps)(DownloadClientSelectInputConnector); diff --git a/frontend/src/Components/Form/EnhancedSelectInput.css b/frontend/src/Components/Form/EnhancedSelectInput.css deleted file mode 100644 index defefb18e..000000000 --- a/frontend/src/Components/Form/EnhancedSelectInput.css +++ /dev/null @@ -1,105 +0,0 @@ -.enhancedSelect { - composes: input from '~Components/Form/Input.css'; - - display: flex; - align-items: center; -} - -.editableContainer { - width: 100%; -} - -.hasError { - composes: hasError from '~Components/Form/Input.css'; -} - -.hasWarning { - composes: hasWarning from '~Components/Form/Input.css'; -} - -.isDisabled { - opacity: 0.7; - cursor: not-allowed !important; -} - -.dropdownArrowContainer { - margin-left: 12px; -} - -.dropdownArrowContainerEditable { - position: absolute; - top: 0; - right: 0; - padding-right: 17px; - width: 30%; - height: 35px; - text-align: right; -} - -.dropdownArrowContainerDisabled { - composes: dropdownArrowContainer; - - color: var(--disabledInputColor); -} - -.optionsContainer { - z-index: $popperZIndex; - width: auto; -} - -.options { - composes: scroller from '~Components/Scroller/Scroller.css'; - - border: 1px solid var(--inputBorderColor); - border-radius: 4px; - background-color: var(--inputBackgroundColor); -} - -.optionsModal { - display: flex; - justify-content: center; - max-width: 90%; - max-height: 100%; - width: 350px !important; - height: auto !important; -} - -.optionsModalBody { - composes: modalBody from '~Components/Modal/ModalBody.css'; - - display: flex; - justify-content: center; - flex-direction: column; - padding: 10px 0; -} - -.optionsModalScroller { - composes: scroller from '~Components/Scroller/Scroller.css'; - - border: 1px solid var(--inputBorderColor); - border-radius: 4px; - background-color: var(--inputBackgroundColor); -} - -.loading { - display: inline-block; - margin: 5px -5px 5px 0; -} - -.mobileCloseButtonContainer { - display: flex; - justify-content: flex-end; - height: 40px; - border-bottom: 1px solid var(--borderColor); -} - -.mobileCloseButton { - width: 40px; - height: 40px; - text-align: center; - line-height: 40px; - - &:hover { - color: var(--modalCloseButtonHoverColor); - } -} diff --git a/frontend/src/Components/Form/EnhancedSelectInput.css.d.ts b/frontend/src/Components/Form/EnhancedSelectInput.css.d.ts deleted file mode 100644 index edcf0079b..000000000 --- a/frontend/src/Components/Form/EnhancedSelectInput.css.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'dropdownArrowContainer': string; - 'dropdownArrowContainerDisabled': string; - 'dropdownArrowContainerEditable': string; - 'editableContainer': string; - 'enhancedSelect': string; - 'hasError': string; - 'hasWarning': string; - 'isDisabled': string; - 'loading': string; - 'mobileCloseButton': string; - 'mobileCloseButtonContainer': string; - 'options': string; - 'optionsContainer': string; - 'optionsModal': string; - 'optionsModalBody': string; - 'optionsModalScroller': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Components/Form/EnhancedSelectInput.js b/frontend/src/Components/Form/EnhancedSelectInput.js deleted file mode 100644 index 8327b9385..000000000 --- a/frontend/src/Components/Form/EnhancedSelectInput.js +++ /dev/null @@ -1,605 +0,0 @@ -import classNames from 'classnames'; -import _ from 'lodash'; -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import { Manager, Popper, Reference } from 'react-popper'; -import Icon from 'Components/Icon'; -import Link from 'Components/Link/Link'; -import LoadingIndicator from 'Components/Loading/LoadingIndicator'; -import Measure from 'Components/Measure'; -import Modal from 'Components/Modal/Modal'; -import ModalBody from 'Components/Modal/ModalBody'; -import Portal from 'Components/Portal'; -import Scroller from 'Components/Scroller/Scroller'; -import { icons, scrollDirections, sizes } from 'Helpers/Props'; -import { isMobile as isMobileUtil } from 'Utilities/browser'; -import * as keyCodes from 'Utilities/Constants/keyCodes'; -import getUniqueElememtId from 'Utilities/getUniqueElementId'; -import HintedSelectInputOption from './HintedSelectInputOption'; -import HintedSelectInputSelectedValue from './HintedSelectInputSelectedValue'; -import TextInput from './TextInput'; -import styles from './EnhancedSelectInput.css'; - -const MINIMUM_DISTANCE_FROM_EDGE = 10; - -function isArrowKey(keyCode) { - return keyCode === keyCodes.UP_ARROW || keyCode === keyCodes.DOWN_ARROW; -} - -function getSelectedOption(selectedIndex, values) { - return values[selectedIndex]; -} - -function findIndex(startingIndex, direction, values) { - let indexToTest = startingIndex + direction; - - while (indexToTest !== startingIndex) { - if (indexToTest < 0) { - indexToTest = values.length - 1; - } else if (indexToTest >= values.length) { - indexToTest = 0; - } - - if (getSelectedOption(indexToTest, values).isDisabled) { - indexToTest = indexToTest + direction; - } else { - return indexToTest; - } - } -} - -function previousIndex(selectedIndex, values) { - return findIndex(selectedIndex, -1, values); -} - -function nextIndex(selectedIndex, values) { - return findIndex(selectedIndex, 1, values); -} - -function getSelectedIndex(props) { - const { - value, - values - } = props; - - if (Array.isArray(value)) { - return values.findIndex((v) => { - return value.size && v.key === value[0]; - }); - } - - return values.findIndex((v) => { - return v.key === value; - }); -} - -function isSelectedItem(index, props) { - const { - value, - values - } = props; - - if (Array.isArray(value)) { - return value.includes(values[index].key); - } - - return values[index].key === value; -} - -function getKey(selectedIndex, values) { - return values[selectedIndex].key; -} - -class EnhancedSelectInput extends Component { - - // - // Lifecycle - - constructor(props, context) { - super(props, context); - - this._scheduleUpdate = null; - this._buttonId = getUniqueElememtId(); - this._optionsId = getUniqueElememtId(); - - this.state = { - isOpen: false, - selectedIndex: getSelectedIndex(props), - width: 0, - isMobile: isMobileUtil() - }; - } - - componentDidUpdate(prevProps) { - if (this._scheduleUpdate) { - this._scheduleUpdate(); - } - - if (!Array.isArray(this.props.value)) { - if (prevProps.value !== this.props.value || prevProps.values !== this.props.values) { - this.setState({ - selectedIndex: getSelectedIndex(this.props) - }); - } - } - } - - // - // Control - - _addListener() { - window.addEventListener('click', this.onWindowClick); - } - - _removeListener() { - window.removeEventListener('click', this.onWindowClick); - } - - // - // Listeners - - onComputeMaxHeight = (data) => { - const windowHeight = window.innerHeight; - - data.styles.maxHeight = windowHeight - MINIMUM_DISTANCE_FROM_EDGE; - - return data; - }; - - onWindowClick = (event) => { - const button = document.getElementById(this._buttonId); - const options = document.getElementById(this._optionsId); - - if (!button || !event.target.isConnected || this.state.isMobile) { - return; - } - - if ( - !button.contains(event.target) && - options && - !options.contains(event.target) && - this.state.isOpen - ) { - this.setState({ isOpen: false }); - this._removeListener(); - } - }; - - onFocus = () => { - if (this.state.isOpen) { - this._removeListener(); - this.setState({ isOpen: false }); - } - }; - - onBlur = () => { - if (!this.props.isEditable) { - // Calling setState without this check prevents the click event from being properly handled on Chrome (it is on firefox) - const origIndex = getSelectedIndex(this.props); - - if (origIndex !== this.state.selectedIndex) { - this.setState({ selectedIndex: origIndex }); - } - } - }; - - onKeyDown = (event) => { - const { - values - } = this.props; - - const { - isOpen, - selectedIndex - } = this.state; - - const keyCode = event.keyCode; - const newState = {}; - - if (!isOpen) { - if (isArrowKey(keyCode)) { - event.preventDefault(); - newState.isOpen = true; - } - - if ( - selectedIndex == null || selectedIndex === -1 || - getSelectedOption(selectedIndex, values).isDisabled - ) { - if (keyCode === keyCodes.UP_ARROW) { - newState.selectedIndex = previousIndex(0, values); - } else if (keyCode === keyCodes.DOWN_ARROW) { - newState.selectedIndex = nextIndex(values.length - 1, values); - } - } - - this.setState(newState); - return; - } - - if (keyCode === keyCodes.UP_ARROW) { - event.preventDefault(); - newState.selectedIndex = previousIndex(selectedIndex, values); - } - - if (keyCode === keyCodes.DOWN_ARROW) { - event.preventDefault(); - newState.selectedIndex = nextIndex(selectedIndex, values); - } - - if (keyCode === keyCodes.ENTER) { - event.preventDefault(); - newState.isOpen = false; - this.onSelect(getKey(selectedIndex, values)); - } - - if (keyCode === keyCodes.TAB) { - newState.isOpen = false; - this.onSelect(getKey(selectedIndex, values)); - } - - if (keyCode === keyCodes.ESCAPE) { - event.preventDefault(); - event.stopPropagation(); - newState.isOpen = false; - newState.selectedIndex = getSelectedIndex(this.props); - } - - if (!_.isEmpty(newState)) { - this.setState(newState); - } - }; - - onPress = () => { - if (this.state.isOpen) { - this._removeListener(); - } else { - this._addListener(); - } - - if (!this.state.isOpen && this.props.onOpen) { - this.props.onOpen(); - } - - this.setState({ isOpen: !this.state.isOpen }); - }; - - onSelect = (value) => { - if (Array.isArray(this.props.value)) { - let newValue = null; - const index = this.props.value.indexOf(value); - if (index === -1) { - newValue = this.props.values.map((v) => v.key).filter((v) => (v === value) || this.props.value.includes(v)); - } else { - newValue = [...this.props.value]; - newValue.splice(index, 1); - } - this.props.onChange({ - name: this.props.name, - value: newValue - }); - } else { - this.setState({ isOpen: false }); - - this.props.onChange({ - name: this.props.name, - value - }); - } - }; - - onMeasure = ({ width }) => { - this.setState({ width }); - }; - - onOptionsModalClose = () => { - this.setState({ isOpen: false }); - }; - - // - // Render - - render() { - const { - className, - disabledClassName, - name, - value, - values, - isDisabled, - isEditable, - isFetching, - hasError, - hasWarning, - valueOptions, - selectedValueOptions, - selectedValueComponent: SelectedValueComponent, - optionComponent: OptionComponent, - onChange - } = this.props; - - const { - selectedIndex, - width, - isOpen, - isMobile - } = this.state; - - const isMultiSelect = Array.isArray(value); - const selectedOption = getSelectedOption(selectedIndex, values); - let selectedValue = value; - - if (!values.length) { - selectedValue = isMultiSelect ? [] : ''; - } - - return ( -
- - - {({ ref }) => ( -
- - { - isEditable ? -
- - - { - isFetching ? - : - null - } - - { - isFetching ? - null : - - } - -
: - - - {selectedOption ? selectedOption.value : null} - - -
- - { - isFetching ? - : - null - } - - { - isFetching ? - null : - - } -
- - } -
-
- )} -
- - - {({ ref, style, scheduleUpdate }) => { - this._scheduleUpdate = scheduleUpdate; - - return ( -
- { - isOpen && !isMobile ? - - { - values.map((v, index) => { - const hasParent = v.parentKey !== undefined; - const depth = hasParent ? 1 : 0; - const parentSelected = hasParent && value.includes(v.parentKey); - return ( - - {v.value} - - ); - }) - } - : - null - } -
- ); - } - } -
-
-
- - { - isMobile ? - - - -
- - - -
- - { - values.map((v, index) => { - const hasParent = v.parentKey !== undefined; - const depth = hasParent ? 1 : 0; - const parentSelected = hasParent && value.includes(v.parentKey); - return ( - - {v.value} - - ); - }) - } -
-
-
: - null - } -
- ); - } -} - -EnhancedSelectInput.propTypes = { - className: PropTypes.string, - disabledClassName: PropTypes.string, - name: PropTypes.string.isRequired, - value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.arrayOf(PropTypes.string), PropTypes.arrayOf(PropTypes.number)]).isRequired, - values: PropTypes.arrayOf(PropTypes.object).isRequired, - isDisabled: PropTypes.bool.isRequired, - isFetching: PropTypes.bool.isRequired, - isEditable: PropTypes.bool.isRequired, - hasError: PropTypes.bool, - hasWarning: PropTypes.bool, - valueOptions: PropTypes.object.isRequired, - selectedValueOptions: PropTypes.object.isRequired, - selectedValueComponent: PropTypes.oneOfType([PropTypes.string, PropTypes.func]).isRequired, - optionComponent: PropTypes.elementType, - onOpen: PropTypes.func, - onChange: PropTypes.func.isRequired -}; - -EnhancedSelectInput.defaultProps = { - className: styles.enhancedSelect, - disabledClassName: styles.isDisabled, - isDisabled: false, - isFetching: false, - isEditable: false, - valueOptions: {}, - selectedValueOptions: {}, - selectedValueComponent: HintedSelectInputSelectedValue, - optionComponent: HintedSelectInputOption -}; - -export default EnhancedSelectInput; diff --git a/frontend/src/Components/Form/EnhancedSelectInputConnector.js b/frontend/src/Components/Form/EnhancedSelectInputConnector.js deleted file mode 100644 index f2af4a585..000000000 --- a/frontend/src/Components/Form/EnhancedSelectInputConnector.js +++ /dev/null @@ -1,159 +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 { clearOptions, defaultState, fetchOptions } from 'Store/Actions/providerOptionActions'; -import EnhancedSelectInput from './EnhancedSelectInput'; - -const importantFieldNames = [ - 'baseUrl', - 'apiPath', - 'apiKey' -]; - -function getProviderDataKey(providerData) { - if (!providerData || !providerData.fields) { - return null; - } - - const fields = providerData.fields - .filter((f) => importantFieldNames.includes(f.name)) - .map((f) => f.value); - - return fields; -} - -function getSelectOptions(items) { - if (!items) { - return []; - } - - return items.map((option) => { - return { - key: option.value, - value: option.name, - hint: option.hint, - parentKey: option.parentValue - }; - }); -} - -function createMapStateToProps() { - return createSelector( - (state, { selectOptionsProviderAction }) => state.providerOptions[selectOptionsProviderAction] || defaultState, - (options) => { - if (options) { - return { - isFetching: options.isFetching, - values: getSelectOptions(options.items) - }; - } - } - ); -} - -const mapDispatchToProps = { - dispatchFetchOptions: fetchOptions, - dispatchClearOptions: clearOptions -}; - -class EnhancedSelectInputConnector extends Component { - - // - // Lifecycle - - constructor(props, context) { - super(props, context); - - this.state = { - refetchRequired: false - }; - } - - componentDidMount = () => { - this._populate(); - }; - - componentDidUpdate = (prevProps) => { - const prevKey = getProviderDataKey(prevProps.providerData); - const nextKey = getProviderDataKey(this.props.providerData); - - if (!_.isEqual(prevKey, nextKey)) { - this.setState({ refetchRequired: true }); - } - }; - - componentWillUnmount = () => { - this._cleanup(); - }; - - // - // Listeners - - onOpen = () => { - if (this.state.refetchRequired) { - this._populate(); - } - }; - - // - // Control - - _populate() { - const { - provider, - providerData, - selectOptionsProviderAction, - dispatchFetchOptions - } = this.props; - - if (selectOptionsProviderAction) { - this.setState({ refetchRequired: false }); - dispatchFetchOptions({ - section: selectOptionsProviderAction, - action: selectOptionsProviderAction, - provider, - providerData - }); - } - } - - _cleanup() { - const { - selectOptionsProviderAction, - dispatchClearOptions - } = this.props; - - if (selectOptionsProviderAction) { - dispatchClearOptions({ section: selectOptionsProviderAction }); - } - } - - // - // Render - - render() { - return ( - - ); - } -} - -EnhancedSelectInputConnector.propTypes = { - provider: PropTypes.string.isRequired, - providerData: PropTypes.object.isRequired, - name: PropTypes.string.isRequired, - value: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])).isRequired, - values: PropTypes.arrayOf(PropTypes.object).isRequired, - selectOptionsProviderAction: PropTypes.string, - onChange: PropTypes.func.isRequired, - isFetching: PropTypes.bool.isRequired, - dispatchFetchOptions: PropTypes.func.isRequired, - dispatchClearOptions: PropTypes.func.isRequired -}; - -export default connect(createMapStateToProps, mapDispatchToProps)(EnhancedSelectInputConnector); diff --git a/frontend/src/Components/Form/EnhancedSelectInputOption.css b/frontend/src/Components/Form/EnhancedSelectInputOption.css deleted file mode 100644 index d7f0e861b..000000000 --- a/frontend/src/Components/Form/EnhancedSelectInputOption.css +++ /dev/null @@ -1,65 +0,0 @@ -.option { - display: flex; - align-items: center; - justify-content: space-between; - padding: 5px 10px; - width: 100%; - cursor: default; - - &:hover { - background-color: var(--inputHoverBackgroundColor); - } - - &.isDisabled { - cursor: not-allowed; - } -} - -.optionCheck { - composes: container from '~./CheckInput.css'; - - flex: 0 0 0; -} - -.optionCheckInput { - composes: input from '~./CheckInput.css'; - - margin-top: 0; -} - -.isSelected { - background-color: var(--inputSelectedBackgroundColor); - - &:hover { - background-color: var(--inputSelectedBackgroundColor); - } - - &.isMobile { - background-color: inherit; - - .iconContainer { - color: var(--primaryColor); - } - } -} - -.isDisabled { - background-color: #aaa; -} - -.isHidden { - display: none; -} - -.isMobile { - height: 50px; - border-bottom: 1px solid var(--borderColor); - - &:last-child { - border: none; - } - - &:hover { - background-color: unset; - } -} diff --git a/frontend/src/Components/Form/EnhancedSelectInputOption.css.d.ts b/frontend/src/Components/Form/EnhancedSelectInputOption.css.d.ts deleted file mode 100644 index 59675cd91..000000000 --- a/frontend/src/Components/Form/EnhancedSelectInputOption.css.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'iconContainer': string; - 'isDisabled': string; - 'isHidden': string; - 'isMobile': string; - 'isSelected': string; - 'option': string; - 'optionCheck': string; - 'optionCheckInput': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Components/Form/EnhancedSelectInputOption.js b/frontend/src/Components/Form/EnhancedSelectInputOption.js deleted file mode 100644 index b2783dbaa..000000000 --- a/frontend/src/Components/Form/EnhancedSelectInputOption.js +++ /dev/null @@ -1,113 +0,0 @@ -import classNames from 'classnames'; -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import Icon from 'Components/Icon'; -import Link from 'Components/Link/Link'; -import { icons } from 'Helpers/Props'; -import CheckInput from './CheckInput'; -import styles from './EnhancedSelectInputOption.css'; - -class EnhancedSelectInputOption extends Component { - - // - // Listeners - - onPress = (e) => { - e.preventDefault(); - - const { - id, - onSelect - } = this.props; - - onSelect(id); - }; - - onCheckPress = () => { - // CheckInput requires a handler. Swallow the change event because onPress will already handle it via event propagation. - }; - - // - // Render - - render() { - const { - className, - id, - depth, - isSelected, - isDisabled, - isHidden, - isMultiSelect, - isMobile, - children - } = this.props; - - return ( - - - { - depth !== 0 && -
- } - - { - isMultiSelect && - - } - - {children} - - { - isMobile && -
- -
- } - - ); - } -} - -EnhancedSelectInputOption.propTypes = { - className: PropTypes.string.isRequired, - id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired, - depth: PropTypes.number.isRequired, - isSelected: PropTypes.bool.isRequired, - isDisabled: PropTypes.bool.isRequired, - isHidden: PropTypes.bool.isRequired, - isMultiSelect: PropTypes.bool.isRequired, - isMobile: PropTypes.bool.isRequired, - children: PropTypes.node.isRequired, - onSelect: PropTypes.func.isRequired -}; - -EnhancedSelectInputOption.defaultProps = { - className: styles.option, - depth: 0, - isDisabled: false, - isHidden: false, - isMultiSelect: false -}; - -export default EnhancedSelectInputOption; diff --git a/frontend/src/Components/Form/EnhancedSelectInputSelectedValue.css b/frontend/src/Components/Form/EnhancedSelectInputSelectedValue.css deleted file mode 100644 index 908126689..000000000 --- a/frontend/src/Components/Form/EnhancedSelectInputSelectedValue.css +++ /dev/null @@ -1,7 +0,0 @@ -.selectedValue { - flex: 1 1 auto; -} - -.isDisabled { - color: var(--disabledInputColor); -} diff --git a/frontend/src/Components/Form/EnhancedSelectInputSelectedValue.css.d.ts b/frontend/src/Components/Form/EnhancedSelectInputSelectedValue.css.d.ts deleted file mode 100644 index 5377239a8..000000000 --- a/frontend/src/Components/Form/EnhancedSelectInputSelectedValue.css.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'isDisabled': string; - 'selectedValue': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Components/Form/EnhancedSelectInputSelectedValue.js b/frontend/src/Components/Form/EnhancedSelectInputSelectedValue.js deleted file mode 100644 index 21ddebb02..000000000 --- a/frontend/src/Components/Form/EnhancedSelectInputSelectedValue.js +++ /dev/null @@ -1,35 +0,0 @@ -import classNames from 'classnames'; -import PropTypes from 'prop-types'; -import React from 'react'; -import styles from './EnhancedSelectInputSelectedValue.css'; - -function EnhancedSelectInputSelectedValue(props) { - const { - className, - children, - isDisabled - } = props; - - return ( -
- {children} -
- ); -} - -EnhancedSelectInputSelectedValue.propTypes = { - className: PropTypes.string.isRequired, - children: PropTypes.node, - isDisabled: PropTypes.bool.isRequired -}; - -EnhancedSelectInputSelectedValue.defaultProps = { - className: styles.selectedValue, - isDisabled: false -}; - -export default EnhancedSelectInputSelectedValue; diff --git a/frontend/src/Components/Form/Form.css b/frontend/src/Components/Form/Form.css deleted file mode 100644 index 52e79aec4..000000000 --- a/frontend/src/Components/Form/Form.css +++ /dev/null @@ -1,3 +0,0 @@ -.validationFailures { - margin-bottom: 20px; -} diff --git a/frontend/src/Components/Form/Form.css.d.ts b/frontend/src/Components/Form/Form.css.d.ts deleted file mode 100644 index 178f2fec1..000000000 --- a/frontend/src/Components/Form/Form.css.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'validationFailures': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Components/Form/Form.js b/frontend/src/Components/Form/Form.js deleted file mode 100644 index 79ad3fe8a..000000000 --- a/frontend/src/Components/Form/Form.js +++ /dev/null @@ -1,66 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import Alert from 'Components/Alert'; -import { kinds } from 'Helpers/Props'; -import styles from './Form.css'; - -function Form(props) { - const { - children, - validationErrors, - validationWarnings, - // eslint-disable-next-line no-unused-vars - ...otherProps - } = props; - - return ( -
- { - validationErrors.length || validationWarnings.length ? -
- { - validationErrors.map((error, index) => { - return ( - - {error.errorMessage} - - ); - }) - } - - { - validationWarnings.map((warning, index) => { - return ( - - {warning.errorMessage} - - ); - }) - } -
: - null - } - - {children} -
- ); -} - -Form.propTypes = { - children: PropTypes.node.isRequired, - validationErrors: PropTypes.arrayOf(PropTypes.object).isRequired, - validationWarnings: PropTypes.arrayOf(PropTypes.object).isRequired -}; - -Form.defaultProps = { - validationErrors: [], - validationWarnings: [] -}; - -export default Form; diff --git a/frontend/src/Components/Form/FormGroup.css b/frontend/src/Components/Form/FormGroup.css deleted file mode 100644 index ddce8863b..000000000 --- a/frontend/src/Components/Form/FormGroup.css +++ /dev/null @@ -1,28 +0,0 @@ -.group { - display: flex; - margin-bottom: 20px; -} - -/* Sizes */ - -.extraSmall { - max-width: $formGroupExtraSmallWidth; -} - -.small { - max-width: $formGroupSmallWidth; -} - -.medium { - max-width: $formGroupMediumWidth; -} - -.large { - max-width: $formGroupLargeWidth; -} - -@media only screen and (max-width: $breakpointLarge) { - .group { - display: block; - } -} diff --git a/frontend/src/Components/Form/FormGroup.css.d.ts b/frontend/src/Components/Form/FormGroup.css.d.ts deleted file mode 100644 index 86145f643..000000000 --- a/frontend/src/Components/Form/FormGroup.css.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'extraSmall': string; - 'group': string; - 'large': string; - 'medium': string; - 'small': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Components/Form/FormGroup.js b/frontend/src/Components/Form/FormGroup.js deleted file mode 100644 index f538daa2f..000000000 --- a/frontend/src/Components/Form/FormGroup.js +++ /dev/null @@ -1,56 +0,0 @@ -import classNames from 'classnames'; -import PropTypes from 'prop-types'; -import React from 'react'; -import { map } from 'Helpers/elementChildren'; -import { sizes } from 'Helpers/Props'; -import styles from './FormGroup.css'; - -function FormGroup(props) { - const { - className, - children, - size, - advancedSettings, - isAdvanced, - ...otherProps - } = props; - - if (!advancedSettings && isAdvanced) { - return null; - } - - const childProps = isAdvanced ? { isAdvanced } : {}; - - return ( -
- { - map(children, (child) => { - return React.cloneElement(child, childProps); - }) - } -
- ); -} - -FormGroup.propTypes = { - className: PropTypes.string.isRequired, - children: PropTypes.node.isRequired, - size: PropTypes.oneOf(sizes.all).isRequired, - advancedSettings: PropTypes.bool.isRequired, - isAdvanced: PropTypes.bool.isRequired -}; - -FormGroup.defaultProps = { - className: styles.group, - size: sizes.SMALL, - advancedSettings: false, - isAdvanced: false -}; - -export default FormGroup; diff --git a/frontend/src/Components/Form/FormInputButton.css b/frontend/src/Components/Form/FormInputButton.css deleted file mode 100644 index da4888f09..000000000 --- a/frontend/src/Components/Form/FormInputButton.css +++ /dev/null @@ -1,12 +0,0 @@ -.button { - composes: button from '~Components/Link/Button.css'; - - border-left: none; - border-top-left-radius: 0; - border-bottom-left-radius: 0; -} - -.middleButton { - border-top-right-radius: 0; - border-bottom-right-radius: 0; -} diff --git a/frontend/src/Components/Form/FormInputButton.css.d.ts b/frontend/src/Components/Form/FormInputButton.css.d.ts deleted file mode 100644 index d469cdfe3..000000000 --- a/frontend/src/Components/Form/FormInputButton.css.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -// This file is automatically generated. -// Please do not change this file! -interface CssExports { - 'button': string; - 'middleButton': string; -} -export const cssExports: CssExports; -export default cssExports; diff --git a/frontend/src/Components/Form/FormInputButton.js b/frontend/src/Components/Form/FormInputButton.js deleted file mode 100644 index a7145363a..000000000 --- a/frontend/src/Components/Form/FormInputButton.js +++ /dev/null @@ -1,54 +0,0 @@ -import classNames from 'classnames'; -import PropTypes from 'prop-types'; -import React from 'react'; -import Button from 'Components/Link/Button'; -import SpinnerButton from 'Components/Link/SpinnerButton'; -import { kinds } from 'Helpers/Props'; -import styles from './FormInputButton.css'; - -function FormInputButton(props) { - const { - className, - canSpin, - isLastButton, - ...otherProps - } = props; - - if (canSpin) { - return ( - - ); - } - - return ( -