Complete linaria migration (#18361)

## Summary

Completes the migration of the frontend styling system from **Emotion**
(`@emotion/styled`, `@emotion/react`) to **Linaria** (`@linaria/react`,
`@linaria/core`), a zero-runtime CSS-in-JS library where styles are
extracted at build time.

This is the final step of the migration — all ~494 files across
`twenty-front`, `twenty-ui`, `twenty-website`, and `twenty-sdk` are now
fully converted.

## Changes

### Styling Migration (across ~480 component files)
- Replaced all `@emotion/styled` imports with `@linaria/react`
- Converted runtime theme access patterns (`({ theme }) => theme.x.y`)
to build-time `themeCssVariables` CSS custom properties
- Replaced `useTheme()` hook (from Emotion) with
`useContext(ThemeContext)` where runtime theme values are still needed
(e.g., passing colors to non-CSS props like icon components)
- Removed `@emotion/react` `css` helper usages in favor of Linaria
template literals

### Dependency & Configuration Changes
- **Removed**: `@emotion/react`, `@emotion/styled` from root
`package.json`
- **Added**: `@wyw-in-js/babel-preset`, `next-with-linaria` (for
twenty-website SSR support)
- Updated Nx generator defaults from `@emotion/styled` to
`@linaria/react` in `nx.json`
- Simplified `vite.config.ts` (removed Emotion-specific configuration)
- Updated `twenty-website/next.config.js` to use `next-with-linaria` for
SSR Linaria support

### Storybook & Testing
- Removed `ThemeProvider` from Emotion in Storybook previews
(`twenty-front`, `twenty-sdk`)
- Now relies solely on `ThemeContextProvider` for theme injection

### Documentation
- Removed the temporary `docs/emotion-to-linaria-migration-plan.md`
(migration complete)
- Updated `CLAUDE.md` and `README.md` to reflect Linaria as the styling
stack
- Updated frontend style guide docs across all locales

## How it works

Linaria extracts styles at build time via the `@wyw-in-js/vite` plugin.
All expressions in `styled` template literals must be **statically
evaluable** — no runtime theme objects or closures over component state.

- **Static styles** use `themeCssVariables` which map to CSS custom
properties (`var(--theme-color-x)`)
- **Runtime theme access** (for non-CSS use cases like icon `color`
props) uses `useContext(ThemeContext)` instead of Emotion's `useTheme()`
This commit is contained in:
Charles Bochet
2026-03-04 00:50:06 +01:00
committed by GitHub
parent 8a3b96d911
commit 7a2e397ad1
540 changed files with 3654 additions and 4156 deletions
@@ -1,5 +1,5 @@
import { useState } from 'react';
import styled from '@emotion/styled';
import { styled } from '@linaria/react';
import { useClientConfig } from '@/client-config/hooks/useClientConfig';
import { GET_ADMIN_AI_MODELS } from '@/settings/admin-panel/ai/graphql/queries/getAdminAiModels';
@@ -21,6 +21,7 @@ import {
import { Button } from 'twenty-ui/input';
import { Card, Section } from 'twenty-ui/layout';
import { MenuItemToggle } from 'twenty-ui/navigation';
import { themeCssVariables } from 'twenty-ui/theme-constants';
import {
useCreateDatabaseConfigVariableMutation,
useGetAdminAiModelsQuery,
@@ -31,8 +32,8 @@ import { getModelProviderLabel } from '~/pages/settings/ai/utils/getModelProvide
const StyledSearchAndFilterContainer = styled.div`
display: flex;
gap: ${({ theme }) => theme.spacing(2)};
margin-bottom: ${({ theme }) => theme.spacing(2)};
gap: ${themeCssVariables.spacing[2]};
margin-bottom: ${themeCssVariables.spacing[2]};
width: 100%;
`;
@@ -5,7 +5,7 @@ import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';
import { TabList } from '@/ui/layout/tab-list/components/TabList';
import { DEFAULT_WORKSPACE_LOGO } from '@/ui/navigation/navigation-drawer/constants/DefaultWorkspaceLogo';
import styled from '@emotion/styled';
import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
import { isNonEmptyString } from '@sniptt/guards';
import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';
@@ -30,12 +30,13 @@ import {
} from 'twenty-ui/display';
import { Button } from 'twenty-ui/input';
import { Section } from 'twenty-ui/layout';
import { themeCssVariables } from 'twenty-ui/theme-constants';
const StyledContainer = styled.div`
align-items: center;
display: flex;
flex-direction: row;
gap: ${({ theme }) => theme.spacing(2)};
gap: ${themeCssVariables.spacing[2]};
`;
export const SettingsAdminGeneral = () => {
@@ -1,10 +1,11 @@
import { useTheme } from '@emotion/react';
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';
export const SettingsAdminTabSkeletonLoader = () => {
const theme = useTheme();
const { theme } = useContext(ThemeContext);
return (
<SkeletonTheme
baseColor={theme.background.tertiary}
@@ -2,28 +2,30 @@ import { Table } from '@/ui/layout/table/components/Table';
import { TableBody } from '@/ui/layout/table/components/TableBody';
import { TableCell } from '@/ui/layout/table/components/TableCell';
import { TableRow } from '@/ui/layout/table/components/TableRow';
import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import { styled } from '@linaria/react';
import { useContext } from 'react';
import { isDefined } from 'twenty-shared/utils';
import { type IconComponent } from 'twenty-ui/display';
import { Card } from 'twenty-ui/layout';
import { ThemeContext } from 'twenty-ui/theme';
import { themeCssVariables } from 'twenty-ui/theme-constants';
const StyledCard = styled(Card)`
background-color: ${({ theme }) => theme.background.secondary};
border: 1px solid ${({ theme }) => theme.border.color.medium};
background-color: ${themeCssVariables.background.secondary};
border: 1px solid ${themeCssVariables.border.color.medium};
`;
const StyledTableRow = styled(TableRow)`
height: ${({ theme }) => theme.spacing(6)};
height: ${themeCssVariables.spacing[6]};
`;
const StyledTableCellLabel = styled(TableCell)<{
align?: 'left' | 'center' | 'right';
}>`
color: ${({ theme }) => theme.font.color.tertiary};
height: ${({ theme }) => theme.spacing(6)};
color: ${themeCssVariables.font.color.tertiary};
height: ${themeCssVariables.spacing[6]};
display: flex;
gap: ${({ theme }) => theme.spacing(2)};
gap: ${themeCssVariables.spacing[2]};
justify-content: ${({ align }) =>
align === 'right'
? 'flex-end'
@@ -36,9 +38,9 @@ const StyledTableCellValue = styled(TableCell)<{
align?: 'left' | 'center' | 'right';
clickable?: boolean;
}>`
color: ${({ theme }) => theme.font.color.primary};
color: ${themeCssVariables.font.color.primary};
cursor: ${({ clickable }) => (clickable ? 'pointer' : 'default')};
height: ${({ theme }) => theme.spacing(6)};
height: ${themeCssVariables.spacing[6]};
justify-content: ${({ align }) =>
align === 'left'
? 'flex-start'
@@ -71,7 +73,7 @@ export const SettingsAdminTableCard = ({
valueAlign = 'left',
className,
}: SettingsAdminTableCardProps) => {
const theme = useTheme();
const { theme } = useContext(ThemeContext);
return (
<StyledCard rounded={rounded} className={className}>
@@ -1,5 +1,6 @@
import styled from '@emotion/styled';
import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
import { themeCssVariables } from 'twenty-ui/theme-constants';
type SettingsAdminVersionDisplayProps = {
version: string | undefined | null;
@@ -9,23 +10,23 @@ type SettingsAdminVersionDisplayProps = {
const StyledActionLink = styled.a`
align-items: center;
color: ${({ theme }) => theme.font.color.primary};
color: ${themeCssVariables.font.color.primary};
display: flex;
font-size: ${({ theme }) => theme.font.size.sm};
font-weight: ${({ theme }) => theme.font.weight.regular};
gap: ${({ theme }) => theme.spacing(1)};
font-size: ${themeCssVariables.font.size.sm};
font-weight: ${themeCssVariables.font.weight.regular};
gap: ${themeCssVariables.spacing[1]};
text-decoration: none;
:hover {
color: ${({ theme }) => theme.font.color.primary};
color: ${themeCssVariables.font.color.primary};
cursor: pointer;
}
`;
const StyledSpan = styled.span`
color: ${({ theme }) => theme.font.color.primary};
font-size: ${({ theme }) => theme.font.size.sm};
font-weight: ${({ theme }) => theme.font.weight.regular};
color: ${themeCssVariables.font.color.primary};
font-size: ${themeCssVariables.font.size.sm};
font-weight: ${themeCssVariables.font.weight.regular};
`;
export const SettingsAdminVersionDisplay = ({
@@ -15,7 +15,7 @@ import { TableCell } from '@/ui/layout/table/components/TableCell';
import { TableHeader } from '@/ui/layout/table/components/TableHeader';
import { TableRow } from '@/ui/layout/table/components/TableRow';
import { DEFAULT_WORKSPACE_LOGO } from '@/ui/navigation/navigation-drawer/constants/DefaultWorkspaceLogo';
import styled from '@emotion/styled';
import { styled } from '@linaria/react';
import { useLingui } from '@lingui/react/macro';
import { isNonEmptyString } from '@sniptt/guards';
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
@@ -33,6 +33,7 @@ import {
} from 'twenty-ui/display';
import { Button, Toggle } from 'twenty-ui/input';
import { Section } from 'twenty-ui/layout';
import { themeCssVariables } from 'twenty-ui/theme-constants';
import { REACT_APP_SERVER_BASE_URL } from '~/config';
import {
type FeatureFlagKey,
@@ -47,12 +48,12 @@ type SettingsAdminWorkspaceContentProps = {
const StyledContainer = styled.div`
display: flex;
flex-direction: column;
gap: ${({ theme }) => theme.spacing(3)};
margin-top: ${({ theme }) => theme.spacing(6)};
gap: ${themeCssVariables.spacing[3]};
margin-top: ${themeCssVariables.spacing[6]};
`;
const StyledButtonContainer = styled.div`
margin-top: ${({ theme }) => theme.spacing(3)};
margin-top: ${themeCssVariables.spacing[3]};
`;
export const SettingsAdminWorkspaceContent = ({
@@ -1,6 +1,6 @@
import { type ConfigVariableSourceFilter } from '@/settings/admin-panel/config-variables/types/ConfigVariableSourceFilter';
import { SortOrFilterChip } from '@/views/components/SortOrFilterChip';
import styled from '@emotion/styled';
import { styled } from '@linaria/react';
const StyledChipContainer = styled.div`
display: flex;
@@ -1,16 +1,17 @@
import styled from '@emotion/styled';
import { styled } from '@linaria/react';
import { useLingui } from '@lingui/react/macro';
import { isConfigVariablesInDbEnabledState } from '@/client-config/states/isConfigVariablesInDbEnabledState';
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
import { themeCssVariables } from 'twenty-ui/theme-constants';
import {
ConfigSource,
type ConfigVariable,
} from '~/generated-metadata/graphql';
const StyledHelpText = styled.div<{ color?: string }>`
color: ${({ theme, color }) => color || theme.font.color.tertiary};
font-size: ${({ theme }) => theme.font.size.sm};
color: ${themeCssVariables.font.color.tertiary};
font-size: ${themeCssVariables.font.size.sm};
line-height: 1.5;
`;
@@ -8,11 +8,12 @@ import { DropdownMenuHeader } from '@/ui/layout/dropdown/components/DropdownMenu
import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent';
import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';
import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator';
import { useTheme } from '@emotion/react';
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';
type ConfigVariableOptionsDropdownContentProps = {
selectedCategory: ConfigVariableFilterCategory | null;
@@ -37,7 +38,7 @@ export const ConfigVariableOptionsDropdownContent = ({
onGroupFilterChange,
onShowHiddenChange,
}: ConfigVariableOptionsDropdownContentProps) => {
const theme = useTheme();
const { theme } = useContext(ThemeContext);
const isConfigVariablesInDbEnabled = useAtomStateValue(
isConfigVariablesInDbEnabledState,
@@ -1,5 +1,5 @@
import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';
import styled from '@emotion/styled';
import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
import { IconSearch } from 'twenty-ui/display';
@@ -2,7 +2,7 @@ import { useLingui } from '@lingui/react/macro';
import { isConfigVariablesInDbEnabledState } from '@/client-config/states/isConfigVariablesInDbEnabledState';
import { TextInput } from '@/ui/input/components/TextInput';
import styled from '@emotion/styled';
import { styled } from '@linaria/react';
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
import { type ConfigVariableValue } from 'twenty-shared/types';
import { type ConfigVariable } from '~/generated-metadata/graphql';
@@ -6,7 +6,7 @@ import { CONFIG_VARIABLE_SOURCE_OPTIONS } from '@/settings/admin-panel/config-va
import { configVariableGroupFilterState } from '@/settings/admin-panel/config-variables/states/configVariableGroupFilterState';
import { configVariableSourceFilterState } from '@/settings/admin-panel/config-variables/states/configVariableSourceFilterState';
import { showHiddenGroupVariablesState } from '@/settings/admin-panel/config-variables/states/showHiddenGroupVariablesState';
import styled from '@emotion/styled';
import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
import { useMemo, useState } from 'react';
import { H2Title } from 'twenty-ui/display';
@@ -1,10 +1,12 @@
import { TableCell } from '@/ui/layout/table/components/TableCell';
import { TableRow } from '@/ui/layout/table/components/TableRow';
import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
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 { type ConfigVariable } from '~/generated-metadata/graphql';
type SettingsAdminConfigVariablesRowProps = {
@@ -20,7 +22,7 @@ const StyledTruncatedCell = styled(TableCell)`
const StyledTableRow = styled(TableRow)`
&:hover {
background-color: ${({ theme }) => theme.background.transparent.light};
background-color: ${themeCssVariables.background.transparent.light};
}
`;
@@ -33,7 +35,7 @@ const StyledEllipsisLabel = styled.div`
export const SettingsAdminConfigVariablesRow = ({
variable,
}: SettingsAdminConfigVariablesRowProps) => {
const theme = useTheme();
const { theme } = useContext(ThemeContext);
const displayValue =
variable.value === ''
@@ -4,11 +4,12 @@ import { Table } from '@/ui/layout/table/components/Table';
import { TableBody } from '@/ui/layout/table/components/TableBody';
import { TableHeader } from '@/ui/layout/table/components/TableHeader';
import { TableRow } from '@/ui/layout/table/components/TableRow';
import styled from '@emotion/styled';
import { styled } from '@linaria/react';
import { themeCssVariables } from 'twenty-ui/theme-constants';
import { type ConfigVariable } from '~/generated-metadata/graphql';
const StyledTableBody = styled(TableBody)`
border-bottom: 1px solid ${({ theme }) => theme.border.color.light};
border-bottom: 1px solid ${themeCssVariables.border.color.light};
`;
type SettingsAdminConfigVariablesTableProps = {
@@ -1,12 +1,13 @@
import { useTheme } from '@emotion/react';
import { useLingui } from '@lingui/react/macro';
import { useContext } from 'react';
import { CustomError } from 'twenty-shared/utils';
import { ThemeContext } from 'twenty-ui/theme';
import { ConfigSource } from '~/generated-metadata/graphql';
export const useSourceContent = (source: ConfigSource) => {
const { t } = useLingui();
const theme = useTheme();
const { theme } = useContext(ThemeContext);
switch (source) {
case ConfigSource.DATABASE:
@@ -1,19 +1,20 @@
import { SettingsAdminHealthAccountSyncCountersTable } from '@/settings/admin-panel/health-status/components/SettingsAdminHealthAccountSyncCountersTable';
import { SettingsAdminIndicatorHealthContext } from '@/settings/admin-panel/health-status/contexts/SettingsAdminIndicatorHealthContext';
import styled from '@emotion/styled';
import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
import { useContext } from 'react';
import { themeCssVariables } from 'twenty-ui/theme-constants';
import { AdminPanelHealthServiceStatus } from '~/generated-metadata/graphql';
const StyledErrorMessage = styled.div`
color: ${({ theme }) => theme.color.red};
margin-top: ${({ theme }) => theme.spacing(2)};
color: ${themeCssVariables.color.red};
margin-top: ${themeCssVariables.spacing[2]};
`;
const StyledContainer = styled.div`
display: flex;
flex-direction: column;
gap: ${({ theme }) => theme.spacing(8)};
gap: ${themeCssVariables.spacing[8]};
`;
export const SettingsAdminConnectedAccountHealthStatus = () => {
@@ -1,12 +1,13 @@
import { SettingsAdminTableCard } from '@/settings/admin-panel/components/SettingsAdminTableCard';
import styled from '@emotion/styled';
import { styled } from '@linaria/react';
import { useLingui } from '@lingui/react/macro';
import { H2Title } from 'twenty-ui/display';
import { Section } from 'twenty-ui/layout';
import { themeCssVariables } from 'twenty-ui/theme-constants';
const StyledSettingsAdminTableCard = styled(SettingsAdminTableCard)`
padding-left: ${({ theme }) => theme.spacing(2)};
padding-right: ${({ theme }) => theme.spacing(2)};
padding-left: ${themeCssVariables.spacing[2]};
padding-right: ${themeCssVariables.spacing[2]};
`;
export const SettingsAdminHealthAccountSyncCountersTable = ({
@@ -1,5 +1,5 @@
import { SettingsListCard } from '@/settings/components/SettingsListCard';
import { useTheme } from '@emotion/react';
import { useContext } from 'react';
import { SettingsPath } from 'twenty-shared/types';
import { getSettingsPath } from 'twenty-shared/utils';
import {
@@ -10,6 +10,7 @@ import {
IconTool,
IconUserCircle,
} from 'twenty-ui/display';
import { ThemeContext } from 'twenty-ui/theme';
import {
HealthIndicatorId,
type SystemHealthService,
@@ -32,7 +33,7 @@ export const SettingsAdminHealthStatusListCard = ({
services: Array<SystemHealthService>;
loading?: boolean;
}) => {
const theme = useTheme();
const { theme } = useContext(ThemeContext);
return (
<SettingsListCard
@@ -1,7 +1,8 @@
import styled from '@emotion/styled';
import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
import { JsonTree } from 'twenty-ui/json-visualizer';
import { AnimatedExpandableContainer } from 'twenty-ui/layout';
import { themeCssVariables } from 'twenty-ui/theme-constants';
import { type QueueJob } from '~/generated-metadata/graphql';
import { useCopyToClipboard } from '~/hooks/useCopyToClipboard';
@@ -11,13 +12,13 @@ type SettingsAdminJobDetailsExpandableProps = {
};
const StyledDetailsContainer = styled.div`
background-color: ${({ theme }) => theme.background.secondary};
border-top: 1px solid ${({ theme }) => theme.border.color.medium};
padding: ${({ theme }) => theme.spacing(4)};
background-color: ${themeCssVariables.background.secondary};
border-top: 1px solid ${themeCssVariables.border.color.medium};
padding: ${themeCssVariables.spacing[4]};
`;
const StyledSection = styled.div`
margin-bottom: ${({ theme }) => theme.spacing(4)};
margin-bottom: ${themeCssVariables.spacing[4]};
&:last-child {
margin-bottom: 0;
@@ -25,35 +26,35 @@ const StyledSection = styled.div`
`;
const StyledSectionTitle = styled.div`
color: ${({ theme }) => theme.font.color.secondary};
font-size: ${({ theme }) => theme.font.size.sm};
font-weight: ${({ theme }) => theme.font.weight.medium};
margin-bottom: ${({ theme }) => theme.spacing(2)};
color: ${themeCssVariables.font.color.secondary};
font-size: ${themeCssVariables.font.size.sm};
font-weight: ${themeCssVariables.font.weight.medium};
margin-bottom: ${themeCssVariables.spacing[2]};
`;
const StyledPreformattedText = styled.pre`
background-color: ${({ theme }) => theme.background.primary};
border: 1px solid ${({ theme }) => theme.border.color.medium};
border-radius: ${({ theme }) => theme.border.radius.sm};
color: ${({ theme }) => theme.font.color.danger};
font-family: ${({ theme }) => theme.font.family};
font-size: ${({ theme }) => theme.font.size.sm};
background-color: ${themeCssVariables.background.primary};
border: 1px solid ${themeCssVariables.border.color.medium};
border-radius: ${themeCssVariables.border.radius.sm};
color: ${themeCssVariables.font.color.danger};
font-family: ${themeCssVariables.font.family};
font-size: ${themeCssVariables.font.size.sm};
margin: 0;
max-height: 300px;
overflow: auto;
padding: ${({ theme }) => theme.spacing(2)};
padding: ${themeCssVariables.spacing[2]};
white-space: pre-wrap;
word-break: break-word;
`;
const StyledLogEntry = styled.div`
background-color: ${({ theme }) => theme.background.primary};
border: 1px solid ${({ theme }) => theme.border.color.medium};
border-radius: ${({ theme }) => theme.border.radius.sm};
font-family: ${({ theme }) => theme.font.family};
font-size: ${({ theme }) => theme.font.size.sm};
margin-bottom: ${({ theme }) => theme.spacing(1)};
padding: ${({ theme }) => theme.spacing(2)};
background-color: ${themeCssVariables.background.primary};
border: 1px solid ${themeCssVariables.border.color.medium};
border-radius: ${themeCssVariables.border.radius.sm};
font-family: ${themeCssVariables.font.family};
font-size: ${themeCssVariables.font.size.sm};
margin-bottom: ${themeCssVariables.spacing[1]};
padding: ${themeCssVariables.spacing[2]};
`;
export const SettingsAdminJobDetailsExpandable = ({
@@ -1,5 +1,6 @@
import styled from '@emotion/styled';
import { styled } from '@linaria/react';
import { Tag, type TagColor } from 'twenty-ui/components';
import { themeCssVariables } from 'twenty-ui/theme-constants';
import { JobState } from '~/generated-metadata/graphql';
type SettingsAdminJobStateBadgeProps = {
@@ -20,17 +21,17 @@ const JOB_STATE_COLORS: Record<JobState, TagColor> = {
const StyledContainer = styled.div`
align-items: center;
display: flex;
gap: ${({ theme }) => theme.spacing(2)};
gap: ${themeCssVariables.spacing[2]};
`;
const StyledAttemptBadge = styled.span`
background-color: ${({ theme }) => theme.background.danger};
border: 1px solid ${({ theme }) => theme.border.color.danger};
border-radius: ${({ theme }) => theme.border.radius.sm};
color: ${({ theme }) => theme.font.color.danger};
font-size: ${({ theme }) => theme.font.size.xs};
font-weight: ${({ theme }) => theme.font.weight.medium};
padding: ${({ theme }) => `${theme.spacing(0.5)} ${theme.spacing(1)}`};
background-color: ${themeCssVariables.background.danger};
border: 1px solid ${themeCssVariables.border.color.danger};
border-radius: ${themeCssVariables.border.radius.sm};
color: ${themeCssVariables.font.color.danger};
font-size: ${themeCssVariables.font.size.xs};
font-weight: ${themeCssVariables.font.weight.medium};
padding: ${themeCssVariables.spacing['0.5']} ${themeCssVariables.spacing[1]};
white-space: nowrap;
`;
@@ -1,25 +1,26 @@
import { SettingsAdminIndicatorHealthContext } from '@/settings/admin-panel/health-status/contexts/SettingsAdminIndicatorHealthContext';
import styled from '@emotion/styled';
import { styled } from '@linaria/react';
import { useLingui } from '@lingui/react/macro';
import { useContext } from 'react';
import { JsonTree } from 'twenty-ui/json-visualizer';
import { Section } from 'twenty-ui/layout';
import { themeCssVariables } from 'twenty-ui/theme-constants';
import { AdminPanelHealthServiceStatus } from '~/generated-metadata/graphql';
import { useCopyToClipboard } from '~/hooks/useCopyToClipboard';
const StyledDetailsContainer = styled.div`
background-color: ${({ theme }) => theme.background.secondary};
padding: ${({ theme }) => theme.spacing(4)};
border-radius: ${({ theme }) => theme.border.radius.md};
border: 1px solid ${({ theme }) => theme.border.color.medium};
font-size: ${({ theme }) => theme.font.size.sm};
background-color: ${themeCssVariables.background.secondary};
padding: ${themeCssVariables.spacing[4]};
border-radius: ${themeCssVariables.border.radius.md};
border: 1px solid ${themeCssVariables.border.color.medium};
font-size: ${themeCssVariables.font.size.sm};
overflow-x: auto;
`;
const StyledErrorMessage = styled.div`
color: ${({ theme }) => theme.color.red};
margin-top: ${({ theme }) => theme.spacing(2)};
margin-bottom: ${({ theme }) => theme.spacing(4)};
color: ${themeCssVariables.color.red};
margin-top: ${themeCssVariables.spacing[2]};
margin-bottom: ${themeCssVariables.spacing[4]};
`;
export const SettingsAdminJsonDataIndicatorHealthStatus = () => {
@@ -12,11 +12,12 @@ import { TableBody } from '@/ui/layout/table/components/TableBody';
import { TableCell } from '@/ui/layout/table/components/TableCell';
import { TableHeader } from '@/ui/layout/table/components/TableHeader';
import { TableRow } from '@/ui/layout/table/components/TableRow';
import styled from '@emotion/styled';
import { styled } from '@linaria/react';
import { plural, t } from '@lingui/core/macro';
import { useState } from 'react';
import { IconRefresh, IconTrash } from 'twenty-ui/display';
import { Button, Checkbox } from 'twenty-ui/input';
import { themeCssVariables } from 'twenty-ui/theme-constants';
import {
JobState,
type QueueJob,
@@ -37,19 +38,19 @@ type SettingsAdminQueueJobsTableProps = {
const StyledContainer = styled.div`
display: flex;
flex-direction: column;
gap: ${({ theme }) => theme.spacing(4)};
gap: ${themeCssVariables.spacing[4]};
`;
const StyledControlsContainer = styled.div`
align-items: center;
display: flex;
gap: ${({ theme }) => theme.spacing(2)};
gap: ${themeCssVariables.spacing[2]};
justify-content: space-between;
`;
const StyledEmptyState = styled.div`
color: ${({ theme }) => theme.font.color.tertiary};
padding: ${({ theme }) => theme.spacing(8)};
color: ${themeCssVariables.font.color.tertiary};
padding: ${themeCssVariables.spacing[8]};
text-align: center;
`;
@@ -57,7 +58,7 @@ const StyledPaginationContainer = styled.div`
align-items: center;
display: flex;
justify-content: space-between;
padding: ${({ theme }) => theme.spacing(2)};
padding: ${themeCssVariables.spacing[2]};
`;
const StyledTableCell = styled(TableCell)`
@@ -69,11 +70,13 @@ const StyledTableCell = styled(TableCell)`
const StyledExpandableTableRow = styled(TableRow)<{ isExpanded: boolean }>`
cursor: pointer;
background-color: ${({ theme, isExpanded }) =>
isExpanded ? theme.background.transparent.light : 'transparent'};
background-color: ${({ isExpanded }) =>
isExpanded
? themeCssVariables.background.transparent.light
: 'transparent'};
&:hover {
background-color: ${({ theme }) => theme.background.transparent.light};
background-color: ${themeCssVariables.background.transparent.light};
}
`;
@@ -84,19 +87,19 @@ const StyledJobRowWrapper = styled.div`
const StyledCheckboxCell = styled(TableCell)`
justify-content: center;
padding: 0;
padding-left: ${({ theme }) => theme.spacing(1)};
padding-left: ${themeCssVariables.spacing[1]};
`;
const StyledHeaderCheckboxCell = styled(TableHeader)`
align-items: center;
display: flex;
justify-content: center;
padding-right: ${({ theme }) => theme.spacing(1)};
padding-right: ${themeCssVariables.spacing[1]};
`;
const StyledButtonGroup = styled.div`
display: flex;
gap: ${({ theme }) => theme.spacing(2)};
gap: ${themeCssVariables.spacing[2]};
`;
const RETRY_MODAL_ID = 'retry-jobs-modal';
@@ -150,7 +153,6 @@ export const SettingsAdminQueueJobsTable = ({
const totalCount = data?.getQueueJobs?.totalCount || 0;
const failedJobs = jobs.filter((job) => job.state === JobState.FAILED);
// Pass retention config to parent when data loads
const shouldPassConfig =
data?.getQueueJobs?.retentionConfig !== undefined &&
onRetentionConfigLoaded !== undefined;
@@ -165,7 +167,6 @@ export const SettingsAdminQueueJobsTable = ({
const someJobsSelected =
jobs.some((job) => selectedJobIds.has(job.id)) && !allJobsSelected;
// Check if all selected jobs are failed (for showing retry button)
const selectedJobs = jobs.filter((job) => selectedJobIds.has(job.id));
const allSelectedAreFailed =
selectedJobs.length > 0 &&
@@ -1,13 +1,14 @@
import { SettingsAdminWorkerQueueMetricsSection } from '@/settings/admin-panel/health-status/components/SettingsAdminWorkerQueueMetricsSection';
import styled from '@emotion/styled';
import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
import { useContext } from 'react';
import { AdminPanelHealthServiceStatus } from '~/generated-metadata/graphql';
import { SettingsAdminIndicatorHealthContext } from '@/settings/admin-panel/health-status/contexts/SettingsAdminIndicatorHealthContext';
import { themeCssVariables } from 'twenty-ui/theme-constants';
const StyledErrorMessage = styled.div`
color: ${({ theme }) => theme.color.red};
margin-top: ${({ theme }) => theme.spacing(2)};
color: ${themeCssVariables.color.red};
margin-top: ${themeCssVariables.spacing[2]};
`;
export const SettingsAdminWorkerHealthStatus = () => {
@@ -1,36 +1,38 @@
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 { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
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 {
QueueMetricsTimeRange,
useGetQueueMetricsQuery,
} from '~/generated-metadata/graphql';
const StyledGraphContainer = styled.div`
background-color: ${({ theme }) => theme.background.secondary};
border-radius: ${({ theme }) => theme.border.radius.md};
background-color: ${themeCssVariables.background.secondary};
border-radius: ${themeCssVariables.border.radius.md};
height: 240px;
border: 1px solid ${({ theme }) => theme.border.color.medium};
margin-bottom: ${({ theme }) => theme.spacing(4)};
border: 1px solid ${themeCssVariables.border.color.medium};
margin-bottom: ${themeCssVariables.spacing[4]};
padding-top: 10px;
width: 100%;
`;
const StyledNoDataMessage = styled.div`
align-items: center;
color: ${({ theme }) => theme.font.color.light};
color: ${themeCssVariables.font.color.light};
display: flex;
height: 100%;
justify-content: center;
`;
const StyledSettingsAdminTableCard = styled(SettingsAdminTableCard)`
padding-left: ${({ theme }) => theme.spacing(2)};
padding-right: ${({ theme }) => theme.spacing(2)};
padding-left: ${themeCssVariables.spacing[2]};
padding-right: ${themeCssVariables.spacing[2]};
`;
type SettingsAdminWorkerMetricsGraphProps = {
@@ -43,7 +45,7 @@ export const SettingsAdminWorkerMetricsGraph = ({
queueName,
timeRange,
}: SettingsAdminWorkerMetricsGraphProps) => {
const theme = useTheme();
const { theme } = useContext(ThemeContext);
const { enqueueErrorSnackBar } = useSnackBar();
const { loading, data } = useGetQueueMetricsQuery({
@@ -1,23 +1,24 @@
import styled from '@emotion/styled';
import { styled } from '@linaria/react';
import type { LineSeries, Point } from '@nivo/line';
import { type ReactElement } from 'react';
import { themeCssVariables } from 'twenty-ui/theme-constants';
const StyledTooltipContainer = styled.div`
backdrop-filter: ${({ theme }) => theme.blur.medium};
background-color: ${({ theme }) => theme.background.transparent.secondary};
border: 1px solid ${({ theme }) => theme.border.color.medium};
border-radius: ${({ theme }) => theme.border.radius.md};
box-shadow: ${({ theme }) => theme.boxShadow.light};
backdrop-filter: ${themeCssVariables.blur.medium};
background-color: ${themeCssVariables.background.transparent.secondary};
border: 1px solid ${themeCssVariables.border.color.medium};
border-radius: ${themeCssVariables.border.radius.md};
box-shadow: ${themeCssVariables.boxShadow.light};
display: flex;
flex-direction: column;
font-size: ${({ theme }) => theme.font.size.sm};
gap: ${({ theme }) => theme.spacing(2)};
padding: ${({ theme }) => theme.spacing(2)};
font-size: ${themeCssVariables.font.size.sm};
gap: ${themeCssVariables.spacing[2]};
padding: ${themeCssVariables.spacing[2]};
`;
const StyledTooltipItem = styled.div`
align-items: center;
color: ${({ theme }) => theme.font.color.primary};
color: ${themeCssVariables.font.color.primary};
display: flex;
`;
@@ -25,7 +26,7 @@ const StyledTooltipColorCircle = styled.div<{ color: string }>`
background-color: ${({ color }) => color};
border-radius: 50%;
height: 8px;
margin-right: ${({ theme }) => theme.spacing(2)};
margin-right: ${themeCssVariables.spacing[2]};
width: 8px;
`;
@@ -33,14 +34,14 @@ const StyledTooltipDataRow = styled.div`
align-items: center;
display: flex;
justify-content: space-between;
color: ${({ theme }) => theme.font.color.tertiary};
gap: ${({ theme }) => theme.spacing(2)};
color: ${themeCssVariables.font.color.tertiary};
gap: ${themeCssVariables.spacing[2]};
width: 100%;
`;
const StyledTooltipValue = styled.span`
color: ${({ theme }) => theme.font.color.primary};
font-weight: ${({ theme }) => theme.font.weight.medium};
color: ${themeCssVariables.font.color.primary};
font-weight: ${themeCssVariables.font.weight.medium};
`;
type SettingsAdminWorkerMetricsTooltipProps = {
@@ -1,7 +1,7 @@
import { WidgetSkeletonLoader } from '@/page-layout/widgets/components/WidgetSkeletonLoader';
import { WORKER_QUEUE_METRICS_SELECT_OPTIONS } from '@/settings/admin-panel/health-status/constants/WorkerQueueMetricsSelectOptions';
import { Select } from '@/ui/input/components/Select';
import styled from '@emotion/styled';
import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
import { lazy, Suspense, useState } from 'react';
import { SettingsPath } from 'twenty-shared/types';
@@ -9,6 +9,7 @@ import { getSettingsPath } from 'twenty-shared/utils';
import { H2Title, IconList } from 'twenty-ui/display';
import { Button } from 'twenty-ui/input';
import { Section } from 'twenty-ui/layout';
import { themeCssVariables } from 'twenty-ui/theme-constants';
import {
type AdminPanelWorkerQueueHealth,
QueueMetricsTimeRange,
@@ -33,13 +34,13 @@ const StyledControlsContainer = styled.div`
const StyledRightControls = styled.div`
align-items: center;
display: flex;
gap: ${({ theme }) => theme.spacing(2)};
gap: ${themeCssVariables.spacing[2]};
`;
const StyledContainer = styled.div`
display: flex;
flex-direction: column;
margin-bottom: ${({ theme }) => theme.spacing(8)};
margin-bottom: ${themeCssVariables.spacing[8]};
`;
export const SettingsAdminWorkerQueueMetricsSection = ({