Skip to content

Commit

Permalink
fix(access-alpha): remove beta access feature flag (#411)
Browse files Browse the repository at this point in the history
  • Loading branch information
RemiBonnet committed Dec 12, 2022
1 parent ac7fa18 commit 39f0b02
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 129 deletions.
9 changes: 6 additions & 3 deletions __tests__/utils/providers.tsx
@@ -1,4 +1,5 @@
import { Auth0Provider } from '@auth0/auth0-react'
import * as TooltipPrimitive from '@radix-ui/react-tooltip'
import { configureStore } from '@reduxjs/toolkit'
import posthog from 'posthog-js'
import React, { ComponentType, ReactNode } from 'react'
Expand Down Expand Up @@ -33,9 +34,11 @@ export const Wrapper: React.FC<Props> = ({ children, reduxState = initialRootSta
return (
<Auth0Provider clientId="__test_client_id__" domain="__test_domain__">
<Provider store={store}>
<ModalProvider>
<MemoryRouter>{children}</MemoryRouter>
</ModalProvider>
<TooltipPrimitive.Provider>
<ModalProvider>
<MemoryRouter>{children}</MemoryRouter>
</ModalProvider>
</TooltipPrimitive.Provider>
</Provider>
</Auth0Provider>
)
Expand Down
36 changes: 6 additions & 30 deletions apps/console/src/app/app.tsx
Expand Up @@ -2,7 +2,7 @@ import { GTMProvider } from '@elgorditosalsero/react-gtm-hook'
import axios from 'axios'
import LogRocket from 'logrocket'
import posthog from 'posthog-js'
import { useCallback, useEffect, useState } from 'react'
import { useCallback, useEffect } from 'react'
import { useSelector } from 'react-redux'
import { Navigate, Route, Routes } from 'react-router-dom'
import { useIntercom } from 'react-use-intercom'
Expand All @@ -12,15 +12,7 @@ import { PageLogin, PageLogoutFeature } from '@qovery/pages/login'
import { PageOnboarding } from '@qovery/pages/onboarding'
import { useAuth } from '@qovery/shared/auth'
import { UserInterface } from '@qovery/shared/interfaces'
import {
BetaRoute,
LOGIN_URL,
LOGOUT_URL,
NO_BETA_ACCESS_URL,
NoBetaAccess,
ONBOARDING_URL,
ProtectedRoute,
} from '@qovery/shared/router'
import { LOGIN_URL, LOGOUT_URL, ONBOARDING_URL, ProtectedRoute } from '@qovery/shared/router'
import { LoadingScreen } from '@qovery/shared/ui'
import { useAuthInterceptor, useDocumentTitle } from '@qovery/shared/utils'
import { environment } from '../environments/environment'
Expand All @@ -30,8 +22,6 @@ export function App() {
useDocumentTitle('Loading...')
const { isLoading } = useAuth()

const [, setBetaAccess] = useState(false)

const gtmParams = { id: environment.gtm }

const user = useSelector(selectUser)
Expand Down Expand Up @@ -67,7 +57,6 @@ export function App() {
// if (process.env['NODE_ENV'] === 'production') {

// if onboarding feature flag activated we add onboarding routes to router
// const isOnboarding = posthog && posthog.isFeatureEnabled('v3-onboarding')
const isOnboarding = environment.onboarding === 'true'
if (isOnboarding) {
ROUTER.push({
Expand All @@ -86,10 +75,7 @@ export function App() {

useEffect(() => {
if (user && user.sub) {
if (process.env['NODE_ENV'] !== 'production') {
posthog.feature_flags.override(['v3-beta'])
setBetaAccess(posthog.isFeatureEnabled('v3-beta'))
} else {
if (process.env['NODE_ENV'] === 'production') {
initMonitorings(user)
}
}
Expand All @@ -104,14 +90,6 @@ export function App() {
<Routes>
<Route path={`${LOGIN_URL}/*`} element={<PageLogin />} />
<Route path={LOGOUT_URL} element={<PageLogoutFeature />} />
<Route
path={NO_BETA_ACCESS_URL}
element={
<ProtectedRoute>
<NoBetaAccess />
</ProtectedRoute>
}
/>
{ROUTER.map(
(route) =>
!route.layout && (
Expand All @@ -135,11 +113,9 @@ export function App() {
</DarkModeEnabler>
) : (
<ProtectedRoute>
<BetaRoute>
<DarkModeEnabler key={'dark-mode-' + route.path} isDarkMode={route.darkMode}>
<Layout topBar={route.topBar}>{route.component}</Layout>
</DarkModeEnabler>
</BetaRoute>
<DarkModeEnabler key={'dark-mode-' + route.path} isDarkMode={route.darkMode}>
<Layout topBar={route.topBar}>{route.component}</Layout>
</DarkModeEnabler>
</ProtectedRoute>
)
}
Expand Down
11 changes: 7 additions & 4 deletions apps/console/src/main.tsx
@@ -1,4 +1,5 @@
import { AppState, Auth0Provider } from '@auth0/auth0-react'
import * as TooltipPrimitive from '@radix-ui/react-tooltip'
import { createBrowserHistory } from 'history'
import posthog from 'posthog-js'
import { createRoot } from 'react-dom/client'
Expand Down Expand Up @@ -40,10 +41,12 @@ root.render(
>
<Provider store={store}>
<BrowserRouter>
<ModalProvider>
<App />
<ToastBehavior />
</ModalProvider>
<TooltipPrimitive.Provider>
<ModalProvider>
<App />
<ToastBehavior />
</ModalProvider>
</TooltipPrimitive.Provider>
</BrowserRouter>
</Provider>
</Auth0Provider>
Expand Down
2 changes: 0 additions & 2 deletions libs/shared/router/src/index.ts
@@ -1,4 +1,2 @@
export * from './lib/router'
export * from './lib/protected-route/protected-route'
export * from './lib/beta-route/beta-route'
export * from './lib/pages/no-beta-access'
13 changes: 0 additions & 13 deletions libs/shared/router/src/lib/beta-route/beta-route.spec.tsx

This file was deleted.

27 changes: 0 additions & 27 deletions libs/shared/router/src/lib/beta-route/beta-route.tsx

This file was deleted.

10 changes: 0 additions & 10 deletions libs/shared/router/src/lib/pages/no-beta-access.spec.tsx

This file was deleted.

37 changes: 0 additions & 37 deletions libs/shared/router/src/lib/pages/no-beta-access.tsx

This file was deleted.

1 change: 0 additions & 1 deletion libs/shared/router/src/lib/router.ts
Expand Up @@ -11,7 +11,6 @@ export const INDEX_URL = '/'
export const ORGANIZATION_URL = (organizationId = ':organizationId') => `/organization/${organizationId}`
export const OVERVIEW_URL = (organizationId = ':organizationId', projectId = ':projectId') =>
`/organization/${organizationId}/project/${projectId}/overview`
export const NO_BETA_ACCESS_URL = '/no-beta-access'
export interface Route {
component: React.ReactElement
path: string
Expand Down
3 changes: 1 addition & 2 deletions libs/shared/ui/src/lib/components/tooltip/tooltip.spec.tsx
@@ -1,5 +1,4 @@
import { render } from '@testing-library/react'

import { render } from '__tests__/utils/setup-jest'
import Tooltip from './tooltip'

describe('Tooltip', () => {
Expand Down

0 comments on commit 39f0b02

Please sign in to comment.