The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
fix(admin-panel): inline skeleton loaders for table sections (#20014)
Félix Malfaitec98130defb4
diff --git a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountLoader.tsx b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountLoader.tsxdeleted file mode 100644index c5d50418d37..00000000000--- a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountLoader.tsx+++ /dev/null@@ -1,16 +0,0 @@-import { useContext } from 'react';-import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';-import { ThemeContext } from 'twenty-ui/theme-constants';--export const SettingsAccountLoader = () => {- const { theme } = useContext(ThemeContext);- return (- <SkeletonTheme- baseColor={theme.background.tertiary}- highlightColor={theme.background.transparent.lighter}- borderRadius={4}- >- <Skeleton height={20} width={512} />- </SkeletonTheme>- );-};diff --git a/packages/twenty-front/src/modules/settings/admin-panel/ai/components/SettingsAdminAI.tsx b/packages/twenty-front/src/modules/settings/admin-panel/ai/components/SettingsAdminAI.tsxindex a815d64d330..34f22c5eced 100644--- a/packages/twenty-front/src/modules/settings/admin-panel/ai/components/SettingsAdminAI.tsx+++ b/packages/twenty-front/src/modules/settings/admin-panel/ai/components/SettingsAdminAI.tsx@@ -25,7 +25,7 @@ import { GET_AI_PROVIDERS } from '@/settings/admin-panel/ai/graphql/queries/getAimport { type GetAiProvidersResult } from '@/settings/admin-panel/ai/types/GetAiProvidersResult';import { parseProviderItems } from '@/settings/admin-panel/ai/utils/parseProviderItems';import { getModelIcon } from '@/settings/ai/utils/getModelIcon';-import { SettingsAdminTabSkeletonLoader } from '@/settings/admin-panel/components/SettingsAdminTabSkeletonLoader';+import { SettingsSectionSkeletonLoader } from '@/settings/components/SettingsSectionSkeletonLoader';import { SettingsEnterpriseFeatureGateCard } from '@/settings/components/SettingsEnterpriseFeatureGateCard';import { SettingsOptionCardContentSelect } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSelect';import { useUsageValueFormatter } from '@/settings/usage/hooks/useUsageValueFormatter';@@ -128,7 +128,7 @@ export const SettingsAdminAI = () => {);if (isLoadingProviders || isLoadingModels) {- return <SettingsAdminTabSkeletonLoader />;+ return <SettingsSectionSkeletonLoader />;}const handleRecommendedToggle = async (diff --git a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminGeneral.tsx b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminGeneral.tsxindex 500349bc755..4a2c0b879a8 100644--- a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminGeneral.tsx+++ b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminGeneral.tsx@@ -1,9 +1,9 @@import { canManageFeatureFlagsState } from '@/client-config/states/canManageFeatureFlagsState';import { useApolloAdminClient } from '@/settings/admin-panel/apollo/hooks/useApolloAdminClient';+import { SettingsSectionSkeletonLoader } from '@/settings/components/SettingsSectionSkeletonLoader';import { SettingsAdminVersionContainer } from '@/settings/admin-panel/components/SettingsAdminVersionContainer';import { ADMIN_PANEL_RECENT_USERS } from '@/settings/admin-panel/graphql/queries/adminPanelRecentUsers';import { ADMIN_PANEL_TOP_WORKSPACES } from '@/settings/admin-panel/graphql/queries/adminPanelTopWorkspaces';-import { SettingsSkeletonLoader } from '@/settings/components/SettingsSkeletonLoader';import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';import { Table } from '@/ui/layout/table/components/Table';import { TableBody } from '@/ui/layout/table/components/TableBody';@@ -105,7 +105,7 @@ export const SettingsAdminGeneral = () => {fullWidth/>{isLoadingUsers ? (- <SettingsSkeletonLoader />+ <SettingsSectionSkeletonLoader />) : recentUsers.length === 0 ? (<StyledEmptyState>{t`No users found matching your search criteria.`}@@ -154,7 +154,7 @@ export const SettingsAdminGeneral = () => {fullWidth/>{isLoadingWorkspaces ? (- <SettingsSkeletonLoader />+ <SettingsSectionSkeletonLoader />) : topWorkspaces.length === 0 ? (<StyledEmptyState>{t`No workspaces found matching your search criteria.`}diff --git a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminTabSkeletonLoader.tsx b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminTabSkeletonLoader.tsxdeleted file mode 100644index a57a03cd431..00000000000--- a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminTabSkeletonLoader.tsx+++ /dev/null@@ -1,18 +0,0 @@-import { useContext } from 'react';-import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';--import { SKELETON_LOADER_HEIGHT_SIZES } from '@/activities/components/SkeletonLoader';-import { ThemeContext } from 'twenty-ui/theme-constants';--export const SettingsAdminTabSkeletonLoader = () => {- const { theme } = useContext(ThemeContext);- return (- <SkeletonTheme- baseColor={theme.background.tertiary}- highlightColor={theme.background.transparent.lighter}- borderRadius={4}- >- <Skeleton height={SKELETON_LOADER_HEIGHT_SIZES.standard.m} width={120} />- </SkeletonTheme>- );-};diff --git a/packages/twenty-front/src/modules/settings/admin-panel/config-variables/components/SettingsAdminConfigVariables.tsx b/packages/twenty-front/src/modules/settings/admin-panel/config-variables/components/SettingsAdminConfigVariables.tsxindex b0d045a008d..f33af865785 100644--- a/packages/twenty-front/src/modules/settings/admin-panel/config-variables/components/SettingsAdminConfigVariables.tsx+++ b/packages/twenty-front/src/modules/settings/admin-panel/config-variables/components/SettingsAdminConfigVariables.tsx@@ -1,4 +1,4 @@-import { SettingsAdminTabSkeletonLoader } from '@/settings/admin-panel/components/SettingsAdminTabSkeletonLoader';+import { SettingsSectionSkeletonLoader } from '@/settings/components/SettingsSectionSkeletonLoader';import { useApolloAdminClient } from '@/settings/admin-panel/apollo/hooks/useApolloAdminClient';import { ConfigVariableFilterContainer } from '@/settings/admin-panel/config-variables/components/ConfigVariableFilterContainer';import { ConfigVariableFilterDropdown } from '@/settings/admin-panel/config-variables/components/ConfigVariableFilterDropdown';@@ -160,7 +160,7 @@ export const SettingsAdminConfigVariables = () => {}, [filteredVariables, allGroups]);if (configVariablesLoading) {- return <SettingsAdminTabSkeletonLoader />;+ return <SettingsSectionSkeletonLoader />;}return (diff --git a/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminHealthStatus.tsx b/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminHealthStatus.tsxindex b79211ca8a8..ef72e23398d 100644--- a/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminHealthStatus.tsx+++ b/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminHealthStatus.tsx@@ -1,5 +1,5 @@import { useApolloAdminClient } from '@/settings/admin-panel/apollo/hooks/useApolloAdminClient';-import { SettingsAdminTabSkeletonLoader } from '@/settings/admin-panel/components/SettingsAdminTabSkeletonLoader';+import { SettingsSectionSkeletonLoader } from '@/settings/components/SettingsSectionSkeletonLoader';import { SettingsAdminHealthStatusListCard } from '@/settings/admin-panel/health-status/components/SettingsAdminHealthStatusListCard';import { SettingsAdminMaintenanceModeFetchEffect } from '@/settings/admin-panel/health-status/maintenance-mode/components/SettingsAdminMaintenanceModeFetchEffect';import { SettingsAdminMaintenanceMode } from '@/settings/admin-panel/health-status/maintenance-mode/components/SettingsAdminMaintenanceMode';@@ -22,7 +22,7 @@ export const SettingsAdminHealthStatus = () => {const services = data?.getSystemHealthStatus.services ?? [];if (loadingHealthStatus) {- return <SettingsAdminTabSkeletonLoader />;+ return <SettingsSectionSkeletonLoader />;}return (diff --git a/packages/twenty-front/src/modules/settings/components/SettingsSectionSkeletonLoader.tsx b/packages/twenty-front/src/modules/settings/components/SettingsSectionSkeletonLoader.tsxnew file mode 100644index 00000000000..72af8476be9--- /dev/null+++ b/packages/twenty-front/src/modules/settings/components/SettingsSectionSkeletonLoader.tsx@@ -0,0 +1,38 @@+import { styled } from '@linaria/react';+import { useContext } from 'react';+import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';++import { SKELETON_LOADER_HEIGHT_SIZES } from '@/activities/components/SkeletonLoader';++type SettingsSectionSkeletonLoaderProps = {+ rowCount?: number;+};++const StyledRows = styled.div`+ display: flex;+ flex-direction: column;+ gap: ${themeCssVariables.spacing[2]};+ width: 100%;+`;++export const SettingsSectionSkeletonLoader = ({+ rowCount = 4,+}: SettingsSectionSkeletonLoaderProps) => {+ const { theme } = useContext(ThemeContext);++ return (+ <StyledRows>+ <SkeletonTheme+ baseColor={theme.background.tertiary}+ highlightColor={theme.background.transparent.lighter}+ borderRadius={4}+ >+ <Skeleton+ count={rowCount}+ height={SKELETON_LOADER_HEIGHT_SIZES.standard.l}+ />+ </SkeletonTheme>+ </StyledRows>+ );+};diff --git a/packages/twenty-front/src/pages/settings/accounts/SettingsAccounts.tsx b/packages/twenty-front/src/pages/settings/accounts/SettingsAccounts.tsxindex 539f270b7b0..a25028f81e1 100644--- a/packages/twenty-front/src/pages/settings/accounts/SettingsAccounts.tsx+++ b/packages/twenty-front/src/pages/settings/accounts/SettingsAccounts.tsx@@ -1,5 +1,5 @@import { SettingsPath } from 'twenty-shared/types';-import { SettingsAccountLoader } from '@/settings/accounts/components/SettingsAccountLoader';+import { SettingsSectionSkeletonLoader } from '@/settings/components/SettingsSectionSkeletonLoader';import { SettingsAccountsBlocklistSection } from '@/settings/accounts/components/SettingsAccountsBlocklistSection';import { SettingsAccountsConnectedAccountsListCard } from '@/settings/accounts/components/SettingsAccountsConnectedAccountsListCard';import { SettingsAccountsSettingsSection } from '@/settings/accounts/components/SettingsAccountsSettingsSection';@@ -29,7 +29,7 @@ export const SettingsAccounts = () => {><SettingsPageContainer>{loading ? (- <SettingsAccountLoader />+ <SettingsSectionSkeletonLoader />) : (<><Section>diff --git a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceDetail.tsx b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceDetail.tsxindex ff83f7d0d94..2162e67f9e8 100644--- a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceDetail.tsx+++ b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceDetail.tsx@@ -10,6 +10,7 @@ import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';import { canManageFeatureFlagsState } from '@/client-config/states/canManageFeatureFlagsState';import { AI_ADMIN_PATH } from '@/settings/admin-panel/ai/constants/AiAdminPath';import { useApolloAdminClient } from '@/settings/admin-panel/apollo/hooks/useApolloAdminClient';+import { SettingsSectionSkeletonLoader } from '@/settings/components/SettingsSectionSkeletonLoader';import { SettingsAdminWorkspaceContent } from '@/settings/admin-panel/components/SettingsAdminWorkspaceContent';import { GET_ADMIN_WORKSPACE_CHAT_THREADS } from '@/settings/admin-panel/graphql/queries/getAdminWorkspaceChatThreads';import { WORKSPACE_LOOKUP_ADMIN_PANEL } from '@/settings/admin-panel/graphql/queries/workspaceLookupAdminPanel';@@ -304,7 +305,7 @@ export const SettingsAdminWorkspaceDetail = () => {description={t`AI chat threads for this workspace`}/>{isLoadingThreads ? (- <SettingsSkeletonLoader />+ <SettingsSectionSkeletonLoader />) : threads.length === 0 ? (<Card rounded><TableRow gridTemplateColumns="1fr">diff --git a/packages/twenty-front/src/pages/settings/applications/SettingsApplicationDetails.tsx b/packages/twenty-front/src/pages/settings/applications/SettingsApplicationDetails.tsxindex fb7d56aadc4..0d5893fd3ef 100644--- a/packages/twenty-front/src/pages/settings/applications/SettingsApplicationDetails.tsx+++ b/packages/twenty-front/src/pages/settings/applications/SettingsApplicationDetails.tsx@@ -40,7 +40,7 @@ import {UninstallApplicationDocument,} from '~/generated-metadata/graphql';import { useNavigateSettings } from '~/hooks/useNavigateSettings';-import { SettingsApplicationDetailSkeletonLoader } from '~/pages/settings/applications/components/SettingsApplicationDetailSkeletonLoader';+import { SettingsSectionSkeletonLoader } from '@/settings/components/SettingsSectionSkeletonLoader';import { SettingsApplicationDetailTitle } from '~/pages/settings/applications/components/SettingsApplicationDetailTitle';import { CUSTOM_APPLICATION_ILLUSTRATIONS } from '~/pages/settings/applications/constants/CustomApplicationIllustrations';import { STANDARD_APPLICATION_ILLUSTRATIONS } from '~/pages/settings/applications/constants/StandardApplicationIllustrations';@@ -241,7 +241,7 @@ export const SettingsApplicationDetails = () => {const renderActiveTabContent = () => {if (!isDefined(application)) {- return <SettingsApplicationDetailSkeletonLoader />;+ return <SettingsSectionSkeletonLoader />;}switch (activeTabId) {diff --git a/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationDetailSkeletonLoader.tsx b/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationDetailSkeletonLoader.tsxdeleted file mode 100644index 3fd78e9ecdf..00000000000--- a/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationDetailSkeletonLoader.tsx+++ /dev/null@@ -1,53 +0,0 @@-import { styled } from '@linaria/react';-import { useContext } from 'react';-import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';--import { SKELETON_LOADER_HEIGHT_SIZES } from '@/activities/components/SkeletonLoader';-import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';--const StyledSkeletonContainer = styled.div`- display: flex;- flex-direction: column;- gap: ${themeCssVariables.spacing[8]};-`;--const StyledFormSection = styled.div`- display: flex;- flex-direction: column;- gap: ${themeCssVariables.spacing[2]};-`;--export const SettingsApplicationDetailSkeletonLoader = () => {- const { theme } = useContext(ThemeContext);- return (- <SkeletonTheme- baseColor={theme.background.tertiary}- highlightColor={theme.background.transparent.lighter}- borderRadius={4}- >- <StyledSkeletonContainer>- <StyledFormSection>- <Skeleton- height={SKELETON_LOADER_HEIGHT_SIZES.standard.l}- width="100%"- />-- <Skeleton- height={SKELETON_LOADER_HEIGHT_SIZES.standard.l}- width="100%"- />-- <Skeleton- height={SKELETON_LOADER_HEIGHT_SIZES.standard.l}- width="100%"- />-- <Skeleton- height={SKELETON_LOADER_HEIGHT_SIZES.standard.l}- width="100%"- />- </StyledFormSection>- </StyledSkeletonContainer>- </SkeletonTheme>- );-};