-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create Integrations/IntegrationDetail page
Closes #4546
- Loading branch information
1 parent
e579554
commit 37f3181
Showing
8 changed files
with
84 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
packages/twenty-front/src/modules/workspace/types/FeatureFlagKey.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
export type FeatureFlagKey = | ||
| 'IS_BLOCKLIST_ENABLED' | ||
| 'IS_CALENDAR_ENABLED' | ||
| 'IS_QUICK_ACTIONS_ENABLED'; | ||
| 'IS_QUICK_ACTIONS_ENABLED' | ||
| 'IS_AIRTABLE_INTEGRATION_ENABLED' | ||
| 'IS_POSTGRESQL_INTEGRATION_ENABLED'; |
54 changes: 54 additions & 0 deletions
54
packages/twenty-front/src/pages/settings/integrations/SettingsIntegrationDetail.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { useEffect } from 'react'; | ||
import { useNavigate, useParams } from 'react-router-dom'; | ||
|
||
import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer'; | ||
import { AppPath } from '@/types/AppPath'; | ||
import { IconSettings } from '@/ui/display/icon'; | ||
import { SubMenuTopBarContainer } from '@/ui/layout/page/SubMenuTopBarContainer'; | ||
import { Breadcrumb } from '@/ui/navigation/bread-crumb/components/Breadcrumb'; | ||
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; | ||
import { SETTINGS_INTEGRATION_LABEL_BY_SLUG } from '~/pages/settings/integrations/constants/SettingsIntegrationLabelBySlug'; | ||
|
||
export const SettingsIntegrationDetail = () => { | ||
const { integrationSlug = '' } = useParams(); | ||
const navigate = useNavigate(); | ||
const integrationLabel = SETTINGS_INTEGRATION_LABEL_BY_SLUG[integrationSlug]; | ||
|
||
const isAirtableIntegrationEnabled = useIsFeatureEnabled( | ||
'IS_AIRTABLE_INTEGRATION_ENABLED', | ||
); | ||
const isPostgresqlIntegrationEnabled = useIsFeatureEnabled( | ||
'IS_POSTGRESQL_INTEGRATION_ENABLED', | ||
); | ||
const isIntegrationAvailable = | ||
(integrationSlug === 'airtable' && isAirtableIntegrationEnabled) || | ||
(integrationSlug === 'postgresql' && isPostgresqlIntegrationEnabled); | ||
|
||
useEffect(() => { | ||
if (!integrationLabel || !isIntegrationAvailable) { | ||
return navigate(AppPath.NotFound); | ||
} | ||
}, [ | ||
integrationLabel, | ||
integrationSlug, | ||
isAirtableIntegrationEnabled, | ||
isIntegrationAvailable, | ||
isPostgresqlIntegrationEnabled, | ||
navigate, | ||
]); | ||
|
||
if (!integrationLabel || !isIntegrationAvailable) return null; | ||
|
||
return ( | ||
<SubMenuTopBarContainer Icon={IconSettings} title="Settings"> | ||
<SettingsPageContainer> | ||
<Breadcrumb | ||
links={[ | ||
{ children: 'Integrations', href: '/settings/integrations' }, | ||
{ children: integrationLabel }, | ||
]} | ||
/> | ||
</SettingsPageContainer> | ||
</SubMenuTopBarContainer> | ||
); | ||
}; |
4 changes: 4 additions & 0 deletions
4
.../twenty-front/src/pages/settings/integrations/constants/SettingsIntegrationLabelBySlug.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const SETTINGS_INTEGRATION_LABEL_BY_SLUG: Record<string, string> = { | ||
airtable: 'Airtable', | ||
postgresql: 'PostgreSQL', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters