The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Use the standard section skeleton for the account and connection tables (#29057)
nitin6c02a7c73bb7
diff --git a/packages/twenty-front/src/modules/settings/app-preferences/components/SettingsAccountGroupsSection.tsx b/packages/twenty-front/src/modules/settings/app-preferences/components/SettingsAccountGroupsSection.tsxindex 514faa6ee1f..6873e3000a7 100644--- a/packages/twenty-front/src/modules/settings/app-preferences/components/SettingsAccountGroupsSection.tsx+++ b/packages/twenty-front/src/modules/settings/app-preferences/components/SettingsAccountGroupsSection.tsx@@ -6,7 +6,7 @@ import { useMyAccountGroups } from '@/settings/app-preferences/hooks/useMyAccounimport { type BuiltInAccountApp } from '@/settings/app-preferences/types/BuiltInAccountApp';import { getBuiltInAccountAppsUsingAccount } from '@/settings/app-preferences/utils/getBuiltInAccountAppsUsingAccount';import { useTriggerApisOAuth } from '@/settings/accounts/hooks/useTriggerApiOAuth';-import { SettingsTableRowsSkeletonLoader } from '@/settings/components/SettingsTableRowsSkeletonLoader';+import { SettingsSectionSkeletonLoader } from '@/settings/components/SettingsSectionSkeletonLoader';import { Table } from '@/ui/layout/table/components/Table';import { TableHeader } from '@/ui/layout/table/components/TableHeader';import { TableRow } from '@/ui/layout/table/components/TableRow';@@ -84,19 +84,7 @@ export const SettingsAccountGroupsSection = ({description={t`Shared accounts between apps`}/>{loading ? (- <Table>- {tableHeaderRow}- <SettingsTableRowsSkeletonLoader- gridTemplateColumns={gridTemplateColumns}- columns={[- {},- isDefined(builtInAccountApp)- ? { width: 140 }- : { align: 'right', width: 48 },- {},- ]}- />- </Table>+ <SettingsSectionSkeletonLoader />) : groups.length === 0 ? (<SettingsAccountGroupsEmptyStatebuiltInAccountApp={builtInAccountApp}diff --git a/packages/twenty-front/src/modules/settings/app-preferences/components/SettingsAppPreferencesConnectionsTable.tsx b/packages/twenty-front/src/modules/settings/app-preferences/components/SettingsAppPreferencesConnectionsTable.tsxindex c07bb85775c..34017214d73 100644--- a/packages/twenty-front/src/modules/settings/app-preferences/components/SettingsAppPreferencesConnectionsTable.tsx+++ b/packages/twenty-front/src/modules/settings/app-preferences/components/SettingsAppPreferencesConnectionsTable.tsx@@ -3,7 +3,7 @@ import { SettingsAppPreferencesConnectionRowDropdownMenu } from '@/settings/app-import { SettingsApplicationConnectionName } from '@/settings/applications/components/SettingsApplicationConnectionName';import { SettingsApplicationConnectionStatus } from '@/settings/applications/components/SettingsApplicationConnectionStatus';import { SettingsApplicationConnectionTableRows } from '@/settings/applications/components/SettingsApplicationConnectionTableRows';-import { SettingsTableRowsSkeletonLoader } from '@/settings/components/SettingsTableRowsSkeletonLoader';+import { SettingsSectionSkeletonLoader } from '@/settings/components/SettingsSectionSkeletonLoader';import { Table } from '@/ui/layout/table/components/Table';import { TableCell } from '@/ui/layout/table/components/TableCell';import { TableHeader } from '@/ui/layout/table/components/TableHeader';@@ -30,6 +30,10 @@ export const SettingsAppPreferencesConnectionsTable = ({}: SettingsAppPreferencesConnectionsTableProps) => {const { t } = useLingui();+ if (isLoading) {+ return <SettingsSectionSkeletonLoader />;+ }+return (<Table><TableRow@@ -39,42 +43,35 @@ export const SettingsAppPreferencesConnectionsTable = ({<TableHeader>{t`Status`}</TableHeader><TableHeader /></TableRow>- {isLoading ? (- <SettingsTableRowsSkeletonLoader- gridTemplateColumns={CONNECTION_TABLE_ROW_GRID_TEMPLATE_COLUMNS}- columns={[{}, { width: 96 }, { align: 'right', width: 24 }]}- />- ) : (- <SettingsApplicationConnectionTableRows>- {connections.map((connection) => (- <TableRow- key={connection.id}- gridTemplateColumns={CONNECTION_TABLE_ROW_GRID_TEMPLATE_COLUMNS}+ <SettingsApplicationConnectionTableRows>+ {connections.map((connection) => (+ <TableRow+ key={connection.id}+ gridTemplateColumns={CONNECTION_TABLE_ROW_GRID_TEMPLATE_COLUMNS}+ >+ <TableCell+ color={themeCssVariables.font.color.primary}+ minWidth="0"+ overflow="hidden"+ textOverflow="ellipsis"+ whiteSpace="nowrap">- <TableCell- color={themeCssVariables.font.color.primary}- minWidth="0"- overflow="hidden"- textOverflow="ellipsis"- whiteSpace="nowrap"- >- <SettingsApplicationConnectionName connection={connection} />- </TableCell>- <TableCell whiteSpace="nowrap">- <SettingsApplicationConnectionStatus connection={connection} />- </TableCell>- <TableCell align="right">- <SettingsAppPreferencesConnectionRowDropdownMenu- applicationId={applicationId}- providerName={providerName}- connection={connection}- canStartAuthorization={canStartAuthorization}- />- </TableCell>- </TableRow>- ))}- </SettingsApplicationConnectionTableRows>- )}+ <SettingsApplicationConnectionName connection={connection} />+ </TableCell>+ <TableCell whiteSpace="nowrap">+ <SettingsApplicationConnectionStatus connection={connection} />+ </TableCell>+ <TableCell align="right">+ <SettingsAppPreferencesConnectionRowDropdownMenu+ applicationId={applicationId}+ providerName={providerName}+ connection={connection}+ canStartAuthorization={canStartAuthorization}+ />+ </TableCell>+ </TableRow>+ ))}+ </SettingsApplicationConnectionTableRows></Table>);};diff --git a/packages/twenty-front/src/modules/settings/components/SettingsTableRowsSkeletonLoader.tsx b/packages/twenty-front/src/modules/settings/components/SettingsTableRowsSkeletonLoader.tsxdeleted file mode 100644index 51cf3a8760c..00000000000--- a/packages/twenty-front/src/modules/settings/components/SettingsTableRowsSkeletonLoader.tsx+++ /dev/null@@ -1,73 +0,0 @@-import { SkeletonLine } from '@/ui/feedback/skeleton/components/SkeletonLine';-import { TableCell } from '@/ui/layout/table/components/TableCell';-import { TableRow } from '@/ui/layout/table/components/TableRow';-import { styled } from '@linaria/react';-import { type ReactNode } from 'react';-import { isDefined } from 'twenty-shared/utils';-import { SKELETON_HEIGHT_SIZES } from 'twenty-ui/primitives/feedback';-import { themeCssVariables } from 'twenty-ui/theme';--const SKELETON_ROW_LABEL_WIDTHS = [144, 104, 128];--const ICON_SIZE = 16;--const StyledRows = styled.div`- padding-bottom: ${themeCssVariables.spacing[2]};- padding-top: ${themeCssVariables.spacing[2]};-`;--type SettingsTableRowsSkeletonLoaderColumn = {- align?: 'left' | 'right';- width?: number;-};--type SettingsTableRowsSkeletonLoaderProps = {- columns: SettingsTableRowsSkeletonLoaderColumn[];- gridTemplateColumns: string;-};--const renderSkeletonCellContent = (- column: SettingsTableRowsSkeletonLoaderColumn,- isFirstColumn: boolean,- labelWidth: number,-): ReactNode => {- if (isFirstColumn) {- return (- <>- <SkeletonLine width={ICON_SIZE} height={ICON_SIZE} />- <SkeletonLine width={labelWidth} height={SKELETON_HEIGHT_SIZES.xs} />- </>- );- }-- if (isDefined(column.width)) {- return (- <SkeletonLine width={column.width} height={SKELETON_HEIGHT_SIZES.xs} />- );- }-- return null;-};--export const SettingsTableRowsSkeletonLoader = ({- columns,- gridTemplateColumns,-}: SettingsTableRowsSkeletonLoaderProps) => (- <StyledRows>- {SKELETON_ROW_LABEL_WIDTHS.map((labelWidth) => (- <TableRow key={labelWidth} gridTemplateColumns={gridTemplateColumns}>- {columns.map((column, columnIndex) => (- <TableCell- key={columnIndex}- align={column.align}- gap={themeCssVariables.spacing[2]}- minWidth="0"- overflow="hidden"- >- {renderSkeletonCellContent(column, columnIndex === 0, labelWidth)}- </TableCell>- ))}- </TableRow>- ))}- </StyledRows>-);diff --git a/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsAccounts.stories.tsx b/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsAccounts.stories.tsxindex 5421ae858b9..67b9af756dd 100644--- a/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsAccounts.stories.tsx+++ b/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsAccounts.stories.tsx@@ -185,7 +185,7 @@ export const WorkspaceSharedAppConnectionsStayOff: Story = {},};-export const AccountsHeaderStaysWhileLoading: Story = {+export const AccountsSectionHeaderStaysWhileLoading: Story = {...accountsTabStory,parameters: {msw: {@@ -206,7 +206,6 @@ export const AccountsHeaderStaysWhileLoading: Story = {}),).toBeVisible();expect(canvas.getByRole('heading', { name: 'Accounts' })).toBeVisible();- expect(canvas.getByText('Used by')).toBeVisible();expect(canvasElement.querySelector('[aria-busy="true"]')).not.toBeNull();expect(canvas.queryByText('[email protected]')).not.toBeInTheDocument();},diff --git a/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsBuiltInAccountApp.stories.tsx b/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsBuiltInAccountApp.stories.tsxindex 9d422d39f0b..b41a0370542 100644--- a/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsBuiltInAccountApp.stories.tsx+++ b/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsBuiltInAccountApp.stories.tsx@@ -71,7 +71,7 @@ export const GoogleGeneralShowsAccountsAndBlocklist: Story = {},};-export const TabBarAndHeadersStayWhileLoading: Story = {+export const TabBarStaysWhileLoading: Story = {parameters: {msw: {handlers: [@@ -97,7 +97,6 @@ export const TabBarAndHeadersStayWhileLoading: Story = {expect(canvas.getByTestId('tab-emails')).toBeVisible();expect(canvas.getByTestId('tab-calendar')).toBeVisible();expect(canvas.getByText('Blocklist')).toBeVisible();- expect(canvas.getByText('Permissions')).toBeVisible();expect(canvasElement.querySelector('[aria-busy="true"]')).not.toBeNull();expect(canvas.queryByText('[email protected]')).not.toBeInTheDocument();},