-
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: add Active and Add integration card displays
Closes #4541
- Loading branch information
1 parent
89e0690
commit 7e28378
Showing
16 changed files
with
249 additions
and
137 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
62 changes: 62 additions & 0 deletions
62
...es/twenty-front/src/modules/settings/integrations/components/SettingsIntegrationGroup.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,62 @@ | ||
import styled from '@emotion/styled'; | ||
|
||
import { SettingsIntegrationComponent } from '@/settings/integrations/components/SettingsIntegrationComponent'; | ||
import { SettingsIntegrationCategory } from '@/settings/integrations/types/SettingsIntegrationCategory'; | ||
import { H2Title } from '@/ui/display/typography/components/H2Title'; | ||
import { Section } from '@/ui/layout/section/components/Section'; | ||
|
||
interface SettingsIntegrationGroupProps { | ||
integrationGroup: SettingsIntegrationCategory; | ||
} | ||
|
||
const StyledIntegrationGroupHeader = styled.div` | ||
align-items: start; | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: space-between; | ||
`; | ||
|
||
const StyledGroupLink = styled.div` | ||
align-items: start; | ||
display: flex; | ||
flex-direction: row; | ||
font-size: ${({ theme }) => theme.font.size.md}; | ||
gap: ${({ theme }) => theme.spacing(1)}; | ||
cursor: pointer; | ||
`; | ||
|
||
const StyledIntegrationsSection = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
gap: ${({ theme }) => theme.spacing(4)}; | ||
`; | ||
|
||
export const SettingsIntegrationGroup = ({ | ||
integrationGroup, | ||
}: SettingsIntegrationGroupProps) => ( | ||
<Section> | ||
<StyledIntegrationGroupHeader> | ||
<H2Title title={integrationGroup.title} /> | ||
{integrationGroup.hyperlink && ( | ||
<StyledGroupLink | ||
onClick={() => window.open(integrationGroup.hyperlink ?? '')} | ||
> | ||
<div>{integrationGroup.hyperlinkText}</div> | ||
<div>→</div> | ||
</StyledGroupLink> | ||
)} | ||
</StyledIntegrationGroupHeader> | ||
<StyledIntegrationsSection> | ||
{integrationGroup.integrations.map((integration) => ( | ||
<SettingsIntegrationComponent | ||
key={[ | ||
integrationGroup.key, | ||
integration.from.key, | ||
integration.to?.key, | ||
].join('-')} | ||
integration={integration} | ||
/> | ||
))} | ||
</StyledIntegrationsSection> | ||
</Section> | ||
); |
10 changes: 10 additions & 0 deletions
10
packages/twenty-front/src/modules/settings/integrations/constants/MockRemoteDatabases.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,10 @@ | ||
export const MOCK_REMOTE_DATABASES = [ | ||
{ | ||
name: 'airtable', | ||
isActive: false, | ||
}, | ||
{ | ||
name: 'postgresql', | ||
isActive: true, | ||
}, | ||
]; |
2 changes: 1 addition & 1 deletion
2
...s/constants/SettingsIntegrationRequest.ts → ...s/constants/SettingsIntegrationRequest.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
2 changes: 1 addition & 1 deletion
2
.../constants/SettingsIntegrationWindmill.ts → .../constants/SettingsIntegrationWindmill.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
2 changes: 1 addition & 1 deletion
2
...ns/constants/SettingsIntegrationZapier.ts → ...ns/constants/SettingsIntegrationZapier.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
35 changes: 35 additions & 0 deletions
35
.../twenty-front/src/modules/settings/integrations/hooks/useSettingsIntegrationCategories.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,35 @@ | ||
import { MOCK_REMOTE_DATABASES } from '@/settings/integrations/constants/MockRemoteDatabases'; | ||
import { SETTINGS_INTEGRATION_REQUEST_CATEGORY } from '@/settings/integrations/constants/SettingsIntegrationRequest'; | ||
import { SETTINGS_INTEGRATION_WINDMILL_CATEGORY } from '@/settings/integrations/constants/SettingsIntegrationWindmill'; | ||
import { SETTINGS_INTEGRATION_ZAPIER_CATEGORY } from '@/settings/integrations/constants/SettingsIntegrationZapier'; | ||
import { SettingsIntegrationCategory } from '@/settings/integrations/types/SettingsIntegrationCategory'; | ||
import { getSettingsIntegrationAll } from '@/settings/integrations/utils/getSettingsIntegrationAll'; | ||
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; | ||
|
||
export const useSettingsIntegrationCategories = | ||
(): SettingsIntegrationCategory[] => { | ||
const isAirtableIntegrationEnabled = useIsFeatureEnabled( | ||
'IS_AIRTABLE_INTEGRATION_ENABLED', | ||
); | ||
const isAirtableIntegrationActive = !!MOCK_REMOTE_DATABASES.find( | ||
({ name }) => name === 'airtable', | ||
)?.isActive; | ||
const isPostgresqlIntegrationEnabled = useIsFeatureEnabled( | ||
'IS_POSTGRESQL_INTEGRATION_ENABLED', | ||
); | ||
const isPostgresqlIntegrationActive = !!MOCK_REMOTE_DATABASES.find( | ||
({ name }) => name === 'postgresql', | ||
)?.isActive; | ||
|
||
return [ | ||
getSettingsIntegrationAll({ | ||
isAirtableIntegrationEnabled, | ||
isAirtableIntegrationActive, | ||
isPostgresqlIntegrationEnabled, | ||
isPostgresqlIntegrationActive, | ||
}), | ||
SETTINGS_INTEGRATION_ZAPIER_CATEGORY, | ||
SETTINGS_INTEGRATION_WINDMILL_CATEGORY, | ||
SETTINGS_INTEGRATION_REQUEST_CATEGORY, | ||
]; | ||
}; |
7 changes: 6 additions & 1 deletion
7
...integrations/types/SettingsIntegration.ts → ...integrations/types/SettingsIntegration.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
2 changes: 1 addition & 1 deletion
2
...ions/types/SettingsIntegrationCategory.ts → ...ions/types/SettingsIntegrationCategory.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
44 changes: 44 additions & 0 deletions
44
packages/twenty-front/src/modules/settings/integrations/utils/getSettingsIntegrationAll.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,44 @@ | ||
import { SettingsIntegrationCategory } from '@/settings/integrations/types/SettingsIntegrationCategory'; | ||
|
||
export const getSettingsIntegrationAll = ({ | ||
isAirtableIntegrationEnabled, | ||
isAirtableIntegrationActive, | ||
isPostgresqlIntegrationEnabled, | ||
isPostgresqlIntegrationActive, | ||
}: { | ||
isAirtableIntegrationEnabled: boolean; | ||
isAirtableIntegrationActive: boolean; | ||
isPostgresqlIntegrationEnabled: boolean; | ||
isPostgresqlIntegrationActive: boolean; | ||
}): SettingsIntegrationCategory => ({ | ||
key: 'all', | ||
title: 'All', | ||
integrations: [ | ||
{ | ||
from: { | ||
key: 'airtable', | ||
image: '/images/integrations/airtable-logo.png', | ||
}, | ||
type: !isAirtableIntegrationEnabled | ||
? 'Soon' | ||
: isAirtableIntegrationActive | ||
? 'Active' | ||
: 'Add', | ||
text: 'Airtable', | ||
link: '/settings/integrations/airtable', | ||
}, | ||
{ | ||
from: { | ||
key: 'postgresql', | ||
image: '/images/integrations/postgresql-logo.png', | ||
}, | ||
type: !isPostgresqlIntegrationEnabled | ||
? 'Soon' | ||
: isPostgresqlIntegrationActive | ||
? 'Active' | ||
: 'Add', | ||
text: 'PostgreSQL', | ||
link: '/settings/integrations/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
Oops, something went wrong.