-
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 (#4591)
* feat: add Active and Add integration card displays Closes #4541 * docs: add PaymentSuccess page stories * refactor: move page components
- Loading branch information
1 parent
6ab43c6
commit 8baa59b
Showing
19 changed files
with
242 additions
and
117 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 was deleted.
Oops, something went wrong.
File renamed without changes.
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
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', | ||
}, | ||
], | ||
}); |
File renamed without changes.
48 changes: 48 additions & 0 deletions
48
packages/twenty-front/src/pages/auth/__stories__/PaymentSuccess.stories.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,48 @@ | ||
import { getOperationName } from '@apollo/client/utilities'; | ||
import { Meta, StoryObj } from '@storybook/react'; | ||
import { within } from '@storybook/testing-library'; | ||
import { graphql, HttpResponse } from 'msw'; | ||
|
||
import { AppPath } from '@/types/AppPath'; | ||
import { GET_CURRENT_USER } from '@/users/graphql/queries/getCurrentUser'; | ||
import { | ||
PageDecorator, | ||
PageDecoratorArgs, | ||
} from '~/testing/decorators/PageDecorator'; | ||
import { graphqlMocks } from '~/testing/graphqlMocks'; | ||
import { mockedOnboardingUsersData } from '~/testing/mock-data/users'; | ||
|
||
import { PaymentSuccess } from '../PaymentSuccess'; | ||
|
||
const meta: Meta<PageDecoratorArgs> = { | ||
title: 'Pages/Auth/PaymentSuccess', | ||
component: PaymentSuccess, | ||
decorators: [PageDecorator], | ||
args: { routePath: AppPath.PlanRequiredSuccess }, | ||
parameters: { | ||
msw: { | ||
handlers: [ | ||
graphql.query(getOperationName(GET_CURRENT_USER) ?? '', () => { | ||
return HttpResponse.json({ | ||
data: { | ||
currentUser: mockedOnboardingUsersData[0], | ||
}, | ||
}); | ||
}), | ||
graphqlMocks.handlers, | ||
], | ||
}, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
export type Story = StoryObj<typeof PaymentSuccess>; | ||
|
||
export const Default: Story = { | ||
play: async ({ canvasElement }) => { | ||
const canvas = within(canvasElement); | ||
|
||
await canvas.findByText('Start'); | ||
}, | ||
}; |
Oops, something went wrong.