Skip to content

The open alternative to Salesforce, designed for AI.

Deprecate runtime theme objects in favor of CSS variables (#18402)

Charles Bochet647c32ff3e66
diff --git a/packages/twenty-apps/community/apollo-enrich/src/logic-functions/get-authentication-token-pairs.ts b/packages/twenty-apps/community/apollo-enrich/src/logic-functions/get-authentication-token-pairs.ts
index ab35c47132b..12b5729267f 100644
--- a/packages/twenty-apps/community/apollo-enrich/src/logic-functions/get-authentication-token-pairs.ts
+++ b/packages/twenty-apps/community/apollo-enrich/src/logic-functions/get-authentication-token-pairs.ts
@@ -1,7 +1,6 @@
import { defineLogicFunction, RoutePayload } from "twenty-sdk";
import { MetadataApiClient } from 'twenty-sdk/generated';
-
export const OAUTH_TOKEN_PAIRS_PATH = '/oauth/token-pairs';
type ApolloTokenResponse = {
@@ -53,16 +52,8 @@ const handler = async (event: RoutePayload): Promise<any> => {
const apolloClientSecret = process.env.APOLLO_CLIENT_SECRET ?? '';
const applicationId = process.env.APPLICATION_ID ?? '';
-
const metadataClient = new MetadataApiClient({});
-
-
-
-
-
-
-
const tokenPairs = await getAuthenticationTokenPairs(
code,
apolloClientId,
diff --git a/packages/twenty-apps/community/apollo-enrich/src/logic-functions/on-company-updated.ts b/packages/twenty-apps/community/apollo-enrich/src/logic-functions/on-company-updated.ts
index 7afb5e52cd9..cba2df2d338 100644
--- a/packages/twenty-apps/community/apollo-enrich/src/logic-functions/on-company-updated.ts
+++ b/packages/twenty-apps/community/apollo-enrich/src/logic-functions/on-company-updated.ts
@@ -5,8 +5,6 @@ import {
} from 'twenty-sdk';
import { CoreApiClient } from 'twenty-sdk/generated';
-
-
type CompanyRecord = {
id: string;
name?: string;
@@ -38,8 +36,6 @@ type ApolloEnrichResponse = {
organization?: ApolloOrganization;
};
-
-
const extractDomain = (
domainName?: CompanyRecord['domainName'],
): string | undefined => {
@@ -172,7 +168,6 @@ const updateCompanyInTwenty = async (
}
};
-
type CompanyUpdateEvent = DatabaseEventPayload<
ObjectRecordUpdateEvent<CompanyRecord>
>;
@@ -181,7 +176,6 @@ const handler = async (
event: CompanyUpdateEvent,
): Promise<object | undefined> => {
-
const { recordId, properties } = event;
const { after: companyAfter } = properties;
@@ -206,7 +200,6 @@ const handler = async (
return { skipped: true, reason: 'no enrichment data to apply' };
}
-
await updateCompanyInTwenty(recordId, updateData);
const result = {
diff --git a/packages/twenty-apps/community/fireflies/scripts/fetch-all-meetings.ts b/packages/twenty-apps/community/fireflies/scripts/fetch-all-meetings.ts
index 082d7646298..678669fc72d 100644
--- a/packages/twenty-apps/community/fireflies/scripts/fetch-all-meetings.ts
+++ b/packages/twenty-apps/community/fireflies/scripts/fetch-all-meetings.ts
@@ -219,4 +219,3 @@ main().catch((error) => {
process.exit(1);
});
-
diff --git a/packages/twenty-apps/community/fireflies/src/__tests__/historical-importer.spec.ts b/packages/twenty-apps/community/fireflies/src/__tests__/historical-importer.spec.ts
index 4e829c73263..1e8c30a7cad 100644
--- a/packages/twenty-apps/community/fireflies/src/__tests__/historical-importer.spec.ts
+++ b/packages/twenty-apps/community/fireflies/src/__tests__/historical-importer.spec.ts
@@ -81,4 +81,3 @@ describe('HistoricalImporter', () => {
});
});
-
diff --git a/packages/twenty-apps/community/fireflies/src/historical-importer.ts b/packages/twenty-apps/community/fireflies/src/historical-importer.ts
index ebebef071c4..b418584d954 100644
--- a/packages/twenty-apps/community/fireflies/src/historical-importer.ts
+++ b/packages/twenty-apps/community/fireflies/src/historical-importer.ts
@@ -158,4 +158,3 @@ export class HistoricalImporter {
}
}
-
diff --git a/packages/twenty-apps/community/fireflies/src/objects/index.ts b/packages/twenty-apps/community/fireflies/src/objects/index.ts
index 00189441a4d..2d87481294e 100644
--- a/packages/twenty-apps/community/fireflies/src/objects/index.ts
+++ b/packages/twenty-apps/community/fireflies/src/objects/index.ts
@@ -1,3 +1,2 @@
export { Meeting } from './meeting';
-
diff --git a/packages/twenty-apps/community/fireflies/src/webhook-handler.ts b/packages/twenty-apps/community/fireflies/src/webhook-handler.ts
index 2a8ae38591c..8f0689ccea1 100644
--- a/packages/twenty-apps/community/fireflies/src/webhook-handler.ts
+++ b/packages/twenty-apps/community/fireflies/src/webhook-handler.ts
@@ -330,7 +330,6 @@ export class WebhookHandler {
}
}
-
private async createFailedMeetingRecord(params: unknown, error: string): Promise<void> {
try {
const twentyApiKey = process.env.TWENTY_API_KEY || '';
diff --git a/packages/twenty-apps/community/linkedin-browser-extension/browser-extension/src/entrypoints/add-person.content/index.tsx b/packages/twenty-apps/community/linkedin-browser-extension/browser-extension/src/entrypoints/add-person.content/index.tsx
index be5bd25081e..e54b6434360 100644
--- a/packages/twenty-apps/community/linkedin-browser-extension/browser-extension/src/entrypoints/add-person.content/index.tsx
+++ b/packages/twenty-apps/community/linkedin-browser-extension/browser-extension/src/entrypoints/add-person.content/index.tsx
@@ -43,7 +43,6 @@ export default defineContentScript({
},
});
-
ctx.addEventListener(window, 'wxt:locationchange', ({newUrl, }) => {
const injectedBtn = document.querySelector('[data-id="twenty-btn"]');
if(personPattern.includes(newUrl) && !injectedBtn) ui.mount();
diff --git a/packages/twenty-apps/community/linkedin-browser-extension/browser-extension/src/ui/components/button.tsx b/packages/twenty-apps/community/linkedin-browser-extension/browser-extension/src/ui/components/button.tsx
index 0e400fc5f3a..6fcab66cb33 100755
--- a/packages/twenty-apps/community/linkedin-browser-extension/browser-extension/src/ui/components/button.tsx
+++ b/packages/twenty-apps/community/linkedin-browser-extension/browser-extension/src/ui/components/button.tsx
@@ -8,7 +8,6 @@ const StyledButton = styled.button`
--text-color: #0a66c2;
--bg-color: #00000000;
-
font-size: ${({theme}) => theme.spacing(3.5)};
font-weight: ${({theme}) => theme.font.weight.semiBold};
font-family: ${({theme}) => theme.font.family};
@@ -26,7 +25,6 @@ const StyledButton = styled.button`
transition-timing-function: cubic-bezier(.4, 0, .2, 1);
transition-duration: 167ms;
-
&:hover {
background-color: var(--hover-bg-color);
color: var(--hover-color);
diff --git a/packages/twenty-apps/community/linkedin-browser-extension/browser-extension/src/ui/theme/context/ThemeContext.tsx b/packages/twenty-apps/community/linkedin-browser-extension/browser-extension/src/ui/theme/context/ThemeContext.tsx
index fca7fa0b901..e6603cb03b6 100755
--- a/packages/twenty-apps/community/linkedin-browser-extension/browser-extension/src/ui/theme/context/ThemeContext.tsx
+++ b/packages/twenty-apps/community/linkedin-browser-extension/browser-extension/src/ui/theme/context/ThemeContext.tsx
@@ -1,6 +1,5 @@
-import { ThemeProvider } from '@emotion/react';
import type React from 'react';
-import { THEME_DARK, ThemeContextProvider } from 'twenty-ui/theme';
+import { ColorSchemeProvider } from 'twenty-ui/theme-constants';
type ThemeContextProps = {
children: React.ReactNode;
@@ -8,10 +7,6 @@ type ThemeContextProps = {
export const ThemeContext = ({ children }: ThemeContextProps) => {
return (
- <ThemeProvider theme={THEME_DARK}>
- <ThemeContextProvider theme={THEME_DARK}>
- {children}
- </ThemeContextProvider>
- </ThemeProvider>
+ <ColorSchemeProvider colorScheme="dark">{children}</ColorSchemeProvider>
);
};
diff --git a/packages/twenty-apps/community/linkedin-browser-extension/browser-extension/src/ui/theme/emotion.d.ts b/packages/twenty-apps/community/linkedin-browser-extension/browser-extension/src/ui/theme/emotion.d.ts
deleted file mode 100755
index 5c654112a82..00000000000
--- a/packages/twenty-apps/community/linkedin-browser-extension/browser-extension/src/ui/theme/emotion.d.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import type { ThemeType } from 'twenty-ui/theme';
-
-declare module '@emotion/react' {
- export interface Theme extends ThemeType {}
-}
diff --git a/packages/twenty-front/.storybook/preview.tsx b/packages/twenty-front/.storybook/preview.tsx
index e882e1981e8..342fdbd5038 100644
--- a/packages/twenty-front/.storybook/preview.tsx
+++ b/packages/twenty-front/.storybook/preview.tsx
@@ -2,9 +2,7 @@ import { i18n } from '@lingui/core';
import { I18nProvider } from '@lingui/react';
import { type Preview } from '@storybook/react-vite';
import { initialize, mswLoader } from 'msw-storybook-addon';
-import { useEffect } from 'react';
import { SOURCE_LOCALE } from 'twenty-shared/translations';
-//import { useDarkMode } from 'storybook-dark-mode';
// eslint-disable-next-line no-restricted-imports
import { RootDecorator } from '../src/testing/decorators/RootDecorator';
@@ -13,7 +11,9 @@ import { resetJotaiStore } from '../src/modules/ui/utilities/state/jotai/jotaiSt
import 'react-loading-skeleton/dist/skeleton.css';
import 'twenty-ui/style.css';
-import { THEME_LIGHT, ThemeContextProvider } from 'twenty-ui/theme';
+import 'twenty-ui/theme-light.css';
+import 'twenty-ui/theme-dark.css';
+import { ThemeProvider } from 'twenty-ui/theme-constants';
// eslint-disable-next-line no-restricted-imports
import { messages as enMessages } from '../src/locales/generated/en';
@@ -60,23 +60,15 @@ initialize({
const preview: Preview = {
decorators: [
(Story) => {
- // const theme = useDarkMode() ? THEME_DARK : THEME_LIGHT;
- const theme = THEME_LIGHT;
-
- useEffect(() => {
- document.documentElement.className =
- theme.name === 'dark' ? 'dark' : 'light';
- }, [theme]);
-
return (
<I18nProvider i18n={i18n}>
- <ThemeContextProvider theme={theme}>
+ <ThemeProvider colorScheme="light">
<ClickOutsideListenerContext.Provider
value={{ excludedClickOutsideId: undefined }}
>
<Story />
</ClickOutsideListenerContext.Provider>
- </ThemeContextProvider>
+ </ThemeProvider>
</I18nProvider>
);
},
diff --git a/packages/twenty-front/src/hooks/useCopyToClipboard.tsx b/packages/twenty-front/src/hooks/useCopyToClipboard.tsx
index ffb4754604b..cdaea463579 100644
--- a/packages/twenty-front/src/hooks/useCopyToClipboard.tsx
+++ b/packages/twenty-front/src/hooks/useCopyToClipboard.tsx
@@ -2,8 +2,7 @@ import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
import { useLingui } from '@lingui/react/macro';
import { IconCopy, IconExclamationCircle } from 'twenty-ui/display';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
-
+import { ThemeContext } from 'twenty-ui/theme-constants';
export const useCopyToClipboard = () => {
const { theme } = useContext(ThemeContext);
const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();
diff --git a/packages/twenty-front/src/loading/components/LeftPanelSkeletonLoader.tsx b/packages/twenty-front/src/loading/components/LeftPanelSkeletonLoader.tsx
index 526733a9515..c151bdf5b1a 100644
--- a/packages/twenty-front/src/loading/components/LeftPanelSkeletonLoader.tsx
+++ b/packages/twenty-front/src/loading/components/LeftPanelSkeletonLoader.tsx
@@ -5,9 +5,9 @@ import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
import { SKELETON_LOADER_HEIGHT_SIZES } from '@/activities/components/SkeletonLoader';
import { NAVIGATION_DRAWER_CONSTRAINTS } from '@/ui/layout/resizable-panel/constants/NavigationDrawerConstraints';
import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
-import { useContext } from 'react';
-import { ANIMATION, ThemeContext } from 'twenty-ui/theme';
import { MainNavigationDrawerItemsSkeletonLoader } from '~/loading/components/MainNavigationDrawerItemsSkeletonLoader';
+import { useContext } from 'react';
+import { ThemeContext } from 'twenty-ui/theme-constants';
const StyledAnimatedContainer = styled(motion.div)`
align-items: center;
@@ -47,9 +47,8 @@ const StyledSkeletonTitleContainer = styled.div`
`;
export const LeftPanelSkeletonLoader = () => {
- const isMobile = useIsMobile();
const { theme } = useContext(ThemeContext);
-
+ const isMobile = useIsMobile();
return (
<StyledAnimatedContainer
initial={false}
@@ -57,7 +56,9 @@ export const LeftPanelSkeletonLoader = () => {
width: isMobile ? 0 : NAVIGATION_DRAWER_CONSTRAINTS.default,
opacity: isMobile ? 0 : 1,
}}
- transition={{ duration: ANIMATION.duration.fast }}
+ transition={{
+ duration: theme.animation.duration.fast,
+ }}
>
<StyledItemsContainer>
<StyledSkeletonTitleContainer>
diff --git a/packages/twenty-front/src/loading/components/MainNavigationDrawerItemsSkeletonLoader.tsx b/packages/twenty-front/src/loading/components/MainNavigationDrawerItemsSkeletonLoader.tsx
index 3cf07d50cab..760599d99d4 100644
--- a/packages/twenty-front/src/loading/components/MainNavigationDrawerItemsSkeletonLoader.tsx
+++ b/packages/twenty-front/src/loading/components/MainNavigationDrawerItemsSkeletonLoader.tsx
@@ -2,7 +2,7 @@ import { SKELETON_LOADER_HEIGHT_SIZES } from '@/activities/components/SkeletonLo
import { styled } from '@linaria/react';
import { useContext } from 'react';
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
const StyledSkeletonContainer = styled.div`
align-items: flex-start;
@@ -22,7 +22,6 @@ export const MainNavigationDrawerItemsSkeletonLoader = ({
length: number;
}) => {
const { theme } = useContext(ThemeContext);
-
return (
<StyledSkeletonContainer>
<SkeletonTheme
diff --git a/packages/twenty-front/src/loading/components/RightDrawerSkeletonLoader.tsx b/packages/twenty-front/src/loading/components/RightDrawerSkeletonLoader.tsx
index d382ecd2f5c..5344fbd8333 100644
--- a/packages/twenty-front/src/loading/components/RightDrawerSkeletonLoader.tsx
+++ b/packages/twenty-front/src/loading/components/RightDrawerSkeletonLoader.tsx
@@ -2,8 +2,7 @@ import { SKELETON_LOADER_HEIGHT_SIZES } from '@/activities/components/SkeletonLo
import { styled } from '@linaria/react';
import { useContext } from 'react';
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledRightDrawerContainer = styled.div`
display: flex;
@@ -14,7 +13,6 @@ const StyledRightDrawerContainer = styled.div`
const StyledSkeletonLoader = () => {
const { theme } = useContext(ThemeContext);
-
return (
<SkeletonTheme
baseColor={theme.background.tertiary}
diff --git a/packages/twenty-front/src/loading/components/RightPanelSkeletonLoader.tsx b/packages/twenty-front/src/loading/components/RightPanelSkeletonLoader.tsx
index 8b1df4cb370..b6ec13f2c43 100644
--- a/packages/twenty-front/src/loading/components/RightPanelSkeletonLoader.tsx
+++ b/packages/twenty-front/src/loading/components/RightPanelSkeletonLoader.tsx
@@ -2,8 +2,11 @@ import { SKELETON_LOADER_HEIGHT_SIZES } from '@/activities/components/SkeletonLo
import { styled } from '@linaria/react';
import { useContext } from 'react';
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
-import { ThemeContext } from 'twenty-ui/theme';
-import { MOBILE_VIEWPORT, themeCssVariables } from 'twenty-ui/theme-constants';
+import {
+ MOBILE_VIEWPORT,
+ ThemeContext,
+ themeCssVariables,
+} from 'twenty-ui/theme-constants';
const StyledMainContainer = styled.div`
background: ${themeCssVariables.background.noisy};
@@ -51,7 +54,6 @@ const StyledRightPanelFlexContainer = styled.div`
const StyledSkeletonHeaderLoader = () => {
const { theme } = useContext(ThemeContext);
-
return (
<StyledHeaderContainer>
<SkeletonTheme
@@ -70,7 +72,6 @@ const StyledSkeletonHeaderLoader = () => {
const StyledSkeletonAddLoader = () => {
const { theme } = useContext(ThemeContext);
-
return (
<SkeletonTheme
baseColor={theme.background.tertiary}
diff --git a/packages/twenty-front/src/modules/action-menu/components/PageHeaderActionMenuButtons.tsx b/packages/twenty-front/src/modules/action-menu/components/PageHeaderActionMenuButtons.tsx
index 9321dfa18c5..a6811eaaa2e 100644
--- a/packages/twenty-front/src/modules/action-menu/components/PageHeaderActionMenuButtons.tsx
+++ b/packages/twenty-front/src/modules/action-menu/components/PageHeaderActionMenuButtons.tsx
@@ -3,7 +3,7 @@ import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext';
import { styled } from '@linaria/react';
import { motion } from 'framer-motion';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
const StyledActionContainer = styled(motion.div)`
display: flex;
@@ -12,9 +12,8 @@ const StyledActionContainer = styled(motion.div)`
`;
export const PageHeaderActionMenuButtons = () => {
- const { actions } = useContext(ActionMenuContext);
const { theme } = useContext(ThemeContext);
-
+ const { actions } = useContext(ActionMenuContext);
const pinnedActions = actions.filter((entry) => entry.isPinned).toReversed();
const actionsWithPositionForAnimation = pinnedActions.map(
diff --git a/packages/twenty-front/src/modules/activities/calendar/components/CalendarDayCardContent.tsx b/packages/twenty-front/src/modules/activities/calendar/components/CalendarDayCardContent.tsx
index 8276e4d84ce..f96ec1768ef 100644
--- a/packages/twenty-front/src/modules/activities/calendar/components/CalendarDayCardContent.tsx
+++ b/packages/twenty-front/src/modules/activities/calendar/components/CalendarDayCardContent.tsx
@@ -1,12 +1,11 @@
-import { useContext } from 'react';
import { styled } from '@linaria/react';
import { differenceInSeconds, endOfDay, format } from 'date-fns';
+import { useContext } from 'react';
import { CalendarEventRow } from '@/activities/calendar/components/CalendarEventRow';
import { getCalendarEventStartDate } from '@/activities/calendar/utils/getCalendarEventStartDate';
import { CardContent } from 'twenty-ui/layout';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { type TimelineCalendarEvent } from '~/generated/graphql';
type CalendarDayCardContentProps = {
@@ -54,7 +53,6 @@ export const CalendarDayCardContent = ({
divider,
}: CalendarDayCardContentProps) => {
const { theme } = useContext(ThemeContext);
-
const endOfDayDate = endOfDay(getCalendarEventStartDate(calendarEvents[0]));
const dayEndsIn = differenceInSeconds(endOfDayDate, Date.now());
@@ -63,7 +61,9 @@ export const CalendarDayCardContent = ({
const upcomingDayCardContentVariants = {
upcoming: {},
- ended: { backgroundColor: theme.background.primary },
+ ended: {
+ backgroundColor: theme.background.primary,
+ },
};
return (
diff --git a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventNotSharedContent.tsx b/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventNotSharedContent.tsx
index 4cf667e29dd..8dc32bf6f6c 100644
--- a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventNotSharedContent.tsx
+++ b/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventNotSharedContent.tsx
@@ -1,10 +1,9 @@
-import { useContext } from 'react';
import { styled } from '@linaria/react';
import { Trans } from '@lingui/react/macro';
+import { useContext } from 'react';
import { IconLock } from 'twenty-ui/display';
import { Card, CardContent } from 'twenty-ui/layout';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledVisibilityCard = styled(Card)`
color: ${themeCssVariables.font.color.light};
diff --git a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventParticipantsResponseStatusField.tsx b/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventParticipantsResponseStatusField.tsx
index 2b273446e99..424308772b1 100644
--- a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventParticipantsResponseStatusField.tsx
+++ b/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventParticipantsResponseStatusField.tsx
@@ -7,8 +7,7 @@ import { ParticipantChip } from '@/activities/components/ParticipantChip';
import { EllipsisDisplay } from '@/ui/field/display/components/EllipsisDisplay';
import { ExpandableList } from '@/ui/layout/expandable-list/components/ExpandableList';
import { IconCheck, IconQuestionMark, IconX } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledInlineCellBaseContainer = styled.div`
align-items: center;
diff --git a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventRow.tsx b/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventRow.tsx
index 5240a159adc..b8a22e4431b 100644
--- a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventRow.tsx
+++ b/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventRow.tsx
@@ -1,4 +1,3 @@
-import { useContext } from 'react';
import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
import { format } from 'date-fns';
@@ -15,9 +14,9 @@ import { getCalendarEventStartDate } from '@/activities/calendar/utils/getCalend
import { hasCalendarEventEnded } from '@/activities/calendar/utils/hasCalendarEventEnded';
import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';
import { useOpenCalendarEventInCommandMenu } from '@/command-menu/hooks/useOpenCalendarEventInCommandMenu';
+import { useContext } from 'react';
import { IconArrowRight } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
type CalendarEventRowProps = {
calendarEvent: TimelineCalendarEvent;
diff --git a/packages/twenty-front/src/modules/activities/components/SkeletonLoader.tsx b/packages/twenty-front/src/modules/activities/components/SkeletonLoader.tsx
index 66feefa7d80..14cfaf2e13c 100644
--- a/packages/twenty-front/src/modules/activities/components/SkeletonLoader.tsx
+++ b/packages/twenty-front/src/modules/activities/components/SkeletonLoader.tsx
@@ -1,8 +1,7 @@
-import { useContext } from 'react';
import { styled } from '@linaria/react';
+import { useContext } from 'react';
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledSkeletonContainer = styled.div`
align-items: center;
@@ -44,7 +43,6 @@ export const SKELETON_LOADER_HEIGHT_SIZES = {
const SkeletonColumnLoader = ({ height }: { height: number }) => {
const { theme } = useContext(ThemeContext);
-
return (
<SkeletonTheme
baseColor={theme.background.tertiary}
diff --git a/packages/twenty-front/src/modules/activities/emails/components/EmailThreadNotShared.tsx b/packages/twenty-front/src/modules/activities/emails/components/EmailThreadNotShared.tsx
index a92347f19b7..3e67b81b409 100644
--- a/packages/twenty-front/src/modules/activities/emails/components/EmailThreadNotShared.tsx
+++ b/packages/twenty-front/src/modules/activities/emails/components/EmailThreadNotShared.tsx
@@ -1,9 +1,8 @@
-import { useContext } from 'react';
import { styled } from '@linaria/react';
import { useLingui } from '@lingui/react/macro';
+import { useContext } from 'react';
import { AppTooltip, IconLock, TooltipDelay } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { MessageChannelVisibility } from '~/generated/graphql';
const StyledContainer = styled.div<{ isCompact?: boolean }>`
@@ -34,8 +33,8 @@ type EmailThreadNotSharedProps = {
export const EmailThreadNotShared = ({
visibility,
}: EmailThreadNotSharedProps) => {
- const { t } = useLingui();
const { theme } = useContext(ThemeContext);
+ const { t } = useLingui();
const containerId = 'email-thread-not-shared';
const isCompact = visibility === MessageChannelVisibility.SUBJECT;
diff --git a/packages/twenty-front/src/modules/activities/emails/components/EmailThreadPreview.tsx b/packages/twenty-front/src/modules/activities/emails/components/EmailThreadPreview.tsx
index 0d618f892ab..bffb0c937d7 100644
--- a/packages/twenty-front/src/modules/activities/emails/components/EmailThreadPreview.tsx
+++ b/packages/twenty-front/src/modules/activities/emails/components/EmailThreadPreview.tsx
@@ -1,12 +1,12 @@
-import { useContext } from 'react';
import { styled } from '@linaria/react';
import { ActivityRow } from '@/activities/components/ActivityRow';
import { EmailThreadNotShared } from '@/activities/emails/components/EmailThreadNotShared';
import { useOpenEmailThreadInCommandMenu } from '@/command-menu/hooks/useOpenEmailThreadInCommandMenu';
+import { useContext } from 'react';
+
import { Avatar } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import {
MessageChannelVisibility,
type TimelineThread,
@@ -75,6 +75,7 @@ type EmailThreadPreviewProps = {
};
export const EmailThreadPreview = ({ thread }: EmailThreadPreviewProps) => {
+ const { theme } = useContext(ThemeContext);
const { openEmailThreadInCommandMenu } = useOpenEmailThreadInCommandMenu();
const visibility = thread.visibility;
@@ -107,8 +108,6 @@ export const EmailThreadPreview = ({ thread }: EmailThreadPreviewProps) => {
};
const isDisabled = visibility !== MessageChannelVisibility.SHARE_EVERYTHING;
- const { theme } = useContext(ThemeContext);
-
return (
<ActivityRow onClick={handleThreadClick} disabled={isDisabled}>
<StyledHeading unread={!thread.read}>
diff --git a/packages/twenty-front/src/modules/activities/files/components/AttachmentRow.tsx b/packages/twenty-front/src/modules/activities/files/components/AttachmentRow.tsx
index 5276def6347..9fb36786cbb 100644
--- a/packages/twenty-front/src/modules/activities/files/components/AttachmentRow.tsx
+++ b/packages/twenty-front/src/modules/activities/files/components/AttachmentRow.tsx
@@ -10,7 +10,7 @@ import {
import { getFileCategoryFromExtension } from '@/object-record/record-field/ui/utils/getFileCategoryFromExtension';
import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';
import { styled } from '@linaria/react';
-import { useContext, useState } from 'react';
+import { useState, useContext } from 'react';
import { isDefined } from 'twenty-shared/utils';
import { type AttachmentWithFile } from '@/activities/files/utils/filterAttachmentsWithFile';
@@ -18,8 +18,7 @@ import { FileIcon } from '@/file/components/FileIcon';
import { useHasPermissionFlag } from '@/settings/roles/hooks/useHasPermissionFlag';
import { CoreObjectNameSingular } from 'twenty-shared/types';
import { IconCalendar, OverflowingTextWithTooltip } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { isNavigationModifierPressed } from 'twenty-ui/utilities';
import { PermissionFlagType } from '~/generated-metadata/graphql';
import { formatToHumanReadableDate } from '~/utils/date-utils';
diff --git a/packages/twenty-front/src/modules/activities/files/components/DocumentViewer.tsx b/packages/twenty-front/src/modules/activities/files/components/DocumentViewer.tsx
index 92db34973fa..1c68bc8fb0b 100644
--- a/packages/twenty-front/src/modules/activities/files/components/DocumentViewer.tsx
+++ b/packages/twenty-front/src/modules/activities/files/components/DocumentViewer.tsx
@@ -13,8 +13,7 @@ import { useContext, useEffect, useState } from 'react';
import { isDefined } from 'twenty-shared/utils';
import { IconDownload } from 'twenty-ui/display';
import { Button } from 'twenty-ui/input';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { getFileNameAndExtension } from '~/utils/file/getFileNameAndExtension';
const MS_OFFICE_EXTENSIONS = [
@@ -200,8 +199,8 @@ export const DocumentViewer = ({
documentUrl,
documentExtension,
}: DocumentViewerProps) => {
- const { t } = useLingui();
const { theme } = useContext(ThemeContext);
+ const { t } = useLingui();
const [csvPreview, setCsvPreview] = useState<CsvPreviewData | undefined>(
undefined,
);
diff --git a/packages/twenty-front/src/modules/activities/files/components/DropZone.tsx b/packages/twenty-front/src/modules/activities/files/components/DropZone.tsx
index c6b6f142c1d..66065ac61f1 100644
--- a/packages/twenty-front/src/modules/activities/files/components/DropZone.tsx
+++ b/packages/twenty-front/src/modules/activities/files/components/DropZone.tsx
@@ -1,12 +1,11 @@
-import { useContext } from 'react';
import { styled } from '@linaria/react';
import { useLingui } from '@lingui/react/macro';
+import { useContext } from 'react';
import { useDropzone } from 'react-dropzone';
import { useSpreadsheetImportInternal } from '@/spreadsheet-import/hooks/useSpreadsheetImportInternal';
import { IconUpload } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledContainer = styled.div`
align-items: center;
@@ -49,8 +48,8 @@ export const DropZone = ({
setIsDraggingFile,
onUploadFiles,
}: DropZoneProps) => {
- const { t } = useLingui();
const { theme } = useContext(ThemeContext);
+ const { t } = useLingui();
const { maxFileSize } = useSpreadsheetImportInternal();
const { getRootProps, getInputProps, isDragActive } = useDropzone({
diff --git a/packages/twenty-front/src/modules/activities/tasks/components/TaskRow.tsx b/packages/twenty-front/src/modules/activities/tasks/components/TaskRow.tsx
index cb4874046a8..df23d4d2201 100644
--- a/packages/twenty-front/src/modules/activities/tasks/components/TaskRow.tsx
+++ b/packages/twenty-front/src/modules/activities/tasks/components/TaskRow.tsx
@@ -1,4 +1,3 @@
-import { useContext } from 'react';
import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
@@ -14,10 +13,10 @@ import { CoreObjectNameSingular } from 'twenty-shared/types';
import { StopPropagationContainer } from '@/object-record/record-board/record-board-card/components/StopPropagationContainer';
import { RecordFieldsScopeContextProvider } from '@/object-record/record-field-list/contexts/RecordFieldsScopeContext';
import { FieldContextProvider } from '@/object-record/record-field/ui/components/FieldContextProvider';
+import { useContext } from 'react';
import { IconCalendar, OverflowingTextWithTooltip } from 'twenty-ui/display';
import { Checkbox, CheckboxShape } from 'twenty-ui/input';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { useCompleteTask } from '@/activities/tasks/hooks/useCompleteTask';
const StyledTaskBody = styled.div`
diff --git a/packages/twenty-front/src/modules/advanced-text-editor/components/TurnIntoBlockDropdown.tsx b/packages/twenty-front/src/modules/advanced-text-editor/components/TurnIntoBlockDropdown.tsx
index eb1213e5555..9c4b399119c 100644
--- a/packages/twenty-front/src/modules/advanced-text-editor/components/TurnIntoBlockDropdown.tsx
+++ b/packages/twenty-front/src/modules/advanced-text-editor/components/TurnIntoBlockDropdown.tsx
@@ -9,8 +9,7 @@ import { type Editor } from '@tiptap/react';
import { useContext, useId } from 'react';
import { IconPilcrow } from 'twenty-ui/display';
import { MenuItem } from 'twenty-ui/navigation';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledMenuItem = styled.button`
align-items: center;
@@ -45,7 +44,6 @@ export const TurnIntoBlockDropdown = ({
editor,
}: TurnIntoBlockDropdownProps) => {
const { theme } = useContext(ThemeContext);
-
const instanceId = useId();
const dropdownId = `turn-into-block-dropdown-${instanceId}`;
const { toggleDropdown } = useToggleDropdown();
@@ -84,7 +82,7 @@ export const TurnIntoBlockDropdown = ({
</StyledMenuItem>
}
dropdownOffset={{
- y: parseInt(theme.spacing(1), 10),
+ y: parseInt(theme.spacing[1], 10),
}}
/>
);
diff --git a/packages/twenty-front/src/modules/advanced-text-editor/components/WorkflowAttachmentChip.tsx b/packages/twenty-front/src/modules/advanced-text-editor/components/WorkflowAttachmentChip.tsx
index e2d4eb2564b..704c2356834 100644
--- a/packages/twenty-front/src/modules/advanced-text-editor/components/WorkflowAttachmentChip.tsx
+++ b/packages/twenty-front/src/modules/advanced-text-editor/components/WorkflowAttachmentChip.tsx
@@ -6,8 +6,7 @@ import { useContext } from 'react';
import { type WorkflowAttachment } from 'twenty-shared/workflow';
import { AvatarOrIcon } from 'twenty-ui/components';
import { IconX } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
type WorkflowAttachmentChipProps = {
file: WorkflowAttachment;
@@ -65,8 +64,8 @@ export const WorkflowAttachmentChip = ({
onRemove,
readonly = false,
}: WorkflowAttachmentChipProps) => {
- const iconColors = useFileCategoryColors();
const { theme } = useContext(ThemeContext);
+ const iconColors = useFileCategoryColors();
return (
<StyledChip data-chip deletable={!readonly}>
diff --git a/packages/twenty-front/src/modules/advanced-text-editor/components/WorkflowSendEmailAttachments.tsx b/packages/twenty-front/src/modules/advanced-text-editor/components/WorkflowSendEmailAttachments.tsx
index ce68b31befc..999d45e1f43 100644
--- a/packages/twenty-front/src/modules/advanced-text-editor/components/WorkflowSendEmailAttachments.tsx
+++ b/packages/twenty-front/src/modules/advanced-text-editor/components/WorkflowSendEmailAttachments.tsx
@@ -8,8 +8,7 @@ import { type ChangeEvent, useContext, useRef } from 'react';
import { isDefined } from 'twenty-shared/utils';
import { type WorkflowAttachment } from 'twenty-shared/workflow';
import { IconUpload } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
type WorkflowSendEmailAttachmentsProps = {
files: WorkflowAttachment[];
@@ -67,11 +66,10 @@ export const WorkflowSendEmailAttachments = ({
label,
onChange,
}: WorkflowSendEmailAttachmentsProps) => {
+ const { theme } = useContext(ThemeContext);
const fileInputRef = useRef<HTMLInputElement>(null);
const { uploadWorkflowFile } = useUploadWorkflowFile();
const { t } = useLingui();
- const { theme } = useContext(ThemeContext);
-
const handleAddFileClick = (e: React.MouseEvent) => {
const target = e.target as HTMLElement;
diff --git a/packages/twenty-front/src/modules/ai/components/AIChatAssistantMessageRenderer.tsx b/packages/twenty-front/src/modules/ai/components/AIChatAssistantMessageRenderer.tsx
index c793ceb7112..b538346cc26 100644
--- a/packages/twenty-front/src/modules/ai/components/AIChatAssistantMessageRenderer.tsx
+++ b/packages/twenty-front/src/modules/ai/components/AIChatAssistantMessageRenderer.tsx
@@ -7,11 +7,10 @@ import { LazyMarkdownRenderer } from '@/ai/components/LazyMarkdownRenderer';
import { ToolStepRenderer } from '@/ai/components/ToolStepRenderer';
import { groupContiguousThinkingStepParts } from '@/ai/utils/groupContiguousThinkingStepParts';
import { styled } from '@linaria/react';
-import { useContext } from 'react';
import { isToolUIPart, type ToolUIPart } from 'ai';
import { type ExtendedUIMessagePart } from 'twenty-shared/ai';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { useContext } from 'react';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledMessagePartsContainer = styled.div`
display: flex;
diff --git a/packages/twenty-front/src/modules/ai/components/AIChatErrorMessage.tsx b/packages/twenty-front/src/modules/ai/components/AIChatErrorMessage.tsx
index 2082e6a6a4d..96c70e5ce11 100644
--- a/packages/twenty-front/src/modules/ai/components/AIChatErrorMessage.tsx
+++ b/packages/twenty-front/src/modules/ai/components/AIChatErrorMessage.tsx
@@ -4,11 +4,10 @@ import { dispatchBrowserEvent } from '@/browser-event/utils/dispatchBrowserEvent
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
-import { useContext } from 'react';
import { IconAlertCircle, IconRefresh } from 'twenty-ui/display';
import { Button } from 'twenty-ui/input';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { useContext } from 'react';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledErrorContainer = styled.div`
align-items: center;
diff --git a/packages/twenty-front/src/modules/ai/components/AIChatThreadGroup.tsx b/packages/twenty-front/src/modules/ai/components/AIChatThreadGroup.tsx
index 75541c0cd21..8e0d066d2dc 100644
--- a/packages/twenty-front/src/modules/ai/components/AIChatThreadGroup.tsx
+++ b/packages/twenty-front/src/modules/ai/components/AIChatThreadGroup.tsx
@@ -1,10 +1,9 @@
import { useAIChatThreadClick } from '@/ai/hooks/useAIChatThreadClick';
import { styled } from '@linaria/react';
-import { useContext } from 'react';
import { useLingui } from '@lingui/react/macro';
+import { useContext } from 'react';
import { IconSparkles } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { type AgentChatThread } from '~/generated-metadata/graphql';
const StyledThreadsList = styled.div`
@@ -73,8 +72,8 @@ export const AIChatThreadGroup = ({
threads: AgentChatThread[];
title: string;
}) => {
- const { t } = useLingui();
const { theme } = useContext(ThemeContext);
+ const { t } = useLingui();
const { handleThreadClick } = useAIChatThreadClick();
if (threads.length === 0) {
diff --git a/packages/twenty-front/src/modules/ai/components/CodeExecutionDisplay.tsx b/packages/twenty-front/src/modules/ai/components/CodeExecutionDisplay.tsx
index 7c20c6df8d2..08a61615cd5 100644
--- a/packages/twenty-front/src/modules/ai/components/CodeExecutionDisplay.tsx
+++ b/packages/twenty-front/src/modules/ai/components/CodeExecutionDisplay.tsx
@@ -15,8 +15,7 @@ import {
} from 'twenty-ui/display';
import { CodeEditor, LightIconButton } from 'twenty-ui/input';
import { AnimatedExpandableContainer } from 'twenty-ui/layout';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { useCopyToClipboard } from '~/hooks/useCopyToClipboard';
const StyledContainer = styled.div`
@@ -202,8 +201,8 @@ export const CodeExecutionDisplay = ({
files = [],
isRunning = false,
}: CodeExecutionDisplayProps) => {
- const { t } = useLingui();
const { theme } = useContext(ThemeContext);
+ const { t } = useLingui();
const { copyToClipboard } = useCopyToClipboard();
const [isCodeExpanded, setIsCodeExpanded] = useState(false);
const [isOutputExpanded, setIsOutputExpanded] = useState(true);
diff --git a/packages/twenty-front/src/modules/ai/components/LazyMarkdownRenderer.tsx b/packages/twenty-front/src/modules/ai/components/LazyMarkdownRenderer.tsx
index 801ad267ea1..40c005d1142 100644
--- a/packages/twenty-front/src/modules/ai/components/LazyMarkdownRenderer.tsx
+++ b/packages/twenty-front/src/modules/ai/components/LazyMarkdownRenderer.tsx
@@ -13,7 +13,7 @@ import {
import { lazy, Suspense, useContext } from 'react';
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
import { isDefined } from 'twenty-shared/utils';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
const TextWithRecordLinks = ({ text }: { text: string }) => {
const parts: React.ReactNode[] = [];
@@ -132,7 +132,6 @@ const MarkdownRenderer = lazy(async () => {
const LoadingSkeleton = () => {
const { theme } = useContext(ThemeContext);
-
return (
<SkeletonTheme
baseColor={theme.background.tertiary}
diff --git a/packages/twenty-front/src/modules/ai/components/ReasoningSummaryDisplay.tsx b/packages/twenty-front/src/modules/ai/components/ReasoningSummaryDisplay.tsx
index 4dea7c66e5c..78550b6970c 100644
--- a/packages/twenty-front/src/modules/ai/components/ReasoningSummaryDisplay.tsx
+++ b/packages/twenty-front/src/modules/ai/components/ReasoningSummaryDisplay.tsx
@@ -3,8 +3,7 @@ import { useContext, useState } from 'react';
import { IconBrain, IconChevronDown, IconChevronUp } from 'twenty-ui/display';
import { AnimatedExpandableContainer } from 'twenty-ui/layout';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { ShimmeringText } from '@/ai/components/ShimmeringText';
import { t } from '@lingui/core/macro';
diff --git a/packages/twenty-front/src/modules/ai/components/RoutingDebugDisplay.tsx b/packages/twenty-front/src/modules/ai/components/RoutingDebugDisplay.tsx
index 1023fedbbf6..b9ae08d87b4 100644
--- a/packages/twenty-front/src/modules/ai/components/RoutingDebugDisplay.tsx
+++ b/packages/twenty-front/src/modules/ai/components/RoutingDebugDisplay.tsx
@@ -4,8 +4,7 @@ import { useContext, useState } from 'react';
import { IconChevronDown, IconChevronUp } from 'twenty-ui/display';
import { JsonTree } from 'twenty-ui/json-visualizer';
import { AnimatedExpandableContainer } from 'twenty-ui/layout';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { useLingui } from '@lingui/react/macro';
import { type DataMessagePart } from 'twenty-shared/ai';
@@ -323,8 +322,8 @@ type RoutingDebugDisplayProps = {
};
export const RoutingDebugDisplay = ({ debug }: RoutingDebugDisplayProps) => {
- const { t } = useLingui();
const { theme } = useContext(ThemeContext);
+ const { t } = useLingui();
const { copyToClipboard } = useCopyToClipboard();
const [isExpanded, setIsExpanded] = useState(false);
const [activeTab, setActiveTab] = useState<TabType>('timing');
diff --git a/packages/twenty-front/src/modules/ai/components/RoutingStatusDisplay.tsx b/packages/twenty-front/src/modules/ai/components/RoutingStatusDisplay.tsx
index f12bec2083b..db5f110fa07 100644
--- a/packages/twenty-front/src/modules/ai/components/RoutingStatusDisplay.tsx
+++ b/packages/twenty-front/src/modules/ai/components/RoutingStatusDisplay.tsx
@@ -5,8 +5,7 @@ import { useContext, useState } from 'react';
import { type DataMessagePart } from 'twenty-shared/ai';
import { IconChevronDown, IconChevronUp, IconCpu } from 'twenty-ui/display';
import { AnimatedExpandableContainer } from 'twenty-ui/layout';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledContainer = styled.div`
display: flex;
diff --git a/packages/twenty-front/src/modules/ai/components/ToolStepRenderer.tsx b/packages/twenty-front/src/modules/ai/components/ToolStepRenderer.tsx
index 1f50191f24f..2e69dfa2fb0 100644
--- a/packages/twenty-front/src/modules/ai/components/ToolStepRenderer.tsx
+++ b/packages/twenty-front/src/modules/ai/components/ToolStepRenderer.tsx
@@ -4,8 +4,7 @@ import { useContext, useState } from 'react';
import { IconChevronDown, IconChevronUp } from 'twenty-ui/display';
import { JsonTree } from 'twenty-ui/json-visualizer';
import { AnimatedExpandableContainer } from 'twenty-ui/layout';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { CodeExecutionDisplay } from '@/ai/components/CodeExecutionDisplay';
import { ShimmeringText } from '@/ai/components/ShimmeringText';
@@ -137,8 +136,8 @@ export const ToolStepRenderer = ({
toolPart: ToolUIPart;
isStreaming: boolean;
}) => {
- const { t } = useLingui();
const { theme } = useContext(ThemeContext);
+ const { t } = useLingui();
const { copyToClipboard } = useCopyToClipboard();
const [isExpanded, setIsExpanded] = useState(false);
const [activeTab, setActiveTab] = useState<TabType>('output');
diff --git a/packages/twenty-front/src/modules/ai/components/__tests__/AIChatAssistantMessageRenderer.test.tsx b/packages/twenty-front/src/modules/ai/components/__tests__/AIChatAssistantMessageRenderer.test.tsx
index 368c23cacb7..edf6c76c70d 100644
--- a/packages/twenty-front/src/modules/ai/components/__tests__/AIChatAssistantMessageRenderer.test.tsx
+++ b/packages/twenty-front/src/modules/ai/components/__tests__/AIChatAssistantMessageRenderer.test.tsx
@@ -1,5 +1,5 @@
import { render, screen } from '@testing-library/react';
-import { THEME_LIGHT, ThemeContextProvider } from 'twenty-ui/theme';
+import { ThemeProvider } from 'twenty-ui/theme-constants';
import { type ExtendedUIMessagePart } from 'twenty-shared/ai';
import { AIChatAssistantMessageRenderer } from '@/ai/components/AIChatAssistantMessageRenderer';
@@ -42,12 +42,12 @@ jest.mock('@/ai/components/CodeExecutionDisplay', () => ({
const renderAssistantRenderer = (messageParts: ExtendedUIMessagePart[]) => {
return render(
- <ThemeContextProvider theme={THEME_LIGHT}>
+ <ThemeProvider colorScheme="light">
<AIChatAssistantMessageRenderer
messageParts={messageParts}
isLastMessageStreaming={false}
/>
- </ThemeContextProvider>,
+ </ThemeProvider>,
);
};
diff --git a/packages/twenty-front/src/modules/ai/components/__tests__/ThinkingStepsDisplay.test.tsx b/packages/twenty-front/src/modules/ai/components/__tests__/ThinkingStepsDisplay.test.tsx
index 442282a7429..19a3a1d3295 100644
--- a/packages/twenty-front/src/modules/ai/components/__tests__/ThinkingStepsDisplay.test.tsx
+++ b/packages/twenty-front/src/modules/ai/components/__tests__/ThinkingStepsDisplay.test.tsx
@@ -1,6 +1,6 @@
import { render, screen, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
-import { THEME_LIGHT, ThemeContextProvider } from 'twenty-ui/theme';
+import { ThemeProvider } from 'twenty-ui/theme-constants';
import { ThinkingStepsDisplay } from '@/ai/components/ThinkingStepsDisplay';
import { type ThinkingStepPart } from '@/ai/utils/thinkingStepPart';
@@ -80,13 +80,13 @@ const renderThinkingStepsDisplay = ({
hasAssistantTextResponseStarted?: boolean;
}) => {
return render(
- <ThemeContextProvider theme={THEME_LIGHT}>
+ <ThemeProvider colorScheme="light">
<ThinkingStepsDisplay
parts={parts}
isLastMessageStreaming={isLastMessageStreaming}
hasAssistantTextResponseStarted={hasAssistantTextResponseStarted}
/>
- </ThemeContextProvider>,
+ </ThemeProvider>,
);
};
diff --git a/packages/twenty-front/src/modules/ai/components/internal/AIChatContextUsageButton.tsx b/packages/twenty-front/src/modules/ai/components/internal/AIChatContextUsageButton.tsx
index 8ff23b5aa9b..eabf08ea757 100644
--- a/packages/twenty-front/src/modules/ai/components/internal/AIChatContextUsageButton.tsx
+++ b/packages/twenty-front/src/modules/ai/components/internal/AIChatContextUsageButton.tsx
@@ -1,11 +1,10 @@
import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
import { useLingui } from '@lingui/react/macro';
-import { useContext, useState } from 'react';
+import { useState } from 'react';
import { isDefined } from 'twenty-shared/utils';
import { HorizontalSeparator } from 'twenty-ui/display';
import { ProgressBar } from 'twenty-ui/feedback';
-import { ThemeContext } from 'twenty-ui/theme';
import { themeCssVariables } from 'twenty-ui/theme-constants';
import { ContextUsageProgressRing } from '@/ai/components/internal/ContextUsageProgressRing';
@@ -116,7 +115,6 @@ const getCachedLabel = (lastMessage: AgentChatLastMessageUsage): string => {
export const AIChatContextUsageButton = () => {
const { t } = useLingui();
- const { theme } = useContext(ThemeContext);
const [isHovered, setIsHovered] = useState(false);
const agentChatUsage = useAtomStateValue(agentChatUsageState);
@@ -175,19 +173,22 @@ export const AIChatContextUsageButton = () => {
value={percentage}
barColor={
percentage > 80
- ? theme.color.red
+ ? themeCssVariables.color.red
: percentage > 60
- ? theme.color.orange
- : theme.color.blue
+ ? themeCssVariables.color.orange
+ : themeCssVariables.color.blue
}
- backgroundColor={theme.background.tertiary}
+ backgroundColor={themeCssVariables.background.tertiary}
withBorderRadius
/>
</StyledSection>
{isDefined(lastMessage) && (
<>
- <HorizontalSeparator noMargin color={theme.background.tertiary} />
+ <HorizontalSeparator
+ noMargin
+ color={themeCssVariables.background.tertiary}
+ />
<StyledSection>
<StyledSectionTitle>{t`Last message`}</StyledSectionTitle>
<SettingsBillingLabelValueItem
@@ -206,7 +207,10 @@ export const AIChatContextUsageButton = () => {
</>
)}
- <HorizontalSeparator noMargin color={theme.background.tertiary} />
+ <HorizontalSeparator
+ noMargin
+ color={themeCssVariables.background.tertiary}
+ />
<StyledSection>
<StyledSectionTitle>{t`Conversation`}</StyledSectionTitle>
<SettingsBillingLabelValueItem
diff --git a/packages/twenty-front/src/modules/ai/components/internal/AIChatSkeletonLoader.tsx b/packages/twenty-front/src/modules/ai/components/internal/AIChatSkeletonLoader.tsx
index 79663c48e1f..91aa50c04bd 100644
--- a/packages/twenty-front/src/modules/ai/components/internal/AIChatSkeletonLoader.tsx
+++ b/packages/twenty-front/src/modules/ai/components/internal/AIChatSkeletonLoader.tsx
@@ -5,8 +5,7 @@ import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomState
import { styled } from '@linaria/react';
import { useContext } from 'react';
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledSkeletonContainer = styled.div`
display: flex;
diff --git a/packages/twenty-front/src/modules/ai/components/internal/AgentChatFilePreview.tsx b/packages/twenty-front/src/modules/ai/components/internal/AgentChatFilePreview.tsx
index c9dd3214744..214d9a63419 100644
--- a/packages/twenty-front/src/modules/ai/components/internal/AgentChatFilePreview.tsx
+++ b/packages/twenty-front/src/modules/ai/components/internal/AgentChatFilePreview.tsx
@@ -13,7 +13,7 @@ import { isDefined } from 'twenty-shared/utils';
import { AvatarOrIcon, Chip, ChipVariant } from 'twenty-ui/components';
import { type IconComponent, IconX } from 'twenty-ui/display';
import { Loader } from 'twenty-ui/feedback';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
const StyledClickableContainer = styled.div<{ clickable: boolean }>`
cursor: ${({ clickable }: { clickable: boolean }) =>
diff --git a/packages/twenty-front/src/modules/ai/components/internal/ContextUsageProgressRing.tsx b/packages/twenty-front/src/modules/ai/components/internal/ContextUsageProgressRing.tsx
index 56c585f7a09..fac99659f02 100644
--- a/packages/twenty-front/src/modules/ai/components/internal/ContextUsageProgressRing.tsx
+++ b/packages/twenty-front/src/modules/ai/components/internal/ContextUsageProgressRing.tsx
@@ -1,6 +1,4 @@
import { styled } from '@linaria/react';
-import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
import { themeCssVariables } from 'twenty-ui/theme-constants';
type ContextUsageProgressRingProps = {
@@ -32,8 +30,6 @@ export const ContextUsageProgressRing = ({
size = 16,
strokeWidth = 2,
}: ContextUsageProgressRingProps) => {
- const { theme } = useContext(ThemeContext);
-
const normalizedPercentage = Math.min(Math.max(percentage, 0), 100);
const radius = (size - strokeWidth) / 2;
const circumference = 2 * Math.PI * radius;
@@ -42,10 +38,10 @@ export const ContextUsageProgressRing = ({
const progressColor =
normalizedPercentage > 80
- ? theme.color.red
+ ? themeCssVariables.color.red
: normalizedPercentage > 60
- ? theme.color.orange
- : theme.color.blue;
+ ? themeCssVariables.color.orange
+ : themeCssVariables.color.blue;
return (
<StyledSvg width={size} height={size}>
@@ -60,7 +56,7 @@ export const ContextUsageProgressRing = ({
cy={size / 2}
r={radius}
strokeWidth={strokeWidth}
- stroke={progressColor}
+ style={{ stroke: progressColor }}
strokeDasharray={circumference}
strokeDashoffset={strokeDashoffset}
strokeLinecap="round"
diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/components/SignInUpGlobalScopeForm.tsx b/packages/twenty-front/src/modules/auth/sign-in-up/components/SignInUpGlobalScopeForm.tsx
index 2ddff5bd51e..6804655f3ac 100644
--- a/packages/twenty-front/src/modules/auth/sign-in-up/components/SignInUpGlobalScopeForm.tsx
+++ b/packages/twenty-front/src/modules/auth/sign-in-up/components/SignInUpGlobalScopeForm.tsx
@@ -30,8 +30,7 @@ import {
IconChevronRight,
IconPlus,
} from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { type AvailableWorkspace } from '~/generated-metadata/graphql';
import { getWorkspaceUrl } from '~/utils/getWorkspaceUrl';
@@ -135,11 +134,11 @@ const StyledForgotPasswordLinkContainer = styled.div`
`;
export const SignInUpGlobalScopeForm = () => {
+ const { theme } = useContext(ThemeContext);
const authProviders = useAtomStateValue(authProvidersState);
const signInUpStep = useAtomStateValue(signInUpStepState);
const { buildWorkspaceUrl } = useBuildWorkspaceUrl();
const { signOut } = useAuth();
- const { theme } = useContext(ThemeContext);
const { createWorkspace } = useSignUpInNewWorkspace();
const availableWorkspaces = useAtomStateValue(availableWorkspacesState);
diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/components/__tests__/SignInUpGlobalScopeForm.test.tsx b/packages/twenty-front/src/modules/auth/sign-in-up/components/__tests__/SignInUpGlobalScopeForm.test.tsx
index 8bb2fbb74bb..6bc9eb492f4 100644
--- a/packages/twenty-front/src/modules/auth/sign-in-up/components/__tests__/SignInUpGlobalScopeForm.test.tsx
+++ b/packages/twenty-front/src/modules/auth/sign-in-up/components/__tests__/SignInUpGlobalScopeForm.test.tsx
@@ -3,11 +3,7 @@ import { I18nProvider } from '@lingui/react';
import { fireEvent, render, screen } from '@testing-library/react';
import { Provider as JotaiProvider } from 'jotai';
import { SOURCE_LOCALE } from 'twenty-shared/translations';
-import {
- THEME_LIGHT,
- ThemeContextProvider,
- ThemeProvider,
-} from 'twenty-ui/theme';
+import { ThemeProvider } from 'twenty-ui/theme-constants';
import { SignInUpGlobalScopeForm } from '@/auth/sign-in-up/components/SignInUpGlobalScopeForm';
import {
@@ -98,12 +94,10 @@ describe('SignInUpGlobalScopeForm', () => {
render(
<JotaiProvider store={jotaiStore}>
- <ThemeProvider theme={THEME_LIGHT}>
- <ThemeContextProvider theme={THEME_LIGHT}>
- <I18nProvider i18n={i18n}>
- <SignInUpGlobalScopeForm />
- </I18nProvider>
- </ThemeContextProvider>
+ <ThemeProvider colorScheme="light">
+ <I18nProvider i18n={i18n}>
+ <SignInUpGlobalScopeForm />
+ </I18nProvider>
</ThemeProvider>
</JotaiProvider>,
);
diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpPasswordField.tsx b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpPasswordField.tsx
index cccac77c27e..578afe3363b 100644
--- a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpPasswordField.tsx
+++ b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpPasswordField.tsx
@@ -7,8 +7,7 @@ import { motion } from 'framer-motion';
import { useContext } from 'react';
import { Controller, useFormContext } from 'react-hook-form';
import { StyledText } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledFullWidthMotionDiv = styled(motion.div)`
width: 100%;
@@ -25,8 +24,8 @@ export const SignInUpPasswordField = ({
showErrors: boolean;
signInUpMode: SignInUpMode;
}) => {
- const { t } = useLingui();
const { theme } = useContext(ThemeContext);
+ const { t } = useLingui();
const form = useFormContext<Form>();
return (
diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpTwoFactorAuthenticationProvision.tsx b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpTwoFactorAuthenticationProvision.tsx
index d88aa1323e3..0612361f929 100644
--- a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpTwoFactorAuthenticationProvision.tsx
+++ b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpTwoFactorAuthenticationProvision.tsx
@@ -7,14 +7,13 @@ import {
import { extractSecretFromOtpUri } from '@/settings/two-factor-authentication/utils/extractSecretFromOtpUri';
import { styled } from '@linaria/react';
import { Trans, useLingui } from '@lingui/react/macro';
-import { useContext } from 'react';
import QRCode from 'react-qr-code';
import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';
import { IconCopy } from 'twenty-ui/display';
import { Loader } from 'twenty-ui/feedback';
import { MainButton } from 'twenty-ui/input';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { useContext } from 'react';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
import { useCopyToClipboard } from '~/hooks/useCopyToClipboard';
@@ -69,8 +68,8 @@ const StyledCopySetupKeyLink = styled.button`
`;
export const SignInUpTwoFactorAuthenticationProvision = () => {
- const { t } = useLingui();
const { theme } = useContext(ThemeContext);
+ const { t } = useLingui();
const { copyToClipboard } = useCopyToClipboard();
const qrCode = useAtomStateValue(qrCodeState);
const setSignInUpStep = useSetAtomState(signInUpStepState);
diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWithGoogle.tsx b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWithGoogle.tsx
index c4b7a67df7c..31a79a7f16b 100644
--- a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWithGoogle.tsx
+++ b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWithGoogle.tsx
@@ -11,12 +11,11 @@ import { useLingui } from '@lingui/react/macro';
import { memo, useContext } from 'react';
import { HorizontalSeparator, IconGoogle } from 'twenty-ui/display';
import { MainButton } from 'twenty-ui/input';
-import { ThemeContext } from 'twenty-ui/theme';
import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
import { LastUsedPill } from './LastUsedPill';
import { StyledSSOButtonContainer } from './SignInUpSSOButtonStyles';
-
+import { ThemeContext } from 'twenty-ui/theme-constants';
const GoogleIcon = memo(() => {
const { theme } = useContext(ThemeContext);
return <IconGoogle size={theme.icon.size.md} />;
diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWithMicrosoft.tsx b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWithMicrosoft.tsx
index fe7fc4306c6..4302b1b9b92 100644
--- a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWithMicrosoft.tsx
+++ b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWithMicrosoft.tsx
@@ -11,11 +11,11 @@ import { useLingui } from '@lingui/react/macro';
import { useContext } from 'react';
import { HorizontalSeparator, IconMicrosoft } from 'twenty-ui/display';
import { MainButton } from 'twenty-ui/input';
-import { ThemeContext } from 'twenty-ui/theme';
import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
import { LastUsedPill } from './LastUsedPill';
import { StyledSSOButtonContainer } from './SignInUpSSOButtonStyles';
+import { ThemeContext } from 'twenty-ui/theme-constants';
export const SignInUpWithMicrosoft = ({
action,
diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWithSSO.tsx b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWithSSO.tsx
index eccf3b0e6b5..70be4b7907c 100644
--- a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWithSSO.tsx
+++ b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWithSSO.tsx
@@ -11,13 +11,13 @@ import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomState
import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';
import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';
import { useLingui } from '@lingui/react/macro';
-import { useContext } from 'react';
import { isDefined } from 'twenty-shared/utils';
import { HorizontalSeparator, IconLock } from 'twenty-ui/display';
import { MainButton } from 'twenty-ui/input';
-import { ThemeContext } from 'twenty-ui/theme';
import { LastUsedPill } from './LastUsedPill';
import { StyledSSOButtonContainer } from './SignInUpSSOButtonStyles';
+import { useContext } from 'react';
+import { ThemeContext } from 'twenty-ui/theme-constants';
export const SignInUpWithSSO = () => {
const { theme } = useContext(ThemeContext);
diff --git a/packages/twenty-front/src/modules/billing/components/SettingsBillingCreditsSection.tsx b/packages/twenty-front/src/modules/billing/components/SettingsBillingCreditsSection.tsx
index 28e4fae762d..caa9a714e0f 100644
--- a/packages/twenty-front/src/modules/billing/components/SettingsBillingCreditsSection.tsx
+++ b/packages/twenty-front/src/modules/billing/components/SettingsBillingCreditsSection.tsx
@@ -14,7 +14,7 @@ import { formatToShortNumber } from 'twenty-shared/utils';
import { H2Title, HorizontalSeparator } from 'twenty-ui/display';
import { ProgressBar } from 'twenty-ui/feedback';
import { Section } from 'twenty-ui/layout';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
import { SubscriptionStatus } from '~/generated-metadata/graphql';
export const SettingsBillingCreditsSection = ({
@@ -24,6 +24,7 @@ export const SettingsBillingCreditsSection = ({
CurrentWorkspace['currentBillingSubscription']
>;
}) => {
+ const { theme } = useContext(ThemeContext);
const subscriptionStatus = useSubscriptionStatus();
const { formatNumber } = useNumberFormat();
@@ -60,8 +61,6 @@ export const SettingsBillingCreditsSection = ({
currentBillingSubscription.interval,
);
- const { theme } = useContext(ThemeContext);
-
return (
<>
<Section>
diff --git a/packages/twenty-front/src/modules/billing/components/SubscriptionBenefit.tsx b/packages/twenty-front/src/modules/billing/components/SubscriptionBenefit.tsx
index f30be08d79c..d7292951c83 100644
--- a/packages/twenty-front/src/modules/billing/components/SubscriptionBenefit.tsx
+++ b/packages/twenty-front/src/modules/billing/components/SubscriptionBenefit.tsx
@@ -1,8 +1,7 @@
import { styled } from '@linaria/react';
import React, { useContext } from 'react';
import { IconCheck } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledBenefitContainer = styled.div`
color: ${themeCssVariables.font.color.secondary};
@@ -25,6 +24,7 @@ type SubscriptionBenefitProps = {
};
export const SubscriptionBenefit = ({ children }: SubscriptionBenefitProps) => {
const { theme } = useContext(ThemeContext);
+
return (
<StyledBenefitContainer>
<StyledCheckContainer>
diff --git a/packages/twenty-front/src/modules/billing/components/internal/SubscriptionInfoRowContainer.tsx b/packages/twenty-front/src/modules/billing/components/internal/SubscriptionInfoRowContainer.tsx
index 2cbfd5c366e..3b304490cca 100644
--- a/packages/twenty-front/src/modules/billing/components/internal/SubscriptionInfoRowContainer.tsx
+++ b/packages/twenty-front/src/modules/billing/components/internal/SubscriptionInfoRowContainer.tsx
@@ -2,8 +2,7 @@ import { type IconComponent } from 'twenty-ui/display';
import React, { useContext } from 'react';
import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
type SubscriptionInfoRowContainerProps = {
Icon: IconComponent;
@@ -56,6 +55,7 @@ export const SubscriptionInfoRowContainer = ({
nextValue,
}: SubscriptionInfoRowContainerProps) => {
const { theme } = useContext(ThemeContext);
+
return (
<StyledContainer>
<StyledIconLabelContainer>
diff --git a/packages/twenty-front/src/modules/blocknote-editor/components/BlockEditor.tsx b/packages/twenty-front/src/modules/blocknote-editor/components/BlockEditor.tsx
index a346a75a8b0..6351963336e 100644
--- a/packages/twenty-front/src/modules/blocknote-editor/components/BlockEditor.tsx
+++ b/packages/twenty-front/src/modules/blocknote-editor/components/BlockEditor.tsx
@@ -3,9 +3,6 @@ import { BlockNoteView } from '@blocknote/mantine';
import { SuggestionMenuController } from '@blocknote/react';
import { styled } from '@linaria/react';
import { type ClipboardEvent, useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
-
import { type BLOCK_SCHEMA } from '@/blocknote-editor/blocks/Schema';
import { getSlashMenu } from '@/blocknote-editor/utils/getSlashMenu';
import { CustomMentionMenu } from '@/blocknote-editor/components/CustomMentionMenu';
@@ -15,6 +12,7 @@ import {
type SuggestionItem,
} from '@/blocknote-editor/components/CustomSlashMenu';
import { useMentionMenu } from '@/mention/hooks/useMentionMenu';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
interface BlockEditorProps {
editor: typeof BLOCK_SCHEMA.BlockNoteEditor;
@@ -142,8 +140,9 @@ export const BlockEditor = ({
onPaste,
readonly,
}: BlockEditorProps) => {
- const { theme } = useContext(ThemeContext);
- const blockNoteTheme = theme.name === 'light' ? 'light' : 'dark';
+ const { colorScheme } = useContext(ThemeContext);
+
+ const blockNoteTheme = colorScheme === 'light' ? 'light' : 'dark';
const getMentionItems = useMentionMenu(editor);
const handleFocus = () => {
diff --git a/packages/twenty-front/src/modules/blocknote-editor/components/CustomSideMenuOptions.tsx b/packages/twenty-front/src/modules/blocknote-editor/components/CustomSideMenuOptions.tsx
index 9b6cc0dc284..bd62af35124 100644
--- a/packages/twenty-front/src/modules/blocknote-editor/components/CustomSideMenuOptions.tsx
+++ b/packages/twenty-front/src/modules/blocknote-editor/components/CustomSideMenuOptions.tsx
@@ -1,8 +1,7 @@
import { styled } from '@linaria/react';
import { useContext } from 'react';
import { type IconComponent } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledContainer = styled.div<{ Variant: Variants }>`
color: ${({ Variant }) =>
@@ -29,6 +28,7 @@ export const CustomSideMenuOptions = ({
text,
}: CustomSideMenuOptionsProps) => {
const { theme } = useContext(ThemeContext);
+
return (
<StyledContainer Variant={Variant}>
<LeftIcon
diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuContextRecordChipAvatars.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuContextRecordChipAvatars.tsx
index f3c0fb2a309..627c8bac98b 100644
--- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuContextRecordChipAvatars.tsx
+++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuContextRecordChipAvatars.tsx
@@ -3,11 +3,9 @@ import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataI
import { useRecordChipData } from '@/object-record/hooks/useRecordChipData';
import { type ObjectRecord } from '@/object-record/types/ObjectRecord';
import { styled } from '@linaria/react';
-import { Avatar } from 'twenty-ui/display';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
-
+import { Avatar } from 'twenty-ui/display';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledIconWrapper = styled.div<{ withIconBackground?: boolean }>`
background: ${({ withIconBackground }) =>
withIconBackground ? themeCssVariables.background.primary : 'unset'};
@@ -32,6 +30,7 @@ export const CommandMenuContextRecordChipAvatars = ({
objectMetadataItem: ObjectMetadataItem;
record: ObjectRecord;
}) => {
+ const { theme } = useContext(ThemeContext);
const { recordChipData } = useRecordChipData({
objectNameSingular: objectMetadataItem.nameSingular,
record,
@@ -39,9 +38,6 @@ export const CommandMenuContextRecordChipAvatars = ({
const { Icon, IconColor } = useGetStandardObjectIcon(
objectMetadataItem.nameSingular,
);
-
- const { theme } = useContext(ThemeContext);
-
return (
<StyledIconWrapper
withIconBackground={recordChipData.avatarType !== 'rounded'}
diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuMultipleRecordsInfo.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuMultipleRecordsInfo.tsx
index fb2f2a2623a..48faba1b78c 100644
--- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuMultipleRecordsInfo.tsx
+++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuMultipleRecordsInfo.tsx
@@ -5,7 +5,7 @@ import { CommandMenuPageInfoLayout } from '@/command-menu/components/CommandMenu
import { useFindManyRecordsSelectedInContextStore } from '@/context-store/hooks/useFindManyRecordsSelectedInContextStore';
import { t } from '@lingui/core/macro';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
type CommandMenuMultipleRecordsInfoProps = {
commandMenuPageInstanceId: string;
@@ -15,7 +15,6 @@ export const CommandMenuMultipleRecordsInfo = ({
commandMenuPageInstanceId,
}: CommandMenuMultipleRecordsInfoProps) => {
const { theme } = useContext(ThemeContext);
-
const { totalCount } = useFindManyRecordsSelectedInContextStore({
instanceId: commandMenuPageInstanceId,
limit: 1,
diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuOpenContainer.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuOpenContainer.tsx
index 3d86aba025e..27db5ba5542 100644
--- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuOpenContainer.tsx
+++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuOpenContainer.tsx
@@ -23,9 +23,7 @@ import { motion } from 'framer-motion';
import { useCallback, useContext, useRef } from 'react';
import { LINK_CHIP_CLICK_OUTSIDE_ID } from 'twenty-ui/components';
import { useIsMobile } from 'twenty-ui/utilities';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
-import { ThemeContext } from 'twenty-ui/theme';
-
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledCommandMenuBase = styled.div`
background: ${themeCssVariables.background.primary};
border-left: 1px solid ${themeCssVariables.border.color.medium};
@@ -46,14 +44,12 @@ const StyledCommandMenu = motion.create(StyledCommandMenuBase);
export const CommandMenuOpenContainer = ({
children,
}: React.PropsWithChildren) => {
+ const { theme } = useContext(ThemeContext);
const isMobile = useIsMobile();
const targetVariantForAnimation: CommandMenuAnimationVariant = isMobile
? 'fullScreen'
: 'normal';
-
- const { theme } = useContext(ThemeContext);
-
const { closeCommandMenu } = useCommandMenu();
const commandMenuRef = useRef<HTMLDivElement>(null);
@@ -100,7 +96,9 @@ export const CommandMenuOpenContainer = ({
initial="closed"
exit="closed"
variants={COMMAND_MENU_ANIMATION_VARIANTS}
- transition={{ duration: theme.animation.duration.normal }}
+ transition={{
+ duration: theme.animation.duration.normal,
+ }}
onAnimationStart={() => setIsSidePanelAnimating(true)}
onAnimationComplete={() => setIsSidePanelAnimating(false)}
>
diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuPageInfo.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuPageInfo.tsx
index abb7ec3e297..5130f4018df 100644
--- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuPageInfo.tsx
+++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuPageInfo.tsx
@@ -20,11 +20,9 @@ import { selectedNavigationMenuItemInEditModeState } from '@/navigation-menu-ite
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
import { CommandMenuPages } from 'twenty-shared/types';
-import { type CommandMenuContextChipProps } from './CommandMenuContextChip';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
-
+import { type CommandMenuContextChipProps } from './CommandMenuContextChip';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledPageTitle = styled.div`
color: ${themeCssVariables.font.color.primary};
font-size: ${themeCssVariables.font.size.sm};
diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuPageLayoutInfoContent.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuPageLayoutInfoContent.tsx
index b448de7e1c0..76b1fddfbf9 100644
--- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuPageLayoutInfoContent.tsx
+++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuPageLayoutInfoContent.tsx
@@ -18,8 +18,7 @@ import { CommandMenuPages } from 'twenty-shared/types';
import { isDefined } from 'twenty-shared/utils';
import { useIcons } from 'twenty-ui/display';
import { CommandMenuPageInfoLayout } from './CommandMenuPageInfoLayout';
-import { ThemeContext } from 'twenty-ui/theme';
-
+import { ThemeContext } from 'twenty-ui/theme-constants';
export const CommandMenuPageLayoutInfoContent = ({
pageLayoutId,
}: {
diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuRouter.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuRouter.tsx
index 0faf55086ca..3d8ecea57f9 100644
--- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuRouter.tsx
+++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuRouter.tsx
@@ -8,9 +8,9 @@ import { CommandMenuPageComponentInstanceContext } from '@/command-menu/states/c
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
import { styled } from '@linaria/react';
import { motion } from 'framer-motion';
-import { isDefined } from 'twenty-shared/utils';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
+import { isDefined } from 'twenty-shared/utils';
+import { ThemeContext } from 'twenty-ui/theme-constants';
const StyledCommandMenuContent = styled.div`
flex: 1;
@@ -18,6 +18,7 @@ const StyledCommandMenuContent = styled.div`
`;
export const CommandMenuRouter = () => {
+ const { theme } = useContext(ThemeContext);
const commandMenuPage = useAtomStateValue(commandMenuPageState);
const commandMenuPageInfo = useAtomStateValue(commandMenuPageInfoState);
@@ -26,9 +27,6 @@ export const CommandMenuRouter = () => {
) : (
<></>
);
-
- const { theme } = useContext(ThemeContext);
-
return (
<CommandMenuContainer>
<CommandMenuPageComponentInstanceContext.Provider
diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuTopBar.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuTopBar.tsx
index 48c181f0c42..91fc8c1f376 100644
--- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuTopBar.tsx
+++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuTopBar.tsx
@@ -23,8 +23,7 @@ import { CommandMenuPages } from 'twenty-shared/types';
import { IconX } from 'twenty-ui/display';
import { IconButton } from 'twenty-ui/input';
import { useIsMobile } from 'twenty-ui/utilities';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledInputContainer = styled.div<{ isMobile: boolean }>`
align-items: center;
@@ -80,6 +79,7 @@ const StyledContentContainer = styled.div`
`;
export const CommandMenuTopBar = () => {
+ const { theme } = useContext(ThemeContext);
const [commandMenuSearch, setCommandMenuSearch] = useAtomState(
commandMenuSearchState,
);
@@ -101,8 +101,6 @@ export const CommandMenuTopBar = () => {
commandMenuNavigationStackState,
);
- const { theme } = useContext(ThemeContext);
-
const { contextChips } = useCommandMenuContextChips();
const { pushFocusItemToFocusStack } = usePushFocusItemToFocusStack();
diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuWorkflowStepInfo.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuWorkflowStepInfo.tsx
index 0b80adce8ad..60f6b5e96cc 100644
--- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuWorkflowStepInfo.tsx
+++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuWorkflowStepInfo.tsx
@@ -18,19 +18,20 @@ import { getActionIconColorOrThrow } from '@/workflow/workflow-steps/workflow-ac
import { getTriggerIcon } from '@/workflow/workflow-trigger/utils/getTriggerIcon';
import { getTriggerIconColor } from '@/workflow/workflow-trigger/utils/getTriggerIconColor';
import { t } from '@lingui/core/macro';
-import { useState } from 'react';
+import { useContext, useState } from 'react';
import { CommandMenuPages, CoreObjectNameSingular } from 'twenty-shared/types';
import { isDefined } from 'twenty-shared/utils';
import { TRIGGER_STEP_ID } from 'twenty-shared/workflow';
import { useIcons } from 'twenty-ui/display';
-import { ICON_SIZES, ICON_STROKES } from 'twenty-ui/theme-constants';
import { CommandMenuPageInfoLayout } from './CommandMenuPageInfoLayout';
+import { ThemeContext } from 'twenty-ui/theme-constants';
export const CommandMenuWorkflowStepInfo = ({
commandMenuPageInstanceId,
}: {
commandMenuPageInstanceId: string;
}) => {
+ const { theme } = useContext(ThemeContext);
const { getIcon } = useIcons();
const commandMenuPage = useAtomStateValue(commandMenuPageState);
@@ -169,7 +170,7 @@ export const CommandMenuWorkflowStepInfo = ({
<CommandMenuPageInfoLayout
icon={
headerIcon ? (
- <Icon size={ICON_SIZES.md} stroke={ICON_STROKES.sm} />
+ <Icon size={theme.icon.size.md} stroke={theme.icon.stroke.sm} />
) : undefined
}
iconColor={headerIconColor}
diff --git a/packages/twenty-front/src/modules/command-menu/components/hooks/usePageLayoutHeaderInfo.ts b/packages/twenty-front/src/modules/command-menu/components/hooks/usePageLayoutHeaderInfo.ts
index f660af8d7ea..063ff8466f1 100644
--- a/packages/twenty-front/src/modules/command-menu/components/hooks/usePageLayoutHeaderInfo.ts
+++ b/packages/twenty-front/src/modules/command-menu/components/hooks/usePageLayoutHeaderInfo.ts
@@ -13,8 +13,8 @@ import {
IconPlus,
type IconComponent,
} from 'twenty-ui/display';
+import { ThemeContext } from 'twenty-ui/theme-constants';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
type PageLayoutHeaderInfo = {
headerIcon: IconComponent | undefined;
diff --git a/packages/twenty-front/src/modules/command-menu/constants/CommandMenuAnimationVariants.ts b/packages/twenty-front/src/modules/command-menu/constants/CommandMenuAnimationVariants.ts
index fd33b3de75c..7db2daf635e 100644
--- a/packages/twenty-front/src/modules/command-menu/constants/CommandMenuAnimationVariants.ts
+++ b/packages/twenty-front/src/modules/command-menu/constants/CommandMenuAnimationVariants.ts
@@ -1,4 +1,5 @@
-import { THEME_COMMON } from 'twenty-ui/theme';
+import { themeCssVariables } from 'twenty-ui/theme-constants';
+
export const COMMAND_MENU_ANIMATION_VARIANTS = {
fullScreen: {
x: '0%',
@@ -9,14 +10,14 @@ export const COMMAND_MENU_ANIMATION_VARIANTS = {
},
normal: {
x: '0%',
- width: THEME_COMMON.rightDrawerWidth,
+ width: themeCssVariables.rightDrawerWidth,
height: '100%',
bottom: '0',
top: '0',
},
closed: {
x: '100%',
- width: THEME_COMMON.rightDrawerWidth,
+ width: themeCssVariables.rightDrawerWidth,
height: '100%',
bottom: '0',
top: 'auto',
diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuContextChips.tsx b/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuContextChips.tsx
index 6f2f9d00413..5a060005198 100644
--- a/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuContextChips.tsx
+++ b/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuContextChips.tsx
@@ -12,9 +12,11 @@ import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomState
import { useContext, useMemo } from 'react';
import { CommandMenuPages } from 'twenty-shared/types';
import { isDefined } from 'twenty-shared/utils';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
export const useCommandMenuContextChips = () => {
+ const { theme } = useContext(ThemeContext);
+ const iconSizeSm = theme.icon.size.sm;
const commandMenuNavigationStack = useAtomStateValue(
commandMenuNavigationStackState,
);
@@ -27,8 +29,6 @@ export const useCommandMenuContextChips = () => {
const { navigateCommandMenuHistory } = useCommandMenuHistory();
- const { theme } = useContext(ThemeContext);
-
const commandMenuNavigationMorphItemsByPage = useAtomStateValue(
commandMenuNavigationMorphItemsByPageState,
);
@@ -111,16 +111,16 @@ export const useCommandMenuContextChips = () => {
return {
page,
Icons: isLastChip
- ? [<page.pageIcon size={theme.icon.size.sm} />]
+ ? [<page.pageIcon size={iconSizeSm} />]
: [
<CommandMenuContextChipIconWrapper>
<page.pageIcon
- size={theme.icon.size.sm}
+ size={iconSizeSm}
color={
isDefined(page.pageIconColor) &&
page.pageIconColor !== 'currentColor'
? page.pageIconColor
- : theme.font.color.tertiary
+ : themeCssVariables.font.color.tertiary
}
/>
</CommandMenuContextChipIconWrapper>,
@@ -137,12 +137,11 @@ export const useCommandMenuContextChips = () => {
}, [
commandMenuNavigationMorphItemsByPage,
commandMenuNavigationStack,
+ iconSizeSm,
navigateCommandMenuHistory,
objectMetadataItems,
recordIdentifiers,
records,
- theme.font.color.tertiary,
- theme.icon.size.sm,
]);
return {
diff --git a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuEditColorOption.tsx b/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuEditColorOption.tsx
index 17752bcdfa3..b3ad48caa6f 100644
--- a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuEditColorOption.tsx
+++ b/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuEditColorOption.tsx
@@ -15,9 +15,8 @@ import {
DEFAULT_COLOR_LABELS,
MenuItemSelectColor,
} from 'twenty-ui/navigation';
-import { MAIN_COLOR_NAMES, type ThemeColor } from 'twenty-ui/theme';
import { themeCssVariables } from 'twenty-ui/theme-constants';
-
+import { type ThemeColor, MAIN_COLOR_NAMES } from 'twenty-ui/theme';
const NAVIGATION_MENU_ITEM_COLOR_DROPDOWN_ID = 'navigation-menu-item-color';
const StyledMenuStyleText = styled.span`
diff --git a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemMainMenu.tsx b/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemMainMenu.tsx
index b1bc13ccde8..ed3e78c4e42 100644
--- a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemMainMenu.tsx
+++ b/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemMainMenu.tsx
@@ -19,7 +19,7 @@ import { NavigationMenuItemStyleIcon } from '@/navigation-menu-item/components/N
import { NavigationMenuItemType } from '@/navigation-menu-item/constants/NavigationMenuItemType';
import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
type CommandMenuNewSidebarItemMainMenuProps = {
onSelectObject: () => void;
@@ -32,8 +32,8 @@ export const CommandMenuNewSidebarItemMainMenu = ({
onSelectView,
onSelectRecord,
}: CommandMenuNewSidebarItemMainMenuProps) => {
- const { t } = useLingui();
const { theme } = useContext(ThemeContext);
+ const { t } = useLingui();
const { handleAddFolder } = useAddFolderToNavigationMenu();
const { handleAddLink } = useAddLinkToNavigationMenu();
diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartColorGradientOption.tsx b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartColorGradientOption.tsx
index 3f684f20ac1..70e7ebaf5a8 100644
--- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartColorGradientOption.tsx
+++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartColorGradientOption.tsx
@@ -5,9 +5,8 @@ import { SelectableListItem } from '@/ui/layout/selectable-list/components/Selec
import { styled } from '@linaria/react';
import { ColorSample } from 'twenty-ui/display';
import { MenuItemSelect } from 'twenty-ui/navigation';
-import { type ThemeColor } from 'twenty-ui/theme';
import { themeCssVariables } from 'twenty-ui/theme-constants';
-
+import { type ThemeColor } from 'twenty-ui/theme';
type ChartColorGradientOptionProps = {
colorOption: {
id: string;
diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartColorPaletteOption.tsx b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartColorPaletteOption.tsx
index f50e3cc716e..50f51fde3ed 100644
--- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartColorPaletteOption.tsx
+++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartColorPaletteOption.tsx
@@ -6,10 +6,9 @@ import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
import { ColorSample } from 'twenty-ui/display';
import { MenuItemSelect } from 'twenty-ui/navigation';
-import { type ThemeColor } from 'twenty-ui/theme';
import { getMainColorNameFromPaletteColorName } from 'twenty-ui/utilities';
import { themeCssVariables } from 'twenty-ui/theme-constants';
-
+import { type ThemeColor } from 'twenty-ui/theme';
type ChartColorPaletteOptionProps = {
selectedItemId: string | null;
currentColor: string | null | undefined;
diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartColorSelectionDropdownContent.tsx b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartColorSelectionDropdownContent.tsx
index 83b33c2320e..9c585c95b4b 100644
--- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartColorSelectionDropdownContent.tsx
+++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartColorSelectionDropdownContent.tsx
@@ -17,7 +17,7 @@ import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/use
import { t } from '@lingui/core/macro';
import { useState } from 'react';
import { capitalize, isDefined } from 'twenty-shared/utils';
-import { MAIN_COLOR_NAMES, type ThemeColor } from 'twenty-ui/theme';
+import { type ThemeColor, MAIN_COLOR_NAMES } from 'twenty-ui/theme';
import { filterBySearchQuery } from '~/utils/filterBySearchQuery';
type ColorOption = {
diff --git a/packages/twenty-front/src/modules/command-menu/pages/rich-text-page/components/CommandMenuEditRichTextPage.tsx b/packages/twenty-front/src/modules/command-menu/pages/rich-text-page/components/CommandMenuEditRichTextPage.tsx
index a765690531f..d09a92b0f48 100644
--- a/packages/twenty-front/src/modules/command-menu/pages/rich-text-page/components/CommandMenuEditRichTextPage.tsx
+++ b/packages/twenty-front/src/modules/command-menu/pages/rich-text-page/components/CommandMenuEditRichTextPage.tsx
@@ -5,8 +5,7 @@ import { styled } from '@linaria/react';
import { lazy, Suspense, useContext } from 'react';
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
import { CoreObjectNameSingular } from 'twenty-shared/types';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const ActivityRichTextEditor = lazy(() =>
import('@/activities/components/ActivityRichTextEditor').then((module) => ({
@@ -23,7 +22,6 @@ const StyledContainer = styled.div`
const LoadingSkeleton = () => {
const { theme } = useContext(ThemeContext);
-
return (
<SkeletonTheme
baseColor={theme.background.tertiary}
diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/trigger-type/components/CommandMenuWorkflowSelectTriggerTypeContent.tsx b/packages/twenty-front/src/modules/command-menu/pages/workflow/trigger-type/components/CommandMenuWorkflowSelectTriggerTypeContent.tsx
index cc8363ed139..04d231f43b4 100644
--- a/packages/twenty-front/src/modules/command-menu/pages/workflow/trigger-type/components/CommandMenuWorkflowSelectTriggerTypeContent.tsx
+++ b/packages/twenty-front/src/modules/command-menu/pages/workflow/trigger-type/components/CommandMenuWorkflowSelectTriggerTypeContent.tsx
@@ -18,11 +18,12 @@ import { t } from '@lingui/core/macro';
import { isDefined } from 'twenty-shared/utils';
import { TRIGGER_STEP_ID } from 'twenty-shared/workflow';
import { useIcons } from 'twenty-ui/display';
-import { MenuItem } from 'twenty-ui/navigation';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
+import { MenuItem } from 'twenty-ui/navigation';
+import { ThemeContext } from 'twenty-ui/theme-constants';
export const CommandMenuWorkflowSelectTriggerTypeContent = () => {
+ const { theme } = useContext(ThemeContext);
const { getIcon } = useIcons();
const workflowId = useCommandMenuWorkflowIdOrThrow();
const { updateTrigger } = useUpdateWorkflowVersionTrigger();
@@ -73,8 +74,6 @@ export const CommandMenuWorkflowSelectTriggerTypeContent = () => {
};
};
- const { theme } = useContext(ThemeContext);
-
return (
<RightDrawerStepListContainer>
<RightDrawerWorkflowSelectStepTitle>
diff --git a/packages/twenty-front/src/modules/error-handler/components/AppRootErrorFallback.tsx b/packages/twenty-front/src/modules/error-handler/components/AppRootErrorFallback.tsx
index 2240825f542..dcdf2edd930 100644
--- a/packages/twenty-front/src/modules/error-handler/components/AppRootErrorFallback.tsx
+++ b/packages/twenty-front/src/modules/error-handler/components/AppRootErrorFallback.tsx
@@ -1,8 +1,9 @@
import { type AppErrorDisplayProps } from '@/error-handler/types/AppErrorDisplayProps';
import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
+import { useContext } from 'react';
import { IconReload } from 'twenty-ui/display';
-import { ICON_SIZES, themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
type AppRootErrorFallbackProps = AppErrorDisplayProps;
@@ -102,6 +103,8 @@ export const AppRootErrorFallback = ({
resetErrorBoundary,
title = t`Sorry, something went wrong`,
}: AppRootErrorFallbackProps) => {
+ const { theme } = useContext(ThemeContext);
+
return (
<StyledContainer>
<StyledPanel>
@@ -124,7 +127,7 @@ export const AppRootErrorFallback = ({
</StyledEmptyTextContainer>
<StyledButton onClick={resetErrorBoundary}>
<StyledIconContainer>
- <IconReload size={ICON_SIZES.md} />
+ <IconReload size={theme.icon.size.md} />
</StyledIconContainer>
{t`Reload`}
</StyledButton>
diff --git a/packages/twenty-front/src/modules/favorites/components/FavoriteIcon.tsx b/packages/twenty-front/src/modules/favorites/components/FavoriteIcon.tsx
index 8de9d9d5b7c..90f5294a0c2 100644
--- a/packages/twenty-front/src/modules/favorites/components/FavoriteIcon.tsx
+++ b/packages/twenty-front/src/modules/favorites/components/FavoriteIcon.tsx
@@ -2,7 +2,7 @@ import { type ProcessedFavorite } from '@/favorites/utils/sortFavorites';
import { useGetStandardObjectIcon } from '@/object-metadata/hooks/useGetStandardObjectIcon';
import { useContext } from 'react';
import { Avatar, useIcons } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
export const FavoriteIcon = ({ favorite }: { favorite: ProcessedFavorite }) => {
const { theme } = useContext(ThemeContext);
diff --git a/packages/twenty-front/src/modules/favorites/components/FavoritesBackButton.tsx b/packages/twenty-front/src/modules/favorites/components/FavoritesBackButton.tsx
index f614e2bc7c3..f0b9e386113 100644
--- a/packages/twenty-front/src/modules/favorites/components/FavoritesBackButton.tsx
+++ b/packages/twenty-front/src/modules/favorites/components/FavoritesBackButton.tsx
@@ -1,10 +1,9 @@
import { currentFavoriteFolderIdState } from '@/ui/navigation/navigation-drawer/states/currentFavoriteFolderIdState';
import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';
import { styled } from '@linaria/react';
-import { useContext } from 'react';
import { IconX } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { useContext } from 'react';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledBackButton = styled.button`
display: flex;
diff --git a/packages/twenty-front/src/modules/favorites/components/FavoritesSkeletonLoader.tsx b/packages/twenty-front/src/modules/favorites/components/FavoritesSkeletonLoader.tsx
index 765dbb969b2..aaf023afd1c 100644
--- a/packages/twenty-front/src/modules/favorites/components/FavoritesSkeletonLoader.tsx
+++ b/packages/twenty-front/src/modules/favorites/components/FavoritesSkeletonLoader.tsx
@@ -2,8 +2,7 @@ import { SKELETON_LOADER_HEIGHT_SIZES } from '@/activities/components/SkeletonLo
import { styled } from '@linaria/react';
import { useContext } from 'react';
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledSkeletonContainer = styled.div`
display: flex;
diff --git a/packages/twenty-front/src/modules/favorites/favorite-folder-picker/components/FavoriteFolderPickerFooter.tsx b/packages/twenty-front/src/modules/favorites/favorite-folder-picker/components/FavoriteFolderPickerFooter.tsx
index 17ed61ba0d5..be8df84e02c 100644
--- a/packages/twenty-front/src/modules/favorites/favorite-folder-picker/components/FavoriteFolderPickerFooter.tsx
+++ b/packages/twenty-front/src/modules/favorites/favorite-folder-picker/components/FavoriteFolderPickerFooter.tsx
@@ -5,17 +5,17 @@ import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';
import { useNavigationSection } from '@/ui/navigation/navigation-drawer/hooks/useNavigationSection';
import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded';
import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';
-import { useContext } from 'react';
import { useLingui } from '@lingui/react/macro';
+import { useContext } from 'react';
import { IconPlus } from 'twenty-ui/display';
import { MenuItem } from 'twenty-ui/navigation';
-import { ThemeContext } from 'twenty-ui/theme';
-
+import { ThemeContext } from 'twenty-ui/theme-constants';
export const FavoriteFolderPickerFooter = ({
dropdownId,
}: {
dropdownId: string;
}) => {
+ const { theme } = useContext(ThemeContext);
const { t } = useLingui();
const [, setIsFavoriteFolderCreating] = useAtomState(
isFavoriteFolderCreatingState,
@@ -24,7 +24,6 @@ export const FavoriteFolderPickerFooter = ({
isNavigationDrawerExpandedState,
);
const { openNavigationSection } = useNavigationSection('Favorites');
- const { theme } = useContext(ThemeContext);
const { closeDropdown } = useCloseDropdown();
return (
diff --git a/packages/twenty-front/src/modules/file/components/FileIcon.tsx b/packages/twenty-front/src/modules/file/components/FileIcon.tsx
index e682a25766f..326c2330a4d 100644
--- a/packages/twenty-front/src/modules/file/components/FileIcon.tsx
+++ b/packages/twenty-front/src/modules/file/components/FileIcon.tsx
@@ -2,11 +2,10 @@ import { type AttachmentFileCategory } from '@/activities/files/types/Attachment
import { useFileIconColors } from '@/file/hooks/useFileIconColors';
import { IconMapping } from '@/file/utils/fileIconMappings';
import { styled } from '@linaria/react';
-import { useContext } from 'react';
import { type FileCategory } from 'twenty-shared/types';
import { AvatarOrIcon } from 'twenty-ui/components';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { useContext } from 'react';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
type FileIconSize = 'small' | 'medium';
diff --git a/packages/twenty-front/src/modules/file/hooks/useFileCategoryColors.ts b/packages/twenty-front/src/modules/file/hooks/useFileCategoryColors.ts
index 00f6ec7202e..e7b66980188 100644
--- a/packages/twenty-front/src/modules/file/hooks/useFileCategoryColors.ts
+++ b/packages/twenty-front/src/modules/file/hooks/useFileCategoryColors.ts
@@ -3,13 +3,14 @@ import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadata
import { useContext } from 'react';
import { CoreObjectNameSingular } from 'twenty-shared/types';
import { isDefined } from 'twenty-shared/utils';
-import { type ThemeColor, ThemeContext } from 'twenty-ui/theme';
-
+import { ThemeContext } from 'twenty-ui/theme-constants';
+import { type ThemeColor } from 'twenty-ui/theme';
export const useFileCategoryColors = (): Record<
AttachmentFileCategory,
string
> => {
const { theme } = useContext(ThemeContext);
+
const { objectMetadataItem } = useObjectMetadataItem({
objectNameSingular: CoreObjectNameSingular.Attachment,
});
@@ -36,9 +37,11 @@ export const useFileCategoryColors = (): Record<
if (
isDefined(category) &&
isDefined(color) &&
- isDefined(theme.color[color])
+ isDefined((theme.color as unknown as Record<string, string>)[color])
) {
- colorMap[category] = theme.color[color];
+ colorMap[category] = (theme.color as unknown as Record<string, string>)[
+ color
+ ];
}
});
}
diff --git a/packages/twenty-front/src/modules/file/hooks/useFileIconColors.ts b/packages/twenty-front/src/modules/file/hooks/useFileIconColors.ts
index 4cd85f4fa56..e59eff996de 100644
--- a/packages/twenty-front/src/modules/file/hooks/useFileIconColors.ts
+++ b/packages/twenty-front/src/modules/file/hooks/useFileIconColors.ts
@@ -1,7 +1,7 @@
import { type AttachmentFileCategory } from '@/activities/files/types/AttachmentFileCategory';
import { useContext } from 'react';
import { type FileCategory } from 'twenty-shared/types';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
export const useFileIconColors = (): Record<
AttachmentFileCategory | FileCategory,
diff --git a/packages/twenty-front/src/modules/front-components/components/FrontComponentRenderer.tsx b/packages/twenty-front/src/modules/front-components/components/FrontComponentRenderer.tsx
index 192eea8b33b..e69274bc2ab 100644
--- a/packages/twenty-front/src/modules/front-components/components/FrontComponentRenderer.tsx
+++ b/packages/twenty-front/src/modules/front-components/components/FrontComponentRenderer.tsx
@@ -9,7 +9,7 @@ import { t } from '@lingui/core/macro';
import { useCallback, useContext } from 'react';
import { FrontComponentRenderer as SharedFrontComponentRenderer } from 'twenty-sdk/front-component-renderer';
import { isDefined } from 'twenty-shared/utils';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
import { REACT_APP_SERVER_BASE_URL } from '~/config';
import { useFindOneFrontComponentQuery } from '~/generated-metadata/graphql';
@@ -20,7 +20,7 @@ type FrontComponentRendererProps = {
export const FrontComponentRenderer = ({
frontComponentId,
}: FrontComponentRendererProps) => {
- const { theme } = useContext(ThemeContext);
+ const { colorScheme } = useContext(ThemeContext);
const { enqueueErrorSnackBar } = useSnackBar();
const setFrontComponentApplicationTokenPair = useSetAtomComponentState(
@@ -81,7 +81,7 @@ export const FrontComponentRenderer = ({
return (
<FrontComponentRendererProvider frontComponentId={frontComponentId}>
<SharedFrontComponentRenderer
- theme={theme}
+ colorScheme={colorScheme}
componentUrl={componentUrl}
applicationAccessToken={
applicationTokenPair.applicationAccessToken.token
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/components/AddToNavigationDragHandle.tsx b/packages/twenty-front/src/modules/navigation-menu-item/components/AddToNavigationDragHandle.tsx
index c0332971d1b..bf223a3fd87 100644
--- a/packages/twenty-front/src/modules/navigation-menu-item/components/AddToNavigationDragHandle.tsx
+++ b/packages/twenty-front/src/modules/navigation-menu-item/components/AddToNavigationDragHandle.tsx
@@ -3,8 +3,7 @@ import { isNonEmptyString } from '@sniptt/guards';
import { type ReactNode, useContext } from 'react';
import { isDefined } from 'twenty-shared/utils';
import { IconGripVertical, type IconComponent } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { NavigationMenuItemStyleIcon } from '@/navigation-menu-item/components/NavigationMenuItemStyleIcon';
import { DEFAULT_NAVIGATION_MENU_ITEM_COLOR_FOLDER } from '@/navigation-menu-item/constants/NavigationMenuItemDefaultColorFolder';
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuEditModeBar.tsx b/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuEditModeBar.tsx
index 1bc26faaa1f..5ff55213c5a 100644
--- a/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuEditModeBar.tsx
+++ b/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuEditModeBar.tsx
@@ -15,8 +15,7 @@ import { useLingui } from '@lingui/react/macro';
import { useContext, useState } from 'react';
import { CommandMenuPages } from 'twenty-shared/types';
import { IconCheck, useIcons } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { FeatureFlagKey } from '~/generated-metadata/graphql';
const StyledContainer = styled.div`
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuItemBackButton.tsx b/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuItemBackButton.tsx
index 49599378496..ad27b19a89b 100644
--- a/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuItemBackButton.tsx
+++ b/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuItemBackButton.tsx
@@ -1,8 +1,7 @@
import { styled } from '@linaria/react';
import { useContext } from 'react';
import { IconX } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { currentNavigationMenuItemFolderIdState } from '@/ui/navigation/navigation-drawer/states/currentNavigationMenuItemFolderIdState';
import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuItemSkeletonLoader.tsx b/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuItemSkeletonLoader.tsx
index d0701ce8bb6..285db3e76bd 100644
--- a/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuItemSkeletonLoader.tsx
+++ b/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuItemSkeletonLoader.tsx
@@ -2,8 +2,7 @@ import { SKELETON_LOADER_HEIGHT_SIZES } from '@/activities/components/SkeletonLo
import { styled } from '@linaria/react';
import { useContext } from 'react';
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledSkeletonContainer = styled.div`
display: flex;
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuItemStyleIcon.tsx b/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuItemStyleIcon.tsx
index 156804675e3..31bb1d952d5 100644
--- a/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuItemStyleIcon.tsx
+++ b/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuItemStyleIcon.tsx
@@ -1,8 +1,8 @@
import type { IconComponent } from 'twenty-ui/display';
-import { ICON_SIZES, ICON_STROKES } from 'twenty-ui/theme-constants';
-
import { StyledNavigationMenuItemIconContainer } from '@/navigation-menu-item/components/NavigationMenuItemIconContainer';
import { getNavigationMenuItemIconStyleFromColor } from '@/navigation-menu-item/utils/get-navigation-menu-item-icon-style-from-color';
+import { useContext } from 'react';
+import { ThemeContext } from 'twenty-ui/theme-constants';
export type NavigationMenuItemStyleIconProps = {
Icon: IconComponent;
@@ -13,6 +13,7 @@ export const NavigationMenuItemStyleIcon = ({
Icon,
color,
}: NavigationMenuItemStyleIconProps) => {
+ const { theme } = useContext(ThemeContext);
const style = getNavigationMenuItemIconStyleFromColor(color);
return (
<StyledNavigationMenuItemIconContainer
@@ -20,8 +21,8 @@ export const NavigationMenuItemStyleIcon = ({
$borderColor={style.borderColor}
>
<Icon
- size={ICON_SIZES.md}
- stroke={ICON_STROKES.md}
+ size={theme.icon.size.md}
+ stroke={theme.icon.stroke.md}
color={style.iconColor}
/>
</StyledNavigationMenuItemIconContainer>
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/components/ObjectIconWithViewOverlay.tsx b/packages/twenty-front/src/modules/navigation-menu-item/components/ObjectIconWithViewOverlay.tsx
index 66dc749fe26..52cd5769508 100644
--- a/packages/twenty-front/src/modules/navigation-menu-item/components/ObjectIconWithViewOverlay.tsx
+++ b/packages/twenty-front/src/modules/navigation-menu-item/components/ObjectIconWithViewOverlay.tsx
@@ -1,6 +1,7 @@
import { styled } from '@linaria/react';
import type { IconComponent } from 'twenty-ui/display';
-import { ICON_STROKES, themeCssVariables } from 'twenty-ui/theme-constants';
+import { useContext } from 'react';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { getNavigationMenuItemIconStyleFromColor } from '@/navigation-menu-item/utils/get-navigation-menu-item-icon-style-from-color';
@@ -56,6 +57,7 @@ export const ObjectIconWithViewOverlay = ({
ViewIcon,
objectColor,
}: ObjectIconWithViewOverlayProps) => {
+ const { theme } = useContext(ThemeContext);
const objectStyle = getNavigationMenuItemIconStyleFromColor(objectColor);
return (
@@ -66,14 +68,14 @@ export const ObjectIconWithViewOverlay = ({
>
<ObjectIcon
size="14px"
- stroke={ICON_STROKES.md}
+ stroke={theme.icon.stroke.md}
color={objectStyle.iconColor}
/>
</StyledObjectIconWrapper>
<StyledViewOverlay $backgroundColor={themeCssVariables.grayScale.gray4}>
<ViewIcon
size="10px"
- stroke={ICON_STROKES.lg}
+ stroke={theme.icon.stroke.lg}
color={themeCssVariables.grayScale.gray10}
/>
</StyledViewOverlay>
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/components/WorkspaceNavigationMenuItemFolderDragClone.tsx b/packages/twenty-front/src/modules/navigation-menu-item/components/WorkspaceNavigationMenuItemFolderDragClone.tsx
index 39c7f74d57b..eb4a0096c11 100644
--- a/packages/twenty-front/src/modules/navigation-menu-item/components/WorkspaceNavigationMenuItemFolderDragClone.tsx
+++ b/packages/twenty-front/src/modules/navigation-menu-item/components/WorkspaceNavigationMenuItemFolderDragClone.tsx
@@ -5,7 +5,7 @@ import {
} from '@hello-pangea/dnd';
import { useContext } from 'react';
import { isDefined } from 'twenty-shared/utils';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
import { NavigationMenuItemIcon } from '@/navigation-menu-item/components/NavigationMenuItemIcon';
import { getNavigationMenuItemSecondaryLabel } from '@/navigation-menu-item/utils/getNavigationMenuItemSecondaryLabel';
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/components/WorkspaceNavigationMenuItemsFolder.tsx b/packages/twenty-front/src/modules/navigation-menu-item/components/WorkspaceNavigationMenuItemsFolder.tsx
index 92223d454d6..fd542db459b 100644
--- a/packages/twenty-front/src/modules/navigation-menu-item/components/WorkspaceNavigationMenuItemsFolder.tsx
+++ b/packages/twenty-front/src/modules/navigation-menu-item/components/WorkspaceNavigationMenuItemsFolder.tsx
@@ -11,8 +11,7 @@ import {
IconPlus,
useIcons,
} from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { useIsDropDisabledForSection } from '@/navigation-menu-item/hooks/useIsDropDisabledForSection';
import { useOpenAddItemToFolderPage } from '@/navigation-menu-item/hooks/useOpenAddItemToFolderPage';
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/utils/get-color-from-theme.util.ts b/packages/twenty-front/src/modules/navigation-menu-item/utils/get-color-from-theme.util.ts
index a82b82faaae..aa30425cb49 100644
--- a/packages/twenty-front/src/modules/navigation-menu-item/utils/get-color-from-theme.util.ts
+++ b/packages/twenty-front/src/modules/navigation-menu-item/utils/get-color-from-theme.util.ts
@@ -1,5 +1,5 @@
-import type { ThemeColor } from 'twenty-ui/theme';
import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { type ThemeColor } from 'twenty-ui/theme';
export const getColorFromTheme = (
themeColor: ThemeColor,
diff --git a/packages/twenty-front/src/modules/navigation/components/MainNavigationDrawerTabsRow.tsx b/packages/twenty-front/src/modules/navigation/components/MainNavigationDrawerTabsRow.tsx
index 3ac89399ae9..30a4cce475f 100644
--- a/packages/twenty-front/src/modules/navigation/components/MainNavigationDrawerTabsRow.tsx
+++ b/packages/twenty-front/src/modules/navigation/components/MainNavigationDrawerTabsRow.tsx
@@ -1,15 +1,15 @@
import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
-import { useContext } from 'react';
import {
IconComment,
IconHome,
IconMessageCirclePlus,
} from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { useIsMobile } from 'twenty-ui/utilities';
+import { useContext } from 'react';
+
import { useCreateNewAIChatThread } from '@/ai/hooks/useCreateNewAIChatThread';
import { NavigationDrawerAnimatedCollapseWrapper } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerAnimatedCollapseWrapper';
import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded';
diff --git a/packages/twenty-front/src/modules/object-metadata/components/NavigationDrawerSectionForObjectMetadataItemsSkeletonLoader.tsx b/packages/twenty-front/src/modules/object-metadata/components/NavigationDrawerSectionForObjectMetadataItemsSkeletonLoader.tsx
index 3b59008e9aa..11d95b61740 100644
--- a/packages/twenty-front/src/modules/object-metadata/components/NavigationDrawerSectionForObjectMetadataItemsSkeletonLoader.tsx
+++ b/packages/twenty-front/src/modules/object-metadata/components/NavigationDrawerSectionForObjectMetadataItemsSkeletonLoader.tsx
@@ -2,8 +2,7 @@ import { SKELETON_LOADER_HEIGHT_SIZES } from '@/activities/components/SkeletonLo
import { styled } from '@linaria/react';
import { useContext } from 'react';
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledSkeletonColumn = styled.div`
display: flex;
diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownBooleanSelect.tsx b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownBooleanSelect.tsx
index b1754216a24..c1f94ff6cfb 100644
--- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownBooleanSelect.tsx
+++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownBooleanSelect.tsx
@@ -1,8 +1,7 @@
import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { useApplyObjectFilterDropdownFilterValue } from '@/object-record/object-filter-dropdown/hooks/useApplyObjectFilterDropdownFilterValue';
import { useObjectFilterDropdownFilterValue } from '@/object-record/object-filter-dropdown/hooks/useObjectFilterDropdownFilterValue';
diff --git a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownMenuViewName.tsx b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownMenuViewName.tsx
index 1d768497a9c..11bf2aead48 100644
--- a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownMenuViewName.tsx
+++ b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownMenuViewName.tsx
@@ -16,8 +16,7 @@ import { styled } from '@linaria/react';
import { useContext, useEffect, useRef, useState } from 'react';
import { Key } from 'ts-key-enum';
import { OverflowingTextWithTooltip, useIcons } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { useDebouncedCallback } from 'use-debounce';
const StyledDropdownMenuIconAndNameContainer = styled.div`
@@ -60,6 +59,7 @@ type ObjectOptionsDropdownMenuViewNameProps = {
export const ObjectOptionsDropdownMenuViewName = ({
currentView,
}: ObjectOptionsDropdownMenuViewNameProps) => {
+ const { theme } = useContext(ThemeContext);
const [viewPickerSelectedIcon, setViewPickerSelectedIcon] =
useAtomComponentState(viewPickerSelectedIconComponentState);
@@ -111,7 +111,6 @@ export const ObjectOptionsDropdownMenuViewName = ({
}
}, [currentView?.key]);
- const { theme } = useContext(ThemeContext);
const { getIcon } = useIcons();
const MainIcon = getIcon(currentView?.icon);
diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnCardContainerSkeletonLoader.tsx b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnCardContainerSkeletonLoader.tsx
index 2ac532ba99e..21b3b061af9 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnCardContainerSkeletonLoader.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnCardContainerSkeletonLoader.tsx
@@ -1,8 +1,7 @@
import { styled } from '@linaria/react';
import { useContext } from 'react';
import { SkeletonTheme } from 'react-loading-skeleton';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { SKELETON_LOADER_HEIGHT_SIZES } from '@/activities/components/SkeletonLoader';
import { RecordCardBodyContainer } from '@/object-record/record-card/components/RecordCardBodyContainer';
@@ -38,7 +37,6 @@ const StyledStaticCellSkeleton = styled.div<{ width: number; height: number }>`
export const RecordBoardColumnCardContainerSkeletonLoader = () => {
const { theme } = useContext(ThemeContext);
-
const { currentView } = useGetCurrentViewOnly();
const isCompactModeActive = currentView?.isCompact ?? false;
diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnNewRecordButton.tsx b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnNewRecordButton.tsx
index 2b827d1f3e5..4f75d5701ef 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnNewRecordButton.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnNewRecordButton.tsx
@@ -8,8 +8,7 @@ import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
import { useContext } from 'react';
import { IconPlus } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledNewButton = styled.button`
align-items: center;
@@ -30,7 +29,6 @@ const StyledNewButton = styled.button`
export const RecordBoardColumnNewRecordButton = () => {
const { theme } = useContext(ThemeContext);
-
const { objectMetadataItem, selectFieldMetadataItem } =
useContext(RecordBoardContext);
diff --git a/packages/twenty-front/src/modules/object-record/record-calendar/components/RecordCalendarAddNew.tsx b/packages/twenty-front/src/modules/object-record/record-calendar/components/RecordCalendarAddNew.tsx
index 6ecebbed665..8a92a73ec81 100644
--- a/packages/twenty-front/src/modules/object-record/record-calendar/components/RecordCalendarAddNew.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-calendar/components/RecordCalendarAddNew.tsx
@@ -12,8 +12,7 @@ import { useContext } from 'react';
import { type Temporal } from 'temporal-polyfill';
import { IconPlus } from 'twenty-ui/display';
import { Button } from 'twenty-ui/input';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledButton = styled(Button)`
padding: ${themeCssVariables.spacing['0.5']};
@@ -28,10 +27,9 @@ type RecordCalendarAddNewProps = {
export const RecordCalendarAddNew = ({
cardDate,
}: RecordCalendarAddNewProps) => {
+ const { theme } = useContext(ThemeContext);
const { userTimezone } = useUserTimezone();
const { objectMetadataItem } = useRecordCalendarContextOrThrow();
- const { theme } = useContext(ThemeContext);
-
const { createNewIndexRecord } = useCreateNewIndexRecord({
objectMetadataItem,
});
diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/BaseChip.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/BaseChip.tsx
index 1c44f6fb2b1..7ff8ad10d3d 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/BaseChip.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/BaseChip.tsx
@@ -1,8 +1,7 @@
import { styled } from '@linaria/react';
import { useContext } from 'react';
import { IconX } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledChip = styled.div<{ deletable: boolean; danger: boolean }>`
background-color: ${({ danger }) =>
diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormAdvancedTextFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormAdvancedTextFieldInput.tsx
index 127a8c2beff..ce2b4a38b29 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormAdvancedTextFieldInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormAdvancedTextFieldInput.tsx
@@ -19,8 +19,7 @@ import { useLingui } from '@lingui/react/macro';
import { useContext, useId, useState } from 'react';
import { isDefined } from 'twenty-shared/utils';
import { IconMaximize } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { useIsMobile } from 'twenty-ui/utilities';
const StyledAdvancedTextFieldContainer = styled(FormFieldInputContainer)`
@@ -110,10 +109,10 @@ export const FormAdvancedTextFieldInput = ({
maxWidth,
contentType = 'json',
}: FormAdvancedTextFieldInputProps) => {
+ const { theme } = useContext(ThemeContext);
const instanceId = useId();
const isMobile = useIsMobile();
const [isFullScreen, setIsFullScreen] = useState(false);
- const { theme } = useContext(ThemeContext);
const { t } = useLingui();
const { pushFocusItemToFocusStack } = usePushFocusItemToFocusStack();
diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormArrayFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormArrayFieldInput.tsx
index b2853017caf..4dfc5aa604c 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormArrayFieldInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormArrayFieldInput.tsx
@@ -28,8 +28,7 @@ import { isNonEmptyArray } from '@sniptt/guards';
import { useContext, useId, useRef, useState } from 'react';
import { isDefined } from 'twenty-shared/utils';
import { IconPlus } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { MenuItem } from 'twenty-ui/navigation';
import { toSpliced } from '~/utils/array/toSpliced';
@@ -87,7 +86,6 @@ export const FormArrayFieldInput = ({
}: FormArrayFieldInputProps) => {
const { t } = useLingui();
const { theme } = useContext(ThemeContext);
-
const instanceId = useId();
const { pushFocusItemToFocusStack } = usePushFocusItemToFocusStack();
@@ -323,7 +321,7 @@ export const FormArrayFieldInput = ({
dropdownId={dropdownId}
dropdownPlacement="bottom-start"
dropdownOffset={{
- y: parseSpacingValueAsNumber(theme.spacing(1)),
+ y: parseSpacingValueAsNumber(theme.spacing[1]),
}}
clickableComponent={
<StyledDisplayModeContainer data-open={isDropdownOpen}>
diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormBooleanFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormBooleanFieldInput.tsx
index f4c41da20e4..5a1089d27f6 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormBooleanFieldInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormBooleanFieldInput.tsx
@@ -12,7 +12,7 @@ import { useLingui } from '@lingui/react/macro';
import { useContext, useId, useState } from 'react';
import { isDefined } from 'twenty-shared/utils';
import { IconCheck, IconCircleOff, IconX } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
type FormBooleanFieldInputProps = {
label?: string;
@@ -45,8 +45,8 @@ export const FormBooleanFieldInput = ({
readonly,
VariablePicker,
}: FormBooleanFieldInputProps) => {
- const { theme } = useContext(ThemeContext);
const { t } = useLingui();
+ const { theme } = useContext(ThemeContext);
const instanceId = useId();
@@ -134,7 +134,9 @@ export const FormBooleanFieldInput = ({
hasRightElement={isDefined(VariablePicker) && !readonly}
disabled={readonly}
dropdownWidth={GenericDropdownContentWidth.ExtraLarge}
- dropdownOffset={{ y: parseInt(theme.spacing(1), 10) }}
+ dropdownOffset={{
+ y: parseInt(theme.spacing[1], 10),
+ }}
/>
) : (
<FormFieldInputInnerContainer
diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormMultiSelectFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormMultiSelectFieldInput.tsx
index edfbd30b3f5..1162fd64d8d 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormMultiSelectFieldInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormMultiSelectFieldInput.tsx
@@ -25,8 +25,7 @@ import { isDefined } from 'twenty-shared/utils';
import { VisibilityHidden } from 'twenty-ui/accessibility';
import { IconChevronDown } from 'twenty-ui/display';
import { type SelectOption } from 'twenty-ui/input';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
type FormMultiSelectFieldInputProps = {
label?: string;
@@ -90,8 +89,8 @@ export const FormMultiSelectFieldInput = ({
hint,
dropdownWidth,
}: FormMultiSelectFieldInputProps) => {
- const instanceId = useId();
const { theme } = useContext(ThemeContext);
+ const instanceId = useId();
const { pushFocusItemToFocusStack } = usePushFocusItemToFocusStack();
const { removeFocusItemFromFocusStackById } =
diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormSelectFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormSelectFieldInput.tsx
index 938a5b8ff4e..80833fa557d 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormSelectFieldInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormSelectFieldInput.tsx
@@ -16,7 +16,7 @@ import { Key } from 'ts-key-enum';
import { isDefined } from 'twenty-shared/utils';
import { IconCircleOff } from 'twenty-ui/display';
import { type SelectOption } from 'twenty-ui/input';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
type FormSelectFieldInputProps = {
label?: string;
@@ -38,7 +38,6 @@ export const FormSelectFieldInput = ({
readonly,
}: FormSelectFieldInputProps) => {
const { theme } = useContext(ThemeContext);
-
const instanceId = useId();
const { removeFocusItemFromFocusStackById } =
@@ -145,7 +144,9 @@ export const FormSelectFieldInput = ({
withSearchInput
disabled={readonly}
dropdownWidth={GenericDropdownContentWidth.ExtraLarge}
- dropdownOffset={{ y: parseInt(theme.spacing(1), 10) }}
+ dropdownOffset={{
+ y: parseInt(theme.spacing[1], 10),
+ }}
/>
) : (
<FormFieldInputInnerContainer
diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormSingleRecordPicker.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormSingleRecordPicker.tsx
index 4ae719b2346..33bab805579 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormSingleRecordPicker.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormSingleRecordPicker.tsx
@@ -20,8 +20,7 @@ import { isNonEmptyString } from '@sniptt/guards';
import { useCallback, useContext, useId } from 'react';
import { CustomError, isDefined, isValidUuid } from 'twenty-shared/utils';
import { IconChevronDown, IconForbid } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledFormSelectContainer = styled(FormFieldInputInnerContainer)<{
readonly?: boolean;
@@ -81,6 +80,7 @@ export const FormSingleRecordPicker = ({
VariablePicker,
}: FormSingleRecordPickerProps) => {
const { theme } = useContext(ThemeContext);
+
const draftValue: FormSingleRecordPickerValue = isStandaloneVariableString(
defaultValue,
)
@@ -186,7 +186,9 @@ export const FormSingleRecordPicker = ({
clickableComponentWidth="100%"
onClose={handleCloseRelationPickerDropdown}
onOpen={handleOpenDropdown}
- dropdownOffset={{ y: parseInt(theme.spacing(1), 10) }}
+ dropdownOffset={{
+ y: parseInt(theme.spacing[1], 10),
+ }}
clickableComponent={
<StyledFormSelectContainer
formFieldInputInstanceId={componentId}
diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/VariableChip.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/VariableChip.tsx
index 85d8f709414..3e173d8acc3 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/VariableChip.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/VariableChip.tsx
@@ -5,7 +5,7 @@ import { useContext } from 'react';
import { isDefined } from 'twenty-shared/utils';
import { extractRawVariableNamePart } from 'twenty-shared/workflow';
import { IconAlertTriangle } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
type VariableChipProps = {
rawVariableName: string;
@@ -18,8 +18,8 @@ export const VariableChip = ({
onRemove,
isFullRecord = false,
}: VariableChipProps) => {
- const { theme } = useContext(ThemeContext);
const { t } = useLingui();
+ const { theme } = useContext(ThemeContext);
const { variableLabel, variablePathLabel } = useSearchVariable({
stepId: extractRawVariableNamePart({
diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/display/components/ForbiddenFieldDisplay.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/display/components/ForbiddenFieldDisplay.tsx
index 1edbad8c6d5..574d01a98f4 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/display/components/ForbiddenFieldDisplay.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/display/components/ForbiddenFieldDisplay.tsx
@@ -2,8 +2,7 @@ import { styled } from '@linaria/react';
import { Trans } from '@lingui/react/macro';
import { useContext } from 'react';
import { IconLock } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledContainer = styled.div`
align-items: center;
diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/RichTextFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/RichTextFieldInput.tsx
index 4ede25a0392..b1beee68700 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/RichTextFieldInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/RichTextFieldInput.tsx
@@ -14,8 +14,7 @@ import { Suspense, lazy, useContext, useRef } from 'react';
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
import { IconLayoutSidebarLeftCollapse } from 'twenty-ui/display';
import { FloatingIconButton } from 'twenty-ui/input';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const ActivityRichTextEditor = lazy(() =>
import('@/activities/components/ActivityRichTextEditor').then((module) => ({
@@ -43,7 +42,6 @@ const StyledCollapseButton = styled.div`
const LoadingSkeleton = () => {
const { theme } = useContext(ThemeContext);
-
return (
<SkeletonTheme
baseColor={theme.background.tertiary}
diff --git a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexPageHeaderIcon.tsx b/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexPageHeaderIcon.tsx
index 439f2be38b9..bd187c62793 100644
--- a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexPageHeaderIcon.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexPageHeaderIcon.tsx
@@ -1,5 +1,4 @@
import { isNonEmptyString } from '@sniptt/guards';
-import { useContext } from 'react';
import { NavigationMenuItemStyleIcon } from '@/navigation-menu-item/components/NavigationMenuItemStyleIcon';
import { usePrefetchedNavigationMenuItemsData } from '@/navigation-menu-item/hooks/usePrefetchedNavigationMenuItemsData';
@@ -8,17 +7,17 @@ import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataI
import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue';
import { coreIndexViewIdFromObjectMetadataItemFamilySelector } from '@/views/states/selectors/coreIndexViewIdFromObjectMetadataItemFamilySelector';
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
+import { useContext } from 'react';
import { isDefined } from 'twenty-shared/utils';
import { useIcons } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
import { FeatureFlagKey } from '~/generated-metadata/graphql';
+import { ThemeContext } from 'twenty-ui/theme-constants';
export const RecordIndexPageHeaderIcon = ({
objectMetadataItem,
}: {
objectMetadataItem?: ObjectMetadataItem;
}) => {
- const { theme } = useContext(ThemeContext);
const isNavigationMenuItemEditingEnabled = useIsFeatureEnabled(
FeatureFlagKey.IS_NAVIGATION_MENU_ITEM_EDITING_ENABLED,
);
@@ -28,6 +27,7 @@ export const RecordIndexPageHeaderIcon = ({
coreIndexViewIdFromObjectMetadataItemFamilySelector,
{ objectMetadataItemId: objectMetadataItem?.id ?? '' },
);
+ const { theme } = useContext(ThemeContext);
const { getIcon } = useIcons();
const ObjectIcon = getIcon(objectMetadataItem?.icon);
diff --git a/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCellContainer.tsx b/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCellContainer.tsx
index 0af9e83e431..b41eba65935 100644
--- a/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCellContainer.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCellContainer.tsx
@@ -1,7 +1,6 @@
import { styled } from '@linaria/react';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext';
import { useFieldFocus } from '@/object-record/record-field/ui/hooks/useFieldFocus';
@@ -73,6 +72,7 @@ export const StyledSkeletonDiv = styled.div`
export const RecordInlineCellContainer = () => {
const { readonly, IconLabel, label, labelWidth, showLabel } =
useRecordInlineCellContext();
+ const { theme } = useContext(ThemeContext);
const { recordId, fieldDefinition, onMouseEnter, onMouseLeave, anchorId } =
useContext(FieldContext);
@@ -97,7 +97,6 @@ export const RecordInlineCellContainer = () => {
onMouseLeave?.();
};
- const { theme } = useContext(ThemeContext);
const labelId = `label-${getRecordFieldInputInstanceId({
recordId,
fieldName: fieldDefinition?.metadata?.fieldName,
diff --git a/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCellSkeletonLoader.tsx b/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCellSkeletonLoader.tsx
index 3a19ee2fb54..6ef8bdfe089 100644
--- a/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCellSkeletonLoader.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCellSkeletonLoader.tsx
@@ -1,13 +1,12 @@
import { useContext } from 'react';
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
-import { ThemeContext } from 'twenty-ui/theme';
import { SKELETON_LOADER_HEIGHT_SIZES } from '@/activities/components/SkeletonLoader';
+import { ThemeContext } from 'twenty-ui/theme-constants';
import { StyledSkeletonDiv } from './RecordInlineCellContainer';
export const RecordInlineCellSkeletonLoader = () => {
const { theme } = useContext(ThemeContext);
-
return (
<SkeletonTheme
baseColor={theme.background.tertiary}
diff --git a/packages/twenty-front/src/modules/object-record/record-inline-cell/property-box/components/PropertyBoxSkeletonLoader.tsx b/packages/twenty-front/src/modules/object-record/record-inline-cell/property-box/components/PropertyBoxSkeletonLoader.tsx
index cdcaeb4bd40..e0a04dd150c 100644
--- a/packages/twenty-front/src/modules/object-record/record-inline-cell/property-box/components/PropertyBoxSkeletonLoader.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-inline-cell/property-box/components/PropertyBoxSkeletonLoader.tsx
@@ -2,8 +2,7 @@ import { SKELETON_LOADER_HEIGHT_SIZES } from '@/activities/components/SkeletonLo
import { styled } from '@linaria/react';
import { useContext } from 'react';
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledSkeletonDiv = styled.div`
align-items: center;
diff --git a/packages/twenty-front/src/modules/object-record/record-show/components/ObjectRecordShowPageBreadcrumb.tsx b/packages/twenty-front/src/modules/object-record/record-show/components/ObjectRecordShowPageBreadcrumb.tsx
index 390cd952a52..0c3abea1b76 100644
--- a/packages/twenty-front/src/modules/object-record/record-show/components/ObjectRecordShowPageBreadcrumb.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-show/components/ObjectRecordShowPageBreadcrumb.tsx
@@ -11,8 +11,7 @@ import { RecordTitleCellContainerType } from '@/object-record/record-title-cell/
import { styled } from '@linaria/react';
import { useContext } from 'react';
import { FieldMetadataType } from 'twenty-shared/types';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledEditableTitleContainer = styled.div`
align-items: center;
@@ -52,6 +51,7 @@ export const ObjectRecordShowPageBreadcrumb = ({
objectLabel: string;
labelIdentifierFieldMetadataItem?: FieldMetadataItem;
}) => {
+ const { theme } = useContext(ThemeContext);
const { loading } = useFindOneRecord({
objectNameSingular,
objectRecordId,
@@ -81,9 +81,6 @@ export const ObjectRecordShowPageBreadcrumb = ({
objectNameSingular,
objectRecordId,
);
-
- const { theme } = useContext(ThemeContext);
-
if (loading) {
return null;
}
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellBaseContainer.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellBaseContainer.tsx
index a65986530f9..8d095bab853 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellBaseContainer.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellBaseContainer.tsx
@@ -6,7 +6,7 @@ import { isFieldIdentifierDisplay } from '@/object-record/record-field/ui/meta-t
import { RECORD_CHIP_CLICK_OUTSIDE_ID } from '@/object-record/record-table/constants/RecordChipClickOutsideId';
import { RecordTableCellContext } from '@/object-record/record-table/contexts/RecordTableCellContext';
import { useOpenRecordTableCellFromCell } from '@/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellFromCell';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
const StyledBaseContainer = styled.div<{
fontColorMedium: string;
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellFirstRowFirstColumn.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellFirstRowFirstColumn.tsx
index 4c1360a5a71..6299739c7c7 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellFirstRowFirstColumn.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellFirstRowFirstColumn.tsx
@@ -10,7 +10,7 @@ import { styled } from '@linaria/react';
import { type DraggableProvidedDragHandleProps } from '@hello-pangea/dnd';
import { cx } from '@linaria/core';
import { useContext, type ReactNode } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
const StyledRecordTableTd = styled(StyledCell)<{ zIndex: number }>`
z-index: ${({ zIndex }) => zIndex};
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellSkeletonLoader.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellSkeletonLoader.tsx
index ba960a42b4a..eae1a0a920b 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellSkeletonLoader.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellSkeletonLoader.tsx
@@ -2,8 +2,7 @@ import { SKELETON_LOADER_HEIGHT_SIZES } from '@/activities/components/SkeletonLo
import { styled } from '@linaria/react';
import { useContext } from 'react';
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledSkeletonContainer = styled.div`
padding-left: ${themeCssVariables.spacing[2]};
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellStyleWrapper.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellStyleWrapper.tsx
index 93276b08912..a9c95406baa 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellStyleWrapper.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellStyleWrapper.tsx
@@ -2,7 +2,7 @@ import { type DraggableProvidedDragHandleProps } from '@hello-pangea/dnd';
import { cx } from '@linaria/core';
import { styled } from '@linaria/react';
import { type ReactNode, useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
export const StyledCell = styled.div<{
backgroundColor: string;
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/components/RecordTableColumnAggregateFooterValueCell.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/components/RecordTableColumnAggregateFooterValueCell.tsx
index 8cf95e7bb22..9a200af74c4 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/components/RecordTableColumnAggregateFooterValueCell.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/components/RecordTableColumnAggregateFooterValueCell.tsx
@@ -11,8 +11,7 @@ import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/use
import { styled } from '@linaria/react';
import { useContext, useState } from 'react';
import { IconChevronDown } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledCell = styled.div<{ isUnfolded: boolean; isFirstCell: boolean }>`
align-items: center;
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableColumnHead.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableColumnHead.tsx
index 35026533b64..e6090427eec 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableColumnHead.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableColumnHead.tsx
@@ -8,8 +8,11 @@ import { shouldCompactRecordTableFirstColumnComponentState } from '@/object-reco
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue';
import { useIcons } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { MOBILE_VIEWPORT, themeCssVariables } from 'twenty-ui/theme-constants';
+import {
+ MOBILE_VIEWPORT,
+ ThemeContext,
+ themeCssVariables,
+} from 'twenty-ui/theme-constants';
const StyledTitle = styled.div<{ hideTitle?: boolean }>`
align-items: center;
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderAddColumnButton.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderAddColumnButton.tsx
index 6224ac3959d..447063226c4 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderAddColumnButton.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderAddColumnButton.tsx
@@ -19,8 +19,7 @@ import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/use
import { cx } from '@linaria/core';
import { useContext } from 'react';
import { IconPlus } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledPlusIconHeaderCell = styled.div<{
shouldDisplayBorderBottom: boolean;
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderDragDropColumn.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderDragDropColumn.tsx
index 1fc29656268..cac4c178b57 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderDragDropColumn.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderDragDropColumn.tsx
@@ -12,8 +12,7 @@ import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/use
import { styled } from '@linaria/react';
import { cx } from '@linaria/core';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledDragDropHeaderCell = styled.div<{
shouldDisplayBorderBottom: boolean;
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableActionRow.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableActionRow.tsx
index 05766fba4d4..aa7068fd680 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableActionRow.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableActionRow.tsx
@@ -1,8 +1,7 @@
import { styled } from '@linaria/react';
import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { RECORD_TABLE_COLUMN_CHECKBOX_WIDTH } from '@/object-record/record-table/constants/RecordTableColumnCheckboxWidth';
import { RECORD_TABLE_COLUMN_DRAG_AND_DROP_WIDTH } from '@/object-record/record-table/constants/RecordTableColumnDragAndDropWidth';
import { RECORD_TABLE_COLUMN_MIN_WIDTH } from '@/object-record/record-table/constants/RecordTableColumnMinWidth';
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableDraggableTr.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableDraggableTr.tsx
index f1050040cb6..c2f55bc8bd2 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableDraggableTr.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableDraggableTr.tsx
@@ -1,6 +1,6 @@
import { Draggable } from '@hello-pangea/dnd';
import { type ReactNode, useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
import { RecordTableRowDraggableContextProvider } from '@/object-record/record-table/contexts/RecordTableRowDraggableContext';
import { RecordTableRowMultiDragPreview } from '@/object-record/record-table/record-table-row/components/RecordTableRowMultiDragPreview';
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableDraggableTrFirstRowOfGroup.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableDraggableTrFirstRowOfGroup.tsx
index 69d94e27182..32524eccd72 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableDraggableTrFirstRowOfGroup.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableDraggableTrFirstRowOfGroup.tsx
@@ -1,6 +1,6 @@
import { Draggable } from '@hello-pangea/dnd';
import { type ReactNode, useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
import { RecordTableRowDraggableContextProvider } from '@/object-record/record-table/contexts/RecordTableRowDraggableContext';
import { RecordTableRowMultiDragPreview } from '@/object-record/record-table/record-table-row/components/RecordTableRowMultiDragPreview';
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-section/components/RecordTableRecordGroupSection.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-section/components/RecordTableRecordGroupSection.tsx
index fe53fb9f02d..70356be4b91 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-section/components/RecordTableRecordGroupSection.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-section/components/RecordTableRecordGroupSection.tsx
@@ -1,7 +1,6 @@
import { styled } from '@linaria/react';
import { useCallback, useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { RecordBoardColumnHeaderAggregateDropdown } from '@/object-record/record-board/record-board-column/components/RecordBoardColumnHeaderAggregateDropdown';
import { visibleRecordFieldsComponentSelector } from '@/object-record/record-field/states/visibleRecordFieldsComponentSelector';
diff --git a/packages/twenty-front/src/modules/onboarding/components/OnboardingModalCircularIcon.tsx b/packages/twenty-front/src/modules/onboarding/components/OnboardingModalCircularIcon.tsx
index c4f8c6c0a7b..6bea820ce30 100644
--- a/packages/twenty-front/src/modules/onboarding/components/OnboardingModalCircularIcon.tsx
+++ b/packages/twenty-front/src/modules/onboarding/components/OnboardingModalCircularIcon.tsx
@@ -1,8 +1,7 @@
import { styled } from '@linaria/react';
import { useContext } from 'react';
import { type IconComponent } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledCheckContainer = styled.div<{ color: string }>`
align-items: center;
diff --git a/packages/twenty-front/src/modules/page-layout/components/PageLayoutGridResizeHandle.tsx b/packages/twenty-front/src/modules/page-layout/components/PageLayoutGridResizeHandle.tsx
index c63f93e6b6d..f4e40877eaf 100644
--- a/packages/twenty-front/src/modules/page-layout/components/PageLayoutGridResizeHandle.tsx
+++ b/packages/twenty-front/src/modules/page-layout/components/PageLayoutGridResizeHandle.tsx
@@ -7,9 +7,7 @@ import {
IconRadiusTopRight,
} from 'twenty-ui/display';
import { ResizeHandle } from 'twenty-ui/layout';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
-import { ThemeContext } from 'twenty-ui/theme';
-
+import { themeCssVariables, ThemeContext } from 'twenty-ui/theme-constants';
type WidgetHandleAxis = 'n' | 's' | 'e' | 'w' | 'ne' | 'nw' | 'se' | 'sw';
type WidgetHorizontalHandleAxis = 'n' | 's';
type WidgetVerticalHandleAxis = 'e' | 'w';
diff --git a/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListReorderableOverflowDropdown.tsx b/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListReorderableOverflowDropdown.tsx
index 89a936d6921..e398c645f7d 100644
--- a/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListReorderableOverflowDropdown.tsx
+++ b/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListReorderableOverflowDropdown.tsx
@@ -29,7 +29,7 @@ import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSe
import { useContext } from 'react';
import { CommandMenuPages } from 'twenty-shared/types';
import { type PageLayoutType } from '~/generated-metadata/graphql';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
const StyledOverflowDropdownListDraggableWrapper = styled.div`
display: flex;
diff --git a/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabMenuItemSelectAvatar.tsx b/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabMenuItemSelectAvatar.tsx
index 2d3196c850c..e7c8078818f 100644
--- a/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabMenuItemSelectAvatar.tsx
+++ b/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabMenuItemSelectAvatar.tsx
@@ -11,9 +11,7 @@ import {
StyledMenuItemLabel,
StyledMenuItemLeftContent,
} from 'twenty-ui/navigation';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
-import { ThemeContext } from 'twenty-ui/theme';
-
+import { themeCssVariables, ThemeContext } from 'twenty-ui/theme-constants';
const StyledTextContainer = styled.div`
display: flex;
align-items: center;
diff --git a/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabRenderClone.tsx b/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabRenderClone.tsx
index b39b3ab682c..ab574ca6077 100644
--- a/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabRenderClone.tsx
+++ b/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabRenderClone.tsx
@@ -8,9 +8,8 @@ import { styled } from '@linaria/react';
import { type DraggableProvided } from '@hello-pangea/dnd';
import { StyledTabContainer, TabContent } from 'twenty-ui/input';
import { MenuItemSelectAvatar } from 'twenty-ui/navigation';
+import { ThemeContext } from 'twenty-ui/theme-constants';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
-
const StyledDraggableWrapper = styled.div`
display: flex;
cursor: grab;
@@ -30,7 +29,6 @@ export const PageLayoutTabRenderClone = ({
activeTabId: string | null;
}) => {
const { theme } = useContext(ThemeContext);
-
const pageLayoutTabListCurrentDragDroppableId = useAtomComponentStateValue(
pageLayoutTabListCurrentDragDroppableIdComponentState,
);
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/components/WidgetRenderer.tsx b/packages/twenty-front/src/modules/page-layout/widgets/components/WidgetRenderer.tsx
index 7ac7244c007..de86928696c 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/components/WidgetRenderer.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/components/WidgetRenderer.tsx
@@ -33,7 +33,7 @@ import {
PageLayoutType,
WidgetType,
} from '~/generated-metadata/graphql';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
const StyledNoAccessContainer = styled.div`
align-items: center;
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/components/WidgetSkeletonLoader.tsx b/packages/twenty-front/src/modules/page-layout/widgets/components/WidgetSkeletonLoader.tsx
index 0aba5fd279f..b3077966ccf 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/components/WidgetSkeletonLoader.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/components/WidgetSkeletonLoader.tsx
@@ -1,8 +1,8 @@
import { SKELETON_LOADER_HEIGHT_SIZES } from '@/activities/components/SkeletonLoader';
import { styled } from '@linaria/react';
-import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
+import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
+import { ThemeContext } from 'twenty-ui/theme-constants';
const StyledContainer = styled.div`
align-items: center;
@@ -14,7 +14,6 @@ const StyledContainer = styled.div`
export const WidgetSkeletonLoader = () => {
const { theme } = useContext(ThemeContext);
-
return (
<StyledContainer>
<SkeletonTheme
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/fields/components/FieldsWidgetGroupContainer.tsx b/packages/twenty-front/src/modules/page-layout/widgets/fields/components/FieldsWidgetGroupContainer.tsx
index 605d4de240e..f17bf8d6c38 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/fields/components/FieldsWidgetGroupContainer.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/fields/components/FieldsWidgetGroupContainer.tsx
@@ -2,8 +2,7 @@ import { styled } from '@linaria/react';
import { useContext, useState } from 'react';
import { IconChevronDown } from 'twenty-ui/display';
import { AnimatedExpandableContainer, Section } from 'twenty-ui/layout';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { themeCssVariables, ThemeContext } from 'twenty-ui/theme-constants';
const StyledHeader = styled.header`
align-items: center;
@@ -36,8 +35,8 @@ export const FieldsWidgetGroupContainer = ({
children,
title,
}: FieldsWidgetGroupContainerProps) => {
- const [isExpanded, setIsExpanded] = useState(true);
const { theme } = useContext(ThemeContext);
+ const [isExpanded, setIsExpanded] = useState(true);
const handleToggleGroup = () =>
setIsExpanded((previousIsExpanded) => !previousIsExpanded);
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/chart-core/layers/AxisLabel.tsx b/packages/twenty-front/src/modules/page-layout/widgets/graph/chart-core/layers/AxisLabel.tsx
index 9a7f3b2f12b..fca42fabab7 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/graph/chart-core/layers/AxisLabel.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/chart-core/layers/AxisLabel.tsx
@@ -1,6 +1,6 @@
import { useContext } from 'react';
import { isDefined } from 'twenty-shared/utils';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
type AxisLabelProps = {
label: string;
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/chart-core/layers/AxisLayer.tsx b/packages/twenty-front/src/modules/page-layout/widgets/graph/chart-core/layers/AxisLayer.tsx
index 82563f7f521..2b585985acd 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/graph/chart-core/layers/AxisLayer.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/chart-core/layers/AxisLayer.tsx
@@ -7,7 +7,7 @@ import { getAxisLayerLayout } from '@/page-layout/widgets/graph/chart-core/utils
import { type ChartMargins } from '@/page-layout/widgets/graph/types/ChartMargins';
import { styled } from '@linaria/react';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
type AxisLayerProps = {
bottomAxisTickRotation: number;
@@ -55,6 +55,7 @@ export const AxisLayer = ({
axisConfig,
}: AxisLayerProps) => {
const { theme } = useContext(ThemeContext);
+
const tickFontSize = axisConfig.tickFontSize;
const legendFontSize = axisConfig.legendFontSize;
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/chart-core/layers/BottomAxisTicks.tsx b/packages/twenty-front/src/modules/page-layout/widgets/graph/chart-core/layers/BottomAxisTicks.tsx
index 5f640b1871c..dc0630435f1 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/graph/chart-core/layers/BottomAxisTicks.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/chart-core/layers/BottomAxisTicks.tsx
@@ -1,6 +1,5 @@
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
-
+import { ThemeContext } from 'twenty-ui/theme-constants';
type BottomAxisTicksProps = {
bottomTickValues: (string | number)[];
getBottomTickPosition: (value: string | number, index: number) => number;
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/chart-core/layers/LeftAxisTicks.tsx b/packages/twenty-front/src/modules/page-layout/widgets/graph/chart-core/layers/LeftAxisTicks.tsx
index 15e11a87927..b635d4b2eb7 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/graph/chart-core/layers/LeftAxisTicks.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/chart-core/layers/LeftAxisTicks.tsx
@@ -1,6 +1,5 @@
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
-
+import { ThemeContext } from 'twenty-ui/theme-constants';
type LeftAxisTicksProps = {
leftTickValues: (string | number)[];
getLeftTickPosition: (value: string | number, index: number) => number;
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/chart-core/layers/ZeroLine.tsx b/packages/twenty-front/src/modules/page-layout/widgets/graph/chart-core/layers/ZeroLine.tsx
index f881863cf0e..919de8782fa 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/graph/chart-core/layers/ZeroLine.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/chart-core/layers/ZeroLine.tsx
@@ -1,6 +1,5 @@
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
-
+import { ThemeContext } from 'twenty-ui/theme-constants';
type ZeroLineProps = {
isVertical: boolean;
zeroPosition: number;
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/components/GraphDataLabel.tsx b/packages/twenty-front/src/modules/page-layout/widgets/graph/components/GraphDataLabel.tsx
index c5bedd74c5c..a737f902e98 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/graph/components/GraphDataLabel.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/components/GraphDataLabel.tsx
@@ -1,9 +1,9 @@
import { type GraphLabelData } from '@/page-layout/widgets/graph/types/GraphLabelData';
import { calculateGraphLabelStyles } from '@/page-layout/widgets/graph/utils/calculateGraphLabelStyles';
import { animated } from '@react-spring/web';
-import { isDefined } from 'twenty-shared/utils';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
+import { isDefined } from 'twenty-shared/utils';
+import { ThemeContext } from 'twenty-ui/theme-constants';
type GraphDataLabelProps = {
label: GraphLabelData;
@@ -19,6 +19,7 @@ export const GraphDataLabel = ({
isVerticalLayout,
}: GraphDataLabelProps) => {
const { theme } = useContext(ThemeContext);
+
const styles = calculateGraphLabelStyles(label, offset, isVerticalLayout);
return (
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/components/GraphWidgetFloatingTooltip.tsx b/packages/twenty-front/src/modules/page-layout/widgets/graph/components/GraphWidgetFloatingTooltip.tsx
index 51580b2c41e..dfa6ba868f0 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/graph/components/GraphWidgetFloatingTooltip.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/components/GraphWidgetFloatingTooltip.tsx
@@ -5,10 +5,9 @@ import {
import { useGraphWidgetTooltipFloating } from '@/page-layout/widgets/graph/hooks/useGraphWidgetTooltipFloating';
import { FloatingPortal, type VirtualElement } from '@floating-ui/react';
import { animated, useSpring } from '@react-spring/web';
-import { isDefined } from 'twenty-shared/utils';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
-
+import { isDefined } from 'twenty-shared/utils';
+import { ThemeContext } from 'twenty-ui/theme-constants';
type GraphWidgetFloatingTooltipProps = {
reference: Element | VirtualElement | null;
boundary: Element | null;
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/components/GraphWidgetLegend.tsx b/packages/twenty-front/src/modules/page-layout/widgets/graph/components/GraphWidgetLegend.tsx
index 250da1a8bc5..bc0b032d431 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/graph/components/GraphWidgetLegend.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/components/GraphWidgetLegend.tsx
@@ -20,8 +20,7 @@ import {
OverflowingTextWithTooltip,
} from 'twenty-ui/display';
import { LightIconButton } from 'twenty-ui/input';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
export type GraphWidgetLegendItem = {
id: string;
@@ -140,6 +139,8 @@ export const GraphWidgetLegend = ({
items,
show = true,
}: GraphWidgetLegendProps) => {
+ const { theme } = useContext(ThemeContext);
+
const containerRef = useRef<HTMLDivElement>(null);
const [currentPage, setCurrentPage] = useState(0);
@@ -149,8 +150,6 @@ export const GraphWidgetLegend = ({
const [animationDirection, setAnimationDirection] =
useState<AnimationDirection>('forward');
- const { theme } = useContext(ThemeContext);
-
const isPageLayoutInEditMode = useAtomComponentStateValue(
isPageLayoutInEditModeComponentState,
);
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/components/GraphWidgetTooltip.tsx b/packages/twenty-front/src/modules/page-layout/widgets/graph/components/GraphWidgetTooltip.tsx
index e9c7ee85fe8..62d51862672 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/graph/components/GraphWidgetTooltip.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/components/GraphWidgetTooltip.tsx
@@ -5,11 +5,10 @@ import { GraphWidgetLegendDot } from '@/page-layout/widgets/graph/components/Gra
import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
import { isNonEmptyString } from '@sniptt/guards';
+import { useContext } from 'react';
import { isDefined } from 'twenty-shared/utils';
import { IconArrowUpRight } from 'twenty-ui/display';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
-import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledTooltip = styled.div`
background: ${themeCssVariables.background.primary};
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/components/NoDataLayer.tsx b/packages/twenty-front/src/modules/page-layout/widgets/graph/components/NoDataLayer.tsx
index 500b260a0e0..3c3defcadf1 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/graph/components/NoDataLayer.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/components/NoDataLayer.tsx
@@ -1,6 +1,6 @@
-import { useContext } from 'react';
import { useLingui } from '@lingui/react/macro';
-import { ThemeContext } from 'twenty-ui/theme';
+import { useContext } from 'react';
+import { ThemeContext } from 'twenty-ui/theme-constants';
type NoDataLayerProps = {
innerWidth: number;
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetAggregateChart/components/GraphWidgetAggregateChart.tsx b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetAggregateChart/components/GraphWidgetAggregateChart.tsx
index bdd2a958f62..23f471c53b3 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetAggregateChart/components/GraphWidgetAggregateChart.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetAggregateChart/components/GraphWidgetAggregateChart.tsx
@@ -1,5 +1,6 @@
import { formatNumberChartTrend } from '@/page-layout/widgets/graph/graphWidgetAggregateChart/utils/formatNumberChartTrend';
import { styled } from '@linaria/react';
+import { useContext } from 'react';
import { isDefined } from 'twenty-shared/utils';
import {
H1Title,
@@ -7,10 +8,7 @@ import {
IconTrendingDown,
IconTrendingUp,
} from 'twenty-ui/display';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
-import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
-
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
type GraphWidgetAggregateChartProps = {
value: string | number;
trendPercentage?: number;
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/BarChart.tsx b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/BarChart.tsx
index 65ec5a5d908..255dc4662e7 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/BarChart.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/BarChart.tsx
@@ -18,9 +18,8 @@ import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/use
import { styled } from '@linaria/react';
import { type MouseEvent, useContext } from 'react';
import { isDefined } from 'twenty-shared/utils';
+import { ThemeContext } from 'twenty-ui/theme-constants';
import { BarChartLayout } from '~/generated-metadata/graphql';
-import { ThemeContext } from 'twenty-ui/theme';
-
type BarChartProps = {
data: BarChartDatum[];
indexBy: string;
@@ -77,6 +76,7 @@ export const BarChart = ({
hasNoData = false,
}: BarChartProps) => {
const { theme } = useContext(ThemeContext);
+
const graphWidgetHighlightedLegendId = useAtomComponentStateValue(
graphWidgetHighlightedLegendIdComponentState,
);
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/BarChartBaseLayerEffect.tsx b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/BarChartBaseLayerEffect.tsx
index a11111e0d82..79e58a745f6 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/BarChartBaseLayerEffect.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/BarChartBaseLayerEffect.tsx
@@ -15,7 +15,7 @@ import {
useState,
} from 'react';
import { BarChartLayout } from '~/generated-metadata/graphql';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
type BarChartBaseLayerEffectProps = {
bars: BarPosition[];
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/BarChartHoverLayerEffect.tsx b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/BarChartHoverLayerEffect.tsx
index ef84d04802d..feb7a3d33b0 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/BarChartHoverLayerEffect.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/BarChartHoverLayerEffect.tsx
@@ -4,7 +4,7 @@ import { renderSliceHighlight } from '@/page-layout/widgets/graph/graphWidgetBar
import { type ChartMargins } from '@/page-layout/widgets/graph/types/ChartMargins';
import { type RefObject, useContext, useEffect, useState } from 'react';
import { BarChartLayout } from '~/generated-metadata/graphql';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
type BarChartHoverLayerEffectProps = {
hoveredSlice: BarChartSlice | null;
@@ -24,6 +24,7 @@ export const BarChartHoverLayerEffect = ({
canvasRef,
}: BarChartHoverLayerEffectProps) => {
const { theme } = useContext(ThemeContext);
+
const [dpr] = useState<number>(
() =>
(typeof window !== 'undefined' ? window.devicePixelRatio : undefined) ||
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/hooks/useBarChartTheme.ts b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/hooks/useBarChartTheme.ts
index 24d4e28ce93..1461ad6823b 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/hooks/useBarChartTheme.ts
+++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/hooks/useBarChartTheme.ts
@@ -1,10 +1,11 @@
import { COMMON_CHART_CONSTANTS } from '@/page-layout/widgets/graph/constants/CommonChartConstants';
import { parseFontSizeToPx } from '@/page-layout/widgets/graph/utils/parseFontSizeToPx';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
export const useBarChartTheme = () => {
const { theme } = useContext(ThemeContext);
+
const tickFontSize = COMMON_CHART_CONSTANTS.AXIS_FONT_SIZE;
const legendFontSize = parseFontSizeToPx(theme.font.size.sm, tickFontSize);
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/components/CustomCrosshairLayer.tsx b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/components/CustomCrosshairLayer.tsx
index ca3cf1e04d9..b18c6e09a77 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/components/CustomCrosshairLayer.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/components/CustomCrosshairLayer.tsx
@@ -5,7 +5,7 @@ import { type LineSeries, type Point } from '@nivo/line';
import { motion } from 'framer-motion';
import { type MouseEvent, useCallback, useContext, useMemo } from 'react';
import { isDefined } from 'twenty-shared/utils';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
export type SliceHoverData = {
sliceX: number;
@@ -41,6 +41,7 @@ export const CustomCrosshairLayer = ({
onRectLeave,
}: CustomCrosshairLayerProps) => {
const { theme } = useContext(ThemeContext);
+
const graphWidgetLineCrosshairX = useAtomComponentStateValue(
graphWidgetLineCrosshairXComponentState,
);
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/hooks/useLineChartTheme.ts b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/hooks/useLineChartTheme.ts
index 806715952d2..c45a536c9f8 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/hooks/useLineChartTheme.ts
+++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/hooks/useLineChartTheme.ts
@@ -1,9 +1,10 @@
-import { useContext } from 'react';
import { parseFontSizeToPx } from '@/page-layout/widgets/graph/utils/parseFontSizeToPx';
-import { ThemeContext } from 'twenty-ui/theme';
+import { useContext } from 'react';
+import { ThemeContext } from 'twenty-ui/theme-constants';
export const useLineChartTheme = () => {
const { theme } = useContext(ThemeContext);
+
const tickFontSize = 12;
const legendFontSize = parseFontSizeToPx(theme.font.size.sm, tickFontSize);
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetPieChart/components/PieChartCenterMetricLayer.tsx b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetPieChart/components/PieChartCenterMetricLayer.tsx
index 11886700c2b..3ae31905a46 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetPieChart/components/PieChartCenterMetricLayer.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetPieChart/components/PieChartCenterMetricLayer.tsx
@@ -2,10 +2,9 @@ import { usePieChartCenterMetricData } from '@/page-layout/widgets/graph/graphWi
import { styled } from '@linaria/react';
import { useLingui } from '@lingui/react/macro';
import { AnimatePresence, motion } from 'framer-motion';
-import { type PieChartConfiguration } from '~/generated-metadata/graphql';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
+import { type PieChartConfiguration } from '~/generated-metadata/graphql';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
type PieChartCenterMetricProps = {
objectMetadataItemId: string;
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/utils/parseGraphColor.ts b/packages/twenty-front/src/modules/page-layout/widgets/graph/utils/parseGraphColor.ts
index 70f18402c3f..d4674504745 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/graph/utils/parseGraphColor.ts
+++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/utils/parseGraphColor.ts
@@ -1,6 +1,6 @@
import { type GraphColor } from '@/page-layout/widgets/graph/types/GraphColor';
import { isDefined } from 'twenty-shared/utils';
-import { MAIN_COLOR_NAMES, type ThemeColor } from 'twenty-ui/theme';
+import { type ThemeColor, MAIN_COLOR_NAMES } from 'twenty-ui/theme';
export const parseGraphColor = (
value: string | null | undefined,
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/standalone-rich-text/components/DashboardColorIcon.tsx b/packages/twenty-front/src/modules/page-layout/widgets/standalone-rich-text/components/DashboardColorIcon.tsx
index 6260eddd954..6b020abcae5 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/standalone-rich-text/components/DashboardColorIcon.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/standalone-rich-text/components/DashboardColorIcon.tsx
@@ -1,10 +1,8 @@
import { styled } from '@linaria/react';
import { type BlockNoteColor } from '@/page-layout/widgets/standalone-rich-text/types/BlockNoteColor';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { themeCssVariables, ThemeContext } from 'twenty-ui/theme-constants';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
-
const StyledColorIcon = styled.div<{
textColorValue: string;
backgroundColorValue: string;
@@ -36,7 +34,9 @@ export const DashboardColorIcon = ({
if (color === 'default') {
return 'inherit';
}
- return theme.color[color] ?? 'inherit';
+ return (
+ (theme.color as unknown as Record<string, string>)[color] ?? 'inherit'
+ );
};
const getThemeColorForBackgroundColor = (color: BlockNoteColor): string => {
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/standalone-rich-text/components/DashboardColorSelectionMenu.tsx b/packages/twenty-front/src/modules/page-layout/widgets/standalone-rich-text/components/DashboardColorSelectionMenu.tsx
index b028dcd62da..f5b2459055c 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/standalone-rich-text/components/DashboardColorSelectionMenu.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/standalone-rich-text/components/DashboardColorSelectionMenu.tsx
@@ -10,9 +10,8 @@ import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent
import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';
import { DropdownMenuSectionLabel } from '@/ui/layout/dropdown/components/DropdownMenuSectionLabel';
import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { themeCssVariables, ThemeContext } from 'twenty-ui/theme-constants';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
const StyledColorMenuItem = styled.div`
align-items: center;
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/standalone-rich-text/components/DashboardsBlockEditor.tsx b/packages/twenty-front/src/modules/page-layout/widgets/standalone-rich-text/components/DashboardsBlockEditor.tsx
index d78ceaef067..8365e719072 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/standalone-rich-text/components/DashboardsBlockEditor.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/standalone-rich-text/components/DashboardsBlockEditor.tsx
@@ -12,9 +12,7 @@ import { DashboardEditorSideMenu } from '@/page-layout/widgets/standalone-rich-t
import { DashboardFormattingToolbar } from '@/page-layout/widgets/standalone-rich-text/components/DashboardFormattingToolbar';
import { type DASHBOARD_BLOCK_SCHEMA } from '@/page-layout/widgets/standalone-rich-text/constants/DashboardBlockSchema';
import { getDashboardSlashMenu } from '@/page-layout/widgets/standalone-rich-text/utils/getDashboardSlashMenu';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
-import { ThemeContext } from 'twenty-ui/theme';
-
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
type DashboardsBlockEditorProps = {
editor: typeof DASHBOARD_BLOCK_SCHEMA.BlockNoteEditor;
onFocus?: () => void;
@@ -148,8 +146,8 @@ export const DashboardsBlockEditor = ({
readonly,
boundaryElement,
}: DashboardsBlockEditorProps) => {
- const { theme } = useContext(ThemeContext);
- const blockNoteTheme = theme.name === 'light' ? 'light' : 'dark';
+ const { colorScheme } = useContext(ThemeContext);
+ const blockNoteTheme = colorScheme === 'light' ? 'light' : 'dark';
const handleFocus = () => {
onFocus?.();
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/widget-card/components/WidgetCardHeader.tsx b/packages/twenty-front/src/modules/page-layout/widgets/widget-card/components/WidgetCardHeader.tsx
index 1a8f9606b88..5a0f1739aa7 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/widget-card/components/WidgetCardHeader.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/widget-card/components/WidgetCardHeader.tsx
@@ -12,9 +12,7 @@ import { type WidgetCardVariant } from '@/page-layout/widgets/types/WidgetCardVa
import { WidgetGrip } from '@/page-layout/widgets/widget-card/components/WidgetGrip';
import { AnimatePresence, motion } from 'framer-motion';
import { isDefined, isNonEmptyArray } from 'twenty-shared/utils';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
-import { ThemeContext } from 'twenty-ui/theme';
-
+import { themeCssVariables, ThemeContext } from 'twenty-ui/theme-constants';
export type WidgetCardHeaderProps = {
variant: WidgetCardVariant;
widgetId: string;
@@ -83,7 +81,6 @@ export const WidgetCardHeader = ({
className,
}: WidgetCardHeaderProps) => {
const { theme } = useContext(ThemeContext);
-
const widgetCardHovered = useAtomComponentFamilyStateValue(
widgetCardHoveredComponentFamilyState,
widgetId,
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/widget-card/components/WidgetGrip.tsx b/packages/twenty-front/src/modules/page-layout/widgets/widget-card/components/WidgetGrip.tsx
index ac3826f80a5..e240e411387 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/widget-card/components/WidgetGrip.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/widget-card/components/WidgetGrip.tsx
@@ -1,9 +1,8 @@
import { styled } from '@linaria/react';
import { motion } from 'framer-motion';
import { IconGripVertical } from 'twenty-ui/display';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { themeCssVariables, ThemeContext } from 'twenty-ui/theme-constants';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
const StyledGripContainerBase = styled.div`
width: 20px;
@@ -34,7 +33,6 @@ type WidgetGripProps = {
export const WidgetGrip = ({ className, onClick }: WidgetGripProps) => {
const { theme } = useContext(ThemeContext);
-
return (
<StyledGripContainer
layout
diff --git a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountLoader.tsx b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountLoader.tsx
index fd14514b71e..c5d50418d37 100644
--- a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountLoader.tsx
+++ b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountLoader.tsx
@@ -1,6 +1,6 @@
import { useContext } from 'react';
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
export const SettingsAccountLoader = () => {
const { theme } = useContext(ThemeContext);
diff --git a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsListEmptyStateCard.tsx b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsListEmptyStateCard.tsx
index 4a3e46c2cbe..f86aaff3952 100644
--- a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsListEmptyStateCard.tsx
+++ b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsListEmptyStateCard.tsx
@@ -6,15 +6,14 @@ import { isMicrosoftMessagingEnabledState } from '@/client-config/states/isMicro
import { useTriggerApisOAuth } from '@/settings/accounts/hooks/useTriggerApiOAuth';
import { SettingsCard } from '@/settings/components/SettingsCard';
import { styled } from '@linaria/react';
-import { useContext } from 'react';
import { useLingui } from '@lingui/react/macro';
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
import { ConnectedAccountProvider, SettingsPath } from 'twenty-shared/types';
import { getSettingsPath } from 'twenty-shared/utils';
import { IconAt, IconGoogle, IconMicrosoft } from 'twenty-ui/display';
import { UndecoratedLink } from 'twenty-ui/navigation';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { useContext } from 'react';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledCardsContainer = styled.div`
display: flex;
@@ -23,11 +22,10 @@ const StyledCardsContainer = styled.div`
`;
export const SettingsAccountsListEmptyStateCard = () => {
+ const { theme } = useContext(ThemeContext);
const { triggerApisOAuth } = useTriggerApisOAuth();
const { t } = useLingui();
- const { theme } = useContext(ThemeContext);
-
const isGoogleMessagingEnabled = useAtomStateValue(
isGoogleMessagingEnabledState,
);
diff --git a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsSettingsSection.tsx b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsSettingsSection.tsx
index 06c042a6724..770dca14017 100644
--- a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsSettingsSection.tsx
+++ b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsSettingsSection.tsx
@@ -1,15 +1,18 @@
import { styled } from '@linaria/react';
+import { useContext } from 'react';
import { SettingsCard } from '@/settings/components/SettingsCard';
-import { useContext } from 'react';
import { useLingui } from '@lingui/react/macro';
import { SettingsPath } from 'twenty-shared/types';
import { getSettingsPath } from 'twenty-shared/utils';
import { H2Title, IconCalendarEvent, IconMailCog } from 'twenty-ui/display';
import { Section } from 'twenty-ui/layout';
import { UndecoratedLink } from 'twenty-ui/navigation';
-import { ThemeContext } from 'twenty-ui/theme';
-import { MOBILE_VIEWPORT, themeCssVariables } from 'twenty-ui/theme-constants';
+import {
+ MOBILE_VIEWPORT,
+ ThemeContext,
+ themeCssVariables,
+} from 'twenty-ui/theme-constants';
const StyledCardsContainer = styled.div`
display: flex;
@@ -22,8 +25,8 @@ const StyledCardsContainer = styled.div`
`;
export const SettingsAccountsSettingsSection = () => {
- const { t } = useLingui();
const { theme } = useContext(ThemeContext);
+ const { t } = useLingui();
return (
<Section>
<H2Title
diff --git a/packages/twenty-front/src/modules/settings/accounts/components/SettingsConnectedAccountIcon.tsx b/packages/twenty-front/src/modules/settings/accounts/components/SettingsConnectedAccountIcon.tsx
index 9ccd7296b93..a077618eedd 100644
--- a/packages/twenty-front/src/modules/settings/accounts/components/SettingsConnectedAccountIcon.tsx
+++ b/packages/twenty-front/src/modules/settings/accounts/components/SettingsConnectedAccountIcon.tsx
@@ -1,5 +1,4 @@
import { type ConnectedAccount } from '@/accounts/types/ConnectedAccount';
-import { useContext } from 'react';
import { ConnectedAccountProvider } from 'twenty-shared/types';
import { isDefined } from 'twenty-shared/utils';
import {
@@ -12,7 +11,8 @@ import {
IconMicrosoft,
IconSend,
} from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
+import { useContext } from 'react';
+import { ThemeContext } from 'twenty-ui/theme-constants';
const ImapSmtpCaldavIcon = (
props: IconComponentProps & { account: ConnectedAccount },
diff --git a/packages/twenty-front/src/modules/settings/accounts/components/message-folders/SettingsAccountsMessageFolderIcon.tsx b/packages/twenty-front/src/modules/settings/accounts/components/message-folders/SettingsAccountsMessageFolderIcon.tsx
index d5d5e8de39c..a68437600a1 100644
--- a/packages/twenty-front/src/modules/settings/accounts/components/message-folders/SettingsAccountsMessageFolderIcon.tsx
+++ b/packages/twenty-front/src/modules/settings/accounts/components/message-folders/SettingsAccountsMessageFolderIcon.tsx
@@ -1,13 +1,12 @@
import { type MessageFolder } from '@/accounts/types/MessageFolder';
-import { useContext } from 'react';
import {
IconFolder,
IconFolderRoot,
IconInbox,
IconSend,
} from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-
+import { useContext } from 'react';
+import { ThemeContext } from 'twenty-ui/theme-constants';
type SettingsAccountsMessageFolderIconProps = {
folder: MessageFolder;
isChildFolder?: boolean;
@@ -18,6 +17,7 @@ export const SettingsAccountsMessageFolderIcon = ({
isChildFolder = false,
}: SettingsAccountsMessageFolderIconProps) => {
const { theme } = useContext(ThemeContext);
+
if (folder.isSentFolder) {
return <IconSend size={theme.icon.size.md} stroke={theme.icon.stroke.sm} />;
}
diff --git a/packages/twenty-front/src/modules/settings/accounts/components/message-folders/SettingsMessageFoldersEmptyStateCard.tsx b/packages/twenty-front/src/modules/settings/accounts/components/message-folders/SettingsMessageFoldersEmptyStateCard.tsx
index 57d299e6fb5..f22cbb76883 100644
--- a/packages/twenty-front/src/modules/settings/accounts/components/message-folders/SettingsMessageFoldersEmptyStateCard.tsx
+++ b/packages/twenty-front/src/modules/settings/accounts/components/message-folders/SettingsMessageFoldersEmptyStateCard.tsx
@@ -1,10 +1,9 @@
import { styled } from '@linaria/react';
-import { useContext } from 'react';
import { t } from '@lingui/core/macro';
import { IconFolder } from 'twenty-ui/display';
import { Section } from 'twenty-ui/layout';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { useContext } from 'react';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledEmptyState = styled.div`
align-items: center;
diff --git a/packages/twenty-front/src/modules/settings/accounts/components/message-folders/SettingsMessageFoldersSkeletonLoader.tsx b/packages/twenty-front/src/modules/settings/accounts/components/message-folders/SettingsMessageFoldersSkeletonLoader.tsx
index f08c6e3a893..5ce24b8ff90 100644
--- a/packages/twenty-front/src/modules/settings/accounts/components/message-folders/SettingsMessageFoldersSkeletonLoader.tsx
+++ b/packages/twenty-front/src/modules/settings/accounts/components/message-folders/SettingsMessageFoldersSkeletonLoader.tsx
@@ -2,8 +2,7 @@ import { SKELETON_LOADER_HEIGHT_SIZES } from '@/activities/components/SkeletonLo
import { styled } from '@linaria/react';
import { useContext } from 'react';
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledSkeletonContainer = styled.div`
display: flex;
@@ -37,7 +36,6 @@ const SKELETON_ROWS = [
export const SettingsMessageFoldersSkeletonLoader = () => {
const { theme } = useContext(ThemeContext);
-
return (
<SkeletonTheme
baseColor={theme.background.tertiary}
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.tsx
index 7b5a77231c1..a57a03cd431 100644
--- a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminTabSkeletonLoader.tsx
+++ b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminTabSkeletonLoader.tsx
@@ -2,7 +2,7 @@ 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';
+import { ThemeContext } from 'twenty-ui/theme-constants';
export const SettingsAdminTabSkeletonLoader = () => {
const { theme } = useContext(ThemeContext);
diff --git a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminTableCard.tsx b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminTableCard.tsx
index e32099ac9f4..9d3b7fe11dc 100644
--- a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminTableCard.tsx
+++ b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminTableCard.tsx
@@ -5,7 +5,8 @@ import { TableRow } from '@/ui/layout/table/components/TableRow';
import { isDefined } from 'twenty-shared/utils';
import { type IconComponent } from 'twenty-ui/display';
import { Card } from 'twenty-ui/layout';
-import { ICON_SIZES, themeCssVariables } from 'twenty-ui/theme-constants';
+import { useContext } from 'react';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
type TableItem = {
Icon?: IconComponent;
@@ -31,6 +32,7 @@ export const SettingsAdminTableCard = ({
valueAlign = 'left',
className,
}: SettingsAdminTableCardProps) => {
+ const { theme } = useContext(ThemeContext);
return (
<Card
rounded={rounded}
@@ -51,7 +53,7 @@ export const SettingsAdminTableCard = ({
height={themeCssVariables.spacing[6]}
gap={themeCssVariables.spacing[2]}
>
- {item.Icon && <item.Icon size={ICON_SIZES.md} />}
+ {item.Icon && <item.Icon size={theme.icon.size.md} />}
<span>{item.label}</span>
</TableCell>
<TableCell
diff --git a/packages/twenty-front/src/modules/settings/admin-panel/config-variables/components/ConfigVariableOptionsDropdownContent.tsx b/packages/twenty-front/src/modules/settings/admin-panel/config-variables/components/ConfigVariableOptionsDropdownContent.tsx
index cf3d3faab35..c99737c1fd2 100644
--- a/packages/twenty-front/src/modules/settings/admin-panel/config-variables/components/ConfigVariableOptionsDropdownContent.tsx
+++ b/packages/twenty-front/src/modules/settings/admin-panel/config-variables/components/ConfigVariableOptionsDropdownContent.tsx
@@ -10,11 +10,10 @@ import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/Drop
import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator';
import { t } from '@lingui/core/macro';
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
-import { useContext } from 'react';
import { IconChevronLeft, IconEye, IconEyeOff } from 'twenty-ui/display';
import { MenuItem, MenuItemSelectTag } from 'twenty-ui/navigation';
-import { ThemeContext } from 'twenty-ui/theme';
-
+import { useContext } from 'react';
+import { ThemeContext } from 'twenty-ui/theme-constants';
type ConfigVariableOptionsDropdownContentProps = {
selectedCategory: ConfigVariableFilterCategory | null;
onSelectCategory: (category: ConfigVariableFilterCategory | null) => void;
@@ -39,7 +38,6 @@ export const ConfigVariableOptionsDropdownContent = ({
onShowHiddenChange,
}: ConfigVariableOptionsDropdownContentProps) => {
const { theme } = useContext(ThemeContext);
-
const isConfigVariablesInDbEnabled = useAtomStateValue(
isConfigVariablesInDbEnabledState,
);
diff --git a/packages/twenty-front/src/modules/settings/admin-panel/config-variables/components/SettingsAdminConfigVariablesRow.tsx b/packages/twenty-front/src/modules/settings/admin-panel/config-variables/components/SettingsAdminConfigVariablesRow.tsx
index 88958ad9de8..cbfc9be78b2 100644
--- a/packages/twenty-front/src/modules/settings/admin-panel/config-variables/components/SettingsAdminConfigVariablesRow.tsx
+++ b/packages/twenty-front/src/modules/settings/admin-panel/config-variables/components/SettingsAdminConfigVariablesRow.tsx
@@ -1,12 +1,11 @@
import { TableCell } from '@/ui/layout/table/components/TableCell';
import { TableRow } from '@/ui/layout/table/components/TableRow';
-import { useContext } from 'react';
import { styled } from '@linaria/react';
import { SettingsPath } from 'twenty-shared/types';
import { getSettingsPath } from 'twenty-shared/utils';
import { IconChevronRight } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { useContext } from 'react';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { type ConfigVariable } from '~/generated-metadata/graphql';
type SettingsAdminConfigVariablesRowProps = {
diff --git a/packages/twenty-front/src/modules/settings/admin-panel/config-variables/utils/useSourceContent.ts b/packages/twenty-front/src/modules/settings/admin-panel/config-variables/utils/useSourceContent.ts
index 3fcb976f2d7..9cbe5fdc266 100644
--- a/packages/twenty-front/src/modules/settings/admin-panel/config-variables/utils/useSourceContent.ts
+++ b/packages/twenty-front/src/modules/settings/admin-panel/config-variables/utils/useSourceContent.ts
@@ -1,13 +1,13 @@
import { useLingui } from '@lingui/react/macro';
import { useContext } from 'react';
import { CustomError } from 'twenty-shared/utils';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
import { ConfigSource } from '~/generated-metadata/graphql';
export const useSourceContent = (source: ConfigSource) => {
- const { t } = useLingui();
const { theme } = useContext(ThemeContext);
+ const { t } = useLingui();
switch (source) {
case ConfigSource.DATABASE:
diff --git a/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminHealthStatusListCard.tsx b/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminHealthStatusListCard.tsx
index ff61b84f9a0..cafe5156bdd 100644
--- a/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminHealthStatusListCard.tsx
+++ b/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminHealthStatusListCard.tsx
@@ -1,5 +1,4 @@
import { SettingsListCard } from '@/settings/components/SettingsListCard';
-import { useContext } from 'react';
import { SettingsPath } from 'twenty-shared/types';
import { getSettingsPath } from 'twenty-shared/utils';
import {
@@ -10,7 +9,8 @@ import {
IconTool,
IconUserCircle,
} from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
+import { useContext } from 'react';
+import { ThemeContext } from 'twenty-ui/theme-constants';
import {
HealthIndicatorId,
type SystemHealthService,
diff --git a/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminWorkerMetricsGraph.tsx b/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminWorkerMetricsGraph.tsx
index 962e35f9276..ca2653c1519 100644
--- a/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminWorkerMetricsGraph.tsx
+++ b/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminWorkerMetricsGraph.tsx
@@ -1,12 +1,11 @@
import { SettingsAdminTableCard } from '@/settings/admin-panel/components/SettingsAdminTableCard';
import { SettingsAdminWorkerMetricsTooltip } from '@/settings/admin-panel/health-status/components/SettingsAdminWorkerMetricsTooltip';
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
-import { useContext } from 'react';
import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
import { ResponsiveLine } from '@nivo/line';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { useContext } from 'react';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import {
QueueMetricsTimeRange,
useGetQueueMetricsQuery,
diff --git a/packages/twenty-front/src/modules/settings/components/AdvancedSettingsContentWrapperWithDot.tsx b/packages/twenty-front/src/modules/settings/components/AdvancedSettingsContentWrapperWithDot.tsx
index 16ebac5a6ea..6c3dc230079 100644
--- a/packages/twenty-front/src/modules/settings/components/AdvancedSettingsContentWrapperWithDot.tsx
+++ b/packages/twenty-front/src/modules/settings/components/AdvancedSettingsContentWrapperWithDot.tsx
@@ -1,8 +1,7 @@
import { styled } from '@linaria/react';
import { useContext } from 'react';
import { IconPoint } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledWrapper = styled.div`
position: relative;
@@ -37,6 +36,7 @@ export const AdvancedSettingsContentWrapperWithDot = ({
dotPosition = 'centered',
}: AdvancedSettingsContentWrapperWithDotProps) => {
const { theme } = useContext(ThemeContext);
+
return (
<StyledWrapper>
{!hideDot && (
diff --git a/packages/twenty-front/src/modules/settings/components/SettingsCard.tsx b/packages/twenty-front/src/modules/settings/components/SettingsCard.tsx
index 0e83d9f861d..517fc2af425 100644
--- a/packages/twenty-front/src/modules/settings/components/SettingsCard.tsx
+++ b/packages/twenty-front/src/modules/settings/components/SettingsCard.tsx
@@ -5,8 +5,7 @@ import { t } from '@lingui/core/macro';
import { Card, CardContent } from 'twenty-ui/layout';
import { IconChevronRight } from 'twenty-ui/display';
import { Pill } from 'twenty-ui/components';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
type SettingsCardProps = {
description?: string;
diff --git a/packages/twenty-front/src/modules/settings/components/SettingsConnectedAccountsTableRow.tsx b/packages/twenty-front/src/modules/settings/components/SettingsConnectedAccountsTableRow.tsx
index 6f4d8f3a948..8a684a9452a 100644
--- a/packages/twenty-front/src/modules/settings/components/SettingsConnectedAccountsTableRow.tsx
+++ b/packages/twenty-front/src/modules/settings/components/SettingsConnectedAccountsTableRow.tsx
@@ -5,8 +5,7 @@ import { TableCell } from '@/ui/layout/table/components/TableCell';
import { TableRow } from '@/ui/layout/table/components/TableRow';
import { styled } from '@linaria/react';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledNameCell = styled.div`
align-items: center;
@@ -30,7 +29,6 @@ export const SettingsConnectedAccountsTableRow = ({
account,
}: SettingsConnectedAccountsTableRowProps) => {
const { theme } = useContext(ThemeContext);
-
const IconComponent = SettingsConnectedAccountIcon({ account });
return (
diff --git a/packages/twenty-front/src/modules/settings/components/SettingsItemTypeTag.tsx b/packages/twenty-front/src/modules/settings/components/SettingsItemTypeTag.tsx
index de38f3dde29..935c2141bf6 100644
--- a/packages/twenty-front/src/modules/settings/components/SettingsItemTypeTag.tsx
+++ b/packages/twenty-front/src/modules/settings/components/SettingsItemTypeTag.tsx
@@ -1,11 +1,10 @@
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
import { getItemTagInfo } from '@/settings/data-model/utils/getItemTagInfo';
import { styled } from '@linaria/react';
-import { useContext } from 'react';
import { Avatar } from 'twenty-ui/display';
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { useContext } from 'react';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
type SettingsItemTypeTagProps = {
item: {
@@ -28,7 +27,6 @@ export const SettingsItemTypeTag = ({
className,
item: { isCustom, isRemote, applicationId },
}: SettingsItemTypeTagProps) => {
- const { theme } = useContext(ThemeContext);
const currentWorkspace = useAtomStateValue(currentWorkspaceState);
const itemTagInfo = getItemTagInfo({
item: { isCustom, isRemote, applicationId },
@@ -36,6 +34,8 @@ export const SettingsItemTypeTag = ({
currentWorkspace?.workspaceCustomApplication?.id,
});
+ const { theme } = useContext(ThemeContext);
+
return (
<StyledContainer className={className}>
<Avatar
diff --git a/packages/twenty-front/src/modules/settings/components/SettingsListCard.tsx b/packages/twenty-front/src/modules/settings/components/SettingsListCard.tsx
index 786cfb64ef5..91627486074 100644
--- a/packages/twenty-front/src/modules/settings/components/SettingsListCard.tsx
+++ b/packages/twenty-front/src/modules/settings/components/SettingsListCard.tsx
@@ -5,8 +5,7 @@ import { SettingsListSkeletonCard } from '@/settings/components/SettingsListSkel
import { type IconComponent, IconPlus } from 'twenty-ui/display';
import { Card, CardFooter } from 'twenty-ui/layout';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { SettingsListItemCardContent } from './SettingsListItemCardContent';
const StyledFooter = styled(CardFooter)`
diff --git a/packages/twenty-front/src/modules/settings/components/SettingsListItemCardContent.tsx b/packages/twenty-front/src/modules/settings/components/SettingsListItemCardContent.tsx
index aaa477d3312..15bbf0d060f 100644
--- a/packages/twenty-front/src/modules/settings/components/SettingsListItemCardContent.tsx
+++ b/packages/twenty-front/src/modules/settings/components/SettingsListItemCardContent.tsx
@@ -4,8 +4,7 @@ import { Link } from 'react-router-dom';
import { isDefined } from 'twenty-shared/utils';
import { IconChevronRight, type IconComponent } from 'twenty-ui/display';
import { CardContent } from 'twenty-ui/layout';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledRow = styled(CardContent)`
align-items: center;
diff --git a/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentToggle.tsx b/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentToggle.tsx
index f97ef1372d2..6ccb3365cb9 100644
--- a/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentToggle.tsx
+++ b/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentToggle.tsx
@@ -14,8 +14,7 @@ import {
OverflowingTextWithTooltip,
} from 'twenty-ui/display';
import { Toggle } from 'twenty-ui/input';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledSettingsCardToggleContent = styled(StyledSettingsCardContent)`
cursor: ${({ disabled }) => (disabled ? 'default' : 'pointer')};
diff --git a/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionIconCustomizer.tsx b/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionIconCustomizer.tsx
index 017dd509539..6a84c2f23f9 100644
--- a/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionIconCustomizer.tsx
+++ b/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionIconCustomizer.tsx
@@ -1,7 +1,7 @@
import { styled } from '@linaria/react';
import { useContext } from 'react';
import { type IconComponent } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
type SettingsOptionIconCustomizerProps = {
Icon: IconComponent;
@@ -22,6 +22,7 @@ export const SettingsOptionIconCustomizer = ({
rotate = -4,
}: SettingsOptionIconCustomizerProps) => {
const { theme } = useContext(ThemeContext);
+
return (
<StyledIconCustomizer zoom={zoom} rotate={rotate}>
<Icon
diff --git a/packages/twenty-front/src/modules/settings/components/SettingsRadioCard.tsx b/packages/twenty-front/src/modules/settings/components/SettingsRadioCard.tsx
index 3ec7d4a6424..0db376386a0 100644
--- a/packages/twenty-front/src/modules/settings/components/SettingsRadioCard.tsx
+++ b/packages/twenty-front/src/modules/settings/components/SettingsRadioCard.tsx
@@ -3,8 +3,7 @@ import { useContext } from 'react';
import { CardContent } from 'twenty-ui/layout';
import { type IconComponent } from 'twenty-ui/display';
import { Radio } from 'twenty-ui/input';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledRadioCardContent = styled(CardContent)`
display: flex;
@@ -56,7 +55,6 @@ export const SettingsRadioCard = ({
Icon,
}: SettingsRadioCardProps) => {
const { theme } = useContext(ThemeContext);
-
const onClick = () => handleSelect(value);
return (
diff --git a/packages/twenty-front/src/modules/settings/components/SettingsSkeletonLoader.tsx b/packages/twenty-front/src/modules/settings/components/SettingsSkeletonLoader.tsx
index 53990de3a08..b98a6c935bf 100644
--- a/packages/twenty-front/src/modules/settings/components/SettingsSkeletonLoader.tsx
+++ b/packages/twenty-front/src/modules/settings/components/SettingsSkeletonLoader.tsx
@@ -4,8 +4,7 @@ import { PageHeader } from '@/ui/layout/page/components/PageHeader';
import { styled } from '@linaria/react';
import { useContext } from 'react';
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledContainer = styled.div`
display: flex;
diff --git a/packages/twenty-front/src/modules/settings/data-model/components/SettingsDataModelNewFieldBreadcrumbDropDown.tsx b/packages/twenty-front/src/modules/settings/data-model/components/SettingsDataModelNewFieldBreadcrumbDropDown.tsx
index 66c1d622728..3644ba1a5ce 100644
--- a/packages/twenty-front/src/modules/settings/data-model/components/SettingsDataModelNewFieldBreadcrumbDropDown.tsx
+++ b/packages/twenty-front/src/modules/settings/data-model/components/SettingsDataModelNewFieldBreadcrumbDropDown.tsx
@@ -4,16 +4,15 @@ import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent
import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';
import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';
import { styled } from '@linaria/react';
-import { t } from '@lingui/core/macro';
import { useContext } from 'react';
+import { t } from '@lingui/core/macro';
import { useLocation, useParams, useSearchParams } from 'react-router-dom';
import { SettingsPath } from 'twenty-shared/types';
import { isDefined } from 'twenty-shared/utils';
import { IconChevronDown } from 'twenty-ui/display';
import { Button } from 'twenty-ui/input';
import { MenuItem } from 'twenty-ui/navigation';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { useNavigateSettings } from '~/hooks/useNavigateSettings';
const StyledContainer = styled.div`
@@ -52,13 +51,13 @@ const StyledButton = styled(Button)`
`;
export const SettingsDataModelNewFieldBreadcrumbDropDown = () => {
+ const { theme } = useContext(ThemeContext);
const dropdownId = `settings-object-new-field-breadcrumb-dropdown`;
const { closeDropdown } = useCloseDropdown();
const navigate = useNavigateSettings();
const location = useLocation();
const { objectNamePlural = '' } = useParams();
const [searchParams] = useSearchParams();
- const { theme } = useContext(ThemeContext);
const fieldType = searchParams.get('fieldType') as SettingsFieldType;
const isConfigureStep = location.pathname.includes('/configure');
diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/forms/components/SettingsDataModelFieldIconLabelForm.tsx b/packages/twenty-front/src/modules/settings/data-model/fields/forms/components/SettingsDataModelFieldIconLabelForm.tsx
index d95bb33d1bc..06ec88fbeee 100644
--- a/packages/twenty-front/src/modules/settings/data-model/fields/forms/components/SettingsDataModelFieldIconLabelForm.tsx
+++ b/packages/twenty-front/src/modules/settings/data-model/fields/forms/components/SettingsDataModelFieldIconLabelForm.tsx
@@ -1,4 +1,5 @@
import { styled } from '@linaria/react';
+import { useContext } from 'react';
import { Controller, useFormContext } from 'react-hook-form';
import { type z } from 'zod';
@@ -12,7 +13,6 @@ import { getErrorMessageFromError } from '@/settings/data-model/fields/forms/uti
import { IconPicker } from '@/ui/input/components/IconPicker';
import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';
import { useLingui } from '@lingui/react/macro';
-import { useContext } from 'react';
import { FieldMetadataType } from 'twenty-shared/types';
import { isDefined } from 'twenty-shared/utils';
import {
@@ -22,8 +22,7 @@ import {
TooltipDelay,
} from 'twenty-ui/display';
import { Card } from 'twenty-ui/layout';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { computeMetadataNameFromLabel } from '~/pages/settings/data-model/utils/computeMetadataNameFromLabel';
export const settingsDataModelFieldIconLabelFormSchema = (
@@ -96,7 +95,6 @@ export const SettingsDataModelFieldIconLabelForm = ({
} = useFormContext<SettingsDataModelFieldIconLabelFormValues>();
const { theme } = useContext(ThemeContext);
-
const label = watch('label');
const { t } = useLingui();
diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/forms/components/SettingsObjectNewFieldSelector.tsx b/packages/twenty-front/src/modules/settings/data-model/fields/forms/components/SettingsObjectNewFieldSelector.tsx
index c724426fbfb..32ffe2796c5 100644
--- a/packages/twenty-front/src/modules/settings/data-model/fields/forms/components/SettingsObjectNewFieldSelector.tsx
+++ b/packages/twenty-front/src/modules/settings/data-model/fields/forms/components/SettingsObjectNewFieldSelector.tsx
@@ -19,8 +19,7 @@ import { SettingsPath } from 'twenty-shared/types';
import { getSettingsPath } from 'twenty-shared/utils';
import { H2Title, IconSearch } from 'twenty-ui/display';
import { UndecoratedLink } from 'twenty-ui/navigation';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { FieldMetadataType } from '~/generated-metadata/graphql';
import { type SettingsDataModelFieldTypeFormValues } from '~/pages/settings/data-model/new-field/SettingsObjectNewFieldSelect';
diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/forms/select/components/SettingsDataModelFieldSelectForm.tsx b/packages/twenty-front/src/modules/settings/data-model/fields/forms/select/components/SettingsDataModelFieldSelectForm.tsx
index 24efee2b6df..c768535687f 100644
--- a/packages/twenty-front/src/modules/settings/data-model/fields/forms/select/components/SettingsDataModelFieldSelectForm.tsx
+++ b/packages/twenty-front/src/modules/settings/data-model/fields/forms/select/components/SettingsDataModelFieldSelectForm.tsx
@@ -43,8 +43,7 @@ import {
import { LightButton, LightIconButton } from 'twenty-ui/input';
import { CardContent, CardFooter } from 'twenty-ui/layout';
import { MenuItem } from 'twenty-ui/navigation';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { SettingsDataModelFieldSelectFormOptionRow } from './SettingsDataModelFieldSelectFormOptionRow';
export const settingsDataModelFieldSelectFormSchema = z.object({
@@ -159,6 +158,7 @@ export const SettingsDataModelFieldSelectForm = ({
fieldType,
disabled = false,
}: SettingsDataModelFieldSelectFormProps) => {
+ const { theme } = useContext(ThemeContext);
const { initialDefaultValue, initialOptions } =
useSelectSettingsFormInitialValues({
fieldMetadataId: existingFieldMetadataId,
@@ -302,8 +302,6 @@ export const SettingsDataModelFieldSelectForm = ({
setFormValue('options', newOptions, { shouldDirty: true });
};
- const { theme } = useContext(ThemeContext);
-
return (
<>
<Controller
diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/forms/select/components/SettingsDataModelFieldSelectFormOptionRow.tsx b/packages/twenty-front/src/modules/settings/data-model/fields/forms/select/components/SettingsDataModelFieldSelectFormOptionRow.tsx
index 0a23e86c769..ff737334fad 100644
--- a/packages/twenty-front/src/modules/settings/data-model/fields/forms/select/components/SettingsDataModelFieldSelectFormOptionRow.tsx
+++ b/packages/twenty-front/src/modules/settings/data-model/fields/forms/select/components/SettingsDataModelFieldSelectFormOptionRow.tsx
@@ -6,8 +6,8 @@ import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';
import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';
import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';
import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';
-import { useContext } from 'react';
import { styled } from '@linaria/react';
+import { useContext } from 'react';
import { t } from '@lingui/core/macro';
import {
ColorSample,
@@ -23,9 +23,9 @@ import {
MenuItem,
MenuItemSelectColor,
} from 'twenty-ui/navigation';
-import { MAIN_COLOR_NAMES, ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
import { computeOptionValueFromLabel } from '~/pages/settings/data-model/utils/computeOptionValueFromLabel';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
+import { MAIN_COLOR_NAMES } from 'twenty-ui/theme';
const useColorLabels = (): ColorLabels => ({
gray: t`Gray`,
@@ -130,7 +130,9 @@ export const SettingsDataModelFieldSelectFormOptionRow = ({
return (
<StyledRow className={className}>
<StyledIconGripVertical
- style={{ minWidth: theme.icon.size.md }}
+ style={{
+ minWidth: theme.icon.size.md,
+ }}
size={theme.icon.size.md}
stroke={theme.icon.stroke.sm}
color={theme.font.color.extraLight}
diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/forms/select/utils/generateNewSelectOption.ts b/packages/twenty-front/src/modules/settings/data-model/fields/forms/select/utils/generateNewSelectOption.ts
index 4392d725624..c040cdc22ae 100644
--- a/packages/twenty-front/src/modules/settings/data-model/fields/forms/select/utils/generateNewSelectOption.ts
+++ b/packages/twenty-front/src/modules/settings/data-model/fields/forms/select/utils/generateNewSelectOption.ts
@@ -2,7 +2,8 @@ import { v4 } from 'uuid';
import { type FieldMetadataItemOption } from '@/object-metadata/types/FieldMetadataItem';
import { generateNewSelectOptionLabel } from '@/settings/data-model/fields/forms/select/utils/generateNewSelectOptionLabel';
-import { getNextThemeColor } from 'twenty-ui/theme';
+import { MAIN_COLOR_NAMES } from 'twenty-ui/theme';
+import { getNextThemeColor } from 'twenty-ui/theme-constants';
import { computeOptionValueFromLabel } from '~/pages/settings/data-model/utils/computeOptionValueFromLabel';
export const generateNewSelectOption = (
@@ -11,7 +12,10 @@ export const generateNewSelectOption = (
): FieldMetadataItemOption => {
const newOptionLabel = label ?? generateNewSelectOptionLabel(options);
return {
- color: getNextThemeColor(options[options.length - 1]?.color),
+ color: getNextThemeColor(
+ MAIN_COLOR_NAMES,
+ options[options.length - 1]?.color,
+ ),
id: v4(),
label: newOptionLabel,
position: options.length,
diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/preview/components/SettingsDataModelFieldPreview.tsx b/packages/twenty-front/src/modules/settings/data-model/fields/preview/components/SettingsDataModelFieldPreview.tsx
index 5a0fc239902..995fbcf9f7d 100644
--- a/packages/twenty-front/src/modules/settings/data-model/fields/preview/components/SettingsDataModelFieldPreview.tsx
+++ b/packages/twenty-front/src/modules/settings/data-model/fields/preview/components/SettingsDataModelFieldPreview.tsx
@@ -12,11 +12,8 @@ import { SettingsDataModelSetFieldValueEffect } from '@/settings/data-model/fiel
import { SettingsDataModelSetLabelIdentifierRecordEffect } from '@/settings/data-model/fields/preview/components/SettingsDataModelSetLabelIdentifierRecordEffect';
import { useFieldPreviewValue } from '@/settings/data-model/fields/preview/hooks/useFieldPreviewValue';
import { useIcons } from 'twenty-ui/display';
-import {
- ICON_SIZES,
- ICON_STROKES,
- themeCssVariables,
-} from 'twenty-ui/theme-constants';
+import { useContext } from 'react';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { FieldMetadataType } from '~/generated-metadata/graphql';
type SettingsDataModelFieldPreviewProps = {
@@ -66,6 +63,7 @@ export const SettingsDataModelFieldPreview = ({
objectNameSingular: objectNameSingular,
});
+ const { theme } = useContext(ThemeContext);
const { getIcon } = useIcons();
const FieldIcon = getIcon(fieldMetadataItem.icon);
@@ -115,7 +113,10 @@ export const SettingsDataModelFieldPreview = ({
<StyledFieldPreview shrink={shrink}>
{!!withFieldLabel && (
<StyledFieldLabel>
- <FieldIcon size={ICON_SIZES.md} stroke={ICON_STROKES.sm} />
+ <FieldIcon
+ size={theme.icon.size.md}
+ stroke={theme.icon.stroke.sm}
+ />
{fieldMetadataItem.label}:
</StyledFieldLabel>
)}
diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/preview/components/SettingsDataModelRelationFieldPreview.tsx b/packages/twenty-front/src/modules/settings/data-model/fields/preview/components/SettingsDataModelRelationFieldPreview.tsx
index dd524207659..44d52ff6ae0 100644
--- a/packages/twenty-front/src/modules/settings/data-model/fields/preview/components/SettingsDataModelRelationFieldPreview.tsx
+++ b/packages/twenty-front/src/modules/settings/data-model/fields/preview/components/SettingsDataModelRelationFieldPreview.tsx
@@ -1,4 +1,3 @@
-import { useContext } from 'react';
import { styled } from '@linaria/react';
import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';
@@ -11,8 +10,8 @@ import { RecordFieldComponentInstanceContext } from '@/object-record/record-fiel
import { SettingsDataModelSetFieldValueEffect } from '@/settings/data-model/fields/preview/components/SettingsDataModelSetFieldValueEffect';
import { useFieldPreviewValue } from '@/settings/data-model/fields/preview/hooks/useFieldPreviewValue';
import { useIcons } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { useContext } from 'react';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { v4 } from 'uuid';
import { FieldMetadataType } from '~/generated-metadata/graphql';
@@ -62,9 +61,7 @@ export const SettingsDataModelRelationFieldPreview = ({
useObjectMetadataItem({
objectNameSingular: relationTargetObjectNameSingular,
});
-
const { theme } = useContext(ThemeContext);
-
const { getIcon } = useIcons();
const FieldIcon = getIcon(fieldMetadataItem.icon);
diff --git a/packages/twenty-front/src/modules/settings/data-model/graph-overview/components/SettingsDataModelOverviewEffect.tsx b/packages/twenty-front/src/modules/settings/data-model/graph-overview/components/SettingsDataModelOverviewEffect.tsx
index 5aef1c2aabc..e83f097a397 100644
--- a/packages/twenty-front/src/modules/settings/data-model/graph-overview/components/SettingsDataModelOverviewEffect.tsx
+++ b/packages/twenty-front/src/modules/settings/data-model/graph-overview/components/SettingsDataModelOverviewEffect.tsx
@@ -1,10 +1,10 @@
import { type Edge, type Node } from '@xyflow/react';
-import { useContext, useEffect } from 'react';
+import { useEffect } from 'react';
import { useFilteredObjectMetadataItems } from '@/object-metadata/hooks/useFilteredObjectMetadataItems';
import { isDefined } from 'twenty-shared/utils';
-import { ThemeContext } from 'twenty-ui/theme';
import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';
+import { themeCssVariables } from 'twenty-ui/theme-constants';
type SettingsDataModelOverviewEffectProps = {
setEdges: (edges: Edge[]) => void;
@@ -15,7 +15,6 @@ export const SettingsDataModelOverviewEffect = ({
setEdges,
setNodes,
}: SettingsDataModelOverviewEffectProps) => {
- const { theme } = useContext(ThemeContext);
const { activeNonSystemObjectMetadataItems: items } =
useFilteredObjectMetadataItems();
@@ -62,7 +61,7 @@ export const SettingsDataModelOverviewEffect = ({
type: 'smoothstep',
style: {
strokeWidth: 1,
- stroke: theme.color.gray,
+ stroke: themeCssVariables.color.gray,
},
markerEnd: 'marker',
markerStart: 'marker',
@@ -102,7 +101,7 @@ export const SettingsDataModelOverviewEffect = ({
};
loadDagreAndLayout();
- }, [items, setEdges, setNodes, theme]);
+ }, [items, setEdges, setNodes]);
return <></>;
};
diff --git a/packages/twenty-front/src/modules/settings/data-model/graph-overview/components/SettingsDataModelOverviewField.tsx b/packages/twenty-front/src/modules/settings/data-model/graph-overview/components/SettingsDataModelOverviewField.tsx
index b53ba6af1dc..bf8baa49268 100644
--- a/packages/twenty-front/src/modules/settings/data-model/graph-overview/components/SettingsDataModelOverviewField.tsx
+++ b/packages/twenty-front/src/modules/settings/data-model/graph-overview/components/SettingsDataModelOverviewField.tsx
@@ -3,10 +3,9 @@ import { Handle, Position } from '@xyflow/react';
import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState';
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';
-import { useContext } from 'react';
import { useIcons } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { useContext } from 'react';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { RelationType } from '~/generated-metadata/graphql';
type ObjectFieldRowProps = {
@@ -27,9 +26,9 @@ const StyledFieldName = styled.div`
`;
export const ObjectFieldRow = ({ field }: ObjectFieldRowProps) => {
+ const { theme } = useContext(ThemeContext);
const objectMetadataItems = useAtomStateValue(objectMetadataItemsState);
const { getIcon } = useIcons();
- const { theme } = useContext(ThemeContext);
const relatedObjectId = field.relation?.targetObjectMetadata.id;
diff --git a/packages/twenty-front/src/modules/settings/data-model/graph-overview/components/SettingsDataModelOverviewFieldWithoutRelation.tsx b/packages/twenty-front/src/modules/settings/data-model/graph-overview/components/SettingsDataModelOverviewFieldWithoutRelation.tsx
index 3a9a002c59c..24193d4a274 100644
--- a/packages/twenty-front/src/modules/settings/data-model/graph-overview/components/SettingsDataModelOverviewFieldWithoutRelation.tsx
+++ b/packages/twenty-front/src/modules/settings/data-model/graph-overview/components/SettingsDataModelOverviewFieldWithoutRelation.tsx
@@ -1,10 +1,9 @@
-import { useContext } from 'react';
import { styled } from '@linaria/react';
import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';
import { useIcons } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { useContext } from 'react';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
type ObjectFieldRowWithoutRelationProps = {
field: FieldMetadataItem;
@@ -26,8 +25,8 @@ const StyledFieldName = styled.div`
export const ObjectFieldRowWithoutRelation = ({
field,
}: ObjectFieldRowWithoutRelationProps) => {
- const { getIcon } = useIcons();
const { theme } = useContext(ThemeContext);
+ const { getIcon } = useIcons();
const Icon = getIcon(field?.icon);
diff --git a/packages/twenty-front/src/modules/settings/data-model/graph-overview/components/SettingsDataModelOverviewObject.tsx b/packages/twenty-front/src/modules/settings/data-model/graph-overview/components/SettingsDataModelOverviewObject.tsx
index 753d09e7394..dbf2289287f 100644
--- a/packages/twenty-front/src/modules/settings/data-model/graph-overview/components/SettingsDataModelOverviewObject.tsx
+++ b/packages/twenty-front/src/modules/settings/data-model/graph-overview/components/SettingsDataModelOverviewObject.tsx
@@ -15,8 +15,7 @@ import { SettingsPath } from 'twenty-shared/types';
import { getSettingsPath } from 'twenty-shared/utils';
import { IconChevronDown, IconChevronUp, useIcons } from 'twenty-ui/display';
import { SettingsItemTypeTag } from '@/settings/components/SettingsItemTypeTag';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
type SettingsDataModelOverviewObjectNode = Node<ObjectMetadataItem, 'object'>;
type SettingsDataModelOverviewObjectProps =
diff --git a/packages/twenty-front/src/modules/settings/data-model/graph-overview/components/SettingsDataModelOverviewRelationMarkers.tsx b/packages/twenty-front/src/modules/settings/data-model/graph-overview/components/SettingsDataModelOverviewRelationMarkers.tsx
index 161b262512f..5e8fe2e643e 100644
--- a/packages/twenty-front/src/modules/settings/data-model/graph-overview/components/SettingsDataModelOverviewRelationMarkers.tsx
+++ b/packages/twenty-front/src/modules/settings/data-model/graph-overview/components/SettingsDataModelOverviewRelationMarkers.tsx
@@ -1,8 +1,8 @@
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
-
+import { ThemeContext } from 'twenty-ui/theme-constants';
export const SettingsDataModelOverviewRelationMarkers = () => {
const { theme } = useContext(ThemeContext);
+
return (
<svg style={{ position: 'absolute', top: 0, left: 0 }}>
<defs>
diff --git a/packages/twenty-front/src/modules/settings/data-model/new-object/components/SettingsAvailableStandardObjectItemTableRow.tsx b/packages/twenty-front/src/modules/settings/data-model/new-object/components/SettingsAvailableStandardObjectItemTableRow.tsx
index f63a445a4d5..1a552357947 100644
--- a/packages/twenty-front/src/modules/settings/data-model/new-object/components/SettingsAvailableStandardObjectItemTableRow.tsx
+++ b/packages/twenty-front/src/modules/settings/data-model/new-object/components/SettingsAvailableStandardObjectItemTableRow.tsx
@@ -1,4 +1,3 @@
-import { useContext } from 'react';
import { styled } from '@linaria/react';
import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
@@ -6,8 +5,8 @@ import { TableCell } from '@/ui/layout/table/components/TableCell';
import { TableRow } from '@/ui/layout/table/components/TableRow';
import { Checkbox } from 'twenty-ui/input';
import { useIcons } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { useContext } from 'react';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
type SettingsAvailableStandardObjectItemTableRowProps = {
isSelected?: boolean;
@@ -42,7 +41,6 @@ export const SettingsAvailableStandardObjectItemTableRow = ({
onClick,
}: SettingsAvailableStandardObjectItemTableRowProps) => {
const { theme } = useContext(ThemeContext);
-
const { getIcon } = useIcons();
const Icon = getIcon(objectItem.icon);
diff --git a/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectFieldDataType.tsx b/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectFieldDataType.tsx
index aa397fca09a..1afee5bf227 100644
--- a/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectFieldDataType.tsx
+++ b/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectFieldDataType.tsx
@@ -1,12 +1,11 @@
-import { useContext } from 'react';
import { styled } from '@linaria/react';
import { Link } from 'react-router-dom';
import { type SettingsFieldType } from '@/settings/data-model/types/SettingsFieldType';
import { getSettingsFieldTypeConfig } from '@/settings/data-model/utils/getSettingsFieldTypeConfig';
import { type IconComponent, IconTwentyStar } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { useContext } from 'react';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
type SettingsObjectFieldDataTypeProps = {
to?: string;
@@ -68,7 +67,6 @@ export const SettingsObjectFieldDataType = ({
onClick,
}: SettingsObjectFieldDataTypeProps) => {
const { theme } = useContext(ThemeContext);
-
const fieldTypeConfig = getSettingsFieldTypeConfig(value);
const Icon: IconComponent =
IconFromProps ?? fieldTypeConfig?.Icon ?? IconTwentyStar;
diff --git a/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectFieldItemTableRow.tsx b/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectFieldItemTableRow.tsx
index 8b817104fba..66db4cf5cb6 100644
--- a/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectFieldItemTableRow.tsx
+++ b/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectFieldItemTableRow.tsx
@@ -24,8 +24,7 @@ import {
} from 'twenty-ui/display';
import { LightIconButton } from 'twenty-ui/input';
import { UndecoratedLink } from 'twenty-ui/navigation';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { RelationType } from '~/generated-metadata/graphql';
import { useNavigateSettings } from '~/hooks/useNavigateSettings';
import { type SettingsObjectDetailTableItem } from '~/pages/settings/data-model/types/SettingsObjectDetailTableItem';
@@ -89,6 +88,7 @@ export const SettingsObjectFieldItemTableRow = ({
mode,
status,
}: SettingsObjectFieldItemTableRowProps) => {
+ const { theme } = useContext(ThemeContext);
const { t } = useLingui();
const { fieldMetadataItem, objectMetadataItem } =
settingsObjectDetailTableItem;
@@ -99,7 +99,6 @@ export const SettingsObjectFieldItemTableRow = ({
const navigate = useNavigateSettings();
- const { theme } = useContext(ThemeContext);
const { getIcon } = useIcons();
const Icon = getIcon(fieldMetadataItem.icon);
@@ -185,7 +184,9 @@ export const SettingsObjectFieldItemTableRow = ({
<StyledNameTableCell>
{!!Icon && (
<Icon
- style={{ minWidth: theme.icon.size.md }}
+ style={{
+ minWidth: theme.icon.size.md,
+ }}
size={theme.icon.size.md}
stroke={theme.icon.stroke.sm}
/>
diff --git a/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectItemTableRow.tsx b/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectItemTableRow.tsx
index 9c97e1f24a0..5d14a976f86 100644
--- a/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectItemTableRow.tsx
+++ b/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectItemTableRow.tsx
@@ -1,4 +1,4 @@
-import { useContext, type ReactNode } from 'react';
+import { type ReactNode, useContext } from 'react';
import { styled } from '@linaria/react';
import { useLingui } from '@lingui/react/macro';
@@ -12,8 +12,7 @@ import {
} from '@/settings/data-model/object-details/components/SettingsObjectItemTableRowStyledComponents';
import { TableCell } from '@/ui/layout/table/components/TableCell';
import { useIcons } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
export type SettingsObjectMetadataItemTableRowProps = {
action: ReactNode;
@@ -57,8 +56,8 @@ export const SettingsObjectMetadataItemTableRow = ({
link,
totalObjectCount,
}: SettingsObjectMetadataItemTableRowProps) => {
- const { t } = useLingui();
const { theme } = useContext(ThemeContext);
+ const { t } = useLingui();
const { getIcon } = useIcons();
const Icon = getIcon(objectMetadataItem.icon);
@@ -68,7 +67,9 @@ export const SettingsObjectMetadataItemTableRow = ({
<StyledNameTableCell>
{!!Icon && (
<Icon
- style={{ minWidth: theme.icon.size.md }}
+ style={{
+ minWidth: theme.icon.size.md,
+ }}
size={theme.icon.size.md}
stroke={theme.icon.stroke.sm}
/>
diff --git a/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectRelationItemTableRow.tsx b/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectRelationItemTableRow.tsx
index eacaee23fc2..67a214e630c 100644
--- a/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectRelationItemTableRow.tsx
+++ b/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectRelationItemTableRow.tsx
@@ -17,8 +17,7 @@ import { FieldMetadataType, SettingsPath } from 'twenty-shared/types';
import { getSettingsPath, isDefined } from 'twenty-shared/utils';
import { IconChevronRight, useIcons } from 'twenty-ui/display';
import { UndecoratedLink } from 'twenty-ui/navigation';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { useNavigateSettings } from '~/hooks/useNavigateSettings';
type SettingsObjectRelationItemTableRowProps = {
@@ -99,9 +98,9 @@ export const SettingsObjectRelationItemTableRow = ({
fieldMetadataItem,
objectMetadataItem,
}: SettingsObjectRelationItemTableRowProps) => {
+ const { theme } = useContext(ThemeContext);
const { t } = useLingui();
const navigate = useNavigateSettings();
- const { theme } = useContext(ThemeContext);
const { getIcon } = useIcons();
const Icon = getIcon(fieldMetadataItem.icon);
@@ -163,7 +162,9 @@ export const SettingsObjectRelationItemTableRow = ({
<StyledNameTableCell>
{!!Icon && (
<Icon
- style={{ minWidth: theme.icon.size.md }}
+ style={{
+ minWidth: theme.icon.size.md,
+ }}
size={theme.icon.size.md}
stroke={theme.icon.stroke.sm}
/>
diff --git a/packages/twenty-front/src/modules/settings/data-model/objects/components/SettingsDataModelObjectSummary.tsx b/packages/twenty-front/src/modules/settings/data-model/objects/components/SettingsDataModelObjectSummary.tsx
index 32416d16a74..0bbd2e2440a 100644
--- a/packages/twenty-front/src/modules/settings/data-model/objects/components/SettingsDataModelObjectSummary.tsx
+++ b/packages/twenty-front/src/modules/settings/data-model/objects/components/SettingsDataModelObjectSummary.tsx
@@ -1,6 +1,6 @@
import { t } from '@lingui/core/macro';
-import { useContext } from 'react';
import { styled } from '@linaria/react';
+import { useContext } from 'react';
import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
import {
@@ -9,8 +9,7 @@ import {
useIcons,
} from 'twenty-ui/display';
import { SettingsItemTypeTag } from '@/settings/components/SettingsItemTypeTag';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
export type SettingsDataModelObjectPreviewProps = {
className?: string;
@@ -103,6 +102,7 @@ const SettingsDataModelObjectPreviewOtherObjects = ({
selected: number;
}) => {
const { theme } = useContext(ThemeContext);
+
return (
<>
<StyledSeparator />
diff --git a/packages/twenty-front/src/modules/settings/data-model/objects/components/SettingsObjectCoverImage.tsx b/packages/twenty-front/src/modules/settings/data-model/objects/components/SettingsObjectCoverImage.tsx
index 964385599f3..b850934d29e 100644
--- a/packages/twenty-front/src/modules/settings/data-model/objects/components/SettingsObjectCoverImage.tsx
+++ b/packages/twenty-front/src/modules/settings/data-model/objects/components/SettingsObjectCoverImage.tsx
@@ -10,9 +10,7 @@ import { Card } from 'twenty-ui/layout';
import DarkCoverImage from '@/settings/data-model/assets/cover-dark.png';
import LightCoverImage from '@/settings/data-model/assets/cover-light.png';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
-
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledCoverImageContainer = styled(Card)`
align-items: center;
background-size: cover;
@@ -29,13 +27,14 @@ const StyledButtonContainer = styled.div`
padding-top: ${themeCssVariables.spacing[5]};
`;
export const SettingsObjectCoverImage = () => {
+ const { colorScheme } = useContext(ThemeContext);
+
const { t } = useLingui();
- const { theme } = useContext(ThemeContext);
return (
<StyledCoverImageContainer
style={{
backgroundImage:
- theme.name === 'light'
+ colorScheme === 'light'
? `url('${LightCoverImage.toString()}')`
: `url('${DarkCoverImage.toString()}')`,
}}
diff --git a/packages/twenty-front/src/modules/settings/data-model/objects/forms/components/SettingsDataModelObjectAboutForm.tsx b/packages/twenty-front/src/modules/settings/data-model/objects/forms/components/SettingsDataModelObjectAboutForm.tsx
index 793f0a3e747..1d86b4d6b2d 100644
--- a/packages/twenty-front/src/modules/settings/data-model/objects/forms/components/SettingsDataModelObjectAboutForm.tsx
+++ b/packages/twenty-front/src/modules/settings/data-model/objects/forms/components/SettingsDataModelObjectAboutForm.tsx
@@ -6,8 +6,8 @@ import { type SettingsDataModelObjectAboutFormValues } from '@/settings/data-mod
import { IconPicker } from '@/ui/input/components/IconPicker';
import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';
import { TextArea } from '@/ui/input/components/TextArea';
-import { useContext } from 'react';
import { styled } from '@linaria/react';
+import { useContext } from 'react';
import { useLingui } from '@lingui/react/macro';
import { plural } from 'pluralize';
import { Controller, useFormContext } from 'react-hook-form';
@@ -22,8 +22,7 @@ import {
} from 'twenty-ui/display';
import { Button } from 'twenty-ui/input';
import { Card } from 'twenty-ui/layout';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { type StringKeyOf } from 'type-fest';
import { useNavigateSettings } from '~/hooks/useNavigateSettings';
import { computeMetadataNameFromLabel } from '~/pages/settings/data-model/utils/computeMetadataNameFromLabel';
@@ -115,10 +114,10 @@ export const SettingsDataModelObjectAboutForm = ({
objectMetadataItem,
conflictingObjectMetadataItem,
}: SettingsDataModelObjectAboutFormProps) => {
+ const { theme } = useContext(ThemeContext);
const { control, watch, setValue } =
useFormContext<SettingsDataModelObjectAboutFormValues>();
const { t } = useLingui();
- const { theme } = useContext(ThemeContext);
const navigateSettings = useNavigateSettings();
const isLabelSyncedWithName = watch('isLabelSyncedWithName');
diff --git a/packages/twenty-front/src/modules/settings/developers/components/SettingsApiKeysFieldItemTableRow.tsx b/packages/twenty-front/src/modules/settings/developers/components/SettingsApiKeysFieldItemTableRow.tsx
index 78ca68de550..a0ca69059ac 100644
--- a/packages/twenty-front/src/modules/settings/developers/components/SettingsApiKeysFieldItemTableRow.tsx
+++ b/packages/twenty-front/src/modules/settings/developers/components/SettingsApiKeysFieldItemTableRow.tsx
@@ -1,4 +1,3 @@
-import { useContext } from 'react';
import { styled } from '@linaria/react';
import {
@@ -8,8 +7,8 @@ import {
import { TableCell } from '@/ui/layout/table/components/TableCell';
import { TableRow } from '@/ui/layout/table/components/TableRow';
import { IconChevronRight } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { MOBILE_VIEWPORT } from 'twenty-ui/theme-constants';
+import { useContext } from 'react';
+import { MOBILE_VIEWPORT, ThemeContext } from 'twenty-ui/theme-constants';
import { type ApiKey } from '~/generated-metadata/graphql';
export const StyledApisFieldTableRow = styled(TableRow)`
diff --git a/packages/twenty-front/src/modules/settings/developers/components/SettingsDevelopersWebhookTableRow.tsx b/packages/twenty-front/src/modules/settings/developers/components/SettingsDevelopersWebhookTableRow.tsx
index a5e638bf027..a6da829f93b 100644
--- a/packages/twenty-front/src/modules/settings/developers/components/SettingsDevelopersWebhookTableRow.tsx
+++ b/packages/twenty-front/src/modules/settings/developers/components/SettingsDevelopersWebhookTableRow.tsx
@@ -2,14 +2,13 @@ import { styled } from '@linaria/react';
import { TableCell } from '@/ui/layout/table/components/TableCell';
import { TableRow } from '@/ui/layout/table/components/TableRow';
-import { useContext } from 'react';
import { getUrlHostnameOrThrow, isValidUrl } from 'twenty-shared/utils';
import {
IconChevronRight,
OverflowingTextWithTooltip,
} from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { useContext } from 'react';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { type Webhook } from '~/generated-metadata/graphql';
export const StyledApisFieldTableRow = styled(TableRow)`
@@ -42,7 +41,6 @@ export const SettingsDevelopersWebhookTableRow = ({
to: string;
}) => {
const { theme } = useContext(ThemeContext);
-
return (
<StyledApisFieldTableRow to={to}>
<StyledUrlTableCell>
diff --git a/packages/twenty-front/src/modules/settings/developers/components/WebhookEntitySelect.tsx b/packages/twenty-front/src/modules/settings/developers/components/WebhookEntitySelect.tsx
index 75ce39c3d94..b2eabb08c26 100644
--- a/packages/twenty-front/src/modules/settings/developers/components/WebhookEntitySelect.tsx
+++ b/packages/twenty-front/src/modules/settings/developers/components/WebhookEntitySelect.tsx
@@ -26,8 +26,7 @@ import {
useIcons,
} from 'twenty-ui/display';
import { MenuItemSelect } from 'twenty-ui/navigation';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const WEBHOOK_ENTITY_DROPDOWN_ID = 'webhook-entity-select';
diff --git a/packages/twenty-front/src/modules/settings/logic-functions/components/SettingsLogicFunctionsFieldItemTableRow.tsx b/packages/twenty-front/src/modules/settings/logic-functions/components/SettingsLogicFunctionsFieldItemTableRow.tsx
index 00ce9ec8d9c..fbe210407cb 100644
--- a/packages/twenty-front/src/modules/settings/logic-functions/components/SettingsLogicFunctionsFieldItemTableRow.tsx
+++ b/packages/twenty-front/src/modules/settings/logic-functions/components/SettingsLogicFunctionsFieldItemTableRow.tsx
@@ -1,11 +1,10 @@
import { styled } from '@linaria/react';
import { type LogicFunction } from '~/generated-metadata/graphql';
import { TableCell } from '@/ui/layout/table/components/TableCell';
-import { useContext } from 'react';
import { IconChevronRight } from 'twenty-ui/display';
import { StyledTableRow } from '@/settings/logic-functions/components/SettingsLogicFunctionsTable';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { useContext } from 'react';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledNameTableCell = styled(TableCell)`
color: ${themeCssVariables.font.color.primary};
diff --git a/packages/twenty-front/src/modules/settings/playground/components/GraphQLPlayground.tsx b/packages/twenty-front/src/modules/settings/playground/components/GraphQLPlayground.tsx
index c3b8b891d17..dc6cae5b2c2 100644
--- a/packages/twenty-front/src/modules/settings/playground/components/GraphQLPlayground.tsx
+++ b/packages/twenty-front/src/modules/settings/playground/components/GraphQLPlayground.tsx
@@ -8,9 +8,8 @@ import { createGraphiQLFetcher } from '@graphiql/toolkit';
import { GraphiQL } from 'graphiql';
import 'graphiql/graphiql.css';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
import { REACT_APP_SERVER_BASE_URL } from '~/config';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
type GraphQLPlaygroundProps = {
onError(): void;
@@ -39,7 +38,7 @@ export const GraphQLPlayground = ({
const playgroundApiKey = useAtomStateValue(playgroundApiKeyState);
const baseUrl = REACT_APP_SERVER_BASE_URL + '/' + schemaToPath[schema];
- const { theme } = useContext(ThemeContext);
+ const { colorScheme } = useContext(ThemeContext);
if (!playgroundApiKey) {
onError();
@@ -57,7 +56,7 @@ export const GraphQLPlayground = ({
return (
<StyledGraphiQLContainer>
<GraphiQL
- forcedTheme={theme.name as 'light' | 'dark'}
+ forcedTheme={colorScheme}
plugins={[explorer]}
fetcher={fetcher}
defaultHeaders={JSON.stringify({
diff --git a/packages/twenty-front/src/modules/settings/playground/components/RestPlayground.tsx b/packages/twenty-front/src/modules/settings/playground/components/RestPlayground.tsx
index 38cfdb720b6..47c1828cd44 100644
--- a/packages/twenty-front/src/modules/settings/playground/components/RestPlayground.tsx
+++ b/packages/twenty-front/src/modules/settings/playground/components/RestPlayground.tsx
@@ -6,9 +6,8 @@ import { styled } from '@linaria/react';
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
import { SettingsPath } from 'twenty-shared/types';
import { getSettingsPath } from 'twenty-shared/utils';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
import { REACT_APP_SERVER_BASE_URL } from '~/config';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledContainer = styled.div`
border: 1px solid ${themeCssVariables.border.color.medium};
@@ -51,7 +50,7 @@ type RestPlaygroundProps = {
};
export const RestPlayground = ({ onError, schema }: RestPlaygroundProps) => {
- const { theme } = useContext(ThemeContext);
+ const { theme, colorScheme } = useContext(ThemeContext);
const playgroundApiKey = useAtomStateValue(playgroundApiKeyState);
if (!playgroundApiKey) {
@@ -85,7 +84,7 @@ export const RestPlayground = ({ onError, schema }: RestPlaygroundProps) => {
},
},
baseServerURL: REACT_APP_SERVER_BASE_URL + '/' + schema,
- forceDarkModeState: theme.name === 'dark' ? 'dark' : 'light',
+ forceDarkModeState: colorScheme === 'dark' ? 'dark' : 'light',
hideClientButton: true,
hideDarkModeToggle: true,
hideModels: schema === 'metadata',
diff --git a/packages/twenty-front/src/modules/settings/playground/components/SettingsPlaygroundCoverImage.tsx b/packages/twenty-front/src/modules/settings/playground/components/SettingsPlaygroundCoverImage.tsx
index 3bd58f66829..f15c3153b06 100644
--- a/packages/twenty-front/src/modules/settings/playground/components/SettingsPlaygroundCoverImage.tsx
+++ b/packages/twenty-front/src/modules/settings/playground/components/SettingsPlaygroundCoverImage.tsx
@@ -4,9 +4,7 @@ import { type ReactNode, useContext } from 'react';
import DarkCoverImage from '@/settings/playground/assets/cover-dark.png';
import LightCoverImage from '@/settings/playground/assets/cover-light.png';
import { Card } from 'twenty-ui/layout';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
-
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledCard = styled(Card)`
align-items: center;
background-size: cover;
@@ -29,9 +27,10 @@ export const StyledSettingsApiPlaygroundCoverImage = ({
children,
className,
}: StyledSettingsApiPlaygroundCoverImageProps) => {
- const { theme } = useContext(ThemeContext);
+ const { colorScheme } = useContext(ThemeContext);
+
const coverImage =
- theme.name === 'light'
+ colorScheme === 'light'
? LightCoverImage.toString()
: DarkCoverImage.toString();
return (
diff --git a/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesTableRow.tsx b/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesTableRow.tsx
index 483857e8fde..bdfa7448b1e 100644
--- a/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesTableRow.tsx
+++ b/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesTableRow.tsx
@@ -14,8 +14,7 @@ import {
TooltipDelay,
useIcons,
} from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { type RoleWithPartialMembers } from '@/settings/roles/types/RoleWithPartialMembers';
@@ -62,7 +61,6 @@ type SettingsRolesTableRowProps = {
export const SettingsRolesTableRow = ({ role }: SettingsRolesTableRowProps) => {
const { theme } = useContext(ThemeContext);
-
const { getIcon } = useIcons();
const Icon = getIcon(role.icon ?? 'IconUser');
diff --git a/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentTableRow.tsx b/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentTableRow.tsx
index 2efb3db12d4..92de3c47b61 100644
--- a/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentTableRow.tsx
+++ b/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentTableRow.tsx
@@ -12,8 +12,7 @@ import {
OverflowingTextWithTooltip,
useIcons,
} from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { type Agent, type ApiKeyForRole } from '~/generated-metadata/graphql';
import { dateLocaleState } from '~/localization/states/dateLocaleState';
import { formatDateString } from '~/utils/string/formatDateString';
@@ -55,10 +54,10 @@ type SettingsRoleAssignmentTableRowProps = {
export const SettingsRoleAssignmentTableRow = ({
roleTarget,
}: SettingsRoleAssignmentTableRowProps) => {
- const { theme } = useContext(ThemeContext);
const currentWorkspaceMembers = useAtomStateValue(
currentWorkspaceMembersState,
);
+ const { theme } = useContext(ThemeContext);
const { getIcon } = useIcons();
const { dateFormat, timeZone } = useContext(UserContext);
const dateLocale = useAtomStateValue(dateLocaleState);
diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/components/SettingsRolePermissionsObjectLevelObjectPicker.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/components/SettingsRolePermissionsObjectLevelObjectPicker.tsx
index 22aa5f51e5b..6b7821f9e2d 100644
--- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/components/SettingsRolePermissionsObjectLevelObjectPicker.tsx
+++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/components/SettingsRolePermissionsObjectLevelObjectPicker.tsx
@@ -10,8 +10,7 @@ import { useSearchParams } from 'react-router-dom';
import { SettingsPath } from 'twenty-shared/types';
import { H2Title, IconSearch, useIcons } from 'twenty-ui/display';
import { Section } from 'twenty-ui/layout';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { useNavigateSettings } from '~/hooks/useNavigateSettings';
const StyledTypeSelectContainer = styled.div`
diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/components/SettingsRolePermissionsObjectLevelTableRow.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/components/SettingsRolePermissionsObjectLevelTableRow.tsx
index 9c79e834444..d96f79fd04b 100644
--- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/components/SettingsRolePermissionsObjectLevelTableRow.tsx
+++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/components/SettingsRolePermissionsObjectLevelTableRow.tsx
@@ -6,13 +6,12 @@ import { SettingsRolePermissionsObjectLevelUpdateFieldsValueForObject } from '@/
import { OBJECT_LEVEL_PERMISSION_TABLE_GRID_AUTO_COLUMNS } from '@/settings/roles/role-permissions/object-level-permissions/constants/ObjectLevelPermissionTableGridAutoColumns';
import { TableCell } from '@/ui/layout/table/components/TableCell';
import { TableRow } from '@/ui/layout/table/components/TableRow';
-import { useContext } from 'react';
import { styled } from '@linaria/react';
import { SettingsPath } from 'twenty-shared/types';
import { getSettingsPath } from 'twenty-shared/utils';
import { OverflowingTextWithTooltip, useIcons } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { useContext } from 'react';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledNameTableCell = styled(TableCell)`
color: ${themeCssVariables.font.color.primary};
@@ -43,8 +42,8 @@ export const SettingsRolePermissionsObjectLevelTableRow = ({
isEditable = true,
fromAgentId,
}: SettingsRolePermissionsObjectLevelTableRowProps) => {
- const { getIcon } = useIcons();
const { theme } = useContext(ThemeContext);
+ const { getIcon } = useIcons();
const Icon = getIcon(objectMetadataItem.icon);
@@ -66,7 +65,9 @@ export const SettingsRolePermissionsObjectLevelTableRow = ({
<StyledNameTableCell>
{!!Icon && (
<Icon
- style={{ minWidth: theme.icon.size.md }}
+ style={{
+ minWidth: theme.icon.size.md,
+ }}
size={theme.icon.size.md}
stroke={theme.icon.stroke.sm}
/>
diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/field-permissions/components/SettingsRolePermissionsObjectLevelObjectFieldPermissionTableRow.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/field-permissions/components/SettingsRolePermissionsObjectLevelObjectFieldPermissionTableRow.tsx
index 8f23780997e..c5a9253b8a1 100644
--- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/field-permissions/components/SettingsRolePermissionsObjectLevelObjectFieldPermissionTableRow.tsx
+++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/field-permissions/components/SettingsRolePermissionsObjectLevelObjectFieldPermissionTableRow.tsx
@@ -13,8 +13,7 @@ import { styled } from '@linaria/react';
import { useContext, useMemo } from 'react';
import { isDefined } from 'twenty-shared/utils';
import { useIcons } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { v4 } from 'uuid';
import {
type FieldPermission,
@@ -161,7 +160,9 @@ export const SettingsRolePermissionsObjectLevelObjectFieldPermissionTableRow =
<StyledNameTableCell>
{!!Icon && (
<Icon
- style={{ minWidth: theme.icon.size.md }}
+ style={{
+ minWidth: theme.icon.size.md,
+ }}
size={theme.icon.size.md}
stroke={theme.icon.stroke.sm}
/>
diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/object-form/components/OverridableCheckbox.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/object-form/components/OverridableCheckbox.tsx
index 943417e073a..2ff2197cdc4 100644
--- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/object-form/components/OverridableCheckbox.tsx
+++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/object-form/components/OverridableCheckbox.tsx
@@ -1,9 +1,8 @@
-import { useContext } from 'react';
import { styled } from '@linaria/react';
+import { useContext } from 'react';
import { IconReload, IconX } from 'twenty-ui/display';
import { Checkbox } from 'twenty-ui/input';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { AnimatedRotate } from 'twenty-ui/utilities';
export type OverridableCheckboxType = 'default' | 'override' | 'no_cta';
diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionValueInput.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionValueInput.tsx
index 9956202c04f..3bbe76d5b57 100644
--- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionValueInput.tsx
+++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionValueInput.tsx
@@ -24,8 +24,7 @@ import { currentRecordFiltersComponentState } from '@/object-record/record-filte
import { type CompositeFieldType } from '@/settings/data-model/types/CompositeFieldType';
import { createRecordLevelPermissionVariablePicker } from '@/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionVariablePicker';
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledContainer = styled.div`
align-items: stretch;
@@ -99,7 +98,6 @@ export const SettingsRolePermissionsObjectLevelRecordLevelPermissionValueInput =
recordFilterId,
}: SettingsRolePermissionsObjectLevelRecordLevelPermissionValueInputProps) => {
const { theme } = useContext(ThemeContext);
-
const { objectMetadataItem } = useContext(AdvancedFilterContext);
const currentRecordFilters = useAtomComponentStateValue(
diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionVariablePicker.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionVariablePicker.tsx
index 8f078d09e24..24060e2203c 100644
--- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionVariablePicker.tsx
+++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionVariablePicker.tsx
@@ -1,10 +1,9 @@
/* @license Enterprise */
-import { useContext } from 'react';
import { styled } from '@linaria/react';
import { IconVariablePlus } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { useContext } from 'react';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { type VariablePickerComponent } from '@/object-record/record-field/ui/form-types/types/VariablePickerComponent';
import { SettingsRolePermissionsObjectLevelRecordLevelPermissionMeValueSelect } from '@/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionMeValueSelect';
diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/objects-permissions/components/PermissionIcon.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/objects-permissions/components/PermissionIcon.tsx
index 2c7d3e0ec90..07a9f4d2fef 100644
--- a/packages/twenty-front/src/modules/settings/roles/role-permissions/objects-permissions/components/PermissionIcon.tsx
+++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/objects-permissions/components/PermissionIcon.tsx
@@ -2,10 +2,9 @@ import {
SETTINGS_ROLE_OBJECT_PERMISSION_ICON_CONFIG,
type SettingsRoleObjectPermissionKey,
} from '@/settings/roles/role-permissions/objects-permissions/constants/SettingsRoleObjectPermissionIconConfig';
-import { useContext } from 'react';
import { styled } from '@linaria/react';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { useContext } from 'react';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
type PermissionIconProps = {
permission: SettingsRoleObjectPermissionKey;
@@ -39,11 +38,10 @@ const StyledIcon = styled.div<{ isRevoked?: boolean }>`
`;
export const PermissionIcon = ({ permission, state }: PermissionIconProps) => {
- const { theme } = useContext(ThemeContext);
-
const { Icon, IconForbidden } =
SETTINGS_ROLE_OBJECT_PERMISSION_ICON_CONFIG[permission];
+ const { theme } = useContext(ThemeContext);
const isRevoked = state === 'revoked';
return (
diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsTableRow.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsTableRow.tsx
index 63d07a82e0f..3a929d46073 100644
--- a/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsTableRow.tsx
+++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsTableRow.tsx
@@ -4,11 +4,10 @@ import { TableCell } from '@/ui/layout/table/components/TableCell';
import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue';
import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState';
import { TableRow } from '@/ui/layout/table/components/TableRow';
-import { useContext } from 'react';
import { styled } from '@linaria/react';
import { Checkbox } from 'twenty-ui/input';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { useContext } from 'react';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { v4 } from 'uuid';
const StyledTableRow = styled(TableRow)<{ isDisabled: boolean }>`
diff --git a/packages/twenty-front/src/modules/settings/roles/role-settings/components/SettingsRoleApplicability.tsx b/packages/twenty-front/src/modules/settings/roles/role-settings/components/SettingsRoleApplicability.tsx
index 2d2ecdb6361..a2078f3f802 100644
--- a/packages/twenty-front/src/modules/settings/roles/role-settings/components/SettingsRoleApplicability.tsx
+++ b/packages/twenty-front/src/modules/settings/roles/role-settings/components/SettingsRoleApplicability.tsx
@@ -1,13 +1,12 @@
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
-import { useContext } from 'react';
import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
import { H2Title, IconKey, IconRobot, IconUsers } from 'twenty-ui/display';
import { Checkbox } from 'twenty-ui/input';
import { Section } from 'twenty-ui/layout';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { useContext } from 'react';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { FeatureFlagKey } from '~/generated-metadata/graphql';
const StyledCheckboxContainer = styled.div<{ disabled: boolean }>`
@@ -52,7 +51,6 @@ export const SettingsRoleApplicability = ({
isEditable,
}: SettingsRoleApplicabilityProps) => {
const { theme } = useContext(ThemeContext);
-
const isAiEnabled = useIsFeatureEnabled(FeatureFlagKey.IS_AI_ENABLED);
const options = [
diff --git a/packages/twenty-front/src/modules/settings/security/components/SSO/SettingsSSOSAMLForm.tsx b/packages/twenty-front/src/modules/settings/security/components/SSO/SettingsSSOSAMLForm.tsx
index 16ee4891f47..6fbf0dc9e5c 100644
--- a/packages/twenty-front/src/modules/settings/security/components/SSO/SettingsSSOSAMLForm.tsx
+++ b/packages/twenty-front/src/modules/settings/security/components/SSO/SettingsSSOSAMLForm.tsx
@@ -3,7 +3,7 @@
import { parseSAMLMetadataFromXMLFile } from '@/settings/security/utils/parseSAMLMetadataFromXMLFile';
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';
-import { useContext, type ChangeEvent, useRef } from 'react';
+import { type ChangeEvent, useContext, useRef } from 'react';
import { styled } from '@linaria/react';
import { useLingui } from '@lingui/react/macro';
import { useFormContext } from 'react-hook-form';
@@ -18,8 +18,7 @@ import {
} from 'twenty-ui/display';
import { Button } from 'twenty-ui/input';
import { Section } from 'twenty-ui/layout';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { REACT_APP_SERVER_BASE_URL } from '~/config';
import { useCopyToClipboard } from '~/hooks/useCopyToClipboard';
@@ -57,8 +56,8 @@ const StyledButtonCopy = styled.div`
`;
export const SettingsSSOSAMLForm = () => {
- const { enqueueErrorSnackBar } = useSnackBar();
const { theme } = useContext(ThemeContext);
+ const { enqueueErrorSnackBar } = useSnackBar();
const { setValue, getValues, watch, trigger } = useFormContext();
const { t } = useLingui();
const { copyToClipboard } = useCopyToClipboard();
diff --git a/packages/twenty-front/src/modules/spreadsheet-import/components/SpreadsheetImportTable.tsx b/packages/twenty-front/src/modules/spreadsheet-import/components/SpreadsheetImportTable.tsx
index 34c8f9be99d..802aaca35fa 100644
--- a/packages/twenty-front/src/modules/spreadsheet-import/components/SpreadsheetImportTable.tsx
+++ b/packages/twenty-front/src/modules/spreadsheet-import/components/SpreadsheetImportTable.tsx
@@ -2,10 +2,8 @@ import { styled } from '@linaria/react';
import { useContext } from 'react';
// @ts-expect-error // Todo: remove usage of react-data-grid
import DataGrid, { type DataGridProps } from 'react-data-grid';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
-
import { useSpreadsheetImportInternal } from '@/spreadsheet-import/hooks/useSpreadsheetImportInternal';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledDataGrid = styled(DataGrid)`
--rdg-background-color: ${themeCssVariables.background.primary};
@@ -132,9 +130,10 @@ export const SpreadsheetImportTable = <Data,>({
onSelectedRowsChange,
selectedRows,
}: SpreadsheetImportTableProps<Data>) => {
+ const { colorScheme } = useContext(ThemeContext);
+
const { rtl } = useSpreadsheetImportInternal();
- const { theme } = useContext(ThemeContext);
- const themeClassName = theme.name === 'dark' ? 'rdg-dark' : 'rdg-light';
+ const themeClassName = colorScheme === 'dark' ? 'rdg-dark' : 'rdg-light';
if (!rows?.length || !columns?.length) return null;
diff --git a/packages/twenty-front/src/modules/spreadsheet-import/provider/components/SpreadsheetImportProvider.tsx b/packages/twenty-front/src/modules/spreadsheet-import/provider/components/SpreadsheetImportProvider.tsx
index a6221468a90..7566196ed4b 100644
--- a/packages/twenty-front/src/modules/spreadsheet-import/provider/components/SpreadsheetImportProvider.tsx
+++ b/packages/twenty-front/src/modules/spreadsheet-import/provider/components/SpreadsheetImportProvider.tsx
@@ -1,6 +1,6 @@
import React, { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
+import { ThemeContext } from 'twenty-ui/theme-constants';
import { SKELETON_LOADER_HEIGHT_SIZES } from '@/activities/components/SkeletonLoader';
import { SPREADSHEET_IMPORT_MODAL_ID } from '@/spreadsheet-import/constants/SpreadsheetImportModalId';
@@ -18,7 +18,6 @@ const SpreadsheetImport = React.lazy(() =>
const LoadingSkeleton = () => {
const { theme } = useContext(ThemeContext);
-
return (
<SkeletonTheme
baseColor={theme.background.tertiary}
diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/components/SubMatchingSelectDropdownButton.tsx b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/components/SubMatchingSelectDropdownButton.tsx
index 69e0a8b0d77..748ee5ce0f5 100644
--- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/components/SubMatchingSelectDropdownButton.tsx
+++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/components/SubMatchingSelectDropdownButton.tsx
@@ -9,8 +9,7 @@ import { type SpreadsheetMatchedOptions } from '@/spreadsheet-import/types/Sprea
import { getFieldOptions } from '@/spreadsheet-import/utils/getFieldOptions';
import { styled } from '@linaria/react';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { Tag, type TagColor } from 'twenty-ui/components';
import { IconChevronDown } from 'twenty-ui/display';
import { type SelectOption } from 'twenty-ui/input';
@@ -31,12 +30,10 @@ export const SubMatchingSelectDropdownButton = ({
column,
placeholder,
}: SubMatchingSelectDropdownButtonProps) => {
+ const { theme } = useContext(ThemeContext);
const { spreadsheetImportFields: fields } = useSpreadsheetImportInternal();
const options = getFieldOptions(fields, column.value) as SelectOption[];
const value = options.find((opt) => opt.value === option.value);
-
- const { theme } = useContext(ThemeContext);
-
return (
<SubMatchingSelectControlContainer cursor="pointer" id="control">
<Tag
diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/components/UnmatchColumnBanner.tsx b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/components/UnmatchColumnBanner.tsx
index 1525deb9c51..72b362899ad 100644
--- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/components/UnmatchColumnBanner.tsx
+++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/components/UnmatchColumnBanner.tsx
@@ -1,9 +1,8 @@
import { styled } from '@linaria/react';
-import { useContext } from 'react';
import { isDefined } from 'twenty-shared/utils';
import { Banner, IconChevronDown, IconInfoCircle } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { useContext } from 'react';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledBanner = styled(Banner)<{ allMatched: boolean }>`
background: ${({ allMatched }) =>
diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/SpreadsheetImportStepper.tsx b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/SpreadsheetImportStepper.tsx
index 3cf1083d638..0681e620767 100644
--- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/SpreadsheetImportStepper.tsx
+++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/SpreadsheetImportStepper.tsx
@@ -1,6 +1,4 @@
import { useCallback, useContext, useState } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
-
import { useSpreadsheetImportInternal } from '@/spreadsheet-import/hooks/useSpreadsheetImportInternal';
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
import { ModalContent } from 'twenty-ui/layout';
@@ -14,6 +12,7 @@ import { SelectHeaderStep } from './SelectHeaderStep/SelectHeaderStep';
import { SelectSheetStep } from './SelectSheetStep/SelectSheetStep';
import { UploadStep } from './UploadStep/UploadStep';
import { ValidationStep } from './ValidationStep/ValidationStep';
+import { ThemeContext } from 'twenty-ui/theme-constants';
type SpreadsheetImportStepperProps = {
nextStep: () => void;
@@ -25,7 +24,6 @@ export const SpreadsheetImportStepper = ({
prevStep,
}: SpreadsheetImportStepperProps) => {
const { theme } = useContext(ThemeContext);
-
const { initialStepState } = useSpreadsheetImportInternal();
const [currentStepState, setCurrentStepState] =
diff --git a/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/components/SnackBar.tsx b/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/components/SnackBar.tsx
index 419c379142e..f6035311d9d 100644
--- a/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/components/SnackBar.tsx
+++ b/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/components/SnackBar.tsx
@@ -19,8 +19,11 @@ import {
} from 'twenty-ui/display';
import { ProgressBar, useProgressAnimation } from 'twenty-ui/feedback';
import { LightButton, LightIconButton } from 'twenty-ui/input';
-import { ThemeContext } from 'twenty-ui/theme';
-import { MOBILE_VIEWPORT, themeCssVariables } from 'twenty-ui/theme-constants';
+import {
+ MOBILE_VIEWPORT,
+ ThemeContext,
+ themeCssVariables,
+} from 'twenty-ui/theme-constants';
export enum SnackBarVariant {
Default = 'default',
@@ -154,8 +157,8 @@ export const SnackBar = ({
role = 'status',
variant = SnackBarVariant.Default,
}: SnackBarProps) => {
- const { theme } = useContext(ThemeContext);
const { i18n, t } = useLingui();
+ const { theme } = useContext(ThemeContext);
const { animation: progressAnimation, value: progressValue } =
useProgressAnimation({
autoPlay: isUndefined(overrideProgressValue),
@@ -197,7 +200,7 @@ export const SnackBar = ({
<IconAlertTriangle {...{ 'aria-label': ariaLabel, color, size }} />
);
}
- }, [iconComponent, theme.icon.size.md, theme.snackBar, variant, i18n]);
+ }, [iconComponent, variant, i18n, theme.icon.size.md, theme.snackBar]);
const handleMouseEnter = () => {
if (progressAnimation?.state === 'running') {
diff --git a/packages/twenty-front/src/modules/ui/field/display/components/CurrencyDisplay.tsx b/packages/twenty-front/src/modules/ui/field/display/components/CurrencyDisplay.tsx
index 019a1980a98..d953aff34e2 100644
--- a/packages/twenty-front/src/modules/ui/field/display/components/CurrencyDisplay.tsx
+++ b/packages/twenty-front/src/modules/ui/field/display/components/CurrencyDisplay.tsx
@@ -13,7 +13,7 @@ import { EllipsisDisplay } from '@/ui/field/display/components/EllipsisDisplay';
import { isDefined, formatToShortNumber } from 'twenty-shared/utils';
import { DEFAULT_DECIMAL_VALUE } from '~/utils/format/formatNumber';
import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
type CurrencyDisplayProps = {
currencyValue: FieldCurrencyValue | null | undefined;
diff --git a/packages/twenty-front/src/modules/ui/field/display/components/UploadFileChip.tsx b/packages/twenty-front/src/modules/ui/field/display/components/UploadFileChip.tsx
index 04a039862f5..2a4f9320567 100644
--- a/packages/twenty-front/src/modules/ui/field/display/components/UploadFileChip.tsx
+++ b/packages/twenty-front/src/modules/ui/field/display/components/UploadFileChip.tsx
@@ -1,9 +1,8 @@
import { styled } from '@linaria/react';
+import { useContext } from 'react';
import { IconArrowUp } from 'twenty-ui/display';
import { Loader } from 'twenty-ui/feedback';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
-import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledContainer = styled.div`
align-items: center;
diff --git a/packages/twenty-front/src/modules/ui/field/input/components/CurrencyInput.tsx b/packages/twenty-front/src/modules/ui/field/input/components/CurrencyInput.tsx
index f905f9984fe..000e09cdd7c 100644
--- a/packages/twenty-front/src/modules/ui/field/input/components/CurrencyInput.tsx
+++ b/packages/twenty-front/src/modules/ui/field/input/components/CurrencyInput.tsx
@@ -7,8 +7,7 @@ import { CurrencyPickerDropdownButton } from '@/ui/input/components/internal/cur
import { type Currency } from '@/ui/input/components/internal/types/Currency';
import { IMaskInput } from 'react-imask';
import { type IconComponent } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
export const StyledIMaskInput = styled(IMaskInput)`
margin: 0;
@@ -82,7 +81,6 @@ export const CurrencyInput = ({
decimals,
}: CurrencyInputProps) => {
const { theme } = useContext(ThemeContext);
-
const [internalText, setInternalText] = useState(value);
const wrapperRef = useRef<HTMLInputElement>(null);
diff --git a/packages/twenty-front/src/modules/ui/field/input/components/RatingInput.tsx b/packages/twenty-front/src/modules/ui/field/input/components/RatingInput.tsx
index 696e563c9f2..524a824069a 100644
--- a/packages/twenty-front/src/modules/ui/field/input/components/RatingInput.tsx
+++ b/packages/twenty-front/src/modules/ui/field/input/components/RatingInput.tsx
@@ -6,7 +6,7 @@ import { useClearField } from '@/object-record/record-field/ui/hooks/useClearFie
import { RATING_VALUES } from 'twenty-shared/constants';
import { type FieldRatingValue } from 'twenty-shared/types';
import { IconTwentyStarFilled } from 'twenty-ui/display';
-import { THEME_COMMON, ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledContainer = styled.div`
align-items: center;
@@ -26,18 +26,17 @@ type RatingInputProps = {
readonly?: boolean;
};
-const iconSizeMd = THEME_COMMON.icon.size.md;
-
export const RatingInput = ({
onChange,
value,
readonly,
}: RatingInputProps) => {
- const { theme } = useContext(ThemeContext);
const clearField = useClearField();
+ const { theme } = useContext(ThemeContext);
- const activeColor = theme.font.color.secondary;
- const inactiveColor = theme.background.quaternary;
+ const iconSizeMd = theme.icon.size.md;
+ const activeColor = themeCssVariables.font.color.secondary;
+ const inactiveColor = themeCssVariables.background.quaternary;
const [hoveredValue, setHoveredValue] = useState<FieldRatingValue>(null);
diff --git a/packages/twenty-front/src/modules/ui/input/components/ImageInput.tsx b/packages/twenty-front/src/modules/ui/input/components/ImageInput.tsx
index d0fe1f8e843..c14f8c662ed 100644
--- a/packages/twenty-front/src/modules/ui/input/components/ImageInput.tsx
+++ b/packages/twenty-front/src/modules/ui/input/components/ImageInput.tsx
@@ -7,9 +7,7 @@ import { getImageAbsoluteURI, isDefined } from 'twenty-shared/utils';
import { IconPhotoUp, IconTrash, IconUpload, IconX } from 'twenty-ui/display';
import { Button } from 'twenty-ui/input';
import { REACT_APP_SERVER_BASE_URL } from '~/config';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
-import { ThemeContext } from 'twenty-ui/theme';
-
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledContainer = styled.div`
display: flex;
flex-direction: row;
diff --git a/packages/twenty-front/src/modules/ui/input/components/MultiSelectControl.tsx b/packages/twenty-front/src/modules/ui/input/components/MultiSelectControl.tsx
index ef49c3ed8da..0a3f27f496c 100644
--- a/packages/twenty-front/src/modules/ui/input/components/MultiSelectControl.tsx
+++ b/packages/twenty-front/src/modules/ui/input/components/MultiSelectControl.tsx
@@ -10,8 +10,7 @@ import {
type IconComponent,
OverflowingTextWithTooltip,
} from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledIconChevronDownWrapper = styled.div<{
disabled?: boolean;
@@ -44,7 +43,6 @@ export const MultiSelectControl = ({
hasRightElement,
}: MultiSelectControlProps) => {
const { theme } = useContext(ThemeContext);
-
const firstSelectedOption = selectedOptions?.[0];
return (
<StyledControlContainer
diff --git a/packages/twenty-front/src/modules/ui/input/components/SelectControl.tsx b/packages/twenty-front/src/modules/ui/input/components/SelectControl.tsx
index 3103e66ee6e..1aa0064bf50 100644
--- a/packages/twenty-front/src/modules/ui/input/components/SelectControl.tsx
+++ b/packages/twenty-front/src/modules/ui/input/components/SelectControl.tsx
@@ -1,11 +1,10 @@
import { type SelectSizeVariant } from '@/ui/input/components/Select';
import { styled } from '@linaria/react';
+import { useContext } from 'react';
import { isDefined } from 'twenty-shared/utils';
import { IconChevronDown, OverflowingTextWithTooltip } from 'twenty-ui/display';
import { type SelectOption } from 'twenty-ui/input';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
-import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
export type SelectControlTextAccent = 'default' | 'placeholder';
@@ -79,7 +78,6 @@ export const SelectControl = ({
hasRightElement,
}: SelectControlProps) => {
const { theme } = useContext(ThemeContext);
-
return (
<StyledControlContainer
disabled={isDisabled}
diff --git a/packages/twenty-front/src/modules/ui/input/components/TextInput.tsx b/packages/twenty-front/src/modules/ui/input/components/TextInput.tsx
index 6f8434865e7..3df52306a7d 100644
--- a/packages/twenty-front/src/modules/ui/input/components/TextInput.tsx
+++ b/packages/twenty-front/src/modules/ui/input/components/TextInput.tsx
@@ -16,9 +16,7 @@ import { type IconComponent, IconEye, IconEyeOff } from 'twenty-ui/display';
import { AutogrowWrapper } from 'twenty-ui/utilities';
import { useCombinedRefs } from '~/hooks/useCombinedRefs';
import { turnIntoEmptyStringIfWhitespacesOnly } from '~/utils/string/turnIntoEmptyStringIfWhitespacesOnly';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
-import { ThemeContext } from 'twenty-ui/theme';
-
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledContainer = styled.div<Pick<TextInputComponentProps, 'fullWidth'>>`
box-sizing: border-box;
display: inline-flex;
diff --git a/packages/twenty-front/src/modules/ui/input/components/internal/currency/components/CurrencyPickerDropdownButton.tsx b/packages/twenty-front/src/modules/ui/input/components/internal/currency/components/CurrencyPickerDropdownButton.tsx
index 390e8f981d1..947d1c3fb41 100644
--- a/packages/twenty-front/src/modules/ui/input/components/internal/currency/components/CurrencyPickerDropdownButton.tsx
+++ b/packages/twenty-front/src/modules/ui/input/components/internal/currency/components/CurrencyPickerDropdownButton.tsx
@@ -6,12 +6,10 @@ import { CurrencyCode } from 'twenty-shared/constants';
import { CURRENCIES } from '@/settings/data-model/constants/Currencies';
import { type Currency } from '@/ui/input/components/internal/types/Currency';
import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';
+import { useContext } from 'react';
import { IconChevronDown } from 'twenty-ui/display';
import { CurrencyPickerDropdownSelect } from './CurrencyPickerDropdownSelect';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
-import { useContext } from 'react';
-
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledDropdownButtonContainer = styled.div`
align-items: center;
color: ${({ color }) => color ?? 'none'};
@@ -51,7 +49,6 @@ export const CurrencyPickerDropdownButton = ({
onChange: (currency: Currency) => void;
}) => {
const { theme } = useContext(ThemeContext);
-
const dropdownId = 'currency-picker-dropdown-id';
const { closeDropdown } = useCloseDropdown();
diff --git a/packages/twenty-front/src/modules/ui/input/components/internal/date/components/DatePicker.tsx b/packages/twenty-front/src/modules/ui/input/components/internal/date/components/DatePicker.tsx
index 827354024a1..c877185cf8f 100644
--- a/packages/twenty-front/src/modules/ui/input/components/internal/date/components/DatePicker.tsx
+++ b/packages/twenty-front/src/modules/ui/input/components/internal/date/components/DatePicker.tsx
@@ -1,5 +1,5 @@
import { styled } from '@linaria/react';
-import { Suspense, lazy, type ComponentType, useContext } from 'react';
+import { Suspense, lazy, useContext, type ComponentType } from 'react';
import type { ReactDatePickerProps as ReactDatePickerLibProps } from 'react-datepicker';
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
@@ -26,8 +26,7 @@ import {
} from 'twenty-shared/utils';
import { IconCalendarX } from 'twenty-ui/display';
import { MenuItemLeftContent } from 'twenty-ui/navigation';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
export const MONTH_AND_YEAR_DROPDOWN_MONTH_SELECT_ID =
'date-picker-month-and-year-dropdown-month-select';
@@ -355,14 +354,13 @@ export const DatePicker = ({
onRelativeDateChange,
hideHeaderInput,
}: DatePickerProps) => {
+ const { theme } = useContext(ThemeContext);
const plainDate = isDefined(plainDateString)
? Temporal.PlainDate.from(plainDateString)
: Temporal.Now.plainDateISO();
const { userTimezone } = useUserTimezone();
- const { theme } = useContext(ThemeContext);
-
const { closeDropdown: closeDropdownMonthSelect } = useCloseDropdown();
const { closeDropdown: closeDropdownYearSelect } = useCloseDropdown();
const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState);
diff --git a/packages/twenty-front/src/modules/ui/input/components/internal/date/components/DatePickerWithoutCalendar.tsx b/packages/twenty-front/src/modules/ui/input/components/internal/date/components/DatePickerWithoutCalendar.tsx
index a5dcffa248b..fa13744512d 100644
--- a/packages/twenty-front/src/modules/ui/input/components/internal/date/components/DatePickerWithoutCalendar.tsx
+++ b/packages/twenty-front/src/modules/ui/input/components/internal/date/components/DatePickerWithoutCalendar.tsx
@@ -1,5 +1,5 @@
import { styled } from '@linaria/react';
-import { Suspense, lazy, type ComponentType, useContext } from 'react';
+import { Suspense, lazy, useContext, type ComponentType } from 'react';
import type { ReactDatePickerProps as ReactDatePickerLibProps } from 'react-datepicker';
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
@@ -16,8 +16,7 @@ import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomState
import { Temporal } from 'temporal-polyfill';
import { type Nullable } from 'twenty-shared/types';
import { isDefined, turnJSDateToPlainDate } from 'twenty-shared/utils';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
export const MONTH_AND_YEAR_DROPDOWN_MONTH_SELECT_ID =
'date-picker-month-and-year-dropdown-month-select';
@@ -323,9 +322,8 @@ export const DatePickerWithoutCalendar = ({
onChange,
onClose,
}: DatePickerWithoutCalendarProps) => {
- const plainDate = isDefined(date) ? Temporal.PlainDate.from(date) : null;
-
const { theme } = useContext(ThemeContext);
+ const plainDate = isDefined(date) ? Temporal.PlainDate.from(date) : null;
const { closeDropdown: closeDropdownMonthSelect } = useCloseDropdown();
const { closeDropdown: closeDropdownYearSelect } = useCloseDropdown();
diff --git a/packages/twenty-front/src/modules/ui/input/components/internal/date/components/DateTimePicker.tsx b/packages/twenty-front/src/modules/ui/input/components/internal/date/components/DateTimePicker.tsx
index 975359160bf..c756284d546 100644
--- a/packages/twenty-front/src/modules/ui/input/components/internal/date/components/DateTimePicker.tsx
+++ b/packages/twenty-front/src/modules/ui/input/components/internal/date/components/DateTimePicker.tsx
@@ -11,7 +11,7 @@ import { getHighlightedDates } from '@/ui/input/components/internal/date/utils/g
import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';
import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
-import { Suspense, lazy, type ComponentType, useContext } from 'react';
+import { Suspense, lazy, useContext, type ComponentType } from 'react';
import type { ReactDatePickerProps as ReactDatePickerLibProps } from 'react-datepicker';
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
@@ -24,9 +24,7 @@ import { useGetShiftedDateToSystemTimeZone } from '@/ui/input/components/interna
import { useUserFirstDayOfTheWeek } from '@/ui/input/components/internal/date/hooks/useUserFirstDayOfTheWeek';
import { useUserTimezone } from '@/ui/input/components/internal/date/hooks/useUserTimezone';
import { Temporal } from 'temporal-polyfill';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
-import { ThemeContext } from 'twenty-ui/theme';
-
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
export const MONTH_AND_YEAR_DROPDOWN_MONTH_SELECT_ID =
'date-picker-month-and-year-dropdown-month-select';
export const MONTH_AND_YEAR_DROPDOWN_YEAR_SELECT_ID =
@@ -356,7 +354,6 @@ export const DateTimePicker = ({
timeZone,
}: DateTimePickerProps) => {
const { theme } = useContext(ThemeContext);
-
const { userFirstDayOfTheWeek } = useUserFirstDayOfTheWeek();
const { userTimezone } = useUserTimezone();
diff --git a/packages/twenty-front/src/modules/ui/input/components/internal/phone/components/PhoneCountryPickerDropdownButton.tsx b/packages/twenty-front/src/modules/ui/input/components/internal/phone/components/PhoneCountryPickerDropdownButton.tsx
index 0113e501cd0..034351a7860 100644
--- a/packages/twenty-front/src/modules/ui/input/components/internal/phone/components/PhoneCountryPickerDropdownButton.tsx
+++ b/packages/twenty-front/src/modules/ui/input/components/internal/phone/components/PhoneCountryPickerDropdownButton.tsx
@@ -13,8 +13,7 @@ import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/use
import 'react-phone-number-input/style.css';
import { isDefined } from 'twenty-shared/utils';
import { IconChevronDown, IconWorld } from 'twenty-ui/display';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
type StyledDropdownButtonProps = {
isUnfolded: boolean;
@@ -75,8 +74,6 @@ export const PhoneCountryPickerDropdownButton = ({
value: string;
onChange: (countryCode: string) => void;
}) => {
- const { theme } = useContext(ThemeContext);
-
const [selectedCountry, setSelectedCountry] = useState<Country>();
const isDropdownOpen = useAtomComponentStateValue(
@@ -92,6 +89,7 @@ export const PhoneCountryPickerDropdownButton = ({
};
const countries = useCountries();
+ const { theme } = useContext(ThemeContext);
useEffect(() => {
const country = countries.find(({ countryCode }) => countryCode === value);
diff --git a/packages/twenty-front/src/modules/ui/input/relation-picker/components/skeletons/DropdownMenuSkeletonItem.tsx b/packages/twenty-front/src/modules/ui/input/relation-picker/components/skeletons/DropdownMenuSkeletonItem.tsx
index 0a20c86462e..1627eea4168 100644
--- a/packages/twenty-front/src/modules/ui/input/relation-picker/components/skeletons/DropdownMenuSkeletonItem.tsx
+++ b/packages/twenty-front/src/modules/ui/input/relation-picker/components/skeletons/DropdownMenuSkeletonItem.tsx
@@ -1,11 +1,9 @@
import { SKELETON_LOADER_HEIGHT_SIZES } from '@/activities/components/SkeletonLoader';
import { type CSSWidth } from '@/ui/types/CSSWidth';
import { styled } from '@linaria/react';
-import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
-
+import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledDropdownMenuSkeletonContainer = styled.div`
--horizontal-padding: ${themeCssVariables.spacing[1]};
--vertical-padding: ${themeCssVariables.spacing[2]};
diff --git a/packages/twenty-front/src/modules/ui/layout/draggable-list/components/DraggableItem.tsx b/packages/twenty-front/src/modules/ui/layout/draggable-list/components/DraggableItem.tsx
index 173ae2877f3..fab1d9a3817 100644
--- a/packages/twenty-front/src/modules/ui/layout/draggable-list/components/DraggableItem.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/draggable-list/components/DraggableItem.tsx
@@ -1,8 +1,8 @@
import { Draggable } from '@hello-pangea/dnd';
import { isFunction } from '@sniptt/guards';
-import { isDefined } from 'twenty-shared/utils';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
+import { isDefined } from 'twenty-shared/utils';
+import { ThemeContext } from 'twenty-ui/theme-constants';
type DraggableItemProps = {
draggableId: string;
@@ -30,7 +30,6 @@ export const DraggableItem = ({
containerOffsetY,
}: DraggableItemProps) => {
const { theme } = useContext(ThemeContext);
-
return (
<Draggable
key={draggableId}
diff --git a/packages/twenty-front/src/modules/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent.tsx b/packages/twenty-front/src/modules/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent.tsx
index cedd940ba43..2bf581a313f 100644
--- a/packages/twenty-front/src/modules/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent.tsx
@@ -6,8 +6,7 @@ import {
type IconComponent,
} from 'twenty-ui/display';
import { LightIconButton } from 'twenty-ui/input';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledNonClickableStartIcon = styled.div`
align-items: center;
@@ -42,7 +41,6 @@ export const DropdownMenuHeaderLeftComponent = ({
| Record<never, never>
)) => {
const { theme } = useContext(ThemeContext);
-
return (
<>
{'Icon' in props &&
diff --git a/packages/twenty-front/src/modules/ui/layout/dropdown/components/DropdownMenuInnerSelect.tsx b/packages/twenty-front/src/modules/ui/layout/dropdown/components/DropdownMenuInnerSelect.tsx
index 374ed2805be..dfc9526ed86 100644
--- a/packages/twenty-front/src/modules/ui/layout/dropdown/components/DropdownMenuInnerSelect.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/dropdown/components/DropdownMenuInnerSelect.tsx
@@ -4,12 +4,11 @@ import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/Drop
import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';
import { styled } from '@linaria/react';
+import { useContext } from 'react';
import { IconChevronDown } from 'twenty-ui/display';
import { type SelectOption } from 'twenty-ui/input';
import { MenuItemSelect } from 'twenty-ui/navigation';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
-import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledDropdownMenuInnerSelectDropdownButton = styled.div`
align-items: center;
@@ -46,7 +45,6 @@ export const DropdownMenuInnerSelect = ({
widthInPixels,
}: DropdownMenuInnerSelectProps) => {
const { theme } = useContext(ThemeContext);
-
const { closeDropdown } = useCloseDropdown();
return (
diff --git a/packages/twenty-front/src/modules/ui/layout/expandable-list/components/__stories__/ExpandableList.stories.tsx b/packages/twenty-front/src/modules/ui/layout/expandable-list/components/__stories__/ExpandableList.stories.tsx
index 9d66b8765db..1be1e90d05a 100644
--- a/packages/twenty-front/src/modules/ui/layout/expandable-list/components/__stories__/ExpandableList.stories.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/expandable-list/components/__stories__/ExpandableList.stories.tsx
@@ -6,9 +6,8 @@ import { ExpandableList } from '@/ui/layout/expandable-list/components/Expandabl
import { isDefined } from 'twenty-shared/utils';
import { Tag } from 'twenty-ui/components';
import { ComponentDecorator } from 'twenty-ui/testing';
-import { MAIN_COLOR_NAMES } from 'twenty-ui/theme';
import { themeCssVariables } from 'twenty-ui/theme-constants';
-
+import { MAIN_COLOR_NAMES } from 'twenty-ui/theme';
const StyledContainer = styled.div`
padding: ${themeCssVariables.spacing[1]};
width: 300px;
diff --git a/packages/twenty-front/src/modules/ui/layout/page-header/components/PageHeaderToggleCommandMenuButton.tsx b/packages/twenty-front/src/modules/ui/layout/page-header/components/PageHeaderToggleCommandMenuButton.tsx
index d1d00b2a13e..ee6e079cadb 100644
--- a/packages/twenty-front/src/modules/ui/layout/page-header/components/PageHeaderToggleCommandMenuButton.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/page-header/components/PageHeaderToggleCommandMenuButton.tsx
@@ -9,13 +9,11 @@ import { styled } from '@linaria/react';
import { i18n } from '@lingui/core';
import { t } from '@lingui/core/macro';
import { motion } from 'framer-motion';
+import { useContext } from 'react';
import { AppTooltip, TooltipDelay, TooltipPosition } from 'twenty-ui/display';
import { AnimatedButton } from 'twenty-ui/input';
import { getOsControlSymbol, useIsMobile } from 'twenty-ui/utilities';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
-import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
-
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledButtonWrapper = styled.div<{ alignToTop: boolean }>`
align-items: ${({ alignToTop }) => (alignToTop ? 'center' : 'initial')};
display: ${({ alignToTop }) => (alignToTop ? 'flex' : 'block')};
@@ -45,6 +43,7 @@ const AnimatedIcon = ({
isCommandMenuOpened: boolean;
}) => {
const { theme } = useContext(ThemeContext);
+
return (
<svg
xmlns="http://www.w3.org/2000/svg"
@@ -68,7 +67,9 @@ const AnimatedIcon = ({
scale: isCommandMenuOpened ? 0 : 1,
opacity: isCommandMenuOpened ? 0 : 1,
}}
- transition={{ duration: theme.animation.duration.fast }}
+ transition={{
+ duration: theme.animation.duration.fast,
+ }}
/>
{/* X lines expanding from center */}
@@ -99,7 +100,9 @@ const AnimatedIcon = ({
scale: isCommandMenuOpened ? 0 : 1,
opacity: isCommandMenuOpened ? 0 : 1,
}}
- transition={{ duration: theme.animation.duration.fast }}
+ transition={{
+ duration: theme.animation.duration.fast,
+ }}
/>
{/* Bottom dot */}
@@ -112,13 +115,16 @@ const AnimatedIcon = ({
scale: isCommandMenuOpened ? 0 : 1,
opacity: isCommandMenuOpened ? 0 : 1,
}}
- transition={{ duration: theme.animation.duration.fast }}
+ transition={{
+ duration: theme.animation.duration.fast,
+ }}
/>
</svg>
);
};
export const PageHeaderToggleCommandMenuButton = () => {
+ const { theme } = useContext(ThemeContext);
const { toggleCommandMenu } = useCommandMenu();
const isCommandMenuOpened = useAtomStateValue(isCommandMenuOpenedState);
const isNavigationMenuInEditMode = useAtomStateValue(
@@ -133,9 +139,6 @@ export const PageHeaderToggleCommandMenuButton = () => {
const ariaLabel = isCommandMenuOpened
? t`Close command menu`
: t`Open command menu`;
-
- const { theme } = useContext(ThemeContext);
-
return (
<StyledButtonWrapper alignToTop={alignWithCommandMenuTopBar}>
<div id="toggle-command-menu-button">
diff --git a/packages/twenty-front/src/modules/ui/layout/page/components/DefaultLayout.tsx b/packages/twenty-front/src/modules/ui/layout/page/components/DefaultLayout.tsx
index 8a3132ebc18..c61d890c796 100644
--- a/packages/twenty-front/src/modules/ui/layout/page/components/DefaultLayout.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/page/components/DefaultLayout.tsx
@@ -27,9 +27,7 @@ import { styled } from '@linaria/react';
import { AnimatePresence, LayoutGroup, motion } from 'framer-motion';
import { Outlet } from 'react-router-dom';
import { useScreenSize } from 'twenty-ui/utilities';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
-import { ThemeContext } from 'twenty-ui/theme';
-
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledLayout = styled.div`
background: ${themeCssVariables.background.noisy};
display: flex;
@@ -66,10 +64,10 @@ const StyledMainContainer = styled.div`
export const DefaultLayout = () => {
const isMobile = useIsMobile();
const isSettingsPage = useIsSettingsPage();
- const { theme } = useContext(ThemeContext);
const windowsWidth = useScreenSize().width;
const showAuthModal = useShowAuthModal();
const useShowFullScreen = useShowFullscreen();
+ const { theme } = useContext(ThemeContext);
return (
<>
diff --git a/packages/twenty-front/src/modules/ui/layout/page/components/PageHeader.tsx b/packages/twenty-front/src/modules/ui/layout/page/components/PageHeader.tsx
index b6c02cdd511..630f1f86ef2 100644
--- a/packages/twenty-front/src/modules/ui/layout/page/components/PageHeader.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/page/components/PageHeader.tsx
@@ -15,8 +15,11 @@ import {
OverflowingTextWithTooltip,
} from 'twenty-ui/display';
import { LightIconButton } from 'twenty-ui/input';
-import { ThemeContext } from 'twenty-ui/theme';
-import { MOBILE_VIEWPORT, themeCssVariables } from 'twenty-ui/theme-constants';
+import {
+ MOBILE_VIEWPORT,
+ ThemeContext,
+ themeCssVariables,
+} from 'twenty-ui/theme-constants';
const StyledTopBarContainer = styled.div<{ isMobile: boolean }>`
align-items: center;
diff --git a/packages/twenty-front/src/modules/ui/layout/show-page/components/FieldRichTextCard.tsx b/packages/twenty-front/src/modules/ui/layout/show-page/components/FieldRichTextCard.tsx
index 308561f38af..71e96072900 100644
--- a/packages/twenty-front/src/modules/ui/layout/show-page/components/FieldRichTextCard.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/show-page/components/FieldRichTextCard.tsx
@@ -8,8 +8,7 @@ import { lazy, Suspense, useContext } from 'react';
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue';
import { isDefined } from 'twenty-shared/utils';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const ActivityRichTextEditor = lazy(() =>
import('@/activities/components/ActivityRichTextEditor').then((module) => ({
@@ -33,7 +32,6 @@ const StyledSkeletonContainer = styled.div`
const LoadingSkeleton = () => {
const { theme } = useContext(ThemeContext);
-
return (
<StyledSkeletonContainer>
<SkeletonTheme
diff --git a/packages/twenty-front/src/modules/ui/layout/show-page/components/ShowPageSummaryCard.tsx b/packages/twenty-front/src/modules/ui/layout/show-page/components/ShowPageSummaryCard.tsx
index aeaf765e7ba..6e2b85bde1c 100644
--- a/packages/twenty-front/src/modules/ui/layout/show-page/components/ShowPageSummaryCard.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/show-page/components/ShowPageSummaryCard.tsx
@@ -11,8 +11,7 @@ import {
type IconComponent,
} from 'twenty-ui/display';
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { v4 as uuidV4 } from 'uuid';
import { dateLocaleState } from '~/localization/states/dateLocaleState';
import {
diff --git a/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabAvatar.tsx b/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabAvatar.tsx
index 864e952c4a0..2cc7ae4207b 100644
--- a/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabAvatar.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabAvatar.tsx
@@ -2,7 +2,7 @@ import { type SingleTabProps } from '@/ui/layout/tab-list/types/SingleTabProps';
import { useContext } from 'react';
import { isDefined } from 'twenty-shared/utils';
import { Avatar } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
export const TabAvatar = ({ tab }: { tab: SingleTabProps }) => {
const { theme } = useContext(ThemeContext);
diff --git a/packages/twenty-front/src/modules/ui/layout/table/components/TableSection.tsx b/packages/twenty-front/src/modules/ui/layout/table/components/TableSection.tsx
index ab78c9e4963..6fb0fda0bf7 100644
--- a/packages/twenty-front/src/modules/ui/layout/table/components/TableSection.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/table/components/TableSection.tsx
@@ -2,8 +2,7 @@ import { styled } from '@linaria/react';
import { type ReactNode, useContext, useState } from 'react';
import { TableBody } from './TableBody';
import { IconChevronDown, IconChevronUp, Label } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
type TableSectionProps = {
children: ReactNode;
@@ -41,8 +40,8 @@ export const TableSection = ({
isInitiallyExpanded = true,
title,
}: TableSectionProps) => {
- const [isExpanded, setIsExpanded] = useState(isInitiallyExpanded);
const { theme } = useContext(ThemeContext);
+ const [isExpanded, setIsExpanded] = useState(isInitiallyExpanded);
const handleToggleSection = () =>
setIsExpanded((previousIsExpanded) => !previousIsExpanded);
diff --git a/packages/twenty-front/src/modules/ui/navigation/bread-crumb/components/MobileBreadcrumb.tsx b/packages/twenty-front/src/modules/ui/navigation/bread-crumb/components/MobileBreadcrumb.tsx
index 6f050f93d0d..b3586419ace 100644
--- a/packages/twenty-front/src/modules/ui/navigation/bread-crumb/components/MobileBreadcrumb.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/bread-crumb/components/MobileBreadcrumb.tsx
@@ -5,8 +5,7 @@ import { isNonEmptyString } from '@sniptt/guards';
import { type ReactNode, useContext } from 'react';
import { Link } from 'react-router-dom';
import { IconChevronLeft } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
export type MobileBreadcrumbProps = {
className?: string;
@@ -45,7 +44,6 @@ export const MobileBreadcrumb = ({
links,
}: MobileBreadcrumbProps) => {
const { theme } = useContext(ThemeContext);
-
const { openSettingsMenu } = useOpenSettingsMenu();
const handleBackToSettingsClick = () => {
diff --git a/packages/twenty-front/src/modules/ui/navigation/menu-item/components/MenuItemWithOptionDropdown.tsx b/packages/twenty-front/src/modules/ui/navigation/menu-item/components/MenuItemWithOptionDropdown.tsx
index 582c1f9b526..c3607bbfa89 100644
--- a/packages/twenty-front/src/modules/ui/navigation/menu-item/components/MenuItemWithOptionDropdown.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/menu-item/components/MenuItemWithOptionDropdown.tsx
@@ -7,7 +7,6 @@ import {
type ReactNode,
useContext,
} from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
import {
IconChevronRight,
type IconComponent,
@@ -20,6 +19,7 @@ import {
StyledHoverableMenuItemBase,
StyledMenuItemLeftContent,
} from 'twenty-ui/navigation';
+import { ThemeContext } from 'twenty-ui/theme-constants';
export type MenuItemIconButton = {
Wrapper?: FunctionComponent<{ iconButton: ReactElement }>;
@@ -64,7 +64,6 @@ export const MenuItemWithOptionDropdown = ({
dropdownPlacement = 'bottom-end',
}: MenuItemWithOptionDropdownProps) => {
const { theme } = useContext(ThemeContext);
-
const handleMenuItemClick = (event: MouseEvent<HTMLDivElement>) => {
if (!onClick) return;
event.preventDefault();
diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/MultiWorkspaceDropdownClickableComponent.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/MultiWorkspaceDropdownClickableComponent.tsx
index 7f1d91d547f..b23b5c80e7c 100644
--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/MultiWorkspaceDropdownClickableComponent.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/MultiWorkspaceDropdownClickableComponent.tsx
@@ -7,14 +7,13 @@ import {
} from '@/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/MultiWorkspacesDropdownStyles';
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
-import { useContext } from 'react';
import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded';
+import { useContext } from 'react';
import { Avatar } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-
+import { ThemeContext } from 'twenty-ui/theme-constants';
export const MultiWorkspaceDropdownClickableComponent = () => {
- const currentWorkspace = useAtomStateValue(currentWorkspaceState);
const { theme } = useContext(ThemeContext);
+ const currentWorkspace = useAtomStateValue(currentWorkspaceState);
const isNavigationDrawerExpanded = useAtomStateValue(
isNavigationDrawerExpandedState,
diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerAnimatedCollapseWrapper.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerAnimatedCollapseWrapper.tsx
index 5e480784d5a..fb758a13174 100644
--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerAnimatedCollapseWrapper.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerAnimatedCollapseWrapper.tsx
@@ -2,14 +2,13 @@ import { useIsSettingsPage } from '@/navigation/hooks/useIsSettingsPage';
import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded';
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
import { styled } from '@linaria/react';
-import { useContext } from 'react';
import {
type AnimationControls,
motion,
type TargetAndTransition,
} from 'framer-motion';
-import { ThemeContext } from 'twenty-ui/theme';
-
+import { useContext } from 'react';
+import { ThemeContext } from 'twenty-ui/theme-constants';
const StyledAnimatedContainerBase = styled.span`
display: block;
`;
@@ -50,7 +49,9 @@ export const NavigationDrawerAnimatedCollapseWrapper = ({
<StyledAnimatedContainer
initial={false}
animate={animate}
- transition={{ duration: theme.animation.duration.normal }}
+ transition={{
+ duration: theme.animation.duration.normal,
+ }}
>
{children}
</StyledAnimatedContainer>
diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerBackButton.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerBackButton.tsx
index 7a9c5531a9f..7708fa7a7a6 100644
--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerBackButton.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerBackButton.tsx
@@ -1,5 +1,4 @@
import { styled } from '@linaria/react';
-import { useContext } from 'react';
import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded';
import { navigationDrawerExpandedMemorizedState } from '@/ui/navigation/states/navigationDrawerExpandedMemorizedState';
@@ -8,10 +7,10 @@ import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomState
import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';
import { useIsWorkspaceActivationStatusEqualsTo } from '@/workspace/hooks/useIsWorkspaceActivationStatusEqualsTo';
import { WorkspaceActivationStatus } from 'twenty-shared/workspace';
+import { useContext } from 'react';
import { IconX } from 'twenty-ui/display';
import { UndecoratedLink } from 'twenty-ui/navigation';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
type NavigationDrawerBackButtonProps = {
title: string;
diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx
index 3d2baf6fc2f..959bd3473c2 100644
--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx
@@ -25,8 +25,11 @@ import {
TooltipDelay,
TooltipPosition,
} from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { MOBILE_VIEWPORT, themeCssVariables } from 'twenty-ui/theme-constants';
+import {
+ MOBILE_VIEWPORT,
+ ThemeContext,
+ themeCssVariables,
+} from 'twenty-ui/theme-constants';
import {
type TriggerEventType,
useMouseDownNavigation,
diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItemsCollapsableContainer.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItemsCollapsableContainer.tsx
index 9dd2dd83f54..0ee407068af 100644
--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItemsCollapsableContainer.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItemsCollapsableContainer.tsx
@@ -2,14 +2,13 @@ import { useIsSettingsPage } from '@/navigation/hooks/useIsSettingsPage';
import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded';
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
import { styled } from '@linaria/react';
-import { useContext, type ReactNode } from 'react';
+import { type ReactNode, useContext } from 'react';
import {
type AnimationControls,
motion,
type TargetAndTransition,
} from 'framer-motion';
-import { ThemeContext } from 'twenty-ui/theme';
-
+import { ThemeContext } from 'twenty-ui/theme-constants';
const StyledAnimationGroupContainerBase = styled.div``;
const StyledAnimationGroupContainer = motion.create(
@@ -52,7 +51,9 @@ export const NavigationDrawerItemsCollapsableContainer = ({
<StyledAnimationGroupContainer
initial={false}
animate={animate}
- transition={{ duration: theme.animation.duration.normal }}
+ transition={{
+ duration: theme.animation.duration.normal,
+ }}
>
{children}
</StyledAnimationGroupContainer>
diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerSectionTitleSkeletonLoader.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerSectionTitleSkeletonLoader.tsx
index 051caf7dd0e..2680b77d407 100644
--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerSectionTitleSkeletonLoader.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerSectionTitleSkeletonLoader.tsx
@@ -2,8 +2,7 @@ import { SKELETON_LOADER_HEIGHT_SIZES } from '@/activities/components/SkeletonLo
import { styled } from '@linaria/react';
import { useContext } from 'react';
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledSkeletonTitle = styled.div`
margin-bottom: ${themeCssVariables.spacing[2]};
diff --git a/packages/twenty-front/src/modules/ui/navigation/step-bar/components/Step.tsx b/packages/twenty-front/src/modules/ui/navigation/step-bar/components/Step.tsx
index c4278dbf8f7..2863c175574 100644
--- a/packages/twenty-front/src/modules/ui/navigation/step-bar/components/Step.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/step-bar/components/Step.tsx
@@ -1,11 +1,14 @@
import { styled } from '@linaria/react';
-import { useContext } from 'react';
import { motion } from 'framer-motion';
+import { useContext } from 'react';
import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
import { AnimatedCheckmark } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { MOBILE_VIEWPORT, themeCssVariables } from 'twenty-ui/theme-constants';
+import {
+ MOBILE_VIEWPORT,
+ ThemeContext,
+ themeCssVariables,
+} from 'twenty-ui/theme-constants';
const StyledContainer = styled.div<{ isLast: boolean }>`
align-items: center;
@@ -82,8 +85,8 @@ export const Step = ({
children,
activeStep = 0,
}: StepProps) => {
- const { theme } = useContext(ThemeContext);
const isMobile = useIsMobile();
+ const { theme } = useContext(ThemeContext);
const variantsLine = {
previous: {
diff --git a/packages/twenty-front/src/modules/ui/theme/components/BaseThemeProvider.tsx b/packages/twenty-front/src/modules/ui/theme/components/BaseThemeProvider.tsx
index cf469d1494d..8b2deb044d4 100644
--- a/packages/twenty-front/src/modules/ui/theme/components/BaseThemeProvider.tsx
+++ b/packages/twenty-front/src/modules/ui/theme/components/BaseThemeProvider.tsx
@@ -4,7 +4,7 @@ import { useSystemColorScheme } from '@/ui/theme/hooks/useSystemColorScheme';
import { persistedColorSchemeState } from '@/ui/theme/states/persistedColorSchemeState';
import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';
import { type ColorScheme } from 'twenty-ui/input';
-import { THEME_DARK, THEME_LIGHT, ThemeContextProvider } from 'twenty-ui/theme';
+import { ThemeProvider } from 'twenty-ui/theme-constants';
type BaseThemeProviderProps = {
children: JSX.Element | JSX.Element[];
@@ -24,14 +24,13 @@ export const BaseThemeProvider = ({ children }: BaseThemeProviderProps) => {
? systemColorScheme
: persistedColorScheme;
- document.documentElement.className =
- effectiveColorScheme === 'Dark' ? 'dark' : 'light';
-
- const theme = effectiveColorScheme === 'Dark' ? THEME_DARK : THEME_LIGHT;
-
return (
<ThemeSchemeContext.Provider value={setPersistedColorScheme}>
- <ThemeContextProvider theme={theme}>{children}</ThemeContextProvider>
+ <ThemeProvider
+ colorScheme={effectiveColorScheme === 'Dark' ? 'dark' : 'light'}
+ >
+ {children}
+ </ThemeProvider>
</ThemeSchemeContext.Provider>
);
};
diff --git a/packages/twenty-front/src/modules/views/components/SortOrFilterChip.tsx b/packages/twenty-front/src/modules/views/components/SortOrFilterChip.tsx
index 4be3a68d901..87486b2ae8d 100644
--- a/packages/twenty-front/src/modules/views/components/SortOrFilterChip.tsx
+++ b/packages/twenty-front/src/modules/views/components/SortOrFilterChip.tsx
@@ -1,8 +1,7 @@
import { styled } from '@linaria/react';
import { useContext } from 'react';
import { type IconComponent, IconX } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledChip = styled.div<{ variant: SortOrFilterChipVariant }>`
align-items: center;
diff --git a/packages/twenty-front/src/modules/views/components/ViewBarSkeletonLoader.tsx b/packages/twenty-front/src/modules/views/components/ViewBarSkeletonLoader.tsx
index eba22793124..d1ea91af3a5 100644
--- a/packages/twenty-front/src/modules/views/components/ViewBarSkeletonLoader.tsx
+++ b/packages/twenty-front/src/modules/views/components/ViewBarSkeletonLoader.tsx
@@ -1,7 +1,7 @@
import { SKELETON_LOADER_HEIGHT_SIZES } from '@/activities/components/SkeletonLoader';
import { useContext } from 'react';
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
export const ViewBarSkeletonLoader = () => {
const { theme } = useContext(ThemeContext);
diff --git a/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerDropdown.tsx b/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerDropdown.tsx
index 6945b5345ff..4bb391fa812 100644
--- a/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerDropdown.tsx
+++ b/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerDropdown.tsx
@@ -1,7 +1,5 @@
import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
-import { useContext } from 'react';
-
import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';
import { StyledDropdownButtonContainer } from '@/ui/layout/dropdown/components/StyledDropdownButtonContainer';
import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDropdownOpenComponentState';
@@ -23,8 +21,12 @@ import {
OverflowingTextWithTooltip,
useIcons,
} from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { MOBILE_VIEWPORT, themeCssVariables } from 'twenty-ui/theme-constants';
+import { useContext } from 'react';
+import {
+ MOBILE_VIEWPORT,
+ ThemeContext,
+ themeCssVariables,
+} from 'twenty-ui/theme-constants';
const StyledIconContainer = styled.span`
display: flex;
@@ -55,7 +57,6 @@ const StyledViewName = styled.span`
export const ViewPickerDropdown = () => {
const { theme } = useContext(ThemeContext);
-
const { currentView } = useGetCurrentViewOnly();
const { updateViewFromCurrentState } = useUpdateViewFromCurrentState();
diff --git a/packages/twenty-front/src/modules/workflow/components/WorkflowStepExecutionResult.tsx b/packages/twenty-front/src/modules/workflow/components/WorkflowStepExecutionResult.tsx
index 5c4d0e8b5e0..0737cd9c422 100644
--- a/packages/twenty-front/src/modules/workflow/components/WorkflowStepExecutionResult.tsx
+++ b/packages/twenty-front/src/modules/workflow/components/WorkflowStepExecutionResult.tsx
@@ -8,10 +8,8 @@ import {
} from 'twenty-ui/display';
import { CodeEditor, CoreEditorHeader } from 'twenty-ui/input';
import { AnimatedCircleLoading } from 'twenty-ui/utilities';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { themeCssVariables, ThemeContext } from 'twenty-ui/theme-constants';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
-
const StyledContainer = styled.div`
display: flex;
flex-direction: column;
diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramCanvasBase.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramCanvasBase.tsx
index 91547549458..fccc1c3a7b8 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramCanvasBase.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramCanvasBase.tsx
@@ -63,9 +63,7 @@ import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomState
import { isDefined } from 'twenty-shared/utils';
import { Tag, type TagColor } from 'twenty-ui/components';
import { useStore } from 'jotai';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
-import { ThemeContext } from 'twenty-ui/theme';
-
+import { themeCssVariables, ThemeContext } from 'twenty-ui/theme-constants';
const StyledResetReactflowStyles = styled.div`
height: 100%;
width: 100%;
@@ -166,9 +164,8 @@ export const WorkflowDiagramCanvasBase = ({
event: MouseEvent | React.MouseEvent<Element, MouseEvent>;
}) => void;
}) => {
- const store = useStore();
const { theme } = useContext(ThemeContext);
-
+ const store = useStore();
const reactflow = useReactFlow();
const workflowDiagram = useAtomComponentStateValue(
diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramConnector.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramConnector.tsx
index dd418456dd3..683b539a702 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramConnector.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramConnector.tsx
@@ -1,9 +1,7 @@
+import { ThemeContext } from 'twenty-ui/theme-constants';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
-
export const WorkflowDiagramConnector = () => {
const { theme } = useContext(ThemeContext);
-
return (
<svg
xmlns="http://www.w3.org/2000/svg"
diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowRunCard.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowRunCard.tsx
index cb4e25107d3..0af4761aa65 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowRunCard.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowRunCard.tsx
@@ -9,9 +9,7 @@ import { WorkflowVisualizerComponentInstanceContext } from '@/workflow/workflow-
import { styled } from '@linaria/react';
import { Suspense, useContext, useId } from 'react';
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
-import { ThemeContext } from 'twenty-ui/theme';
-
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledLoadingSkeletonContainer = styled.div`
display: flex;
flex-direction: column;
@@ -23,7 +21,6 @@ const StyledLoadingSkeletonContainer = styled.div`
const LoadingSkeleton = () => {
const { theme } = useContext(ThemeContext);
-
return (
<StyledLoadingSkeletonContainer>
<SkeletonTheme
diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowVersionCard.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowVersionCard.tsx
index f0ea3072fd4..840c010aac6 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowVersionCard.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowVersionCard.tsx
@@ -7,9 +7,7 @@ import { WorkflowVisualizerComponentInstanceContext } from '@/workflow/workflow-
import { styled } from '@linaria/react';
import { Suspense, useContext } from 'react';
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
-import { ThemeContext } from 'twenty-ui/theme';
-
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledLoadingSkeletonContainer = styled.div`
display: flex;
flex-direction: column;
@@ -21,7 +19,6 @@ const StyledLoadingSkeletonContainer = styled.div`
const LoadingSkeleton = () => {
const { theme } = useContext(ThemeContext);
-
return (
<StyledLoadingSkeletonContainer>
<SkeletonTheme
diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useWorkflowDiagramScreenToFlowPosition.ts b/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useWorkflowDiagramScreenToFlowPosition.ts
index 73532a920e6..fe24dc98c8b 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useWorkflowDiagramScreenToFlowPosition.ts
+++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useWorkflowDiagramScreenToFlowPosition.ts
@@ -1,8 +1,9 @@
import { useReactFlow } from '@xyflow/react';
+import { useContext } from 'react';
import { isDefined } from 'twenty-shared/utils';
-import { THEME_COMMON } from 'twenty-ui/theme';
-
+import { ThemeContext } from 'twenty-ui/theme-constants';
export const useWorkflowDiagramScreenToFlowPosition = () => {
+ const { theme } = useContext(ThemeContext);
const { screenToFlowPosition } = useReactFlow();
const workflowDiagramScreenToFlowPosition = (position?: {
@@ -14,7 +15,7 @@ export const useWorkflowDiagramScreenToFlowPosition = () => {
}
const visibleRightDrawerWidth = Number(
- THEME_COMMON.rightDrawerWidth.replace('px', ''),
+ theme.rightDrawerWidth.replace('px', ''),
);
const flowPosition = screenToFlowPosition(position);
diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/components/WorkflowDiagramBaseEdge.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/components/WorkflowDiagramBaseEdge.tsx
index 3e32b587666..435ecae8b2d 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/components/WorkflowDiagramBaseEdge.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/components/WorkflowDiagramBaseEdge.tsx
@@ -1,8 +1,8 @@
import { useEdgeState } from '@/workflow/workflow-diagram/workflow-edges/hooks/useEdgeState';
import { type WorkflowDiagramEdgeComponentProps } from '@/workflow/workflow-diagram/workflow-edges/types/WorkflowDiagramEdgeComponentProps';
import { BaseEdge } from '@xyflow/react';
+import { ThemeContext } from 'twenty-ui/theme-constants';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
type WorkflowDiagramBaseEdgeProps = Pick<
WorkflowDiagramEdgeComponentProps,
@@ -26,7 +26,6 @@ export const WorkflowDiagramBaseEdge = ({
path,
}: WorkflowDiagramBaseEdgeProps) => {
const { theme } = useContext(ThemeContext);
-
const { isEdgeSelected, isEdgeHovered } = useEdgeState();
const selected = isEdgeSelected({
diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/components/WorkflowDiagramBlankEdge.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/components/WorkflowDiagramBlankEdge.tsx
index fe832db5ca2..c3a2616e64a 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/components/WorkflowDiagramBlankEdge.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/components/WorkflowDiagramBlankEdge.tsx
@@ -1,8 +1,8 @@
import { type WorkflowDiagramEdge } from '@/workflow/workflow-diagram/types/WorkflowDiagram';
import { getEdgePath } from '@/workflow/workflow-diagram/workflow-edges/utils/getEdgePath';
import { BaseEdge, type EdgeProps } from '@xyflow/react';
+import { ThemeContext } from 'twenty-ui/theme-constants';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
type WorkflowDiagramBlankEdgeProps = EdgeProps<WorkflowDiagramEdge>;
@@ -17,7 +17,6 @@ export const WorkflowDiagramBlankEdge = ({
targetPosition,
}: WorkflowDiagramBlankEdgeProps) => {
const { theme } = useContext(ThemeContext);
-
const { segments } = getEdgePath({
sourceX,
sourceY,
@@ -37,7 +36,9 @@ export const WorkflowDiagramBlankEdge = ({
markerStart={segment.markerStart}
markerEnd={segment.markerEnd}
path={segment.path}
- style={{ stroke: theme.border.color.strong }}
+ style={{
+ stroke: theme.border.color.strong,
+ }}
/>
))}
</>
diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/components/WorkflowDiagramConnection.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/components/WorkflowDiagramConnection.tsx
index b90ceac9612..432c6632bc5 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/components/WorkflowDiagramConnection.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/components/WorkflowDiagramConnection.tsx
@@ -3,8 +3,8 @@ import {
getBezierPath,
} from '@xyflow/react';
import { EDGE_BRANCH_ARROW_MARKER } from '@/workflow/workflow-diagram/workflow-edges/constants/EdgeBranchArrowMarker';
+import { ThemeContext } from 'twenty-ui/theme-constants';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
type WorkflowDiagramConnectionProps = ConnectionLineComponentProps;
@@ -15,7 +15,6 @@ export const WorkflowDiagramConnection = ({
toY,
}: WorkflowDiagramConnectionProps) => {
const { theme } = useContext(ThemeContext);
-
const [path] = getBezierPath({
sourceX: fromX,
sourceY: fromY + 4,
diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/components/WorkflowDiagramCustomMarkers.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/components/WorkflowDiagramCustomMarkers.tsx
index f6a8f6c22a0..2529e225b77 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/components/WorkflowDiagramCustomMarkers.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/components/WorkflowDiagramCustomMarkers.tsx
@@ -1,10 +1,9 @@
-import { useContext } from 'react';
import { EDGE_BRANCH_ARROW_MARKER } from '@/workflow/workflow-diagram/workflow-edges/constants/EdgeBranchArrowMarker';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
+import { useContext } from 'react';
export const WorkflowDiagramCustomMarkers = () => {
const { theme } = useContext(ThemeContext);
-
return (
<svg style={{ position: 'absolute', top: 0, left: 0 }}>
<defs>
diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/components/WorkflowDiagramDefaultEdgeReadonly.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/components/WorkflowDiagramDefaultEdgeReadonly.tsx
index 7267c54cf98..522f831637e 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/components/WorkflowDiagramDefaultEdgeReadonly.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/components/WorkflowDiagramDefaultEdgeReadonly.tsx
@@ -5,8 +5,8 @@ import { getEdgePath } from '@/workflow/workflow-diagram/workflow-edges/utils/ge
import { i18n } from '@lingui/core';
import { BaseEdge, EdgeLabelRenderer } from '@xyflow/react';
import { isDefined } from 'twenty-shared/utils';
+import { ThemeContext } from 'twenty-ui/theme-constants';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
type WorkflowDiagramDefaultEdgeReadonlyProps =
WorkflowDiagramEdgeComponentProps;
@@ -23,7 +23,6 @@ export const WorkflowDiagramDefaultEdgeReadonly = ({
data,
}: WorkflowDiagramDefaultEdgeReadonlyProps) => {
const { theme } = useContext(ThemeContext);
-
const {
segments,
overlayPosition: [labelX, labelY],
@@ -47,7 +46,9 @@ export const WorkflowDiagramDefaultEdgeReadonly = ({
markerStart={segment.markerStart}
markerEnd={segment.markerEnd}
path={segment.path}
- style={{ stroke: theme.border.color.strong }}
+ style={{
+ stroke: theme.border.color.strong,
+ }}
/>
))}
diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramStepNodeIcon.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramStepNodeIcon.tsx
index 6e332b25742..d28e86c9288 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramStepNodeIcon.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramStepNodeIcon.tsx
@@ -2,8 +2,8 @@ import { type WorkflowDiagramStepNodeData } from '@/workflow/workflow-diagram/ty
import { getWorkflowNodeIconKey } from '@/workflow/workflow-diagram/utils/getWorkflowNodeIconKey';
import { assertUnreachable } from 'twenty-shared/utils';
import { useIcons } from 'twenty-ui/display';
+import { ThemeContext } from 'twenty-ui/theme-constants';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
export const WorkflowDiagramStepNodeIcon = ({
data,
diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowAiAgentPermissionsFlagRow.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowAiAgentPermissionsFlagRow.tsx
index 2fa3678321a..9f6c9fb6809 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowAiAgentPermissionsFlagRow.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowAiAgentPermissionsFlagRow.tsx
@@ -8,9 +8,8 @@ import {
StyledRowLeftContent,
StyledText,
} from './WorkflowAiAgentPermissionsStyles';
+import { ThemeContext } from 'twenty-ui/theme-constants';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
-
type WorkflowAiAgentPermissionsFlagRowProps = {
permission: SettingsRolePermissionsSettingPermission;
isEnabled: boolean;
diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowAiAgentPermissionsObjectRow.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowAiAgentPermissionsObjectRow.tsx
index 9d9e14cca8f..96ab5dc6fd8 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowAiAgentPermissionsObjectRow.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowAiAgentPermissionsObjectRow.tsx
@@ -6,9 +6,8 @@ import {
StyledRowLeftContent,
StyledText,
} from './WorkflowAiAgentPermissionsStyles';
+import { ThemeContext } from 'twenty-ui/theme-constants';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
-
type WorkflowAiAgentPermissionsObjectRowProps = {
objectMetadata: {
id: string;
diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowOutputSchemaBuilder.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowOutputSchemaBuilder.tsx
index a2b170fd34e..ce8faecee03 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowOutputSchemaBuilder.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowOutputSchemaBuilder.tsx
@@ -9,10 +9,8 @@ import { IconPlus, IconTrash } from 'twenty-ui/display';
import { LightIconButton } from 'twenty-ui/input';
import { v4 } from 'uuid';
import { WorkflowOutputFieldTypeSelector } from './WorkflowOutputFieldTypeSelector';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { themeCssVariables, ThemeContext } from 'twenty-ui/theme-constants';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
-
type WorkflowOutputSchemaBuilderProps = {
fields: OutputSchemaField[];
onChange: (fields: OutputSchemaField[]) => void;
diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowEditActionFormBuilder.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowEditActionFormBuilder.tsx
index 8645fd3eac7..c2f2d297409 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowEditActionFormBuilder.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowEditActionFormBuilder.tsx
@@ -18,7 +18,7 @@ import { styled } from '@linaria/react';
import { type OnDragEndResponder } from '@hello-pangea/dnd';
import { useLingui } from '@lingui/react/macro';
import { isNonEmptyString } from '@sniptt/guards';
-import { useEffect, useState } from 'react';
+import { useContext, useEffect, useState } from 'react';
import { FieldMetadataType } from 'twenty-shared/types';
import { isDefined } from 'twenty-shared/utils';
import {
@@ -32,7 +32,7 @@ import {
import { LightIconButton } from 'twenty-ui/input';
import { useDebouncedCallback } from 'use-debounce';
import { v4 } from 'uuid';
-import { ICON_SIZES, themeCssVariables } from 'twenty-ui/theme-constants';
+import { themeCssVariables, ThemeContext } from 'twenty-ui/theme-constants';
export type WorkflowEditActionFormBuilderProps = {
triggerType: WorkflowTriggerType | undefined;
@@ -149,6 +149,7 @@ export const WorkflowEditActionFormBuilder = ({
actionOptions,
}: WorkflowEditActionFormBuilderProps) => {
const { t } = useLingui();
+ const { theme } = useContext(ThemeContext);
const [formData, setFormData] = useState<FormData>(action.settings.input);
@@ -328,7 +329,7 @@ export const WorkflowEditActionFormBuilder = ({
</StyledPlaceholderContainer>
{field.type === 'RECORD' && (
<IconChevronDown
- size={ICON_SIZES.md}
+ size={theme.icon.size.md}
color={
themeCssVariables.font.color.tertiary
}
@@ -418,7 +419,7 @@ export const WorkflowEditActionFormBuilder = ({
>
<StyledFieldContainer>
<StyledAddFieldButtonContentContainer>
- <IconPlus size={ICON_SIZES.sm} />
+ <IconPlus size={theme.icon.size.sm} />
{t`Add Field`}
</StyledAddFieldButtonContentContainer>
</StyledFieldContainer>
diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowEditActionFormFieldSettings.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowEditActionFormFieldSettings.tsx
index 32e7af8a3ec..bf7320ca7d5 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowEditActionFormFieldSettings.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowEditActionFormFieldSettings.tsx
@@ -10,10 +10,8 @@ import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
import { IconSettingsAutomation, IconX } from 'twenty-ui/display';
import { LightIconButton } from 'twenty-ui/input';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { themeCssVariables, ThemeContext } from 'twenty-ui/theme-constants';
import { useContext } from 'react';
-import { ThemeContext } from 'twenty-ui/theme';
-
type WorkflowEditActionFormFieldSettingsProps = {
field: WorkflowFormActionField;
onChange: (field: WorkflowFormActionField) => void;
diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/components/WorkflowEditActionHttpRequest.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/components/WorkflowEditActionHttpRequest.tsx
index 514121b5880..08e14d83437 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/components/WorkflowEditActionHttpRequest.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/components/WorkflowEditActionHttpRequest.tsx
@@ -30,9 +30,7 @@ import { BodyInput } from './BodyInput';
import { HttpRequestExecutionResult } from './HttpRequestExecutionResult';
import { HttpRequestTestVariableInput } from './HttpRequestTestVariableInput';
import { KeyValuePairInput } from './KeyValuePairInput';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
-import { ThemeContext } from 'twenty-ui/theme';
-
+import { themeCssVariables, ThemeContext } from 'twenty-ui/theme-constants';
type WorkflowEditActionHttpRequestProps = {
action: WorkflowHttpRequestAction;
actionOptions: {
@@ -153,7 +151,9 @@ export const WorkflowEditActionHttpRequest = ({
value={formData.method}
onChange={(value) => handleFieldChange('method', value)}
disabled={actionOptions.readonly}
- dropdownOffset={{ y: parseInt(theme.spacing(1), 10) }}
+ dropdownOffset={{
+ y: parseInt(theme.spacing[1], 10),
+ }}
dropdownWidth={GenericDropdownContentWidth.ExtraLarge}
/>
diff --git a/packages/twenty-front/src/modules/workflow/workflow-trigger/components/WorkflowEditTriggerWebhookForm.tsx b/packages/twenty-front/src/modules/workflow/workflow-trigger/components/WorkflowEditTriggerWebhookForm.tsx
index 873355f85f5..ede9ca5129e 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-trigger/components/WorkflowEditTriggerWebhookForm.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-trigger/components/WorkflowEditTriggerWebhookForm.tsx
@@ -24,7 +24,7 @@ import { IconCopy } from 'twenty-ui/display';
import { useDebouncedCallback } from 'use-debounce';
import { REACT_APP_SERVER_BASE_URL } from '~/config';
import { useCopyToClipboard } from '~/hooks/useCopyToClipboard';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
type WorkflowEditTriggerWebhookFormProps = {
trigger: WorkflowWebhookTrigger;
diff --git a/packages/twenty-front/src/modules/workflow/workflow-variables/components/WorkflowVariablesDropdown.tsx b/packages/twenty-front/src/modules/workflow/workflow-variables/components/WorkflowVariablesDropdown.tsx
index fd319e283c6..084f113649d 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-variables/components/WorkflowVariablesDropdown.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-variables/components/WorkflowVariablesDropdown.tsx
@@ -14,9 +14,7 @@ import { styled } from '@linaria/react';
import { useContext, useState } from 'react';
import { isDefined } from 'twenty-shared/utils';
import { IconVariablePlus } from 'twenty-ui/display';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
-import { ThemeContext } from 'twenty-ui/theme';
-
+import { themeCssVariables, ThemeContext } from 'twenty-ui/theme-constants';
const StyledDropdownVariableButtonContainer = styled(
StyledDropdownButtonContainer,
)<{ transparentBackground?: boolean; disabled?: boolean }>`
@@ -52,7 +50,6 @@ export const WorkflowVariablesDropdown = ({
clickableComponent?: React.ReactNode;
}) => {
const { theme } = useContext(ThemeContext);
-
const dropdownId = `${SEARCH_VARIABLES_DROPDOWN_ID}-${instanceId}`;
const isDropdownOpen = useAtomComponentStateValue(
isDropdownOpenComponentState,
@@ -140,7 +137,7 @@ export const WorkflowVariablesDropdown = ({
dropdownPlacement="bottom-end"
dropdownOffset={{
x: 2,
- y: parseInt(theme.spacing(multiline ? 11 : 1), 10),
+ y: parseInt(theme.spacing[multiline ? 11 : 1], 10),
}}
/>
);
diff --git a/packages/twenty-front/src/pages/auth/PasswordReset.tsx b/packages/twenty-front/src/pages/auth/PasswordReset.tsx
index 1291a749f5e..773d584672b 100644
--- a/packages/twenty-front/src/pages/auth/PasswordReset.tsx
+++ b/packages/twenty-front/src/pages/auth/PasswordReset.tsx
@@ -29,8 +29,7 @@ import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomState
import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';
import { AppPath } from 'twenty-shared/types';
import { MainButton } from 'twenty-ui/input';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { AnimatedEaseIn } from 'twenty-ui/utilities';
import { z } from 'zod';
import {
@@ -87,6 +86,7 @@ const StyledMainButton = styled(MainButton)`
`;
export const PasswordReset = () => {
+ const { theme } = useContext(ThemeContext);
const { t } = useLingui();
const { enqueueErrorSnackBar, enqueueSuccessSnackBar } = useSnackBar();
@@ -99,9 +99,6 @@ export const PasswordReset = () => {
const [email, setEmail] = useState('');
const [isTokenValid, setIsTokenValid] = useState(false);
const [isTargetUserPasswordSet, setIsTargetUserPasswordSet] = useState(false);
-
- const { theme } = useContext(ThemeContext);
-
const passwordResetToken = useParams().passwordResetToken;
const isLoggedIn = useIsLogged();
@@ -230,7 +227,9 @@ export const PasswordReset = () => {
<Skeleton
height={SKELETON_LOADER_HEIGHT_SIZES.standard.m}
count={2}
- style={{ marginBottom: theme.spacing(2) }}
+ style={{
+ marginBottom: themeCssVariables.spacing[2],
+ }}
/>
</SkeletonTheme>
) : (
diff --git a/packages/twenty-front/src/pages/onboarding/BookCall.tsx b/packages/twenty-front/src/pages/onboarding/BookCall.tsx
index 4eb043cc61e..e36cc419caa 100644
--- a/packages/twenty-front/src/pages/onboarding/BookCall.tsx
+++ b/packages/twenty-front/src/pages/onboarding/BookCall.tsx
@@ -12,7 +12,7 @@ import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomState
import { AppPath } from 'twenty-shared/types';
import { IconChevronLeft, IconChevronRightPipe } from 'twenty-ui/display';
import { LightButton } from 'twenty-ui/input';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
import { useIsMobile } from 'twenty-ui/utilities';
import {
OnboardingStatus,
@@ -20,8 +20,9 @@ import {
} from '~/generated-metadata/graphql';
export const BookCall = () => {
+ const { colorScheme } = useContext(ThemeContext);
+
const { t } = useLingui();
- const { theme } = useContext(ThemeContext);
const calendarBookingPageId = useAtomStateValue(calendarBookingPageIdState);
const setNextOnboardingStatus = useSetNextOnboardingStatus();
const currentUser = useAtomStateValue(currentUserState);
@@ -52,7 +53,7 @@ export const BookCall = () => {
calLink={calendarBookingPageId ?? ''}
config={{
layout: 'month_view',
- theme: theme.name === 'light' ? 'light' : 'dark',
+ theme: colorScheme === 'light' ? 'light' : 'dark',
email: currentUser?.email ?? '',
name: `${currentUser?.firstName} ${currentUser?.lastName}`,
}}
diff --git a/packages/twenty-front/src/pages/onboarding/SyncEmails.tsx b/packages/twenty-front/src/pages/onboarding/SyncEmails.tsx
index 07ce8713c79..ba460aa77b3 100644
--- a/packages/twenty-front/src/pages/onboarding/SyncEmails.tsx
+++ b/packages/twenty-front/src/pages/onboarding/SyncEmails.tsx
@@ -22,8 +22,7 @@ import { AppPath, ConnectedAccountProvider } from 'twenty-shared/types';
import { IconGoogle, IconMicrosoft } from 'twenty-ui/display';
import { MainButton } from 'twenty-ui/input';
import { ClickToActionLink } from 'twenty-ui/navigation';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import {
CalendarChannelVisibility,
MessageChannelVisibility,
diff --git a/packages/twenty-front/src/pages/settings/ai/SettingsSkillForm.tsx b/packages/twenty-front/src/pages/settings/ai/SettingsSkillForm.tsx
index 1262cb0967b..e94f399ce98 100644
--- a/packages/twenty-front/src/pages/settings/ai/SettingsSkillForm.tsx
+++ b/packages/twenty-front/src/pages/settings/ai/SettingsSkillForm.tsx
@@ -29,8 +29,7 @@ import {
} from 'twenty-ui/display';
import { Button } from 'twenty-ui/input';
import { Card, Section } from 'twenty-ui/layout';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import {
useActivateSkillMutation,
useCreateSkillMutation,
@@ -105,11 +104,11 @@ type SkillFormValues = {
const DELETE_SKILL_MODAL_ID = 'delete-skill-modal';
export const SettingsSkillForm = ({ mode }: { mode: 'create' | 'edit' }) => {
+ const { theme } = useContext(ThemeContext);
const { skillId = '' } = useParams<{ skillId: string }>();
const navigate = useNavigateSettings();
const navigateApp = useNavigateApp();
const { enqueueErrorSnackBar } = useSnackBar();
- const { theme } = useContext(ThemeContext);
const [isSubmitting, setIsSubmitting] = useState(false);
const [isReadonlyMode, setIsReadonlyMode] = useState(false);
const [originalFormValues, setOriginalFormValues] =
diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsAIAgentTableRow.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsAIAgentTableRow.tsx
index d00ffc93c05..907f117e7e9 100644
--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsAIAgentTableRow.tsx
+++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsAIAgentTableRow.tsx
@@ -5,8 +5,7 @@ import { SettingsItemTypeTag } from '@/settings/components/SettingsItemTypeTag';
import { TableCell } from '@/ui/layout/table/components/TableCell';
import { TableRow } from '@/ui/layout/table/components/TableRow';
import { OverflowingTextWithTooltip, useIcons } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { type Agent } from '~/generated-metadata/graphql';
export type SettingsAIAgentTableRowProps = {
diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsAIAgentsTable.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsAIAgentsTable.tsx
index 70712adb33b..afb256535ab 100644
--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsAIAgentsTable.tsx
+++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsAIAgentsTable.tsx
@@ -20,8 +20,7 @@ import {
} from 'twenty-ui/display';
import { Button } from 'twenty-ui/input';
import { MenuItemToggle } from 'twenty-ui/navigation';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { SETTINGS_AI_AGENT_TABLE_METADATA } from '~/pages/settings/ai/constants/SettingsAiAgentTableMetadata';
import { normalizeSearchText } from '~/utils/normalizeSearchText';
@@ -52,10 +51,10 @@ const StyledTableHeaderRow = styled(StyledAIAgentTableRow)`
`;
export const SettingsAIAgentsTable = () => {
+ const { theme } = useContext(ThemeContext);
const { data, loading } = useFindManyAgentsQuery();
const { t } = useLingui();
- const { theme } = useContext(ThemeContext);
const [searchTerm, setSearchTerm] = useState('');
const [showWorkflowAgents, setShowWorkflowAgents] = useState(false);
diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentDetailSkeletonLoader.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentDetailSkeletonLoader.tsx
index 71d4ea529c7..5b55fae94fb 100644
--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentDetailSkeletonLoader.tsx
+++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentDetailSkeletonLoader.tsx
@@ -3,8 +3,7 @@ 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';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledSkeletonContainer = styled.div`
display: flex;
@@ -34,7 +33,6 @@ const StyledNameContainer = styled.div`
export const SettingsAgentDetailSkeletonLoader = () => {
const { theme } = useContext(ThemeContext);
-
return (
<SkeletonTheme
baseColor={theme.background.tertiary}
diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentModelCapabilities.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentModelCapabilities.tsx
index 343c7f60c54..71796c694da 100644
--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentModelCapabilities.tsx
+++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentModelCapabilities.tsx
@@ -1,6 +1,4 @@
import { styled } from '@linaria/react';
-import { useContext } from 'react';
-
import { aiModelsState } from '@/client-config/states/aiModelsState';
import { InputLabel } from '@/ui/input/components/InputLabel';
import { t } from '@lingui/core/macro';
@@ -9,8 +7,8 @@ import { IconBrandX, IconWorld } from 'twenty-ui/display';
import { Checkbox } from 'twenty-ui/input';
import { Section } from 'twenty-ui/layout';
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { useContext } from 'react';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledCheckboxContainer = styled.div<{ disabled: boolean }>`
display: flex;
diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsSkillTableRow.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsSkillTableRow.tsx
index 7df14e443d5..fdbccdac459 100644
--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsSkillTableRow.tsx
+++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsSkillTableRow.tsx
@@ -1,11 +1,11 @@
import { styled } from '@linaria/react';
-import { type ReactNode } from 'react';
+import { type ReactNode, useContext } from 'react';
import { SettingsItemTypeTag } from '@/settings/components/SettingsItemTypeTag';
import { TableCell } from '@/ui/layout/table/components/TableCell';
import { TableRow } from '@/ui/layout/table/components/TableRow';
import { useIcons, OverflowingTextWithTooltip } from 'twenty-ui/display';
-import { ICON_SIZES, themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { type Skill } from '~/generated-metadata/graphql';
@@ -26,6 +26,7 @@ export const SettingsSkillTableRow = ({
action,
link,
}: SettingsSkillTableRowProps) => {
+ const { theme } = useContext(ThemeContext);
const { getIcon } = useIcons();
const Icon = getIcon(skill.icon ?? 'IconSparkles');
@@ -43,7 +44,7 @@ export const SettingsSkillTableRow = ({
overflow="hidden"
>
<StyledIconContainer>
- <Icon size={ICON_SIZES.md} />
+ <Icon size={theme.icon.size.md} />
</StyledIconContainer>
<OverflowingTextWithTooltip text={skill.label} />
</TableCell>
diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsSkillsTable.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsSkillsTable.tsx
index 5cd243967a3..bfa26638c08 100644
--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsSkillsTable.tsx
+++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsSkillsTable.tsx
@@ -1,6 +1,6 @@
import { styled } from '@linaria/react';
import { useLingui } from '@lingui/react/macro';
-import { useMemo, useState } from 'react';
+import { useContext, useMemo, useState } from 'react';
import Skeleton from 'react-loading-skeleton';
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
@@ -24,11 +24,7 @@ import {
} from 'twenty-ui/display';
import { Button } from 'twenty-ui/input';
import { MenuItemToggle, UndecoratedLink } from 'twenty-ui/navigation';
-import {
- ICON_SIZES,
- ICON_STROKES,
- themeCssVariables,
-} from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import {
useActivateSkillMutation,
@@ -63,6 +59,7 @@ const StyledFooterContainer = styled.div`
`;
export const SettingsSkillsTable = () => {
+ const { theme } = useContext(ThemeContext);
const { data, loading, refetch } = useFindManySkillsQuery();
const [activateSkill] = useActivateSkillMutation();
const [deleteSkill] = useDeleteSkillMutation();
@@ -190,8 +187,8 @@ export const SettingsSkillsTable = () => {
action={
skill.isActive ? (
<IconChevronRight
- size={ICON_SIZES.md}
- stroke={ICON_STROKES.sm}
+ size={theme.icon.size.md}
+ stroke={theme.icon.stroke.sm}
/>
) : (
<SettingsSkillInactiveMenuDropDown
diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsToolsTable.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsToolsTable.tsx
index 9779f26073b..5214c5e6d18 100644
--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsToolsTable.tsx
+++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsToolsTable.tsx
@@ -22,8 +22,7 @@ import {
} from 'twenty-ui/display';
import { Button } from 'twenty-ui/input';
import { Section } from 'twenty-ui/layout';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { normalizeSearchText } from '~/utils/normalizeSearchText';
import { SettingsSystemToolTableRow } from './SettingsSystemToolTableRow';
@@ -56,12 +55,12 @@ const StyledFooterContainer = styled.div`
`;
export const SettingsToolsTable = () => {
+ const { theme } = useContext(ThemeContext);
const logicFunctions = useAtomStateValue(logicFunctionsState);
const { toolIndex, loading: toolIndexLoading } = useGetToolIndex();
const { createLogicFunction } = usePersistLogicFunction();
const { t } = useLingui();
- const { theme } = useContext(ThemeContext);
const navigate = useNavigate();
const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar();
const [customSearchTerm, setCustomSearchTerm] = useState('');
diff --git a/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationDataTableRow.tsx b/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationDataTableRow.tsx
index 3cf5cb217b0..26b5929fa63 100644
--- a/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationDataTableRow.tsx
+++ b/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationDataTableRow.tsx
@@ -11,11 +11,10 @@ import { TableRow } from '@/ui/layout/table/components/TableRow';
import { TableSubRow } from '@/ui/layout/table/components/TableSubRow';
import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
-import { useContext } from 'react';
import { isDefined } from 'twenty-shared/utils';
import { IconChevronDown, IconChevronRight, useIcons } from 'twenty-ui/display';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { useContext } from 'react';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { type ApplicationDataTableRow } from '~/pages/settings/applications/components/SettingsApplicationDataTable';
diff --git a/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationDetailSkeletonLoader.tsx b/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationDetailSkeletonLoader.tsx
index 5cb2cc84b45..3fd78e9ecdf 100644
--- a/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationDetailSkeletonLoader.tsx
+++ b/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationDetailSkeletonLoader.tsx
@@ -3,8 +3,7 @@ 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';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
const StyledSkeletonContainer = styled.div`
display: flex;
@@ -20,7 +19,6 @@ const StyledFormSection = styled.div`
export const SettingsApplicationDetailSkeletonLoader = () => {
const { theme } = useContext(ThemeContext);
-
return (
<SkeletonTheme
baseColor={theme.background.tertiary}
diff --git a/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationsTable.tsx b/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationsTable.tsx
index cf334f4edca..7669a2b3ef3 100644
--- a/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationsTable.tsx
+++ b/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationsTable.tsx
@@ -14,8 +14,7 @@ import { type ApplicationWithoutRelation } from '~/pages/settings/applications/t
import { isNewerSemver } from '~/pages/settings/applications/utils/isNewerSemver';
import { Section } from 'twenty-ui/layout';
import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { AppRegistrationSourceType } from '~/generated-metadata/graphql';
const StyledTable = styled(Table)`
@@ -36,9 +35,8 @@ export const SettingsApplicationsTable = ({
}: {
applications: ApplicationWithoutRelation[];
}) => {
- const { t } = useLingui();
-
const { theme } = useContext(ThemeContext);
+ const { t } = useLingui();
const [searchTerm, setSearchTerm] = useState('');
diff --git a/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationsDeveloperTab.tsx b/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationsDeveloperTab.tsx
index 38d299b9f7e..815d4cc043a 100644
--- a/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationsDeveloperTab.tsx
+++ b/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationsDeveloperTab.tsx
@@ -6,7 +6,6 @@ import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomState
import { styled } from '@linaria/react';
import { useLingui } from '@lingui/react/macro';
import { useQuery } from '@apollo/client';
-import { useContext } from 'react';
import { useNavigate } from 'react-router-dom';
import { SettingsPath } from 'twenty-shared/types';
import { getSettingsPath } from 'twenty-shared/utils';
@@ -20,8 +19,8 @@ import {
} from 'twenty-ui/display';
import { Button } from 'twenty-ui/input';
import { Section } from 'twenty-ui/layout';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { useContext } from 'react';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { useCopyToClipboard } from '~/hooks/useCopyToClipboard';
const StyledButtonContainer = styled.div`
@@ -35,9 +34,9 @@ type ApplicationRegistration = {
};
export const SettingsApplicationsDeveloperTab = () => {
+ const { theme } = useContext(ThemeContext);
const { t } = useLingui();
const navigate = useNavigate();
- const { theme } = useContext(ThemeContext);
const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState);
const { copyToClipboard } = useCopyToClipboard();
diff --git a/packages/twenty-front/src/pages/settings/data-model/SettingsObjectDetailPage.tsx b/packages/twenty-front/src/pages/settings/data-model/SettingsObjectDetailPage.tsx
index 9f78114d830..00e21f550ca 100644
--- a/packages/twenty-front/src/pages/settings/data-model/SettingsObjectDetailPage.tsx
+++ b/packages/twenty-front/src/pages/settings/data-model/SettingsObjectDetailPage.tsx
@@ -29,7 +29,7 @@ import {
} from 'twenty-ui/display';
import { Button } from 'twenty-ui/input';
import { UndecoratedLink } from 'twenty-ui/navigation';
-import { ThemeContext } from 'twenty-ui/theme';
+import { ThemeContext } from 'twenty-ui/theme-constants';
import { FeatureFlagKey } from '~/generated-metadata/graphql';
import { useNavigateApp } from '~/hooks/useNavigateApp';
import { SETTINGS_OBJECT_DETAIL_TABS } from '~/pages/settings/data-model/constants/SettingsObjectDetailTabs';
@@ -42,10 +42,9 @@ const StyledContentContainer = styled.div`
`;
export const SettingsObjectDetailPage = () => {
+ const { theme } = useContext(ThemeContext);
const navigateApp = useNavigateApp();
const { t } = useLingui();
- const { theme } = useContext(ThemeContext);
-
const { objectNamePlural = '' } = useParams();
const { findObjectMetadataItemByNamePlural } =
diff --git a/packages/twenty-front/src/pages/settings/data-model/SettingsObjectTable.tsx b/packages/twenty-front/src/pages/settings/data-model/SettingsObjectTable.tsx
index 24dde8b9b97..42c3b4e5557 100644
--- a/packages/twenty-front/src/pages/settings/data-model/SettingsObjectTable.tsx
+++ b/packages/twenty-front/src/pages/settings/data-model/SettingsObjectTable.tsx
@@ -25,8 +25,7 @@ import { getSettingsPath } from 'twenty-shared/utils';
import { IconArchive, IconChevronRight, IconSettings } from 'twenty-ui/display';
import { SearchInput } from 'twenty-ui/input';
import { MenuItemToggle } from 'twenty-ui/navigation';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { GET_SETTINGS_OBJECT_TABLE_METADATA } from '~/pages/settings/data-model/constants/SettingsObjectTableMetadata';
import type { SettingsObjectTableItem } from '~/pages/settings/data-model/types/SettingsObjectTableItem';
import { normalizeSearchText } from '~/utils/normalizeSearchText';
@@ -46,9 +45,8 @@ export const SettingsObjectTable = ({
objectMetadataItems: ObjectMetadataItem[];
withSearchBar?: boolean;
}) => {
- const { t } = useLingui();
-
const { theme } = useContext(ThemeContext);
+ const { t } = useLingui();
const isAdvancedModeEnabled = useAtomStateValue(isAdvancedModeEnabledState);
diff --git a/packages/twenty-front/src/pages/settings/members/SettingsWorkspaceMembers.tsx b/packages/twenty-front/src/pages/settings/members/SettingsWorkspaceMembers.tsx
index 15a8dc46083..e928328d46a 100644
--- a/packages/twenty-front/src/pages/settings/members/SettingsWorkspaceMembers.tsx
+++ b/packages/twenty-front/src/pages/settings/members/SettingsWorkspaceMembers.tsx
@@ -49,8 +49,7 @@ import { TableRow } from '@/ui/layout/table/components/TableRow';
import { useDeleteWorkspaceInvitation } from '@/workspace-invitation/hooks/useDeleteWorkspaceInvitation';
import { useResendWorkspaceInvitation } from '@/workspace-invitation/hooks/useResendWorkspaceInvitation';
import { workspaceInvitationsState } from '@/workspace-invitation/states/workspaceInvitationsStates';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { useNavigateSettings } from '~/hooks/useNavigateSettings';
import { normalizeSearchText } from '~/utils/normalizeSearchText';
@@ -122,9 +121,9 @@ const StyledNoMembers = styled(TableCell)`
`;
export const SettingsWorkspaceMembers = () => {
+ const { theme } = useContext(ThemeContext);
const { t } = useLingui();
const { enqueueErrorSnackBar } = useSnackBar();
- const { theme } = useContext(ThemeContext);
const navigateSettings = useNavigateSettings();
const [isFetchingMore, setIsFetchingMore] = useState(false);
const [searchFilter, setSearchFilter] = useState('');
diff --git a/packages/twenty-front/src/pages/settings/security/event-logs/components/EventLogResultsTable.tsx b/packages/twenty-front/src/pages/settings/security/event-logs/components/EventLogResultsTable.tsx
index 4f8292ef1c4..7c04cfd3094 100644
--- a/packages/twenty-front/src/pages/settings/security/event-logs/components/EventLogResultsTable.tsx
+++ b/packages/twenty-front/src/pages/settings/security/event-logs/components/EventLogResultsTable.tsx
@@ -11,8 +11,7 @@ import { TableHeader } from '@/ui/layout/table/components/TableHeader';
import { TableRow } from '@/ui/layout/table/components/TableRow';
import { ScrollWrapper } from '@/ui/utilities/scroll/components/ScrollWrapper';
import { useScrollWrapperHTMLElement } from '@/ui/utilities/scroll/hooks/useScrollWrapperHTMLElement';
-import { ThemeContext } from 'twenty-ui/theme';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { beautifyPastDateRelativeToNow } from '~/utils/date-utils';
import { type MessageDescriptor } from '@lingui/core';
@@ -175,8 +174,8 @@ export const EventLogResultsTable = ({
onLoadMore,
selectedTable,
}: EventLogResultsTableProps) => {
- const { t } = useLingui();
const { theme } = useContext(ThemeContext);
+ const { t } = useLingui();
const showObjectEventColumns = selectedTable === EventLogTable.OBJECT_EVENT;
const baseColumns = showObjectEventColumns
diff --git a/packages/twenty-front/src/pages/settings/updates/SettingsUpdates.tsx b/packages/twenty-front/src/pages/settings/updates/SettingsUpdates.tsx
index a5d0ce80b11..07f6475a187 100644
--- a/packages/twenty-front/src/pages/settings/updates/SettingsUpdates.tsx
+++ b/packages/twenty-front/src/pages/settings/updates/SettingsUpdates.tsx
@@ -4,20 +4,18 @@ import { SettingsLabContent } from '@/settings/lab/components/SettingsLabContent
import { SubMenuTopBarContainer } from '@/ui/layout/page/components/SubMenuTopBarContainer';
import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
-import { useContext } from 'react';
import { SettingsPath } from 'twenty-shared/types';
import { getSettingsPath } from 'twenty-shared/utils';
import { H2Title, IconTransform } from 'twenty-ui/display';
import { Section } from 'twenty-ui/layout';
-import { ThemeContext } from 'twenty-ui/theme';
-
+import { useContext } from 'react';
+import { ThemeContext } from 'twenty-ui/theme-constants';
const StyledCardLink = styled.a`
text-decoration: none;
`;
export const SettingsUpdates = () => {
const { theme } = useContext(ThemeContext);
-
return (
<SubMenuTopBarContainer
title={t`Updates`}
diff --git a/packages/twenty-front/src/testing/mock-data/generated/metadata/api-keys/mock-api-keys-data.ts b/packages/twenty-front/src/testing/mock-data/generated/metadata/api-keys/mock-api-keys-data.ts
index 8b4452c9f8d..34d567f6ba1 100644
--- a/packages/twenty-front/src/testing/mock-data/generated/metadata/api-keys/mock-api-keys-data.ts
+++ b/packages/twenty-front/src/testing/mock-data/generated/metadata/api-keys/mock-api-keys-data.ts
@@ -1,7 +1,6 @@
/* eslint-disable */
// @ts-nocheck
-
// This file was automatically generated — do not edit manually.
// prettier-ignore
diff --git a/packages/twenty-sdk/.storybook/preview.tsx b/packages/twenty-sdk/.storybook/preview.tsx
index acfa65702f1..251bd8a638a 100644
--- a/packages/twenty-sdk/.storybook/preview.tsx
+++ b/packages/twenty-sdk/.storybook/preview.tsx
@@ -1,22 +1,17 @@
import { type Preview } from '@storybook/react-vite';
-import { THEME_LIGHT, ThemeContextProvider } from 'twenty-ui/theme';
+import { ThemeProvider } from 'twenty-ui/theme-constants';
const preview: Preview = {
tags: ['autodocs'],
decorators: [
(Story) => {
- const theme = THEME_LIGHT;
-
return (
- <ThemeContextProvider theme={theme}>
+ <ThemeProvider colorScheme="light">
<Story />
- </ThemeContextProvider>
+ </ThemeProvider>
);
},
],
- args: {
- theme: THEME_LIGHT,
- },
};
export default preview;
diff --git a/packages/twenty-sdk/src/front-component-renderer/__stories__/example-sources/twenty-ui-example.front-component.tsx b/packages/twenty-sdk/src/front-component-renderer/__stories__/example-sources/twenty-ui-example.front-component.tsx
index 54a4646459d..235fc66266a 100644
--- a/packages/twenty-sdk/src/front-component-renderer/__stories__/example-sources/twenty-ui-example.front-component.tsx
+++ b/packages/twenty-sdk/src/front-component-renderer/__stories__/example-sources/twenty-ui-example.front-component.tsx
@@ -7,7 +7,6 @@ import {
H2Title,
Status,
Tag,
- THEME_LIGHT,
ThemeProvider,
} from 'twenty-sdk/ui';
@@ -34,7 +33,7 @@ const TwentyUiComponent = () => {
const [count, setCount] = useState(0);
return (
- <ThemeProvider theme={THEME_LIGHT}>
+ <ThemeProvider colorScheme="light">
<div data-testid="twenty-ui-component" style={CARD_STYLE}>
<H2Title
title="Twenty UI"
diff --git a/packages/twenty-sdk/src/front-component-renderer/host/components/FrontComponentRenderer.tsx b/packages/twenty-sdk/src/front-component-renderer/host/components/FrontComponentRenderer.tsx
index 3ea32f9ecee..b2ad4dfa2dd 100644
--- a/packages/twenty-sdk/src/front-component-renderer/host/components/FrontComponentRenderer.tsx
+++ b/packages/twenty-sdk/src/front-component-renderer/host/components/FrontComponentRenderer.tsx
@@ -12,7 +12,7 @@ import {
import { useMemo, useState } from 'react';
import { isDefined } from 'twenty-shared/utils';
-import { type ThemeType, ThemeContextProvider } from 'twenty-ui/theme';
+import { ThemeProvider } from 'twenty-ui/theme-constants';
import { FrontComponentWorkerEffect } from '../../remote/components/FrontComponentWorkerEffect';
import { componentRegistry } from '../generated/host-component-registry';
@@ -23,7 +23,7 @@ type FrontComponentContentProps = {
executionContext: FrontComponentExecutionContext;
frontComponentHostCommunicationApi: FrontComponentHostCommunicationApi;
onError: (error?: Error) => void;
- theme: ThemeType;
+ colorScheme: 'light' | 'dark';
};
export const FrontComponentRenderer = ({
@@ -33,7 +33,7 @@ export const FrontComponentRenderer = ({
executionContext,
frontComponentHostCommunicationApi,
onError,
- theme,
+ colorScheme,
}: FrontComponentContentProps) => {
const [receiver, setReceiver] = useState<RemoteReceiver | null>(null);
const [thread, setThread] = useState<ThreadWebWorker<
@@ -109,12 +109,12 @@ export const FrontComponentRenderer = ({
)}
{isDefined(receiver) && isExecutionContextInitialized && (
- <ThemeContextProvider theme={theme}>
+ <ThemeProvider colorScheme={colorScheme}>
<RemoteRootRenderer
receiver={receiver}
components={componentRegistry}
/>
- </ThemeContextProvider>
+ </ThemeProvider>
)}
</>
);
diff --git a/packages/twenty-sdk/src/ui/index.ts b/packages/twenty-sdk/src/ui/index.ts
index d35fd14e730..2882256cc6b 100644
--- a/packages/twenty-sdk/src/ui/index.ts
+++ b/packages/twenty-sdk/src/ui/index.ts
@@ -7,5 +7,5 @@ export * from 'twenty-ui/input';
export * from 'twenty-ui/json-visualizer';
export * from 'twenty-ui/layout';
export * from 'twenty-ui/navigation';
-export * from 'twenty-ui/theme';
+export * from 'twenty-ui/theme-constants';
export * from 'twenty-ui/utilities';
diff --git a/packages/twenty-shared/src/utils/filter/__tests__/turnRecordFilterGroupIntoGqlOperationFilter.test.ts b/packages/twenty-shared/src/utils/filter/__tests__/turnRecordFilterGroupIntoGqlOperationFilter.test.ts
index a2d4c77fd1b..8f43880e8c1 100644
--- a/packages/twenty-shared/src/utils/filter/__tests__/turnRecordFilterGroupIntoGqlOperationFilter.test.ts
+++ b/packages/twenty-shared/src/utils/filter/__tests__/turnRecordFilterGroupIntoGqlOperationFilter.test.ts
@@ -38,7 +38,6 @@ describe('turnRecordFilterGroupsIntoGqlOperationFilter', () => {
filterValueDependencies: {},
filters: [
{
- id: 'filter1',
fieldMetadataId: 'f1',
value: 'test',
type: 'TEXT',
@@ -64,7 +63,6 @@ describe('turnRecordFilterGroupsIntoGqlOperationFilter', () => {
filterValueDependencies: {},
filters: [
{
- id: 'filter1',
fieldMetadataId: 'f1',
value: 'test',
type: 'TEXT',
@@ -90,7 +88,6 @@ describe('turnRecordFilterGroupsIntoGqlOperationFilter', () => {
filterValueDependencies: {},
filters: [
{
- id: 'filter1',
fieldMetadataId: 'f1',
value: 'test',
type: 'TEXT',
diff --git a/packages/twenty-ui/.storybook/preview.tsx b/packages/twenty-ui/.storybook/preview.tsx
index ce885f37912..bee0d0f8b96 100644
--- a/packages/twenty-ui/.storybook/preview.tsx
+++ b/packages/twenty-ui/.storybook/preview.tsx
@@ -1,16 +1,16 @@
import { type Preview } from '@storybook/react-vite';
-import { THEME_LIGHT, ThemeContextProvider } from '@ui/theme';
+import '@ui/theme-constants/theme-light.css';
+import '@ui/theme-constants/theme-dark.css';
+import { ThemeProvider } from '@ui/theme-constants';
const preview: Preview = {
tags: ['autodocs'],
decorators: [
(Story) => {
- const theme = THEME_LIGHT;
-
return (
- <ThemeContextProvider theme={theme}>
+ <ThemeProvider colorScheme="light">
<Story />
- </ThemeContextProvider>
+ </ThemeProvider>
);
},
],
diff --git a/packages/twenty-ui/src/components/avatar-or-icon/AvatarOrIcon.tsx b/packages/twenty-ui/src/components/avatar-or-icon/AvatarOrIcon.tsx
index b12baff5561..ca12c2ac158 100644
--- a/packages/twenty-ui/src/components/avatar-or-icon/AvatarOrIcon.tsx
+++ b/packages/twenty-ui/src/components/avatar-or-icon/AvatarOrIcon.tsx
@@ -2,9 +2,9 @@ import { styled } from '@linaria/react';
import { Avatar } from '@ui/display/avatar/components/Avatar';
import { type AvatarType } from '@ui/display/avatar/types/AvatarType';
import { type IconComponent } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
-import { type Nullable } from '@ui/utilities';
+import { ThemeContext } from '@ui/theme-constants';
import { useContext } from 'react';
+import { type Nullable } from '@ui/utilities';
import { isDefined } from 'twenty-shared/utils';
const StyledIconWithBackgroundContainer = styled.div<{
@@ -50,6 +50,7 @@ export const AvatarOrIcon = ({
onClick,
}: AvatarOrIconProps) => {
const { theme } = useContext(ThemeContext);
+
if (!isDefined(Icon)) {
return (
<Avatar
diff --git a/packages/twenty-ui/src/components/tag/Tag.tsx b/packages/twenty-ui/src/components/tag/Tag.tsx
index c93bfb5cbf1..33c9da9ef44 100644
--- a/packages/twenty-ui/src/components/tag/Tag.tsx
+++ b/packages/twenty-ui/src/components/tag/Tag.tsx
@@ -1,11 +1,11 @@
import { styled } from '@linaria/react';
-import { useContext } from 'react';
import { type IconComponent } from '@ui/display/icon/types/IconComponent';
import { OverflowingTextWithTooltip } from '@ui/display/tooltip/OverflowingTextWithTooltip';
-import { type ThemeColor, ThemeContext } from '@ui/theme';
-import { themeCssVariables } from '@ui/theme-constants';
import { isDefined } from 'twenty-shared/utils';
+import { type ThemeColor } from '@ui/theme';
+import { ThemeContext, themeCssVariables } from '@ui/theme-constants';
+import { useContext } from 'react';
const StyledTag = styled.h3<{
color: TagColor;
diff --git a/packages/twenty-ui/src/components/tag/__stories__/Tag.stories.tsx b/packages/twenty-ui/src/components/tag/__stories__/Tag.stories.tsx
index 60bfde262b3..9609a821f5b 100644
--- a/packages/twenty-ui/src/components/tag/__stories__/Tag.stories.tsx
+++ b/packages/twenty-ui/src/components/tag/__stories__/Tag.stories.tsx
@@ -7,7 +7,7 @@ import {
type CatalogStory,
ComponentDecorator,
} from '@ui/testing';
-import { MAIN_COLOR_NAMES, type ThemeColor } from '@ui/theme';
+import { type ThemeColor, MAIN_COLOR_NAMES } from '@ui/theme';
import { Tag } from '../Tag';
diff --git a/packages/twenty-ui/src/display/avatar/components/Avatar.tsx b/packages/twenty-ui/src/display/avatar/components/Avatar.tsx
index 3e5c4862176..b93203bf522 100644
--- a/packages/twenty-ui/src/display/avatar/components/Avatar.tsx
+++ b/packages/twenty-ui/src/display/avatar/components/Avatar.tsx
@@ -8,7 +8,7 @@ import { AVATAR_PROPERTIES_BY_SIZE } from '@ui/display/avatar/constants/AvatarPr
import { type AvatarSize } from '@ui/display/avatar/types/AvatarSize';
import { type AvatarType } from '@ui/display/avatar/types/AvatarType';
import { type IconComponent } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
import { stringToThemeColorP3String } from '@ui/utilities';
import { REACT_APP_SERVER_BASE_URL } from '@ui/utilities/config';
import { type Nullable } from 'twenty-shared/types';
@@ -85,6 +85,7 @@ export const Avatar = ({
backgroundColor,
}: AvatarProps) => {
const { theme } = useContext(ThemeContext);
+
const [invalidAvatarUrls, setInvalidAvatarUrls] = useAtom(
invalidAvatarUrlsAtomV2,
);
@@ -115,16 +116,16 @@ export const Avatar = ({
: (color ??
stringToThemeColorP3String({
string: placeholderColorSeed ?? '',
- theme,
variant: 12,
+ theme,
}));
const fixedBackgroundColor = isPlaceholderFirstCharEmpty
? theme.background.transparent.light
: (backgroundColor ??
stringToThemeColorP3String({
string: placeholderColorSeed ?? '',
- theme,
variant: 4,
+ theme,
}));
const showBackgroundColor = showPlaceholder;
@@ -148,7 +149,7 @@ export const Avatar = ({
size={theme.icon.size.xl}
/>
) : showPlaceholder ? (
- <StyledPlaceholderChar fontWeight={theme.font.weight.medium}>
+ <StyledPlaceholderChar fontWeight={500}>
{placeholderChar}
</StyledPlaceholderChar>
) : (
diff --git a/packages/twenty-ui/src/display/checkmark/components/AnimatedCheckmark.tsx b/packages/twenty-ui/src/display/checkmark/components/AnimatedCheckmark.tsx
index 72011e93bdc..4a1faa110c5 100644
--- a/packages/twenty-ui/src/display/checkmark/components/AnimatedCheckmark.tsx
+++ b/packages/twenty-ui/src/display/checkmark/components/AnimatedCheckmark.tsx
@@ -1,6 +1,6 @@
-import { useContext } from 'react';
import { motion } from 'framer-motion';
-import { ThemeContext } from '@ui/theme';
+import { useContext } from 'react';
+import { ThemeContext } from '@ui/theme-constants';
export type AnimatedCheckmarkProps = React.ComponentProps<
typeof motion.path
@@ -18,6 +18,7 @@ export const AnimatedCheckmark = ({
size = 28,
}: AnimatedCheckmarkProps) => {
const { theme } = useContext(ThemeContext);
+
return (
<svg
xmlns="http://www.w3.org/2000/svg"
diff --git a/packages/twenty-ui/src/display/checkmark/components/Checkmark.tsx b/packages/twenty-ui/src/display/checkmark/components/Checkmark.tsx
index 68cc37b0bac..78f420f37e8 100644
--- a/packages/twenty-ui/src/display/checkmark/components/Checkmark.tsx
+++ b/packages/twenty-ui/src/display/checkmark/components/Checkmark.tsx
@@ -3,8 +3,7 @@ import React, { useContext } from 'react';
import { styled } from '@linaria/react';
import { IconCheck } from '@ui/display/icon/components/TablerIcons';
-import { ThemeContext } from '@ui/theme';
-import { themeCssVariables } from '@ui/theme-constants';
+import { ThemeContext, themeCssVariables } from '@ui/theme-constants';
const StyledContainer = styled.div`
align-items: center;
diff --git a/packages/twenty-ui/src/display/color/components/ColorSample.tsx b/packages/twenty-ui/src/display/color/components/ColorSample.tsx
index d8dead77c96..9c03fdce810 100644
--- a/packages/twenty-ui/src/display/color/components/ColorSample.tsx
+++ b/packages/twenty-ui/src/display/color/components/ColorSample.tsx
@@ -1,8 +1,8 @@
import { styled } from '@linaria/react';
+import { isDefined } from 'twenty-shared/utils';
import { type ThemeColor } from '@ui/theme';
import { themeCssVariables } from '@ui/theme-constants';
-import { isDefined } from 'twenty-shared/utils';
export type ColorSampleVariant = 'default' | 'pipeline';
diff --git a/packages/twenty-ui/src/display/icon/components/IconAddressBook.tsx b/packages/twenty-ui/src/display/icon/components/IconAddressBook.tsx
index a4b54e30606..78759ab0a5a 100644
--- a/packages/twenty-ui/src/display/icon/components/IconAddressBook.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IconAddressBook.tsx
@@ -1,7 +1,8 @@
-import IconAddressBookRaw from '@assets/icons/address-book.svg?react';
import { useContext } from 'react';
+
+import IconAddressBookRaw from '@assets/icons/address-book.svg?react';
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
type IconAddressBookProps = Pick<
IconComponentProps,
diff --git a/packages/twenty-ui/src/display/icon/components/IconBrandAnthropic.tsx b/packages/twenty-ui/src/display/icon/components/IconBrandAnthropic.tsx
index a953287ea32..182f94bde68 100644
--- a/packages/twenty-ui/src/display/icon/components/IconBrandAnthropic.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IconBrandAnthropic.tsx
@@ -2,7 +2,7 @@ import { useContext } from 'react';
import IconAnthropicRaw from '@assets/icons/anthropic.svg?react';
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
type IconBrandAnthropicProps = Pick<IconComponentProps, 'size' | 'color'>;
diff --git a/packages/twenty-ui/src/display/icon/components/IconBrandGroq.tsx b/packages/twenty-ui/src/display/icon/components/IconBrandGroq.tsx
index 5c059c4d480..98731b6e7ae 100644
--- a/packages/twenty-ui/src/display/icon/components/IconBrandGroq.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IconBrandGroq.tsx
@@ -2,7 +2,7 @@ import { useContext } from 'react';
import IconBrandGroqRaw from '@assets/icons/groq.svg?react';
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
type IconBrandGroqProps = Pick<IconComponentProps, 'size' | 'color'>;
diff --git a/packages/twenty-ui/src/display/icon/components/IconBrandMistral.tsx b/packages/twenty-ui/src/display/icon/components/IconBrandMistral.tsx
index 0f15d51287e..a05c53967bd 100644
--- a/packages/twenty-ui/src/display/icon/components/IconBrandMistral.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IconBrandMistral.tsx
@@ -2,7 +2,7 @@ import { useContext } from 'react';
import IconBrandMistralRaw from '@assets/icons/mistral.svg?react';
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
type IconBrandMistralProps = Pick<IconComponentProps, 'size' | 'color'>;
diff --git a/packages/twenty-ui/src/display/icon/components/IconBrandXai.tsx b/packages/twenty-ui/src/display/icon/components/IconBrandXai.tsx
index 283ade6ca18..d0d1a7ab29a 100644
--- a/packages/twenty-ui/src/display/icon/components/IconBrandXai.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IconBrandXai.tsx
@@ -2,7 +2,7 @@ import { useContext } from 'react';
import IconBrandXaiRaw from '@assets/icons/xai.svg?react';
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
type IconBrandXaiProps = Pick<IconComponentProps, 'size' | 'color'>;
diff --git a/packages/twenty-ui/src/display/icon/components/IconChartBarHorizontal.tsx b/packages/twenty-ui/src/display/icon/components/IconChartBarHorizontal.tsx
index 32e293c185b..f589ac03fb5 100644
--- a/packages/twenty-ui/src/display/icon/components/IconChartBarHorizontal.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IconChartBarHorizontal.tsx
@@ -4,7 +4,7 @@ import { styled } from '@linaria/react';
import { IconChartBar } from '@ui/display/icon/components/TablerIcons';
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
const StyledRotatedIconWrapper = styled.div`
display: inline-flex;
diff --git a/packages/twenty-ui/src/display/icon/components/IconGmail.tsx b/packages/twenty-ui/src/display/icon/components/IconGmail.tsx
index b42c619324d..961fc5d6887 100644
--- a/packages/twenty-ui/src/display/icon/components/IconGmail.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IconGmail.tsx
@@ -2,7 +2,7 @@ import { useContext } from 'react';
import IconGmailRaw from '@assets/icons/gmail.svg?react';
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
type IconGmailProps = Pick<IconComponentProps, 'size'>;
diff --git a/packages/twenty-ui/src/display/icon/components/IconGoogle.tsx b/packages/twenty-ui/src/display/icon/components/IconGoogle.tsx
index cf8b30176da..4ae7dac95e6 100644
--- a/packages/twenty-ui/src/display/icon/components/IconGoogle.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IconGoogle.tsx
@@ -2,7 +2,7 @@ import { useContext } from 'react';
import IconGoogleRaw from '@assets/icons/google.svg?react';
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
type IconGoogleProps = Pick<IconComponentProps, 'size'>;
diff --git a/packages/twenty-ui/src/display/icon/components/IconGoogleCalendar.tsx b/packages/twenty-ui/src/display/icon/components/IconGoogleCalendar.tsx
index 70a8e200b83..1db26ddec96 100644
--- a/packages/twenty-ui/src/display/icon/components/IconGoogleCalendar.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IconGoogleCalendar.tsx
@@ -2,7 +2,7 @@ import { useContext } from 'react';
import IconGoogleCalendarRaw from '@assets/icons/google-calendar.svg?react';
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
type IconGoogleCalendarProps = Pick<IconComponentProps, 'size'>;
diff --git a/packages/twenty-ui/src/display/icon/components/IconLock.tsx b/packages/twenty-ui/src/display/icon/components/IconLock.tsx
index f8e8563d094..31652800660 100644
--- a/packages/twenty-ui/src/display/icon/components/IconLock.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IconLock.tsx
@@ -2,7 +2,7 @@ import { useContext } from 'react';
import IconLockRaw from '@assets/icons/lock.svg?react';
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
type IconLockCustomProps = Pick<IconComponentProps, 'size'>;
diff --git a/packages/twenty-ui/src/display/icon/components/IconMicrosoft.tsx b/packages/twenty-ui/src/display/icon/components/IconMicrosoft.tsx
index 7d4d92a40ed..5bc803f4938 100644
--- a/packages/twenty-ui/src/display/icon/components/IconMicrosoft.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IconMicrosoft.tsx
@@ -1,7 +1,7 @@
import { useContext } from 'react';
import IconMicrosoftRaw from '@assets/icons/microsoft.svg?react';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
interface IconMicrosoftProps {
size?: number | string;
diff --git a/packages/twenty-ui/src/display/icon/components/IconMicrosoftCalendar.tsx b/packages/twenty-ui/src/display/icon/components/IconMicrosoftCalendar.tsx
index 60d0e656c8f..894fbebfda4 100644
--- a/packages/twenty-ui/src/display/icon/components/IconMicrosoftCalendar.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IconMicrosoftCalendar.tsx
@@ -1,7 +1,7 @@
import { useContext } from 'react';
import IconMicrosoftCalendarRaw from '@assets/icons/microsoft-calendar.svg?react';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
interface IconMicrosoftCalendarProps {
size?: number | string;
diff --git a/packages/twenty-ui/src/display/icon/components/IconMicrosoftOutlook.tsx b/packages/twenty-ui/src/display/icon/components/IconMicrosoftOutlook.tsx
index aaaa48ab0c7..4e04adac43d 100644
--- a/packages/twenty-ui/src/display/icon/components/IconMicrosoftOutlook.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IconMicrosoftOutlook.tsx
@@ -1,7 +1,7 @@
import { useContext } from 'react';
import IconMicrosoftOutlookRaw from '@assets/icons/microsoft-outlook.svg?react';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
interface IconMicrosoftOutlookProps {
size?: number | string;
diff --git a/packages/twenty-ui/src/display/icon/components/IconRelationManyToOne.tsx b/packages/twenty-ui/src/display/icon/components/IconRelationManyToOne.tsx
index 808305a748b..0f207941812 100644
--- a/packages/twenty-ui/src/display/icon/components/IconRelationManyToOne.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IconRelationManyToOne.tsx
@@ -2,7 +2,7 @@ import { useContext } from 'react';
import IconRelationManyToOneRaw from '@assets/icons/many-to-one.svg?react';
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
type IconRelationManyToOneProps = Pick<IconComponentProps, 'size' | 'stroke'>;
diff --git a/packages/twenty-ui/src/display/icon/components/IconTrashXOff.tsx b/packages/twenty-ui/src/display/icon/components/IconTrashXOff.tsx
index b5f5dbe50a6..2d5aedfb5e2 100644
--- a/packages/twenty-ui/src/display/icon/components/IconTrashXOff.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IconTrashXOff.tsx
@@ -2,7 +2,7 @@ import { useContext } from 'react';
import IconTrashXOffRaw from '@assets/icons/trash-x-off.svg?react';
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
type IconTrashXOffProps = Pick<IconComponentProps, 'size' | 'stroke'>;
diff --git a/packages/twenty-ui/src/display/icon/components/IconTwentyStar.tsx b/packages/twenty-ui/src/display/icon/components/IconTwentyStar.tsx
index b763b5b684f..7309bb0c2ca 100644
--- a/packages/twenty-ui/src/display/icon/components/IconTwentyStar.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IconTwentyStar.tsx
@@ -2,7 +2,7 @@ import { useContext } from 'react';
import IconTwentyStarRaw from '@assets/icons/twenty-star.svg?react';
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
type IconTwentyStarProps = Pick<IconComponentProps, 'size' | 'stroke'>;
diff --git a/packages/twenty-ui/src/display/icon/components/IconTwentyStarFilled.tsx b/packages/twenty-ui/src/display/icon/components/IconTwentyStarFilled.tsx
index 98f0154be7f..051c98fffb1 100644
--- a/packages/twenty-ui/src/display/icon/components/IconTwentyStarFilled.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IconTwentyStarFilled.tsx
@@ -1,14 +1,15 @@
+import { useContext } from 'react';
+
import IconTwentyStarFilledRaw from '@assets/icons/twenty-star-filled.svg?react';
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
-import { THEME_COMMON } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
type IconTwentyStarFilledProps = Pick<IconComponentProps, 'size' | 'stroke'>;
-const iconStrokeMd = THEME_COMMON.icon.stroke.md;
-
export const IconTwentyStarFilled = (props: IconTwentyStarFilledProps) => {
+ const { theme } = useContext(ThemeContext);
const size = props.size ?? 24;
- const stroke = props.stroke ?? iconStrokeMd;
+ const stroke = props.stroke ?? theme.icon.stroke.md;
return (
<IconTwentyStarFilledRaw height={size} width={size} strokeWidth={stroke} />
diff --git a/packages/twenty-ui/src/display/icon/components/IllustrationIconArray.tsx b/packages/twenty-ui/src/display/icon/components/IllustrationIconArray.tsx
index 9c8d1d1bf93..17cf7c48a44 100644
--- a/packages/twenty-ui/src/display/icon/components/IllustrationIconArray.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IllustrationIconArray.tsx
@@ -1,8 +1,10 @@
-import IllustrationIconArrayRaw from '@assets/icons/illustration-array.svg?react';
import { useContext } from 'react';
+
+import IllustrationIconArrayRaw from '@assets/icons/illustration-array.svg?react';
import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
+
type IllustrationIconArrayProps = Pick<IconComponentProps, 'size'>;
export const IllustrationIconArray = (props: IllustrationIconArrayProps) => {
diff --git a/packages/twenty-ui/src/display/icon/components/IllustrationIconCalendarEvent.tsx b/packages/twenty-ui/src/display/icon/components/IllustrationIconCalendarEvent.tsx
index 14e91b5f134..f6220899257 100644
--- a/packages/twenty-ui/src/display/icon/components/IllustrationIconCalendarEvent.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IllustrationIconCalendarEvent.tsx
@@ -1,8 +1,10 @@
-import IllustrationIconCalendarEventRaw from '@assets/icons/illustration-calendar-event.svg?react';
import { useContext } from 'react';
+
+import IllustrationIconCalendarEventRaw from '@assets/icons/illustration-calendar-event.svg?react';
import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
+
type IllustrationIconCalendarEventProps = Pick<IconComponentProps, 'size'>;
export const IllustrationIconCalendarEvent = (
diff --git a/packages/twenty-ui/src/display/icon/components/IllustrationIconCalendarTime.tsx b/packages/twenty-ui/src/display/icon/components/IllustrationIconCalendarTime.tsx
index f9c6edf5af2..8027cb5048b 100644
--- a/packages/twenty-ui/src/display/icon/components/IllustrationIconCalendarTime.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IllustrationIconCalendarTime.tsx
@@ -1,8 +1,9 @@
-import IllustrationIconCalendarTimeRaw from '@assets/icons/illustration-calendar-time.svg?react';
import { useContext } from 'react';
+
+import IllustrationIconCalendarTimeRaw from '@assets/icons/illustration-calendar-time.svg?react';
import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
type IllustrationIconCalendarTimeProps = Pick<IconComponentProps, 'size'>;
diff --git a/packages/twenty-ui/src/display/icon/components/IllustrationIconCurrency.tsx b/packages/twenty-ui/src/display/icon/components/IllustrationIconCurrency.tsx
index 19253394914..0a0ef60343f 100644
--- a/packages/twenty-ui/src/display/icon/components/IllustrationIconCurrency.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IllustrationIconCurrency.tsx
@@ -1,9 +1,9 @@
import { useContext } from 'react';
-import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import IllustrationIconCurrencyRaw from '@assets/icons/illustration-currency.svg?react';
+import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
type IllustrationIconCurrencyProps = Pick<IconComponentProps, 'size'>;
diff --git a/packages/twenty-ui/src/display/icon/components/IllustrationIconFile.tsx b/packages/twenty-ui/src/display/icon/components/IllustrationIconFile.tsx
index f2b880b2e91..94be18214b6 100644
--- a/packages/twenty-ui/src/display/icon/components/IllustrationIconFile.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IllustrationIconFile.tsx
@@ -1,9 +1,9 @@
import { useContext } from 'react';
-import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import IllustrationIconFileRaw from '@assets/icons/illustration-file.svg?react';
+import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
type IllustrationIconFileProps = Pick<IconComponentProps, 'size'>;
diff --git a/packages/twenty-ui/src/display/icon/components/IllustrationIconJson.tsx b/packages/twenty-ui/src/display/icon/components/IllustrationIconJson.tsx
index bf147d2b137..c521ba4c8c4 100644
--- a/packages/twenty-ui/src/display/icon/components/IllustrationIconJson.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IllustrationIconJson.tsx
@@ -1,9 +1,9 @@
import { useContext } from 'react';
-import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import IllustrationIconJsonRaw from '@assets/icons/illustration-json.svg?react';
+import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
type IllustrationIconJsonProps = Pick<IconComponentProps, 'size'>;
diff --git a/packages/twenty-ui/src/display/icon/components/IllustrationIconLink.tsx b/packages/twenty-ui/src/display/icon/components/IllustrationIconLink.tsx
index 799cd3d8dfe..afaa9b1983a 100644
--- a/packages/twenty-ui/src/display/icon/components/IllustrationIconLink.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IllustrationIconLink.tsx
@@ -1,9 +1,9 @@
import { useContext } from 'react';
-import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import IllustrationIconLinkRaw from '@assets/icons/illustration-link.svg?react';
+import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
type IllustrationIconLinkProps = Pick<IconComponentProps, 'size'>;
diff --git a/packages/twenty-ui/src/display/icon/components/IllustrationIconMail.tsx b/packages/twenty-ui/src/display/icon/components/IllustrationIconMail.tsx
index 8925466e958..95f9ee133e8 100644
--- a/packages/twenty-ui/src/display/icon/components/IllustrationIconMail.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IllustrationIconMail.tsx
@@ -1,8 +1,9 @@
-import IllustrationIconMailRaw from '@assets/icons/illustration-mail.svg?react';
import { useContext } from 'react';
+
+import IllustrationIconMailRaw from '@assets/icons/illustration-mail.svg?react';
import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
type IllustrationIconMailProps = Pick<IconComponentProps, 'size'>;
diff --git a/packages/twenty-ui/src/display/icon/components/IllustrationIconManyToMany.tsx b/packages/twenty-ui/src/display/icon/components/IllustrationIconManyToMany.tsx
index e1ce8101d38..0fd8370f859 100644
--- a/packages/twenty-ui/src/display/icon/components/IllustrationIconManyToMany.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IllustrationIconManyToMany.tsx
@@ -1,8 +1,9 @@
-import IllustrationIconManyToManyRaw from '@assets/icons/illustration-many-to-many.svg?react';
import { useContext } from 'react';
+
+import IllustrationIconManyToManyRaw from '@assets/icons/illustration-many-to-many.svg?react';
import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
type IllustrationIconManyToManyProps = Pick<IconComponentProps, 'size'>;
diff --git a/packages/twenty-ui/src/display/icon/components/IllustrationIconMap.tsx b/packages/twenty-ui/src/display/icon/components/IllustrationIconMap.tsx
index 3c1018ca495..484ce4cd47b 100644
--- a/packages/twenty-ui/src/display/icon/components/IllustrationIconMap.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IllustrationIconMap.tsx
@@ -1,8 +1,9 @@
-import IllustrationIconMapRaw from '@assets/icons/illustration-map.svg?react';
import { useContext } from 'react';
+
+import IllustrationIconMapRaw from '@assets/icons/illustration-map.svg?react';
import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
type IllustrationIconMapProps = Pick<IconComponentProps, 'size'>;
diff --git a/packages/twenty-ui/src/display/icon/components/IllustrationIconNumbers.tsx b/packages/twenty-ui/src/display/icon/components/IllustrationIconNumbers.tsx
index 19bd1ebbd03..0ac70a09fe9 100644
--- a/packages/twenty-ui/src/display/icon/components/IllustrationIconNumbers.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IllustrationIconNumbers.tsx
@@ -1,8 +1,9 @@
-import IllustrationIconNumbersRaw from '@assets/icons/illustration-numbers.svg?react';
import { useContext } from 'react';
+
+import IllustrationIconNumbersRaw from '@assets/icons/illustration-numbers.svg?react';
import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
type IllustrationIconNumbersProps = Pick<IconComponentProps, 'size'>;
diff --git a/packages/twenty-ui/src/display/icon/components/IllustrationIconOneToMany.tsx b/packages/twenty-ui/src/display/icon/components/IllustrationIconOneToMany.tsx
index c4e4f9204ed..7c8e50474fe 100644
--- a/packages/twenty-ui/src/display/icon/components/IllustrationIconOneToMany.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IllustrationIconOneToMany.tsx
@@ -1,9 +1,9 @@
import { useContext } from 'react';
-import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import IllustrationIconOneToManyRaw from '@assets/icons/illustration-one-to-many.svg?react';
+import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
type IllustrationIconOneToManyProps = Pick<IconComponentProps, 'size'>;
diff --git a/packages/twenty-ui/src/display/icon/components/IllustrationIconOneToOne.tsx b/packages/twenty-ui/src/display/icon/components/IllustrationIconOneToOne.tsx
index 88d810a7da1..54da40e2b23 100644
--- a/packages/twenty-ui/src/display/icon/components/IllustrationIconOneToOne.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IllustrationIconOneToOne.tsx
@@ -1,9 +1,9 @@
import { useContext } from 'react';
-import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import IllustrationIconOneToOneRaw from '@assets/icons/illustration-one-to-one.svg?react';
+import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
type IllustrationIconOneToOneProps = Pick<IconComponentProps, 'size'>;
diff --git a/packages/twenty-ui/src/display/icon/components/IllustrationIconPhone.tsx b/packages/twenty-ui/src/display/icon/components/IllustrationIconPhone.tsx
index 84845786da3..e06371bb9a8 100644
--- a/packages/twenty-ui/src/display/icon/components/IllustrationIconPhone.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IllustrationIconPhone.tsx
@@ -1,9 +1,9 @@
import { useContext } from 'react';
-import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import IllustrationIconPhoneRaw from '@assets/icons/illustration-phone.svg?react';
+import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
type IllustrationIconPhoneProps = Pick<IconComponentProps, 'size'>;
diff --git a/packages/twenty-ui/src/display/icon/components/IllustrationIconSetting.tsx b/packages/twenty-ui/src/display/icon/components/IllustrationIconSetting.tsx
index 30acb88824c..10c96b0e6dd 100644
--- a/packages/twenty-ui/src/display/icon/components/IllustrationIconSetting.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IllustrationIconSetting.tsx
@@ -1,9 +1,9 @@
import { useContext } from 'react';
-import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import IllustrationIconSettingRaw from '@assets/icons/illustration-setting.svg?react';
+import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
type IllustrationIconSettingProps = Pick<IconComponentProps, 'size'>;
diff --git a/packages/twenty-ui/src/display/icon/components/IllustrationIconStar.tsx b/packages/twenty-ui/src/display/icon/components/IllustrationIconStar.tsx
index f610a32c0fb..e8c662c27fe 100644
--- a/packages/twenty-ui/src/display/icon/components/IllustrationIconStar.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IllustrationIconStar.tsx
@@ -1,9 +1,9 @@
import { useContext } from 'react';
-import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import IllustrationIconStarRaw from '@assets/icons/illustration-star.svg?react';
+import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
type IllustrationIconStarProps = Pick<IconComponentProps, 'size'>;
diff --git a/packages/twenty-ui/src/display/icon/components/IllustrationIconTag.tsx b/packages/twenty-ui/src/display/icon/components/IllustrationIconTag.tsx
index b2a85b29d62..a45034ed09e 100644
--- a/packages/twenty-ui/src/display/icon/components/IllustrationIconTag.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IllustrationIconTag.tsx
@@ -1,9 +1,9 @@
import { useContext } from 'react';
-import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import IllustrationIconTagRaw from '@assets/icons/illustration-tag.svg?react';
+import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
type IllustrationIconTagProps = Pick<IconComponentProps, 'size'>;
diff --git a/packages/twenty-ui/src/display/icon/components/IllustrationIconTags.tsx b/packages/twenty-ui/src/display/icon/components/IllustrationIconTags.tsx
index 59e9f7ba260..667a8127408 100644
--- a/packages/twenty-ui/src/display/icon/components/IllustrationIconTags.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IllustrationIconTags.tsx
@@ -1,9 +1,9 @@
import { useContext } from 'react';
-import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import IllustrationIconTagsRaw from '@assets/icons/illustration-tags.svg?react';
+import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
type IllustrationIconTagsProps = Pick<IconComponentProps, 'size'>;
diff --git a/packages/twenty-ui/src/display/icon/components/IllustrationIconText.tsx b/packages/twenty-ui/src/display/icon/components/IllustrationIconText.tsx
index bff5af5b3ee..9544e42ab65 100644
--- a/packages/twenty-ui/src/display/icon/components/IllustrationIconText.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IllustrationIconText.tsx
@@ -1,9 +1,9 @@
import { useContext } from 'react';
-import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import IllustrationIconTextRaw from '@assets/icons/illustration-text.svg?react';
+import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
type IllustrationIconTextProps = Pick<IconComponentProps, 'size'>;
diff --git a/packages/twenty-ui/src/display/icon/components/IllustrationIconToggle.tsx b/packages/twenty-ui/src/display/icon/components/IllustrationIconToggle.tsx
index fd0e9109da7..8dec6ec915d 100644
--- a/packages/twenty-ui/src/display/icon/components/IllustrationIconToggle.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IllustrationIconToggle.tsx
@@ -1,9 +1,9 @@
import { useContext } from 'react';
-import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import IllustrationIconToggleRaw from '@assets/icons/illustration-toggle.svg?react';
+import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
type IllustrationIconToggleProps = Pick<IconComponentProps, 'size'>;
diff --git a/packages/twenty-ui/src/display/icon/components/IllustrationIconUid.tsx b/packages/twenty-ui/src/display/icon/components/IllustrationIconUid.tsx
index ce3465195f0..6c890663025 100644
--- a/packages/twenty-ui/src/display/icon/components/IllustrationIconUid.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IllustrationIconUid.tsx
@@ -1,9 +1,9 @@
import { useContext } from 'react';
-import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import IllustrationIconUidRaw from '@assets/icons/illustration-uid.svg?react';
+import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
type IllustrationIconUidProps = Pick<IconComponentProps, 'size'>;
diff --git a/packages/twenty-ui/src/display/icon/components/IllustrationIconUser.tsx b/packages/twenty-ui/src/display/icon/components/IllustrationIconUser.tsx
index d155b0144a7..e76856f2a09 100644
--- a/packages/twenty-ui/src/display/icon/components/IllustrationIconUser.tsx
+++ b/packages/twenty-ui/src/display/icon/components/IllustrationIconUser.tsx
@@ -1,9 +1,9 @@
import { useContext } from 'react';
-import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import IllustrationIconUserRaw from '@assets/icons/illustration-user.svg?react';
+import { IllustrationIconWrapper } from '@ui/display/icon/components/IllustrationIconWrapper';
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
type IllustrationIconUserProps = Pick<IconComponentProps, 'size'>;
diff --git a/packages/twenty-ui/src/display/icon/hooks/__tests__/useIcons.test.ts b/packages/twenty-ui/src/display/icon/hooks/__tests__/useIcons.test.ts
index bd49b6047aa..f12ce151fa4 100644
--- a/packages/twenty-ui/src/display/icon/hooks/__tests__/useIcons.test.ts
+++ b/packages/twenty-ui/src/display/icon/hooks/__tests__/useIcons.test.ts
@@ -1,5 +1,5 @@
import { renderHook } from '@testing-library/react';
-import * as jotai from 'jotai';
+import { Provider } from 'jotai';
import {
Icon123,
@@ -8,17 +8,20 @@ import {
} from '@ui/display/icon/components/TablerIcons';
import { useIcons } from '@ui/display/icon/hooks/useIcons';
+const mockedStateIcons = {
+ IconUser,
+ Icon123,
+ IconBuildingSkyscraper,
+};
+
+jest.mock('jotai', () => ({
+ ...jest.requireActual('jotai'),
+ useAtomValue: () => mockedStateIcons,
+}));
+
describe('useIcons', () => {
- const mockedStateIcons = {
- IconUser,
- Icon123,
- IconBuildingSkyscraper,
- };
- jest
- .spyOn(jotai, 'useAtomValue')
- .mockImplementationOnce(() => mockedStateIcons);
const { result } = renderHook(() => useIcons(), {
- wrapper: jotai.Provider,
+ wrapper: Provider,
});
it('returns default icon when no icon key is provided', () => {
diff --git a/packages/twenty-ui/src/display/info/components/Info.tsx b/packages/twenty-ui/src/display/info/components/Info.tsx
index f2a28215eaf..2cfc84235c3 100644
--- a/packages/twenty-ui/src/display/info/components/Info.tsx
+++ b/packages/twenty-ui/src/display/info/components/Info.tsx
@@ -1,9 +1,9 @@
import { styled } from '@linaria/react';
import { IconInfoCircle } from '@ui/display/icon/components/TablerIcons';
-import { ICON_SIZES, themeCssVariables } from '@ui/theme-constants';
+import { ThemeContext, themeCssVariables } from '@ui/theme-constants';
import { Button } from '@ui/input/button/components/Button/Button';
-import React from 'react';
+import React, { useContext } from 'react';
import { Link } from 'react-router-dom';
export type InfoAccent = 'blue' | 'danger';
@@ -69,10 +69,12 @@ export const Info = ({
onClick,
to,
}: InfoProps) => {
+ const { theme } = useContext(ThemeContext);
+
return (
<StyledInfo accent={accent}>
<StyledTextContainer>
- <IconInfoCircle size={ICON_SIZES.md} />
+ <IconInfoCircle size={theme.icon.size.md} />
{text}
</StyledTextContainer>
{buttonTitle && to && (
diff --git a/packages/twenty-ui/src/display/status/components/Status.tsx b/packages/twenty-ui/src/display/status/components/Status.tsx
index aa5b44f214b..9cfb3126f3f 100644
--- a/packages/twenty-ui/src/display/status/components/Status.tsx
+++ b/packages/twenty-ui/src/display/status/components/Status.tsx
@@ -1,8 +1,7 @@
import { styled } from '@linaria/react';
-import { MAIN_COLOR_NAMES, type ThemeColor } from '@ui/theme';
-import { themeCssVariables } from '@ui/theme-constants';
-
import { Loader } from '@ui/feedback/loader/components/Loader';
+import { type ThemeColor, MAIN_COLOR_NAMES } from '@ui/theme';
+import { themeCssVariables } from '@ui/theme-constants';
const parseThemeColor = (color: string): ThemeColor =>
(MAIN_COLOR_NAMES as string[]).includes(color)
diff --git a/packages/twenty-ui/src/display/status/components/__stories__/Status.stories.tsx b/packages/twenty-ui/src/display/status/components/__stories__/Status.stories.tsx
index 75fcf6af9eb..c24a1647971 100644
--- a/packages/twenty-ui/src/display/status/components/__stories__/Status.stories.tsx
+++ b/packages/twenty-ui/src/display/status/components/__stories__/Status.stories.tsx
@@ -4,7 +4,7 @@ import {
type CatalogStory,
ComponentDecorator,
} from '@ui/testing';
-import { MAIN_COLOR_NAMES, type ThemeColor } from '@ui/theme';
+import { type ThemeColor, MAIN_COLOR_NAMES } from '@ui/theme';
import { expect, fn, userEvent, within } from 'storybook/test';
import { Status } from '../Status';
diff --git a/packages/twenty-ui/src/display/tooltip/OverflowingTextWithTooltip.tsx b/packages/twenty-ui/src/display/tooltip/OverflowingTextWithTooltip.tsx
index 0e6ddcc8da6..aa577296858 100644
--- a/packages/twenty-ui/src/display/tooltip/OverflowingTextWithTooltip.tsx
+++ b/packages/twenty-ui/src/display/tooltip/OverflowingTextWithTooltip.tsx
@@ -3,11 +3,11 @@ import { type ReactNode, useRef, useState } from 'react';
import { createPortal } from 'react-dom';
import { isNonEmptyString } from '@sniptt/guards';
-import { THEME_COMMON } from '@ui/theme';
import { isDefined } from 'twenty-shared/utils';
+import { themeCssVariables } from '@ui/theme-constants';
import { AppTooltip, TooltipDelay } from './AppTooltip';
-const spacing4 = THEME_COMMON.spacing(4);
+const spacing4 = themeCssVariables.spacing[4];
const StyledOverflowingMultilineText = styled.div<{
isContentOverflowing: boolean;
diff --git a/packages/twenty-ui/src/feedback/loader/components/Loader.tsx b/packages/twenty-ui/src/feedback/loader/components/Loader.tsx
index 11d4eaf8519..753be93c281 100644
--- a/packages/twenty-ui/src/feedback/loader/components/Loader.tsx
+++ b/packages/twenty-ui/src/feedback/loader/components/Loader.tsx
@@ -1,7 +1,7 @@
import { styled } from '@linaria/react';
+import { motion } from 'framer-motion';
import { type ThemeColor } from '@ui/theme';
import { themeCssVariables } from '@ui/theme-constants';
-import { motion } from 'framer-motion';
const StyledLoaderContainer = styled.div<{
color?: ThemeColor;
diff --git a/packages/twenty-ui/src/individual-entry.ts b/packages/twenty-ui/src/individual-entry.ts
index 11fa297fe91..f9ef6db03a8 100644
--- a/packages/twenty-ui/src/individual-entry.ts
+++ b/packages/twenty-ui/src/individual-entry.ts
@@ -12,4 +12,5 @@ export * from './json-visualizer';
export * from './layout';
export * from './navigation';
export * from './theme';
+export * from './theme-constants';
export * from './utilities';
diff --git a/packages/twenty-ui/src/input/button/components/AnimatedButton.tsx b/packages/twenty-ui/src/input/button/components/AnimatedButton.tsx
index 398f1b27e26..849cb3ece47 100644
--- a/packages/twenty-ui/src/input/button/components/AnimatedButton.tsx
+++ b/packages/twenty-ui/src/input/button/components/AnimatedButton.tsx
@@ -2,11 +2,11 @@ import { styled } from '@linaria/react';
import { useIsMobile } from '@ui/utilities';
import { getOsShortcutSeparator } from '@ui/utilities/device/getOsShortcutSeparator';
import { type MotionProps, motion } from 'framer-motion';
-import React, { useMemo } from 'react';
+import React, { useContext, useMemo } from 'react';
import { Link } from 'react-router-dom';
import { Pill } from '@ui/components/Pill/Pill';
-import { ICON_SIZES, themeCssVariables } from '@ui/theme-constants';
+import { ThemeContext, themeCssVariables } from '@ui/theme-constants';
import {
type ButtonAccent,
type ButtonPosition,
@@ -446,6 +446,7 @@ export const AnimatedButton = ({
dataGloballyPreventClickOutside,
soonLabel = 'Soon',
}: AnimatedButtonProps) => {
+ const { theme } = useContext(ThemeContext);
const isMobile = useIsMobile();
const isDisabled = soon || disabled;
@@ -492,7 +493,7 @@ export const AnimatedButton = ({
{Icon && (
<StyledIconContainer>
<motion.div animate={animate} transition={transition}>
- <Icon size={ICON_SIZES.sm} />
+ <Icon size={theme.icon.size.sm} />
</motion.div>
</StyledIconContainer>
)}
diff --git a/packages/twenty-ui/src/input/button/components/AnimatedLightIconButton.tsx b/packages/twenty-ui/src/input/button/components/AnimatedLightIconButton.tsx
index 50d0701574f..1dce5c8e34a 100644
--- a/packages/twenty-ui/src/input/button/components/AnimatedLightIconButton.tsx
+++ b/packages/twenty-ui/src/input/button/components/AnimatedLightIconButton.tsx
@@ -4,9 +4,9 @@ import {
type LightIconButtonAccent,
type LightIconButtonSize,
} from '@ui/input/button/components/LightIconButton';
-import { ICON_SIZES, themeCssVariables } from '@ui/theme-constants';
+import { ThemeContext, themeCssVariables } from '@ui/theme-constants';
import { motion, type MotionProps } from 'framer-motion';
-import { type ComponentProps, type MouseEvent } from 'react';
+import { type ComponentProps, type MouseEvent, useContext } from 'react';
export type AnimatedLightIconButtonProps = {
className?: string;
@@ -107,6 +107,8 @@ export const AnimatedLightIconButton = ({
onClick,
title,
}: AnimatedLightIconButtonProps) => {
+ const { theme } = useContext(ThemeContext);
+
return (
<StyledButton
data-testid={testId}
@@ -122,7 +124,9 @@ export const AnimatedLightIconButton = ({
>
<StyledIconContainer animate={animate} transition={transition}>
{Icon && (
- <Icon size={size === 'medium' ? ICON_SIZES.md : ICON_SIZES.sm} />
+ <Icon
+ size={size === 'medium' ? theme.icon.size.md : theme.icon.size.sm}
+ />
)}
</StyledIconContainer>
</StyledButton>
diff --git a/packages/twenty-ui/src/input/button/components/Button/internal/ButtonIcon.tsx b/packages/twenty-ui/src/input/button/components/Button/internal/ButtonIcon.tsx
index 342eff8c85a..de58ef45177 100644
--- a/packages/twenty-ui/src/input/button/components/Button/internal/ButtonIcon.tsx
+++ b/packages/twenty-ui/src/input/button/components/Button/internal/ButtonIcon.tsx
@@ -2,7 +2,8 @@ import { styled } from '@linaria/react';
import { type IconComponent } from '@ui/display';
import { Loader } from '@ui/feedback';
import { baseTransitionTiming } from '@ui/input/button/components/Button/constant';
-import { ICON_SIZES, themeCssVariables } from '@ui/theme-constants';
+import { ThemeContext, themeCssVariables } from '@ui/theme-constants';
+import { useContext } from 'react';
const StyledIcon = styled.div<{
isLoading: boolean;
@@ -41,17 +42,21 @@ export const ButtonIcon = ({
}: {
Icon?: IconComponent;
isLoading?: boolean;
-}) => (
- <StyledIconWrapper>
- {isLoading && (
- <StyledLoader>
- <Loader />
- </StyledLoader>
- )}
- {Icon && (
- <StyledIcon isLoading={!!isLoading}>
- <Icon size={ICON_SIZES.sm} />
- </StyledIcon>
- )}
- </StyledIconWrapper>
-);
+}) => {
+ const { theme } = useContext(ThemeContext);
+
+ return (
+ <StyledIconWrapper>
+ {isLoading && (
+ <StyledLoader>
+ <Loader />
+ </StyledLoader>
+ )}
+ {Icon && (
+ <StyledIcon isLoading={!!isLoading}>
+ <Icon size={theme.icon.size.sm} />
+ </StyledIcon>
+ )}
+ </StyledIconWrapper>
+ );
+};
diff --git a/packages/twenty-ui/src/input/button/components/FloatingButton.tsx b/packages/twenty-ui/src/input/button/components/FloatingButton.tsx
index 691d3439b0e..b1c3cde4760 100644
--- a/packages/twenty-ui/src/input/button/components/FloatingButton.tsx
+++ b/packages/twenty-ui/src/input/button/components/FloatingButton.tsx
@@ -1,7 +1,6 @@
import { styled } from '@linaria/react';
import { type IconComponent } from '@ui/display';
-import { ThemeContext } from '@ui/theme';
-import { themeCssVariables } from '@ui/theme-constants';
+import { ThemeContext, themeCssVariables } from '@ui/theme-constants';
import { useContext } from 'react';
import { Link } from 'react-router-dom';
@@ -115,6 +114,7 @@ export const FloatingButton = ({
to,
}: FloatingButtonProps) => {
const { theme } = useContext(ThemeContext);
+
return (
<StyledButton
disabled={disabled}
diff --git a/packages/twenty-ui/src/input/button/components/FloatingIconButton.tsx b/packages/twenty-ui/src/input/button/components/FloatingIconButton.tsx
index 23a85a55aee..0f03c337a6c 100644
--- a/packages/twenty-ui/src/input/button/components/FloatingIconButton.tsx
+++ b/packages/twenty-ui/src/input/button/components/FloatingIconButton.tsx
@@ -1,7 +1,6 @@
import { styled } from '@linaria/react';
import { type IconComponent } from '@ui/display';
-import { ThemeContext } from '@ui/theme';
-import { themeCssVariables } from '@ui/theme-constants';
+import { ThemeContext, themeCssVariables } from '@ui/theme-constants';
import React, { useContext } from 'react';
export type FloatingIconButtonSize = 'small' | 'medium';
@@ -118,6 +117,7 @@ export const FloatingIconButton = ({
isActive,
}: FloatingIconButtonProps) => {
const { theme } = useContext(ThemeContext);
+
return (
<StyledButton
disabled={disabled}
diff --git a/packages/twenty-ui/src/input/button/components/IconButton.tsx b/packages/twenty-ui/src/input/button/components/IconButton.tsx
index e6eb594e4b6..61304736090 100644
--- a/packages/twenty-ui/src/input/button/components/IconButton.tsx
+++ b/packages/twenty-ui/src/input/button/components/IconButton.tsx
@@ -1,8 +1,7 @@
import { styled } from '@linaria/react';
import { type IconComponent } from '@ui/display';
-import { GRAY_SCALE_LIGHT, ThemeContext } from '@ui/theme';
-import { themeCssVariables } from '@ui/theme-constants';
import React, { useContext, useMemo } from 'react';
+import { ThemeContext, themeCssVariables } from '@ui/theme-constants';
export type IconButtonSize = 'medium' | 'small';
export type IconButtonPosition = 'standalone' | 'left' | 'middle' | 'right';
@@ -79,7 +78,7 @@ const computeIconButtonDynamicStyles = (
boxShadow: focusOverride
? `0 0 0 3px ${themeCssVariables.accent.tertiary}`
: 'none',
- color: GRAY_SCALE_LIGHT.gray1,
+ color: themeCssVariables.grayScale.gray1,
opacity: disabled ? 0.24 : 1,
hoverBackground: disabled
? themeCssVariables.color.blue
@@ -100,7 +99,7 @@ const computeIconButtonDynamicStyles = (
boxShadow: focusOverride
? `0 0 0 3px ${themeCssVariables.color.red3}`
: 'none',
- color: GRAY_SCALE_LIGHT.gray1,
+ color: themeCssVariables.grayScale.gray1,
opacity: disabled ? 0.24 : 1,
hoverBackground: disabled
? themeCssVariables.color.red
@@ -292,6 +291,7 @@ export const IconButton = ({
to,
}: IconButtonProps) => {
const { theme } = useContext(ThemeContext);
+
const dynamicStyles = useMemo(() => {
const styles = computeIconButtonDynamicStyles(
variant,
diff --git a/packages/twenty-ui/src/input/button/components/InsideButton.tsx b/packages/twenty-ui/src/input/button/components/InsideButton.tsx
index d02048905ce..9ed8d9e262c 100644
--- a/packages/twenty-ui/src/input/button/components/InsideButton.tsx
+++ b/packages/twenty-ui/src/input/button/components/InsideButton.tsx
@@ -1,7 +1,6 @@
import { styled } from '@linaria/react';
import { type IconComponent } from '@ui/display';
-import { ThemeContext } from '@ui/theme';
-import { themeCssVariables } from '@ui/theme-constants';
+import { ThemeContext, themeCssVariables } from '@ui/theme-constants';
import React, { useContext } from 'react';
export type InsideButtonProps = {
diff --git a/packages/twenty-ui/src/input/button/components/LightButton.tsx b/packages/twenty-ui/src/input/button/components/LightButton.tsx
index 59c5dac468e..98356705f7f 100644
--- a/packages/twenty-ui/src/input/button/components/LightButton.tsx
+++ b/packages/twenty-ui/src/input/button/components/LightButton.tsx
@@ -1,7 +1,7 @@
import { styled } from '@linaria/react';
import { type IconComponent } from '@ui/display';
-import { ICON_SIZES, themeCssVariables } from '@ui/theme-constants';
-import { type MouseEvent } from 'react';
+import { ThemeContext, themeCssVariables } from '@ui/theme-constants';
+import { type MouseEvent, useContext } from 'react';
export type LightButtonAccent = 'secondary' | 'tertiary';
@@ -89,6 +89,8 @@ export const LightButton = ({
type = 'button',
onClick,
}: LightButtonProps) => {
+ const { theme } = useContext(ThemeContext);
+
return (
<StyledButton
onClick={onClick}
@@ -99,7 +101,7 @@ export const LightButton = ({
className={className}
active={active}
>
- {!!Icon && <Icon size={ICON_SIZES.md} />}
+ {!!Icon && <Icon size={theme.icon.size.md} />}
{title}
</StyledButton>
);
diff --git a/packages/twenty-ui/src/input/button/components/LightIconButton.tsx b/packages/twenty-ui/src/input/button/components/LightIconButton.tsx
index dfd9f340f50..a73d9588cb8 100644
--- a/packages/twenty-ui/src/input/button/components/LightIconButton.tsx
+++ b/packages/twenty-ui/src/input/button/components/LightIconButton.tsx
@@ -1,7 +1,7 @@
import { styled } from '@linaria/react';
import { type IconComponent } from '@ui/display';
-import { ICON_SIZES, themeCssVariables } from '@ui/theme-constants';
-import { type ComponentProps, type MouseEvent } from 'react';
+import { ThemeContext, themeCssVariables } from '@ui/theme-constants';
+import { type ComponentProps, type MouseEvent, useContext } from 'react';
export type LightIconButtonAccent = 'secondary' | 'tertiary';
export type LightIconButtonSize = 'small' | 'medium';
@@ -105,6 +105,8 @@ export const LightIconButton = ({
onClick,
title,
}: LightIconButtonProps) => {
+ const { theme } = useContext(ThemeContext);
+
return (
<StyledButton
data-testid={testId}
@@ -119,7 +121,9 @@ export const LightIconButton = ({
title={title}
>
{Icon && (
- <Icon size={size === 'medium' ? ICON_SIZES.md : ICON_SIZES.sm} />
+ <Icon
+ size={size === 'medium' ? theme.icon.size.md : theme.icon.size.sm}
+ />
)}
</StyledButton>
);
diff --git a/packages/twenty-ui/src/input/button/components/MainButton.tsx b/packages/twenty-ui/src/input/button/components/MainButton.tsx
index 8c09bc14489..9d278d34b2a 100644
--- a/packages/twenty-ui/src/input/button/components/MainButton.tsx
+++ b/packages/twenty-ui/src/input/button/components/MainButton.tsx
@@ -1,7 +1,6 @@
import { styled } from '@linaria/react';
import { type IconComponent } from '@ui/display';
-import { ThemeContext } from '@ui/theme';
-import { themeCssVariables } from '@ui/theme-constants';
+import { ThemeContext, themeCssVariables } from '@ui/theme-constants';
import React, { type FunctionComponent, useContext } from 'react';
export type MainButtonVariant = 'primary' | 'secondary';
@@ -106,6 +105,7 @@ export const MainButton = ({
className,
}: MainButtonProps) => {
const { theme } = useContext(ThemeContext);
+
return (
<StyledButton
className={className}
diff --git a/packages/twenty-ui/src/input/button/components/RoundedIconButton.tsx b/packages/twenty-ui/src/input/button/components/RoundedIconButton.tsx
index a12f275d0ff..07e86e1e656 100644
--- a/packages/twenty-ui/src/input/button/components/RoundedIconButton.tsx
+++ b/packages/twenty-ui/src/input/button/components/RoundedIconButton.tsx
@@ -1,7 +1,6 @@
import { styled } from '@linaria/react';
import { type IconComponent } from '@ui/display';
-import { ThemeContext } from '@ui/theme';
-import { themeCssVariables } from '@ui/theme-constants';
+import { ThemeContext, themeCssVariables } from '@ui/theme-constants';
import { useContext } from 'react';
export type RoundedIconButtonSize = 'small' | 'medium';
diff --git a/packages/twenty-ui/src/input/button/components/TabButton/internals/components/TabContent.tsx b/packages/twenty-ui/src/input/button/components/TabButton/internals/components/TabContent.tsx
index 8025ef1d400..9ca002675ea 100644
--- a/packages/twenty-ui/src/input/button/components/TabButton/internals/components/TabContent.tsx
+++ b/packages/twenty-ui/src/input/button/components/TabButton/internals/components/TabContent.tsx
@@ -1,6 +1,6 @@
import { Pill } from '@ui/components/Pill/Pill';
import { Avatar, type IconComponent } from '@ui/display';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
import { type ReactElement, useContext } from 'react';
import { StyledTabHover } from './StyledTabBase';
@@ -29,6 +29,7 @@ export const TabContent = ({
className,
}: TabContentProps) => {
const { theme } = useContext(ThemeContext);
+
const iconColor = active
? theme.font.color.primary
: disabled
diff --git a/packages/twenty-ui/src/input/code-editor/components/CodeEditor.tsx b/packages/twenty-ui/src/input/code-editor/components/CodeEditor.tsx
index a63fc992cfd..16df34e685a 100644
--- a/packages/twenty-ui/src/input/code-editor/components/CodeEditor.tsx
+++ b/packages/twenty-ui/src/input/code-editor/components/CodeEditor.tsx
@@ -5,8 +5,7 @@ import { ResizeHandle } from '@ui/layout/resize-handle/components/ResizeHandle';
import { BASE_CODE_EDITOR_THEME_ID } from '@ui/input/code-editor/constants/BaseCodeEditorThemeId';
import { useResizeHandle } from '@ui/layout/resize-handle/hooks/useResizeHandle';
import { getBaseCodeEditorTheme } from '@ui/input/code-editor/theme/utils/getBaseCodeEditorTheme';
-import { ThemeContext } from '@ui/theme';
-import { themeCssVariables } from '@ui/theme-constants';
+import { ThemeContext, themeCssVariables } from '@ui/theme-constants';
import { type editor } from 'monaco-editor';
import { type KeyboardEvent, useContext, useState } from 'react';
import { isDefined } from 'twenty-shared/utils';
@@ -189,9 +188,7 @@ export const CodeEditor = ({
monaco.editor.defineTheme(
BASE_CODE_EDITOR_THEME_ID,
- getBaseCodeEditorTheme({
- theme,
- }),
+ getBaseCodeEditorTheme(theme),
);
monaco.editor.setTheme(BASE_CODE_EDITOR_THEME_ID);
diff --git a/packages/twenty-ui/src/input/code-editor/theme/utils/getBaseCodeEditorTheme.ts b/packages/twenty-ui/src/input/code-editor/theme/utils/getBaseCodeEditorTheme.ts
index 6e571e6b058..26fc71322ea 100644
--- a/packages/twenty-ui/src/input/code-editor/theme/utils/getBaseCodeEditorTheme.ts
+++ b/packages/twenty-ui/src/input/code-editor/theme/utils/getBaseCodeEditorTheme.ts
@@ -1,4 +1,4 @@
-import { type ThemeType } from '@ui/theme';
+import { type ThemeType } from '@ui/theme-constants';
import { type editor } from 'monaco-editor';
import { isDefined } from 'twenty-shared/utils';
@@ -31,11 +31,9 @@ const convertColorToHex = (color: string): string => {
return color;
};
-export const getBaseCodeEditorTheme = ({
- theme,
-}: {
- theme: ThemeType;
-}): editor.IStandaloneThemeData => {
+export const getBaseCodeEditorTheme = (
+ theme: ThemeType,
+): editor.IStandaloneThemeData => {
return {
base: 'vs',
inherit: true,
@@ -45,12 +43,18 @@ export const getBaseCodeEditorTheme = ({
foreground: convertColorToHex(theme.code.text.gray),
fontStyle: 'bold',
},
- { token: 'keyword', foreground: convertColorToHex(theme.code.text.sky) },
+ {
+ token: 'keyword',
+ foreground: convertColorToHex(theme.code.text.sky),
+ },
{
token: 'delimiter',
foreground: convertColorToHex(theme.code.text.gray),
},
- { token: 'string', foreground: convertColorToHex(theme.code.text.pink) },
+ {
+ token: 'string',
+ foreground: convertColorToHex(theme.code.text.pink),
+ },
{
token: 'comment',
foreground: convertColorToHex(theme.code.text.orange),
diff --git a/packages/twenty-ui/src/input/color-scheme/components/ColorSchemeCard.tsx b/packages/twenty-ui/src/input/color-scheme/components/ColorSchemeCard.tsx
index 0ac79f1f744..a4f2f727233 100644
--- a/packages/twenty-ui/src/input/color-scheme/components/ColorSchemeCard.tsx
+++ b/packages/twenty-ui/src/input/color-scheme/components/ColorSchemeCard.tsx
@@ -1,8 +1,6 @@
import { styled } from '@linaria/react';
import { Checkmark } from '@ui/display/checkmark/components/Checkmark';
import { type ColorScheme } from '@ui/input/types/ColorScheme';
-import { GRAY_SCALE_DARK, GRAY_SCALE_LIGHT } from '@ui/theme';
-import { themeCssVariables } from '@ui/theme-constants';
import {
AnimatePresence,
type AnimationControls,
@@ -10,6 +8,9 @@ import {
useAnimation,
} from 'framer-motion';
import React from 'react';
+import { GRAY_SCALE_DARK } from '@ui/theme/constants/GrayScaleDark';
+import { GRAY_SCALE_LIGHT } from '@ui/theme/constants/GrayScaleLight';
+import { themeCssVariables } from '@ui/theme-constants';
const StyledColorSchemeBackground = styled.div<
Pick<ColorSchemeCardProps, 'variant'>
diff --git a/packages/twenty-ui/src/input/color-scheme/components/__stories__/ColorSchemeCard.stories.tsx b/packages/twenty-ui/src/input/color-scheme/components/__stories__/ColorSchemeCard.stories.tsx
index 70aa1264abf..59c1c7b5314 100644
--- a/packages/twenty-ui/src/input/color-scheme/components/__stories__/ColorSchemeCard.stories.tsx
+++ b/packages/twenty-ui/src/input/color-scheme/components/__stories__/ColorSchemeCard.stories.tsx
@@ -1,16 +1,15 @@
import { styled } from '@linaria/react';
import { type Meta, type StoryObj } from '@storybook/react-vite';
import { ComponentDecorator } from '@ui/testing';
-import { useContext } from 'react';
-import { ThemeContext, type ThemeType } from '@ui/theme';
+import { themeCssVariables } from '@ui/theme-constants';
import { ColorSchemeCard } from '../ColorSchemeCard';
-const StyledContainer = styled.div<{ theme: ThemeType }>`
+const StyledContainer = styled.div`
display: flex;
flex-direction: row;
> * + * {
- margin-left: ${({ theme }) => theme.spacing(4)};
+ margin-left: ${themeCssVariables.spacing['4']};
}
`;
@@ -19,10 +18,8 @@ const meta: Meta<typeof ColorSchemeCard> = {
component: ColorSchemeCard,
decorators: [
(Story) => {
- const { theme } = useContext(ThemeContext);
-
return (
- <StyledContainer theme={theme}>
+ <StyledContainer>
<Story />
</StyledContainer>
);
diff --git a/packages/twenty-ui/src/input/components/SearchInput.tsx b/packages/twenty-ui/src/input/components/SearchInput.tsx
index 52aa0e0f55e..daa162f8bdd 100644
--- a/packages/twenty-ui/src/input/components/SearchInput.tsx
+++ b/packages/twenty-ui/src/input/components/SearchInput.tsx
@@ -1,8 +1,7 @@
import { styled } from '@linaria/react';
import { IconFilter, IconSearch } from '@ui/display';
import { IconButton } from '@ui/input/button/components/IconButton';
-import { ThemeContext } from '@ui/theme';
-import { themeCssVariables } from '@ui/theme-constants';
+import { ThemeContext, themeCssVariables } from '@ui/theme-constants';
import { type ChangeEvent, type ReactNode, useContext, useState } from 'react';
export type SearchInputProps = {
diff --git a/packages/twenty-ui/src/input/components/__stories__/Toggle.stories.tsx b/packages/twenty-ui/src/input/components/__stories__/Toggle.stories.tsx
index 3d01003629d..ca4989b4760 100644
--- a/packages/twenty-ui/src/input/components/__stories__/Toggle.stories.tsx
+++ b/packages/twenty-ui/src/input/components/__stories__/Toggle.stories.tsx
@@ -4,7 +4,7 @@ import {
type CatalogStory,
ComponentDecorator,
} from '@ui/testing';
-import { MAIN_COLORS_LIGHT } from '@ui/theme';
+import { themeCssVariables } from '@ui/theme-constants';
import { useState } from 'react';
import { Toggle, type ToggleSize } from '../Toggle';
@@ -88,7 +88,7 @@ export const Catalog: CatalogStory<Story, typeof InteractiveToggle> = {
if (color === 'default') {
return {};
}
- return { color: MAIN_COLORS_LIGHT.yellow };
+ return { color: themeCssVariables.color.yellow };
},
},
],
diff --git a/packages/twenty-ui/src/json-visualizer/components/internal/JsonArrow.tsx b/packages/twenty-ui/src/json-visualizer/components/internal/JsonArrow.tsx
index 8cd0bf4bbc4..de647d78f13 100644
--- a/packages/twenty-ui/src/json-visualizer/components/internal/JsonArrow.tsx
+++ b/packages/twenty-ui/src/json-visualizer/components/internal/JsonArrow.tsx
@@ -2,7 +2,8 @@ import { styled } from '@linaria/react';
import { VisibilityHidden } from '@ui/accessibility';
import { IconChevronDown } from '@ui/display';
import { useJsonTreeContextOrThrow } from '@ui/json-visualizer/hooks/useJsonTreeContextOrThrow';
-import { ICON_SIZES, themeCssVariables } from '@ui/theme-constants';
+import { ThemeContext, themeCssVariables } from '@ui/theme-constants';
+import { useContext } from 'react';
import { motion } from 'framer-motion';
const StyledButton = styled.button<{
@@ -38,6 +39,7 @@ export const JsonArrow = ({
onClick: () => void;
variant?: 'blue' | 'red';
}) => {
+ const { theme } = useContext(ThemeContext);
const { arrowButtonCollapsedLabel, arrowButtonExpandedLabel } =
useJsonTreeContextOrThrow();
@@ -59,7 +61,7 @@ export const JsonArrow = ({
animate={{ rotate: isOpen ? 0 : -90 }}
transition={{ duration: 0.3 }}
>
- <IconChevronDown size={ICON_SIZES.md} color={iconColor} />
+ <IconChevronDown size={theme.icon.size.md} color={iconColor} />
</motion.div>
</StyledButton>
);
diff --git a/packages/twenty-ui/src/json-visualizer/components/internal/JsonNodeLabel.tsx b/packages/twenty-ui/src/json-visualizer/components/internal/JsonNodeLabel.tsx
index 4899c7ded6a..05e8c52e194 100644
--- a/packages/twenty-ui/src/json-visualizer/components/internal/JsonNodeLabel.tsx
+++ b/packages/twenty-ui/src/json-visualizer/components/internal/JsonNodeLabel.tsx
@@ -1,8 +1,7 @@
import { styled } from '@linaria/react';
import { type IconComponent } from '@ui/display';
import { type JsonNodeHighlighting } from '@ui/json-visualizer/types/JsonNodeHighlighting';
-import { ThemeContext } from '@ui/theme';
-import { themeCssVariables } from '@ui/theme-constants';
+import { ThemeContext, themeCssVariables } from '@ui/theme-constants';
import { useContext } from 'react';
const StyledLabelContainer = styled.span<{
diff --git a/packages/twenty-ui/src/layout/animated-expandable-container/__stories__/AnimatedExpandableContainer.stories.tsx b/packages/twenty-ui/src/layout/animated-expandable-container/__stories__/AnimatedExpandableContainer.stories.tsx
index 1ec8acca4dc..64fb8db13e5 100644
--- a/packages/twenty-ui/src/layout/animated-expandable-container/__stories__/AnimatedExpandableContainer.stories.tsx
+++ b/packages/twenty-ui/src/layout/animated-expandable-container/__stories__/AnimatedExpandableContainer.stories.tsx
@@ -1,21 +1,21 @@
import { styled } from '@linaria/react';
import { type Meta, type StoryObj } from '@storybook/react-vite';
import { ComponentDecorator } from '@ui/testing';
-import { useContext, useState } from 'react';
-import { ThemeContext, type ThemeType } from '@ui/theme';
+import { useState } from 'react';
+import { themeCssVariables } from '@ui/theme-constants';
import { AnimatedExpandableContainer } from '../components/AnimatedExpandableContainer';
-const StyledButton = styled.button<{ theme: ThemeType }>`
- padding: ${({ theme }) => theme.spacing(2)} ${({ theme }) => theme.spacing(4)};
- background-color: ${({ theme }) => theme.color.blue10};
- color: ${({ theme }) => theme.font.color.primary};
+const StyledButton = styled.button`
+ padding: ${themeCssVariables.spacing['2']} ${themeCssVariables.spacing['4']};
+ background-color: ${themeCssVariables.color.blue10};
+ color: ${themeCssVariables.font.color.primary};
border: none;
- border-radius: ${({ theme }) => theme.spacing(1)};
+ border-radius: ${themeCssVariables.spacing['1']};
cursor: pointer;
- margin-bottom: ${({ theme }) => theme.spacing(3)};
+ margin-bottom: ${themeCssVariables.spacing['3']};
&:hover {
- background-color: ${({ theme }) => theme.color.blue8};
+ background-color: ${themeCssVariables.color.blue8};
}
`;
@@ -24,8 +24,8 @@ const StyledButtonWrapper = styled.div<{ dimension: 'width' | 'height' }>`
width: ${({ dimension }) => (dimension === 'height' ? '600px' : 'auto')};
`;
-const StyledExpandableWrapper = styled.div<{ theme: ThemeType }>`
- background-color: ${({ theme }) => theme.background.primary};
+const StyledExpandableWrapper = styled.div`
+ background-color: ${themeCssVariables.background.primary};
height: 100%;
width: 100%;
`;
@@ -33,17 +33,16 @@ const StyledExpandableWrapper = styled.div<{ theme: ThemeType }>`
const StyledContent = styled.div<{
dimension: 'width' | 'height';
mode: 'scroll-height' | 'fit-content';
- theme: ThemeType;
}>`
- padding: ${({ theme }) => theme.spacing(3)};
+ padding: ${themeCssVariables.spacing['3']};
height: ${({ dimension, mode }) =>
dimension === 'height' && mode === 'scroll-height' ? '200px' : 'auto'};
width: ${({ dimension }) => (dimension === 'width' ? '400px' : 'auto')};
p {
- color: ${({ theme }) => theme.font.color.primary};
- margin-bottom: ${({ theme }) => theme.spacing(2)};
- font-size: ${({ theme }) => theme.font.size.md};
+ color: ${themeCssVariables.font.color.primary};
+ margin-bottom: ${themeCssVariables.spacing['2']};
+ font-size: ${themeCssVariables.font.size.md};
}
`;
@@ -63,12 +62,11 @@ const AnimatedExpandableContainerWithButton = ({
isExpanded: initialIsExpanded,
...args
}: AnimatedExpandableContainerWithButtonProps) => {
- const { theme } = useContext(ThemeContext);
const [isExpanded, setIsExpanded] = useState(initialIsExpanded);
return (
<StyledButtonWrapper dimension={args.dimension}>
- <StyledButton theme={theme} onClick={() => setIsExpanded(!isExpanded)}>
+ <StyledButton onClick={() => setIsExpanded(!isExpanded)}>
{isExpanded ? 'Collapse' : 'Expand'}
</StyledButton>
<AnimatedExpandableContainer
@@ -77,12 +75,8 @@ const AnimatedExpandableContainerWithButton = ({
mode={args.mode}
animationDurations={args.animationDurations}
>
- <StyledExpandableWrapper theme={theme}>
- <StyledContent
- dimension={args.dimension}
- mode={args.mode}
- theme={theme}
- >
+ <StyledExpandableWrapper>
+ <StyledContent dimension={args.dimension} mode={args.mode}>
<p>
This is some content inside the AnimatedExpandableContainer. It
will animate smoothly when expanding or collapsing.
diff --git a/packages/twenty-ui/src/layout/animated-expandable-container/components/AnimatedExpandableContainer.tsx b/packages/twenty-ui/src/layout/animated-expandable-container/components/AnimatedExpandableContainer.tsx
index 4cfedde570b..ae8ad0b08b7 100644
--- a/packages/twenty-ui/src/layout/animated-expandable-container/components/AnimatedExpandableContainer.tsx
+++ b/packages/twenty-ui/src/layout/animated-expandable-container/components/AnimatedExpandableContainer.tsx
@@ -4,7 +4,7 @@ import { type AnimationDurations } from '@ui/layout/animated-expandable-containe
import { type AnimationMode } from '@ui/layout/animated-expandable-container/types/AnimationMode';
import { type AnimationSize } from '@ui/layout/animated-expandable-container/types/AnimationSize';
import { getExpandableAnimationConfig } from '@ui/layout/animated-expandable-container/utils/getExpandableAnimationConfig';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
import { AnimatePresence, motion } from 'framer-motion';
import { type ReactNode, useContext, useRef, useState } from 'react';
import { isDefined } from 'twenty-shared/utils';
@@ -32,11 +32,13 @@ export const AnimatedExpandableContainer = ({
const contentRef = useRef<HTMLDivElement>(null);
const [size, setSize] = useState<AnimationSize>(0);
+ const normalDuration = theme.animation.duration.normal;
+
const actualDurations: AnimationDurationObject =
animationDurations === 'default'
? {
- opacity: theme.animation.duration.normal,
- size: theme.animation.duration.normal,
+ opacity: normalDuration,
+ size: normalDuration,
}
: animationDurations;
diff --git a/packages/twenty-ui/src/layout/animated-placeholder/components/AnimatedPlaceholder.tsx b/packages/twenty-ui/src/layout/animated-placeholder/components/AnimatedPlaceholder.tsx
index 48b4c05aeb0..7d3836523e7 100644
--- a/packages/twenty-ui/src/layout/animated-placeholder/components/AnimatedPlaceholder.tsx
+++ b/packages/twenty-ui/src/layout/animated-placeholder/components/AnimatedPlaceholder.tsx
@@ -3,7 +3,7 @@ import { BACKGROUND } from '@ui/layout/animated-placeholder/constants/Background
import { DARK_BACKGROUND } from '@ui/layout/animated-placeholder/constants/DarkBackground';
import { DARK_MOVING_IMAGE } from '@ui/layout/animated-placeholder/constants/DarkMovingImage';
import { MOVING_IMAGE } from '@ui/layout/animated-placeholder/constants/MovingImage';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
import { animate, motion, useMotionValue, useTransform } from 'framer-motion';
import { useContext, useEffect } from 'react';
@@ -38,7 +38,7 @@ interface AnimatedPlaceholderProps {
}
export const AnimatedPlaceholder = ({ type }: AnimatedPlaceholderProps) => {
- const { theme } = useContext(ThemeContext);
+ const { colorScheme } = useContext(ThemeContext);
const x = useMotionValue(window.innerWidth / 2);
const y = useMotionValue(window.innerHeight / 2);
@@ -84,13 +84,13 @@ export const AnimatedPlaceholder = ({ type }: AnimatedPlaceholderProps) => {
return (
<StyledContainer>
<StyledBackgroundImage
- src={theme.name === 'dark' ? DARK_BACKGROUND[type] : BACKGROUND[type]}
+ src={colorScheme === 'dark' ? DARK_BACKGROUND[type] : BACKGROUND[type]}
alt=""
type={type}
/>
<motion.img
src={
- theme.name === 'dark' ? DARK_MOVING_IMAGE[type] : MOVING_IMAGE[type]
+ colorScheme === 'dark' ? DARK_MOVING_IMAGE[type] : MOVING_IMAGE[type]
}
alt=""
style={{
diff --git a/packages/twenty-ui/src/layout/modal/components/Modal.tsx b/packages/twenty-ui/src/layout/modal/components/Modal.tsx
index bd7d71e9e82..772e423feb0 100644
--- a/packages/twenty-ui/src/layout/modal/components/Modal.tsx
+++ b/packages/twenty-ui/src/layout/modal/components/Modal.tsx
@@ -3,8 +3,7 @@ import { AnimatePresence, motion } from 'framer-motion';
import React, { useContext, useRef } from 'react';
import { createPortal } from 'react-dom';
import { isDefined } from 'twenty-shared/utils';
-import { themeCssVariables } from '@ui/theme-constants';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext, themeCssVariables } from '@ui/theme-constants';
import { type ModalOverlay } from '../types/ModalOverlay';
import { type ModalPadding } from '../types/ModalPadding';
@@ -128,9 +127,9 @@ export const Modal = ({
onBackdropMouseDown,
modalRef: externalRef,
}: ModalProps) => {
+ const { theme } = useContext(ThemeContext);
const internalRef = useRef<HTMLDivElement>(null);
const resolvedRef = externalRef ?? internalRef;
- const { theme } = useContext(ThemeContext);
const handleBackdropMouseDown = (e: React.MouseEvent) => {
e.stopPropagation();
@@ -158,7 +157,9 @@ export const Modal = ({
layout
overlay={overlay}
variants={modalAnimation}
- transition={{ duration: theme.animation.duration.normal }}
+ transition={{
+ duration: theme.animation.duration.normal,
+ }}
isMobile={isMobile}
gap={gap}
smallBorderRadius={smallBorderRadius}
diff --git a/packages/twenty-ui/src/navigation/link/components/AdvancedSettingsToggle.tsx b/packages/twenty-ui/src/navigation/link/components/AdvancedSettingsToggle.tsx
index 70477372b23..c9a7958bfbd 100644
--- a/packages/twenty-ui/src/navigation/link/components/AdvancedSettingsToggle.tsx
+++ b/packages/twenty-ui/src/navigation/link/components/AdvancedSettingsToggle.tsx
@@ -1,8 +1,7 @@
import { styled } from '@linaria/react';
import { IconPoint } from '@ui/display';
import { Toggle } from '@ui/input';
-import { ThemeContext } from '@ui/theme';
-import { themeCssVariables } from '@ui/theme-constants';
+import { ThemeContext, themeCssVariables } from '@ui/theme-constants';
import { useContext, useId } from 'react';
const StyledContainer = styled.div`
@@ -46,21 +45,19 @@ export const AdvancedSettingsToggle = ({
setIsAdvancedModeEnabled,
label = 'Advanced:',
}: AdvancedSettingsToggleProps) => {
+ const { theme } = useContext(ThemeContext);
+
const onChange = (newValue: boolean) => {
setIsAdvancedModeEnabled(newValue);
};
const instanceId = useId();
- const { theme } = useContext(ThemeContext);
+ const yellowColor = theme.color.yellow;
return (
<StyledContainer>
<StyledIconContainer>
- <IconPoint
- size={12}
- color={theme.color.yellow}
- fill={theme.color.yellow}
- />
+ <IconPoint size={12} color={yellowColor} fill={yellowColor} />
</StyledIconContainer>
<StyledToggleContainer htmlFor={instanceId}>
<StyledText>{label}</StyledText>
@@ -68,7 +65,7 @@ export const AdvancedSettingsToggle = ({
<Toggle
id={instanceId}
onChange={onChange}
- color={theme.color.yellow}
+ color={yellowColor}
value={isAdvancedModeEnabled}
/>
</StyledToggleContainer>
diff --git a/packages/twenty-ui/src/navigation/link/components/GithubVersionLink.tsx b/packages/twenty-ui/src/navigation/link/components/GithubVersionLink.tsx
index a0888a869a8..d045e5bf12b 100644
--- a/packages/twenty-ui/src/navigation/link/components/GithubVersionLink.tsx
+++ b/packages/twenty-ui/src/navigation/link/components/GithubVersionLink.tsx
@@ -1,8 +1,8 @@
-import { useContext } from 'react';
import { IconBrandGithub } from '@ui/display';
-import { ThemeContext } from '@ui/theme';
import { ClickToActionLink } from '@ui/navigation/link/components/ClickToActionLink';
import { GITHUB_LINK } from '../constants/GithubLink';
+import { ThemeContext } from '@ui/theme-constants';
+import { useContext } from 'react';
interface GithubVersionLinkProps {
version: string;
diff --git a/packages/twenty-ui/src/navigation/menu/components/MenuPicker.tsx b/packages/twenty-ui/src/navigation/menu/components/MenuPicker.tsx
index 60cde938dfe..d49b2d5e3ff 100644
--- a/packages/twenty-ui/src/navigation/menu/components/MenuPicker.tsx
+++ b/packages/twenty-ui/src/navigation/menu/components/MenuPicker.tsx
@@ -6,11 +6,8 @@ import {
TooltipPosition,
type IconComponent,
} from '@ui/display';
-import {
- ICON_SIZES,
- ICON_STROKES,
- themeCssVariables,
-} from '@ui/theme-constants';
+import { ThemeContext, themeCssVariables } from '@ui/theme-constants';
+import { useContext } from 'react';
import { isDefined } from 'twenty-shared/utils';
const StyledMenuPicker = styled.button<{
@@ -137,6 +134,8 @@ export const MenuPicker = ({
tooltipDelay = TooltipDelay.noDelay,
tooltipOffset = 5,
}: MenuPickerProps) => {
+ const { theme } = useContext(ThemeContext);
+
return (
<>
<StyledMenuPicker
@@ -151,7 +150,7 @@ export const MenuPicker = ({
aria-label={label}
>
<StyledIconContainer>
- <Icon size={ICON_SIZES.md} stroke={ICON_STROKES.sm} />
+ <Icon size={theme.icon.size.md} stroke={theme.icon.stroke.sm} />
</StyledIconContainer>
{isDefined(label) && showLabel && (
diff --git a/packages/twenty-ui/src/navigation/menu/components/__stories__/MenuPicker.stories.tsx b/packages/twenty-ui/src/navigation/menu/components/__stories__/MenuPicker.stories.tsx
index f7188214ddc..f971478da6b 100644
--- a/packages/twenty-ui/src/navigation/menu/components/__stories__/MenuPicker.stories.tsx
+++ b/packages/twenty-ui/src/navigation/menu/components/__stories__/MenuPicker.stories.tsx
@@ -3,8 +3,8 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
import { IconChartPie, TooltipDelay } from '@ui/display';
import { MenuPicker } from '@ui/navigation/menu/components/MenuPicker';
import { ComponentDecorator } from '@ui/testing';
-import { type ReactNode, useContext } from 'react';
-import { ThemeContext, type ThemeType } from '@ui/theme';
+import { type ReactNode } from 'react';
+import { themeCssVariables } from '@ui/theme-constants';
const meta: Meta<typeof MenuPicker> = {
title: 'UI/Navigation/Menu/MenuPicker',
@@ -50,16 +50,15 @@ export const WithoutLabel: Story = {
},
};
-const StyledTitle = styled.h4<{ theme: ThemeType }>`
+const StyledTitle = styled.h4`
align-items: center;
- color: ${({ theme }) => theme.font.color.tertiary};
+ color: ${themeCssVariables.font.color.tertiary};
font-size: 12px;
margin-bottom: 8px;
`;
const SectionTitle = ({ children }: { children?: ReactNode }) => {
- const { theme } = useContext(ThemeContext);
- return <StyledTitle theme={theme}>{children}</StyledTitle>;
+ return <StyledTitle>{children}</StyledTitle>;
};
export const AllStates: Story = {
diff --git a/packages/twenty-ui/src/navigation/menu/menu-item/components/MenuItem.tsx b/packages/twenty-ui/src/navigation/menu/menu-item/components/MenuItem.tsx
index 3ff01db3e8b..927dfbc2c86 100644
--- a/packages/twenty-ui/src/navigation/menu/menu-item/components/MenuItem.tsx
+++ b/packages/twenty-ui/src/navigation/menu/menu-item/components/MenuItem.tsx
@@ -11,7 +11,7 @@ import {
import { styled } from '@linaria/react';
import { MenuItemHotKeys } from '@ui/navigation/menu/menu-item/components/MenuItemHotKeys';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
import { motion } from 'framer-motion';
import { MenuItemLeftContent } from '../internals/components/MenuItemLeftContent';
import {
@@ -134,7 +134,9 @@ export const MenuItem = ({
{hasSubMenu && !disabled && (
<StyledSubMenuIcon
animate={{ rotate: isSubMenuOpened ? 90 : 0 }}
- transition={{ duration: theme.animation.duration.normal }}
+ transition={{
+ duration: theme.animation.duration.normal,
+ }}
>
<IconChevronRight
size={theme.icon.size.sm}
diff --git a/packages/twenty-ui/src/navigation/menu/menu-item/components/MenuItemMultiSelect.tsx b/packages/twenty-ui/src/navigation/menu/menu-item/components/MenuItemMultiSelect.tsx
index 8f2cb20bafb..386bab61f57 100644
--- a/packages/twenty-ui/src/navigation/menu/menu-item/components/MenuItemMultiSelect.tsx
+++ b/packages/twenty-ui/src/navigation/menu/menu-item/components/MenuItemMultiSelect.tsx
@@ -4,9 +4,9 @@ import { Tag } from '@ui/components';
import { type IconComponent } from '@ui/display';
import { Checkbox } from '@ui/input/components/Checkbox';
import { MenuItemLeftContent } from '@ui/navigation/menu/menu-item/internals/components/MenuItemLeftContent';
+import { StyledMenuItemBase } from '../internals/components/StyledMenuItemBase';
import { type ThemeColor } from '@ui/theme';
import { themeCssVariables } from '@ui/theme-constants';
-import { StyledMenuItemBase } from '../internals/components/StyledMenuItemBase';
const StyledLeftContentWithCheckboxContainer = styled.div`
align-items: center;
diff --git a/packages/twenty-ui/src/navigation/menu/menu-item/components/MenuItemNavigate.tsx b/packages/twenty-ui/src/navigation/menu/menu-item/components/MenuItemNavigate.tsx
index 1ab67c1efab..1bd3416ae98 100644
--- a/packages/twenty-ui/src/navigation/menu/menu-item/components/MenuItemNavigate.tsx
+++ b/packages/twenty-ui/src/navigation/menu/menu-item/components/MenuItemNavigate.tsx
@@ -1,7 +1,6 @@
-import { useContext } from 'react';
-
import { IconChevronRight, type IconComponent } from '@ui/display';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
+import { useContext } from 'react';
import { MenuItemLeftContent } from '../internals/components/MenuItemLeftContent';
import {
StyledMenuItemBase,
diff --git a/packages/twenty-ui/src/navigation/menu/menu-item/components/MenuItemSelect.tsx b/packages/twenty-ui/src/navigation/menu/menu-item/components/MenuItemSelect.tsx
index 3875fd00022..51d667b6242 100644
--- a/packages/twenty-ui/src/navigation/menu/menu-item/components/MenuItemSelect.tsx
+++ b/packages/twenty-ui/src/navigation/menu/menu-item/components/MenuItemSelect.tsx
@@ -8,8 +8,7 @@ import {
type IconComponent,
} from '@ui/display';
import { type ReactNode, useContext } from 'react';
-import { ThemeContext } from '@ui/theme';
-import { themeCssVariables } from '@ui/theme-constants';
+import { ThemeContext, themeCssVariables } from '@ui/theme-constants';
import { MenuItemLeftContent } from '../internals/components/MenuItemLeftContent';
import {
StyledMenuItemBase,
diff --git a/packages/twenty-ui/src/navigation/menu/menu-item/components/MenuItemSelectAvatar.tsx b/packages/twenty-ui/src/navigation/menu/menu-item/components/MenuItemSelectAvatar.tsx
index d1c397b6aaa..aa1970e135a 100644
--- a/packages/twenty-ui/src/navigation/menu/menu-item/components/MenuItemSelectAvatar.tsx
+++ b/packages/twenty-ui/src/navigation/menu/menu-item/components/MenuItemSelectAvatar.tsx
@@ -1,4 +1,4 @@
-import { useContext, type ReactNode } from 'react';
+import { type ReactNode, useContext } from 'react';
import {
StyledMenuItemIconCheck,
@@ -9,8 +9,7 @@ import {
import { styled } from '@linaria/react';
import { OverflowingTextWithTooltip } from '@ui/display';
-import { ThemeContext } from '@ui/theme';
-import { themeCssVariables } from '@ui/theme-constants';
+import { ThemeContext, themeCssVariables } from '@ui/theme-constants';
import { StyledMenuItemSelect } from './MenuItemSelect';
type MenuItemSelectAvatarProps = {
diff --git a/packages/twenty-ui/src/navigation/menu/menu-item/components/MenuItemSelectColor.tsx b/packages/twenty-ui/src/navigation/menu/menu-item/components/MenuItemSelectColor.tsx
index da26d1172f1..7abb018fd00 100644
--- a/packages/twenty-ui/src/navigation/menu/menu-item/components/MenuItemSelectColor.tsx
+++ b/packages/twenty-ui/src/navigation/menu/menu-item/components/MenuItemSelectColor.tsx
@@ -1,5 +1,3 @@
-import { useContext } from 'react';
-
import {
StyledMenuItemIconCheck,
StyledMenuItemLabel,
@@ -7,7 +5,9 @@ import {
} from '../internals/components/StyledMenuItemBase';
import { ColorSample, type ColorSampleVariant } from '@ui/display';
-import { type ThemeColor, ThemeContext } from '@ui/theme';
+import { type ThemeColor } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
+import { useContext } from 'react';
import {
DEFAULT_COLOR_LABELS,
type ColorLabels,
diff --git a/packages/twenty-ui/src/navigation/menu/menu-item/components/MenuItemSelectTag.tsx b/packages/twenty-ui/src/navigation/menu/menu-item/components/MenuItemSelectTag.tsx
index dab45bf897b..e28e34505f4 100644
--- a/packages/twenty-ui/src/navigation/menu/menu-item/components/MenuItemSelectTag.tsx
+++ b/packages/twenty-ui/src/navigation/menu/menu-item/components/MenuItemSelectTag.tsx
@@ -1,5 +1,3 @@
-import { useContext } from 'react';
-
import {
StyledMenuItemIconCheck,
StyledMenuItemLeftContent,
@@ -7,7 +5,9 @@ import {
import { Tag } from '@ui/components';
import { type IconComponent } from '@ui/display';
-import { type ThemeColor, ThemeContext } from '@ui/theme';
+import { type ThemeColor } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
+import { useContext } from 'react';
import { StyledMenuItemSelect } from './MenuItemSelect';
type MenuItemSelectTagProps = {
@@ -34,6 +34,7 @@ export const MenuItemSelectTag = ({
LeftIcon,
}: MenuItemSelectTagProps) => {
const { theme } = useContext(ThemeContext);
+
return (
<StyledMenuItemSelect
onClick={onClick}
diff --git a/packages/twenty-ui/src/navigation/menu/menu-item/components/__stories__/MenuItemSelectColor.stories.tsx b/packages/twenty-ui/src/navigation/menu/menu-item/components/__stories__/MenuItemSelectColor.stories.tsx
index 6f49705e523..df169246264 100644
--- a/packages/twenty-ui/src/navigation/menu/menu-item/components/__stories__/MenuItemSelectColor.stories.tsx
+++ b/packages/twenty-ui/src/navigation/menu/menu-item/components/__stories__/MenuItemSelectColor.stories.tsx
@@ -8,7 +8,7 @@ import {
type CatalogStory,
ComponentDecorator,
} from '@ui/testing';
-import { MAIN_COLOR_NAMES, type ThemeColor } from '@ui/theme';
+import { type ThemeColor, MAIN_COLOR_NAMES } from '@ui/theme';
import { MenuItemSelectColor } from '../MenuItemSelectColor';
const meta: Meta<typeof MenuItemSelectColor> = {
diff --git a/packages/twenty-ui/src/navigation/menu/menu-item/internals/components/MenuItemIcon.tsx b/packages/twenty-ui/src/navigation/menu/menu-item/internals/components/MenuItemIcon.tsx
index cfa519276d2..087b432c84f 100644
--- a/packages/twenty-ui/src/navigation/menu/menu-item/internals/components/MenuItemIcon.tsx
+++ b/packages/twenty-ui/src/navigation/menu/menu-item/internals/components/MenuItemIcon.tsx
@@ -1,8 +1,7 @@
-import { useContext } from 'react';
-
import { type IconComponent } from '@ui/display';
+import { useContext } from 'react';
+import { ThemeContext } from '@ui/theme-constants';
import { MenuItemIconBoxContainer } from './MenuItemIconBoxContainer';
-import { ThemeContext } from '@ui/theme';
export type MenuItemIconProps = {
Icon: IconComponent | null | undefined;
diff --git a/packages/twenty-ui/src/navigation/menu/menu-item/internals/components/MenuItemIconWithGripSwap.tsx b/packages/twenty-ui/src/navigation/menu/menu-item/internals/components/MenuItemIconWithGripSwap.tsx
index 825a7dd9ca1..df8d0512179 100644
--- a/packages/twenty-ui/src/navigation/menu/menu-item/internals/components/MenuItemIconWithGripSwap.tsx
+++ b/packages/twenty-ui/src/navigation/menu/menu-item/internals/components/MenuItemIconWithGripSwap.tsx
@@ -1,10 +1,7 @@
import { styled } from '@linaria/react';
import { type IconComponent, IconGripVertical } from '@ui/display';
-import {
- ICON_SIZES,
- ICON_STROKES,
- themeCssVariables,
-} from '@ui/theme-constants';
+import { ThemeContext, themeCssVariables } from '@ui/theme-constants';
+import { useContext } from 'react';
import { MenuItemIconBoxContainer } from './MenuItemIconBoxContainer';
const StyledIconSwapContainer = styled.div`
@@ -39,6 +36,8 @@ export const MenuItemIconWithGripSwap = ({
withIconContainer = false,
gripIconColor,
}: MenuItemIconWithGripSwapProps) => {
+ const { theme } = useContext(ThemeContext);
+
if (!LeftIcon) {
return null;
}
@@ -46,12 +45,12 @@ export const MenuItemIconWithGripSwap = ({
const iconContent = (
<StyledIconSwapContainer>
<StyledDefaultIcon className="grip-swap-default-icon">
- <LeftIcon size={ICON_SIZES.md} stroke={ICON_STROKES.sm} />
+ <LeftIcon size={theme.icon.size.md} stroke={theme.icon.stroke.sm} />
</StyledDefaultIcon>
<StyledHoverIcon className="grip-swap-hover-icon">
<IconGripVertical
- size={ICON_SIZES.md}
- stroke={ICON_STROKES.sm}
+ size={theme.icon.size.md}
+ stroke={theme.icon.stroke.sm}
color={gripIconColor}
/>
</StyledHoverIcon>
diff --git a/packages/twenty-ui/src/navigation/menu/menu-item/internals/components/MenuItemLeftContent.tsx b/packages/twenty-ui/src/navigation/menu/menu-item/internals/components/MenuItemLeftContent.tsx
index d5d8063449a..f500ab581fb 100644
--- a/packages/twenty-ui/src/navigation/menu/menu-item/internals/components/MenuItemLeftContent.tsx
+++ b/packages/twenty-ui/src/navigation/menu/menu-item/internals/components/MenuItemLeftContent.tsx
@@ -1,5 +1,5 @@
import { isNonEmptyString, isString } from '@sniptt/guards';
-import { type ReactNode } from 'react';
+import { type ReactNode, useContext } from 'react';
import { styled } from '@linaria/react';
import {
@@ -7,11 +7,7 @@ import {
IconGripVertical,
OverflowingTextWithTooltip,
} from '@ui/display';
-import {
- ICON_SIZES,
- ICON_STROKES,
- themeCssVariables,
-} from '@ui/theme-constants';
+import { ThemeContext, themeCssVariables } from '@ui/theme-constants';
import { type MenuItemDraggableGripMode } from '../../types/MenuItemDraggableGripMode';
import { MenuItemIcon } from './MenuItemIcon';
import { MenuItemIconBoxContainer } from './MenuItemIconBoxContainer';
@@ -59,6 +55,8 @@ export const MenuItemLeftContent = ({
gripMode = 'never',
disabled = false,
}: MenuItemLeftContentProps) => {
+ const { theme } = useContext(ThemeContext);
+
const gripIconColor = withIconContainer
? themeCssVariables.font.color.tertiary
: disabled
@@ -72,8 +70,8 @@ export const MenuItemLeftContent = ({
<MenuItemIconBoxContainer>
<StyledDraggableItem>
<IconGripVertical
- size={ICON_SIZES.md}
- stroke={ICON_STROKES.sm}
+ size={theme.icon.size.md}
+ stroke={theme.icon.stroke.sm}
color={gripIconColor}
/>
</StyledDraggableItem>
@@ -81,8 +79,8 @@ export const MenuItemLeftContent = ({
) : (
<StyledDraggableItem>
<IconGripVertical
- size={ICON_SIZES.md}
- stroke={ICON_STROKES.sm}
+ size={theme.icon.size.md}
+ stroke={theme.icon.stroke.sm}
color={gripIconColor}
/>
</StyledDraggableItem>
diff --git a/packages/twenty-ui/src/navigation/navigation-bar/components/NavigationBarItem.tsx b/packages/twenty-ui/src/navigation/navigation-bar/components/NavigationBarItem.tsx
index f6489d94e37..f897c670e4f 100644
--- a/packages/twenty-ui/src/navigation/navigation-bar/components/NavigationBarItem.tsx
+++ b/packages/twenty-ui/src/navigation/navigation-bar/components/NavigationBarItem.tsx
@@ -1,6 +1,7 @@
import { styled } from '@linaria/react';
import { type IconComponent } from '@ui/display/icon/types/IconComponent';
-import { ICON_SIZES, themeCssVariables } from '@ui/theme-constants';
+import { ThemeContext, themeCssVariables } from '@ui/theme-constants';
+import { useContext } from 'react';
const StyledIconButton = styled.div<{ isActive?: boolean }>`
align-items: center;
@@ -30,8 +31,15 @@ export const NavigationBarItem = ({
Icon,
isActive,
onClick,
-}: NavigationBarItemProps) => (
- <StyledIconButton isActive={isActive} onClick={onClick}>
- <Icon color={themeCssVariables.grayScale.gray10} size={ICON_SIZES.lg} />
- </StyledIconButton>
-);
+}: NavigationBarItemProps) => {
+ const { theme } = useContext(ThemeContext);
+
+ return (
+ <StyledIconButton isActive={isActive} onClick={onClick}>
+ <Icon
+ color={themeCssVariables.grayScale.gray10}
+ size={theme.icon.size.lg}
+ />
+ </StyledIconButton>
+ );
+};
diff --git a/packages/twenty-ui/src/testing/ComponentStorybookLayout.tsx b/packages/twenty-ui/src/testing/ComponentStorybookLayout.tsx
index 9592f182e50..006e28c4ce1 100644
--- a/packages/twenty-ui/src/testing/ComponentStorybookLayout.tsx
+++ b/packages/twenty-ui/src/testing/ComponentStorybookLayout.tsx
@@ -1,17 +1,15 @@
import { styled } from '@linaria/react';
-import { useContext } from 'react';
import { isDefined } from 'twenty-shared/utils';
-import { ThemeContext, type ThemeType } from '@ui/theme';
+import { themeCssVariables } from '@ui/theme-constants';
const StyledLayout = styled.div<{
width?: number;
backgroundColor?: string | undefined;
height: number | 'fit-content';
- theme: ThemeType;
}>`
- background: ${({ theme, backgroundColor }) =>
- backgroundColor ?? theme.background.primary};
- border: 1px solid ${({ theme }) => theme.border.color.light};
+ background: ${({ backgroundColor }) =>
+ backgroundColor ?? themeCssVariables.background.primary};
+ border: 1px solid ${themeCssVariables.border.color.light};
border-radius: 5px;
display: flex;
@@ -42,14 +40,11 @@ export const ComponentStorybookLayout = ({
height,
children,
}: ComponentStorybookLayoutProps) => {
- const { theme } = useContext(ThemeContext);
-
return (
<StyledLayout
width={width}
backgroundColor={backgroundColor}
height={isDefined(height) ? height : 'fit-content'}
- theme={theme}
>
{children}
</StyledLayout>
diff --git a/packages/twenty-ui/src/testing/decorators/CatalogDecorator.tsx b/packages/twenty-ui/src/testing/decorators/CatalogDecorator.tsx
index 34b045411c2..548caaf848e 100644
--- a/packages/twenty-ui/src/testing/decorators/CatalogDecorator.tsx
+++ b/packages/twenty-ui/src/testing/decorators/CatalogDecorator.tsx
@@ -1,36 +1,36 @@
import { styled } from '@linaria/react';
import { isNumber, isString } from '@sniptt/guards';
import { type Decorator } from '@storybook/react-vite';
-import { type ComponentProps, type JSX, useContext } from 'react';
-import { ThemeContext, type ThemeType } from '@ui/theme';
+import { type ComponentProps, type JSX } from 'react';
+import { themeCssVariables } from '@ui/theme-constants';
-const StyledColumnTitle = styled.h1<{ theme: ThemeType }>`
- font-size: ${({ theme }) => theme.font.size.lg};
- font-weight: ${({ theme }) => theme.font.weight.semiBold};
- margin: ${({ theme }) => theme.spacing(2)};
+const StyledColumnTitle = styled.h1`
+ font-size: ${themeCssVariables.font.size.lg};
+ font-weight: ${themeCssVariables.font.weight.semiBold};
+ margin: ${themeCssVariables.spacing[2]};
`;
-const StyledRowsTitle = styled.h2<{ theme: ThemeType }>`
- color: ${({ theme }) => theme.font.color.secondary};
- font-size: ${({ theme }) => theme.font.size.md};
- font-weight: ${({ theme }) => theme.font.weight.semiBold};
- margin: ${({ theme }) => theme.spacing(2)};
+const StyledRowsTitle = styled.h2`
+ color: ${themeCssVariables.font.color.secondary};
+ font-size: ${themeCssVariables.font.size.md};
+ font-weight: ${themeCssVariables.font.weight.semiBold};
+ margin: ${themeCssVariables.spacing[2]};
width: 100px;
`;
-const StyledRowTitle = styled.h3<{ theme: ThemeType }>`
- color: ${({ theme }) => theme.font.color.tertiary};
- font-size: ${({ theme }) => theme.font.size.md};
- font-weight: ${({ theme }) => theme.font.weight.semiBold};
- margin: ${({ theme }) => theme.spacing(2)};
+const StyledRowTitle = styled.h3`
+ color: ${themeCssVariables.font.color.tertiary};
+ font-size: ${themeCssVariables.font.size.md};
+ font-weight: ${themeCssVariables.font.weight.semiBold};
+ margin: ${themeCssVariables.spacing[2]};
width: 100px;
`;
-const StyledElementTitle = styled.span<{ theme: ThemeType }>`
- color: ${({ theme }) => theme.font.color.light};
- font-size: ${({ theme }) => theme.font.size.xs};
- font-weight: ${({ theme }) => theme.font.weight.semiBold};
- margin-bottom: ${({ theme }) => theme.spacing(1)};
+const StyledElementTitle = styled.span`
+ color: ${themeCssVariables.font.color.light};
+ font-size: ${themeCssVariables.font.size.xs};
+ font-weight: ${themeCssVariables.font.weight.semiBold};
+ margin-bottom: ${themeCssVariables.spacing[1]};
text-align: center;
text-transform: uppercase;
`;
@@ -40,23 +40,23 @@ const StyledContainer = styled.div`
flex-direction: row;
`;
-const StyledColumnContainer = styled.div<{ theme: ThemeType }>`
+const StyledColumnContainer = styled.div`
display: flex;
flex-direction: column;
- padding: ${({ theme }) => theme.spacing(2)};
+ padding: ${themeCssVariables.spacing[2]};
`;
-const StyledRowsContainer = styled.div<{ theme: ThemeType }>`
+const StyledRowsContainer = styled.div`
display: flex;
flex-direction: column;
- gap: ${({ theme }) => theme.spacing(2)};
+ gap: ${themeCssVariables.spacing[2]};
`;
-const StyledRowContainer = styled.div<{ theme: ThemeType }>`
+const StyledRowContainer = styled.div`
display: flex;
flex: 1;
flex-direction: row;
- gap: ${({ theme }) => theme.spacing(2)};
+ gap: ${themeCssVariables.spacing[2]};
`;
const StyledElementContainer = styled.div<{ width: number }>`
@@ -64,11 +64,11 @@ const StyledElementContainer = styled.div<{ width: number }>`
min-width: ${({ width }) => (width ? `${width}px` : 'auto')};
`;
-const StyledCellContainer = styled.div<{ theme: ThemeType }>`
+const StyledCellContainer = styled.div`
align-items: center;
display: flex;
flex-direction: column;
- padding: ${({ theme }) => theme.spacing(2)};
+ padding: ${themeCssVariables.spacing[2]};
`;
const emptyDimension = {
@@ -98,8 +98,6 @@ export type CatalogOptions = {
};
export const CatalogDecorator: Decorator = (Story, context) => {
- const { theme } = useContext(ThemeContext);
-
const {
catalog: { dimensions = [], options = {} } = {
dimensions: [],
@@ -121,31 +119,27 @@ export const CatalogDecorator: Decorator = (Story, context) => {
return (
<StyledContainer>
{dimension4.values.map((value4: any, index4: number) => (
- <StyledColumnContainer key={`d4-${index4}`} theme={theme}>
- <StyledColumnTitle theme={theme}>
+ <StyledColumnContainer key={`d4-${index4}`}>
+ <StyledColumnTitle>
{dimension4.labels?.(value4) ??
(isStringOrNumber(value4) ? value4 : '')}
</StyledColumnTitle>
{dimension3.values.map((value3: any, index3: number) => (
- <StyledRowsContainer key={`d3-${index3}`} theme={theme}>
- <StyledRowsTitle theme={theme}>
+ <StyledRowsContainer key={`d3-${index3}`}>
+ <StyledRowsTitle>
{dimension3.labels?.(value3) ??
(isStringOrNumber(value3) ? value3 : '')}
</StyledRowsTitle>
{dimension2.values.map((value2: any, index2: number) => (
- <StyledRowContainer key={`d2-${index2}`} theme={theme}>
- <StyledRowTitle theme={theme}>
+ <StyledRowContainer key={`d2-${index2}`}>
+ <StyledRowTitle>
{dimension2.labels?.(value2) ??
(isStringOrNumber(value2) ? value2 : '')}
</StyledRowTitle>
{dimension1.values.map((value1: any, index1: number) => {
return (
- <StyledCellContainer
- key={`d1-${index1}`}
- id={value1}
- theme={theme}
- >
- <StyledElementTitle theme={theme}>
+ <StyledCellContainer key={`d1-${index1}`} id={value1}>
+ <StyledElementTitle>
{dimension1.labels?.(value1) ??
(isStringOrNumber(value1) ? value1 : '')}
</StyledElementTitle>
diff --git a/packages/twenty-ui/src/testing/decorators/ComponentDecorator.tsx b/packages/twenty-ui/src/testing/decorators/ComponentDecorator.tsx
index 3aae39ebb12..966f74cb112 100644
--- a/packages/twenty-ui/src/testing/decorators/ComponentDecorator.tsx
+++ b/packages/twenty-ui/src/testing/decorators/ComponentDecorator.tsx
@@ -1,6 +1,6 @@
import { type Decorator } from '@storybook/react-vite';
-import { GRAY_SCALE_LIGHT, MAIN_COLORS_LIGHT } from '@ui/theme';
+import { themeCssVariables } from '@ui/theme-constants';
import { ComponentStorybookLayout } from '../ComponentStorybookLayout';
@@ -9,11 +9,11 @@ const getBackgroundColor = (inverted: boolean, accent: string) => {
switch (accent) {
case 'default':
- return GRAY_SCALE_LIGHT.gray11;
+ return themeCssVariables.grayScale.gray11;
case 'danger':
- return MAIN_COLORS_LIGHT.red;
+ return themeCssVariables.color.red;
case 'blue':
- return MAIN_COLORS_LIGHT.blue;
+ return themeCssVariables.color.blue;
default:
return undefined;
}
diff --git a/packages/twenty-ui/src/theme-constants/ThemeProvider.tsx b/packages/twenty-ui/src/theme-constants/ThemeProvider.tsx
new file mode 100644
index 00000000000..05d96ec475e
--- /dev/null
+++ b/packages/twenty-ui/src/theme-constants/ThemeProvider.tsx
@@ -0,0 +1,119 @@
+import { createContext, useLayoutEffect, useState } from 'react';
+
+import { themeCssVariables } from './themeCssVariables';
+
+type StringLeaves<T> = {
+ [K in keyof T]: T[K] extends string ? string : StringLeaves<T[K]>;
+};
+
+type DeepMerge<T, U> = {
+ [K in keyof T]: K extends keyof U
+ ? U[K] extends Record<string, unknown>
+ ? T[K] extends Record<string, unknown>
+ ? DeepMerge<T[K], U[K]>
+ : U[K]
+ : U[K]
+ : T[K];
+};
+
+// CSS variables that resolve to pure numbers at runtime
+type NumericOverrides = {
+ icon: {
+ size: { sm: number; md: number; lg: number; xl: number };
+ stroke: { sm: number; md: number; lg: number };
+ };
+ animation: {
+ duration: { instant: number; fast: number; normal: number; slow: number };
+ };
+ text: {
+ lineHeight: { lg: number; md: number };
+ iconSizeMedium: number;
+ iconSizeSmall: number;
+ iconStrikeLight: number;
+ iconStrikeMedium: number;
+ iconStrikeBold: number;
+ };
+ spacingMultiplicator: number;
+ lastLayerZIndex: number;
+};
+
+export type ThemeType = DeepMerge<
+ StringLeaves<typeof themeCssVariables>,
+ NumericOverrides
+>;
+
+export type ThemeContextType = {
+ theme: ThemeType;
+ colorScheme: 'light' | 'dark';
+};
+
+const computeThemeFromCss = (): ThemeType => {
+ const root = document?.documentElement;
+
+ if (!root) {
+ return themeCssVariables as unknown as ThemeType;
+ }
+
+ const computedStyle = getComputedStyle(root);
+
+ const resolve = (obj: Record<string, unknown>): Record<string, unknown> => {
+ const result: Record<string, unknown> = {};
+
+ for (const key of Object.keys(obj)) {
+ const value = obj[key];
+
+ if (typeof value === 'string' && value.startsWith('var(')) {
+ const varName = value.slice(4, -1);
+ const raw = computedStyle.getPropertyValue(varName).trim();
+ const num = Number(raw);
+ result[key] = raw !== '' && !isNaN(num) ? num : raw;
+ } else if (typeof value === 'object' && value !== null) {
+ result[key] = resolve(value as Record<string, unknown>);
+ } else {
+ result[key] = value;
+ }
+ }
+
+ return result;
+ };
+
+ return resolve(
+ themeCssVariables as unknown as Record<string, unknown>,
+ ) as unknown as ThemeType;
+};
+
+const applyColorSchemeClass = (colorScheme: 'light' | 'dark') => {
+ const root = document?.documentElement;
+ if (!root?.classList) return;
+ root.classList.toggle('dark', colorScheme === 'dark');
+ root.classList.toggle('light', colorScheme === 'light');
+};
+
+export const ThemeContext = createContext<ThemeContextType>({
+ theme: themeCssVariables as unknown as ThemeType,
+ colorScheme: 'light',
+});
+
+export const ThemeProvider = ({
+ children,
+ colorScheme,
+}: {
+ children: React.ReactNode;
+ colorScheme: 'light' | 'dark';
+}) => {
+ const [theme, setTheme] = useState<ThemeType>(() => {
+ applyColorSchemeClass(colorScheme);
+ return computeThemeFromCss();
+ });
+
+ useLayoutEffect(() => {
+ applyColorSchemeClass(colorScheme);
+ setTheme(computeThemeFromCss());
+ }, [colorScheme]);
+
+ return (
+ <ThemeContext.Provider value={{ theme, colorScheme }}>
+ {children}
+ </ThemeContext.Provider>
+ );
+};
diff --git a/packages/twenty-ui/src/theme/utils/__tests__/getNextThemeColor.test.ts b/packages/twenty-ui/src/theme-constants/__tests__/getNextThemeColor.test.ts
similarity index 75%
rename from packages/twenty-ui/src/theme/utils/__tests__/getNextThemeColor.test.ts
rename to packages/twenty-ui/src/theme-constants/__tests__/getNextThemeColor.test.ts
index e4dfa0e2a15..b8b126433be 100644
--- a/packages/twenty-ui/src/theme/utils/__tests__/getNextThemeColor.test.ts
+++ b/packages/twenty-ui/src/theme-constants/__tests__/getNextThemeColor.test.ts
@@ -10,7 +10,7 @@ describe('getNextThemeColor', () => {
const currentColor: ThemeColor = MAIN_COLOR_NAMES[0];
const nextColor: ThemeColor = MAIN_COLOR_NAMES[1];
- expect(getNextThemeColor(currentColor)).toBe(nextColor);
+ expect(getNextThemeColor(MAIN_COLOR_NAMES, currentColor)).toBe(nextColor);
});
it('returns the first color when reaching the end', () => {
@@ -18,11 +18,11 @@ describe('getNextThemeColor', () => {
MAIN_COLOR_NAMES[MAIN_COLOR_NAMES.length - 1];
const nextColor: ThemeColor = MAIN_COLOR_NAMES[0];
- expect(getNextThemeColor(currentColor)).toBe(nextColor);
+ expect(getNextThemeColor(MAIN_COLOR_NAMES, currentColor)).toBe(nextColor);
});
it('returns the first color when currentColorIsUndefined', () => {
const firstColor: ThemeColor = MAIN_COLOR_NAMES[0];
- expect(getNextThemeColor(undefined)).toBe(firstColor);
+ expect(getNextThemeColor(MAIN_COLOR_NAMES, undefined)).toBe(firstColor);
});
});
diff --git a/packages/twenty-ui/src/theme-constants/constants.ts b/packages/twenty-ui/src/theme-constants/constants.ts
index 12145f7308f..25092372eda 100644
--- a/packages/twenty-ui/src/theme-constants/constants.ts
+++ b/packages/twenty-ui/src/theme-constants/constants.ts
@@ -1,18 +1,3 @@
// CSS custom properties don't work in media queries, so MOBILE_VIEWPORT
// must be a static number rather than a var(--...) reference.
export const MOBILE_VIEWPORT = 768;
-
-// Numeric icon size/stroke constants for components that require pixel values
-// (e.g. icon size props) rather than CSS variable strings.
-export const ICON_SIZES = {
- sm: 14,
- md: 16,
- lg: 20,
- xl: 24,
-} as const;
-
-export const ICON_STROKES = {
- sm: 1.6,
- md: 2,
- lg: 2.5,
-} as const;
diff --git a/packages/twenty-ui/src/theme-constants/getNextThemeColor.ts b/packages/twenty-ui/src/theme-constants/getNextThemeColor.ts
new file mode 100644
index 00000000000..7cdcc7ba9a9
--- /dev/null
+++ b/packages/twenty-ui/src/theme-constants/getNextThemeColor.ts
@@ -0,0 +1,15 @@
+import { type ThemeColor } from '@ui/theme/constants/MainColorNames';
+
+export const getNextThemeColor = (
+ colorNames: ThemeColor[],
+ currentColor?: ThemeColor,
+): ThemeColor => {
+ if (currentColor === null || currentColor === undefined) {
+ return colorNames[0];
+ }
+ const currentColorIndex = colorNames.findIndex(
+ (color) => color === currentColor,
+ );
+ const nextColorIndex = (currentColorIndex + 1) % colorNames.length;
+ return colorNames[nextColorIndex];
+};
diff --git a/packages/twenty-ui/src/theme-constants/index.ts b/packages/twenty-ui/src/theme-constants/index.ts
index 6347808cb7d..7e804abdedf 100644
--- a/packages/twenty-ui/src/theme-constants/index.ts
+++ b/packages/twenty-ui/src/theme-constants/index.ts
@@ -7,5 +7,8 @@
* |___/
*/
-export { MOBILE_VIEWPORT, ICON_SIZES, ICON_STROKES } from './constants';
+export { MOBILE_VIEWPORT } from './constants';
+export { getNextThemeColor } from './getNextThemeColor';
export { themeCssVariables } from './themeCssVariables';
+export type { ThemeType, ThemeContextType } from './ThemeProvider';
+export { ThemeContext, ThemeProvider } from './ThemeProvider';
diff --git a/packages/twenty-ui/src/theme/constants/ThemeDark.ts b/packages/twenty-ui/src/theme/constants/ThemeDark.ts
index 15342aaa669..94cf05ea051 100644
--- a/packages/twenty-ui/src/theme/constants/ThemeDark.ts
+++ b/packages/twenty-ui/src/theme/constants/ThemeDark.ts
@@ -3,7 +3,6 @@ import { ILLUSTRATION_ICON_DARK } from '@ui/theme/constants/IllustrationIconDark
import { COLOR_DARK } from './ColorsDark';
import { GRAY_SCALE_DARK } from './GrayScaleDark';
import { SNACK_BAR_DARK } from './SnackBarDark';
-import type { ThemeType } from '../types/ThemeType';
import { ACCENT_DARK } from './AccentDark';
import { BACKGROUND_DARK } from './BackgroundDark';
import { BORDER_DARK } from './BorderDark';
@@ -12,8 +11,9 @@ import { CODE_DARK } from './CodeDark';
import { FONT_DARK } from './FontDark';
import { TAG_DARK } from './TagDark';
import { THEME_COMMON } from './ThemeCommon';
+import type { THEME_LIGHT } from './ThemeLight';
-export const THEME_DARK: ThemeType = {
+export const THEME_DARK: typeof THEME_LIGHT = {
...THEME_COMMON,
...{
accent: ACCENT_DARK,
diff --git a/packages/twenty-ui/src/theme/index.ts b/packages/twenty-ui/src/theme/index.ts
index 93719dad5bd..f004e400708 100644
--- a/packages/twenty-ui/src/theme/index.ts
+++ b/packages/twenty-ui/src/theme/index.ts
@@ -52,11 +52,3 @@ export { THEME_DARK } from './constants/ThemeDark';
export { THEME_LIGHT } from './constants/ThemeLight';
export { TRANSPARENT_COLORS_DARK } from './constants/TransparentColorsDark';
export { TRANSPARENT_COLORS_LIGHT } from './constants/TransparentColorsLight';
-export type { ThemeContextType } from './provider/ThemeContextProvider';
-export {
- ThemeContext,
- ThemeContextProvider,
-} from './provider/ThemeContextProvider';
-export { ThemeProvider } from './provider/ThemeProvider';
-export type { ThemeType } from './types/ThemeType';
-export { getNextThemeColor } from './utils/getNextThemeColor';
diff --git a/packages/twenty-ui/src/theme/provider/ThemeContextProvider.tsx b/packages/twenty-ui/src/theme/provider/ThemeContextProvider.tsx
deleted file mode 100644
index 1a5abbb2e3b..00000000000
--- a/packages/twenty-ui/src/theme/provider/ThemeContextProvider.tsx
+++ /dev/null
@@ -1,30 +0,0 @@
-import { createContext, useLayoutEffect } from 'react';
-
-import { type ThemeType } from '@ui/theme/types/ThemeType';
-
-export type ThemeContextType = {
- theme: ThemeType;
-};
-
-export const ThemeContext = createContext<ThemeContextType>(
- {} as ThemeContextType,
-);
-
-export const ThemeContextProvider = ({
- children,
- theme,
-}: {
- children: React.ReactNode;
- theme: ThemeType;
-}) => {
- useLayoutEffect(() => {
- const root = document.documentElement;
- const isDark = theme.name === 'dark';
- root.classList.toggle('dark', isDark);
- root.classList.toggle('light', !isDark);
- }, [theme.name]);
-
- return (
- <ThemeContext.Provider value={{ theme }}>{children}</ThemeContext.Provider>
- );
-};
diff --git a/packages/twenty-ui/src/theme/provider/ThemeProvider.tsx b/packages/twenty-ui/src/theme/provider/ThemeProvider.tsx
deleted file mode 100644
index 612853fdc19..00000000000
--- a/packages/twenty-ui/src/theme/provider/ThemeProvider.tsx
+++ /dev/null
@@ -1,14 +0,0 @@
-import { type ReactNode } from 'react';
-
-import { ThemeContextProvider } from '@ui/theme/provider/ThemeContextProvider';
-
-import { type ThemeType } from '..';
-
-type ThemeProviderProps = {
- theme: ThemeType;
- children: ReactNode;
-};
-
-export const ThemeProvider = ({ theme, children }: ThemeProviderProps) => {
- return <ThemeContextProvider theme={theme}>{children}</ThemeContextProvider>;
-};
diff --git a/packages/twenty-ui/src/theme/types/ThemeType.ts b/packages/twenty-ui/src/theme/types/ThemeType.ts
deleted file mode 100644
index 02d902c03ea..00000000000
--- a/packages/twenty-ui/src/theme/types/ThemeType.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import { type THEME_LIGHT } from '../constants/ThemeLight';
-
-export type ThemeType = typeof THEME_LIGHT;
diff --git a/packages/twenty-ui/src/theme/utils/getNextThemeColor.ts b/packages/twenty-ui/src/theme/utils/getNextThemeColor.ts
deleted file mode 100644
index 6feb92d3810..00000000000
--- a/packages/twenty-ui/src/theme/utils/getNextThemeColor.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import { MAIN_COLOR_NAMES, type ThemeColor } from '@ui/theme';
-import { isDefined } from 'twenty-shared/utils';
-
-export const getNextThemeColor = (currentColor?: ThemeColor): ThemeColor => {
- if (!isDefined(currentColor)) {
- return MAIN_COLOR_NAMES[0];
- }
- const currentColorIndex = MAIN_COLOR_NAMES.findIndex(
- (color) => color === currentColor,
- );
- const nextColorIndex = (currentColorIndex + 1) % MAIN_COLOR_NAMES.length;
- return MAIN_COLOR_NAMES[nextColorIndex];
-};
diff --git a/packages/twenty-ui/src/utilities/animation/components/AnimatedCircleLoading.tsx b/packages/twenty-ui/src/utilities/animation/components/AnimatedCircleLoading.tsx
index 61e03d09be7..342fd2973d2 100644
--- a/packages/twenty-ui/src/utilities/animation/components/AnimatedCircleLoading.tsx
+++ b/packages/twenty-ui/src/utilities/animation/components/AnimatedCircleLoading.tsx
@@ -2,7 +2,7 @@ import React, { useContext } from 'react';
import { motion } from 'framer-motion';
import { styled } from '@linaria/react';
-import { ThemeContext } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
const StyledAnimatedContainer = styled(motion.div)`
align-items: center;
@@ -16,6 +16,7 @@ export const AnimatedCircleLoading = ({
children: React.ReactNode;
}) => {
const { theme } = useContext(ThemeContext);
+
return (
<StyledAnimatedContainer
initial={{ rotate: 0 }}
diff --git a/packages/twenty-ui/src/utilities/animation/components/AnimatedEaseIn.tsx b/packages/twenty-ui/src/utilities/animation/components/AnimatedEaseIn.tsx
index 1791d3df34c..2548b0aff03 100644
--- a/packages/twenty-ui/src/utilities/animation/components/AnimatedEaseIn.tsx
+++ b/packages/twenty-ui/src/utilities/animation/components/AnimatedEaseIn.tsx
@@ -1,6 +1,7 @@
-import { useContext } from 'react';
-import { type AnimationDuration, ThemeContext } from '@ui/theme';
import { motion } from 'framer-motion';
+import { useContext } from 'react';
+import { type AnimationDuration } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
type AnimatedEaseInProps = Omit<
React.ComponentProps<typeof motion.div>,
@@ -14,6 +15,7 @@ export const AnimatedEaseIn = ({
duration = 'normal',
}: AnimatedEaseInProps) => {
const { theme } = useContext(ThemeContext);
+
const initial = { opacity: 0 };
const animate = { opacity: 1 };
const transition = {
diff --git a/packages/twenty-ui/src/utilities/animation/components/AnimatedEaseInOut.tsx b/packages/twenty-ui/src/utilities/animation/components/AnimatedEaseInOut.tsx
index 6b3683ef7c2..9754b0d1d26 100644
--- a/packages/twenty-ui/src/utilities/animation/components/AnimatedEaseInOut.tsx
+++ b/packages/twenty-ui/src/utilities/animation/components/AnimatedEaseInOut.tsx
@@ -1,6 +1,7 @@
-import { useContext } from 'react';
-import { type AnimationDuration, ThemeContext } from '@ui/theme';
import { AnimatePresence, motion } from 'framer-motion';
+import { useContext } from 'react';
+import { type AnimationDuration } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
type AnimatedEaseInOutProps = {
isOpen: boolean;
diff --git a/packages/twenty-ui/src/utilities/animation/components/AnimatedFadeOut.tsx b/packages/twenty-ui/src/utilities/animation/components/AnimatedFadeOut.tsx
index fcd2937d467..d3e3ffb35d1 100644
--- a/packages/twenty-ui/src/utilities/animation/components/AnimatedFadeOut.tsx
+++ b/packages/twenty-ui/src/utilities/animation/components/AnimatedFadeOut.tsx
@@ -1,6 +1,7 @@
-import { useContext } from 'react';
-import { type AnimationDuration, ThemeContext } from '@ui/theme';
import { AnimatePresence, motion } from 'framer-motion';
+import { useContext } from 'react';
+import { type AnimationDuration } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
type AnimatedFadeOutProps = {
isOpen: boolean;
@@ -18,6 +19,7 @@ export const AnimatedFadeOut = ({
marginTop,
}: AnimatedFadeOutProps) => {
const { theme } = useContext(ThemeContext);
+
return (
<AnimatePresence>
{isOpen && (
diff --git a/packages/twenty-ui/src/utilities/animation/components/AnimatedRotate.tsx b/packages/twenty-ui/src/utilities/animation/components/AnimatedRotate.tsx
index 8a4dbed3ab2..545890f8012 100644
--- a/packages/twenty-ui/src/utilities/animation/components/AnimatedRotate.tsx
+++ b/packages/twenty-ui/src/utilities/animation/components/AnimatedRotate.tsx
@@ -1,8 +1,8 @@
-import { useContext } from 'react';
-
import { styled } from '@linaria/react';
-import { ThemeContext, type AnimationDuration } from '@ui/theme';
import { type HTMLMotionProps, motion } from 'framer-motion';
+import { type AnimationDuration } from '@ui/theme';
+import { ThemeContext } from '@ui/theme-constants';
+import { useContext } from 'react';
type AnimatedRotateProps = Omit<
HTMLMotionProps<'div'>,
@@ -24,6 +24,7 @@ export const AnimatedRotate = ({
animateOnHover,
}: AnimatedRotateProps): JSX.Element => {
const { theme } = useContext(ThemeContext);
+
const initial = { opacity: 0, rotate: -90 };
const animate = { opacity: 1, rotate: 0 };
const exit = { opacity: 0, rotate: 90 };
diff --git a/packages/twenty-ui/src/utilities/animation/components/AnimatedTranslation.tsx b/packages/twenty-ui/src/utilities/animation/components/AnimatedTranslation.tsx
index e782399860a..03e226f6439 100644
--- a/packages/twenty-ui/src/utilities/animation/components/AnimatedTranslation.tsx
+++ b/packages/twenty-ui/src/utilities/animation/components/AnimatedTranslation.tsx
@@ -1,6 +1,6 @@
-import { useContext } from 'react';
import { motion } from 'framer-motion';
-import { ThemeContext } from '@ui/theme';
+import { useContext } from 'react';
+import { ThemeContext } from '@ui/theme-constants';
type AnimatedTranslationProps = {
children: React.ReactNode;
@@ -22,7 +22,7 @@ export const AnimatedTranslation = ({ children }: AnimatedTranslationProps) => {
opacity: 1,
y: 0,
transition: {
- duration: theme.animation.duration.normal, // Replace this with your theme's duration
+ duration: theme.animation.duration.normal,
ease: 'easeInOut',
},
},
diff --git a/packages/twenty-ui/src/utilities/color/utils/__tests__/stringToThemeColorP3String.test.ts b/packages/twenty-ui/src/utilities/color/utils/__tests__/stringToThemeColorP3String.test.ts
index efddd316142..c7f3ba9ca02 100644
--- a/packages/twenty-ui/src/utilities/color/utils/__tests__/stringToThemeColorP3String.test.ts
+++ b/packages/twenty-ui/src/utilities/color/utils/__tests__/stringToThemeColorP3String.test.ts
@@ -1,4 +1,3 @@
-import { THEME_LIGHT } from '@ui/theme';
import { stringToThemeColor } from '@ui/utilities';
import { stringToThemeColorP3String } from '@ui/utilities/color/utils/stringToThemeColorP3String';
@@ -19,14 +18,19 @@ describe('stringToThemeColor', () => {
});
describe('stringToThemeColorP3String', () => {
- it('should return a theme color based on a string', () => {
+ it('should return a resolved CSS variable value for a color', () => {
+ const mockTheme = {
+ color: new Proxy({} as Record<string, string>, {
+ get: (_, prop) => `mock-${String(prop)}`,
+ }),
+ } as any;
+
const color = stringToThemeColorP3String({
string: 'test',
- theme: THEME_LIGHT,
variant: 9,
+ theme: mockTheme,
});
expect(typeof color).toBe('string');
- expect(Object.values(THEME_LIGHT.color)).toContain(color);
});
});
diff --git a/packages/twenty-ui/src/utilities/color/utils/stringToThemeColorP3String.ts b/packages/twenty-ui/src/utilities/color/utils/stringToThemeColorP3String.ts
index ab83a86463e..c01a5e12c64 100644
--- a/packages/twenty-ui/src/utilities/color/utils/stringToThemeColorP3String.ts
+++ b/packages/twenty-ui/src/utilities/color/utils/stringToThemeColorP3String.ts
@@ -1,4 +1,5 @@
-import { MAIN_COLOR_NAMES, type ThemeColor, type ThemeType } from '@ui/theme';
+import { type ThemeType, type themeCssVariables } from '@ui/theme-constants';
+import { type ThemeColor, MAIN_COLOR_NAMES } from '@ui/theme';
export const stringToThemeColor = (string: string): ThemeColor => {
let hash = 0;
@@ -12,12 +13,12 @@ export const stringToThemeColor = (string: string): ThemeColor => {
export const stringToThemeColorP3String = ({
string,
- theme,
variant = 9,
+ theme,
}: {
string: string;
- theme: ThemeType;
variant: number;
+ theme: ThemeType;
}): string => {
if (variant < 1 || variant > 12) {
throw new Error('Variant must be between 1 and 12');
@@ -25,7 +26,9 @@ export const stringToThemeColorP3String = ({
const colorName = stringToThemeColor(string);
const colorNameWithVariant =
- `${colorName}${variant}` as keyof typeof theme.color;
+ `${colorName}${variant}` as keyof typeof themeCssVariables.color;
- return theme.color[colorNameWithVariant] as string;
+ return theme.color[
+ colorNameWithVariant as keyof typeof theme.color
+ ] as string;
};
diff --git a/packages/twenty-ui/src/utilities/color/utils/themeColorSchema.ts b/packages/twenty-ui/src/utilities/color/utils/themeColorSchema.ts
index 3f1c73f1f23..8b2bde570ce 100644
--- a/packages/twenty-ui/src/utilities/color/utils/themeColorSchema.ts
+++ b/packages/twenty-ui/src/utilities/color/utils/themeColorSchema.ts
@@ -1,6 +1,6 @@
import { z } from 'zod';
-import { MAIN_COLOR_NAMES, type ThemeColor } from '@ui/theme';
+import { type ThemeColor, MAIN_COLOR_NAMES } from '@ui/theme';
export const themeColorSchema = z.enum(
MAIN_COLOR_NAMES as [ThemeColor, ...ThemeColor[]],