Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

(improvement) Remove `prop-types` and some TS refactoring (#420)

Andrii Romasiuna9f6d3fa418d
diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml
index e3de74518..b249d10ab 100644
--- a/.github/workflows/pull_request.yml
+++ b/.github/workflows/pull_request.yml
@@ -35,5 +35,5 @@ jobs:
- name: Code formatting validation
run: npm run format
- - name: Unit tests
- run: npm run test:ci
+ - name: TypeScript validation
+ run: npm run typecheck
diff --git a/app/components/EventsRunningOutBanner.tsx b/app/components/EventsRunningOutBanner.tsx
index b024d47c6..741b53aac 100644
--- a/app/components/EventsRunningOutBanner.tsx
+++ b/app/components/EventsRunningOutBanner.tsx
@@ -9,16 +9,7 @@ import UIActions from 'redux/reducers/ui'
import { SHOW_BANNER_AT_PERC } from 'redux/constants'
const EventsRunningOutBanner = () => {
- const {
- t,
- }: {
- t: (
- key: string,
- item?: {
- [key: string]: string | number
- },
- ) => string
- } = useTranslation('common')
+ const { t } = useTranslation('common')
const dispatch = useAppDispatch()
const showNoEventsLeftBanner = useSelector((state: StateType) => state.ui.misc.showNoEventsLeftBanner)
const dashboardBlockReason = useSelector((state: StateType) => state.auth.user.dashboardBlockReason)
diff --git a/app/components/Footer/index.tsx b/app/components/Footer/index.tsx
index 3df062476..c9d459a0e 100644
--- a/app/components/Footer/index.tsx
+++ b/app/components/Footer/index.tsx
@@ -3,7 +3,6 @@ import { Link } from '@remix-run/react'
import { useTranslation } from 'react-i18next'
import _map from 'lodash/map'
import Flag from 'react-flagkit'
-import PropTypes from 'prop-types'
import {
isSelfhosted,
@@ -204,15 +203,13 @@ const SelfHostedFooter = () => {
)
}
-const Footer = ({
- minimal,
- authenticated,
- showDBIPMessage,
-}: {
+interface IFooter {
minimal?: boolean
authenticated?: boolean
showDBIPMessage?: boolean
-}): JSX.Element => {
+}
+
+const Footer = ({ minimal, authenticated, showDBIPMessage }: IFooter): JSX.Element => {
const {
t,
i18n: { language },
@@ -446,13 +443,4 @@ const Footer = ({
)
}
-Footer.propTypes = {
- authenticated: PropTypes.bool.isRequired,
- minimal: PropTypes.bool,
-}
-
-Footer.defaultProps = {
- minimal: false,
-}
-
export default memo(Footer)
diff --git a/app/components/GithubAuth.tsx b/app/components/GithubAuth.tsx
index 63a639f08..6ff7ad434 100644
--- a/app/components/GithubAuth.tsx
+++ b/app/components/GithubAuth.tsx
@@ -1,4 +1,5 @@
import React from 'react'
+import type i18next from 'i18next'
import { useTranslation } from 'react-i18next'
import { useSelector } from 'react-redux'
import cx from 'clsx'
@@ -11,7 +12,7 @@ import { SSO_PROVIDERS, isBrowser } from 'redux/constants'
interface IGoogleAuth {
setIsLoading: (isLoading: boolean) => void
- authSSO: (provider: string, dontRemember: boolean, t: (key: string) => string, callback: (res: any) => void) => void
+ authSSO: (provider: string, dontRemember: boolean, t: typeof i18next.t, callback: (res: any) => void) => void
ssrTheme: string
callback?: any
dontRemember?: boolean
@@ -23,7 +24,7 @@ const GithubAuth: React.FC<IGoogleAuth> = ({
setIsLoading,
authSSO,
dontRemember,
- callback,
+ callback = () => {},
isMiniButton,
className,
ssrTheme,
@@ -72,11 +73,4 @@ const GithubAuth: React.FC<IGoogleAuth> = ({
)
}
-GithubAuth.defaultProps = {
- dontRemember: false,
- isMiniButton: false,
- callback: () => {},
- className: '',
-}
-
export default GithubAuth
diff --git a/app/components/GoogleAuth.tsx b/app/components/GoogleAuth.tsx
index 5b97e8232..0a28ae906 100644
--- a/app/components/GoogleAuth.tsx
+++ b/app/components/GoogleAuth.tsx
@@ -1,4 +1,5 @@
import React from 'react'
+import type i18next from 'i18next'
import { useTranslation } from 'react-i18next'
import cx from 'clsx'
@@ -8,7 +9,7 @@ import { SSO_PROVIDERS } from 'redux/constants'
interface IGoogleAuth {
setIsLoading: (isLoading: boolean) => void
- authSSO: (provider: string, dontRemember: boolean, t: (key: string) => string, callback: (res: any) => void) => void
+ authSSO: (provider: string, dontRemember: boolean, t: typeof i18next.t, callback: (res: any) => void) => void
callback?: any
dontRemember?: boolean
isMiniButton?: boolean
@@ -19,7 +20,7 @@ const GoogleAuth: React.FC<IGoogleAuth> = ({
setIsLoading,
authSSO,
dontRemember,
- callback,
+ callback = () => {},
isMiniButton,
className,
}) => {
@@ -65,11 +66,4 @@ const GoogleAuth: React.FC<IGoogleAuth> = ({
)
}
-GoogleAuth.defaultProps = {
- dontRemember: false,
- isMiniButton: false,
- callback: () => {},
- className: '',
-}
-
export default GoogleAuth
diff --git a/app/components/Header/index.tsx b/app/components/Header/index.tsx
index 26d4ee547..bf9c4fbc5 100644
--- a/app/components/Header/index.tsx
+++ b/app/components/Header/index.tsx
@@ -183,12 +183,7 @@ const ThemeMenu = ({
switchTheme,
}: {
theme: string
- t: (
- key: string,
- options?: {
- [key: string]: string | number | null
- },
- ) => string
+ t: typeof i18next.t
switchTheme: (i: string) => void
}) => (
<Menu as='div' className='relative ml-3'>
@@ -258,12 +253,7 @@ const ProfileMenu = ({
}: {
user: IUser
logoutHandler: () => void
- t: (
- key: string,
- options?: {
- [key: string]: string | number | null
- },
- ) => string
+ t: typeof i18next.t
onLanguageChange: (l: string) => void
language: string
}) => (
diff --git a/app/modals/Forecast.tsx b/app/modals/Forecast.tsx
index 7a1cb1f27..fb4dea903 100644
--- a/app/modals/Forecast.tsx
+++ b/app/modals/Forecast.tsx
@@ -1,6 +1,5 @@
import React, { useState } from 'react'
import { useTranslation } from 'react-i18next'
-import PropTypes from 'prop-types'
import _isNaN from 'lodash/isNaN'
import Modal from 'ui/Modal'
@@ -10,24 +9,16 @@ import _toString from 'lodash/toString'
const DEFAULT_PERIOD = '3'
-const Forecast = ({
- onClose,
- onSubmit,
- isOpened,
- activeTB,
- tb,
-}: {
+interface IForecast {
onClose: () => void
onSubmit: (period: string) => void
isOpened: boolean
activeTB: string
tb: string
-}): JSX.Element => {
- const {
- t,
- }: {
- t: (key: string, options?: { [key: string]: string | number }) => string
- } = useTranslation('common')
+}
+
+const Forecast = ({ onClose, onSubmit, isOpened, activeTB, tb }: IForecast): JSX.Element => {
+ const { t } = useTranslation('common')
const [period, setPeriod] = useState<string>(DEFAULT_PERIOD)
const [error, setError] = useState<string | null>(null)
@@ -100,12 +91,4 @@ const Forecast = ({
)
}
-Forecast.propTypes = {
- onClose: PropTypes.func.isRequired,
- isOpened: PropTypes.bool.isRequired,
- onSubmit: PropTypes.func.isRequired,
- activeTB: PropTypes.string.isRequired,
- tb: PropTypes.string.isRequired,
-}
-
export default Forecast
diff --git a/app/modals/PaidFeature.tsx b/app/modals/PaidFeature.tsx
index a69a671ea..f8ff94d15 100644
--- a/app/modals/PaidFeature.tsx
+++ b/app/modals/PaidFeature.tsx
@@ -1,17 +1,17 @@
import React from 'react'
import { useNavigate } from '@remix-run/react'
import { useTranslation } from 'react-i18next'
-import PropTypes from 'prop-types'
import Modal from 'ui/Modal'
import routes from 'routesPath'
-const PaidFeature = ({ onClose, isOpened }: { onClose: () => void; isOpened: boolean }): JSX.Element => {
- const {
- t,
- }: {
- t: (key: string, options?: { [key: string]: string | number }) => string
- } = useTranslation('common')
+interface IPaidFeature {
+ onClose: () => void
+ isOpened: boolean
+}
+
+const PaidFeature = ({ onClose, isOpened }: IPaidFeature): JSX.Element => {
+ const { t } = useTranslation('common')
const navigate = useNavigate()
const onSubmit = () => {
@@ -32,9 +32,4 @@ const PaidFeature = ({ onClose, isOpened }: { onClose: () => void; isOpened: boo
)
}
-PaidFeature.propTypes = {
- onClose: PropTypes.func.isRequired,
- isOpened: PropTypes.bool.isRequired,
-}
-
export default PaidFeature
diff --git a/app/modals/TrackingSnippet.tsx b/app/modals/TrackingSnippet.tsx
index 012d4aab7..fa0fe06ea 100644
--- a/app/modals/TrackingSnippet.tsx
+++ b/app/modals/TrackingSnippet.tsx
@@ -1,6 +1,5 @@
import React from 'react'
import { useTranslation, Trans } from 'react-i18next'
-import PropTypes from 'prop-types'
import Modal from 'ui/Modal'
import { Badge } from 'ui/Badge'
@@ -75,9 +74,4 @@ const TrackingSnippet = ({ onClose, isOpened, pid }: ITrackingSnippet): JSX.Elem
)
}
-TrackingSnippet.propTypes = {
- onClose: PropTypes.func.isRequired,
- isOpened: PropTypes.bool.isRequired,
-}
-
export default TrackingSnippet
diff --git a/app/modals/ViewProjectHotkeys.tsx b/app/modals/ViewProjectHotkeys.tsx
index a6d76128e..a0db2cd55 100644
--- a/app/modals/ViewProjectHotkeys.tsx
+++ b/app/modals/ViewProjectHotkeys.tsx
@@ -1,6 +1,5 @@
import React, { useMemo } from 'react'
import { useTranslation } from 'react-i18next'
-import PropTypes from 'prop-types'
import { TFunction } from 'i18next'
import _map from 'lodash/map'
@@ -97,9 +96,4 @@ const ViewProjectHotkeys = ({ onClose, isOpened }: IViewProjectHotkeys): JSX.Ele
)
}
-ViewProjectHotkeys.propTypes = {
- onClose: PropTypes.func.isRequired,
- isOpened: PropTypes.bool.isRequired,
-}
-
export default ViewProjectHotkeys
diff --git a/app/pages/Auth/CreateNewPassword/CreateNewPassword.tsx b/app/pages/Auth/CreateNewPassword/CreateNewPassword.tsx
index f1754c8f4..a0d7deb68 100644
--- a/app/pages/Auth/CreateNewPassword/CreateNewPassword.tsx
+++ b/app/pages/Auth/CreateNewPassword/CreateNewPassword.tsx
@@ -24,11 +24,7 @@ const CreateNewPassword = ({
createNewPasswordFailed: (e: string) => void
newPassword: (message: string) => void
}): JSX.Element => {
- const {
- t,
- }: {
- t: (key: string, options?: { [key: string]: string | number }) => string
- } = useTranslation('common')
+ const { t } = useTranslation('common')
const navigate = useNavigate()
const { id } = useParams()
const [form, setForm] = useState<FormSubmitData>({
diff --git a/app/pages/Auth/ForgotPassword/ForgotPassword.tsx b/app/pages/Auth/ForgotPassword/ForgotPassword.tsx
index 95def33b4..8bd228014 100644
--- a/app/pages/Auth/ForgotPassword/ForgotPassword.tsx
+++ b/app/pages/Auth/ForgotPassword/ForgotPassword.tsx
@@ -19,11 +19,7 @@ const ForgotPassword = ({
createNewPasswordFailed: (e: string) => void
newPassword: (message: string) => void
}): JSX.Element => {
- const {
- t,
- }: {
- t: (key: string) => string
- } = useTranslation('common')
+ const { t } = useTranslation('common')
const navigate = useNavigate()
const [form, setForm] = useState<{
email: string
diff --git a/app/pages/Auth/Signin/Signin.container.tsx b/app/pages/Auth/Signin/Signin.container.tsx
index 1fbb9c8b0..1a8dd70df 100644
--- a/app/pages/Auth/Signin/Signin.container.tsx
+++ b/app/pages/Auth/Signin/Signin.container.tsx
@@ -1,5 +1,5 @@
import { connect } from 'react-redux'
-
+import type i18next from 'i18next'
import sagaActions from 'redux/sagas/actions'
import { authActions } from 'redux/reducers/auth'
import { errorsActions } from 'redux/reducers/errors'
@@ -30,7 +30,7 @@ const mapDispatchToProps = (dispatch: AppDispatch) => ({
}),
)
},
- authSSO: (provider: string, dontRemember: boolean, t: (key: string) => string, callback: (res: any) => void) => {
+ authSSO: (provider: string, dontRemember: boolean, t: typeof i18next.t, callback: (res: any) => void) => {
dispatch(sagaActions.authSSO(provider, dontRemember, t, callback))
},
})
diff --git a/app/pages/Auth/Signin/Signin.tsx b/app/pages/Auth/Signin/Signin.tsx
index 08db0347d..55971d87b 100644
--- a/app/pages/Auth/Signin/Signin.tsx
+++ b/app/pages/Auth/Signin/Signin.tsx
@@ -1,6 +1,6 @@
import React, { useState, useEffect, memo } from 'react'
+import type i18next from 'i18next'
import { Link } from '@remix-run/react'
-import PropTypes from 'prop-types'
import { useTranslation, Trans } from 'react-i18next'
import _keys from 'lodash/keys'
import _isEmpty from 'lodash/isEmpty'
@@ -37,21 +37,12 @@ interface ISignin {
) => void
loginSuccess: (user: IUser) => void
loginFailed: (error: string) => void
- authSSO: (provider: string, dontRemember: boolean, t: (key: string) => string, callback: (res: any) => void) => void
+ authSSO: (provider: string, dontRemember: boolean, t: typeof i18next.t, callback: (res: any) => void) => void
ssrTheme: string
}
const Signin = ({ login, loginSuccess, loginFailed, authSSO, ssrTheme }: ISignin): JSX.Element => {
- const {
- t,
- }: {
- t: (
- key: string,
- optinions?: {
- [key: string]: string | number
- },
- ) => string
- } = useTranslation('common')
+ const { t } = useTranslation('common')
const [form, setForm] = useState<ISigninForm>({
email: '',
password: '',
@@ -317,12 +308,4 @@ const Signin = ({ login, loginSuccess, loginFailed, authSSO, ssrTheme }: ISignin
)
}
-Signin.propTypes = {
- login: PropTypes.func.isRequired,
- loginSuccess: PropTypes.func.isRequired,
- loginFailed: PropTypes.func.isRequired,
- authSSO: PropTypes.func.isRequired,
- ssrTheme: PropTypes.string.isRequired,
-}
-
export default memo(withAuthentication(Signin, auth.notAuthenticated))
diff --git a/app/pages/Auth/Signup/BasicSignup.tsx b/app/pages/Auth/Signup/BasicSignup.tsx
index 0519779bc..5aa39defe 100644
--- a/app/pages/Auth/Signup/BasicSignup.tsx
+++ b/app/pages/Auth/Signup/BasicSignup.tsx
@@ -33,16 +33,7 @@ interface IBasicSignup {
}
const BasicSignup: React.FC<IBasicSignup> = ({ ssrTheme }): JSX.Element => {
- const {
- t,
- }: {
- t: (
- key: string,
- optinions?: {
- [key: string]: string | number
- },
- ) => string
- } = useTranslation('common')
+ const { t } = useTranslation('common')
const navigate = useNavigate()
const dispatch = useAppDispatch()
const [form, setForm] = useState<ISignUpForm>({
diff --git a/app/pages/Auth/Signup/Signup.container.tsx b/app/pages/Auth/Signup/Signup.container.tsx
index 190f860ea..764a71798 100644
--- a/app/pages/Auth/Signup/Signup.container.tsx
+++ b/app/pages/Auth/Signup/Signup.container.tsx
@@ -1,4 +1,5 @@
import { connect } from 'react-redux'
+import type i18next from 'i18next'
import { AppDispatch, StateType } from 'redux/store'
import sagaActions from 'redux/sagas/actions'
import Signup from './Signup'
@@ -19,17 +20,12 @@ const mapDispatchToProps = (dispatch: AppDispatch) => ({
dontRemember: boolean
checkIfLeaked: boolean
},
- t: (
- key: string,
- optinions?: {
- [key: string]: string | number
- },
- ) => string,
+ t: typeof i18next.t,
callback: (res: any) => void,
) => {
dispatch(sagaActions.signupAsync(data, t, callback))
},
- authSSO: (provider: string, dontRemember: boolean, t: (key: string) => string, callback: (res: any) => void) => {
+ authSSO: (provider: string, dontRemember: boolean, t: typeof i18next.t, callback: (res: any) => void) => {
dispatch(sagaActions.authSSO(provider, dontRemember, t, callback))
},
})
diff --git a/app/pages/Auth/Signup/Signup.tsx b/app/pages/Auth/Signup/Signup.tsx
index 8ea73d060..9f6312e01 100644
--- a/app/pages/Auth/Signup/Signup.tsx
+++ b/app/pages/Auth/Signup/Signup.tsx
@@ -1,6 +1,6 @@
import React, { useState, useEffect } from 'react'
+import type i18next from 'i18next'
import { Link, useNavigate } from '@remix-run/react'
-import PropTypes from 'prop-types'
import { useTranslation, Trans } from 'react-i18next'
import _size from 'lodash/size'
import _keys from 'lodash/keys'
@@ -37,15 +37,10 @@ interface ISignup {
dontRemember: boolean
checkIfLeaked: boolean
},
- t: (
- key: string,
- options?: {
- [key: string]: string | number
- },
- ) => string,
+ t: typeof i18next.t,
callback: (res: any) => void,
) => void
- authSSO: (provider: string, dontRemember: boolean, t: (key: string) => string, callback: (res: any) => void) => void
+ authSSO: (provider: string, dontRemember: boolean, t: typeof i18next.t, callback: (res: any) => void) => void
ssrTheme: string
authenticated: boolean
loading: boolean
@@ -326,10 +321,4 @@ const Signup = ({ signup, authSSO, ssrTheme, authenticated: reduxAuthenticated,
)
}
-Signup.propTypes = {
- signup: PropTypes.func.isRequired,
- authSSO: PropTypes.func.isRequired,
- ssrTheme: PropTypes.string.isRequired,
-}
-
export default Signup
diff --git a/app/pages/Auth/Socialised/index.tsx b/app/pages/Auth/Socialised/index.tsx
index 78b1a00cf..f56eb7458 100644
--- a/app/pages/Auth/Socialised/index.tsx
+++ b/app/pages/Auth/Socialised/index.tsx
@@ -11,16 +11,7 @@ import Loader from 'ui/Loader'
import routes from 'routesPath'
const Socialised = (): JSX.Element => {
- const {
- t,
- }: {
- t: (
- key: string,
- optinions?: {
- [key: string]: string | number
- },
- ) => string
- } = useTranslation('common')
+ const { t } = useTranslation('common')
const [loading, setLoading] = useState<boolean>(true)
const [isError, setIsError] = useState<boolean>(false)
diff --git a/app/pages/Auth/VerifyEmail/index.tsx b/app/pages/Auth/VerifyEmail/index.tsx
index 073051bc9..af0c8a038 100644
--- a/app/pages/Auth/VerifyEmail/index.tsx
+++ b/app/pages/Auth/VerifyEmail/index.tsx
@@ -11,16 +11,7 @@ import Loader from 'ui/Loader'
import routes from 'routesPath'
const VerifyEmail = (): JSX.Element => {
- const {
- t,
- }: {
- t: (
- key: string,
- optinions?: {
- [key: string]: string | number
- },
- ) => string
- } = useTranslation('common')
+ const { t } = useTranslation('common')
const dispatch = useDispatch()
const { id } = useParams()
const [loading, setLoading] = useState<boolean>(true)
diff --git a/app/pages/Billing/index.tsx b/app/pages/Billing/index.tsx
index 1024a4c25..bcd7cfcce 100644
--- a/app/pages/Billing/index.tsx
+++ b/app/pages/Billing/index.tsx
@@ -57,16 +57,6 @@ const Billing: React.FC<IBilling> = ({ ssrAuthenticated, ssrTheme }): JSX.Elemen
const {
t,
i18n: { language },
- }: {
- t: (
- key: string,
- optinions?: {
- [key: string]: string | number
- },
- ) => string
- i18n: {
- language: string
- }
} = useTranslation('common')
const authenticated = isBrowser ? reduxAuthenticated : ssrAuthenticated
const {
diff --git a/app/pages/Blog/Post.tsx b/app/pages/Blog/Post.tsx
index ed244f14b..16202d904 100644
--- a/app/pages/Blog/Post.tsx
+++ b/app/pages/Blog/Post.tsx
@@ -2,8 +2,19 @@ import React from 'react'
import { Link, useLoaderData } from '@remix-run/react'
import NotFound from 'pages/NotFound'
+interface IPost {
+ slug: string
+ title?: string
+ html: string
+ hidden?: boolean
+ intro?: string
+ date?: string
+ author?: string
+ nickname?: string
+}
+
export default function PostSlug() {
- const post = useLoaderData()
+ const post = useLoaderData() as IPost
if (!post) {
return <NotFound />
diff --git a/app/pages/Captcha/Settings/CaptchaSettings.tsx b/app/pages/Captcha/Settings/CaptchaSettings.tsx
index 61e9ec70d..436f660be 100644
--- a/app/pages/Captcha/Settings/CaptchaSettings.tsx
+++ b/app/pages/Captcha/Settings/CaptchaSettings.tsx
@@ -1,4 +1,3 @@
-/* eslint-disable react/forbid-prop-types */
import React, { useState, useEffect, useMemo, memo, useRef } from 'react'
import { useNavigate, useParams } from '@remix-run/react'
import { useTranslation } from 'react-i18next'
@@ -14,7 +13,6 @@ import _keys from 'lodash/keys'
import _map from 'lodash/map'
import _filter from 'lodash/filter'
import _includes from 'lodash/includes'
-import PropTypes from 'prop-types'
import { ExclamationTriangleIcon, TrashIcon, ClipboardDocumentIcon } from '@heroicons/react/24/outline'
import { withAuthentication, auth } from 'hoc/protected'
@@ -101,16 +99,7 @@ const CaptchaSettings = ({
loading,
isSettings,
}: ICaptchaSettings): JSX.Element => {
- const {
- t,
- }: {
- t: (
- key: string,
- options?: {
- [key: string]: string | number | boolean | undefined
- },
- ) => string
- } = useTranslation('common')
+ const { t } = useTranslation('common')
// @ts-ignore
const {
id,
@@ -655,23 +644,4 @@ const CaptchaSettings = ({
)
}
-CaptchaSettings.propTypes = {
- updateProjectFailed: PropTypes.func.isRequired,
- createNewProjectFailed: PropTypes.func.isRequired,
- newProject: PropTypes.func.isRequired,
- projectDeleted: PropTypes.func.isRequired,
- deleteProjectFailed: PropTypes.func.isRequired,
- loadProjects: PropTypes.func.isRequired,
- projects: PropTypes.arrayOf(PropTypes.object).isRequired,
- showError: PropTypes.func.isRequired,
- isLoading: PropTypes.bool.isRequired,
- user: PropTypes.object.isRequired,
- deleteProjectCache: PropTypes.func.isRequired,
- isSettings: PropTypes.bool,
-}
-
-CaptchaSettings.defaultProps = {
- isSettings: false,
-}
-
export default memo(withAuthentication(CaptchaSettings, auth.authenticated))
diff --git a/app/pages/Captcha/View/Panels.tsx b/app/pages/Captcha/View/Panels.tsx
index e41b19f2a..7be58ae65 100644
--- a/app/pages/Captcha/View/Panels.tsx
+++ b/app/pages/Captcha/View/Panels.tsx
@@ -1,4 +1,5 @@
import React, { memo, useState, useEffect, useMemo, Fragment } from 'react'
+import type i18next from 'i18next'
import { ArrowSmallUpIcon, ArrowSmallDownIcon } from '@heroicons/react/24/solid'
import {
FunnelIcon,
@@ -10,7 +11,6 @@ import {
ArrowLongLeftIcon,
} from '@heroicons/react/24/outline'
import cx from 'clsx'
-import PropTypes from 'prop-types'
import { pie } from 'billboard.js'
import _keys from 'lodash/keys'
import _values from 'lodash/values'
@@ -35,7 +35,7 @@ import Button from 'ui/Button'
import { IEntry } from 'redux/models/IEntry'
import LiveVisitorsDropdown from './components/LiveVisitorsDropdown'
-import InteractiveMap from './components/InteractiveMap'
+import InteractiveMap from '../../Project/View/components/InteractiveMap'
import { iconClassName } from './ViewCaptcha.helpers'
const ENTRIES_PER_PANEL = 5
@@ -46,6 +46,17 @@ const checkIfBarsNeeded = (panelID: string) => {
return _includes(panelsWithBars, panelID)
}
+interface IPanelContainer {
+ name: string
+ children?: React.ReactNode
+ noSwitch?: boolean
+ icon?: React.ReactNode
+ type: string
+ openModal?: () => void
+ activeFragment?: number | string
+ setActiveFragment?: (arg: number) => void
+}
+
// noSwitch - 'previous' and 'next' buttons
const PanelContainer = ({
name,
@@ -53,19 +64,10 @@ const PanelContainer = ({
noSwitch,
icon,
type,
- openModal,
- activeFragment,
- setActiveFragment,
-}: {
- name: string
- children?: React.ReactNode
- noSwitch?: boolean
- icon?: React.ReactNode
- type: string
- openModal?: () => void
- activeFragment: number | string
- setActiveFragment: (arg: number) => void
-}): JSX.Element => (
+ openModal = () => {},
+ activeFragment = 0,
+ setActiveFragment = () => {},
+}: IPanelContainer): JSX.Element => (
<div
className={cx(
'relative bg-white dark:bg-slate-800/25 pt-5 px-4 min-h-72 sm:pt-6 sm:px-6 shadow rounded-lg overflow-hidden',
@@ -131,24 +133,6 @@ const PanelContainer = ({
</div>
)
-PanelContainer.propTypes = {
- name: PropTypes.string.isRequired,
- children: PropTypes.node.isRequired,
- noSwitch: PropTypes.bool,
- activeFragment: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
- setActiveFragment: PropTypes.func,
- icon: PropTypes.node,
- openModal: PropTypes.func,
-}
-
-PanelContainer.defaultProps = {
- icon: null,
- noSwitch: false,
- activeFragment: 0,
- setActiveFragment: () => {},
- openModal: () => {},
-}
-
// First tab with stats
const Overview = ({
overall,
@@ -162,7 +146,7 @@ const Overview = ({
overall: any
chartData: any
activePeriod: any
- t: (arg: string) => string
+ t: typeof i18next.t
live: number | string
sessionDurationAVG: number
projectId: string
@@ -178,7 +162,7 @@ const Overview = ({
}
return (
- <PanelContainer name={t('project.overview')} noSwitch type='' openModal={() => {}}>
+ <PanelContainer name={t('project.overview')} noSwitch type=''>
<div className='flex text-lg justify-between'>
<div className='flex items-center dark:text-gray-50'>
<PulsatingCircle className='mr-1.5' type='big' />
@@ -324,7 +308,7 @@ const CustomEvents = ({
customs: any
chartData: any
onFilter: any
- t: (arg0: string) => string
+ t: typeof i18next.t
}) => {
const keys = _keys(customs)
const uniques = _sum(chartData.uniques)
@@ -404,37 +388,31 @@ const CustomEvents = ({
)
}
-CustomEvents.propTypes = {
- customs: PropTypes.objectOf(PropTypes.number).isRequired,
- onFilter: PropTypes.func.isRequired,
- t: PropTypes.func.isRequired,
- // eslint-disable-next-line react/forbid-prop-types
- chartData: PropTypes.objectOf(PropTypes.any).isRequired,
+interface IPanel {
+ name: string
+ data: IEntry[]
+ rowMapper?: (row: any) => string | JSX.Element
+ capitalize?: boolean
+ linkContent?: boolean
+ t: typeof i18next.t
+ icon: any
+ id: string
+ hideFilters?: boolean
+ onFilter: any
}
const Panel = ({
name,
data,
- rowMapper,
+ rowMapper = (row: IEntry): string => row.name,
capitalize,
linkContent,
t,
icon,
id,
hideFilters,
- onFilter,
-}: {
- name: string
- data: IEntry[]
- rowMapper: any
- capitalize: boolean
- linkContent: boolean
- t: (arg0: string) => string
- icon: any
- id: string
- hideFilters: boolean
- onFilter: any
-}): JSX.Element => {
+ onFilter = () => {},
+}: IPanel): JSX.Element => {
const [page, setPage] = useState(0)
const currentIndex = page * ENTRIES_PER_PANEL
const total = useMemo(() => _reduce(data, (prev, curr) => prev + curr.count, 0), [data])
@@ -580,7 +558,7 @@ const Panel = ({
className={cx('flex items-center label hover:underline text-blue-600 dark:text-blue-500', {
capitalize,
})}
- href={rowData}
+ href={rowData as string}
target='_blank'
rel='noopener noreferrer nofollow'
aria-label={`${rowData} (opens in a new tab)`}
@@ -663,28 +641,6 @@ const Panel = ({
)
}
-Panel.propTypes = {
- name: PropTypes.string.isRequired,
- data: PropTypes.objectOf(PropTypes.number).isRequired,
- id: PropTypes.string,
- rowMapper: PropTypes.func,
- onFilter: PropTypes.func,
- capitalize: PropTypes.bool,
- linkContent: PropTypes.bool,
- hideFilters: PropTypes.bool,
- icon: PropTypes.node,
-}
-
-Panel.defaultProps = {
- id: null,
- rowMapper: (row: IEntry): string => row.name,
- capitalize: false,
- linkContent: false,
- onFilter: () => {},
- hideFilters: false,
- icon: null,
-}
-
const PanelMemo = memo(Panel)
const OverviewMemo = memo(Overview)
const CustomEventsMemo = memo(CustomEvents)
diff --git a/app/pages/Captcha/View/ViewCaptcha.helpers.tsx b/app/pages/Captcha/View/ViewCaptcha.helpers.tsx
index a481f5622..92c37ba6f 100644
--- a/app/pages/Captcha/View/ViewCaptcha.helpers.tsx
+++ b/app/pages/Captcha/View/ViewCaptcha.helpers.tsx
@@ -1,4 +1,5 @@
import React from 'react'
+import type i18next from 'i18next'
// @ts-ignore
import {
GlobeEuropeAfricaIcon,
@@ -197,7 +198,7 @@ const validTimeBacket = ['hour', 'day', 'week', 'month']
const validPeriods = ['custom', 'today', 'yesterday', '1d', '7d', '4w', '3M', '12M', '24M']
const validFilters = ['cc', 'pg', 'lc', 'ref', 'dv', 'br', 'os', 'so', 'me', 'ca', 'lt', 'ev']
-const typeNameMapping = (t: (key: string) => string) => ({
+const typeNameMapping = (t: typeof i18next.t) => ({
cc: t('project.mapping.cc'),
dv: t('project.mapping.dv'),
br: t('project.mapping.br'),
diff --git a/app/pages/Captcha/View/ViewCaptcha.tsx b/app/pages/Captcha/View/ViewCaptcha.tsx
index d88412cb3..33fc191b7 100644
--- a/app/pages/Captcha/View/ViewCaptcha.tsx
+++ b/app/pages/Captcha/View/ViewCaptcha.tsx
@@ -1,4 +1,4 @@
-/* eslint-disable react/forbid-prop-types, react/no-unstable-nested-components, react/display-name */
+/* eslint-disable react/no-unstable-nested-components, react/display-name */
import React, { useState, useEffect, useMemo, memo, useRef } from 'react'
import useSize from 'hooks/useSize'
import { useNavigate, useParams } from '@remix-run/react'
@@ -18,7 +18,6 @@ import _filter from 'lodash/filter'
import _startsWith from 'lodash/startsWith'
import _debounce from 'lodash/debounce'
import _some from 'lodash/some'
-import PropTypes from 'prop-types'
import LineChart from 'ui/icons/LineChart'
import BarChart from 'ui/icons/BarChart'
@@ -985,15 +984,4 @@ const ViewCaptcha = ({
)
}
-ViewCaptcha.propTypes = {
- projects: PropTypes.arrayOf(PropTypes.object).isRequired,
- cache: PropTypes.objectOf(PropTypes.object).isRequired,
- projectViewPrefs: PropTypes.objectOf(PropTypes.object).isRequired,
- showError: PropTypes.func.isRequired,
- setProjectCache: PropTypes.func.isRequired,
- setProjectViewPrefs: PropTypes.func.isRequired,
- isLoading: PropTypes.bool.isRequired,
- authenticated: PropTypes.bool.isRequired,
-}
-
export default memo(ViewCaptcha)
diff --git a/app/pages/Captcha/View/components/Filters.tsx b/app/pages/Captcha/View/components/Filters.tsx
index 8ee027ef5..aa99de93c 100644
--- a/app/pages/Captcha/View/components/Filters.tsx
+++ b/app/pages/Captcha/View/components/Filters.tsx
@@ -1,25 +1,12 @@
import React, { memo } from 'react'
+import type i18next from 'i18next'
import _truncate from 'lodash/truncate'
import _map from 'lodash/map'
-import PropTypes from 'prop-types'
import { useTranslation } from 'react-i18next'
import countries from 'utils/isoCountries'
-/**
- * This component is used for showing the filter in panel
- * @returns {JSX.Element}
- */
-const Filter = ({
- column,
- filter,
- isExclusive,
- onRemoveFilter,
- onChangeExclusive,
- tnMapping,
- language,
- t,
-}: {
+interface IFiler {
column: string
filter: string
isExclusive: boolean
@@ -29,13 +16,24 @@ const Filter = ({
onChangeExclusive: (column: string, filter: string, isExclusive: boolean) => void
tnMapping: Record<string, string>
language: string
- t: (key: string) => string
-}): JSX.Element => {
+ t: typeof i18next.t
+}
+
+const Filter = ({
+ column,
+ filter,
+ isExclusive,
+ onRemoveFilter,
+ onChangeExclusive,
+ tnMapping,
+ language,
+ t,
+}: IFiler): JSX.Element => {
const displayColumn = tnMapping[column]
let displayFilter = filter
if (column === 'cc') {
- displayFilter = countries.getName(filter, language)
+ displayFilter = countries.getName(filter, language) as string
}
if (column === 'pg') {
@@ -71,21 +69,7 @@ const Filter = ({
)
}
-/**
- * This component is used for rendering the filter panel.
- *
- * @param {array} filters - Active filters.
- * @param {function} onRemoveFilter - Callback to remove a filter.
- * @param {function} onChangeExclusive - Callback to change the exclusive status of a filter.
- * @param {object} tnMapping - Mapping of column names to translated names.
- * @returns {JSX.Element}
- */
-const Filters = ({
- filters,
- onRemoveFilter,
- onChangeExclusive,
- tnMapping,
-}: {
+interface IFilters {
filters: {
column: string
filter: string
@@ -96,7 +80,9 @@ const Filters = ({
// eslint-disable-next-line no-shadow
onChangeExclusive: (column: string, filter: string, isExclusive: boolean) => void
tnMapping: Record<string, string>
-}) => {
+}
+
+const Filters = ({ filters, onRemoveFilter, onChangeExclusive, tnMapping }: IFilters) => {
const {
t,
i18n: { language },
@@ -124,21 +110,4 @@ const Filters = ({
)
}
-Filters.propTypes = {
- filters: PropTypes.arrayOf(
- PropTypes.shape({
- column: PropTypes.string,
- filter: PropTypes.string,
- isExclusive: PropTypes.bool,
- }),
- ),
- onRemoveFilter: PropTypes.func.isRequired,
- onChangeExclusive: PropTypes.func.isRequired,
- tnMapping: PropTypes.objectOf(PropTypes.string).isRequired,
-}
-
-Filters.defaultProps = {
- filters: [],
-}
-
export default memo(Filters)
diff --git a/app/pages/Captcha/View/components/InteractiveMap.tsx b/app/pages/Captcha/View/components/InteractiveMap.tsx
deleted file mode 100644
index 10aeef40b..000000000
--- a/app/pages/Captcha/View/components/InteractiveMap.tsx
+++ /dev/null
@@ -1,136 +0,0 @@
-import React, { memo, useState, useMemo } from 'react'
-import cx from 'clsx'
-import _map from 'lodash/map'
-import _reduce from 'lodash/reduce'
-import { useTranslation } from 'react-i18next'
-import PropTypes from 'prop-types'
-import countries from 'utils/isoCountries'
-import { nFormatter } from 'utils/generic'
-
-import { IEntry } from 'redux/models/IEntry'
-import countriesList from 'utils/countries'
-
-interface IInteractiveMap {
- data: IEntry[]
- onClickCountry: (country: string) => void
- total: number
-}
-
-interface ICursorPosition {
- pageX: number
- pageY: number
-}
-
-interface IDataHover {
- countries: string
- data: number
-}
-
-interface ICountryMap {
- [key: string]: number
-}
-
-const InteractiveMap = ({ data, onClickCountry, total }: IInteractiveMap) => {
- const {
- t,
- i18n: { language },
- } = useTranslation('common')
- const [hoverShow, setHoverShow] = useState<boolean>(false)
- const [dataHover, setDataHover] = useState<IDataHover>({} as IDataHover)
- const [cursorPosition, setCursorPosition] = useState<ICursorPosition>({} as ICursorPosition)
- const countryMap: ICountryMap = useMemo(
- () => _reduce(data, (prev, curr) => ({ ...prev, [curr.cc || curr.name]: curr.count }), {}),
- [data],
- )
-
- const onMouseMove = (e: React.MouseEvent<SVGSVGElement, MouseEvent>) => {
- const rect = e.currentTarget.getBoundingClientRect()
- const pageX = e.clientX - rect.left
- const pageY = e.clientY - rect.top
- setCursorPosition({ pageX, pageY })
- }
-
- return (
- <div className='relative'>
- <svg id='map' viewBox='0 0 1050 650' className='w-full h-full' onMouseMove={onMouseMove}>
- <g>
- {_map(countriesList, (key, value) => {
- const ccData = countryMap[value] || 0
- const perc = (ccData / total) * 100 || 0
-
- return (
- <path
- key={value}
- id={value}
- className={cx({
- 'hover:opacity-90': perc > 0,
- 'fill-[#cfd1d4] dark:fill-[#465d7e46]': perc === 0,
- 'fill-[#92b2e7] dark:fill-[#292d77]': perc > 0 && perc < 3,
- 'fill-[#6f9be3] dark:fill-[#363391]': perc >= 3 && perc < 10,
- 'fill-[#5689db] dark:fill-[#4842be]': perc >= 10 && perc < 20,
- 'fill-[#3b82f6] dark:fill-[#6357ff]': perc >= 20,
- 'cursor-pointer': Boolean(ccData),
- })}
- d={key.d}
- onClick={() => perc !== 0 && onClickCountry(value)}
- onMouseEnter={() => {
- if (ccData) {
- setHoverShow(true)
- setDataHover({
- countries: countries.getName(value, language),
- data: ccData,
- })
- }
- }}
- onMouseLeave={() => {
- setHoverShow(false)
- }}
- />
- )
- })}
- </g>
- </svg>
- <div>
- {hoverShow && cursorPosition && (
- <div
- className='border absolute z-30 text-xs bg-gray-100 dark:bg-slate-900 dark:shadow-gray-850 dark:border-gray-850 dark:text-gray-200 p-1 rounded-md'
- style={{
- top: cursorPosition.pageY + 20,
- left: cursorPosition.pageX - 20,
- }}
- >
- <strong>{dataHover.countries}</strong>
- <br />
- {t('project.unique')}: &nbsp;
- <strong
- className={cx({
- 'dark:text-indigo-400': dataHover.data < 5,
- })}
- >
- {nFormatter(dataHover.data, 1)}
- </strong>
- </div>
- )}
- </div>
- </div>
- )
-}
-
-InteractiveMap.propTypes = {
- onClickCountry: PropTypes.func,
- data: PropTypes.arrayOf(
- PropTypes.shape({
- name: PropTypes.string,
- count: PropTypes.number,
- }),
- ),
- total: PropTypes.number,
-}
-
-InteractiveMap.defaultProps = {
- onClickCountry: () => {},
- data: [],
- total: 0,
-}
-
-export default memo(InteractiveMap)
diff --git a/app/pages/Captcha/View/components/NoEvents.tsx b/app/pages/Captcha/View/components/NoEvents.tsx
index 7d38407e9..8471ee9fe 100644
--- a/app/pages/Captcha/View/components/NoEvents.tsx
+++ b/app/pages/Captcha/View/components/NoEvents.tsx
@@ -1,35 +1,21 @@
import React, { memo } from 'react'
import { useTranslation, Trans } from 'react-i18next'
import _isEmpty from 'lodash/isEmpty'
-import PropTypes from 'prop-types'
import Button from 'ui/Button'
import { DOCS_CAPTCHA_URL } from 'redux/constants'
-/**
- * This component is used to display text if the data is not available.
- *
- * @param {array} filters - Active filters.
- * @param {function} resetFilters - Callback to reset all filters.
- * @param {string} pid - Project ID.
- * @returns {JSX.Element}
- */
-const NoEvents = ({
- filters,
- resetFilters,
-}: {
+interface INoEvents {
filters: {
column: string
filter: string
isExclusive: boolean
}[]
resetFilters: () => void
-}): JSX.Element => {
- const {
- t,
- }: {
- t: (key: string) => string
- } = useTranslation('common')
+}
+
+const NoEvents = ({ filters, resetFilters }: INoEvents): JSX.Element => {
+ const { t } = useTranslation('common')
return (
<div className='flex flex-col py-6 sm:px-6 lg:px-8 mt-5'>
@@ -65,19 +51,4 @@ const NoEvents = ({
)
}
-NoEvents.propTypes = {
- filters: PropTypes.arrayOf(
- PropTypes.shape({
- column: PropTypes.string,
- filter: PropTypes.string,
- isExclusive: PropTypes.bool,
- }),
- ),
- resetFilters: PropTypes.func.isRequired,
-}
-
-NoEvents.defaultProps = {
- filters: [],
-}
-
export default memo(NoEvents)
diff --git a/app/pages/Changelog/index.tsx b/app/pages/Changelog/index.tsx
index c9c1d0da5..925d75dd8 100644
--- a/app/pages/Changelog/index.tsx
+++ b/app/pages/Changelog/index.tsx
@@ -313,11 +313,7 @@ const changelog = [
]
const Changelog = (): JSX.Element => {
- const {
- t,
- }: {
- t: (key: string) => string
- } = useTranslation('common')
+ const { t } = useTranslation('common')
return (
<div className='min-h-min-footer bg-gray-50 dark:bg-slate-900'>
diff --git a/app/pages/Dashboard/Dashboard.tsx b/app/pages/Dashboard/Dashboard.tsx
index be7f9a3be..71faa0125 100644
--- a/app/pages/Dashboard/Dashboard.tsx
+++ b/app/pages/Dashboard/Dashboard.tsx
@@ -1,9 +1,8 @@
-/* eslint-disable react/forbid-prop-types */
import React, { memo, useState, useEffect, useMemo } from 'react'
import { Link, useNavigate } from '@remix-run/react'
+import type i18next from 'i18next'
import { ClientOnly } from 'remix-utils/client-only'
import cx from 'clsx'
-import PropTypes from 'prop-types'
import _isEmpty from 'lodash/isEmpty'
import _size from 'lodash/size'
import _isNumber from 'lodash/isNumber'
@@ -56,12 +55,7 @@ interface IProjectCard {
active?: boolean
birdseye: IOverall
type: 'analytics' | 'captcha'
- t: (
- key: string,
- options?: {
- [key: string]: string | number | null | undefined
- },
- ) => string
+ t: typeof i18next.t
live?: string | number
isPublic?: boolean
confirmed?: boolean
@@ -81,17 +75,12 @@ interface IProjectCard {
interface IMiniCard {
labelTKey: string
- t: (
- key: string,
- options?: {
- [key: string]: string | number | null | undefined
- },
- ) => string
+ t: typeof i18next.t
total?: number | string
percChange?: number
}
-const MiniCard = ({ labelTKey, t, total, percChange }: IMiniCard): JSX.Element => {
+const MiniCard = ({ labelTKey, t, total = 0, percChange }: IMiniCard): JSX.Element => {
const statsDidGrowUp = percChange ? percChange >= 0 : false
return (
@@ -126,17 +115,12 @@ const MiniCard = ({ labelTKey, t, total, percChange }: IMiniCard): JSX.Element =
)
}
-MiniCard.defaultProps = {
- total: 0,
- percChange: null,
-}
-
const ProjectCard = ({
name,
active,
birdseye,
t,
- live,
+ live = 'N/A',
isPublic,
confirmed,
id,
@@ -280,25 +264,13 @@ const ProjectCard = ({
)
}
-ProjectCard.defaultProps = {
- isPublic: false,
- active: false,
- shared: false,
- captcha: false,
- confirmed: false,
- name: '',
- live: 'N/A',
- isTransferring: false,
- getRole: () => '',
-}
-
interface INoProjects {
- t: (key: string) => string
+ t: typeof i18next.t
onClick: () => void
}
interface IAddProject {
- t: (key: string) => string
+ t: typeof i18next.t
onClick: () => void
sitesCount: number
}
@@ -866,31 +838,4 @@ const Dashboard = ({
)
}
-Dashboard.propTypes = {
- projects: PropTypes.arrayOf(PropTypes.object).isRequired,
- sharedProjects: PropTypes.arrayOf(PropTypes.object).isRequired,
- user: PropTypes.object.isRequired,
- isLoading: PropTypes.bool.isRequired,
- error: PropTypes.string,
- deleteProjectFailed: PropTypes.func.isRequired,
- setProjectsShareData: PropTypes.func.isRequired,
- setUserShareData: PropTypes.func.isRequired,
- sharedProjectError: PropTypes.func.isRequired,
- userSharedUpdate: PropTypes.func.isRequired,
- loadProjects: PropTypes.func.isRequired,
- total: PropTypes.number.isRequired,
- setDashboardPaginationPage: PropTypes.func.isRequired,
- setDashboardPaginationPageShared: PropTypes.func.isRequired,
- dashboardPaginationPage: PropTypes.number.isRequired,
- dashboardPaginationPageShared: PropTypes.number.isRequired,
- dashboardTabs: PropTypes.string.isRequired,
- setDashboardTabs: PropTypes.func.isRequired,
- sharedTotal: PropTypes.number.isRequired,
- birdseye: PropTypes.object.isRequired,
-}
-
-Dashboard.defaultProps = {
- error: '',
-}
-
export default memo(withAuthentication(Dashboard, auth.authenticated))
diff --git a/app/pages/MainPage/Pricing.tsx b/app/pages/MainPage/Pricing.tsx
index 1f0f9f9e4..ee4fe93ce 100644
--- a/app/pages/MainPage/Pricing.tsx
+++ b/app/pages/MainPage/Pricing.tsx
@@ -1,5 +1,6 @@
/* eslint-disable no-confusing-arrow */
import React, { memo, useState, useEffect } from 'react'
+import type i18next from 'i18next'
import { useSelector, useDispatch } from 'react-redux'
import { ClientOnly } from 'remix-utils/client-only'
import { Link } from '@remix-run/react'
@@ -49,12 +50,7 @@ const getPaidFeatures = (t: any, tier: any) => {
}
interface IPricing {
- t: (
- key: string,
- options?: {
- [key: string]: string | number
- },
- ) => string
+ t: typeof i18next.t
language: string
authenticated: boolean
isBillingPage?: boolean
diff --git a/app/pages/MainPage/index.tsx b/app/pages/MainPage/index.tsx
index ff54d9fa1..e3f44fde9 100644
--- a/app/pages/MainPage/index.tsx
+++ b/app/pages/MainPage/index.tsx
@@ -170,16 +170,6 @@ const Main: React.FC<IMain> = ({ ssrTheme, ssrAuthenticated }): JSX.Element => {
const {
t,
i18n: { language },
- }: {
- t: (
- key: string,
- options?: {
- [key: string]: any
- },
- ) => string
- i18n: {
- language: string
- }
} = useTranslation('common')
const reduxTheme = useSelector((state: StateType) => state.ui.theme.theme)
const { authenticated: reduxAuthenticated, loading } = useSelector((state: StateType) => state.auth)
@@ -533,6 +523,7 @@ const Main: React.FC<IMain> = ({ ssrTheme, ssrAuthenticated }): JSX.Element => {
</div>
<div className='mt-[60px] flex items-center max-w-7xl w-full mx-auto flex-wrap justify-center xl:justify-between'>
{_map(
+ // @ts-expect-error
t('main.features', { returnObjects: true }),
(
item: {
@@ -603,6 +594,7 @@ const Main: React.FC<IMain> = ({ ssrTheme, ssrAuthenticated }): JSX.Element => {
</h2>
<div className='grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-y-10 sm:gap-y-24 justify-between justify-items-center text-slate-900 dark:text-white pt-20 pb-36'>
{_map(
+ // @ts-expect-error
t('main.mFeatures', { returnObjects: true }),
(
item: {
@@ -755,6 +747,7 @@ const Main: React.FC<IMain> = ({ ssrTheme, ssrAuthenticated }): JSX.Element => {
</p>
<div className='flex items-center flex-col md:flex-row justify-between mt-16'>
{_map(
+ // @ts-expect-error
t('main.lTestimonials', { returnObjects: true }),
(
item: {
diff --git a/app/pages/NotFound/index.tsx b/app/pages/NotFound/index.tsx
index 66b40e488..893524f63 100644
--- a/app/pages/NotFound/index.tsx
+++ b/app/pages/NotFound/index.tsx
@@ -5,11 +5,7 @@ import { useTranslation } from 'react-i18next'
import routes from 'routesPath'
const NotFound = (): JSX.Element => {
- const {
- t,
- }: {
- t: (key: string) => string
- } = useTranslation('common')
+ const { t } = useTranslation('common')
return (
<div className='min-h-min-footer bg-gray-50 dark:bg-slate-900 px-4 py-16 sm:px-6 sm:py-24 md:grid md:place-items-center lg:px-8'>
diff --git a/app/pages/Press/index.tsx b/app/pages/Press/index.tsx
index 0948dde01..eef645555 100644
--- a/app/pages/Press/index.tsx
+++ b/app/pages/Press/index.tsx
@@ -15,7 +15,12 @@ interface ILogoComponent {
textColor?: string
}
-const LogoComponent = ({ description, logoSVG, logoPNG, textColor }: ILogoComponent): JSX.Element => (
+const LogoComponent = ({
+ description,
+ logoSVG,
+ logoPNG,
+ textColor = 'text-gray-900 dark:text-gray-50',
+}: ILogoComponent): JSX.Element => (
<p>
<b className={`font-bold tracking-tight ${textColor}`}>{description}</b>
<img className='h-16 sm:h-20 mt-5 mb-2' src={logoSVG || logoPNG} alt={description} />
@@ -43,17 +48,8 @@ const LogoComponent = ({ description, logoSVG, logoPNG, textColor }: ILogoCompon
</p>
)
-LogoComponent.defaultProps = {
- logoSVG: null,
- textColor: 'text-gray-900 dark:text-gray-50',
-}
-
const Press = (): JSX.Element => {
- const {
- t,
- }: {
- t: (key: string) => string
- } = useTranslation('common')
+ const { t } = useTranslation('common')
return (
<div className='min-h-min-footer bg-gray-50 dark:bg-slate-900'>
diff --git a/app/pages/Project/Alerts/Settings/ProjectAlertsSettings.tsx b/app/pages/Project/Alerts/Settings/ProjectAlertsSettings.tsx
index 102f03de6..450cfa04f 100644
--- a/app/pages/Project/Alerts/Settings/ProjectAlertsSettings.tsx
+++ b/app/pages/Project/Alerts/Settings/ProjectAlertsSettings.tsx
@@ -1,9 +1,7 @@
-/* eslint-disable react/forbid-prop-types */
import React, { useEffect, useMemo, useState } from 'react'
import { useNavigate, useParams, useLocation, Link } from '@remix-run/react'
import { useTranslation, Trans } from 'react-i18next'
import { ExclamationTriangleIcon } from '@heroicons/react/24/outline'
-import PropTypes from 'prop-types'
import _isEmpty from 'lodash/isEmpty'
import _size from 'lodash/size'
@@ -55,16 +53,7 @@ const ProjectAlertsSettings = ({
const navigate = useNavigate()
const { id, pid } = useParams()
const { pathname } = useLocation()
- const {
- t,
- }: {
- t: (
- key: string,
- options?: {
- [key: string]: string | number | null | undefined
- },
- ) => string
- } = useTranslation('common')
+ const { t } = useTranslation('common')
const isSettings: boolean =
!_isEmpty(id) && _replace(_replace(routes.alert_settings, ':id', id as string), ':pid', pid as string) === pathname
const alert = useMemo(() => _find(alerts, { id }), [alerts, id])
@@ -426,12 +415,4 @@ const ProjectAlertsSettings = ({
)
}
-ProjectAlertsSettings.propTypes = {
- alerts: PropTypes.array.isRequired,
- setProjectAlerts: PropTypes.func.isRequired,
- showError: PropTypes.func.isRequired,
- user: PropTypes.object.isRequired,
- loading: PropTypes.bool.isRequired,
-}
-
export default withAuthentication(ProjectAlertsSettings, auth.authenticated)
diff --git a/app/pages/Project/Alerts/View/ProjectAlertsView.tsx b/app/pages/Project/Alerts/View/ProjectAlertsView.tsx
index d5d05b170..ae8d3c18f 100644
--- a/app/pages/Project/Alerts/View/ProjectAlertsView.tsx
+++ b/app/pages/Project/Alerts/View/ProjectAlertsView.tsx
@@ -1,4 +1,3 @@
-/* eslint-disable react/forbid-prop-types */
import React, { useMemo, memo, useState } from 'react'
import dayjs from 'dayjs'
import _map from 'lodash/map'
diff --git a/app/pages/Project/ConfirmShare/index.tsx b/app/pages/Project/ConfirmShare/index.tsx
index 28d5e0f26..c583fd06d 100644
--- a/app/pages/Project/ConfirmShare/index.tsx
+++ b/app/pages/Project/ConfirmShare/index.tsx
@@ -11,11 +11,7 @@ import routes from 'routesPath'
import { AppDispatch } from 'redux/store'
const ConfirmShare = () => {
- const {
- t,
- }: {
- t: (key: string) => string
- } = useTranslation('common')
+ const { t } = useTranslation('common')
const dispatch: AppDispatch = useDispatch()
const { id } = useParams()
const [loading, setLoading] = useState<boolean>(true)
diff --git a/app/pages/Project/New/index.tsx b/app/pages/Project/New/index.tsx
index c744ea5ab..b6adf4596 100644
--- a/app/pages/Project/New/index.tsx
+++ b/app/pages/Project/New/index.tsx
@@ -1,4 +1,3 @@
-/* eslint-disable react/forbid-prop-types */
import React, { useState, useEffect, memo } from 'react'
import { useNavigate } from '@remix-run/react'
import { useTranslation } from 'react-i18next'
diff --git a/app/pages/Project/ProjectProtectedPassword/index.tsx b/app/pages/Project/ProjectProtectedPassword/index.tsx
index ebdcc2be7..a8596f794 100644
--- a/app/pages/Project/ProjectProtectedPassword/index.tsx
+++ b/app/pages/Project/ProjectProtectedPassword/index.tsx
@@ -30,16 +30,7 @@ const ProjectProtectedPassword = ({
embedded: boolean
isAuth: boolean
}): JSX.Element => {
- const {
- t,
- }: {
- t: (
- key: string,
- optinions?: {
- [key: string]: string | number
- },
- ) => string
- } = useTranslation('common')
+ const { t } = useTranslation('common')
const [form, setForm] = useState<IProjectProtectedPasswordForm>({
password: '',
})
@@ -47,11 +38,7 @@ const ProjectProtectedPassword = ({
const [errors, setErrors] = useState<{
password?: string
}>({})
- const {
- id,
- }: {
- id: string
- } = useParams()
+ const { id } = useParams()
const [beenSubmitted, setBeenSubmitted] = useState<boolean>(false)
const [isLoading, setIsLoading] = useState<boolean>(false)
const navigate = useNavigate()
@@ -83,17 +70,17 @@ const ProjectProtectedPassword = ({
const onSubmit = async (data: IProjectProtectedPasswordForm) => {
if (!isLoading) {
setIsLoading(true)
- await checkPassword(id, data.password)
+ await checkPassword(id as string, data.password)
.then((res) => {
if (res) {
dispatch(
UIActions.setProjectProtectedPassword({
- id,
+ id: id as string,
password: data.password,
}),
)
navigate({
- pathname: _replace(routes.project, ':id', id),
+ pathname: _replace(routes.project, ':id', id as string),
search: `?embedded=${embedded}&theme=${ssrTheme}`,
})
}
diff --git a/app/pages/Project/Settings/Emails/ConfirmReportsShare/index.tsx b/app/pages/Project/Settings/Emails/ConfirmReportsShare/index.tsx
index 2188915a6..78b537eb9 100644
--- a/app/pages/Project/Settings/Emails/ConfirmReportsShare/index.tsx
+++ b/app/pages/Project/Settings/Emails/ConfirmReportsShare/index.tsx
@@ -9,22 +9,14 @@ import { confirmSubscriberInvite } from 'api'
import routes from 'routesPath'
const ConfirmReportsShare = (): JSX.Element => {
- const {
- t,
- }: {
- t: (key: string) => string
- } = useTranslation('common')
- const {
- id,
- }: {
- id: string
- } = useParams()
+ const { t } = useTranslation('common')
+ const { id } = useParams()
const [loading, setLoading] = useState<boolean>(true)
const [error, setError] = useState<string>('')
const handleConfirm = async (token: string) => {
try {
- await confirmSubscriberInvite(id, token)
+ await confirmSubscriberInvite(id as string, token)
} catch (e) {
setError(t('apiNotifications.invalidToken'))
} finally {
diff --git a/app/pages/Project/Settings/Emails/Emails.tsx b/app/pages/Project/Settings/Emails/Emails.tsx
index a26ab380f..5c07cacb6 100644
--- a/app/pages/Project/Settings/Emails/Emails.tsx
+++ b/app/pages/Project/Settings/Emails/Emails.tsx
@@ -1,7 +1,7 @@
import React, { useState, useEffect, useRef } from 'react'
+import type i18next from 'i18next'
import { TrashIcon, InboxStackIcon, ChevronDownIcon, CheckIcon } from '@heroicons/react/24/outline'
import { useTranslation } from 'react-i18next'
-import PropTypes from 'prop-types'
import dayjs from 'dayjs'
import _keys from 'lodash/keys'
import _isEmpty from 'lodash/isEmpty'
@@ -43,12 +43,7 @@ const ModalMessage = ({
email: string
reportFrequency: string
}
- t: (
- key: string,
- options?: {
- [key: string]: string | number | boolean | undefined
- },
- ) => string
+ t: typeof i18next.t
}): JSX.Element => (
<div>
<h2 className='text-xl font-bold text-gray-700 dark:text-gray-200'>
@@ -139,12 +134,7 @@ const EmailList = ({
reportFrequency: string
}
onRemove: (id: string) => void
- t: (
- key: string,
- options?: {
- [key: string]: string | number | boolean | undefined
- },
- ) => string
+ t: typeof i18next.t
setEmails: (value: ISubscribers[] | ((prevVar: ISubscribers[]) => ISubscribers[])) => void
emailFailed: (message: string) => void
language: string
@@ -154,7 +144,7 @@ const EmailList = ({
const [showDeleteModal, setShowDeleteModal] = useState<boolean>(false)
const openRef = useRef<HTMLDivElement>(null)
useOnClickOutside(openRef, () => setOpen(false))
- const { id, addedAt, isConfirmed, projectId, email, reportFrequency } = data
+ const { id, addedAt, isConfirmed, projectId, email, reportFrequency } = data || {}
const changeRole = async (reportType: { value: string; label: string }) => {
try {
@@ -267,21 +257,7 @@ const EmailList = ({
)
}
-EmailList.propTypes = {
- data: PropTypes.shape({
- created: PropTypes.string,
- email: PropTypes.string,
- }),
- onRemove: PropTypes.func.isRequired,
- t: PropTypes.func.isRequired,
- language: PropTypes.string.isRequired,
-}
-
-EmailList.defaultProps = {
- data: {},
-}
-
-const NoSubscribers = ({ t }: { t: (string: string) => string }): JSX.Element => (
+const NoSubscribers = ({ t }: { t: typeof i18next.t }): JSX.Element => (
<div className='flex flex-col py-6 sm:px-6 lg:px-8'>
<div className='max-w-7xl w-full mx-auto text-gray-900 dark:text-gray-50'>
<h2 className='text-xl mb-8 text-center leading-snug px-4'>{t('project.settings.noPeople')}</h2>
@@ -308,14 +284,6 @@ const Emails = ({
const {
t,
i18n: { language },
- }: {
- t: (
- string: string,
- options?: {
- [key: string]: string | number | boolean | undefined | null
- },
- ) => string
- i18n: { language: string }
} = useTranslation('common')
const [form, setForm] = useState<{
email: string
@@ -532,11 +500,4 @@ const Emails = ({
)
}
-Emails.propTypes = {
- // eslint-disable-next-line react/forbid-prop-types
- emailFailed: PropTypes.func.isRequired,
- addEmail: PropTypes.func.isRequired,
- removeEmail: PropTypes.func.isRequired,
-}
-
export default Emails
diff --git a/app/pages/Project/Settings/People/People.tsx b/app/pages/Project/Settings/People/People.tsx
index 262f32145..79dd0c3ee 100644
--- a/app/pages/Project/Settings/People/People.tsx
+++ b/app/pages/Project/Settings/People/People.tsx
@@ -1,9 +1,9 @@
import React, { useState, useEffect, useRef } from 'react'
+import type i18next from 'i18next'
import { ChevronDownIcon, CheckIcon } from '@heroicons/react/24/solid'
import { TrashIcon, UserPlusIcon, CurrencyDollarIcon } from '@heroicons/react/24/outline'
import { useTranslation } from 'react-i18next'
import cx from 'clsx'
-import PropTypes from 'prop-types'
import dayjs from 'dayjs'
import _keys from 'lodash/keys'
import _isEmpty from 'lodash/isEmpty'
@@ -22,7 +22,7 @@ import useOnClickOutside from 'hooks/useOnClickOutside'
import { IProject, IShareOwnerProject } from 'redux/models/IProject'
import { IUser } from 'redux/models/IUser'
-const NoEvents = ({ t }: { t: (key: string) => string }): JSX.Element => (
+const NoEvents = ({ t }: { t: typeof i18next.t }): JSX.Element => (
<div className='flex flex-col py-6 sm:px-6 lg:px-8'>
<div className='max-w-7xl w-full mx-auto text-gray-900 dark:text-gray-50'>
<h2 className='text-xl mb-8 text-center leading-snug px-4'>{t('project.settings.noPeople')}</h2>
@@ -33,12 +33,7 @@ const NoEvents = ({ t }: { t: (key: string) => string }): JSX.Element => (
interface IUsersList {
data: IShareOwnerProject
onRemove: (id: string) => void
- t: (
- key: string,
- options?: {
- [key: string]: string | number | null
- },
- ) => string
+ t: typeof i18next.t
share?: IShareOwnerProject[]
setProjectShareData: (item: Partial<IProject>, id: string, shared: boolean) => void
pid: string
@@ -66,7 +61,7 @@ const UsersList = ({
const [showDeleteModal, setShowDeleteModal] = useState(false)
const openRef = useRef<HTMLDivElement>(null)
useOnClickOutside(openRef, () => setOpen(false))
- const { id, created, confirmed, role, user } = data
+ const { id, created, confirmed, role, user } = data || {}
const changeRole = async (newRole: string) => {
try {
@@ -181,19 +176,6 @@ const UsersList = ({
)
}
-UsersList.propTypes = {
- share: PropTypes.arrayOf(PropTypes.object).isRequired, // eslint-disable-line react/forbid-prop-types
- data: PropTypes.object, // eslint-disable-line react/forbid-prop-types
- pid: PropTypes.string.isRequired,
- onRemove: PropTypes.func.isRequired,
- updateProjectFailed: PropTypes.func.isRequired,
- language: PropTypes.string.isRequired,
-}
-
-UsersList.defaultProps = {
- data: {},
-}
-
interface IPeopleProps {
project: IProject
updateProjectFailed: (error: string) => void
@@ -535,15 +517,4 @@ const People: React.FunctionComponent<IPeopleProps> = ({
)
}
-People.propTypes = {
- // @ts-ignore
- // eslint-disable-next-line react/forbid-prop-types
- project: PropTypes.object.isRequired,
- updateProjectFailed: PropTypes.func.isRequired,
- setProjectShareData: PropTypes.func.isRequired,
- roleUpdatedNotification: PropTypes.func.isRequired,
- inviteUserNotification: PropTypes.func.isRequired,
- removeUserNotification: PropTypes.func.isRequired,
-}
-
export default People
diff --git a/app/pages/Project/Settings/ProjectSettings.tsx b/app/pages/Project/Settings/ProjectSettings.tsx
index 33d3aaa4e..be78e230c 100644
--- a/app/pages/Project/Settings/ProjectSettings.tsx
+++ b/app/pages/Project/Settings/ProjectSettings.tsx
@@ -1,5 +1,5 @@
-/* eslint-disable react/forbid-prop-types */
import React, { useState, useEffect, useMemo, memo } from 'react'
+import type i18next from 'i18next'
import { useNavigate, useParams } from '@remix-run/react'
import { useTranslation } from 'react-i18next'
import cx from 'clsx'
@@ -70,12 +70,7 @@ interface IModalMessage {
dateRange: Date[]
setDateRange: (a: Date[]) => void
setTab: (i: string) => void
- t: (
- key: string,
- options?: {
- [key: string]: string | number | null
- },
- ) => string
+ t: typeof i18next.t
tab: string
pid: string
activeFilter: string[]
diff --git a/app/pages/Project/Settings/TransferProject/TransferProjectConfirm.tsx b/app/pages/Project/Settings/TransferProject/TransferProjectConfirm.tsx
index 525b72370..b8beb03f3 100644
--- a/app/pages/Project/Settings/TransferProject/TransferProjectConfirm.tsx
+++ b/app/pages/Project/Settings/TransferProject/TransferProjectConfirm.tsx
@@ -9,11 +9,7 @@ import { confirmTransferProject } from 'api'
import routes from 'routesPath'
const TransferProjectConfirm = (): JSX.Element => {
- const {
- t,
- }: {
- t: (key: string) => string
- } = useTranslation('common')
+ const { t } = useTranslation('common')
const [loading, setLoading] = useState<boolean>(true)
const [error, setError] = useState<string>('')
diff --git a/app/pages/Project/Settings/TransferProject/TransferProjectReject.tsx b/app/pages/Project/Settings/TransferProject/TransferProjectReject.tsx
index 3256736da..d5c978830 100644
--- a/app/pages/Project/Settings/TransferProject/TransferProjectReject.tsx
+++ b/app/pages/Project/Settings/TransferProject/TransferProjectReject.tsx
@@ -9,11 +9,7 @@ import { rejectTransferProject } from 'api'
import routes from 'routesPath'
const TransferProjectReject = (): JSX.Element => {
- const {
- t,
- }: {
- t: (key: string) => string
- } = useTranslation('common')
+ const { t } = useTranslation('common')
const [loading, setLoading] = useState<boolean>(true)
const [error, setError] = useState<string>('')
diff --git a/app/pages/Project/View/Panels.tsx b/app/pages/Project/View/Panels.tsx
index 94b1c29ce..06ff72e10 100644
--- a/app/pages/Project/View/Panels.tsx
+++ b/app/pages/Project/View/Panels.tsx
@@ -1,4 +1,5 @@
import React, { memo, useState, useEffect, useMemo, Fragment } from 'react'
+import type i18next from 'i18next'
import InnerHTML from 'dangerously-set-html-content'
import { ArrowLongRightIcon, ArrowLongLeftIcon } from '@heroicons/react/24/solid'
import { ChevronUpIcon, ChevronDownIcon } from '@heroicons/react/20/solid'
@@ -12,7 +13,6 @@ import {
RectangleGroupIcon,
} from '@heroicons/react/24/outline'
import cx from 'clsx'
-import PropTypes from 'prop-types'
import { pie } from 'billboard.js'
import _keys from 'lodash/keys'
import _values from 'lodash/values'
@@ -116,12 +116,12 @@ const PanelContainer = ({
noSwitch,
icon,
type,
- activeFragment,
- setActiveFragment,
- customTabs,
+ activeFragment = 0,
+ setActiveFragment = () => {},
+ customTabs = [],
activeTab,
isCustomContent,
- onExpandClick,
+ onExpandClick = () => {},
}: IPanelContainer): JSX.Element => (
<div
className={cx(
@@ -257,27 +257,6 @@ const PanelContainer = ({
</div>
)
-PanelContainer.propTypes = {
- name: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired,
- children: PropTypes.node.isRequired,
- noSwitch: PropTypes.bool,
- activeFragment: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
- setActiveFragment: PropTypes.func,
- onExpandClick: PropTypes.func,
- icon: PropTypes.node,
-}
-
-PanelContainer.defaultProps = {
- icon: null,
- noSwitch: false,
- activeFragment: 0,
- setActiveFragment: () => {},
- onExpandClick: () => {},
- customTabs: [],
- activeTab: '',
- isCustomContent: false,
-}
-
// Options for circle chart showing the stats of data
const getPieOptions = (customs: any, uniques: number, t: any) => {
const tQuantity = t('project.quantity')
@@ -324,7 +303,7 @@ interface ICustomEvents {
customs: any
chartData: any
onFilter: any
- t: (arg0: string) => string
+ t: typeof i18next.t
getCustomEventMetadata: (event: string) => any
customTabs: any
}
@@ -410,7 +389,7 @@ const KVTable = ({ data, t, uniques, loading }: IKVTable) => {
}
// Tabs with custom events like submit form, press button, go to the link rate etc.
-const CustomEvents = ({ customs, chartData, onFilter, t, customTabs, getCustomEventMetadata }: ICustomEvents) => {
+const CustomEvents = ({ customs, chartData, onFilter, t, customTabs = [], getCustomEventMetadata }: ICustomEvents) => {
const [page, setPage] = useState(0)
const [modal, setModal] = useState(false)
const [activeEvents, setActiveEvents] = useState<any>({})
@@ -910,31 +889,17 @@ const CustomEvents = ({ customs, chartData, onFilter, t, customTabs, getCustomEv
)
}
-CustomEvents.propTypes = {
- customs: PropTypes.objectOf(PropTypes.number).isRequired,
- onFilter: PropTypes.func.isRequired,
- t: PropTypes.func.isRequired,
- // eslint-disable-next-line react/forbid-prop-types
- chartData: PropTypes.objectOf(PropTypes.any).isRequired,
- // eslint-disable-next-line react/forbid-prop-types
- customTabs: PropTypes.array,
-}
-
-CustomEvents.defaultProps = {
- customTabs: [],
-}
-
interface IPanel {
name: string | JSX.Element
data: IEntry[]
- rowMapper: any
- valueMapper: any
- capitalize: boolean
- linkContent: boolean
- t: (arg0: string) => string
+ rowMapper?: (row: any) => string | JSX.Element
+ valueMapper?: (value: number) => number
+ capitalize?: boolean
+ linkContent?: boolean
+ t: typeof i18next.t
icon: any
id: string
- hideFilters: boolean
+ hideFilters?: boolean
onFilter: any
customTabs?: any
pid?: string | null
@@ -952,16 +917,16 @@ interface IPanel {
const Panel = ({
name,
data,
- rowMapper,
- valueMapper,
+ rowMapper = (row: IEntry): string => row.name,
+ valueMapper = (value: number): number => value,
capitalize,
linkContent,
t,
icon,
id,
hideFilters,
- onFilter,
- customTabs,
+ onFilter = () => {},
+ customTabs = [],
pid,
period,
timeBucket,
@@ -969,7 +934,7 @@ const Panel = ({
to,
timezone,
activeTab,
- onFragmentChange,
+ onFragmentChange = () => {},
filters,
projectPassword,
}: IPanel): JSX.Element => {
@@ -1058,7 +1023,6 @@ const Panel = ({
{/* @ts-ignore */}
<UserFlow
projectPassword={projectPassword}
- disableLegend
pid={pid || ''}
period={period || ''}
timeBucket={timeBucket || ''}
@@ -1219,7 +1183,7 @@ const Panel = ({
className={cx('flex items-center label hover:underline text-blue-600 dark:text-blue-500', {
capitalize,
})}
- href={rowData}
+ href={rowData as string}
target='_blank'
rel='noopener noreferrer nofollow'
aria-label={`${rowData} (opens in a new tab)`}
@@ -1304,46 +1268,6 @@ const Panel = ({
)
}
-Panel.propTypes = {
- name: PropTypes.oneOfType([PropTypes.string.isRequired, PropTypes.node]).isRequired,
- data: PropTypes.arrayOf(
- PropTypes.shape({
- name: PropTypes.string,
- count: PropTypes.number,
- }),
- ).isRequired,
- id: PropTypes.string,
- rowMapper: PropTypes.func,
- valueMapper: PropTypes.func,
- onFilter: PropTypes.func,
- capitalize: PropTypes.bool,
- linkContent: PropTypes.bool,
- hideFilters: PropTypes.bool,
- icon: PropTypes.node,
- onFragmentChange: PropTypes.func,
-}
-
-Panel.defaultProps = {
- id: null,
- rowMapper: (row: IEntry): string => row.name,
- valueMapper: (value: number): number => value,
- capitalize: false,
- linkContent: false,
- onFilter: () => {},
- hideFilters: false,
- icon: null,
- customTabs: [],
- to: null,
- from: null,
- timezone: null,
- timeBucket: null,
- period: null,
- pid: null,
- activeTab: null,
- onFragmentChange: () => {},
- filters: [],
-}
-
const PanelMemo = memo(Panel)
const CustomEventsMemo = memo(CustomEvents)
diff --git a/app/pages/Project/View/ViewProject.helpers.tsx b/app/pages/Project/View/ViewProject.helpers.tsx
index 72847737f..af2fbab3b 100644
--- a/app/pages/Project/View/ViewProject.helpers.tsx
+++ b/app/pages/Project/View/ViewProject.helpers.tsx
@@ -1,4 +1,5 @@
import React from 'react'
+import type i18next from 'i18next'
// @ts-ignore
import { saveAs } from 'file-saver'
import {
@@ -1064,11 +1065,7 @@ const getSettingsError = (
}
// function to get the settings and data for the funnels chart
-const getSettingsFunnels = (
- funnel: IAnalyticsFunnel[],
- totalPageviews: number,
- t: (key: string, params?: any) => string,
-) => {
+const getSettingsFunnels = (funnel: IAnalyticsFunnel[], totalPageviews: number, t: typeof i18next.t) => {
const values = _map(funnel, (step) => {
if (_startsWith(step.value, '/')) {
return t('project.visitPage', { page: step.value })
@@ -1473,7 +1470,7 @@ export const filterInvalidViewPrefs = (prefs: any): any => {
)
}
-const typeNameMapping = (t: (str: string) => string) => ({
+const typeNameMapping = (t: typeof i18next.t) => ({
cc: t('project.mapping.cc'),
rg: t('project.mapping.rg'),
ct: t('project.mapping.ct'),
diff --git a/app/pages/Project/View/ViewProject.tsx b/app/pages/Project/View/ViewProject.tsx
index 064a5a0fb..3df6ee8a8 100644
--- a/app/pages/Project/View/ViewProject.tsx
+++ b/app/pages/Project/View/ViewProject.tsx
@@ -1,4 +1,4 @@
-/* eslint-disable react/forbid-prop-types, react/no-unstable-nested-components, react/display-name */
+/* eslint-disable react/no-unstable-nested-components, react/display-name */
import React, { useState, useEffect, useMemo, memo, useRef, useCallback } from 'react'
import { ClientOnly } from 'remix-utils/client-only'
import useSize from 'hooks/useSize'
@@ -43,7 +43,6 @@ import _every from 'lodash/every'
import _size from 'lodash/size'
import _truncate from 'lodash/truncate'
import _isString from 'lodash/isString'
-import PropTypes from 'prop-types'
import { withProjectProtected } from 'hoc/projectProtected'
@@ -257,7 +256,7 @@ const ViewProject = ({
setPublicProject,
setLiveStatsForProject,
authenticated: csrAuthenticated,
- timezone,
+ timezone = DEFAULT_TIMEZONE,
user,
sharedProjects,
extensions,
@@ -284,20 +283,9 @@ const ViewProject = ({
}: IViewProject) => {
const authenticated = isBrowser ? (authLoading ? ssrAuthenticated : csrAuthenticated) : ssrAuthenticated
- // t is used for translation
const {
t,
i18n: { language },
- }: {
- t: (
- key: string,
- options?: {
- [key: string]: string | number | null
- },
- ) => string
- i18n: {
- language: string
- }
} = useTranslation('common')
const _theme = isBrowser ? theme : ssrTheme
@@ -3606,15 +3594,18 @@ const ViewProject = ({
activeTab !== PROJECT_TABS.errors && (
<Dropdown
header={t('project.exportData')}
- items={[
- ...exportTypes,
- ...customExportTypes,
- !isSelfhosted && {
- label: t('project.lookingForMore'),
- lookingForMore: true,
- onClick: () => {},
- },
- ].filter((el) => !!el)}
+ items={_filter(
+ [
+ ...exportTypes,
+ ...customExportTypes,
+ !isSelfhosted && {
+ label: t('project.lookingForMore'),
+ lookingForMore: true,
+ onClick: () => {},
+ },
+ ],
+ (el) => !!el,
+ )}
title={[<ArrowDownTrayIcon key='download-icon' className='w-5 h-5' />]}
labelExtractor={(item) => {
const { label } = item
@@ -4960,29 +4951,4 @@ const ViewProject = ({
)
}
-ViewProject.propTypes = {
- projects: PropTypes.arrayOf(PropTypes.object).isRequired,
- sharedProjects: PropTypes.arrayOf(PropTypes.object).isRequired,
- cache: PropTypes.objectOf(PropTypes.object).isRequired,
- showError: PropTypes.func.isRequired,
- setProjectCache: PropTypes.func.isRequired,
- setProjectViewPrefs: PropTypes.func.isRequired,
- isLoading: PropTypes.bool.isRequired,
- setPublicProject: PropTypes.func.isRequired,
- setLiveStatsForProject: PropTypes.func.isRequired,
- authenticated: PropTypes.bool.isRequired,
- extensions: PropTypes.arrayOf(PropTypes.object).isRequired,
- timezone: PropTypes.string,
- embedded: PropTypes.bool.isRequired,
- ssrAuthenticated: PropTypes.bool.isRequired,
- authLoading: PropTypes.bool.isRequired,
- updateProject: PropTypes.func.isRequired,
- queryPassword: PropTypes.string,
-}
-
-ViewProject.defaultProps = {
- timezone: DEFAULT_TIMEZONE,
- queryPassword: null,
-}
-
export default memo(withProjectProtected(ViewProject))
diff --git a/app/pages/Project/View/components/CCRow.tsx b/app/pages/Project/View/components/CCRow.tsx
index b8f46d0ae..9813b3c88 100644
--- a/app/pages/Project/View/components/CCRow.tsx
+++ b/app/pages/Project/View/components/CCRow.tsx
@@ -11,14 +11,6 @@ interface ICCRow {
spaces?: number
}
-/**
- * Component to render country flag in the 'Countries' panel.
- *
- * @param {string} cc - The country code.
- * @param {string} name - Row name to override country name with.
- * @param {string} language - Language to use for country name.
- * @returns {JSX.Element}
- */
const CCRow = ({ cc, name, language, size = 21, spaces = 2 }: ICCRow): JSX.Element => (
<>
<Flag className='rounded-sm' country={cc} size={size} alt='' aria-hidden='true' />
@@ -31,8 +23,4 @@ const CCRow = ({ cc, name, language, size = 21, spaces = 2 }: ICCRow): JSX.Eleme
</>
)
-CCRow.defaultProps = {
- name: null,
-}
-
export default memo(CCRow)
diff --git a/app/pages/Project/View/components/Filters.tsx b/app/pages/Project/View/components/Filters.tsx
index 8ff631f97..d30763c20 100644
--- a/app/pages/Project/View/components/Filters.tsx
+++ b/app/pages/Project/View/components/Filters.tsx
@@ -1,8 +1,8 @@
import React, { memo } from 'react'
+import type i18next from 'i18next'
import cx from 'clsx'
import _truncate from 'lodash/truncate'
import _map from 'lodash/map'
-import PropTypes from 'prop-types'
import { useTranslation } from 'react-i18next'
import countries from 'utils/isoCountries'
@@ -18,7 +18,7 @@ interface IFilter {
onChangeExclusive: (column: string, filter: string, isExclusive: boolean) => void
tnMapping: Record<string, string>
language: string
- t: (key: string) => string
+ t: typeof i18next.t
canChangeExclusive?: boolean
removable?: boolean
}
@@ -149,21 +149,4 @@ export const Filters = ({ filters, onRemoveFilter, onChangeExclusive, tnMapping
)
}
-Filters.propTypes = {
- filters: PropTypes.arrayOf(
- PropTypes.shape({
- column: PropTypes.string,
- filter: PropTypes.string,
- isExclusive: PropTypes.bool,
- }),
- ),
- onRemoveFilter: PropTypes.func.isRequired,
- onChangeExclusive: PropTypes.func.isRequired,
- tnMapping: PropTypes.objectOf(PropTypes.string).isRequired,
-}
-
-Filters.defaultProps = {
- filters: [],
-}
-
export default memo(Filters)
diff --git a/app/pages/Project/View/components/InteractiveMap.tsx b/app/pages/Project/View/components/InteractiveMap.tsx
index 29daae437..00edea0a5 100644
--- a/app/pages/Project/View/components/InteractiveMap.tsx
+++ b/app/pages/Project/View/components/InteractiveMap.tsx
@@ -3,7 +3,6 @@ import cx from 'clsx'
import _map from 'lodash/map'
import _reduce from 'lodash/reduce'
import { useTranslation } from 'react-i18next'
-import PropTypes from 'prop-types'
import countries from 'utils/isoCountries'
import { PROJECT_TABS } from 'redux/constants'
import { StateType } from 'redux/store'
@@ -98,7 +97,7 @@ const InteractiveMap = ({ data, onClickCountry, total }: IInteractiveMap) => {
if (ccData) {
setHoverShow(true)
setDataHover({
- countries: countries.getName(value, language),
+ countries: countries.getName(value, language) as string,
data: ccData,
})
}
@@ -140,21 +139,4 @@ const InteractiveMap = ({ data, onClickCountry, total }: IInteractiveMap) => {
)
}
-InteractiveMap.propTypes = {
- onClickCountry: PropTypes.func,
- data: PropTypes.arrayOf(
- PropTypes.shape({
- name: PropTypes.string,
- count: PropTypes.number,
- }),
- ),
- total: PropTypes.number,
-}
-
-InteractiveMap.defaultProps = {
- onClickCountry: () => {},
- data: [],
- total: 0,
-}
-
export default memo(InteractiveMap)
diff --git a/app/pages/Project/View/components/LiveVisitorsDropdown.tsx b/app/pages/Project/View/components/LiveVisitorsDropdown.tsx
index c743f15b3..113fe9f63 100644
--- a/app/pages/Project/View/components/LiveVisitorsDropdown.tsx
+++ b/app/pages/Project/View/components/LiveVisitorsDropdown.tsx
@@ -15,7 +15,7 @@ interface ILiveVisitorsDropdown {
projectPassword?: string
}
-const LiveVisitorsDropdown = ({ live, projectId, projectPassword }: ILiveVisitorsDropdown): JSX.Element => {
+const LiveVisitorsDropdown = ({ live, projectId, projectPassword = '' }: ILiveVisitorsDropdown): JSX.Element => {
const { t } = useTranslation()
const [show, setShow] = useState<boolean>(false)
const [liveInfo, setLiveInfo] = useState<IGetLiveVisitorsInfo[]>([])
@@ -92,8 +92,4 @@ const LiveVisitorsDropdown = ({ live, projectId, projectPassword }: ILiveVisitor
)
}
-LiveVisitorsDropdown.defaultProps = {
- projectPassword: '',
-}
-
export default LiveVisitorsDropdown
diff --git a/app/pages/Project/View/components/NoEvents.tsx b/app/pages/Project/View/components/NoEvents.tsx
index e4a375aae..798a76f3d 100644
--- a/app/pages/Project/View/components/NoEvents.tsx
+++ b/app/pages/Project/View/components/NoEvents.tsx
@@ -1,7 +1,6 @@
import React, { memo } from 'react'
import { useTranslation } from 'react-i18next'
import _isEmpty from 'lodash/isEmpty'
-import PropTypes from 'prop-types'
import Button from 'ui/Button'
@@ -14,20 +13,8 @@ interface INoEvents {
resetFilters: () => void
}
-/**
- * This component is used to display text if the data is not available.
- *
- * @param {array} filters - Active filters.
- * @param {function} resetFilters - Callback to reset all filters.
- * @param {string} pid - Project ID.
- * @returns {JSX.Element}
- */
const NoEvents = ({ filters, resetFilters }: INoEvents): JSX.Element => {
- const {
- t,
- }: {
- t: (key: string) => string
- } = useTranslation('common')
+ const { t } = useTranslation('common')
return (
<div className='flex flex-col py-6 sm:px-6 lg:px-8 mt-5'>
@@ -46,19 +33,4 @@ const NoEvents = ({ filters, resetFilters }: INoEvents): JSX.Element => {
)
}
-NoEvents.propTypes = {
- filters: PropTypes.arrayOf(
- PropTypes.shape({
- column: PropTypes.string,
- filter: PropTypes.string,
- isExclusive: PropTypes.bool,
- }),
- ),
- resetFilters: PropTypes.func.isRequired,
-}
-
-NoEvents.defaultProps = {
- filters: [],
-}
-
export default memo(NoEvents)
diff --git a/app/pages/Project/View/components/RefRow.tsx b/app/pages/Project/View/components/RefRow.tsx
index 597461501..fa068c91c 100644
--- a/app/pages/Project/View/components/RefRow.tsx
+++ b/app/pages/Project/View/components/RefRow.tsx
@@ -1,13 +1,6 @@
import React, { memo } from 'react'
import _isEmpty from 'lodash/isEmpty'
-import PropTypes from 'prop-types'
-/**
- * Component that renders a link row in the 'Referrer' panel.
- *
- * @param {string} rowName - A link itself (e.g. https://google.com) to render in the row.
- * @returns {JSX.Element}
- */
const RefRow = ({ rowName }: { rowName: string }): JSX.Element => {
let isUrl: boolean = true
let url: URL | null = null
@@ -46,8 +39,4 @@ const RefRow = ({ rowName }: { rowName: string }): JSX.Element => {
)
}
-RefRow.propTypes = {
- rowName: PropTypes.string.isRequired,
-}
-
export default memo(RefRow)
diff --git a/app/pages/Project/View/components/TBPeriodSelector.tsx b/app/pages/Project/View/components/TBPeriodSelector.tsx
index 08134efe6..eedeb8a97 100644
--- a/app/pages/Project/View/components/TBPeriodSelector.tsx
+++ b/app/pages/Project/View/components/TBPeriodSelector.tsx
@@ -111,8 +111,4 @@ const TBPeriodSelector = ({
)
}
-TBPeriodSelector.defaultProps = {
- name: null,
-}
-
export default memo(TBPeriodSelector)
diff --git a/app/pages/Project/View/components/UserFlow.tsx b/app/pages/Project/View/components/UserFlow.tsx
index bfa0e903e..2d1319d4f 100644
--- a/app/pages/Project/View/components/UserFlow.tsx
+++ b/app/pages/Project/View/components/UserFlow.tsx
@@ -1,4 +1,5 @@
import { useEffect, useState } from 'react'
+import type i18next from 'i18next'
import { ResponsiveSankey } from '@nivo/sankey'
import { connect } from 'react-redux'
import { StateType, AppDispatch } from 'redux/store'
@@ -47,7 +48,6 @@ const mapDispatchToProps = (dispatch: AppDispatch) => ({
})
interface IJSXUserFlow {
- disableLegend?: boolean
pid: string
userFlowAscendingCache: {
[key: string]: IUserFlow
@@ -64,14 +64,13 @@ interface IJSXUserFlow {
setUserFlowAscending: (data: IUserFlow, id: string, pd: string, fltr: any) => void
setUserFlowDescending: (data: IUserFlow, id: string, pd: string, fltr: any) => void
generateError: (message: string) => void
- t: (key: string) => string
+ t: typeof i18next.t
filters: string[]
setReversed: () => void
projectPassword?: string
}
const UserFlow = ({
- disableLegend,
pid,
period,
timeBucket,
@@ -158,7 +157,6 @@ const UserFlow = ({
data={isReversed ? userFlowDescending : userFlowAscending}
margin={{
top: 0,
- // right: disableLegend ? 0 : 120,
right: 0,
bottom: 0,
left: 20,
@@ -186,36 +184,10 @@ const UserFlow = ({
from: 'color',
modifiers: [['darker', 1]],
}}
- // legends={!disableLegend ? [
- // {
- // anchor: 'bottom-right',
- // direction: 'column',
- // translateX: 100,
- // itemWidth: 100,
- // itemHeight: 14,
- // itemDirection: 'right-to-left',
- // itemsSpacing: 2,
- // itemTextColor: '#999',
- // symbolSize: 14,
- // effects: [
- // {
- // on: 'hover',
- // style: {
- // itemTextColor: '#000',
- // },
- // },
- // ],
- // },
- // ] : []}
/>
)
}
-UserFlow.defaultProps = {
- disableLegend: false,
- isReversed: false,
-}
-
const mergeProps = (
stateProps: ReturnType<typeof mapStateToProps>,
dispatchProps: ReturnType<typeof mapDispatchToProps>,
diff --git a/app/pages/ReferralPage/index.tsx b/app/pages/ReferralPage/index.tsx
index b9d3af324..7ad8f3f18 100644
--- a/app/pages/ReferralPage/index.tsx
+++ b/app/pages/ReferralPage/index.tsx
@@ -16,16 +16,7 @@ interface IReferralPage {
}
const ReferralPage = ({ ssrTheme }: IReferralPage): JSX.Element => {
- const {
- t,
- }: {
- t: (
- key: string,
- options?: {
- [key: string]: string | number
- },
- ) => string
- } = useTranslation('common')
+ const { t } = useTranslation('common')
const reduxTheme = useSelector((state: StateType) => state.ui.theme.theme)
const theme = isBrowser ? reduxTheme : ssrTheme
diff --git a/app/pages/UserSettings/UserSettings.container.tsx b/app/pages/UserSettings/UserSettings.container.tsx
index 29e933a5b..9f316a06a 100644
--- a/app/pages/UserSettings/UserSettings.container.tsx
+++ b/app/pages/UserSettings/UserSettings.container.tsx
@@ -1,4 +1,5 @@
import { connect } from 'react-redux'
+import type i18next from 'i18next'
import UIActions from 'redux/reducers/ui'
import { errorsActions } from 'redux/reducers/errors'
import { authActions } from 'redux/reducers/auth'
@@ -33,7 +34,7 @@ const mapDispatchToProps = (dispatch: AppDispatch) => ({
)
},
onDelete: (
- t: (key: string) => string,
+ t: typeof i18next.t,
deletionFeedback: string,
onSuccess: {
(): void
@@ -160,10 +161,10 @@ const mapDispatchToProps = (dispatch: AppDispatch) => ({
// setThemeType: (theme) => {
// dispatch(UIActions.setThemeType(theme))
// },
- linkSSO: (t: (key: string) => string, callback: (e: any) => void, provider: string) => {
+ linkSSO: (t: typeof i18next.t, callback: (e: any) => void, provider: string) => {
dispatch(sagaActions.linkSSO(t, callback, provider))
},
- unlinkSSO: (t: (key: string) => string, callback: (e: any) => void, provider: string) => {
+ unlinkSSO: (t: typeof i18next.t, callback: (e: any) => void, provider: string) => {
dispatch(sagaActions.unlinkSSO(t, callback, provider))
},
updateShowLiveVisitorsInTitle: (show: boolean, callback: (isSuccess: boolean) => void) => {
diff --git a/app/pages/UserSettings/UserSettings.tsx b/app/pages/UserSettings/UserSettings.tsx
index 866df4830..ccf99b219 100644
--- a/app/pages/UserSettings/UserSettings.tsx
+++ b/app/pages/UserSettings/UserSettings.tsx
@@ -1,5 +1,6 @@
-/* eslint-disable no-param-reassign, react/forbid-prop-types */
+/* eslint-disable no-param-reassign */
import React, { useState, useEffect, memo, useRef, useMemo } from 'react'
+import type i18next from 'i18next'
import { useNavigate } from '@remix-run/react'
import { ClientOnly } from 'remix-utils/client-only'
import { useTranslation } from 'react-i18next'
@@ -22,7 +23,6 @@ import {
ComputerDesktopIcon,
CursorArrowRaysIcon,
} from '@heroicons/react/24/outline'
-import PropTypes from 'prop-types'
import dayjs from 'dayjs'
import utc from 'dayjs/plugin/utc'
import cx from 'clsx'
@@ -78,7 +78,7 @@ const TAB_MAPPING = {
COMMUNICATIONS: 'communications',
}
-const getTabs = (t: (key: string) => string) => {
+const getTabs = (t: typeof i18next.t) => {
if (isSelfhosted) {
return [
{
@@ -119,7 +119,7 @@ const getTabs = (t: (key: string) => string) => {
}
interface IProps {
- onDelete: (t: (key: string) => string, deletionFeedback: string, callback: () => void) => void
+ onDelete: (t: typeof i18next.t, deletionFeedback: string, callback: () => void) => void
onDeleteProjectCache: () => void
removeProject: (id: string) => void
removeShareProject: (id: string) => void
@@ -137,8 +137,8 @@ interface IProps {
user: IUser
dontRemember: boolean
isPaidTierUsed: boolean
- linkSSO: (t: (key: string) => string, callback: (e: any) => void, provider: string) => void
- unlinkSSO: (t: (key: string) => string, callback: (e: any) => void, provider: string) => void
+ linkSSO: (t: typeof i18next.t, callback: (e: any) => void, provider: string) => void
+ unlinkSSO: (t: typeof i18next.t, callback: (e: any) => void, provider: string) => void
theme: string
updateShowLiveVisitorsInTitle: (show: boolean, callback: (isSuccess: boolean) => void) => void
logoutLocal: () => void
@@ -186,16 +186,7 @@ const UserSettings = ({
setCache,
}: IProps): JSX.Element => {
const navigate = useNavigate()
- const {
- t,
- }: {
- t: (
- key: string,
- options?: {
- [key: string]: string | number | null
- },
- ) => string
- } = useTranslation('common')
+ const { t } = useTranslation('common')
const [activeTab, setActiveTab] = useState<string>(TAB_MAPPING.ACCOUNT)
const [form, setForm] = useState<IForm>({
email: user.email || '',
@@ -1093,33 +1084,4 @@ const UserSettings = ({
)
}
-UserSettings.propTypes = {
- onDelete: PropTypes.func.isRequired,
- onGDPRExportFailed: PropTypes.func.isRequired,
- onDeleteProjectCache: PropTypes.func.isRequired,
- removeProject: PropTypes.func.isRequired,
- removeShareProject: PropTypes.func.isRequired,
- setUserShareData: PropTypes.func.isRequired,
- setProjectsShareData: PropTypes.func.isRequired,
- userSharedUpdate: PropTypes.func.isRequired,
- sharedProjectError: PropTypes.func.isRequired,
- updateUserData: PropTypes.func.isRequired,
- genericError: PropTypes.func.isRequired,
- updateProfileFailed: PropTypes.func.isRequired,
- updateUserProfileAsync: PropTypes.func.isRequired,
- accountUpdated: PropTypes.func.isRequired,
- setAPIKey: PropTypes.func.isRequired,
- user: PropTypes.object.isRequired,
- dontRemember: PropTypes.bool.isRequired,
- isPaidTierUsed: PropTypes.bool.isRequired,
- linkSSO: PropTypes.func.isRequired,
- unlinkSSO: PropTypes.func.isRequired,
- theme: PropTypes.string.isRequired,
- logoutLocal: PropTypes.func.isRequired,
- logoutAll: PropTypes.func.isRequired,
- referralStatistics: PropTypes.object.isRequired,
- activeReferrals: PropTypes.array.isRequired,
- setCache: PropTypes.func.isRequired,
-}
-
export default memo(withAuthentication(UserSettings, auth.authenticated))
diff --git a/app/pages/UserSettings/components/Integrations.tsx b/app/pages/UserSettings/components/Integrations.tsx
index f86253c3a..31796c175 100644
--- a/app/pages/UserSettings/components/Integrations.tsx
+++ b/app/pages/UserSettings/components/Integrations.tsx
@@ -1,4 +1,5 @@
import React, { useState, memo } from 'react'
+import type i18next from 'i18next'
import { useTranslation, Trans } from 'react-i18next'
import _map from 'lodash/map'
import _isString from 'lodash/isString'
@@ -11,7 +12,7 @@ import { removeTgIntegration } from 'api'
import { IUser } from 'redux/models/IUser'
const getAvailableIntegrations = (
- t: (key: string) => string,
+ t: typeof i18next.t,
): {
name: string
key: string
@@ -40,11 +41,7 @@ const Integrations = ({
handleIntegrationSave: (data: Partial<IUser>, cb: () => void) => void
genericError: (message: string) => void
}) => {
- const {
- t,
- }: {
- t: (key: string) => string
- } = useTranslation('common')
+ const { t } = useTranslation('common')
const available = getAvailableIntegrations(t)
const [integrationConfigurating, setIntegrationConfigurating] = useState<string | null>(null)
const [tgChatId, setTgChatId] = useState<string | null>(null)
diff --git a/app/pages/UserSettings/components/NoSharedProjects.tsx b/app/pages/UserSettings/components/NoSharedProjects.tsx
index dfc6b2471..4e5a87745 100644
--- a/app/pages/UserSettings/components/NoSharedProjects.tsx
+++ b/app/pages/UserSettings/components/NoSharedProjects.tsx
@@ -1,6 +1,7 @@
import React from 'react'
+import type i18next from 'i18next'
-const NoSharedProjects = ({ t }: { t: (key: string) => string }): JSX.Element => (
+const NoSharedProjects = ({ t }: { t: typeof i18next.t }): JSX.Element => (
<div className='flex flex-col py-6 sm:px-6 lg:px-8'>
<div className='max-w-7xl w-full mx-auto text-gray-900 dark:text-gray-50'>
<h2 className='text-2xl mb-4 text-center leading-snug'>{t('profileSettings.noSharedProjects')}</h2>
diff --git a/app/pages/UserSettings/components/ProjectList.tsx b/app/pages/UserSettings/components/ProjectList.tsx
index 940ef01c4..1bc818792 100644
--- a/app/pages/UserSettings/components/ProjectList.tsx
+++ b/app/pages/UserSettings/components/ProjectList.tsx
@@ -1,6 +1,5 @@
import React, { memo, useState } from 'react'
import dayjs from 'dayjs'
-import PropTypes from 'prop-types'
import { useTranslation } from 'react-i18next'
import Button from 'ui/Button'
@@ -28,16 +27,6 @@ const ProjectList = ({
const {
t,
i18n: { language },
- }: {
- t: (
- key: string,
- options?: {
- [key: string]: string | number
- },
- ) => string
- i18n: {
- language: string
- }
} = useTranslation('common')
const [showDeleteModal, setShowDeleteModal] = useState<boolean>(false)
@@ -115,12 +104,4 @@ const ProjectList = ({
)
}
-ProjectList.propTypes = {
- item: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
- sharedProjectError: PropTypes.func.isRequired,
- removeProject: PropTypes.func.isRequired,
- removeShareProject: PropTypes.func.isRequired,
- userSharedUpdate: PropTypes.func.isRequired,
-}
-
export default memo(ProjectList)
diff --git a/app/pages/UserSettings/components/Socialisations.tsx b/app/pages/UserSettings/components/Socialisations.tsx
index 020ab0d2f..3d63fcb9a 100644
--- a/app/pages/UserSettings/components/Socialisations.tsx
+++ b/app/pages/UserSettings/components/Socialisations.tsx
@@ -1,4 +1,5 @@
import React, { useState, memo } from 'react'
+import type i18next from 'i18next'
import { useTranslation } from 'react-i18next'
import _map from 'lodash/map'
import { CheckCircleIcon, XCircleIcon } from '@heroicons/react/24/solid'
@@ -30,11 +31,6 @@ const AVAILABLE_SSO_PROVIDERS = [
},
]
-/**
- * @param {IUser} user - user object
- * @param {string} socialisation - key from SOCIALISATIONS
- * @returns {[boolean, boolean]} - [isConnected, isUnlinkable]
- */
const getStatusByUser = (user: IUser, socialisation: string) => {
if (socialisation === SSO_PROVIDERS.GOOGLE) {
const connected = user.googleId
@@ -53,18 +49,14 @@ const getStatusByUser = (user: IUser, socialisation: string) => {
interface ISocialisations {
user: IUser
- linkSSO: (t: (key: string) => string, callback: (e: any) => void, provider: string) => void
- unlinkSSO: (t: (key: string) => string, callback: (e: any) => void, provider: string) => void
+ linkSSO: (t: typeof i18next.t, callback: (e: any) => void, provider: string) => void
+ unlinkSSO: (t: typeof i18next.t, callback: (e: any) => void, provider: string) => void
genericError: (message: string) => void
theme: string
}
const Socialisations = ({ user, linkSSO, unlinkSSO, genericError, theme }: ISocialisations) => {
- const {
- t,
- }: {
- t: (key: string) => string
- } = useTranslation('common')
+ const { t } = useTranslation('common')
const [isLoading, setIsLoading] = useState(false)
const _linkSSO = (provider: string) => {
diff --git a/app/pages/UserSettings/components/TwoFA.tsx b/app/pages/UserSettings/components/TwoFA.tsx
index fbe6dd728..c995d838d 100644
--- a/app/pages/UserSettings/components/TwoFA.tsx
+++ b/app/pages/UserSettings/components/TwoFA.tsx
@@ -23,16 +23,7 @@ const TwoFA = ({
updateUserData: (data: Partial<IUser>) => void
genericError: (message: string) => void
}): JSX.Element => {
- const {
- t,
- }: {
- t: (
- key: string,
- options?: {
- [key: string]: string | number
- },
- ) => string
- } = useTranslation('common')
+ const { t } = useTranslation('common')
const [twoFAConfigurating, setTwoFAConfigurating] = useState<boolean>(false)
const [twoFADisabling, setTwoFADisabling] = useState<boolean>(false)
const [twoFAConfigData, setTwoFAConfigData] = useState<{
diff --git a/app/redux/sagas/actions/index.ts b/app/redux/sagas/actions/index.ts
index e99fb1903..88af5c9a8 100644
--- a/app/redux/sagas/actions/index.ts
+++ b/app/redux/sagas/actions/index.ts
@@ -1,5 +1,6 @@
/* eslint-disable no-unused-vars */
import types from 'redux/sagas/actions/types'
+import type i18next from 'i18next'
import { removeAccessToken } from 'utils/accessToken'
import { removeItem } from 'utils/localstorage'
import { LS_VIEW_PREFS_SETTING, LS_CAPTCHA_VIEW_PREFS_SETTING } from 'redux/constants'
@@ -56,7 +57,8 @@ const loginAsync = (
const authSSO = (
provider: string,
dontRemember: boolean,
- t: (key: string) => string = () => '',
+ // @ts-expect-error
+ t: typeof i18next.t = () => '',
callback: (res: any) => void = () => {},
) => ({
type: types.AUTH_SSO,
@@ -69,11 +71,8 @@ const authSSO = (
})
// currently only google is supported, in future we should provide a variable specifying the provider
-const linkSSO = (
- t: (key: string) => string = () => '',
- callback: (res: any) => void = () => {},
- provider = 'google',
-) => ({
+// @ts-expect-error
+const linkSSO = (t: typeof i18next.t = () => '', callback: (res: any) => void = () => {}, provider = 'google') => ({
type: types.LINK_SSO,
payload: {
callback,
@@ -83,11 +82,8 @@ const linkSSO = (
})
// currently only google is supported, in future we should provide a variable specifying the provider
-const unlinkSSO = (
- t: (key: string) => string = () => '',
- callback: (res: any) => void = () => {},
- provider = 'google',
-) => ({
+// @ts-expect-error
+const unlinkSSO = (t: typeof i18next.t = () => '', callback: (res: any) => void = () => {}, provider = 'google') => ({
type: types.UNLINK_SSO,
payload: {
callback,
diff --git a/app/redux/sagas/auth/workers/deleteUserAccount.ts b/app/redux/sagas/auth/workers/deleteUserAccount.ts
index 44cba554e..8509ba463 100644
--- a/app/redux/sagas/auth/workers/deleteUserAccount.ts
+++ b/app/redux/sagas/auth/workers/deleteUserAccount.ts
@@ -1,4 +1,5 @@
import { call, put } from 'redux-saga/effects'
+import type i18next from 'i18next'
import { authActions } from 'redux/reducers/auth'
import { alertsActions } from 'redux/reducers/alerts'
@@ -10,7 +11,7 @@ export default function* deleteUserAccountWorker({
payload: {
errorCallback: (error: any) => void
successCallback: () => void
- t: (key: string) => string
+ t: typeof i18next.t
deletionFeedback: string
}
}) {
diff --git a/app/redux/sagas/auth/workers/sso_auth.ts b/app/redux/sagas/auth/workers/sso_auth.ts
index 0f7c663f8..b64497d69 100644
--- a/app/redux/sagas/auth/workers/sso_auth.ts
+++ b/app/redux/sagas/auth/workers/sso_auth.ts
@@ -1,4 +1,5 @@
import { call, put, delay } from 'redux-saga/effects'
+import type i18next from 'i18next'
import { authActions } from 'redux/reducers/auth'
import { errorsActions } from 'redux/reducers/errors'
@@ -19,7 +20,7 @@ interface ISSOAuth {
payload: {
callback: (isSuccess: boolean, is2FA: boolean) => void
dontRemember: boolean
- t: (key: string) => string
+ t: typeof i18next.t
provider: string
}
}
diff --git a/app/redux/sagas/auth/workers/sso_link.ts b/app/redux/sagas/auth/workers/sso_link.ts
index 35e5d8716..680b22c03 100644
--- a/app/redux/sagas/auth/workers/sso_link.ts
+++ b/app/redux/sagas/auth/workers/sso_link.ts
@@ -1,4 +1,5 @@
import { call, put, delay } from 'redux-saga/effects'
+import type i18next from 'i18next'
import { authActions } from 'redux/reducers/auth'
import { errorsActions } from 'redux/reducers/errors'
@@ -14,7 +15,7 @@ const HASH_CHECK_FREQUENCY = 1000 // 1 second
export interface ISSOLink {
payload: {
callback: (isSuccess: boolean) => void
- t: (key: string) => string
+ t: typeof i18next.t
provider: string
}
}
diff --git a/app/redux/sagas/auth/workers/sso_unlink.ts b/app/redux/sagas/auth/workers/sso_unlink.ts
index d9ded412e..129fede69 100644
--- a/app/redux/sagas/auth/workers/sso_unlink.ts
+++ b/app/redux/sagas/auth/workers/sso_unlink.ts
@@ -1,4 +1,5 @@
import { call, put } from 'redux-saga/effects'
+import type i18next from 'i18next'
import _values from 'lodash/values'
import _includes from 'lodash/includes'
@@ -11,7 +12,7 @@ const { unlinkSSO, authMe } = require('api')
export interface ISSOUnlink {
payload: {
provider: string
- t: (key: string) => string
+ t: typeof i18next.t
callback: (isSuccess: boolean) => void
}
}
diff --git a/app/root.tsx b/app/root.tsx
index 0b258d04e..236edabe9 100644
--- a/app/root.tsx
+++ b/app/root.tsx
@@ -1,4 +1,4 @@
-import type { LinksFunction, LoaderArgs, HeadersFunction } from '@remix-run/node'
+import type { LinksFunction, LoaderFunctionArgs, HeadersFunction } from '@remix-run/node'
import { json, redirect } from '@remix-run/node'
import { useState } from 'react'
import {
@@ -168,7 +168,7 @@ const removeMultipleLngParams = (url: string): string => {
return _replace(url, /%3Flng%3D[^%]*/g, '')
}
-export async function loader({ request }: LoaderArgs) {
+export async function loader({ request }: LoaderFunctionArgs) {
const { url } = request
const removedLng = removeMultipleLngParams(url)
diff --git a/app/routes/billing.tsx b/app/routes/billing.tsx
index 6ae56cac0..a91d08778 100644
--- a/app/routes/billing.tsx
+++ b/app/routes/billing.tsx
@@ -1,4 +1,4 @@
-import type { LoaderArgs } from '@remix-run/node'
+import type { LoaderFunctionArgs } from '@remix-run/node'
import { useLoaderData } from '@remix-run/react'
import { json, redirect } from '@remix-run/node'
import type { SitemapFunction } from 'remix-sitemap'
@@ -11,7 +11,7 @@ export const sitemap: SitemapFunction = () => ({
exclude: true,
})
-export async function loader({ request }: LoaderArgs) {
+export async function loader({ request }: LoaderFunctionArgs) {
if (isSelfhosted) {
return redirect('/login', 302)
}
diff --git a/app/routes/blog.$category.$slug.tsx b/app/routes/blog.$category.$slug.tsx
index 47d0638f4..3a393c4d3 100644
--- a/app/routes/blog.$category.$slug.tsx
+++ b/app/routes/blog.$category.$slug.tsx
@@ -1,4 +1,4 @@
-import type { LoaderFunction, LinksFunction, V2_MetaFunction } from '@remix-run/node'
+import type { LoaderFunction, LinksFunction, MetaFunction } from '@remix-run/node'
import { redirect, json } from '@remix-run/node'
import singlePostCss from 'css/mdfile.css'
import { getPost } from 'utils/getPosts'
@@ -9,7 +9,7 @@ export const links: LinksFunction = () => {
return [{ rel: 'stylesheet', href: singlePostCss }]
}
-export const meta: V2_MetaFunction = (loaderData: any) => {
+export const meta: MetaFunction = (loaderData: any) => {
const ogImageUrl = getOgImageUrl(loaderData?.data?.title)
return [
diff --git a/app/routes/blog.$slug.tsx b/app/routes/blog.$slug.tsx
index 081f00a20..299c29f07 100644
--- a/app/routes/blog.$slug.tsx
+++ b/app/routes/blog.$slug.tsx
@@ -1,5 +1,5 @@
import type { SitemapFunction } from 'remix-sitemap'
-import type { LoaderFunction, LinksFunction, V2_MetaFunction } from '@remix-run/node'
+import type { LoaderFunction, LinksFunction, MetaFunction } from '@remix-run/node'
import { redirect, json } from '@remix-run/node'
import _map from 'lodash/map'
import _last from 'lodash/last'
@@ -15,7 +15,7 @@ export const links: LinksFunction = () => {
return [{ rel: 'stylesheet', href: singlePostCss }]
}
-export const meta: V2_MetaFunction = (loaderData: any) => {
+export const meta: MetaFunction = (loaderData: any) => {
const ogImageUrl = getOgImageUrl(loaderData?.data?.title)
return [
diff --git a/app/routes/blog.tsx b/app/routes/blog.tsx
index 50907d515..abe95fbf3 100644
--- a/app/routes/blog.tsx
+++ b/app/routes/blog.tsx
@@ -1,4 +1,4 @@
-import type { V2_MetaFunction } from '@remix-run/node'
+import type { MetaFunction } from '@remix-run/node'
import { Link, useLoaderData } from '@remix-run/react'
import { blogLoader } from 'utils/getPosts'
import _map from 'lodash/map'
@@ -7,7 +7,7 @@ import { TITLE_SUFFIX } from 'redux/constants'
export const loader = blogLoader
-export const meta: V2_MetaFunction = () => {
+export const meta: MetaFunction = () => {
return [
{
title: `Blog ${TITLE_SUFFIX}`,
diff --git a/app/routes/confirm-email.tsx b/app/routes/confirm-email.tsx
index b6562f65f..b4ce42245 100644
--- a/app/routes/confirm-email.tsx
+++ b/app/routes/confirm-email.tsx
@@ -1,6 +1,6 @@
import CheckYourInbox from 'pages/Auth/CheckYourInbox'
import type { SitemapFunction } from 'remix-sitemap'
-import type { HeadersFunction, LoaderArgs } from '@remix-run/node'
+import type { HeadersFunction, LoaderFunctionArgs } from '@remix-run/node'
import { redirect } from '@remix-run/node'
import { isSelfhosted } from 'redux/constants'
@@ -13,7 +13,7 @@ export const sitemap: SitemapFunction = () => ({
exclude: true,
})
-export async function loader({ request }: LoaderArgs) {
+export async function loader({ request }: LoaderFunctionArgs) {
if (isSelfhosted) {
return redirect('/login', 302)
}
diff --git a/app/routes/error-tracking.tsx b/app/routes/error-tracking.tsx
index ff316994a..c26313bc0 100644
--- a/app/routes/error-tracking.tsx
+++ b/app/routes/error-tracking.tsx
@@ -1,4 +1,4 @@
-import type { LoaderArgs } from '@remix-run/node'
+import type { LoaderFunctionArgs } from '@remix-run/node'
import { useLoaderData } from '@remix-run/react'
import { json, redirect } from '@remix-run/node'
import type { SitemapFunction } from 'remix-sitemap'
@@ -12,7 +12,7 @@ export const sitemap: SitemapFunction = () => ({
exclude: isSelfhosted,
})
-export async function loader({ request }: LoaderArgs) {
+export async function loader({ request }: LoaderFunctionArgs) {
if (isSelfhosted) {
return redirect('/login', 302)
}
diff --git a/app/routes/index.tsx b/app/routes/index.tsx
index a3581fb6a..edd791b5c 100644
--- a/app/routes/index.tsx
+++ b/app/routes/index.tsx
@@ -1,5 +1,5 @@
import MainPage from 'pages/MainPage'
-import type { LoaderArgs } from '@remix-run/node'
+import type { LoaderFunctionArgs } from '@remix-run/node'
import { useLoaderData } from '@remix-run/react'
import { json, redirect } from '@remix-run/node'
import type { SitemapFunction } from 'remix-sitemap'
@@ -12,7 +12,7 @@ export const sitemap: SitemapFunction = () => ({
exclude: isSelfhosted,
})
-export async function loader({ request }: LoaderArgs) {
+export async function loader({ request }: LoaderFunctionArgs) {
if (isSelfhosted) {
return redirect('/login', 302)
}
diff --git a/app/routes/login.tsx b/app/routes/login.tsx
index 20d523e05..37ebcc596 100644
--- a/app/routes/login.tsx
+++ b/app/routes/login.tsx
@@ -1,5 +1,5 @@
import Signin from 'pages/Auth/Signin'
-import type { HeadersFunction, LoaderArgs } from '@remix-run/node'
+import type { HeadersFunction, LoaderFunctionArgs } from '@remix-run/node'
import { useLoaderData } from '@remix-run/react'
import { json } from '@remix-run/node'
@@ -10,7 +10,7 @@ export const headers: HeadersFunction = ({ parentHeaders }) => {
return parentHeaders
}
-export async function loader({ request }: LoaderArgs) {
+export async function loader({ request }: LoaderFunctionArgs) {
const [theme] = detectTheme(request)
return json({ theme })
diff --git a/app/routes/performance.tsx b/app/routes/performance.tsx
index 2a61fab29..580a3a93d 100644
--- a/app/routes/performance.tsx
+++ b/app/routes/performance.tsx
@@ -1,5 +1,5 @@
import Performance from 'pages/Performance'
-import type { LoaderArgs } from '@remix-run/node'
+import type { LoaderFunctionArgs } from '@remix-run/node'
import { useLoaderData } from '@remix-run/react'
import { json, redirect } from '@remix-run/node'
import type { SitemapFunction } from 'remix-sitemap'
@@ -12,7 +12,7 @@ export const sitemap: SitemapFunction = () => ({
exclude: isSelfhosted,
})
-export async function loader({ request }: LoaderArgs) {
+export async function loader({ request }: LoaderFunctionArgs) {
if (isSelfhosted) {
return redirect('/login', 302)
}
diff --git a/app/routes/projects.$id.password.tsx b/app/routes/projects.$id.password.tsx
index 2f2000301..2399d70ff 100644
--- a/app/routes/projects.$id.password.tsx
+++ b/app/routes/projects.$id.password.tsx
@@ -1,11 +1,11 @@
import ProjectProtectedPassword from 'pages/Project/ProjectProtectedPassword'
-import type { LoaderArgs } from '@remix-run/node'
+import type { LoaderFunctionArgs } from '@remix-run/node'
import { useLoaderData } from '@remix-run/react'
import { json } from '@remix-run/node'
import { detectTheme, isEmbedded, getProjectPassword, isAuthenticated } from 'utils/server'
-export async function loader({ request }: LoaderArgs) {
+export async function loader({ request }: LoaderFunctionArgs) {
const embedded = isEmbedded(request)
const queryPassword = getProjectPassword(request)
const [theme] = detectTheme(request)
diff --git a/app/routes/projects.$id.tsx b/app/routes/projects.$id.tsx
index 5d5bd7202..2a8730921 100644
--- a/app/routes/projects.$id.tsx
+++ b/app/routes/projects.$id.tsx
@@ -1,5 +1,5 @@
import ViewProject from 'pages/Project/View'
-import type { LinksFunction, LoaderArgs, V2_MetaFunction } from '@remix-run/node'
+import type { LinksFunction, LoaderFunctionArgs, MetaFunction } from '@remix-run/node'
import { useLoaderData } from '@remix-run/react'
import { json } from '@remix-run/node'
import _split from 'lodash/split'
@@ -10,7 +10,7 @@ import ProjectViewStyle from 'styles/ProjectViewStyle.css'
export const links: LinksFunction = () => [{ rel: 'stylesheet', href: ProjectViewStyle }]
-export const meta: V2_MetaFunction = ({ location }) => {
+export const meta: MetaFunction = ({ location }) => {
const { pathname } = location
const pid = _split(pathname, '/')[2]
const previewURL = `${API_URL}project/ogimage/${pid}`
@@ -21,7 +21,7 @@ export const meta: V2_MetaFunction = ({ location }) => {
]
}
-export async function loader({ request }: LoaderArgs) {
+export async function loader({ request }: LoaderFunctionArgs) {
const embedded = isEmbedded(request)
const queryPassword = getProjectPassword(request)
const [theme] = detectTheme(request)
diff --git a/app/routes/ref.$id.$page.tsx b/app/routes/ref.$id.$page.tsx
index 4dbf17144..65e29f244 100644
--- a/app/routes/ref.$id.$page.tsx
+++ b/app/routes/ref.$id.$page.tsx
@@ -1,11 +1,11 @@
-import type { LoaderArgs } from '@remix-run/node'
+import type { LoaderFunctionArgs } from '@remix-run/node'
import { redirect } from '@remix-run/node'
import { isSelfhosted, REFERRAL_COOKIE, REFERRAL_COOKIE_DAYS } from 'redux/constants'
import { generateCookieString } from 'utils/cookie'
// This route sets the affiliate cookie ($id) and redirects to page specified at $page
-export async function loader({ params }: LoaderArgs) {
+export async function loader({ params }: LoaderFunctionArgs) {
if (isSelfhosted) {
return redirect('/login', 302)
}
diff --git a/app/routes/ref.$id.tsx b/app/routes/ref.$id.tsx
index c286e4dd2..ba6975d43 100644
--- a/app/routes/ref.$id.tsx
+++ b/app/routes/ref.$id.tsx
@@ -1,4 +1,4 @@
-import type { LoaderArgs } from '@remix-run/node'
+import type { LoaderFunctionArgs } from '@remix-run/node'
import { useLoaderData } from '@remix-run/react'
import { json, redirect } from '@remix-run/node'
import ReferralPage from 'pages/ReferralPage'
@@ -6,7 +6,7 @@ import ReferralPage from 'pages/ReferralPage'
import { isSelfhosted } from 'redux/constants'
import { detectTheme } from 'utils/server'
-export async function loader({ request }: LoaderArgs) {
+export async function loader({ request }: LoaderFunctionArgs) {
if (isSelfhosted) {
return redirect('/login', 302)
}
diff --git a/app/routes/signup.tsx b/app/routes/signup.tsx
index d2df61c63..76e526e5e 100644
--- a/app/routes/signup.tsx
+++ b/app/routes/signup.tsx
@@ -1,6 +1,6 @@
import Singup from 'pages/Auth/Signup'
import type { SitemapFunction } from 'remix-sitemap'
-import type { HeadersFunction, LoaderArgs } from '@remix-run/node'
+import type { HeadersFunction, LoaderFunctionArgs } from '@remix-run/node'
import { useLoaderData } from '@remix-run/react'
import { json, redirect } from '@remix-run/node'
@@ -12,7 +12,7 @@ export const headers: HeadersFunction = ({ parentHeaders }) => {
return parentHeaders
}
-export async function loader({ request }: LoaderArgs) {
+export async function loader({ request }: LoaderFunctionArgs) {
if (isSelfhosted) {
return redirect('/login', 302)
}
diff --git a/app/ui/Alert.tsx b/app/ui/Alert.tsx
index bbd3c52cd..70bba2c6c 100644
--- a/app/ui/Alert.tsx
+++ b/app/ui/Alert.tsx
@@ -1,7 +1,6 @@
// Custom Alert template for react-alert
import React, { memo } from 'react'
import { useTranslation } from 'react-i18next'
-import PropTypes from 'prop-types'
import { CheckCircleIcon, InformationCircleIcon, XCircleIcon, XMarkIcon } from '@heroicons/react/24/solid'
interface IAlert {
@@ -18,7 +17,7 @@ interface IAlert {
// AlertTemplate component
const AlertTemplate = ({ message, options, close }: IAlert): JSX.Element => {
const { t } = useTranslation('common')
- const { type } = options
+ const { type } = options || {}
const isInfo = type === 'info'
const isSuccess = type === 'success'
const isError = type === 'error'
@@ -56,22 +55,4 @@ const AlertTemplate = ({ message, options, close }: IAlert): JSX.Element => {
)
}
-// Define prop types for the component
-AlertTemplate.propTypes = {
- message: PropTypes.string,
- className: PropTypes.string,
- options: PropTypes.shape({
- type: PropTypes.oneOf(['info', 'success', 'error']),
- }),
- close: PropTypes.func,
-}
-
-// Define default props for the component
-AlertTemplate.defaultProps = {
- message: '',
- className: '',
- options: {},
- close: () => {},
-}
-
export default memo(AlertTemplate)
diff --git a/app/ui/Beta.tsx b/app/ui/Beta.tsx
index 546f89d6e..1984f5485 100644
--- a/app/ui/Beta.tsx
+++ b/app/ui/Beta.tsx
@@ -1,11 +1,9 @@
import React, { memo } from 'react'
-import PropTypes from 'prop-types'
import { useTranslation } from 'react-i18next'
import Tooltip from './Tooltip'
import { Badge } from './Badge'
-// Define the prop types for the component
interface IBeta {
className?: string
}
@@ -25,14 +23,4 @@ const Beta = ({
)
}
-// Define the prop types for the component
-Beta.propTypes = {
- className: PropTypes.string,
-}
-
-// Define the default props for the component
-Beta.defaultProps = {
- className: '',
-}
-
export default memo(Beta)
diff --git a/app/ui/Button.tsx b/app/ui/Button.tsx
index 2f8e481e7..3a8f1a21e 100644
--- a/app/ui/Button.tsx
+++ b/app/ui/Button.tsx
@@ -1,7 +1,6 @@
/* eslint-disable react/button-has-type */
import React, { ButtonHTMLAttributes, memo } from 'react'
import cx from 'clsx'
-import PropTypes from 'prop-types'
import Spin from './icons/Spin'
// Define the prop types for the component
@@ -47,13 +46,13 @@ const Button = ({
regular,
large,
giant,
- type,
+ type = 'button',
className,
loading,
semiSmall,
semiDanger,
noBorder,
- focus,
+ focus = true,
disabled,
...props
}: IButton): JSX.Element => (
@@ -89,50 +88,4 @@ const Button = ({
</button>
)
-// Define the prop types for the component
-Button.propTypes = {
- text: PropTypes.string,
- children: PropTypes.node,
- onClick: PropTypes.func,
- primary: PropTypes.bool,
- secondary: PropTypes.bool,
- white: PropTypes.bool,
- danger: PropTypes.bool,
- semiDanger: PropTypes.bool,
- small: PropTypes.bool,
- semiSmall: PropTypes.bool,
- regular: PropTypes.bool,
- large: PropTypes.bool,
- giant: PropTypes.bool,
- type: PropTypes.string,
- className: PropTypes.string,
- loading: PropTypes.bool,
- focus: PropTypes.bool,
- noBorder: PropTypes.bool,
- disabled: PropTypes.bool,
-}
-
-// Define the default props for the component
-Button.defaultProps = {
- text: null,
- onClick: () => {},
- primary: false,
- secondary: false,
- white: false,
- small: false,
- semiSmall: false,
- regular: false,
- large: false,
- danger: false,
- semiDanger: false,
- giant: false,
- loading: false,
- type: 'button',
- className: '',
- children: null,
- focus: true,
- noBorder: false,
- disabled: false,
-}
-
export default memo(Button)
diff --git a/app/ui/Checkbox.tsx b/app/ui/Checkbox.tsx
index 4a119e669..add772890 100644
--- a/app/ui/Checkbox.tsx
+++ b/app/ui/Checkbox.tsx
@@ -1,8 +1,6 @@
import React, { memo } from 'react'
import cx from 'clsx'
-import PropTypes from 'prop-types'
-// Define the prop types for the component
interface ICheckbox {
label: string | JSX.Element
hint?: string | JSX.Element
@@ -72,29 +70,4 @@ const Checkbox = ({
)
}
-// Define the prop types for the component
-Checkbox.propTypes = {
- label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
- checked: PropTypes.bool.isRequired,
- hint: PropTypes.string,
- onChange: PropTypes.func,
- id: PropTypes.string,
- className: PropTypes.string,
- name: PropTypes.string,
- hintClassName: PropTypes.string,
- disabled: PropTypes.bool,
-}
-
-// Define the default props for the component
-Checkbox.defaultProps = {
- label: '',
- hint: '',
- onChange: () => {},
- id: '',
- className: '',
- name: '',
- hintClassName: '',
- disabled: false,
-}
-
export default memo(Checkbox)
diff --git a/app/ui/Combobox.tsx b/app/ui/Combobox.tsx
index 79382554b..4100c5c5e 100644
--- a/app/ui/Combobox.tsx
+++ b/app/ui/Combobox.tsx
@@ -1,6 +1,5 @@
import React, { Fragment, memo, useState } from 'react'
import cx from 'clsx'
-import PropTypes from 'prop-types'
import { Combobox as HeadlessCombobox, Transition } from '@headlessui/react'
import { CheckIcon, ChevronUpDownIcon } from '@heroicons/react/24/solid'
import { useTranslation } from 'react-i18next'
@@ -113,26 +112,4 @@ const Combobox = ({
)
}
-Combobox.propTypes = {
- title: PropTypes.string,
- placeholder: PropTypes.string,
- className: PropTypes.string,
- buttonClassName: PropTypes.string,
- items: PropTypes.array.isRequired,
- labelExtractor: PropTypes.func,
- keyExtractor: PropTypes.func,
- onSelect: PropTypes.func.isRequired,
- disabled: PropTypes.bool,
-}
-
-Combobox.defaultProps = {
- title: '',
- placeholder: '',
- className: '',
- buttonClassName: '',
- labelExtractor: null,
- keyExtractor: null,
- disabled: false,
-}
-
export default memo(Combobox)
diff --git a/app/ui/Dropdown.tsx b/app/ui/Dropdown.tsx
index de96cf154..ab3e2a725 100644
--- a/app/ui/Dropdown.tsx
+++ b/app/ui/Dropdown.tsx
@@ -5,7 +5,6 @@ import { ChevronDownIcon as ChevronDownIconMini } from '@heroicons/react/20/soli
import cx from 'clsx'
import _map from 'lodash/map'
import _isEmpty from 'lodash/isEmpty'
-import PropTypes from 'prop-types'
// Define the prop types for the component
interface IDropdown {
@@ -15,9 +14,9 @@ interface IDropdown {
/* (array): An array of items to be displayed in the dropdown menu. */
items: any[]
/* (function): A function that returns the label for each item in the dropdown menu. */
- labelExtractor: (item: any) => string | number | React.ReactNode
+ labelExtractor?: (item: any) => string | number | React.ReactNode
/* (function): A function that returns the key for each item in the dropdown menu. */
- keyExtractor: (item: any) => string | number | React.ReactNode
+ keyExtractor?: (item: any) => string | number | React.ReactNode
/* (function): A function that is called when an item is selected. */
onSelect: (item: any, e?: React.MouseEvent<HTMLElement>) => void | null
aside?: boolean
@@ -43,7 +42,7 @@ const Dropdown = ({
selectItemClassName,
menuItemsClassName,
header,
- chevron,
+ chevron = 'regular',
headless,
disabled,
}: IDropdown): JSX.Element => (
@@ -127,36 +126,4 @@ const Dropdown = ({
</Menu>
)
-Dropdown.propTypes = {
- title: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired,
- onSelect: PropTypes.func.isRequired,
- items: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.object])),
- className: PropTypes.string,
- buttonClassName: PropTypes.string,
- selectItemClassName: PropTypes.string,
- labelExtractor: PropTypes.func,
- keyExtractor: PropTypes.func,
- aside: PropTypes.bool,
- desc: PropTypes.string,
- menuItemsClassName: PropTypes.string,
- chevron: PropTypes.oneOf(['regular', 'mini']),
- headless: PropTypes.bool,
- disabled: PropTypes.bool,
-}
-
-Dropdown.defaultProps = {
- className: '',
- buttonClassName: '',
- selectItemClassName: '',
- labelExtractor: null,
- keyExtractor: null,
- aside: false,
- desc: '',
- items: [],
- menuItemsClassName: '',
- chevron: 'regular',
- headless: false,
- disabled: false,
-}
-
export default memo(Dropdown)
diff --git a/app/ui/Flatpicker.tsx b/app/ui/Flatpicker.tsx
index 3147395f0..b26ddfd8d 100644
--- a/app/ui/Flatpicker.tsx
+++ b/app/ui/Flatpicker.tsx
@@ -3,7 +3,6 @@ import React, { memo, createRef } from 'react'
import Flatpickr from 'react-flatpickr'
import _size from 'lodash/size'
import _split from 'lodash/split'
-import PropTypes from 'prop-types'
import cx from 'clsx'
import { MAX_MONTHS_IN_PAST } from 'redux/constants'
@@ -31,7 +30,7 @@ class FlatPicker extends React.Component<
this.setCustomDate = this.setCustomDate.bind(this)
this.state = {
maxDate: 'today',
- minDate: this.removeMonths(new Date(), props?.maxDateMonths || 24),
+ minDate: this.removeMonths(new Date(), props?.maxDateMonths || MAX_MONTHS_IN_PAST),
}
}
@@ -60,7 +59,7 @@ class FlatPicker extends React.Component<
this.setState({
maxDate: 'today',
// eslint-disable-next-line react/destructuring-assignment
- minDate: this.removeMonths(new Date(), this.props?.maxDateMonths || 24),
+ minDate: this.removeMonths(new Date(), this.props?.maxDateMonths || MAX_MONTHS_IN_PAST),
})
this.calendar.current.flatpickr.open()
}
@@ -128,22 +127,4 @@ class FlatPicker extends React.Component<
}
}
-// @ts-ignore
-FlatPicker.propTypes = {
- onChange: PropTypes.func,
- value: PropTypes.arrayOf(PropTypes.instanceOf(Date)),
- maxDateMonths: PropTypes.number,
- className: PropTypes.string,
-}
-
-// @ts-ignore
-FlatPicker.defaultProps = {
- onChange: () => {},
- value: [],
- maxDateMonths: MAX_MONTHS_IN_PAST,
- options: null,
- maxRange: 0,
- className: '',
-}
-
export default memo(FlatPicker)
diff --git a/app/ui/Input.tsx b/app/ui/Input.tsx
index 0f7be73ed..edc35e713 100644
--- a/app/ui/Input.tsx
+++ b/app/ui/Input.tsx
@@ -1,12 +1,11 @@
import React, { memo } from 'react'
import cx from 'clsx'
import _isEmpty from 'lodash/isEmpty'
-import PropTypes from 'prop-types'
import { ExclamationCircleIcon } from '@heroicons/react/24/solid'
import Beta from 'ui/Beta'
interface IInput {
- label: string | JSX.Element
+ label?: string | JSX.Element
hint?: string | JSX.Element
placeholder?: string
type?: string
@@ -98,36 +97,4 @@ const Input = ({
)
}
-Input.propTypes = {
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
- label: PropTypes.string,
- hint: PropTypes.string,
- placeholder: PropTypes.string,
- onChange: PropTypes.func,
- onKeyDown: PropTypes.func,
- id: PropTypes.string,
- type: PropTypes.string,
- className: PropTypes.string,
- error: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
- name: PropTypes.string,
- disabled: PropTypes.bool,
- isBeta: PropTypes.bool,
-}
-
-Input.defaultProps = {
- value: null,
- label: '',
- hint: '',
- placeholder: '',
- onChange: () => {},
- onKeyDown: () => {},
- id: '',
- type: '',
- className: '',
- error: null,
- name: '',
- disabled: false,
- isBeta: false,
-}
-
export default memo(Input)
diff --git a/app/ui/Modal.tsx b/app/ui/Modal.tsx
index e3e08e0c3..de4e8205a 100644
--- a/app/ui/Modal.tsx
+++ b/app/ui/Modal.tsx
@@ -1,5 +1,4 @@
import React, { Fragment, memo } from 'react'
-import PropTypes from 'prop-types'
import cx from 'clsx'
import { Dialog, Transition } from '@headlessui/react'
import {
@@ -14,8 +13,8 @@ import Spin from './icons/Spin'
interface IModal {
className?: string
- type: 'error' | 'success' | 'info' | 'warning' | 'confirmed'
- title: string
+ type?: 'error' | 'success' | 'info' | 'warning' | 'confirmed'
+ title?: string
message: React.ReactNode | string
isOpened: boolean
onClose: () => void
@@ -41,8 +40,8 @@ const Modal = ({
onSubmit,
closeText,
submitText,
- submitType,
- size,
+ submitType = 'regular',
+ size = 'regular',
customButtons,
isBeta,
isLoading,
@@ -190,41 +189,4 @@ const Modal = ({
</Transition.Root>
)
-Modal.propTypes = {
- type: PropTypes.oneOf(['error', 'success', 'info', 'warning', 'confirmed']),
- title: PropTypes.string,
- onClose: PropTypes.func.isRequired,
- message: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
- className: PropTypes.string,
- isOpened: PropTypes.bool,
- onSubmit: PropTypes.func,
- closeText: PropTypes.string,
- submitText: PropTypes.string,
- submitDisabled: PropTypes.bool,
- submitType: PropTypes.oneOf(['regular', 'danger']),
- size: PropTypes.oneOf(['regular', 'large']),
- customButtons: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
- isBeta: PropTypes.bool,
- isLoading: PropTypes.bool,
- overflowVisible: PropTypes.bool,
-}
-
-Modal.defaultProps = {
- className: '',
- message: '',
- isOpened: false,
- onSubmit: () => {},
- closeText: null,
- submitText: null,
- submitDisabled: false,
- submitType: 'regular',
- size: 'regular',
- type: null,
- title: null,
- customButtons: null,
- isBeta: false,
- isLoading: false,
- overflowVisible: false,
-}
-
export default memo(Modal)
diff --git a/app/ui/MultiProgress.tsx b/app/ui/MultiProgress.tsx
index 115ccc4f0..f256a3fe4 100644
--- a/app/ui/MultiProgress.tsx
+++ b/app/ui/MultiProgress.tsx
@@ -1,6 +1,5 @@
import React, { memo } from 'react'
import cx from 'clsx'
-import PropTypes from 'prop-types'
import _map from 'lodash/map'
interface IProgress {
@@ -32,20 +31,4 @@ const MultiProgress = ({ progress, theme, className }: IMultiProgress): JSX.Elem
</div>
)
-MultiProgress.propTypes = {
- progress: PropTypes.arrayOf(
- PropTypes.shape({
- value: PropTypes.number.isRequired,
- lightColour: PropTypes.string.isRequired,
- darkColour: PropTypes.string.isRequired,
- }),
- ).isRequired,
- theme: PropTypes.oneOf(['dark', 'light']).isRequired,
- className: PropTypes.string,
-}
-
-MultiProgress.defaultProps = {
- className: '',
-}
-
export default memo(MultiProgress)
diff --git a/app/ui/MultiSelect.tsx b/app/ui/MultiSelect.tsx
index 8c638ab7a..f4c466a35 100644
--- a/app/ui/MultiSelect.tsx
+++ b/app/ui/MultiSelect.tsx
@@ -5,20 +5,7 @@ import _map from 'lodash/map'
import _includes from 'lodash/includes'
import _isEmpty from 'lodash/isEmpty'
-const MultiSelect = ({
- onRemove,
- onSelect,
- items,
- labelExtractor,
- keyExtractor,
- label,
- hint,
- placholder,
- className,
- itemExtractor,
- searchPlaseholder,
- onSearch,
-}: {
+interface IMultiSelect {
className?: string
onRemove: (item: any) => void
onSelect: (item: any) => void
@@ -31,16 +18,31 @@ const MultiSelect = ({
searchPlaseholder?: string
onSearch?: (search: string) => void
itemExtractor?: (item: any) => string
-}) => {
+}
+
+const MultiSelect = ({
+ onRemove,
+ onSelect,
+ items,
+ labelExtractor,
+ keyExtractor,
+ label,
+ hint,
+ placholder = 'Select...',
+ className,
+ itemExtractor,
+ searchPlaseholder = 'Search...',
+ onSearch,
+}: IMultiSelect) => {
const [selected, setSelected] = useState(false)
return (
- <div className={`w-full flex flex-col items-center keypress-multiselect ${className}`}>
+ <div className={cx('w-full flex flex-col items-center keypress-multiselect', className)}>
<div className='w-full'>
<div className='flex flex-col items-center relative'>
<div
className='w-full cursor-pointer'
- onClick={(e) => {
+ onClick={() => {
setSelected(!selected)
}}
>
@@ -161,15 +163,4 @@ const MultiSelect = ({
)
}
-MultiSelect.defaultProps = {
- className: '',
- labelExtractor: (item: any) => item,
- keyExtractor: (item: any) => item,
- hint: '',
- placholder: 'Select...',
- itemExtractor: (item: any) => item,
- searchPlaseholder: 'Search...',
- onSearch: (e: string) => {},
-}
-
export default MultiSelect
diff --git a/app/ui/Pagination.tsx b/app/ui/Pagination.tsx
index b5a7c2ad2..859f852bc 100644
--- a/app/ui/Pagination.tsx
+++ b/app/ui/Pagination.tsx
@@ -3,7 +3,6 @@ import { ArrowLongLeftIcon, ArrowLongRightIcon } from '@heroicons/react/24/solid
import _map from 'lodash/map'
import cx from 'clsx'
import { useTranslation } from 'react-i18next'
-import PropTypes from 'prop-types'
import { usePagination, DOTS } from 'hooks/usePagination'
interface IPagination {
@@ -84,16 +83,4 @@ const Pagination = ({ page, setPage, pageAmount, total, className }: IPagination
)
}
-Pagination.propTypes = {
- page: PropTypes.number.isRequired,
- setPage: PropTypes.func.isRequired,
- pageAmount: PropTypes.number.isRequired,
- total: PropTypes.number.isRequired,
- className: PropTypes.string,
-}
-
-Pagination.defaultProps = {
- className: '',
-}
-
export default memo(Pagination)
diff --git a/app/ui/Progress.tsx b/app/ui/Progress.tsx
index 03758f336..378da419f 100644
--- a/app/ui/Progress.tsx
+++ b/app/ui/Progress.tsx
@@ -1,5 +1,4 @@
import React, { memo } from 'react'
-import PropTypes from 'prop-types'
interface IProgress {
now: number
@@ -16,8 +15,4 @@ const Progress = ({ now }: IProgress): JSX.Element => (
</div>
)
-Progress.propTypes = {
- now: PropTypes.number.isRequired,
-}
-
export default memo(Progress)
diff --git a/app/ui/Select.tsx b/app/ui/Select.tsx
index 4569e8722..299e1ba0d 100644
--- a/app/ui/Select.tsx
+++ b/app/ui/Select.tsx
@@ -1,13 +1,12 @@
import React, { Fragment, memo } from 'react'
import cx from 'clsx'
-import PropTypes from 'prop-types'
import { Listbox, Transition } from '@headlessui/react'
import { CheckIcon, ChevronUpDownIcon } from '@heroicons/react/24/solid'
import _map from 'lodash/map'
interface ISelect {
title?: string
- label: string
+ label?: string
className?: string
labelClassName?: string
buttonClassName?: string
@@ -24,7 +23,7 @@ const Select = ({
title,
label,
className,
- items,
+ items = [],
labelExtractor,
keyExtractor,
iconExtractor,
@@ -126,31 +125,4 @@ const Select = ({
</Listbox>
)
-Select.propTypes = {
- title: PropTypes.string.isRequired,
- onSelect: PropTypes.func.isRequired,
- items: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.object])),
- className: PropTypes.string,
- labelClassName: PropTypes.string,
- buttonClassName: PropTypes.string,
- capitalise: PropTypes.bool,
- labelExtractor: PropTypes.func,
- iconExtractor: PropTypes.func,
- keyExtractor: PropTypes.func,
- label: PropTypes.string,
-}
-
-Select.defaultProps = {
- className: '',
- labelClassName: '',
- buttonClassName: '',
- capitalise: false,
- labelExtractor: null,
- keyExtractor: null,
- iconExtractor: null,
- label: '',
- items: [],
- id: '',
-}
-
export default memo(Select)
diff --git a/app/ui/Textarea.tsx b/app/ui/Textarea.tsx
index bbe52e8ce..fcd0a36a4 100644
--- a/app/ui/Textarea.tsx
+++ b/app/ui/Textarea.tsx
@@ -1,7 +1,6 @@
import React, { memo } from 'react'
import cx from 'clsx'
import _isEmpty from 'lodash/isEmpty'
-import PropTypes from 'prop-types'
import { ExclamationCircleIcon } from '@heroicons/react/24/solid'
import Beta from 'ui/Beta'
@@ -36,7 +35,7 @@ const Textarea = ({
disabled,
isBeta,
readOnly,
- rows,
+ rows = 4,
}: ITextarea) => {
const identifier = `textarea-${id || name || type}`
const isError = !_isEmpty(error)
@@ -89,37 +88,4 @@ const Textarea = ({
)
}
-Textarea.propTypes = {
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
- label: PropTypes.string,
- hint: PropTypes.string,
- placeholder: PropTypes.string,
- onChange: PropTypes.func,
- id: PropTypes.string,
- type: PropTypes.string,
- className: PropTypes.string,
- error: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
- name: PropTypes.string,
- disabled: PropTypes.bool,
- isBeta: PropTypes.bool,
- readOnly: PropTypes.bool,
- rows: PropTypes.number,
-}
-
-Textarea.defaultProps = {
- label: '',
- hint: '',
- placeholder: '',
- onChange: () => {},
- id: '',
- type: '',
- className: '',
- error: null,
- name: '',
- disabled: false,
- isBeta: false,
- readOnly: false,
- rows: 4,
-}
-
export default memo(Textarea)
diff --git a/app/ui/TimezonePicker.tsx b/app/ui/TimezonePicker.tsx
index 341222e31..a305cfcde 100644
--- a/app/ui/TimezonePicker.tsx
+++ b/app/ui/TimezonePicker.tsx
@@ -2,7 +2,6 @@ import React from 'react'
import spacetime from 'spacetime'
import soft from 'timezone-soft'
import { useTranslation } from 'react-i18next'
-import PropTypes from 'prop-types'
import _find from 'lodash/find'
import _reduce from 'lodash/reduce'
import _includes from 'lodash/includes'
@@ -49,11 +48,7 @@ interface ITimezoneSelect {
}
const TimezoneSelect = ({ value, onChange }: ITimezoneSelect): JSX.Element => {
- const {
- t,
- }: {
- t: (key: string) => string
- } = useTranslation('common')
+ const { t } = useTranslation('common')
const labelExtractor = (option: { label: string }) => option?.label
const keyExtractor = (option: { value: string }) => option?.value
@@ -100,13 +95,4 @@ const TimezoneSelect = ({ value, onChange }: ITimezoneSelect): JSX.Element => {
)
}
-TimezoneSelect.propTypes = {
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.object]).isRequired,
- onChange: PropTypes.func,
-}
-
-TimezoneSelect.defaultProps = {
- onChange: () => {},
-}
-
export default TimezoneSelect
diff --git a/app/ui/Tooltip.tsx b/app/ui/Tooltip.tsx
index e7ced6495..0f5dcdfa5 100644
--- a/app/ui/Tooltip.tsx
+++ b/app/ui/Tooltip.tsx
@@ -1,5 +1,4 @@
import React, { memo } from 'react'
-import PropTypes from 'prop-types'
import { QuestionMarkCircleIcon } from '@heroicons/react/24/solid'
import cx from 'clsx'
@@ -23,15 +22,4 @@ const Tooltip = ({ text, className, tooltipNode }: ITooltip): JSX.Element => (
</div>
)
-Tooltip.propTypes = {
- text: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.node]).isRequired,
- className: PropTypes.string,
- tooltipNode: PropTypes.node,
-}
-
-Tooltip.defaultProps = {
- className: '',
- tooltipNode: null,
-}
-
export default memo(Tooltip)
diff --git a/app/ui/__test__/Alert.test.tsx b/app/ui/__test__/Alert.test.tsx
deleted file mode 100644
index 8c742f908..000000000
--- a/app/ui/__test__/Alert.test.tsx
+++ /dev/null
@@ -1,50 +0,0 @@
-/* eslint-disable testing-library/prefer-screen-queries */
-/* eslint-disable import/no-extraneous-dependencies */
-import React from 'react'
-import { render, fireEvent } from '@testing-library/react'
-import AlertTemplate from '../Alert'
-import '@testing-library/jest-dom'
-
-describe('AlertTemplate', () => {
- const closeMock = jest.fn()
-
- afterEach(() => {
- closeMock.mockClear()
- })
-
- test('renders an info alert', () => {
- const { getByText, getByRole } = render(
- <AlertTemplate message='This is an info alert' options={{ type: 'info' }} close={closeMock} />,
- )
-
- expect(getByText('This is an info alert')).toBeInTheDocument()
- expect(getByRole('button')).toBeInTheDocument()
-
- fireEvent.click(getByRole('button'))
- expect(closeMock).toHaveBeenCalled()
- })
-
- test('renders a success alert', () => {
- const { getByText, getByRole } = render(
- <AlertTemplate message='This is a success alert' options={{ type: 'success' }} close={closeMock} />,
- )
-
- expect(getByText('This is a success alert')).toBeInTheDocument()
- expect(getByRole('button')).toBeInTheDocument()
-
- fireEvent.click(getByRole('button'))
- expect(closeMock).toHaveBeenCalled()
- })
-
- test('renders an error alert', () => {
- const { getByText, getByRole } = render(
- <AlertTemplate message='This is an error alert' options={{ type: 'error' }} close={closeMock} />,
- )
-
- expect(getByText('This is an error alert')).toBeInTheDocument()
- expect(getByRole('button')).toBeInTheDocument()
-
- fireEvent.click(getByRole('button'))
- expect(closeMock).toHaveBeenCalled()
- })
-})
diff --git a/app/ui/__test__/Beta.test.tsx b/app/ui/__test__/Beta.test.tsx
deleted file mode 100644
index d667414b8..000000000
--- a/app/ui/__test__/Beta.test.tsx
+++ /dev/null
@@ -1,34 +0,0 @@
-/* eslint-disable testing-library/prefer-screen-queries */
-/* eslint-disable import/no-extraneous-dependencies */
-import React from 'react'
-import { render } from '@testing-library/react'
-import { I18nextProvider } from 'react-i18next'
-import i18n from 'i18next'
-import '@testing-library/jest-dom'
-import Beta from '../Beta'
-
-global.ResizeObserver = require('resize-observer-polyfill')
-
-describe('Beta component', () => {
- beforeEach(() => {
- i18n.init({
- lng: 'en',
- resources: {
- en: {
- beta: {
- title: 'beta.title',
- },
- },
- },
- })
- })
-
- it('should render with a custom class name', () => {
- const { getByText } = render(
- <I18nextProvider i18n={i18n}>
- <Beta className='custom-class-name' />
- </I18nextProvider>,
- )
- expect(getByText('beta.title')).toHaveClass('custom-class-name')
- })
-})
diff --git a/app/ui/__test__/Button.test.tsx b/app/ui/__test__/Button.test.tsx
deleted file mode 100644
index 6e1ce09f2..000000000
--- a/app/ui/__test__/Button.test.tsx
+++ /dev/null
@@ -1,95 +0,0 @@
-/* eslint-disable import/no-extraneous-dependencies */
-/* eslint-disable testing-library/prefer-screen-queries */
-import React from 'react'
-import { render, fireEvent } from '@testing-library/react'
-import '@testing-library/jest-dom'
-import Button from '../Button'
-
-describe('Button component', () => {
- it('renders with text', () => {
- const { getByText } = render(<Button text='Click me' />)
- expect(getByText('Click me')).toBeInTheDocument()
- })
-
- it('renders with children', () => {
- const { getByText } = render(
- <Button>
- <span>Click me</span>
- </Button>,
- )
- expect(getByText('Click me')).toBeInTheDocument()
- })
-
- it('handles clicks', () => {
- const onClick = jest.fn()
- const { getByRole } = render(<Button onClick={onClick} />)
- fireEvent.click(getByRole('button'))
- expect(onClick).toHaveBeenCalledTimes(1)
- })
-
- it('renders a primary button', () => {
- const { getByText } = render(<Button text='Click me' primary />)
- const button = getByText('Click me')
- expect(button).toHaveClass('bg-slate-900')
- })
-
- it('renders a secondary button', () => {
- const { getByText } = render(<Button text='Click me' secondary />)
- const button = getByText('Click me')
- expect(button).toHaveClass('bg-slate-300')
- })
-
- it('renders a white button', () => {
- const { getByText } = render(<Button text='Click me' white />)
- const button = getByText('Click me')
- expect(button).toHaveClass('bg-white')
- })
-
- it('renders a danger button', () => {
- const { getByText } = render(<Button text='Click me' danger />)
- const button = getByText('Click me')
- expect(button).toHaveClass('bg-red-500')
- })
-
- it('renders a semi-danger button', () => {
- const { getByText } = render(<Button text='Click me' semiDanger />)
- const button = getByText('Click me')
- expect(button).toHaveClass('border-red-600')
- })
-
- it('renders a small button', () => {
- const { getByText } = render(<Button text='Click me' small />)
- const button = getByText('Click me')
- expect(button).toHaveClass('text-xs')
- })
-
- it('renders a semi-small button', () => {
- const { getByText } = render(<Button text='Click me' semiSmall />)
- const button = getByText('Click me')
- expect(button).toHaveClass('text-sm')
- })
-
- it('renders a regular button', () => {
- const { getByText } = render(<Button text='Click me' regular />)
- const button = getByText('Click me')
- expect(button).toHaveClass('text-sm')
- })
-
- it('renders a large button', () => {
- const { getByText } = render(<Button text='Click me' large />)
- const button = getByText('Click me')
- expect(button).toHaveClass('text-sm')
- })
-
- it('renders a giant button', () => {
- const { getByText } = render(<Button text='Click me' giant />)
- const button = getByText('Click me')
- expect(button).toHaveClass('text-base')
- })
-
- it('renders a button with no border', () => {
- const { getByText } = render(<Button text='Click me' noBorder />)
- const button = getByText('Click me')
- expect(button).toHaveClass('border-none')
- })
-})
diff --git a/app/ui/__test__/Checkbox.test.tsx b/app/ui/__test__/Checkbox.test.tsx
deleted file mode 100644
index c547ee8ab..000000000
--- a/app/ui/__test__/Checkbox.test.tsx
+++ /dev/null
@@ -1,25 +0,0 @@
-/* eslint-disable testing-library/prefer-screen-queries */
-/* eslint-disable import/no-extraneous-dependencies */
-import React from 'react'
-import { render, fireEvent } from '@testing-library/react'
-import '@testing-library/jest-dom'
-import Checkbox from '../Checkbox'
-
-describe('Checkbox', () => {
- test('renders a checkbox', () => {
- const { getByText } = render(<Checkbox label='Checkbox' checked />)
- expect(getByText('Checkbox')).toBeInTheDocument()
- })
-
- test('renders a checkbox with a custom id', () => {
- const { getByRole } = render(<Checkbox id='custom-id' label='Checkbox' checked />)
- expect(getByRole('checkbox')).toHaveAttribute('id', 'custom-id')
- })
-
- test('clicking the checkbox calls the onChange handler', () => {
- const onChange = jest.fn()
- const { getByRole } = render(<Checkbox label='Checkbox' checked onChange={onChange} />)
- fireEvent.click(getByRole('checkbox'))
- expect(onChange).toHaveBeenCalled()
- })
-})
diff --git a/app/ui/__test__/Dropdown.test.tsx b/app/ui/__test__/Dropdown.test.tsx
deleted file mode 100644
index 92368af6f..000000000
--- a/app/ui/__test__/Dropdown.test.tsx
+++ /dev/null
@@ -1,38 +0,0 @@
-/* eslint-disable testing-library/prefer-screen-queries */
-/* eslint-disable import/no-extraneous-dependencies */
-import React from 'react'
-import { render, fireEvent } from '@testing-library/react'
-import '@testing-library/jest-dom'
-import Dropdown from '../Dropdown'
-
-describe('Dropdown', () => {
- const items = ['Item 1', 'Item 2', 'Item 3']
- const onSelect = jest.fn()
- const defaultProps = {
- title: 'Dropdown Title',
- onSelect,
- items,
- }
-
- afterEach(() => {
- jest.resetAllMocks()
- })
-
- it('should render without errors', () => {
- const { getByText } = render(<Dropdown {...defaultProps} />)
- expect(getByText(defaultProps.title)).toBeInTheDocument()
- })
-
- it('should render the description when provided', () => {
- const description = 'Dropdown description'
- const { getByText } = render(<Dropdown {...defaultProps} desc={description} />)
- expect(getByText(description)).toBeInTheDocument()
- })
-
- it('should call onSelect when an item is clicked', () => {
- const { getByText } = render(<Dropdown {...defaultProps} />)
- const btnOpen = getByText(defaultProps.title)
- fireEvent.click(btnOpen)
- expect(getByText(items[0])).toBeInTheDocument()
- })
-})
diff --git a/app/ui/__test__/Flatpicker.test.tsx b/app/ui/__test__/Flatpicker.test.tsx
deleted file mode 100644
index a3f5e9295..000000000
--- a/app/ui/__test__/Flatpicker.test.tsx
+++ /dev/null
@@ -1,13 +0,0 @@
-/* eslint-disable testing-library/prefer-screen-queries */
-/* eslint-disable import/no-extraneous-dependencies */
-import React from 'react'
-import { render } from '@testing-library/react'
-import '@testing-library/jest-dom'
-import Flatpicker from '../Flatpicker'
-
-describe('Flatpicker', () => {
- test('renders a flatpicker', () => {
- const { getByTestId } = render(<Flatpicker />)
- expect(getByTestId('calendar')).toBeInTheDocument()
- })
-})
diff --git a/app/ui/__test__/Input.test.tsx b/app/ui/__test__/Input.test.tsx
deleted file mode 100644
index fffdbfc9c..000000000
--- a/app/ui/__test__/Input.test.tsx
+++ /dev/null
@@ -1,38 +0,0 @@
-/* eslint-disable testing-library/prefer-screen-queries */
-/* eslint-disable import/no-extraneous-dependencies */
-import React from 'react'
-import { render, fireEvent } from '@testing-library/react'
-import '@testing-library/jest-dom'
-import Input from '../Input'
-
-describe('Input component', () => {
- it('renders label, input and hint', () => {
- const { getAllByText, getByText, getByPlaceholderText } = render(
- <Input label='Username' hint='Enter your username' placeholder='Enter your username' />,
- )
- expect(getAllByText(/username/i)).toHaveLength(2)
- expect(getByText(/enter your username/i)).toBeInTheDocument()
- expect(getByPlaceholderText(/enter your username/i)).toBeInTheDocument()
- })
-
- it('calls onChange callback when input value changes', () => {
- const handleChange = jest.fn()
- const { getByRole } = render(<Input label='Username' onChange={handleChange} />)
- const input = getByRole('textbox')
- fireEvent.change(input, { target: { value: 'John' } })
- expect(handleChange).toHaveBeenCalledTimes(1)
- })
-
- it('displays error message when error prop is truthy', () => {
- const { getByRole, getByText } = render(<Input label='Username' error='Username is required' />)
- const input = getByRole('textbox')
- fireEvent.blur(input)
- expect(getByText(/username is required/i)).toBeInTheDocument()
- })
-
- it('disables input when disabled prop is true', () => {
- const { getByRole } = render(<Input label='Username' disabled />)
- const input = getByRole('textbox') as HTMLInputElement
- expect(input).toBeDisabled()
- })
-})
diff --git a/app/ui/__test__/Loader.test.tsx b/app/ui/__test__/Loader.test.tsx
deleted file mode 100644
index 7684d355c..000000000
--- a/app/ui/__test__/Loader.test.tsx
+++ /dev/null
@@ -1,13 +0,0 @@
-/* eslint-disable testing-library/prefer-screen-queries */
-/* eslint-disable import/no-extraneous-dependencies */
-import React from 'react'
-import { render } from '@testing-library/react'
-import '@testing-library/jest-dom'
-import Loader from '../Loader'
-
-describe('Loader', () => {
- it('renders the loader with the "Loading..." text', () => {
- const { getByText } = render(<Loader />)
- expect(getByText('Loading...')).toBeInTheDocument()
- })
-})
diff --git a/app/ui/__test__/Modal.test.tsx b/app/ui/__test__/Modal.test.tsx
deleted file mode 100644
index 400417527..000000000
--- a/app/ui/__test__/Modal.test.tsx
+++ /dev/null
@@ -1,83 +0,0 @@
-/* eslint-disable testing-library/prefer-screen-queries */
-/* eslint-disable import/no-extraneous-dependencies */
-import React from 'react'
-import { render, fireEvent } from '@testing-library/react'
-import '@testing-library/jest-dom'
-import { I18nextProvider } from 'react-i18next'
-import i18n from 'i18next'
-import Modal from '../Modal'
-
-global.ResizeObserver = require('resize-observer-polyfill')
-
-describe('Modal component', () => {
- const defaultProps: {
- type: 'error' | 'success' | 'info' | 'warning' | 'confirmed'
- title: string
- message: string
- isOpened: boolean
- onClose: () => void
- } = {
- type: 'success',
- title: 'Success',
- message: 'Action completed successfully',
- isOpened: true,
- onClose: jest.fn(),
- }
-
- // use HOC to wrap component with I18nextProvider
- const HocWithI18n = (props: any): JSX.Element => (
- <I18nextProvider i18n={i18n}>
- <Modal {...props} />
- </I18nextProvider>
- )
-
- // initialize i18n before each test
- beforeEach(() => {
- i18n.init({
- lng: 'en',
- resources: {
- en: {
- beta: {
- title: 'beta.title',
- },
- },
- },
- })
- })
-
- afterEach(() => {
- jest.resetAllMocks()
- })
-
- it('renders with default props', () => {
- const { getByText } = render(<HocWithI18n {...defaultProps} />)
- expect(getByText('Success')).toBeInTheDocument()
- expect(getByText('Action completed successfully')).toBeInTheDocument()
- })
-
- it('calls onClose when close button is clicked', () => {
- const { getByText } = render(<HocWithI18n {...defaultProps} closeText='Close' />)
- const closeButton = getByText('Close')
- fireEvent.click(closeButton)
- expect(defaultProps.onClose).toHaveBeenCalled()
- })
-
- it('calls onSubmit when submit button is clicked', () => {
- const onSubmit = jest.fn()
- const { getByText } = render(<HocWithI18n {...defaultProps} onSubmit={onSubmit} submitText='Submit' />)
- const submitButton = getByText('Submit')
- fireEvent.click(submitButton)
- expect(onSubmit).toHaveBeenCalled()
- })
-
- it('renders custom buttons', () => {
- const customButtons = <button type='button'>Custom Button</button>
- const { getByText } = render(<HocWithI18n {...defaultProps} customButtons={customButtons} />)
- expect(getByText('Custom Button')).toBeInTheDocument()
- })
-
- it('renders beta badge when isBeta prop is true', () => {
- const { getByText } = render(<HocWithI18n {...defaultProps} isBeta />)
- expect(getByText('beta.title')).toBeInTheDocument()
- })
-})
diff --git a/app/ui/__test__/Pagination.test.tsx b/app/ui/__test__/Pagination.test.tsx
deleted file mode 100644
index d6ac02972..000000000
--- a/app/ui/__test__/Pagination.test.tsx
+++ /dev/null
@@ -1,100 +0,0 @@
-/* eslint-disable testing-library/prefer-screen-queries */
-/* eslint-disable import/no-extraneous-dependencies */
-import React from 'react'
-import { render } from '@testing-library/react'
-import '@testing-library/jest-dom'
-import { I18nextProvider } from 'react-i18next'
-import i18n from 'i18next'
-import Pagination from '../Pagination'
-
-describe('Pagination', () => {
- let defaultProps: {
- page: number
- setPage: (item: number) => void
- pageAmount: number
- total: number
- } = {
- page: 1,
- setPage: () => {
- defaultProps.page += 1
- },
- pageAmount: 10,
- total: 100,
- }
-
- // use HOC to wrap component with I18nextProvider
- const HocWithI18n = (props: any): JSX.Element => (
- <I18nextProvider i18n={i18n}>
- <Pagination {...props} />
- </I18nextProvider>
- )
-
- // initialize i18n before each test
- beforeEach(() => {
- i18n.init({
- lng: 'en',
- resources: {
- en: {
- project: {
- prev: 'project.prev',
- next: 'project.next',
- },
- },
- },
- })
- })
-
- afterEach(() => {
- jest.resetAllMocks()
- defaultProps = {
- page: 1,
- setPage: () => {
- defaultProps.page += 1
- },
- pageAmount: 10,
- total: 100,
- }
- })
-
- it('renders with default props', () => {
- const { getByText } = render(<HocWithI18n {...defaultProps} />)
- expect(getByText('1')).toBeInTheDocument()
- expect(getByText('10')).toBeInTheDocument()
- expect(getByText('project.next')).toBeInTheDocument()
- })
-
- it('renders on page > 1', () => {
- defaultProps.page = 2
- const { getByText } = render(<HocWithI18n {...defaultProps} />)
- expect(getByText('1')).toBeInTheDocument()
- expect(getByText('10')).toBeInTheDocument()
- expect(getByText('project.prev')).toBeInTheDocument()
- expect(getByText('project.next')).toBeInTheDocument()
- })
-
- it('renders on page > 1 and page < pageAmount', () => {
- defaultProps.page = 5
- const { getByText } = render(<HocWithI18n {...defaultProps} />)
- expect(getByText('1')).toBeInTheDocument()
- expect(getByText('10')).toBeInTheDocument()
- expect(getByText('project.prev')).toBeInTheDocument()
- expect(getByText('project.next')).toBeInTheDocument()
- })
-
- it('renders on page = pageAmount', () => {
- defaultProps.page = 10
- const { getByText } = render(<HocWithI18n {...defaultProps} />)
- expect(getByText('1')).toBeInTheDocument()
- expect(getByText('10')).toBeInTheDocument()
- expect(getByText('project.prev')).toBeInTheDocument()
- })
-
- it('renders on page = pageAmount and pageAmount < total', () => {
- defaultProps.page = 10
- defaultProps.total = 101
- const { getByText } = render(<HocWithI18n {...defaultProps} />)
- expect(getByText('1')).toBeInTheDocument()
- expect(getByText('9')).toBeInTheDocument()
- expect(getByText('project.prev')).toBeInTheDocument()
- })
-})
diff --git a/app/ui/__test__/Progress.test.tsx b/app/ui/__test__/Progress.test.tsx
deleted file mode 100644
index cc73c6f57..000000000
--- a/app/ui/__test__/Progress.test.tsx
+++ /dev/null
@@ -1,14 +0,0 @@
-/* eslint-disable testing-library/prefer-screen-queries */
-/* eslint-disable import/no-extraneous-dependencies */
-import React from 'react'
-import { render } from '@testing-library/react'
-import '@testing-library/jest-dom'
-
-import Progress from '../Progress'
-
-describe('Progress', () => {
- it('renders the progress bar', () => {
- const { getByTestId } = render(<Progress now={10} />)
- expect(getByTestId('progress')).toBeInTheDocument()
- })
-})
diff --git a/app/ui/__test__/Select.test.tsx b/app/ui/__test__/Select.test.tsx
deleted file mode 100644
index 5d766a656..000000000
--- a/app/ui/__test__/Select.test.tsx
+++ /dev/null
@@ -1,58 +0,0 @@
-/* eslint-disable testing-library/prefer-screen-queries */
-/* eslint-disable import/no-extraneous-dependencies */
-import React from 'react'
-import { fireEvent, render } from '@testing-library/react'
-import '@testing-library/jest-dom'
-import _forEach from 'lodash/forEach'
-import Select from '../Select'
-
-describe('Select', () => {
- const defaultProps: {
- title: string
- label: string
- className?: string
- items: any[]
- id?: string
- labelExtractor?: (item: any, index: number) => string
- keyExtractor?: (item: any, index: number) => string
- iconExtractor?: (item: any, index: number) => JSX.Element | null
- onSelect: (item: any) => void
- capitalise: boolean
- } = {
- title: 'Select Title',
- label: 'Select',
- items: [],
- onSelect: () => {},
- capitalise: true,
- }
-
- afterEach(() => {
- jest.resetAllMocks()
- })
-
- it('should render without errors', () => {
- const { getByText } = render(<Select {...defaultProps} />)
- expect(getByText(defaultProps.label)).toBeInTheDocument()
- })
-
- it('should render the title when provided', () => {
- const title = 'Select Title'
- const { getByText } = render(<Select {...defaultProps} title={title} />)
- expect(getByText(title)).toBeInTheDocument()
- })
-
- it('should render the description when provided', () => {
- const description = 'Select description'
- const { getByText } = render(<Select {...defaultProps} label={description} />)
- expect(getByText(description)).toBeInTheDocument()
- })
-
- it('should render the items when provided', () => {
- const items = ['Item 1', 'Item 2', 'Item 3']
- const { getByText } = render(<Select {...defaultProps} items={items} />)
- fireEvent.click(getByText(defaultProps.title))
- _forEach(items, (item) => {
- expect(getByText(item)).toBeInTheDocument()
- })
- })
-})
diff --git a/app/ui/__test__/TimezonePicker.test.tsx b/app/ui/__test__/TimezonePicker.test.tsx
deleted file mode 100644
index 7d175e1f6..000000000
--- a/app/ui/__test__/TimezonePicker.test.tsx
+++ /dev/null
@@ -1,53 +0,0 @@
-/* eslint-disable testing-library/prefer-screen-queries */
-/* eslint-disable import/no-extraneous-dependencies */
-import React from 'react'
-import { fireEvent, render } from '@testing-library/react'
-import '@testing-library/jest-dom'
-import { I18nextProvider } from 'react-i18next'
-import i18n from 'i18next'
-
-import TimezonePicker from '../TimezonePicker'
-
-describe('TimezonePricker', () => {
- const onChange = jest.fn()
-
- afterEach(() => {
- jest.clearAllMocks()
- })
-
- const HocWithI18n = (props: any): JSX.Element => (
- <I18nextProvider i18n={i18n}>
- <TimezonePicker {...props} />
- </I18nextProvider>
- )
-
- // initialize i18n before each test
- beforeEach(() => {
- i18n.init({
- lng: 'en',
- resources: {
- en: {
- profileSettings: {
- timezoneDesc: 'Timezone description',
- },
- },
- },
- })
- })
-
- afterEach(() => {
- jest.resetAllMocks()
- })
-
- it('calls onChange function when an option is selected', () => {
- const { getByText, getByRole } = render(<HocWithI18n value='Europe/London' onChange={onChange} />)
-
- fireEvent.click(getByRole('button'))
-
- const option = getByText('(GMT-7:00) Arizona')
- fireEvent.click(option)
-
- expect(onChange).toHaveBeenCalledTimes(1)
- expect(onChange).toHaveBeenCalledWith('America/Phoenix')
- })
-})
diff --git a/app/ui/__test__/Tooltip.test.tsx b/app/ui/__test__/Tooltip.test.tsx
deleted file mode 100644
index 996ad7ce2..000000000
--- a/app/ui/__test__/Tooltip.test.tsx
+++ /dev/null
@@ -1,31 +0,0 @@
-/* eslint-disable testing-library/prefer-screen-queries */
-/* eslint-disable import/no-extraneous-dependencies */
-import React from 'react'
-import { render, fireEvent } from '@testing-library/react'
-import '@testing-library/jest-dom'
-import Tooltip from '../Tooltip'
-
-describe('Tooltip', () => {
- it('should render the tooltip text when hovering over the icon', () => {
- const text = 'This is a tooltip'
- const { getByTestId, getByText } = render(<Tooltip text={text} />)
- const tooltipIcon = getByTestId('tooltip-icon')
- fireEvent.mouseEnter(tooltipIcon)
- const tooltipText = getByText(text)
- expect(tooltipText).toBeInTheDocument()
- })
-
- it('should render a custom tooltip icon when provided', () => {
- const CustomIcon = () => <div data-testid='custom-icon' />
- const { getByTestId } = render(<Tooltip tooltipNode={<CustomIcon />} text='dds' />)
- const customIcon = getByTestId('custom-icon')
- expect(customIcon).toBeInTheDocument()
- })
-
- it('should render a custom class name when provided', () => {
- const className = 'custom-class'
- const { getByTestId } = render(<Tooltip text='Tooltip' className={className} />)
- const tooltipWrapper = getByTestId('tooltip-wrapper')
- expect(tooltipWrapper).toHaveClass(className)
- })
-})
diff --git a/app/ui/icons/Angular.tsx b/app/ui/icons/Angular.tsx
index eb4d55feb..915513829 100644
--- a/app/ui/icons/Angular.tsx
+++ b/app/ui/icons/Angular.tsx
@@ -1,5 +1,4 @@
import React from 'react'
-import PropTypes from 'prop-types'
const Angular = ({ className }: { className?: string }): JSX.Element => (
<svg className={className} x='0px' y='0px' viewBox='0 0 250 250' xmlSpace='preserve'>
@@ -21,12 +20,4 @@ const Angular = ({ className }: { className?: string }): JSX.Element => (
</svg>
)
-Angular.propTypes = {
- className: PropTypes.string,
-}
-
-Angular.defaultProps = {
- className: '',
-}
-
export default Angular
diff --git a/app/ui/icons/BackgroundSvg.tsx b/app/ui/icons/BackgroundSvg.tsx
index 9822ab6f9..f8e20c4f5 100644
--- a/app/ui/icons/BackgroundSvg.tsx
+++ b/app/ui/icons/BackgroundSvg.tsx
@@ -1,6 +1,5 @@
import React from 'react'
import cx from 'clsx'
-import PropTypes from 'prop-types'
interface IBackgroundSvg {
className?: string
@@ -198,13 +197,4 @@ const BackgroundSvg: React.FC<IBackgroundSvg> = ({ className, type, children, th
)
}
-BackgroundSvg.propTypes = {
- className: PropTypes.string,
-}
-
-BackgroundSvg.defaultProps = {
- className: '',
- children: undefined,
-}
-
export default BackgroundSvg
diff --git a/app/ui/icons/BarChart.tsx b/app/ui/icons/BarChart.tsx
index ae131ee32..b60f6e318 100644
--- a/app/ui/icons/BarChart.tsx
+++ b/app/ui/icons/BarChart.tsx
@@ -1,6 +1,5 @@
import React from 'react'
import cx from 'clsx'
-import PropTypes from 'prop-types'
interface IBarChart {
className?: string
@@ -16,12 +15,4 @@ const BarChart = ({ className }: IBarChart): JSX.Element => (
</svg>
)
-BarChart.propTypes = {
- className: PropTypes.string,
-}
-
-BarChart.defaultProps = {
- className: '',
-}
-
export default BarChart
diff --git a/app/ui/icons/Cloudflare.tsx b/app/ui/icons/Cloudflare.tsx
index ab44b54e3..da86d5b36 100644
--- a/app/ui/icons/Cloudflare.tsx
+++ b/app/ui/icons/Cloudflare.tsx
@@ -1,6 +1,5 @@
import React from 'react'
import cx from 'clsx'
-import PropTypes from 'prop-types'
const Cloudflare = ({ theme, className }: { theme: 'dark' | 'light'; className?: string }): JSX.Element => {
const cn = cx(className, {
@@ -57,13 +56,4 @@ const Cloudflare = ({ theme, className }: { theme: 'dark' | 'light'; className?:
)
}
-Cloudflare.propTypes = {
- className: PropTypes.string,
- theme: PropTypes.string.isRequired,
-}
-
-Cloudflare.defaultProps = {
- className: '',
-}
-
export default Cloudflare
diff --git a/app/ui/icons/Gatsby.tsx b/app/ui/icons/Gatsby.tsx
index a84fb6328..c8ecd0292 100644
--- a/app/ui/icons/Gatsby.tsx
+++ b/app/ui/icons/Gatsby.tsx
@@ -1,6 +1,5 @@
import React from 'react'
import cx from 'clsx'
-import PropTypes from 'prop-types'
const Gatsby = ({ theme, className }: { theme: 'dark' | 'light'; className?: string }): JSX.Element => (
<svg
@@ -30,13 +29,4 @@ const Gatsby = ({ theme, className }: { theme: 'dark' | 'light'; className?: str
</svg>
)
-Gatsby.propTypes = {
- className: PropTypes.string,
- theme: PropTypes.string.isRequired,
-}
-
-Gatsby.defaultProps = {
- className: '',
-}
-
export default Gatsby
diff --git a/app/ui/icons/Ghost.tsx b/app/ui/icons/Ghost.tsx
index d4a386774..438748d9d 100644
--- a/app/ui/icons/Ghost.tsx
+++ b/app/ui/icons/Ghost.tsx
@@ -1,6 +1,5 @@
import React from 'react'
import cx from 'clsx'
-import PropTypes from 'prop-types'
const Ghost = ({ theme, className }: { theme: 'dark' | 'light'; className?: string }): JSX.Element => {
const cn = cx(className, {
@@ -44,13 +43,4 @@ const Ghost = ({ theme, className }: { theme: 'dark' | 'light'; className?: stri
)
}
-Ghost.propTypes = {
- className: PropTypes.string,
- theme: PropTypes.string.isRequired,
-}
-
-Ghost.defaultProps = {
- className: '',
-}
-
export default Ghost
diff --git a/app/ui/icons/GithubDark.tsx b/app/ui/icons/GithubDark.tsx
index b6fa82bee..212480c32 100644
--- a/app/ui/icons/GithubDark.tsx
+++ b/app/ui/icons/GithubDark.tsx
@@ -1,5 +1,4 @@
import React from 'react'
-import PropTypes from 'prop-types'
const GithubDarkSVG = ({ className }: { className?: string }): JSX.Element => (
<svg className={className} viewBox='0 0 100 100'>
@@ -12,12 +11,4 @@ const GithubDarkSVG = ({ className }: { className?: string }): JSX.Element => (
</svg>
)
-GithubDarkSVG.propTypes = {
- className: PropTypes.string,
-}
-
-GithubDarkSVG.defaultProps = {
- className: '',
-}
-
export default GithubDarkSVG
diff --git a/app/ui/icons/GithubLight.tsx b/app/ui/icons/GithubLight.tsx
index 5d09885f7..0f301a43a 100644
--- a/app/ui/icons/GithubLight.tsx
+++ b/app/ui/icons/GithubLight.tsx
@@ -1,5 +1,4 @@
import React from 'react'
-import PropTypes from 'prop-types'
const GithubLightSVG = ({ className }: { className?: string }): JSX.Element => (
<svg className={className} viewBox='0 0 100 100'>
@@ -12,12 +11,4 @@ const GithubLightSVG = ({ className }: { className?: string }): JSX.Element => (
</svg>
)
-GithubLightSVG.propTypes = {
- className: PropTypes.string,
-}
-
-GithubLightSVG.defaultProps = {
- className: '',
-}
-
export default GithubLightSVG
diff --git a/app/ui/icons/GoogleG.tsx b/app/ui/icons/GoogleG.tsx
index 679979ec5..738badf66 100644
--- a/app/ui/icons/GoogleG.tsx
+++ b/app/ui/icons/GoogleG.tsx
@@ -1,5 +1,4 @@
import React from 'react'
-import PropTypes from 'prop-types'
const GoogleGSVG = ({ className }: { className?: string }): JSX.Element => (
<svg className={className} viewBox='0 0 186.69 190.5'>
@@ -32,12 +31,4 @@ const GoogleGSVG = ({ className }: { className?: string }): JSX.Element => (
</svg>
)
-GoogleGSVG.propTypes = {
- className: PropTypes.string,
-}
-
-GoogleGSVG.defaultProps = {
- className: '',
-}
-
export default GoogleGSVG
diff --git a/app/ui/icons/LineChart.tsx b/app/ui/icons/LineChart.tsx
index 4aea104a7..751a20800 100644
--- a/app/ui/icons/LineChart.tsx
+++ b/app/ui/icons/LineChart.tsx
@@ -1,6 +1,5 @@
import React from 'react'
import cx from 'clsx'
-import PropTypes from 'prop-types'
interface ILineChart {
className?: string
@@ -13,12 +12,4 @@ const LineChart = ({ className }: ILineChart): JSX.Element => (
</svg>
)
-LineChart.propTypes = {
- className: PropTypes.string,
-}
-
-LineChart.defaultProps = {
- className: '',
-}
-
export default LineChart
diff --git a/app/ui/icons/NextJS.tsx b/app/ui/icons/NextJS.tsx
index 6dab01677..739aeab20 100644
--- a/app/ui/icons/NextJS.tsx
+++ b/app/ui/icons/NextJS.tsx
@@ -1,6 +1,5 @@
import React from 'react'
import cx from 'clsx'
-import PropTypes from 'prop-types'
const NextJS = ({ theme, className }: { theme: 'dark' | 'light'; className?: string }): JSX.Element => (
<svg
@@ -18,13 +17,4 @@ const NextJS = ({ theme, className }: { theme: 'dark' | 'light'; className?: str
</svg>
)
-NextJS.propTypes = {
- className: PropTypes.string,
- theme: PropTypes.string.isRequired,
-}
-
-NextJS.defaultProps = {
- className: '',
-}
-
export default NextJS
diff --git a/app/ui/icons/Notion.tsx b/app/ui/icons/Notion.tsx
index a2a62bd50..2550abc0e 100644
--- a/app/ui/icons/Notion.tsx
+++ b/app/ui/icons/Notion.tsx
@@ -1,6 +1,5 @@
import React from 'react'
import cx from 'clsx'
-import PropTypes from 'prop-types'
const Notion = ({ theme, className }: { theme: 'dark' | 'light'; className?: string }): JSX.Element => {
const cn = cx(className, {
@@ -29,13 +28,4 @@ const Notion = ({ theme, className }: { theme: 'dark' | 'light'; className?: str
)
}
-Notion.propTypes = {
- className: PropTypes.string,
- theme: PropTypes.string.isRequired,
-}
-
-Notion.defaultProps = {
- className: '',
-}
-
export default Notion
diff --git a/app/ui/icons/NuxtJS.tsx b/app/ui/icons/NuxtJS.tsx
index 322dbd989..f37613f48 100644
--- a/app/ui/icons/NuxtJS.tsx
+++ b/app/ui/icons/NuxtJS.tsx
@@ -1,6 +1,5 @@
import React from 'react'
import cx from 'clsx'
-import PropTypes from 'prop-types'
const NuxtJS = ({ theme, className }: { theme: 'dark' | 'light'; className?: string }): JSX.Element => {
const cn = cx({
@@ -49,13 +48,4 @@ const NuxtJS = ({ theme, className }: { theme: 'dark' | 'light'; className?: str
)
}
-NuxtJS.propTypes = {
- className: PropTypes.string,
- theme: PropTypes.string.isRequired,
-}
-
-NuxtJS.defaultProps = {
- className: '',
-}
-
export default NuxtJS
diff --git a/app/ui/icons/PulsatingCircle.tsx b/app/ui/icons/PulsatingCircle.tsx
index bd6f2b57f..9dc06cff2 100644
--- a/app/ui/icons/PulsatingCircle.tsx
+++ b/app/ui/icons/PulsatingCircle.tsx
@@ -1,6 +1,5 @@
import React from 'react'
import cx from 'clsx'
-import PropTypes from 'prop-types'
const types = {
small: {
@@ -17,21 +16,16 @@ const types = {
},
}
-const PulsatingCircle = ({ className, type }: { className?: string; type: 'small' | 'big' | 'giant' }): JSX.Element => (
+interface IPulsatingCircle {
+ className?: string
+ type: 'small' | 'big' | 'giant'
+}
+
+const PulsatingCircle = ({ className, type = 'small' }: IPulsatingCircle): JSX.Element => (
<span className={cx('flex justify-center items-center', types[type]?.pulse, className)}>
<span className={cx('animate-ping-slow absolute inline-flex rounded-full bg-green-400', types[type]?.pulse)} />
<span className={cx('relative inline-flex rounded-full bg-green-500', types[type]?.base)} />
</span>
)
-PulsatingCircle.propTypes = {
- className: PropTypes.string,
- type: PropTypes.oneOf(['small', 'big', 'giant']),
-}
-
-PulsatingCircle.defaultProps = {
- className: '',
- type: 'small',
-}
-
export default PulsatingCircle
diff --git a/app/ui/icons/Quote.tsx b/app/ui/icons/Quote.tsx
index bde094bf6..f194e0d39 100644
--- a/app/ui/icons/Quote.tsx
+++ b/app/ui/icons/Quote.tsx
@@ -1,6 +1,5 @@
import React from 'react'
import cx from 'clsx'
-import PropTypes from 'prop-types'
const Quote = ({
theme,
@@ -27,14 +26,4 @@ const Quote = ({
</svg>
)
-Quote.propTypes = {
- className: PropTypes.string,
- theme: PropTypes.string.isRequired,
- color: PropTypes.oneOf(['indigo', 'black']).isRequired,
-}
-
-Quote.defaultProps = {
- className: '',
-}
-
export default Quote
diff --git a/app/ui/icons/ReactSVG.tsx b/app/ui/icons/ReactSVG.tsx
index d524fd83c..ec3549dfb 100644
--- a/app/ui/icons/ReactSVG.tsx
+++ b/app/ui/icons/ReactSVG.tsx
@@ -1,5 +1,4 @@
import React from 'react'
-import PropTypes from 'prop-types'
const ReactSVG = ({ className }: { className?: string }): JSX.Element => (
<svg className={className} viewBox='175.7 78 490.6 436.9'>
@@ -11,12 +10,4 @@ const ReactSVG = ({ className }: { className?: string }): JSX.Element => (
</svg>
)
-ReactSVG.propTypes = {
- className: PropTypes.string,
-}
-
-ReactSVG.defaultProps = {
- className: '',
-}
-
export default ReactSVG
diff --git a/app/ui/icons/Robot.tsx b/app/ui/icons/Robot.tsx
index c44e0bc6f..b1cdf7aac 100644
--- a/app/ui/icons/Robot.tsx
+++ b/app/ui/icons/Robot.tsx
@@ -1,6 +1,5 @@
import React from 'react'
import cx from 'clsx'
-import PropTypes from 'prop-types'
interface IRobot {
className?: string
@@ -35,14 +34,4 @@ const Robot: React.FC<IRobot> = ({ className, containerClassName, theme }): JSX.
)
}
-Robot.propTypes = {
- className: PropTypes.string,
- containerClassName: PropTypes.string,
-}
-
-Robot.defaultProps = {
- className: '',
- containerClassName: '',
-}
-
export default Robot
diff --git a/app/ui/icons/Sort.tsx b/app/ui/icons/Sort.tsx
index ba84d1f2b..dc6ecf58f 100644
--- a/app/ui/icons/Sort.tsx
+++ b/app/ui/icons/Sort.tsx
@@ -20,10 +20,4 @@ const Sort: React.FC<ISort> = ({ sortByAscend, sortByDescend, className }: ISort
return <ChevronUpDownIcon className={cx(className, 'w-4 h-4')} />
}
-Sort.defaultProps = {
- sortByAscend: false,
- sortByDescend: false,
- className: '',
-}
-
export default Sort
diff --git a/app/ui/icons/Spin.tsx b/app/ui/icons/Spin.tsx
index 0f2cfadcd..78c624dff 100644
--- a/app/ui/icons/Spin.tsx
+++ b/app/ui/icons/Spin.tsx
@@ -1,6 +1,5 @@
import React from 'react'
import cx from 'clsx'
-import PropTypes from 'prop-types'
interface ISpin {
className?: string
@@ -30,14 +29,4 @@ const Spin = ({ className, alwaysLight }: ISpin): JSX.Element => (
</svg>
)
-Spin.propTypes = {
- className: PropTypes.string,
- alwaysLight: PropTypes.bool,
-}
-
-Spin.defaultProps = {
- className: '',
- alwaysLight: false,
-}
-
export default Spin
diff --git a/app/ui/icons/Telegram.tsx b/app/ui/icons/Telegram.tsx
index d20f26c1c..73ea38f89 100644
--- a/app/ui/icons/Telegram.tsx
+++ b/app/ui/icons/Telegram.tsx
@@ -1,5 +1,4 @@
import React from 'react'
-import PropTypes from 'prop-types'
const Telegram = ({ className }: { className?: string }): JSX.Element => (
<svg className={className} viewBox='0 0 1000 1000'>
@@ -21,12 +20,4 @@ const Telegram = ({ className }: { className?: string }): JSX.Element => (
</svg>
)
-Telegram.propTypes = {
- className: PropTypes.string,
-}
-
-Telegram.defaultProps = {
- className: '',
-}
-
export default Telegram
diff --git a/app/ui/icons/Webflow.tsx b/app/ui/icons/Webflow.tsx
index 120b291b5..184adf66f 100644
--- a/app/ui/icons/Webflow.tsx
+++ b/app/ui/icons/Webflow.tsx
@@ -1,6 +1,5 @@
import React from 'react'
import cx from 'clsx'
-import PropTypes from 'prop-types'
const Webflow = ({ theme, className }: { theme: 'dark' | 'light'; className?: string }): JSX.Element => (
<svg className={className} x='0px' y='0px' viewBox='0 0 808.3 203.3'>
@@ -32,13 +31,4 @@ const Webflow = ({ theme, className }: { theme: 'dark' | 'light'; className?: st
</svg>
)
-Webflow.propTypes = {
- className: PropTypes.string,
- theme: PropTypes.string.isRequired,
-}
-
-Webflow.defaultProps = {
- className: '',
-}
-
export default Webflow
diff --git a/app/ui/icons/Wix.tsx b/app/ui/icons/Wix.tsx
index 93e4c6cce..49fb81e6e 100644
--- a/app/ui/icons/Wix.tsx
+++ b/app/ui/icons/Wix.tsx
@@ -1,6 +1,5 @@
import React from 'react'
import cx from 'clsx'
-import PropTypes from 'prop-types'
const Wix = ({ theme, className }: { theme: 'dark' | 'light'; className?: string }): JSX.Element => (
<svg
@@ -20,13 +19,4 @@ const Wix = ({ theme, className }: { theme: 'dark' | 'light'; className?: string
</svg>
)
-Wix.propTypes = {
- className: PropTypes.string,
- theme: PropTypes.string.isRequired,
-}
-
-Wix.defaultProps = {
- className: '',
-}
-
export default Wix
diff --git a/app/ui/icons/Wordpress.tsx b/app/ui/icons/Wordpress.tsx
index 5062b2e0c..f98ccf394 100644
--- a/app/ui/icons/Wordpress.tsx
+++ b/app/ui/icons/Wordpress.tsx
@@ -1,6 +1,5 @@
import React from 'react'
import cx from 'clsx'
-import PropTypes from 'prop-types'
const Wordpress = ({ theme, className }: { theme: 'dark' | 'light'; className?: string }): JSX.Element => (
<svg
@@ -19,13 +18,4 @@ const Wordpress = ({ theme, className }: { theme: 'dark' | 'light'; className?:
</svg>
)
-Wordpress.propTypes = {
- className: PropTypes.string,
- theme: PropTypes.string.isRequired,
-}
-
-Wordpress.defaultProps = {
- className: '',
-}
-
export default Wordpress
diff --git a/app/utils/getPosts.ts b/app/utils/getPosts.ts
index 34039c421..278f087ce 100644
--- a/app/utils/getPosts.ts
+++ b/app/utils/getPosts.ts
@@ -28,7 +28,18 @@ export type PostMarkdownAttributes = {
export const getSlugFromFilename = (filename: string) => filename.substring(11)
export const getDateFromFilename = (filename: string) => filename.substring(0, 10)
-export async function getPost(slug: string, category?: string) {
+interface IPost {
+ slug: string
+ title?: string
+ html: string
+ hidden?: boolean
+ intro?: string
+ date?: string
+ author?: string
+ nickname?: string
+}
+
+export async function getPost(slug: string, category?: string): Promise<IPost | null> {
let post: any = null
if (category) {
@@ -56,7 +67,7 @@ export async function getPost(slug: string, category?: string) {
return {
slug,
title: post.attributes?.title,
- html: marked(post.body, { renderer }),
+ html: marked(post.body, { renderer }) as string,
hidden: post.attributes?.hidden,
intro: post.attributes?.intro,
date: post.attributes?.date,
diff --git a/app/utils/server.ts b/app/utils/server.ts
index e48bbe475..04abdbb2e 100644
--- a/app/utils/server.ts
+++ b/app/utils/server.ts
@@ -1,3 +1,4 @@
+import type i18next from 'i18next'
import routes from 'routesPath'
import _includes from 'lodash/includes'
import _split from 'lodash/split'
@@ -102,7 +103,7 @@ interface IPageMeta {
prefixLessTitle: string
}
-export const getPageMeta = (t: (key: string) => string, url?: string, _pathname?: string): IPageMeta => {
+export const getPageMeta = (t: typeof i18next.t, url?: string, _pathname?: string): IPageMeta => {
const DEFAULT_RESULT = {
title: t('titles.main'),
} as Partial<IPageMeta>
diff --git a/jest.config.js b/jest.config.js
deleted file mode 100644
index 77c0a0d57..000000000
--- a/jest.config.js
+++ /dev/null
@@ -1,22 +0,0 @@
-const config = {
- testEnvironment: 'jsdom',
- moduleFileExtensions: ['js', 'ts', 'tsx'],
- transform: {
- '^.+\\.tsx?$': 'ts-jest',
- },
- transformIgnorePatterns: ['node_modules/(?!axios)'],
- testPathIgnorePatterns: ['<rootDir>/app/api/*'],
- globals: {
- 'ts-jest': {
- tsconfig: '<rootDir>/tsconfig.json',
- isolatedModules: true,
- },
- },
- moduleNameMapper: {
- '^ui/(.*)': '<rootDir>/app/ui/$1',
- '^hooks/(.*)': '<rootDir>/app/hooks/$1',
- '^redux/(.*)': '<rootDir>/app/redux/$1',
- },
-}
-
-module.exports = config
diff --git a/package.json b/package.json
index ba581292e..853a4b136 100644
--- a/package.json
+++ b/package.json
@@ -9,8 +9,6 @@
"dev:staging": "cross-env STAGING=true remix dev",
"start": "remix-serve ./build/index.js",
"start:staging": "cross-env STAGING=true remix-serve ./build/index.js",
- "test": "jest --transformIgnorePatterns \"node_modules/(?!axios)/\"",
- "test:ci": "CI=true npm run test",
"typecheck": "tsc",
"lint": "eslint app",
"lint:fix": "eslint app --fix",
@@ -31,10 +29,8 @@
"@remix-run/v1-route-convention": "^0.1.4",
"@swetrix/sdk": "^1.1.0",
"@tailwindcss/forms": "^0.5.7",
- "@testing-library/jest-dom": "^6.4.2",
"axios": "^1.6.8",
"axios-auth-refresh": "^3.3.6",
- "babel-jest": "^29.7.0",
"billboard.js": "^3.11.3",
"clsx": "^2.1.0",
"d3": "^7.9.0",
@@ -52,7 +48,6 @@
"jszip": "^3.10.1",
"lodash": "^4.17.21",
"marked": "^12.0.2",
- "prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-flagkit": "^2.0.4",
@@ -70,13 +65,11 @@
"remix-utils": "^7.6.0",
"spacetime": "^7.6.0",
"swetrix": "^3.1.1",
- "timezone-soft": "^1.5.2",
- "ts-jest": "^29.1.2"
+ "timezone-soft": "^1.5.2"
},
"eslintConfig": {
"extends": [
"@remix-run/eslint-config",
- "@remix-run/eslint-config/jest-testing-library",
"eslint:recommended"
],
"globals": {
@@ -87,7 +80,6 @@
"react-hooks"
],
"rules": {
- "testing-library/prefer-user-event": "off",
"jsx-quotes": [
"error",
"prefer-single"
@@ -123,8 +115,7 @@
}
},
"env": {
- "browser": true,
- "jest": true
+ "browser": true
}
},
"browserslist": {
@@ -143,18 +134,13 @@
"@remix-run/dev": "^2.8.1",
"@remix-run/eslint-config": "^2.8.1",
"@tailwindcss/typography": "^0.5.12",
- "@testing-library/react": "^15.0.2",
"@types/debug": "^4.1.12",
- "@types/jest": "^29.5.12",
"@types/lodash": "^4.17.0",
"@types/node": "^20.12.7",
- "@types/prop-types": "^15.7.12",
"@types/react": "^18.2.79",
"@types/react-dom": "^18.2.25",
"@types/react-flatpickr": "^3.8.11",
- "@types/react-test-renderer": "^18.0.7",
"@types/redux-mock-store": "^1.0.6",
- "@types/testing-library__jest-dom": "^5.14.9",
"@typescript-eslint/parser": "^7.7.0",
"@typescript-eslint/typescript-estree": "^7.7.0",
"autoprefixer": "^10.4.19",
@@ -163,8 +149,6 @@
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-lodash": "^7.4.0",
"eslint-plugin-react-hooks": "^4.6.0",
- "jest": "^29.7.0",
- "jest-environment-jsdom": "^29.7.0",
"postcss": "^8.4.38",
"prettier": "^3.2.5",
"resize-observer-polyfill": "^1.5.1",
diff --git a/tsconfig.json b/tsconfig.json
index 560636de8..cb7ac976e 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -2,10 +2,12 @@
"include": ["remix.env.d.ts", "**/*.ts", "**/*.tsx"],
"compilerOptions": {
"lib": ["DOM", "DOM.Iterable", "ES2020"],
+ "skipLibCheck": true,
"isolatedModules": true,
"esModuleInterop": true,
"jsx": "react-jsx",
- "moduleResolution": "node",
+ // We need Bundler instead of Node so IDE would not complain for imports from remix-utils/*
+ "moduleResolution": "Bundler",
"resolveJsonModule": true,
"target": "ES2019",
"strict": true,