Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disable analytics on stage #320

Merged
merged 2 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import classNames from 'classnames/bind'
import { useEffect, useState } from 'react'
import { trigger } from 'utils/events'
import SvgIcon from 'components/Helpers/SvgIcon/SvgIcon'
import s from './ContextMenuButton.module.scss'
Expand Down Expand Up @@ -61,6 +62,12 @@ const ContextMenuButton = ({
/>
)

const [icon, setIcon] = useState<JSX.Element | null>(null)

useEffect(() => {
type && setIcon(getIconElement(type))
}, [type])

return (
<button
id={id}
Expand All @@ -74,12 +81,12 @@ const ContextMenuButton = ({
rel='noopener noreferrer'
className={s.link}
>
{type && getIconElement(type)}
{icon}
{children || name}
</a>
) : (
<>
{type && getIconElement(type)}
{icon}
<span>{children || name}</span>
</>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import classNames from 'classnames/bind'
import { useAuth } from 'context'
import { useTranslation } from 'react-i18next'
import { useNavigate } from 'react-router-dom'
import { ReactComponent as FeedbackIcon } from 'assets/icons/feedBack.svg'
import { RoutesList } from 'router/RoutesList'
import { TOOLTIP_DELAY } from 'constants/constants'
import { SvgIcon } from 'components/Helpers'
import { BaseToolTip } from 'components/Menus'
import s from './FeedbackTab.module.scss'

Expand All @@ -30,7 +30,7 @@ export const FeedbackTab = ({ isActive }: Props) => {
data-tooltip-id='sidebarFeedbackTab'
className={cx('feedback', isActive && 'active')}
>
<SvgIcon iconName='feedBack' />
<FeedbackIcon />
<BaseToolTip
delayShow={TOOLTIP_DELAY}
id='sidebarFeedbackTab'
Expand Down
4 changes: 2 additions & 2 deletions services/frontend/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ const queryClient = new QueryClient({
},
})

if (import.meta.env.MODE !== 'DEV') {
if (import.meta.env.MODE !== 'DEV' && import.meta.env.MODE !== 'STAGE') {
ReactGA.initialize(import.meta.env.VITE_GOOGLE_ANALYTICS)
}

prepare().then(() => {
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
<GaContextProvider>
{import.meta.env.MODE !== 'DEV' && (
{import.meta.env.MODE !== 'DEV' && import.meta.env.MODE !== 'STAGE' && (
<YMInitializer
accounts={[Number(import.meta.env.VITE_YANDEX_METRIC_ID)]}
options={{
Expand Down
3 changes: 2 additions & 1 deletion services/frontend/src/utils/googleAnalytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ export const getSkillView = (pageType: PageType, isTableView: boolean) => {
export const safeFunctionWrapper =
<T extends any[]>(func: (...args: T) => void) =>
(...args: T) => {
if (import.meta.env.MODE === 'DEV') return
const mode = import.meta.env.MODE
if (mode === 'DEV' || mode === 'STAGE') return

try {
func(...args)
Expand Down
3 changes: 2 additions & 1 deletion services/frontend/src/utils/yandexMetrics.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import ym from 'react-yandex-metrika'

export const yandexMetrics = (methodName: string, ...args: string[]) => {
if (import.meta.env.MODE === 'DEV') return
const mode = import.meta.env.MODE
if (mode === 'DEV' || mode === 'STAGE') return

ym(methodName, ...args)
}
Loading