From 5b2a8f682bc6628a82cc9b51e04f207f8e8a8dc7 Mon Sep 17 00:00:00 2001 From: Danshil Kokil Mungur Date: Tue, 25 Jan 2022 06:10:37 +0400 Subject: [PATCH] build(deps): bump dependencies (#2454) * build(deps): bump react-select from 4.3.1 to 5.2.2 * build(deps): bump axios from 0.21.4 to 0.25.0 * build(deps-dev): bump lint-staged from 12.2.1 to 12.2.2 Bumps [lint-staged](https://github.com/okonet/lint-staged) from 12.2.1 to 12.2.2. - [Release notes](https://github.com/okonet/lint-staged/releases) - [Commits](https://github.com/okonet/lint-staged/compare/v12.2.1...v12.2.2) --- updated-dependencies: - dependency-name: lint-staged dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * build(deps-dev): bump typescript from 4.5.4 to 4.5.5 Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.5.4 to 4.5.5. - [Release notes](https://github.com/Microsoft/TypeScript/releases) - [Commits](https://github.com/Microsoft/TypeScript/commits) --- updated-dependencies: - dependency-name: typescript dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * build(deps-dev): bump eslint-plugin-formatjs from 2.20.3 to 2.20.4 Bumps [eslint-plugin-formatjs](https://github.com/formatjs/formatjs) from 2.20.3 to 2.20.4. - [Release notes](https://github.com/formatjs/formatjs/releases) - [Commits](https://github.com/formatjs/formatjs/compare/eslint-plugin-formatjs@2.20.3...eslint-plugin-formatjs@2.20.4) --- updated-dependencies: - dependency-name: eslint-plugin-formatjs dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * build(deps-dev): bump @commitlint/cli from 16.0.3 to 16.1.0 Bumps [@commitlint/cli](https://github.com/conventional-changelog/commitlint/tree/HEAD/@commitlint/cli) from 16.0.3 to 16.1.0. - [Release notes](https://github.com/conventional-changelog/commitlint/releases) - [Changelog](https://github.com/conventional-changelog/commitlint/blob/master/@commitlint/cli/CHANGELOG.md) - [Commits](https://github.com/conventional-changelog/commitlint/commits/v16.1.0/@commitlint/cli) --- updated-dependencies: - dependency-name: "@commitlint/cli" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * build(deps): bump @tanem/react-nprogress from 4.0.3 to 4.0.4 Bumps [@tanem/react-nprogress](https://github.com/tanem/react-nprogress) from 4.0.3 to 4.0.4. - [Release notes](https://github.com/tanem/react-nprogress/releases) - [Changelog](https://github.com/tanem/react-nprogress/blob/master/CHANGELOG.md) - [Commits](https://github.com/tanem/react-nprogress/compare/v4.0.3...v4.0.4) --- updated-dependencies: - dependency-name: "@tanem/react-nprogress" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * fix: cleanup comments * build(deps-dev): bump lint-staged from 12.2.1 to 12.3.1 Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ryan Cohen --- package.json | 15 +- src/components/LanguageSelector/index.tsx | 66 ++++---- .../RequestModal/AdvancedRequester/index.tsx | 45 +++--- src/components/Settings/RadarrModal/index.tsx | 47 +++--- src/components/Settings/SonarrModal/index.tsx | 83 +++++----- src/pages/_app.tsx | 7 +- src/styles/globals.css | 17 +- src/utils/plex.ts | 2 +- yarn.lock | 147 ++++++++---------- 9 files changed, 204 insertions(+), 225 deletions(-) diff --git a/package.json b/package.json index 65c3216bc..2c03bfd65 100644 --- a/package.json +++ b/package.json @@ -26,9 +26,9 @@ "@heroicons/react": "^1.0.5", "@supercharge/request-ip": "^1.1.2", "@svgr/webpack": "^6.2.0", - "@tanem/react-nprogress": "^4.0.2", + "@tanem/react-nprogress": "^4.0.4", "ace-builds": "^1.4.13", - "axios": "^0.21.4", + "axios": "^0.25.0", "bcrypt": "^5.0.1", "bowser": "^2.11.0", "connect-typeorm": "^1.1.4", @@ -59,7 +59,7 @@ "react-intersection-observer": "^8.33.1", "react-intl": "5.24.3", "react-markdown": "^8.0.0", - "react-select": "^4.3.1", + "react-select": "^5.2.2", "react-spring": "^9.4.2", "react-toast-notifications": "^2.5.1", "react-transition-group": "^4.4.2", @@ -80,7 +80,7 @@ }, "devDependencies": { "@babel/cli": "^7.16.8", - "@commitlint/cli": "^16.0.3", + "@commitlint/cli": "^16.1.0", "@commitlint/config-conventional": "^16.0.0", "@semantic-release/changelog": "^6.0.1", "@semantic-release/commit-analyzer": "^9.0.2", @@ -102,7 +102,6 @@ "@types/nodemailer": "^6.4.4", "@types/react": "^17.0.38", "@types/react-dom": "^17.0.11", - "@types/react-select": "^4.0.17", "@types/react-transition-group": "^4.4.4", "@types/secure-random-password": "^0.2.1", "@types/swagger-ui-express": "^4.1.3", @@ -121,14 +120,14 @@ "eslint": "^8.7.0", "eslint-config-next": "^12.0.8", "eslint-config-prettier": "^8.3.0", - "eslint-plugin-formatjs": "^2.20.3", + "eslint-plugin-formatjs": "^2.20.4", "eslint-plugin-jsx-a11y": "^6.5.1", "eslint-plugin-prettier": "^4.0.0", "eslint-plugin-react": "^7.28.0", "eslint-plugin-react-hooks": "^4.3.0", "extract-react-intl-messages": "^4.1.1", "husky": "^7.0.4", - "lint-staged": "^12.2.1", + "lint-staged": "^12.3.1", "nodemon": "^2.0.15", "postcss": "^8.4.5", "prettier": "^2.5.1", @@ -136,7 +135,7 @@ "semantic-release-docker-buildx": "^1.0.1", "tailwindcss": "^3.0.15", "ts-node": "^10.4.0", - "typescript": "^4.5.4" + "typescript": "^4.5.5" }, "resolutions": { "sqlite3/node-gyp": "^8.4.1" diff --git a/src/components/LanguageSelector/index.tsx b/src/components/LanguageSelector/index.tsx index 652687da3..74c84b152 100644 --- a/src/components/LanguageSelector/index.tsx +++ b/src/components/LanguageSelector/index.tsx @@ -1,9 +1,7 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ import { sortBy } from 'lodash'; -import dynamic from 'next/dynamic'; import React, { useMemo } from 'react'; import { defineMessages, useIntl } from 'react-intl'; -import type { OptionsType, OptionTypeBase } from 'react-select'; +import Select, { CSSObjectWithLabel } from 'react-select'; import useSWR from 'swr'; import { Language } from '../../../server/lib/settings'; import globalMessages from '../../i18n/globalMessages'; @@ -13,8 +11,6 @@ const messages = defineMessages({ languageServerDefault: 'Default ({language})', }); -const Select = dynamic(() => import('react-select'), { ssr: false }); - type OptionType = { value: string; label: string; @@ -22,11 +18,11 @@ type OptionType = { }; const selectStyles = { - multiValueLabel: (base: any, state: { data: { isFixed?: boolean } }) => { - return state.data.isFixed ? { ...base, paddingRight: 6 } : base; + multiValueLabel: (base: CSSObjectWithLabel, props: { data: OptionType }) => { + return props.data?.isFixed ? { ...base, paddingRight: 6 } : base; }, - multiValueRemove: (base: any, state: { data: { isFixed?: boolean } }) => { - return state.data.isFixed ? { ...base, display: 'none' } : base; + multiValueRemove: (base: CSSObjectWithLabel, props: { data: OptionType }) => { + return props.data?.isFixed ? { ...base, display: 'none' } : base; }, }; @@ -95,7 +91,7 @@ const LanguageSelector: React.FC = ({ }); return ( - name="tags" options={(serverData?.tags ?? []).map((tag) => ({ label: tag.label, @@ -489,22 +486,26 @@ const AdvancedRequester: React.FC = ({ } className="react-select-container react-select-container-dark" classNamePrefix="react-select" - value={selectedTags.map((tagId) => { - const foundTag = serverData?.tags.find( - (tag) => tag.id === tagId - ); - return { - value: foundTag?.id, - label: foundTag?.label, - }; - })} - onChange={( - value: OptionTypeBase | OptionsType | null - ) => { - if (!Array.isArray(value)) { - return; - } - setSelectedTags(value?.map((option) => option.value)); + value={ + selectedTags + .map((tagId) => { + const foundTag = serverData?.tags.find( + (tag) => tag.id === tagId + ); + + if (!foundTag) { + return undefined; + } + + return { + value: foundTag.id, + label: foundTag.label, + }; + }) + .filter((option) => option !== undefined) as OptionType[] + } + onChange={(value) => { + setSelectedTags(value.map((option) => option.value)); }} noOptionsMessage={() => intl.formatMessage(messages.notagoptions) diff --git a/src/components/Settings/RadarrModal/index.tsx b/src/components/Settings/RadarrModal/index.tsx index b09a6e264..ef18dfc87 100644 --- a/src/components/Settings/RadarrModal/index.tsx +++ b/src/components/Settings/RadarrModal/index.tsx @@ -1,10 +1,9 @@ import { PencilIcon, PlusIcon } from '@heroicons/react/solid'; import axios from 'axios'; import { Field, Formik } from 'formik'; -import dynamic from 'next/dynamic'; import React, { useCallback, useEffect, useRef, useState } from 'react'; import { defineMessages, useIntl } from 'react-intl'; -import type { OptionsType, OptionTypeBase } from 'react-select'; +import Select from 'react-select'; import { useToasts } from 'react-toast-notifications'; import * as Yup from 'yup'; import type { RadarrSettings } from '../../../../server/lib/settings'; @@ -14,12 +13,10 @@ import SensitiveInput from '../../Common/SensitiveInput'; import Transition from '../../Transition'; type OptionType = { - value: string; + value: number; label: string; }; -const Select = dynamic(() => import('react-select'), { ssr: false }); - const messages = defineMessages({ createradarr: 'Add New Radarr Server', create4kradarr: 'Add New 4K Radarr Server', @@ -611,7 +608,7 @@ const RadarrModal: React.FC = ({ {intl.formatMessage(messages.tags)}
- options={ isValidated ? testResponse.tags.map((tag) => ({ @@ -680,25 +677,29 @@ const SonarrModal: React.FC = ({ value={ isTesting ? [] - : values.tags.map((tagId) => { - const foundTag = testResponse.tags.find( - (tag) => tag.id === tagId - ); - return { - value: foundTag?.id, - label: foundTag?.label, - }; - }) + : (values.tags + .map((tagId) => { + const foundTag = testResponse.tags.find( + (tag) => tag.id === tagId + ); + + if (!foundTag) { + return undefined; + } + + return { + value: foundTag.id, + label: foundTag.label, + }; + }) + .filter( + (option) => option !== undefined + ) as OptionType[]) } - onChange={( - value: OptionTypeBase | OptionsType | null - ) => { - if (!Array.isArray(value)) { - return; - } + onChange={(value: OnChangeValue) => { setFieldValue( 'tags', - value?.map((option) => option.value) + value.map((option) => option.value) ); }} noOptionsMessage={() => @@ -835,7 +836,7 @@ const SonarrModal: React.FC = ({ {intl.formatMessage(messages.animeTags)}
-