From 023df68f7bc078dd5923545db35ffa054922a417 Mon Sep 17 00:00:00 2001 From: Hongbo Wu Date: Mon, 6 May 2024 13:29:48 +0800 Subject: [PATCH] feat: open notion to public --- packages/web/pages/settings/features/beta.tsx | 34 +------------ packages/web/pages/settings/integrations.tsx | 50 +++++++++---------- 2 files changed, 24 insertions(+), 60 deletions(-) diff --git a/packages/web/pages/settings/features/beta.tsx b/packages/web/pages/settings/features/beta.tsx index 733333a86..720a48c2d 100644 --- a/packages/web/pages/settings/features/beta.tsx +++ b/packages/web/pages/settings/features/beta.tsx @@ -12,8 +12,6 @@ import { useGetViewerQuery } from '../../../lib/networking/queries/useGetViewerQ import { applyStoredTheme } from '../../../lib/themeUpdater' import { showErrorToast, showSuccessToast } from '../../../lib/toastHelpers' -const ACCOUNT_LIMIT = 50_000 - const StyledLabel = styled('label', { fontWeight: 600, fontSize: '16px', @@ -49,10 +47,6 @@ export default function Account(): JSX.Element { ) }, [viewerData]) - const hasNotion = useMemo(() => { - return viewerData?.me?.featureList?.some((f) => f.name === 'notion') - }, [viewerData]) - applyStoredTheme() return ( @@ -116,8 +110,7 @@ export default function Account(): JSX.Element { ) })} - {(!hasYouTube || - !hasNotion) /* || !hasAISummaries || !hasDigest */ && ( + {!hasYouTube /* || !hasAISummaries || !hasDigest */ && ( Available beta features @@ -150,31 +143,6 @@ export default function Account(): JSX.Element { )} - {!hasNotion && ( - - - - Notion integration: Export your items and highlights - to Notion. - - - - )} - {/* { - // create a form and submit it to the backend - const form = document.createElement('form') - form.method = 'POST' - form.action = `${fetchEndpoint}/integration/${name.toLowerCase()}/auth` - if (importItemState) { - const input = document.createElement('input') - input.type = 'hidden' - input.name = 'state' - input.value = importItemState - form.appendChild(input) - } - document.body.appendChild(form) + const redirectToIntegration = useCallback( + (name: string, importItemState?: ImportItemState) => { + // create a form and submit it to the backend + const form = document.createElement('form') + form.method = 'POST' + form.action = `${fetchEndpoint}/integration/${name.toLowerCase()}/auth` + if (importItemState) { + const input = document.createElement('input') + input.type = 'hidden' + input.name = 'state' + input.value = importItemState + form.appendChild(input) + } + document.body.appendChild(form) - form.submit() - }, []) + form.submit() + }, + [] + ) const isImporting = (integration: Integration | undefined) => { return !!integration && !!integration.taskName @@ -307,10 +305,7 @@ export default function Integrations(): JSX.Element { }, }, }, - ] - - userHasFeature(viewerData?.me, 'notion') && - integrationsArray.push({ + { icon: '/static/icons/notion.png', title: 'Notion', subText: @@ -325,7 +320,8 @@ export default function Integrations(): JSX.Element { : redirectToIntegration('NOTION') }, }, - }) + }, + ] setIntegrationsArray(integrationsArray) }, [getIntegration, router])