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!

Apply linting rules

Blue Mouseaed81ddd2a45
diff --git a/web/.eslintrc.cjs b/web/.eslintrc.cjs
index 05dbef071..973948998 100644
--- a/web/.eslintrc.cjs
+++ b/web/.eslintrc.cjs
@@ -1,9 +1,3 @@
-/**
- * This is intended to be a basic starting point for linting in the Indie Stack.
- * It relies on recommended configs out of the box for simplicity, but you can
- * and should modify this configuration to best suit your team's needs.
- */
-
/** @type {import('eslint').Linter.Config} */
module.exports = {
root: true,
@@ -47,13 +41,21 @@ module.exports = {
},
rules: {
'react/jsx-no-leaked-render': ['warn', { validStrategies: ['ternary'] }],
+ 'react/prop-types': 'off',
+
+ // TODO: Re-enable these rules in future
+ 'jsx-a11y/anchor-has-content': 'off',
+ 'jsx-a11y/click-events-have-key-events': 'off',
+ 'jsx-a11y/no-noninteractive-element-interactions': 'off',
+ 'react/no-unescaped-entities': 'off',
+ 'jsx-a11y/no-static-element-interactions': 'off',
},
},
// Typescript
{
files: ['**/*.{ts,tsx}'],
- plugins: ['@typescript-eslint', 'import'],
+ plugins: ['@typescript-eslint', 'import', 'unused-imports'],
parser: '@typescript-eslint/parser',
settings: {
'import/internal-regex': '^~/',
@@ -65,6 +67,8 @@ module.exports = {
alwaysTryTypes: true,
},
},
+ 'jsx-quotes': ['error', 'prefer-single'],
+ 'comma-dangle': ['warn', 'always-multiline'],
},
extends: [
'plugin:@typescript-eslint/recommended',
@@ -83,16 +87,23 @@ module.exports = {
},
],
'@typescript-eslint/no-explicit-any': 'off',
+ '@typescript-eslint/no-unused-vars': 'off',
+ '@typescript-eslint/prefer-for-of': 'off',
+ '@typescript-eslint/ban-ts-comment': 'off',
+ '@typescript-eslint/no-empty-function': 'off',
+ 'unused-imports/no-unused-imports': 'error',
+ 'unused-imports/no-unused-vars': [
+ 'warn',
+ {
+ vars: 'all',
+ varsIgnorePattern: '^_',
+ args: 'after-used',
+ argsIgnorePattern: '^_',
+ },
+ ],
},
},
- // Markdown
- {
- files: ['**/*.md'],
- plugins: ['markdown'],
- extends: ['plugin:markdown/recommended-legacy', 'prettier'],
- },
-
// Node
{
files: ['.eslintrc.cjs'],
diff --git a/web/app/App.tsx b/web/app/App.tsx
index 4cd1da93b..c73ed0c44 100644
--- a/web/app/App.tsx
+++ b/web/app/App.tsx
@@ -1,26 +1,26 @@
-import React, { useEffect } from 'react'
-import { useLocation, Outlet } from 'react-router'
-import { useSelector } from 'react-redux'
-import { useTranslation } from 'react-i18next'
-import _some from 'lodash/some'
+import _endsWith from 'lodash/endsWith'
import _includes from 'lodash/includes'
+import _some from 'lodash/some'
import _startsWith from 'lodash/startsWith'
-import _endsWith from 'lodash/endsWith'
+import { useEffect } from 'react'
+import { useTranslation } from 'react-i18next'
+import { useSelector } from 'react-redux'
+import { useLocation, Outlet } from 'react-router'
import 'dayjs/locale/uk'
+import { Toaster } from 'sonner'
-import Header from '~/components/Header'
import Footer from '~/components/Footer'
-
-import { Toaster } from 'sonner'
-import { getAccessToken } from '~/utils/accessToken'
+import Header from '~/components/Header'
+import { isBrowser, isSelfhosted } from '~/lib/constants'
import { authActions } from '~/lib/reducers/auth'
+import UIActions from '~/lib/reducers/ui'
import { StateType, useAppDispatch } from '~/lib/store'
-import { isBrowser, isSelfhosted } from '~/lib/constants'
+import { getAccessToken } from '~/utils/accessToken'
+import { logout, shouldShowLowEventsBanner } from '~/utils/auth'
import routesPath from '~/utils/routes'
import { getPageMeta } from '~/utils/server'
+
import { authMe, getGeneralStats, getInstalledExtensions, getLastPost, getPaymentMetainfo } from './api'
-import UIActions from '~/lib/reducers/ui'
-import { logout, shouldShowLowEventsBanner } from '~/utils/auth'
interface AppProps {
ssrTheme: 'dark' | 'light'
@@ -106,9 +106,9 @@ const App = ({ ssrTheme, ssrAuthenticated }: AppProps) => {
return (
<>
- {!_includes(routesWithOutHeader, pathname) && !isReferralPage && !isProjectViewPage && (
+ {!_includes(routesWithOutHeader, pathname) && !isReferralPage && !isProjectViewPage ? (
<Header ssrTheme={ssrTheme} authenticated={authenticated} />
- )}
+ ) : null}
<Outlet />
<Toaster
theme={theme}
@@ -116,7 +116,7 @@ const App = ({ ssrTheme, ssrAuthenticated }: AppProps) => {
duration: 5000,
}}
/>
- {!isReferralPage && !isProjectViewPage && <Footer authenticated={authenticated} />}
+ {!isReferralPage && !isProjectViewPage ? <Footer authenticated={authenticated} /> : null}
</>
)
}
diff --git a/web/app/api/index.ts b/web/app/api/index.ts
index b83266531..1a0930250 100644
--- a/web/app/api/index.ts
+++ b/web/app/api/index.ts
@@ -1,23 +1,23 @@
/* eslint-disable implicit-arrow-linebreak */
import axios, { AxiosResponse } from 'axios'
import createAuthRefreshInterceptor from 'axios-auth-refresh'
-import _map from 'lodash/map'
-import _isEmpty from 'lodash/isEmpty'
import _isArray from 'lodash/isArray'
+import _isEmpty from 'lodash/isEmpty'
+import _map from 'lodash/map'
-import { store } from '~/lib/store'
-import { authActions } from '~/lib/reducers/auth'
-import { getAccessToken, removeAccessToken, setAccessToken } from '~/utils/accessToken'
-import { getRefreshToken, removeRefreshToken } from '~/utils/refreshToken'
import { DEFAULT_ALERTS_TAKE, API_URL } from '~/lib/constants'
-import { User, FeatureFlag } from '~/lib/models/User'
+import { Alerts } from '~/lib/models/Alerts'
import { Auth } from '~/lib/models/Auth'
+import { Role } from '~/lib/models/Organisation'
import { Project, Overall, LiveStats, Funnel } from '~/lib/models/Project'
-import { Alerts } from '~/lib/models/Alerts'
import { Subscriber } from '~/lib/models/Subscriber'
+import { User, FeatureFlag } from '~/lib/models/User'
+import { authActions } from '~/lib/reducers/auth'
+import { store } from '~/lib/store'
import { Filter, ProjectViewCustomEvent } from '~/pages/Project/View/interfaces/traffic'
-import { Role } from '~/lib/models/Organisation'
+import { getAccessToken, removeAccessToken, setAccessToken } from '~/utils/accessToken'
import { logout } from '~/utils/auth'
+import { getRefreshToken, removeRefreshToken } from '~/utils/refreshToken'
const api = axios.create({
baseURL: API_URL,
@@ -85,7 +85,7 @@ export const logoutApi = (refreshToken: string | null) =>
Authorization: `Bearer ${refreshToken}`,
},
})
- .then((response): {} => {
+ .then((response) => {
removeAccessToken()
removeRefreshToken()
return response.data
@@ -129,7 +129,7 @@ export const deleteUser = (deletionFeedback?: string) =>
feedback: deletionFeedback,
},
})
- .then((response): {} => response.data)
+ .then((response) => response.data)
.catch((error) => {
throw new Error(JSON.stringify(error.response.data))
})
@@ -265,8 +265,8 @@ export const verifyShare = ({ path, id }: { path: string; id: string }) =>
})
export const getProjects = (
- take: number = 0,
- skip: number = 0,
+ take = 0,
+ skip = 0,
search?: string,
mode?: string,
period?: string,
@@ -290,7 +290,7 @@ export const getProjects = (
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
-export const getProjectsAvailableForOrganisation = (take: number = 0, skip: number = 0, search?: string) =>
+export const getProjectsAvailableForOrganisation = (take = 0, skip = 0, search?: string) =>
api
.get(`/project/available-for-organisation?take=${take}&skip=${skip}&search=${search}`)
.then((response) => response.data)
@@ -298,7 +298,7 @@ export const getProjectsAvailableForOrganisation = (take: number = 0, skip: numb
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
-export const getOrganisations = (take: number = 0, skip: number = 0, search?: string) =>
+export const getOrganisations = (take = 0, skip = 0, search?: string) =>
api
.get(`/organisation?take=${take}&skip=${skip}&search=${search}`)
.then((response) => response.data)
@@ -464,13 +464,13 @@ export const resetCaptchaProject = (id: string) =>
export const getProjectData = (
pid: string,
- tb: string = 'hour',
- period: string = '1d',
+ tb = 'hour',
+ period = '1d',
filters: Filter[] = [],
metrics: ProjectViewCustomEvent[] = [],
- from: string = '',
- to: string = '',
- timezone: string = '',
+ from = '',
+ to = '',
+ timezone = '',
password: string | undefined = '',
mode: 'periodical' | 'cumulative' = 'periodical',
) =>
@@ -493,11 +493,11 @@ export const getProjectData = (
export const getCustomEventsMetadata = (
pid: string,
event: string,
- tb: string = 'hour',
- period: string = '1d',
- from: string = '',
- to: string = '',
- timezone: string = '',
+ tb = 'hour',
+ period = '1d',
+ from = '',
+ to = '',
+ timezone = '',
password: string | undefined = '',
) =>
api
@@ -517,12 +517,12 @@ export const getCustomEventsMetadata = (
export const getPropertyMetadata = (
pid: string,
property: string,
- tb: string = 'hour',
- period: string = '1d',
- from: string = '',
- to: string = '',
+ tb = 'hour',
+ period = '1d',
+ from = '',
+ to = '',
filters: any[] = [],
- timezone: string = '',
+ timezone = '',
password: string | undefined = '',
) =>
api
@@ -543,12 +543,12 @@ export const getPropertyMetadata = (
export const getTrafficCompareData = (
pid: string,
- tb: string = 'hour',
- period: string = '3d',
+ tb = 'hour',
+ period = '3d',
filters: any[] = [],
- from: string = '',
- to: string = '',
- timezone: string = '',
+ from = '',
+ to = '',
+ timezone = '',
password: string | undefined = '',
mode: 'periodical' | 'cumulative' = 'periodical',
) =>
@@ -570,13 +570,13 @@ export const getTrafficCompareData = (
export const getPerformanceCompareData = (
pid: string,
- tb: string = 'hour',
- period: string = '3d',
+ tb = 'hour',
+ period = '3d',
filters: any[] = [],
- from: string = '',
- to: string = '',
- timezone: string = '',
- measure: string = '',
+ from = '',
+ to = '',
+ timezone = '',
+ measure = '',
password: string | undefined = '',
) =>
api
@@ -597,13 +597,13 @@ export const getPerformanceCompareData = (
export const getPerfData = (
pid: string,
- tb: string = 'hour',
- period: string = '3d',
+ tb = 'hour',
+ period = '3d',
filters: any[] = [],
- from: string = '',
- to: string = '',
- timezone: string = '',
- measure: string = '',
+ from = '',
+ to = '',
+ timezone = '',
+ measure = '',
password: string | undefined = '',
) =>
api
@@ -624,13 +624,13 @@ export const getPerfData = (
export const getSessions = (
pid: string,
- period: string = '3d',
+ period = '3d',
filters: any[] = [],
- from: string = '',
- to: string = '',
- take: number = 30,
- skip: number = 0,
- timezone: string = '',
+ from = '',
+ to = '',
+ take = 30,
+ skip = 0,
+ timezone = '',
password: string | undefined = '',
) =>
api
@@ -651,14 +651,14 @@ export const getSessions = (
export const getErrors = (
pid: string,
- period: string = '3d',
+ period = '3d',
filters: any[] = [],
options: any = {},
- from: string = '',
- to: string = '',
- take: number = 30,
- skip: number = 0,
- timezone: string = '',
+ from = '',
+ to = '',
+ take = 30,
+ skip = 0,
+ timezone = '',
password: string | undefined = '',
) =>
api
@@ -677,7 +677,7 @@ export const getErrors = (
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
-export const getSession = (pid: string, psid: string, timezone: string = '', password: string | undefined = '') =>
+export const getSession = (pid: string, psid: string, timezone = '', password: string | undefined = '') =>
api
.get(`log/session?pid=${pid}&psid=${psid}&timezone=${timezone}`, {
headers: {
@@ -692,11 +692,11 @@ export const getSession = (pid: string, psid: string, timezone: string = '', pas
export const getError = (
pid: string,
eid: string,
- period: string = '7d',
+ period = '7d',
filters: any[] = [],
- from: string = '',
- to: string = '',
- timezone: string = '',
+ from = '',
+ to = '',
+ timezone = '',
password: string | undefined = '',
) =>
api
@@ -715,11 +715,11 @@ export const getError = (
export const getFunnelData = (
pid: string,
- period: string = '3d',
- from: string = '',
- to: string = '',
- timezone: string = '',
- funnelId: string = '',
+ period = '3d',
+ from = '',
+ to = '',
+ timezone = '',
+ funnelId = '',
password: string | undefined = '',
) =>
api
@@ -793,14 +793,7 @@ export const deleteProjectView = (pid: string, viewId: string) =>
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
-export const getCaptchaData = (
- pid: string,
- tb: string = 'hour',
- period: string = '3d',
- filters: any[] = [],
- from: string = '',
- to: string = '',
-) =>
+export const getCaptchaData = (pid: string, tb = 'hour', period = '3d', filters: any[] = [], from = '', to = '') =>
api
.get(
`log/captcha?pid=${pid}&timeBucket=${tb}&period=${period}&filters=${JSON.stringify(
@@ -1043,7 +1036,7 @@ export const removeTgIntegration = (tgID: string) =>
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
-export const getProjectAlerts = (projectId: string, take: number = DEFAULT_ALERTS_TAKE, skip: number = 0) =>
+export const getProjectAlerts = (projectId: string, take: number = DEFAULT_ALERTS_TAKE, skip = 0) =>
api
.get(`/alert/project/${projectId}?take=${take}&skip=${skip}`)
.then(
@@ -1067,7 +1060,7 @@ export const getAlert = (alertId: string) =>
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
-export interface CreateAlert extends Omit<Alerts, 'id' | 'lastTrigger' | 'lastTriggered' | 'created'> {}
+export type CreateAlert = Omit<Alerts, 'id' | 'lastTrigger' | 'lastTriggered' | 'created'>
export const createAlert = (data: CreateAlert) =>
api
@@ -1186,12 +1179,12 @@ export const confirmSubscriberInvite = (id: string, token: string) =>
export const getProjectDataCustomEvents = (
pid: string,
- tb: string = 'hour',
- period: string = '3d',
+ tb = 'hour',
+ period = '3d',
filters: any[] = [],
- from: string = '',
- to: string = '',
- timezone: string = '',
+ from = '',
+ to = '',
+ timezone = '',
customEvents: string[] = [],
password: string | undefined = '',
) =>
@@ -1313,12 +1306,12 @@ export const deletePartially = (
export const getUserFlow = (
pid: string,
- tb: string = 'hour',
- period: string = '3d',
+ tb = 'hour',
+ period = '3d',
filters: any[] = [],
- from: string = '',
- to: string = '',
- timezone: string = '',
+ from = '',
+ to = '',
+ timezone = '',
password: string | undefined = '',
) =>
api
@@ -1344,7 +1337,7 @@ export const checkPassword = (pid: string, password: string) =>
'x-password': password,
},
})
- .then((response): Boolean => response.data)
+ .then((response): boolean => response.data)
.catch((error) => {
throw _isEmpty(error.response.data?.message) ? error.response.data : error.response.data.message
})
diff --git a/web/app/components/DashboardLockedBanner.tsx b/web/app/components/DashboardLockedBanner.tsx
index 1eba4dc89..2837719e4 100644
--- a/web/app/components/DashboardLockedBanner.tsx
+++ b/web/app/components/DashboardLockedBanner.tsx
@@ -1,9 +1,10 @@
-import React, { memo, useState, useMemo } from 'react'
import { LockClosedIcon } from '@heroicons/react/24/outline'
-import { useSelector } from 'react-redux'
-import { StateType } from '~/lib/store'
+import { memo, useState, useMemo } from 'react'
import { useTranslation } from 'react-i18next'
+import { useSelector } from 'react-redux'
+
import { DashboardBlockReason } from '~/lib/models/User'
+import { StateType } from '~/lib/store'
import Modal from '~/ui/Modal'
const DashboardLockedBanner = () => {
diff --git a/web/app/components/EventsRunningOutBanner.tsx b/web/app/components/EventsRunningOutBanner.tsx
index 30ea7c841..e30a34756 100644
--- a/web/app/components/EventsRunningOutBanner.tsx
+++ b/web/app/components/EventsRunningOutBanner.tsx
@@ -1,12 +1,12 @@
-import React, { memo, useState } from 'react'
import { ExclamationTriangleIcon, XMarkIcon } from '@heroicons/react/24/outline'
-import { useSelector } from 'react-redux'
-import { useAppDispatch, StateType } from '~/lib/store'
+import { memo, useState } from 'react'
import { useTranslation } from 'react-i18next'
+import { useSelector } from 'react-redux'
-import Modal from '~/ui/Modal'
-import UIActions from '~/lib/reducers/ui'
import { SHOW_BANNER_AT_PERC } from '~/lib/constants'
+import UIActions from '~/lib/reducers/ui'
+import { useAppDispatch, StateType } from '~/lib/store'
+import Modal from '~/ui/Modal'
const EventsRunningOutBanner = () => {
const { t } = useTranslation('common')
diff --git a/web/app/components/Footer/index.tsx b/web/app/components/Footer/index.tsx
index 500a68165..df8de9b9d 100644
--- a/web/app/components/Footer/index.tsx
+++ b/web/app/components/Footer/index.tsx
@@ -1,9 +1,9 @@
-import React, { memo } from 'react'
-import { Link } from 'react-router'
-import { Trans, useTranslation } from 'react-i18next'
import { SiDiscord, SiGithub, SiX } from '@icons-pack/react-simple-icons'
import _map from 'lodash/map'
-import Flag from '~/ui/Flag'
+import { SquareArrowOutUpRightIcon } from 'lucide-react'
+import React, { memo } from 'react'
+import { Trans, useTranslation } from 'react-i18next'
+import { Link } from 'react-router'
import {
isSelfhosted,
@@ -20,10 +20,10 @@ import {
DISCORD_URL,
CAPTCHA_URL,
} from '~/lib/constants'
-import routesPath from '~/utils/routes'
-import { SquareArrowOutUpRightIcon } from 'lucide-react'
-import SwetrixLogo from '~/ui/icons/SwetrixLogo'
+import Flag from '~/ui/Flag'
import LinkedIn from '~/ui/icons/LinkedIn'
+import SwetrixLogo from '~/ui/icons/SwetrixLogo'
+import routesPath from '~/utils/routes'
const CONTACT_US_URL = `https://swetrix.com${routesPath.contact}`
const ABOUT_US_URL = `https://swetrix.com${routesPath.about}`
@@ -311,7 +311,7 @@ const Footer = ({ authenticated, showDBIPMessage }: FooterProps) => {
)
})}
- {showDBIPMessage && (
+ {showDBIPMessage ? (
<li>
<a
className='text-base text-gray-300 hover:text-white'
@@ -323,7 +323,7 @@ const Footer = ({ authenticated, showDBIPMessage }: FooterProps) => {
IP Geolocation by DB-IP
</a>
</li>
- )}
+ ) : null}
</ul>
</div>
</div>
diff --git a/web/app/components/GithubAuth.tsx b/web/app/components/GithubAuth.tsx
index f25591467..d582c237f 100644
--- a/web/app/components/GithubAuth.tsx
+++ b/web/app/components/GithubAuth.tsx
@@ -1,13 +1,12 @@
-import React from 'react'
+import cx from 'clsx'
import { useTranslation } from 'react-i18next'
import { useSelector } from 'react-redux'
-import cx from 'clsx'
-import Button from '~/ui/Button'
+import { isBrowser } from '~/lib/constants'
import { StateType } from '~/lib/store/index'
+import Button from '~/ui/Button'
import GithubDarkSVG from '~/ui/icons/GithubDark'
import GithubLightSVG from '~/ui/icons/GithubLight'
-import { isBrowser } from '~/lib/constants'
interface GoogleAuthProps {
ssrTheme: string
diff --git a/web/app/components/GoogleAuth.tsx b/web/app/components/GoogleAuth.tsx
index e76c8c86e..8656dbedf 100644
--- a/web/app/components/GoogleAuth.tsx
+++ b/web/app/components/GoogleAuth.tsx
@@ -1,6 +1,5 @@
-import React from 'react'
-import { useTranslation } from 'react-i18next'
import cx from 'clsx'
+import { useTranslation } from 'react-i18next'
import Button from '~/ui/Button'
import GoogleGSVG from '~/ui/icons/GoogleG'
diff --git a/web/app/components/Header/index.tsx b/web/app/components/Header/index.tsx
index e21ea39f5..6fa165262 100644
--- a/web/app/components/Header/index.tsx
+++ b/web/app/components/Header/index.tsx
@@ -1,10 +1,5 @@
/* eslint-disable jsx-a11y/anchor-is-valid, react/no-unstable-nested-components */
-import React, { memo, Fragment, useMemo, useState } from 'react'
-import { Link } from 'react-router'
-import { useSelector } from 'react-redux'
-import { useTranslation } from 'react-i18next'
-import i18next from 'i18next'
import {
Popover,
Transition,
@@ -18,22 +13,25 @@ import {
MenuItems,
DialogPanel,
} from '@headlessui/react'
-import { Bars3Icon, XMarkIcon, ChevronDownIcon } from '@heroicons/react/24/outline'
import { ArrowRightIcon } from '@heroicons/react/20/solid'
+import { Bars3Icon, XMarkIcon, ChevronDownIcon } from '@heroicons/react/24/outline'
import { MoonIcon, SunIcon } from '@heroicons/react/24/solid'
import { SiYoutube } from '@icons-pack/react-simple-icons'
+import cx, { clsx } from 'clsx'
import dayjs from 'dayjs'
-import utc from 'dayjs/plugin/utc'
import duration from 'dayjs/plugin/duration'
-import _map from 'lodash/map'
+import utc from 'dayjs/plugin/utc'
+import { type t as i18nextT } from 'i18next'
+import { changeLanguage } from 'i18next'
import _includes from 'lodash/includes'
+import _map from 'lodash/map'
import _startsWith from 'lodash/startsWith'
-import cx, { clsx } from 'clsx'
import { GaugeIcon, ChartPieIcon, BugIcon, PuzzleIcon, PhoneIcon } from 'lucide-react'
+import { memo, Fragment, useMemo, useState } from 'react'
+import { useTranslation } from 'react-i18next'
+import { useSelector } from 'react-redux'
+import { Link } from 'react-router'
-import routes from '~/utils/routes'
-import { authActions } from '~/lib/reducers/auth'
-import UIActions from '~/lib/reducers/ui'
import {
whitelist,
languages,
@@ -45,12 +43,15 @@ import {
CAPTCHA_URL,
isDisableMarketingPages,
} from '~/lib/constants'
-import Dropdown from '~/ui/Dropdown'
-import Flag from '~/ui/Flag'
import { User } from '~/lib/models/User'
+import { authActions } from '~/lib/reducers/auth'
+import UIActions from '~/lib/reducers/ui'
import { useAppDispatch, StateType } from '~/lib/store'
-import { logout } from '~/utils/auth'
+import Dropdown from '~/ui/Dropdown'
+import Flag from '~/ui/Flag'
import SwetrixLogo from '~/ui/icons/SwetrixLogo'
+import { logout } from '~/utils/auth'
+import routes from '~/utils/routes'
dayjs.extend(utc)
dayjs.extend(duration)
@@ -64,7 +65,7 @@ const TRIAL_STATUS_MAPPING = {
ENDS_IN_X_DAYS: 4,
}
-const getSolutions = (t: typeof i18next.t) => [
+const getSolutions = (t: typeof i18nextT) => [
{
name: t('header.solutions.analytics.title'),
description: t('header.solutions.analytics.desc'),
@@ -91,7 +92,7 @@ const getSolutions = (t: typeof i18next.t) => [
},
]
-const getCallsToAction = (t: typeof i18next.t) => [
+const getCallsToAction = (t: typeof i18nextT) => [
{ name: t('header.watchDemo'), link: 'https://www.youtube.com/watch?v=XBp38fZREIE', icon: SiYoutube },
{ name: t('header.contactSales'), link: routes.contact, icon: PhoneIcon },
]
@@ -269,15 +270,7 @@ const ThemeMenu = ({ theme, switchTheme }: { theme: string; switchTheme: (i: str
)
}
-const ProfileMenu = ({
- user,
- logoutHandler,
- onLanguageChange,
-}: {
- user: User
- logoutHandler: () => void
- onLanguageChange: (l: string) => void
-}) => {
+const ProfileMenu = ({ user, logoutHandler }: { user: User; logoutHandler: () => void }) => {
const {
t,
i18n: { language },
@@ -368,7 +361,7 @@ const ProfileMenu = ({
className='block cursor-pointer px-4 py-2 text-sm text-gray-700 hover:bg-gray-200 dark:bg-slate-800 dark:text-gray-50 dark:hover:bg-gray-600'
role='menuitem'
tabIndex={0}
- onClick={() => onLanguageChange(lng)}
+ onClick={() => changeLanguage(lng)}
>
<div className='flex'>
<div className='pt-1'>
@@ -419,7 +412,7 @@ const ProfileMenu = ({
)}
</MenuItem>
)}
- {!isSelfhosted && (
+ {!isSelfhosted ? (
<MenuItem>
{({ active }) => (
<Link
@@ -432,7 +425,7 @@ const ProfileMenu = ({
</Link>
)}
</MenuItem>
- )}
+ ) : null}
</div>
<MenuItem>
@@ -447,7 +440,7 @@ const ProfileMenu = ({
</Link>
)}
</MenuItem>
- {!isSelfhosted && (
+ {!isSelfhosted ? (
<MenuItem>
{({ active }) => (
<Link
@@ -460,7 +453,7 @@ const ProfileMenu = ({
</Link>
)}
</MenuItem>
- )}
+ ) : null}
<MenuItem>
{({ active }) => (
<p
@@ -491,7 +484,6 @@ const AuthedHeader = ({
user,
switchTheme,
theme,
- onLanguageChange,
rawStatus,
status,
logoutHandler,
@@ -501,7 +493,6 @@ const AuthedHeader = ({
user: User
switchTheme: (thm?: string) => void
theme: 'dark' | 'light'
- onLanguageChange: (lng: string) => void
rawStatus: string | number
status: string
logoutHandler: () => void
@@ -525,7 +516,7 @@ const AuthedHeader = ({
</Link>
<div className='ml-10 hidden gap-4 space-x-1 lg:flex'>
- {user?.planCode === 'trial' && (
+ {user?.planCode === 'trial' ? (
<Link
to={routes.billing}
className={cx('text-base leading-6 font-semibold', {
@@ -539,8 +530,8 @@ const AuthedHeader = ({
>
{status}
</Link>
- )}
- {user?.planCode === 'none' && (
+ ) : null}
+ {user?.planCode === 'none' ? (
<Link
to={routes.billing}
className='text-base leading-6 font-semibold text-rose-600 hover:text-rose-500'
@@ -548,9 +539,9 @@ const AuthedHeader = ({
>
{t('billing.inactive')}
</Link>
- )}
- {!isSelfhosted && !isDisableMarketingPages && <SolutionsMenu />}
- {isSelfhosted && !isDisableMarketingPages && (
+ ) : null}
+ {!isSelfhosted && !isDisableMarketingPages ? <SolutionsMenu /> : null}
+ {isSelfhosted && !isDisableMarketingPages ? (
<a
href={`https://swetrix.com${routes.blog}`}
target='_blank'
@@ -559,15 +550,15 @@ const AuthedHeader = ({
>
{t('footer.blog')}
</a>
- )}
- {!isSelfhosted && !isDisableMarketingPages && (
+ ) : null}
+ {!isSelfhosted && !isDisableMarketingPages ? (
<Link
to={routes.blog}
className='text-base leading-6 font-semibold text-slate-800 hover:text-slate-700 dark:text-slate-200 dark:hover:text-white'
>
{t('footer.blog')}
</Link>
- )}
+ ) : null}
<a
href={DOCS_URL}
className='text-base leading-6 font-semibold text-slate-800 hover:text-slate-700 dark:text-slate-200 dark:hover:text-white'
@@ -586,7 +577,7 @@ const AuthedHeader = ({
</div>
<div className='ml-1 hidden flex-wrap items-center justify-center space-y-1 space-x-2 sm:space-y-0 lg:ml-10 lg:flex lg:space-x-4'>
<ThemeMenu theme={theme} switchTheme={switchTheme} />
- <ProfileMenu user={user} logoutHandler={logoutHandler} onLanguageChange={onLanguageChange} />
+ <ProfileMenu user={user} logoutHandler={logoutHandler} />
</div>
<div className='flex items-center justify-center space-x-3 lg:hidden'>
{/* Theme switch */}
@@ -623,14 +614,12 @@ const AuthedHeader = ({
const NotAuthedHeader = ({
switchTheme,
theme,
- onLanguageChange,
colourBackground,
refPage,
openMenu,
}: {
switchTheme: (a?: string) => void
theme: 'dark' | 'light'
- onLanguageChange: (lang: string) => void
colourBackground: boolean
refPage?: boolean
openMenu: () => void
@@ -658,10 +647,10 @@ const NotAuthedHeader = ({
</Link>
)}
- {!refPage && (
+ {!refPage ? (
<div className='ml-10 hidden items-center gap-4 space-x-1 lg:flex'>
- {!isSelfhosted && !isDisableMarketingPages && <SolutionsMenu />}
- {isSelfhosted && !isDisableMarketingPages && (
+ {!isSelfhosted && !isDisableMarketingPages ? <SolutionsMenu /> : null}
+ {isSelfhosted && !isDisableMarketingPages ? (
<a
href={`https://swetrix.com${routes.blog}`}
target='_blank'
@@ -670,16 +659,16 @@ const NotAuthedHeader = ({
>
{t('footer.blog')}
</a>
- )}
- {!isSelfhosted && !isDisableMarketingPages && (
+ ) : null}
+ {!isSelfhosted && !isDisableMarketingPages ? (
<Link
to={routes.blog}
className='text-base leading-6 font-semibold text-slate-800 hover:text-slate-700 dark:text-slate-200 dark:hover:text-white'
>
{t('footer.blog')}
</Link>
- )}
- {!isSelfhosted && !isDisableMarketingPages && (
+ ) : null}
+ {!isSelfhosted && !isDisableMarketingPages ? (
<Link
to={`${routes.main}#pricing`}
className='text-base leading-6 font-semibold text-slate-800 hover:text-slate-700 dark:text-slate-200 dark:hover:text-white'
@@ -687,7 +676,7 @@ const NotAuthedHeader = ({
>
{t('common.pricing')}
</Link>
- )}
+ ) : null}
<a
href={DOCS_URL}
className='text-base leading-6 font-semibold text-slate-800 hover:text-slate-700 dark:text-slate-200 dark:hover:text-white'
@@ -697,7 +686,7 @@ const NotAuthedHeader = ({
{t('common.docs')}
</a>
</div>
- )}
+ ) : null}
</div>
<div className='ml-1 hidden flex-wrap items-center justify-center space-y-1 space-x-2 sm:space-y-0 lg:ml-10 lg:flex lg:space-x-4'>
{/* Language selector */}
@@ -725,11 +714,13 @@ const NotAuthedHeader = ({
{languages[lng]}
</div>
)}
- onSelect={onLanguageChange}
+ onSelect={(lng: string) => {
+ changeLanguage(lng)
+ }}
headless
/>
<ThemeMenu theme={theme} switchTheme={switchTheme} />
- {!refPage && (
+ {!refPage ? (
<>
<Separator />
<Link
@@ -740,7 +731,7 @@ const NotAuthedHeader = ({
<ArrowRightIcon className='mt-[1px] ml-1 h-4 w-4 stroke-2' />
</Link>
</>
- )}
+ ) : null}
</div>
<div className='flex items-center justify-center space-x-3 lg:hidden'>
{/* Theme switch */}
@@ -839,10 +830,6 @@ const Header = ({ ssrTheme, authenticated, refPage, transparent }: HeaderProps)
dispatch(UIActions.setTheme(newTheme as 'light' | 'dark'))
}
- const onLanguageChange = (id: string) => {
- i18next.changeLanguage(id)
- }
-
const openMenu = () => {
setMobileMenuOpen(true)
}
@@ -858,7 +845,6 @@ const Header = ({ ssrTheme, authenticated, refPage, transparent }: HeaderProps)
logoutHandler={logoutHandler}
switchTheme={switchTheme}
theme={theme}
- onLanguageChange={onLanguageChange}
colourBackground={!transparent}
openMenu={openMenu}
/>
@@ -866,7 +852,6 @@ const Header = ({ ssrTheme, authenticated, refPage, transparent }: HeaderProps)
<NotAuthedHeader
switchTheme={switchTheme}
theme={theme}
- onLanguageChange={onLanguageChange}
colourBackground={!transparent}
refPage={refPage}
openMenu={openMenu}
@@ -950,7 +935,7 @@ const Header = ({ ssrTheme, authenticated, refPage, transparent }: HeaderProps)
className='block cursor-pointer px-4 py-2 text-sm text-gray-700 hover:bg-gray-200 dark:bg-slate-800 dark:text-gray-50 dark:hover:bg-gray-600'
role='menuitem'
tabIndex={0}
- onClick={() => onLanguageChange(lng)}
+ onClick={() => changeLanguage(lng)}
>
<div className='flex'>
<div className='pt-1'>
@@ -971,7 +956,7 @@ const Header = ({ ssrTheme, authenticated, refPage, transparent }: HeaderProps)
</>
)}
</Menu>
- {!isSelfhosted && (
+ {!isSelfhosted ? (
<Disclosure as='div' className='-mx-3'>
{({ open }) => (
<>
@@ -1021,8 +1006,8 @@ const Header = ({ ssrTheme, authenticated, refPage, transparent }: HeaderProps)
</>
)}
</Disclosure>
- )}
- {!isSelfhosted && authenticated && user?.planCode === 'trial' && (
+ ) : null}
+ {!isSelfhosted && authenticated && user?.planCode === 'trial' ? (
<Link
to={routes.billing}
onClick={() => setMobileMenuOpen(false)}
@@ -1040,8 +1025,8 @@ const Header = ({ ssrTheme, authenticated, refPage, transparent }: HeaderProps)
>
{status}
</Link>
- )}
- {!isSelfhosted && authenticated && user?.planCode === 'none' && (
+ ) : null}
+ {!isSelfhosted && authenticated && user?.planCode === 'none' ? (
<Link
to={routes.billing}
onClick={() => setMobileMenuOpen(false)}
@@ -1050,8 +1035,8 @@ const Header = ({ ssrTheme, authenticated, refPage, transparent }: HeaderProps)
>
{t('billing.inactive')}
</Link>
- )}
- {!isSelfhosted && authenticated && user?.planCode !== 'none' && user?.planCode !== 'trial' && (
+ ) : null}
+ {!isSelfhosted && authenticated && user?.planCode !== 'none' && user?.planCode !== 'trial' ? (
<Link
to={routes.billing}
onClick={() => setMobileMenuOpen(false)}
@@ -1060,8 +1045,8 @@ const Header = ({ ssrTheme, authenticated, refPage, transparent }: HeaderProps)
>
{t('common.billing')}
</Link>
- )}
- {!isSelfhosted && !isDisableMarketingPages && !authenticated && (
+ ) : null}
+ {!isSelfhosted && !isDisableMarketingPages && !authenticated ? (
<Link
to={`${routes.main}#pricing`}
onClick={() => setMobileMenuOpen(false)}
@@ -1070,8 +1055,8 @@ const Header = ({ ssrTheme, authenticated, refPage, transparent }: HeaderProps)
>
{t('common.pricing')}
</Link>
- )}
- {isSelfhosted && !isDisableMarketingPages && (
+ ) : null}
+ {isSelfhosted && !isDisableMarketingPages ? (
<a
onClick={() => setMobileMenuOpen(false)}
href={`https://swetrix.com${routes.blog}`}
@@ -1081,8 +1066,8 @@ const Header = ({ ssrTheme, authenticated, refPage, transparent }: HeaderProps)
>
{t('footer.blog')}
</a>
- )}
- {!isSelfhosted && !isDisableMarketingPages && (
+ ) : null}
+ {!isSelfhosted && !isDisableMarketingPages ? (
<Link
to={routes.blog}
onClick={() => setMobileMenuOpen(false)}
@@ -1090,7 +1075,7 @@ const Header = ({ ssrTheme, authenticated, refPage, transparent }: HeaderProps)
>
{t('footer.blog')}
</Link>
- )}
+ ) : null}
<a
href={DOCS_URL}
onClick={() => setMobileMenuOpen(false)}
@@ -1100,7 +1085,7 @@ const Header = ({ ssrTheme, authenticated, refPage, transparent }: HeaderProps)
>
{t('common.docs')}
</a>
- {authenticated && (
+ {authenticated ? (
<Link
to={routes.dashboard}
onClick={() => setMobileMenuOpen(false)}
@@ -1108,7 +1093,7 @@ const Header = ({ ssrTheme, authenticated, refPage, transparent }: HeaderProps)
>
{t('common.dashboard')}
</Link>
- )}
+ ) : null}
</div>
<div className='space-y-2 py-6'>
{authenticated ? (
@@ -1120,7 +1105,7 @@ const Header = ({ ssrTheme, authenticated, refPage, transparent }: HeaderProps)
>
{t('common.accountSettings')}
</Link>
- {!isSelfhosted && (
+ {!isSelfhosted ? (
<Link
to={routes.organisations}
onClick={() => setMobileMenuOpen(false)}
@@ -1128,7 +1113,7 @@ const Header = ({ ssrTheme, authenticated, refPage, transparent }: HeaderProps)
>
{t('organisations.organisations')}
</Link>
- )}
+ ) : null}
<span
className='-mx-3 block rounded-lg px-3 py-2 text-base leading-7 font-semibold text-gray-900 hover:bg-gray-300/50 dark:text-gray-50 dark:hover:bg-slate-700/80'
onClick={logoutHandler}
diff --git a/web/app/components/LocaleLinks.tsx b/web/app/components/LocaleLinks.tsx
index 0f6273393..4ebfe8ce5 100644
--- a/web/app/components/LocaleLinks.tsx
+++ b/web/app/components/LocaleLinks.tsx
@@ -1,8 +1,9 @@
+import _map from 'lodash/map'
+import _some from 'lodash/some'
import { useMemo } from 'react'
import { useLocation, Location } from 'react-router'
+
import { whitelist, whitelistWithCC, MAIN_URL } from '~/lib/constants'
-import _map from 'lodash/map'
-import _some from 'lodash/some'
const getUrlFromLocation = (location: Location) => {
const { pathname, hash, search } = location
diff --git a/web/app/components/SEO.tsx b/web/app/components/SEO.tsx
index a500737f3..f1d085bfa 100644
--- a/web/app/components/SEO.tsx
+++ b/web/app/components/SEO.tsx
@@ -1,10 +1,11 @@
-import { useTranslation } from 'react-i18next'
-import { useLocation } from 'react-router'
import _startsWith from 'lodash/startsWith'
import _toUpper from 'lodash/toUpper'
-import { getPageMeta } from '~/utils/server'
+import { useTranslation } from 'react-i18next'
+import { useLocation } from 'react-router'
+
import { getOgImageUrl } from '~/lib/constants'
import routes from '~/utils/routes'
+import { getPageMeta } from '~/utils/server'
export const SEO = () => {
const {
@@ -22,7 +23,7 @@ export const SEO = () => {
return (
<>
- {!isBlogPage && (
+ {!isBlogPage ? (
<>
<title>{title}</title>
<meta property='og:title' content='Swetrix' />
@@ -39,26 +40,26 @@ export const SEO = () => {
property='og:description'
content='Swetrix is a cookieless, privacy-first and GDPR-compliant Google Analytics alternative'
/>
- {isMainPage && (
+ {isMainPage ? (
<>
<meta name='twitter:image' content='https://swetrix.com/assets/og_image.png' />
<meta property='og:image' content='https://swetrix.com/assets/og_image.png' />
</>
- )}
- {isErrorsPage && (
+ ) : null}
+ {isErrorsPage ? (
<>
<meta name='twitter:image' content='https://swetrix.com/assets/og_image_errors.png' />
<meta property='og:image' content='https://swetrix.com/assets/og_image_errors.png' />
</>
- )}
- {!isProjectViewPage && !isMainPage && !isErrorsPage && (
+ ) : null}
+ {!isProjectViewPage && !isMainPage && !isErrorsPage ? (
<>
<meta name='twitter:image' content={ogImageUrl} />
<meta property='og:image' content={ogImageUrl} />
</>
- )}
+ ) : null}
</>
- )}
+ ) : null}
<meta name='theme-color' content='#818cf8' />
<meta name='twitter:site' content='@swetrix' />
<meta name='twitter:card' content='summary_large_image' />
diff --git a/web/app/components/marketing/ComparisonTable.tsx b/web/app/components/marketing/ComparisonTable.tsx
index a65599f03..a0323ba32 100644
--- a/web/app/components/marketing/ComparisonTable.tsx
+++ b/web/app/components/marketing/ComparisonTable.tsx
@@ -1,17 +1,13 @@
-import _map from 'lodash/map'
-import { useTranslation } from 'react-i18next'
import { CheckIcon, XMarkIcon } from '@heroicons/react/24/solid'
import cx from 'clsx'
+import _map from 'lodash/map'
+import { useTranslation } from 'react-i18next'
const COMPETITORS_LIST = ['Google Analytics', 'Fathom', 'Plausible', 'Simple Analytics']
const SWETRIX_AND_COMPETITORS_LIST = ['Swetrix', ...COMPETITORS_LIST]
// The order in the table is defined by the Swetrix object
-const COMPETITOR_FEATURE_TABLE: {
- [key: string]: {
- [key: string]: boolean
- }
-} = {
+const COMPETITOR_FEATURE_TABLE: Record<string, Record<string, boolean>> = {
Swetrix: {
'main.competitiveFeatures.gdpr': true, // GDPR-compatible
'main.competitiveFeatures.open': true, // Open-source
@@ -123,18 +119,18 @@ export const ComparisonTable = ({ className }: ComparisonTableProps) => {
<td className='w-1/6 px-3 py-4 text-sm text-slate-700 sm:pl-6 dark:text-gray-50'>{t(key)}</td>
{_map(SWETRIX_AND_COMPETITORS_LIST, (service) => (
<td key={`${key}-${service}`} className='w-1/6 px-3 py-4 text-sm text-gray-50 sm:pl-6'>
- {COMPETITOR_FEATURE_TABLE[service][key] && (
+ {COMPETITOR_FEATURE_TABLE[service][key] ? (
<CheckIcon
className='h-5 w-5 shrink-0 text-green-600 dark:text-green-500'
aria-label={t('common.yes')}
/>
- )}
- {!COMPETITOR_FEATURE_TABLE[service][key] && (
+ ) : null}
+ {!COMPETITOR_FEATURE_TABLE[service][key] ? (
<XMarkIcon
className='h-5 w-5 shrink-0 text-red-600 dark:text-red-500'
aria-label={t('common.no')}
/>
- )}
+ ) : null}
</td>
))}
</tr>
diff --git a/web/app/components/marketing/ConveyorBelt.tsx b/web/app/components/marketing/ConveyorBelt.tsx
index adcab8f18..07f7af055 100644
--- a/web/app/components/marketing/ConveyorBelt.tsx
+++ b/web/app/components/marketing/ConveyorBelt.tsx
@@ -1,4 +1,3 @@
-import React from 'react'
import clsx from 'clsx'
const Logo = ({ label, className }: { label: string; className: string }) => {
diff --git a/web/app/components/marketing/DitchGoogle.tsx b/web/app/components/marketing/DitchGoogle.tsx
index 29367ad36..3c1c082a7 100644
--- a/web/app/components/marketing/DitchGoogle.tsx
+++ b/web/app/components/marketing/DitchGoogle.tsx
@@ -1,6 +1,6 @@
-import { Link } from 'react-router'
import { ArrowRightIcon } from '@heroicons/react/20/solid'
import { Trans, useTranslation } from 'react-i18next'
+import { Link } from 'react-router'
import routes from '~/utils/routes'
diff --git a/web/app/components/marketing/Lines.tsx b/web/app/components/marketing/Lines.tsx
index 4aa7d9566..0d489f46e 100644
--- a/web/app/components/marketing/Lines.tsx
+++ b/web/app/components/marketing/Lines.tsx
@@ -1,5 +1,3 @@
-import React from 'react'
-
export const Lines = () => (
<div className='pointer-events-none relative'>
<div className='absolute top-[32rem] right-[-48rem] h-px w-[800%] rotate-6 bg-gradient-to-l from-slate-600 opacity-10 dark:from-slate-400' />
diff --git a/web/app/components/marketing/LogoTimeline.tsx b/web/app/components/marketing/LogoTimeline.tsx
index f54485400..49a8c76e6 100644
--- a/web/app/components/marketing/LogoTimeline.tsx
+++ b/web/app/components/marketing/LogoTimeline.tsx
@@ -1,5 +1,3 @@
-import React from 'react'
-import clsx from 'clsx'
import {
SiFramer,
SiGhost,
@@ -14,6 +12,8 @@ import {
SiWix,
SiWordpress,
} from '@icons-pack/react-simple-icons'
+import clsx from 'clsx'
+import React from 'react'
const Row = ({ children }: { children: React.ReactNode }) => {
return (
diff --git a/web/app/components/marketing/MarketplaceCluster.tsx b/web/app/components/marketing/MarketplaceCluster.tsx
index 8b858e33d..e5ab20849 100644
--- a/web/app/components/marketing/MarketplaceCluster.tsx
+++ b/web/app/components/marketing/MarketplaceCluster.tsx
@@ -1,6 +1,6 @@
-import React from 'react'
import { clsx } from 'clsx'
import { motion } from 'framer-motion'
+import React from 'react'
const Circle = ({ size, delay, opacity }: { size: number; delay: number; opacity: string }) => {
return (
diff --git a/web/app/components/marketing/Pricing.tsx b/web/app/components/marketing/Pricing.tsx
index c40c67b9b..9bab96d60 100644
--- a/web/app/components/marketing/Pricing.tsx
+++ b/web/app/components/marketing/Pricing.tsx
@@ -1,20 +1,19 @@
/* eslint-disable no-confusing-arrow */
-import React, { memo, useState, useEffect } from 'react'
-import { useSelector, useDispatch } from 'react-redux'
-import { ClientOnly } from 'remix-utils/client-only'
-import { Link } from 'react-router'
+import { RadioGroup } from '@headlessui/react'
import { CheckIcon } from '@heroicons/react/24/solid'
+import cx from 'clsx'
import dayjs from 'dayjs'
-import _map from 'lodash/map'
-import _isNil from 'lodash/isNil'
import _includes from 'lodash/includes'
+import _isNil from 'lodash/isNil'
+import _map from 'lodash/map'
+import React, { memo, useState, useEffect } from 'react'
import { Trans, useTranslation } from 'react-i18next'
-import { RadioGroup } from '@headlessui/react'
-import cx from 'clsx'
+import { useSelector, useDispatch } from 'react-redux'
+import { Link } from 'react-router'
+import { ClientOnly } from 'remix-utils/client-only'
import { toast } from 'sonner'
-import Modal from '~/ui/Modal'
-import Button from '~/ui/Button'
+import { authMe, previewSubscriptionUpdate, changeSubscriptionPlan } from '~/api'
import {
CONTACT_EMAIL,
paddleLanguageMapping,
@@ -26,12 +25,13 @@ import {
TRIAL_DAYS,
} from '~/lib/constants'
import { authActions } from '~/lib/reducers/auth'
-import { authMe, previewSubscriptionUpdate, changeSubscriptionPlan } from '~/api'
-import routes from '~/utils/routes'
import { AppDispatch, StateType } from '~/lib/store'
-import Loader from '~/ui/Loader'
import { Badge } from '~/ui/Badge'
+import Button from '~/ui/Button'
+import Loader from '~/ui/Loader'
+import Modal from '~/ui/Modal'
import { logout } from '~/utils/auth'
+import routes from '~/utils/routes'
const getPaidFeatures = (t: any, tier: any) => {
return [
@@ -84,7 +84,7 @@ const Pricing = ({ authenticated, isBillingPage }: PricingProps) => {
: [user.planCode, ...STANDARD_PLANS]
: STANDARD_PLANS
- // @ts-ignore
+ // @ts-expect-error
const [selectedTier, setSelectedTier] = useState<any>(authenticated ? PLAN_LIMITS[user.planCode] : PLAN_LIMITS.hobby)
const planFeatures = getPaidFeatures(t, selectedTier)
const currency = CURRENCIES[currencyCode]
@@ -93,7 +93,7 @@ const Pricing = ({ authenticated, isBillingPage }: PricingProps) => {
const index = Number(e.target.value)
const planCode = PLAN_CODES_ARRAY[index]
- // @ts-ignore
+ // @ts-expect-error
setSelectedTier(PLAN_LIMITS[planCode])
}
@@ -157,7 +157,7 @@ const Pricing = ({ authenticated, isBillingPage }: PricingProps) => {
setPlanCodeLoading(tier.planCode)
- // @ts-ignore
+ // @ts-expect-error
if (!window.Paddle) {
toast.error('Payment script has not yet loaded! Please, try again.')
setPlanCodeLoading(null)
@@ -168,7 +168,7 @@ const Pricing = ({ authenticated, isBillingPage }: PricingProps) => {
user.referrerID && (user.planCode === 'trial' || user.planCode === 'none') && !user.cancellationEffectiveDate
const coupon = discountMayBeApplied ? REFERRAL_DISCOUNT_CODE : undefined
- // @ts-ignore
+ // @ts-expect-error
window.Paddle.Checkout.open({
product: billingFrequency === BillingFrequency.monthly ? tier.pid : tier.ypid,
email: user.email,
@@ -228,7 +228,7 @@ const Pricing = ({ authenticated, isBillingPage }: PricingProps) => {
}
}
- // @ts-ignore
+ // @ts-expect-error
const userPlancodeID = PLAN_LIMITS[user.planCode]?.index
const planCodeID = selectedTier.index
const downgrade = planCodeID < userPlancodeID
@@ -262,7 +262,7 @@ const Pricing = ({ authenticated, isBillingPage }: PricingProps) => {
})}
>
<div className='sm:align-center sm:flex sm:flex-col'>
- {!authenticated && (
+ {!authenticated ? (
<>
<h2 className='font-sans text-4xl font-extrabold text-gray-900 sm:text-center dark:text-gray-50'>
{t('pricing.title')}
@@ -273,7 +273,7 @@ const Pricing = ({ authenticated, isBillingPage }: PricingProps) => {
})}
</p>
</>
- )}
+ ) : null}
<div className='flex justify-between'>
<div>
<h3 className='text-lg font-medium tracking-tight text-gray-900 dark:text-gray-50'>
@@ -334,7 +334,7 @@ const Pricing = ({ authenticated, isBillingPage }: PricingProps) => {
onChange={onSelectPlanChange}
/>
<div className='relative mt-5 divide-y rounded-2xl border ring-1 ring-gray-200 dark:ring-slate-700'>
- {user.planCode === selectedTier.planCode && (
+ {user.planCode === selectedTier.planCode ? (
<div className='absolute top-0 left-5 translate-y-px transform'>
<div className='flex -translate-y-1/2 transform justify-center'>
<span className='inline-flex rounded-full bg-indigo-600 px-4 py-1 text-sm font-semibold tracking-wider text-white uppercase'>
@@ -342,8 +342,8 @@ const Pricing = ({ authenticated, isBillingPage }: PricingProps) => {
</span>
</div>
</div>
- )}
- {selectedTier.legacy && (
+ ) : null}
+ {selectedTier.legacy ? (
<div className='absolute top-0 right-5 translate-y-px transform'>
<div className='flex -translate-y-1/2 transform justify-center'>
<span className='inline-flex rounded-full bg-amber-400 px-2 py-1 text-sm font-semibold tracking-wider text-white uppercase'>
@@ -351,7 +351,7 @@ const Pricing = ({ authenticated, isBillingPage }: PricingProps) => {
</span>
</div>
</div>
- )}
+ ) : null}
<div className='border-none p-6'>
<ClientOnly fallback={<Loader />}>
{() => (
@@ -426,7 +426,7 @@ const Pricing = ({ authenticated, isBillingPage }: PricingProps) => {
values={{
amount: 10,
}}
- // @ts-ignore
+ // @ts-expect-error
components={{
url: (
<Link
@@ -478,8 +478,8 @@ const Pricing = ({ authenticated, isBillingPage }: PricingProps) => {
isLoading={isSubUpdating}
message={
<>
- {subUpdatePreview === null && <Loader />}
- {subUpdatePreview === false && (
+ {subUpdatePreview === null ? <Loader /> : null}
+ {subUpdatePreview === false ? (
<p className='whitespace-pre-line'>
<Trans
t={t}
@@ -498,8 +498,8 @@ const Pricing = ({ authenticated, isBillingPage }: PricingProps) => {
}}
/>
</p>
- )}
- {subUpdatePreview && (
+ ) : null}
+ {subUpdatePreview ? (
<div>
<h2 className='text-base font-bold'>{t('billing.dueNow')}</h2>
<p className='text-sm'>{t('billing.dueNowDescription')}</p>
@@ -535,7 +535,7 @@ const Pricing = ({ authenticated, isBillingPage }: PricingProps) => {
</tbody>
</table>
</div>
- {subUpdatePreview.immediatePayment.amount < 0 && (
+ {subUpdatePreview.immediatePayment.amount < 0 ? (
<p className='mt-2 italic'>
{t('billing.negativePayment', {
currency: subUpdatePreview.immediatePayment.symbol,
@@ -547,7 +547,7 @@ const Pricing = ({ authenticated, isBillingPage }: PricingProps) => {
nextPaymentAmount: subUpdatePreview.nextPayment.amount,
})}
</p>
- )}
+ ) : null}
<h2 className='mt-5 text-base font-bold'>{t('billing.nextPayment')}</h2>
<div className='mt-2 overflow-hidden ring-1 ring-black/5 md:rounded-lg'>
<table className='200 min-w-full divide-y divide-gray-300 dark:divide-gray-500'>
@@ -582,7 +582,7 @@ const Pricing = ({ authenticated, isBillingPage }: PricingProps) => {
</table>
</div>
</div>
- )}
+ ) : null}
</>
}
isOpened={isNewPlanConfirmationModalOpened}
diff --git a/web/app/entry.client.tsx b/web/app/entry.client.tsx
index 67b8fd113..d76979981 100644
--- a/web/app/entry.client.tsx
+++ b/web/app/entry.client.tsx
@@ -1,16 +1,18 @@
-import { HydratedRouter } from 'react-router/dom'
-import { startTransition, StrictMode } from 'react'
-import { hydrateRoot } from 'react-dom/client'
-
import i18next from 'i18next'
-import { I18nextProvider, initReactI18next } from 'react-i18next'
import LanguageDetector from 'i18next-browser-languagedetector'
import HTTPBackend from 'i18next-http-backend'
+import { startTransition, StrictMode } from 'react'
+import { hydrateRoot } from 'react-dom/client'
+import { I18nextProvider, initReactI18next } from 'react-i18next'
+import { HydratedRouter } from 'react-router/dom'
import { getInitialNamespaces } from 'remix-i18next/client'
-import i18n from './i18n'
+
import { I18N_CACHE_BREAKER } from '~/lib/constants'
+import i18n from './i18n'
+
async function hydrate() {
+ // eslint-disable-next-line import/no-named-as-default-member
await i18next
.use(initReactI18next)
.use(LanguageDetector)
diff --git a/web/app/entry.server.tsx b/web/app/entry.server.tsx
index 26ab36548..34495f453 100644
--- a/web/app/entry.server.tsx
+++ b/web/app/entry.server.tsx
@@ -1,18 +1,19 @@
-import type { EntryContext } from 'react-router'
-import { PassThrough } from 'node:stream'
import { resolve as feResolve } from 'node:path'
-import { createInstance } from 'i18next'
-import { I18nextProvider, initReactI18next } from 'react-i18next'
+import { PassThrough } from 'node:stream'
+
import { createReadableStreamFromReadable } from '@react-router/node'
+import { createInstance } from 'i18next'
import FSBackend from 'i18next-fs-backend'
-import { ServerRouter } from 'react-router'
import { isbot } from 'isbot'
import { renderToPipeableStream } from 'react-dom/server'
+import { I18nextProvider, initReactI18next } from 'react-i18next'
+import { ServerRouter } from 'react-router'
+import type { EntryContext } from 'react-router'
import { createSitemapGenerator } from 'remix-sitemap'
-import { MAIN_URL } from './lib/constants'
-import i18next from './i18next.server'
import i18n, { detectLanguage } from './i18n'
+import i18next from './i18next.server'
+import { MAIN_URL } from './lib/constants'
// Reject/cancel all pending promises after 5 seconds
const streamTimeout = 5000
@@ -30,7 +31,7 @@ export default async function handleRequest(
reactRouterContext: EntryContext,
) {
if (isSitemapUrl(request)) {
- // @ts-ignore
+ // @ts-expect-error
const stm = await sitemap(request, reactRouterContext)
return stm
}
diff --git a/web/app/hoc/protected.tsx b/web/app/hoc/protected.tsx
index 71c3f442c..143a43d0b 100644
--- a/web/app/hoc/protected.tsx
+++ b/web/app/hoc/protected.tsx
@@ -1,19 +1,17 @@
-import React, { useEffect, useRef } from 'react'
+import { useEffect, useRef } from 'react'
import { useSelector } from 'react-redux'
import { useNavigate } from 'react-router'
-import { getAccessToken } from '~/utils/accessToken'
import { StateType } from '~/lib/store'
+import { getAccessToken } from '~/utils/accessToken'
import routes from '~/utils/routes'
-type AuthParamType = {
+interface AuthParamType {
shouldBeAuthenticated: boolean
redirectPath: string
}
-type PropsType = {
- [key: string]: any
-}
+type PropsType = Record<string, any>
export const auth = {
authenticated: {
diff --git a/web/app/hooks/useFeatureFlag.ts b/web/app/hooks/useFeatureFlag.ts
index b7ef6d0dd..9776a6cf3 100644
--- a/web/app/hooks/useFeatureFlag.ts
+++ b/web/app/hooks/useFeatureFlag.ts
@@ -1,6 +1,7 @@
import { useSelector } from 'react-redux'
-import { StateType } from '~/lib/store'
+
import { FeatureFlag } from '~/lib/models/User'
+import { StateType } from '~/lib/store'
const useFeatureFlag = (flag: FeatureFlag): boolean => {
const { user } = useSelector((state: StateType) => state.auth)
diff --git a/web/app/hooks/useOnClickOutside.ts b/web/app/hooks/useOnClickOutside.ts
index 352189101..5deeb7bd1 100644
--- a/web/app/hooks/useOnClickOutside.ts
+++ b/web/app/hooks/useOnClickOutside.ts
@@ -1,6 +1,9 @@
import React, { useEffect } from 'react'
-const useOnClickOutside = (ref: React.RefObject<HTMLDivElement | HTMLUListElement>, handler: Function) => {
+const useOnClickOutside = (
+ ref: React.RefObject<HTMLDivElement | HTMLUListElement>,
+ handler: (event: MouseEvent | TouchEvent) => void,
+) => {
useEffect(() => {
const func = (event: MouseEvent | TouchEvent) => {
if (!ref.current || ref.current.contains(event.target as Node)) {
diff --git a/web/app/hooks/usePagination.tsx b/web/app/hooks/usePagination.tsx
index 993a5dc2a..0c9e37f15 100644
--- a/web/app/hooks/usePagination.tsx
+++ b/web/app/hooks/usePagination.tsx
@@ -1,4 +1,5 @@
import { useMemo } from 'react'
+
import { ENTRIES_PER_PAGE_DASHBOARD } from '~/lib/constants'
export const DOTS = '...'
@@ -11,7 +12,7 @@ const range = (start: number, end: number) => {
export const usePagination = (
totalCount: number,
currentPage: number,
- siblingCount: number = 1,
+ siblingCount = 1,
pageSize: number = ENTRIES_PER_PAGE_DASHBOARD,
): any[] => {
const paginationRange = useMemo(() => {
diff --git a/web/app/hooks/useSize.ts b/web/app/hooks/useSize.ts
index aa41cb58c..afed85597 100644
--- a/web/app/hooks/useSize.ts
+++ b/web/app/hooks/useSize.ts
@@ -1,7 +1,7 @@
/* eslint-disable consistent-return */
+import _get from 'lodash/get'
import type { MutableRefObject } from 'react'
import { useEffect, useRef, useState } from 'react'
-import _get from 'lodash/get'
const useSize = (): [MutableRefObject<null>, { width: number; height: number }] => {
const [size, setSize] = useState({
diff --git a/web/app/i18next.server.ts b/web/app/i18next.server.ts
index 31055c963..64fdd9e56 100644
--- a/web/app/i18next.server.ts
+++ b/web/app/i18next.server.ts
@@ -1,7 +1,10 @@
-import { RemixI18Next } from 'remix-i18next/server'
-import Backend from 'i18next-fs-backend'
import { resolve } from 'node:path'
+
+import Backend from 'i18next-fs-backend'
+import { RemixI18Next } from 'remix-i18next/server'
+
import { defaultLanguage, whitelist } from '~/lib/constants'
+
import i18n from './i18n'
const i18next = new RemixI18Next({
diff --git a/web/app/lib/constants/index.ts b/web/app/lib/constants/index.ts
index 2a55a43d8..c45802f4b 100644
--- a/web/app/lib/constants/index.ts
+++ b/web/app/lib/constants/index.ts
@@ -1,5 +1,6 @@
-/* eslint-disable no-undef */
+import { t as i18nextT } from 'i18next'
import _endsWith from 'lodash/endsWith'
+
import { Role } from '~/lib/models/Organisation'
const displayDateOptions: Intl.DateTimeFormatOptions = {
@@ -8,7 +9,7 @@ const displayDateOptions: Intl.DateTimeFormatOptions = {
day: 'numeric',
}
-const getCustomLabel = (dates: Date[], t: Function, language?: string): string => {
+const getCustomLabel = (dates: Date[], t: typeof i18nextT, language?: string): string => {
if (dates) {
let from: string
let to: string
@@ -45,7 +46,7 @@ export interface TBPeriodPairsProps {
}
export const tbPeriodPairs = (
- t: Function,
+ t: typeof i18nextT,
tbs?: string[] | null,
dates?: Date[],
language?: string,
@@ -120,7 +121,7 @@ export const tbPeriodPairs = (
]
export const captchaTbPeriodPairs = (
- t: Function,
+ t: typeof i18nextT,
tbs?: string[] | null,
dates?: Date[],
language?: string,
@@ -198,7 +199,7 @@ export const ERROR_PERIOD_PAIRS = ['1h', '1d', '7d', '4w', '3M', '12M']
export const FUNNELS_PERIOD_PAIRS = ['1h', '1d', '7d', '4w', '3M', '12M', 'custom']
export const tbPeriodPairsCompare = (
- t: Function,
+ t: typeof i18nextT,
dates?: Date[],
language?: string,
): {
@@ -384,11 +385,11 @@ export const getOgImageUrl = (title: string) => {
}
// Cookies
-export const GDPR_REQUEST: string = 'gdpr_request'
-export const CONFIRMATION_TIMEOUT: string = 'confirmation_timeout'
-export const LOW_EVENTS_WARNING: string = 'low_events_warning'
-export const TOKEN: string = 'access_token'
-export const REFRESH_TOKEN: string = 'refresh_token'
+export const GDPR_REQUEST = 'gdpr_request'
+export const CONFIRMATION_TIMEOUT = 'confirmation_timeout'
+export const LOW_EVENTS_WARNING = 'low_events_warning'
+export const TOKEN = 'access_token'
+export const REFRESH_TOKEN = 'refresh_token'
// LocalStorage
export const LS_PROJECTS_PROTECTED = 'projects_protected'
@@ -495,12 +496,13 @@ const GBP = {
code: 'GBP',
}
-type ICurrencies = {
- [key in 'EUR' | 'USD' | 'GBP']: {
+type ICurrencies = Record<
+ 'EUR' | 'USD' | 'GBP',
+ {
symbol: string
code: string
}
-}
+>
export const CURRENCIES: ICurrencies = {
EUR,
diff --git a/web/app/lib/models/Project.ts b/web/app/lib/models/Project.ts
index 27a43695e..06142f2be 100644
--- a/web/app/lib/models/Project.ts
+++ b/web/app/lib/models/Project.ts
@@ -17,9 +17,7 @@ export interface OverallObject {
customEVFilterApplied?: boolean
}
-export interface Overall {
- [key: string]: OverallObject
-}
+export type Overall = Record<string, OverallObject>
export interface OverallPerformanceObject {
current: {
@@ -42,9 +40,7 @@ interface UserShareProject {
id: string
}
-export interface LiveStats {
- [key: string]: number
-}
+export type LiveStats = Record<string, number>
export interface ShareOwnerProject {
id: string
diff --git a/web/app/lib/models/User.ts b/web/app/lib/models/User.ts
index 8a6b4990e..99082be30 100644
--- a/web/app/lib/models/User.ts
+++ b/web/app/lib/models/User.ts
@@ -1,5 +1,5 @@
-import { SharedProject } from './SharedProject'
import { OrganisationMembership } from './Organisation'
+import { SharedProject } from './SharedProject'
export enum DashboardBlockReason {
'exceeding_plan_limits' = 'exceeding_plan_limits',
diff --git a/web/app/lib/reducers/auth.ts b/web/app/lib/reducers/auth.ts
index 21b4abd07..4367d3761 100644
--- a/web/app/lib/reducers/auth.ts
+++ b/web/app/lib/reducers/auth.ts
@@ -1,4 +1,5 @@
import { createSlice, PayloadAction } from '@reduxjs/toolkit'
+
import { User } from '../models/User'
interface AuthState {
diff --git a/web/app/lib/reducers/ui/cache.ts b/web/app/lib/reducers/ui/cache.ts
index aae3d7a54..07ec32ea0 100644
--- a/web/app/lib/reducers/ui/cache.ts
+++ b/web/app/lib/reducers/ui/cache.ts
@@ -1,7 +1,8 @@
import { createSlice, PayloadAction } from '@reduxjs/toolkit'
-import { getItem, removeItem, setItem } from '~/utils/localstorage'
+
import { LS_VIEW_PREFS_SETTING, LS_CAPTCHA_VIEW_PREFS_SETTING, isBrowser } from '~/lib/constants'
import { filterInvalidViewPrefs } from '~/pages/Project/View/utils/filters'
+import { getItem, removeItem, setItem } from '~/utils/localstorage'
const getInitialViewPrefs = (LS_VIEW: string) => {
if (!isBrowser) {
@@ -22,13 +23,14 @@ const getInitialViewPrefs = (LS_VIEW: string) => {
interface InitialState {
captchaProjectsViewPrefs: any
customEventsPrefs: any
- projectViewPrefs: {
- [key: string]: {
+ projectViewPrefs: Record<
+ string,
+ {
period: string
timeBucket: string
rangeDate?: Date[]
}
- } | null
+ > | null
}
const initialState: InitialState = {
@@ -56,13 +58,14 @@ const cacheSlice = createSlice({
period,
timeBucket,
}
- const storedPrefs = getItem(LS_VIEW_PREFS_SETTING) as {
- [key: string]: {
+ const storedPrefs = getItem(LS_VIEW_PREFS_SETTING) as Record<
+ string,
+ {
period: string
timeBucket: string
rangeDate?: Date[]
}
- }
+ >
if (typeof storedPrefs === 'object' && storedPrefs !== null) {
storedPrefs[pid] = viewPrefs
setItem(LS_VIEW_PREFS_SETTING, JSON.stringify(storedPrefs))
@@ -89,13 +92,14 @@ const cacheSlice = createSlice({
period,
timeBucket,
}
- const storedPrefs = getItem(LS_CAPTCHA_VIEW_PREFS_SETTING) as {
- [key: string]: {
+ const storedPrefs = getItem(LS_CAPTCHA_VIEW_PREFS_SETTING) as Record<
+ string,
+ {
period: string
timeBucket: string
rangeDate?: Date[]
}
- }
+ >
if (typeof storedPrefs === 'object' && storedPrefs !== null) {
storedPrefs[pid] = viewPrefs
setItem(LS_CAPTCHA_VIEW_PREFS_SETTING, JSON.stringify(storedPrefs))
diff --git a/web/app/lib/reducers/ui/misc.ts b/web/app/lib/reducers/ui/misc.ts
index 848e169a1..e096b4e3a 100644
--- a/web/app/lib/reducers/ui/misc.ts
+++ b/web/app/lib/reducers/ui/misc.ts
@@ -1,9 +1,10 @@
import { createSlice, PayloadAction } from '@reduxjs/toolkit'
+
import { LOW_EVENTS_WARNING, LS_PROJECTS_PROTECTED } from '~/lib/constants'
+import { Metainfo } from '~/lib/models/Metainfo'
+import { Stats } from '~/lib/models/Stats'
import { setCookie } from '~/utils/cookie'
import { secondsTillNextMonth } from '~/utils/generic'
-import { Stats } from '~/lib/models/Stats'
-import { Metainfo } from '~/lib/models/Metainfo'
import { getItem, setItem } from '~/utils/localstorage'
interface InitialState {
@@ -14,9 +15,7 @@ interface InitialState {
showNoEventsLeftBanner: boolean
lastBlogPost: any
extensions: any[]
- projectPasswords: {
- [key: string]: string
- }
+ projectPasswords: Record<string, string>
}
const initialState: InitialState = {
diff --git a/web/app/lib/reducers/ui/theme.ts b/web/app/lib/reducers/ui/theme.ts
index 87b8725d1..02471971d 100644
--- a/web/app/lib/reducers/ui/theme.ts
+++ b/web/app/lib/reducers/ui/theme.ts
@@ -1,7 +1,8 @@
import { createSlice, PayloadAction } from '@reduxjs/toolkit'
import _includes from 'lodash/includes'
-import { setCookie, getCookie } from '~/utils/cookie'
+
import { isBrowser, LS_THEME_SETTING, SUPPORTED_THEMES, ThemeType } from '~/lib/constants'
+import { setCookie, getCookie } from '~/utils/cookie'
const setThemeToDOM = (theme: string) => {
if (!isBrowser) {
diff --git a/web/app/lib/store/index.ts b/web/app/lib/store/index.ts
index 942cbff7f..036325ce9 100644
--- a/web/app/lib/store/index.ts
+++ b/web/app/lib/store/index.ts
@@ -1,10 +1,12 @@
import { combineReducers, configureStore } from '@reduxjs/toolkit'
import { useDispatch } from 'react-redux'
+
import { isDevelopment } from '~/lib/constants'
+
import authSlice from '../reducers/auth'
+import cacheSlice from '../reducers/ui/cache'
import miscSlice from '../reducers/ui/misc'
import themeSlice from '../reducers/ui/theme'
-import cacheSlice from '../reducers/ui/cache'
const rootReducer = combineReducers({
auth: authSlice,
diff --git a/web/app/modals/NewFunnel.tsx b/web/app/modals/NewFunnel.tsx
index e72bc2301..9f36d4680 100644
--- a/web/app/modals/NewFunnel.tsx
+++ b/web/app/modals/NewFunnel.tsx
@@ -1,18 +1,18 @@
-import React, { useState, useEffect, useMemo } from 'react'
-import _map from 'lodash/map'
+import cx from 'clsx'
import _every from 'lodash/every'
import _isUndefined from 'lodash/isUndefined'
-import cx from 'clsx'
+import _map from 'lodash/map'
+import { Trash2Icon } from 'lucide-react'
+import { useState, useEffect, useMemo } from 'react'
import { useTranslation } from 'react-i18next'
-import Modal from '~/ui/Modal'
-import Input from '~/ui/Input'
-import Combobox from '~/ui/Combobox'
-import { MIN_FUNNEL_STEPS, MAX_FUNNEL_STEPS } from '~/lib/constants'
import { getFilters } from '~/api'
+import { MIN_FUNNEL_STEPS, MAX_FUNNEL_STEPS } from '~/lib/constants'
import { Funnel } from '~/lib/models/Project'
import { ProjectForShared } from '~/lib/models/SharedProject'
-import { Trash2Icon } from 'lucide-react'
+import Combobox from '~/ui/Combobox'
+import Input from '~/ui/Input'
+import Modal from '~/ui/Modal'
interface NewFunnelProps {
project: ProjectForShared
@@ -137,7 +137,7 @@ const NewFunnel = ({
title={step || ''}
disabled={!allowedToManage}
/>
- {steps.length > MIN_FUNNEL_STEPS && allowedToManage && (
+ {steps.length > MIN_FUNNEL_STEPS && allowedToManage ? (
<Trash2Icon
role='button'
aria-label='Remove step'
@@ -149,20 +149,20 @@ const NewFunnel = ({
}}
strokeWidth={1.5}
/>
- )}
+ ) : null}
</div>
))}
- {steps.length < MAX_FUNNEL_STEPS && allowedToManage && (
- <p
+ {steps.length < MAX_FUNNEL_STEPS && allowedToManage ? (
+ <button
+ type='button'
onClick={() => {
setSteps([...steps, null])
}}
- role='button'
className='mt-2 cursor-pointer text-indigo-600 hover:text-indigo-500 dark:text-indigo-400 dark:hover:text-indigo-500'
>
+ {t('modals.funnels.addStep')}
- </p>
- )}
+ </button>
+ ) : null}
</div>
}
title={funnel ? t('modals.funnels.editTitle') : t('modals.funnels.addTitle')}
diff --git a/web/app/modals/PaidFeature.tsx b/web/app/modals/PaidFeature.tsx
index 5f02bc62b..bae991268 100644
--- a/web/app/modals/PaidFeature.tsx
+++ b/web/app/modals/PaidFeature.tsx
@@ -1,6 +1,5 @@
-import React from 'react'
-import { useNavigate } from 'react-router'
import { useTranslation } from 'react-i18next'
+import { useNavigate } from 'react-router'
import Modal from '~/ui/Modal'
import routes from '~/utils/routes'
diff --git a/web/app/modals/TrackingSnippet.tsx b/web/app/modals/TrackingSnippet.tsx
index 2aef17ae1..dc5eef560 100644
--- a/web/app/modals/TrackingSnippet.tsx
+++ b/web/app/modals/TrackingSnippet.tsx
@@ -1,10 +1,9 @@
-import React from 'react'
import { useTranslation, Trans } from 'react-i18next'
-import Modal from '~/ui/Modal'
+import { API_URL, isSelfhosted } from '~/lib/constants'
import { Badge } from '~/ui/Badge'
+import Modal from '~/ui/Modal'
import Textarea from '~/ui/Textarea'
-import { API_URL, isSelfhosted } from '~/lib/constants'
const API_URL_WITHOUT_TRAILING_SLASH = API_URL.endsWith('/') ? API_URL.slice(0, -1) : API_URL
diff --git a/web/app/modals/ViewProjectHotkeys.tsx b/web/app/modals/ViewProjectHotkeys.tsx
index 42c8d7c0b..dbce36eca 100644
--- a/web/app/modals/ViewProjectHotkeys.tsx
+++ b/web/app/modals/ViewProjectHotkeys.tsx
@@ -1,10 +1,10 @@
-import React, { useMemo } from 'react'
-import { useTranslation } from 'react-i18next'
import { TFunction } from 'i18next'
import _map from 'lodash/map'
+import { useMemo } from 'react'
+import { useTranslation } from 'react-i18next'
-import Modal from '~/ui/Modal'
import { Badge } from '~/ui/Badge'
+import Modal from '~/ui/Modal'
interface ViewProjectHotkeysProps {
onClose: () => void
@@ -13,7 +13,7 @@ interface ViewProjectHotkeysProps {
interface HotkeysListProps {
title: string
- hotkeys: { [key: string]: string }
+ hotkeys: Record<string, string>
}
const getHotkeys = (t: TFunction) => ({
diff --git a/web/app/pages/About/index.tsx b/web/app/pages/About/index.tsx
index 872e00072..c081b42bc 100644
--- a/web/app/pages/About/index.tsx
+++ b/web/app/pages/About/index.tsx
@@ -1,13 +1,11 @@
-import React from 'react'
+import { SiGithub, SiX } from '@icons-pack/react-simple-icons'
import _map from 'lodash/map'
+import React from 'react'
import { CONTACT_EMAIL, GITHUB_URL } from '~/lib/constants'
-import { SiGithub, SiX } from '@icons-pack/react-simple-icons'
import LinkedIn from '~/ui/icons/LinkedIn'
-const socialIcons: {
- [key: string]: React.ReactNode
-} = {
+const socialIcons: Record<string, React.ReactNode> = {
LinkedIn: <LinkedIn className='h-6 w-6' />,
Github: <SiGithub className='h-6 w-6' />,
Twitter: <SiX className='h-6 w-6' />,
@@ -17,9 +15,7 @@ interface TeammateProps {
photo: string
name: string
role: string
- socials: {
- [key: string]: string
- }
+ socials: Record<string, string>
desc: string
}
diff --git a/web/app/pages/Auth/ChangeEmail/index.tsx b/web/app/pages/Auth/ChangeEmail/index.tsx
index deba5593d..2daf8609e 100644
--- a/web/app/pages/Auth/ChangeEmail/index.tsx
+++ b/web/app/pages/Auth/ChangeEmail/index.tsx
@@ -1,8 +1,8 @@
-import { useState, useEffect } from 'react'
-import { useParams, Link } from 'react-router'
-import { useTranslation } from 'react-i18next'
import { CheckCircleIcon, XCircleIcon } from '@heroicons/react/24/solid'
import _isString from 'lodash/isString'
+import { useState, useEffect } from 'react'
+import { useTranslation } from 'react-i18next'
+import { useParams, Link } from 'react-router'
import { confirmChangeEmail } from '~/api'
import Loader from '~/ui/Loader'
diff --git a/web/app/pages/Auth/CheckYourInbox/CheckYourInbox.tsx b/web/app/pages/Auth/CheckYourInbox/CheckYourInbox.tsx
index 884ca9648..ee8c9db61 100644
--- a/web/app/pages/Auth/CheckYourInbox/CheckYourInbox.tsx
+++ b/web/app/pages/Auth/CheckYourInbox/CheckYourInbox.tsx
@@ -1,15 +1,15 @@
-import React, { useMemo, useEffect } from 'react'
-import { useNavigate } from 'react-router'
-import { useTranslation, Trans } from 'react-i18next'
import { EnvelopeIcon } from '@heroicons/react/24/outline'
+import { useMemo, useEffect } from 'react'
+import { useTranslation, Trans } from 'react-i18next'
import { useSelector } from 'react-redux'
+import { useNavigate } from 'react-router'
-import Loader from '~/ui/Loader'
import { withAuthentication } from '~/hoc/protected'
import { authActions } from '~/lib/reducers/auth'
import { StateType, useAppDispatch } from '~/lib/store'
-import routes from '~/utils/routes'
+import Loader from '~/ui/Loader'
import { logout } from '~/utils/auth'
+import routes from '~/utils/routes'
const CheckYourInbox = () => {
const { t } = useTranslation('common')
@@ -63,6 +63,7 @@ const CheckYourInbox = () => {
components={{
url: (
<span
+ tabIndex={0}
role='button'
className='cursor-pointer font-medium text-indigo-600 hover:underline dark:text-indigo-400'
onClick={() => {
diff --git a/web/app/pages/Auth/CreateNewPassword/CreateNewPassword.tsx b/web/app/pages/Auth/CreateNewPassword/CreateNewPassword.tsx
index 78fef4a13..2c945b243 100644
--- a/web/app/pages/Auth/CreateNewPassword/CreateNewPassword.tsx
+++ b/web/app/pages/Auth/CreateNewPassword/CreateNewPassword.tsx
@@ -1,16 +1,16 @@
+import _isEmpty from 'lodash/isEmpty'
+import _keys from 'lodash/keys'
+import _size from 'lodash/size'
import React, { useState, useEffect } from 'react'
-import { Link, useNavigate, useParams } from 'react-router'
import { useTranslation, Trans } from 'react-i18next'
-import _size from 'lodash/size'
-import _keys from 'lodash/keys'
-import _isEmpty from 'lodash/isEmpty'
+import { Link, useNavigate, useParams } from 'react-router'
import { toast } from 'sonner'
import { createNewPassword } from '~/api'
import { withAuthentication, auth } from '~/hoc/protected'
-import routes from '~/utils/routes'
-import Input from '~/ui/Input'
import Button from '~/ui/Button'
+import Input from '~/ui/Input'
+import routes from '~/utils/routes'
import { isValidPassword, MIN_PASSWORD_CHARS, MAX_PASSWORD_CHARS } from '~/utils/validator'
interface FormSubmitData {
@@ -116,7 +116,7 @@ const CreateNewPassword = () => {
hint={t('auth.common.hint', { amount: MIN_PASSWORD_CHARS })}
value={form.password}
onChange={handleInput}
- error={beenSubmitted && errors.password}
+ error={beenSubmitted ? errors.password : null}
/>
<Input
name='repeat'
@@ -124,7 +124,7 @@ const CreateNewPassword = () => {
label={t('auth.common.repeat')}
value={form.repeat}
onChange={handleInput}
- error={beenSubmitted && errors.repeat}
+ error={beenSubmitted ? errors.repeat : null}
/>
<Button className='w-full justify-center' type='submit' loading={isLoading} primary giant>
{t('auth.recovery.save')}
diff --git a/web/app/pages/Auth/ForgotPassword/ForgotPassword.tsx b/web/app/pages/Auth/ForgotPassword/ForgotPassword.tsx
index cedc1ba81..e628a0226 100644
--- a/web/app/pages/Auth/ForgotPassword/ForgotPassword.tsx
+++ b/web/app/pages/Auth/ForgotPassword/ForgotPassword.tsx
@@ -1,16 +1,16 @@
+import _isEmpty from 'lodash/isEmpty'
+import _keys from 'lodash/keys'
import React, { useState, useEffect } from 'react'
-import { Link, useNavigate } from 'react-router'
import { useTranslation, Trans } from 'react-i18next'
-import _keys from 'lodash/keys'
-import _isEmpty from 'lodash/isEmpty'
+import { Link, useNavigate } from 'react-router'
import { toast } from 'sonner'
import { forgotPassword } from '~/api'
import { withAuthentication, auth } from '~/hoc/protected'
-import routes from '~/utils/routes'
-import Input from '~/ui/Input'
-import Button from '~/ui/Button'
import { TRIAL_DAYS } from '~/lib/constants'
+import Button from '~/ui/Button'
+import Input from '~/ui/Input'
+import routes from '~/utils/routes'
import { isValidEmail } from '~/utils/validator'
const ForgotPassword = () => {
@@ -100,7 +100,7 @@ const ForgotPassword = () => {
label={t('auth.common.email')}
value={form.email}
onChange={handleInput}
- error={beenSubmitted && errors.email}
+ error={beenSubmitted ? errors.email : null}
/>
<Button className='w-full justify-center' type='submit' loading={isLoading} primary giant>
{t('auth.forgot.reset')}
diff --git a/web/app/pages/Auth/Signin/Signin.tsx b/web/app/pages/Auth/Signin/Signin.tsx
index c7471555f..a87cd193c 100644
--- a/web/app/pages/Auth/Signin/Signin.tsx
+++ b/web/app/pages/Auth/Signin/Signin.tsx
@@ -1,31 +1,31 @@
-import React, { useState, useEffect, memo } from 'react'
-import { Link, useNavigate, useSearchParams } from 'react-router'
-import { useTranslation, Trans } from 'react-i18next'
-import _keys from 'lodash/keys'
-import _omit from 'lodash/omit'
import _isEmpty from 'lodash/isEmpty'
import _isString from 'lodash/isString'
+import _keys from 'lodash/keys'
+import _omit from 'lodash/omit'
+import React, { useState, useEffect, memo } from 'react'
+import { useTranslation, Trans } from 'react-i18next'
+import { Link, useNavigate, useSearchParams } from 'react-router'
import { toast } from 'sonner'
-import GoogleAuth from '~/components/GoogleAuth'
+import { generateSSOAuthURL, getInstalledExtensions, getJWTBySSOHash, login, submit2FA } from '~/api'
import GithubAuth from '~/components/GithubAuth'
+import GoogleAuth from '~/components/GoogleAuth'
import { withAuthentication, auth } from '~/hoc/protected'
-import routes from '~/utils/routes'
-import Input from '~/ui/Input'
+import { isSelfhosted, REFERRAL_COOKIE, TRIAL_DAYS } from '~/lib/constants'
+import { SSOProvider } from '~/lib/models/Auth'
+import { authActions } from '~/lib/reducers/auth'
+import UIActions from '~/lib/reducers/ui'
+import { useAppDispatch } from '~/lib/store'
import Button from '~/ui/Button'
import Checkbox from '~/ui/Checkbox'
-import { isValidEmail, isValidPassword, MIN_PASSWORD_CHARS } from '~/utils/validator'
-import { isSelfhosted, REFERRAL_COOKIE, TRIAL_DAYS } from '~/lib/constants'
-import { generateSSOAuthURL, getInstalledExtensions, getJWTBySSOHash, login, submit2FA } from '~/api'
+import Input from '~/ui/Input'
import { setAccessToken, removeAccessToken } from '~/utils/accessToken'
-import { setRefreshToken, removeRefreshToken } from '~/utils/refreshToken'
-import { useAppDispatch } from '~/lib/store'
-import { authActions } from '~/lib/reducers/auth'
-import { delay, openBrowserWindow } from '~/utils/generic'
-import { deleteCookie, getCookie } from '~/utils/cookie'
import { shouldShowLowEventsBanner } from '~/utils/auth'
-import UIActions from '~/lib/reducers/ui'
-import { SSOProvider } from '~/lib/models/Auth'
+import { deleteCookie, getCookie } from '~/utils/cookie'
+import { delay, openBrowserWindow } from '~/utils/generic'
+import { setRefreshToken, removeRefreshToken } from '~/utils/refreshToken'
+import routes from '~/utils/routes'
+import { isValidEmail, isValidPassword, MIN_PASSWORD_CHARS } from '~/utils/validator'
interface SigninForm {
email: string
@@ -147,7 +147,7 @@ const Signin = ({ ssrTheme }: SigninProps) => {
navigate(routes.dashboard)
return
- } catch (reason) {
+ } catch {
// Authentication is not finished yet
}
@@ -278,7 +278,7 @@ const Signin = ({ ssrTheme }: SigninProps) => {
/>
<div className='mt-3 flex justify-between'>
<div className='font-mono text-sm whitespace-pre-line text-gray-600 dark:text-gray-400'>
- {!isSelfhosted && (
+ {!isSelfhosted ? (
<Trans
t={t}
i18nKey='auth.signin.2faUnavailable'
@@ -289,7 +289,7 @@ const Signin = ({ ssrTheme }: SigninProps) => {
),
}}
/>
- )}
+ ) : null}
</div>
<Button type='submit' loading={isLoading} primary large>
{t('common.continue')}
@@ -341,7 +341,7 @@ const Signin = ({ ssrTheme }: SigninProps) => {
name='dontRemember'
label={t('auth.common.noRemember')}
/>
- {!isSelfhosted && (
+ {!isSelfhosted ? (
<div className='text-sm leading-6'>
<Link
to={routes.reset_password}
@@ -350,7 +350,7 @@ const Signin = ({ ssrTheme }: SigninProps) => {
{t('auth.signin.forgot')}
</Link>
</div>
- )}
+ ) : null}
</div>
<Button className='w-full justify-center' type='submit' loading={isLoading} primary giant>
@@ -358,7 +358,7 @@ const Signin = ({ ssrTheme }: SigninProps) => {
</Button>
</form>
- {!isSelfhosted && (
+ {!isSelfhosted ? (
<div>
<div className='relative mt-10'>
<div className='absolute inset-0 flex items-center' aria-hidden='true'>
@@ -375,10 +375,10 @@ const Signin = ({ ssrTheme }: SigninProps) => {
<GithubAuth onClick={() => onSsoLogin('github')} ssrTheme={ssrTheme} disabled={isLoading} />
</div>
</div>
- )}
+ ) : null}
</div>
- {!isSelfhosted && (
+ {!isSelfhosted ? (
<p className='mt-10 mb-4 text-center text-sm text-gray-500 dark:text-gray-200'>
<Trans
t={t}
@@ -398,7 +398,7 @@ const Signin = ({ ssrTheme }: SigninProps) => {
}}
/>
</p>
- )}
+ ) : null}
</div>
</div>
)
diff --git a/web/app/pages/Auth/Signup/Signup.tsx b/web/app/pages/Auth/Signup/Signup.tsx
index bca0bf065..9ba97848a 100644
--- a/web/app/pages/Auth/Signup/Signup.tsx
+++ b/web/app/pages/Auth/Signup/Signup.tsx
@@ -1,32 +1,32 @@
+import _isEmpty from 'lodash/isEmpty'
+import _keys from 'lodash/keys'
+import _size from 'lodash/size'
import React, { useState, useEffect } from 'react'
-import { Link, useNavigate } from 'react-router'
import { useTranslation, Trans } from 'react-i18next'
-import _size from 'lodash/size'
-import _keys from 'lodash/keys'
-import _isEmpty from 'lodash/isEmpty'
+import { useSelector } from 'react-redux'
+import { Link, useNavigate } from 'react-router'
+import { toast } from 'sonner'
-import { getAccessToken, setAccessToken } from '~/utils/accessToken'
-import GoogleAuth from '~/components/GoogleAuth'
+import { generateSSOAuthURL, getJWTBySSOHash, signup } from '~/api'
import GithubAuth from '~/components/GithubAuth'
-import routes from '~/utils/routes'
-import Input from '~/ui/Input'
+import GoogleAuth from '~/components/GoogleAuth'
+import { HAVE_I_BEEN_PWNED_URL, REFERRAL_COOKIE, TRIAL_DAYS } from '~/lib/constants'
+import { SSOProvider } from '~/lib/models/Auth'
+import { authActions } from '~/lib/reducers/auth'
+import UIActions from '~/lib/reducers/ui'
+import { StateType, useAppDispatch } from '~/lib/store'
+import Button from '~/ui/Button'
import Checkbox from '~/ui/Checkbox'
+import Input from '~/ui/Input'
import Tooltip from '~/ui/Tooltip'
-import Button from '~/ui/Button'
-import { isValidEmail, isValidPassword, MIN_PASSWORD_CHARS, MAX_PASSWORD_CHARS } from '~/utils/validator'
-import { HAVE_I_BEEN_PWNED_URL, REFERRAL_COOKIE, TRIAL_DAYS } from '~/lib/constants'
+import { getAccessToken, setAccessToken } from '~/utils/accessToken'
import { trackCustom } from '~/utils/analytics'
-import { StateType, useAppDispatch } from '~/lib/store'
-import { useSelector } from 'react-redux'
-import { delay, openBrowserWindow } from '~/utils/generic'
-import { toast } from 'sonner'
-import { generateSSOAuthURL, getJWTBySSOHash, signup } from '~/api'
+import { shouldShowLowEventsBanner } from '~/utils/auth'
import { deleteCookie, getCookie } from '~/utils/cookie'
-import { authActions } from '~/lib/reducers/auth'
+import { delay, openBrowserWindow } from '~/utils/generic'
import { setRefreshToken } from '~/utils/refreshToken'
-import { shouldShowLowEventsBanner } from '~/utils/auth'
-import UIActions from '~/lib/reducers/ui'
-import { SSOProvider } from '~/lib/models/Auth'
+import routes from '~/utils/routes'
+import { isValidEmail, isValidPassword, MIN_PASSWORD_CHARS, MAX_PASSWORD_CHARS } from '~/utils/validator'
interface SignupForm {
email: string
@@ -207,7 +207,7 @@ const Signup = ({ ssrTheme }: SignupProps) => {
navigate(routes.dashboard)
return
- } catch (reason) {
+ } catch {
// Authentication is not finished yet
}
diff --git a/web/app/pages/Auth/Socialised/index.tsx b/web/app/pages/Auth/Socialised/index.tsx
index 6030a0e16..ad2246bff 100644
--- a/web/app/pages/Auth/Socialised/index.tsx
+++ b/web/app/pages/Auth/Socialised/index.tsx
@@ -1,9 +1,9 @@
-import { useEffect, useState } from 'react'
-import { Link } from 'react-router'
-import { useTranslation } from 'react-i18next'
import { CheckCircleIcon, XCircleIcon } from '@heroicons/react/24/solid'
-import _split from 'lodash/split'
import _replace from 'lodash/replace'
+import _split from 'lodash/split'
+import { useEffect, useState } from 'react'
+import { useTranslation } from 'react-i18next'
+import { Link } from 'react-router'
import { processSSOToken } from '~/api'
import { SSO_PROVIDERS } from '~/lib/constants'
diff --git a/web/app/pages/Auth/VerifyEmail/index.tsx b/web/app/pages/Auth/VerifyEmail/index.tsx
index 47efe8070..ce1fcf81e 100644
--- a/web/app/pages/Auth/VerifyEmail/index.tsx
+++ b/web/app/pages/Auth/VerifyEmail/index.tsx
@@ -1,14 +1,14 @@
+import { CheckCircleIcon, XCircleIcon } from '@heroicons/react/24/solid'
+import _isString from 'lodash/isString'
import { useState, useEffect } from 'react'
+import { useTranslation } from 'react-i18next'
import { useDispatch } from 'react-redux'
import { useParams, Link } from 'react-router'
-import { useTranslation } from 'react-i18next'
-import { CheckCircleIcon, XCircleIcon } from '@heroicons/react/24/solid'
-import _isString from 'lodash/isString'
-import Loader from '~/ui/Loader'
-import routes from '~/utils/routes'
import { verifyEmail } from '~/api'
import { authActions } from '~/lib/reducers/auth'
+import Loader from '~/ui/Loader'
+import routes from '~/utils/routes'
const VerifyEmail = () => {
const { t } = useTranslation('common')
diff --git a/web/app/pages/Billing/index.tsx b/web/app/pages/Billing/index.tsx
index 5c4de5d18..64e80dc8a 100644
--- a/web/app/pages/Billing/index.tsx
+++ b/web/app/pages/Billing/index.tsx
@@ -1,12 +1,16 @@
-import React, { memo, useMemo, useState, useEffect } from 'react'
-import { useTranslation, Trans } from 'react-i18next'
-import { useSelector } from 'react-redux'
+import { ExclamationTriangleIcon, InformationCircleIcon } from '@heroicons/react/24/outline'
import dayjs from 'dayjs'
-import utc from 'dayjs/plugin/utc'
import duration from 'dayjs/plugin/duration'
-import { ExclamationTriangleIcon, InformationCircleIcon } from '@heroicons/react/24/outline'
+import utc from 'dayjs/plugin/utc'
import _round from 'lodash/round'
+import { memo, useMemo, useState, useEffect } from 'react'
+import { useTranslation, Trans } from 'react-i18next'
+import { useSelector } from 'react-redux'
+import { toast } from 'sonner'
+import { getUsageInfo } from '~/api'
+import DashboardLockedBanner from '~/components/DashboardLockedBanner'
+import { withAuthentication, auth } from '~/hoc/protected'
import {
isSelfhosted,
PADDLE_JS_URL,
@@ -15,20 +19,17 @@ import {
paddleLanguageMapping,
isBrowser,
} from '~/lib/constants'
-import { loadScript } from '~/utils/generic'
-import Loader from '~/ui/Loader'
+import { UsageInfo } from '~/lib/models/Usageinfo'
+import UIActions from '~/lib/reducers/ui'
import { useAppDispatch, StateType } from '~/lib/store'
-import { withAuthentication, auth } from '~/hoc/protected'
-import Modal from '~/ui/Modal'
import Button from '~/ui/Button'
+import Loader from '~/ui/Loader'
+import Modal from '~/ui/Modal'
import MultiProgress from '~/ui/MultiProgress'
import Tooltip from '~/ui/Tooltip'
-import UIActions from '~/lib/reducers/ui'
+import { loadScript } from '~/utils/generic'
+
import Pricing from '../../components/marketing/Pricing'
-import DashboardLockedBanner from '~/components/DashboardLockedBanner'
-import { UsageInfo } from '~/lib/models/Usageinfo'
-import { getUsageInfo } from '~/api'
-import { toast } from 'sonner'
dayjs.extend(utc)
dayjs.extend(duration)
@@ -238,7 +239,7 @@ const Billing = ({ ssrAuthenticated, ssrTheme }: BillingProps) => {
<p className='max-w-prose font-mono text-base tracking-tight text-gray-900 dark:text-gray-50'>
{t('billing.membersNotification')}
</p>
- {isSubscriber && nextBillDate && (
+ {isSubscriber && nextBillDate ? (
<div className='mt-5 max-w-prose rounded-md bg-blue-50 p-4 font-mono dark:bg-blue-600/30'>
<div className='flex'>
<div className='shrink-0'>
@@ -254,8 +255,8 @@ const Billing = ({ ssrAuthenticated, ssrTheme }: BillingProps) => {
</p>
</div>
</div>
- )}
- {cancellationEffectiveDate && (
+ ) : null}
+ {cancellationEffectiveDate ? (
<div className='mt-5 max-w-prose rounded-md bg-blue-50 p-4 font-mono dark:bg-blue-600/30'>
<div className='flex'>
<div className='shrink-0'>
@@ -276,8 +277,8 @@ const Billing = ({ ssrAuthenticated, ssrTheme }: BillingProps) => {
</div>
</div>
</div>
- )}
- {isTrial && trialMessage && (
+ ) : null}
+ {isTrial && trialMessage ? (
<div className='mt-5 max-w-prose rounded-md bg-blue-50 p-4 font-mono dark:bg-blue-600/30'>
<div className='flex'>
<div className='shrink-0'>
@@ -286,8 +287,8 @@ const Billing = ({ ssrAuthenticated, ssrTheme }: BillingProps) => {
<p className='ml-3 text-sm font-medium text-blue-700 dark:text-blue-100'>{trialMessage}</p>
</div>
</div>
- )}
- {isNoSub && (
+ ) : null}
+ {isNoSub ? (
<div className='mt-5 max-w-prose rounded-md bg-red-50 p-4 font-mono dark:bg-red-600/30'>
<div className='flex'>
<div className='shrink-0'>
@@ -303,7 +304,7 @@ const Billing = ({ ssrAuthenticated, ssrTheme }: BillingProps) => {
</div>
</div>
</div>
- )}
+ ) : null}
{isLoading ? (
<Loader />
@@ -311,16 +312,16 @@ const Billing = ({ ssrAuthenticated, ssrTheme }: BillingProps) => {
<div className='mt-8 flex flex-col'>
<Pricing authenticated={authenticated} isBillingPage />
<div className='mt-2 space-y-2'>
- {subUpdateURL && (
+ {subUpdateURL ? (
<Button className='mr-2' onClick={onUpdatePaymentDetails} type='button' primary large>
{t('billing.update')}
</Button>
- )}
- {subCancelURL && (
+ ) : null}
+ {subCancelURL ? (
<Button onClick={() => setIsCancelSubModalOpened(true)} type='button' semiDanger large>
{t('billing.cancelSub')}
</Button>
- )}
+ ) : null}
</div>
</div>
)}
diff --git a/web/app/pages/Blog/Post.tsx b/web/app/pages/Blog/Post.tsx
index c6963691d..75630e8cc 100644
--- a/web/app/pages/Blog/Post.tsx
+++ b/web/app/pages/Blog/Post.tsx
@@ -1,8 +1,9 @@
-import React, { useEffect } from 'react'
+import { useEffect } from 'react'
+import { useTranslation } from 'react-i18next'
import { Link, useLoaderData, useLocation } from 'react-router'
+
import NotFound from '~/pages/NotFound'
import { trackPageview } from '~/utils/analytics'
-import { useTranslation } from 'react-i18next'
interface Post {
slug: string
@@ -81,8 +82,10 @@ export default function PostSlug() {
<ul className='-mx-5 -mt-6 flex flex-wrap text-sm leading-6'>
<li className='mt-6 flex items-center px-5 font-medium whitespace-nowrap'>
<div className='text-sm leading-4'>
- {post?.author && <div className='text-slate-900 dark:text-slate-200'>{post.author}</div>}
- {post?.nickname && (
+ {post?.author ? (
+ <div className='text-slate-900 dark:text-slate-200'>{post.author}</div>
+ ) : null}
+ {post?.nickname ? (
<div className='mt-1'>
<a
href={`https://github.com/${post.nickname}`}
@@ -91,7 +94,7 @@ export default function PostSlug() {
@{post.nickname}
</a>
</div>
- )}
+ ) : null}
</div>
</li>
</ul>
diff --git a/web/app/pages/Captcha/Settings/CaptchaSettings.tsx b/web/app/pages/Captcha/Settings/CaptchaSettings.tsx
index be9c4efe7..aeb09e2ab 100644
--- a/web/app/pages/Captcha/Settings/CaptchaSettings.tsx
+++ b/web/app/pages/Captcha/Settings/CaptchaSettings.tsx
@@ -1,21 +1,21 @@
-import React, { useState, useEffect, memo } from 'react'
-import { Link, useNavigate } from 'react-router'
-import { useTranslation } from 'react-i18next'
-import { toast } from 'sonner'
+import { ExclamationTriangleIcon, XCircleIcon } from '@heroicons/react/24/outline'
import cx from 'clsx'
+import _includes from 'lodash/includes'
import _isEmpty from 'lodash/isEmpty'
-import _size from 'lodash/size'
-import _replace from 'lodash/replace'
-import _join from 'lodash/join'
import _isString from 'lodash/isString'
-import _split from 'lodash/split'
+import _join from 'lodash/join'
import _keys from 'lodash/keys'
import _map from 'lodash/map'
-import _includes from 'lodash/includes'
-import { ExclamationTriangleIcon, XCircleIcon } from '@heroicons/react/24/outline'
+import _replace from 'lodash/replace'
+import _size from 'lodash/size'
+import _split from 'lodash/split'
+import { Trash2Icon } from 'lucide-react'
+import React, { useState, useEffect, memo } from 'react'
+import { useTranslation } from 'react-i18next'
+import { useSelector } from 'react-redux'
+import { Link, useNavigate } from 'react-router'
+import { toast } from 'sonner'
-import { withAuthentication, auth } from '~/hoc/protected'
-import { TITLE_SUFFIX } from '~/lib/constants'
import {
createProject,
updateProject,
@@ -24,18 +24,18 @@ import {
reGenerateCaptchaSecretKey,
getProject,
} from '~/api'
-import Input from '~/ui/Input'
-import Loader from '~/ui/Loader'
+import { withAuthentication, auth } from '~/hoc/protected'
+import { useRequiredParams } from '~/hooks/useRequiredParams'
+import { TITLE_SUFFIX } from '~/lib/constants'
+import { CaptchaProject } from '~/lib/models/Project'
+import { StateType } from '~/lib/store'
import Button from '~/ui/Button'
import Checkbox from '~/ui/Checkbox'
+import Input from '~/ui/Input'
+import Loader from '~/ui/Loader'
import Modal from '~/ui/Modal'
import { trackCustom } from '~/utils/analytics'
import routes from '~/utils/routes'
-import { CaptchaProject } from '~/lib/models/Project'
-import { useRequiredParams } from '~/hooks/useRequiredParams'
-import { useSelector } from 'react-redux'
-import { StateType } from '~/lib/store'
-import { Trash2Icon } from 'lucide-react'
const MAX_NAME_LENGTH = 50
const MAX_ORIGINS_LENGTH = 300
@@ -463,7 +463,7 @@ const CaptchaSettings = ({ isSettings }: CaptchaSettingsProps) => {
</p>
)}
- {!isSettings && (
+ {!isSettings ? (
<div>
<Button
className='mr-2 border-indigo-100 dark:border-slate-700/50 dark:bg-slate-800 dark:text-gray-50 dark:hover:bg-slate-700'
@@ -477,7 +477,7 @@ const CaptchaSettings = ({ isSettings }: CaptchaSettingsProps) => {
{t('common.save')}
</Button>
</div>
- )}
+ ) : null}
</form>
<Modal
onClose={() => setShowDelete(false)}
diff --git a/web/app/pages/Captcha/View/ViewCaptcha.helpers.tsx b/web/app/pages/Captcha/View/ViewCaptcha.helpers.tsx
index 81c38d9ae..792a09e8e 100644
--- a/web/app/pages/Captcha/View/ViewCaptcha.helpers.tsx
+++ b/web/app/pages/Captcha/View/ViewCaptcha.helpers.tsx
@@ -1,12 +1,12 @@
-import React from 'react'
-import type i18next from 'i18next'
-// @ts-ignore
import { LanguageIcon, ArrowRightCircleIcon } from '@heroicons/react/24/outline'
-import dayjs from 'dayjs'
import { area, bar } from 'billboard.js'
import type { ChartOptions } from 'billboard.js'
+import * as d3 from 'd3'
+import dayjs from 'dayjs'
+import type i18next from 'i18next'
import _map from 'lodash/map'
import _size from 'lodash/size'
+import { CompassIcon, FileTextIcon, MapPinIcon, MonitorCog, TabletSmartphoneIcon } from 'lucide-react'
import {
TimeFormat,
@@ -16,10 +16,7 @@ import {
tbsFormatMapperTooltip,
tbsFormatMapperTooltip24h,
} from '~/lib/constants'
-// @ts-ignore
-import * as d3 from 'd3'
import { nFormatter } from '~/utils/generic'
-import { CompassIcon, FileTextIcon, MapPinIcon, MonitorCog, TabletSmartphoneIcon } from 'lucide-react'
const PANELS_ORDER = ['cc', 'br', 'os', 'dv']
@@ -95,11 +92,11 @@ const getSettings = (
tick: {
fit: true,
rotate: rotateXAxis ? 45 : 0,
- // @ts-expect-error
format:
+ // @ts-expect-error
timeFormat === TimeFormat['24-hour']
- ? (x: string) => d3.timeFormat(tbsFormatMapper24h[timeBucket])(x)
- : (x: string) => d3.timeFormat(tbsFormatMapper[timeBucket])(x),
+ ? (x: string) => d3.timeFormat(tbsFormatMapper24h[timeBucket])(x as unknown as Date)
+ : (x: string) => d3.timeFormat(tbsFormatMapper[timeBucket])(x as unknown as Date),
},
localtime: timeFormat === TimeFormat['24-hour'],
type: 'timeseries',
diff --git a/web/app/pages/Captcha/View/ViewCaptcha.tsx b/web/app/pages/Captcha/View/ViewCaptcha.tsx
index 7e81c4d09..4bd4a3642 100644
--- a/web/app/pages/Captcha/View/ViewCaptcha.tsx
+++ b/web/app/pages/Captcha/View/ViewCaptcha.tsx
@@ -1,27 +1,28 @@
/* eslint-disable react/no-unstable-nested-components, react/display-name */
-import React, { useState, useEffect, useMemo, memo, useRef } from 'react'
-import { toast } from 'sonner'
-import useSize from '~/hooks/useSize'
-import { useNavigate, useSearchParams } from 'react-router'
-import { ClientOnly } from 'remix-utils/client-only'
-import bb from 'billboard.js'
import { GlobeAltIcon } from '@heroicons/react/24/outline'
+import billboard from 'billboard.js'
import cx from 'clsx'
-import { useTranslation } from 'react-i18next'
-import _keys from 'lodash/keys'
-import _map from 'lodash/map'
+import _filter from 'lodash/filter'
+import _find from 'lodash/find'
import _includes from 'lodash/includes'
-import _last from 'lodash/last'
import _isEmpty from 'lodash/isEmpty'
+import _keys from 'lodash/keys'
+import _last from 'lodash/last'
+import _map from 'lodash/map'
import _replace from 'lodash/replace'
-import _find from 'lodash/find'
-import _filter from 'lodash/filter'
import _startsWith from 'lodash/startsWith'
+import { DownloadIcon, RotateCw, SettingsIcon } from 'lucide-react'
+import { useState, useEffect, useMemo, memo, useRef } from 'react'
+import { useTranslation } from 'react-i18next'
+import { useSelector } from 'react-redux'
+import { useNavigate, useSearchParams } from 'react-router'
+import { ClientOnly } from 'remix-utils/client-only'
+import { toast } from 'sonner'
-import LineChart from '~/ui/icons/LineChart'
-import BarChart from '~/ui/icons/BarChart'
-import { getItem, setItem } from '~/utils/localstorage'
+import { getProject, getCaptchaData } from '~/api'
import EventsRunningOutBanner from '~/components/EventsRunningOutBanner'
+import { useRequiredParams } from '~/hooks/useRequiredParams'
+import useSize from '~/hooks/useSize'
import {
captchaTbPeriodPairs,
timeBucketToDays,
@@ -38,12 +39,25 @@ import {
DEFAULT_TIMEZONE,
} from '~/lib/constants'
import { CaptchaProject } from '~/lib/models/Project'
-import Loader from '~/ui/Loader'
+import UIActions from '~/lib/reducers/ui'
+import { StateType, useAppDispatch } from '~/lib/store'
+import { Panel } from '~/pages/Project/View/Panels'
+import { parseFiltersFromUrl } from '~/pages/Project/View/utils/filters'
+import { ViewProjectContext } from '~/pages/Project/View/ViewProject'
+import { deviceIconMapping, onCSVExportClick } from '~/pages/Project/View/ViewProject.helpers'
import Dropdown from '~/ui/Dropdown'
import FlatPicker from '~/ui/Flatpicker'
+import BarChart from '~/ui/icons/BarChart'
+import LineChart from '~/ui/icons/LineChart'
+import Loader from '~/ui/Loader'
+import { getItem, setItem } from '~/utils/localstorage'
import routes from '~/utils/routes'
-import { getProject, getCaptchaData } from '~/api'
-import { Panel } from '~/pages/Project/View/Panels'
+
+import CCRow from '../../Project/View/components/CCRow'
+
+import Filters from './components/Filters'
+import NoEvents from './components/NoEvents'
+import TBPeriodSelector from './components/TBPeriodSelector'
import {
getFormatDate,
panelIconMapping,
@@ -56,18 +70,6 @@ import {
getColumns,
PANELS_ORDER,
} from './ViewCaptcha.helpers'
-import { deviceIconMapping, onCSVExportClick } from '~/pages/Project/View/ViewProject.helpers'
-import CCRow from '../../Project/View/components/CCRow'
-import NoEvents from './components/NoEvents'
-import { useRequiredParams } from '~/hooks/useRequiredParams'
-import { useSelector } from 'react-redux'
-import { StateType, useAppDispatch } from '~/lib/store'
-import Filters from './components/Filters'
-import TBPeriodSelector from './components/TBPeriodSelector'
-import UIActions from '~/lib/reducers/ui'
-import { DownloadIcon, RotateCw, SettingsIcon } from 'lucide-react'
-import { ViewProjectContext } from '~/pages/Project/View/ViewProject'
-import { parseFiltersFromUrl } from '~/pages/Project/View/utils/filters'
const PageLoader = () => (
<div className='min-h-min-footer bg-gray-50 dark:bg-slate-900'>
@@ -242,7 +244,7 @@ const ViewCaptcha = ({ ssrTheme }: ViewCaptchaProps) => {
setIsPanelsDataEmpty(false)
setMainChart(() => {
- const generete = bb.generate(bbSettings)
+ const generete = billboard.generate(bbSettings)
generete.data.names(dataNames)
return generete
})
@@ -275,7 +277,7 @@ const ViewCaptcha = ({ ssrTheme }: ViewCaptchaProps) => {
}, [areFiltersParsed, filters, authLoading, project, dateRange, period, timeBucket])
// this funtion is used for requesting the data from the API when the filter is changed
- const filterHandler = (column: any, filter: any, isExclusive: boolean = false) => {
+ const filterHandler = (column: any, filter: any, isExclusive = false) => {
let newFilters
// eslint-disable-next-line no-lonely-if
@@ -286,7 +288,7 @@ const ViewCaptcha = ({ ssrTheme }: ViewCaptchaProps) => {
setFilters(newFilters)
// removing filter from the page URL
- // @ts-ignore
+ // @ts-expect-error
const url = new URL(window.location)
url.searchParams.delete(column)
const { pathname, search } = url
@@ -298,7 +300,7 @@ const ViewCaptcha = ({ ssrTheme }: ViewCaptchaProps) => {
setFilters(newFilters)
// storing filter in the page URL
- // @ts-ignore
+ // @ts-expect-error
const url = new URL(window.location)
url.searchParams.append(column, filter)
const { pathname, search } = url
@@ -321,7 +323,7 @@ const ViewCaptcha = ({ ssrTheme }: ViewCaptchaProps) => {
setFilters(newFilters)
// storing exclusive filter in the page URL
- // @ts-ignore
+ // @ts-expect-error
const url = new URL(window.location)
url.searchParams.delete(column)
@@ -342,7 +344,7 @@ const ViewCaptcha = ({ ssrTheme }: ViewCaptchaProps) => {
// Parsing initial filters from the address bar
useEffect(() => {
try {
- // @ts-ignore
+ // @ts-expect-error
const url = new URL(window.location)
const { searchParams } = url
const intialTimeBucket: string = searchParams.get('timeBucket') || ''
@@ -363,7 +365,7 @@ const ViewCaptcha = ({ ssrTheme }: ViewCaptchaProps) => {
}
try {
- // @ts-ignore
+ // @ts-expect-error
const url = new URL(window.location)
const { searchParams } = url
const intialPeriod = captchaProjectsViewPrefs
@@ -374,9 +376,9 @@ const ViewCaptcha = ({ ssrTheme }: ViewCaptchaProps) => {
}
if (intialPeriod === 'custom') {
- // @ts-ignore
+ // @ts-expect-error
const from = new Date(searchParams.get('from'))
- // @ts-ignore
+ // @ts-expect-error
const to = new Date(searchParams.get('to'))
if (from.getDate() && to.getDate()) {
onRangeDateChange([from, to], true)
@@ -393,7 +395,7 @@ const ViewCaptcha = ({ ssrTheme }: ViewCaptchaProps) => {
}
try {
- // @ts-ignore
+ // @ts-expect-error
const url = new URL(window.location)
const { searchParams } = url
const initialFilters: any[] = []
@@ -448,7 +450,9 @@ const ViewCaptcha = ({ ssrTheme }: ViewCaptchaProps) => {
updatePeriod({
period: intialPeriod,
})
- } catch {}
+ } catch {
+ //
+ }
}
parsePeriodFilters()
@@ -462,7 +466,9 @@ const ViewCaptcha = ({ ssrTheme }: ViewCaptchaProps) => {
setTimebucket(initialTimeBucket || periodPairs[3].tbs[1])
}
}
- } catch {}
+ } catch {
+ //
+ }
setAreFiltersParsed(true)
// eslint-disable-next-line react-hooks/exhaustive-deps
@@ -470,7 +476,7 @@ const ViewCaptcha = ({ ssrTheme }: ViewCaptchaProps) => {
const onRangeDateChange = (dates: Date[], onRender?: any) => {
const days = Math.ceil(Math.abs(dates[1].getTime() - dates[0].getTime()) / (1000 * 3600 * 24))
- // @ts-ignore
+ // @ts-expect-error
const url = new URL(window.location)
// setting allowed time buckets for the specified date range (period)
@@ -544,7 +550,7 @@ const ViewCaptcha = ({ ssrTheme }: ViewCaptchaProps) => {
const updatePeriod = (newPeriod: any) => {
const newPeriodFull = _find(periodPairs, (el) => el.period === newPeriod.period)
let tb: any = timeBucket
- // @ts-ignore
+ // @ts-expect-error
const url = new URL(window.location)
if (_isEmpty(newPeriodFull)) return
@@ -575,7 +581,7 @@ const ViewCaptcha = ({ ssrTheme }: ViewCaptchaProps) => {
}
const updateTimebucket = (newTimebucket: string) => {
- // @ts-ignore
+ // @ts-expect-error
const url = new URL(window.location)
url.searchParams.delete('timeBucket')
url.searchParams.append('timeBucket', newTimebucket)
@@ -597,7 +603,7 @@ const ViewCaptcha = ({ ssrTheme }: ViewCaptchaProps) => {
}
const resetFilters = () => {
- // @ts-ignore
+ // @ts-expect-error
const url: URL = new URL(window.location)
const { searchParams } = url
for (const [key] of Array.from(searchParams.entries())) {
@@ -748,7 +754,7 @@ const ViewCaptcha = ({ ssrTheme }: ViewCaptchaProps) => {
onSelect={(pair) => {
if (pair.isCustomDate) {
setTimeout(() => {
- // @ts-ignore
+ // @ts-expect-error
refCalendar.current.openCalendar()
}, 100)
} else {
@@ -758,7 +764,7 @@ const ViewCaptcha = ({ ssrTheme }: ViewCaptchaProps) => {
}
}}
/>
- {(project.role === 'admin' || project.role === 'owner') && (
+ {project.role === 'admin' || project.role === 'owner' ? (
<button
type='button'
onClick={openSettingsHandler}
@@ -769,7 +775,7 @@ const ViewCaptcha = ({ ssrTheme }: ViewCaptchaProps) => {
{t('common.settings')}
</>
</button>
- )}
+ ) : null}
<FlatPicker
ref={refCalendar}
onChange={(date) => setDateRange(date)}
@@ -778,8 +784,8 @@ const ViewCaptcha = ({ ssrTheme }: ViewCaptchaProps) => {
/>
</div>
</div>
- {analyticsLoading && <Loader />}
- {isPanelsDataEmpty && <NoEvents filters={filters} resetFilters={resetFilters} />}
+ {analyticsLoading ? <Loader /> : null}
+ {isPanelsDataEmpty ? <NoEvents filters={filters} resetFilters={resetFilters} /> : null}
<div className={cx('pt-4', { hidden: isPanelsDataEmpty || analyticsLoading })}>
<div className='h-80'>
<div className='h-80 [&_svg]:!overflow-visible' id='captchaChart' />
@@ -791,85 +797,94 @@ const ViewCaptcha = ({ ssrTheme }: ViewCaptchaProps) => {
tnMapping={tnMapping}
resetFilters={resetFilters}
/>
- {dataLoading && (
+ {dataLoading ? (
<div className='static mt-4 !bg-transparent' id='loader'>
<div className='loader-head dark:!bg-slate-800'>
<div className='first dark:!bg-slate-600' />
<div className='second dark:!bg-slate-600' />
</div>
</div>
- )}
+ ) : null}
<div className='mt-5 grid grid-cols-1 gap-5 sm:grid-cols-2 lg:grid-cols-3'>
- {!_isEmpty(panelsData.types) &&
- _map(PANELS_ORDER, (type: keyof typeof tnMapping) => {
- const panelName = tnMapping[type]
- const panelIcon = panelIconMapping[type]
+ {!_isEmpty(panelsData.types)
+ ? _map(PANELS_ORDER, (type: keyof typeof tnMapping) => {
+ const panelName = tnMapping[type]
+ const panelIcon = panelIconMapping[type]
+
+ if (type === 'cc') {
+ const rowMapper = (entry: any) => {
+ const { name: entryName, cc } = entry
- if (type === 'cc') {
- const rowMapper = (entry: any) => {
- const { name: entryName, cc } = entry
+ if (cc) {
+ return <CCRow cc={cc} name={entryName} language={language} />
+ }
- if (cc) {
- return <CCRow cc={cc} name={entryName} language={language} />
+ return <CCRow cc={entryName} language={language} />
}
- return <CCRow cc={entryName} language={language} />
+ return (
+ <Panel
+ key={type}
+ icon={panelIcon}
+ id={type}
+ onFilter={filterHandler}
+ name={panelName}
+ data={panelsData.data[type]}
+ rowMapper={rowMapper}
+ />
+ )
}
- return (
- <Panel
- key={type}
- icon={panelIcon}
- id={type}
- onFilter={filterHandler}
- name={panelName}
- data={panelsData.data[type]}
- rowMapper={rowMapper}
- />
- )
- }
-
- if (type === 'dv') {
- return (
- <Panel
- key={type}
- icon={panelIcon}
- id={type}
- onFilter={filterHandler}
- name={panelName}
- data={panelsData.data[type]}
- rowMapper={(entry: { name: keyof typeof deviceIconMapping }) => {
- const { name: entryName } = entry
-
- const icon = deviceIconMapping[entryName]
+ if (type === 'dv') {
+ return (
+ <Panel
+ key={type}
+ icon={panelIcon}
+ id={type}
+ onFilter={filterHandler}
+ name={panelName}
+ data={panelsData.data[type]}
+ rowMapper={(entry: { name: keyof typeof deviceIconMapping }) => {
+ const { name: entryName } = entry
+
+ const icon = deviceIconMapping[entryName]
+
+ if (!icon) {
+ return entryName
+ }
+
+ return (
+ <>
+ {icon}
+ &nbsp;
+ {entryName}
+ </>
+ )
+ }}
+ capitalize
+ />
+ )
+ }
- if (!icon) {
- return entryName
- }
+ if (type === 'br') {
+ const rowMapper = (entry: any) => {
+ const { name: entryName } = entry
+ // @ts-expect-error
+ const logoUrl = BROWSER_LOGO_MAP[entryName]
+ if (!logoUrl) {
return (
<>
- {icon}
+ <GlobeAltIcon className='h-5 w-5' />
&nbsp;
{entryName}
</>
)
- }}
- capitalize
- />
- )
- }
-
- if (type === 'br') {
- const rowMapper = (entry: any) => {
- const { name: entryName } = entry
- // @ts-ignore
- const logoUrl = BROWSER_LOGO_MAP[entryName]
+ }
- if (!logoUrl) {
return (
<>
- <GlobeAltIcon className='h-5 w-5' />
+ <img src={logoUrl} className='h-5 w-5' alt='' />
&nbsp;
{entryName}
</>
@@ -877,56 +892,60 @@ const ViewCaptcha = ({ ssrTheme }: ViewCaptchaProps) => {
}
return (
- <>
- <img src={logoUrl} className='h-5 w-5' alt='' />
- &nbsp;
- {entryName}
- </>
+ <Panel
+ key={type}
+ icon={panelIcon}
+ id={type}
+ onFilter={filterHandler}
+ name={panelName}
+ data={panelsData.data[type]}
+ rowMapper={rowMapper}
+ />
)
}
- return (
- <Panel
- key={type}
- icon={panelIcon}
- id={type}
- onFilter={filterHandler}
- name={panelName}
- data={panelsData.data[type]}
- rowMapper={rowMapper}
- />
- )
- }
+ if (type === 'os') {
+ const rowMapper = (entry: any) => {
+ const { name: entryName } = entry
+ // @ts-expect-error
+ const logoPathLight = OS_LOGO_MAP[entryName]
+ // @ts-expect-error
+ const logoPathDark = OS_LOGO_MAP_DARK[entryName]
+
+ let logoPath = _theme === 'dark' ? logoPathDark : logoPathLight
+ logoPath ||= logoPathLight
- if (type === 'os') {
- const rowMapper = (entry: any) => {
- const { name: entryName } = entry
- // @ts-ignore
- const logoPathLight = OS_LOGO_MAP[entryName]
- // @ts-ignore
- const logoPathDark = OS_LOGO_MAP_DARK[entryName]
+ if (!logoPath) {
+ return (
+ <>
+ <GlobeAltIcon className='h-5 w-5' />
+ &nbsp;
+ {entryName}
+ </>
+ )
+ }
- let logoPath = _theme === 'dark' ? logoPathDark : logoPathLight
- logoPath ||= logoPathLight
+ const logoUrl = `/${logoPath}`
- if (!logoPath) {
return (
<>
- <GlobeAltIcon className='h-5 w-5' />
+ <img src={logoUrl} className='h-5 w-5 dark:fill-gray-50' alt='' />
&nbsp;
{entryName}
</>
)
}
- const logoUrl = `/${logoPath}`
-
return (
- <>
- <img src={logoUrl} className='h-5 w-5 dark:fill-gray-50' alt='' />
- &nbsp;
- {entryName}
- </>
+ <Panel
+ key={type}
+ icon={panelIcon}
+ id={type}
+ onFilter={filterHandler}
+ name={panelName}
+ data={panelsData.data[type]}
+ rowMapper={rowMapper}
+ />
)
}
@@ -938,22 +957,10 @@ const ViewCaptcha = ({ ssrTheme }: ViewCaptchaProps) => {
onFilter={filterHandler}
name={panelName}
data={panelsData.data[type]}
- rowMapper={rowMapper}
/>
)
- }
-
- return (
- <Panel
- key={type}
- icon={panelIcon}
- id={type}
- onFilter={filterHandler}
- name={panelName}
- data={panelsData.data[type]}
- />
- )
- })}
+ })
+ : null}
</div>
</div>
</div>
diff --git a/web/app/pages/Captcha/View/components/Filters.tsx b/web/app/pages/Captcha/View/components/Filters.tsx
index 353e847c9..4ea38e9fd 100644
--- a/web/app/pages/Captcha/View/components/Filters.tsx
+++ b/web/app/pages/Captcha/View/components/Filters.tsx
@@ -1,16 +1,16 @@
import { XMarkIcon } from '@heroicons/react/24/outline'
-import React, { memo } from 'react'
import cx from 'clsx'
-import _truncate from 'lodash/truncate'
import _isEmpty from 'lodash/isEmpty'
import _map from 'lodash/map'
-import _startsWith from 'lodash/startsWith'
import _replace from 'lodash/replace'
+import _startsWith from 'lodash/startsWith'
+import _truncate from 'lodash/truncate'
+import { FilterIcon } from 'lucide-react'
+import { memo } from 'react'
import { useTranslation } from 'react-i18next'
-import countries from '~/utils/isoCountries'
import { getLocaleDisplayName } from '~/utils/generic'
-import { FilterIcon } from 'lucide-react'
+import countries from '~/utils/isoCountries'
interface FilterProps {
column: string
@@ -94,7 +94,7 @@ const Filter = ({
&nbsp; &quot;
{truncatedFilter}
&quot;
- {removable && (
+ {removable ? (
<button
onClick={() => onRemoveFilter(column, filter)}
type='button'
@@ -105,7 +105,7 @@ const Filter = ({
<path strokeLinecap='round' strokeWidth='1.5' d='M1 1l6 6m0-6L1 7' />
</svg>
</button>
- )}
+ ) : null}
</span>
)
}
diff --git a/web/app/pages/Captcha/View/components/NoEvents.tsx b/web/app/pages/Captcha/View/components/NoEvents.tsx
index 408f20730..c7007ea4a 100644
--- a/web/app/pages/Captcha/View/components/NoEvents.tsx
+++ b/web/app/pages/Captcha/View/components/NoEvents.tsx
@@ -1,10 +1,10 @@
-import React, { memo } from 'react'
-import { useTranslation, Trans } from 'react-i18next'
import _isEmpty from 'lodash/isEmpty'
+import { memo } from 'react'
+import { useTranslation, Trans } from 'react-i18next'
-import Button from '~/ui/Button'
import { DOCS_CAPTCHA_URL } from '~/lib/constants'
import { Filter } from '~/pages/Project/View/interfaces/traffic'
+import Button from '~/ui/Button'
interface NoEventsProps {
filters: Filter[]
@@ -35,13 +35,13 @@ const NoEvents = ({ filters, resetFilters }: NoEventsProps) => {
}}
/>
</h2>
- {!_isEmpty(filters) && (
+ {!_isEmpty(filters) ? (
<div className='!mx-auto !flex'>
<Button onClick={resetFilters} className='!mx-auto !flex' primary giant>
{t('project.resetFilters')}
</Button>
</div>
- )}
+ ) : null}
</div>
</div>
)
diff --git a/web/app/pages/Captcha/View/components/TBPeriodSelector.tsx b/web/app/pages/Captcha/View/components/TBPeriodSelector.tsx
index cd9917d98..4cebddaf3 100644
--- a/web/app/pages/Captcha/View/components/TBPeriodSelector.tsx
+++ b/web/app/pages/Captcha/View/components/TBPeriodSelector.tsx
@@ -1,12 +1,13 @@
-import React, { memo, Fragment, useMemo } from 'react'
import { Popover, PopoverButton, PopoverPanel, Transition } from '@headlessui/react'
import { ChevronDownIcon } from '@heroicons/react/20/solid'
-import { useTranslation } from 'react-i18next'
-import _map from 'lodash/map'
-import _includes from 'lodash/includes'
import cx from 'clsx'
-import { ALL_PERIODS } from '~/lib/constants'
+import _includes from 'lodash/includes'
+import _map from 'lodash/map'
import { CalendarIcon } from 'lucide-react'
+import React, { memo, Fragment, useMemo } from 'react'
+import { useTranslation } from 'react-i18next'
+
+import { ALL_PERIODS } from '~/lib/constants'
interface TBPeriodSelectorProps {
title: string | number | React.ReactNode
diff --git a/web/app/pages/Changelog/index.tsx b/web/app/pages/Changelog/index.tsx
index d56eb6e04..0330b1ac8 100644
--- a/web/app/pages/Changelog/index.tsx
+++ b/web/app/pages/Changelog/index.tsx
@@ -1,8 +1,7 @@
/* eslint-disable jsx-a11y/anchor-has-content */
-import React from 'react'
+import dayjs from 'dayjs'
import _map from 'lodash/map'
import { useTranslation } from 'react-i18next'
-import dayjs from 'dayjs'
import { Link } from 'react-router'
import { SWETRIX_VS_GOOGLE, DOCS_URL, CAPTCHA_URL, DOCS_CAPTCHA_URL } from '~/lib/constants'
@@ -453,7 +452,7 @@ const Changelog = () => {
<div className='relative'>
<ul className='dark:prose-dark prose prose-slate prose-a:relative prose-a:z-10 relative top-7 mt-2 mb-4 list-disc text-base text-gray-900 lg:top-0 lg:block dark:text-gray-50'>
{_map(item.changes, (change) => (
- // @ts-ignore
+ // @ts-expect-error
<li key={change} className='whitespace-pre-line'>
{change}
</li>
diff --git a/web/app/pages/Contact/index.tsx b/web/app/pages/Contact/index.tsx
index 3be097e6a..3fec9fbd2 100644
--- a/web/app/pages/Contact/index.tsx
+++ b/web/app/pages/Contact/index.tsx
@@ -1,6 +1,5 @@
/* eslint-disable jsx-a11y/anchor-has-content */
import { SquareArrowOutUpRightIcon } from 'lucide-react'
-import React from 'react'
import { useTranslation, Trans } from 'react-i18next'
import { CONTACT_EMAIL, TWITTER_URL, TWITTER_USERNAME, DISCORD_URL, DOCS_URL, BOOK_A_CALL_URL } from '~/lib/constants'
diff --git a/web/app/pages/CookiePolicy/index.tsx b/web/app/pages/CookiePolicy/index.tsx
index cf4b00d27..1ac0e592f 100644
--- a/web/app/pages/CookiePolicy/index.tsx
+++ b/web/app/pages/CookiePolicy/index.tsx
@@ -1,5 +1,4 @@
/* eslint-disable react/no-unescaped-entities */
-import React from 'react'
import _map from 'lodash/map'
const typesOfCookies = [
diff --git a/web/app/pages/Dashboard/AddProject.tsx b/web/app/pages/Dashboard/AddProject.tsx
index a5dbe31ea..436eb76b9 100644
--- a/web/app/pages/Dashboard/AddProject.tsx
+++ b/web/app/pages/Dashboard/AddProject.tsx
@@ -1,8 +1,8 @@
-import React from 'react'
import { FolderPlusIcon } from '@heroicons/react/24/outline'
-import { Link } from 'react-router'
-import { useTranslation } from 'react-i18next'
import cx from 'clsx'
+import React from 'react'
+import { useTranslation } from 'react-i18next'
+import { Link } from 'react-router'
import routes from '~/utils/routes'
diff --git a/web/app/pages/Dashboard/Dashboard.tsx b/web/app/pages/Dashboard/Dashboard.tsx
index 9ddfdb0a3..ae3b5c9f4 100644
--- a/web/app/pages/Dashboard/Dashboard.tsx
+++ b/web/app/pages/Dashboard/Dashboard.tsx
@@ -1,38 +1,38 @@
-import React, { useState, useEffect, useRef } from 'react'
-import { Link, useLoaderData, useSearchParams } from 'react-router'
-import { ClientOnly } from 'remix-utils/client-only'
-import _isEmpty from 'lodash/isEmpty'
-import _size from 'lodash/size'
-import _map from 'lodash/map'
-import { useTranslation } from 'react-i18next'
import { FolderPlusIcon, MagnifyingGlassIcon, XMarkIcon } from '@heroicons/react/24/outline'
import { XCircleIcon } from '@heroicons/react/24/solid'
-import { StretchHorizontal as StretchHorizontalIcon, LayoutGrid as LayoutGridIcon } from 'lucide-react'
import cx from 'clsx'
+import _isEmpty from 'lodash/isEmpty'
+import _map from 'lodash/map'
+import _size from 'lodash/size'
+import { StretchHorizontal as StretchHorizontalIcon, LayoutGrid as LayoutGridIcon } from 'lucide-react'
+import React, { useState, useEffect, useRef } from 'react'
+import { useTranslation } from 'react-i18next'
+import { useSelector } from 'react-redux'
+import { Link, useLoaderData, useSearchParams } from 'react-router'
+import { ClientOnly } from 'remix-utils/client-only'
-import Modal from '~/ui/Modal'
-import { withAuthentication, auth } from '~/hoc/protected'
-import routes from '~/utils/routes'
-import { isSelfhosted, LIVE_VISITORS_UPDATE_INTERVAL } from '~/lib/constants'
-import EventsRunningOutBanner from '~/components/EventsRunningOutBanner'
+import { getProjects, getLiveVisitors, getOverallStats, getOverallStatsCaptcha } from '~/api'
import DashboardLockedBanner from '~/components/DashboardLockedBanner'
+import EventsRunningOutBanner from '~/components/EventsRunningOutBanner'
+import { withAuthentication, auth } from '~/hoc/protected'
+import useBreakpoint from '~/hooks/useBreakpoint'
import useDebounce from '~/hooks/useDebounce'
import useFeatureFlag from '~/hooks/useFeatureFlag'
+import { isSelfhosted, LIVE_VISITORS_UPDATE_INTERVAL } from '~/lib/constants'
+import { Overall, Project } from '~/lib/models/Project'
import { FeatureFlag } from '~/lib/models/User'
+import { StateType } from '~/lib/store'
+import Modal from '~/ui/Modal'
+import Pagination from '~/ui/Pagination'
import { setCookie } from '~/utils/cookie'
+import routes from '~/utils/routes'
-import Pagination from '~/ui/Pagination'
-import { useSelector } from 'react-redux'
-import { StateType } from '~/lib/store'
-import { ProjectCard, ProjectCardSkeleton } from './ProjectCard'
-import { NoProjects } from './NoProjects'
import { AddProject } from './AddProject'
-import { Overall, Project } from '~/lib/models/Project'
-import { getProjects, getLiveVisitors, getOverallStats, getOverallStatsCaptcha } from '~/api'
-import { DASHBOARD_TABS, Tabs } from './Tabs'
+import { NoProjects } from './NoProjects'
import { PeriodSelector } from './PeriodSelector'
+import { ProjectCard, ProjectCardSkeleton } from './ProjectCard'
import { SortSelector, SORT_OPTIONS } from './SortSelector'
-import useBreakpoint from '~/hooks/useBreakpoint'
+import { DASHBOARD_TABS, Tabs } from './Tabs'
const PAGE_SIZE_OPTIONS = [12, 24, 48, 96]
@@ -315,7 +315,7 @@ const Dashboard = () => {
/>
)}
</h2>
- {isSearchActive && (
+ {isSearchActive ? (
<div className='hidden w-full max-w-md items-center px-2 pb-1 font-mono sm:ml-5 sm:flex'>
<label htmlFor='simple-search' className='sr-only'>
Search
@@ -334,7 +334,7 @@ const Dashboard = () => {
/>
</div>
</div>
- )}
+ ) : null}
</div>
<div className='flex flex-wrap items-center gap-1'>
{activeTab === 'lost-traffic' ? null : showPeriodSelector ? (
@@ -394,7 +394,7 @@ const Dashboard = () => {
</Link>
</div>
</div>
- {isSearchActive && (
+ {isSearchActive ? (
<div className='mb-2 flex w-full items-center sm:hidden'>
<label htmlFor='search-projects' className='sr-only'>
Search
@@ -413,8 +413,8 @@ const Dashboard = () => {
/>
</div>
</div>
- )}
- {showTabs && (
+ ) : null}
+ {showTabs ? (
<Tabs
activeTab={activeTab}
setActiveTab={(tab) => {
@@ -428,7 +428,7 @@ const Dashboard = () => {
isLoading={isLoading === null || isLoading}
className='mb-4'
/>
- )}
+ ) : null}
{isLoading || isLoading === null ? (
<div className='min-h-min-footer bg-gray-50 dark:bg-slate-900'>
<ProjectCardSkeleton viewMode={_viewMode} />
diff --git a/web/app/pages/Dashboard/NoProjects.tsx b/web/app/pages/Dashboard/NoProjects.tsx
index bf476bfcd..50b4e057a 100644
--- a/web/app/pages/Dashboard/NoProjects.tsx
+++ b/web/app/pages/Dashboard/NoProjects.tsx
@@ -1,9 +1,10 @@
-import React from 'react'
import { FolderPlusIcon } from '@heroicons/react/24/outline'
-import { Link } from 'react-router'
+import React from 'react'
import { useTranslation } from 'react-i18next'
+import { Link } from 'react-router'
import routes from '~/utils/routes'
+
import { DASHBOARD_TABS } from './Tabs'
interface NoProjectsProps {
diff --git a/web/app/pages/Dashboard/PeriodSelector.tsx b/web/app/pages/Dashboard/PeriodSelector.tsx
index 41a02dc81..09cec7b64 100644
--- a/web/app/pages/Dashboard/PeriodSelector.tsx
+++ b/web/app/pages/Dashboard/PeriodSelector.tsx
@@ -1,10 +1,11 @@
-import React, { Fragment, useMemo } from 'react'
import { Popover, PopoverButton, PopoverPanel, Transition } from '@headlessui/react'
import { ChevronDownIcon } from '@heroicons/react/20/solid'
-import { useTranslation } from 'react-i18next'
-import _map from 'lodash/map'
import cx from 'clsx'
+import _map from 'lodash/map'
import { CalendarIcon } from 'lucide-react'
+import { Fragment, useMemo } from 'react'
+import { useTranslation } from 'react-i18next'
+
import { KEY_FOR_ALL_TIME } from '~/lib/constants'
interface PeriodSelectorProps {
diff --git a/web/app/pages/Dashboard/ProjectCard.tsx b/web/app/pages/Dashboard/ProjectCard.tsx
index 233bedbc2..b0c850076 100644
--- a/web/app/pages/Dashboard/ProjectCard.tsx
+++ b/web/app/pages/Dashboard/ProjectCard.tsx
@@ -1,31 +1,30 @@
-import React, { useState, useMemo } from 'react'
-import { Link } from 'react-router'
-import { toast } from 'sonner'
+import { ChevronUpIcon, ChevronDownIcon } from '@heroicons/react/20/solid'
+import { AdjustmentsVerticalIcon } from '@heroicons/react/24/outline'
import cx from 'clsx'
-import _size from 'lodash/size'
-import _round from 'lodash/round'
-import _isNumber from 'lodash/isNumber'
-import _replace from 'lodash/replace'
import _find from 'lodash/find'
+import _isNumber from 'lodash/isNumber'
import _map from 'lodash/map'
+import _replace from 'lodash/replace'
+import _round from 'lodash/round'
+import _size from 'lodash/size'
+import React, { useState, useMemo } from 'react'
import { useTranslation } from 'react-i18next'
-import { AdjustmentsVerticalIcon } from '@heroicons/react/24/outline'
-import { ChevronUpIcon, ChevronDownIcon } from '@heroicons/react/20/solid'
-
-import Modal from '~/ui/Modal'
-import { Badge, BadgeProps } from '~/ui/Badge'
-import routes from '~/utils/routes'
-import { nFormatter, calculateRelativePercentage } from '~/utils/generic'
+import { useSelector } from 'react-redux'
+import { Link } from 'react-router'
+import { toast } from 'sonner'
import { acceptProjectShare } from '~/api'
-
+import useFeatureFlag from '~/hooks/useFeatureFlag'
import { OverallObject, Project } from '~/lib/models/Project'
-import { useSelector } from 'react-redux'
-import { StateType, useAppDispatch } from '~/lib/store'
+import { FeatureFlag } from '~/lib/models/User'
import { authActions } from '~/lib/reducers/auth'
+import { StateType, useAppDispatch } from '~/lib/store'
+import { Badge, BadgeProps } from '~/ui/Badge'
import Spin from '~/ui/icons/Spin'
-import useFeatureFlag from '~/hooks/useFeatureFlag'
-import { FeatureFlag } from '~/lib/models/User'
+import Modal from '~/ui/Modal'
+import { nFormatter, calculateRelativePercentage } from '~/utils/generic'
+import routes from '~/utils/routes'
+
import { DASHBOARD_TABS } from './Tabs'
interface ProjectCardProps {
@@ -57,7 +56,7 @@ const MiniCard = ({ labelTKey, total, percChange }: MiniCardProps) => {
) : (
<>
<p className='text-xl text-gray-700 dark:text-gray-100'>{_isNumber(total) ? nFormatter(total) : total}</p>
- {_isNumber(percChange) && (
+ {_isNumber(percChange) ? (
<p
className={cx('flex items-center text-xs', {
'text-green-600': statsDidGrowUp,
@@ -77,7 +76,7 @@ const MiniCard = ({ labelTKey, total, percChange }: MiniCardProps) => {
)}
{nFormatter(percChange)}%
</p>
- )}
+ ) : null}
</>
)}
</div>
@@ -216,14 +215,14 @@ export const ProjectCard = ({ live, project, overallStats, activePeriod, activeT
<div className={cx('flex items-center', viewMode === 'grid' ? 'justify-between' : 'justify-start gap-1')}>
<p className='truncate font-mono text-lg font-semibold text-slate-900 dark:text-gray-50'>{name}</p>
- {role !== 'viewer' && (
+ {role !== 'viewer' ? (
<Link onClick={(e) => e.stopPropagation()} to={_replace(routes.project_settings, ':id', id)}>
<AdjustmentsVerticalIcon
className='size-6 text-gray-800 hover:text-gray-900 dark:text-slate-400 dark:hover:text-slate-500'
aria-label={`${t('project.settings.settings')} ${name}`}
/>
</Link>
- )}
+ ) : null}
</div>
<div className='mt-1 flex shrink-0 flex-wrap gap-2'>
{badges.length > 0 ? (
@@ -259,7 +258,7 @@ export const ProjectCard = ({ live, project, overallStats, activePeriod, activeT
)}
{project.isAnalyticsProject ? <MiniCard labelTKey='dashboard.liveVisitors' total={live} /> : null}
</div>
- {project.role !== 'owner' && !project.isAccessConfirmed && (
+ {project.role !== 'owner' && !project.isAccessConfirmed ? (
<Modal
onClose={() => {
setShowInviteModal(false)
@@ -275,7 +274,7 @@ export const ProjectCard = ({ live, project, overallStats, activePeriod, activeT
message={t('dashboard.invitationDesc', { project: name })}
isOpened={showInviteModal}
/>
- )}
+ ) : null}
</Link>
)
}
diff --git a/web/app/pages/Dashboard/SortSelector.tsx b/web/app/pages/Dashboard/SortSelector.tsx
index ce7198b3a..bf914fa26 100644
--- a/web/app/pages/Dashboard/SortSelector.tsx
+++ b/web/app/pages/Dashboard/SortSelector.tsx
@@ -1,16 +1,18 @@
-import React, { Fragment, useEffect, useMemo } from 'react'
import { Popover, PopoverButton, PopoverPanel, Transition } from '@headlessui/react'
import { ChevronDownIcon } from '@heroicons/react/20/solid'
-import { useTranslation } from 'react-i18next'
-import _map from 'lodash/map'
import cx from 'clsx'
+import _map from 'lodash/map'
import { ArrowUpDown } from 'lucide-react'
-import { DASHBOARD_TABS } from './Tabs'
+import { Fragment, useEffect, useMemo } from 'react'
+import { useTranslation } from 'react-i18next'
+import { useSelector } from 'react-redux'
+
import useFeatureFlag from '~/hooks/useFeatureFlag'
import { FeatureFlag } from '~/lib/models/User'
-import { useSelector } from 'react-redux'
import { StateType } from '~/lib/store'
+import { DASHBOARD_TABS } from './Tabs'
+
interface SortSelectorProps {
activeSort: string
setActiveSort: (sort: string) => void
diff --git a/web/app/pages/Dashboard/Tabs.tsx b/web/app/pages/Dashboard/Tabs.tsx
index 7e812a31b..fc0897cb3 100644
--- a/web/app/pages/Dashboard/Tabs.tsx
+++ b/web/app/pages/Dashboard/Tabs.tsx
@@ -1,7 +1,7 @@
-import React from 'react'
-import _map from 'lodash/map'
import cx from 'clsx'
+import _map from 'lodash/map'
import { FlameIcon, LayoutListIcon, PowerOffIcon, TrendingDownIcon, TrendingUpIcon } from 'lucide-react'
+import React from 'react'
export const DASHBOARD_TABS = [
{
diff --git a/web/app/pages/ErrorTracking/index.tsx b/web/app/pages/ErrorTracking/index.tsx
index 170d2fd97..3e87c38a0 100644
--- a/web/app/pages/ErrorTracking/index.tsx
+++ b/web/app/pages/ErrorTracking/index.tsx
@@ -1,22 +1,22 @@
-import { Link } from 'react-router'
-import React, { memo } from 'react'
+import { ArrowRightIcon } from '@heroicons/react/20/solid'
+import { ChevronRightIcon } from '@heroicons/react/24/solid'
+import _isEmpty from 'lodash/isEmpty'
+import _map from 'lodash/map'
+import { memo } from 'react'
import { useTranslation, Trans } from 'react-i18next'
import { useSelector } from 'react-redux'
+import { Link } from 'react-router'
import { ClientOnly } from 'remix-utils/client-only'
-import { ChevronRightIcon } from '@heroicons/react/24/solid'
-import { ArrowRightIcon } from '@heroicons/react/20/solid'
-import _map from 'lodash/map'
-import _isEmpty from 'lodash/isEmpty'
-import routesPath from '~/utils/routes'
-import { getAccessToken } from '~/utils/accessToken'
+import Header from '~/components/Header'
+import { DitchGoogle } from '~/components/marketing/DitchGoogle'
import { ERROR_TRACKING_LIVE_DEMO_URL, isBrowser } from '~/lib/constants'
import { StateType } from '~/lib/store/index'
import BackgroundSvg from '~/ui/icons/BackgroundSvg'
+import { getAccessToken } from '~/utils/accessToken'
+import routesPath from '~/utils/routes'
-import Header from '~/components/Header'
import Pricing from '../../components/marketing/Pricing'
-import { DitchGoogle } from '~/components/marketing/DitchGoogle'
import { PeopleLoveSwetrix } from '../Performance'
const Lines = () => (
@@ -225,7 +225,7 @@ const ErrorTracking = ({ ssrTheme, ssrAuthenticated }: ErrorTrackingProps) => {
</div>
{/* For now let's hide Pricing for authenticated users on the main page as the Paddle script only loads on the Billing page */}
- {!authenticated && <Pricing authenticated={false} />}
+ {!authenticated ? <Pricing authenticated={false} /> : null}
<DitchGoogle
screenshot={{
diff --git a/web/app/pages/Imprint/index.tsx b/web/app/pages/Imprint/index.tsx
index 6c919ede0..4857f321a 100644
--- a/web/app/pages/Imprint/index.tsx
+++ b/web/app/pages/Imprint/index.tsx
@@ -1,5 +1,4 @@
/* eslint-disable react/no-unescaped-entities */
-import React from 'react'
import { CONTACT_EMAIL } from '~/lib/constants'
diff --git a/web/app/pages/Landings/Marketers.tsx b/web/app/pages/Landings/Marketers.tsx
index 1ff3ab3fe..225f135ac 100644
--- a/web/app/pages/Landings/Marketers.tsx
+++ b/web/app/pages/Landings/Marketers.tsx
@@ -1,19 +1,16 @@
-import { Link, useLoaderData } from 'react-router'
-
+import { ArrowRightIcon } from '@heroicons/react/20/solid'
+import _map from 'lodash/map'
import { useTranslation, Trans } from 'react-i18next'
import { useSelector } from 'react-redux'
-import { StateType } from '~/lib/store'
-import { BOOK_A_CALL_URL, DISCORD_URL, isBrowser, LIVE_DEMO_URL } from '~/lib/constants'
-import routesPath from '~/utils/routes'
-
-import { ArrowRightIcon } from '@heroicons/react/20/solid'
+import { Link, useLoaderData } from 'react-router'
import Header from '~/components/Header'
-import { getAccessToken } from '~/utils/accessToken'
-
-import _map from 'lodash/map'
import { ComparisonTable } from '~/components/marketing/ComparisonTable'
import { DitchGoogle } from '~/components/marketing/DitchGoogle'
+import { BOOK_A_CALL_URL, DISCORD_URL, isBrowser, LIVE_DEMO_URL } from '~/lib/constants'
+import { StateType } from '~/lib/store'
+import { getAccessToken } from '~/utils/accessToken'
+import routesPath from '~/utils/routes'
interface LoaderProps {
theme: 'dark' | 'light'
diff --git a/web/app/pages/Landings/SmallBusinesses.tsx b/web/app/pages/Landings/SmallBusinesses.tsx
index 6420d586b..cb1b07580 100644
--- a/web/app/pages/Landings/SmallBusinesses.tsx
+++ b/web/app/pages/Landings/SmallBusinesses.tsx
@@ -1,19 +1,16 @@
-import { Link, useLoaderData } from 'react-router'
-
+import { ArrowRightIcon } from '@heroicons/react/20/solid'
+import _map from 'lodash/map'
import { useTranslation, Trans } from 'react-i18next'
import { useSelector } from 'react-redux'
-import { StateType } from '~/lib/store'
-import { BOOK_A_CALL_URL, DISCORD_URL, isBrowser, LIVE_DEMO_URL, TWITTER_URL } from '~/lib/constants'
-import routesPath from '~/utils/routes'
-
-import { ArrowRightIcon } from '@heroicons/react/20/solid'
+import { Link, useLoaderData } from 'react-router'
import Header from '~/components/Header'
-import { getAccessToken } from '~/utils/accessToken'
-
-import _map from 'lodash/map'
import { ComparisonTable } from '~/components/marketing/ComparisonTable'
import { DitchGoogle } from '~/components/marketing/DitchGoogle'
+import { BOOK_A_CALL_URL, DISCORD_URL, isBrowser, LIVE_DEMO_URL, TWITTER_URL } from '~/lib/constants'
+import { StateType } from '~/lib/store'
+import { getAccessToken } from '~/utils/accessToken'
+import routesPath from '~/utils/routes'
interface LoaderProps {
theme: 'dark' | 'light'
diff --git a/web/app/pages/Landings/Startups.tsx b/web/app/pages/Landings/Startups.tsx
index e92179b4a..53a234498 100644
--- a/web/app/pages/Landings/Startups.tsx
+++ b/web/app/pages/Landings/Startups.tsx
@@ -1,19 +1,16 @@
-import { Link, useLoaderData } from 'react-router'
-
+import { ArrowRightIcon } from '@heroicons/react/20/solid'
+import _map from 'lodash/map'
import { useTranslation, Trans } from 'react-i18next'
import { useSelector } from 'react-redux'
-import { StateType } from '~/lib/store'
-import { BOOK_A_CALL_URL, DISCORD_URL, isBrowser, LIVE_DEMO_URL } from '~/lib/constants'
-import routesPath from '~/utils/routes'
-
-import { ArrowRightIcon } from '@heroicons/react/20/solid'
+import { Link, useLoaderData } from 'react-router'
import Header from '~/components/Header'
-import { getAccessToken } from '~/utils/accessToken'
-
-import _map from 'lodash/map'
import { ComparisonTable } from '~/components/marketing/ComparisonTable'
import { DitchGoogle } from '~/components/marketing/DitchGoogle'
+import { BOOK_A_CALL_URL, DISCORD_URL, isBrowser, LIVE_DEMO_URL } from '~/lib/constants'
+import { StateType } from '~/lib/store'
+import { getAccessToken } from '~/utils/accessToken'
+import routesPath from '~/utils/routes'
interface LoaderProps {
theme: 'dark' | 'light'
diff --git a/web/app/pages/NotFound/index.tsx b/web/app/pages/NotFound/index.tsx
index 5c234a04d..f4825b3be 100644
--- a/web/app/pages/NotFound/index.tsx
+++ b/web/app/pages/NotFound/index.tsx
@@ -1,9 +1,8 @@
-import React from 'react'
-import { Link } from 'react-router'
import { useTranslation } from 'react-i18next'
+import { Link } from 'react-router'
-import routes from '~/utils/routes'
import { isSelfhosted } from '~/lib/constants'
+import routes from '~/utils/routes'
const CONTACT_US_URL = `https://swetrix.com${routes.contact}`
diff --git a/web/app/pages/OpenStartup/index.tsx b/web/app/pages/OpenStartup/index.tsx
index 8bd532958..dd08d1ef1 100644
--- a/web/app/pages/OpenStartup/index.tsx
+++ b/web/app/pages/OpenStartup/index.tsx
@@ -1,13 +1,13 @@
/* eslint-disable no-useless-escape */
-import React, { useEffect } from 'react'
-import bb, { bar, line } from 'billboard.js'
+import billboard, { bar, line } from 'billboard.js'
+import { useEffect } from 'react'
import { useTranslation, Trans } from 'react-i18next'
-import { Link } from 'react-router'
import { useSelector } from 'react-redux'
+import { Link } from 'react-router'
-import { nFormatterSeparated } from '~/utils/generic'
-import { StateType } from '~/lib/store/index'
import { LIVE_DEMO_URL } from '~/lib/constants'
+import { StateType } from '~/lib/store/index'
+import { nFormatterSeparated } from '~/utils/generic'
// This should be generated on the API side, will be done later.
// MRR taken from Profitwell dashboard
@@ -383,8 +383,8 @@ const OpenStartup = () => {
useEffect(() => {
const bbSettings = getSettings()
- // @ts-ignore
- bb.generate(bbSettings)
+ // @ts-expect-error
+ billboard.generate(bbSettings)
}, [])
return (
@@ -414,21 +414,21 @@ const OpenStartup = () => {
{t('main.users')}
{': '}
{users[0]}
- {users[1] && <span className='text-gray-900 dark:text-indigo-200'>{users[1]}+</span>}
+ {users[1] ? <span className='text-gray-900 dark:text-indigo-200'>{users[1]}+</span> : null}
</p>
<p className='text-md mt-2 tracking-tight text-gray-900 dark:text-gray-50'>
{t('main.websites')}
{': '}
{websites[0]}
- {websites[1] && <span className='text-gray-900 dark:text-indigo-200'>{websites[1]}+</span>}
+ {websites[1] ? <span className='text-gray-900 dark:text-indigo-200'>{websites[1]}+</span> : null}
</p>
<p className='text-md mt-2 tracking-tight text-gray-900 dark:text-gray-50'>
{t('main.pageviews')}
{': '}
{events[0]}
- {events[1] && <span className='text-gray-900 dark:text-indigo-200'>{events[1]}+</span>}
+ {events[1] ? <span className='text-gray-900 dark:text-indigo-200'>{events[1]}+</span> : null}
</p>
<p className='mt-2 text-lg tracking-tight text-gray-900 dark:text-gray-50'>
diff --git a/web/app/pages/Organisations/AddOrganisation.tsx b/web/app/pages/Organisations/AddOrganisation.tsx
index 89a46e45c..ace7408ed 100644
--- a/web/app/pages/Organisations/AddOrganisation.tsx
+++ b/web/app/pages/Organisations/AddOrganisation.tsx
@@ -1,6 +1,6 @@
import { BuildingOffice2Icon } from '@heroicons/react/24/outline'
-import { useTranslation } from 'react-i18next'
import cx from 'clsx'
+import { useTranslation } from 'react-i18next'
interface AddOrganisationProps {
onClick: () => void
diff --git a/web/app/pages/Organisations/NoOrganisations.tsx b/web/app/pages/Organisations/NoOrganisations.tsx
index af34fd6bb..c944e9149 100644
--- a/web/app/pages/Organisations/NoOrganisations.tsx
+++ b/web/app/pages/Organisations/NoOrganisations.tsx
@@ -1,5 +1,5 @@
-import { useTranslation } from 'react-i18next'
import { BuildingOffice2Icon } from '@heroicons/react/24/outline'
+import { useTranslation } from 'react-i18next'
interface NoOrganisationsProps {
onClick: () => void
diff --git a/web/app/pages/Organisations/OrganisationCard.tsx b/web/app/pages/Organisations/OrganisationCard.tsx
index 9551b8930..995888f29 100644
--- a/web/app/pages/Organisations/OrganisationCard.tsx
+++ b/web/app/pages/Organisations/OrganisationCard.tsx
@@ -1,23 +1,22 @@
import { AdjustmentsVerticalIcon } from '@heroicons/react/24/outline'
-import { Link } from 'react-router'
-import React, { useState, useMemo } from 'react'
-import { toast } from 'sonner'
-import _size from 'lodash/size'
-import _replace from 'lodash/replace'
+import cx from 'clsx'
import _find from 'lodash/find'
import _map from 'lodash/map'
+import _replace from 'lodash/replace'
+import _size from 'lodash/size'
+import React, { useState, useMemo } from 'react'
import { useTranslation } from 'react-i18next'
-import cx from 'clsx'
-
-import Modal from '~/ui/Modal'
-import { Badge, BadgeProps } from '~/ui/Badge'
-import routes from '~/utils/routes'
-
-import { DetailedOrganisation } from '~/lib/models/Organisation'
import { useSelector } from 'react-redux'
-import { StateType, useAppDispatch } from '~/lib/store'
+import { Link } from 'react-router'
+import { toast } from 'sonner'
+
import { acceptOrganisationInvitation } from '~/api'
+import { DetailedOrganisation } from '~/lib/models/Organisation'
import { authActions } from '~/lib/reducers/auth'
+import { StateType, useAppDispatch } from '~/lib/store'
+import { Badge, BadgeProps } from '~/ui/Badge'
+import Modal from '~/ui/Modal'
+import routes from '~/utils/routes'
interface OrganisationCardProps {
organisation: DetailedOrganisation
@@ -146,7 +145,7 @@ export const OrganisationCard = ({ organisation, reloadOrganisations }: Organisa
))}
</div>
</div>
- {!membership?.confirmed && (
+ {!membership?.confirmed ? (
<Modal
onClose={() => {
setShowInviteModal(false)
@@ -162,7 +161,7 @@ export const OrganisationCard = ({ organisation, reloadOrganisations }: Organisa
message={t('dashboard.invitationDesc', { project: name })}
isOpened={showInviteModal}
/>
- )}
+ ) : null}
</CardWrapper>
)
}
diff --git a/web/app/pages/Organisations/Organisations.tsx b/web/app/pages/Organisations/Organisations.tsx
index 403860476..7cb2d762f 100644
--- a/web/app/pages/Organisations/Organisations.tsx
+++ b/web/app/pages/Organisations/Organisations.tsx
@@ -1,32 +1,31 @@
-import React, { useState, useEffect, useCallback } from 'react'
-import { Link } from 'react-router'
-import { toast } from 'sonner'
-import { ClientOnly } from 'remix-utils/client-only'
+import { MagnifyingGlassIcon, XMarkIcon, BuildingOffice2Icon } from '@heroicons/react/24/outline'
+import { XCircleIcon } from '@heroicons/react/24/solid'
import _isEmpty from 'lodash/isEmpty'
-import _size from 'lodash/size'
import _map from 'lodash/map'
+import _size from 'lodash/size'
+import React, { useState, useEffect, useCallback } from 'react'
import { useTranslation } from 'react-i18next'
-import { MagnifyingGlassIcon, XMarkIcon, BuildingOffice2Icon } from '@heroicons/react/24/outline'
-import { XCircleIcon } from '@heroicons/react/24/solid'
+import { useSelector } from 'react-redux'
+import { Link } from 'react-router'
+import { ClientOnly } from 'remix-utils/client-only'
+import { toast } from 'sonner'
-import Modal from '~/ui/Modal'
-import { withAuthentication, auth } from '~/hoc/protected'
-import Loader from '~/ui/Loader'
-import routes from '~/utils/routes'
-import { ENTRIES_PER_PAGE_DASHBOARD } from '~/lib/constants'
+import { createOrganisation, getOrganisations } from '~/api'
import EventsRunningOutBanner from '~/components/EventsRunningOutBanner'
+import { withAuthentication, auth } from '~/hoc/protected'
import useDebounce from '~/hooks/useDebounce'
-
-import { createOrganisation, getOrganisations } from '~/api'
-
-import Pagination from '~/ui/Pagination'
+import { ENTRIES_PER_PAGE_DASHBOARD } from '~/lib/constants'
import { DetailedOrganisation } from '~/lib/models/Organisation'
+import { StateType } from '~/lib/store'
import Input from '~/ui/Input'
-import { OrganisationCard } from './OrganisationCard'
-import { NoOrganisations } from './NoOrganisations'
+import Loader from '~/ui/Loader'
+import Modal from '~/ui/Modal'
+import Pagination from '~/ui/Pagination'
+import routes from '~/utils/routes'
+
import { AddOrganisation } from './AddOrganisation'
-import { useSelector } from 'react-redux'
-import { StateType } from '~/lib/store'
+import { NoOrganisations } from './NoOrganisations'
+import { OrganisationCard } from './OrganisationCard'
const Organisations = () => {
const { loading: authLoading } = useSelector((state: StateType) => state.auth)
@@ -199,7 +198,7 @@ const Organisations = () => {
/>
)}
</h2>
- {isSearchActive && (
+ {isSearchActive ? (
<div className='hidden w-full max-w-md items-center px-2 pb-1 sm:ml-5 sm:flex'>
<label htmlFor='simple-search' className='sr-only'>
Search
@@ -217,7 +216,7 @@ const Organisations = () => {
/>
</div>
</div>
- )}
+ ) : null}
</div>
<span
onClick={onNewOrganisation}
@@ -227,7 +226,7 @@ const Organisations = () => {
{t('organisations.new')}
</span>
</div>
- {isSearchActive && (
+ {isSearchActive ? (
<div className='mb-2 flex w-full items-center sm:hidden'>
<label htmlFor='simple-search' className='sr-only'>
Search
@@ -245,7 +244,7 @@ const Organisations = () => {
/>
</div>
</div>
- )}
+ ) : null}
{authLoading || isLoading || isLoading === null ? (
<div className='min-h-min-footer bg-gray-50 dark:bg-slate-900'>
<Loader />
@@ -312,11 +311,11 @@ const Organisations = () => {
value={newOrganisationName}
onChange={(e) => setNewOrganisationName(e.target.value)}
/>
- {newOrganisationError && (
+ {newOrganisationError ? (
<p className='mt-2 text-sm font-medium text-red-500'>
{t('apiNotifications.errorOccured', { error: newOrganisationError })}
</p>
- )}
+ ) : null}
</div>
}
title={t('organisations.create')}
diff --git a/web/app/pages/Organisations/Settings/People.tsx b/web/app/pages/Organisations/Settings/People.tsx
index 3d69ea5ad..bd17aefeb 100644
--- a/web/app/pages/Organisations/Settings/People.tsx
+++ b/web/app/pages/Organisations/Settings/People.tsx
@@ -1,25 +1,25 @@
-import React, { useState, useEffect, useRef } from 'react'
-import { toast } from 'sonner'
import { ChevronDownIcon, CheckIcon } from '@heroicons/react/24/solid'
-import { useTranslation } from 'react-i18next'
import cx from 'clsx'
import dayjs from 'dayjs'
-import _keys from 'lodash/keys'
import _isEmpty from 'lodash/isEmpty'
+import _keys from 'lodash/keys'
import _map from 'lodash/map'
+import { Trash2Icon, UserRoundPlusIcon } from 'lucide-react'
+import React, { useState, useEffect, useRef } from 'react'
+import { useTranslation } from 'react-i18next'
+import { useSelector } from 'react-redux'
+import { toast } from 'sonner'
-import { isValidEmail } from '~/utils/validator'
-import Input from '~/ui/Input'
-import { Badge } from '~/ui/Badge'
-import Button from '~/ui/Button'
-import Modal from '~/ui/Modal'
-import { roles, INVITATION_EXPIRES_IN } from '~/lib/constants'
+import { changeOrganisationRole, inviteOrganisationMember, removeOrganisationMember } from '~/api'
import useOnClickOutside from '~/hooks/useOnClickOutside'
+import { roles, INVITATION_EXPIRES_IN } from '~/lib/constants'
import { DetailedOrganisation, Role } from '~/lib/models/Organisation'
-import { useSelector } from 'react-redux'
import { StateType } from '~/lib/store'
-import { changeOrganisationRole, inviteOrganisationMember, removeOrganisationMember } from '~/api'
-import { Trash2Icon, UserRoundPlusIcon } from 'lucide-react'
+import { Badge } from '~/ui/Badge'
+import Button from '~/ui/Button'
+import Input from '~/ui/Input'
+import Modal from '~/ui/Modal'
+import { isValidEmail } from '~/utils/validator'
const NoPeople = () => {
const { t } = useTranslation('common')
@@ -104,11 +104,11 @@ const UsersList = ({ members, onRemove }: UsersListProps) => {
<p className='truncate font-bold text-gray-700 group-hover:text-gray-200 dark:text-gray-200'>
{t(`organisations.role.${itRole}.name`)}
</p>
- {member.role === itRole && (
+ {member.role === itRole ? (
<span className='ml-3 flex-none text-indigo-600 group-hover:text-gray-200'>
<CheckIcon className='size-5' />
</span>
- )}
+ ) : null}
</div>
<p className='mt-1 text-sm whitespace-normal text-gray-500 group-hover:text-gray-200'>
{t(`organisations.role.${itRole}.desc`)}
@@ -374,7 +374,7 @@ const People = ({ organisation, reloadOrganisation }: PeopleProps) => {
placeholder='[email protected]'
className='mt-4'
onChange={handleInput}
- error={beenSubmitted && errors.email}
+ error={beenSubmitted ? errors.email : null}
/>
<fieldset className='mt-4'>
{/* eslint-disable-next-line jsx-a11y/label-has-associated-control */}
@@ -465,11 +465,11 @@ const People = ({ organisation, reloadOrganisation }: PeopleProps) => {
</div>
</label>
</div>
- {errors.role && (
+ {errors.role ? (
<p className='mt-2 text-sm text-red-600 dark:text-red-500' id='email-error'>
{errors.role}
</p>
- )}
+ ) : null}
</fieldset>
</div>
}
diff --git a/web/app/pages/Organisations/Settings/Projects.tsx b/web/app/pages/Organisations/Settings/Projects.tsx
index 0ff2217f5..742a57bd4 100644
--- a/web/app/pages/Organisations/Settings/Projects.tsx
+++ b/web/app/pages/Organisations/Settings/Projects.tsx
@@ -1,25 +1,25 @@
-import React, { useState, useEffect, useMemo } from 'react'
-import { toast } from 'sonner'
import { InformationCircleIcon, MagnifyingGlassIcon, FolderPlusIcon, XMarkIcon } from '@heroicons/react/24/outline'
-import { useTranslation } from 'react-i18next'
+import _filter from 'lodash/filter'
import _isEmpty from 'lodash/isEmpty'
-import _replace from 'lodash/replace'
import _map from 'lodash/map'
-import _filter from 'lodash/filter'
+import _replace from 'lodash/replace'
+import { useState, useEffect, useMemo } from 'react'
+import { useTranslation } from 'react-i18next'
+import { useSelector } from 'react-redux'
+import { Link } from 'react-router'
+import { toast } from 'sonner'
-import Button from '~/ui/Button'
-import Modal from '~/ui/Modal'
+import { removeProjectFromOrganisation, getProjectsAvailableForOrganisation, addProjectToOrganisation } from '~/api'
+import useDebounce from '~/hooks/useDebounce'
import { DetailedOrganisation } from '~/lib/models/Organisation'
-import { useSelector } from 'react-redux'
+import { Project } from '~/lib/models/Project'
import { StateType } from '~/lib/store'
-import Tooltip from '~/ui/Tooltip'
-import { removeProjectFromOrganisation, getProjectsAvailableForOrganisation, addProjectToOrganisation } from '~/api'
-import { Link } from 'react-router'
-import routes from '~/utils/routes'
+import Button from '~/ui/Button'
import Loader from '~/ui/Loader'
+import Modal from '~/ui/Modal'
import Pagination from '~/ui/Pagination'
-import useDebounce from '~/hooks/useDebounce'
-import { Project } from '~/lib/models/Project'
+import Tooltip from '~/ui/Tooltip'
+import routes from '~/utils/routes'
interface SelectAProjectProps {
onSelect: (project: Project) => void
@@ -277,7 +277,7 @@ export const Projects = ({ organisation, reloadOrganisation }: ProjectsProps) =>
</>
</Button>
</div>
- {isSearchActive && (
+ {isSearchActive ? (
<div className='relative w-full'>
<div className='pointer-events-none absolute inset-y-0 left-0 hidden items-center sm:flex'>
<MagnifyingGlassIcon className='ml-2 h-5 w-5 cursor-pointer text-gray-900 hover:opacity-80 dark:text-gray-50' />
@@ -293,7 +293,7 @@ export const Projects = ({ organisation, reloadOrganisation }: ProjectsProps) =>
placeholder={t('project.search')}
/>
</div>
- )}
+ ) : null}
<div>
{_isEmpty(filteredProjects) ? (
<NoProjects />
diff --git a/web/app/pages/Organisations/Settings/index.tsx b/web/app/pages/Organisations/Settings/index.tsx
index d67fe3426..95380d010 100644
--- a/web/app/pages/Organisations/Settings/index.tsx
+++ b/web/app/pages/Organisations/Settings/index.tsx
@@ -1,28 +1,29 @@
-import React, { useState, useEffect, useCallback, useMemo } from 'react'
-import { toast } from 'sonner'
-import { Link, useNavigate } from 'react-router'
-import { useTranslation } from 'react-i18next'
+import { XCircleIcon } from '@heroicons/react/24/outline'
import _isEmpty from 'lodash/isEmpty'
-import _size from 'lodash/size'
import _keys from 'lodash/keys'
+import _size from 'lodash/size'
+import { Trash2Icon } from 'lucide-react'
+import React, { useState, useEffect, useCallback, useMemo } from 'react'
+import { useTranslation } from 'react-i18next'
+import { useSelector } from 'react-redux'
+import { Link, useNavigate } from 'react-router'
+import { toast } from 'sonner'
+import { transferProject, getOrganisation, updateOrganisation, deleteOrganisation } from '~/api'
import { withAuthentication, auth } from '~/hoc/protected'
+import { useRequiredParams } from '~/hooks/useRequiredParams'
import { TITLE_SUFFIX } from '~/lib/constants'
-import { transferProject, getOrganisation, updateOrganisation, deleteOrganisation } from '~/api'
-import Input from '~/ui/Input'
+import { DetailedOrganisation } from '~/lib/models/Organisation'
+import { StateType } from '~/lib/store'
import Button from '~/ui/Button'
+import Input from '~/ui/Input'
import Loader from '~/ui/Loader'
import Modal from '~/ui/Modal'
import routes from '~/utils/routes'
import People from './People'
-import { useRequiredParams } from '~/hooks/useRequiredParams'
-import { DetailedOrganisation } from '~/lib/models/Organisation'
-import { StateType } from '~/lib/store'
-import { useSelector } from 'react-redux'
import { Projects } from './Projects'
-import { XCircleIcon } from '@heroicons/react/24/outline'
-import { Trash2Icon } from 'lucide-react'
+
// import { ArrowLeftRight } from 'lucide-react'
const MAX_NAME_LENGTH = 50
diff --git a/web/app/pages/Performance/index.tsx b/web/app/pages/Performance/index.tsx
index 1955db611..9cf96fe98 100644
--- a/web/app/pages/Performance/index.tsx
+++ b/web/app/pages/Performance/index.tsx
@@ -1,23 +1,23 @@
-import { Link } from 'react-router'
-import React, { memo } from 'react'
+import { ArrowRightIcon } from '@heroicons/react/20/solid'
+import { ChevronRightIcon } from '@heroicons/react/24/solid'
+import _isEmpty from 'lodash/isEmpty'
+import _map from 'lodash/map'
+import { memo } from 'react'
import { useTranslation, Trans } from 'react-i18next'
import { useSelector } from 'react-redux'
+import { Link } from 'react-router'
import { ClientOnly } from 'remix-utils/client-only'
-import { ChevronRightIcon } from '@heroicons/react/24/solid'
-import { ArrowRightIcon } from '@heroicons/react/20/solid'
-import _map from 'lodash/map'
-import _isEmpty from 'lodash/isEmpty'
-import routesPath from '~/utils/routes'
-import { getAccessToken } from '~/utils/accessToken'
-import { nFormatterSeparated } from '~/utils/generic'
+import Header from '~/components/Header'
+import { DitchGoogle } from '~/components/marketing/DitchGoogle'
import { PERFORMANCE_LIVE_DEMO_URL, isBrowser } from '~/lib/constants'
import { StateType } from '~/lib/store/index'
import BackgroundSvg from '~/ui/icons/BackgroundSvg'
+import { getAccessToken } from '~/utils/accessToken'
+import { nFormatterSeparated } from '~/utils/generic'
+import routesPath from '~/utils/routes'
-import Header from '~/components/Header'
import Pricing from '../../components/marketing/Pricing'
-import { DitchGoogle } from '~/components/marketing/DitchGoogle'
const Lines = () => (
<div className='pointer-events-none relative'>
@@ -55,7 +55,7 @@ export const PeopleLoveSwetrix = () => {
{() => (
<p className='text-center text-5xl font-extrabold text-indigo-700'>
{users[0]}
- {users[1] && <span className='text-gray-900 dark:text-indigo-200'>{users[1]}+</span>}
+ {users[1] ? <span className='text-gray-900 dark:text-indigo-200'>{users[1]}+</span> : null}
</p>
)}
</ClientOnly>
@@ -67,7 +67,7 @@ export const PeopleLoveSwetrix = () => {
{() => (
<p className='text-center text-5xl font-extrabold text-indigo-700'>
{websites[0]}
- {websites[1] && <span className='text-gray-900 dark:text-indigo-200'>{websites[1]}+</span>}
+ {websites[1] ? <span className='text-gray-900 dark:text-indigo-200'>{websites[1]}+</span> : null}
</p>
)}
</ClientOnly>
@@ -79,7 +79,7 @@ export const PeopleLoveSwetrix = () => {
{() => (
<p className='text-center text-5xl font-extrabold text-indigo-700'>
{events[0]}
- {events[1] && <span className='text-gray-900 dark:text-indigo-200'>{events[1]}+</span>}
+ {events[1] ? <span className='text-gray-900 dark:text-indigo-200'>{events[1]}+</span> : null}
</p>
)}
</ClientOnly>
@@ -281,7 +281,7 @@ const Performance = ({ ssrTheme, ssrAuthenticated }: PerformanceProps) => {
</div>
{/* For now let's hide Pricing for authenticated users on the main page as the Paddle script only loads on the Billing page */}
- {!authenticated && <Pricing authenticated={false} />}
+ {!authenticated ? <Pricing authenticated={false} /> : null}
<DitchGoogle
screenshot={{
diff --git a/web/app/pages/Privacy/index.tsx b/web/app/pages/Privacy/index.tsx
index 9ca0db4b0..11b95cc54 100644
--- a/web/app/pages/Privacy/index.tsx
+++ b/web/app/pages/Privacy/index.tsx
@@ -1,5 +1,4 @@
/* eslint-disable react/no-unescaped-entities */
-import React from 'react'
import _map from 'lodash/map'
import { CONTACT_EMAIL, SECURITY_EMAIL, DOCS_URL } from '~/lib/constants'
diff --git a/web/app/pages/Project/Alerts/Settings/ProjectAlertsSettings.tsx b/web/app/pages/Project/Alerts/Settings/ProjectAlertsSettings.tsx
index 2d660e5a8..7093ac1f7 100644
--- a/web/app/pages/Project/Alerts/Settings/ProjectAlertsSettings.tsx
+++ b/web/app/pages/Project/Alerts/Settings/ProjectAlertsSettings.tsx
@@ -1,32 +1,32 @@
-import React, { useEffect, useMemo, useState } from 'react'
-import { useNavigate, Link } from 'react-router'
-import { useTranslation, Trans } from 'react-i18next'
-import { toast } from 'sonner'
import { ExclamationTriangleIcon, XCircleIcon } from '@heroicons/react/24/outline'
-
+import { clsx as cx } from 'clsx'
+import _findKey from 'lodash/findKey'
import _isEmpty from 'lodash/isEmpty'
-import _size from 'lodash/size'
-import _split from 'lodash/split'
import _keys from 'lodash/keys'
import _reduce from 'lodash/reduce'
-import _values from 'lodash/values'
-import _findKey from 'lodash/findKey'
+import _size from 'lodash/size'
+import _split from 'lodash/split'
import _toNumber from 'lodash/toNumber'
-import { clsx as cx } from 'clsx'
-import Input from '~/ui/Input'
-import Button from '~/ui/Button'
-import Checkbox from '~/ui/Checkbox'
-import Modal from '~/ui/Modal'
-import { PROJECT_TABS, QUERY_CONDITION, QUERY_METRIC, QUERY_TIME } from '~/lib/constants'
+import _values from 'lodash/values'
+import React, { useEffect, useMemo, useState } from 'react'
+import { useTranslation, Trans } from 'react-i18next'
+import { useSelector } from 'react-redux'
+import { useNavigate, Link } from 'react-router'
+import { toast } from 'sonner'
+
import { createAlert, updateAlert, deleteAlert, CreateAlert, getAlert } from '~/api'
import { withAuthentication, auth } from '~/hoc/protected'
-import routes from '~/utils/routes'
-import Select from '~/ui/Select'
+import { useRequiredParams } from '~/hooks/useRequiredParams'
+import { PROJECT_TABS, QUERY_CONDITION, QUERY_METRIC, QUERY_TIME } from '~/lib/constants'
import { Alerts } from '~/lib/models/Alerts'
import { StateType } from '~/lib/store'
-import { useSelector } from 'react-redux'
-import { useRequiredParams } from '~/hooks/useRequiredParams'
+import Button from '~/ui/Button'
+import Checkbox from '~/ui/Checkbox'
+import Input from '~/ui/Input'
import Loader from '~/ui/Loader'
+import Modal from '~/ui/Modal'
+import Select from '~/ui/Select'
+import routes from '~/utils/routes'
const INTEGRATIONS_LINK = `${routes.user_settings}#integrations`
@@ -50,9 +50,7 @@ const ProjectAlertsSettings = ({ isSettings }: ProjectAlertsSettingsProps) => {
queryCustomEvent: '',
})
const [validated, setValidated] = useState(false)
- const [errors, setErrors] = useState<{
- [key: string]: string
- }>({})
+ const [errors, setErrors] = useState<Record<string, string>>({})
const [beenSubmitted, setBeenSubmitted] = useState(false)
const [showModal, setShowModal] = useState(false)
@@ -103,9 +101,7 @@ const ProjectAlertsSettings = ({ isSettings }: ProjectAlertsSettingsProps) => {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [authLoading, id, isSettings])
- const queryTimeTMapping: {
- [key: string]: string
- } = useMemo(() => {
+ const queryTimeTMapping: Record<string, string> = useMemo(() => {
const values = _values(QUERY_TIME)
return _reduce(
@@ -135,9 +131,7 @@ const ProjectAlertsSettings = ({ isSettings }: ProjectAlertsSettingsProps) => {
)
}, [t])
- const queryConditionTMapping: {
- [key: string]: string
- } = useMemo(() => {
+ const queryConditionTMapping: Record<string, string> = useMemo(() => {
const values = _values(QUERY_CONDITION)
return _reduce(
@@ -170,9 +164,7 @@ const ProjectAlertsSettings = ({ isSettings }: ProjectAlertsSettingsProps) => {
}, [alert])
const validate = () => {
- const allErrors: {
- [key: string]: string
- } = {}
+ const allErrors: Record<string, string> = {}
if (_isEmpty(form.name) || _size(form.name) < 3) {
allErrors.name = t('alert.noNameError')
@@ -205,7 +197,7 @@ const ProjectAlertsSettings = ({ isSettings }: ProjectAlertsSettingsProps) => {
})
} else {
createAlert(data as CreateAlert)
- .then((res) => {
+ .then(() => {
navigate(`/projects/${pid}?tab=${PROJECT_TABS.alerts}`)
toast.success(t('alertsSettings.alertCreated'))
})
@@ -313,7 +305,7 @@ const ProjectAlertsSettings = ({ isSettings }: ProjectAlertsSettingsProps) => {
>
<form className='mx-auto w-full max-w-7xl' onSubmit={handleSubmit}>
<h2 className='mt-2 text-3xl font-bold text-gray-900 dark:text-gray-50'>{title}</h2>
- {!authLoading && !isIntegrationLinked && (
+ {!authLoading && !isIntegrationLinked ? (
<div className='mt-2 flex items-center rounded-sm bg-blue-50 px-5 py-3 text-base whitespace-pre-wrap dark:bg-slate-800 dark:text-gray-50'>
<ExclamationTriangleIcon className='mr-1 h-5 w-5' />
<Trans
@@ -325,7 +317,7 @@ const ProjectAlertsSettings = ({ isSettings }: ProjectAlertsSettingsProps) => {
}}
/>
</div>
- )}
+ ) : null}
<Input
name='name'
label={t('alert.name')}
@@ -366,7 +358,7 @@ const ProjectAlertsSettings = ({ isSettings }: ProjectAlertsSettingsProps) => {
capitalise
/>
</div>
- {form.queryMetric === QUERY_METRIC.CUSTOM_EVENTS && (
+ {form.queryMetric === QUERY_METRIC.CUSTOM_EVENTS ? (
<Input
name='queryCustomEvent'
label={t('alert.customEvent')}
@@ -376,7 +368,7 @@ const ProjectAlertsSettings = ({ isSettings }: ProjectAlertsSettingsProps) => {
onChange={handleInput}
error={beenSubmitted ? errors.queryCustomEvent : null}
/>
- )}
+ ) : null}
<div className='mt-4'>
<Select
id='queryCondition'
@@ -434,7 +426,7 @@ const ProjectAlertsSettings = ({ isSettings }: ProjectAlertsSettingsProps) => {
<Button
className='mr-2 border-indigo-100 dark:border-slate-700/50 dark:bg-slate-800 dark:text-gray-50 dark:hover:bg-slate-700'
as={Link}
- // @ts-ignore
+ // @ts-expect-error
to={`/projects/${pid}?tab=${PROJECT_TABS.alerts}`}
secondary
regular
@@ -451,7 +443,7 @@ const ProjectAlertsSettings = ({ isSettings }: ProjectAlertsSettingsProps) => {
<Button
className='mr-2 border-indigo-100 dark:border-slate-700/50 dark:bg-slate-800 dark:text-gray-50 dark:hover:bg-slate-700'
as={Link}
- // @ts-ignore
+ // @ts-expect-error
to={`/projects/${pid}?tab=${PROJECT_TABS.alerts}`}
secondary
regular
diff --git a/web/app/pages/Project/Alerts/View/ProjectAlertsView.tsx b/web/app/pages/Project/Alerts/View/ProjectAlertsView.tsx
index ef8d5316c..c47b81749 100644
--- a/web/app/pages/Project/Alerts/View/ProjectAlertsView.tsx
+++ b/web/app/pages/Project/Alerts/View/ProjectAlertsView.tsx
@@ -1,14 +1,3 @@
-import React, { useMemo, useState, useEffect } from 'react'
-import dayjs from 'dayjs'
-import _map from 'lodash/map'
-import _isEmpty from 'lodash/isEmpty'
-import _replace from 'lodash/replace'
-import _values from 'lodash/values'
-import _reduce from 'lodash/reduce'
-import { useNavigate, Link } from 'react-router'
-import { useTranslation } from 'react-i18next'
-import { useSelector } from 'react-redux'
-import { toast } from 'sonner'
import {
CurrencyDollarIcon,
AdjustmentsVerticalIcon,
@@ -17,18 +6,30 @@ import {
XCircleIcon,
} from '@heroicons/react/24/outline'
import cx from 'clsx'
+import dayjs from 'dayjs'
+import _isEmpty from 'lodash/isEmpty'
+import _map from 'lodash/map'
+import _reduce from 'lodash/reduce'
+import _replace from 'lodash/replace'
+import _values from 'lodash/values'
+import { Trash2Icon, BellRingIcon } from 'lucide-react'
+import { useMemo, useState, useEffect } from 'react'
+import { useTranslation } from 'react-i18next'
+import { useSelector } from 'react-redux'
+import { useNavigate, Link } from 'react-router'
+import { toast } from 'sonner'
-import routes from '~/utils/routes'
-import Button from '~/ui/Button'
-import Modal from '~/ui/Modal'
-import PaidFeature from '~/modals/PaidFeature'
-import { QUERY_METRIC, PLAN_LIMITS, DEFAULT_ALERTS_TAKE } from '~/lib/constants'
import { deleteAlert as deleteAlertApi, getProjectAlerts } from '~/api'
-import { StateType } from '~/lib/store'
+import { QUERY_METRIC, PLAN_LIMITS, DEFAULT_ALERTS_TAKE } from '~/lib/constants'
import { Alerts } from '~/lib/models/Alerts'
+import { StateType } from '~/lib/store'
+import PaidFeature from '~/modals/PaidFeature'
+import Button from '~/ui/Button'
import Loader from '~/ui/Loader'
+import Modal from '~/ui/Modal'
import Pagination from '~/ui/Pagination'
-import { Trash2Icon, BellRingIcon } from 'lucide-react'
+import routes from '~/utils/routes'
+
import { useViewProjectContext } from '../../View/ViewProject'
const Separator = ({ className }: { className?: string }) => (
@@ -200,7 +201,7 @@ const ProjectAlerts = () => {
const limits = PLAN_LIMITS[user?.planCode] || PLAN_LIMITS.trial
const isLimitReached = authenticated && total >= limits?.maxAlerts
- const loadAlerts = async (take: number, skip: number, search?: string) => {
+ const loadAlerts = async (take: number, skip: number) => {
if (isLoading) {
return
}
@@ -223,9 +224,7 @@ const ProjectAlerts = () => {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [page])
- const queryMetricTMapping: {
- [key: string]: string
- } = useMemo(() => {
+ const queryMetricTMapping: Record<string, string> = useMemo(() => {
const values = _values(QUERY_METRIC)
return _reduce(
@@ -327,13 +326,13 @@ const ProjectAlerts = () => {
secondary
large
>
- {isLimitReached && <CurrencyDollarIcon className='mr-1 h-5 w-5' />}
+ {isLimitReached ? <CurrencyDollarIcon className='mr-1 h-5 w-5' /> : null}
{t('alert.add')}
</Button>
</div>
) : (
<>
- {!isIntegrationLinked && <NoNotificationChannelSet />}
+ {!isIntegrationLinked ? <NoNotificationChannelSet /> : null}
<ul className='mt-4 grid grid-cols-1 gap-x-6 gap-y-3 lg:grid-cols-3 lg:gap-y-6'>
{_map(alerts, (alert) => (
<AlertCard
diff --git a/web/app/pages/Project/ConfirmShare/index.tsx b/web/app/pages/Project/ConfirmShare/index.tsx
index 4730e1aca..c0103ff57 100644
--- a/web/app/pages/Project/ConfirmShare/index.tsx
+++ b/web/app/pages/Project/ConfirmShare/index.tsx
@@ -1,12 +1,12 @@
-import { useState, useEffect } from 'react'
-import { useParams, Link } from 'react-router'
-import { useTranslation } from 'react-i18next'
import { CheckCircleIcon, XCircleIcon } from '@heroicons/react/24/solid'
import _split from 'lodash/split'
+import { useState, useEffect } from 'react'
+import { useTranslation } from 'react-i18next'
+import { useParams, Link } from 'react-router'
+import { verifyShare } from '~/api'
import Loader from '~/ui/Loader'
import routes from '~/utils/routes'
-import { verifyShare } from '~/api'
const ConfirmShare = () => {
const { t } = useTranslation('common')
diff --git a/web/app/pages/Project/New/index.tsx b/web/app/pages/Project/New/index.tsx
index a45889d5e..2c2aca6c8 100644
--- a/web/app/pages/Project/New/index.tsx
+++ b/web/app/pages/Project/New/index.tsx
@@ -1,23 +1,23 @@
+import _isEmpty from 'lodash/isEmpty'
+import _keys from 'lodash/keys'
+import _size from 'lodash/size'
import React, { useState, useEffect, useMemo } from 'react'
-import { Link, useNavigate } from 'react-router'
import { useTranslation } from 'react-i18next'
import { useSelector } from 'react-redux'
+import { Link, useNavigate } from 'react-router'
import { toast } from 'sonner'
-import _isEmpty from 'lodash/isEmpty'
-import _size from 'lodash/size'
-import _keys from 'lodash/keys'
+import { createProject } from '~/api'
import { withAuthentication, auth } from '~/hoc/protected'
import { isSelfhosted, TITLE_SUFFIX } from '~/lib/constants'
import { Project } from '~/lib/models/Project'
-import { createProject } from '~/api'
-import Input from '~/ui/Input'
+import { useAppDispatch, StateType } from '~/lib/store'
import Button from '~/ui/Button'
+import Input from '~/ui/Input'
import Loader from '~/ui/Loader'
+import Select from '~/ui/Select'
import { trackCustom } from '~/utils/analytics'
import routes from '~/utils/routes'
-import { useAppDispatch, StateType } from '~/lib/store'
-import Select from '~/ui/Select'
const MAX_NAME_LENGTH = 50
@@ -152,7 +152,7 @@ const NewProject = () => {
error={beenSubmitted ? errors.name : null}
/>
- {organisations.length > 1 && (
+ {organisations.length > 1 ? (
<div className='mt-4'>
<Select
items={organisations}
@@ -174,7 +174,7 @@ const NewProject = () => {
title={organisations.find((org) => org.id === form.organisationId)?.name}
/>
</div>
- )}
+ ) : null}
<p className='mt-1 mb-4 font-mono text-sm text-gray-500 italic dark:text-gray-300'>
{t('project.settings.createHint')}
diff --git a/web/app/pages/Project/ProjectProtectedPassword/index.tsx b/web/app/pages/Project/ProjectProtectedPassword/index.tsx
index 13a0df4a5..6acd6254c 100644
--- a/web/app/pages/Project/ProjectProtectedPassword/index.tsx
+++ b/web/app/pages/Project/ProjectProtectedPassword/index.tsx
@@ -1,20 +1,20 @@
-import React, { useState, useEffect, memo } from 'react'
-import { Link, useNavigate } from 'react-router'
-import { useTranslation } from 'react-i18next'
-import _keys from 'lodash/keys'
import _isEmpty from 'lodash/isEmpty'
-import _size from 'lodash/size'
+import _keys from 'lodash/keys'
import _replace from 'lodash/replace'
+import _size from 'lodash/size'
+import React, { useState, useEffect, memo } from 'react'
+import { useTranslation } from 'react-i18next'
+import { useDispatch } from 'react-redux'
+import { Link, useNavigate } from 'react-router'
-import routes from '~/utils/routes'
-import Input from '~/ui/Input'
-import Button from '~/ui/Button'
import { checkPassword } from '~/api'
-import { useDispatch } from 'react-redux'
-import UIActions from '~/lib/reducers/ui'
-import Header from '~/components/Header'
import Footer from '~/components/Footer'
+import Header from '~/components/Header'
import { useRequiredParams } from '~/hooks/useRequiredParams'
+import UIActions from '~/lib/reducers/ui'
+import Button from '~/ui/Button'
+import Input from '~/ui/Input'
+import routes from '~/utils/routes'
interface ProjectProtectedPasswordForm {
password: string
@@ -116,7 +116,7 @@ const ProjectProtectedPassword = ({ ssrTheme, embedded, isAuth }: ProjectProtect
return (
<>
- {!embedded && <Header ssrTheme={ssrTheme} authenticated={isAuth} />}
+ {!embedded ? <Header ssrTheme={ssrTheme} authenticated={isAuth} /> : null}
<div className='min-h-page flex flex-col bg-gray-50 px-4 py-6 sm:px-6 lg:px-8 dark:bg-slate-900'>
<form className='mx-auto w-full max-w-7xl' onSubmit={handleSubmit}>
<h2 className='mt-2 text-3xl font-bold text-gray-900 dark:text-gray-50'>{t('titles.passwordProtected')}</h2>
@@ -128,7 +128,7 @@ const ProjectProtectedPassword = ({ ssrTheme, embedded, isAuth }: ProjectProtect
placeholder={t('auth.common.password')}
className='mt-4'
onChange={handleInput}
- error={beenSubmitted && errors.password}
+ error={beenSubmitted ? errors.password : null}
/>
<div className='mt-5'>
<Button
@@ -147,7 +147,7 @@ const ProjectProtectedPassword = ({ ssrTheme, embedded, isAuth }: ProjectProtect
</div>
</form>
</div>
- {!embedded && <Footer authenticated={isAuth} />}
+ {!embedded ? <Footer authenticated={isAuth} /> : null}
</>
)
}
diff --git a/web/app/pages/Project/Settings/Emails/ConfirmReportsShare/index.tsx b/web/app/pages/Project/Settings/Emails/ConfirmReportsShare/index.tsx
index f189d7cfe..da2d1cf33 100644
--- a/web/app/pages/Project/Settings/Emails/ConfirmReportsShare/index.tsx
+++ b/web/app/pages/Project/Settings/Emails/ConfirmReportsShare/index.tsx
@@ -1,11 +1,10 @@
-import React, { useState, useEffect, memo } from 'react'
-import { useParams, Link } from 'react-router'
-import { useTranslation } from 'react-i18next'
import { CheckCircleIcon, XCircleIcon } from '@heroicons/react/24/solid'
-
-import Loader from '~/ui/Loader'
+import { useState, useEffect, memo } from 'react'
+import { useTranslation } from 'react-i18next'
+import { useParams, Link } from 'react-router'
import { confirmSubscriberInvite } from '~/api'
+import Loader from '~/ui/Loader'
import routes from '~/utils/routes'
const ConfirmReportsShare = () => {
diff --git a/web/app/pages/Project/Settings/Emails/Emails.tsx b/web/app/pages/Project/Settings/Emails/Emails.tsx
index a38076eea..27d22738b 100644
--- a/web/app/pages/Project/Settings/Emails/Emails.tsx
+++ b/web/app/pages/Project/Settings/Emails/Emails.tsx
@@ -1,28 +1,26 @@
-import React, { useState, useEffect, useRef } from 'react'
-import { toast } from 'sonner'
import { ChevronDownIcon, CheckIcon } from '@heroicons/react/24/outline'
-import { useTranslation } from 'react-i18next'
+import cx from 'clsx'
import dayjs from 'dayjs'
-import _keys from 'lodash/keys'
-import _isEmpty from 'lodash/isEmpty'
import _filter from 'lodash/filter'
+import _isEmpty from 'lodash/isEmpty'
+import _keys from 'lodash/keys'
import _map from 'lodash/map'
import _toLower from 'lodash/toLower'
+import { MailPlusIcon, Trash2Icon } from 'lucide-react'
+import React, { useState, useEffect, useRef } from 'react'
+import { useTranslation } from 'react-i18next'
+import { toast } from 'sonner'
import { addSubscriber, removeSubscriber, getSubscribers, updateSubscriber } from '~/api'
-
-import { isValidEmail } from '~/utils/validator'
import useOnClickOutside from '~/hooks/useOnClickOutside'
import { reportFrequencyForEmailsOptions } from '~/lib/constants'
-
-import Input from '~/ui/Input'
+import { Subscriber } from '~/lib/models/Subscriber'
+import { Badge } from '~/ui/Badge'
import Button from '~/ui/Button'
-import Modal from '~/ui/Modal'
+import Input from '~/ui/Input'
import Loader from '~/ui/Loader'
-import cx from 'clsx'
-import { Badge } from '~/ui/Badge'
-import { Subscriber } from '~/lib/models/Subscriber'
-import { MailPlusIcon, Trash2Icon } from 'lucide-react'
+import Modal from '~/ui/Modal'
+import { isValidEmail } from '~/utils/validator'
interface ModalMessageProps {
handleInput: (e: React.ChangeEvent<HTMLInputElement>) => void
@@ -52,7 +50,7 @@ const ModalMessage = ({ handleInput, beenSubmitted, errors, form }: ModalMessage
placeholder='[email protected]'
className='mt-4'
onChange={handleInput}
- error={beenSubmitted && errors.email}
+ error={beenSubmitted ? errors.email : null}
/>
<fieldset className='mt-4'>
<legend className='block text-sm font-medium text-gray-700 dark:text-gray-300'>
@@ -74,11 +72,11 @@ const ModalMessage = ({ handleInput, beenSubmitted, errors, form }: ModalMessage
/>
))}
</div>
- {errors.reportFrequency && (
+ {errors.reportFrequency ? (
<p className='mt-2 text-sm text-red-600 dark:text-red-500' id='reportFrequency-error'>
{errors.reportFrequency}
</p>
- )}
+ ) : null}
</fieldset>
</div>
)
@@ -190,7 +188,7 @@ const EmailList = ({ data, onRemove, setEmails }: EmailListProps) => {
{t(`profileSettings.${_toLower(reportFrequency)}`)}
<ChevronDownIcon style={{ transform: open ? 'rotate(180deg)' : '' }} className='ml-0.5 h-4 w-4 pt-px' />
</button>
- {open && (
+ {open ? (
<ul
ref={openRef}
className='absolute right-0 z-10 mt-2 w-72 origin-top-right divide-y divide-gray-200 rounded-md bg-white text-left focus:outline-hidden dark:divide-gray-700 dark:bg-slate-900'
@@ -209,11 +207,11 @@ const EmailList = ({ data, onRemove, setEmails }: EmailListProps) => {
{t(`profileSettings.${_toLower(item.label)}`)}
</p>
</div>
- {reportFrequency === item.value && (
+ {reportFrequency === item.value ? (
<span className='text-indigo-600 group-hover:text-gray-200'>
<CheckIcon className='ml-1 h-7 w-7 pt-px' />
</span>
- )}
+ ) : null}
</li>
))}
<li
@@ -223,7 +221,7 @@ const EmailList = ({ data, onRemove, setEmails }: EmailListProps) => {
<p className='font-bold text-red-600 dark:text-red-500'>{t('project.settings.removeMember')}</p>
</li>
</ul>
- )}
+ ) : null}
</div>
) : (
<div className='flex items-center justify-end'>
@@ -408,7 +406,7 @@ const Emails = ({ projectId }: { projectId: string }) => {
<div className='mt-3 flex flex-col'>
<div className='-mx-4 -my-2 overflow-x-auto sm:-mx-6 md:overflow-x-visible lg:-mx-8'>
<div className='inline-block min-w-full py-2 md:px-6 lg:px-8'>
- {!loading && !_isEmpty(emails) && (
+ {!loading && !_isEmpty(emails) ? (
<div className='font-mono ring-1 ring-black/10 md:rounded-lg'>
<table className='min-w-full divide-y divide-gray-300 dark:divide-gray-600'>
<thead>
@@ -443,9 +441,9 @@ const Emails = ({ projectId }: { projectId: string }) => {
</tbody>
</table>
</div>
- )}
- {_isEmpty(emails) && <NoSubscribers />}
- {loading && <Loader />}
+ ) : null}
+ {_isEmpty(emails) ? <NoSubscribers /> : null}
+ {loading ? <Loader /> : null}
</div>
</div>
</div>
diff --git a/web/app/pages/Project/Settings/People/People.tsx b/web/app/pages/Project/Settings/People/People.tsx
index 9e7bf01fd..58e8f8d60 100644
--- a/web/app/pages/Project/Settings/People/People.tsx
+++ b/web/app/pages/Project/Settings/People/People.tsx
@@ -1,27 +1,27 @@
-import React, { useState, useEffect, useRef } from 'react'
-import { toast } from 'sonner'
import { ChevronDownIcon, CheckIcon } from '@heroicons/react/24/solid'
-import { useTranslation } from 'react-i18next'
import cx from 'clsx'
import dayjs from 'dayjs'
-import _keys from 'lodash/keys'
import _isEmpty from 'lodash/isEmpty'
+import _keys from 'lodash/keys'
import _map from 'lodash/map'
+import { Trash2Icon, UserRoundPlusIcon } from 'lucide-react'
+import React, { useState, useEffect, useRef } from 'react'
+import { useTranslation } from 'react-i18next'
+import { useSelector } from 'react-redux'
+import { toast } from 'sonner'
import { deleteShareProjectUsers, shareProject, changeShareRole } from '~/api'
-import { isValidEmail } from '~/utils/validator'
-import Input from '~/ui/Input'
-import { Badge } from '~/ui/Badge'
-import Button from '~/ui/Button'
-import Modal from '~/ui/Modal'
-import PaidFeature from '~/modals/PaidFeature'
-import { roles, INVITATION_EXPIRES_IN } from '~/lib/constants'
import useOnClickOutside from '~/hooks/useOnClickOutside'
-import { Project, ShareOwnerProject } from '~/lib/models/Project'
+import { roles, INVITATION_EXPIRES_IN } from '~/lib/constants'
import { Role } from '~/lib/models/Organisation'
-import { useSelector } from 'react-redux'
+import { Project, ShareOwnerProject } from '~/lib/models/Project'
import { StateType } from '~/lib/store'
-import { Trash2Icon, UserRoundPlusIcon } from 'lucide-react'
+import PaidFeature from '~/modals/PaidFeature'
+import { Badge } from '~/ui/Badge'
+import Button from '~/ui/Button'
+import Input from '~/ui/Input'
+import Modal from '~/ui/Modal'
+import { isValidEmail } from '~/utils/validator'
const NoPeople = () => {
const { t } = useTranslation('common')
@@ -83,7 +83,7 @@ const UsersList = ({ data, onRemove, language, authedUserEmail }: UsersListProps
{t(`project.settings.roles.${role}.name`)}
<ChevronDownIcon style={{ transform: open ? 'rotate(180deg)' : '' }} className='ml-0.5 h-4 w-4 pt-px' />
</button>
- {open && (
+ {open ? (
<ul
ref={openRef}
className='absolute right-0 z-10 mt-2 w-72 origin-top-right divide-y divide-gray-200 rounded-md bg-white text-left focus:outline-hidden dark:divide-gray-700 dark:bg-slate-900'
@@ -105,11 +105,11 @@ const UsersList = ({ data, onRemove, language, authedUserEmail }: UsersListProps
{t(`project.settings.roles.${itRole}.shortDesc`)}
</p>
</div>
- {role === itRole && (
+ {role === itRole ? (
<span className='text-indigo-600 group-hover:text-gray-200'>
<CheckIcon className='ml-1 h-7 w-7 pt-px' />
</span>
- )}
+ ) : null}
</li>
))}
<li
@@ -119,7 +119,7 @@ const UsersList = ({ data, onRemove, language, authedUserEmail }: UsersListProps
<p className='font-bold text-red-600 dark:text-red-500'>{t('project.settings.removeMember')}</p>
</li>
</ul>
- )}
+ ) : null}
</div>
) : (
<div className='flex items-center justify-end'>
@@ -371,7 +371,7 @@ const People = ({ project }: PeopleProps) => {
placeholder='[email protected]'
className='mt-4'
onChange={handleInput}
- error={beenSubmitted && errors.email}
+ error={beenSubmitted ? errors.email : null}
/>
<fieldset className='mt-4'>
{/* eslint-disable-next-line jsx-a11y/label-has-associated-control */}
@@ -462,11 +462,11 @@ const People = ({ project }: PeopleProps) => {
</div>
</label>
</div>
- {errors.role && (
+ {errors.role ? (
<p className='mt-2 text-sm text-red-600 dark:text-red-500' id='email-error'>
{errors.role}
</p>
- )}
+ ) : null}
</fieldset>
</div>
}
diff --git a/web/app/pages/Project/Settings/ProjectSettings.tsx b/web/app/pages/Project/Settings/ProjectSettings.tsx
index c8b1365c4..0de3c3c0e 100644
--- a/web/app/pages/Project/Settings/ProjectSettings.tsx
+++ b/web/app/pages/Project/Settings/ProjectSettings.tsx
@@ -1,25 +1,24 @@
-import React, { useState, useEffect, useMemo } from 'react'
-import { toast } from 'sonner'
-import { useLoaderData, useNavigate, Link } from 'react-router'
-import { useTranslation } from 'react-i18next'
+import { XCircleIcon } from '@heroicons/react/24/outline'
import cx from 'clsx'
-import _isEmpty from 'lodash/isEmpty'
-import _size from 'lodash/size'
-import _replace from 'lodash/replace'
+import _filter from 'lodash/filter'
import _find from 'lodash/find'
-import _join from 'lodash/join'
+import _includes from 'lodash/includes'
+import _isEmpty from 'lodash/isEmpty'
import _isString from 'lodash/isString'
-import _split from 'lodash/split'
+import _join from 'lodash/join'
import _keys from 'lodash/keys'
-import _filter from 'lodash/filter'
import _map from 'lodash/map'
+import _replace from 'lodash/replace'
+import _size from 'lodash/size'
+import _split from 'lodash/split'
import _toUpper from 'lodash/toUpper'
-import _includes from 'lodash/includes'
-import { XCircleIcon } from '@heroicons/react/24/outline'
+import { ArrowLeftRight, RotateCcw, Trash2Icon } from 'lucide-react'
+import React, { useState, useEffect, useMemo } from 'react'
+import { useTranslation } from 'react-i18next'
+import { useSelector } from 'react-redux'
+import { useLoaderData, useNavigate, Link } from 'react-router'
+import { toast } from 'sonner'
-import { withAuthentication, auth } from '~/hoc/protected'
-import { isSelfhosted, TITLE_SUFFIX, FILTERS_PANELS_ORDER, isBrowser } from '~/lib/constants'
-import { Project } from '~/lib/models/Project'
import {
updateProject,
deleteProject,
@@ -31,26 +30,28 @@ import {
getProject,
assignProjectToOrganisation,
} from '~/api'
-import Input from '~/ui/Input'
+import { withAuthentication, auth } from '~/hoc/protected'
+import { useRequiredParams } from '~/hooks/useRequiredParams'
+import { isSelfhosted, TITLE_SUFFIX, FILTERS_PANELS_ORDER, isBrowser } from '~/lib/constants'
+import { Project } from '~/lib/models/Project'
+import { StateType } from '~/lib/store'
import Button from '~/ui/Button'
-import Loader from '~/ui/Loader'
import Checkbox from '~/ui/Checkbox'
-import Modal from '~/ui/Modal'
+import Dropdown from '~/ui/Dropdown'
import FlatPicker from '~/ui/Flatpicker'
+import Input from '~/ui/Input'
+import Loader from '~/ui/Loader'
+import Modal from '~/ui/Modal'
+import MultiSelect from '~/ui/MultiSelect'
+import Select from '~/ui/Select'
import countries from '~/utils/isoCountries'
import routes from '~/utils/routes'
-import Dropdown from '~/ui/Dropdown'
-import MultiSelect from '~/ui/MultiSelect'
+
import CCRow from '../View/components/CCRow'
import { getFormatDate } from '../View/ViewProject.helpers'
-import People from './People'
import Emails from './Emails'
-import Select from '~/ui/Select'
-import { useRequiredParams } from '~/hooks/useRequiredParams'
-import { ArrowLeftRight, RotateCcw, Trash2Icon } from 'lucide-react'
-import { StateType } from '~/lib/store'
-import { useSelector } from 'react-redux'
+import People from './People'
const MAX_NAME_LENGTH = 50
const MAX_ORIGINS_LENGTH = 300
@@ -138,7 +139,7 @@ const ModalMessage = ({
))}
</nav>
</div>
- {tab === DELETE_DATA_MODAL_TABS[1].name && (
+ {tab === DELETE_DATA_MODAL_TABS[1].name ? (
<>
<p className='mt-4 mb-2 text-sm text-gray-500 dark:text-gray-300'>
{t('project.settings.reseted.partiallyDesc')}
@@ -159,13 +160,13 @@ const ModalMessage = ({
value={dateRange}
/>
</>
- )}
- {tab === DELETE_DATA_MODAL_TABS[0].name && (
+ ) : null}
+ {tab === DELETE_DATA_MODAL_TABS[0].name ? (
<p className='mt-4 mb-4 text-sm text-gray-500 italic dark:text-gray-300'>
{t('project.settings.reseted.allHint')}
</p>
- )}
- {tab === DELETE_DATA_MODAL_TABS[2].name && (
+ ) : null}
+ {tab === DELETE_DATA_MODAL_TABS[2].name ? (
<div className='min-h-[410px]'>
<p className='mt-4 mb-4 text-sm text-gray-500 italic dark:text-gray-300'>
{t('project.settings.reseted.viaFiltersHint')}
@@ -241,7 +242,7 @@ const ModalMessage = ({
)}
</div>
</div>
- )}
+ ) : null}
</>
)
}
@@ -716,7 +717,7 @@ const ProjectSettings = () => {
label={t('project.settings.protected')}
hint={t('project.settings.protectedHint')}
/>
- {organisations.length > 1 && (
+ {organisations.length > 1 ? (
<div className='mt-4'>
<Select
items={organisations}
@@ -739,7 +740,7 @@ const ProjectSettings = () => {
title={organisations.find((org) => org.id === form.organisationId)?.name}
/>
</div>
- )}
+ ) : null}
<div className='mt-8 flex flex-wrap justify-center gap-2 sm:justify-between'>
<div className='flex flex-wrap items-center gap-2'>
<Button
@@ -758,14 +759,14 @@ const ProjectSettings = () => {
</div>
{project.role === 'owner' ? (
<div className='flex flex-wrap justify-center gap-2'>
- {!isSelfhosted && (
+ {!isSelfhosted ? (
<Button onClick={() => setShowTransfer(true)} semiDanger semiSmall>
<>
<ArrowLeftRight className='mr-1 h-5 w-5' />
{t('project.settings.transfer')}
</>
</Button>
- )}
+ ) : null}
<Button onClick={() => !setResetting && setShowReset(true)} loading={isDeleting} semiDanger semiSmall>
<>
<RotateCcw className='mr-1 h-5 w-5' />
@@ -781,18 +782,18 @@ const ProjectSettings = () => {
</div>
) : null}
</div>
- {!isSelfhosted && (
+ {!isSelfhosted ? (
<>
<hr className='xs:mt-2 mt-8 border-gray-200 sm:mt-5 dark:border-gray-600' />
<Emails projectId={id} />
</>
- )}
- {!isSelfhosted && (
+ ) : null}
+ {!isSelfhosted ? (
<>
<hr className='mt-2 border-gray-200 sm:mt-5 dark:border-gray-600' />
<People project={project} />
</>
- )}
+ ) : null}
</form>
<Modal
onClose={() => setShowDelete(false)}
diff --git a/web/app/pages/Project/Settings/TransferProject/TransferProjectConfirm.tsx b/web/app/pages/Project/Settings/TransferProject/TransferProjectConfirm.tsx
index 4f925f836..32d9b97e1 100644
--- a/web/app/pages/Project/Settings/TransferProject/TransferProjectConfirm.tsx
+++ b/web/app/pages/Project/Settings/TransferProject/TransferProjectConfirm.tsx
@@ -1,11 +1,10 @@
-import React, { useState, useEffect } from 'react'
-import { Link } from 'react-router'
-import { useTranslation } from 'react-i18next'
import { CheckCircleIcon, XCircleIcon } from '@heroicons/react/24/solid'
-
-import Loader from '~/ui/Loader'
+import { useState, useEffect } from 'react'
+import { useTranslation } from 'react-i18next'
+import { Link } from 'react-router'
import { confirmTransferProject } from '~/api'
+import Loader from '~/ui/Loader'
import routes from '~/utils/routes'
const TransferProjectConfirm = () => {
diff --git a/web/app/pages/Project/Settings/TransferProject/TransferProjectReject.tsx b/web/app/pages/Project/Settings/TransferProject/TransferProjectReject.tsx
index c300b4866..cd92cb0ea 100644
--- a/web/app/pages/Project/Settings/TransferProject/TransferProjectReject.tsx
+++ b/web/app/pages/Project/Settings/TransferProject/TransferProjectReject.tsx
@@ -1,11 +1,10 @@
+import { XCircleIcon, InformationCircleIcon } from '@heroicons/react/24/solid'
import { useState, useEffect } from 'react'
-import { Link } from 'react-router'
import { useTranslation } from 'react-i18next'
-import { XCircleIcon, InformationCircleIcon } from '@heroicons/react/24/solid'
-
-import Loader from '~/ui/Loader'
+import { Link } from 'react-router'
import { rejectTransferProject } from '~/api'
+import Loader from '~/ui/Loader'
import routes from '~/utils/routes'
const TransferProjectReject = () => {
diff --git a/web/app/pages/Project/View/Panels.tsx b/web/app/pages/Project/View/Panels.tsx
index 239bee6a2..776cc9f4c 100644
--- a/web/app/pages/Project/View/Panels.tsx
+++ b/web/app/pages/Project/View/Panels.tsx
@@ -1,45 +1,27 @@
-import React, { memo, useState, useEffect, useMemo, Fragment } from 'react'
-import InnerHTML from 'dangerously-set-html-content'
-import { ArrowLongRightIcon, ArrowLongLeftIcon } from '@heroicons/react/24/solid'
import { ChevronUpIcon, ChevronDownIcon } from '@heroicons/react/20/solid'
-import cx from 'clsx'
+import { ArrowLongRightIcon, ArrowLongLeftIcon } from '@heroicons/react/24/solid'
import { pie } from 'billboard.js'
-import _keys from 'lodash/keys'
-import _values from 'lodash/values'
-import _map from 'lodash/map'
+import cx from 'clsx'
+import InnerHTML from 'dangerously-set-html-content'
+import _ceil from 'lodash/ceil'
+import _find from 'lodash/find'
+import _floor from 'lodash/floor'
+import _fromPairs from 'lodash/fromPairs'
+import _includes from 'lodash/includes'
import _isEmpty from 'lodash/isEmpty'
import _isString from 'lodash/isString'
+import _keys from 'lodash/keys'
+import _map from 'lodash/map'
import _orderBy from 'lodash/orderBy'
import _reduce from 'lodash/reduce'
+import _reverse from 'lodash/reverse'
import _round from 'lodash/round'
-import _find from 'lodash/find'
-import _includes from 'lodash/includes'
-import _floor from 'lodash/floor'
import _size from 'lodash/size'
import _slice from 'lodash/slice'
-import _sum from 'lodash/sum'
-import _ceil from 'lodash/ceil'
import _sortBy from 'lodash/sortBy'
-import _fromPairs from 'lodash/fromPairs'
+import _sum from 'lodash/sum'
import _toPairs from 'lodash/toPairs'
-import _reverse from 'lodash/reverse'
-
-import { nFormatter } from '~/utils/generic'
-import Progress from '~/ui/Progress'
-import Sort from '~/ui/icons/Sort'
-import Modal from '~/ui/Modal'
-import Button from '~/ui/Button'
-import Chart from '~/ui/Chart'
-import { PROJECT_TABS } from '~/lib/constants'
-import { Entry } from '~/lib/models/Entry'
-import InteractiveMap from './components/InteractiveMap'
-import UserFlow from './components/UserFlow'
-import { iconClassName } from './ViewProject.helpers'
-import Spin from '~/ui/icons/Spin'
-import { useTranslation } from 'react-i18next'
-import CustomEventsDropdown from './components/CustomEventsDropdown'
-import { Customs, Filter, Properties } from './interfaces/traffic'
-import { useViewProjectContext } from './ViewProject'
+import _values from 'lodash/values'
import {
AlignJustifyIcon,
ChartPieIcon,
@@ -49,6 +31,25 @@ import {
FilterIcon,
PuzzleIcon,
} from 'lucide-react'
+import React, { memo, useState, useEffect, useMemo, Fragment } from 'react'
+import { useTranslation } from 'react-i18next'
+
+import { PROJECT_TABS } from '~/lib/constants'
+import { Entry } from '~/lib/models/Entry'
+import Button from '~/ui/Button'
+import Chart from '~/ui/Chart'
+import Sort from '~/ui/icons/Sort'
+import Spin from '~/ui/icons/Spin'
+import Modal from '~/ui/Modal'
+import Progress from '~/ui/Progress'
+import { nFormatter } from '~/utils/generic'
+
+import CustomEventsDropdown from './components/CustomEventsDropdown'
+import InteractiveMap from './components/InteractiveMap'
+import UserFlow from './components/UserFlow'
+import { Customs, Filter, Properties } from './interfaces/traffic'
+import { useViewProjectContext } from './ViewProject'
+import { iconClassName } from './ViewProject.helpers'
const ENTRIES_PER_PANEL = 5
const ENTRIES_PER_CUSTOM_EVENTS_PANEL = 6
@@ -137,11 +138,11 @@ const PanelContainer = ({
>
<div className='mb-2 flex items-center justify-between'>
<h3 className='flex items-center font-mono text-lg leading-6 font-semibold text-gray-900 dark:text-gray-50'>
- {icon && <span className='mr-1'>{icon}</span>}
+ {icon ? <span className='mr-1'>{icon}</span> : null}
{name}
</h3>
<div className='flex'>
- {(checkIfBarsNeeded(type) || checkCustomTabs(type, customTabs)) && (
+ {checkIfBarsNeeded(type) || checkCustomTabs(type, customTabs) ? (
<AlignJustifyIcon
className={cx(iconClassName, 'cursor-pointer', {
'text-slate-900 dark:text-gray-50': activeFragment === 0,
@@ -150,10 +151,10 @@ const PanelContainer = ({
onClick={() => setActiveFragment(0)}
strokeWidth={1.5}
/>
- )}
+ ) : null}
{/* if it is a Country tab */}
- {(type === 'cc' || type === 'rg' || type === 'ct') && (
+ {type === 'cc' || type === 'rg' || type === 'ct' ? (
<>
<MapIcon
className={cx(iconClassName, 'ml-2 cursor-pointer', {
@@ -171,9 +172,9 @@ const PanelContainer = ({
strokeWidth={1.5}
/>
</>
- )}
+ ) : null}
- {type === 'pg' && activeTab !== PROJECT_TABS.performance && activeTab !== PROJECT_TABS.errors && (
+ {type === 'pg' && activeTab !== PROJECT_TABS.performance && activeTab !== PROJECT_TABS.errors ? (
<WorkflowIcon
className={cx(iconClassName, 'ml-2 cursor-pointer', {
'text-slate-900 dark:text-gray-50': activeFragment === 1,
@@ -182,10 +183,10 @@ const PanelContainer = ({
onClick={onExpandClick}
strokeWidth={1.5}
/>
- )}
+ ) : null}
{/* if this tab using Circle showing stats panel */}
- {(type === 'ce' || type === 'os' || type === 'br' || type === 'dv') && (
+ {type === 'ce' || type === 'os' || type === 'br' || type === 'dv' ? (
<ChartPieIcon
className={cx(iconClassName, 'ml-2 cursor-pointer', {
'text-slate-900 dark:text-gray-50': activeFragment === 1,
@@ -194,10 +195,10 @@ const PanelContainer = ({
onClick={() => setActiveFragment(1)}
strokeWidth={1.5}
/>
- )}
+ ) : null}
{/* if it is a 'Custom events' tab */}
- {(type === 'ce' || type === 'props') && (
+ {type === 'ce' || type === 'props' ? (
<>
<MaximizeIcon
className={cx(iconClassName, 'ml-2 cursor-pointer text-slate-400 dark:text-slate-500')}
@@ -205,9 +206,9 @@ const PanelContainer = ({
strokeWidth={1.5}
/>
</>
- )}
+ ) : null}
- {checkCustomTabs(type, customTabs) && (
+ {checkCustomTabs(type, customTabs) ? (
<>
{/* This is a temp fix to prevent multiple tabs of the same extensionID be displayed */}
{/* TODO: Investigate the issue and fix it */}
@@ -234,7 +235,7 @@ const PanelContainer = ({
)
})}
</>
- )}
+ ) : null}
</div>
</div>
{/* for other tabs */}
@@ -392,8 +393,8 @@ const KVTable = ({ listId, data, displayKeyAsHeader, onClick }: KVTableProps) =>
{displayKeyAsHeader ? listId : t('project.value')}
<Sort
className='ml-1'
- sortByAscend={sort.label === 'event' && sort.sortByAscend}
- sortByDescend={sort.label === 'event' && sort.sortByDescend}
+ sortByAscend={sort.label === 'event' ? sort.sortByAscend : null}
+ sortByDescend={sort.label === 'event' ? sort.sortByDescend : null}
/>
</th>
<th className='w-[30%] sm:w-1/6'>
@@ -401,8 +402,8 @@ const KVTable = ({ listId, data, displayKeyAsHeader, onClick }: KVTableProps) =>
{t('project.quantity')}
<Sort
className='ml-1'
- sortByAscend={sort.label === 'quantity' && sort.sortByAscend}
- sortByDescend={sort.label === 'quantity' && sort.sortByDescend}
+ sortByAscend={sort.label === 'quantity' ? sort.sortByAscend : null}
+ sortByDescend={sort.label === 'quantity' ? sort.sortByDescend : null}
/>
</p>
</th>
@@ -411,8 +412,8 @@ const KVTable = ({ listId, data, displayKeyAsHeader, onClick }: KVTableProps) =>
{t('project.conversion')}
<Sort
className='ml-1'
- sortByAscend={sort.label === 'conversion' && sort.sortByAscend}
- sortByDescend={sort.label === 'conversion' && sort.sortByDescend}
+ sortByAscend={sort.label === 'conversion' ? sort.sortByAscend : null}
+ sortByDescend={sort.label === 'conversion' ? sort.sortByDescend : null}
/>
</p>
</th>
@@ -687,8 +688,8 @@ const CustomEvents = ({
{t('project.event')}
<Sort
className='ml-1'
- sortByAscend={sort.label === 'event' && sort.sortByAscend}
- sortByDescend={sort.label === 'event' && sort.sortByDescend}
+ sortByAscend={sort.label === 'event' ? sort.sortByAscend : null}
+ sortByDescend={sort.label === 'event' ? sort.sortByDescend : null}
/>
</th>
<th className='w-[30%] sm:w-1/6'>
@@ -699,8 +700,8 @@ const CustomEvents = ({
{t('project.quantity')}
<Sort
className='ml-1'
- sortByAscend={sort.label === 'quantity' && sort.sortByAscend}
- sortByDescend={sort.label === 'quantity' && sort.sortByDescend}
+ sortByAscend={sort.label === 'quantity' ? sort.sortByAscend : null}
+ sortByDescend={sort.label === 'quantity' ? sort.sortByDescend : null}
/>
&nbsp;&nbsp;
</p>
@@ -713,8 +714,8 @@ const CustomEvents = ({
{t('project.conversion')}
<Sort
className='ml-1'
- sortByAscend={sort.label === 'conversion' && sort.sortByAscend}
- sortByDescend={sort.label === 'conversion' && sort.sortByDescend}
+ sortByAscend={sort.label === 'conversion' ? sort.sortByAscend : null}
+ sortByDescend={sort.label === 'conversion' ? sort.sortByDescend : null}
/>
</p>
</th>
@@ -750,7 +751,7 @@ const CustomEvents = ({
{uniques === 0 ? 100 : _round((customsEventsData[ev] / uniques) * 100, 2)}%
</td>
</tr>
- {activeEvents[ev] && !loadingEvents[ev] && (
+ {activeEvents[ev] && !loadingEvents[ev] ? (
<tr>
<td className='pl-9' colSpan={3}>
<KVTableContainer
@@ -764,7 +765,7 @@ const CustomEvents = ({
/>
</td>
</tr>
- )}
+ ) : null}
</Fragment>
))}
</tbody>
@@ -828,7 +829,7 @@ const CustomEvents = ({
isCustomContent
>
{/* Using this instead of dangerouslySetInnerHTML to support script tags */}
- {tabContent && <InnerHTML className='absolute overflow-auto' html={tabContent} />}
+ {tabContent ? <InnerHTML className='absolute overflow-auto' html={tabContent} /> : null}
</PanelContainer>
)
}
@@ -852,8 +853,8 @@ const CustomEvents = ({
{t('project.event')}
<Sort
className='ml-1'
- sortByAscend={sort.label === 'event' && sort.sortByAscend}
- sortByDescend={sort.label === 'event' && sort.sortByDescend}
+ sortByAscend={sort.label === 'event' ? sort.sortByAscend : null}
+ sortByDescend={sort.label === 'event' ? sort.sortByDescend : null}
/>
</th>
<th className='w-1/6 text-right'>
@@ -861,8 +862,8 @@ const CustomEvents = ({
{t('project.quantity')}
<Sort
className='ml-1'
- sortByAscend={sort.label === 'quantity' && sort.sortByAscend}
- sortByDescend={sort.label === 'quantity' && sort.sortByDescend}
+ sortByAscend={sort.label === 'quantity' ? sort.sortByAscend : null}
+ sortByDescend={sort.label === 'quantity' ? sort.sortByDescend : null}
/>
&nbsp;&nbsp;
</p>
@@ -872,8 +873,8 @@ const CustomEvents = ({
{t('project.conversion')}
<Sort
className='ml-1'
- sortByAscend={sort.label === 'conversion' && sort.sortByAscend}
- sortByDescend={sort.label === 'conversion' && sort.sortByDescend}
+ sortByAscend={sort.label === 'conversion' ? sort.sortByAscend : null}
+ sortByDescend={sort.label === 'conversion' ? sort.sortByDescend : null}
/>
</p>
</th>
@@ -909,7 +910,7 @@ const CustomEvents = ({
</tbody>
</table>
{/* for pagination in tabs */}
- {_size(keys) > ENTRIES_PER_CUSTOM_EVENTS_PANEL && (
+ {_size(keys) > ENTRIES_PER_CUSTOM_EVENTS_PANEL ? (
<div className='absolute bottom-0 w-[calc(100%-2rem)] font-mono sm:w-[calc(100%-3rem)]'>
<div className='mb-2 flex justify-between select-none'>
<div>
@@ -954,7 +955,7 @@ const CustomEvents = ({
</div>
</div>
</div>
- )}
+ ) : null}
<Modal
onClose={onModalClose}
isOpened={detailsOpened}
@@ -1133,8 +1134,8 @@ const PageProperties = ({
{t('project.property')}
<Sort
className='ml-1'
- sortByAscend={sort.label === 'event' && sort.sortByAscend}
- sortByDescend={sort.label === 'event' && sort.sortByDescend}
+ sortByAscend={sort.label === 'event' ? sort.sortByAscend : null}
+ sortByDescend={sort.label === 'event' ? sort.sortByDescend : null}
/>
</th>
<th className='w-[30%] sm:w-1/6'>
@@ -1145,8 +1146,8 @@ const PageProperties = ({
{t('project.quantity')}
<Sort
className='ml-1'
- sortByAscend={sort.label === 'quantity' && sort.sortByAscend}
- sortByDescend={sort.label === 'quantity' && sort.sortByDescend}
+ sortByAscend={sort.label === 'quantity' ? sort.sortByAscend : null}
+ sortByDescend={sort.label === 'quantity' ? sort.sortByDescend : null}
/>
&nbsp;&nbsp;
</p>
@@ -1159,8 +1160,8 @@ const PageProperties = ({
{t('project.conversion')}
<Sort
className='ml-1'
- sortByAscend={sort.label === 'conversion' && sort.sortByAscend}
- sortByDescend={sort.label === 'conversion' && sort.sortByDescend}
+ sortByAscend={sort.label === 'conversion' ? sort.sortByAscend : null}
+ sortByDescend={sort.label === 'conversion' ? sort.sortByDescend : null}
/>
</p>
</th>
@@ -1196,7 +1197,7 @@ const PageProperties = ({
{uniques === 0 ? 100 : _round((processedProperties[tag] / uniques) * 100, 2)}%
</td>
</tr>
- {activeProperties[tag] && !loadingDetails[tag] && (
+ {activeProperties[tag] && !loadingDetails[tag] ? (
<tr>
<td className='pl-9' colSpan={3}>
<KVTableContainer
@@ -1209,7 +1210,7 @@ const PageProperties = ({
/>
</td>
</tr>
- )}
+ ) : null}
</Fragment>
))}
</tbody>
@@ -1249,8 +1250,8 @@ const PageProperties = ({
{t('project.property')}
<Sort
className='ml-1'
- sortByAscend={sort.label === 'event' && sort.sortByAscend}
- sortByDescend={sort.label === 'event' && sort.sortByDescend}
+ sortByAscend={sort.label === 'event' ? sort.sortByAscend : null}
+ sortByDescend={sort.label === 'event' ? sort.sortByDescend : null}
/>
</th>
<th className='w-1/6 text-right'>
@@ -1258,8 +1259,8 @@ const PageProperties = ({
{t('project.quantity')}
<Sort
className='ml-1'
- sortByAscend={sort.label === 'quantity' && sort.sortByAscend}
- sortByDescend={sort.label === 'quantity' && sort.sortByDescend}
+ sortByAscend={sort.label === 'quantity' ? sort.sortByAscend : null}
+ sortByDescend={sort.label === 'quantity' ? sort.sortByDescend : null}
/>
&nbsp;&nbsp;
</p>
@@ -1269,8 +1270,8 @@ const PageProperties = ({
{t('project.conversion')}
<Sort
className='ml-1'
- sortByAscend={sort.label === 'conversion' && sort.sortByAscend}
- sortByDescend={sort.label === 'conversion' && sort.sortByDescend}
+ sortByAscend={sort.label === 'conversion' ? sort.sortByAscend : null}
+ sortByDescend={sort.label === 'conversion' ? sort.sortByDescend : null}
/>
</p>
</th>
@@ -1306,7 +1307,7 @@ const PageProperties = ({
</tbody>
</table>
{/* for pagination in tabs */}
- {_size(keys) > ENTRIES_PER_CUSTOM_EVENTS_PANEL && (
+ {_size(keys) > ENTRIES_PER_CUSTOM_EVENTS_PANEL ? (
<div className='absolute bottom-0 w-[calc(100%-2rem)] font-mono sm:w-[calc(100%-3rem)]'>
<div className='mb-2 flex justify-between select-none'>
<div>
@@ -1351,7 +1352,7 @@ const PageProperties = ({
</div>
</div>
</div>
- )}
+ ) : null}
<Modal
onClose={onModalClose}
isOpened={detailsOpened}
@@ -1626,7 +1627,7 @@ const Panel = ({
})
)}
{/* for pagination in tabs */}
- {_size(entries) > ENTRIES_PER_PANEL && (
+ {_size(entries) > ENTRIES_PER_PANEL ? (
<div className='absolute bottom-0 w-[calc(100%-2rem)] font-mono sm:w-[calc(100%-3rem)]'>
<div className='mb-2 flex justify-between select-none'>
<div>
@@ -1671,10 +1672,10 @@ const Panel = ({
</div>
</div>
</div>
- )}
+ ) : null}
{/* PAGE - User flow modal */}
- {id === 'pg' && (
+ {id === 'pg' ? (
<Modal
onClose={() => setIsModalOpen(false)}
closeText={t('common.close')}
@@ -1696,7 +1697,7 @@ const Panel = ({
}
size='large'
/>
- )}
+ ) : null}
</PanelContainer>
)
}
diff --git a/web/app/pages/Project/View/ViewProject.helpers.tsx b/web/app/pages/Project/View/ViewProject.helpers.tsx
index c1952f671..60daf1484 100644
--- a/web/app/pages/Project/View/ViewProject.helpers.tsx
+++ b/web/app/pages/Project/View/ViewProject.helpers.tsx
@@ -1,42 +1,25 @@
-import React from 'react'
-import type { ChartOptions, GridLineOptions } from 'billboard.js'
-import type i18next from 'i18next'
-import filesaver from 'file-saver'
import { LanguageIcon, ArrowRightCircleIcon } from '@heroicons/react/24/outline'
-import dayjs from 'dayjs'
+import type { ChartOptions, GridLineOptions } from 'billboard.js'
import { area, areaSpline, spline, bar, line } from 'billboard.js'
+import * as d3 from 'd3'
+import dayjs from 'dayjs'
+import filesaver from 'file-saver'
+import type i18next from 'i18next'
+import JSZip from 'jszip'
+import _fill from 'lodash/fill'
import _forEach from 'lodash/forEach'
-import _map from 'lodash/map'
-import _split from 'lodash/split'
-import _replace from 'lodash/replace'
+import _includes from 'lodash/includes'
import _isEmpty from 'lodash/isEmpty'
-import _startsWith from 'lodash/startsWith'
import _keys from 'lodash/keys'
-import _size from 'lodash/size'
-import _round from 'lodash/round'
-import _fill from 'lodash/fill'
+import _map from 'lodash/map'
import _reduce from 'lodash/reduce'
+import _replace from 'lodash/replace'
+import _round from 'lodash/round'
+import _size from 'lodash/size'
+import _split from 'lodash/split'
+import _startsWith from 'lodash/startsWith'
import _toNumber from 'lodash/toNumber'
import _toString from 'lodash/toString'
-import _includes from 'lodash/includes'
-import JSZip from 'jszip'
-// @ts-ignore
-import * as d3 from 'd3'
-
-import {
- TimeFormat,
- chartTypes,
- tbsFormatMapper,
- tbsFormatMapper24h,
- tbsFormatMapperTooltip,
- tbsFormatMapperTooltip24h,
- PROJECT_TABS,
- isSelfhosted,
-} from '~/lib/constants'
-import { Entry } from '~/lib/models/Entry'
-import { getTimeFromSeconds, getStringFromTime, sumArrays, nFormatter } from '~/utils/generic'
-import countries from '~/utils/isoCountries'
-import { AnalyticsFunnel } from '~/lib/models/Project'
import {
CompassIcon,
CpuIcon,
@@ -52,6 +35,21 @@ import {
WatchIcon,
} from 'lucide-react'
+import {
+ TimeFormat,
+ chartTypes,
+ tbsFormatMapper,
+ tbsFormatMapper24h,
+ tbsFormatMapperTooltip,
+ tbsFormatMapperTooltip24h,
+ PROJECT_TABS,
+ isSelfhosted,
+} from '~/lib/constants'
+import { Entry } from '~/lib/models/Entry'
+import { AnalyticsFunnel } from '~/lib/models/Project'
+import { getTimeFromSeconds, getStringFromTime, sumArrays, nFormatter } from '~/utils/generic'
+import countries from '~/utils/isoCountries'
+
const { saveAs } = filesaver
const getAvg = (arr: any) => {
@@ -128,9 +126,7 @@ const onCSVExportClick = (
types: any
},
pid: string,
- tnMapping: {
- [key: string]: string
- },
+ tnMapping: Record<string, string>,
language: string,
) => {
const { data: rowData, types } = data
@@ -194,15 +190,9 @@ const CHART_MEASURES_MAPPING_PERF = {
// function to filter the data for the chart
const getColumns = (
- chart: {
- [key: string]: string[]
- },
- activeChartMetrics: {
- [key: string]: boolean
- },
- compareChart?: {
- [key: string]: string[]
- },
+ chart: Record<string, string[]>,
+ activeChartMetrics: Record<string, boolean>,
+ compareChart?: Record<string, string[]>,
) => {
const { views, bounce, viewsPerUnique, unique, trendlines, sessionDuration, occurrences, avgResponseTime } =
activeChartMetrics
@@ -272,13 +262,9 @@ const getColumns = (
}
const getColumnsPerf = (
- chart: {
- [key: string]: string[]
- },
+ chart: Record<string, string[]>,
activeChartMetrics: string,
- compareChart?: {
- [key: string]: string[]
- },
+ compareChart?: Record<string, string[]>,
) => {
const columns: any[] = [['x', ..._map(chart.x, (el) => dayjs(el).toDate())]]
@@ -380,13 +366,7 @@ const getColumnsPerf = (
return columns
}
-const getValueForTooltipPerfomance = (
- chart: {
- [key: string]: string[]
- },
- id: string,
- index: number,
-) => {
+const getValueForTooltipPerfomance = (chart: Record<string, string[]>, id: string, index: number) => {
if (id === 'p50' || id === 'p75' || id === 'p95') {
return chart[id] ? chart[id][index] : 0
}
@@ -451,19 +431,13 @@ const noRegionPeriods = ['custom', 'yesterday']
const getSettings = (
chart: any,
timeBucket: string,
- activeChartMetrics: {
- [key: string]: boolean
- },
+ activeChartMetrics: Record<string, boolean>,
applyRegions: boolean,
timeFormat: string,
rotateXAxis: boolean,
chartType: string,
- customEvents?: {
- [key: string]: string[]
- },
- compareChart?: {
- [key: string]: string[]
- },
+ customEvents?: Record<string, string[]>,
+ compareChart?: Record<string, string[]>,
): ChartOptions => {
const xAxisSize = _size(chart.x)
const lines: GridLineOptions[] = []
@@ -475,9 +449,7 @@ const getSettings = (
})
: []
- let customEventsColors: {
- [key: string]: string
- } = {}
+ let customEventsColors: Record<string, string> = {}
if (_isEmpty(compareChart)) {
_forEach(_keys(customEvents), (el) => {
@@ -591,11 +563,12 @@ const getSettings = (
tick: {
fit: true,
rotate: rotateXAxis ? 45 : 0,
- // @ts-expect-error
+
format:
+ // @ts-expect-error
timeFormat === TimeFormat['24-hour']
- ? (x: string) => d3.timeFormat(tbsFormatMapper24h[timeBucket])(x)
- : (x: string) => d3.timeFormat(tbsFormatMapper[timeBucket])(x),
+ ? (x: string) => d3.timeFormat(tbsFormatMapper24h[timeBucket])(x as unknown as Date)
+ : (x: string) => d3.timeFormat(tbsFormatMapper[timeBucket])(x as unknown as Date),
},
localtime: timeFormat === TimeFormat['24-hour'],
type: 'timeseries',
@@ -622,9 +595,7 @@ const getSettings = (
},
tooltip: {
contents: (item, _, __, color) => {
- const typesOptionsToTypesCompare: {
- [key: string]: string
- } = {
+ const typesOptionsToTypesCompare: Record<string, string> = {
unique: 'uniques',
total: 'visits',
sessionDuration: 'sdur',
@@ -678,8 +649,8 @@ const getSettings = (
: d3.timeFormat(tbsFormatMapperTooltip[timeBucket])(dayjs(compareChart?.x[index]).toDate())
const xDataValue =
timeFormat === TimeFormat['24-hour']
- ? d3.timeFormat(tbsFormatMapperTooltip24h[timeBucket])(x)
- : d3.timeFormat(tbsFormatMapperTooltip[timeBucket])(x)
+ ? d3.timeFormat(tbsFormatMapperTooltip24h[timeBucket])(x as unknown as Date)
+ : d3.timeFormat(tbsFormatMapperTooltip[timeBucket])(x as unknown as Date)
const valueCompare =
id === 'sessionDuration'
? getStringFromTime(getTimeFromSeconds(compareChart?.[typesOptionsToTypesCompare?.[id]]?.[index]))
@@ -817,11 +788,12 @@ const getSettingsSession = (
tick: {
fit: true,
rotate: rotateXAxis ? 45 : 0,
- // @ts-expect-error
+
format:
+ // @ts-expect-error
timeFormat === TimeFormat['24-hour']
- ? (x: string) => d3.timeFormat(tbsFormatMapper24h[timeBucket])(x)
- : (x: string) => d3.timeFormat(tbsFormatMapper[timeBucket])(x),
+ ? (x: string) => d3.timeFormat(tbsFormatMapper24h[timeBucket])(x as unknown as Date)
+ : (x: string) => d3.timeFormat(tbsFormatMapper[timeBucket])(x as unknown as Date),
},
localtime: timeFormat === TimeFormat['24-hour'],
type: 'timeseries',
@@ -957,11 +929,11 @@ const getSettingsError = (
tick: {
fit: true,
rotate: rotateXAxis ? 45 : 0,
- // @ts-expect-error
format:
+ // @ts-expect-error
timeFormat === TimeFormat['24-hour']
- ? (x: string) => d3.timeFormat(tbsFormatMapper24h[timeBucket])(x)
- : (x: string) => d3.timeFormat(tbsFormatMapper[timeBucket])(x),
+ ? (x: string) => d3.timeFormat(tbsFormatMapper24h[timeBucket])(x as unknown as Date)
+ : (x: string) => d3.timeFormat(tbsFormatMapper[timeBucket])(x as unknown as Date),
},
localtime: timeFormat === TimeFormat['24-hour'],
type: 'timeseries',
@@ -1186,17 +1158,13 @@ const perfomanceChartCompare = [
]
const getSettingsPerf = (
- chart: {
- [key: string]: string[]
- },
+ chart: Record<string, string[]>,
timeBucket: string,
activeChartMetrics: string,
rotateXAxis: boolean,
chartType: string,
timeFormat: string,
- compareChart?: {
- [key: string]: string[]
- },
+ compareChart?: Record<string, string[]>,
): ChartOptions => {
const xAxisSize = _size(chart.x)
@@ -1283,11 +1251,12 @@ const getSettingsPerf = (
tick: {
fit: true,
rotate: rotateXAxis ? 45 : 0,
- // @ts-expect-error
+
format:
+ // @ts-expect-error
timeFormat === TimeFormat['24-hour']
- ? (x: string) => d3.timeFormat(tbsFormatMapper24h[timeBucket])(x)
- : (x: string) => d3.timeFormat(tbsFormatMapper[timeBucket])(x),
+ ? (x: string) => d3.timeFormat(tbsFormatMapper24h[timeBucket])(x as unknown as Date)
+ : (x: string) => d3.timeFormat(tbsFormatMapper[timeBucket])(x as unknown as Date),
},
localtime: timeFormat === TimeFormat['24-hour'],
type: 'timeseries',
@@ -1342,8 +1311,8 @@ const getSettingsPerf = (
: d3.timeFormat(tbsFormatMapperTooltip[timeBucket])(dayjs(compareChart?.x[index]).toDate())
const xDataValue =
timeFormat === TimeFormat['24-hour']
- ? d3.timeFormat(tbsFormatMapperTooltip24h[timeBucket])(x)
- : d3.timeFormat(tbsFormatMapperTooltip[timeBucket])(x)
+ ? d3.timeFormat(tbsFormatMapperTooltip24h[timeBucket])(x as unknown as Date)
+ : d3.timeFormat(tbsFormatMapperTooltip[timeBucket])(x as unknown as Date)
const valueCompare = getValueForTooltipPerfomance(compareChart, id, index)
if (_includes(perfomanceChartCompare, id)) {
diff --git a/web/app/pages/Project/View/ViewProject.tsx b/web/app/pages/Project/View/ViewProject.tsx
index 6f0277739..ab10f3806 100644
--- a/web/app/pages/Project/View/ViewProject.tsx
+++ b/web/app/pages/Project/View/ViewProject.tsx
@@ -1,20 +1,27 @@
/* eslint-disable react-hooks/exhaustive-deps */
-import React, {
- useState,
- useEffect,
- useMemo,
- useRef,
- useCallback,
- createContext,
- useContext,
- SetStateAction,
- Dispatch,
-} from 'react'
-import { ClientOnly } from 'remix-utils/client-only'
-import useSize from '~/hooks/useSize'
-import { useNavigate, Link, useSearchParams, useLoaderData } from 'react-router'
-import bb from 'billboard.js'
import { MagnifyingGlassIcon, ChevronLeftIcon, GlobeAltIcon } from '@heroicons/react/24/outline'
+import SwetrixSDK from '@swetrix/sdk'
+import billboard from 'billboard.js'
+import cx from 'clsx'
+import dayjs from 'dayjs'
+import _debounce from 'lodash/debounce'
+import _every from 'lodash/every'
+import _filter from 'lodash/filter'
+import _find from 'lodash/find'
+import _findIndex from 'lodash/findIndex'
+import _includes from 'lodash/includes'
+import _isEmpty from 'lodash/isEmpty'
+import _isString from 'lodash/isString'
+import _keys from 'lodash/keys'
+import _last from 'lodash/last'
+import _map from 'lodash/map'
+import _pickBy from 'lodash/pickBy'
+import _replace from 'lodash/replace'
+import _size from 'lodash/size'
+import _some from 'lodash/some'
+import _toUpper from 'lodash/toUpper'
+import _truncate from 'lodash/truncate'
+import _uniqBy from 'lodash/uniqBy'
import {
BugIcon,
GaugeIcon,
@@ -30,36 +37,55 @@ import {
SettingsIcon,
BanIcon,
} from 'lucide-react'
-import cx from 'clsx'
-import dayjs from 'dayjs'
-import { useTranslation } from 'react-i18next'
+import React, {
+ useState,
+ useEffect,
+ useMemo,
+ useRef,
+ useCallback,
+ createContext,
+ useContext,
+ SetStateAction,
+ Dispatch,
+} from 'react'
import { useHotkeys } from 'react-hotkeys-hook'
-import _keys from 'lodash/keys'
-import _map from 'lodash/map'
-import _includes from 'lodash/includes'
-import _last from 'lodash/last'
-import _isEmpty from 'lodash/isEmpty'
-import _replace from 'lodash/replace'
-import _toUpper from 'lodash/toUpper'
-import _find from 'lodash/find'
-import _filter from 'lodash/filter'
-import _uniqBy from 'lodash/uniqBy'
-import _findIndex from 'lodash/findIndex'
-import _debounce from 'lodash/debounce'
-import _some from 'lodash/some'
-import _pickBy from 'lodash/pickBy'
-import _every from 'lodash/every'
-import _size from 'lodash/size'
-import _truncate from 'lodash/truncate'
-import _isString from 'lodash/isString'
+import { useTranslation } from 'react-i18next'
+import { useSelector } from 'react-redux'
+import { useNavigate, Link, useSearchParams, useLoaderData } from 'react-router'
+import { ClientOnly } from 'remix-utils/client-only'
import { toast } from 'sonner'
-import SwetrixSDK from '@swetrix/sdk'
-import { periodToCompareDate } from '~/utils/compareConvertDate'
-
-import { getTimeFromSeconds, getStringFromTime, getLocaleDisplayName, nLocaleFormatter } from '~/utils/generic'
-import { getItem, setItem, removeItem } from '~/utils/localstorage'
+import {
+ getProjectData,
+ getProject,
+ getOverallStats,
+ getLiveVisitors,
+ getPerfData,
+ getProjectDataCustomEvents,
+ getTrafficCompareData,
+ getPerformanceCompareData,
+ checkPassword,
+ getCustomEventsMetadata,
+ addFunnel,
+ updateFunnel,
+ deleteFunnel,
+ getFunnelData,
+ getFunnels,
+ getPerformanceOverallStats,
+ getSessions,
+ getSession,
+ getErrors,
+ getError,
+ updateErrorStatus,
+ getPropertyMetadata,
+ getProjectViews,
+ deleteProjectView,
+} from '~/api'
import EventsRunningOutBanner from '~/components/EventsRunningOutBanner'
+import Footer from '~/components/Footer'
+import Header from '~/components/Header'
+import { useRequiredParams } from '~/hooks/useRequiredParams'
+import useSize from '~/hooks/useSize'
import {
tbPeriodPairs,
LIVE_VISITORS_UPDATE_INTERVAL,
@@ -92,92 +118,57 @@ import {
FUNNELS_PERIOD_PAIRS,
ThemeType,
} from '~/lib/constants'
-import { Project, Funnel, AnalyticsFunnel, OverallObject, OverallPerformanceObject } from '~/lib/models/Project'
import { CountryEntry } from '~/lib/models/Entry'
-import Loader from '~/ui/Loader'
-import Dropdown from '~/ui/Dropdown'
+import { Project, Funnel, AnalyticsFunnel, OverallObject, OverallPerformanceObject } from '~/lib/models/Project'
+import UIActions from '~/lib/reducers/ui'
+import { StateType, useAppDispatch } from '~/lib/store'
+import NewFunnel from '~/modals/NewFunnel'
+import ViewProjectHotkeys from '~/modals/ViewProjectHotkeys'
import Checkbox from '~/ui/Checkbox'
-import Select from '~/ui/Select'
+import Dropdown from '~/ui/Dropdown'
import FlatPicker from '~/ui/Flatpicker'
-import LineChart from '~/ui/icons/LineChart'
import BarChart from '~/ui/icons/BarChart'
-import NewFunnel from '~/modals/NewFunnel'
-import ViewProjectHotkeys from '~/modals/ViewProjectHotkeys'
+import LineChart from '~/ui/icons/LineChart'
+import Loader from '~/ui/Loader'
+import Select from '~/ui/Select'
+import { trackCustom } from '~/utils/analytics'
+import { periodToCompareDate } from '~/utils/compareConvertDate'
+import { getTimeFromSeconds, getStringFromTime, getLocaleDisplayName, nLocaleFormatter } from '~/utils/generic'
+import { getItem, setItem, removeItem } from '~/utils/localstorage'
import routes from '~/utils/routes'
-import Header from '~/components/Header'
-import Footer from '~/components/Footer'
-import {
- getProjectData,
- getProject,
- getOverallStats,
- getLiveVisitors,
- getPerfData,
- getProjectDataCustomEvents,
- getTrafficCompareData,
- getPerformanceCompareData,
- checkPassword,
- getCustomEventsMetadata,
- addFunnel,
- updateFunnel,
- deleteFunnel,
- getFunnelData,
- getFunnels,
- getPerformanceOverallStats,
- getSessions,
- getSession,
- getErrors,
- getError,
- updateErrorStatus,
- getPropertyMetadata,
- getProjectViews,
- deleteProjectView,
-} from '~/api'
-import { Panel, Metadata } from './Panels'
-import {
- onCSVExportClick,
- getFormatDate,
- panelIconMapping,
- typeNameMapping,
- noRegionPeriods,
- getSettings,
- getColumns,
- CHART_METRICS_MAPPING,
- CHART_METRICS_MAPPING_PERF,
- getSettingsPerf,
- getSettingsFunnels,
- SHORTCUTS_TABS_LISTENERS,
- SHORTCUTS_TABS_MAP,
- SHORTCUTS_GENERAL_LISTENERS,
- SHORTCUTS_TIMEBUCKETS_LISTENERS,
- CHART_MEASURES_MAPPING_PERF,
- deviceIconMapping,
-} from './ViewProject.helpers'
+
+import ProjectAlertsView from '../Alerts/View'
+
+import AddAViewModal from './components/AddAViewModal'
+import BrowserDropdown from './components/BrowserDropdown'
import CCRow from './components/CCRow'
-import FunnelsList from './components/FunnelsList'
-import RefRow from './components/RefRow'
-import NoEvents from './components/NoEvents'
-import SearchFilters from './components/SearchFilters'
+import CountryDropdown from './components/CountryDropdown'
+import CustomMetrics from './components/CustomMetrics'
+import { ErrorChart } from './components/ErrorChart'
+import { ErrorDetails } from './components/ErrorDetails'
+import { Errors } from './components/Errors'
import Filters from './components/Filters'
+import FunnelsList from './components/FunnelsList'
import LiveVisitorsDropdown from './components/LiveVisitorsDropdown'
-import CountryDropdown from './components/CountryDropdown'
+import LockedDashboard from './components/LockedDashboard'
import { MetricCard, MetricCards, PerformanceMetricCards } from './components/MetricCards'
-import ProjectAlertsView from '../Alerts/View'
-import UTMDropdown from './components/UTMDropdown'
-import TBPeriodSelector from './components/TBPeriodSelector'
-import { Session } from './interfaces/session'
-import { Sessions } from './components/Sessions'
+import NoErrorDetails from './components/NoErrorDetails'
+import NoEvents from './components/NoEvents'
+import NoSessionDetails from './components/NoSessionDetails'
+import OSDropdown from './components/OSDropdown'
+import PageDropdown from './components/PageDropdown'
import { Pageflow } from './components/Pageflow'
-import { SessionDetails } from './components/SessionDetails'
+import RefRow from './components/RefRow'
+import SearchFilters from './components/SearchFilters'
import { SessionChart } from './components/SessionChart'
-import { Errors } from './components/Errors'
-import LockedDashboard from './components/LockedDashboard'
+import { SessionDetails } from './components/SessionDetails'
+import { Sessions } from './components/Sessions'
+import TBPeriodSelector from './components/TBPeriodSelector'
+import UTMDropdown from './components/UTMDropdown'
+import WaitingForAnError from './components/WaitingForAnError'
import WaitingForAnEvent from './components/WaitingForAnEvent'
-import { ErrorChart } from './components/ErrorChart'
-import { ErrorDetails } from './components/ErrorDetails'
import { SwetrixError } from './interfaces/error'
-import NoErrorDetails from './components/NoErrorDetails'
-import WaitingForAnError from './components/WaitingForAnError'
-import NoSessionDetails from './components/NoSessionDetails'
+import { Session } from './interfaces/session'
import {
Customs,
Filter,
@@ -188,7 +179,7 @@ import {
Properties,
TrafficLogResponse,
} from './interfaces/traffic'
-import { trackCustom } from '~/utils/analytics'
+import { Panel, Metadata } from './Panels'
import {
handleNavigationParams,
updateFilterState,
@@ -199,15 +190,25 @@ import {
FILTER_CHART_METRICS_MAPPING_FOR_COMPARE,
ERROR_FILTERS_MAPPING,
} from './utils/filters'
-import AddAViewModal from './components/AddAViewModal'
-import CustomMetrics from './components/CustomMetrics'
-import { useRequiredParams } from '~/hooks/useRequiredParams'
-import BrowserDropdown from './components/BrowserDropdown'
-import OSDropdown from './components/OSDropdown'
-import { StateType, useAppDispatch } from '~/lib/store'
-import UIActions from '~/lib/reducers/ui'
-import { useSelector } from 'react-redux'
-import PageDropdown from './components/PageDropdown'
+import {
+ onCSVExportClick,
+ getFormatDate,
+ panelIconMapping,
+ typeNameMapping,
+ noRegionPeriods,
+ getSettings,
+ getColumns,
+ CHART_METRICS_MAPPING,
+ CHART_METRICS_MAPPING_PERF,
+ getSettingsPerf,
+ getSettingsFunnels,
+ SHORTCUTS_TABS_LISTENERS,
+ SHORTCUTS_TABS_MAP,
+ SHORTCUTS_GENERAL_LISTENERS,
+ SHORTCUTS_TIMEBUCKETS_LISTENERS,
+ CHART_MEASURES_MAPPING_PERF,
+ deviceIconMapping,
+} from './ViewProject.helpers'
const CUSTOM_EV_DROPDOWN_MAX_VISIBLE_LENGTH = 32
const SESSIONS_TAKE = 30
@@ -337,9 +338,7 @@ const ViewProject = () => {
const [chartData, setChartData] = useState<any>({})
const [mainChart, setMainChart] = useState<any>(null)
const [dataLoading, setDataLoading] = useState(false)
- const [activeChartMetrics, setActiveChartMetrics] = useState<{
- [key: string]: boolean
- }>({
+ const [activeChartMetrics, setActiveChartMetrics] = useState<Record<string, boolean>>({
[CHART_METRICS_MAPPING.unique]: true,
[CHART_METRICS_MAPPING.views]: false,
[CHART_METRICS_MAPPING.sessionDuration]: false,
@@ -348,9 +347,7 @@ const ViewProject = () => {
[CHART_METRICS_MAPPING.trendlines]: false,
[CHART_METRICS_MAPPING.cumulativeMode]: false,
})
- const [errorOptions, setErrorOptions] = useState<{
- [key: string]: boolean
- }>({
+ const [errorOptions, setErrorOptions] = useState<Record<string, boolean>>({
[ERROR_FILTERS_MAPPING.showResolved]: false,
})
const [activeChartMetricsPerf, setActiveChartMetricsPerf] = useState(CHART_METRICS_MAPPING_PERF.timing)
@@ -1083,7 +1080,7 @@ const ViewProject = () => {
events,
)
setMainChart(() => {
- const generate = bb.generate(bbSettings)
+ const generate = billboard.generate(bbSettings)
generate.data.names(dataNames)
return generate
})
@@ -1342,7 +1339,7 @@ const ViewProject = () => {
if (activeTab === PROJECT_TABS.traffic) {
setMainChart(() => {
- const generate = bb.generate(bbSettings)
+ const generate = billboard.generate(bbSettings)
generate.data.names(dataNames)
return generate
})
@@ -1803,7 +1800,7 @@ const ViewProject = () => {
if (activeTab === PROJECT_TABS.performance) {
setMainChart(() => {
- const generate = bb.generate(bbSettings)
+ const generate = billboard.generate(bbSettings)
generate.data.names(dataNamesPerf)
return generate
})
@@ -1851,7 +1848,7 @@ const ViewProject = () => {
if (activeTab === PROJECT_TABS.funnels) {
setMainChart(() => {
- const generate = bb.generate(bbSettings)
+ const generate = billboard.generate(bbSettings)
generate.data.names(dataNamesFunnel)
return generate
})
@@ -2108,7 +2105,9 @@ const ViewProject = () => {
updatePeriod({
period: intialPeriod,
})
- } catch {}
+ } catch {
+ //
+ }
}
parsePeriodFilters()
@@ -2122,7 +2121,9 @@ const ViewProject = () => {
setTimebucket(initialTimeBucket || periodPairs[3].tbs[1])
}
}
- } catch {}
+ } catch {
+ //
+ }
setAreFiltersParsed(true)
}, [activeTab])
@@ -2301,7 +2302,7 @@ const ViewProject = () => {
)
setMainChart(() => {
- const generate = bb.generate(bbSettings)
+ const generate = billboard.generate(bbSettings)
generate.data.names(dataNames)
return generate
})
@@ -2337,7 +2338,7 @@ const ViewProject = () => {
)
setMainChart(() => {
- const generate = bb.generate(bbSettings)
+ const generate = billboard.generate(bbSettings)
generate.data.names(dataNamesPerf)
return generate
})
@@ -2722,7 +2723,7 @@ const ViewProject = () => {
)
setMainChart(() => {
- const generate = bb.generate(bbSettings)
+ const generate = billboard.generate(bbSettings)
generate.data.names(dataNames)
return generate
})
@@ -2740,7 +2741,7 @@ const ViewProject = () => {
)
setMainChart(() => {
- const generate = bb.generate(bbPerfSettings)
+ const generate = billboard.generate(bbPerfSettings)
generate.data.names(dataNamesPerf)
return generate
})
@@ -2911,7 +2912,7 @@ const ViewProject = () => {
if (authLoading || !project) {
return (
<>
- {!embedded && <Header ssrTheme={ssrTheme} authenticated={authenticated} />}
+ {!embedded ? <Header ssrTheme={ssrTheme} authenticated={authenticated} /> : null}
<div
className={cx('min-h-min-footer bg-gray-50 dark:bg-slate-900', {
'min-h-min-footer': !embedded,
@@ -2920,7 +2921,7 @@ const ViewProject = () => {
>
<Loader />
</div>
- {!embedded && <Footer authenticated={authenticated} />}
+ {!embedded ? <Footer authenticated={authenticated} /> : null}
</>
)
}
@@ -2928,7 +2929,7 @@ const ViewProject = () => {
if (project.isLocked) {
return (
<>
- {!embedded && <Header ssrTheme={ssrTheme} authenticated={authenticated} />}
+ {!embedded ? <Header ssrTheme={ssrTheme} authenticated={authenticated} /> : null}
<div
className={cx('mx-auto w-full max-w-[1584px] bg-gray-50 px-2 py-6 sm:px-4 lg:px-8 dark:bg-slate-900', {
'min-h-min-footer': !embedded,
@@ -2941,7 +2942,7 @@ const ViewProject = () => {
</h2>
<LockedDashboard user={user} project={project} />
</div>
- {!embedded && <Footer authenticated={authenticated} />}
+ {!embedded ? <Footer authenticated={authenticated} /> : null}
</>
)
}
@@ -2949,7 +2950,7 @@ const ViewProject = () => {
if (!project.isDataExists && activeTab !== PROJECT_TABS.errors && !analyticsLoading) {
return (
<>
- {!embedded && <Header ssrTheme={ssrTheme} authenticated={authenticated} />}
+ {!embedded ? <Header ssrTheme={ssrTheme} authenticated={authenticated} /> : null}
<div
className={cx('mx-auto w-full max-w-[1584px] bg-gray-50 px-2 py-6 sm:px-4 lg:px-8 dark:bg-slate-900', {
'min-h-min-footer': !embedded,
@@ -2962,7 +2963,7 @@ const ViewProject = () => {
</h2>
<WaitingForAnEvent project={project} />
</div>
- {!embedded && <Footer authenticated={authenticated} />}
+ {!embedded ? <Footer authenticated={authenticated} /> : null}
</>
)
}
@@ -2974,7 +2975,7 @@ const ViewProject = () => {
) {
return (
<>
- {!embedded && <Header ssrTheme={ssrTheme} authenticated={authenticated} />}
+ {!embedded ? <Header ssrTheme={ssrTheme} authenticated={authenticated} /> : null}
<div
className={cx('mx-auto w-full max-w-[1584px] bg-gray-50 px-2 py-6 sm:px-4 lg:px-8 dark:bg-slate-900', {
'min-h-min-footer': !embedded,
@@ -2987,7 +2988,7 @@ const ViewProject = () => {
</h2>
<WaitingForAnError />
</div>
- {!embedded && <Footer authenticated={authenticated} />}
+ {!embedded ? <Footer authenticated={authenticated} /> : null}
</>
)
}
@@ -3036,7 +3037,7 @@ const ViewProject = () => {
}}
>
<>
- {!embedded && <Header ssrTheme={ssrTheme} authenticated={authenticated} />}
+ {!embedded ? <Header ssrTheme={ssrTheme} authenticated={authenticated} /> : null}
<EventsRunningOutBanner />
<div
ref={ref}
@@ -3053,560 +3054,560 @@ const ViewProject = () => {
>
<TabsSelector />
{activeTab !== PROJECT_TABS.alerts &&
- (activeTab !== PROJECT_TABS.sessions || !activePSID) &&
- (activeFunnel || activeTab !== PROJECT_TABS.funnels) && (
- <>
- <div className='mt-2 flex flex-col items-center justify-between lg:flex-row'>
- <div className='flex flex-wrap items-center justify-center gap-x-5 gap-y-2'>
- <h2 className='font-mono text-xl font-bold break-words break-all text-gray-900 dark:text-gray-50'>
- {/* If tab is funnels - then display a funnel name, otherwise a project name */}
- {activeTab === PROJECT_TABS.funnels ? activeFunnel?.name : project.name}
- </h2>
- {activeTab !== PROJECT_TABS.funnels && (
- <LiveVisitorsDropdown
- onSessionSelect={(psid) => {
- setDashboardTab(PROJECT_TABS.sessions)
- setActivePSID(psid)
- }}
- live={liveVisitors}
- />
- )}
- </div>
- <div className='mx-auto mt-3 flex w-full max-w-[420px] flex-wrap items-center justify-center gap-y-1 space-x-2 sm:mx-0 sm:w-auto sm:max-w-none sm:flex-nowrap sm:justify-between lg:mt-0'>
- {activeTab !== PROJECT_TABS.funnels && (
- <>
- <button
- type='button'
- title={t('project.refreshStats')}
- onClick={refreshStats}
- className={cx(
- 'relative rounded-md border border-gray-50/0 bg-gray-50 p-2 text-sm font-medium hover:border-gray-300 hover:bg-white focus:z-10 focus:ring-1 focus:ring-indigo-500 focus:outline-hidden dark:bg-slate-900 hover:dark:border-slate-800/50 dark:hover:bg-slate-800 focus:dark:ring-gray-200',
+ (activeTab !== PROJECT_TABS.sessions || !activePSID) &&
+ (activeFunnel || activeTab !== PROJECT_TABS.funnels) ? (
+ <>
+ <div className='mt-2 flex flex-col items-center justify-between lg:flex-row'>
+ <div className='flex flex-wrap items-center justify-center gap-x-5 gap-y-2'>
+ <h2 className='font-mono text-xl font-bold break-words break-all text-gray-900 dark:text-gray-50'>
+ {/* If tab is funnels - then display a funnel name, otherwise a project name */}
+ {activeTab === PROJECT_TABS.funnels ? activeFunnel?.name : project.name}
+ </h2>
+ {activeTab !== PROJECT_TABS.funnels ? (
+ <LiveVisitorsDropdown
+ onSessionSelect={(psid) => {
+ setDashboardTab(PROJECT_TABS.sessions)
+ setActivePSID(psid)
+ }}
+ live={liveVisitors}
+ />
+ ) : null}
+ </div>
+ <div className='mx-auto mt-3 flex w-full max-w-[420px] flex-wrap items-center justify-center gap-y-1 space-x-2 sm:mx-0 sm:w-auto sm:max-w-none sm:flex-nowrap sm:justify-between lg:mt-0'>
+ {activeTab !== PROJECT_TABS.funnels ? (
+ <>
+ <button
+ type='button'
+ title={t('project.refreshStats')}
+ onClick={refreshStats}
+ className={cx(
+ 'relative rounded-md border border-gray-50/0 bg-gray-50 p-2 text-sm font-medium hover:border-gray-300 hover:bg-white focus:z-10 focus:ring-1 focus:ring-indigo-500 focus:outline-hidden dark:bg-slate-900 hover:dark:border-slate-800/50 dark:hover:bg-slate-800 focus:dark:ring-gray-200',
+ {
+ 'cursor-not-allowed opacity-50': authLoading || dataLoading,
+ },
+ )}
+ >
+ <RotateCw className='h-5 w-5 text-gray-700 dark:text-gray-50' />
+ </button>
+ <div
+ className={cx('border-gray-200 dark:border-gray-600', {
+ // @ts-expect-error
+ 'lg:border-r': activeTab === PROJECT_TABS.funnels,
+ hidden: activeTab === PROJECT_TABS.errors && activeError,
+ })}
+ >
+ <button
+ type='button'
+ title={t('project.search')}
+ onClick={() => {
+ if (dataLoading) {
+ return
+ }
+
+ setShowFiltersSearch(true)
+ }}
+ className={cx(
+ 'relative rounded-md border border-gray-50/0 bg-gray-50 p-2 text-sm font-medium hover:border-gray-300 hover:bg-white focus:z-10 focus:ring-1 focus:ring-indigo-500 focus:outline-hidden dark:bg-slate-900 hover:dark:border-slate-800/50 dark:hover:bg-slate-800 focus:dark:ring-gray-200',
{
'cursor-not-allowed opacity-50': authLoading || dataLoading,
},
)}
>
- <RotateCw className='h-5 w-5 text-gray-700 dark:text-gray-50' />
+ <MagnifyingGlassIcon className='h-5 w-5 stroke-2 text-gray-700 dark:text-gray-50' />
</button>
- <div
- className={cx('border-gray-200 dark:border-gray-600', {
- // @ts-expect-error
- 'lg:border-r': activeTab === PROJECT_TABS.funnels,
- hidden: activeTab === PROJECT_TABS.errors && activeError,
- })}
- >
- <button
- type='button'
- title={t('project.search')}
- onClick={() => {
- if (dataLoading) {
- return
- }
-
- setShowFiltersSearch(true)
- }}
- className={cx(
- 'relative rounded-md border border-gray-50/0 bg-gray-50 p-2 text-sm font-medium hover:border-gray-300 hover:bg-white focus:z-10 focus:ring-1 focus:ring-indigo-500 focus:outline-hidden dark:bg-slate-900 hover:dark:border-slate-800/50 dark:hover:bg-slate-800 focus:dark:ring-gray-200',
- {
- 'cursor-not-allowed opacity-50': authLoading || dataLoading,
+ </div>
+ {activeTab === PROJECT_TABS.traffic ? (
+ <Dropdown
+ header={t('project.views')}
+ onClick={() => loadProjectViews()}
+ loading={projectViewsLoading || projectViewsLoading === null}
+ selectItemClassName={
+ !allowedToManage &&
+ !(projectViewsLoading || projectViewsLoading === null) &&
+ _isEmpty(projectViews)
+ ? 'block px-4 py-2 text-sm text-gray-700 dark:border-gray-800 dark:bg-slate-800 dark:text-gray-50'
+ : undefined
+ }
+ items={_filter(
+ [
+ ...projectViews,
+ allowedToManage && {
+ id: 'add-a-view',
+ name: t('project.addAView'),
+ createView: true,
},
- )}
- >
- <MagnifyingGlassIcon className='h-5 w-5 stroke-2 text-gray-700 dark:text-gray-50' />
- </button>
- </div>
- {activeTab === PROJECT_TABS.traffic && (
- <Dropdown
- header={t('project.views')}
- onClick={() => loadProjectViews()}
- loading={projectViewsLoading || projectViewsLoading === null}
- selectItemClassName={
!allowedToManage &&
- !(projectViewsLoading || projectViewsLoading === null) &&
- _isEmpty(projectViews)
- ? 'block px-4 py-2 text-sm text-gray-700 dark:border-gray-800 dark:bg-slate-800 dark:text-gray-50'
- : undefined
- }
- items={_filter(
- [
- ...projectViews,
- allowedToManage && {
- id: 'add-a-view',
- name: t('project.addAView'),
- createView: true,
+ _isEmpty(projectViews) && {
+ id: 'no-views',
+ name: t('project.noViewsYet'),
+ notClickable: true,
},
- !allowedToManage &&
- _isEmpty(projectViews) && {
- id: 'no-views',
- name: t('project.noViewsYet'),
- notClickable: true,
- },
- ],
- (x) => !!x,
- )}
- title={[<BookmarkIcon key='bookmark-icon' className='h-5 w-5' />]}
- labelExtractor={(item, close) => {
- // @ts-expect-error
- if (item.createView) {
- return item.name
- }
+ ],
+ (x) => !!x,
+ )}
+ title={[<BookmarkIcon key='bookmark-icon' className='h-5 w-5' />]}
+ labelExtractor={(item, close) => {
+ // @ts-expect-error
+ if (item.createView) {
+ return item.name
+ }
- if (item.id === 'no-views') {
- return <span className='text-gray-600 dark:text-gray-200'>{item.name}</span>
- }
+ if (item.id === 'no-views') {
+ return <span className='text-gray-600 dark:text-gray-200'>{item.name}</span>
+ }
- return (
- <span
- className={cx('flex items-center justify-between space-x-4', {
- 'cursor-wait': dataLoading,
- })}
- >
- <span>{item.name}</span>
- {allowedToManage && (
- <span className='flex cursor-pointer space-x-2'>
- <PencilIcon
- className='size-4 hover:text-gray-900 dark:hover:text-gray-50'
- onClick={(e) => {
- e.stopPropagation()
- setProjectViewToUpdate(item)
- close()
- setIsAddAViewOpened(true)
- }}
- strokeWidth={1.5}
- />
- <Trash2Icon
- className={cx('size-4 hover:text-gray-900 dark:hover:text-gray-50', {
- 'cursor-not-allowed': projectViewDeleting,
- })}
- onClick={(e) => {
- e.stopPropagation()
- close()
- onProjectViewDelete(item.id)
- }}
- strokeWidth={1.5}
- />
- </span>
- )}
- </span>
- )
- }}
- keyExtractor={(item) => item.id}
- onSelect={(item: ProjectView, e) => {
- // @ts-expect-error
- if (item.createView) {
- e?.stopPropagation()
- setIsAddAViewOpened(true)
+ return (
+ <span
+ className={cx('flex items-center justify-between space-x-4', {
+ 'cursor-wait': dataLoading,
+ })}
+ >
+ <span>{item.name}</span>
+ {allowedToManage ? (
+ <span className='flex cursor-pointer space-x-2'>
+ <PencilIcon
+ className='size-4 hover:text-gray-900 dark:hover:text-gray-50'
+ onClick={(e) => {
+ e.stopPropagation()
+ setProjectViewToUpdate(item)
+ close()
+ setIsAddAViewOpened(true)
+ }}
+ strokeWidth={1.5}
+ />
+ <Trash2Icon
+ className={cx('size-4 hover:text-gray-900 dark:hover:text-gray-50', {
+ 'cursor-not-allowed': projectViewDeleting,
+ })}
+ onClick={(e) => {
+ e.stopPropagation()
+ close()
+ onProjectViewDelete(item.id)
+ }}
+ strokeWidth={1.5}
+ />
+ </span>
+ ) : null}
+ </span>
+ )
+ }}
+ keyExtractor={(item) => item.id}
+ onSelect={(item: ProjectView, e) => {
+ // @ts-expect-error
+ if (item.createView) {
+ e?.stopPropagation()
+ setIsAddAViewOpened(true)
- return
- }
+ return
+ }
- if (item.filters && !_isEmpty(item.filters)) {
- onFilterSearch(item.filters, true)
- }
+ if (item.filters && !_isEmpty(item.filters)) {
+ onFilterSearch(item.filters, true)
+ }
- if (item.customEvents && !_isEmpty(item.customEvents)) {
- onCustomMetric(item.customEvents)
- }
- }}
- chevron='mini'
- buttonClassName='!p-2 rounded-md hover:bg-white border border-gray-50/0 hover:border-gray-300 hover:dark:border-slate-800/50 dark:hover:bg-slate-800 focus:z-10 focus:outline-hidden focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500 focus:dark:ring-gray-200'
- headless
- />
- )}
- {_includes([PROJECT_TABS.traffic, PROJECT_TABS.performance], activeTab) && (
- <Dropdown
- header={t('project.exportData')}
- items={_filter(
- [
- ...exportTypes,
- ...customExportTypes,
- !isSelfhosted && {
- label: t('project.lookingForMore'),
- lookingForMore: true,
- onClick: () => {},
- },
- ],
- (el) => !!el,
- )}
- title={[<DownloadIcon key='download-icon' className='h-5 w-5' />]}
- labelExtractor={(item) => item.label}
- keyExtractor={(item) => item.label}
- onSelect={(item, e) => {
- if (item.lookingForMore) {
- e?.stopPropagation()
- window.open(MARKETPLACE_URL, '_blank')
+ if (item.customEvents && !_isEmpty(item.customEvents)) {
+ onCustomMetric(item.customEvents)
+ }
+ }}
+ chevron='mini'
+ buttonClassName='!p-2 rounded-md hover:bg-white border border-gray-50/0 hover:border-gray-300 hover:dark:border-slate-800/50 dark:hover:bg-slate-800 focus:z-10 focus:outline-hidden focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500 focus:dark:ring-gray-200'
+ headless
+ />
+ ) : null}
+ {_includes([PROJECT_TABS.traffic, PROJECT_TABS.performance], activeTab) ? (
+ <Dropdown
+ header={t('project.exportData')}
+ items={_filter(
+ [
+ ...exportTypes,
+ ...customExportTypes,
+ !isSelfhosted && {
+ label: t('project.lookingForMore'),
+ lookingForMore: true,
+ onClick: () => {},
+ },
+ ],
+ (el) => !!el,
+ )}
+ title={[<DownloadIcon key='download-icon' className='h-5 w-5' />]}
+ labelExtractor={(item) => item.label}
+ keyExtractor={(item) => item.label}
+ onSelect={(item, e) => {
+ if (item.lookingForMore) {
+ e?.stopPropagation()
+ window.open(MARKETPLACE_URL, '_blank')
- return
- }
+ return
+ }
- trackCustom('DASHBOARD_EXPORT', {
- type: item.label === t('project.asCSV') ? 'csv' : 'extension',
- })
+ trackCustom('DASHBOARD_EXPORT', {
+ type: item.label === t('project.asCSV') ? 'csv' : 'extension',
+ })
- item.onClick(panelsData, t)
- }}
- chevron='mini'
- buttonClassName='!p-2 rounded-md hover:bg-white border border-gray-50/0 hover:border-gray-300 hover:dark:border-slate-800/50 dark:hover:bg-slate-800 focus:z-10 focus:outline-hidden focus:ring-1 focus:ring-indigo-500 focus:dark:ring-gray-200'
- headless
- />
+ item.onClick(panelsData, t)
+ }}
+ chevron='mini'
+ buttonClassName='!p-2 rounded-md hover:bg-white border border-gray-50/0 hover:border-gray-300 hover:dark:border-slate-800/50 dark:hover:bg-slate-800 focus:z-10 focus:outline-hidden focus:ring-1 focus:ring-indigo-500 focus:dark:ring-gray-200'
+ headless
+ />
+ ) : null}
+ <div
+ className={cx(
+ 'space-x-2 border-gray-200 sm:mr-3 lg:border-x lg:px-3 dark:border-gray-600',
+ {
+ hidden:
+ isPanelsDataEmpty ||
+ analyticsLoading ||
+ checkIfAllMetricsAreDisabled ||
+ activeTab === PROJECT_TABS.sessions ||
+ activeTab === PROJECT_TABS.errors,
+ },
)}
- <div
+ >
+ <button
+ type='button'
+ title={t('project.barChart')}
+ onClick={() => setChartTypeOnClick(chartTypes.bar)}
className={cx(
- 'space-x-2 border-gray-200 sm:mr-3 lg:border-x lg:px-3 dark:border-gray-600',
+ 'relative rounded-md fill-gray-700 p-2 text-sm font-medium focus:z-10 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 focus:outline-hidden dark:fill-gray-50 focus:dark:border-gray-200 focus:dark:ring-gray-200',
{
- hidden:
- isPanelsDataEmpty ||
- analyticsLoading ||
- checkIfAllMetricsAreDisabled ||
- activeTab === PROJECT_TABS.sessions ||
- activeTab === PROJECT_TABS.errors,
+ 'border border-gray-300 bg-white stroke-white dark:border-slate-800/50 dark:bg-slate-800 dark:stroke-slate-800':
+ chartType === chartTypes.bar,
+ 'bg-gray-50 stroke-gray-50 dark:bg-slate-900 dark:stroke-slate-900 [&_svg]:hover:fill-gray-500 [&_svg]:hover:dark:fill-gray-200':
+ chartType !== chartTypes.bar,
},
)}
>
- <button
- type='button'
- title={t('project.barChart')}
- onClick={() => setChartTypeOnClick(chartTypes.bar)}
- className={cx(
- 'relative rounded-md fill-gray-700 p-2 text-sm font-medium focus:z-10 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 focus:outline-hidden dark:fill-gray-50 focus:dark:border-gray-200 focus:dark:ring-gray-200',
- {
- 'border border-gray-300 bg-white stroke-white dark:border-slate-800/50 dark:bg-slate-800 dark:stroke-slate-800':
- chartType === chartTypes.bar,
- 'bg-gray-50 stroke-gray-50 dark:bg-slate-900 dark:stroke-slate-900 [&_svg]:hover:fill-gray-500 [&_svg]:hover:dark:fill-gray-200':
- chartType !== chartTypes.bar,
- },
- )}
- >
- <BarChart className='h-5 w-5 [&_path]:stroke-[3.5%]' />
- </button>
- <button
- type='button'
- title={t('project.lineChart')}
- onClick={() => setChartTypeOnClick(chartTypes.line)}
- className={cx(
- 'relative rounded-md fill-gray-700 p-2 text-sm font-medium focus:z-10 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 focus:outline-hidden dark:fill-gray-50 focus:dark:border-gray-200 focus:dark:ring-gray-200',
- {
- 'border border-gray-300 bg-white stroke-white dark:border-slate-800/50 dark:bg-slate-800 dark:stroke-slate-800':
- chartType === chartTypes.line,
- 'bg-gray-50 stroke-gray-50 dark:bg-slate-900 dark:stroke-slate-900 [&_svg]:hover:fill-gray-500 [&_svg]:hover:dark:fill-gray-200':
- chartType !== chartTypes.line,
- },
- )}
- >
- <LineChart className='h-5 w-5 [&_path]:stroke-[3.5%]' />
- </button>
- </div>
- </>
- )}
- {activeTab === PROJECT_TABS.traffic && !isPanelsDataEmpty && (
- <Dropdown
- items={
- isActiveCompare
- ? _filter(chartMetrics, (el) => {
- return !_includes(FILTER_CHART_METRICS_MAPPING_FOR_COMPARE, el.id)
- })
- : chartMetrics
- }
- title={t('project.metricVis')}
- labelExtractor={(pair) => {
- const { label, id: pairID, active, conflicts } = pair
-
- const conflicted = isConflicted(conflicts)
+ <BarChart className='h-5 w-5 [&_path]:stroke-[3.5%]' />
+ </button>
+ <button
+ type='button'
+ title={t('project.lineChart')}
+ onClick={() => setChartTypeOnClick(chartTypes.line)}
+ className={cx(
+ 'relative rounded-md fill-gray-700 p-2 text-sm font-medium focus:z-10 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 focus:outline-hidden dark:fill-gray-50 focus:dark:border-gray-200 focus:dark:ring-gray-200',
+ {
+ 'border border-gray-300 bg-white stroke-white dark:border-slate-800/50 dark:bg-slate-800 dark:stroke-slate-800':
+ chartType === chartTypes.line,
+ 'bg-gray-50 stroke-gray-50 dark:bg-slate-900 dark:stroke-slate-900 [&_svg]:hover:fill-gray-500 [&_svg]:hover:dark:fill-gray-200':
+ chartType !== chartTypes.line,
+ },
+ )}
+ >
+ <LineChart className='h-5 w-5 [&_path]:stroke-[3.5%]' />
+ </button>
+ </div>
+ </>
+ ) : null}
+ {activeTab === PROJECT_TABS.traffic && !isPanelsDataEmpty ? (
+ <Dropdown
+ items={
+ isActiveCompare
+ ? _filter(chartMetrics, (el) => {
+ return !_includes(FILTER_CHART_METRICS_MAPPING_FOR_COMPARE, el.id)
+ })
+ : chartMetrics
+ }
+ title={t('project.metricVis')}
+ labelExtractor={(pair) => {
+ const { label, id: pairID, active, conflicts } = pair
- if (pairID === CHART_METRICS_MAPPING.customEvents) {
- if (_isEmpty(panelsData.customs)) {
- return (
- <span className='flex cursor-not-allowed items-center px-4 py-2'>
- <BanIcon className='mr-1 h-5 w-5' strokeWidth={1.5} />
- {label}
- </span>
- )
- }
+ const conflicted = isConflicted(conflicts)
+ if (pairID === CHART_METRICS_MAPPING.customEvents) {
+ if (_isEmpty(panelsData.customs)) {
return (
- <Dropdown
- menuItemsClassName='max-w-[300px] max-h-[300px] overflow-auto'
- items={chartMetricsCustomEvents}
- title={label}
- labelExtractor={(event) => (
- <Checkbox
- className={cx({ hidden: isPanelsDataEmpty || analyticsLoading })}
- label={
- _size(event.label) > CUSTOM_EV_DROPDOWN_MAX_VISIBLE_LENGTH ? (
- <span title={event.label}>
- {_truncate(event.label, {
- length: CUSTOM_EV_DROPDOWN_MAX_VISIBLE_LENGTH,
- })}
- </span>
- ) : (
- event.label
- )
- }
- onChange={() => {
- switchCustomEventChart(event.id)
- }}
- checked={event.active}
- />
- )}
- buttonClassName='group-hover:bg-gray-200 dark:group-hover:bg-slate-700 px-4 py-2 inline-flex w-full bg-white text-sm font-medium text-gray-700 dark:text-gray-50 dark:border-gray-800 dark:bg-slate-800'
- keyExtractor={(event) => event.id}
- onSelect={(event, e) => {
- e?.stopPropagation()
- e?.preventDefault()
-
- switchCustomEventChart(event.id)
- }}
- chevron='mini'
- headless
- />
+ <span className='flex cursor-not-allowed items-center px-4 py-2'>
+ <BanIcon className='mr-1 h-5 w-5' strokeWidth={1.5} />
+ {label}
+ </span>
)
}
return (
- <Checkbox
- className={cx('px-4 py-2', { hidden: isPanelsDataEmpty || analyticsLoading })}
- label={label}
- disabled={conflicted}
- checked={active}
- onChange={() => {
- switchTrafficChartMetric(pairID, conflicts)
+ <Dropdown
+ menuItemsClassName='max-w-[300px] max-h-[300px] overflow-auto'
+ items={chartMetricsCustomEvents}
+ title={label}
+ labelExtractor={(event) => (
+ <Checkbox
+ className={cx({ hidden: isPanelsDataEmpty || analyticsLoading })}
+ label={
+ _size(event.label) > CUSTOM_EV_DROPDOWN_MAX_VISIBLE_LENGTH ? (
+ <span title={event.label}>
+ {_truncate(event.label, {
+ length: CUSTOM_EV_DROPDOWN_MAX_VISIBLE_LENGTH,
+ })}
+ </span>
+ ) : (
+ event.label
+ )
+ }
+ onChange={() => {
+ switchCustomEventChart(event.id)
+ }}
+ checked={event.active}
+ />
+ )}
+ buttonClassName='group-hover:bg-gray-200 dark:group-hover:bg-slate-700 px-4 py-2 inline-flex w-full bg-white text-sm font-medium text-gray-700 dark:text-gray-50 dark:border-gray-800 dark:bg-slate-800'
+ keyExtractor={(event) => event.id}
+ onSelect={(event, e) => {
+ e?.stopPropagation()
+ e?.preventDefault()
+
+ switchCustomEventChart(event.id)
}}
+ chevron='mini'
+ headless
/>
)
- }}
- buttonClassName='!px-2.5'
- selectItemClassName='group text-gray-700 dark:text-gray-50 dark:border-gray-800 dark:bg-slate-800 block text-sm cursor-pointer hover:bg-gray-200 dark:hover:bg-slate-700'
- keyExtractor={(pair) => pair.id}
- onSelect={({ id: pairID, conflicts }) => {
- switchTrafficChartMetric(pairID, conflicts)
- }}
- chevron='mini'
- headless
- />
- )}
- {activeTab === PROJECT_TABS.errors &&
- allowedToManage &&
- activeError &&
- activeError?.details?.status !== 'resolved' && (
- <button
- type='button'
- disabled={errorStatusUpdating}
- onClick={markErrorAsResolved}
- className={cx('p-2 text-sm font-medium text-gray-700 dark:text-gray-50', {
- 'cursor-not-allowed': authLoading || errorLoading,
- 'opacity-50': errorLoading && !errorStatusUpdating,
- 'animate-pulse cursor-not-allowed': errorStatusUpdating,
- })}
- >
- {t('project.resolve')}
- </button>
- )}
- {activeTab === PROJECT_TABS.errors &&
- allowedToManage &&
- activeError &&
- activeError?.details?.status === 'resolved' && (
- <button
- type='button'
- disabled={errorStatusUpdating}
- onClick={markErrorAsActive}
- className={cx('p-2 text-sm font-medium text-gray-700 dark:text-gray-50', {
- 'cursor-not-allowed': authLoading || errorLoading,
- 'opacity-50': errorLoading && !errorStatusUpdating,
- 'animate-pulse cursor-not-allowed': errorStatusUpdating,
- })}
- >
- {t('project.markAsActive')}
- </button>
- )}
- {activeTab === PROJECT_TABS.errors && !activeError && (
- <Dropdown
- items={errorFilters}
- title={t('project.filters')}
- labelExtractor={(pair) => {
- const { label, active, id: pairID } = pair
+ }
- return (
- <Checkbox
- className='px-4 py-2'
- label={label}
- checked={active}
- onChange={() => switchActiveErrorFilter(pairID)}
- />
- )
- }}
- buttonClassName='!px-2.5'
- selectItemClassName='group text-gray-700 dark:text-gray-50 dark:border-gray-800 dark:bg-slate-800 block text-sm cursor-pointer hover:bg-gray-200 dark:hover:bg-slate-700'
- keyExtractor={(pair) => pair.id}
- onSelect={({ id: pairID }) => {
- switchActiveErrorFilter(pairID)
- }}
- chevron='mini'
- headless
- />
- )}
- {activeTab === PROJECT_TABS.funnels && (
- <button
- type='button'
- title={t('project.refreshStats')}
- onClick={refreshStats}
- className={cx(
- 'relative rounded-md border border-gray-50/0 bg-gray-50 p-2 text-sm font-medium hover:border-gray-300 hover:bg-white focus:z-10 focus:ring-1 focus:ring-indigo-500 focus:outline-hidden dark:bg-slate-900 hover:dark:border-slate-800/50 dark:hover:bg-slate-800 focus:dark:ring-gray-200',
+ return (
+ <Checkbox
+ className={cx('px-4 py-2', { hidden: isPanelsDataEmpty || analyticsLoading })}
+ label={label}
+ disabled={conflicted}
+ checked={active}
+ onChange={() => {
+ switchTrafficChartMetric(pairID, conflicts)
+ }}
+ />
+ )
+ }}
+ buttonClassName='!px-2.5'
+ selectItemClassName='group text-gray-700 dark:text-gray-50 dark:border-gray-800 dark:bg-slate-800 block text-sm cursor-pointer hover:bg-gray-200 dark:hover:bg-slate-700'
+ keyExtractor={(pair) => pair.id}
+ onSelect={({ id: pairID, conflicts }) => {
+ switchTrafficChartMetric(pairID, conflicts)
+ }}
+ chevron='mini'
+ headless
+ />
+ ) : null}
+ {activeTab === PROJECT_TABS.errors &&
+ allowedToManage &&
+ activeError &&
+ activeError?.details?.status !== 'resolved' ? (
+ <button
+ type='button'
+ disabled={errorStatusUpdating}
+ onClick={markErrorAsResolved}
+ className={cx('p-2 text-sm font-medium text-gray-700 dark:text-gray-50', {
+ 'cursor-not-allowed': authLoading || errorLoading,
+ 'opacity-50': errorLoading && !errorStatusUpdating,
+ 'animate-pulse cursor-not-allowed': errorStatusUpdating,
+ })}
+ >
+ {t('project.resolve')}
+ </button>
+ ) : null}
+ {activeTab === PROJECT_TABS.errors &&
+ allowedToManage &&
+ activeError &&
+ activeError?.details?.status === 'resolved' ? (
+ <button
+ type='button'
+ disabled={errorStatusUpdating}
+ onClick={markErrorAsActive}
+ className={cx('p-2 text-sm font-medium text-gray-700 dark:text-gray-50', {
+ 'cursor-not-allowed': authLoading || errorLoading,
+ 'opacity-50': errorLoading && !errorStatusUpdating,
+ 'animate-pulse cursor-not-allowed': errorStatusUpdating,
+ })}
+ >
+ {t('project.markAsActive')}
+ </button>
+ ) : null}
+ {activeTab === PROJECT_TABS.errors && !activeError ? (
+ <Dropdown
+ items={errorFilters}
+ title={t('project.filters')}
+ labelExtractor={(pair) => {
+ const { label, active, id: pairID } = pair
+
+ return (
+ <Checkbox
+ className='px-4 py-2'
+ label={label}
+ checked={active}
+ onChange={() => switchActiveErrorFilter(pairID)}
+ />
+ )
+ }}
+ buttonClassName='!px-2.5'
+ selectItemClassName='group text-gray-700 dark:text-gray-50 dark:border-gray-800 dark:bg-slate-800 block text-sm cursor-pointer hover:bg-gray-200 dark:hover:bg-slate-700'
+ keyExtractor={(pair) => pair.id}
+ onSelect={({ id: pairID }) => {
+ switchActiveErrorFilter(pairID)
+ }}
+ chevron='mini'
+ headless
+ />
+ ) : null}
+ {activeTab === PROJECT_TABS.funnels ? (
+ <button
+ type='button'
+ title={t('project.refreshStats')}
+ onClick={refreshStats}
+ className={cx(
+ 'relative rounded-md border border-gray-50/0 bg-gray-50 p-2 text-sm font-medium hover:border-gray-300 hover:bg-white focus:z-10 focus:ring-1 focus:ring-indigo-500 focus:outline-hidden dark:bg-slate-900 hover:dark:border-slate-800/50 dark:hover:bg-slate-800 focus:dark:ring-gray-200',
+ {
+ 'cursor-not-allowed opacity-50': authLoading || dataLoading,
+ },
+ )}
+ >
+ <RotateCw className='h-5 w-5 text-gray-700 dark:text-gray-50' />
+ </button>
+ ) : null}
+ {activeTab === PROJECT_TABS.performance && !isPanelsDataEmptyPerf ? (
+ <Dropdown
+ items={chartMetricsPerf}
+ className='xs:min-w-0'
+ title={
+ <p>
{
- 'cursor-not-allowed opacity-50': authLoading || dataLoading,
- },
- )}
- >
- <RotateCw className='h-5 w-5 text-gray-700 dark:text-gray-50' />
- </button>
- )}
- {activeTab === PROJECT_TABS.performance && !isPanelsDataEmptyPerf && (
- <Dropdown
- items={chartMetricsPerf}
- className='xs:min-w-0'
- title={
- <p>
- {
- _find(chartMetricsPerf, ({ id: chartId }) => chartId === activeChartMetricsPerf)
- ?.label
- }
- </p>
- }
- labelExtractor={(pair) => pair.label}
- keyExtractor={(pair) => pair.id}
- onSelect={({ id: pairID }) => {
- setActiveChartMetricsPerf(pairID)
- }}
- buttonClassName='!px-2.5'
- chevron='mini'
- headless
- />
- )}
- {activeTab === PROJECT_TABS.performance && !isPanelsDataEmptyPerf && (
- <Dropdown
- disabled={activeChartMetricsPerf === CHART_METRICS_MAPPING_PERF.quantiles}
- items={chartMeasuresPerf}
- className='xs:min-w-0'
- title={
- <p>
- {_find(chartMeasuresPerf, ({ id: chartId }) => chartId === activePerfMeasure)?.label}
- </p>
- }
- labelExtractor={(pair) => pair.label}
- keyExtractor={(pair) => pair.id}
- onSelect={({ id: pairID }) => {
- setActivePerfMeasure(pairID)
- }}
- buttonClassName='!px-2.5'
- chevron='mini'
- headless
- />
- )}
- <TBPeriodSelector
- classes={{
- timeBucket: activeTab === PROJECT_TABS.errors && !activeEID ? 'hidden' : '',
+ _find(chartMetricsPerf, ({ id: chartId }) => chartId === activeChartMetricsPerf)
+ ?.label
+ }
+ </p>
+ }
+ labelExtractor={(pair) => pair.label}
+ keyExtractor={(pair) => pair.id}
+ onSelect={({ id: pairID }) => {
+ setActiveChartMetricsPerf(pairID)
+ }}
+ buttonClassName='!px-2.5'
+ chevron='mini'
+ headless
+ />
+ ) : null}
+ {activeTab === PROJECT_TABS.performance && !isPanelsDataEmptyPerf ? (
+ <Dropdown
+ disabled={activeChartMetricsPerf === CHART_METRICS_MAPPING_PERF.quantiles}
+ items={chartMeasuresPerf}
+ className='xs:min-w-0'
+ title={
+ <p>
+ {_find(chartMeasuresPerf, ({ id: chartId }) => chartId === activePerfMeasure)?.label}
+ </p>
+ }
+ labelExtractor={(pair) => pair.label}
+ keyExtractor={(pair) => pair.id}
+ onSelect={({ id: pairID }) => {
+ setActivePerfMeasure(pairID)
}}
- activePeriod={activePeriod}
- items={timeBucketSelectorItems}
- title={activePeriod?.label}
- onSelect={(pair) => {
- if (dataLoading) {
+ buttonClassName='!px-2.5'
+ chevron='mini'
+ headless
+ />
+ ) : null}
+ <TBPeriodSelector
+ classes={{
+ timeBucket: activeTab === PROJECT_TABS.errors && !activeEID ? 'hidden' : '',
+ }}
+ activePeriod={activePeriod}
+ items={timeBucketSelectorItems}
+ title={activePeriod?.label}
+ onSelect={(pair) => {
+ if (dataLoading) {
+ return
+ }
+
+ if (pair.period === PERIOD_PAIRS_COMPARE.COMPARE) {
+ // @ts-expect-error
+ if (activeTab === PROJECT_TABS.alerts) {
return
}
- if (pair.period === PERIOD_PAIRS_COMPARE.COMPARE) {
+ if (isActiveCompare) {
+ compareDisable()
+ } else {
+ setIsActiveCompare(true)
+ }
+
+ return
+ }
+
+ if (pair.isCustomDate) {
+ setTimeout(() => {
// @ts-expect-error
- if (activeTab === PROJECT_TABS.alerts) {
+ refCalendar.current.openCalendar()
+ }, 100)
+ } else {
+ setPeriodPairs(tbPeriodPairs(t, undefined, undefined, language))
+ setDateRange(null)
+ updatePeriod(pair)
+ }
+ }}
+ />
+ {isActiveCompare && activeTab !== PROJECT_TABS.errors ? (
+ <>
+ <div className='text-md mx-2 font-mono font-medium whitespace-pre-line text-gray-600 dark:text-gray-200'>
+ vs
+ </div>
+ <Dropdown
+ items={periodPairsCompare}
+ title={activeDropdownLabelCompare}
+ labelExtractor={(pair) => pair.label}
+ keyExtractor={(pair) => pair.label}
+ onSelect={(pair) => {
+ if (pair.period === PERIOD_PAIRS_COMPARE.DISABLE) {
+ compareDisable()
return
}
- if (isActiveCompare) {
- compareDisable()
+ if (pair.period === PERIOD_PAIRS_COMPARE.CUSTOM) {
+ setTimeout(() => {
+ // @ts-expect-error
+ refCalendarCompare.current.openCalendar()
+ }, 100)
} else {
- setIsActiveCompare(true)
+ setPeriodPairsCompare(tbPeriodPairsCompare(t, undefined, language))
+ setDateRangeCompare(null)
+ setActivePeriodCompare(pair.period)
}
-
- return
- }
-
- if (pair.isCustomDate) {
- setTimeout(() => {
- // @ts-expect-error
- refCalendar.current.openCalendar()
- }, 100)
- } else {
- setPeriodPairs(tbPeriodPairs(t, undefined, undefined, language))
- setDateRange(null)
- updatePeriod(pair)
- }
- }}
- />
- {isActiveCompare && activeTab !== PROJECT_TABS.errors && (
- <>
- <div className='text-md mx-2 font-mono font-medium whitespace-pre-line text-gray-600 dark:text-gray-200'>
- vs
- </div>
- <Dropdown
- items={periodPairsCompare}
- title={activeDropdownLabelCompare}
- labelExtractor={(pair) => pair.label}
- keyExtractor={(pair) => pair.label}
- onSelect={(pair) => {
- if (pair.period === PERIOD_PAIRS_COMPARE.DISABLE) {
- compareDisable()
- return
- }
-
- if (pair.period === PERIOD_PAIRS_COMPARE.CUSTOM) {
- setTimeout(() => {
- // @ts-expect-error
- refCalendarCompare.current.openCalendar()
- }, 100)
- } else {
- setPeriodPairsCompare(tbPeriodPairsCompare(t, undefined, language))
- setDateRangeCompare(null)
- setActivePeriodCompare(pair.period)
- }
- }}
- chevron='mini'
- headless
- />
- </>
- )}
- <FlatPicker
- className='!mx-0'
- ref={refCalendar}
- onChange={setDateRange}
- value={dateRange || []}
- maxDateMonths={MAX_MONTHS_IN_PAST}
- maxRange={0}
- />
- <FlatPicker
- className='!mx-0'
- ref={refCalendarCompare}
- onChange={(date) => {
- setDateRangeCompare(date)
- setActivePeriodCompare(PERIOD_PAIRS_COMPARE.CUSTOM)
- setPeriodPairsCompare(tbPeriodPairsCompare(t, date, language))
- }}
- value={dateRangeCompare || []}
- maxDateMonths={MAX_MONTHS_IN_PAST}
- maxRange={maxRangeCompare}
- />
- </div>
+ }}
+ chevron='mini'
+ headless
+ />
+ </>
+ ) : null}
+ <FlatPicker
+ className='!mx-0'
+ ref={refCalendar}
+ onChange={setDateRange}
+ value={dateRange || []}
+ maxDateMonths={MAX_MONTHS_IN_PAST}
+ maxRange={0}
+ />
+ <FlatPicker
+ className='!mx-0'
+ ref={refCalendarCompare}
+ onChange={(date) => {
+ setDateRangeCompare(date)
+ setActivePeriodCompare(PERIOD_PAIRS_COMPARE.CUSTOM)
+ setPeriodPairsCompare(tbPeriodPairsCompare(t, date, language))
+ }}
+ value={dateRangeCompare || []}
+ maxDateMonths={MAX_MONTHS_IN_PAST}
+ maxRange={maxRangeCompare}
+ />
</div>
- {activeTab === PROJECT_TABS.funnels && (
- <button
- type='button'
- onClick={() => setActiveFunnel(null)}
- className='mx-auto mt-2 mb-4 flex items-center font-mono text-sm text-gray-900 underline decoration-dashed hover:decoration-solid lg:mx-0 lg:mt-0 dark:text-gray-100'
- >
- <ChevronLeftIcon className='mr-1 size-3' />
- {t('project.backToFunnels')}
- </button>
- )}
- </>
- )}
- {activeTab === PROJECT_TABS.alerts && (project.role !== 'owner' || !authenticated) && (
+ </div>
+ {activeTab === PROJECT_TABS.funnels ? (
+ <button
+ type='button'
+ onClick={() => setActiveFunnel(null)}
+ className='mx-auto mt-2 mb-4 flex items-center font-mono text-sm text-gray-900 underline decoration-dashed hover:decoration-solid lg:mx-0 lg:mt-0 dark:text-gray-100'
+ >
+ <ChevronLeftIcon className='mr-1 size-3' />
+ {t('project.backToFunnels')}
+ </button>
+ ) : null}
+ </>
+ ) : null}
+ {activeTab === PROJECT_TABS.alerts && (project.role !== 'owner' || !authenticated) ? (
<div className='mt-5 rounded-xl bg-gray-700 p-5'>
<div className='flex items-center text-gray-50'>
<BellRingIcon className='mr-2 h-8 w-8' strokeWidth={1.5} />
@@ -3623,8 +3624,8 @@ const ViewProject = () => {
{t('common.getStarted')}
</Link>
</div>
- )}
- {activeTab === PROJECT_TABS.funnels && !activeFunnel && !_isEmpty(project.funnels) && (
+ ) : null}
+ {activeTab === PROJECT_TABS.funnels && !activeFunnel && !_isEmpty(project.funnels) ? (
<FunnelsList
openFunnelSettings={(funnel?: Funnel) => {
if (funnel) {
@@ -3642,8 +3643,8 @@ const ViewProject = () => {
authenticated={authenticated}
allowedToManage={allowedToManage}
/>
- )}
- {activeTab === PROJECT_TABS.funnels && !activeFunnel && _isEmpty(project.funnels) && (
+ ) : null}
+ {activeTab === PROJECT_TABS.funnels && !activeFunnel && _isEmpty(project.funnels) ? (
<div className='mt-5 rounded-xl bg-gray-700 p-5'>
<div className='flex items-center text-gray-50'>
<FilterIcon className='mr-2 h-8 w-8' strokeWidth={1.5} />
@@ -3670,8 +3671,8 @@ const ViewProject = () => {
</Link>
)}
</div>
- )}
- {activeTab === PROJECT_TABS.sessions && !activePSID && (
+ ) : null}
+ {activeTab === PROJECT_TABS.sessions && !activePSID ? (
<>
<Filters
onRemoveFilter={filterHandler}
@@ -3679,15 +3680,15 @@ const ViewProject = () => {
tnMapping={tnMapping}
resetFilters={resetActiveTabFilters}
/>
- {(sessionsLoading === null || sessionsLoading) && _isEmpty(sessions) && <Loader />}
- {typeof sessionsLoading === 'boolean' && !sessionsLoading && _isEmpty(sessions) && (
+ {(sessionsLoading === null || sessionsLoading) && _isEmpty(sessions) ? <Loader /> : null}
+ {typeof sessionsLoading === 'boolean' && !sessionsLoading && _isEmpty(sessions) ? (
<NoEvents
filters={filters}
filterHandler={filterHandler}
onChangeExclusive={onChangeExclusive}
resetActiveTabFilters={resetActiveTabFilters}
/>
- )}
+ ) : null}
<Sessions
sessions={sessions}
onClick={(psid) => {
@@ -3695,7 +3696,7 @@ const ViewProject = () => {
}}
timeFormat={timeFormat}
/>
- {canLoadMoreSessions && (
+ {canLoadMoreSessions ? (
<button
type='button'
title={t('project.loadMore')}
@@ -3711,10 +3712,10 @@ const ViewProject = () => {
<DownloadIcon className='mr-2 h-5 w-5' strokeWidth={1.5} />
{t('project.loadMore')}
</button>
- )}
+ ) : null}
</>
- )}
- {activeTab === PROJECT_TABS.sessions && activePSID && (
+ ) : null}
+ {activeTab === PROJECT_TABS.sessions && activePSID ? (
<>
<button
type='button'
@@ -3729,8 +3730,8 @@ const ViewProject = () => {
<ChevronLeftIcon className='mr-1 size-3' />
{t('project.backToSessions')}
</button>
- {activeSession?.details && <SessionDetails details={activeSession?.details} />}
- {!_isEmpty(activeSession?.chart) && (
+ {activeSession?.details ? <SessionDetails details={activeSession?.details} /> : null}
+ {!_isEmpty(activeSession?.chart) ? (
<SessionChart
chart={activeSession?.chart}
timeBucket={activeSession?.timeBucket}
@@ -3739,16 +3740,18 @@ const ViewProject = () => {
chartType={chartType}
dataNames={dataNames}
/>
- )}
+ ) : null}
<Pageflow pages={activeSession?.pages} timeFormat={timeFormat} />
- {_isEmpty(activeSession) && sessionLoading && <Loader />}
+ {_isEmpty(activeSession) && sessionLoading ? <Loader /> : null}
{activeSession !== null &&
- _isEmpty(activeSession?.chart) &&
- _isEmpty(activeSession?.pages) &&
- !sessionLoading && <NoSessionDetails />}
+ _isEmpty(activeSession?.chart) &&
+ _isEmpty(activeSession?.pages) &&
+ !sessionLoading ? (
+ <NoSessionDetails />
+ ) : null}
</>
- )}
- {activeTab === PROJECT_TABS.errors && !activeEID && (
+ ) : null}
+ {activeTab === PROJECT_TABS.errors && !activeEID ? (
<>
<Filters
onRemoveFilter={filterHandler}
@@ -3756,15 +3759,15 @@ const ViewProject = () => {
tnMapping={tnMapping}
resetFilters={resetActiveTabFilters}
/>
- {(errorsLoading === null || errorsLoading) && _isEmpty(errors) && <Loader />}
- {typeof errorsLoading === 'boolean' && !errorsLoading && _isEmpty(errors) && (
+ {(errorsLoading === null || errorsLoading) && _isEmpty(errors) ? <Loader /> : null}
+ {typeof errorsLoading === 'boolean' && !errorsLoading && _isEmpty(errors) ? (
<NoEvents
filters={filtersErrors}
filterHandler={filterHandler}
onChangeExclusive={onChangeExclusive}
resetActiveTabFilters={resetActiveTabFilters}
/>
- )}
+ ) : null}
<Errors
errors={errors}
onClick={(eidToLoad) => {
@@ -3772,7 +3775,7 @@ const ViewProject = () => {
setErrorLoading(true)
}}
/>
- {canLoadMoreErrors && (
+ {canLoadMoreErrors ? (
<button
type='button'
title={t('project.loadMore')}
@@ -3788,10 +3791,10 @@ const ViewProject = () => {
<DownloadIcon className='mr-2 h-5 w-5' strokeWidth={1.5} />
{t('project.loadMore')}
</button>
- )}
+ ) : null}
</>
- )}
- {activeTab === PROJECT_TABS.errors && activeEID && (
+ ) : null}
+ {activeTab === PROJECT_TABS.errors && activeEID ? (
<>
<button
type='button'
@@ -3806,8 +3809,8 @@ const ViewProject = () => {
<ChevronLeftIcon className='mr-1 size-3' />
{t('project.backToErrors')}
</button>
- {activeError?.details && <ErrorDetails details={activeError.details} />}
- {activeError?.chart && (
+ {activeError?.details ? <ErrorDetails details={activeError.details} /> : null}
+ {activeError?.chart ? (
<ErrorChart
chart={activeError?.chart}
timeBucket={activeError?.timeBucket}
@@ -3816,7 +3819,7 @@ const ViewProject = () => {
chartType={chartType}
dataNames={dataNames}
/>
- )}
+ ) : null}
<Filters
onRemoveFilter={filterHandler}
onChangeExclusive={onChangeExclusive}
@@ -3824,53 +3827,62 @@ const ViewProject = () => {
resetFilters={resetActiveTabFilters}
/>
<div className='mt-5 grid grid-cols-1 gap-5 sm:grid-cols-2 lg:grid-cols-3'>
- {!_isEmpty(activeError?.params) &&
- _map(ERROR_PANELS_ORDER, (type: keyof typeof tnMapping) => {
- const panelName = tnMapping[type]
- // @ts-expect-error
- const panelIcon = panelIconMapping[type]
+ {!_isEmpty(activeError?.params)
+ ? _map(ERROR_PANELS_ORDER, (type: keyof typeof tnMapping) => {
+ const panelName = tnMapping[type]
+ // @ts-expect-error
+ const panelIcon = panelIconMapping[type]
+
+ if (type === 'cc') {
+ const ccPanelName = tnMapping[countryActiveTab]
- if (type === 'cc') {
- const ccPanelName = tnMapping[countryActiveTab]
+ const rowMapper = (entry: CountryEntry) => {
+ const { name: entryName, cc } = entry
- const rowMapper = (entry: CountryEntry) => {
- const { name: entryName, cc } = entry
+ if (cc) {
+ return <CCRow cc={cc} name={entryName} language={language} />
+ }
- if (cc) {
- return <CCRow cc={cc} name={entryName} language={language} />
+ return <CCRow cc={entryName} language={language} />
}
- return <CCRow cc={entryName} language={language} />
+ return (
+ <Panel
+ key={countryActiveTab}
+ icon={panelIcon}
+ id={countryActiveTab}
+ onFilter={filterHandler}
+ name={<CountryDropdown onSelect={setCountryActiveTab} title={ccPanelName} />}
+ data={activeError.params[countryActiveTab]}
+ rowMapper={rowMapper}
+ />
+ )
}
- return (
- <Panel
- key={countryActiveTab}
- icon={panelIcon}
- id={countryActiveTab}
- onFilter={filterHandler}
- name={<CountryDropdown onSelect={setCountryActiveTab} title={ccPanelName} />}
- data={activeError.params[countryActiveTab]}
- rowMapper={rowMapper}
- />
- )
- }
+ if (type === 'br') {
+ const brPanelName = tnMapping[browserActiveTab]
- if (type === 'br') {
- const brPanelName = tnMapping[browserActiveTab]
+ const rowMapper = (entry: any) => {
+ const { name: entryName, br } = entry
- const rowMapper = (entry: any) => {
- const { name: entryName, br } = entry
+ const logoKey = browserActiveTab === 'br' ? entryName : br
- const logoKey = browserActiveTab === 'br' ? entryName : br
+ // @ts-expect-error
+ const logoUrl = BROWSER_LOGO_MAP[logoKey]
- // @ts-expect-error
- const logoUrl = BROWSER_LOGO_MAP[logoKey]
+ if (!logoUrl) {
+ return (
+ <>
+ <GlobeAltIcon className='h-5 w-5' />
+ &nbsp;
+ {entryName}
+ </>
+ )
+ }
- if (!logoUrl) {
return (
<>
- <GlobeAltIcon className='h-5 w-5' />
+ <img src={logoUrl} className='h-5 w-5' alt='' />
&nbsp;
{entryName}
</>
@@ -3878,139 +3890,145 @@ const ViewProject = () => {
}
return (
- <>
- <img src={logoUrl} className='h-5 w-5' alt='' />
- &nbsp;
- {entryName}
- </>
+ <Panel
+ key={browserActiveTab}
+ icon={panelIcon}
+ id={browserActiveTab}
+ onFilter={filterHandler}
+ name={<BrowserDropdown onSelect={setBrowserActiveTab} title={brPanelName} />}
+ data={activeError.params[browserActiveTab]}
+ rowMapper={rowMapper}
+ />
)
}
- return (
- <Panel
- key={browserActiveTab}
- icon={panelIcon}
- id={browserActiveTab}
- onFilter={filterHandler}
- name={<BrowserDropdown onSelect={setBrowserActiveTab} title={brPanelName} />}
- data={activeError.params[browserActiveTab]}
- rowMapper={rowMapper}
- />
- )
- }
+ if (type === 'os') {
+ const osPanelName = tnMapping[osActiveTab]
- if (type === 'os') {
- const osPanelName = tnMapping[osActiveTab]
+ const rowMapper = (entry: any) => {
+ const { name: entryName, os } = entry
- const rowMapper = (entry: any) => {
- const { name: entryName, os } = entry
+ const logoKey = osActiveTab === 'os' ? entryName : os
- const logoKey = osActiveTab === 'os' ? entryName : os
+ // @ts-expect-error
+ const logoPathLight = OS_LOGO_MAP[logoKey]
+ // @ts-expect-error
+ const logoPathDark = OS_LOGO_MAP_DARK[logoKey]
- // @ts-expect-error
- const logoPathLight = OS_LOGO_MAP[logoKey]
- // @ts-expect-error
- const logoPathDark = OS_LOGO_MAP_DARK[logoKey]
+ let logoPath = _theme === 'dark' ? logoPathDark : logoPathLight
+ logoPath ||= logoPathLight
- let logoPath = _theme === 'dark' ? logoPathDark : logoPathLight
- logoPath ||= logoPathLight
+ if (!logoPath) {
+ return (
+ <>
+ <GlobeAltIcon className='h-5 w-5' />
+ &nbsp;
+ {entryName}
+ </>
+ )
+ }
+
+ const logoUrl = `/${logoPath}`
- if (!logoPath) {
return (
<>
- <GlobeAltIcon className='h-5 w-5' />
+ <img src={logoUrl} className='h-5 w-5 dark:fill-gray-50' alt='' />
&nbsp;
{entryName}
</>
)
}
- const logoUrl = `/${logoPath}`
-
return (
- <>
- <img src={logoUrl} className='h-5 w-5 dark:fill-gray-50' alt='' />
- &nbsp;
- {entryName}
- </>
+ <Panel
+ key={osActiveTab}
+ icon={panelIcon}
+ id={osActiveTab}
+ onFilter={filterHandler}
+ name={<OSDropdown onSelect={setOsActiveTab} title={osPanelName} />}
+ data={activeError.params[osActiveTab]}
+ rowMapper={rowMapper}
+ />
)
}
- return (
- <Panel
- key={osActiveTab}
- icon={panelIcon}
- id={osActiveTab}
- onFilter={filterHandler}
- name={<OSDropdown onSelect={setOsActiveTab} title={osPanelName} />}
- data={activeError.params[osActiveTab]}
- rowMapper={rowMapper}
- />
- )
- }
-
- if (type === 'dv') {
- return (
- <Panel
- key={type}
- icon={panelIcon}
- id={type}
- onFilter={filterHandler}
- name={panelName}
- data={activeError.params[type]}
- rowMapper={(entry: { name: keyof typeof deviceIconMapping }) => {
- const { name: entryName } = entry
+ if (type === 'dv') {
+ return (
+ <Panel
+ key={type}
+ icon={panelIcon}
+ id={type}
+ onFilter={filterHandler}
+ name={panelName}
+ data={activeError.params[type]}
+ rowMapper={(entry: { name: keyof typeof deviceIconMapping }) => {
+ const { name: entryName } = entry
+
+ const icon = deviceIconMapping[entryName]
+
+ if (!icon) {
+ return entryName
+ }
- const icon = deviceIconMapping[entryName]
+ return (
+ <>
+ {icon}
+ &nbsp;
+ {entryName}
+ </>
+ )
+ }}
+ capitalize
+ />
+ )
+ }
- if (!icon) {
- return entryName
- }
+ if (type === 'pg') {
+ return (
+ <Panel
+ key={pageActiveTab}
+ icon={panelIcon}
+ id={pageActiveTab}
+ onFilter={filterHandler}
+ rowMapper={({ name: entryName }) => {
+ if (!entryName) {
+ return _toUpper(
+ pageActiveTab === 'pg' ? t('project.redactedPage') : t('project.unknownHost'),
+ )
+ }
- return (
- <>
- {icon}
- &nbsp;
- {entryName}
- </>
- )
- }}
- capitalize
- />
- )
- }
+ let decodedUri = entryName as string
- if (type === 'pg') {
- return (
- <Panel
- key={pageActiveTab}
- icon={panelIcon}
- id={pageActiveTab}
- onFilter={filterHandler}
- rowMapper={({ name: entryName }) => {
- if (!entryName) {
- return _toUpper(
- pageActiveTab === 'pg' ? t('project.redactedPage') : t('project.unknownHost'),
- )
- }
+ try {
+ decodedUri = decodeURIComponent(entryName)
+ } catch {
+ // do nothing
+ }
- let decodedUri = entryName as string
+ return decodedUri
+ }}
+ data={activeError.params[pageActiveTab]}
+ name={<PageDropdown onSelect={setPageActiveTab} title={tnMapping[pageActiveTab]} />}
+ />
+ )
+ }
- try {
- decodedUri = decodeURIComponent(entryName)
- } catch (_) {
- // do nothing
+ if (type === 'lc') {
+ return (
+ <Panel
+ key={type}
+ icon={panelIcon}
+ id={type}
+ onFilter={filterHandler}
+ name={panelName}
+ data={activeError.params[type]}
+ rowMapper={({ name: entryName }: { name: string }) =>
+ getLocaleDisplayName(entryName, language)
}
+ />
+ )
+ }
- return decodedUri
- }}
- data={activeError.params[pageActiveTab]}
- name={<PageDropdown onSelect={setPageActiveTab} title={tnMapping[pageActiveTab]} />}
- />
- )
- }
-
- if (type === 'lc') {
return (
<Panel
key={type}
@@ -4019,85 +4037,72 @@ const ViewProject = () => {
onFilter={filterHandler}
name={panelName}
data={activeError.params[type]}
- rowMapper={({ name: entryName }: { name: string }) =>
- getLocaleDisplayName(entryName, language)
- }
/>
)
- }
-
- return (
- <Panel
- key={type}
- icon={panelIcon}
- id={type}
- onFilter={filterHandler}
- name={panelName}
- data={activeError.params[type]}
- />
- )
- })}
+ })
+ : null}
</div>
- {_isEmpty(activeError) && errorLoading && <Loader />}
- {!errorLoading && _isEmpty(activeError) && <NoErrorDetails />}
+ {_isEmpty(activeError) && errorLoading ? <Loader /> : null}
+ {!errorLoading && _isEmpty(activeError) ? <NoErrorDetails /> : null}
</>
- )}
- {activeTab === PROJECT_TABS.alerts && project.role === 'owner' && authenticated && (
+ ) : null}
+ {activeTab === PROJECT_TABS.alerts && project.role === 'owner' && authenticated ? (
<ProjectAlertsView />
- )}
- {analyticsLoading && (activeTab === PROJECT_TABS.traffic || activeTab === PROJECT_TABS.performance) && (
+ ) : null}
+ {analyticsLoading && (activeTab === PROJECT_TABS.traffic || activeTab === PROJECT_TABS.performance) ? (
<Loader />
- )}
- {isPanelsDataEmpty && activeTab === PROJECT_TABS.traffic && (
+ ) : null}
+ {isPanelsDataEmpty && activeTab === PROJECT_TABS.traffic ? (
<NoEvents
filters={filters}
filterHandler={filterHandler}
onChangeExclusive={onChangeExclusive}
resetActiveTabFilters={resetActiveTabFilters}
/>
- )}
- {isPanelsDataEmptyPerf && activeTab === PROJECT_TABS.performance && (
+ ) : null}
+ {isPanelsDataEmptyPerf && activeTab === PROJECT_TABS.performance ? (
<NoEvents
filters={filtersPerf}
filterHandler={filterHandler}
onChangeExclusive={onChangeExclusive}
resetActiveTabFilters={resetActiveTabFilters}
/>
- )}
- {activeTab === PROJECT_TABS.traffic && (
+ ) : null}
+ {activeTab === PROJECT_TABS.traffic ? (
<div className={cx('pt-2', { hidden: isPanelsDataEmpty || analyticsLoading })}>
- {!_isEmpty(overall) && (
+ {!_isEmpty(overall) ? (
<div className='mb-5 flex flex-wrap justify-center gap-5 lg:justify-start'>
<MetricCards
overall={overall}
overallCompare={overallCompare}
activePeriodCompare={activePeriodCompare}
/>
- {!_isEmpty(panelsData.meta) &&
- _map(panelsData.meta, ({ key, current, previous }) => (
- <React.Fragment key={key}>
- <MetricCard
- label={t('project.metrics.xAvg', { x: key })}
- value={current.avg}
- change={current.avg - previous.avg}
- goodChangeDirection='down'
- valueMapper={(value, type) =>
- `${type === 'badge' && value > 0 ? '+' : ''}${nLocaleFormatter(value)}`
- }
- />
- <MetricCard
- label={t('project.metrics.xTotal', { x: key })}
- value={current.sum}
- change={current.sum - previous.sum}
- goodChangeDirection='down'
- valueMapper={(value, type) =>
- `${type === 'badge' && value > 0 ? '+' : ''}${nLocaleFormatter(value)}`
- }
- />
- </React.Fragment>
- ))}
+ {!_isEmpty(panelsData.meta)
+ ? _map(panelsData.meta, ({ key, current, previous }) => (
+ <React.Fragment key={key}>
+ <MetricCard
+ label={t('project.metrics.xAvg', { x: key })}
+ value={current.avg}
+ change={current.avg - previous.avg}
+ goodChangeDirection='down'
+ valueMapper={(value, type) =>
+ `${type === 'badge' && value > 0 ? '+' : ''}${nLocaleFormatter(value)}`
+ }
+ />
+ <MetricCard
+ label={t('project.metrics.xTotal', { x: key })}
+ value={current.sum}
+ change={current.sum - previous.sum}
+ goodChangeDirection='down'
+ valueMapper={(value, type) =>
+ `${type === 'badge' && value > 0 ? '+' : ''}${nLocaleFormatter(value)}`
+ }
+ />
+ </React.Fragment>
+ ))
+ : null}
</div>
- )}
+ ) : null}
<div
className={cx('h-80', {
hidden: checkIfAllMetricsAreDisabled,
@@ -4116,64 +4121,73 @@ const ViewProject = () => {
onRemoveMetric={(id) => onRemoveCustomMetric(id)}
resetMetrics={resetCustomMetrics}
/>
- {dataLoading && (
+ {dataLoading ? (
<div className='static mt-4 !bg-transparent' id='loader'>
<div className='loader-head dark:!bg-slate-800'>
<div className='first dark:!bg-slate-600' />
<div className='second dark:!bg-slate-600' />
</div>
</div>
- )}
+ ) : null}
<div className='mt-5 grid grid-cols-1 gap-5 sm:grid-cols-2 lg:grid-cols-3'>
- {!_isEmpty(panelsData.types) &&
- _map(TRAFFIC_PANELS_ORDER, (type: keyof typeof tnMapping) => {
- const panelName = tnMapping[type]
- // @ts-expect-error
- const panelIcon = panelIconMapping[type]
- const customTabs = _filter(customPanelTabs, (tab) => tab.panelID === type)
+ {!_isEmpty(panelsData.types)
+ ? _map(TRAFFIC_PANELS_ORDER, (type: keyof typeof tnMapping) => {
+ const panelName = tnMapping[type]
+ // @ts-expect-error
+ const panelIcon = panelIconMapping[type]
+ const customTabs = _filter(customPanelTabs, (tab) => tab.panelID === type)
- if (type === 'cc') {
- const ccPanelName = tnMapping[countryActiveTab]
+ if (type === 'cc') {
+ const ccPanelName = tnMapping[countryActiveTab]
- const rowMapper = (entry: CountryEntry) => {
- const { name: entryName, cc } = entry
+ const rowMapper = (entry: CountryEntry) => {
+ const { name: entryName, cc } = entry
+
+ if (cc) {
+ return <CCRow cc={cc} name={entryName} language={language} />
+ }
- if (cc) {
- return <CCRow cc={cc} name={entryName} language={language} />
+ return <CCRow cc={entryName} language={language} />
}
- return <CCRow cc={entryName} language={language} />
+ return (
+ <Panel
+ key={countryActiveTab}
+ icon={panelIcon}
+ id={countryActiveTab}
+ onFilter={filterHandler}
+ name={<CountryDropdown onSelect={setCountryActiveTab} title={ccPanelName} />}
+ data={panelsData.data[countryActiveTab]}
+ customTabs={customTabs}
+ rowMapper={rowMapper}
+ />
+ )
}
- return (
- <Panel
- key={countryActiveTab}
- icon={panelIcon}
- id={countryActiveTab}
- onFilter={filterHandler}
- name={<CountryDropdown onSelect={setCountryActiveTab} title={ccPanelName} />}
- data={panelsData.data[countryActiveTab]}
- customTabs={customTabs}
- rowMapper={rowMapper}
- />
- )
- }
+ if (type === 'br') {
+ const brPanelName = tnMapping[browserActiveTab]
- if (type === 'br') {
- const brPanelName = tnMapping[browserActiveTab]
+ const rowMapper = (entry: any) => {
+ const { name: entryName, br } = entry
- const rowMapper = (entry: any) => {
- const { name: entryName, br } = entry
+ const logoKey = browserActiveTab === 'br' ? entryName : br
- const logoKey = browserActiveTab === 'br' ? entryName : br
+ // @ts-expect-error
+ const logoUrl = BROWSER_LOGO_MAP[logoKey]
- // @ts-expect-error
- const logoUrl = BROWSER_LOGO_MAP[logoKey]
+ if (!logoUrl) {
+ return (
+ <>
+ <GlobeAltIcon className='h-5 w-5' />
+ &nbsp;
+ {entryName}
+ </>
+ )
+ }
- if (!logoUrl) {
return (
<>
- <GlobeAltIcon className='h-5 w-5' />
+ <img src={logoUrl} className='h-5 w-5' alt='' />
&nbsp;
{entryName}
</>
@@ -4181,180 +4195,187 @@ const ViewProject = () => {
}
return (
- <>
- <img src={logoUrl} className='h-5 w-5' alt='' />
- &nbsp;
- {entryName}
- </>
+ <Panel
+ key={browserActiveTab}
+ icon={panelIcon}
+ id={browserActiveTab}
+ onFilter={filterHandler}
+ name={<BrowserDropdown onSelect={setBrowserActiveTab} title={brPanelName} />}
+ data={panelsData.data[browserActiveTab]}
+ rowMapper={rowMapper}
+ />
)
}
- return (
- <Panel
- key={browserActiveTab}
- icon={panelIcon}
- id={browserActiveTab}
- onFilter={filterHandler}
- name={<BrowserDropdown onSelect={setBrowserActiveTab} title={brPanelName} />}
- data={panelsData.data[browserActiveTab]}
- rowMapper={rowMapper}
- />
- )
- }
+ if (type === 'os') {
+ const osPanelName = tnMapping[osActiveTab]
- if (type === 'os') {
- const osPanelName = tnMapping[osActiveTab]
+ const rowMapper = (entry: any) => {
+ const { name: entryName, os } = entry
- const rowMapper = (entry: any) => {
- const { name: entryName, os } = entry
+ const logoKey = osActiveTab === 'os' ? entryName : os
- const logoKey = osActiveTab === 'os' ? entryName : os
+ // @ts-expect-error
+ const logoPathLight = OS_LOGO_MAP[logoKey]
+ // @ts-expect-error
+ const logoPathDark = OS_LOGO_MAP_DARK[logoKey]
- // @ts-expect-error
- const logoPathLight = OS_LOGO_MAP[logoKey]
- // @ts-expect-error
- const logoPathDark = OS_LOGO_MAP_DARK[logoKey]
+ let logoPath = _theme === 'dark' ? logoPathDark : logoPathLight
+ logoPath ||= logoPathLight
+
+ if (!logoPath) {
+ return (
+ <>
+ <GlobeAltIcon className='h-5 w-5' />
+ &nbsp;
+ {entryName}
+ </>
+ )
+ }
- let logoPath = _theme === 'dark' ? logoPathDark : logoPathLight
- logoPath ||= logoPathLight
+ const logoUrl = `/${logoPath}`
- if (!logoPath) {
return (
<>
- <GlobeAltIcon className='h-5 w-5' />
+ <img src={logoUrl} className='h-5 w-5 dark:fill-gray-50' alt='' />
&nbsp;
{entryName}
</>
)
}
- const logoUrl = `/${logoPath}`
-
return (
- <>
- <img src={logoUrl} className='h-5 w-5 dark:fill-gray-50' alt='' />
- &nbsp;
- {entryName}
- </>
+ <Panel
+ key={osActiveTab}
+ icon={panelIcon}
+ id={osActiveTab}
+ onFilter={filterHandler}
+ name={<OSDropdown onSelect={setOsActiveTab} title={osPanelName} />}
+ data={panelsData.data[osActiveTab]}
+ rowMapper={rowMapper}
+ />
)
}
- return (
- <Panel
- key={osActiveTab}
- icon={panelIcon}
- id={osActiveTab}
- onFilter={filterHandler}
- name={<OSDropdown onSelect={setOsActiveTab} title={osPanelName} />}
- data={panelsData.data[osActiveTab]}
- rowMapper={rowMapper}
- />
- )
- }
+ if (type === 'dv') {
+ return (
+ <Panel
+ key={type}
+ icon={panelIcon}
+ id={type}
+ onFilter={filterHandler}
+ name={panelName}
+ data={panelsData.data[type]}
+ customTabs={customTabs}
+ rowMapper={(entry: { name: keyof typeof deviceIconMapping }) => {
+ const { name: entryName } = entry
+
+ const icon = deviceIconMapping[entryName]
+
+ if (!icon) {
+ return entryName
+ }
- if (type === 'dv') {
- return (
- <Panel
- key={type}
- icon={panelIcon}
- id={type}
- onFilter={filterHandler}
- name={panelName}
- data={panelsData.data[type]}
- customTabs={customTabs}
- rowMapper={(entry: { name: keyof typeof deviceIconMapping }) => {
- const { name: entryName } = entry
+ return (
+ <>
+ {icon}
+ &nbsp;
+ {entryName}
+ </>
+ )
+ }}
+ capitalize
+ />
+ )
+ }
- const icon = deviceIconMapping[entryName]
+ if (type === 'ref') {
+ return (
+ <Panel
+ key={type}
+ icon={panelIcon}
+ id={type}
+ onFilter={filterHandler}
+ name={panelName}
+ data={panelsData.data[type]}
+ customTabs={customTabs}
+ rowMapper={({ name: entryName }) => <RefRow rowName={entryName} />}
+ />
+ )
+ }
- if (!icon) {
- return entryName
- }
+ if (type === 'so') {
+ const ccPanelName = tnMapping[utmActiveTab]
- return (
- <>
- {icon}
- &nbsp;
- {entryName}
- </>
- )
- }}
- capitalize
- />
- )
- }
+ return (
+ <Panel
+ key={utmActiveTab}
+ icon={panelIcon}
+ id={utmActiveTab}
+ onFilter={filterHandler}
+ name={<UTMDropdown onSelect={setUtmActiveTab} title={ccPanelName} />}
+ data={panelsData.data[utmActiveTab]}
+ customTabs={customTabs}
+ rowMapper={({ name: entryName }) => decodeURIComponent(entryName)}
+ />
+ )
+ }
- if (type === 'ref') {
- return (
- <Panel
- key={type}
- icon={panelIcon}
- id={type}
- onFilter={filterHandler}
- name={panelName}
- data={panelsData.data[type]}
- customTabs={customTabs}
- rowMapper={({ name: entryName }) => <RefRow rowName={entryName} />}
- />
- )
- }
+ if (type === 'pg') {
+ return (
+ <Panel
+ key={pageActiveTab}
+ icon={panelIcon}
+ id={pageActiveTab}
+ onFilter={filterHandler}
+ onFragmentChange={setPgActiveFragment}
+ rowMapper={({ name: entryName }) => {
+ if (!entryName) {
+ return _toUpper(
+ pageActiveTab === 'pg' ? t('project.redactedPage') : t('project.unknownHost'),
+ )
+ }
- if (type === 'so') {
- const ccPanelName = tnMapping[utmActiveTab]
+ let decodedUri = entryName as string
- return (
- <Panel
- key={utmActiveTab}
- icon={panelIcon}
- id={utmActiveTab}
- onFilter={filterHandler}
- name={<UTMDropdown onSelect={setUtmActiveTab} title={ccPanelName} />}
- data={panelsData.data[utmActiveTab]}
- customTabs={customTabs}
- rowMapper={({ name: entryName }) => decodeURIComponent(entryName)}
- />
- )
- }
+ try {
+ decodedUri = decodeURIComponent(entryName)
+ } catch {
+ // do nothing
+ }
- if (type === 'pg') {
- return (
- <Panel
- key={pageActiveTab}
- icon={panelIcon}
- id={pageActiveTab}
- onFilter={filterHandler}
- onFragmentChange={setPgActiveFragment}
- rowMapper={({ name: entryName }) => {
- if (!entryName) {
- return _toUpper(
- pageActiveTab === 'pg' ? t('project.redactedPage') : t('project.unknownHost'),
+ return decodedUri
+ }}
+ name={
+ pgActiveFragment === 1 ? (
+ tnMapping.userFlow
+ ) : (
+ <PageDropdown onSelect={setPageActiveTab} title={tnMapping[pageActiveTab]} />
)
}
+ data={panelsData.data[pageActiveTab]}
+ customTabs={customTabs}
+ />
+ )
+ }
- let decodedUri = entryName as string
-
- try {
- decodedUri = decodeURIComponent(entryName)
- } catch (_) {
- // do nothing
+ if (type === 'lc') {
+ return (
+ <Panel
+ key={type}
+ icon={panelIcon}
+ id={type}
+ onFilter={filterHandler}
+ name={panelName}
+ data={panelsData.data[type]}
+ rowMapper={({ name: entryName }: { name: string }) =>
+ getLocaleDisplayName(entryName, language)
}
+ customTabs={customTabs}
+ />
+ )
+ }
- return decodedUri
- }}
- name={
- pgActiveFragment === 1 ? (
- tnMapping.userFlow
- ) : (
- <PageDropdown onSelect={setPageActiveTab} title={tnMapping[pageActiveTab]} />
- )
- }
- data={panelsData.data[pageActiveTab]}
- customTabs={customTabs}
- />
- )
- }
-
- if (type === 'lc') {
return (
<Panel
key={type}
@@ -4363,27 +4384,12 @@ const ViewProject = () => {
onFilter={filterHandler}
name={panelName}
data={panelsData.data[type]}
- rowMapper={({ name: entryName }: { name: string }) =>
- getLocaleDisplayName(entryName, language)
- }
customTabs={customTabs}
/>
)
- }
-
- return (
- <Panel
- key={type}
- icon={panelIcon}
- id={type}
- onFilter={filterHandler}
- name={panelName}
- data={panelsData.data[type]}
- customTabs={customTabs}
- />
- )
- })}
- {!_isEmpty(panelsData.data) && (
+ })
+ : null}
+ {!_isEmpty(panelsData.data) ? (
<Metadata
customs={panelsData.customs}
properties={panelsData.properties}
@@ -4394,19 +4400,19 @@ const ViewProject = () => {
getCustomEventMetadata={getCustomEventMetadata}
getPropertyMetadata={_getPropertyMetadata}
/>
- )}
+ ) : null}
</div>
</div>
- )}
- {activeTab === PROJECT_TABS.performance && (
+ ) : null}
+ {activeTab === PROJECT_TABS.performance ? (
<div className={cx('pt-8 md:pt-4', { hidden: isPanelsDataEmptyPerf || analyticsLoading })}>
- {!_isEmpty(overallPerformance) && (
+ {!_isEmpty(overallPerformance) ? (
<PerformanceMetricCards
overall={overallPerformance}
overallCompare={overallPerformanceCompare}
activePeriodCompare={activePeriodCompare}
/>
- )}
+ ) : null}
<div
className={cx('h-80', {
hidden: checkIfAllMetricsAreDisabled,
@@ -4420,123 +4426,132 @@ const ViewProject = () => {
tnMapping={tnMapping}
resetFilters={resetActiveTabFilters}
/>
- {dataLoading && (
+ {dataLoading ? (
<div className='static mt-4 !bg-transparent' id='loader'>
<div className='loader-head dark:!bg-slate-800'>
<div className='first dark:!bg-slate-600' />
<div className='second dark:!bg-slate-600' />
</div>
</div>
- )}
+ ) : null}
<div className='mt-5 grid grid-cols-1 gap-5 sm:grid-cols-2 lg:grid-cols-3'>
- {!_isEmpty(panelsDataPerf.types) &&
- _map(PERFORMANCE_PANELS_ORDER, (type: keyof typeof tnMapping) => {
- const panelName = tnMapping[type]
- // @ts-expect-error
- const panelIcon = panelIconMapping[type]
- const customTabs = _filter(customPanelTabs, (tab) => tab.panelID === type)
+ {!_isEmpty(panelsDataPerf.types)
+ ? _map(PERFORMANCE_PANELS_ORDER, (type: keyof typeof tnMapping) => {
+ const panelName = tnMapping[type]
+ // @ts-expect-error
+ const panelIcon = panelIconMapping[type]
+ const customTabs = _filter(customPanelTabs, (tab) => tab.panelID === type)
+
+ if (type === 'cc') {
+ const ccPanelName = tnMapping[countryActiveTab]
- if (type === 'cc') {
- const ccPanelName = tnMapping[countryActiveTab]
+ const rowMapper = (entry: CountryEntry) => {
+ const { name: entryName, cc } = entry
- const rowMapper = (entry: CountryEntry) => {
- const { name: entryName, cc } = entry
+ if (cc) {
+ return <CCRow cc={cc} name={entryName} language={language} />
+ }
- if (cc) {
- return <CCRow cc={cc} name={entryName} language={language} />
+ return <CCRow cc={entryName} language={language} />
}
- return <CCRow cc={entryName} language={language} />
+ return (
+ <Panel
+ projectPassword={projectPassword}
+ key={countryActiveTab}
+ icon={panelIcon}
+ id={countryActiveTab}
+ onFilter={filterHandler}
+ name={<CountryDropdown onSelect={setCountryActiveTab} title={ccPanelName} />}
+ data={panelsDataPerf.data[countryActiveTab]}
+ customTabs={customTabs}
+ rowMapper={rowMapper}
+ // @ts-expect-error
+ valueMapper={(value) => getStringFromTime(getTimeFromSeconds(value), true)}
+ />
+ )
}
- return (
- <Panel
- projectPassword={projectPassword}
- key={countryActiveTab}
- icon={panelIcon}
- id={countryActiveTab}
- onFilter={filterHandler}
- name={<CountryDropdown onSelect={setCountryActiveTab} title={ccPanelName} />}
- data={panelsDataPerf.data[countryActiveTab]}
- customTabs={customTabs}
- rowMapper={rowMapper}
- // @ts-expect-error
- valueMapper={(value) => getStringFromTime(getTimeFromSeconds(value), true)}
- />
- )
- }
-
- if (type === 'dv') {
- return (
- <Panel
- projectPassword={projectPassword}
- key={type}
- icon={panelIcon}
- id={type}
- onFilter={filterHandler}
- name={panelName}
- data={panelsDataPerf.data[type]}
- customTabs={customTabs}
- rowMapper={(entry: { name: keyof typeof deviceIconMapping }) => {
- const { name: entryName } = entry
+ if (type === 'dv') {
+ return (
+ <Panel
+ projectPassword={projectPassword}
+ key={type}
+ icon={panelIcon}
+ id={type}
+ onFilter={filterHandler}
+ name={panelName}
+ data={panelsDataPerf.data[type]}
+ customTabs={customTabs}
+ rowMapper={(entry: { name: keyof typeof deviceIconMapping }) => {
+ const { name: entryName } = entry
+
+ const icon = deviceIconMapping[entryName]
+
+ if (!icon) {
+ return entryName
+ }
- const icon = deviceIconMapping[entryName]
+ return (
+ <>
+ {icon}
+ &nbsp;
+ {entryName}
+ </>
+ )
+ }}
+ // @ts-expect-error
+ valueMapper={(value) => getStringFromTime(getTimeFromSeconds(value), true)}
+ capitalize
+ />
+ )
+ }
- if (!icon) {
- return entryName
+ if (type === 'pg') {
+ return (
+ <Panel
+ projectPassword={projectPassword}
+ key={pageActiveTab}
+ icon={panelIcon}
+ id={pageActiveTab}
+ onFilter={filterHandler}
+ data={panelsDataPerf.data[pageActiveTab]}
+ customTabs={customTabs}
+ // @ts-expect-error
+ valueMapper={(value) => getStringFromTime(getTimeFromSeconds(value), true)}
+ rowMapper={({ name: entryName }) =>
+ entryName ||
+ (pageActiveTab === 'pg' ? t('project.redactedPage') : t('project.unknownHost'))
}
+ name={<PageDropdown onSelect={setPageActiveTab} title={tnMapping[pageActiveTab]} />}
+ />
+ )
+ }
+ if (type === 'br') {
+ const brPanelName = tnMapping[browserActiveTab]
+
+ const rowMapper = (entry: any) => {
+ const { name: entryName, br } = entry
+
+ const logoKey = browserActiveTab === 'br' ? entryName : br
+
+ // @ts-expect-error
+ const logoUrl = BROWSER_LOGO_MAP[logoKey]
+
+ if (!logoUrl) {
return (
<>
- {icon}
+ <GlobeAltIcon className='h-5 w-5' />
&nbsp;
{entryName}
</>
)
- }}
- // @ts-expect-error
- valueMapper={(value) => getStringFromTime(getTimeFromSeconds(value), true)}
- capitalize
- />
- )
- }
-
- if (type === 'pg') {
- return (
- <Panel
- projectPassword={projectPassword}
- key={pageActiveTab}
- icon={panelIcon}
- id={pageActiveTab}
- onFilter={filterHandler}
- data={panelsDataPerf.data[pageActiveTab]}
- customTabs={customTabs}
- // @ts-expect-error
- valueMapper={(value) => getStringFromTime(getTimeFromSeconds(value), true)}
- rowMapper={({ name: entryName }) =>
- entryName ||
- (pageActiveTab === 'pg' ? t('project.redactedPage') : t('project.unknownHost'))
}
- name={<PageDropdown onSelect={setPageActiveTab} title={tnMapping[pageActiveTab]} />}
- />
- )
- }
-
- if (type === 'br') {
- const brPanelName = tnMapping[browserActiveTab]
-
- const rowMapper = (entry: any) => {
- const { name: entryName, br } = entry
-
- const logoKey = browserActiveTab === 'br' ? entryName : br
-
- // @ts-expect-error
- const logoUrl = BROWSER_LOGO_MAP[logoKey]
- if (!logoUrl) {
return (
<>
- <GlobeAltIcon className='h-5 w-5' />
+ <img src={logoUrl} className='h-5 w-5' alt='' />
&nbsp;
{entryName}
</>
@@ -4544,59 +4559,51 @@ const ViewProject = () => {
}
return (
- <>
- <img src={logoUrl} className='h-5 w-5' alt='' />
- &nbsp;
- {entryName}
- </>
+ <Panel
+ key={browserActiveTab}
+ icon={panelIcon}
+ id={browserActiveTab}
+ onFilter={filterHandler}
+ name={<BrowserDropdown onSelect={setBrowserActiveTab} title={brPanelName} />}
+ data={panelsDataPerf.data[browserActiveTab]}
+ rowMapper={rowMapper}
+ />
)
}
return (
<Panel
- key={browserActiveTab}
+ key={type}
icon={panelIcon}
- id={browserActiveTab}
+ id={type}
onFilter={filterHandler}
- name={<BrowserDropdown onSelect={setBrowserActiveTab} title={brPanelName} />}
- data={panelsDataPerf.data[browserActiveTab]}
- rowMapper={rowMapper}
+ name={panelName}
+ data={panelsDataPerf.data[type]}
+ customTabs={customTabs}
+ // @ts-expect-error
+ valueMapper={(value) => getStringFromTime(getTimeFromSeconds(value), true)}
/>
)
- }
-
- return (
- <Panel
- key={type}
- icon={panelIcon}
- id={type}
- onFilter={filterHandler}
- name={panelName}
- data={panelsDataPerf.data[type]}
- customTabs={customTabs}
- // @ts-expect-error
- valueMapper={(value) => getStringFromTime(getTimeFromSeconds(value), true)}
- />
- )
- })}
+ })
+ : null}
</div>
</div>
- )}
- {activeTab === PROJECT_TABS.funnels && (
+ ) : null}
+ {activeTab === PROJECT_TABS.funnels ? (
<div className={cx('pt-4 md:pt-0', { hidden: !activeFunnel || analyticsLoading })}>
<div className='h-80'>
<div className='mt-5 h-80 md:mt-0' id='dataChart' />
</div>
- {dataLoading && (
+ {dataLoading ? (
<div className='static mt-4 !bg-transparent' id='loader'>
<div className='loader-head dark:!bg-slate-800'>
<div className='first dark:!bg-slate-600' />
<div className='second dark:!bg-slate-600' />
</div>
</div>
- )}
+ ) : null}
</div>
- )}
+ ) : null}
</div>
</div>
<ViewProjectHotkeys isOpened={isHotkeysHelpOpened} onClose={() => setIsHotkeysHelpOpened(false)} />
@@ -4655,7 +4662,7 @@ const ViewProject = () => {
pid={id}
tnMapping={tnMapping}
/>
- {!embedded && <Footer authenticated={authenticated} showDBIPMessage />}
+ {!embedded ? <Footer authenticated={authenticated} showDBIPMessage /> : null}
</>
</ViewProjectContext.Provider>
)}
diff --git a/web/app/pages/Project/View/components/AddAViewModal.tsx b/web/app/pages/Project/View/components/AddAViewModal.tsx
index 34f73bc2f..bb7cbae52 100644
--- a/web/app/pages/Project/View/components/AddAViewModal.tsx
+++ b/web/app/pages/Project/View/components/AddAViewModal.tsx
@@ -1,28 +1,30 @@
-import React, { useState, useEffect, useMemo, useCallback } from 'react'
-import { useTranslation } from 'react-i18next'
-import _isEmpty from 'lodash/isEmpty'
-import _reduce from 'lodash/reduce'
+import { XMarkIcon } from '@heroicons/react/24/outline'
import _filter from 'lodash/filter'
-import _map from 'lodash/map'
import _find from 'lodash/find'
+import _isEmpty from 'lodash/isEmpty'
+import _map from 'lodash/map'
+import _reduce from 'lodash/reduce'
import _size from 'lodash/size'
+import React, { useState, useEffect, useMemo, useCallback } from 'react'
+import { useTranslation } from 'react-i18next'
import { toast } from 'sonner'
+import { getFilters, createProjectView, updateProjectView } from '~/api'
+import { FILTERS_PANELS_ORDER } from '~/lib/constants'
+import Combobox from '~/ui/Combobox'
+import Input from '~/ui/Input'
import Modal from '~/ui/Modal'
import Select from '~/ui/Select'
-import Combobox from '~/ui/Combobox'
-import { FILTERS_PANELS_ORDER } from '~/lib/constants'
import countries from '~/utils/isoCountries'
-import { getFilters, createProjectView, updateProjectView } from '~/api'
-import { Filter } from './Filters'
-import Input from '~/ui/Input'
+
import {
Filter as FilterType,
ProjectView,
ProjectViewCustomEvent,
ProjectViewCustomEventMetaValueType,
} from '../interfaces/traffic'
-import { XMarkIcon } from '@heroicons/react/24/outline'
+
+import { Filter } from './Filters'
interface AddAViewModalProps {
projectPassword?: string
@@ -219,7 +221,7 @@ const AddAViewModal = ({
const getFiltersList = useCallback(
async (category: string) => {
- let result = await getFilters(pid, category, projectPassword)
+ const result = await getFilters(pid, category, projectPassword)
setSearchList(result)
},
@@ -387,7 +389,7 @@ const AddAViewModal = ({
_isEmpty(filterType) ? t('project.settings.reseted.selectFilters') : t(`project.mapping.${filterType}`)
}
/>
- {filterType && !_isEmpty(searchList) && (
+ {filterType && !_isEmpty(searchList) ? (
<>
<p className='mt-5 text-sm font-medium text-gray-700 dark:text-gray-200'>{t('project.filters')}</p>
<Combobox
@@ -403,7 +405,7 @@ const AddAViewModal = ({
placeholder={t('project.settings.reseted.filtersPlaceholder')}
/>
</>
- )}
+ ) : null}
<div className='mt-2'>
{_map(activeFilters, ({ filter, column, isExclusive }) => (
<Filter
@@ -469,14 +471,14 @@ const AddAViewModal = ({
/>
))}
</div>
- {customEvents.length < MAX_METRICS_IN_VIEW && (
+ {customEvents.length < MAX_METRICS_IN_VIEW ? (
<InlineButton
text={t('project.addAMetric')}
onClick={() => {
setCustomEvents((prev) => [...prev, { ...EMPTY_CUSTOM_EVENT, id: Math.random().toString() }])
}}
/>
- )}
+ ) : null}
</div>
}
submitType='regular'
diff --git a/web/app/pages/Project/View/components/BrowserDropdown.tsx b/web/app/pages/Project/View/components/BrowserDropdown.tsx
index 93d5dc18f..99d77df2e 100644
--- a/web/app/pages/Project/View/components/BrowserDropdown.tsx
+++ b/web/app/pages/Project/View/components/BrowserDropdown.tsx
@@ -1,8 +1,8 @@
-import { useState } from 'react'
+import { ChevronDownIcon, ChevronUpIcon, XMarkIcon } from '@heroicons/react/24/outline'
import _map from 'lodash/map'
+import { useState } from 'react'
import { useTranslation } from 'react-i18next'
import OutsideClickHandler from 'react-outside-click-handler'
-import { ChevronDownIcon, ChevronUpIcon, XMarkIcon } from '@heroicons/react/24/outline'
const OPTIONS = [
{
@@ -34,7 +34,7 @@ const BrowserDropdown = ({ onSelect, title }: BrowserDropdownProps) => {
<span className='cursor-pointer' onClick={() => setShow(!show)}>
{title} {show ? <ChevronUpIcon className='inline size-4' /> : <ChevronDownIcon className='inline size-4' />}
</span>
- {show && (
+ {show ? (
<div className='absolute top-12 left-5 z-10 mt-2 max-h-[200px] min-w-[250px] overflow-auto rounded-md border border-gray-200 bg-white text-gray-900 dark:border-slate-700/50 dark:bg-slate-900'>
<div className='flex w-full flex-col p-2'>
<p className='px-1 text-sm font-semibold text-gray-900 dark:text-gray-50'>{t('project.browserInfo')}</p>
@@ -53,7 +53,7 @@ const BrowserDropdown = ({ onSelect, title }: BrowserDropdownProps) => {
onClick={() => setShow(!show)}
/>
</div>
- )}
+ ) : null}
</OutsideClickHandler>
)
}
diff --git a/web/app/pages/Project/View/components/CCRow.tsx b/web/app/pages/Project/View/components/CCRow.tsx
index 0faba85f1..4f88ae54f 100644
--- a/web/app/pages/Project/View/components/CCRow.tsx
+++ b/web/app/pages/Project/View/components/CCRow.tsx
@@ -1,6 +1,7 @@
-import React, { memo } from 'react'
-import countries from '~/utils/isoCountries'
+import { memo } from 'react'
+
import Flag from '~/ui/Flag'
+import countries from '~/utils/isoCountries'
interface CCRowProps {
cc: string
diff --git a/web/app/pages/Project/View/components/CountryDropdown.tsx b/web/app/pages/Project/View/components/CountryDropdown.tsx
index dd24c8aaf..3bbd64abb 100644
--- a/web/app/pages/Project/View/components/CountryDropdown.tsx
+++ b/web/app/pages/Project/View/components/CountryDropdown.tsx
@@ -1,8 +1,8 @@
-import React, { useState } from 'react'
+import { ChevronDownIcon, ChevronUpIcon, XMarkIcon } from '@heroicons/react/24/outline'
import _map from 'lodash/map'
+import { useState } from 'react'
import { useTranslation } from 'react-i18next'
import OutsideClickHandler from 'react-outside-click-handler'
-import { ChevronDownIcon, ChevronUpIcon, XMarkIcon } from '@heroicons/react/24/outline'
interface CountryDropdownProps {
onSelect: any
@@ -38,7 +38,7 @@ const CountryDropdown = ({ onSelect, title }: CountryDropdownProps) => {
<span className='cursor-pointer' onClick={() => setShow(!show)}>
{title} {show ? <ChevronUpIcon className='inline h-4 w-4' /> : <ChevronDownIcon className='inline h-4 w-4' />}
</span>
- {show && (
+ {show ? (
<div className='absolute top-12 left-5 z-10 mt-2 max-h-[200px] min-w-[250px] overflow-auto rounded-md border border-gray-200 bg-white text-gray-900 dark:border-slate-700/50 dark:bg-slate-900'>
<div className='flex w-full flex-col p-2'>
<p className='px-1 text-sm font-semibold text-gray-900 dark:text-gray-50'>{t('project.geo')}</p>
@@ -57,7 +57,7 @@ const CountryDropdown = ({ onSelect, title }: CountryDropdownProps) => {
onClick={() => setShow(!show)}
/>
</div>
- )}
+ ) : null}
</OutsideClickHandler>
)
}
diff --git a/web/app/pages/Project/View/components/CustomEventsDropdown.tsx b/web/app/pages/Project/View/components/CustomEventsDropdown.tsx
index 069a784d4..564c606d8 100644
--- a/web/app/pages/Project/View/components/CustomEventsDropdown.tsx
+++ b/web/app/pages/Project/View/components/CustomEventsDropdown.tsx
@@ -1,8 +1,8 @@
-import React, { useState } from 'react'
+import { ChevronDownIcon, ChevronUpIcon, XMarkIcon } from '@heroicons/react/24/outline'
import _map from 'lodash/map'
+import { useState } from 'react'
import { useTranslation } from 'react-i18next'
import OutsideClickHandler from 'react-outside-click-handler'
-import { ChevronDownIcon, ChevronUpIcon, XMarkIcon } from '@heroicons/react/24/outline'
interface CustomEventsDropdownProps {
onSelect: any
@@ -34,7 +34,7 @@ const CustomEventsDropdown = ({ onSelect, title }: CustomEventsDropdownProps) =>
<span className='cursor-pointer' onClick={() => setShow(!show)}>
{title} {show ? <ChevronUpIcon className='inline h-4 w-4' /> : <ChevronDownIcon className='inline h-4 w-4' />}
</span>
- {show && (
+ {show ? (
<div className='absolute top-12 left-5 z-10 mt-2 max-h-[200px] min-w-[250px] overflow-auto rounded-md border border-gray-200 bg-white text-gray-900 dark:border-slate-700/50 dark:bg-slate-900'>
<div className='flex w-full flex-col p-2'>
<p className='px-1 text-sm font-semibold text-gray-900 dark:text-gray-50'>{t('project.metadata')}</p>
@@ -53,7 +53,7 @@ const CustomEventsDropdown = ({ onSelect, title }: CustomEventsDropdownProps) =>
onClick={() => setShow(!show)}
/>
</div>
- )}
+ ) : null}
</OutsideClickHandler>
)
}
diff --git a/web/app/pages/Project/View/components/CustomMetrics.tsx b/web/app/pages/Project/View/components/CustomMetrics.tsx
index 261081039..595ba84ee 100644
--- a/web/app/pages/Project/View/components/CustomMetrics.tsx
+++ b/web/app/pages/Project/View/components/CustomMetrics.tsx
@@ -1,7 +1,7 @@
import { ScaleIcon, XMarkIcon } from '@heroicons/react/24/outline'
-import React, { memo, useMemo } from 'react'
import _isEmpty from 'lodash/isEmpty'
import _map from 'lodash/map'
+import { memo, useMemo } from 'react'
import { useTranslation } from 'react-i18next'
import { ProjectViewCustomEvent } from '../interfaces/traffic'
diff --git a/web/app/pages/Project/View/components/ErrorChart.tsx b/web/app/pages/Project/View/components/ErrorChart.tsx
index ff5709a21..b99a6efa6 100644
--- a/web/app/pages/Project/View/components/ErrorChart.tsx
+++ b/web/app/pages/Project/View/components/ErrorChart.tsx
@@ -1,5 +1,6 @@
+import billboard from 'billboard.js'
import { useEffect } from 'react'
-import bb from 'billboard.js'
+
import { getSettingsError } from '../ViewProject.helpers'
interface ErrorChartProps {
@@ -16,7 +17,6 @@ interface ErrorChartProps {
export const ErrorChart = ({ chart, timeBucket, timeFormat, rotateXAxis, chartType, dataNames }: ErrorChartProps) => {
useEffect(() => {
- // @ts-ignore
const bbSettings: bb.ChartOptions = getSettingsError(
chart,
timeBucket as string,
@@ -25,7 +25,7 @@ export const ErrorChart = ({ chart, timeBucket, timeFormat, rotateXAxis, chartTy
chartType,
)
- const generate = bb.generate(bbSettings)
+ const generate = billboard.generate(bbSettings)
generate.data.names(dataNames)
}, [chart, timeBucket, timeFormat, rotateXAxis, chartType, dataNames])
diff --git a/web/app/pages/Project/View/components/ErrorDetails.tsx b/web/app/pages/Project/View/components/ErrorDetails.tsx
index 5e69f4d94..475919cb8 100644
--- a/web/app/pages/Project/View/components/ErrorDetails.tsx
+++ b/web/app/pages/Project/View/components/ErrorDetails.tsx
@@ -1,9 +1,12 @@
-import React, { useMemo } from 'react'
+import { useMemo } from 'react'
import { useTranslation } from 'react-i18next'
+
+import Tooltip from '~/ui/Tooltip'
+import { getRelativeDateIfPossible } from '~/utils/date'
+
import { SwetrixErrorDetails } from '../interfaces/error'
+
import { MetricCard } from './MetricCards'
-import { getRelativeDateIfPossible } from '~/utils/date'
-import Tooltip from '~/ui/Tooltip'
interface ErrorDetailsProps {
details: SwetrixErrorDetails
diff --git a/web/app/pages/Project/View/components/Errors.tsx b/web/app/pages/Project/View/components/Errors.tsx
index bb336d239..54e1ebd4a 100644
--- a/web/app/pages/Project/View/components/Errors.tsx
+++ b/web/app/pages/Project/View/components/Errors.tsx
@@ -1,14 +1,16 @@
+import { ChevronRightIcon } from '@heroicons/react/24/outline'
+import cx from 'clsx'
+import _map from 'lodash/map'
import React, { useMemo } from 'react'
+import { useTranslation } from 'react-i18next'
import { Link } from 'react-router'
import { ClientOnly } from 'remix-utils/client-only'
-import { useTranslation } from 'react-i18next'
-import _map from 'lodash/map'
-import cx from 'clsx'
-import { ChevronRightIcon } from '@heroicons/react/24/outline'
+
+import { Badge } from '~/ui/Badge'
import Loader from '~/ui/Loader'
-import { SwetrixError } from '../interfaces/error'
import { getRelativeDateIfPossible } from '~/utils/date'
-import { Badge } from '~/ui/Badge'
+
+import { SwetrixError } from '../interfaces/error'
interface ErrorsProps {
errors: SwetrixError[]
diff --git a/web/app/pages/Project/View/components/Filters.tsx b/web/app/pages/Project/View/components/Filters.tsx
index ecc237390..9ef6daca0 100644
--- a/web/app/pages/Project/View/components/Filters.tsx
+++ b/web/app/pages/Project/View/components/Filters.tsx
@@ -1,22 +1,23 @@
import { XMarkIcon } from '@heroicons/react/24/outline'
-import React, { memo } from 'react'
import cx from 'clsx'
-import _truncate from 'lodash/truncate'
import _isEmpty from 'lodash/isEmpty'
import _map from 'lodash/map'
-import _startsWith from 'lodash/startsWith'
import _replace from 'lodash/replace'
+import _startsWith from 'lodash/startsWith'
+import _truncate from 'lodash/truncate'
+import { FilterIcon } from 'lucide-react'
+import { memo } from 'react'
import { useTranslation } from 'react-i18next'
-import countries from '~/utils/isoCountries'
import { getLocaleDisplayName } from '~/utils/generic'
+import countries from '~/utils/isoCountries'
+
import { useViewProjectContext } from '../ViewProject'
-import { FilterIcon } from 'lucide-react'
interface FilterProps {
column: string
filter: string
- isExclusive: Boolean
+ isExclusive: boolean
onRemoveFilter: (column: string, filter: string) => void
onChangeExclusive: (column: string, filter: string, isExclusive: boolean) => void
tnMapping: Record<string, string>
@@ -98,7 +99,7 @@ export const Filter = ({
&nbsp;&quot;
{truncatedFilter}
&quot;
- {removable && (
+ {removable ? (
<button
onClick={() => onRemoveFilter(column, filter)}
type='button'
@@ -114,7 +115,7 @@ export const Filter = ({
<path strokeLinecap='round' strokeWidth='1.5' d='M1 1l6 6m0-6L1 7' />
</svg>
</button>
- )}
+ ) : null}
</span>
)
}
diff --git a/web/app/pages/Project/View/components/FunnelsList.tsx b/web/app/pages/Project/View/components/FunnelsList.tsx
index 0e19cf666..5a3cac8f2 100644
--- a/web/app/pages/Project/View/components/FunnelsList.tsx
+++ b/web/app/pages/Project/View/components/FunnelsList.tsx
@@ -1,10 +1,10 @@
-import React from 'react'
-import _map from 'lodash/map'
+import { AdjustmentsVerticalIcon, PlusCircleIcon } from '@heroicons/react/24/outline'
import cx from 'clsx'
+import _map from 'lodash/map'
+import { Trash2Icon } from 'lucide-react'
import { useTranslation } from 'react-i18next'
-import { AdjustmentsVerticalIcon, PlusCircleIcon } from '@heroicons/react/24/outline'
+
import { Funnel } from '~/lib/models/Project'
-import { Trash2Icon } from 'lucide-react'
interface FunnelsListProps {
funnels?: any[]
@@ -58,7 +58,7 @@ const FunnelCard = ({
>
<AdjustmentsVerticalIcon className='h-6 w-6 text-gray-800 hover:text-gray-900 dark:text-slate-400 dark:hover:text-slate-500' />
</button>
- {allowedToManage && (
+ {allowedToManage ? (
<Trash2Icon
onClick={(e) => {
e.stopPropagation()
@@ -74,7 +74,7 @@ const FunnelCard = ({
)}
strokeWidth={1.5}
/>
- )}
+ ) : null}
</div>
</div>
</div>
@@ -125,7 +125,7 @@ const FunnelsList = ({
allowedToManage={allowedToManage}
/>
))}
- {authenticated && allowedToManage && <AddFunnel openFunnelSettings={openFunnelSettings} />}
+ {authenticated && allowedToManage ? <AddFunnel openFunnelSettings={openFunnelSettings} /> : null}
</ul>
)
diff --git a/web/app/pages/Project/View/components/InteractiveMap.tsx b/web/app/pages/Project/View/components/InteractiveMap.tsx
index 7dc8d8516..75051e551 100644
--- a/web/app/pages/Project/View/components/InteractiveMap.tsx
+++ b/web/app/pages/Project/View/components/InteractiveMap.tsx
@@ -1,15 +1,16 @@
-import React, { memo, useState, useMemo } from 'react'
import cx from 'clsx'
import _map from 'lodash/map'
import _reduce from 'lodash/reduce'
+import React, { memo, useState, useMemo } from 'react'
import { useTranslation } from 'react-i18next'
-import countries from '~/utils/isoCountries'
-import { PROJECT_TABS } from '~/lib/constants'
-import { getTimeFromSeconds, getStringFromTime, nFormatter } from '~/utils/generic'
+import { useSearchParams } from 'react-router'
+import { PROJECT_TABS } from '~/lib/constants'
import { Entry } from '~/lib/models/Entry'
import countriesList from '~/utils/countries'
-import { useSearchParams } from 'react-router'
+import { getTimeFromSeconds, getStringFromTime, nFormatter } from '~/utils/generic'
+import countries from '~/utils/isoCountries'
+
import { useViewProjectContext } from '../ViewProject'
interface InteractiveMapProps {
@@ -28,9 +29,7 @@ interface DataHover {
data: number
}
-interface CountryMap {
- [key: string]: number
-}
+type CountryMap = Record<string, number>
const InteractiveMap = ({ data, onClickCountry, total }: InteractiveMapProps) => {
const { dataLoading } = useViewProjectContext()
@@ -114,7 +113,7 @@ const InteractiveMap = ({ data, onClickCountry, total }: InteractiveMapProps) =>
</g>
</svg>
<div>
- {hoverShow && cursorPosition && (
+ {hoverShow && cursorPosition ? (
<div
className='absolute z-30 rounded-md border bg-gray-100 p-1 text-xs dark:bg-slate-900 dark:text-gray-200'
style={{
@@ -136,7 +135,7 @@ const InteractiveMap = ({ data, onClickCountry, total }: InteractiveMapProps) =>
: getStringFromTime(getTimeFromSeconds(dataHover.data), true)}
</strong>
</div>
- )}
+ ) : null}
</div>
</div>
)
diff --git a/web/app/pages/Project/View/components/LiveVisitorsDropdown.tsx b/web/app/pages/Project/View/components/LiveVisitorsDropdown.tsx
index c402c3519..cfdaf3f98 100644
--- a/web/app/pages/Project/View/components/LiveVisitorsDropdown.tsx
+++ b/web/app/pages/Project/View/components/LiveVisitorsDropdown.tsx
@@ -1,15 +1,16 @@
-import React, { useState, useEffect } from 'react'
+import { ChevronDownIcon, ChevronUpIcon, XMarkIcon } from '@heroicons/react/24/outline'
import _map from 'lodash/map'
+import React, { useState, useEffect } from 'react'
import { useTranslation } from 'react-i18next'
import OutsideClickHandler from 'react-outside-click-handler'
-import { ChevronDownIcon, ChevronUpIcon, XMarkIcon } from '@heroicons/react/24/outline'
+import { Link } from 'react-router'
import { getLiveVisitorsInfo, GetLiveVisitorsInfo } from '~/api'
-import PulsatingCircle from '~/ui/icons/PulsatingCircle'
+import { PROJECT_TABS } from '~/lib/constants'
import Flag from '~/ui/Flag'
+import PulsatingCircle from '~/ui/icons/PulsatingCircle'
+
import { useViewProjectContext } from '../ViewProject'
-import { Link } from 'react-router'
-import { PROJECT_TABS } from '~/lib/constants'
interface LiveVisitorsDropdownProps {
live: number | string
diff --git a/web/app/pages/Project/View/components/LockedDashboard.tsx b/web/app/pages/Project/View/components/LockedDashboard.tsx
index 9618ef861..890037b94 100644
--- a/web/app/pages/Project/View/components/LockedDashboard.tsx
+++ b/web/app/pages/Project/View/components/LockedDashboard.tsx
@@ -1,9 +1,10 @@
-import React, { useMemo } from 'react'
import { LockClosedIcon } from '@heroicons/react/24/outline'
+import { useMemo } from 'react'
+import { useTranslation } from 'react-i18next'
import { Link } from 'react-router'
-import { User, DashboardBlockReason } from '~/lib/models/User'
+
import { ProjectForShared } from '~/lib/models/SharedProject'
-import { useTranslation } from 'react-i18next'
+import { User, DashboardBlockReason } from '~/lib/models/User'
import routes from '~/utils/routes'
interface LockedDashboardProps {
@@ -49,16 +50,16 @@ const LockedDashboard = ({ user, project }: LockedDashboardProps) => {
</h1>
<p className='mt-1 max-w-prose text-base whitespace-pre-line text-gray-700 dark:text-gray-300'>
{message}
- {project.role === 'owner' && (
+ {project.role === 'owner' ? (
<>
<br />
<br />
{t('project.locked.resolve')}
</>
- )}
+ ) : null}
</p>
</div>
- {project.role === 'owner' && (
+ {project.role === 'owner' ? (
<div className='mt-8 flex space-x-3 sm:border-l sm:border-transparent sm:pl-6'>
<Link
to={routes.billing}
@@ -73,7 +74,7 @@ const LockedDashboard = ({ user, project }: LockedDashboardProps) => {
{t('notFoundPage.support')}
</Link>
</div>
- )}
+ ) : null}
</div>
</main>
</div>
diff --git a/web/app/pages/Project/View/components/MetricCards.tsx b/web/app/pages/Project/View/components/MetricCards.tsx
index 0ed40ee9c..734eacb70 100644
--- a/web/app/pages/Project/View/components/MetricCards.tsx
+++ b/web/app/pages/Project/View/components/MetricCards.tsx
@@ -1,15 +1,16 @@
-import React, { memo, useState } from 'react'
-import { useTranslation } from 'react-i18next'
+import { ChevronDownIcon, ChevronUpIcon, XMarkIcon } from '@heroicons/react/24/outline'
import cx from 'clsx'
-import OutsideClickHandler from 'react-outside-click-handler'
-import _round from 'lodash/round'
import _isEmpty from 'lodash/isEmpty'
import _isNumber from 'lodash/isNumber'
import _map from 'lodash/map'
-import { nFormatter, getStringFromTime, getTimeFromSeconds } from '~/utils/generic'
+import _round from 'lodash/round'
+import React, { memo, useState } from 'react'
+import { useTranslation } from 'react-i18next'
+import OutsideClickHandler from 'react-outside-click-handler'
+
import { OverallObject, OverallPerformanceObject } from '~/lib/models/Project'
-import { ChevronDownIcon, ChevronUpIcon, XMarkIcon } from '@heroicons/react/24/outline'
import { Badge } from '~/ui/Badge'
+import { nFormatter, getStringFromTime, getTimeFromSeconds } from '~/utils/generic'
interface MetricCardProps {
label: string
@@ -128,7 +129,7 @@ export const MetricCardSelect = ({ values, valueMapper, selectLabel, classes }:
{values[selected].label}{' '}
{show ? <ChevronUpIcon className='inline h-4 w-4' /> : <ChevronDownIcon className='inline h-4 w-4' />}
</span>
- {show && (
+ {show ? (
<div className='absolute top-4 z-10 mt-2 max-h-[200px] min-w-[250px] overflow-auto rounded-md border border-black/10 bg-white text-gray-900 dark:border-slate-700/50 dark:bg-slate-900'>
<div className='flex w-full flex-col p-2'>
<p className='px-1 text-sm font-semibold text-gray-900 dark:text-gray-50'>{selectLabel}</p>
@@ -147,7 +148,7 @@ export const MetricCardSelect = ({ values, valueMapper, selectLabel, classes }:
onClick={() => setShow(!show)}
/>
</div>
- )}
+ ) : null}
</OutsideClickHandler>
</div>
</div>
@@ -242,11 +243,11 @@ export const PerformanceMetricCards = memo(
let networkChange = overall.networkChange
if (!_isEmpty(overallCompare) && activePeriodCompare !== 'previous') {
- // @ts-ignore
+ // @ts-expect-error
frontendChange = overall.current?.frontend - overallCompare?.current?.frontend
- // @ts-ignore
+ // @ts-expect-error
backendChange = overall.current?.backend - overallCompare?.current?.backend
- // @ts-ignore
+ // @ts-expect-error
networkChange = overall.current?.network - overallCompare?.current?.network
}
diff --git a/web/app/pages/Project/View/components/NoEvents.tsx b/web/app/pages/Project/View/components/NoEvents.tsx
index 740ec016c..22a2c863d 100644
--- a/web/app/pages/Project/View/components/NoEvents.tsx
+++ b/web/app/pages/Project/View/components/NoEvents.tsx
@@ -1,11 +1,12 @@
-import React, { memo } from 'react'
-import { useTranslation } from 'react-i18next'
import _isEmpty from 'lodash/isEmpty'
+import { memo } from 'react'
+import { useTranslation } from 'react-i18next'
import { Filter } from '../interfaces/traffic'
-import Filters from './Filters'
import { typeNameMapping } from '../ViewProject.helpers'
+import Filters from './Filters'
+
interface NoEventsProps {
filters: Filter[]
filterHandler: (column: string, filter: any) => void
diff --git a/web/app/pages/Project/View/components/OSDropdown.tsx b/web/app/pages/Project/View/components/OSDropdown.tsx
index 166d70457..925ba32cc 100644
--- a/web/app/pages/Project/View/components/OSDropdown.tsx
+++ b/web/app/pages/Project/View/components/OSDropdown.tsx
@@ -1,8 +1,8 @@
-import { useState } from 'react'
+import { ChevronDownIcon, ChevronUpIcon, XMarkIcon } from '@heroicons/react/24/outline'
import _map from 'lodash/map'
+import { useState } from 'react'
import { useTranslation } from 'react-i18next'
import OutsideClickHandler from 'react-outside-click-handler'
-import { ChevronDownIcon, ChevronUpIcon, XMarkIcon } from '@heroicons/react/24/outline'
const OPTIONS = [
{
@@ -34,7 +34,7 @@ const OSDropdown = ({ onSelect, title }: OSDropdownProps) => {
<span className='cursor-pointer' onClick={() => setShow(!show)}>
{title} {show ? <ChevronUpIcon className='inline size-4' /> : <ChevronDownIcon className='inline size-4' />}
</span>
- {show && (
+ {show ? (
<div className='absolute top-4 left-5 z-10 mt-2 max-h-[200px] min-w-[250px] overflow-auto rounded-md border border-black/10 bg-white text-gray-900 dark:border-slate-700/50 dark:bg-slate-900'>
<div className='flex w-full flex-col p-2'>
<p className='px-1 text-sm font-semibold text-gray-900 dark:text-gray-50'>{t('project.osInfo')}</p>
@@ -53,7 +53,7 @@ const OSDropdown = ({ onSelect, title }: OSDropdownProps) => {
onClick={() => setShow(!show)}
/>
</div>
- )}
+ ) : null}
</OutsideClickHandler>
)
}
diff --git a/web/app/pages/Project/View/components/PageDropdown.tsx b/web/app/pages/Project/View/components/PageDropdown.tsx
index 04999409f..ea580a91b 100644
--- a/web/app/pages/Project/View/components/PageDropdown.tsx
+++ b/web/app/pages/Project/View/components/PageDropdown.tsx
@@ -1,8 +1,8 @@
-import { useState } from 'react'
+import { ChevronDownIcon, ChevronUpIcon, XMarkIcon } from '@heroicons/react/24/outline'
import _map from 'lodash/map'
+import { useState } from 'react'
import { useTranslation } from 'react-i18next'
import OutsideClickHandler from 'react-outside-click-handler'
-import { ChevronDownIcon, ChevronUpIcon, XMarkIcon } from '@heroicons/react/24/outline'
const OPTIONS = [
{
@@ -34,7 +34,7 @@ const PageDropdown = ({ onSelect, title }: PageDropdownProps) => {
<span className='cursor-pointer' onClick={() => setShow(!show)}>
{title} {show ? <ChevronUpIcon className='inline size-4' /> : <ChevronDownIcon className='inline size-4' />}
</span>
- {show && (
+ {show ? (
<div className='absolute top-4 left-5 z-10 mt-2 max-h-[200px] min-w-[250px] overflow-auto rounded-md border border-black/10 bg-white text-gray-900 dark:border-slate-700/50 dark:bg-slate-900'>
<div className='flex w-full flex-col p-2'>
<p className='px-1 text-sm font-semibold text-gray-900 dark:text-gray-50'>{t('project.urlInfo')}</p>
@@ -53,7 +53,7 @@ const PageDropdown = ({ onSelect, title }: PageDropdownProps) => {
onClick={() => setShow(!show)}
/>
</div>
- )}
+ ) : null}
</OutsideClickHandler>
)
}
diff --git a/web/app/pages/Project/View/components/Pageflow.tsx b/web/app/pages/Project/View/components/Pageflow.tsx
index a0c10f5a8..8f2d2ba04 100644
--- a/web/app/pages/Project/View/components/Pageflow.tsx
+++ b/web/app/pages/Project/View/components/Pageflow.tsx
@@ -1,9 +1,9 @@
-import React from 'react'
import { CursorArrowRaysIcon } from '@heroicons/react/24/outline'
import _map from 'lodash/map'
import _toUpper from 'lodash/toUpper'
-import { Trans, useTranslation } from 'react-i18next'
import { FileTextIcon } from 'lucide-react'
+import React from 'react'
+import { Trans, useTranslation } from 'react-i18next'
interface Metadata {
key: string
@@ -76,10 +76,12 @@ export const Pageflow = ({ pages, timeFormat }: PageflowProps) => {
<div className='relative flex space-x-3'>
<div>
<span className='flex h-8 w-8 items-center justify-center rounded-full bg-slate-400 dark:bg-slate-800'>
- {type === 'pageview' && (
+ {type === 'pageview' ? (
<FileTextIcon className='h-5 w-5 text-white' aria-hidden='true' strokeWidth={1.5} />
- )}
- {type === 'event' && <CursorArrowRaysIcon className='h-5 w-5 text-white' aria-hidden='true' />}
+ ) : null}
+ {type === 'event' ? (
+ <CursorArrowRaysIcon className='h-5 w-5 text-white' aria-hidden='true' />
+ ) : null}
</span>
</div>
<div className='flex min-w-0 flex-1 justify-between space-x-4 pt-1.5'>
diff --git a/web/app/pages/Project/View/components/RefRow.tsx b/web/app/pages/Project/View/components/RefRow.tsx
index 43d8d7245..7c7132126 100644
--- a/web/app/pages/Project/View/components/RefRow.tsx
+++ b/web/app/pages/Project/View/components/RefRow.tsx
@@ -14,7 +14,7 @@ const RefRow = ({ rowName }: { rowName: string }) => {
return (
<div className='scrollbar-thin hover-always-overflow flex items-center'>
- {isUrl && (
+ {isUrl ? (
<img
className='float-left mr-1.5 size-5'
src={`https://icons.duckduckgo.com/ip3/${url?.hostname}.ico`}
@@ -22,7 +22,7 @@ const RefRow = ({ rowName }: { rowName: string }) => {
alt=''
aria-hidden='true'
/>
- )}
+ ) : null}
{isUrl ? (
<a
className={linkClassName}
diff --git a/web/app/pages/Project/View/components/SearchFilters.tsx b/web/app/pages/Project/View/components/SearchFilters.tsx
index 7746758bc..5a2709590 100644
--- a/web/app/pages/Project/View/components/SearchFilters.tsx
+++ b/web/app/pages/Project/View/components/SearchFilters.tsx
@@ -1,20 +1,22 @@
-import React, { useState, useEffect, useCallback } from 'react'
-import { useTranslation } from 'react-i18next'
-import _isEmpty from 'lodash/isEmpty'
import _filter from 'lodash/filter'
-import _map from 'lodash/map'
import _find from 'lodash/find'
+import _isEmpty from 'lodash/isEmpty'
+import _map from 'lodash/map'
+import { useState, useEffect, useCallback } from 'react'
+import { useTranslation } from 'react-i18next'
-import Modal from '~/ui/Modal'
+import { getFilters, getErrorsFilters } from '~/api'
+import { FILTERS_PANELS_ORDER, ERRORS_FILTERS_PANELS_ORDER } from '~/lib/constants'
import Checkbox from '~/ui/Checkbox'
-import Select from '~/ui/Select'
import Combobox from '~/ui/Combobox'
-import { FILTERS_PANELS_ORDER, ERRORS_FILTERS_PANELS_ORDER } from '~/lib/constants'
+import Modal from '~/ui/Modal'
+import Select from '~/ui/Select'
import countries from '~/utils/isoCountries'
-import { getFilters, getErrorsFilters } from '~/api'
-import { Filter } from './Filters'
+
import { Filter as FilterType } from '../interfaces/traffic'
+import { Filter } from './Filters'
+
interface SearchFiltersProps {
projectPassword?: string
setProjectFilter: (filters: FilterType[], override: boolean) => void
@@ -120,7 +122,7 @@ const SearchFilters = ({
_isEmpty(filterType) ? t('project.settings.reseted.selectFilters') : t(`project.mapping.${filterType}`)
}
/>
- {!_isEmpty(filters) && (
+ {!_isEmpty(filters) ? (
<>
<p className='mt-5 text-sm font-medium text-gray-700 dark:text-gray-200'>{t('project.currentFilters')}</p>
{_map(filters, ({ column, filter, isExclusive }) => (
@@ -137,8 +139,8 @@ const SearchFilters = ({
/>
))}
</>
- )}
- {filterType && !_isEmpty(searchList) && (
+ ) : null}
+ {filterType && !_isEmpty(searchList) ? (
<>
<p className='mt-5 text-sm font-medium text-gray-700 dark:text-gray-200'>{t('project.filters')}</p>
<Combobox
@@ -154,7 +156,7 @@ const SearchFilters = ({
placeholder={t('project.settings.reseted.filtersPlaceholder')}
/>
</>
- )}
+ ) : null}
<div className='mt-2'>
{_map(activeFilters, ({ filter, column, isExclusive }) => (
<Filter
@@ -191,7 +193,7 @@ const SearchFilters = ({
/>
))}
</div>
- {!_isEmpty(activeFilters) && (
+ {!_isEmpty(activeFilters) ? (
<Checkbox
checked={Boolean(override)}
onChange={setOverride}
@@ -199,7 +201,7 @@ const SearchFilters = ({
className='mt-4'
label={t('project.overrideCurrentlyFilters')}
/>
- )}
+ ) : null}
</div>
}
submitType='regular'
diff --git a/web/app/pages/Project/View/components/SessionChart.tsx b/web/app/pages/Project/View/components/SessionChart.tsx
index 2a2c6725f..e3adc62c4 100644
--- a/web/app/pages/Project/View/components/SessionChart.tsx
+++ b/web/app/pages/Project/View/components/SessionChart.tsx
@@ -1,5 +1,6 @@
-import React, { useEffect } from 'react'
-import bb from 'billboard.js'
+import billboard from 'billboard.js'
+import { useEffect } from 'react'
+
import { getSettingsSession } from '../ViewProject.helpers'
interface SessionChartProps {
@@ -31,7 +32,7 @@ export const SessionChart = ({
chartType,
)
- const generate = bb.generate(bbSettings)
+ const generate = billboard.generate(bbSettings)
generate.data.names(dataNames)
}, [chart, timeBucket, timeFormat, rotateXAxis, chartType, dataNames])
diff --git a/web/app/pages/Project/View/components/SessionDetails.tsx b/web/app/pages/Project/View/components/SessionDetails.tsx
index 661cdd725..123445f69 100644
--- a/web/app/pages/Project/View/components/SessionDetails.tsx
+++ b/web/app/pages/Project/View/components/SessionDetails.tsx
@@ -1,12 +1,14 @@
-import React from 'react'
-import { useTranslation } from 'react-i18next'
import _capitalize from 'lodash/capitalize'
import _size from 'lodash/size'
import _truncate from 'lodash/truncate'
+import { useTranslation } from 'react-i18next'
+
import { getLocaleDisplayName, getStringFromTime, getTimeFromSeconds } from '~/utils/generic'
+
import { SessionDetails as Details } from '../interfaces/session'
-import { MetricCard, MetricCardSelect } from './MetricCards'
+
import CCRow from './CCRow'
+import { MetricCard, MetricCardSelect } from './MetricCards'
interface SessionDetailsProps {
details: Details
diff --git a/web/app/pages/Project/View/components/Sessions.tsx b/web/app/pages/Project/View/components/Sessions.tsx
index b0a036b47..682b9c336 100644
--- a/web/app/pages/Project/View/components/Sessions.tsx
+++ b/web/app/pages/Project/View/components/Sessions.tsx
@@ -1,11 +1,14 @@
+import { ChevronRightIcon } from '@heroicons/react/24/outline'
+import _map from 'lodash/map'
import React from 'react'
+import { useTranslation } from 'react-i18next'
import { Link } from 'react-router'
import { ClientOnly } from 'remix-utils/client-only'
-import { useTranslation } from 'react-i18next'
-import _map from 'lodash/map'
-import { ChevronRightIcon } from '@heroicons/react/24/outline'
+
import Loader from '~/ui/Loader'
+
import { Session as SessionType } from '../interfaces/session'
+
import CCRow from './CCRow'
interface SessionsProps {
diff --git a/web/app/pages/Project/View/components/TBPeriodSelector.tsx b/web/app/pages/Project/View/components/TBPeriodSelector.tsx
index 7246fdb61..0e298fbfc 100644
--- a/web/app/pages/Project/View/components/TBPeriodSelector.tsx
+++ b/web/app/pages/Project/View/components/TBPeriodSelector.tsx
@@ -1,13 +1,15 @@
-import React, { memo, Fragment, useMemo } from 'react'
import { Popover, PopoverButton, PopoverPanel, Transition } from '@headlessui/react'
import { ChevronDownIcon } from '@heroicons/react/20/solid'
-import { useTranslation } from 'react-i18next'
-import _map from 'lodash/map'
-import _includes from 'lodash/includes'
import cx from 'clsx'
+import _includes from 'lodash/includes'
+import _map from 'lodash/map'
+import { CalendarIcon } from 'lucide-react'
+import React, { memo, Fragment, useMemo } from 'react'
+import { useTranslation } from 'react-i18next'
+
import { ALL_PERIODS } from '~/lib/constants'
+
import { useViewProjectContext } from '../ViewProject'
-import { CalendarIcon } from 'lucide-react'
interface TBPeriodSelectorProps {
title: string | number | React.ReactNode
diff --git a/web/app/pages/Project/View/components/UTMDropdown.tsx b/web/app/pages/Project/View/components/UTMDropdown.tsx
index 1c56a4909..040e4364e 100644
--- a/web/app/pages/Project/View/components/UTMDropdown.tsx
+++ b/web/app/pages/Project/View/components/UTMDropdown.tsx
@@ -1,8 +1,8 @@
-import React, { useState } from 'react'
+import { ChevronDownIcon, ChevronUpIcon, XMarkIcon } from '@heroicons/react/24/outline'
import _map from 'lodash/map'
+import { useState } from 'react'
import { useTranslation } from 'react-i18next'
import OutsideClickHandler from 'react-outside-click-handler'
-import { ChevronDownIcon, ChevronUpIcon, XMarkIcon } from '@heroicons/react/24/outline'
interface UTMDropdownProps {
onSelect: any
@@ -46,7 +46,7 @@ const UTMDropdown = ({ onSelect, title }: UTMDropdownProps) => {
<span className='cursor-pointer' onClick={() => setShow(!show)}>
{title} {show ? <ChevronUpIcon className='inline h-4 w-4' /> : <ChevronDownIcon className='inline h-4 w-4' />}
</span>
- {show && (
+ {show ? (
<div className='absolute top-4 left-5 z-10 mt-2 max-h-[200px] min-w-[250px] overflow-auto rounded-md border border-black/10 bg-white text-gray-900 dark:border-slate-700/50 dark:bg-slate-900'>
<div className='flex w-full flex-col p-2'>
<p className='px-1 text-sm font-semibold text-gray-900 dark:text-gray-50'>{t('project.campaigns')}</p>
@@ -65,7 +65,7 @@ const UTMDropdown = ({ onSelect, title }: UTMDropdownProps) => {
onClick={() => setShow(!show)}
/>
</div>
- )}
+ ) : null}
</OutsideClickHandler>
)
}
diff --git a/web/app/pages/Project/View/components/UserFlow.tsx b/web/app/pages/Project/View/components/UserFlow.tsx
index 862a126e1..e6367a02b 100644
--- a/web/app/pages/Project/View/components/UserFlow.tsx
+++ b/web/app/pages/Project/View/components/UserFlow.tsx
@@ -1,11 +1,13 @@
-import { useEffect, useState, memo, useMemo } from 'react'
-import { toast } from 'sonner'
import { ResponsiveSankey } from '@nivo/sankey'
-import { UserFlowType } from '~/lib/models/UserFlow'
import _isEmpty from 'lodash/isEmpty'
+import { useEffect, useState, memo, useMemo } from 'react'
+import { useTranslation } from 'react-i18next'
+import { toast } from 'sonner'
+
import { getUserFlow } from '~/api'
+import { UserFlowType } from '~/lib/models/UserFlow'
import Loader from '~/ui/Loader'
-import { useTranslation } from 'react-i18next'
+
import { useViewProjectContext } from '../ViewProject'
import { getFormatDate } from '../ViewProject.helpers'
diff --git a/web/app/pages/Project/View/components/WaitingForAnError.tsx b/web/app/pages/Project/View/components/WaitingForAnError.tsx
index b25de0d7f..08b43b5bd 100644
--- a/web/app/pages/Project/View/components/WaitingForAnError.tsx
+++ b/web/app/pages/Project/View/components/WaitingForAnError.tsx
@@ -1,8 +1,9 @@
-import { Link } from 'react-router'
+import { BugIcon } from 'lucide-react'
import { useTranslation, Trans } from 'react-i18next'
-import routes from '~/utils/routes'
+import { Link } from 'react-router'
+
import { ERROR_TRACKING_DOCS_URL } from '~/lib/constants'
-import { BugIcon } from 'lucide-react'
+import routes from '~/utils/routes'
const TROUBLESHOOTING_URL = 'https://docs.swetrix.com/troubleshooting'
diff --git a/web/app/pages/Project/View/components/WaitingForAnEvent.tsx b/web/app/pages/Project/View/components/WaitingForAnEvent.tsx
index 5b0a4ac0a..33fbab31d 100644
--- a/web/app/pages/Project/View/components/WaitingForAnEvent.tsx
+++ b/web/app/pages/Project/View/components/WaitingForAnEvent.tsx
@@ -1,11 +1,12 @@
-import React, { useState } from 'react'
+import { useState } from 'react'
+import { useTranslation, Trans } from 'react-i18next'
import { Link } from 'react-router'
-import { User } from '~/lib/models/User'
+
import { ProjectForShared } from '~/lib/models/SharedProject'
-import { useTranslation, Trans } from 'react-i18next'
-import routes from '~/utils/routes'
-import PulsatingCircle from '~/ui/icons/PulsatingCircle'
+import { User } from '~/lib/models/User'
import TrackingSnippet from '~/modals/TrackingSnippet'
+import PulsatingCircle from '~/ui/icons/PulsatingCircle'
+import routes from '~/utils/routes'
interface WaitingForAnEventProps {
user?: User
@@ -30,7 +31,6 @@ const WaitingForAnEvent = ({ project }: WaitingForAnEventProps) => {
</h1>
<p className='mt-4 max-w-[100ch] font-mono text-sm whitespace-pre-line text-gray-800 dark:text-gray-200'>
<Trans
- // @ts-ignore
t={t}
i18nKey='project.waiting.desc'
components={{
@@ -51,6 +51,7 @@ const WaitingForAnEvent = ({ project }: WaitingForAnEventProps) => {
),
snippet: (
<span
+ tabIndex={0}
role='button'
className='cursor-pointer font-medium text-indigo-600 hover:underline dark:text-indigo-400'
onClick={() => setIsModalOpened(true)}
diff --git a/web/app/pages/Project/View/interfaces/traffic.tsx b/web/app/pages/Project/View/interfaces/traffic.tsx
index 0d9192414..505f6c1c1 100644
--- a/web/app/pages/Project/View/interfaces/traffic.tsx
+++ b/web/app/pages/Project/View/interfaces/traffic.tsx
@@ -31,17 +31,11 @@ interface Param {
count: number
}
-export interface Params {
- [key: string]: Param[]
-}
+export type Params = Record<string, Param[]>
-export interface Customs {
- [key: string]: number
-}
+export type Customs = Record<string, number>
-export interface Properties {
- [key: string]: number
-}
+export type Properties = Record<string, number>
interface Metric {
sum: number
diff --git a/web/app/pages/Project/View/utils/filters.tsx b/web/app/pages/Project/View/utils/filters.tsx
index 4658c761d..be83b20ec 100644
--- a/web/app/pages/Project/View/utils/filters.tsx
+++ b/web/app/pages/Project/View/utils/filters.tsx
@@ -1,11 +1,12 @@
-import React from 'react'
-import { Filter } from '../interfaces/traffic'
import _includes from 'lodash/includes'
-import _replace from 'lodash/replace'
-import _startsWith from 'lodash/startsWith'
-import _some from 'lodash/some'
import _keys from 'lodash/keys'
import _reduce from 'lodash/reduce'
+import _replace from 'lodash/replace'
+import _some from 'lodash/some'
+import _startsWith from 'lodash/startsWith'
+import React from 'react'
+
+import { Filter } from '../interfaces/traffic'
export const ERROR_FILTERS_MAPPING = {
showResolved: 'showResolved',
diff --git a/web/app/pages/ReferralPage/index.tsx b/web/app/pages/ReferralPage/index.tsx
index d795cc5a7..3bd17a28d 100644
--- a/web/app/pages/ReferralPage/index.tsx
+++ b/web/app/pages/ReferralPage/index.tsx
@@ -1,15 +1,13 @@
-import React from 'react'
-import { Link, useParams } from 'react-router'
-import { useSelector } from 'react-redux'
-import { useTranslation, Trans } from 'react-i18next'
import { ArrowRightIcon } from '@heroicons/react/20/solid'
+import { useTranslation, Trans } from 'react-i18next'
+import { useSelector } from 'react-redux'
+import { Link, useParams } from 'react-router'
-import { StateType } from '~/lib/store/index'
import Header from '~/components/Header'
-import routes from '~/utils/routes'
import { Lines } from '~/components/marketing/Lines'
-
import { isBrowser, REFERRAL_COOKIE_DAYS, REFERRAL_DISCOUNT } from '~/lib/constants'
+import { StateType } from '~/lib/store/index'
+import routes from '~/utils/routes'
interface ReferralPageProps {
ssrTheme: 'dark' | 'light'
diff --git a/web/app/pages/Terms/index.tsx b/web/app/pages/Terms/index.tsx
index 418869a22..3fd7f6ee7 100644
--- a/web/app/pages/Terms/index.tsx
+++ b/web/app/pages/Terms/index.tsx
@@ -1,5 +1,4 @@
/* eslint-disable react/no-unescaped-entities */
-import React from 'react'
import { CONTACT_EMAIL } from '~/lib/constants'
diff --git a/web/app/pages/Unsubscribe/index.tsx b/web/app/pages/Unsubscribe/index.tsx
index e94f30d26..d9f54fa46 100644
--- a/web/app/pages/Unsubscribe/index.tsx
+++ b/web/app/pages/Unsubscribe/index.tsx
@@ -1,12 +1,12 @@
-import React, { useState, useEffect, memo } from 'react'
-import { useParams, Link } from 'react-router'
-import { useTranslation } from 'react-i18next'
import { CheckCircleIcon, XCircleIcon } from '@heroicons/react/24/solid'
import _isString from 'lodash/isString'
+import { useState, useEffect, memo } from 'react'
+import { useTranslation } from 'react-i18next'
import { useSelector } from 'react-redux'
+import { useParams, Link } from 'react-router'
-import { StateType } from '~/lib/store'
import { unsubscribeFromEmailReports, unsubscribeFromEmailReports3rdParty } from '~/api'
+import { StateType } from '~/lib/store'
import Loader from '~/ui/Loader'
import routes from '~/utils/routes'
diff --git a/web/app/pages/UserSettings/UserSettings.tsx b/web/app/pages/UserSettings/UserSettings.tsx
index 32f0a19e5..6bbb72677 100644
--- a/web/app/pages/UserSettings/UserSettings.tsx
+++ b/web/app/pages/UserSettings/UserSettings.tsx
@@ -1,27 +1,40 @@
/* eslint-disable no-param-reassign */
-import React, { useState, useEffect, memo, useMemo } from 'react'
-import type i18next from 'i18next'
-import { useNavigate } from 'react-router'
-import { ClientOnly } from 'remix-utils/client-only'
-import { useTranslation } from 'react-i18next'
-import { toast } from 'sonner'
-import _size from 'lodash/size'
-import _isEmpty from 'lodash/isEmpty'
-import _isNull from 'lodash/isNull'
-import _findIndex from 'lodash/findIndex'
-import _map from 'lodash/map'
-import _keys from 'lodash/keys'
-import _find from 'lodash/find'
import {
EnvelopeIcon,
ExclamationTriangleIcon,
ChevronDownIcon,
CursorArrowRaysIcon,
} from '@heroicons/react/24/outline'
+import cx from 'clsx'
import dayjs from 'dayjs'
import utc from 'dayjs/plugin/utc'
-import cx from 'clsx'
+import type i18next from 'i18next'
+import _find from 'lodash/find'
+import _findIndex from 'lodash/findIndex'
+import _isEmpty from 'lodash/isEmpty'
+import _isNull from 'lodash/isNull'
+import _keys from 'lodash/keys'
+import _map from 'lodash/map'
+import _size from 'lodash/size'
+import { DownloadIcon, MessageSquareTextIcon, MonitorIcon, UserRoundIcon } from 'lucide-react'
+import React, { useState, useEffect, memo, useMemo } from 'react'
+import { useTranslation } from 'react-i18next'
+import { useSelector } from 'react-redux'
+import { useNavigate } from 'react-router'
+import { ClientOnly } from 'remix-utils/client-only'
+import { toast } from 'sonner'
+import {
+ confirmEmail,
+ exportUserData,
+ generateApiKey,
+ deleteApiKey, // setTheme,
+ receiveLoginNotification,
+ setShowLiveVisitorsInTitle,
+ changeUserDetails,
+ deleteUser,
+} from '~/api'
+import { withAuthentication, auth } from '~/hoc/protected'
import {
reportFrequencies,
DEFAULT_TIMEZONE,
@@ -32,45 +45,33 @@ import {
isSelfhosted,
} from '~/lib/constants'
import { User } from '~/lib/models/User'
-import { withAuthentication, auth } from '~/hoc/protected'
-import Input from '~/ui/Input'
+import { authActions } from '~/lib/reducers/auth'
+import { StateType, useAppDispatch } from '~/lib/store'
+import PaidFeature from '~/modals/PaidFeature'
import Button from '~/ui/Button'
+import Checkbox from '~/ui/Checkbox'
+import Input from '~/ui/Input'
+import Loader from '~/ui/Loader'
import Modal from '~/ui/Modal'
import Select from '~/ui/Select'
-import Checkbox from '~/ui/Checkbox'
-import PaidFeature from '~/modals/PaidFeature'
-import TimezonePicker from '~/ui/TimezonePicker'
import Textarea from '~/ui/Textarea'
-import Loader from '~/ui/Loader'
-import { isValidEmail, isValidPassword, MIN_PASSWORD_CHARS } from '~/utils/validator'
-import routes from '~/utils/routes'
+import TimezonePicker from '~/ui/TimezonePicker'
+import { removeAccessToken } from '~/utils/accessToken'
import { trackCustom } from '~/utils/analytics'
+import { logout } from '~/utils/auth'
import { getCookie, setCookie } from '~/utils/cookie'
-import {
- confirmEmail,
- exportUserData,
- generateApiKey,
- deleteApiKey, // setTheme,
- receiveLoginNotification,
- setShowLiveVisitorsInTitle,
- changeUserDetails,
- deleteUser,
-} from '~/api'
-import ProjectList from './components/ProjectList'
-import TwoFA from './components/TwoFA'
+import { removeRefreshToken } from '~/utils/refreshToken'
+import routes from '~/utils/routes'
+import { isValidEmail, isValidPassword, MIN_PASSWORD_CHARS } from '~/utils/validator'
+
import Integrations from './components/Integrations'
-import Socialisations from './components/Socialisations'
-import Referral from './components/Referral'
+import NoOrganisations from './components/NoOrganisations'
import NoSharedProjects from './components/NoSharedProjects'
import Organisations from './components/Organisations'
-import NoOrganisations from './components/NoOrganisations'
-import { useSelector } from 'react-redux'
-import { StateType, useAppDispatch } from '~/lib/store'
-import { authActions } from '~/lib/reducers/auth'
-import { removeRefreshToken } from '~/utils/refreshToken'
-import { removeAccessToken } from '~/utils/accessToken'
-import { logout } from '~/utils/auth'
-import { DownloadIcon, MessageSquareTextIcon, MonitorIcon, UserRoundIcon } from 'lucide-react'
+import ProjectList from './components/ProjectList'
+import Referral from './components/Referral'
+import Socialisations from './components/Socialisations'
+import TwoFA from './components/TwoFA'
dayjs.extend(utc)
@@ -149,9 +150,7 @@ const UserSettings = () => {
const [reportFrequency, setReportFrequency] = useState(user.reportFrequency)
const [formPresetted, setFormPresetted] = useState(false)
const [validated, setValidated] = useState(false)
- const [errors, setErrors] = useState<{
- [key: string]: string
- }>({})
+ const [errors, setErrors] = useState<Record<string, string>>({})
const [beenSubmitted, setBeenSubmitted] = useState(false)
const [showModal, setShowModal] = useState(false)
const [showAPIDeleteModal, setShowAPIDeleteModal] = useState(false)
@@ -166,9 +165,7 @@ const UserSettings = () => {
const activeTabLabel = useMemo(() => _find(tabs, (tab) => tab.id === activeTab)?.label, [tabs, activeTab])
const validate = () => {
- const allErrors = {} as {
- [key: string]: string
- }
+ const allErrors = {} as Record<string, string>
if (!isValidEmail(form.email)) {
allErrors.email = t('auth.common.badEmailError')
@@ -565,7 +562,7 @@ const UserSettings = () => {
})}
/>
</span>
- {showPasswordFields && (
+ {showPasswordFields ? (
<div className='mt-4 grid grid-cols-1 gap-x-4 gap-y-6 sm:grid-cols-6'>
<Input
name='password'
@@ -589,7 +586,7 @@ const UserSettings = () => {
error={beenSubmitted ? errors.repeat : null}
/>
</div>
- )}
+ ) : null}
<Button className='mt-4' type='submit' primary large>
{t('profileSettings.update')}
</Button>
@@ -748,7 +745,7 @@ const UserSettings = () => {
</div>
<hr className='mt-5 border-gray-200 dark:border-gray-600' />
- {!user.isActive && (
+ {!user.isActive ? (
<div
className='mt-4 flex max-w-max cursor-pointer pl-0 text-blue-600 underline hover:text-indigo-800 dark:hover:text-indigo-600'
onClick={() => onEmailConfirm(setError)}
@@ -756,7 +753,7 @@ const UserSettings = () => {
<EnvelopeIcon className='mt-0.5 mr-2 h-6 w-6 text-blue-500' />
{t('profileSettings.noLink')}
</div>
- )}
+ ) : null}
<div className='mt-4 flex flex-wrap justify-center gap-2 sm:justify-between'>
<Button onClick={() => setShowExportModal(true)} semiSmall primary>
<>
@@ -847,7 +844,7 @@ const UserSettings = () => {
if (activeTab === TAB_MAPPING.COMMUNICATIONS) {
return (
<>
- {!isSelfhosted && (
+ {!isSelfhosted ? (
<>
{/* Email reports frequency selector (e.g. monthly, weekly, etc.) */}
<h3 className='mt-2 text-lg font-bold text-gray-900 dark:text-gray-50'>
@@ -882,7 +879,7 @@ const UserSettings = () => {
{t('profileSettings.integrations')}
</h3>
<Integrations handleIntegrationSave={handleIntegrationSave} />
- {user.isTelegramChatIdConfirmed && (
+ {user.isTelegramChatIdConfirmed ? (
<Checkbox
checked={user.receiveLoginNotifications}
onChange={handleReceiveLoginNotifications}
@@ -891,9 +888,9 @@ const UserSettings = () => {
className='mt-4'
label={t('profileSettings.receiveLoginNotifications')}
/>
- )}
+ ) : null}
</>
- )}
+ ) : null}
</>
)
}
diff --git a/web/app/pages/UserSettings/components/Integrations.tsx b/web/app/pages/UserSettings/components/Integrations.tsx
index 573b48892..464b2dad2 100644
--- a/web/app/pages/UserSettings/components/Integrations.tsx
+++ b/web/app/pages/UserSettings/components/Integrations.tsx
@@ -1,21 +1,21 @@
-import React, { useState, memo } from 'react'
+import { CheckCircleIcon, XCircleIcon, ClockIcon } from '@heroicons/react/24/solid'
import type i18next from 'i18next'
-import { useTranslation, Trans } from 'react-i18next'
-import _map from 'lodash/map'
import _isString from 'lodash/isString'
-import { CheckCircleIcon, XCircleIcon, ClockIcon } from '@heroicons/react/24/solid'
+import _map from 'lodash/map'
+import React, { useState, memo } from 'react'
+import { useTranslation, Trans } from 'react-i18next'
+import { useSelector } from 'react-redux'
import { toast } from 'sonner'
-import Input from '~/ui/Input'
-import Button from '~/ui/Button'
-import Telegram from '~/ui/icons/Telegram'
-import Slack from '~/ui/icons/Slack'
-import Discord from '~/ui/icons/Discord'
import { removeTgIntegration } from '~/api'
import { User } from '~/lib/models/User'
-import { StateType, useAppDispatch } from '~/lib/store'
-import { useSelector } from 'react-redux'
import { authActions } from '~/lib/reducers/auth'
+import { StateType, useAppDispatch } from '~/lib/store'
+import Button from '~/ui/Button'
+import Discord from '~/ui/icons/Discord'
+import Slack from '~/ui/icons/Slack'
+import Telegram from '~/ui/icons/Telegram'
+import Input from '~/ui/Input'
const getAvailableIntegrations = (
t: typeof i18next.t,
@@ -415,22 +415,22 @@ const Integrations = ({ handleIntegrationSave }: IntegrationsProps) => {
</p>
</div>
<div>
- {id && (
+ {id ? (
<p className='text-sm text-gray-900 dark:text-gray-50'>
{t('profileSettings.chatID')}
{`: ${id}`}
</p>
- )}
+ ) : null}
<p className='mt-2 flex items-center text-sm text-gray-500 dark:text-gray-100'>
- {status === 'notConnected' && (
+ {status === 'notConnected' ? (
<XCircleIcon className='mr-1.5 h-5 w-5 shrink-0 text-red-400' aria-hidden='true' />
- )}
- {status === 'pending' && (
+ ) : null}
+ {status === 'pending' ? (
<ClockIcon className='mr-1.5 h-5 w-5 shrink-0 text-yellow-400' aria-hidden='true' />
- )}
- {status === 'connected' && (
+ ) : null}
+ {status === 'connected' ? (
<CheckCircleIcon className='mr-1.5 h-5 w-5 shrink-0 text-green-400' aria-hidden='true' />
- )}
+ ) : null}
{t(`common.${status}`)}
</p>
</div>
diff --git a/web/app/pages/UserSettings/components/NoOrganisations.tsx b/web/app/pages/UserSettings/components/NoOrganisations.tsx
index 85322082d..0a12edcdb 100644
--- a/web/app/pages/UserSettings/components/NoOrganisations.tsx
+++ b/web/app/pages/UserSettings/components/NoOrganisations.tsx
@@ -1,4 +1,3 @@
-import React from 'react'
import { useTranslation } from 'react-i18next'
const NoOrganisations = () => {
diff --git a/web/app/pages/UserSettings/components/NoSharedProjects.tsx b/web/app/pages/UserSettings/components/NoSharedProjects.tsx
index c80d497ef..b86bba0f7 100644
--- a/web/app/pages/UserSettings/components/NoSharedProjects.tsx
+++ b/web/app/pages/UserSettings/components/NoSharedProjects.tsx
@@ -1,4 +1,3 @@
-import React from 'react'
import { useTranslation } from 'react-i18next'
const NoSharedProjects = () => {
diff --git a/web/app/pages/UserSettings/components/Organisations.tsx b/web/app/pages/UserSettings/components/Organisations.tsx
index d06558901..88b4032fd 100644
--- a/web/app/pages/UserSettings/components/Organisations.tsx
+++ b/web/app/pages/UserSettings/components/Organisations.tsx
@@ -1,18 +1,18 @@
-import React, { memo, useState } from 'react'
-import dayjs from 'dayjs'
-import { toast } from 'sonner'
-import { useTranslation } from 'react-i18next'
import cx from 'clsx'
-import _map from 'lodash/map'
+import dayjs from 'dayjs'
import _filter from 'lodash/filter'
+import _map from 'lodash/map'
+import { memo, useState } from 'react'
+import { useTranslation } from 'react-i18next'
+import { useSelector } from 'react-redux'
+import { toast } from 'sonner'
-import Button from '~/ui/Button'
-import Modal from '~/ui/Modal'
import { rejectOrganisationInvitation, acceptOrganisationInvitation } from '~/api'
import { OrganisationMembership } from '~/lib/models/Organisation'
-import { StateType, useAppDispatch } from '~/lib/store'
import { authActions } from '~/lib/reducers/auth'
-import { useSelector } from 'react-redux'
+import { StateType, useAppDispatch } from '~/lib/store'
+import Button from '~/ui/Button'
+import Modal from '~/ui/Modal'
interface OrganisationsProps {
membership: OrganisationMembership
diff --git a/web/app/pages/UserSettings/components/ProjectList.tsx b/web/app/pages/UserSettings/components/ProjectList.tsx
index ae4b61ae9..8601d6ff3 100644
--- a/web/app/pages/UserSettings/components/ProjectList.tsx
+++ b/web/app/pages/UserSettings/components/ProjectList.tsx
@@ -1,17 +1,17 @@
-import React, { memo, useState } from 'react'
import dayjs from 'dayjs'
-import { toast } from 'sonner'
-import { useTranslation } from 'react-i18next'
-import _map from 'lodash/map'
import _filter from 'lodash/filter'
+import _map from 'lodash/map'
+import { memo, useState } from 'react'
+import { useTranslation } from 'react-i18next'
+import { useSelector } from 'react-redux'
+import { toast } from 'sonner'
-import Button from '~/ui/Button'
-import Modal from '~/ui/Modal'
import { rejectProjectShare, acceptProjectShare } from '~/api'
import { SharedProject } from '~/lib/models/SharedProject'
-import { StateType, useAppDispatch } from '~/lib/store'
import { authActions } from '~/lib/reducers/auth'
-import { useSelector } from 'react-redux'
+import { StateType, useAppDispatch } from '~/lib/store'
+import Button from '~/ui/Button'
+import Modal from '~/ui/Modal'
interface ProjectListProps {
item: SharedProject
diff --git a/web/app/pages/UserSettings/components/Referral.tsx b/web/app/pages/UserSettings/components/Referral.tsx
index 426f81cfd..c712201e9 100644
--- a/web/app/pages/UserSettings/components/Referral.tsx
+++ b/web/app/pages/UserSettings/components/Referral.tsx
@@ -1,15 +1,12 @@
-import React, { useState, useEffect } from 'react'
-import { useTranslation, Trans } from 'react-i18next'
import dayjs from 'dayjs'
import _isEmpty from 'lodash/isEmpty'
import _map from 'lodash/map'
+import React, { useState, useEffect } from 'react'
+import { useTranslation, Trans } from 'react-i18next'
+import { useSelector } from 'react-redux'
import { toast } from 'sonner'
import { generateRefCode, getPayoutsInfo, getReferrals, setPaypalEmail } from '~/api'
-import Tooltip from '~/ui/Tooltip'
-import Highlighted from '~/ui/Highlighted'
-import Input from '~/ui/Input'
-import Button from '~/ui/Button'
import {
REF_URL_PREFIX,
DOCS_REFERRAL_PROGRAM_URL,
@@ -21,12 +18,15 @@ import {
MERCHANT_FEE,
REFERRAL_CUT,
} from '~/lib/constants'
-import { isValidEmail } from '~/utils/validator'
-import { useSelector } from 'react-redux'
-import { StateType, useAppDispatch } from '~/lib/store'
-import { authActions } from '~/lib/reducers/auth'
import { User } from '~/lib/models/User'
+import { authActions } from '~/lib/reducers/auth'
+import { StateType, useAppDispatch } from '~/lib/store'
+import Button from '~/ui/Button'
+import Highlighted from '~/ui/Highlighted'
import Spin from '~/ui/icons/Spin'
+import Input from '~/ui/Input'
+import Tooltip from '~/ui/Tooltip'
+import { isValidEmail } from '~/utils/validator'
const Referral = () => {
const { user } = useSelector((state: StateType) => state.auth)
@@ -277,7 +277,7 @@ const Referral = () => {
</thead>
<tbody className='divide-y divide-gray-200 bg-white dark:divide-gray-600 dark:bg-slate-800'>
{_map(activeReferrals, ({ billingFrequency, created, planCode, tierCurrency }, index) => {
- // @ts-ignore
+ // @ts-expect-error
const planPrice = PLAN_LIMITS[planCode].price[tierCurrency][billingFrequency]
const referrerCut = calculateReferralCut(planPrice)
const currencySymbol = CURRENCIES[tierCurrency as 'EUR' | 'USD' | 'GBP'].symbol
diff --git a/web/app/pages/UserSettings/components/Socialisations.tsx b/web/app/pages/UserSettings/components/Socialisations.tsx
index 129eb04f8..e9c7aad1a 100644
--- a/web/app/pages/UserSettings/components/Socialisations.tsx
+++ b/web/app/pages/UserSettings/components/Socialisations.tsx
@@ -1,19 +1,19 @@
-import React, { useState } from 'react'
-import { useTranslation } from 'react-i18next'
-import _map from 'lodash/map'
import { CheckCircleIcon, XCircleIcon } from '@heroicons/react/24/solid'
+import _map from 'lodash/map'
+import { useState } from 'react'
+import { useTranslation } from 'react-i18next'
+import { useSelector } from 'react-redux'
import { toast } from 'sonner'
+import { authMe, generateSSOAuthURL, linkBySSOHash, unlinkSSO } from '~/api'
+import { SSO_PROVIDERS } from '~/lib/constants'
+import { User } from '~/lib/models/User'
+import { authActions } from '~/lib/reducers/auth'
+import { StateType, useAppDispatch } from '~/lib/store'
import Button from '~/ui/Button'
-import Google from '~/ui/icons/GoogleG'
import GithubDark from '~/ui/icons/GithubDark'
import GithubLight from '~/ui/icons/GithubLight'
-import { User } from '~/lib/models/User'
-import { SSO_PROVIDERS } from '~/lib/constants'
-import { StateType, useAppDispatch } from '~/lib/store'
-import { useSelector } from 'react-redux'
-import { authMe, generateSSOAuthURL, linkBySSOHash, unlinkSSO } from '~/api'
-import { authActions } from '~/lib/reducers/auth'
+import Google from '~/ui/icons/GoogleG'
import { delay, openBrowserWindow } from '~/utils/generic'
const AVAILABLE_SSO_PROVIDERS = [
@@ -95,7 +95,7 @@ const Socialisations = () => {
setIsLoading(false)
return
- } catch (reason) {
+ } catch {
// Authentication is not finished yet
}
@@ -153,35 +153,35 @@ const Socialisations = () => {
<div>
<p className='text-md font-medium text-gray-800 dark:text-gray-50'>{name}</p>
<p className='mt-2 flex items-center text-sm text-gray-500 dark:text-gray-100'>
- {status === 'notConnected' && (
+ {status === 'notConnected' ? (
<XCircleIcon className='mr-1.5 h-5 w-5 shrink-0 text-red-400' aria-hidden='true' />
- )}
- {status === 'connected' && (
+ ) : null}
+ {status === 'connected' ? (
<CheckCircleIcon className='mr-1.5 h-5 w-5 shrink-0 text-green-400' aria-hidden='true' />
- )}
+ ) : null}
{t(`common.${status}`)}
</p>
</div>
</div>
</div>
<div className='mt-2 flex justify-center sm:mt-0 sm:block'>
- {connected && !unlinkable && (
+ {connected && !unlinkable ? (
<Button onClick={() => toast.error(t('profileSettings.cantUnlinkSocialisation'))} small danger>
{t('common.unlink')}
</Button>
- )}
+ ) : null}
- {connected && unlinkable && (
+ {connected && unlinkable ? (
<Button onClick={() => onUnlinkSSO(key)} loading={isLoading} small danger>
{t('common.unlink')}
</Button>
- )}
+ ) : null}
- {!connected && (
+ {!connected ? (
<Button onClick={() => linkSSO(key)} loading={isLoading} small primary>
{t('common.link')}
</Button>
- )}
+ ) : null}
</div>
</div>
</li>
diff --git a/web/app/pages/UserSettings/components/TwoFA.tsx b/web/app/pages/UserSettings/components/TwoFA.tsx
index d57af0bfb..38702eee0 100644
--- a/web/app/pages/UserSettings/components/TwoFA.tsx
+++ b/web/app/pages/UserSettings/components/TwoFA.tsx
@@ -1,19 +1,19 @@
-import React, { useState } from 'react'
-import QRCode from 'react-qr-code'
-import { useTranslation } from 'react-i18next'
import cx from 'clsx'
import _isNull from 'lodash/isNull'
import _isString from 'lodash/isString'
+import React, { useState } from 'react'
+import { useTranslation } from 'react-i18next'
+import QRCode from 'react-qr-code'
+import { useSelector } from 'react-redux'
import { toast } from 'sonner'
-import Input from '~/ui/Input'
-import Button from '~/ui/Button'
import { generate2FA, enable2FA, disable2FA } from '~/api'
+import { authActions } from '~/lib/reducers/auth'
+import { StateType, useAppDispatch } from '~/lib/store'
+import Button from '~/ui/Button'
+import Input from '~/ui/Input'
import { setAccessToken } from '~/utils/accessToken'
import { setRefreshToken } from '~/utils/refreshToken'
-import { StateType, useAppDispatch } from '~/lib/store'
-import { useSelector } from 'react-redux'
-import { authActions } from '~/lib/reducers/auth'
const TwoFA = () => {
const dispatch = useAppDispatch()
diff --git a/web/app/root.tsx b/web/app/root.tsx
index 7da74bcdc..639004b5b 100644
--- a/web/app/root.tsx
+++ b/web/app/root.tsx
@@ -1,6 +1,14 @@
/* eslint-disable no-undef */
-import type { LinksFunction, LoaderFunctionArgs, HeadersFunction } from 'react-router'
+import { ExclamationTriangleIcon, ChevronDownIcon, ChevronUpIcon } from '@heroicons/react/24/outline'
+import BillboardCss from 'billboard.js/dist/billboard.min.css?url'
+import cx from 'clsx'
+import FlatpickrDarkCss from 'flatpickr/dist/themes/dark.css?url'
+import FlatpickrLightCss from 'flatpickr/dist/themes/light.css?url'
+import _replace from 'lodash/replace'
import { useState } from 'react'
+import { useTranslation } from 'react-i18next'
+import { Provider } from 'react-redux'
+import type { LinksFunction, LoaderFunctionArgs, HeadersFunction } from 'react-router'
import {
data,
redirect,
@@ -12,32 +20,24 @@ import {
isRouteErrorResponse,
useRouteError,
} from 'react-router'
-import { store } from '~/lib/store'
-import { CONTACT_EMAIL, LS_THEME_SETTING, isSelfhosted, I18N_CACHE_BREAKER } from '~/lib/constants'
+import { useChangeLanguage } from 'remix-i18next/react'
import { ExternalScripts } from 'remix-utils/external-scripts'
-import { getCookie, generateCookieString } from '~/utils/cookie'
-import { ExclamationTriangleIcon, ChevronDownIcon, ChevronUpIcon } from '@heroicons/react/24/outline'
-import { Provider } from 'react-redux'
-import cx from 'clsx'
-import _replace from 'lodash/replace'
-import BillboardCss from 'billboard.js/dist/billboard.min.css?url'
-import { trackViews, trackErrors } from '~/utils/analytics'
-import { useChangeLanguage } from 'remix-i18next/react'
-import { useTranslation } from 'react-i18next'
-import AppWrapper from './App'
-import { detectLanguage } from './i18n'
-import { detectTheme, isAuthenticated, isWWW } from '~/utils/server'
import { LocaleLinks } from '~/components/LocaleLinks'
import { SEO } from '~/components/SEO'
-
-import mainCss from '~/styles/index.css?url'
-import tailwindCss from '~/styles/tailwind.css?url'
-import sonnerCss from '~/styles/sonner.css?url'
+import { CONTACT_EMAIL, LS_THEME_SETTING, isSelfhosted, I18N_CACHE_BREAKER } from '~/lib/constants'
+import { store } from '~/lib/store'
import FlatpickerCss from '~/styles/Flatpicker.css?url'
-import FlatpickrLightCss from 'flatpickr/dist/themes/light.css?url'
-import FlatpickrDarkCss from 'flatpickr/dist/themes/dark.css?url'
import FontsCss from '~/styles/fonts.css?url'
+import mainCss from '~/styles/index.css?url'
+import sonnerCss from '~/styles/sonner.css?url'
+import tailwindCss from '~/styles/tailwind.css?url'
+import { trackViews, trackErrors } from '~/utils/analytics'
+import { getCookie, generateCookieString } from '~/utils/cookie'
+import { detectTheme, isAuthenticated, isWWW } from '~/utils/server'
+
+import AppWrapper from './App'
+import { detectLanguage } from './i18n'
trackViews()
trackErrors()
@@ -132,11 +132,11 @@ export function ErrorBoundary() {
</>
)}
</span>
- {crashStackShown && (
+ {crashStackShown ? (
<span className='text-sm whitespace-pre-line text-gray-600 dark:text-gray-400'>
{error.stack}
</span>
- )}
+ ) : null}
</>
) : (
<>Unknown error</>
@@ -236,8 +236,8 @@ export default function App() {
<Meta />
<meta name='viewport' content='width=device-width,initial-scale=1' />
<Links />
- {theme === 'dark' && <link rel='stylesheet' href={FlatpickrDarkCss} />}
- {theme === 'light' && <link rel='stylesheet' href={FlatpickrLightCss} />}
+ {theme === 'dark' ? <link rel='stylesheet' href={FlatpickrDarkCss} /> : null}
+ {theme === 'light' ? <link rel='stylesheet' href={FlatpickrLightCss} /> : null}
<LocaleLinks />
<link
rel='preload'
diff --git a/web/app/routes/$.tsx b/web/app/routes/$.tsx
index 1bb58d6eb..63109672c 100644
--- a/web/app/routes/$.tsx
+++ b/web/app/routes/$.tsx
@@ -1,6 +1,7 @@
import type { LoaderFunction } from 'react-router'
-import type { SitemapFunction } from 'remix-sitemap'
import { data } from 'react-router'
+import type { SitemapFunction } from 'remix-sitemap'
+
import NotFound from '~/pages/NotFound'
export const sitemap: SitemapFunction = () => ({
diff --git a/web/app/routes/3rd-party-unsubscribe.$token.tsx b/web/app/routes/3rd-party-unsubscribe.$token.tsx
index d5a91745b..4847321dc 100644
--- a/web/app/routes/3rd-party-unsubscribe.$token.tsx
+++ b/web/app/routes/3rd-party-unsubscribe.$token.tsx
@@ -1,5 +1,6 @@
-import type { SitemapFunction } from 'remix-sitemap'
import { redirect } from 'react-router'
+import type { SitemapFunction } from 'remix-sitemap'
+
import { isSelfhosted } from '~/lib/constants'
import Unsubscribe from '~/pages/Unsubscribe'
diff --git a/web/app/routes/_index.tsx b/web/app/routes/_index.tsx
index 398aad854..7988b19af 100644
--- a/web/app/routes/_index.tsx
+++ b/web/app/routes/_index.tsx
@@ -1,21 +1,26 @@
-import type { LoaderFunctionArgs } from 'react-router'
-import { useLoaderData, Link, redirect } from 'react-router'
-import type { SitemapFunction } from 'remix-sitemap'
-import { UAParser } from 'ua-parser-js'
+import { ArrowRightIcon } from '@heroicons/react/20/solid'
+import { CheckIcon, CursorArrowRaysIcon, GlobeAltIcon } from '@heroicons/react/24/outline'
+import { StarIcon } from '@heroicons/react/24/solid'
+import clsx from 'clsx'
import { motion } from 'framer-motion'
-
-import { detectTheme, isAuthenticated } from '~/utils/server'
-
+import _map from 'lodash/map'
+import { Cookie, FileTextIcon } from 'lucide-react'
+import React, { useEffect, useState } from 'react'
import { useTranslation, Trans } from 'react-i18next'
import { useSelector } from 'react-redux'
+import type { LoaderFunctionArgs } from 'react-router'
+import { useLoaderData, Link, redirect } from 'react-router'
+import type { SitemapFunction } from 'remix-sitemap'
import { ClientOnly } from 'remix-utils/client-only'
-import { StarIcon } from '@heroicons/react/24/solid'
-import { ArrowRightIcon } from '@heroicons/react/20/solid'
-import _map from 'lodash/map'
+import { UAParser } from 'ua-parser-js'
-import routesPath from '~/utils/routes'
-import { getAccessToken } from '~/utils/accessToken'
-import { getStringFromTime, getTimeFromSeconds } from '~/utils/generic'
+import Header from '~/components/Header'
+import { ConveyorBelt } from '~/components/marketing/ConveyorBelt'
+import { DitchGoogle } from '~/components/marketing/DitchGoogle'
+import { Lines } from '~/components/marketing/Lines'
+import { LogoTimeline } from '~/components/marketing/LogoTimeline'
+import { MarketplaceCluster } from '~/components/marketing/MarketplaceCluster'
+import Pricing from '~/components/marketing/Pricing'
import {
GITHUB_URL,
LIVE_DEMO_URL,
@@ -27,20 +32,12 @@ import {
isDisableMarketingPages,
} from '~/lib/constants'
import { StateType } from '~/lib/store/index'
-import { Cookie, FileTextIcon } from 'lucide-react'
-
-import Header from '~/components/Header'
-import Pricing from '~/components/marketing/Pricing'
-import { DitchGoogle } from '~/components/marketing/DitchGoogle'
-import { Lines } from '~/components/marketing/Lines'
-import React, { useEffect, useState } from 'react'
-import clsx from 'clsx'
-import { MetricCard, MetricCardSelect } from '~/pages/Project/View/components/MetricCards'
import CCRow from '~/pages/Project/View/components/CCRow'
-import { CheckIcon, CursorArrowRaysIcon, GlobeAltIcon } from '@heroicons/react/24/outline'
-import { LogoTimeline } from '~/components/marketing/LogoTimeline'
-import { MarketplaceCluster } from '~/components/marketing/MarketplaceCluster'
-import { ConveyorBelt } from '~/components/marketing/ConveyorBelt'
+import { MetricCard, MetricCardSelect } from '~/pages/Project/View/components/MetricCards'
+import { getAccessToken } from '~/utils/accessToken'
+import { getStringFromTime, getTimeFromSeconds } from '~/utils/generic'
+import routesPath from '~/utils/routes'
+import { detectTheme, isAuthenticated } from '~/utils/server'
export const sitemap: SitemapFunction = () => ({
priority: 1,
@@ -918,7 +915,7 @@ export default function Index() {
<CoreFeatures theme={theme} />
{/* Hiding the Pricing for authenticated users on the main page as the Paddle script only loads on the Billing page */}
- {!authenticated && <Pricing authenticated={false} />}
+ {!authenticated ? <Pricing authenticated={false} /> : null}
<Feedback
name='Alper Alkan'
diff --git a/web/app/routes/about.tsx b/web/app/routes/about.tsx
index 26a842a08..b596c91da 100644
--- a/web/app/routes/about.tsx
+++ b/web/app/routes/about.tsx
@@ -1,8 +1,9 @@
import { redirect } from 'react-router'
-import About from '~/pages/About'
-import { isDisableMarketingPages, isSelfhosted } from '~/lib/constants'
import { SitemapFunction } from 'remix-sitemap'
+import { isDisableMarketingPages, isSelfhosted } from '~/lib/constants'
+import About from '~/pages/About'
+
export const sitemap: SitemapFunction = () => ({
priority: 1,
exclude: isSelfhosted || isDisableMarketingPages,
diff --git a/web/app/routes/billing.tsx b/web/app/routes/billing.tsx
index cedc09890..b43e04eaf 100644
--- a/web/app/routes/billing.tsx
+++ b/web/app/routes/billing.tsx
@@ -1,9 +1,9 @@
import type { LoaderFunctionArgs } from 'react-router'
import { useLoaderData, data, redirect } from 'react-router'
import type { SitemapFunction } from 'remix-sitemap'
-import Billing from '~/pages/Billing'
import { isSelfhosted } from '~/lib/constants'
+import Billing from '~/pages/Billing'
import { isAuthenticated, detectTheme } from '~/utils/server'
export const sitemap: SitemapFunction = () => ({
diff --git a/web/app/routes/blog.$category.$slug.tsx b/web/app/routes/blog.$category.$slug.tsx
index 48a27a6e4..251ed7f2f 100644
--- a/web/app/routes/blog.$category.$slug.tsx
+++ b/web/app/routes/blog.$category.$slug.tsx
@@ -1,8 +1,9 @@
import type { LoaderFunction, MetaFunction } from 'react-router'
import { redirect, data } from 'react-router'
-import { getPost } from '~/utils/getPosts'
+
import { isSelfhosted, TITLE_SUFFIX, getOgImageUrl, isDisableMarketingPages } from '~/lib/constants'
import Post from '~/pages/Blog/Post'
+import { getPost } from '~/utils/getPosts'
export const meta: MetaFunction = (loaderData: any) => {
const ogImageUrl = getOgImageUrl(loaderData?.data?.title)
diff --git a/web/app/routes/blog.$slug.tsx b/web/app/routes/blog.$slug.tsx
index 4eb4ad959..bc99dbd4b 100644
--- a/web/app/routes/blog.$slug.tsx
+++ b/web/app/routes/blog.$slug.tsx
@@ -1,14 +1,15 @@
-import type { SitemapFunction } from 'remix-sitemap'
-import type { LoaderFunction, MetaFunction } from 'react-router'
-import { redirect, data } from 'react-router'
-import _map from 'lodash/map'
-import _last from 'lodash/last'
-import _join from 'lodash/join'
import _isString from 'lodash/isString'
-import { getPost, getSlugFromFilename, getDateFromFilename } from '~/utils/getPosts'
+import _join from 'lodash/join'
+import _last from 'lodash/last'
+import _map from 'lodash/map'
+import { redirect, data } from 'react-router'
+import type { LoaderFunction, MetaFunction } from 'react-router'
+import type { SitemapFunction } from 'remix-sitemap'
+
import { getSitemap } from '~/api'
import { isSelfhosted, TITLE_SUFFIX, getOgImageUrl, isDisableMarketingPages } from '~/lib/constants'
import Post from '~/pages/Blog/Post'
+import { getPost, getSlugFromFilename, getDateFromFilename } from '~/utils/getPosts'
export const meta: MetaFunction = (loaderData: any) => {
const ogImageUrl = getOgImageUrl(loaderData?.data?.title)
diff --git a/web/app/routes/blog._index.tsx b/web/app/routes/blog._index.tsx
index b62a92ecb..45deccdb1 100644
--- a/web/app/routes/blog._index.tsx
+++ b/web/app/routes/blog._index.tsx
@@ -1,10 +1,11 @@
+import _filter from 'lodash/filter'
+import _isEmpty from 'lodash/isEmpty'
+import _map from 'lodash/map'
import type { LoaderFunction, MetaFunction } from 'react-router'
import { redirect, Link, useLoaderData } from 'react-router'
-import _map from 'lodash/map'
-import _isEmpty from 'lodash/isEmpty'
-import _filter from 'lodash/filter'
-import { isDisableMarketingPages, isSelfhosted, TITLE_SUFFIX } from '~/lib/constants'
+
import { getBlogPosts } from '~/api'
+import { isDisableMarketingPages, isSelfhosted, TITLE_SUFFIX } from '~/lib/constants'
export const loader: LoaderFunction = async () => {
if (isSelfhosted || isDisableMarketingPages) {
@@ -85,11 +86,11 @@ export default function Posts() {
<h3 className='pt-8 text-base font-semibold tracking-tight text-slate-900 lg:pt-0 dark:text-slate-200'>
{post.title}
</h3>
- {post.intro && (
+ {post.intro ? (
<div className='prose prose-slate prose-a:relative prose-a:z-10 mt-2 mb-4 line-clamp-2 font-mono dark:text-slate-400'>
<p>{post.intro}</p>
</div>
- )}
+ ) : null}
<dl className='absolute top-0 left-0 font-mono uppercase lg:right-full lg:left-auto lg:mr-[calc(5rem+1px)]'>
<dt className='sr-only'>Date</dt>
<dd className='text-sm leading-6 whitespace-nowrap dark:text-slate-400'>
diff --git a/web/app/routes/captchas.$id.tsx b/web/app/routes/captchas.$id.tsx
index a8ae9a6e6..67b0d3859 100644
--- a/web/app/routes/captchas.$id.tsx
+++ b/web/app/routes/captchas.$id.tsx
@@ -1,8 +1,9 @@
-import CaptchaView from '~/pages/Captcha/View'
import type { LinksFunction, LoaderFunctionArgs } from 'react-router'
+import { useLoaderData } from 'react-router'
+
+import CaptchaView from '~/pages/Captcha/View'
import ProjectViewStyle from '~/styles/ProjectViewStyle.css?url'
import { detectTheme } from '~/utils/server'
-import { useLoaderData } from 'react-router'
export const links: LinksFunction = () => [{ rel: 'stylesheet', href: ProjectViewStyle }]
diff --git a/web/app/routes/change-email.$id.tsx b/web/app/routes/change-email.$id.tsx
index 70b9aa664..f586a2336 100644
--- a/web/app/routes/change-email.$id.tsx
+++ b/web/app/routes/change-email.$id.tsx
@@ -1,9 +1,9 @@
-import ChangeEmail from '~/pages/Auth/ChangeEmail'
-import type { SitemapFunction } from 'remix-sitemap'
import type { HeadersFunction } from 'react-router'
import { redirect } from 'react-router'
+import type { SitemapFunction } from 'remix-sitemap'
import { isSelfhosted } from '~/lib/constants'
+import ChangeEmail from '~/pages/Auth/ChangeEmail'
export const headers: HeadersFunction = ({ parentHeaders }) => {
parentHeaders.set('X-Frame-Options', 'DENY')
diff --git a/web/app/routes/changelog.tsx b/web/app/routes/changelog.tsx
index 857f3caa6..516472fe9 100644
--- a/web/app/routes/changelog.tsx
+++ b/web/app/routes/changelog.tsx
@@ -1,6 +1,7 @@
-import Changelog from '~/pages/Changelog'
import type { SitemapFunction } from 'remix-sitemap'
+import Changelog from '~/pages/Changelog'
+
export const sitemap: SitemapFunction = () => ({
priority: 0.9,
})
diff --git a/web/app/routes/confirm-email.tsx b/web/app/routes/confirm-email.tsx
index 05f8dbfda..7a2dea9ae 100644
--- a/web/app/routes/confirm-email.tsx
+++ b/web/app/routes/confirm-email.tsx
@@ -1,8 +1,9 @@
-import CheckYourInbox from '~/pages/Auth/CheckYourInbox'
-import type { SitemapFunction } from 'remix-sitemap'
-import type { HeadersFunction, LoaderFunctionArgs } from 'react-router'
+import type { HeadersFunction } from 'react-router'
import { redirect } from 'react-router'
+import type { SitemapFunction } from 'remix-sitemap'
+
import { isSelfhosted } from '~/lib/constants'
+import CheckYourInbox from '~/pages/Auth/CheckYourInbox'
export const headers: HeadersFunction = ({ parentHeaders }) => {
parentHeaders.set('X-Frame-Options', 'DENY')
@@ -13,7 +14,7 @@ export const sitemap: SitemapFunction = () => ({
exclude: true,
})
-export async function loader({ request }: LoaderFunctionArgs) {
+export async function loader() {
if (isSelfhosted) {
return redirect('/login', 302)
}
diff --git a/web/app/routes/contact.tsx b/web/app/routes/contact.tsx
index 087c63871..c533cb62d 100644
--- a/web/app/routes/contact.tsx
+++ b/web/app/routes/contact.tsx
@@ -1,8 +1,9 @@
import { redirect } from 'react-router'
-import Contact from '~/pages/Contact'
-import { isDisableMarketingPages, isSelfhosted } from '~/lib/constants'
import { SitemapFunction } from 'remix-sitemap'
+import { isDisableMarketingPages, isSelfhosted } from '~/lib/constants'
+import Contact from '~/pages/Contact'
+
export const sitemap: SitemapFunction = () => ({
priority: 1,
exclude: isSelfhosted || isDisableMarketingPages,
diff --git a/web/app/routes/dashboard.tsx b/web/app/routes/dashboard.tsx
index 6c543cd94..f099a7a41 100644
--- a/web/app/routes/dashboard.tsx
+++ b/web/app/routes/dashboard.tsx
@@ -1,7 +1,8 @@
import type { LoaderFunction } from 'react-router'
-import Dashboard from '~/pages/Dashboard'
import type { SitemapFunction } from 'remix-sitemap'
+import Dashboard from '~/pages/Dashboard'
+
export const sitemap: SitemapFunction = () => ({
exclude: true,
})
diff --git a/web/app/routes/error-tracking.tsx b/web/app/routes/error-tracking.tsx
index 87eb3ea77..0e7da8b01 100644
--- a/web/app/routes/error-tracking.tsx
+++ b/web/app/routes/error-tracking.tsx
@@ -2,9 +2,9 @@ import type { LoaderFunctionArgs } from 'react-router'
import { useLoaderData, redirect } from 'react-router'
import type { SitemapFunction } from 'remix-sitemap'
+import { isDisableMarketingPages, isSelfhosted } from '~/lib/constants'
import ErrorTracking from '~/pages/ErrorTracking'
import { detectTheme, isAuthenticated } from '~/utils/server'
-import { isDisableMarketingPages, isSelfhosted } from '~/lib/constants'
export const sitemap: SitemapFunction = () => ({
priority: 1,
diff --git a/web/app/routes/feature-flags.tsx b/web/app/routes/feature-flags.tsx
index ce63d0000..f24744249 100644
--- a/web/app/routes/feature-flags.tsx
+++ b/web/app/routes/feature-flags.tsx
@@ -1,18 +1,18 @@
+import { Switch } from '@headlessui/react'
+import cx from 'clsx'
import { useEffect, useState } from 'react'
-import { useDispatch, useSelector } from 'react-redux'
import { useTranslation } from 'react-i18next'
-import { Switch } from '@headlessui/react'
+import { useDispatch, useSelector } from 'react-redux'
+import { useNavigate } from 'react-router'
import { toast } from 'sonner'
-import cx from 'clsx'
-import { StateType } from '~/lib/store'
-import { FeatureFlag } from '~/lib/models/User'
-import { withAuthentication, auth } from '~/hoc/protected'
import { setFeatureFlags } from '~/api'
-import { useNavigate } from 'react-router'
-import routes from '~/utils/routes'
-import Loader from '~/ui/Loader'
+import { withAuthentication, auth } from '~/hoc/protected'
+import { FeatureFlag } from '~/lib/models/User'
import { authActions } from '~/lib/reducers/auth'
+import { StateType } from '~/lib/store'
+import Loader from '~/ui/Loader'
+import routes from '~/utils/routes'
const FeatureFlagsPage = () => {
const { t } = useTranslation('common')
diff --git a/web/app/routes/for-marketers.tsx b/web/app/routes/for-marketers.tsx
index b97c6ea35..02230789b 100644
--- a/web/app/routes/for-marketers.tsx
+++ b/web/app/routes/for-marketers.tsx
@@ -1,10 +1,10 @@
-import Marketers from '~/pages/Landings/Marketers'
import type { LoaderFunctionArgs } from 'react-router'
import { redirect } from 'react-router'
import type { SitemapFunction } from 'remix-sitemap'
-import { detectTheme, isAuthenticated } from '~/utils/server'
import { isDisableMarketingPages, isSelfhosted } from '~/lib/constants'
+import Marketers from '~/pages/Landings/Marketers'
+import { detectTheme, isAuthenticated } from '~/utils/server'
export const sitemap: SitemapFunction = () => ({
priority: 0.9,
diff --git a/web/app/routes/for-small-businesses.tsx b/web/app/routes/for-small-businesses.tsx
index 7afc553f0..3c8b561e7 100644
--- a/web/app/routes/for-small-businesses.tsx
+++ b/web/app/routes/for-small-businesses.tsx
@@ -1,10 +1,10 @@
-import SmallBusinesses from '~/pages/Landings/SmallBusinesses'
import type { LoaderFunctionArgs } from 'react-router'
import { redirect } from 'react-router'
import type { SitemapFunction } from 'remix-sitemap'
-import { detectTheme, isAuthenticated } from '~/utils/server'
import { isDisableMarketingPages, isSelfhosted } from '~/lib/constants'
+import SmallBusinesses from '~/pages/Landings/SmallBusinesses'
+import { detectTheme, isAuthenticated } from '~/utils/server'
export const sitemap: SitemapFunction = () => ({
priority: 0.9,
diff --git a/web/app/routes/for-startups.tsx b/web/app/routes/for-startups.tsx
index 77174fd07..7d1ff6d9b 100644
--- a/web/app/routes/for-startups.tsx
+++ b/web/app/routes/for-startups.tsx
@@ -1,10 +1,10 @@
-import Startups from '~/pages/Landings/Startups'
import type { LoaderFunctionArgs } from 'react-router'
import { redirect } from 'react-router'
import type { SitemapFunction } from 'remix-sitemap'
-import { detectTheme, isAuthenticated } from '~/utils/server'
import { isDisableMarketingPages, isSelfhosted } from '~/lib/constants'
+import Startups from '~/pages/Landings/Startups'
+import { detectTheme, isAuthenticated } from '~/utils/server'
export const sitemap: SitemapFunction = () => ({
priority: 0.9,
diff --git a/web/app/routes/imprint.tsx b/web/app/routes/imprint.tsx
index 336b1565d..b387ff510 100644
--- a/web/app/routes/imprint.tsx
+++ b/web/app/routes/imprint.tsx
@@ -1,7 +1,8 @@
-import Imprint from '~/pages/Imprint'
-import type { SitemapFunction } from 'remix-sitemap'
import { redirect } from 'react-router'
+import type { SitemapFunction } from 'remix-sitemap'
+
import { isDisableMarketingPages, isSelfhosted } from '~/lib/constants'
+import Imprint from '~/pages/Imprint'
export const sitemap: SitemapFunction = () => ({
priority: 0.9,
diff --git a/web/app/routes/login.tsx b/web/app/routes/login.tsx
index 709c51eb0..e17362c59 100644
--- a/web/app/routes/login.tsx
+++ b/web/app/routes/login.tsx
@@ -1,7 +1,7 @@
-import Signin from '~/pages/Auth/Signin'
import type { HeadersFunction, LoaderFunctionArgs } from 'react-router'
import { useLoaderData } from 'react-router'
+import Signin from '~/pages/Auth/Signin'
import { detectTheme } from '~/utils/server'
export const headers: HeadersFunction = ({ parentHeaders }) => {
diff --git a/web/app/routes/open.tsx b/web/app/routes/open.tsx
index e74975d6d..587fee438 100644
--- a/web/app/routes/open.tsx
+++ b/web/app/routes/open.tsx
@@ -1,8 +1,9 @@
-import OpenStartup from '~/pages/OpenStartup'
import { redirect } from 'react-router'
import type { LinksFunction } from 'react-router'
-import { isDisableMarketingPages, isSelfhosted } from '~/lib/constants'
import type { SitemapFunction } from 'remix-sitemap'
+
+import { isDisableMarketingPages, isSelfhosted } from '~/lib/constants'
+import OpenStartup from '~/pages/OpenStartup'
import Style from '~/styles/ProjectViewStyle.css?url'
export const links: LinksFunction = () => {
diff --git a/web/app/routes/organisation.invite.$id.tsx b/web/app/routes/organisation.invite.$id.tsx
index d4e7124c4..ab22ae7ca 100644
--- a/web/app/routes/organisation.invite.$id.tsx
+++ b/web/app/routes/organisation.invite.$id.tsx
@@ -1,9 +1,9 @@
import { CheckCircleIcon, XCircleIcon } from '@heroicons/react/24/outline'
-import { Link, useParams } from 'react-router'
-import { acceptOrganisationInvitation } from '~/api'
import { useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
+import { Link, useParams } from 'react-router'
+import { acceptOrganisationInvitation } from '~/api'
import Loader from '~/ui/Loader'
import routes from '~/utils/routes'
diff --git a/web/app/routes/organisations.$id.tsx b/web/app/routes/organisations.$id.tsx
index 19b45d1dc..fac9422d6 100644
--- a/web/app/routes/organisations.$id.tsx
+++ b/web/app/routes/organisations.$id.tsx
@@ -1,7 +1,8 @@
import { redirect } from 'react-router'
import type { SitemapFunction } from 'remix-sitemap'
-import OrganisationSettings from '~/pages/Organisations/Settings'
+
import { isSelfhosted } from '~/lib/constants'
+import OrganisationSettings from '~/pages/Organisations/Settings'
export const sitemap: SitemapFunction = () => ({
exclude: true,
diff --git a/web/app/routes/organisations.tsx b/web/app/routes/organisations.tsx
index c702f2d67..1b3fbee36 100644
--- a/web/app/routes/organisations.tsx
+++ b/web/app/routes/organisations.tsx
@@ -1,7 +1,8 @@
import { redirect } from 'react-router'
import type { SitemapFunction } from 'remix-sitemap'
-import Organisations from '~/pages/Organisations'
+
import { isSelfhosted } from '~/lib/constants'
+import Organisations from '~/pages/Organisations'
export const sitemap: SitemapFunction = () => ({
exclude: true,
diff --git a/web/app/routes/password-reset.$id.tsx b/web/app/routes/password-reset.$id.tsx
index 4a7fe5a9a..732587153 100644
--- a/web/app/routes/password-reset.$id.tsx
+++ b/web/app/routes/password-reset.$id.tsx
@@ -1,8 +1,9 @@
-import CreateNewPassword from '~/pages/Auth/CreateNewPassword'
-import type { SitemapFunction } from 'remix-sitemap'
import type { HeadersFunction } from 'react-router'
import { redirect } from 'react-router'
+import type { SitemapFunction } from 'remix-sitemap'
+
import { isSelfhosted } from '~/lib/constants'
+import CreateNewPassword from '~/pages/Auth/CreateNewPassword'
export const headers: HeadersFunction = ({ parentHeaders }) => {
parentHeaders.set('X-Frame-Options', 'DENY')
diff --git a/web/app/routes/pay.tsx b/web/app/routes/pay.tsx
index 0bd33363c..da524a58d 100644
--- a/web/app/routes/pay.tsx
+++ b/web/app/routes/pay.tsx
@@ -1,14 +1,15 @@
-import { redirect } from 'react-router'
import { useEffect } from 'react'
+import { redirect } from 'react-router'
import type { SitemapFunction } from 'remix-sitemap'
import { ExternalScriptsHandle } from 'remix-utils/external-scripts'
+
import { isSelfhosted } from '~/lib/constants'
export const sitemap: SitemapFunction = () => ({
exclude: true,
})
-export let handle: ExternalScriptsHandle = {
+export const handle: ExternalScriptsHandle = {
scripts: [
{
src: 'https://cdn.paddle.com/paddle/v2/paddle.js',
diff --git a/web/app/routes/performance.tsx b/web/app/routes/performance.tsx
index b0bdd0643..a643cbdb2 100644
--- a/web/app/routes/performance.tsx
+++ b/web/app/routes/performance.tsx
@@ -1,10 +1,10 @@
-import Performance from '~/pages/Performance'
import type { LoaderFunctionArgs } from 'react-router'
import { useLoaderData, redirect } from 'react-router'
import type { SitemapFunction } from 'remix-sitemap'
-import { detectTheme, isAuthenticated } from '~/utils/server'
import { isDisableMarketingPages, isSelfhosted } from '~/lib/constants'
+import Performance from '~/pages/Performance'
+import { detectTheme, isAuthenticated } from '~/utils/server'
export const sitemap: SitemapFunction = () => ({
priority: 1,
diff --git a/web/app/routes/privacy.tsx b/web/app/routes/privacy.tsx
index ab9225d75..49eb29221 100644
--- a/web/app/routes/privacy.tsx
+++ b/web/app/routes/privacy.tsx
@@ -1,6 +1,7 @@
-import Privacy from '~/pages/Privacy'
import type { SitemapFunction } from 'remix-sitemap'
+import Privacy from '~/pages/Privacy'
+
export const sitemap: SitemapFunction = () => ({
priority: 0.9,
changefreq: 'monthly',
diff --git a/web/app/routes/project.transfer.cancel.tsx b/web/app/routes/project.transfer.cancel.tsx
index 1a81f25d0..5ee3cae60 100644
--- a/web/app/routes/project.transfer.cancel.tsx
+++ b/web/app/routes/project.transfer.cancel.tsx
@@ -1,6 +1,7 @@
-import TransferProjectReject from '~/pages/Project/Settings/TransferProject/TransferProjectReject'
import type { SitemapFunction } from 'remix-sitemap'
+import TransferProjectReject from '~/pages/Project/Settings/TransferProject/TransferProjectReject'
+
export const sitemap: SitemapFunction = () => ({
exclude: true,
})
diff --git a/web/app/routes/project.transfer.confirm.tsx b/web/app/routes/project.transfer.confirm.tsx
index aa95fcd4b..04c7083e1 100644
--- a/web/app/routes/project.transfer.confirm.tsx
+++ b/web/app/routes/project.transfer.confirm.tsx
@@ -1,6 +1,7 @@
-import TransferProjectConfirm from '~/pages/Project/Settings/TransferProject/TransferProjectConfirm'
import type { SitemapFunction } from 'remix-sitemap'
+import TransferProjectConfirm from '~/pages/Project/Settings/TransferProject/TransferProjectConfirm'
+
export const sitemap: SitemapFunction = () => ({
exclude: true,
})
diff --git a/web/app/routes/projects.$id.password.tsx b/web/app/routes/projects.$id.password.tsx
index 83b1c7b2c..55b56caee 100644
--- a/web/app/routes/projects.$id.password.tsx
+++ b/web/app/routes/projects.$id.password.tsx
@@ -1,7 +1,7 @@
-import ProjectProtectedPassword from '~/pages/Project/ProjectProtectedPassword'
import type { LoaderFunctionArgs } from 'react-router'
import { useLoaderData } from 'react-router'
+import ProjectProtectedPassword from '~/pages/Project/ProjectProtectedPassword'
import { detectTheme, isEmbedded, getProjectPassword, isAuthenticated } from '~/utils/server'
export async function loader({ request }: LoaderFunctionArgs) {
diff --git a/web/app/routes/projects.$id.tsx b/web/app/routes/projects.$id.tsx
index 63e6132f2..259940cad 100644
--- a/web/app/routes/projects.$id.tsx
+++ b/web/app/routes/projects.$id.tsx
@@ -1,10 +1,10 @@
-import ViewProject from '~/pages/Project/View'
-import type { LinksFunction, LoaderFunctionArgs, MetaFunction } from 'react-router'
import _split from 'lodash/split'
+import type { LinksFunction, LoaderFunctionArgs, MetaFunction } from 'react-router'
import { API_URL } from '~/lib/constants'
-import { detectTheme, isEmbedded, isAuthenticated, getProjectPassword, getProjectTabs } from '~/utils/server'
+import ViewProject from '~/pages/Project/View'
import ProjectViewStyle from '~/styles/ProjectViewStyle.css?url'
+import { detectTheme, isEmbedded, isAuthenticated, getProjectPassword, getProjectTabs } from '~/utils/server'
export const links: LinksFunction = () => [{ rel: 'stylesheet', href: ProjectViewStyle }]
diff --git a/web/app/routes/projects.new.tsx b/web/app/routes/projects.new.tsx
index 4c106e066..15d5429a6 100644
--- a/web/app/routes/projects.new.tsx
+++ b/web/app/routes/projects.new.tsx
@@ -1,6 +1,7 @@
-import NewProject from '~/pages/Project/New'
import type { SitemapFunction } from 'remix-sitemap'
+import NewProject from '~/pages/Project/New'
+
export const sitemap: SitemapFunction = () => ({
exclude: true,
})
diff --git a/web/app/routes/projects.settings.$id.tsx b/web/app/routes/projects.settings.$id.tsx
index 7ad05810d..add709021 100644
--- a/web/app/routes/projects.settings.$id.tsx
+++ b/web/app/routes/projects.settings.$id.tsx
@@ -1,4 +1,5 @@
import type { LoaderFunctionArgs } from 'react-router'
+
import ProjectSettings from '~/pages/Project/Settings'
export async function loader({ request }: LoaderFunctionArgs) {
diff --git a/web/app/routes/recovery.tsx b/web/app/routes/recovery.tsx
index 7a34116e5..dc2b887fc 100644
--- a/web/app/routes/recovery.tsx
+++ b/web/app/routes/recovery.tsx
@@ -1,7 +1,8 @@
-import ForgotPassword from '~/pages/Auth/ForgotPassword'
import type { HeadersFunction } from 'react-router'
import { redirect } from 'react-router'
+
import { isSelfhosted } from '~/lib/constants'
+import ForgotPassword from '~/pages/Auth/ForgotPassword'
export const headers: HeadersFunction = ({ parentHeaders }) => {
parentHeaders.set('X-Frame-Options', 'DENY')
diff --git a/web/app/routes/ref.$id.tsx b/web/app/routes/ref.$id.tsx
index 6b0d57624..5d8616254 100644
--- a/web/app/routes/ref.$id.tsx
+++ b/web/app/routes/ref.$id.tsx
@@ -1,8 +1,8 @@
import type { LoaderFunctionArgs } from 'react-router'
import { useLoaderData, redirect } from 'react-router'
-import ReferralPage from '~/pages/ReferralPage'
import { isSelfhosted } from '~/lib/constants'
+import ReferralPage from '~/pages/ReferralPage'
import { detectTheme } from '~/utils/server'
export async function loader({ request }: LoaderFunctionArgs) {
diff --git a/web/app/routes/reports-unsubscribe.$token.tsx b/web/app/routes/reports-unsubscribe.$token.tsx
index 000f5a573..82a955903 100644
--- a/web/app/routes/reports-unsubscribe.$token.tsx
+++ b/web/app/routes/reports-unsubscribe.$token.tsx
@@ -1,5 +1,6 @@
-import type { SitemapFunction } from 'remix-sitemap'
import { redirect } from 'react-router'
+import type { SitemapFunction } from 'remix-sitemap'
+
import { isSelfhosted } from '~/lib/constants'
import Unsubscribe from '~/pages/Unsubscribe'
diff --git a/web/app/routes/share.$id.tsx b/web/app/routes/share.$id.tsx
index 2f371a2f0..78eddd3bd 100644
--- a/web/app/routes/share.$id.tsx
+++ b/web/app/routes/share.$id.tsx
@@ -1,6 +1,7 @@
-import ConfirmShare from '~/pages/Project/ConfirmShare'
import type { SitemapFunction } from 'remix-sitemap'
+import ConfirmShare from '~/pages/Project/ConfirmShare'
+
export const sitemap: SitemapFunction = () => ({
exclude: true,
})
diff --git a/web/app/routes/signup.tsx b/web/app/routes/signup.tsx
index 5164bbe29..aa4fcfde5 100644
--- a/web/app/routes/signup.tsx
+++ b/web/app/routes/signup.tsx
@@ -1,9 +1,9 @@
-import Singup from '~/pages/Auth/Signup'
-import type { SitemapFunction } from 'remix-sitemap'
import type { HeadersFunction, LoaderFunctionArgs } from 'react-router'
import { useLoaderData, redirect } from 'react-router'
+import type { SitemapFunction } from 'remix-sitemap'
import { isSelfhosted } from '~/lib/constants'
+import Singup from '~/pages/Auth/Signup'
import { detectTheme } from '~/utils/server'
export const headers: HeadersFunction = ({ parentHeaders }) => {
diff --git a/web/app/routes/socialised.tsx b/web/app/routes/socialised.tsx
index 2cdee526f..3abb7d682 100644
--- a/web/app/routes/socialised.tsx
+++ b/web/app/routes/socialised.tsx
@@ -1,6 +1,7 @@
-import Socialised from '~/pages/Auth/Socialised'
import type { SitemapFunction } from 'remix-sitemap'
+import Socialised from '~/pages/Auth/Socialised'
+
export const sitemap: SitemapFunction = () => ({
exclude: true,
})
diff --git a/web/app/routes/terms.tsx b/web/app/routes/terms.tsx
index 4321d86ed..6437c71a5 100644
--- a/web/app/routes/terms.tsx
+++ b/web/app/routes/terms.tsx
@@ -1,6 +1,7 @@
-import Terms from '~/pages/Terms'
import type { SitemapFunction } from 'remix-sitemap'
+import Terms from '~/pages/Terms'
+
export const sitemap: SitemapFunction = () => ({
priority: 0.9,
changefreq: 'monthly',
diff --git a/web/app/routes/user-settings.tsx b/web/app/routes/user-settings.tsx
index ac8fc3e59..fde2163c8 100644
--- a/web/app/routes/user-settings.tsx
+++ b/web/app/routes/user-settings.tsx
@@ -1,6 +1,7 @@
-import UserSettings from '~/pages/UserSettings'
import type { SitemapFunction } from 'remix-sitemap'
+import UserSettings from '~/pages/UserSettings'
+
export const sitemap: SitemapFunction = () => ({
exclude: true,
})
diff --git a/web/app/routes/verify.$id.tsx b/web/app/routes/verify.$id.tsx
index ec27aec16..91a188e86 100644
--- a/web/app/routes/verify.$id.tsx
+++ b/web/app/routes/verify.$id.tsx
@@ -1,7 +1,8 @@
-import VerifyEmail from '~/pages/Auth/VerifyEmail'
-import type { SitemapFunction } from 'remix-sitemap'
import { redirect } from 'react-router'
+import type { SitemapFunction } from 'remix-sitemap'
+
import { isSelfhosted } from '~/lib/constants'
+import VerifyEmail from '~/pages/Auth/VerifyEmail'
export const sitemap: SitemapFunction = () => ({
exclude: true,
diff --git a/web/app/ui/Badge.tsx b/web/app/ui/Badge.tsx
index 73e06fc2f..7bbb5adb7 100644
--- a/web/app/ui/Badge.tsx
+++ b/web/app/ui/Badge.tsx
@@ -1,4 +1,3 @@
-import React from 'react'
import cx from 'clsx'
export interface BadgeProps {
diff --git a/web/app/ui/Beta.tsx b/web/app/ui/Beta.tsx
index f58b0e8f2..062a37fa5 100644
--- a/web/app/ui/Beta.tsx
+++ b/web/app/ui/Beta.tsx
@@ -1,8 +1,8 @@
-import React, { memo } from 'react'
+import { memo } from 'react'
import { useTranslation } from 'react-i18next'
-import Tooltip from './Tooltip'
import { Badge } from './Badge'
+import Tooltip from './Tooltip'
interface BetaProps {
className?: string
diff --git a/web/app/ui/Button.tsx b/web/app/ui/Button.tsx
index 594e8b8c7..b7a78ff05 100644
--- a/web/app/ui/Button.tsx
+++ b/web/app/ui/Button.tsx
@@ -1,7 +1,8 @@
/* eslint-disable react/button-has-type */
-import React, { memo } from 'react'
import { Button as HeadlessButton } from '@headlessui/react'
import cx from 'clsx'
+import React, { memo } from 'react'
+
import Spin from './icons/Spin'
interface ButtonProps extends React.ComponentPropsWithoutRef<typeof HeadlessButton> {
@@ -70,7 +71,7 @@ const Button = ({
className,
)}
>
- {loading && <Spin alwaysLight />}
+ {loading ? <Spin alwaysLight /> : null}
{text || children}
</HeadlessButton>
)
diff --git a/web/app/ui/Chart.tsx b/web/app/ui/Chart.tsx
index 11607e1de..baaf3d0e7 100644
--- a/web/app/ui/Chart.tsx
+++ b/web/app/ui/Chart.tsx
@@ -1,5 +1,5 @@
-import React, { useEffect } from 'react'
-import bb from 'billboard.js'
+import billboard from 'billboard.js'
+import { useEffect } from 'react'
import 'billboard.js/dist/theme/datalab.css?url'
import 'billboard.js/dist/billboard.css?url'
@@ -30,7 +30,7 @@ const Chart = ({ current, options }: ChartProps) => {
// Render the chart
const renderChart = () => {
if (current !== null) {
- chartInstance = bb.generate({
+ chartInstance = billboard.generate({
...options,
bindto: `#${current}`,
})
diff --git a/web/app/ui/Checkbox.tsx b/web/app/ui/Checkbox.tsx
index 7e2786710..575f6aed7 100644
--- a/web/app/ui/Checkbox.tsx
+++ b/web/app/ui/Checkbox.tsx
@@ -1,7 +1,7 @@
-import React, { memo } from 'react'
import { Checkbox as HeadlessCheckbox, Description, Field, Label } from '@headlessui/react'
import { CheckIcon } from '@heroicons/react/24/outline'
import cx from 'clsx'
+import React, { memo } from 'react'
interface CheckboxProps {
label: React.ReactNode
@@ -27,9 +27,9 @@ const Checkbox = ({ label, hint, name, className, onChange, checked, hintClassNa
</HeadlessCheckbox>
<Label className='cursor-pointer font-mono text-sm font-medium text-gray-900 dark:text-gray-200'>{label}</Label>
</div>
- {hint && (
+ {hint ? (
<Description className={cx('mt-1 text-sm text-gray-500 dark:text-gray-300', hintClassName)}>{hint}</Description>
- )}
+ ) : null}
</Field>
)
diff --git a/web/app/ui/Combobox.tsx b/web/app/ui/Combobox.tsx
index 70982a764..2cb6cc8d9 100644
--- a/web/app/ui/Combobox.tsx
+++ b/web/app/ui/Combobox.tsx
@@ -1,5 +1,3 @@
-import React, { Fragment, memo, useState } from 'react'
-import cx from 'clsx'
import {
Combobox as HeadlessCombobox,
Transition,
@@ -9,12 +7,14 @@ import {
ComboboxOption,
} from '@headlessui/react'
import { CheckIcon, ChevronUpDownIcon } from '@heroicons/react/24/solid'
-import { useTranslation } from 'react-i18next'
+import cx from 'clsx'
+import _filter from 'lodash/filter'
+import _includes from 'lodash/includes'
import _isEmpty from 'lodash/isEmpty'
import _map from 'lodash/map'
-import _filter from 'lodash/filter'
import _toLower from 'lodash/toLower'
-import _includes from 'lodash/includes'
+import { Fragment, memo, useState } from 'react'
+import { useTranslation } from 'react-i18next'
interface SelectProps {
title?: string
@@ -59,7 +59,7 @@ const Combobox = ({
'relative w-full cursor-default rounded-md border border-gray-300 bg-white py-2 pr-10 pl-3 text-left focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 focus:outline-hidden sm:text-sm dark:border-gray-800 dark:bg-slate-800 dark:text-gray-50',
buttonClassName,
)}
- // @ts-ignore
+ // @ts-expect-error
displayValue={(item) => (labelExtractor ? labelExtractor(item, 0) : item)}
onChange={(event) => setQuery(event.target.value)}
placeholder={placeholder}
diff --git a/web/app/ui/Dropdown.tsx b/web/app/ui/Dropdown.tsx
index 86d4450eb..73d477bf0 100644
--- a/web/app/ui/Dropdown.tsx
+++ b/web/app/ui/Dropdown.tsx
@@ -1,10 +1,11 @@
-import React, { memo, Fragment, Key } from 'react'
import { Menu, MenuButton, MenuItems, MenuItem, Transition } from '@headlessui/react'
-import { ChevronDownIcon } from '@heroicons/react/24/solid'
import { ChevronDownIcon as ChevronDownIconMini } from '@heroicons/react/20/solid'
+import { ChevronDownIcon } from '@heroicons/react/24/solid'
import cx from 'clsx'
-import _map from 'lodash/map'
import _isEmpty from 'lodash/isEmpty'
+import _map from 'lodash/map'
+import React, { memo, Fragment, Key } from 'react'
+
import Spin from './icons/Spin'
interface DropdownProps<T> {
@@ -50,7 +51,7 @@ function Dropdown<T>({
<Menu as='div' className={cx('relative inline-block text-left', className)}>
{({ open, close }) => (
<>
- {!_isEmpty(desc) && <p className='mb-2 text-sm text-gray-900'>{desc}</p>}
+ {!_isEmpty(desc) ? <p className='mb-2 text-sm text-gray-900'>{desc}</p> : null}
<MenuButton
onClick={onClick}
disabled={disabled}
@@ -65,7 +66,7 @@ function Dropdown<T>({
})}
>
{title}
- {chevron === 'regular' && (
+ {chevron === 'regular' ? (
<ChevronDownIcon
className={cx('-mr-1 ml-2 h-5 w-5 transform-gpu transition-transform', {
'group-hover:text-gray-500': headless,
@@ -73,8 +74,8 @@ function Dropdown<T>({
})}
aria-hidden='true'
/>
- )}
- {chevron === 'mini' && (
+ ) : null}
+ {chevron === 'mini' ? (
<ChevronDownIconMini
className={cx('-mr-1 ml-1 h-5 w-5 transform-gpu transition-transform', {
'group-hover:text-gray-500': headless,
@@ -82,7 +83,7 @@ function Dropdown<T>({
})}
aria-hidden='true'
/>
- )}
+ ) : null}
</MenuButton>
<Transition
diff --git a/web/app/ui/Flag.tsx b/web/app/ui/Flag.tsx
index 251ff268e..b0dcd3eb7 100644
--- a/web/app/ui/Flag.tsx
+++ b/web/app/ui/Flag.tsx
@@ -1,6 +1,6 @@
-import React from 'react'
-import _toLower from 'lodash/toLower'
import _includes from 'lodash/includes'
+import _toLower from 'lodash/toLower'
+import React from 'react'
interface FlagProps extends React.HTMLAttributes<HTMLImageElement> {
country: string
diff --git a/web/app/ui/Flatpicker.tsx b/web/app/ui/Flatpicker.tsx
index 034a730c5..6ce21f012 100644
--- a/web/app/ui/Flatpicker.tsx
+++ b/web/app/ui/Flatpicker.tsx
@@ -1,9 +1,9 @@
/* eslint-disable react/no-unused-class-component-methods, class-methods-use-this */
-import React, { memo, createRef } from 'react'
-import Flatpickr from 'react-flatpickr'
+import cx from 'clsx'
import _size from 'lodash/size'
import _split from 'lodash/split'
-import cx from 'clsx'
+import React, { memo, createRef } from 'react'
+import Flatpickr from 'react-flatpickr'
import { MAX_MONTHS_IN_PAST } from '~/lib/constants'
diff --git a/web/app/ui/Input.tsx b/web/app/ui/Input.tsx
index 2c3c78787..005f6007e 100644
--- a/web/app/ui/Input.tsx
+++ b/web/app/ui/Input.tsx
@@ -1,7 +1,8 @@
-import React, { memo } from 'react'
import { Description, Field, Input as HeadlessInput, Label } from '@headlessui/react'
import cx from 'clsx'
import _isEmpty from 'lodash/isEmpty'
+import React, { memo } from 'react'
+
import Beta from '~/ui/Beta'
interface InputProps {
@@ -38,11 +39,11 @@ const Input = ({
{label ? (
<Label className='mb-1 flex font-mono text-sm font-medium text-gray-900 dark:text-gray-200'>
{label}
- {isBeta && (
+ {isBeta ? (
<div className='ml-5'>
<Beta />
</div>
- )}
+ ) : null}
</Label>
) : null}
{hint && hintPosition === 'top' ? (
diff --git a/web/app/ui/Loader.tsx b/web/app/ui/Loader.tsx
index 1b725bc3d..28501bb27 100644
--- a/web/app/ui/Loader.tsx
+++ b/web/app/ui/Loader.tsx
@@ -1,4 +1,3 @@
-import React from 'react'
import Spin from './icons/Spin'
const Loader = () => (
diff --git a/web/app/ui/Modal.tsx b/web/app/ui/Modal.tsx
index 44827d851..5cf68937c 100644
--- a/web/app/ui/Modal.tsx
+++ b/web/app/ui/Modal.tsx
@@ -1,5 +1,3 @@
-import React, { Fragment, memo } from 'react'
-import cx from 'clsx'
import { Dialog, DialogPanel, DialogTitle, Transition, TransitionChild } from '@headlessui/react'
import {
CheckIcon,
@@ -8,7 +6,11 @@ import {
UserGroupIcon,
XMarkIcon,
} from '@heroicons/react/24/outline'
+import cx from 'clsx'
+import React, { Fragment, memo } from 'react'
+
import Beta from '~/ui/Beta'
+
import Spin from './icons/Spin'
interface ModalProps {
@@ -94,33 +96,33 @@ const Modal = ({
)}
>
<div className='sm:flex sm:items-start'>
- {type === 'success' && (
+ {type === 'success' ? (
<div className='mx-auto flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-green-100 sm:mr-3 sm:h-10 sm:w-10'>
<CheckIcon className='h-6 w-6 text-green-600' aria-hidden='true' />
</div>
- )}
- {type === 'error' && (
+ ) : null}
+ {type === 'error' ? (
<div className='mx-auto flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-red-100 sm:mr-3 sm:h-10 sm:w-10'>
<ExclamationTriangleIcon className='h-6 w-6 text-red-600' aria-hidden='true' />
</div>
- )}
- {type === 'info' && (
+ ) : null}
+ {type === 'info' ? (
<div className='mx-auto flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-blue-100 text-center sm:mr-3 sm:h-10 sm:w-10'>
<InformationCircleIcon className='h-6 w-6 text-blue-600' aria-hidden='true' />
</div>
- )}
- {type === 'warning' && (
+ ) : null}
+ {type === 'warning' ? (
<div className='mx-auto flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-orange-100 sm:mr-3 sm:h-10 sm:w-10'>
<ExclamationTriangleIcon className='h-6 w-6 text-amber-600' aria-hidden='true' />
</div>
- )}
- {type === 'confirmed' && (
+ ) : null}
+ {type === 'confirmed' ? (
<div className='mx-auto flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-green-100 sm:mr-3 sm:h-10 sm:w-10'>
<UserGroupIcon className='h-6 w-6 text-green-600' aria-hidden='true' />
</div>
- )}
+ ) : null}
<div className='mt-3 w-full text-center sm:mt-0 sm:text-left'>
- {title && (
+ {title ? (
<DialogTitle
as='h3'
className={cx('flex items-center text-lg leading-6 font-medium text-gray-900 dark:text-gray-50', {
@@ -130,9 +132,9 @@ const Modal = ({
>
<div>
{title}
- {isBeta && <Beta className='ml-10' />}
+ {isBeta ? <Beta className='ml-10' /> : null}
</div>
- {!closeText && (
+ {!closeText ? (
<XMarkIcon
className='size-6 cursor-pointer stroke-2 text-gray-700 hover:text-gray-500 dark:text-gray-200 dark:hover:text-gray-300'
onClick={(e) => {
@@ -141,15 +143,15 @@ const Modal = ({
onClose?.()
}}
/>
- )}
+ ) : null}
</DialogTitle>
- )}
+ ) : null}
<div className='mt-2 text-sm whitespace-pre-line text-gray-600 dark:text-gray-200'>{message}</div>
</div>
</div>
<div className='px-4 py-3 font-mono sm:flex sm:flex-row-reverse sm:px-0 sm:pb-0'>
{customButtons}
- {submitText && (
+ {submitText ? (
<button
type='button'
className={cx(
@@ -164,11 +166,11 @@ const Modal = ({
)}
onClick={onSubmit}
>
- {isLoading && <Spin alwaysLight />}
+ {isLoading ? <Spin alwaysLight /> : null}
{submitText}
</button>
- )}
- {closeText && (
+ ) : null}
+ {closeText ? (
<button
type='button'
className='mt-3 inline-flex w-full justify-center rounded-md border border-gray-300 bg-white px-4 py-2 text-base font-medium text-gray-700 hover:bg-gray-50 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm dark:border-none dark:border-gray-600 dark:bg-slate-800 dark:text-gray-50 dark:hover:border-gray-600 dark:hover:bg-gray-700'
@@ -180,7 +182,7 @@ const Modal = ({
>
{closeText}
</button>
- )}
+ ) : null}
</div>
</DialogPanel>
</TransitionChild>
diff --git a/web/app/ui/MultiProgress.tsx b/web/app/ui/MultiProgress.tsx
index 65eaacea4..fbda98341 100644
--- a/web/app/ui/MultiProgress.tsx
+++ b/web/app/ui/MultiProgress.tsx
@@ -1,6 +1,6 @@
-import React, { memo } from 'react'
import cx from 'clsx'
import _map from 'lodash/map'
+import { memo } from 'react'
interface Progress {
value: number
diff --git a/web/app/ui/MultiSelect.tsx b/web/app/ui/MultiSelect.tsx
index 7cc58b1a2..f59e5ce77 100644
--- a/web/app/ui/MultiSelect.tsx
+++ b/web/app/ui/MultiSelect.tsx
@@ -1,9 +1,9 @@
-import React, { useState } from 'react'
-import cx from 'clsx'
import { MagnifyingGlassIcon } from '@heroicons/react/24/outline'
-import _map from 'lodash/map'
+import cx from 'clsx'
import _includes from 'lodash/includes'
import _isEmpty from 'lodash/isEmpty'
+import _map from 'lodash/map'
+import { useState } from 'react'
interface MultiSelectProps {
className?: string
@@ -112,10 +112,10 @@ const MultiSelect = ({
</div>
</div>
</div>
- {selected && (
+ {selected ? (
<div className='lef-0 max-h-select top-100 z-40 max-h-[200px] w-full overflow-x-hidden overflow-y-auto rounded-sm bg-white dark:bg-slate-800'>
<div className='flex w-full flex-col'>
- {onSearch && (
+ {onSearch ? (
<div className='relative w-full cursor-pointer rounded-t border-b border-gray-100 hover:bg-indigo-100 dark:border-slate-700 dark:hover:bg-slate-700'>
<input
className='relative flex w-full items-center overflow-x-auto border-l-2 border-transparent bg-white p-2 pl-2 hover:border-b-indigo-100 focus:border-transparent focus:ring-0 focus:outline-hidden dark:bg-slate-800 dark:hover:border-b-slate-700'
@@ -132,7 +132,7 @@ const MultiSelect = ({
aria-hidden='true'
/>
</div>
- )}
+ ) : null}
{_map(items, (item) => (
<div
key={keyExtractor ? `${keyExtractor(item)}select` : `${item}select`}
@@ -155,10 +155,10 @@ const MultiSelect = ({
))}
</div>
</div>
- )}
+ ) : null}
</div>
</div>
- {hint && <p className='mt-2 text-sm whitespace-pre-line text-gray-500 dark:text-gray-300'>{hint}</p>}
+ {hint ? <p className='mt-2 text-sm whitespace-pre-line text-gray-500 dark:text-gray-300'>{hint}</p> : null}
</div>
)
}
diff --git a/web/app/ui/Pagination.tsx b/web/app/ui/Pagination.tsx
index 8d8fc5482..a73b1c21c 100644
--- a/web/app/ui/Pagination.tsx
+++ b/web/app/ui/Pagination.tsx
@@ -1,9 +1,11 @@
-import React, { memo } from 'react'
-import { ChevronLeftIcon, ChevronRightIcon } from 'lucide-react'
-import _map from 'lodash/map'
import cx from 'clsx'
+import _map from 'lodash/map'
+import { ChevronLeftIcon, ChevronRightIcon } from 'lucide-react'
+import { memo } from 'react'
import { Trans, useTranslation } from 'react-i18next'
+
import { usePagination, DOTS } from '~/hooks/usePagination'
+
import Select from './Select'
interface PaginationProps {
@@ -91,7 +93,7 @@ const Pagination = ({
</Trans>
</p>
<div className='flex items-center gap-4'>
- {pageSizeOptions && onPageSizeChange && (
+ {pageSizeOptions && onPageSizeChange ? (
<Select<string>
label={t('common.resultsPerPage')}
title={pageSize.toString()}
@@ -99,7 +101,7 @@ const Pagination = ({
onSelect={(item) => onPageSizeChange(Number(item))}
labelClassName='!overflow-visible'
/>
- )}
+ ) : null}
<nav className='isolate inline-flex -space-x-px rounded-md' aria-label='Pagination'>
<button
type='button'
diff --git a/web/app/ui/Progress.tsx b/web/app/ui/Progress.tsx
index caf779e1b..d7d081108 100644
--- a/web/app/ui/Progress.tsx
+++ b/web/app/ui/Progress.tsx
@@ -1,4 +1,4 @@
-import React, { memo } from 'react'
+import { memo } from 'react'
interface ProgressProps {
now: number
diff --git a/web/app/ui/Select.tsx b/web/app/ui/Select.tsx
index 906261767..ed73311be 100644
--- a/web/app/ui/Select.tsx
+++ b/web/app/ui/Select.tsx
@@ -1,5 +1,3 @@
-import React, { Fragment, Key, memo } from 'react'
-import cx from 'clsx'
import {
Listbox,
Transition,
@@ -10,7 +8,9 @@ import {
ListboxOption,
} from '@headlessui/react'
import { CheckIcon, ChevronUpDownIcon } from '@heroicons/react/24/solid'
+import cx from 'clsx'
import _map from 'lodash/map'
+import React, { Fragment, Key, memo } from 'react'
interface SelectProps<T> {
title?: string
@@ -110,13 +110,13 @@ function Select<T>({
{labelExtractor ? labelExtractor(item, index) : (item as React.ReactNode)}
</span>
- {iconExtractor && (
+ {iconExtractor ? (
<span className={cx('absolute inset-y-0 left-0 flex items-center pl-1.5')}>
{iconExtractor(item, index)}
</span>
- )}
+ ) : null}
- {selected && (
+ {selected ? (
<span
className={cx('absolute inset-y-0 left-0 flex items-center pl-1.5', {
'text-white': active,
@@ -125,7 +125,7 @@ function Select<T>({
>
<CheckIcon className='h-5 w-5' aria-hidden='true' />
</span>
- )}
+ ) : null}
</>
)}
</ListboxOption>
@@ -133,11 +133,11 @@ function Select<T>({
</ListboxOptions>
</Transition>
</div>
- {hint && (
+ {hint ? (
<Description className='mt-2 font-mono text-sm whitespace-pre-line text-gray-500 dark:text-gray-300'>
{hint}
</Description>
- )}
+ ) : null}
</>
)}
</Listbox>
diff --git a/web/app/ui/Textarea.tsx b/web/app/ui/Textarea.tsx
index 77183554f..3d706546b 100644
--- a/web/app/ui/Textarea.tsx
+++ b/web/app/ui/Textarea.tsx
@@ -1,7 +1,7 @@
-import React, { memo } from 'react'
import { Description, Field, Label, Textarea as HeadlessTextarea } from '@headlessui/react'
import cx from 'clsx'
import _isEmpty from 'lodash/isEmpty'
+import React, { memo } from 'react'
interface TextareaProps {
value: string | number
@@ -34,7 +34,7 @@ const Textarea = ({
return (
<Field as='div' className={cx('font-mono', className)}>
- {label && <Label className='flex text-sm font-medium text-gray-900 dark:text-gray-200'>{label}</Label>}
+ {label ? <Label className='flex text-sm font-medium text-gray-900 dark:text-gray-200'>{label}</Label> : null}
<HeadlessTextarea
rows={rows}
name={name}
@@ -53,10 +53,10 @@ const Textarea = ({
readOnly={readOnly}
invalid={isError}
/>
- {isError && <p className='mt-2 text-sm text-red-600 dark:text-red-500'>{error}</p>}
- {hint && (
+ {isError ? <p className='mt-2 text-sm text-red-600 dark:text-red-500'>{error}</p> : null}
+ {hint ? (
<Description className='mt-2 text-sm whitespace-pre-line text-gray-500 dark:text-gray-300'>{hint}</Description>
- )}
+ ) : null}
</Field>
)
}
diff --git a/web/app/ui/TimezonePicker.tsx b/web/app/ui/TimezonePicker.tsx
index a42feb986..0ae3bda08 100644
--- a/web/app/ui/TimezonePicker.tsx
+++ b/web/app/ui/TimezonePicker.tsx
@@ -1,10 +1,10 @@
-import React from 'react'
-import spacetime from 'spacetime'
-import soft from 'timezone-soft'
-import { useTranslation } from 'react-i18next'
import _find from 'lodash/find'
-import _reduce from 'lodash/reduce'
import _includes from 'lodash/includes'
+import _reduce from 'lodash/reduce'
+import { useTranslation } from 'react-i18next'
+import spacetime from 'spacetime'
+import soft from 'timezone-soft'
+
import timezones from '~/lib/constants/timezones'
import Select from './Select'
diff --git a/web/app/ui/Tooltip.tsx b/web/app/ui/Tooltip.tsx
index 31c54dcb6..b7e458fa3 100644
--- a/web/app/ui/Tooltip.tsx
+++ b/web/app/ui/Tooltip.tsx
@@ -1,7 +1,7 @@
-import { CircleHelpIcon } from 'lucide-react'
-import React, { forwardRef, memo } from 'react'
import * as TooltipPrimitive from '@radix-ui/react-tooltip'
import cx from 'clsx'
+import { CircleHelpIcon } from 'lucide-react'
+import React, { forwardRef, memo } from 'react'
const TooltipProvider = TooltipPrimitive.Provider
diff --git a/web/app/ui/icons/BackgroundSvg.tsx b/web/app/ui/icons/BackgroundSvg.tsx
index 0be36b934..6ef6b6c7a 100644
--- a/web/app/ui/icons/BackgroundSvg.tsx
+++ b/web/app/ui/icons/BackgroundSvg.tsx
@@ -1,5 +1,5 @@
-import React from 'react'
import cx from 'clsx'
+import React from 'react'
interface BackgroundSvgProps {
className?: string
diff --git a/web/app/ui/icons/BarChart.tsx b/web/app/ui/icons/BarChart.tsx
index 38bc20d75..b742322b6 100644
--- a/web/app/ui/icons/BarChart.tsx
+++ b/web/app/ui/icons/BarChart.tsx
@@ -1,4 +1,3 @@
-import React from 'react'
import cx from 'clsx'
interface BarChartProps {
diff --git a/web/app/ui/icons/Discord.tsx b/web/app/ui/icons/Discord.tsx
index a378779b1..daf7f8e30 100644
--- a/web/app/ui/icons/Discord.tsx
+++ b/web/app/ui/icons/Discord.tsx
@@ -1,5 +1,3 @@
-import React from 'react'
-
const Discord = ({ className }: { className?: string }) => (
<svg className={className} viewBox='0 0 127.14 96.36'>
<title>Discord</title>
diff --git a/web/app/ui/icons/GithubDark.tsx b/web/app/ui/icons/GithubDark.tsx
index 8fd01ebd8..d3c400393 100644
--- a/web/app/ui/icons/GithubDark.tsx
+++ b/web/app/ui/icons/GithubDark.tsx
@@ -1,5 +1,3 @@
-import React from 'react'
-
const GithubDarkSVG = ({ className }: { className?: string }) => (
<svg className={className} viewBox='0 0 100 100'>
<path
diff --git a/web/app/ui/icons/GithubLight.tsx b/web/app/ui/icons/GithubLight.tsx
index e228bac5c..3f43818d5 100644
--- a/web/app/ui/icons/GithubLight.tsx
+++ b/web/app/ui/icons/GithubLight.tsx
@@ -1,5 +1,3 @@
-import React from 'react'
-
const GithubLightSVG = ({ className }: { className?: string }) => (
<svg className={className} viewBox='0 0 100 100'>
<path
diff --git a/web/app/ui/icons/GoogleG.tsx b/web/app/ui/icons/GoogleG.tsx
index a1685e33e..0fb101dcf 100644
--- a/web/app/ui/icons/GoogleG.tsx
+++ b/web/app/ui/icons/GoogleG.tsx
@@ -1,5 +1,3 @@
-import React from 'react'
-
const GoogleGSVG = ({ className }: { className?: string }) => (
<svg className={className} viewBox='0 0 186.69 190.5'>
<g transform='translate(1184.583 765.171)'>
diff --git a/web/app/ui/icons/LineChart.tsx b/web/app/ui/icons/LineChart.tsx
index dcd2da5f1..884fb5daf 100644
--- a/web/app/ui/icons/LineChart.tsx
+++ b/web/app/ui/icons/LineChart.tsx
@@ -1,4 +1,3 @@
-import React from 'react'
import cx from 'clsx'
interface LineChartProps {
diff --git a/web/app/ui/icons/LinkedIn.tsx b/web/app/ui/icons/LinkedIn.tsx
index 0027a8d10..b529a3c12 100644
--- a/web/app/ui/icons/LinkedIn.tsx
+++ b/web/app/ui/icons/LinkedIn.tsx
@@ -1,5 +1,3 @@
-import React from 'react'
-
const LinkedIn = ({ className }: { className?: string }) => (
<svg fill='currentColor' viewBox='0 0 24 24' className={className}>
<title>LinkedIn</title>
diff --git a/web/app/ui/icons/PulsatingCircle.tsx b/web/app/ui/icons/PulsatingCircle.tsx
index a38e6ffb3..08196b00b 100644
--- a/web/app/ui/icons/PulsatingCircle.tsx
+++ b/web/app/ui/icons/PulsatingCircle.tsx
@@ -1,4 +1,3 @@
-import React from 'react'
import cx from 'clsx'
const types = {
diff --git a/web/app/ui/icons/Slack.tsx b/web/app/ui/icons/Slack.tsx
index 0f588d56c..bbf366515 100644
--- a/web/app/ui/icons/Slack.tsx
+++ b/web/app/ui/icons/Slack.tsx
@@ -1,5 +1,3 @@
-import React from 'react'
-
const Slack = ({ className }: { className?: string }) => (
<svg className={className} viewBox='0 0 127 127'>
<title>Slack</title>
diff --git a/web/app/ui/icons/Sort.tsx b/web/app/ui/icons/Sort.tsx
index a99b0d942..794a0a906 100644
--- a/web/app/ui/icons/Sort.tsx
+++ b/web/app/ui/icons/Sort.tsx
@@ -1,4 +1,3 @@
-import React from 'react'
import { ChevronUpDownIcon, ChevronUpIcon, ChevronDownIcon } from '@heroicons/react/24/outline'
import cx from 'clsx'
diff --git a/web/app/ui/icons/Spin.tsx b/web/app/ui/icons/Spin.tsx
index 6193847fc..7d8dcd2b6 100644
--- a/web/app/ui/icons/Spin.tsx
+++ b/web/app/ui/icons/Spin.tsx
@@ -1,4 +1,3 @@
-import React from 'react'
import cx from 'clsx'
interface SpinProps {
diff --git a/web/app/ui/icons/SwetrixLogo.tsx b/web/app/ui/icons/SwetrixLogo.tsx
index a9263d1e5..48fcd28a3 100644
--- a/web/app/ui/icons/SwetrixLogo.tsx
+++ b/web/app/ui/icons/SwetrixLogo.tsx
@@ -1,8 +1,8 @@
-import React from 'react'
import cx from 'clsx'
-import { isSelfhosted } from '~/lib/constants'
import { useTranslation } from 'react-i18next'
+import { isSelfhosted } from '~/lib/constants'
+
interface SwetrixLogoProps {
className?: string
theme?: 'dark' | 'light'
diff --git a/web/app/ui/icons/Telegram.tsx b/web/app/ui/icons/Telegram.tsx
index d621e1215..670da25d4 100644
--- a/web/app/ui/icons/Telegram.tsx
+++ b/web/app/ui/icons/Telegram.tsx
@@ -1,5 +1,3 @@
-import React from 'react'
-
const Telegram = ({ className }: { className?: string }) => (
<svg className={className} viewBox='0 0 1000 1000'>
<title>Telegram</title>
diff --git a/web/app/utils/accessToken.ts b/web/app/utils/accessToken.ts
index 2b7f63b31..456438658 100644
--- a/web/app/utils/accessToken.ts
+++ b/web/app/utils/accessToken.ts
@@ -1,5 +1,7 @@
import _isEmpty from 'lodash/isEmpty'
+
import { TOKEN, isBrowser } from '~/lib/constants'
+
import { getCookie, setCookie, deleteCookie } from './cookie'
// 14 weeks in seconds
diff --git a/web/app/utils/analytics.ts b/web/app/utils/analytics.ts
index 8b50d622b..69ba6357a 100644
--- a/web/app/utils/analytics.ts
+++ b/web/app/utils/analytics.ts
@@ -1,5 +1,6 @@
-import * as Swetrix from 'swetrix'
import _includes from 'lodash/includes'
+import * as Swetrix from 'swetrix'
+
import { isDevelopment, isSelfhosted } from '~/lib/constants'
const SWETRIX_PID = 'STEzHcB1rALV'
diff --git a/web/app/utils/auth.ts b/web/app/utils/auth.ts
index 0251ff8a0..78d39b840 100644
--- a/web/app/utils/auth.ts
+++ b/web/app/utils/auth.ts
@@ -1,3 +1,4 @@
+import { logoutAllApi, logoutApi } from '~/api'
import {
isSelfhosted,
LOW_EVENTS_WARNING,
@@ -5,11 +6,11 @@ import {
LS_VIEW_PREFS_SETTING,
SHOW_BANNER_AT_PERC,
} from '~/lib/constants'
-import { logoutAllApi, logoutApi } from '~/api'
-import { getCookie } from './cookie'
-import { getRefreshToken, removeRefreshToken } from './refreshToken'
+
import { removeAccessToken } from './accessToken'
+import { getCookie } from './cookie'
import { removeItem } from './localstorage'
+import { getRefreshToken, removeRefreshToken } from './refreshToken'
export const shouldShowLowEventsBanner = (totalMonthlyEvents: number, maxEventsCount: number) => {
if (isSelfhosted) {
diff --git a/web/app/utils/date.ts b/web/app/utils/date.ts
index 205f5544a..83a8b66ea 100644
--- a/web/app/utils/date.ts
+++ b/web/app/utils/date.ts
@@ -10,17 +10,17 @@ const DIVISIONS = [
{ amount: Number.POSITIVE_INFINITY, name: 'years' },
]
-// @ts-ignore
+// @ts-expect-error
const formatTimeAgo = (date, language?: string) => {
const rtf = new Intl.RelativeTimeFormat(language)
- // @ts-ignore
+ // @ts-expect-error
let duration = (date - new Date()) / 1000
for (let i = 0; i < DIVISIONS.length; i++) {
const division = DIVISIONS[i]
if (Math.abs(duration) < division.amount) {
- // @ts-ignore
+ // @ts-expect-error
return rtf.format(Math.round(duration), division.name)
}
duration /= division.amount
diff --git a/web/app/utils/generic.ts b/web/app/utils/generic.ts
index 6d22ae3e1..326f8911e 100644
--- a/web/app/utils/generic.ts
+++ b/web/app/utils/generic.ts
@@ -1,8 +1,8 @@
import _find from 'lodash/find'
-import _replace from 'lodash/replace'
-import _round from 'lodash/round'
import _map from 'lodash/map'
import _reduce from 'lodash/reduce'
+import _replace from 'lodash/replace'
+import _round from 'lodash/round'
import { isBrowser } from '~/lib/constants'
@@ -129,7 +129,7 @@ export const getLocaleDisplayName = (locale: string, language: string): string =
try {
return languageNames.of(locale) || locale
- } catch (reason) {
+ } catch {
return locale
}
}
diff --git a/web/app/utils/getPosts.ts b/web/app/utils/getPosts.ts
index 715463b63..4e41fa246 100644
--- a/web/app/utils/getPosts.ts
+++ b/web/app/utils/getPosts.ts
@@ -1,5 +1,6 @@
-import { marked, type Tokens } from 'marked'
import _isEmpty from 'lodash/isEmpty'
+import { marked, type Tokens } from 'marked'
+
import { getBlogPost, getBlogPostWithCategory } from '~/api'
const renderer = new marked.Renderer()
diff --git a/web/app/utils/isoCountries.ts b/web/app/utils/isoCountries.ts
index 59543e9c4..49e2a5722 100644
--- a/web/app/utils/isoCountries.ts
+++ b/web/app/utils/isoCountries.ts
@@ -1,8 +1,8 @@
import countries from 'i18n-iso-countries'
-import countriesEn from 'i18n-iso-countries/langs/en.json'
import countriesDe from 'i18n-iso-countries/langs/de.json'
-import countriesUk from 'i18n-iso-countries/langs/uk.json'
+import countriesEn from 'i18n-iso-countries/langs/en.json'
import countriesPl from 'i18n-iso-countries/langs/pl.json'
+import countriesUk from 'i18n-iso-countries/langs/uk.json'
countries.registerLocale(countriesEn)
countries.registerLocale(countriesUk)
diff --git a/web/app/utils/localstorage.ts b/web/app/utils/localstorage.ts
index eaffeea22..bc27e498c 100644
--- a/web/app/utils/localstorage.ts
+++ b/web/app/utils/localstorage.ts
@@ -7,7 +7,7 @@ import { isBrowser } from '~/lib/constants'
* how any localStorage item was modified after first access
*/
-type currentLocalStorageType = { [key: string]: string | null }
+type currentLocalStorageType = Record<string, string | null>
const currentLocalStorage: currentLocalStorageType = {}
type setItemType = (key: string, value: string) => void
diff --git a/web/app/utils/refreshToken.ts b/web/app/utils/refreshToken.ts
index 2d0774e87..24d600849 100644
--- a/web/app/utils/refreshToken.ts
+++ b/web/app/utils/refreshToken.ts
@@ -1,6 +1,7 @@
import _isEmpty from 'lodash/isEmpty'
import { REFRESH_TOKEN, isBrowser } from '~/lib/constants'
+
import { getCookie, setCookie, deleteCookie } from './cookie'
// 14 weeks in seconds
@@ -20,7 +21,7 @@ export const getRefreshToken = () => {
return refreshToken
}
-export const setRefreshToken = (token: string, temporary: boolean = false) => {
+export const setRefreshToken = (token: string, temporary = false) => {
if (!isBrowser) {
return null
}
diff --git a/web/app/utils/server.ts b/web/app/utils/server.ts
index 132ab60d1..dadffdd46 100644
--- a/web/app/utils/server.ts
+++ b/web/app/utils/server.ts
@@ -1,9 +1,10 @@
import type i18next from 'i18next'
-import routes from '~/utils/routes'
import _includes from 'lodash/includes'
import _split from 'lodash/split'
import _startsWith from 'lodash/startsWith'
+
import { TITLE_SUFFIX, SUPPORTED_THEMES, ThemeType } from '~/lib/constants'
+import routes from '~/utils/routes'
/**
* Function detects theme based on user's browser hints and cookies
diff --git a/web/package-lock.json b/web/package-lock.json
index 369cddd07..ed8ef4715 100644
--- a/web/package-lock.json
+++ b/web/package-lock.json
@@ -62,6 +62,7 @@
"@react-router/dev": "^7.1.5",
"@tailwindcss/forms": "^0.5.10",
"@tailwindcss/typography": "^0.5.16",
+ "@types/d3": "^7.4.3",
"@types/eslint": "^9.6.1",
"@types/file-saver": "^2.0.7",
"@types/lodash": "^4.17.15",
@@ -82,10 +83,10 @@
"eslint-plugin-jest": "^28.9.0",
"eslint-plugin-jest-dom": "^5.5.0",
"eslint-plugin-jsx-a11y": "^6.10.2",
- "eslint-plugin-markdown": "^5.1.0",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-testing-library": "^7.0.0",
+ "eslint-plugin-unused-imports": "^4.1.4",
"knip": "^5.43.6",
"prettier": "^3.4.2",
"tailwindcss": "^4.0.5",
@@ -2315,18 +2316,212 @@
"version": "0.6.0",
"license": "MIT"
},
+ "node_modules/@types/d3": {
+ "version": "7.4.3",
+ "resolved": "https://registry.npmjs.org/@types/d3/-/d3-7.4.3.tgz",
+ "integrity": "sha512-lZXZ9ckh5R8uiFVt8ogUNf+pIrK4EsWrx2Np75WvF/eTpJ0FMHNhjXk8CKEx/+gpHbNQyJWehbFaTvqmHWB3ww==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/d3-array": "*",
+ "@types/d3-axis": "*",
+ "@types/d3-brush": "*",
+ "@types/d3-chord": "*",
+ "@types/d3-color": "*",
+ "@types/d3-contour": "*",
+ "@types/d3-delaunay": "*",
+ "@types/d3-dispatch": "*",
+ "@types/d3-drag": "*",
+ "@types/d3-dsv": "*",
+ "@types/d3-ease": "*",
+ "@types/d3-fetch": "*",
+ "@types/d3-force": "*",
+ "@types/d3-format": "*",
+ "@types/d3-geo": "*",
+ "@types/d3-hierarchy": "*",
+ "@types/d3-interpolate": "*",
+ "@types/d3-path": "*",
+ "@types/d3-polygon": "*",
+ "@types/d3-quadtree": "*",
+ "@types/d3-random": "*",
+ "@types/d3-scale": "*",
+ "@types/d3-scale-chromatic": "*",
+ "@types/d3-selection": "*",
+ "@types/d3-shape": "*",
+ "@types/d3-time": "*",
+ "@types/d3-time-format": "*",
+ "@types/d3-timer": "*",
+ "@types/d3-transition": "*",
+ "@types/d3-zoom": "*"
+ }
+ },
+ "node_modules/@types/d3-array": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/@types/d3-array/-/d3-array-3.2.1.tgz",
+ "integrity": "sha512-Y2Jn2idRrLzUfAKV2LyRImR+y4oa2AntrgID95SHJxuMUrkNXmanDSed71sRNZysveJVt1hLLemQZIady0FpEg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/d3-axis": {
+ "version": "3.0.6",
+ "resolved": "https://registry.npmjs.org/@types/d3-axis/-/d3-axis-3.0.6.tgz",
+ "integrity": "sha512-pYeijfZuBd87T0hGn0FO1vQ/cgLk6E1ALJjfkC0oJ8cbwkZl3TpgS8bVBLZN+2jjGgg38epgxb2zmoGtSfvgMw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/d3-selection": "*"
+ }
+ },
+ "node_modules/@types/d3-brush": {
+ "version": "3.0.6",
+ "resolved": "https://registry.npmjs.org/@types/d3-brush/-/d3-brush-3.0.6.tgz",
+ "integrity": "sha512-nH60IZNNxEcrh6L1ZSMNA28rj27ut/2ZmI3r96Zd+1jrZD++zD3LsMIjWlvg4AYrHn/Pqz4CF3veCxGjtbqt7A==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/d3-selection": "*"
+ }
+ },
+ "node_modules/@types/d3-chord": {
+ "version": "3.0.6",
+ "resolved": "https://registry.npmjs.org/@types/d3-chord/-/d3-chord-3.0.6.tgz",
+ "integrity": "sha512-LFYWWd8nwfwEmTZG9PfQxd17HbNPksHBiJHaKuY1XeqscXacsS2tyoo6OdRsjf+NQYeB6XrNL3a25E3gH69lcg==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/@types/d3-color": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/@types/d3-color/-/d3-color-3.1.3.tgz",
"integrity": "sha512-iO90scth9WAbmgv7ogoq57O9YpKmFBbmoEoCHDB2xMBY0+/KVrqAaCDyCE16dUspeOvIxFFRI+0sEtqDqy2b4A==",
"license": "MIT"
},
+ "node_modules/@types/d3-contour": {
+ "version": "3.0.6",
+ "resolved": "https://registry.npmjs.org/@types/d3-contour/-/d3-contour-3.0.6.tgz",
+ "integrity": "sha512-BjzLgXGnCWjUSYGfH1cpdo41/hgdWETu4YxpezoztawmqsvCeep+8QGfiY6YbDvfgHz/DkjeIkkZVJavB4a3rg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/d3-array": "*",
+ "@types/geojson": "*"
+ }
+ },
+ "node_modules/@types/d3-delaunay": {
+ "version": "6.0.4",
+ "resolved": "https://registry.npmjs.org/@types/d3-delaunay/-/d3-delaunay-6.0.4.tgz",
+ "integrity": "sha512-ZMaSKu4THYCU6sV64Lhg6qjf1orxBthaC161plr5KuPHo3CNm8DTHiLw/5Eq2b6TsNP0W0iJrUOFscY6Q450Hw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/d3-dispatch": {
+ "version": "3.0.6",
+ "resolved": "https://registry.npmjs.org/@types/d3-dispatch/-/d3-dispatch-3.0.6.tgz",
+ "integrity": "sha512-4fvZhzMeeuBJYZXRXrRIQnvUYfyXwYmLsdiN7XXmVNQKKw1cM8a5WdID0g1hVFZDqT9ZqZEY5pD44p24VS7iZQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/d3-drag": {
+ "version": "3.0.7",
+ "resolved": "https://registry.npmjs.org/@types/d3-drag/-/d3-drag-3.0.7.tgz",
+ "integrity": "sha512-HE3jVKlzU9AaMazNufooRJ5ZpWmLIoc90A37WU2JMmeq28w1FQqCZswHZ3xR+SuxYftzHq6WU6KJHvqxKzTxxQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/d3-selection": "*"
+ }
+ },
+ "node_modules/@types/d3-dsv": {
+ "version": "3.0.7",
+ "resolved": "https://registry.npmjs.org/@types/d3-dsv/-/d3-dsv-3.0.7.tgz",
+ "integrity": "sha512-n6QBF9/+XASqcKK6waudgL0pf/S5XHPPI8APyMLLUHd8NqouBGLsU8MgtO7NINGtPBtk9Kko/W4ea0oAspwh9g==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/d3-ease": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/@types/d3-ease/-/d3-ease-3.0.2.tgz",
+ "integrity": "sha512-NcV1JjO5oDzoK26oMzbILE6HW7uVXOHLQvHshBUW4UMdZGfiY6v5BeQwh9a9tCzv+CeefZQHJt5SRgK154RtiA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/d3-fetch": {
+ "version": "3.0.7",
+ "resolved": "https://registry.npmjs.org/@types/d3-fetch/-/d3-fetch-3.0.7.tgz",
+ "integrity": "sha512-fTAfNmxSb9SOWNB9IoG5c8Hg6R+AzUHDRlsXsDZsNp6sxAEOP0tkP3gKkNSO/qmHPoBFTxNrjDprVHDQDvo5aA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/d3-dsv": "*"
+ }
+ },
+ "node_modules/@types/d3-force": {
+ "version": "3.0.10",
+ "resolved": "https://registry.npmjs.org/@types/d3-force/-/d3-force-3.0.10.tgz",
+ "integrity": "sha512-ZYeSaCF3p73RdOKcjj+swRlZfnYpK1EbaDiYICEEp5Q6sUiqFaFQ9qgoshp5CzIyyb/yD09kD9o2zEltCexlgw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/d3-format": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/@types/d3-format/-/d3-format-3.0.4.tgz",
+ "integrity": "sha512-fALi2aI6shfg7vM5KiR1wNJnZ7r6UuggVqtDA+xiEdPZQwy/trcQaHnwShLuLdta2rTymCNpxYTiMZX/e09F4g==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/d3-geo": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/@types/d3-geo/-/d3-geo-3.1.0.tgz",
+ "integrity": "sha512-856sckF0oP/diXtS4jNsiQw/UuK5fQG8l/a9VVLeSouf1/PPbBE1i1W852zVwKwYCBkFJJB7nCFTbk6UMEXBOQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/geojson": "*"
+ }
+ },
+ "node_modules/@types/d3-hierarchy": {
+ "version": "3.1.7",
+ "resolved": "https://registry.npmjs.org/@types/d3-hierarchy/-/d3-hierarchy-3.1.7.tgz",
+ "integrity": "sha512-tJFtNoYBtRtkNysX1Xq4sxtjK8YgoWUNpIiUee0/jHGRwqvzYxkq0hGVbbOGSz+JgFxxRu4K8nb3YpG3CMARtg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/d3-interpolate": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/@types/d3-interpolate/-/d3-interpolate-3.0.4.tgz",
+ "integrity": "sha512-mgLPETlrpVV1YRJIglr4Ez47g7Yxjl1lj7YKsiMCb27VJH9W8NVM6Bb9d8kkpG/uAQS5AmbA48q2IAolKKo1MA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/d3-color": "*"
+ }
+ },
"node_modules/@types/d3-path": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/@types/d3-path/-/d3-path-3.1.0.tgz",
"integrity": "sha512-P2dlU/q51fkOc/Gfl3Ul9kicV7l+ra934qBFXCFhrZMOL6du1TM0pm1ThYvENukyOn5h9v+yMJ9Fn5JK4QozrQ==",
"license": "MIT"
},
+ "node_modules/@types/d3-polygon": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/@types/d3-polygon/-/d3-polygon-3.0.2.tgz",
+ "integrity": "sha512-ZuWOtMaHCkN9xoeEMr1ubW2nGWsp4nIql+OPQRstu4ypeZ+zk3YKqQT0CXVe/PYqrKpZAi+J9mTs05TKwjXSRA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/d3-quadtree": {
+ "version": "3.0.6",
+ "resolved": "https://registry.npmjs.org/@types/d3-quadtree/-/d3-quadtree-3.0.6.tgz",
+ "integrity": "sha512-oUzyO1/Zm6rsxKRHA1vH0NEDG58HrT5icx/azi9MF1TWdtttWl0UIUsjEQBBh+SIkrpd21ZjEv7ptxWys1ncsg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/d3-random": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/@types/d3-random/-/d3-random-3.0.3.tgz",
+ "integrity": "sha512-Imagg1vJ3y76Y2ea0871wpabqp613+8/r0mCLEBfdtqC7xMSfj9idOnmBYyMoULfHePJyxMAw3nWhJxzc+LFwQ==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/@types/d3-sankey": {
"version": "0.11.2",
"license": "MIT",
@@ -2379,6 +2574,20 @@
"integrity": "sha512-yuzZug1nkAAaBlBBikKZTgzCeA+k1uy4ZFwWANOfKw5z5LRhV0gNA7gNkKm7HoK+HRN0wX3EkxGk0fpbWhmB7g==",
"license": "MIT"
},
+ "node_modules/@types/d3-time-format": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/@types/d3-time-format/-/d3-time-format-4.0.3.tgz",
+ "integrity": "sha512-5xg9rC+wWL8kdDj153qZcsJ0FWiFt0J5RB6LYUNZjwSnesfblqrI/bJ1wBdJ8OQfncgbJG5+2F+qfqnqyzYxyg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/d3-timer": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/@types/d3-timer/-/d3-timer-3.0.2.tgz",
+ "integrity": "sha512-Ps3T8E8dZDam6fUyNiMkekK3XUsaUEik+idO9/YjPtfj2qruF8tFBXS7XhtE4iIXBLxhmLjP3SXpLhVf21I9Lw==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/@types/d3-transition": {
"version": "3.0.9",
"license": "MIT",
@@ -2386,6 +2595,17 @@
"@types/d3-selection": "*"
}
},
+ "node_modules/@types/d3-zoom": {
+ "version": "3.0.8",
+ "resolved": "https://registry.npmjs.org/@types/d3-zoom/-/d3-zoom-3.0.8.tgz",
+ "integrity": "sha512-iqMC4/YlFCSlO8+2Ii1GGGliCAY4XdeG748w5vQUbevlbDu0zSjH/+jojorQVBK/se0j6DUFNPBGSqD3YWYnDw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/d3-interpolate": "*",
+ "@types/d3-selection": "*"
+ }
+ },
"node_modules/@types/eslint": {
"version": "9.6.1",
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-9.6.1.tgz",
@@ -2408,6 +2628,13 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/@types/geojson": {
+ "version": "7946.0.16",
+ "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.16.tgz",
+ "integrity": "sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/@types/json-schema": {
"version": "7.0.15",
"dev": true,
@@ -2425,16 +2652,6 @@
"dev": true,
"license": "MIT"
},
- "node_modules/@types/mdast": {
- "version": "3.0.15",
- "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-3.0.15.tgz",
- "integrity": "sha512-LnwD+mUEfxWMa1QpDraczIn6k0Ee3SMicuYSSzS6ZYl2gKS09EClnJYGd8Du6rfc5r/GZEk5o1mRb8TaTj03sQ==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@types/unist": "^2"
- }
- },
"node_modules/@types/node": {
"version": "22.13.1",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.1.tgz",
@@ -2489,13 +2706,6 @@
"version": "0.7.39",
"license": "MIT"
},
- "node_modules/@types/unist": {
- "version": "2.0.11",
- "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.11.tgz",
- "integrity": "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==",
- "dev": true,
- "license": "MIT"
- },
"node_modules/@types/use-sync-external-store": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/@types/use-sync-external-store/-/use-sync-external-store-0.0.6.tgz",
@@ -3455,39 +3665,6 @@
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
- "node_modules/character-entities": {
- "version": "1.2.4",
- "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-1.2.4.tgz",
- "integrity": "sha512-iBMyeEHxfVnIakwOuDXpVkc54HijNgCyQB2w0VfGQThle6NXn50zU6V/u+LDhxHcDUPojn6Kpga3PTAD8W1bQw==",
- "dev": true,
- "license": "MIT",
- "funding": {
- "type": "github",
- "url": "https://github.com/sponsors/wooorm"
- }
- },
- "node_modules/character-entities-legacy": {
- "version": "1.1.4",
- "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-1.1.4.tgz",
- "integrity": "sha512-3Xnr+7ZFS1uxeiUDvV02wQ+QDbc55o97tIV5zHScSPJpcLm/r0DFPcoY3tYRp+VZukxuMeKgXYmsXQHO05zQeA==",
- "dev": true,
- "license": "MIT",
- "funding": {
- "type": "github",
- "url": "https://github.com/sponsors/wooorm"
- }
- },
- "node_modules/character-reference-invalid": {
- "version": "1.1.4",
- "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-1.1.4.tgz",
- "integrity": "sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg==",
- "dev": true,
- "license": "MIT",
- "funding": {
- "type": "github",
- "url": "https://github.com/sponsors/wooorm"
- }
- },
"node_modules/clean-stack": {
"version": "2.2.0",
"dev": true,
@@ -5104,22 +5281,6 @@
"dev": true,
"license": "MIT"
},
- "node_modules/eslint-plugin-markdown": {
- "version": "5.1.0",
- "resolved": "https://registry.npmjs.org/eslint-plugin-markdown/-/eslint-plugin-markdown-5.1.0.tgz",
- "integrity": "sha512-SJeyKko1K6GwI0AN6xeCDToXDkfKZfXcexA6B+O2Wr2btUS9GrC+YgwSyVli5DJnctUHjFXcQ2cqTaAmVoLi2A==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "mdast-util-from-markdown": "^0.8.5"
- },
- "engines": {
- "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
- },
- "peerDependencies": {
- "eslint": ">=8"
- }
- },
"node_modules/eslint-plugin-react": {
"version": "7.37.4",
"resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.37.4.tgz",
@@ -5264,6 +5425,22 @@
"typescript": ">=4.8.4 <5.8.0"
}
},
+ "node_modules/eslint-plugin-unused-imports": {
+ "version": "4.1.4",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-unused-imports/-/eslint-plugin-unused-imports-4.1.4.tgz",
+ "integrity": "sha512-YptD6IzQjDardkl0POxnnRBhU1OEePMV0nd6siHaRBbd+lyh6NAhFEobiznKU7kTsSsDeSD62Pe7kAM1b7dAZQ==",
+ "dev": true,
+ "license": "MIT",
+ "peerDependencies": {
+ "@typescript-eslint/eslint-plugin": "^8.0.0-0 || ^7.0.0 || ^6.0.0 || ^5.0.0",
+ "eslint": "^9.0.0 || ^8.0.0"
+ },
+ "peerDependenciesMeta": {
+ "@typescript-eslint/eslint-plugin": {
+ "optional": true
+ }
+ }
+ },
"node_modules/eslint-visitor-keys": {
"version": "3.4.3",
"dev": true,
@@ -6282,32 +6459,6 @@
"node": ">= 0.10"
}
},
- "node_modules/is-alphabetical": {
- "version": "1.0.4",
- "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-1.0.4.tgz",
- "integrity": "sha512-DwzsA04LQ10FHTZuL0/grVDk4rFoVH1pjAToYwBrHSxcrBIGQuXrQMtD5U1b0U2XVgKZCTLLP8u2Qxqhy3l2Vg==",
- "dev": true,
- "license": "MIT",
- "funding": {
- "type": "github",
- "url": "https://github.com/sponsors/wooorm"
- }
- },
- "node_modules/is-alphanumerical": {
- "version": "1.0.4",
- "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-1.0.4.tgz",
- "integrity": "sha512-UzoZUr+XfVz3t3v4KyGEniVL9BDRoQtY7tOyrRybkVNjDFWyo1yhXNGrrBTQxp3ib9BLAWs7k2YKBQsFRkZG9A==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "is-alphabetical": "^1.0.0",
- "is-decimal": "^1.0.0"
- },
- "funding": {
- "type": "github",
- "url": "https://github.com/sponsors/wooorm"
- }
- },
"node_modules/is-arguments": {
"version": "1.1.1",
"dev": true,
@@ -6456,17 +6607,6 @@
"url": "https://github.com/sponsors/ljharb"
}
},
- "node_modules/is-decimal": {
- "version": "1.0.4",
- "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-1.0.4.tgz",
- "integrity": "sha512-RGdriMmQQvZ2aqaQq3awNA6dCGtKpiDFcOzrTWrDAT2MiWrKQVPmxLGHl7Y2nNu6led0kEyoX0enY0qXYsv9zw==",
- "dev": true,
- "license": "MIT",
- "funding": {
- "type": "github",
- "url": "https://github.com/sponsors/wooorm"
- }
- },
"node_modules/is-deflate": {
"version": "1.0.0",
"license": "MIT"
@@ -6537,17 +6677,6 @@
"node": ">=0.10.0"
}
},
- "node_modules/is-hexadecimal": {
- "version": "1.0.4",
- "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-1.0.4.tgz",
- "integrity": "sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw==",
- "dev": true,
- "license": "MIT",
- "funding": {
- "type": "github",
- "url": "https://github.com/sponsors/wooorm"
- }
- },
"node_modules/is-map": {
"version": "2.0.3",
"license": "MIT",
@@ -7391,35 +7520,6 @@
"node": ">= 0.4"
}
},
- "node_modules/mdast-util-from-markdown": {
- "version": "0.8.5",
- "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-0.8.5.tgz",
- "integrity": "sha512-2hkTXtYYnr+NubD/g6KGBS/0mFmBcifAsI0yIWRiRo0PjVs6SSOSOdtzbp6kSGnShDN6G5aWZpKQ2lWRy27mWQ==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@types/mdast": "^3.0.0",
- "mdast-util-to-string": "^2.0.0",
- "micromark": "~2.11.0",
- "parse-entities": "^2.0.0",
- "unist-util-stringify-position": "^2.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/unified"
- }
- },
- "node_modules/mdast-util-to-string": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-2.0.0.tgz",
- "integrity": "sha512-AW4DRS3QbBayY/jJmD8437V1Gombjf8RSOUCMFBuo5iHi58AGEgVCKQ+ezHkZZDpAQS75hcBMpLqjpJTjtUL7w==",
- "dev": true,
- "license": "MIT",
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/unified"
- }
- },
"node_modules/media-typer": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
@@ -7455,27 +7555,6 @@
"node": ">= 0.6"
}
},
- "node_modules/micromark": {
- "version": "2.11.4",
- "resolved": "https://registry.npmjs.org/micromark/-/micromark-2.11.4.tgz",
- "integrity": "sha512-+WoovN/ppKolQOFIAajxi7Lu9kInbPxFuTBVEavFcL8eAfVstoc5MocPmqBeAdBOJV00uaVjegzH4+MA0DN/uA==",
- "dev": true,
- "funding": [
- {
- "type": "GitHub Sponsors",
- "url": "https://github.com/sponsors/unifiedjs"
- },
- {
- "type": "OpenCollective",
- "url": "https://opencollective.com/unified"
- }
- ],
- "license": "MIT",
- "dependencies": {
- "debug": "^4.0.0",
- "parse-entities": "^2.0.0"
- }
- },
"node_modules/micromatch": {
"version": "4.0.8",
"dev": true,
@@ -7965,25 +8044,6 @@
"node": ">=6"
}
},
- "node_modules/parse-entities": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-2.0.0.tgz",
- "integrity": "sha512-kkywGpCcRYhqQIchaWqZ875wzpS/bMKhz5HnN3p7wveJTkTtyAB/AlnS0f8DFSqYW1T82t6yEAkEcB+A1I3MbQ==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "character-entities": "^1.0.0",
- "character-entities-legacy": "^1.0.0",
- "character-reference-invalid": "^1.0.0",
- "is-alphanumerical": "^1.0.0",
- "is-decimal": "^1.0.0",
- "is-hexadecimal": "^1.0.0"
- },
- "funding": {
- "type": "github",
- "url": "https://github.com/sponsors/wooorm"
- }
- },
"node_modules/parseurl": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
@@ -9911,20 +9971,6 @@
"devOptional": true,
"license": "MIT"
},
- "node_modules/unist-util-stringify-position": {
- "version": "2.0.3",
- "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-2.0.3.tgz",
- "integrity": "sha512-3faScn5I+hy9VleOq/qNbAd6pAx7iH5jYBMS9I1HgQVijz/4mv5Bvw5iw1sC/90CODiKo81G/ps8AJrISn687g==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@types/unist": "^2.0.2"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/unified"
- }
- },
"node_modules/universalify": {
"version": "2.0.1",
"license": "MIT",
diff --git a/web/package.json b/web/package.json
index a22c56afc..3cc9bda92 100644
--- a/web/package.json
+++ b/web/package.json
@@ -93,6 +93,7 @@
"@react-router/dev": "^7.1.5",
"@tailwindcss/forms": "^0.5.10",
"@tailwindcss/typography": "^0.5.16",
+ "@types/d3": "^7.4.3",
"@types/eslint": "^9.6.1",
"@types/file-saver": "^2.0.7",
"@types/lodash": "^4.17.15",
@@ -113,10 +114,10 @@
"eslint-plugin-jest": "^28.9.0",
"eslint-plugin-jest-dom": "^5.5.0",
"eslint-plugin-jsx-a11y": "^6.10.2",
- "eslint-plugin-markdown": "^5.1.0",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-testing-library": "^7.0.0",
+ "eslint-plugin-unused-imports": "^4.1.4",
"knip": "^5.43.6",
"prettier": "^3.4.2",
"tailwindcss": "^4.0.5",