Skip to content

The open alternative to Salesforce, designed for AI.

Show app type on the Installed apps table, with status chips in its place (#29334)

nitin5fc8645dcf08
diff --git a/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationTypeOrStatusCell.tsx b/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationTypeOrStatusCell.tsx
new file mode 100644
index 00000000000..20c58bfc58f
--- /dev/null
+++ b/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationTypeOrStatusCell.tsx
@@ -0,0 +1,54 @@
+import { SettingsApplicationStatusCell } from '@/settings/applications/components/SettingsApplicationStatusCell';
+import { type SettingsApplicationStatus } from '@/settings/applications/types/SettingsApplicationStatus';
+import { styled } from '@linaria/react';
+import { isNonEmptyArray } from 'twenty-shared/utils';
+import { themeCssVariables } from 'twenty-ui/theme';
+
+const StyledStatus = styled.span`
+ display: inline-flex;
+ grid-area: 1 / 1;
+ transition: opacity calc(${themeCssVariables.animation.duration.fast} * 1s);
+`;
+
+const StyledTypeLabel = styled.span`
+ grid-area: 1 / 1;
+ opacity: 0;
+ transition: opacity calc(${themeCssVariables.animation.duration.fast} * 1s);
+`;
+
+const StyledContainer = styled.span`
+ align-items: center;
+ display: inline-grid;
+ justify-items: start;
+
+ &:hover > ${StyledStatus}, a:focus-visible & > ${StyledStatus} {
+ opacity: 0;
+ }
+
+ &:hover > ${StyledTypeLabel}, a:focus-visible & > ${StyledTypeLabel} {
+ opacity: 1;
+ }
+`;
+
+type SettingsApplicationTypeOrStatusCellProps = {
+ typeLabel: string;
+ statuses?: SettingsApplicationStatus[];
+};
+
+export const SettingsApplicationTypeOrStatusCell = ({
+ typeLabel,
+ statuses = [],
+}: SettingsApplicationTypeOrStatusCellProps) => {
+ if (!isNonEmptyArray(statuses)) {
+ return <>{typeLabel}</>;
+ }
+
+ return (
+ <StyledContainer>
+ <StyledStatus>
+ <SettingsApplicationStatusCell statuses={statuses} />
+ </StyledStatus>
+ <StyledTypeLabel>{typeLabel}</StyledTypeLabel>
+ </StyledContainer>
+ );
+};
diff --git a/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationsInstalledAppsSection.tsx b/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationsInstalledAppsSection.tsx
index d2c468bf048..5e388c67f74 100644
--- a/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationsInstalledAppsSection.tsx
+++ b/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationsInstalledAppsSection.tsx
@@ -52,7 +52,7 @@ export const SettingsApplicationsInstalledAppsSection = () => {
applications={installedApplications}
builtInAccountApps={installedBuiltInAccountApps}
linkTarget="applicationDetail"
- middleColumn={isAppPreferencesEnabled ? 'status' : 'type'}
+ middleColumn={isAppPreferencesEnabled ? 'typeOrStatus' : 'type'}
statusesById={statusesById}
/>
);
diff --git a/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationsTableApplicationRow.tsx b/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationsTableApplicationRow.tsx
index 2fcc1340ede..c4a3dc2d0c1 100644
--- a/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationsTableApplicationRow.tsx
+++ b/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationsTableApplicationRow.tsx
@@ -4,11 +4,13 @@ import { type ApplicationDisplayData } from '@/applications/types/ApplicationDis
import { SettingsApplicationStatusCell } from '@/settings/applications/components/SettingsApplicationStatusCell';
import { SettingsApplicationTableRow } from '@/settings/applications/components/SettingsApplicationTableRow';
import { SettingsApplicationTableRowChevronIcon } from '@/settings/applications/components/SettingsApplicationTableRowChevronIcon';
+import { SettingsApplicationTypeOrStatusCell } from '@/settings/applications/components/SettingsApplicationTypeOrStatusCell';
import { type SettingsApplicationStatus } from '@/settings/applications/types/SettingsApplicationStatus';
import { type SettingsApplicationTableRowMiddleColumn } from '@/settings/applications/types/SettingsApplicationTableRowMiddleColumn';
import { getApplicationDescriptionSummary } from '@/settings/applications/utils/getApplicationDescriptionSummary';
import { type MessageDescriptor } from '@lingui/core';
import { msg, t } from '@lingui/core/macro';
+import { type ReactNode } from 'react';
import { isDefined } from 'twenty-shared/utils';
import { Tag } from 'twenty-ui/primitives/data-display';
import { OverflowingTextWithTooltip } from 'twenty-ui/primitives/typography';
@@ -44,22 +46,31 @@ export const SettingsApplicationsTableApplicationRow = ({
statuses = [],
}: SettingsApplicationsTableApplicationRowProps) => {
const resolvedDescription = useResolvedApplicationDescription(application);
+ const sourceTypeLabel = getSourceTypeLabel(application.sourceType);
const shouldShowUpdateTag =
middleColumn === 'type' &&
statuses.some((status) => status.type === 'updateAvailable');
+ const middleByColumn: Record<
+ SettingsApplicationTableRowMiddleColumn,
+ ReactNode
+ > = {
+ type: sourceTypeLabel,
+ status: <SettingsApplicationStatusCell statuses={statuses} />,
+ typeOrStatus: (
+ <SettingsApplicationTypeOrStatusCell
+ typeLabel={sourceTypeLabel}
+ statuses={statuses}
+ />
+ ),
+ };
+
return (
<SettingsApplicationTableRow
middleColumn={middleColumn}
link={link}
name={<ApplicationDisplay application={application} />}
- middle={
- middleColumn === 'status' ? (
- <SettingsApplicationStatusCell statuses={statuses} />
- ) : (
- getSourceTypeLabel(application.sourceType)
- )
- }
+ middle={middleByColumn[middleColumn]}
details={
<>
<OverflowingTextWithTooltip
diff --git a/packages/twenty-front/src/modules/settings/applications/components/__stories__/SettingsApplicationsInstalledAppsSection.stories.tsx b/packages/twenty-front/src/modules/settings/applications/components/__stories__/SettingsApplicationsInstalledAppsSection.stories.tsx
index 72cadbf8db1..091ade14f11 100644
--- a/packages/twenty-front/src/modules/settings/applications/components/__stories__/SettingsApplicationsInstalledAppsSection.stories.tsx
+++ b/packages/twenty-front/src/modules/settings/applications/components/__stories__/SettingsApplicationsInstalledAppsSection.stories.tsx
@@ -240,7 +240,7 @@ export const ShowsTypeAndUpdateTagWithoutAppPreferences: Story = {
},
};
-export const ShowsStatusWithAppPreferences: Story = {
+export const ShowsStatusInPlaceOfTypeWithAppPreferences: Story = {
beforeEach: () => seedInstalledTabStory({ isAppPreferencesEnabled: true }),
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
@@ -250,23 +250,25 @@ export const ShowsStatusWithAppPreferences: Story = {
expect(
await within(recorderRow).findByText('Setup incomplete'),
).toBeVisible();
+ expect(within(recorderRow).getByText('NPM')).not.toBeVisible();
expect(recorderRow).not.toHaveTextContent('Update');
- expect(canvas.getByText('Status')).toBeVisible();
- expect(canvas.queryByText('Type')).not.toBeInTheDocument();
+ expect(canvas.getByText('Type')).toBeVisible();
+ expect(canvas.queryByText('Status')).not.toBeInTheDocument();
const acmeRow = canvas.getByRole('link', { name: /Acme Sync/ });
expect(within(acmeRow).getByText('Update')).toBeVisible();
- expect(acmeRow).not.toHaveTextContent('NPM');
+ expect(within(acmeRow).getByText('NPM')).not.toBeVisible();
const notesRow = canvas.getByRole('link', { name: /Notes/ });
+ expect(within(notesRow).getByText('NPM')).toBeVisible();
expect(notesRow).not.toHaveTextContent('Setup incomplete');
expect(notesRow).not.toHaveTextContent('Update');
const gmailRow = canvas.getByRole('link', { name: /Gmail and Calendar/ });
- expect(gmailRow).not.toHaveTextContent('Built-in');
+ expect(within(gmailRow).getByText('Built-in')).toBeVisible();
expect(gmailRow).not.toHaveTextContent('Setup incomplete');
},
};
diff --git a/packages/twenty-front/src/modules/settings/applications/constants/ApplicationTableRowGridTemplateColumnsByMiddleColumn.ts b/packages/twenty-front/src/modules/settings/applications/constants/ApplicationTableRowGridTemplateColumnsByMiddleColumn.ts
index 789379e063b..077512249d4 100644
--- a/packages/twenty-front/src/modules/settings/applications/constants/ApplicationTableRowGridTemplateColumnsByMiddleColumn.ts
+++ b/packages/twenty-front/src/modules/settings/applications/constants/ApplicationTableRowGridTemplateColumnsByMiddleColumn.ts
@@ -6,4 +6,5 @@ export const APPLICATION_TABLE_ROW_GRID_TEMPLATE_COLUMNS_BY_MIDDLE_COLUMN: Recor
> = {
type: '200px 80px minmax(0, 1fr) 36px',
status: '200px 180px minmax(0, 1fr) 36px',
+ typeOrStatus: '200px 180px minmax(0, 1fr) 36px',
};
diff --git a/packages/twenty-front/src/modules/settings/applications/types/SettingsApplicationTableRowMiddleColumn.ts b/packages/twenty-front/src/modules/settings/applications/types/SettingsApplicationTableRowMiddleColumn.ts
index 9750c8835d9..59a5ebb4921 100644
--- a/packages/twenty-front/src/modules/settings/applications/types/SettingsApplicationTableRowMiddleColumn.ts
+++ b/packages/twenty-front/src/modules/settings/applications/types/SettingsApplicationTableRowMiddleColumn.ts
@@ -1 +1,4 @@
-export type SettingsApplicationTableRowMiddleColumn = 'type' | 'status';
+export type SettingsApplicationTableRowMiddleColumn =
+ | 'type'
+ | 'status'
+ | 'typeOrStatus';