feature flag notion
This commit is contained in:
@ -1,11 +1,5 @@
|
||||
import { UserBasicData } from './networking/queries/useGetViewerQuery'
|
||||
|
||||
const VIP_USERS = ['jacksonh', 'satindar', 'hongbo', 'nat']
|
||||
|
||||
export const isVipUser = (user: UserBasicData): boolean => {
|
||||
return VIP_USERS.includes(user.profile.username)
|
||||
}
|
||||
|
||||
export const userHasFeature = (
|
||||
user: UserBasicData | undefined,
|
||||
feature: string
|
||||
|
||||
@ -17,6 +17,7 @@ import {
|
||||
} from '../../components/elements/LayoutPrimitives'
|
||||
import { SettingsLayout } from '../../components/templates/SettingsLayout'
|
||||
import { fetchEndpoint } from '../../lib/appConfig'
|
||||
import { userHasFeature } from '../../lib/featureFlag'
|
||||
import { deleteIntegrationMutation } from '../../lib/networking/mutations/deleteIntegrationMutation'
|
||||
import { importFromIntegrationMutation } from '../../lib/networking/mutations/importFromIntegrationMutation'
|
||||
import {
|
||||
@ -27,8 +28,8 @@ import {
|
||||
Integration,
|
||||
useGetIntegrationsQuery,
|
||||
} from '../../lib/networking/queries/useGetIntegrationsQuery'
|
||||
import { useGetViewerQuery } from '../../lib/networking/queries/useGetViewerQuery'
|
||||
import { useGetWebhooksQuery } from '../../lib/networking/queries/useGetWebhooksQuery'
|
||||
import { applyStoredTheme } from '../../lib/themeUpdater'
|
||||
import { showErrorToast, showSuccessToast } from '../../lib/toastHelpers'
|
||||
// Styles
|
||||
const Header = styled(Box, {
|
||||
@ -74,7 +75,8 @@ type integrationsCard = {
|
||||
}
|
||||
}
|
||||
export default function Integrations(): JSX.Element {
|
||||
applyStoredTheme()
|
||||
const { viewerData } = useGetViewerQuery()
|
||||
|
||||
const { integrations, revalidate } = useGetIntegrationsQuery()
|
||||
const { webhooks } = useGetWebhooksQuery()
|
||||
|
||||
@ -202,7 +204,7 @@ export default function Integrations(): JSX.Element {
|
||||
}, [router])
|
||||
|
||||
useEffect(() => {
|
||||
setIntegrationsArray([
|
||||
const integrationsArray = [
|
||||
{
|
||||
icon: '/static/icons/logseq.svg',
|
||||
title: 'Logseq',
|
||||
@ -267,22 +269,6 @@ export default function Integrations(): JSX.Element {
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
icon: '/static/icons/notion.png',
|
||||
title: 'Notion',
|
||||
subText:
|
||||
'Notion is an all-in-one workspace. Use our Notion integration to sync your Omnivore items to Notion.',
|
||||
button: {
|
||||
text: isConnected('NOTION') ? 'Settings' : 'Connect',
|
||||
icon: <Link size={16} weight={'bold'} />,
|
||||
style: isConnected('NOTION') ? 'ctaWhite' : 'ctaDarkYellow',
|
||||
action: () => {
|
||||
isConnected('NOTION')
|
||||
? router.push('/settings/integrations/notion')
|
||||
: redirectToIntegration('NOTION')
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
icon: '/static/icons/webhooks.svg',
|
||||
title: 'Webhooks',
|
||||
@ -310,7 +296,27 @@ export default function Integrations(): JSX.Element {
|
||||
},
|
||||
},
|
||||
},
|
||||
])
|
||||
]
|
||||
|
||||
userHasFeature(viewerData?.me, 'notion') &&
|
||||
integrationsArray.push({
|
||||
icon: '/static/icons/notion.png',
|
||||
title: 'Notion',
|
||||
subText:
|
||||
'Notion is an all-in-one workspace. Use our Notion integration to sync your Omnivore items to Notion.',
|
||||
button: {
|
||||
text: isConnected('NOTION') ? 'Settings' : 'Connect',
|
||||
icon: <Link size={16} weight={'bold'} />,
|
||||
style: isConnected('NOTION') ? 'ctaWhite' : 'ctaDarkYellow',
|
||||
action: () => {
|
||||
isConnected('NOTION')
|
||||
? router.push('/settings/integrations/notion')
|
||||
: redirectToIntegration('NOTION')
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
setIntegrationsArray(integrationsArray)
|
||||
}, [pocketConnected, readwiseConnected, webhooks, integrations])
|
||||
|
||||
return (
|
||||
|
||||
@ -7,7 +7,6 @@ import {
|
||||
message,
|
||||
Space,
|
||||
Spin,
|
||||
Switch,
|
||||
} from 'antd'
|
||||
import 'antd/dist/antd.compact.css'
|
||||
import { CheckboxValueType } from 'antd/lib/checkbox/Group'
|
||||
@ -16,7 +15,6 @@ import { useRouter } from 'next/router'
|
||||
import { useCallback, useEffect, useState } from 'react'
|
||||
import { HStack, VStack } from '../../../components/elements/LayoutPrimitives'
|
||||
import { PageMetaData } from '../../../components/patterns/PageMetaData'
|
||||
import { Beta } from '../../../components/templates/Beta'
|
||||
import { Header } from '../../../components/templates/settings/SettingsTable'
|
||||
import { SettingsLayout } from '../../../components/templates/SettingsLayout'
|
||||
import { deleteIntegrationMutation } from '../../../lib/networking/mutations/deleteIntegrationMutation'
|
||||
|
||||
Reference in New Issue
Block a user