Skip to content

The open alternative to Salesforce, designed for AI.

Use shared UI styles in frontend callers (#28441)

Raphaël Bosief904048c051
diff --git a/packages/twenty-docs/ui/primitives/layout/collapsible.mdx b/packages/twenty-docs/ui/primitives/layout/collapsible.mdx
index b832833ead6..9f5dc655655 100644
--- a/packages/twenty-docs/ui/primitives/layout/collapsible.mdx
+++ b/packages/twenty-docs/ui/primitives/layout/collapsible.mdx
@@ -64,7 +64,7 @@ Public types include `CollapsibleRootProps`, `CollapsibleTriggerProps`, `Collaps
Panel defaults to `dimension="height"`. Use `dimension="width"` for horizontal expansion and constrain the content's width when needed. `containAnimation` defaults to `true`, clips overflow, and lays content out in a column. Set it to `false` when content needs to overflow during the transition.
-Panel's `duration` chooses a theme preset (`instant`, `fast`, `normal`, or `slow`). For independent timings, use native `style={{ transitionDuration: '0.4s, 0.2s' }}`. The first duration controls size and the second controls opacity. Reduced-motion preferences disable the transitions, including custom timings.
+Panel's `duration` chooses a theme preset (`instant`, `fast`, `normal`, or `slow`) and defaults to `normal`. Reduced-motion preferences disable the transitions.
Panel unmounts after closing by default. Use `keepMounted` to preserve local content state while hiding the closed panel. `hiddenUntilFound` lets browser page search reveal closed content and takes precedence over `keepMounted`.
diff --git a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventsCardContent.tsx b/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventsCardContent.tsx
index 598ca5a8688..f35e9b469a3 100644
--- a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventsCardContent.tsx
+++ b/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventsCardContent.tsx
@@ -25,15 +25,9 @@ const StyledYear = styled.span`
color: ${themeCssVariables.font.color.light};
`;
-const StyledTitleContainer = styled.div`
+const StyledMonthHeading = styled(Heading)`
+ font-weight: ${themeCssVariables.font.weight.regular};
margin-bottom: ${themeCssVariables.spacing[2]};
-
- h3 {
- color: ${themeCssVariables.font.color.secondary};
- font-size: ${themeCssVariables.font.size.md};
- font-weight: ${themeCssVariables.font.weight.regular};
- line-height: inherit;
- }
`;
type CalendarEventsCardContentProps = {
@@ -98,12 +92,10 @@ export const CalendarEventsCardContent = ({
return (
<Section.Root key={monthTime}>
- <StyledTitleContainer>
- <Heading level={3} size="lg">
- {monthLabel}
- {isLastMonthOfYear && <StyledYear> {year}</StyledYear>}
- </Heading>
- </StyledTitleContainer>
+ <StyledMonthHeading level={3} size="md" color="secondary">
+ {monthLabel}
+ {isLastMonthOfYear && <StyledYear> {year}</StyledYear>}
+ </StyledMonthHeading>
<CalendarMonthCard dayTimes={monthDayTimes} />
</Section.Root>
);
diff --git a/packages/twenty-front/src/modules/activities/emails/components/EmailComposerFields.tsx b/packages/twenty-front/src/modules/activities/emails/components/EmailComposerFields.tsx
index bc3020905f0..3acab4b6ff9 100644
--- a/packages/twenty-front/src/modules/activities/emails/components/EmailComposerFields.tsx
+++ b/packages/twenty-front/src/modules/activities/emails/components/EmailComposerFields.tsx
@@ -1,6 +1,7 @@
import { EmailOperation } from 'twenty-shared/types';
import { useQuery } from '@apollo/client/react';
import { DragDropProvider } from '@dnd-kit/react';
+import { css } from '@linaria/core';
import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
import {
@@ -9,7 +10,10 @@ import {
isDefined,
} from 'twenty-shared/utils';
import { IconPaperclip } from 'twenty-ui/icon';
-import { useTheme, themeCssVariables } from 'twenty-ui/theme';
+import { useRef } from 'react';
+import { flushSync } from 'react-dom';
+import { LightButton } from 'twenty-ui/components/input';
+import { themeCssVariables } from 'twenty-ui/theme';
import { ComposerFieldRow } from '@/activities/components/ComposerFieldRow';
import { ComposerHeader } from '@/activities/components/ComposerHeader';
@@ -42,24 +46,6 @@ const StyledFieldsContainer = styled.div`
width: 100%;
`;
-const StyledCcBccToggle = styled.button`
- all: unset;
- color: ${themeCssVariables.font.color.tertiary};
- cursor: pointer;
- flex-shrink: 0;
- font-size: ${themeCssVariables.font.size.md};
- padding: 0 ${themeCssVariables.spacing[1]};
-
- &:hover {
- color: ${themeCssVariables.font.color.secondary};
- }
-
- &:focus-visible {
- outline: 2px solid ${themeCssVariables.color.blue};
- outline-offset: 2px;
- }
-`;
-
const StyledBody = styled.div`
display: flex;
flex: 1;
@@ -75,24 +61,8 @@ const StyledAttachments = styled.div`
padding: 0 ${themeCssVariables.spacing[3]} ${themeCssVariables.spacing[2]};
`;
-const StyledAttachAction = styled.button`
- align-items: center;
+const ATTACH_ACTION_CLASS_NAME = css`
align-self: flex-start;
- all: unset;
- color: ${themeCssVariables.font.color.tertiary};
- cursor: pointer;
- display: flex;
- font-size: ${themeCssVariables.font.size.md};
- gap: ${themeCssVariables.spacing[1]};
-
- &:hover {
- color: ${themeCssVariables.font.color.secondary};
- }
-
- &:focus-visible {
- outline: 2px solid ${themeCssVariables.color.blue};
- outline-offset: 2px;
- }
`;
const StyledRecipientLimitWarning = styled.div`
@@ -113,7 +83,7 @@ export const EmailComposerFields = ({
contextRecord,
onAttachFiles,
}: EmailComposerFieldsProps) => {
- const theme = useTheme();
+ const ccInputRef = useRef<HTMLInputElement>(null);
const { uploadEmailImage } = useUploadEmailImage();
const { data: accountsData } = useQuery<{
myConnectedAccounts: Pick<
@@ -196,6 +166,11 @@ export const EmailComposerFields = ({
const areCcBccFieldsVisible = composerState.showCcBcc || isDraggingRecipients;
+ const handleShowCcBcc = () => {
+ flushSync(() => composerState.setShowCcBcc(true));
+ ccInputRef.current?.focus();
+ };
+
return (
<StyledFieldsContainer>
<DragDropItemDndContext.Provider value={contextValues}>
@@ -223,11 +198,13 @@ export const EmailComposerFields = ({
label={t`To`}
trailing={
!areCcBccFieldsVisible && (
- <StyledCcBccToggle
- onClick={() => composerState.setShowCcBcc(true)}
+ <LightButton
+ emphasis="subtle"
+ size="sm"
+ onClick={handleShowCcBcc}
>
{t`Cc/Bcc`}
- </StyledCcBccToggle>
+ </LightButton>
)
}
>
@@ -247,6 +224,7 @@ export const EmailComposerFields = ({
<ComposerFieldRow label={t`Cc`}>
<EmailRecipientsFieldInput
fieldId="cc"
+ inputRef={ccInputRef}
draggedSourceIndices={getDraggedIndicesForField('cc')}
label={t`Cc`}
recipients={composerState.cc}
@@ -299,10 +277,15 @@ export const EmailComposerFields = ({
{(composerState.files.length > 0 || isDefined(onAttachFiles)) && (
<StyledAttachments>
{isDefined(onAttachFiles) && (
- <StyledAttachAction type="button" onClick={onAttachFiles}>
- <IconPaperclip size={theme.icon.size.sm} />
+ <LightButton
+ className={ATTACH_ACTION_CLASS_NAME}
+ emphasis="subtle"
+ size="sm"
+ startIcon={<IconPaperclip />}
+ onClick={onAttachFiles}
+ >
{t`Attach files`}
- </StyledAttachAction>
+ </LightButton>
)}
{composerState.files.length > 0 && (
<EmailAttachmentsField
diff --git a/packages/twenty-front/src/modules/activities/emails/recipients/components/EmailRecipientsFieldInput.tsx b/packages/twenty-front/src/modules/activities/emails/recipients/components/EmailRecipientsFieldInput.tsx
index 6d649d6607f..08f9e41ef2c 100644
--- a/packages/twenty-front/src/modules/activities/emails/recipients/components/EmailRecipientsFieldInput.tsx
+++ b/packages/twenty-front/src/modules/activities/emails/recipients/components/EmailRecipientsFieldInput.tsx
@@ -9,6 +9,7 @@ import {
type ClipboardEvent,
type MouseEvent,
type ReactNode,
+ type RefObject,
useContext,
useId,
useMemo,
@@ -100,6 +101,7 @@ const StyledInput = styled.input`
type EmailRecipientsFieldInputProps = {
fieldId: EmailRecipientsFieldId;
+ inputRef?: RefObject<HTMLInputElement | null>;
// null when the drag started in another field.
draggedSourceIndices: number[] | null;
label: string;
@@ -112,6 +114,7 @@ type EmailRecipientsFieldInputProps = {
export const EmailRecipientsFieldInput = ({
fieldId,
+ inputRef: providedInputRef,
draggedSourceIndices,
label,
recipients,
@@ -124,7 +127,8 @@ export const EmailRecipientsFieldInput = ({
const focusId = `email-recipients-field-${instanceId}`;
const suggestionsDropdownId = `${focusId}-suggestions`;
- const inputRef = useRef<HTMLInputElement>(null);
+ const localInputRef = useRef<HTMLInputElement>(null);
+ const inputRef = providedInputRef ?? localInputRef;
const { pushFocusItemToFocusStack } = usePushFocusItemToFocusStack();
const { removeFocusItemFromFocusStackById } =
diff --git a/packages/twenty-front/src/modules/activities/files/components/AttachmentList.tsx b/packages/twenty-front/src/modules/activities/files/components/AttachmentList.tsx
index 3501e0ffcfb..b24877f61e6 100644
--- a/packages/twenty-front/src/modules/activities/files/components/AttachmentList.tsx
+++ b/packages/twenty-front/src/modules/activities/files/components/AttachmentList.tsx
@@ -1,8 +1,7 @@
-import { Dialog } from 'twenty-ui/primitives/surfaces';
-import { DialogInstance } from '@/ui/layout/dialog/components/DialogInstance';
+import { FilePreviewDialog } from '@/ui/field/display/components/FilePreviewDialog';
import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
-import { lazy, Suspense, useState } from 'react';
+import { useState } from 'react';
import { DropZone } from '@/activities/files/components/DropZone';
import { useUploadAttachmentFile } from '@/activities/files/hooks/useUploadAttachmentFile';
@@ -20,20 +19,11 @@ import {
import { getAttachmentUrl } from '@/activities/utils/getAttachmentUrl';
import { useHasPermissionFlag } from '@/settings/roles/hooks/useHasPermissionFlag';
import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';
-import { ScrollWrapper } from '@/ui/utilities/scroll/components/ScrollWrapper';
import { isDefined } from 'twenty-shared/utils';
-import { IconDownload, IconX } from 'twenty-ui/icon';
-import { IconButton } from 'twenty-ui/components/input';
import { themeCssVariables } from 'twenty-ui/theme';
import { PermissionFlagType } from '~/generated-metadata/graphql';
import { AttachmentRow } from './AttachmentRow';
-const DocumentViewer = lazy(() =>
- import('@/activities/files/components/DocumentViewer').then((module) => ({
- default: module.DocumentViewer,
- })),
-);
-
type AttachmentListProps = {
targetableObject: ActivityTargetableObject;
attachments: Attachment[];
@@ -72,36 +62,6 @@ const StyledLoadingText = styled.div`
font-weight: ${themeCssVariables.font.weight.medium};
`;
-const StyledPreviewPopup = styled(Dialog.Popup)`
- gap: ${themeCssVariables.spacing[2]};
- padding: ${themeCssVariables.spacing[2]};
-`;
-
-const StyledHeader = styled.div`
- align-items: center;
- display: flex;
- flex-shrink: 0;
- justify-content: space-between;
- min-height: 40px;
- width: 100%;
-`;
-
-const StyledModalTitle = styled.span`
- color: ${themeCssVariables.font.color.primary};
-`;
-
-const StyledButtonContainer = styled.div`
- display: flex;
- flex-direction: row;
- gap: ${themeCssVariables.spacing[1]};
-`;
-
-const StyledPreviewContent = styled.div`
- display: flex;
- flex: 1 1 0%;
- flex-direction: column;
-`;
-
const PREVIEW_MODAL_ID = 'preview-modal';
export const AttachmentList = ({
@@ -140,7 +100,9 @@ export const AttachmentList = ({
};
const handlePreview = (attachment: AttachmentWithFile) => {
- if (!isAttachmentPreviewEnabled) return;
+ if (!isAttachmentPreviewEnabled) {
+ return;
+ }
setPreviewedAttachment(attachment);
openDialog(PREVIEW_MODAL_ID);
};
@@ -151,7 +113,9 @@ export const AttachmentList = ({
};
const handleDownload = () => {
- if (!isDefined(previewedAttachment)) return;
+ if (!isDefined(previewedAttachment)) {
+ return;
+ }
const attachmentUrl = getAttachmentUrl({ attachment: previewedAttachment });
downloadFile(attachmentUrl, previewedAttachment.name);
};
@@ -186,64 +150,21 @@ export const AttachmentList = ({
</StyledContainer>
)}
{previewedAttachment && isAttachmentPreviewEnabled && (
- <DialogInstance
+ <FilePreviewDialog
dialogId={PREVIEW_MODAL_ID}
- dismissible
+ scrollWrapperId={`preview-modal-${previewedAttachment.id}`}
+ title={previewedAttachment.name}
+ documentName={previewedAttachment.name}
+ documentUrl={getAttachmentUrl({ attachment: previewedAttachment })}
onClose={handleClosePreview}
- renderInDocumentBody
- >
- {({ onKeyDown }) => (
- <StyledPreviewPopup
- aria-label={previewedAttachment.name}
- onKeyDown={onKeyDown}
- size="lg"
- >
- <StyledHeader>
- <StyledModalTitle>{previewedAttachment.name}</StyledModalTitle>
- <StyledButtonContainer>
- {hasDownloadPermission && (
- <IconButton
- aria-label={t`Download attachment`}
- onClick={handleDownload}
- size="sm"
- >
- <IconDownload />
- </IconButton>
- )}
- <IconButton
- aria-label={t`Close preview`}
- onClick={handleClosePreview}
- size="sm"
- >
- <IconX />
- </IconButton>
- </StyledButtonContainer>
- </StyledHeader>
- <ScrollWrapper
- componentInstanceId={`preview-modal-${previewedAttachment.id}`}
- >
- <StyledPreviewContent>
- <Suspense
- fallback={
- <StyledLoadingContainer>
- <StyledLoadingText>
- {t`Loading document viewer...`}
- </StyledLoadingText>
- </StyledLoadingContainer>
- }
- >
- <DocumentViewer
- documentName={previewedAttachment.name}
- documentUrl={getAttachmentUrl({
- attachment: previewedAttachment,
- })}
- />
- </Suspense>
- </StyledPreviewContent>
- </ScrollWrapper>
- </StyledPreviewPopup>
- )}
- </DialogInstance>
+ onDownload={hasDownloadPermission ? handleDownload : undefined}
+ downloadLabel={t`Download attachment`}
+ loadingFallback={
+ <StyledLoadingContainer>
+ <StyledLoadingText>{t`Loading document viewer...`}</StyledLoadingText>
+ </StyledLoadingContainer>
+ }
+ />
)}
</>
);
diff --git a/packages/twenty-front/src/modules/ai/components/AiModelTierBars.tsx b/packages/twenty-front/src/modules/ai/components/AiModelTierBars.tsx
index e1fe01ffe32..c982ca2a540 100644
--- a/packages/twenty-front/src/modules/ai/components/AiModelTierBars.tsx
+++ b/packages/twenty-front/src/modules/ai/components/AiModelTierBars.tsx
@@ -1,31 +1,9 @@
-import { useRender } from '@base-ui/react/use-render';
-import { type ComponentProps } from 'react';
-import { styled } from '@linaria/react';
import { type AiModelTier } from 'twenty-shared/ai';
-import { themeCssVariables } from 'twenty-ui/theme';
+import { LightButton, type LightButtonProps } from 'twenty-ui/components/input';
import { AiModelTierIndicator } from '@/ai/components/AiModelTierIndicator';
-const StyledButton = styled.button<{ disabled: boolean }>`
- align-items: center;
- background: transparent;
- border: none;
- border-radius: ${themeCssVariables.border.radius.sm};
- cursor: ${({ disabled }) => (disabled ? 'default' : 'pointer')};
- display: flex;
- height: 24px;
- opacity: ${({ disabled }) => (disabled ? 0.5 : 1)};
- padding: 0 ${themeCssVariables.spacing[1]};
-
- &:hover {
- background: ${({ disabled }) =>
- disabled
- ? 'transparent'
- : themeCssVariables.background.transparent.light};
- }
-`;
-
-type AiModelTierBarsProps = ComponentProps<'button'> & {
+type AiModelTierBarsProps = Omit<LightButtonProps, 'children'> & {
selectedTier: AiModelTier;
label: string;
};
@@ -36,16 +14,17 @@ export const AiModelTierBars = ({
disabled = false,
ref,
...props
-}: AiModelTierBarsProps) =>
- useRender({
- defaultTagName: 'button',
- render: <StyledButton disabled={disabled} />,
- ref,
- props: {
- ...props,
- type: 'button',
- 'aria-label': label,
- disabled,
- children: <AiModelTierIndicator tier={selectedTier} />,
- },
- });
+}: AiModelTierBarsProps) => (
+ <LightButton
+ // oxlint-disable-next-line react/jsx-props-no-spreading
+ {...props}
+ ref={ref}
+ type="button"
+ aria-label={label}
+ disabled={disabled}
+ emphasis="subtle"
+ size="sm"
+ >
+ <AiModelTierIndicator tier={selectedTier} />
+ </LightButton>
+);
diff --git a/packages/twenty-front/src/modules/ai/components/AiModelTierInformationButton.tsx b/packages/twenty-front/src/modules/ai/components/AiModelTierInformationButton.tsx
index 34d090f8b0a..a7b85e84530 100644
--- a/packages/twenty-front/src/modules/ai/components/AiModelTierInformationButton.tsx
+++ b/packages/twenty-front/src/modules/ai/components/AiModelTierInformationButton.tsx
@@ -12,6 +12,7 @@ import {
IconInfoCircle,
} from 'twenty-ui/icon';
import { Separator } from 'twenty-ui/primitives/layout';
+import { LightIconButton } from 'twenty-ui/components/input';
import { MetricRow } from 'twenty-ui/components/data-display';
import {
themeCssVariables,
@@ -26,28 +27,6 @@ import { getAiModelModeDescription } from '@/ai/utils/getAiModelModeDescription'
import { StyledInformationCard } from '@/ui/layout/information-card/components/StyledInformationCard';
import { formatNumber } from '@/localization/utils/formatNumber';
-const StyledTrigger = styled.button`
- align-items: center;
- background: transparent;
- border: none;
- border-radius: ${themeCssVariables.border.radius.sm};
- color: ${themeCssVariables.font.color.tertiary};
- cursor: pointer;
- display: flex;
- height: 20px;
- justify-content: center;
- padding: 0;
- width: 20px;
-
- &:hover {
- color: ${themeCssVariables.font.color.primary};
- }
-
- &:focus-visible {
- outline: 2px solid ${themeCssVariables.color.blue};
- }
-`;
-
const StyledHeading = styled.div`
color: ${themeCssVariables.font.color.secondary};
font-size: ${themeCssVariables.font.size.xs};
@@ -127,7 +106,9 @@ export const AiModelTierInformationButton = ({
return (
<>
- <StyledTrigger
+ <LightIconButton
+ emphasis="subtle"
+ size="xs"
ref={refs.setReference}
type="button"
aria-label={t`Model information`}
@@ -135,7 +116,7 @@ export const AiModelTierInformationButton = ({
{...getReferenceProps()}
>
<IconInfoCircle size={theme.icon.size.sm} />
- </StyledTrigger>
+ </LightIconButton>
{isOpen && (
<FloatingPortal root={themeContainer}>
<StyledInformationCard
diff --git a/packages/twenty-front/src/modules/ai/components/ThinkingStepsDisplay.tsx b/packages/twenty-front/src/modules/ai/components/ThinkingStepsDisplay.tsx
index 8c3e5d2ed80..e31d26dbd80 100644
--- a/packages/twenty-front/src/modules/ai/components/ThinkingStepsDisplay.tsx
+++ b/packages/twenty-front/src/modules/ai/components/ThinkingStepsDisplay.tsx
@@ -1,6 +1,7 @@
import { styled } from '@linaria/react';
import { plural, t } from '@lingui/core/macro';
import { useState } from 'react';
+import { Collapsible } from 'twenty-ui/primitives/layout';
import { IconChevronRight, IconCpu } from 'twenty-ui/icon';
import { isDefined } from 'twenty-shared/utils';
import { themeCssVariables } from 'twenty-ui/theme';
@@ -63,20 +64,18 @@ const StyledSummaryButton = styled.button`
}
`;
-const StyledSummaryChevronContainer = styled.div<{ isExpanded: boolean }>`
+const StyledSummaryChevronContainer = styled.div`
align-items: center;
color: ${themeCssVariables.font.color.light};
display: flex;
justify-content: center;
- transform: rotate(${({ isExpanded }) => (isExpanded ? '90deg' : '0deg')});
+ transform: rotate(0deg);
transition: transform calc(${themeCssVariables.animation.duration.fast} * 1s)
ease-in-out;
-`;
-const StyledRowsContainer = styled.div`
- display: flex;
- flex-direction: column;
- gap: ${themeCssVariables.spacing[1]};
+ [data-panel-open] > & {
+ transform: rotate(90deg);
+ }
`;
const StyledRow = styled.div`
@@ -191,14 +190,14 @@ export const ThinkingStepsDisplay = ({
hasActiveStep || isExpanded || shouldKeepExpandedBeforeAnswer;
return (
- <StyledContainer>
+ <Collapsible.Root
+ open={shouldRenderRows}
+ onOpenChange={setIsExpanded}
+ render={<StyledContainer />}
+ >
{shouldShowSummaryButton && (
- <StyledSummaryButton
- type="button"
- aria-expanded={isExpanded}
- onClick={() => setIsExpanded((previousValue) => !previousValue)}
- >
- <StyledSummaryChevronContainer isExpanded={isExpanded}>
+ <Collapsible.Trigger render={<StyledSummaryButton />}>
+ <StyledSummaryChevronContainer>
<IconChevronRight size={14} />
</StyledSummaryChevronContainer>
<StyledSummaryText>
@@ -209,26 +208,19 @@ export const ThinkingStepsDisplay = ({
other: '# steps',
})}
</StyledSummaryText>
- </StyledSummaryButton>
+ </Collapsible.Trigger>
)}
- {shouldRenderRows && (
+ <Collapsible.Panel>
<StyledStepsContentContainer>
- <StyledRowsContainer>
- {parts.map((part, index) => (
- <ThinkingStepRow
- key={index}
- part={part}
- isActive={isThinkingStepPartActive(
- part,
- isLastMessageStreaming,
- )}
- />
- ))}
- {isTrailingWhileStreaming && !hasActiveStep && (
- <AiChatThinkingRow />
- )}
- </StyledRowsContainer>
+ {parts.map((part, index) => (
+ <ThinkingStepRow
+ key={index}
+ part={part}
+ isActive={isThinkingStepPartActive(part, isLastMessageStreaming)}
+ />
+ ))}
+ {isTrailingWhileStreaming && !hasActiveStep && <AiChatThinkingRow />}
{!!shouldDisplayReasoningContent && (
<StyledReasoningContainer>
<StyledReasoningText>
@@ -237,7 +229,7 @@ export const ThinkingStepsDisplay = ({
</StyledReasoningContainer>
)}
</StyledStepsContentContainer>
- )}
- </StyledContainer>
+ </Collapsible.Panel>
+ </Collapsible.Root>
);
};
diff --git a/packages/twenty-front/src/modules/ai/components/ThinkingToolStepRow.tsx b/packages/twenty-front/src/modules/ai/components/ThinkingToolStepRow.tsx
index 91be4262ed3..5b631e528c8 100644
--- a/packages/twenty-front/src/modules/ai/components/ThinkingToolStepRow.tsx
+++ b/packages/twenty-front/src/modules/ai/components/ThinkingToolStepRow.tsx
@@ -56,14 +56,18 @@ const StyledRowLabelContainer = styled.div`
min-width: 0;
`;
-const StyledChevronContainer = styled.div<{ isExpanded: boolean }>`
+const StyledChevronContainer = styled.div`
align-items: center;
color: ${themeCssVariables.font.color.light};
display: flex;
justify-content: center;
- transform: rotate(${({ isExpanded }) => (isExpanded ? '90deg' : '0deg')});
+ transform: rotate(0deg);
transition: transform calc(${themeCssVariables.animation.duration.fast} * 1s)
ease-in-out;
+
+ [data-panel-open] & {
+ transform: rotate(90deg);
+ }
`;
const StyledToolRowContainer = styled.div`
@@ -72,7 +76,7 @@ const StyledToolRowContainer = styled.div`
gap: ${themeCssVariables.spacing[1]};
`;
-const StyledToolRowButton = styled.button<{ isExpandable: boolean }>`
+const StyledToolRow = styled.div<{ isExpandable: boolean }>`
align-items: center;
background: none;
border: none;
@@ -195,97 +199,98 @@ export const ThinkingToolStepRow = ({
{ id: 'input', title: t`Input` },
];
- return (
- <StyledToolRowContainer>
- <StyledToolRowButton
- type="button"
- isExpandable={isExpandable}
- onClick={() => {
- if (!isExpandable) {
- return;
- }
-
- setIsExpanded((previousValue) => !previousValue);
- }}
- aria-expanded={isExpandable ? isExpanded : undefined}
- >
- <StyledIconContainer>
- <ToolIcon size={14} />
- </StyledIconContainer>
- <StyledRowLabelContainer>
- <StyledToolRowLabel>
- {isActive ? (
- <StyledShimmeringLabel>{displayMessage}</StyledShimmeringLabel>
- ) : (
- <OverflowingTextWithTooltip
- text={displayMessage}
- tooltipDelay={TooltipDelay.shortDelay}
- />
- )}
- </StyledToolRowLabel>
- {isExpandable && (
- <StyledChevronContainer isExpanded={isExpanded}>
- <IconChevronRight size={14} />
- </StyledChevronContainer>
+ const rowContent = (
+ <>
+ <StyledIconContainer>
+ <ToolIcon size={14} />
+ </StyledIconContainer>
+ <StyledRowLabelContainer>
+ <StyledToolRowLabel>
+ {isActive ? (
+ <StyledShimmeringLabel>{displayMessage}</StyledShimmeringLabel>
+ ) : (
+ <OverflowingTextWithTooltip
+ text={displayMessage}
+ tooltipDelay={TooltipDelay.shortDelay}
+ />
)}
- </StyledRowLabelContainer>
- </StyledToolRowButton>
+ </StyledToolRowLabel>
+ {isExpandable && (
+ <StyledChevronContainer>
+ <IconChevronRight size={14} />
+ </StyledChevronContainer>
+ )}
+ </StyledRowLabelContainer>
+ </>
+ );
+
+ return (
+ <Collapsible.Root
+ open={isExpanded}
+ onOpenChange={setIsExpanded}
+ render={<StyledToolRowContainer />}
+ >
+ {isExpandable ? (
+ <Collapsible.Trigger
+ render={<StyledToolRow as="button" isExpandable />}
+ >
+ {rowContent}
+ </Collapsible.Trigger>
+ ) : (
+ <StyledToolRow isExpandable={false}>{rowContent}</StyledToolRow>
+ )}
{isExpandable && (
- <Collapsible.Root open={isExpanded}>
- <Collapsible.Panel>
- <StyledToolDetailsContainer>
- {isNonEmptyArray(recordReferences) && (
- <StyledToolRecordsContainer>
- <ToolRecordsWidget
- message={recordsMessage ?? ''}
- recordReferences={recordReferences}
- />
- </StyledToolRecordsContainer>
- )}
- {hasError ? (
- <StyledToolErrorText>{part.errorText}</StyledToolErrorText>
- ) : (
- <TabListRoot
- componentInstanceId={toolTabListComponentInstanceId}
- >
- <StyledToolDetailsContent>
- <StyledToolTabListContainer>
- <TabList
- aria-label={t`Tool details: ${displayMessage}`}
- tabs={toolTabs}
- behaveAsLinks={false}
- componentInstanceId={toolTabListComponentInstanceId}
+ <Collapsible.Panel>
+ <StyledToolDetailsContainer>
+ {isNonEmptyArray(recordReferences) && (
+ <StyledToolRecordsContainer>
+ <ToolRecordsWidget
+ message={recordsMessage ?? ''}
+ recordReferences={recordReferences}
+ />
+ </StyledToolRecordsContainer>
+ )}
+ {hasError ? (
+ <StyledToolErrorText>{part.errorText}</StyledToolErrorText>
+ ) : (
+ <TabListRoot componentInstanceId={toolTabListComponentInstanceId}>
+ <StyledToolDetailsContent>
+ <StyledToolTabListContainer>
+ <TabList
+ aria-label={t`Tool details: ${displayMessage}`}
+ tabs={toolTabs}
+ behaveAsLinks={false}
+ componentInstanceId={toolTabListComponentInstanceId}
+ />
+ </StyledToolTabListContainer>
+ <Tabs.Panel
+ value={activeTab}
+ render={<StyledToolJsonContent />}
+ >
+ <StyledJsonTreeContainer>
+ <JsonTree
+ value={
+ (activeTab === 'output'
+ ? toolOutput
+ : toolInput) as JsonValue
+ }
+ shouldExpandNodeInitially={() => false}
+ emptyArrayLabel={t`Empty Array`}
+ emptyObjectLabel={t`Empty Object`}
+ emptyStringLabel={t`[empty string]`}
+ arrowButtonCollapsedLabel={t`Expand`}
+ arrowButtonExpandedLabel={t`Collapse`}
+ onNodeValueClick={copyToClipboard}
/>
- </StyledToolTabListContainer>
- <Tabs.Panel
- value={activeTab}
- render={<StyledToolJsonContent />}
- >
- <StyledJsonTreeContainer>
- <JsonTree
- value={
- (activeTab === 'output'
- ? toolOutput
- : toolInput) as JsonValue
- }
- shouldExpandNodeInitially={() => false}
- emptyArrayLabel={t`Empty Array`}
- emptyObjectLabel={t`Empty Object`}
- emptyStringLabel={t`[empty string]`}
- arrowButtonCollapsedLabel={t`Expand`}
- arrowButtonExpandedLabel={t`Collapse`}
- onNodeValueClick={copyToClipboard}
- />
- </StyledJsonTreeContainer>
- </Tabs.Panel>
- </StyledToolDetailsContent>
- </TabListRoot>
- )}
- </StyledToolDetailsContainer>
- </Collapsible.Panel>
- </Collapsible.Root>
+ </StyledJsonTreeContainer>
+ </Tabs.Panel>
+ </StyledToolDetailsContent>
+ </TabListRoot>
+ )}
+ </StyledToolDetailsContainer>
+ </Collapsible.Panel>
)}
- </StyledToolRowContainer>
+ </Collapsible.Root>
);
};
diff --git a/packages/twenty-front/src/modules/ai/components/__stories__/ThinkingStepsDisplay.stories.tsx b/packages/twenty-front/src/modules/ai/components/__stories__/ThinkingStepsDisplay.stories.tsx
new file mode 100644
index 00000000000..e81980da0d0
--- /dev/null
+++ b/packages/twenty-front/src/modules/ai/components/__stories__/ThinkingStepsDisplay.stories.tsx
@@ -0,0 +1,113 @@
+import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';
+import { type Meta, type StoryObj } from '@storybook/react-vite';
+import { graphql, HttpResponse } from 'msw';
+import { expect, userEvent, waitFor, within } from 'storybook/test';
+import { assertIsDefinedOrThrow } from 'twenty-shared/utils';
+import { ComponentDecorator } from 'twenty-ui/testing';
+
+import { ThinkingStepsDisplay } from '@/ai/components/ThinkingStepsDisplay';
+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';
+
+const meta: Meta<typeof ThinkingStepsDisplay> = {
+ title: 'Modules/AI/ThinkingStepsDisplay',
+ component: ThinkingStepsDisplay,
+ decorators: [ToastDecorator, MemoryRouterDecorator, ComponentDecorator],
+ parameters: {
+ container: { width: 500 },
+ msw: {
+ handlers: [
+ graphql.query('GetToolIndex', () =>
+ HttpResponse.json({ data: { getToolIndex: [] } }),
+ ),
+ ],
+ },
+ },
+ args: {
+ isLastMessageStreaming: false,
+ hasAssistantTextResponseStarted: true,
+ parts: [
+ { type: 'reasoning', state: 'done', text: 'Reviewed the request.' },
+ ],
+ },
+};
+
+export default meta;
+type Story = StoryObj<typeof ThinkingStepsDisplay>;
+
+export const SummaryDisclosure: Story = {
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+ const toggle = canvas.getByRole('button', { name: '1 step' });
+ expect(toggle).toHaveAttribute('aria-expanded', 'false');
+ expect(canvas.queryByText('Thought')).toBeNull();
+ await userEvent.tab();
+ expect(toggle).toHaveFocus();
+ await userEvent.keyboard('{Enter}');
+ const panelId = toggle.getAttribute('aria-controls');
+ assertIsDefinedOrThrow(panelId);
+ await waitFor(() => {
+ expect(toggle).toHaveAttribute('aria-expanded', 'true');
+ expect(canvasElement.ownerDocument.getElementById(panelId)).toBeVisible();
+ expect(canvas.getByText('Thought')).toBeVisible();
+ });
+ await expect(
+ await canvas.findByText('Reviewed the request.'),
+ ).toBeVisible();
+ await userEvent.keyboard(' ');
+ await waitFor(() => {
+ expect(toggle).toHaveAttribute('aria-expanded', 'false');
+ expect(canvas.queryByText('Thought')).toBeNull();
+ });
+ },
+};
+
+export const BeforeAnswer: Story = {
+ args: {
+ hasAssistantTextResponseStarted: false,
+ isLastMessageStreaming: true,
+ },
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+ expect(canvas.queryByRole('button', { name: '1 step' })).toBeNull();
+ expect(canvas.getByText('Thought')).toBeVisible();
+ await expect(
+ await canvas.findByText('Reviewed the request.'),
+ ).toBeVisible();
+ },
+};
+
+export const ToolDisclosure: Story = {
+ args: {
+ hasAssistantTextResponseStarted: false,
+ parts: [
+ {
+ type: 'dynamic-tool',
+ toolName: 'inspect_tool',
+ toolCallId: 'inspect-tool-call',
+ state: 'output-available',
+ input: 'Saved input',
+ output: 'Saved output',
+ },
+ ],
+ },
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+ const toggle = canvas.getByRole('button', { name: /inspect_tool/ });
+ expect(toggle).toHaveAttribute('aria-expanded', 'false');
+ await userEvent.click(toggle);
+ const panelId = toggle.getAttribute('aria-controls');
+ assertIsDefinedOrThrow(panelId);
+ await waitFor(() => {
+ expect(toggle).toHaveAttribute('aria-expanded', 'true');
+ expect(canvasElement.ownerDocument.getElementById(panelId)).toBeVisible();
+ expect(
+ canvas.getByRole('button', { name: 'Saved output' }),
+ ).toBeVisible();
+ });
+ await userEvent.keyboard(' ');
+ await waitFor(() => {
+ expect(toggle).toHaveAttribute('aria-expanded', 'false');
+ expect(canvas.queryByRole('button', { name: 'Saved output' })).toBeNull();
+ });
+ },
+};
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 e76b468aea6..e07486d1a73 100644
--- a/packages/twenty-front/src/modules/ai/components/internal/AiChatContextUsageButton.tsx
+++ b/packages/twenty-front/src/modules/ai/components/internal/AiChatContextUsageButton.tsx
@@ -7,6 +7,7 @@ import { useState } from 'react';
import { useReducedMotion } from 'framer-motion';
import { isDefined } from 'twenty-shared/utils';
import { MetricRow } from 'twenty-ui/components/data-display';
+import { LightIconButton } from 'twenty-ui/components/input';
import { ProgressRing } from 'twenty-ui/primitives/feedback';
import { Button } from 'twenty-ui/primitives/input';
import { IconWindow, IconGauge } from 'twenty-ui/icon';
@@ -29,26 +30,6 @@ import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomState
import { formatNumber } from '@/localization/utils/formatNumber';
import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue';
-const StyledTrigger = styled.button`
- align-items: center;
- background: transparent;
- border: none;
- border-radius: ${themeCssVariables.border.radius.md};
- cursor: pointer;
- display: flex;
- height: 24px;
- justify-content: center;
- padding: 0;
- width: 24px;
-
- &:hover {
- background: ${themeCssVariables.background.transparent.light};
- }
- &:focus-visible {
- outline: 2px solid ${themeCssVariables.color.blue};
- }
-`;
-
const StyledFooter = styled.div`
display: flex;
justify-content: flex-end;
@@ -164,7 +145,8 @@ export const AiChatContextUsageButton = () => {
return (
<>
- <StyledTrigger
+ <LightIconButton
+ size="sm"
ref={refs.setReference}
type="button"
aria-label={
@@ -181,7 +163,7 @@ export const AiChatContextUsageButton = () => {
barColor={contextWindowRingColor}
render={<span />}
/>
- </StyledTrigger>
+ </LightIconButton>
{isMounted && (
<FloatingPortal>
<StyledInformationCard
diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/components/EmailVerificationSent.tsx b/packages/twenty-front/src/modules/auth/sign-in-up/components/EmailVerificationSent.tsx
index fdc031616bc..2bc830fc56c 100644
--- a/packages/twenty-front/src/modules/auth/sign-in-up/components/EmailVerificationSent.tsx
+++ b/packages/twenty-front/src/modules/auth/sign-in-up/components/EmailVerificationSent.tsx
@@ -1,3 +1,4 @@
+import { Button } from 'twenty-ui/primitives/input';
import { styled } from '@linaria/react';
import { SubTitle } from '@/auth/components/SubTitle';
@@ -52,26 +53,6 @@ const StyledBottomLinks = styled.div`
justify-content: center;
`;
-const StyledLinkButton = styled.button`
- background: none;
- border: none;
- color: ${themeCssVariables.font.color.tertiary};
- cursor: pointer;
- font-family: ${themeCssVariables.font.family};
- font-size: ${themeCssVariables.font.size.xs};
- font-weight: ${themeCssVariables.font.weight.regular};
- line-height: 140%;
-
- &:hover {
- color: ${themeCssVariables.font.color.secondary};
- }
-
- &:disabled {
- cursor: not-allowed;
- opacity: 0.5;
- }
-`;
-
const StyledDot = styled.div`
background: ${themeCssVariables.font.color.light};
border-radius: 50%;
@@ -168,16 +149,18 @@ export const EmailVerificationSent = ({
{!isError && (
<StyledBottomLinks>
- <StyledLinkButton
+ <Button
+ variant="link"
+ size="sm"
onClick={handleResendEmailVerificationToken(email)}
disabled={isLoading}
>
{isLoading ? t`Sending...` : t`Resend email`}
- </StyledLinkButton>
+ </Button>
<StyledDot />
- <StyledLinkButton onClick={handleChangeEmail}>
+ <Button variant="link" size="sm" onClick={handleChangeEmail}>
{t`Change email`}
- </StyledLinkButton>
+ </Button>
</StyledBottomLinks>
)}
</StyledContainer>
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 0e80e2cca0a..8dac062f620 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
@@ -1,4 +1,3 @@
-import { Text } from 'twenty-ui/primitives/typography';
import { type Form } from '@/auth/sign-in-up/hooks/useSignInUpForm';
import { SignInUpMode } from '@/auth/types/SignInUpMode';
import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';
@@ -53,24 +52,16 @@ export const SignInUpPasswordField = ({
onBlur={onBlur}
onChange={onChange}
error={showErrors ? error?.message : undefined}
+ hint={
+ signInUpMode === SignInUpMode.SignUp
+ ? t`At least 8 characters long.`
+ : undefined
+ }
fullWidth
/>
- {signInUpMode === SignInUpMode.SignUp && (
- <StyledPasswordHint>{t`At least 8 characters long.`}</StyledPasswordHint>
- )}
</StyledInputContainer>
)}
/>
</StyledFullWidthMotionDiv>
);
};
-
-const StyledPasswordHint = styled(Text)`
- color: ${themeCssVariables.font.color.secondary};
- cursor: initial;
- font-size: ${themeCssVariables.font.size.sm};
- font-weight: ${themeCssVariables.font.weight.regular};
- overflow: hidden;
- padding: ${themeCssVariables.spacing[2]} 0;
- white-space: nowrap;
-`;
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 9d70b3c1e11..75586c69fc1 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
@@ -12,12 +12,15 @@ import { ONBOARDING_CONTENT_BLOCK_WIDTH } from '@/onboarding/constants/Onboardin
import { extractSecretFromOtpUri } from '@/settings/two-factor-authentication/utils/extractSecretFromOtpUri';
import { styled } from '@linaria/react';
import { Trans, useLingui } from '@lingui/react/macro';
+import { isNonEmptyString } from '@sniptt/guards';
+import { isDefined } from 'twenty-shared/utils';
import QRCodeModule from 'react-qr-code';
import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';
import { MainButton } from 'twenty-ui/components/input';
import { IconCopy } from 'twenty-ui/icon';
import { Loader } from 'twenty-ui/primitives/feedback';
-import { useTheme, themeCssVariables } from 'twenty-ui/theme';
+import { Button } from 'twenty-ui/primitives/input';
+import { themeCssVariables } from 'twenty-ui/theme';
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
import { resolveCjsModuleDefaultExport } from '~/utils/resolveCjsModuleDefaultExport';
import { useCopyToClipboard } from '~/hooks/useCopyToClipboard';
@@ -32,26 +35,7 @@ const StyledForm = styled.div`
width: ${ONBOARDING_CONTENT_BLOCK_WIDTH}px;
`;
-const StyledCopySetupKeyLink = styled.button`
- align-items: center;
- background: none;
- border: none;
- color: ${themeCssVariables.font.color.secondary};
- cursor: pointer;
- display: flex;
- font-size: ${themeCssVariables.font.size.sm};
- gap: ${themeCssVariables.spacing[1]};
- margin-top: ${themeCssVariables.spacing[2]};
- padding: 0;
- text-decoration: underline;
-
- &:hover {
- color: ${themeCssVariables.font.color.primary};
- }
-`;
-
export const SignInUpTwoFactorAuthenticationProvision = () => {
- const theme = useTheme();
const { t } = useLingui();
const { copyToClipboard } = useCopyToClipboard();
const qrCode = useAtomStateValue(qrCodeState);
@@ -62,10 +46,12 @@ export const SignInUpTwoFactorAuthenticationProvision = () => {
};
const handleCopySetupKey = async () => {
- if (!qrCode) return;
+ if (!isNonEmptyString(qrCode)) {
+ return;
+ }
const secret = extractSecretFromOtpUri(qrCode);
- if (secret !== null) {
+ if (isDefined(secret)) {
await copyToClipboard(secret, t`Setup key copied to clipboard`);
}
};
@@ -83,10 +69,16 @@ export const SignInUpTwoFactorAuthenticationProvision = () => {
<StyledTwoFactorMainContent>
{!qrCode ? <Loader /> : <QRCode value={qrCode} />}
{qrCode && (
- <StyledCopySetupKeyLink onClick={handleCopySetupKey}>
- <IconCopy size={theme.icon.size.sm} />
- <Trans>Copy Setup Key</Trans>
- </StyledCopySetupKeyLink>
+ <div style={{ marginTop: themeCssVariables.spacing[2] }}>
+ <Button
+ variant="link"
+ size="sm"
+ startIcon={<IconCopy />}
+ onClick={handleCopySetupKey}
+ >
+ <Trans>Copy Setup Key</Trans>
+ </Button>
+ </div>
)}
</StyledTwoFactorMainContent>
<MainButton onClick={handleClick} fullWidth>{t`Next`}</MainButton>
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 f9d17cbef5a..bf8ad538434 100644
--- a/packages/twenty-front/src/modules/error-handler/components/AppRootErrorFallback.tsx
+++ b/packages/twenty-front/src/modules/error-handler/components/AppRootErrorFallback.tsx
@@ -2,7 +2,8 @@ import { type AppErrorDisplayProps } from '@/error-handler/types/AppErrorDisplay
import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
import { IconReload } from 'twenty-ui/icon';
-import { useTheme, themeCssVariables } from 'twenty-ui/theme';
+import { Button } from 'twenty-ui/primitives/input';
+import { themeCssVariables } from 'twenty-ui/theme';
type AppRootErrorFallbackProps = AppErrorDisplayProps;
@@ -80,30 +81,10 @@ const StyledEmptySubTitle = styled.div`
width: 50%;
`;
-const StyledButton = styled.button`
- align-items: center;
- background: ${themeCssVariables.grayScale.gray1};
- border: 1px solid ${themeCssVariables.grayScale.gray5};
- border-radius: ${themeCssVariables.border.radius.md};
- color: ${themeCssVariables.grayScale.gray12};
- cursor: pointer;
- display: flex;
- padding: 8px;
- padding: 8px 16px;
-`;
-
-const StyledIconContainer = styled.span`
- color: ${themeCssVariables.grayScale.gray12};
- display: inline-flex;
- margin-right: 8px;
-`;
-
export const AppRootErrorFallback = ({
resetErrorBoundary,
title = t`Sorry, something went wrong`,
}: AppRootErrorFallbackProps) => {
- const theme = useTheme();
-
return (
<StyledContainer>
<StyledPanel>
@@ -124,12 +105,13 @@ export const AppRootErrorFallback = ({
{t`Please refresh the page.`}
</StyledEmptySubTitle>
</StyledEmptyTextContainer>
- <StyledButton onClick={resetErrorBoundary}>
- <StyledIconContainer>
- <IconReload size={theme.icon.size.md} />
- </StyledIconContainer>
+ <Button
+ variant="outline"
+ startIcon={<IconReload />}
+ onClick={resetErrorBoundary}
+ >
{t`Reload`}
- </StyledButton>
+ </Button>
</StyledEmptyContainer>
</StyledPanel>
</StyledContainer>
diff --git a/packages/twenty-front/src/modules/front-components/media-session/components/FrontComponentMediaSessionIndicator.tsx b/packages/twenty-front/src/modules/front-components/media-session/components/FrontComponentMediaSessionIndicator.tsx
index e7b9db29797..aa5131c0548 100644
--- a/packages/twenty-front/src/modules/front-components/media-session/components/FrontComponentMediaSessionIndicator.tsx
+++ b/packages/twenty-front/src/modules/front-components/media-session/components/FrontComponentMediaSessionIndicator.tsx
@@ -5,32 +5,10 @@ import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
import groupBy from 'lodash.groupby';
import { isNonEmptyArray } from 'twenty-shared/utils';
+import { LightIconButton } from 'twenty-ui/components/input';
import { Popover } from 'twenty-ui/primitives/surfaces';
import { themeCssVariables } from 'twenty-ui/theme';
-const StyledTrigger = styled.button`
- align-items: center;
- background: transparent;
- border: none;
- border-radius: ${themeCssVariables.border.radius.sm};
- cursor: pointer;
- display: flex;
- flex-shrink: 0;
- height: ${themeCssVariables.spacing[6]};
- justify-content: center;
- padding: 0;
- width: ${themeCssVariables.spacing[6]};
-
- &:hover {
- background: ${themeCssVariables.background.transparent.light};
- }
-
- &:focus-visible {
- outline: 2px solid ${themeCssVariables.color.orange};
- outline-offset: 2px;
- }
-`;
-
const StyledDot = styled.span<{ isCapturing: boolean }>`
background: ${({ isCapturing }) =>
isCapturing ? themeCssVariables.color.orange : 'transparent'};
@@ -76,12 +54,13 @@ export const FrontComponentMediaSessionIndicator = () => {
return (
<Popover.Root>
<Popover.Trigger
- render={<StyledTrigger />}
+ render={
+ <LightIconButton size="sm" aria-label={title}>
+ <StyledDot isCapturing={isCapturing} aria-hidden />
+ </LightIconButton>
+ }
openOnHover
- aria-label={title}
- >
- <StyledDot isCapturing={isCapturing} aria-hidden />
- </Popover.Trigger>
+ />
<Popover.Portal>
<Popover.Positioner side="bottom" align="start">
<StyledPopup initialFocus={false}>
diff --git a/packages/twenty-front/src/modules/front-components/media-session/components/__stories__/FrontComponentMediaSessionIndicator.stories.tsx b/packages/twenty-front/src/modules/front-components/media-session/components/__stories__/FrontComponentMediaSessionIndicator.stories.tsx
index 00d3b8b2893..5b3e2a2f2ac 100644
--- a/packages/twenty-front/src/modules/front-components/media-session/components/__stories__/FrontComponentMediaSessionIndicator.stories.tsx
+++ b/packages/twenty-front/src/modules/front-components/media-session/components/__stories__/FrontComponentMediaSessionIndicator.stories.tsx
@@ -59,7 +59,7 @@ export const CircularIndicators: StoryObj<
for (const name of ['Apps recording', 'Recording requests']) {
const trigger = canvas.getByRole('button', { name });
- const dot = trigger.querySelector('span[aria-hidden]');
+ const dot = trigger.querySelector('span[aria-hidden]:empty');
if (!isDefined(dot)) {
throw new Error(`Missing recording indicator for ${name}`);
@@ -157,6 +157,7 @@ export const OneRowPerApplication: StoryObj<
const applications = await screen.findByRole('list', {
name: 'Apps recording',
});
+ await waitFor(() => expect(applications).toBeVisible());
const applicationsCanvas = within(applications);
await expect(applicationsCanvas.getAllByRole('listitem')).toHaveLength(2);
diff --git a/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/KeyboardShortcutMenu.tsx b/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/KeyboardShortcutMenu.tsx
index 0b2b2f3817d..107852eed20 100644
--- a/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/KeyboardShortcutMenu.tsx
+++ b/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/KeyboardShortcutMenu.tsx
@@ -1,17 +1,12 @@
import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu';
import { useKeyboardShortcutMenu } from '@/keyboard-shortcut-menu/hooks/useKeyboardShortcutMenu';
-import { isKeyboardShortcutMenuOpenedState } from '@/keyboard-shortcut-menu/states/isKeyboardShortcutMenuOpenedState';
import { KeyboardShortcutMenuOpenContent } from '@/keyboard-shortcut-menu/components/KeyboardShortcutMenuOpenContent';
import { useGlobalHotkeys } from '@/ui/utilities/hotkey/hooks/useGlobalHotkeys';
-import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
export const KeyboardShortcutMenu = () => {
const { toggleKeyboardShortcutMenu } = useKeyboardShortcutMenu();
- const isKeyboardShortcutMenuOpened = useAtomStateValue(
- isKeyboardShortcutMenuOpenedState,
- );
const { closeSidePanelMenu } = useSidePanelMenu();
useGlobalHotkeys({
@@ -24,7 +19,5 @@ export const KeyboardShortcutMenu = () => {
dependencies: [toggleKeyboardShortcutMenu],
});
- return (
- <>{isKeyboardShortcutMenuOpened && <KeyboardShortcutMenuOpenContent />}</>
- );
+ return <KeyboardShortcutMenuOpenContent />;
};
diff --git a/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/KeyboardShortcutMenuDialog.tsx b/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/KeyboardShortcutMenuDialog.tsx
index 3c1af46bb90..f381daff642 100644
--- a/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/KeyboardShortcutMenuDialog.tsx
+++ b/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/KeyboardShortcutMenuDialog.tsx
@@ -1,71 +1,78 @@
import { styled } from '@linaria/react';
-import { themeCssVariables } from 'twenty-ui/theme';
import { t } from '@lingui/core/macro';
+import { type ReactNode } from 'react';
import { IconButton } from 'twenty-ui/components/input';
import { IconX } from 'twenty-ui/icon';
-import { useIsMobile } from 'twenty-ui/utilities';
+import { Dialog } from 'twenty-ui/primitives/surfaces';
+import { RootStackingContextZIndices } from '@/ui/layout/constants/RootStackingContextZIndices';
-const StyledDialog = styled.div<{ isMobile: boolean }>`
- background: ${themeCssVariables.background.primary};
- border-radius: ${themeCssVariables.border.radius.md};
- box-shadow: ${themeCssVariables.boxShadow.strong};
- font-family: ${themeCssVariables.font.family};
- left: 50%;
- max-width: 400px;
- overflow: hidden;
- padding: 0;
- padding: ${themeCssVariables.spacing[1]};
+const StyledOverlay = styled.div`
+ inset: 0;
position: fixed;
- top: 30%;
- transform: ${({ isMobile }) =>
- isMobile ? 'translateX(-49.5%)' : 'translateX(-50%)'};
- width: ${({ isMobile }) => (isMobile ? 'calc(100% - 40px)' : '100%')};
- z-index: 1000;
+ z-index: ${RootStackingContextZIndices.RootModal};
+`;
+
+const StyledTitle = styled.h2`
+ text-align: start;
`;
const StyledHeading = styled.div`
align-items: center;
- border-bottom: 1px solid ${themeCssVariables.border.color.medium};
- color: ${themeCssVariables.font.color.primary};
- display: flex;
flex-direction: row;
- font-weight: ${themeCssVariables.font.weight.semiBold};
justify-content: space-between;
- padding: ${themeCssVariables.spacing[3]};
`;
-const StyledContainer = styled.div`
- gap: ${themeCssVariables.spacing[2]};
- padding-bottom: ${themeCssVariables.spacing[4]};
- padding-left: ${themeCssVariables.spacing[4]};
- padding-right: ${themeCssVariables.spacing[4]};
- padding-top: ${themeCssVariables.spacing[1]};
+const StyledGroups = styled.div`
+ display: flex;
+ flex-direction: column;
+ gap: var(--t-spacing-4);
`;
type KeyboardMenuDialogProps = {
+ open: boolean;
onClose: () => void;
- children: React.ReactNode | React.ReactNode[];
+ children: ReactNode;
};
export const KeyboardMenuDialog = ({
+ open,
onClose,
children,
-}: KeyboardMenuDialogProps) => {
- const isMobile = useIsMobile();
-
- return (
- <StyledDialog isMobile={isMobile}>
- <StyledHeading>
- {t`Keyboard shortcuts`}
- <IconButton
- aria-label={t`Close keyboard shortcuts`}
- variant="ghost"
- onClick={onClose}
- >
- <IconX />
- </IconButton>
- </StyledHeading>
- <StyledContainer>{children}</StyledContainer>
- </StyledDialog>
- );
-};
+}: KeyboardMenuDialogProps) => (
+ <Dialog.Root
+ open={open}
+ onOpenChange={(isOpen) => {
+ if (!isOpen) {
+ onClose();
+ }
+ }}
+ >
+ <Dialog.Portal>
+ <StyledOverlay>
+ <Dialog.Backdrop />
+ <Dialog.Viewport>
+ <Dialog.Popup size="md">
+ <Dialog.Header render={<StyledHeading />}>
+ <Dialog.Title render={<StyledTitle />}>
+ {t`Keyboard shortcuts`}
+ </Dialog.Title>
+ <Dialog.Close
+ render={
+ <IconButton
+ aria-label={t`Close keyboard shortcuts`}
+ variant="ghost"
+ >
+ <IconX />
+ </IconButton>
+ }
+ />
+ </Dialog.Header>
+ <Dialog.Body>
+ <StyledGroups>{children}</StyledGroups>
+ </Dialog.Body>
+ </Dialog.Popup>
+ </Dialog.Viewport>
+ </StyledOverlay>
+ </Dialog.Portal>
+ </Dialog.Root>
+);
diff --git a/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/KeyboardShortcutMenuGroup.tsx b/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/KeyboardShortcutMenuGroup.tsx
index da485b0dfbc..54d68b41b6d 100644
--- a/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/KeyboardShortcutMenuGroup.tsx
+++ b/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/KeyboardShortcutMenuGroup.tsx
@@ -1,30 +1,29 @@
import { styled } from '@linaria/react';
-import { themeCssVariables } from 'twenty-ui/theme';
+import { type ReactNode, useId } from 'react';
+import { Heading } from 'twenty-ui/primitives/typography';
const StyledGroup = styled.div`
display: flex;
flex-direction: column;
- gap: ${themeCssVariables.spacing[2]};
-`;
-
-const StyledGroupHeading = styled.label`
- color: ${themeCssVariables.color.gray10};
- padding-bottom: ${themeCssVariables.spacing[1]};
- padding-top: ${themeCssVariables.spacing[4]};
+ gap: var(--t-spacing-2);
`;
type KeyboardMenuGroupProps = {
heading: string;
- children: React.ReactNode | React.ReactNode[];
+ children: ReactNode;
};
export const KeyboardMenuGroup = ({
heading,
children,
}: KeyboardMenuGroupProps) => {
+ const headingId = useId();
+
return (
- <StyledGroup>
- <StyledGroupHeading>{heading}</StyledGroupHeading>
+ <StyledGroup role="group" aria-labelledby={headingId}>
+ <Heading id={headingId} level={3} size="md" color="tertiary">
+ {heading}
+ </Heading>
{children}
</StyledGroup>
);
diff --git a/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/KeyboardShortcutMenuOpenContent.tsx b/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/KeyboardShortcutMenuOpenContent.tsx
index bf0eeee21b7..b5460c58e8c 100644
--- a/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/KeyboardShortcutMenuOpenContent.tsx
+++ b/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/KeyboardShortcutMenuOpenContent.tsx
@@ -1,36 +1,27 @@
-import { Key } from 'ts-key-enum';
-
import { KEYBOARD_SHORTCUTS_GENERAL } from '@/keyboard-shortcut-menu/constants/KeyboardShortcutsGeneral';
import { KEYBOARD_SHORTCUTS_SIDE_PANEL } from '@/keyboard-shortcut-menu/constants/KeyboardShortcutsSidePanel';
import { KEYBOARD_SHORTCUTS_TABLE } from '@/keyboard-shortcut-menu/constants/KeyboardShortcutsTable';
-import {
- KEYBOARD_SHORTCUT_MENU_INSTANCE_ID,
- useKeyboardShortcutMenu,
-} from '@/keyboard-shortcut-menu/hooks/useKeyboardShortcutMenu';
-
-import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement';
+import { useKeyboardShortcutMenu } from '@/keyboard-shortcut-menu/hooks/useKeyboardShortcutMenu';
+import { isKeyboardShortcutMenuOpenedState } from '@/keyboard-shortcut-menu/states/isKeyboardShortcutMenuOpenedState';
+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
import { t } from '@lingui/core/macro';
import { KeyboardMenuDialog } from './KeyboardShortcutMenuDialog';
import { KeyboardMenuGroup } from './KeyboardShortcutMenuGroup';
import { KeyboardMenuItem } from './KeyboardShortcutMenuItem';
export const KeyboardShortcutMenuOpenContent = () => {
- const { toggleKeyboardShortcutMenu, closeKeyboardShortcutMenu } =
- useKeyboardShortcutMenu();
-
- useHotkeysOnFocusedElement({
- keys: [Key.Escape],
- callback: () => {
- closeKeyboardShortcutMenu();
- },
- focusId: KEYBOARD_SHORTCUT_MENU_INSTANCE_ID,
- dependencies: [closeKeyboardShortcutMenu],
- });
+ const { closeKeyboardShortcutMenu } = useKeyboardShortcutMenu();
+ const isKeyboardShortcutMenuOpened = useAtomStateValue(
+ isKeyboardShortcutMenuOpenedState,
+ );
return (
<>
- <KeyboardMenuDialog onClose={toggleKeyboardShortcutMenu}>
+ <KeyboardMenuDialog
+ open={isKeyboardShortcutMenuOpened}
+ onClose={closeKeyboardShortcutMenu}
+ >
<KeyboardMenuGroup heading={t`Table`}>
{KEYBOARD_SHORTCUTS_TABLE.map((TableShortcut, index) => (
<KeyboardMenuItem shortcut={TableShortcut} key={index} />
diff --git a/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/__stories__/KeyboardShortcutMenu.stories.tsx b/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/__stories__/KeyboardShortcutMenu.stories.tsx
index fc147b02c85..9df6b4bb139 100644
--- a/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/__stories__/KeyboardShortcutMenu.stories.tsx
+++ b/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/__stories__/KeyboardShortcutMenu.stories.tsx
@@ -1,12 +1,11 @@
import { type Meta, type StoryObj } from '@storybook/react-vite';
-import { expect, within } from 'storybook/test';
-
-import { ToastDecorator } from '~/testing/decorators/ToastDecorator';
-
+import { expect, userEvent, waitFor, within } from 'storybook/test';
+import { Button } from 'twenty-ui/primitives/input';
+import { ComponentDecorator } from 'twenty-ui/testing';
import { KeyboardShortcutMenu } from '@/keyboard-shortcut-menu/components/KeyboardShortcutMenu';
import { useKeyboardShortcutMenu } from '@/keyboard-shortcut-menu/hooks/useKeyboardShortcutMenu';
-import { useEffect } from 'react';
-import { ComponentWithRouterDecorator } from '~/testing/decorators/ComponentWithRouterDecorator';
+import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';
+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';
const meta: Meta<typeof KeyboardShortcutMenu> = {
title: 'Modules/KeyboardShortcutMenu/KeyboardShortcutMenu',
@@ -14,13 +13,16 @@ const meta: Meta<typeof KeyboardShortcutMenu> = {
decorators: [
(Story) => {
const { openKeyboardShortcutMenu } = useKeyboardShortcutMenu();
- useEffect(() => {
- openKeyboardShortcutMenu();
- }, [openKeyboardShortcutMenu]);
- return <Story />;
+ return (
+ <>
+ <Button onClick={openKeyboardShortcutMenu}>Open shortcuts</Button>
+ <Story />
+ </>
+ );
},
ToastDecorator,
- ComponentWithRouterDecorator,
+ MemoryRouterDecorator,
+ ComponentDecorator,
],
};
@@ -30,7 +32,38 @@ type Story = StoryObj<typeof KeyboardShortcutMenu>;
export const Default: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
-
- expect(await canvas.findByText('Keyboard shortcuts')).toBeInTheDocument();
+ const body = within(canvasElement.ownerDocument.body);
+ const trigger = canvas.getByRole('button', { name: 'Open shortcuts' });
+ await userEvent.click(trigger);
+ const dialog = await body.findByRole('dialog', {
+ name: 'Keyboard shortcuts',
+ });
+ const closeButton = within(dialog).getByRole('button', {
+ name: 'Close keyboard shortcuts',
+ });
+ await waitFor(() => expect(dialog).toBeVisible());
+ await waitFor(() => expect(closeButton).toHaveFocus());
+ for (const name of ['Table', 'Side Panel', 'General']) {
+ expect(within(dialog).getByRole('group', { name })).toBeVisible();
+ expect(within(dialog).getByRole('heading', { name })).toHaveAttribute(
+ 'data-size',
+ 'md',
+ );
+ }
+ await userEvent.tab();
+ expect(closeButton).toHaveFocus();
+ await userEvent.keyboard('{Escape}');
+ await waitFor(() => expect(dialog).not.toBeInTheDocument());
+ await waitFor(() => expect(trigger).toHaveFocus());
+ await userEvent.keyboard('{Shift>}?{/Shift}');
+ const reopenedDialog = await body.findByRole('dialog', {
+ name: 'Keyboard shortcuts',
+ });
+ await userEvent.click(
+ within(reopenedDialog).getByRole('button', {
+ name: 'Close keyboard shortcuts',
+ }),
+ );
+ await waitFor(() => expect(reopenedDialog).not.toBeInTheDocument());
},
};
diff --git a/packages/twenty-front/src/modules/log-console/components/LogConsoleDetailPanel.tsx b/packages/twenty-front/src/modules/log-console/components/LogConsoleDetailPanel.tsx
index fb2428050fc..e8deb6e8450 100644
--- a/packages/twenty-front/src/modules/log-console/components/LogConsoleDetailPanel.tsx
+++ b/packages/twenty-front/src/modules/log-console/components/LogConsoleDetailPanel.tsx
@@ -40,6 +40,10 @@ import { getAbsoluteImageUrl } from '~/utils/image/getAbsoluteImageUrl';
const COLLAPSED_MESSAGE_STACK_LINE_COUNT = 1;
+const StyledShowMoreContainer = styled.div`
+ align-self: flex-start;
+`;
+
const StyledPanel = styled.aside`
border-left: 1px solid ${themeCssVariables.border.color.medium};
box-sizing: border-box;
@@ -274,10 +278,12 @@ export const LogConsoleDetailPanel = () => {
</StyledMessageStackLine>
))}
{hiddenMessageStackLineCount > 0 && (
- <FieldWidgetShowMoreButton
- remainingCount={hiddenMessageStackLineCount}
- onClick={() => setEntryWithExpandedMessage(entry)}
- />
+ <StyledShowMoreContainer>
+ <FieldWidgetShowMoreButton
+ remainingCount={hiddenMessageStackLineCount}
+ onClick={() => setEntryWithExpandedMessage(entry)}
+ />
+ </StyledShowMoreContainer>
)}
</StyledMessageCard>
</Section.Root>
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/NavigationMenuItemFolderLayout.tsx b/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/NavigationMenuItemFolderLayout.tsx
index 9e6ff89261d..13bd44d881d 100644
--- a/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/NavigationMenuItemFolderLayout.tsx
+++ b/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/NavigationMenuItemFolderLayout.tsx
@@ -1,15 +1,8 @@
-import { styled } from '@linaria/react';
import { useDeferredValue, type ReactNode } from 'react';
import { Collapsible } from 'twenty-ui/primitives/layout';
import { NavigationDrawerItemsCollapsableContainer } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerItemsCollapsableContainer';
-const StyledFolderExpandableWrapper = styled.div`
- & > div {
- overflow: visible !important;
- }
-`;
-
type NavigationMenuItemFolderLayoutProps = {
header: ReactNode;
isOpen: boolean;
@@ -29,13 +22,11 @@ export const NavigationMenuItemFolderLayout = ({
return (
<NavigationDrawerItemsCollapsableContainer isGroup={isGroup}>
{header}
- <StyledFolderExpandableWrapper>
- <Collapsible.Root open={isExpandedForAnimation}>
- <Collapsible.Panel dimension="height" containAnimation>
- {children}
- </Collapsible.Panel>
- </Collapsible.Root>
- </StyledFolderExpandableWrapper>
+ <Collapsible.Root open={isExpandedForAnimation}>
+ <Collapsible.Panel dimension="height" containAnimation>
+ {children}
+ </Collapsible.Panel>
+ </Collapsible.Root>
</NavigationDrawerItemsCollapsableContainer>
);
};
diff --git a/packages/twenty-front/src/modules/navigation/components/NavigationDrawerHeader.tsx b/packages/twenty-front/src/modules/navigation/components/NavigationDrawerHeader.tsx
index 831d0ea9959..04b794ba766 100644
--- a/packages/twenty-front/src/modules/navigation/components/NavigationDrawerHeader.tsx
+++ b/packages/twenty-front/src/modules/navigation/components/NavigationDrawerHeader.tsx
@@ -1,6 +1,5 @@
import { FrontComponentMediaSessionIndicator } from '@/front-components/media-session/components/FrontComponentMediaSessionIndicator';
import { APP_HEADER_HEIGHT } from '@/ui/layout/constants/AppHeaderHeight';
-import { NAVIGATION_DRAWER_COLLAPSED_BUTTON_SIZE } from '@/ui/navigation/navigation-drawer/constants/NavigationDrawerCollapsedButtonSize';
import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
import { LightIconButton } from 'twenty-ui/components/input';
@@ -40,21 +39,6 @@ const StyledCollapsedSearch = styled.div`
${themeCssVariables.spacing[1]};
`;
-const StyledSearchButtonContainer = styled.div<{ isExpanded: boolean }>`
- display: flex;
-
- > button {
- height: ${({ isExpanded }) =>
- isExpanded
- ? themeCssVariables.spacing[6]
- : `${NAVIGATION_DRAWER_COLLAPSED_BUTTON_SIZE}px`};
- width: ${({ isExpanded }) =>
- isExpanded
- ? themeCssVariables.spacing[6]
- : `${NAVIGATION_DRAWER_COLLAPSED_BUTTON_SIZE}px`};
- }
-`;
-
const StyledRightActions = styled.div`
align-items: center;
display: flex;
@@ -63,22 +47,6 @@ const StyledRightActions = styled.div`
margin-left: auto;
`;
-const StyledNavigationDrawerCollapseButtonContainer = styled.div`
- > * {
- height: ${themeCssVariables.spacing[6]};
- padding-right: 0;
- width: ${themeCssVariables.spacing[6]};
- }
-
- @media (max-width: ${MOBILE_VIEWPORT}px) {
- > * {
- height: ${NAVIGATION_DRAWER_COLLAPSED_BUTTON_SIZE}px;
- padding-right: 0;
- width: ${NAVIGATION_DRAWER_COLLAPSED_BUTTON_SIZE}px;
- }
- }
-`;
-
const StyledWorkspaceDropdownContainer = styled.div`
display: flex;
flex: 1 1 auto;
@@ -91,16 +59,14 @@ export const NavigationDrawerHeader = () => {
const isExpanded = useIsNavigationDrawerContentExpanded();
const searchButton = !isMobile && (
- <StyledSearchButtonContainer isExpanded={isExpanded}>
- <LightIconButton
- emphasis="standard"
- size="sm"
- onClick={openRecordsSearchPage}
- aria-label={t`Search`}
- >
- <IconSearch />
- </LightIconButton>
- </StyledSearchButtonContainer>
+ <LightIconButton
+ emphasis="standard"
+ size={isExpanded ? 'sm' : 'md'}
+ onClick={openRecordsSearchPage}
+ aria-label={t`Search`}
+ >
+ <IconSearch />
+ </LightIconButton>
);
return (
@@ -113,9 +79,10 @@ export const NavigationDrawerHeader = () => {
<StyledRightActions>
<FrontComponentMediaSessionIndicator />
{searchButton}
- <StyledNavigationDrawerCollapseButtonContainer>
- <NavigationDrawerCollapseButton direction="left" />
- </StyledNavigationDrawerCollapseButtonContainer>
+ <NavigationDrawerCollapseButton
+ direction="left"
+ size={isMobile ? 'md' : 'sm'}
+ />
</StyledRightActions>
)}
</StyledHeaderRow>
diff --git a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownCustomView.tsx b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownCustomView.tsx
index acaec896aae..c3176b8b860 100644
--- a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownCustomView.tsx
+++ b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownCustomView.tsx
@@ -250,7 +250,6 @@ export const ObjectOptionsDropdownCustomView = ({
<Tooltip
content={t`Not available on Default View`}
side="bottom"
- maxWidth={'100%'}
delay={TooltipDelay.mediumDelay}
disabled={!isDefaultView}
>
@@ -298,7 +297,6 @@ export const ObjectOptionsDropdownCustomView = ({
: t`Cannot delete the only view`
}
side="bottom"
- maxWidth={'100%'}
disabled={!(isDefaultView || isLastView)}
>
<div id="delete-view-menu-item">
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 0d2667190e4..2c3f019214a 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
@@ -9,32 +9,13 @@ import { RecordTableWidgetContext } from '@/object-record/record-table-widget/co
import { canCreateRecordsForObjectMetadataItem } from '@/object-record/utils/canCreateRecordsForObjectMetadataItem';
import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue';
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
-import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
import { useContext } from 'react';
import { isDefined } from 'twenty-shared/utils';
+import { LightButton } from 'twenty-ui/components/input';
import { IconPlus } from 'twenty-ui/icon';
-import { useTheme, themeCssVariables } from 'twenty-ui/theme';
-
-const StyledNewButton = styled.button`
- align-items: center;
- align-self: baseline;
- background-color: ${themeCssVariables.background.primary};
- border: none;
- border-radius: ${themeCssVariables.border.radius.sm};
- color: ${themeCssVariables.font.color.tertiary};
- cursor: pointer;
- display: flex;
- gap: ${themeCssVariables.spacing[1]};
- padding: ${themeCssVariables.spacing[1]};
-
- &:hover {
- background-color: ${themeCssVariables.background.tertiary};
- }
-`;
export const RecordBoardColumnNewRecordButton = () => {
- const theme = useTheme();
const { objectMetadataItem, selectFieldMetadataItem } =
useContext(RecordBoardContext);
@@ -84,7 +65,10 @@ export const RecordBoardColumnNewRecordButton = () => {
}
return (
- <StyledNewButton
+ <LightButton
+ emphasis="subtle"
+ size="sm"
+ startIcon={<IconPlus />}
onClick={async () => {
await createNewIndexRecord({
position: 'last',
@@ -93,8 +77,7 @@ export const RecordBoardColumnNewRecordButton = () => {
});
}}
>
- <IconPlus size={theme.icon.size.md} />
{t`New`}
- </StyledNewButton>
+ </LightButton>
);
};
diff --git a/packages/twenty-front/src/modules/object-record/record-group/components/RecordGroupsVisibilityDropdownSection.tsx b/packages/twenty-front/src/modules/object-record/record-group/components/RecordGroupsVisibilityDropdownSection.tsx
index ac7fcb4bbf2..b653b58b9f4 100644
--- a/packages/twenty-front/src/modules/object-record/record-group/components/RecordGroupsVisibilityDropdownSection.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-group/components/RecordGroupsVisibilityDropdownSection.tsx
@@ -6,7 +6,7 @@ import { type RecordGroupDefinition } from '@/object-record/record-group/types/R
import { DraggableItem } from '@/ui/layout/draggable-list/components/DraggableItem';
import { DraggableList } from '@/ui/layout/draggable-list/components/DraggableList';
import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';
-import { StyledDropdownMenuSubheader } from '@/ui/layout/dropdown/components/StyledDropdownMenuSubheader';
+import { DropdownMenuSectionLabel } from '@/ui/layout/dropdown/components/DropdownMenuSectionLabel';
type RecordGroupsVisibilityDropdownSectionProps = {
recordGroupIds: string[];
@@ -37,9 +37,7 @@ export const RecordGroupsVisibilityDropdownSection = ({
return (
<div ref={ref}>
- {showSubheader && (
- <StyledDropdownMenuSubheader>{title}</StyledDropdownMenuSubheader>
- )}
+ {showSubheader && <DropdownMenuSectionLabel label={title} />}
<DropdownMenuItemsContainer hasMaxHeight>
{recordGroupIds.length > 0 && (
<>
diff --git a/packages/twenty-front/src/modules/object-record/record-list/components/RecordListAddNew.tsx b/packages/twenty-front/src/modules/object-record/record-list/components/RecordListAddNew.tsx
index e7ecf5add03..425cdd0ce8f 100644
--- a/packages/twenty-front/src/modules/object-record/record-list/components/RecordListAddNew.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-list/components/RecordListAddNew.tsx
@@ -8,35 +8,14 @@ import { useCreateNewIndexRecord } from '@/object-record/record-table/hooks/useC
import { canCreateRecordsForObjectMetadataItem } from '@/object-record/utils/canCreateRecordsForObjectMetadataItem';
import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue';
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
-import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
import { isDefined } from 'twenty-shared/utils';
import { useToast } from 'twenty-ui/components/feedback';
+import { LightButton } from 'twenty-ui/components/input';
import { IconPlus } from 'twenty-ui/icon';
-import { useTheme, themeCssVariables } from 'twenty-ui/theme';
import { logError } from '~/utils/logError';
-const StyledAddNewRow = styled.button`
- align-items: center;
- background: transparent;
- border: none;
- border-radius: ${themeCssVariables.border.radius.sm};
- color: ${themeCssVariables.font.color.tertiary};
- cursor: pointer;
- display: flex;
- font-size: ${themeCssVariables.font.size.md};
- gap: ${themeCssVariables.spacing[1]};
- height: 24px;
- padding: 0 6px;
- text-align: left;
-
- &:hover {
- background: ${themeCssVariables.background.transparent.lighter};
- }
-`;
-
export const RecordListAddNew = () => {
- const theme = useTheme();
const { objectMetadataItem } = useRecordIndexContextOrThrow();
const { enqueueToast } = useToast();
@@ -97,13 +76,14 @@ export const RecordListAddNew = () => {
};
return (
- <StyledAddNewRow type="button" onClick={handleCreateRecord}>
- <IconPlus
- stroke={theme.icon.stroke.sm}
- size={theme.icon.size.sm}
- color={theme.font.color.tertiary}
- />
+ <LightButton
+ emphasis="subtle"
+ size="sm"
+ startIcon={<IconPlus />}
+ type="button"
+ onClick={handleCreateRecord}
+ >
{t`Add new`}
- </StyledAddNewRow>
+ </LightButton>
);
};
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellButtons.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellButtons.tsx
index 4dfb9a3b373..c97b24c9efc 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellButtons.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellButtons.tsx
@@ -8,20 +8,12 @@ import { ButtonGroup } from 'twenty-ui/primitives/input';
import { MOBILE_VIEWPORT, themeCssVariables } from 'twenty-ui/theme';
const StyledButtonContainer = styled.div`
- /* Buttons stay concentric with the frame: its radius minus the 1px border.
- The frame uses sm (not md): on this ~26px control md would exceed 50% of
- the box and clamp to a full squircle, and a scaled full squircle is not a
- uniform offset — the child corners would pull away from the frame. sm
- stays well below the clamp point so radius - inset holds in both modes. */
- --tw-button-radius: calc(${themeCssVariables.border.radius.sm} - 1px);
+ margin: ${themeCssVariables.spacing[1]};
- border: 1px solid ${themeCssVariables.border.color.strong};
@media (max-width: ${MOBILE_VIEWPORT}px) {
position: relative;
right: 7px;
}
- border-radius: ${themeCssVariables.border.radius.sm};
- margin: ${themeCssVariables.spacing[1]};
`;
type RecordTableCellButtonsProps = {
@@ -40,7 +32,7 @@ export const RecordTableCellButtons = ({
return (
<AnimatedContainer>
<StyledButtonContainer>
- <ButtonGroup aria-label={t`Cell controls`} attached={false}>
+ <ButtonGroup aria-label={t`Cell controls`} framed attached={false}>
{buttons.map(({ Icon, onClick, ariaLabel }, index) => (
<LightIconButton
key={index}
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/__stories__/RecordTableCellButtons.stories.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/__stories__/RecordTableCellButtons.stories.tsx
index 728b1bdb663..6988888a6ff 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/__stories__/RecordTableCellButtons.stories.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/__stories__/RecordTableCellButtons.stories.tsx
@@ -1,7 +1,6 @@
import { RecordTableCellButtons } from '@/object-record/record-table/record-table-cell/components/RecordTableCellButtons';
import { type Meta, type StoryObj } from '@storybook/react-vite';
import { expect, fn, userEvent, within } from 'storybook/test';
-import { isDefined } from 'twenty-shared/utils';
import { IconPencil, IconPlus } from 'twenty-ui/icon';
const meta: Meta<typeof RecordTableCellButtons> = {
@@ -25,14 +24,14 @@ export const Default: Story = {
name: 'Unavailable action',
});
const group = canvas.getByRole('group', { name: 'Cell controls' });
- const frame = group.parentElement;
- if (!isDefined(frame)) {
- throw new Error('Missing table action frame');
- }
+ const frameStyle = getComputedStyle(group);
+ const frameInset =
+ parseFloat(frameStyle.borderLeftWidth) +
+ parseFloat(frameStyle.paddingLeft);
await expect(getComputedStyle(edit).width).toBe('24px');
await expect(getComputedStyle(group).gap).toBe('2px');
await expect(parseFloat(getComputedStyle(edit).borderTopLeftRadius)).toBe(
- parseFloat(getComputedStyle(frame).borderTopLeftRadius) - 1,
+ parseFloat(frameStyle.borderTopLeftRadius) - frameInset,
);
await expect(unavailable).toBeDisabled();
edit.focus();
diff --git a/packages/twenty-front/src/modules/onboarding/components/OnboardingSkipButton.tsx b/packages/twenty-front/src/modules/onboarding/components/OnboardingSkipButton.tsx
index c804ba9df95..244b3ac360c 100644
--- a/packages/twenty-front/src/modules/onboarding/components/OnboardingSkipButton.tsx
+++ b/packages/twenty-front/src/modules/onboarding/components/OnboardingSkipButton.tsx
@@ -1,19 +1,5 @@
-import { styled } from '@linaria/react';
import { useLingui } from '@lingui/react/macro';
-import { themeCssVariables } from 'twenty-ui/theme';
-
-const StyledSkipButton = styled.button`
- background-color: transparent;
- border: 1px solid ${themeCssVariables.border.color.light};
- border-radius: ${themeCssVariables.border.radius.md};
- color: ${themeCssVariables.font.color.tertiary};
- cursor: pointer;
- font-family: ${themeCssVariables.font.family};
- font-size: ${themeCssVariables.font.size.md};
- font-weight: ${themeCssVariables.font.weight.semiBold};
- height: ${themeCssVariables.spacing[8]};
- padding: 0 ${themeCssVariables.spacing[5]};
-`;
+import { Button } from 'twenty-ui/primitives/input';
type OnboardingSkipButtonProps = {
onClick: () => void;
@@ -27,8 +13,8 @@ export const OnboardingSkipButton = ({
const { t } = useLingui();
return (
- <StyledSkipButton type="button" onClick={onClick} disabled={disabled}>
+ <Button variant="outline" onClick={onClick} disabled={disabled}>
{t`Skip`}
- </StyledSkipButton>
+ </Button>
);
};
diff --git a/packages/twenty-front/src/modules/onboarding/components/upgrade-free-trial/OnboardingPlanCard.tsx b/packages/twenty-front/src/modules/onboarding/components/upgrade-free-trial/OnboardingPlanCard.tsx
index bee530bbf65..bf3f0ec6c4f 100644
--- a/packages/twenty-front/src/modules/onboarding/components/upgrade-free-trial/OnboardingPlanCard.tsx
+++ b/packages/twenty-front/src/modules/onboarding/components/upgrade-free-trial/OnboardingPlanCard.tsx
@@ -1,3 +1,4 @@
+import { Badge } from 'twenty-ui/primitives/data-display';
import { styled } from '@linaria/react';
import { isNonEmptyString } from '@sniptt/guards';
import { isValidElement, type ReactNode, useId } from 'react';
@@ -87,20 +88,6 @@ const StyledNote = styled.span`
line-height: 1.4;
`;
-const StyledBadge = styled.span`
- align-items: center;
- background-color: ${themeCssVariables.grayScale.gray3};
- border-radius: ${themeCssVariables.border.radius.pill};
- box-sizing: border-box;
- color: ${themeCssVariables.font.color.tertiary};
- corner-shape: round;
- display: flex;
- font-size: ${themeCssVariables.font.size.sm};
- font-weight: ${themeCssVariables.font.weight.medium};
- height: ${themeCssVariables.spacing[5]};
- padding: 0 ${themeCssVariables.spacing[2]};
-`;
-
const StyledRadioContainer = styled.div`
align-items: center;
display: flex;
@@ -163,7 +150,7 @@ export const OnboardingPlanCard = ({
)}
</StyledTitleText>
{hasTags && <StyledTags id={tagsId}>{tags}</StyledTags>}
- {isDefined(badge) && <StyledBadge>{badge}</StyledBadge>}
+ {isDefined(badge) && <Badge size="md">{badge}</Badge>}
</StyledTitleContent>
<StyledRadioContainer>
<Radio
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/components/RecordPageWidgetInsertionSeparator.tsx b/packages/twenty-front/src/modules/page-layout/widgets/components/RecordPageWidgetInsertionSeparator.tsx
index 969f8ee318a..32e2ccc2dba 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/components/RecordPageWidgetInsertionSeparator.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/components/RecordPageWidgetInsertionSeparator.tsx
@@ -8,9 +8,6 @@ import { IconPlus } from 'twenty-ui/icon';
import { themeCssVariables } from 'twenty-ui/theme';
const INSERT_BUTTON_CLASS_NAME = css`
- background: ${themeCssVariables.background.transparent.primary};
- border-color: ${themeCssVariables.background.transparent.light};
- flex-shrink: 0;
opacity: 0;
pointer-events: none;
`;
@@ -74,8 +71,8 @@ export const RecordPageWidgetInsertionSeparator = ({
return (
<StyledSeparator>
<IconButton
- elevated
className={INSERT_BUTTON_CLASS_NAME}
+ elevated
aria-label={t`Add widget above ${widget.title}`}
size="sm"
onClick={() =>
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/email-thread/components/EmailThreadComposer.tsx b/packages/twenty-front/src/modules/page-layout/widgets/email-thread/components/EmailThreadComposer.tsx
index b8f67da14ee..3d645c6da21 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/email-thread/components/EmailThreadComposer.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/email-thread/components/EmailThreadComposer.tsx
@@ -1,4 +1,3 @@
-import { styled } from '@linaria/react';
import { useCallback, useMemo } from 'react';
import { EmailComposerFields } from '@/activities/emails/components/EmailComposerFields';
@@ -20,23 +19,7 @@ import {
IconSend,
IconX,
} from 'twenty-ui/icon';
-import { themeCssVariables } from 'twenty-ui/theme';
-
-const StyledReplyBar = styled.button`
- align-items: center;
- all: unset;
- color: ${themeCssVariables.font.color.tertiary};
- cursor: pointer;
- display: flex;
- font-size: ${themeCssVariables.font.size.md};
- gap: ${themeCssVariables.spacing[2]};
- padding: ${themeCssVariables.spacing[3]} ${themeCssVariables.spacing[4]};
-
- &:hover {
- background: ${themeCssVariables.background.transparent.light};
- color: ${themeCssVariables.font.color.secondary};
- }
-`;
+import { LightButton } from 'twenty-ui/components/input';
type EmailThreadComposerProps = {
replyContext: ReplyContextReady;
@@ -160,10 +143,15 @@ export const EmailThreadComposer = ({
/>
) : (
!isInSidePanel && (
- <StyledReplyBar onClick={() => setIsComposerOpen(true)}>
- <IconArrowBackUp size={16} />
+ <LightButton
+ emphasis="subtle"
+ size="md"
+ fullWidth
+ startIcon={<IconArrowBackUp />}
+ onClick={() => setIsComposerOpen(true)}
+ >
{t`Reply...`}
- </StyledReplyBar>
+ </LightButton>
)
)}
</>
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidgetShowMoreButton.tsx b/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidgetShowMoreButton.tsx
index 0a4b5d00f69..a688500701e 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidgetShowMoreButton.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidgetShowMoreButton.tsx
@@ -1,45 +1,23 @@
-import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
-
+import { LightButton } from 'twenty-ui/components/input';
import { IconChevronDown } from 'twenty-ui/icon';
-import { themeCssVariables, useTheme } from 'twenty-ui/theme';
type FieldWidgetShowMoreButtonProps = {
remainingCount: number;
onClick: () => void;
};
-const StyledButton = styled.button`
- align-items: center;
- background: transparent;
- border: none;
- box-sizing: border-box;
- color: ${themeCssVariables.font.color.tertiary};
- cursor: pointer;
- display: flex;
- font-family: ${themeCssVariables.font.family};
- font-weight: ${themeCssVariables.font.weight.regular};
- gap: ${themeCssVariables.spacing[1]};
- height: 24px;
- padding: 0;
- transition: color ${themeCssVariables.animation.duration.instant}s ease;
- width: 100%;
-
- &:hover {
- color: ${themeCssVariables.font.color.primary};
- }
-`;
-
export const FieldWidgetShowMoreButton = ({
remainingCount,
onClick,
-}: FieldWidgetShowMoreButtonProps) => {
- const theme = useTheme();
-
- return (
- <StyledButton data-testid="field-widget-show-more-button" onClick={onClick}>
- <IconChevronDown size={theme.icon.size.md} />
- {t`More (${remainingCount})`}
- </StyledButton>
- );
-};
+}: FieldWidgetShowMoreButtonProps) => (
+ <LightButton
+ emphasis="subtle"
+ size="sm"
+ startIcon={<IconChevronDown />}
+ data-testid="field-widget-show-more-button"
+ onClick={onClick}
+ >
+ {t`More (${remainingCount})`}
+ </LightButton>
+);
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/widget-card/components/WidgetCardHeaderActionLink.tsx b/packages/twenty-front/src/modules/page-layout/widgets/widget-card/components/WidgetCardHeaderActionLink.tsx
index fcf500f8529..fa368512e4a 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/widget-card/components/WidgetCardHeaderActionLink.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/widget-card/components/WidgetCardHeaderActionLink.tsx
@@ -1,35 +1,6 @@
-import { styled } from '@linaria/react';
import { Link } from 'react-router-dom';
+import { LightIconButton } from 'twenty-ui/components/input';
import { type IconComponent } from 'twenty-ui/icon';
-import { themeCssVariables, useTheme } from 'twenty-ui/theme';
-
-const StyledActionLink = styled(Link)`
- align-items: center;
- border-radius: ${themeCssVariables.border.radius.md};
- color: ${themeCssVariables.font.color.tertiary};
- display: flex;
- height: ${themeCssVariables.spacing[6]};
- justify-content: center;
- min-width: ${themeCssVariables.spacing[6]};
- padding: ${themeCssVariables.spacing[1]};
- text-decoration: none;
- transition: background calc(${themeCssVariables.animation.duration.fast} * 1s)
- ease;
- width: ${themeCssVariables.spacing[6]};
-
- &:hover {
- background: ${themeCssVariables.background.transparent.light};
- }
-
- &:focus-visible {
- outline: 2px solid ${themeCssVariables.color.blue};
- outline-offset: 1px;
- }
-
- &:active {
- background: ${themeCssVariables.background.transparent.medium};
- }
-`;
type WidgetCardHeaderActionLinkProps = {
Icon: IconComponent;
@@ -41,12 +12,16 @@ export const WidgetCardHeaderActionLink = ({
Icon,
label,
to,
-}: WidgetCardHeaderActionLinkProps) => {
- const theme = useTheme();
-
- return (
- <StyledActionLink to={to} aria-label={label} title={label}>
- <Icon size={theme.icon.size.sm} aria-hidden />
- </StyledActionLink>
- );
-};
+}: WidgetCardHeaderActionLinkProps) => (
+ <LightIconButton
+ render={<Link to={to} />}
+ nativeButton={false}
+ role="link"
+ emphasis="subtle"
+ size="sm"
+ aria-label={label}
+ title={label}
+ >
+ <Icon aria-hidden />
+ </LightIconButton>
+);
diff --git a/packages/twenty-front/src/modules/settings/accounts/components/message-folders/SettingsAccountsMessageFoldersCard.tsx b/packages/twenty-front/src/modules/settings/accounts/components/message-folders/SettingsAccountsMessageFoldersCard.tsx
index d592439ebdd..ea2df752b49 100644
--- a/packages/twenty-front/src/modules/settings/accounts/components/message-folders/SettingsAccountsMessageFoldersCard.tsx
+++ b/packages/twenty-front/src/modules/settings/accounts/components/message-folders/SettingsAccountsMessageFoldersCard.tsx
@@ -53,7 +53,6 @@ const StyledSectionHeader = styled.div`
const StyledLabelContainer = styled.span`
align-items: center;
- color: ${themeCssVariables.font.color.tertiary};
display: flex;
margin-bottom: ${themeCssVariables.spacing[2]};
margin-top: ${themeCssVariables.spacing[2]};
diff --git a/packages/twenty-front/src/modules/settings/accounts/components/message-folders/SettingsMessageFoldersTreeItem.tsx b/packages/twenty-front/src/modules/settings/accounts/components/message-folders/SettingsMessageFoldersTreeItem.tsx
index a50c884fc9d..21ca960b123 100644
--- a/packages/twenty-front/src/modules/settings/accounts/components/message-folders/SettingsMessageFoldersTreeItem.tsx
+++ b/packages/twenty-front/src/modules/settings/accounts/components/message-folders/SettingsMessageFoldersTreeItem.tsx
@@ -10,6 +10,7 @@ import { useLingui } from '@lingui/react/macro';
import { useState } from 'react';
import { MessageFolderPendingSyncAction } from 'twenty-shared/types';
import { Status } from 'twenty-ui/primitives/data-display';
+import { Collapsible } from 'twenty-ui/primitives/layout';
import { Checkbox } from 'twenty-ui/primitives/input';
import { IconChevronDown, IconChevronUp } from 'twenty-ui/icon';
@@ -35,17 +36,6 @@ const StyledNestedList = styled.ul`
padding: 0;
`;
-const StyledCollapsibleWrapper = styled.div<{ isExpanded: boolean }>`
- display: grid;
- grid-template-rows: ${({ isExpanded }) => (isExpanded ? '1fr' : '0fr')};
- transition: grid-template-rows
- calc(${themeCssVariables.animation.duration.fast} * 1s) ease-out;
-`;
-
-const StyledCollapsibleContent = styled.div`
- overflow: hidden;
-`;
-
const StyledTreeItemContent = styled.div<{ depth: number }>`
align-items: center;
border-radius: ${themeCssVariables.border.radius.sm};
@@ -144,7 +134,6 @@ export const SettingsMessageFoldersTreeItem = ({
const handleExpandToggle = (e: React.MouseEvent) => {
e.stopPropagation();
- setIsExpanded(!isExpanded);
};
const handleRowClick = () => {
@@ -161,7 +150,11 @@ export const SettingsMessageFoldersTreeItem = ({
depth > 0 ? [...parentsIsLastList, isLast] : parentsIsLastList;
return (
- <StyledTreeItem>
+ <Collapsible.Root
+ open={isExpanded}
+ onOpenChange={setIsExpanded}
+ render={<StyledTreeItem />}
+ >
<StyledTreeItemContent depth={depth} onClick={handleRowClick}>
{depth > 0 && (
<SettingsMessageFoldersBreadcrumb
@@ -189,7 +182,8 @@ export const SettingsMessageFoldersTreeItem = ({
{hasChildren && (
<>
<StyledChildCount>{childCount}</StyledChildCount>
- <StyledExpandButton
+ <Collapsible.Trigger
+ render={<StyledExpandButton />}
aria-label={
isExpanded ? t`Collapse folder` : t`Expand folder`
}
@@ -200,7 +194,7 @@ export const SettingsMessageFoldersTreeItem = ({
) : (
<IconChevronDown size={16} />
)}
- </StyledExpandButton>
+ </Collapsible.Trigger>
</>
)}
@@ -217,23 +211,19 @@ export const SettingsMessageFoldersTreeItem = ({
</StyledTreeItemContent>
{hasChildren && (
- <StyledCollapsibleWrapper isExpanded={isExpanded}>
- <StyledCollapsibleContent>
- <StyledNestedList>
- {children.map((child, index) => (
- <SettingsMessageFoldersTreeItem
- key={child.folder.id}
- depth={depth + 1}
- folderTreeNode={child}
- isLast={index === children.length - 1}
- onToggleFolder={onToggleFolder}
- parentsIsLastList={childParentsIsLastList}
- />
- ))}
- </StyledNestedList>
- </StyledCollapsibleContent>
- </StyledCollapsibleWrapper>
+ <Collapsible.Panel keepMounted render={<StyledNestedList />}>
+ {children.map((child, index) => (
+ <SettingsMessageFoldersTreeItem
+ key={child.folder.id}
+ depth={depth + 1}
+ folderTreeNode={child}
+ isLast={index === children.length - 1}
+ onToggleFolder={onToggleFolder}
+ parentsIsLastList={childParentsIsLastList}
+ />
+ ))}
+ </Collapsible.Panel>
)}
- </StyledTreeItem>
+ </Collapsible.Root>
);
};
diff --git a/packages/twenty-front/src/modules/settings/accounts/components/message-folders/__stories__/SettingsMessageFoldersTreeItem.stories.tsx b/packages/twenty-front/src/modules/settings/accounts/components/message-folders/__stories__/SettingsMessageFoldersTreeItem.stories.tsx
new file mode 100644
index 00000000000..dec0edb3797
--- /dev/null
+++ b/packages/twenty-front/src/modules/settings/accounts/components/message-folders/__stories__/SettingsMessageFoldersTreeItem.stories.tsx
@@ -0,0 +1,86 @@
+import { type Meta, type StoryObj } from '@storybook/react-vite';
+import { expect, fn, userEvent, waitFor, within } from 'storybook/test';
+import { MessageFolderPendingSyncAction } from 'twenty-shared/types';
+import { ComponentDecorator } from 'twenty-ui/testing';
+
+import { type MessageFolder } from '@/accounts/types/MessageFolder';
+import { SettingsMessageFoldersTreeItem } from '@/settings/accounts/components/message-folders/SettingsMessageFoldersTreeItem';
+import { computeMessageFolderTree } from '@/settings/accounts/components/message-folders/utils/computeMessageFolderTree';
+
+const createFolder = ({
+ id,
+ name,
+ parentFolderId,
+}: Pick<MessageFolder, 'id' | 'name' | 'parentFolderId'>): MessageFolder => ({
+ id,
+ name,
+ parentFolderId,
+ externalId: id,
+ isSynced: false,
+ isSentFolder: false,
+ pendingSyncAction: MessageFolderPendingSyncAction.NONE,
+ messageChannelId: 'mail-channel',
+ createdAt: '2026-01-01T00:00:00.000Z',
+ updatedAt: '2026-01-01T00:00:00.000Z',
+ __typename: 'MessageFolder',
+});
+
+const ROOT_FOLDER = createFolder({
+ id: 'work',
+ name: 'Work',
+ parentFolderId: null,
+});
+const FOLDER_TREE = computeMessageFolderTree([
+ ROOT_FOLDER,
+ createFolder({ id: 'team', name: 'Team', parentFolderId: 'work' }),
+ createFolder({ id: 'planning', name: 'Planning', parentFolderId: 'team' }),
+]);
+
+const meta: Meta<typeof SettingsMessageFoldersTreeItem> = {
+ title: 'Modules/Settings/Accounts/SettingsMessageFoldersTreeItem',
+ component: SettingsMessageFoldersTreeItem,
+ decorators: [ComponentDecorator],
+ args: { folderTreeNode: FOLDER_TREE[0], onToggleFolder: fn() },
+ parameters: { container: { width: 400 } },
+ render: (args) => (
+ <ul>
+ <SettingsMessageFoldersTreeItem
+ // oxlint-disable-next-line react/jsx-props-no-spreading
+ {...args}
+ />
+ </ul>
+ ),
+};
+
+export default meta;
+type Story = StoryObj<typeof SettingsMessageFoldersTreeItem>;
+
+export const PreservesNestedExpansion: Story = {
+ play: async ({ canvasElement, args }) => {
+ const canvas = within(canvasElement);
+ const [rootToggle, nestedToggle] = canvas.getAllByRole('button', {
+ name: 'Collapse folder',
+ });
+ expect(rootToggle).toHaveAttribute('aria-expanded', 'true');
+ expect(rootToggle).toHaveAttribute('aria-controls');
+ await userEvent.click(nestedToggle);
+ await waitFor(() => {
+ expect(nestedToggle).toHaveAttribute('aria-expanded', 'false');
+ expect(canvas.getByText('Planning')).not.toBeVisible();
+ });
+ await userEvent.click(rootToggle);
+ await waitFor(() =>
+ expect(rootToggle).toHaveAttribute('aria-expanded', 'false'),
+ );
+ await userEvent.keyboard('{Enter}');
+ await waitFor(() => {
+ expect(rootToggle).toHaveAttribute('aria-expanded', 'true');
+ expect(nestedToggle).toBeVisible();
+ expect(nestedToggle).toHaveAttribute('aria-expanded', 'false');
+ expect(canvas.getByText('Planning')).not.toBeVisible();
+ });
+ await userEvent.click(canvas.getAllByRole('checkbox')[0]);
+ expect(args.onToggleFolder).toHaveBeenCalledWith(ROOT_FOLDER);
+ expect(rootToggle).toHaveAttribute('aria-expanded', 'true');
+ },
+};
diff --git a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminChatCollapsibleSection.tsx b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminChatCollapsibleSection.tsx
index 4f4301bd048..9b8f1025021 100644
--- a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminChatCollapsibleSection.tsx
+++ b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminChatCollapsibleSection.tsx
@@ -1,7 +1,8 @@
import { styled } from '@linaria/react';
import { type ReactNode, useState } from 'react';
-import { IconChevronDown, IconChevronUp } from 'twenty-ui/icon';
+import { Button } from 'twenty-ui/primitives/input';
+import { IconChevronDown } from 'twenty-ui/icon';
import { Collapsible } from 'twenty-ui/primitives/layout';
import { themeCssVariables } from 'twenty-ui/theme';
@@ -18,18 +19,13 @@ const StyledContainer = styled.div`
width: 100%;
`;
-const StyledToggleButton = styled.button`
- align-items: center;
- background: none;
- border: none;
- color: ${themeCssVariables.font.color.tertiary};
- cursor: pointer;
+const StyledChevron = styled.span`
display: flex;
- font-size: ${themeCssVariables.font.size.sm};
- font-weight: ${themeCssVariables.font.weight.medium};
- gap: ${themeCssVariables.spacing[1]};
- padding: 0;
- width: fit-content;
+ transform: rotate(0deg);
+
+ [data-panel-open] & {
+ transform: rotate(180deg);
+ }
`;
export const SettingsAdminChatCollapsibleSection = ({
@@ -45,13 +41,11 @@ export const SettingsAdminChatCollapsibleSection = ({
onOpenChange={setIsExpanded}
render={<StyledContainer />}
>
- <Collapsible.Trigger render={<StyledToggleButton />}>
+ <Collapsible.Trigger render={<Button variant="link" />}>
{label}
- {isExpanded ? (
- <IconChevronUp size={14} />
- ) : (
+ <StyledChevron>
<IconChevronDown size={14} />
- )}
+ </StyledChevron>
</Collapsible.Trigger>
<Collapsible.Panel>{children}</Collapsible.Panel>
</Collapsible.Root>
diff --git a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminChatToolCallPart.tsx b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminChatToolCallPart.tsx
index b981a7adc9c..d366f1e237a 100644
--- a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminChatToolCallPart.tsx
+++ b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminChatToolCallPart.tsx
@@ -110,13 +110,12 @@ export const SettingsAdminChatToolCallPart = ({
];
return (
- <StyledContainer>
- <StyledToggleRow
- aria-expanded={isExpanded}
- onClick={() =>
- setIsExpanded((previousIsExpanded) => !previousIsExpanded)
- }
- >
+ <Collapsible.Root
+ open={isExpanded}
+ onOpenChange={setIsExpanded}
+ render={<StyledContainer />}
+ >
+ <Collapsible.Trigger render={<StyledToggleRow />}>
<StyledToolLabel>
<IconTool size={14} />
{toolName}
@@ -129,56 +128,54 @@ export const SettingsAdminChatToolCallPart = ({
<IconChevronDown size={14} />
)}
</StyledRightContent>
- </StyledToggleRow>
- <Collapsible.Root open={isExpanded}>
- <Collapsible.Panel>
- <Tabs.Root
- value={activeTab}
- onValueChange={(value) => {
- if (value !== 'output' && value !== 'input') {
- return;
- }
- setActiveTab(value);
- }}
+ </Collapsible.Trigger>
+ <Collapsible.Panel>
+ <Tabs.Root
+ value={activeTab}
+ onValueChange={(value) => {
+ if (value !== 'output' && value !== 'input') {
+ return;
+ }
+ setActiveTab(value);
+ }}
+ >
+ <Tabs.List
+ aria-label={t`Tool call details`}
+ render={<StyledTabContainer />}
>
- <Tabs.List
- aria-label={t`Tool call details`}
- render={<StyledTabContainer />}
- >
- <Tabs.Tab value="output" size="compact">
- {t`Output`}
- </Tabs.Tab>
- <Tabs.Tab value="input" size="compact">
- {t`Input`}
- </Tabs.Tab>
- <Tabs.Indicator />
- </Tabs.List>
- {tabPanels.map(({ value, content, emptyLabel }) => (
- <Tabs.Panel key={value} value={value}>
- {isDefined(content) ? (
- <StyledJsonTreeContainer>
- <JsonTree
- value={content}
- shouldExpandNodeInitially={() => false}
- emptyArrayLabel={t`Empty Array`}
- emptyObjectLabel={t`Empty Object`}
- emptyStringLabel={t`[empty string]`}
- arrowButtonCollapsedLabel={t`Expand`}
- arrowButtonExpandedLabel={t`Collapse`}
- onNodeValueClick={copyToClipboard}
- />
- </StyledJsonTreeContainer>
- ) : (
- <StyledEmptyTabLabel>{emptyLabel}</StyledEmptyTabLabel>
- )}
- </Tabs.Panel>
- ))}
- </Tabs.Root>
- {isNonEmptyString(part.errorMessage) && (
- <StyledErrorMessage>{part.errorMessage}</StyledErrorMessage>
- )}
- </Collapsible.Panel>
- </Collapsible.Root>
- </StyledContainer>
+ <Tabs.Tab value="output" size="compact">
+ {t`Output`}
+ </Tabs.Tab>
+ <Tabs.Tab value="input" size="compact">
+ {t`Input`}
+ </Tabs.Tab>
+ <Tabs.Indicator />
+ </Tabs.List>
+ {tabPanels.map(({ value, content, emptyLabel }) => (
+ <Tabs.Panel key={value} value={value}>
+ {isDefined(content) ? (
+ <StyledJsonTreeContainer>
+ <JsonTree
+ value={content}
+ shouldExpandNodeInitially={() => false}
+ emptyArrayLabel={t`Empty Array`}
+ emptyObjectLabel={t`Empty Object`}
+ emptyStringLabel={t`[empty string]`}
+ arrowButtonCollapsedLabel={t`Expand`}
+ arrowButtonExpandedLabel={t`Collapse`}
+ onNodeValueClick={copyToClipboard}
+ />
+ </StyledJsonTreeContainer>
+ ) : (
+ <StyledEmptyTabLabel>{emptyLabel}</StyledEmptyTabLabel>
+ )}
+ </Tabs.Panel>
+ ))}
+ </Tabs.Root>
+ {isNonEmptyString(part.errorMessage) && (
+ <StyledErrorMessage>{part.errorMessage}</StyledErrorMessage>
+ )}
+ </Collapsible.Panel>
+ </Collapsible.Root>
);
};
diff --git a/packages/twenty-front/src/modules/settings/admin-panel/components/__stories__/SettingsAdminChatToolCallPart.stories.tsx b/packages/twenty-front/src/modules/settings/admin-panel/components/__stories__/SettingsAdminChatToolCallPart.stories.tsx
index 4660958ebcd..5b94593897d 100644
--- a/packages/twenty-front/src/modules/settings/admin-panel/components/__stories__/SettingsAdminChatToolCallPart.stories.tsx
+++ b/packages/twenty-front/src/modules/settings/admin-panel/components/__stories__/SettingsAdminChatToolCallPart.stories.tsx
@@ -1,5 +1,6 @@
import { type Meta, type StoryObj } from '@storybook/react-vite';
import { expect, userEvent, waitFor, within } from 'storybook/test';
+import { assertIsDefinedOrThrow } from 'twenty-shared/utils';
import { ComponentDecorator } from 'twenty-ui/testing';
import { SettingsAdminChatToolCallPart } from '@/settings/admin-panel/components/SettingsAdminChatToolCallPart';
@@ -31,7 +32,18 @@ export const OutputAndInput: Story = {
const canvas = within(canvasElement);
const user = userEvent.setup({ writeToClipboard: true });
const toggle = canvas.getByRole('button', { name: 'inspect_tool' });
+ expect(toggle).toHaveAttribute('aria-expanded', 'false');
+ expect(toggle.tagName).toBe('BUTTON');
await user.click(toggle);
+ await user.keyboard(' ');
+ await expect(toggle).toHaveAttribute('aria-expanded', 'false');
+ await user.keyboard('{Enter}');
+ const panelId = toggle.getAttribute('aria-controls');
+ assertIsDefinedOrThrow(panelId);
+ await waitFor(() => {
+ expect(toggle).toHaveAttribute('aria-expanded', 'true');
+ expect(canvasElement.ownerDocument.getElementById(panelId)).toBeVisible();
+ });
const output = await canvas.findByRole('tab', { name: 'Output' });
const input = canvas.getByRole('tab', { name: 'Input' });
await waitFor(() => {
diff --git a/packages/twenty-front/src/modules/settings/ai/components/SettingsToolParameterTable.tsx b/packages/twenty-front/src/modules/settings/ai/components/SettingsToolParameterTable.tsx
index c516ebb8d10..b4d24c4a0f1 100644
--- a/packages/twenty-front/src/modules/settings/ai/components/SettingsToolParameterTable.tsx
+++ b/packages/twenty-front/src/modules/settings/ai/components/SettingsToolParameterTable.tsx
@@ -117,8 +117,7 @@ export const SettingsToolParameterTable = ({
</TableRow>
</StyledTableHeaderRow>
<StyledFieldsContainer>
- {entries.map(([paramName, property], index) => {
- const infoIconId = `param-info-${index}`;
+ {entries.map(([paramName, property]) => {
const displayType = getDisplayType(property);
const TypeIcon = TYPE_ICON_MAP[getTypeIconKey(property)];
@@ -155,10 +154,8 @@ export const SettingsToolParameterTable = ({
delay={TooltipDelay.shortDelay}
>
<IconInfoCircle
- id={infoIconId}
size={theme.icon.size.md}
color={theme.font.color.tertiary}
- style={{ outline: 'none', cursor: 'pointer' }}
/>
</Tooltip>
</StyledInfoIconContainer>
diff --git a/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationDetailVariablesTab.tsx b/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationDetailVariablesTab.tsx
index c3f2c2931cc..e27702b5fdc 100644
--- a/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationDetailVariablesTab.tsx
+++ b/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationDetailVariablesTab.tsx
@@ -63,7 +63,6 @@ export const SettingsApplicationDetailVariablesTab = ({
label={applicationVariable.label}
isDeprecated={applicationVariable.isDeprecated}
description={applicationVariable.description}
- tooltipId={`env-var-desc-${applicationVariable.key}`}
/>
<SettingsApplicationVariableInput
type={applicationVariable.type}
diff --git a/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationVariableLabelRow.tsx b/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationVariableLabelRow.tsx
index 8c8dcdec80d..e098ad22cf1 100644
--- a/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationVariableLabelRow.tsx
+++ b/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationVariableLabelRow.tsx
@@ -25,13 +25,11 @@ export const SettingsApplicationVariableLabelRow = ({
label,
isDeprecated,
description,
- tooltipId,
}: {
variableKey: string;
label?: string;
isDeprecated: boolean;
description: string;
- tooltipId: string;
}) => {
const { t } = useLingui();
const theme = useTheme();
@@ -49,10 +47,8 @@ export const SettingsApplicationVariableLabelRow = ({
delay={TooltipDelay.shortDelay}
>
<IconInfoCircle
- id={tooltipId}
size={theme.icon.size.sm}
color={theme.font.color.tertiary}
- style={{ outline: 'none', cursor: 'pointer' }}
/>
</Tooltip>
)}
diff --git a/packages/twenty-front/src/modules/settings/applications/components/__stories__/SettingsApplicationVariableLabelRow.stories.tsx b/packages/twenty-front/src/modules/settings/applications/components/__stories__/SettingsApplicationVariableLabelRow.stories.tsx
index 7faa0df50a1..57f0a39f99d 100644
--- a/packages/twenty-front/src/modules/settings/applications/components/__stories__/SettingsApplicationVariableLabelRow.stories.tsx
+++ b/packages/twenty-front/src/modules/settings/applications/components/__stories__/SettingsApplicationVariableLabelRow.stories.tsx
@@ -11,7 +11,6 @@ const meta: Meta<typeof SettingsApplicationVariableLabelRow> = {
variableKey: 'MY_VARIABLE_KEY',
isDeprecated: false,
description: '',
- tooltipId: 'variable-label-row-tooltip',
},
decorators: [ComponentDecorator],
};
diff --git a/packages/twenty-front/src/modules/settings/billing/components/internal/SettingsBillingLabelValueItem.tsx b/packages/twenty-front/src/modules/settings/billing/components/internal/SettingsBillingLabelValueItem.tsx
index 0cc9973ca99..7a9a5a59137 100644
--- a/packages/twenty-front/src/modules/settings/billing/components/internal/SettingsBillingLabelValueItem.tsx
+++ b/packages/twenty-front/src/modules/settings/billing/components/internal/SettingsBillingLabelValueItem.tsx
@@ -1,16 +1,11 @@
-import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';
import { styled } from '@linaria/react';
import { type ReactNode } from 'react';
-import { IconInfoCircle } from 'twenty-ui/icon';
-import { Tooltip } from 'twenty-ui/primitives/surfaces';
import { themeCssVariables } from 'twenty-ui/theme';
type SettingsBillingLabelValueItemProps = {
label: string;
value: ReactNode;
isValueInPrimaryColor?: boolean;
- tooltipText?: string;
- tooltipId?: string;
};
const StyledContainer = styled.div`
@@ -18,24 +13,12 @@ const StyledContainer = styled.div`
justify-content: space-between;
`;
-const StyledLabelWrapper = styled.span`
- align-items: center;
- display: flex;
- gap: ${themeCssVariables.spacing[1]};
-`;
-
const StyledLabelSpan = styled.span`
color: ${themeCssVariables.font.color.tertiary};
font-size: ${themeCssVariables.font.size.xs};
font-weight: ${themeCssVariables.font.weight.semiBold};
`;
-const StyledInfoIcon = styled(IconInfoCircle)`
- color: ${themeCssVariables.font.color.tertiary};
- cursor: default;
- flex-shrink: 0;
-`;
-
const StyledValueSpan = styled.span<{ isPrimaryColor: boolean }>`
color: ${({ isPrimaryColor }) =>
isPrimaryColor
@@ -49,25 +32,10 @@ export const SettingsBillingLabelValueItem = ({
label,
value,
isValueInPrimaryColor = false,
- tooltipText,
- tooltipId,
}: SettingsBillingLabelValueItemProps) => {
return (
<StyledContainer>
- <StyledLabelWrapper>
- <StyledLabelSpan>{label}</StyledLabelSpan>
- {tooltipText && tooltipId && (
- <Tooltip
- content={tooltipText}
- arrow
- side="top"
- delay={TooltipDelay.shortDelay}
- positionMethod="fixed"
- >
- <StyledInfoIcon id={tooltipId} size={12} />
- </Tooltip>
- )}
- </StyledLabelWrapper>
+ <StyledLabelSpan>{label}</StyledLabelSpan>
<StyledValueSpan isPrimaryColor={isValueInPrimaryColor}>
{value}
</StyledValueSpan>
diff --git a/packages/twenty-front/src/modules/settings/components/SettingsTextLink.tsx b/packages/twenty-front/src/modules/settings/components/SettingsTextLink.tsx
index 7bf408c424f..972d66da3f0 100644
--- a/packages/twenty-front/src/modules/settings/components/SettingsTextLink.tsx
+++ b/packages/twenty-front/src/modules/settings/components/SettingsTextLink.tsx
@@ -1,3 +1,4 @@
+import { Button } from 'twenty-ui/primitives/input';
import { css, cx } from '@linaria/core';
import { type MouseEventHandler, type ReactNode } from 'react';
import { Link, type LinkProps } from 'react-router-dom';
@@ -92,14 +93,16 @@ export const SettingsTextLink = ({
}
return (
- <button
- className={textLinkClassName}
+ <Button
+ variant="link"
+ size="sm"
+ className={className}
disabled={props.disabled ?? false}
onClick={props.onClick}
title={title}
type="button"
>
{children}
- </button>
+ </Button>
);
};
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 b16acddd55f..064fe6cc148 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
@@ -212,10 +212,8 @@ export const SettingsDataModelFieldIconLabelForm = ({
delay={TooltipDelay.shortDelay}
>
<IconInfoCircle
- id="info-circle-id-name"
size={theme.icon.size.md}
color={theme.font.color.tertiary}
- style={{ outline: 'none' }}
/>
</Tooltip>
)}
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 14c9887901d..890bcaeec66 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
@@ -64,8 +64,6 @@ const StyledLabel = styled.span`
margin-bottom: ${themeCssVariables.spacing[1]};
`;
-const infoCircleElementId = 'info-circle-id';
-
export const SettingsDataModelObjectAboutForm = ({
disableEdition = false,
onNewDirtyField,
@@ -337,10 +335,8 @@ export const SettingsDataModelObjectAboutForm = ({
delay={TooltipDelay.shortDelay}
>
<IconInfoCircle
- id={infoCircleElementId + fieldName}
size={theme.icon.size.md}
color={theme.font.color.tertiary}
- style={{ outline: 'none' }}
/>
</Tooltip>
)}
diff --git a/packages/twenty-front/src/modules/settings/emailing-domains/components/SettingsEmailingDomainAiSetup.tsx b/packages/twenty-front/src/modules/settings/emailing-domains/components/SettingsEmailingDomainAiSetup.tsx
index 0555154a496..1e9f50d343a 100644
--- a/packages/twenty-front/src/modules/settings/emailing-domains/components/SettingsEmailingDomainAiSetup.tsx
+++ b/packages/twenty-front/src/modules/settings/emailing-domains/components/SettingsEmailingDomainAiSetup.tsx
@@ -135,7 +135,6 @@ export const SettingsEmailingDomainAiSetup = ({
<StyledContainer>
<Tooltip
content={t`Copies a Cloudflare setup prompt for your AI coding tool`}
- maxWidth="440px"
>
<StyledPromptButton type="button" onClick={handleCopy}>
<StyledButtonLabel>{t`Set up DNS with AI`}</StyledButtonLabel>
diff --git a/packages/twenty-front/src/modules/settings/enterprise/components/OrganizationAdornment.tsx b/packages/twenty-front/src/modules/settings/enterprise/components/OrganizationAdornment.tsx
index 4c45979edaf..fe123311c7b 100644
--- a/packages/twenty-front/src/modules/settings/enterprise/components/OrganizationAdornment.tsx
+++ b/packages/twenty-front/src/modules/settings/enterprise/components/OrganizationAdornment.tsx
@@ -92,7 +92,6 @@ export const OrganizationAdornment = ({
content={resolvedTooltipContent}
delay={TooltipDelay.shortDelay}
side="top"
- maxWidth="260px"
>
{adornment}
</Tooltip>
diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsSection.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsSection.tsx
index 874e3bc0a79..a5734881f89 100644
--- a/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsSection.tsx
+++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsSection.tsx
@@ -91,11 +91,7 @@ export const SettingsRolePermissionsSettingsSection = ({
!shouldShowAllAccessToggle || !settingsDraftRole.canUpdateAllSettings
}
>
- <Collapsible.Panel
- dimension="height"
- style={{ transitionDuration: '0.4s, 0.2s' }}
- containAnimation={false}
- >
+ <Collapsible.Panel dimension="height" containAnimation={false}>
<StyledTable>
<SettingsRolePermissionsSettingsTableHeader
roleId={roleId}
diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsToolSection.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsToolSection.tsx
index 2f91966fa6c..05fd2023e24 100644
--- a/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsToolSection.tsx
+++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsToolSection.tsx
@@ -90,11 +90,7 @@ export const SettingsRolePermissionsToolSection = ({
!shouldShowAllAccessToggle || !settingsDraftRole.canAccessAllTools
}
>
- <Collapsible.Panel
- dimension="height"
- style={{ transitionDuration: '0.4s, 0.2s' }}
- containAnimation={false}
- >
+ <Collapsible.Panel dimension="height" containAnimation={false}>
<StyledTable>
<SettingsRolePermissionsSettingsTableHeader
roleId={roleId}
diff --git a/packages/twenty-front/src/modules/ui/feedback/toast/components/AppToaster.tsx b/packages/twenty-front/src/modules/ui/feedback/toast/components/AppToaster.tsx
index e303fc27bef..be4888a0c8f 100644
--- a/packages/twenty-front/src/modules/ui/feedback/toast/components/AppToaster.tsx
+++ b/packages/twenty-front/src/modules/ui/feedback/toast/components/AppToaster.tsx
@@ -3,16 +3,19 @@ import { RootStackingContextZIndices } from '@/ui/layout/constants/RootStackingC
import { useLingui } from '@lingui/react/macro';
import { Toaster, type ToasterProps } from 'twenty-ui/components/feedback';
-type AppToasterProps = Pick<ToasterProps, 'container'>;
+type AppToasterProps = Pick<ToasterProps, 'container' | 'getToastProps'>;
-export const AppToaster = ({ container }: AppToasterProps) => {
+export const AppToaster = ({ container, getToastProps }: AppToasterProps) => {
const { t, i18n } = useLingui();
return (
<Toaster
container={container}
aria-label={t`Notifications`}
- getToastProps={(toast) => getLocalizedToastProps({ toast, i18n })}
+ getToastProps={(toast) => ({
+ ...getLocalizedToastProps({ toast, i18n }),
+ ...getToastProps?.(toast),
+ })}
style={{ zIndex: RootStackingContextZIndices.Toaster }}
data-globally-prevent-click-outside
/>
diff --git a/packages/twenty-front/src/modules/ui/field/display/components/FilePreviewDialog.tsx b/packages/twenty-front/src/modules/ui/field/display/components/FilePreviewDialog.tsx
new file mode 100644
index 00000000000..3617790831b
--- /dev/null
+++ b/packages/twenty-front/src/modules/ui/field/display/components/FilePreviewDialog.tsx
@@ -0,0 +1,126 @@
+import { DialogInstance } from '@/ui/layout/dialog/components/DialogInstance';
+import { ScrollWrapper } from '@/ui/utilities/scroll/components/ScrollWrapper';
+import { styled } from '@linaria/react';
+import { t } from '@lingui/core/macro';
+import { lazy, Suspense, type ReactNode } from 'react';
+import { isDefined } from 'twenty-shared/utils';
+import { IconButton } from 'twenty-ui/components/input';
+import { IconDownload, IconX } from 'twenty-ui/icon';
+import { Dialog } from 'twenty-ui/primitives/surfaces';
+
+const DocumentViewer = lazy(() =>
+ import('@/activities/files/components/DocumentViewer').then((module) => ({
+ default: module.DocumentViewer,
+ })),
+);
+
+const StyledPreviewLayout = styled.div`
+ display: flex;
+ flex-direction: column;
+ gap: var(--t-spacing-2);
+ min-height: 0;
+ padding: var(--t-spacing-2);
+`;
+
+const StyledHeader = styled.div`
+ align-items: center;
+ display: flex;
+ flex-shrink: 0;
+ gap: var(--t-spacing-2);
+ justify-content: space-between;
+ min-height: var(--t-spacing-10);
+`;
+
+const StyledTitle = styled.h2`
+ min-width: 0;
+ overflow: hidden;
+ text-align: start;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+`;
+
+const StyledActions = styled.div`
+ display: flex;
+ flex-shrink: 0;
+ gap: var(--t-spacing-1);
+`;
+
+const StyledPreviewContent = styled.div`
+ display: flex;
+ flex: 1 1 0%;
+ flex-direction: column;
+`;
+
+type FilePreviewDialogProps = {
+ dialogId: string;
+ scrollWrapperId: string;
+ title: string;
+ documentName: string;
+ documentUrl: string;
+ documentExtension?: string;
+ onClose: () => void;
+ onDownload?: () => void;
+ downloadLabel: string;
+ loadingFallback: ReactNode;
+};
+
+export const FilePreviewDialog = ({
+ dialogId,
+ scrollWrapperId,
+ title,
+ documentName,
+ documentUrl,
+ documentExtension,
+ onClose,
+ onDownload,
+ downloadLabel,
+ loadingFallback,
+}: FilePreviewDialogProps) => (
+ <DialogInstance
+ dialogId={dialogId}
+ dismissible
+ onClose={onClose}
+ renderInDocumentBody
+ >
+ {({ onKeyDown }) => (
+ <Dialog.Popup onKeyDown={onKeyDown} size="lg">
+ <StyledPreviewLayout>
+ <StyledHeader>
+ <Dialog.Title size="md" render={<StyledTitle />}>
+ {title}
+ </Dialog.Title>
+ <StyledActions>
+ {isDefined(onDownload) && (
+ <IconButton
+ aria-label={downloadLabel}
+ onClick={onDownload}
+ size="sm"
+ >
+ <IconDownload />
+ </IconButton>
+ )}
+ <IconButton
+ aria-label={t`Close preview`}
+ onClick={onClose}
+ size="sm"
+ >
+ <IconX />
+ </IconButton>
+ </StyledActions>
+ </StyledHeader>
+ <ScrollWrapper componentInstanceId={scrollWrapperId}>
+ <StyledPreviewContent>
+ <Suspense fallback={loadingFallback}>
+ <DocumentViewer
+ documentName={documentName}
+ documentUrl={documentUrl}
+ documentExtension={documentExtension}
+ />
+ </Suspense>
+ </StyledPreviewContent>
+ </ScrollWrapper>
+ </StyledPreviewLayout>
+ </Dialog.Popup>
+ )}
+ </DialogInstance>
+);
diff --git a/packages/twenty-front/src/modules/ui/field/display/components/GlobalFilePreviewModal.tsx b/packages/twenty-front/src/modules/ui/field/display/components/GlobalFilePreviewModal.tsx
index d15a3ca16a7..5796fb7d920 100644
--- a/packages/twenty-front/src/modules/ui/field/display/components/GlobalFilePreviewModal.tsx
+++ b/packages/twenty-front/src/modules/ui/field/display/components/GlobalFilePreviewModal.tsx
@@ -1,70 +1,15 @@
-import { Dialog } from 'twenty-ui/primitives/surfaces';
-import { DialogInstance } from '@/ui/layout/dialog/components/DialogInstance';
import { downloadFile } from '@/activities/files/utils/downloadFile';
+import { FilePreviewDialog } from '@/ui/field/display/components/FilePreviewDialog';
+import { GlobalFilePreviewOpenEffect } from '@/ui/field/display/components/GlobalFilePreviewOpenEffect';
+import { GLOBAL_FILE_PREVIEW_MODAL_ID } from '@/ui/field/display/constants/GlobalFilePreviewModalId';
import { filePreviewState } from '@/ui/field/display/states/filePreviewState';
import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';
import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';
-import { ScrollWrapper } from '@/ui/utilities/scroll/components/ScrollWrapper';
import { styled } from '@linaria/react';
import { useLingui } from '@lingui/react/macro';
-import { type JSX, lazy, Suspense, useEffect } from 'react';
-import { isDefined } from 'twenty-shared/utils';
-import { IconDownload, IconX } from 'twenty-ui/icon';
-import { IconButton } from 'twenty-ui/components/input';
+import { isDefined, isNonEmptyString } from 'twenty-shared/utils';
import { themeCssVariables } from 'twenty-ui/theme';
-const DocumentViewer = lazy(() =>
- import('@/activities/files/components/DocumentViewer').then((module) => ({
- default: module.DocumentViewer,
- })),
-);
-
-const GLOBAL_FILE_PREVIEW_MODAL_ID = 'global-file-preview-modal';
-
-const StyledPreviewPopup = styled(Dialog.Popup)`
- padding: ${themeCssVariables.spacing[4]};
-`;
-
-const StyledModalHeader = styled.div`
- align-items: center;
- border-bottom: 1px solid ${themeCssVariables.border.color.medium};
- display: flex;
- flex-direction: row;
- gap: ${themeCssVariables.spacing[2]};
- height: 60px;
- justify-content: space-between;
- overflow: hidden;
- padding: ${themeCssVariables.spacing[0]} ${themeCssVariables.spacing[4]}
- ${themeCssVariables.spacing[0]} ${themeCssVariables.spacing[4]};
- text-overflow: ellipsis;
- white-space: nowrap;
-`;
-
-const StyledHeader = styled.div`
- align-items: center;
- display: flex;
- gap: ${themeCssVariables.spacing[2]};
- justify-content: space-between;
- width: 100%;
-`;
-
-const StyledModalTitle = styled.div`
- color: ${themeCssVariables.font.color.primary};
- font-size: ${themeCssVariables.font.size.xl};
- font-weight: ${themeCssVariables.font.weight.semiBold};
-`;
-
-const StyledButtonContainer = styled.div`
- align-items: center;
- display: flex;
- gap: ${themeCssVariables.spacing[1]};
-`;
-
-const StyledModalContent = styled.div`
- height: 100%;
- padding: ${themeCssVariables.spacing[4]};
-`;
-
const StyledLoadingContainer = styled.div`
align-items: center;
display: flex;
@@ -76,16 +21,10 @@ const StyledLoadingText = styled.div`
color: ${themeCssVariables.font.color.tertiary};
`;
-export const GlobalFilePreviewModal = (): JSX.Element | null => {
+export const GlobalFilePreviewModal = () => {
const { t } = useLingui();
const [filePreview, setFilePreview] = useAtomState(filePreviewState);
- const { openDialog, closeDialog } = useDialog();
-
- useEffect(() => {
- if (isDefined(filePreview)) {
- openDialog(GLOBAL_FILE_PREVIEW_MODAL_ID);
- }
- }, [filePreview, openDialog]);
+ const { closeDialog } = useDialog();
const handleClose = () => {
closeDialog(GLOBAL_FILE_PREVIEW_MODAL_ID);
@@ -93,7 +32,9 @@ export const GlobalFilePreviewModal = (): JSX.Element | null => {
};
const handleDownload = () => {
- if (!filePreview || !filePreview.url) return;
+ if (!isDefined(filePreview) || !isNonEmptyString(filePreview.url)) {
+ return;
+ }
downloadFile(filePreview.url, filePreview.label ?? 'file');
};
@@ -102,62 +43,24 @@ export const GlobalFilePreviewModal = (): JSX.Element | null => {
}
return (
- <DialogInstance
- dialogId={GLOBAL_FILE_PREVIEW_MODAL_ID}
- dismissible
- onClose={handleClose}
- renderInDocumentBody
- >
- {({ onKeyDown }) => (
- <StyledPreviewPopup
- aria-label={filePreview.label ?? t`File preview`}
- onKeyDown={onKeyDown}
- size="lg"
- >
- <StyledModalHeader>
- <StyledHeader>
- <StyledModalTitle>{filePreview.label}</StyledModalTitle>
- <StyledButtonContainer>
- <IconButton
- aria-label={t`Download file`}
- onClick={handleDownload}
- size="sm"
- >
- <IconDownload />
- </IconButton>
- <IconButton
- aria-label={t`Close preview`}
- onClick={handleClose}
- size="sm"
- >
- <IconX />
- </IconButton>
- </StyledButtonContainer>
- </StyledHeader>
- </StyledModalHeader>
- <ScrollWrapper
- componentInstanceId={`preview-modal-${filePreview.fileId ?? 'file'}`}
- >
- <StyledModalContent>
- <Suspense
- fallback={
- <StyledLoadingContainer>
- <StyledLoadingText>
- {t`Loading document viewer...`}
- </StyledLoadingText>
- </StyledLoadingContainer>
- }
- >
- <DocumentViewer
- documentName={filePreview.label ?? t`Untitled`}
- documentUrl={filePreview.url ?? ''}
- documentExtension={filePreview.extension ?? ''}
- />
- </Suspense>
- </StyledModalContent>
- </ScrollWrapper>
- </StyledPreviewPopup>
- )}
- </DialogInstance>
+ <>
+ <GlobalFilePreviewOpenEffect />
+ <FilePreviewDialog
+ dialogId={GLOBAL_FILE_PREVIEW_MODAL_ID}
+ scrollWrapperId={`preview-modal-${filePreview.fileId ?? 'file'}`}
+ title={filePreview.label ?? t`File preview`}
+ documentName={filePreview.label ?? t`Untitled`}
+ documentUrl={filePreview.url ?? ''}
+ documentExtension={filePreview.extension ?? ''}
+ onClose={handleClose}
+ onDownload={handleDownload}
+ downloadLabel={t`Download file`}
+ loadingFallback={
+ <StyledLoadingContainer>
+ <StyledLoadingText>{t`Loading document viewer...`}</StyledLoadingText>
+ </StyledLoadingContainer>
+ }
+ />
+ </>
);
};
diff --git a/packages/twenty-front/src/modules/ui/field/display/components/GlobalFilePreviewOpenEffect.tsx b/packages/twenty-front/src/modules/ui/field/display/components/GlobalFilePreviewOpenEffect.tsx
new file mode 100644
index 00000000000..1124c58c4fd
--- /dev/null
+++ b/packages/twenty-front/src/modules/ui/field/display/components/GlobalFilePreviewOpenEffect.tsx
@@ -0,0 +1,19 @@
+import { GLOBAL_FILE_PREVIEW_MODAL_ID } from '@/ui/field/display/constants/GlobalFilePreviewModalId';
+import { filePreviewState } from '@/ui/field/display/states/filePreviewState';
+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';
+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
+import { useEffect } from 'react';
+import { isDefined } from 'twenty-shared/utils';
+
+export const GlobalFilePreviewOpenEffect = () => {
+ const filePreview = useAtomStateValue(filePreviewState);
+ const { openDialog } = useDialog();
+
+ useEffect(() => {
+ if (isDefined(filePreview)) {
+ openDialog(GLOBAL_FILE_PREVIEW_MODAL_ID);
+ }
+ }, [filePreview, openDialog]);
+
+ return null;
+};
diff --git a/packages/twenty-front/src/modules/ui/field/display/components/__stories__/FilePreviewDialog.stories.tsx b/packages/twenty-front/src/modules/ui/field/display/components/__stories__/FilePreviewDialog.stories.tsx
new file mode 100644
index 00000000000..38bb2708554
--- /dev/null
+++ b/packages/twenty-front/src/modules/ui/field/display/components/__stories__/FilePreviewDialog.stories.tsx
@@ -0,0 +1,89 @@
+import { type Meta, type StoryObj } from '@storybook/react-vite';
+import { expect, fn, userEvent, waitFor, within } from 'storybook/test';
+import { Button } from 'twenty-ui/primitives/input';
+import { Text } from 'twenty-ui/primitives/typography';
+import { ComponentDecorator } from 'twenty-ui/testing';
+import { FilePreviewDialog } from '@/ui/field/display/components/FilePreviewDialog';
+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';
+
+const meta: Meta<typeof FilePreviewDialog> = {
+ title: 'UI/Field/FilePreviewDialog',
+ component: FilePreviewDialog,
+ decorators: [ComponentDecorator],
+ args: {
+ dialogId: 'file-preview-story',
+ scrollWrapperId: 'file-preview-story',
+ title: 'Archive.zip',
+ documentName: 'Archive.zip',
+ documentUrl: 'https://example.com/archive.zip',
+ downloadLabel: 'Download attachment',
+ loadingFallback: <Text>Loading document viewer...</Text>,
+ onClose: fn(),
+ onDownload: fn(),
+ },
+ render: (args) => {
+ const { openDialog, closeDialog } = useDialog();
+ return (
+ <>
+ <Button onClick={() => openDialog(args.dialogId)}>Open preview</Button>
+ <FilePreviewDialog
+ // oxlint-disable-next-line react/jsx-props-no-spreading
+ {...args}
+ onClose={() => {
+ closeDialog(args.dialogId);
+ args.onClose();
+ }}
+ />
+ </>
+ );
+ },
+};
+
+export default meta;
+type Story = StoryObj<typeof FilePreviewDialog>;
+
+export const Default: Story = {
+ play: async ({ canvasElement, args }) => {
+ const canvas = within(canvasElement);
+ const body = within(canvasElement.ownerDocument.body);
+ const trigger = canvas.getByRole('button', { name: 'Open preview' });
+ await userEvent.click(trigger);
+ const dialog = await body.findByRole('dialog', { name: 'Archive.zip' });
+ expect(dialog).toHaveAttribute('data-size', 'lg');
+ expect(
+ within(dialog).getByRole('heading', { name: 'Archive.zip' }),
+ ).toHaveAttribute('data-size', 'md');
+ await within(dialog).findByText(
+ 'Archive files cannot be previewed. Please download the file to access its contents.',
+ {},
+ { timeout: 10000 },
+ );
+ await userEvent.click(
+ within(dialog).getByRole('button', { name: 'Download attachment' }),
+ );
+ expect(args.onDownload).toHaveBeenCalledOnce();
+ await userEvent.keyboard('{Escape}');
+ await waitFor(() => expect(args.onClose).toHaveBeenCalledOnce());
+ await waitFor(() => expect(dialog).not.toBeInTheDocument());
+ await waitFor(() => expect(trigger).toHaveFocus());
+ },
+};
+
+export const WithoutDownloadAction: Story = {
+ args: { onDownload: undefined, onClose: fn() },
+ play: async ({ canvasElement, args }) => {
+ const body = within(canvasElement.ownerDocument.body);
+ await userEvent.click(
+ within(canvasElement).getByRole('button', { name: 'Open preview' }),
+ );
+ const dialog = await body.findByRole('dialog', { name: 'Archive.zip' });
+ expect(
+ within(dialog).queryByRole('button', { name: 'Download attachment' }),
+ ).toBeNull();
+ await userEvent.click(
+ within(dialog).getByRole('button', { name: 'Close preview' }),
+ );
+ await waitFor(() => expect(args.onClose).toHaveBeenCalledOnce());
+ await waitFor(() => expect(dialog).not.toBeInTheDocument());
+ },
+};
diff --git a/packages/twenty-front/src/modules/ui/field/display/components/internal/EllipsisDisplay/EllipsisDisplay.tsx b/packages/twenty-front/src/modules/ui/field/display/components/internal/EllipsisDisplay/EllipsisDisplay.tsx
index 4e4ac7236a7..28889b60f67 100644
--- a/packages/twenty-front/src/modules/ui/field/display/components/internal/EllipsisDisplay/EllipsisDisplay.tsx
+++ b/packages/twenty-front/src/modules/ui/field/display/components/internal/EllipsisDisplay/EllipsisDisplay.tsx
@@ -5,13 +5,9 @@ import { isDefined } from 'twenty-shared/utils';
const styles = {
ellipsis: css`
- & {
- align-items: center;
- display: flex;
- height: 20px;
- max-width: 100%;
- width: 100%;
- }
+ height: 20px;
+ max-width: 100%;
+ width: 100%;
`,
};
diff --git a/packages/twenty-front/src/modules/ui/field/display/constants/GlobalFilePreviewModalId.ts b/packages/twenty-front/src/modules/ui/field/display/constants/GlobalFilePreviewModalId.ts
new file mode 100644
index 00000000000..be8b1c80a00
--- /dev/null
+++ b/packages/twenty-front/src/modules/ui/field/display/constants/GlobalFilePreviewModalId.ts
@@ -0,0 +1 @@
+export const GLOBAL_FILE_PREVIEW_MODAL_ID = 'global-file-preview-modal';
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 dd3131954cd..3afb01bd6aa 100644
--- a/packages/twenty-front/src/modules/ui/input/components/TextInput.tsx
+++ b/packages/twenty-front/src/modules/ui/input/components/TextInput.tsx
@@ -245,6 +245,7 @@ const TextInputComponent = forwardRef<
'aria-label': ariaLabel,
className,
label,
+ hint,
value,
onChange,
onFocus,
@@ -303,16 +304,21 @@ const TextInputComponent = forwardRef<
onChange?.(turnIntoEmptyStringIfWhitespacesOnly(event.target.value));
};
+ const generatedId = useId();
+ const instanceId = inputProps?.id ?? generatedId;
+ const hintId = isNonEmptyString(hint) ? `${instanceId}-hint` : undefined;
+ const describedBy =
+ [inputProps?.['aria-describedby'], hintId]
+ .filter(isNonEmptyString)
+ .join(' ') || undefined;
const mergedInputProps = mergeProps<'input'>(inputProps, {
onFocus: handleFocus,
onBlur: handleBlur,
onKeyDown,
onChange: handleChange,
+ 'aria-describedby': describedBy,
});
- const generatedId = useId();
- const instanceId = inputProps?.id ?? generatedId;
-
return (
<Field.Root
render={
@@ -402,6 +408,9 @@ const TextInputComponent = forwardRef<
)}
</StyledTrailingIconContainer>
</StyledInputContainer>
+ {isNonEmptyString(hint) && (
+ <Field.Description id={hintId}>{hint}</Field.Description>
+ )}
{!noErrorHelper && error && (
<StyledErrorHelper aria-live="polite">
<Field.Error match>{error}</Field.Error>
diff --git a/packages/twenty-front/src/modules/ui/input/components/__stories__/TextInput.stories.tsx b/packages/twenty-front/src/modules/ui/input/components/__stories__/TextInput.stories.tsx
index f71756c5ba0..c3ce20aa7b9 100644
--- a/packages/twenty-front/src/modules/ui/input/components/__stories__/TextInput.stories.tsx
+++ b/packages/twenty-front/src/modules/ui/input/components/__stories__/TextInput.stories.tsx
@@ -4,6 +4,7 @@ import { expect, fn, userEvent, within } from 'storybook/test';
import { TextInput } from '@/ui/input/components/TextInput';
import { type TextInputComponentProps } from '@/ui/input/types/TextInputComponentProps';
+import { Text } from 'twenty-ui/primitives/typography';
import { ComponentDecorator } from 'twenty-ui/testing';
type RenderProps = TextInputComponentProps;
@@ -71,6 +72,7 @@ export const WithRightAdornment: Story = {
export const ForwardsNativeInputProps: Story = {
args: {
label: 'Address',
+ hint: 'Use your full address.',
value: '',
onChange: fn(),
onFocus: fn(),
@@ -79,17 +81,30 @@ export const ForwardsNativeInputProps: Story = {
id: 'native-address-input',
role: 'combobox',
'aria-controls': 'address-options',
+ 'aria-describedby': 'address-field-context',
onChange: fn(),
onFocus: fn(),
onKeyDown: fn(),
},
},
+ render: (args) => (
+ <>
+ <Text id="address-field-context">Your billing location.</Text>
+ <Render
+ // oxlint-disable-next-line react/jsx-props-no-spreading
+ {...args}
+ />
+ </>
+ ),
play: async ({ args, canvasElement }) => {
const canvas = within(canvasElement);
const input = canvas.getByRole('combobox', { name: 'Address' });
expect(input).toHaveAttribute('id', 'native-address-input');
expect(input).toHaveAttribute('aria-controls', 'address-options');
+ expect(input).toHaveAccessibleDescription(
+ 'Your billing location. Use your full address.',
+ );
await userEvent.click(canvas.getByText('Address'));
diff --git a/packages/twenty-front/src/modules/ui/input/types/TextInputComponentProps.ts b/packages/twenty-front/src/modules/ui/input/types/TextInputComponentProps.ts
index db686937158..5cb24d31654 100644
--- a/packages/twenty-front/src/modules/ui/input/types/TextInputComponentProps.ts
+++ b/packages/twenty-front/src/modules/ui/input/types/TextInputComponentProps.ts
@@ -7,6 +7,7 @@ export type TextInputComponentProps = Omit<
'onChange'
> & {
label?: string;
+ hint?: string;
onChange?: (text: string) => void;
inputProps?: ComponentPropsWithRef<'input'>;
fullWidth?: boolean;
diff --git a/packages/twenty-front/src/modules/ui/layout/dropdown/components/StyledDropdownMenuSubheader.tsx b/packages/twenty-front/src/modules/ui/layout/dropdown/components/StyledDropdownMenuSubheader.tsx
deleted file mode 100644
index 9bb9e91eb26..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/dropdown/components/StyledDropdownMenuSubheader.tsx
+++ /dev/null
@@ -1,26 +0,0 @@
-import { styled } from '@linaria/react';
-import { type ReactNode } from 'react';
-import { Text } from 'twenty-ui/primitives/typography';
-import { themeCssVariables } from 'twenty-ui/theme';
-
-const StyledDropdownMenuSubheaderContainer = styled.div`
- background-color: ${themeCssVariables.background.transparent.lighter};
- padding: ${themeCssVariables.spacing[1]} ${themeCssVariables.spacing[2]};
- width: 100%;
-`;
-
-export const StyledDropdownMenuSubheader = ({
- children,
-}: {
- children: ReactNode;
-}) => (
- <StyledDropdownMenuSubheaderContainer>
- <StyledDisplayLabel>{children}</StyledDisplayLabel>
- </StyledDropdownMenuSubheaderContainer>
-);
-
-const StyledDisplayLabel = styled(Text)`
- color: var(--t-font-color-light);
- font-size: 11px;
- font-weight: var(--t-font-weight-semi-bold);
-`;
diff --git a/packages/twenty-front/src/modules/ui/layout/dropdown/components/__stories__/Dropdown.stories.tsx b/packages/twenty-front/src/modules/ui/layout/dropdown/components/__stories__/Dropdown.stories.tsx
index 7dad270b7ac..aa7c4b92ca0 100644
--- a/packages/twenty-front/src/modules/ui/layout/dropdown/components/__stories__/Dropdown.stories.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/dropdown/components/__stories__/Dropdown.stories.tsx
@@ -17,7 +17,7 @@ import { DropdownMenuInput } from '@/ui/layout/dropdown/components/DropdownMenuI
import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';
import { DropdownMenuSearchInput } from '@/ui/layout/dropdown/components/DropdownMenuSearchInput';
import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator';
-import { StyledDropdownMenuSubheader } from '@/ui/layout/dropdown/components/StyledDropdownMenuSubheader';
+import { DropdownMenuSectionLabel } from '@/ui/layout/dropdown/components/DropdownMenuSectionLabel';
import { IconChevronLeft } from 'twenty-ui/icon';
import { Button } from 'twenty-ui/primitives/input';
import { ListItem } from 'twenty-ui/primitives/navigation';
@@ -212,7 +212,7 @@ export const WithHeaders: Story = {
>
Header
</DropdownMenuHeader>
- <StyledDropdownMenuSubheader>Subheader 1</StyledDropdownMenuSubheader>
+ <DropdownMenuSectionLabel label="Subheader 1" />
<DropdownMenuItemsContainer hasMaxHeight>
<>
{optionsMock.slice(0, 3).map((item) => (
@@ -221,7 +221,7 @@ export const WithHeaders: Story = {
</>
</DropdownMenuItemsContainer>
<DropdownMenuSeparator />
- <StyledDropdownMenuSubheader>Subheader 2</StyledDropdownMenuSubheader>
+ <DropdownMenuSectionLabel label="Subheader 2" />
<DropdownMenuItemsContainer>
{optionsMock.slice(3).map((item) => (
<ListItem key={item.id}>{item.name}</ListItem>
diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerCollapseButton.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerCollapseButton.tsx
index 9c31351ed0b..41e8ea49a5b 100644
--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerCollapseButton.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerCollapseButton.tsx
@@ -4,29 +4,16 @@ import { useToggleNavigationDrawer } from '@/ui/navigation/navigation-drawer/hoo
import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';
import { useNavigationDrawerExpandButtonFocusHandOff } from '@/ui/navigation/navigation-drawer/hooks/useNavigationDrawerExpandButtonFocusHandOff';
import { useIsMobile } from 'twenty-ui/utilities';
-import { styled } from '@linaria/react';
import { LightIconButton } from 'twenty-ui/components/input';
-import { Tooltip } from 'twenty-ui/primitives/surfaces';
-import { themeCssVariables } from 'twenty-ui/theme';
-
-const StyledCollapseButton = styled.div`
- align-items: center;
- border-radius: ${themeCssVariables.border.radius.md};
- color: ${themeCssVariables.font.color.light};
- cursor: pointer;
- display: flex;
- justify-content: center;
- user-select: none;
-`;
type NavigationDrawerCollapseButtonProps = {
- className?: string;
direction?: 'left' | 'right';
+ size?: 'sm' | 'md';
};
export const NavigationDrawerCollapseButton = ({
- className,
direction = 'left',
+ size,
}: NavigationDrawerCollapseButtonProps) => {
const isMobile = useIsMobile();
const isSettingsDrawer = useIsSettingsDrawer();
@@ -43,23 +30,18 @@ export const NavigationDrawerCollapseButton = ({
}
return (
- <Tooltip
- content={label}
- delay={TooltipDelay.longDelay}
- side="bottom"
- sideOffset={5}
+ <LightIconButton
+ ref={direction === 'right' ? expandButtonFocusHandOffRef : undefined}
+ emphasis="standard"
+ size={size ?? (isMobile ? 'md' : 'sm')}
+ onClick={toggleNavigationDrawer}
+ aria-label={label}
+ tooltip={label}
+ tooltipDelay={TooltipDelay.longDelay}
+ tooltipPlace="bottom"
+ tooltipOffset={5}
>
- <StyledCollapseButton className={className}>
- <LightIconButton
- ref={direction === 'right' ? expandButtonFocusHandOffRef : undefined}
- emphasis="standard"
- size="sm"
- onClick={toggleNavigationDrawer}
- aria-label={label}
- >
- <Icon />
- </LightIconButton>
- </StyledCollapseButton>
- </Tooltip>
+ <Icon />
+ </LightIconButton>
);
};
diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerSectionTitle.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerSectionTitle.tsx
index 731f7a6843a..aee8dd4413f 100644
--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerSectionTitle.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerSectionTitle.tsx
@@ -8,6 +8,16 @@ import { IconChevronRight } from 'twenty-ui/icon';
import { Text } from 'twenty-ui/primitives/typography';
import { useTheme, themeCssVariables } from 'twenty-ui/theme';
+const StyledDisplayLabel = styled(Text)`
+ color: var(--t-font-color-light);
+ font-size: ${themeCssVariables.font.size.xs};
+ font-weight: var(--t-font-weight-semi-bold);
+
+ .section-title-container:hover & {
+ color: ${themeCssVariables.font.color.tertiary};
+ }
+`;
+
const StyledTitle = styled.div`
align-items: center;
border-radius: ${themeCssVariables.border.radius.md};
@@ -22,10 +32,6 @@ const StyledTitle = styled.div`
&:hover {
background-color: ${themeCssVariables.background.transparent.light};
cursor: pointer;
-
- .section-title-label {
- color: ${themeCssVariables.font.color.tertiary};
- }
}
`;
@@ -92,9 +98,7 @@ export const NavigationDrawerSectionTitle = ({
return (
<StyledTitle className="section-title-container">
<StyledLabelContainer onClick={handleTitleClick}>
- <StyledDisplayLabel className="section-title-label">
- {label}
- </StyledDisplayLabel>
+ <StyledDisplayLabel>{label}</StyledDisplayLabel>
{isOpen !== undefined && (
<StyledChevron>
<MotionIconChevronRight
@@ -119,9 +123,3 @@ export const NavigationDrawerSectionTitle = ({
</StyledTitle>
);
};
-
-const StyledDisplayLabel = styled(Text)`
- color: var(--t-font-color-light);
- font-size: 11px;
- font-weight: var(--t-font-weight-semi-bold);
-`;
diff --git a/packages/twenty-front/src/modules/ui/utilities/scroll/components/ScrollOverlayButton.tsx b/packages/twenty-front/src/modules/ui/utilities/scroll/components/ScrollOverlayButton.tsx
index 6d6b63476b0..7cd13a20de9 100644
--- a/packages/twenty-front/src/modules/ui/utilities/scroll/components/ScrollOverlayButton.tsx
+++ b/packages/twenty-front/src/modules/ui/utilities/scroll/components/ScrollOverlayButton.tsx
@@ -1,44 +1,20 @@
import { styled } from '@linaria/react';
import { isDefined } from 'twenty-shared/utils';
+import { IconButton } from 'twenty-ui/components/input';
import { type IconComponent } from 'twenty-ui/icon';
-import { themeCssVariables, useTheme } from 'twenty-ui/theme';
+import { Button } from 'twenty-ui/primitives/input';
+import { themeCssVariables } from 'twenty-ui/theme';
-const StyledScrollOverlayButton = styled.button<{
- hasTitle: boolean;
- isVisible: boolean;
-}>`
- align-items: center;
- background: ${themeCssVariables.background.primary};
- border: 1px solid ${themeCssVariables.border.color.medium};
- border-radius: ${themeCssVariables.border.radius.pill};
+const StyledScrollOverlayContainer = styled.div<{ isVisible: boolean }>`
bottom: ${themeCssVariables.spacing[3]};
- box-shadow: ${themeCssVariables.boxShadow.light};
- color: ${themeCssVariables.font.color.secondary};
- corner-shape: round;
- cursor: pointer;
- display: flex;
- font-family: ${themeCssVariables.font.family};
- font-size: ${themeCssVariables.font.size.md};
- font-weight: ${themeCssVariables.font.weight.regular};
- gap: ${themeCssVariables.spacing[1]};
- height: 32px;
- justify-content: center;
left: 50%;
opacity: ${({ isVisible }) => (isVisible ? 1 : 0)};
- padding: ${({ hasTitle }) =>
- hasTitle ? `0 ${themeCssVariables.spacing[3]}` : '0'};
pointer-events: ${({ isVisible }) => (isVisible ? 'auto' : 'none')};
position: absolute;
transform: translateX(-50%);
- transition:
- opacity calc(${themeCssVariables.animation.duration.normal} * 1s) ease,
- background calc(${themeCssVariables.animation.duration.fast} * 1s) ease;
- width: ${({ hasTitle }) => (hasTitle ? 'auto' : '32px')};
+ transition: opacity calc(${themeCssVariables.animation.duration.normal} * 1s)
+ ease;
z-index: 1;
-
- &:hover {
- background: ${themeCssVariables.background.tertiary};
- }
`;
type ScrollOverlayButtonProps = {
@@ -56,20 +32,39 @@ export const ScrollOverlayButton = ({
Icon,
title,
}: ScrollOverlayButtonProps) => {
- const theme = useTheme();
+ if (isDefined(title)) {
+ return (
+ <StyledScrollOverlayContainer isVisible={isVisible}>
+ <Button
+ aria-hidden={!isVisible}
+ aria-label={ariaLabel}
+ variant="outline"
+ elevated
+ size="md"
+ startIcon={isDefined(Icon) ? <Icon /> : undefined}
+ tabIndex={isVisible ? 0 : -1}
+ onClick={onClick}
+ >
+ {title}
+ </Button>
+ </StyledScrollOverlayContainer>
+ );
+ }
return (
- <StyledScrollOverlayButton
- aria-hidden={!isVisible}
- aria-label={ariaLabel}
- hasTitle={isDefined(title)}
- isVisible={isVisible}
- tabIndex={isVisible ? 0 : -1}
- type="button"
- onClick={onClick}
- >
- {isDefined(Icon) && <Icon size={theme.icon.size.md} />}
- {title}
- </StyledScrollOverlayButton>
+ <StyledScrollOverlayContainer isVisible={isVisible}>
+ <IconButton
+ aria-hidden={!isVisible}
+ aria-label={ariaLabel}
+ variant="outline"
+ elevated
+ shape="round"
+ size="md"
+ tabIndex={isVisible ? 0 : -1}
+ onClick={onClick}
+ >
+ {isDefined(Icon) && <Icon />}
+ </IconButton>
+ </StyledScrollOverlayContainer>
);
};
diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/components/WorkflowDiagramDefaultEdgeEditable.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/components/WorkflowDiagramDefaultEdgeEditable.tsx
index 62218b89622..57595b92c40 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/components/WorkflowDiagramDefaultEdgeEditable.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/components/WorkflowDiagramDefaultEdgeEditable.tsx
@@ -136,11 +136,13 @@ export const WorkflowDiagramDefaultEdgeEditable = ({
})
}
>
- <WorkflowDiagramEdgeButtonGroup selected={nodeCreationStarted}>
+ <WorkflowDiagramEdgeButtonGroup>
<LightIconButton
size="xs"
emphasis="subtle"
aria-label={t`Insert action`}
+ color={nodeCreationStarted ? 'accent' : 'neutral'}
+ aria-pressed={nodeCreationStarted}
onClick={handleNodeButtonClick}
>
<IconPlus />
diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/components/WorkflowDiagramEdgeButtonGroup.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/components/WorkflowDiagramEdgeButtonGroup.tsx
index 95b3dd0be2b..674b6fbe934 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/components/WorkflowDiagramEdgeButtonGroup.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/components/WorkflowDiagramEdgeButtonGroup.tsx
@@ -2,34 +2,22 @@ import { styled } from '@linaria/react';
import { useLingui } from '@lingui/react/macro';
import { type ReactNode } from 'react';
import { ButtonGroup } from 'twenty-ui/primitives/input';
-import { themeCssVariables } from 'twenty-ui/theme';
const StyledButtonGroupContainer = styled.div`
pointer-events: all;
`;
-const StyledSelectedButtonGroupContainer = styled.div`
- background-color: ${themeCssVariables.color.blue2};
- border-color: ${themeCssVariables.color.blue};
- pointer-events: all;
-`;
-
type WorkflowDiagramEdgeButtonGroupProps = {
children: ReactNode;
- selected?: boolean;
};
export const WorkflowDiagramEdgeButtonGroup = ({
- selected = false,
children,
}: WorkflowDiagramEdgeButtonGroupProps) => {
const { t } = useLingui();
- const Container = selected
- ? StyledSelectedButtonGroupContainer
- : StyledButtonGroupContainer;
return (
- <Container>
+ <StyledButtonGroupContainer>
<ButtonGroup
aria-label={t`Workflow connection controls`}
framed
@@ -38,6 +26,6 @@ export const WorkflowDiagramEdgeButtonGroup = ({
>
{children}
</ButtonGroup>
- </Container>
+ </StyledButtonGroupContainer>
);
};
diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowNodeLabel.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowNodeLabel.tsx
index fdb2f0d1032..c2c77875c6b 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowNodeLabel.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowNodeLabel.tsx
@@ -10,13 +10,9 @@ type WorkflowNodeLabelProps = {
className?: string;
};
-const StyledNodeLabelWrapper = styled.div<{ labelColor: string }>`
+const StyledNodeLabelWrapper = styled.div`
box-sizing: border-box;
flex: 1 0 0;
-
- > div {
- color: ${({ labelColor }) => labelColor};
- }
`;
export const WorkflowNodeLabel = ({
@@ -29,14 +25,14 @@ export const WorkflowNodeLabel = ({
const labelColor = selected ? colors.selected.color : colors.unselected.color;
return (
- <StyledNodeLabelWrapper labelColor={labelColor} className={className}>
- <StyledDisplayLabel>{children}</StyledDisplayLabel>
+ <StyledNodeLabelWrapper className={className}>
+ <StyledDisplayLabel color={labelColor}>{children}</StyledDisplayLabel>
</StyledNodeLabelWrapper>
);
};
-const StyledDisplayLabel = styled(Text)`
- color: var(--t-font-color-light);
+const StyledDisplayLabel = styled(Text)<{ color: string }>`
+ color: ${({ color }) => color};
font-size: 11px;
font-weight: var(--t-font-weight-semi-bold);
`;
diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowRunStepLogsToolCallRow.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowRunStepLogsToolCallRow.tsx
index 60255f2c776..d84665160d6 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowRunStepLogsToolCallRow.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowRunStepLogsToolCallRow.tsx
@@ -8,12 +8,8 @@ import { getToolDisplayMessage } from '@/ai/utils/tool-display/getToolDisplayMes
import { useLingui } from '@lingui/react/macro';
import { isDefined } from 'twenty-shared/utils';
import { JsonTree } from 'twenty-ui/components/data-display';
-import {
- IconCheck,
- IconChevronDown,
- IconChevronUp,
- IconCircleX,
-} from 'twenty-ui/icon';
+import { IconCheck, IconChevronDown, IconCircleX } from 'twenty-ui/icon';
+import { Badge } from 'twenty-ui/primitives/data-display';
import { Collapsible } from 'twenty-ui/primitives/layout';
import { Tabs } from 'twenty-ui/primitives/navigation';
import { useTheme, themeCssVariables } from 'twenty-ui/theme';
@@ -27,7 +23,7 @@ const StyledContainer = styled.div`
gap: ${themeCssVariables.spacing[2]};
`;
-const StyledToggleButton = styled.button<{ isExpandable: boolean }>`
+const StyledToggleRow = styled.div<{ isExpandable: boolean }>`
align-items: center;
background: none;
border: none;
@@ -43,7 +39,10 @@ const StyledToggleButton = styled.button<{ isExpandable: boolean }>`
width: 100%;
&:hover {
- color: ${themeCssVariables.font.color.primary};
+ color: ${({ isExpandable }) =>
+ isExpandable
+ ? themeCssVariables.font.color.primary
+ : themeCssVariables.font.color.tertiary};
}
`;
@@ -75,13 +74,13 @@ const StyledDisplayMessage = styled.span`
white-space: nowrap;
`;
-const StyledToolBadge = styled.span`
- background: ${themeCssVariables.background.transparent.light};
- border-radius: ${themeCssVariables.border.radius.xs};
- color: ${themeCssVariables.font.color.light};
- font-family: ${themeCssVariables.font.family};
- font-size: ${themeCssVariables.font.size.xs};
- padding: ${themeCssVariables.spacing['0.5']} ${themeCssVariables.spacing[1]};
+const StyledChevron = styled.span`
+ display: flex;
+ transform: rotate(0deg);
+
+ [data-panel-open] & {
+ transform: rotate(180deg);
+ }
`;
const StyledContentContainer = styled.div`
@@ -145,83 +144,92 @@ export const WorkflowRunStepLogsToolCallRow = ({
output: toolCall.output,
});
+ const rowContent = (
+ <>
+ <StyledLeftContent>
+ <StyledIconContainer>
+ <ToolIcon size={theme.icon.size.sm} />
+ </StyledIconContainer>
+ <StyledDisplayMessage>{displayMessage}</StyledDisplayMessage>
+ </StyledLeftContent>
+ <StyledRightContent>
+ <Badge size="sm">{toolCall.toolName}</Badge>
+ <StyledIconContainer style={{ color: statusColor }}>
+ <StatusIcon size={theme.icon.size.sm} />
+ </StyledIconContainer>
+ {isExpandable && (
+ <StyledChevron>
+ <IconChevronDown size={theme.icon.size.sm} />
+ </StyledChevron>
+ )}
+ </StyledRightContent>
+ </>
+ );
+
return (
- <StyledContainer>
- <StyledToggleButton
- type="button"
- isExpandable={isExpandable}
- onClick={() => isExpandable && setIsExpanded(!isExpanded)}
- >
- <StyledLeftContent>
- <StyledIconContainer>
- <ToolIcon size={theme.icon.size.sm} />
- </StyledIconContainer>
- <StyledDisplayMessage>{displayMessage}</StyledDisplayMessage>
- </StyledLeftContent>
- <StyledRightContent>
- <StyledToolBadge>{toolCall.toolName}</StyledToolBadge>
- <StyledIconContainer style={{ color: statusColor }}>
- <StatusIcon size={theme.icon.size.sm} />
- </StyledIconContainer>
- {isExpandable &&
- (isExpanded ? (
- <IconChevronUp size={theme.icon.size.sm} />
- ) : (
- <IconChevronDown size={theme.icon.size.sm} />
- ))}
- </StyledRightContent>
- </StyledToggleButton>
+ <Collapsible.Root
+ open={isExpanded}
+ onOpenChange={setIsExpanded}
+ render={<StyledContainer />}
+ >
+ {isExpandable ? (
+ <Collapsible.Trigger
+ render={<StyledToggleRow as="button" isExpandable />}
+ >
+ {rowContent}
+ </Collapsible.Trigger>
+ ) : (
+ <StyledToggleRow isExpandable={false}>{rowContent}</StyledToggleRow>
+ )}
{isExpandable && (
- <Collapsible.Root open={isExpanded}>
- <Collapsible.Panel>
- <StyledContentContainer>
- {hasError && isDefined(toolCall.errorMessage) ? (
- <StyledErrorMessage>{toolCall.errorMessage}</StyledErrorMessage>
- ) : (
- <Tabs.Root
- value={activeTab}
- onValueChange={(value) => {
- if (value !== 'output' && value !== 'input') {
- return;
- }
- setActiveTab(value);
- }}
+ <Collapsible.Panel>
+ <StyledContentContainer>
+ {hasError && isDefined(toolCall.errorMessage) ? (
+ <StyledErrorMessage>{toolCall.errorMessage}</StyledErrorMessage>
+ ) : (
+ <Tabs.Root
+ value={activeTab}
+ onValueChange={(value) => {
+ if (value !== 'output' && value !== 'input') {
+ return;
+ }
+ setActiveTab(value);
+ }}
+ >
+ <Tabs.List
+ aria-label={t`Tool call details`}
+ render={<StyledTabContainer />}
>
- <Tabs.List
- aria-label={t`Tool call details`}
- render={<StyledTabContainer />}
- >
- <Tabs.Tab value="output" size="compact">
- {t`Output`}
- </Tabs.Tab>
- <Tabs.Tab value="input" size="compact">
- {t`Input`}
- </Tabs.Tab>
- <Tabs.Indicator />
- </Tabs.List>
- {tabPanels.map(({ value, content }) => (
- <Tabs.Panel key={value} value={value}>
- <StyledJsonTreeContainer>
- <JsonTree
- value={content as JsonValue}
- shouldExpandNodeInitially={() => false}
- emptyArrayLabel={t`Empty Array`}
- emptyObjectLabel={t`Empty Object`}
- emptyStringLabel={t`[empty string]`}
- arrowButtonCollapsedLabel={t`Expand`}
- arrowButtonExpandedLabel={t`Collapse`}
- onNodeValueClick={copyToClipboard}
- />
- </StyledJsonTreeContainer>
- </Tabs.Panel>
- ))}
- </Tabs.Root>
- )}
- </StyledContentContainer>
- </Collapsible.Panel>
- </Collapsible.Root>
+ <Tabs.Tab value="output" size="compact">
+ {t`Output`}
+ </Tabs.Tab>
+ <Tabs.Tab value="input" size="compact">
+ {t`Input`}
+ </Tabs.Tab>
+ <Tabs.Indicator />
+ </Tabs.List>
+ {tabPanels.map(({ value, content }) => (
+ <Tabs.Panel key={value} value={value}>
+ <StyledJsonTreeContainer>
+ <JsonTree
+ value={content as JsonValue}
+ shouldExpandNodeInitially={() => false}
+ emptyArrayLabel={t`Empty Array`}
+ emptyObjectLabel={t`Empty Object`}
+ emptyStringLabel={t`[empty string]`}
+ arrowButtonCollapsedLabel={t`Expand`}
+ arrowButtonExpandedLabel={t`Collapse`}
+ onNodeValueClick={copyToClipboard}
+ />
+ </StyledJsonTreeContainer>
+ </Tabs.Panel>
+ ))}
+ </Tabs.Root>
+ )}
+ </StyledContentContainer>
+ </Collapsible.Panel>
)}
- </StyledContainer>
+ </Collapsible.Root>
);
};
diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/__stories__/WorkflowRunStepLogsToolCallRow.stories.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/__stories__/WorkflowRunStepLogsToolCallRow.stories.tsx
index 299d0e2801a..134221b6417 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/__stories__/WorkflowRunStepLogsToolCallRow.stories.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/__stories__/WorkflowRunStepLogsToolCallRow.stories.tsx
@@ -2,6 +2,7 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
import { graphql, HttpResponse } from 'msw';
import { expect, userEvent, waitFor, within } from 'storybook/test';
import { type AgentRunToolCallLog } from 'twenty-shared/ai';
+import { assertIsDefinedOrThrow } from 'twenty-shared/utils';
import { ComponentDecorator } from 'twenty-ui/testing';
import { WorkflowRunStepLogsToolCallRow } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowRunStepLogsToolCallRow';
@@ -40,7 +41,15 @@ export const OutputAndInput: Story = {
const canvas = within(canvasElement);
const user = userEvent.setup({ writeToClipboard: true });
const toggle = canvas.getByRole('button', { name: /inspect_tool/ });
+ expect(toggle).toHaveAttribute('aria-expanded', 'false');
+ expect(toggle.tagName).toBe('BUTTON');
await user.click(toggle);
+ const panelId = toggle.getAttribute('aria-controls');
+ assertIsDefinedOrThrow(panelId);
+ await waitFor(() => {
+ expect(toggle).toHaveAttribute('aria-expanded', 'true');
+ expect(canvasElement.ownerDocument.getElementById(panelId)).toBeVisible();
+ });
const output = await canvas.findByRole('tab', { name: 'Output' });
const input = canvas.getByRole('tab', { name: 'Input' });
await waitFor(() => {
@@ -110,3 +119,15 @@ export const ErrorWithoutTabs: Story = {
});
},
};
+
+export const NoDetails: Story = {
+ args: {
+ toolCall: { ...TOOL_CALL, input: undefined, output: undefined },
+ },
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+ expect(canvas.getByText('inspect_tool')).toBeVisible();
+ expect(canvas.queryByRole('button')).toBeNull();
+ expect(canvas.queryByRole('tablist', { hidden: true })).toBeNull();
+ },
+};
diff --git a/packages/twenty-front/src/pages/auth/Authorize.tsx b/packages/twenty-front/src/pages/auth/Authorize.tsx
index 49236676ba5..578a895188f 100644
--- a/packages/twenty-front/src/pages/auth/Authorize.tsx
+++ b/packages/twenty-front/src/pages/auth/Authorize.tsx
@@ -62,7 +62,6 @@ const StyledHeader = styled.div`
`;
const StyledOAuthTitle = styled(Heading)`
- margin: 0;
max-width: min(100%, var(--oauth-modal-content-max-width));
padding-bottom: ${themeCssVariables.spacing[1]};
text-wrap: balance;
diff --git a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminIndicatorHealthStatus.tsx b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminIndicatorHealthStatus.tsx
index 2d1eff17853..c3ee8719d5d 100644
--- a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminIndicatorHealthStatus.tsx
+++ b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminIndicatorHealthStatus.tsx
@@ -25,10 +25,6 @@ const StyledTitleContainer = styled.div`
display: flex;
gap: ${themeCssVariables.spacing[4]};
margin-top: ${themeCssVariables.spacing[2]};
-
- h3 {
- line-height: inherit;
- }
`;
export const SettingsAdminIndicatorHealthStatus = () => {
diff --git a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceDetail.tsx b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceDetail.tsx
index baca3482773..78ae56db719 100644
--- a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceDetail.tsx
+++ b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceDetail.tsx
@@ -52,10 +52,7 @@ import { Avatar } from 'twenty-ui/primitives/data-display';
import { Button, Switch } from 'twenty-ui/primitives/input';
import { Tabs } from 'twenty-ui/primitives/navigation';
import { Card } from 'twenty-ui/primitives/surfaces';
-import {
- Text,
- OverflowingTextWithTooltip,
-} from 'twenty-ui/primitives/typography';
+import { OverflowingTextWithTooltip } from 'twenty-ui/primitives/typography';
import { themeCssVariables } from 'twenty-ui/theme';
import {
GetUpgradeStatusDocument,
@@ -66,7 +63,7 @@ import {
} from '~/generated-admin/graphql';
import { getAbsoluteImageUrl } from '~/utils/image/getAbsoluteImageUrl';
-const StyledFeatureFlagName = styled(Text)`
+const StyledFeatureFlagName = styled(OverflowingTextWithTooltip)`
color: ${themeCssVariables.font.color.primary};
font-size: ${themeCssVariables.font.size.md};
font-weight: ${themeCssVariables.font.weight.regular};
@@ -258,15 +255,13 @@ export const SettingsAdminWorkspaceDetail = () => {
label: t`Name`,
overflow: 'hidden',
Cell: ({ item }) => (
- <StyledFeatureFlagName>
- <OverflowingTextWithTooltip
- text={<>{item.label}</>}
- tooltipContent={item.id}
- tooltipPlace={'top'}
- alwaysShowTooltip
- isFocusable
- />
- </StyledFeatureFlagName>
+ <StyledFeatureFlagName
+ text={<>{item.label}</>}
+ tooltipContent={item.id}
+ tooltipPlace="top"
+ alwaysShowTooltip
+ isFocusable
+ />
),
},
{
diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsSkillFormContent.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsSkillFormContent.tsx
index d597d8bfb80..8c5bd02a3f5 100644
--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsSkillFormContent.tsx
+++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsSkillFormContent.tsx
@@ -240,10 +240,8 @@ export const SettingsSkillFormContent = ({
delay={TooltipDelay.shortDelay}
>
<IconInfoCircle
- id="info-circle-id-skill-name"
size={theme.icon.size.md}
color={theme.font.color.tertiary}
- style={{ outline: 'none' }}
/>
</Tooltip>
)}
diff --git a/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationRegistrationGeneralInfo.tsx b/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationRegistrationGeneralInfo.tsx
index f4cb8898817..b188ead6bc9 100644
--- a/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationRegistrationGeneralInfo.tsx
+++ b/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationRegistrationGeneralInfo.tsx
@@ -1,3 +1,4 @@
+import { Button } from 'twenty-ui/primitives/input';
import { getChipLabel } from '@/ui/field/display/utils/getChipLabel';
import { useRefetchOnApplicationOperation } from '@/applications/hooks/useRefetchOnApplicationOperation';
import {
@@ -38,15 +39,6 @@ const StyledSourceRow = styled.div`
gap: ${themeCssVariables.spacing[1]};
`;
-const StyledDownloadLink = styled.a`
- color: ${themeCssVariables.font.color.tertiary};
- cursor: pointer;
- text-decoration: underline;
- &:hover {
- color: ${themeCssVariables.font.color.primary};
- }
-`;
-
const StyledGeneralContainer = styled.div`
display: flex;
flex-direction: column;
@@ -161,12 +153,20 @@ export const SettingsApplicationRegistrationGeneralInfo = ({
) ? (
<StyledSourceRow>
<span>{t`Tarball`}</span>
- <StyledDownloadLink
- href={tarballUrlData.applicationRegistrationTarballUrl}
- download
+ <Button
+ variant="link"
+ size="sm"
+ nativeButton={false}
+ role="link"
+ render={
+ <a
+ href={tarballUrlData.applicationRegistrationTarballUrl}
+ download
+ />
+ }
>
<Trans>Download</Trans>
- </StyledDownloadLink>
+ </Button>
</StyledSourceRow>
) : (
t`Tarball`
diff --git a/packages/twenty-front/src/pages/settings/applications/components/SettingsClaimApplicationSection.tsx b/packages/twenty-front/src/pages/settings/applications/components/SettingsClaimApplicationSection.tsx
index 08c2aecd4c0..99ac759027a 100644
--- a/packages/twenty-front/src/pages/settings/applications/components/SettingsClaimApplicationSection.tsx
+++ b/packages/twenty-front/src/pages/settings/applications/components/SettingsClaimApplicationSection.tsx
@@ -74,10 +74,6 @@ const StyledHint = styled.div`
const StyledCalloutContainer = styled.div`
margin-bottom: ${themeCssVariables.spacing[3]};
-
- & > div {
- max-width: 100%;
- }
`;
export const SettingsClaimApplicationSection = () => {
@@ -228,6 +224,7 @@ export const SettingsClaimApplicationSection = () => {
{isDefined(claimError) && (
<StyledCalloutContainer>
<Callout
+ fullWidth
status="error"
title={t`Could not claim this application`}
description={i18n._(claimError.message)}
diff --git a/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationRegistrationConfigTab.tsx b/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationRegistrationConfigTab.tsx
index 29dac0e9cfc..486fbea6100 100644
--- a/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationRegistrationConfigTab.tsx
+++ b/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationRegistrationConfigTab.tsx
@@ -156,7 +156,6 @@ export const SettingsApplicationRegistrationConfigTab = ({
variableKey={variable.key}
isDeprecated={variable.isDeprecated}
description={variable.description}
- tooltipId={`config-var-desc-${variable.key}`}
/>
<ConfigVariableInput
variable={variable as ConfigVariable}
diff --git a/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationsAvailableTab.tsx b/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationsAvailableTab.tsx
index f4ec6901158..627be226089 100644
--- a/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationsAvailableTab.tsx
+++ b/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationsAvailableTab.tsx
@@ -1,3 +1,4 @@
+import { Button } from 'twenty-ui/primitives/input';
import { useMarketplaceApps } from '@/marketplace/hooks/useMarketplaceApps';
import { SettingsEmptyPlaceholder } from '@/settings/components/SettingsEmptyPlaceholder';
import { SettingsSectionSkeletonLoader } from '@/settings/components/SettingsSectionSkeletonLoader';
@@ -51,16 +52,6 @@ const StyledEmptyState = styled.div`
gap: ${themeCssVariables.spacing[2]};
`;
-const StyledHintLink = styled.button`
- background: none;
- border: none;
- color: ${themeCssVariables.color.blue};
- cursor: pointer;
- font-size: inherit;
- padding: 0;
- text-decoration: underline;
-`;
-
export const SettingsApplicationsAvailableTab = () => {
const { t } = useLingui();
const [searchTerm, setSearchTerm] = useState('');
@@ -167,12 +158,15 @@ export const SettingsApplicationsAvailableTab = () => {
<StyledEmptyState role="status">
{getEmptyStateMessage()}
{showNonVettedHint && (
- <StyledHintLink
+ <Button
+ variant="link"
+ color="accent"
+ size="sm"
type="button"
onClick={() => setShowVettedOnly(false)}
>
{t`Show all applications`}
- </StyledHintLink>
+ </Button>
)}
</StyledEmptyState>
</SettingsEmptyPlaceholder>
diff --git a/packages/twenty-front/src/pages/settings/profile/SettingsTwoFactorAuthenticationMethod.tsx b/packages/twenty-front/src/pages/settings/profile/SettingsTwoFactorAuthenticationMethod.tsx
index d295b5d4af4..264bdfc481b 100644
--- a/packages/twenty-front/src/pages/settings/profile/SettingsTwoFactorAuthenticationMethod.tsx
+++ b/packages/twenty-front/src/pages/settings/profile/SettingsTwoFactorAuthenticationMethod.tsx
@@ -1,5 +1,7 @@
+import { Button } from 'twenty-ui/primitives/input';
import { styled } from '@linaria/react';
import { Trans, useLingui } from '@lingui/react/macro';
+import { isNonEmptyString } from '@sniptt/guards';
import { FormProvider } from 'react-hook-form';
import QRCodeModule from 'react-qr-code';
@@ -14,7 +16,7 @@ import { useTwoFactorVerificationForSettings } from '@/settings/two-factor-authe
import { extractSecretFromOtpUri } from '@/settings/two-factor-authentication/utils/extractSecretFromOtpUri';
import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';
import { SettingsPath } from 'twenty-shared/types';
-import { getSettingsPath } from 'twenty-shared/utils';
+import { getSettingsPath, isDefined } from 'twenty-shared/utils';
import { Section } from 'twenty-ui/components/layout';
import { Loader } from 'twenty-ui/primitives/feedback';
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
@@ -63,22 +65,6 @@ const StyledCopySetupKeyText = styled.div`
text-align: left;
`;
-const StyledCopySetupKeyLink = styled.button`
- background: none;
- border: none;
- color: ${themeCssVariables.font.color.tertiary};
- cursor: pointer;
- display: inline;
- font-size: ${themeCssVariables.font.size.sm};
- margin-left: 0;
- padding: 0;
- text-decoration: underline;
-
- &:hover {
- color: ${themeCssVariables.font.color.secondary};
- }
-`;
-
const StyledDivider = styled.div`
margin: ${themeCssVariables.spacing[6]} 0;
width: 100%;
@@ -101,10 +87,12 @@ export const SettingsTwoFactorAuthenticationMethod = () => {
const shouldShowActionButtons = !has2FAMethod;
const handleCopySetupKey = async () => {
- if (!qrCode) return;
+ if (!isNonEmptyString(qrCode)) {
+ return;
+ }
const secret = extractSecretFromOtpUri(qrCode);
- if (secret !== null) {
+ if (isDefined(secret)) {
await copyToClipboard(secret, t`Setup key copied to clipboard`);
}
};
@@ -165,9 +153,13 @@ export const SettingsTwoFactorAuthenticationMethod = () => {
</StyledQRCodeWrapper>
<StyledCopySetupKeyText>
<Trans>Can't scan? Copy the</Trans>{' '}
- <StyledCopySetupKeyLink onClick={handleCopySetupKey}>
+ <Button
+ variant="link"
+ size="sm"
+ onClick={handleCopySetupKey}
+ >
<Trans>setup key</Trans>
- </StyledCopySetupKeyLink>
+ </Button>
</StyledCopySetupKeyText>
</>
)}
diff --git a/packages/twenty-front/src/testing/components/ToastStoryContainer.tsx b/packages/twenty-front/src/testing/components/ToastStoryContainer.tsx
index 00a7a8fabc7..2d680857b8a 100644
--- a/packages/twenty-front/src/testing/components/ToastStoryContainer.tsx
+++ b/packages/twenty-front/src/testing/components/ToastStoryContainer.tsx
@@ -1,14 +1,6 @@
import { AppToaster } from '@/ui/feedback/toast/components/AppToaster';
-import { styled } from '@linaria/react';
import { useState, type ReactNode } from 'react';
-// CI zeroes animation durations, which would immediately dismiss toasts.
-const StyledStoryContainer = styled.div`
- [role='status'] * {
- animation: none !important;
- }
-`;
-
type ToastStoryContainerProps = {
children: ReactNode;
};
@@ -19,9 +11,12 @@ export const ToastStoryContainer = ({ children }: ToastStoryContainerProps) => {
);
return (
- <StyledStoryContainer ref={setToastContainer}>
- <AppToaster container={toastContainer} />
+ <div ref={setToastContainer}>
+ <AppToaster
+ container={toastContainer}
+ getToastProps={() => ({ progress: 100 })}
+ />
{children}
- </StyledStoryContainer>
+ </div>
);
};