Skip to content

The open alternative to Salesforce, designed for AI.

Use shared components in Companion (#28439)

Raphaël Bosicc48af118bb3
diff --git a/packages/twenty-companion/src/renderer/components/CompanionTheme.tsx b/packages/twenty-companion/src/renderer/components/CompanionTheme.tsx
index 4ce64514883..71ac3f134ce 100644
--- a/packages/twenty-companion/src/renderer/components/CompanionTheme.tsx
+++ b/packages/twenty-companion/src/renderer/components/CompanionTheme.tsx
@@ -1,5 +1,6 @@
import { type ReactNode, useSyncExternalStore } from 'react';
import { ThemeProvider } from 'twenty-ui/theme';
+import { ToastProvider, Toaster } from 'twenty-ui/components/feedback';
import 'twenty-ui/theme-light.css';
import 'twenty-ui/theme-dark.css';
import '@fontsource/inter/latin-400.css';
@@ -29,5 +30,12 @@ export const CompanionTheme = ({
const systemDark = useSyncExternalStore(subscribe, getSnapshot);
const colorScheme =
appearance === 'system' ? (systemDark ? 'dark' : 'light') : appearance;
- return <ThemeProvider colorScheme={colorScheme}>{children}</ThemeProvider>;
+ return (
+ <ThemeProvider colorScheme={colorScheme}>
+ <ToastProvider limit={1}>
+ {children}
+ <Toaster />
+ </ToastProvider>
+ </ThemeProvider>
+ );
};
diff --git a/packages/twenty-companion/src/renderer/components/Home.tsx b/packages/twenty-companion/src/renderer/components/Home.tsx
index 7387d1bed81..6befcf93e7c 100644
--- a/packages/twenty-companion/src/renderer/components/Home.tsx
+++ b/packages/twenty-companion/src/renderer/components/Home.tsx
@@ -25,6 +25,9 @@ const UpcomingMeetings = ({ state, isPending, command }: ActionProps) => {
meetings[0]?.startsAt ?? now,
).toLocaleDateString([], { month: 'long' });
const visibleMeetings = showAllMeetings ? meetings : meetings.slice(0, 3);
+ const lastMeetingDay = new Date(
+ visibleMeetings.at(-1)?.startsAt ?? now,
+ ).toDateString();
const meetingDays = new Map<string, typeof visibleMeetings>();
for (const meeting of visibleMeetings) {
const day = new Date(meeting.startsAt).toDateString();
@@ -37,12 +40,13 @@ const UpcomingMeetings = ({ state, isPending, command }: ActionProps) => {
<Section.Header title={calendarTitle} />
{meetings.length ? (
<>
- <Card.Root
- className="agenda-list"
- backgroundColor="var(--t-background-secondary)"
- >
+ <Card.Root backgroundColor="var(--t-background-secondary)">
{Array.from(meetingDays, ([day, dayMeetings]) => (
- <div className="agenda-day" key={day}>
+ <Card.Content
+ className="agenda-day"
+ key={day}
+ divider={day !== lastMeetingDay}
+ >
<time
className="agenda-date"
dateTime={dayMeetings[0].startsAt}
@@ -76,7 +80,7 @@ const UpcomingMeetings = ({ state, isPending, command }: ActionProps) => {
/>
))}
</div>
- </div>
+ </Card.Content>
))}
</Card.Root>
{meetings.length > 3 && (
diff --git a/packages/twenty-companion/src/renderer/components/MeetingRow.module.scss b/packages/twenty-companion/src/renderer/components/MeetingRow.module.scss
deleted file mode 100644
index 03fa75a585f..00000000000
--- a/packages/twenty-companion/src/renderer/components/MeetingRow.module.scss
+++ /dev/null
@@ -1,9 +0,0 @@
-.popup {
- backdrop-filter: var(--t-blur-medium);
- background: var(--t-background-transparent-primary);
- border: 1px solid var(--t-border-color-medium);
- border-radius: var(--t-border-radius-md);
- box-shadow: var(--t-box-shadow-strong);
- overflow: hidden;
- padding: var(--t-spacing-1);
-}
diff --git a/packages/twenty-companion/src/renderer/components/MeetingRow.module.scss.d.ts b/packages/twenty-companion/src/renderer/components/MeetingRow.module.scss.d.ts
deleted file mode 100644
index 12672df8d89..00000000000
--- a/packages/twenty-companion/src/renderer/components/MeetingRow.module.scss.d.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-declare const styles: {
- readonly popup: string;
-};
-export default styles;
diff --git a/packages/twenty-companion/src/renderer/components/MeetingRow.tsx b/packages/twenty-companion/src/renderer/components/MeetingRow.tsx
index 5342fec17c0..94e22e0cbc3 100644
--- a/packages/twenty-companion/src/renderer/components/MeetingRow.tsx
+++ b/packages/twenty-companion/src/renderer/components/MeetingRow.tsx
@@ -1,7 +1,6 @@
-import { Menu } from '@base-ui/react/menu';
import { i18n } from '@lingui/core';
import { IconButton } from 'twenty-ui/components/input';
-import { ListItem } from 'twenty-ui/primitives/navigation';
+import { Dropdown } from 'twenty-ui/components/navigation';
import { Button } from 'twenty-ui/primitives/input';
import {
IconArrowUpRight,
@@ -13,7 +12,6 @@ import { type Meeting } from '../../shared/types/Meeting';
import { type ActionProps } from '../types/ActionProps';
import { formatTime } from '../utils/formatTime';
import { CalendarEventIndicator } from './CalendarEventIndicator';
-import styles from './MeetingRow.module.scss';
type MeetingRowProps = Pick<ActionProps, 'command' | 'isPending'> & {
meeting: Meeting;
@@ -64,8 +62,8 @@ export const MeetingRow = ({
</div>
<div className="agenda-actions">
{autoJoin && meeting.url && Date.parse(meeting.startsAt) > now && (
- <Menu.Root>
- <Menu.Trigger
+ <Dropdown.Root type="menu">
+ <Dropdown.Trigger
render={
<IconButton
variant="ghost"
@@ -76,39 +74,30 @@ export const MeetingRow = ({
</IconButton>
}
/>
- <Menu.Portal>
- <Menu.Positioner
- side="bottom"
- align="end"
- sideOffset={4}
- className="meeting-menu"
- >
- <Menu.Popup className={styles.popup}>
- <Menu.Item
- render={
- <ListItem
- disabled={isPending('skip', 'unskip')}
- startIcon={
- skipped ? <IconCalendarEvent /> : <IconCalendarX />
- }
- />
- }
- disabled={isPending('skip', 'unskip')}
- onClick={() =>
- void command({
- type: skipped ? 'unskip' : 'skip',
- meetingId: meeting.id,
- })
- }
- >
- {skipped
- ? i18n._('Restore auto-join')
- : i18n._('Skip auto-join')}
- </Menu.Item>
- </Menu.Popup>
- </Menu.Positioner>
- </Menu.Portal>
- </Menu.Root>
+ <Dropdown.Content
+ side="bottom"
+ align="end"
+ sideOffset={4}
+ width="max-content"
+ >
+ <div className="meeting-menu-content">
+ <Dropdown.ActionItem
+ disabled={isPending('skip', 'unskip')}
+ startIcon={skipped ? <IconCalendarEvent /> : <IconCalendarX />}
+ onClick={() =>
+ void command({
+ type: skipped ? 'unskip' : 'skip',
+ meetingId: meeting.id,
+ })
+ }
+ >
+ {skipped
+ ? i18n._('Restore auto-join')
+ : i18n._('Skip auto-join')}
+ </Dropdown.ActionItem>
+ </div>
+ </Dropdown.Content>
+ </Dropdown.Root>
)}
<Button
disabled={!meeting.url || isPending('join')}
diff --git a/packages/twenty-companion/src/renderer/components/Notice.tsx b/packages/twenty-companion/src/renderer/components/Notice.tsx
index 4acf01af233..689a07812f8 100644
--- a/packages/twenty-companion/src/renderer/components/Notice.tsx
+++ b/packages/twenty-companion/src/renderer/components/Notice.tsx
@@ -1,48 +1,58 @@
-import { noticeMessage } from '../utils/noticeMessage';
-import { Banner } from 'twenty-ui/primitives/feedback';
-import { Notification } from './Notification';
-import { IconButton } from 'twenty-ui/components/input';
import { i18n } from '@lingui/core';
-import { Button } from 'twenty-ui/primitives/input';
+import { Banner } from 'twenty-ui/primitives/feedback';
import { IconX } from 'twenty-ui/icon';
+import { isDefined } from 'twenty-ui/utilities';
import { type ActionProps } from '../types/ActionProps';
+import { noticeMessage } from '../utils/noticeMessage';
+import { NotificationEffect } from './NotificationEffect';
+
+export const Notice = ({ state, command }: ActionProps) => {
+ const dismiss = () => void command({ type: 'dismiss-error' });
-export const Notice = ({ state, command }: ActionProps) =>
- !state.error && state.notice?.type === 'recording-finished' ? (
- <div className="notification-container">
- <Notification
- message={noticeMessage(state.notice)}
+ const notificationMessage =
+ !isDefined(state.error) && state.notice?.type === 'recording-finished'
+ ? noticeMessage(state.notice)
+ : undefined;
+ const shouldShowBanner =
+ !isDefined(notificationMessage) &&
+ (isDefined(state.error) || isDefined(state.notice));
+
+ const recovery = state.error?.recovery;
+
+ return (
+ <>
+ <NotificationEffect
+ message={notificationMessage}
closeLabel={i18n._('Dismiss message')}
- onClose={() => void command({ type: 'dismiss-error' })}
+ onClose={dismiss}
/>
- </div>
- ) : state.error || state.notice ? (
- <div className="notice" role={state.error ? 'alert' : 'status'}>
- <Banner status={state.error ? 'error' : 'info'}>
- <span className="notice-text">
- {state.error?.message ??
- (state.notice && noticeMessage(state.notice))}
- </span>
- {state.error?.recovery && (
- <Button
- className="notice-recovery"
- variant="outline"
- onClick={() =>
- state.error?.recovery && void command(state.error.recovery)
+ {shouldShowBanner && (
+ <div
+ className="notice"
+ role={isDefined(state.error) ? 'alert' : 'status'}
+ >
+ <Banner
+ status={isDefined(state.error) ? 'error' : 'info'}
+ action={
+ <div className="notice-actions">
+ {isDefined(recovery) && (
+ <Banner.Action onClick={() => void command(recovery)}>
+ {i18n._('Install Desktop Recorder')}
+ </Banner.Action>
+ )}
+ <Banner.Action
+ aria-label={i18n._('Dismiss message')}
+ startIcon={<IconX />}
+ onClick={dismiss}
+ />
+ </div>
}
>
- {i18n._('Install Desktop Recorder')}
- </Button>
- )}
- <IconButton
- className="notice-close"
- variant="ghost"
- aria-label={i18n._('Dismiss message')}
- onClick={() => void command({ type: 'dismiss-error' })}
- size="md"
- >
- <IconX />
- </IconButton>
- </Banner>
- </div>
- ) : null;
+ {state.error?.message ??
+ (isDefined(state.notice) ? noticeMessage(state.notice) : null)}
+ </Banner>
+ </div>
+ )}
+ </>
+ );
+};
diff --git a/packages/twenty-companion/src/renderer/components/Notification.module.scss b/packages/twenty-companion/src/renderer/components/Notification.module.scss
deleted file mode 100644
index e55e5b2d1b5..00000000000
--- a/packages/twenty-companion/src/renderer/components/Notification.module.scss
+++ /dev/null
@@ -1,14 +0,0 @@
-.container {
- --tw-button-size: var(--t-spacing-8);
-
- border-radius: var(--t-border-radius-md);
- font-family: var(--t-font-family);
- inline-size: 296px;
- margin-block-start: 0;
- max-inline-size: 100%;
- overflow: hidden;
-}
-
-.message {
- font-weight: var(--t-font-weight-regular);
-}
diff --git a/packages/twenty-companion/src/renderer/components/Notification.module.scss.d.ts b/packages/twenty-companion/src/renderer/components/Notification.module.scss.d.ts
deleted file mode 100644
index 4fb45ce35db..00000000000
--- a/packages/twenty-companion/src/renderer/components/Notification.module.scss.d.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-declare const styles: {
- readonly container: string;
- readonly message: string;
-};
-export default styles;
diff --git a/packages/twenty-companion/src/renderer/components/Notification.tsx b/packages/twenty-companion/src/renderer/components/Notification.tsx
deleted file mode 100644
index a92a7264c83..00000000000
--- a/packages/twenty-companion/src/renderer/components/Notification.tsx
+++ /dev/null
@@ -1,26 +0,0 @@
-import { Toast } from 'twenty-ui/components/feedback';
-import styles from './Notification.module.scss';
-
-type NotificationProps = {
- message: string;
- closeLabel: string;
- onClose: () => void;
-};
-
-export const Notification = ({
- message,
- closeLabel,
- onClose,
-}: NotificationProps) => {
- return (
- <Toast
- className={styles.container}
- status="info"
- duration={6000}
- closeLabel={closeLabel}
- onClose={onClose}
- >
- <span className={styles.message}>{message}</span>
- </Toast>
- );
-};
diff --git a/packages/twenty-companion/src/renderer/components/NotificationEffect.tsx b/packages/twenty-companion/src/renderer/components/NotificationEffect.tsx
new file mode 100644
index 00000000000..9f510d61475
--- /dev/null
+++ b/packages/twenty-companion/src/renderer/components/NotificationEffect.tsx
@@ -0,0 +1,55 @@
+import { useEffect, useRef } from 'react';
+import { useToast } from 'twenty-ui/components/feedback';
+import { isDefined } from 'twenty-ui/utilities';
+import { doNotTranslate } from '../../shared/utils/doNotTranslate';
+import { type NotificationProps } from '../types/NotificationProps';
+
+const NOTIFICATION_DURATION_MS = 6000;
+const NOTIFICATION_DEDUPE_KEY = doNotTranslate('companion-recording-finished');
+
+export const NotificationEffect = ({
+ message,
+ closeLabel,
+ onClose,
+}: NotificationProps) => {
+ const { enqueueToast, closeToast, updateToast } = useToast();
+ const onCloseRef = useRef<(() => void) | undefined>(onClose);
+ const toastIdRef = useRef<string | undefined>(undefined);
+
+ useEffect(() => {
+ onCloseRef.current = isDefined(message) ? onClose : undefined;
+ }, [message, onClose]);
+
+ useEffect(() => {
+ if (!isDefined(message)) {
+ return;
+ }
+
+ const id = enqueueToast({
+ dedupeKey: NOTIFICATION_DEDUPE_KEY,
+ status: 'info',
+ duration: NOTIFICATION_DURATION_MS,
+ closeLabel,
+ onClose: () => {
+ toastIdRef.current = undefined;
+ onCloseRef.current?.();
+ },
+ children: message,
+ });
+ toastIdRef.current = id;
+ updateToast({ id, closeLabel, children: message });
+ }, [closeLabel, enqueueToast, message, updateToast]);
+
+ useEffect(() => {
+ if (isDefined(message) || !isDefined(toastIdRef.current)) {
+ return;
+ }
+
+ const id = toastIdRef.current;
+ toastIdRef.current = undefined;
+ updateToast({ id, onClose: undefined });
+ closeToast(id);
+ }, [closeToast, message, updateToast]);
+
+ return null;
+};
diff --git a/packages/twenty-companion/src/renderer/components/Onboarding.tsx b/packages/twenty-companion/src/renderer/components/Onboarding.tsx
index d514364cbea..026550f9ad3 100644
--- a/packages/twenty-companion/src/renderer/components/Onboarding.tsx
+++ b/packages/twenty-companion/src/renderer/components/Onboarding.tsx
@@ -2,7 +2,7 @@ import { i18n } from '@lingui/core';
import { THEME_COMMON } from 'twenty-ui/theme';
import { useState } from 'react';
import { type CompanionState } from '../../shared/types/CompanionState';
-import { Field, Button } from 'twenty-ui/primitives/input';
+import { Field, Button, Input } from 'twenty-ui/primitives/input';
import { MainButton } from 'twenty-ui/components/input';
import { IconArrowUpRight, IconRefresh } from 'twenty-ui/icon';
import { type ActionProps } from '../types/ActionProps';
@@ -28,7 +28,7 @@ const Welcome = ({ state, isPending, command }: ActionProps) => {
}}
>
<Field.Root className="workspace-url-field">
- <Field.Control
+ <Input
id="workspace-url"
aria-label={i18n._('Workspace URL')}
value={serverUrl}
diff --git a/packages/twenty-companion/src/renderer/components/Permissions.tsx b/packages/twenty-companion/src/renderer/components/Permissions.tsx
index 49c90f2af1e..5a168c9834f 100644
--- a/packages/twenty-companion/src/renderer/components/Permissions.tsx
+++ b/packages/twenty-companion/src/renderer/components/Permissions.tsx
@@ -14,70 +14,73 @@ import { type ActionProps } from '../types/ActionProps';
import { SetupHeading } from './SetupHeading';
import { Status } from 'twenty-ui/primitives/data-display';
-const PermissionChecklist = ({ state, isPending, command }: ActionProps) => (
- <Card.Root
- className="permission-list"
- backgroundColor="var(--t-background-secondary)"
- >
- {(
- [
- {
- permission: 'microphone',
- label: i18n._('Record your voice'),
- button: i18n._('Enable microphone'),
- Icon: IconMicrophone,
- },
- {
- permission: 'system-audio',
- label: i18n._('Record call audio'),
- button: i18n._('Enable system audio'),
- Icon: IconHeadphones,
- },
- {
- permission: 'accessibility',
- label: i18n._('Detect calls and speakers'),
- button: i18n._('Enable accessibility'),
- Icon: IconUsers,
- },
- ] as const
- ).map(({ permission, label, button, Icon }) => {
- const status = state.permissions[permission];
- const granted = status === 'granted';
- const denied = status === 'denied';
- return (
- <div className="permission-item" key={permission}>
- <span className="permission-icon">
- <Icon
- size={THEME_COMMON.icon.size.lg}
- stroke={THEME_COMMON.icon.stroke.sm}
- />
- </span>
- <strong className="grow">{label}</strong>
- {granted ? (
- <span role="status">
- <Status color="blue">{i18n._('Enabled')}</Status>
+const PermissionChecklist = ({ state, isPending, command }: ActionProps) => {
+ const permissions = [
+ {
+ permission: 'microphone',
+ label: i18n._('Record your voice'),
+ button: i18n._('Enable microphone'),
+ Icon: IconMicrophone,
+ },
+ {
+ permission: 'system-audio',
+ label: i18n._('Record call audio'),
+ button: i18n._('Enable system audio'),
+ Icon: IconHeadphones,
+ },
+ {
+ permission: 'accessibility',
+ label: i18n._('Detect calls and speakers'),
+ button: i18n._('Enable accessibility'),
+ Icon: IconUsers,
+ },
+ ] as const;
+
+ return (
+ <Card.Root backgroundColor="var(--t-background-secondary)">
+ {permissions.map(({ permission, label, button, Icon }) => {
+ const status = state.permissions[permission];
+ const isGranted = status === 'granted';
+ const isDenied = status === 'denied';
+ return (
+ <Card.Content
+ className="permission-item"
+ key={permission}
+ divider={permission !== permissions.at(-1)?.permission}
+ >
+ <span className="permission-icon">
+ <Icon
+ size={THEME_COMMON.icon.size.lg}
+ stroke={THEME_COMMON.icon.stroke.sm}
+ />
</span>
- ) : (
- <Button
- variant="outline"
- disabled={isPending('permission') || !state.updatedAt}
- onClick={() =>
- void command({
- type: 'permission',
- permission,
- })
- }
- size="md"
- startIcon={denied ? <IconArrowUpRight /> : undefined}
- >
- {denied ? i18n._('Open settings') : button}
- </Button>
- )}
- </div>
- );
- })}
- </Card.Root>
-);
+ <strong className="grow">{label}</strong>
+ {isGranted ? (
+ <span role="status">
+ <Status color="blue">{i18n._('Enabled')}</Status>
+ </span>
+ ) : (
+ <Button
+ variant="outline"
+ disabled={isPending('permission') || !state.updatedAt}
+ onClick={() =>
+ void command({
+ type: 'permission',
+ permission,
+ })
+ }
+ size="md"
+ startIcon={isDenied ? <IconArrowUpRight /> : undefined}
+ >
+ {isDenied ? i18n._('Open settings') : button}
+ </Button>
+ )}
+ </Card.Content>
+ );
+ })}
+ </Card.Root>
+ );
+};
export const Permissions = ({
state,
@@ -86,7 +89,7 @@ export const Permissions = ({
onContinue,
intentToRecord,
}: ActionProps & { onContinue: () => void; intentToRecord: boolean }) => {
- const granted = Object.values(state.permissions).every(
+ const hasAllPermissions = Object.values(state.permissions).every(
(status) => status === 'granted',
);
return (
@@ -104,7 +107,7 @@ export const Permissions = ({
/>
<MainButton
fullWidth
- disabled={isPending('record', 'complete-setup') || !granted}
+ disabled={isPending('record', 'complete-setup') || !hasAllPermissions}
onClick={() =>
intentToRecord
? void command({
diff --git a/packages/twenty-companion/src/renderer/components/RecordingControls.tsx b/packages/twenty-companion/src/renderer/components/RecordingControls.tsx
index ba0584f7980..4e49309a3ba 100644
--- a/packages/twenty-companion/src/renderer/components/RecordingControls.tsx
+++ b/packages/twenty-companion/src/renderer/components/RecordingControls.tsx
@@ -1,4 +1,4 @@
-import { Section } from 'twenty-ui/components/layout';
+import { Heading, Text } from 'twenty-ui/primitives/typography';
import { Avatar } from 'twenty-ui/primitives/data-display';
import { Card } from 'twenty-ui/primitives/surfaces';
import { i18n } from '@lingui/core';
@@ -34,50 +34,49 @@ export const RecordingControls = ({
aria-label={i18n._('Current recording')}
backgroundColor="var(--t-background-secondary)"
>
- <div className="live-heading">
- <Avatar
- name={active.title}
- colorSeed={active.id}
- size="xxl"
- shape="rounded-square"
- />
- <Section.Header
- className="grow live-section-header"
- title={active.title}
- level={2}
- size="lg"
- description={
- <div className="small muted" role="status">
+ <Card.Content>
+ <div className="live-heading">
+ <Avatar
+ name={active.title}
+ colorSeed={active.id}
+ size="xxl"
+ shape="rounded-square"
+ />
+ <div className="grow live-recording-heading">
+ <Heading level={2} size="lg">
+ {active.title}
+ </Heading>
+ <Text className="small muted" role="status">
{label} · <RecordingTimer recording={active} />
- </div>
- }
- />
- </div>
- <div className="live-actions">
- <Button
- disabled={
- isPending('pause', 'resume', 'stop', 'record') || transitional
- }
- onClick={() => void command({ type: paused ? 'resume' : 'pause' })}
- variant="outline"
- size="md"
- startIcon={paused ? <IconPlayerPlay /> : <IconPlayerPause />}
- >
- {paused ? i18n._('Resume') : i18n._('Pause')}
- </Button>
- <Button
- disabled={
- isPending('pause', 'resume', 'stop', 'record') || transitional
- }
- onClick={() => void command({ type: 'stop' })}
- variant="outline"
- color="danger"
- size="md"
- startIcon={<IconPlayerStop />}
- >
- {i18n._('Finish recording')}
- </Button>
- </div>
+ </Text>
+ </div>
+ </div>
+ <div className="live-actions">
+ <Button
+ disabled={
+ isPending('pause', 'resume', 'stop', 'record') || transitional
+ }
+ onClick={() => void command({ type: paused ? 'resume' : 'pause' })}
+ variant="outline"
+ size="md"
+ startIcon={paused ? <IconPlayerPlay /> : <IconPlayerPause />}
+ >
+ {paused ? i18n._('Resume') : i18n._('Pause')}
+ </Button>
+ <Button
+ disabled={
+ isPending('pause', 'resume', 'stop', 'record') || transitional
+ }
+ onClick={() => void command({ type: 'stop' })}
+ variant="outline"
+ color="danger"
+ size="md"
+ startIcon={<IconPlayerStop />}
+ >
+ {i18n._('Finish recording')}
+ </Button>
+ </div>
+ </Card.Content>
</Card.Root>
);
};
diff --git a/packages/twenty-companion/src/renderer/components/RecordingList.tsx b/packages/twenty-companion/src/renderer/components/RecordingList.tsx
index c736e55c846..b36e34ca552 100644
--- a/packages/twenty-companion/src/renderer/components/RecordingList.tsx
+++ b/packages/twenty-companion/src/renderer/components/RecordingList.tsx
@@ -16,13 +16,22 @@ export const RecordingList = ({ state, isPending, command }: ActionProps) => {
backgroundColor="var(--t-background-secondary)"
>
{recordings.map((recording) => (
- <button
+ <Card.Content
className="recording-row"
key={recording.id}
- disabled={isPending('open-recording')}
- title={i18n._('Open in Twenty')}
- onClick={() =>
- void command({ type: 'open-recording', recordingId: recording.id })
+ divider={recording.id !== recordings.at(-1)?.id}
+ render={
+ <button
+ type="button"
+ disabled={isPending('open-recording')}
+ title={i18n._('Open in Twenty')}
+ onClick={() =>
+ void command({
+ type: 'open-recording',
+ recordingId: recording.id,
+ })
+ }
+ />
}
>
<RecordingAvatar recording={recording} />
@@ -50,7 +59,7 @@ export const RecordingList = ({ state, isPending, command }: ActionProps) => {
<Status status={recording.status} />
)}
</div>
- </button>
+ </Card.Content>
))}
</Card.Root>
) : (
diff --git a/packages/twenty-companion/src/renderer/components/Settings.tsx b/packages/twenty-companion/src/renderer/components/Settings.tsx
index b1c7fd81ce4..7387badc255 100644
--- a/packages/twenty-companion/src/renderer/components/Settings.tsx
+++ b/packages/twenty-companion/src/renderer/components/Settings.tsx
@@ -6,6 +6,7 @@ import { Card } from 'twenty-ui/primitives/surfaces';
import { type ReactNode } from 'react';
import { Switch, Button } from 'twenty-ui/primitives/input';
import { Status } from 'twenty-ui/primitives/data-display';
+import { isDefined } from 'twenty-ui/utilities';
import { SegmentedControl } from 'twenty-ui/components/input';
import {
IconCalendarEvent,
@@ -31,6 +32,7 @@ const SettingsToggle = ({
icon,
label,
description,
+ hasDivider = true,
}: ActionProps & {
setting:
| 'autoJoin'
@@ -41,33 +43,36 @@ const SettingsToggle = ({
icon: ReactNode;
label: string;
description: string;
+ hasDivider?: boolean;
}) => (
- <label className="toggle-row">
- <SettingsCardContent icon={icon} title={label} description={description}>
- <Switch
- aria-label={label}
- checked={state.settings[setting]}
- disabled={isPending('settings')}
- onCheckedChange={(value) =>
- void command({
- type: 'settings',
- settings: { [setting]: value },
- })
- }
- />
- </SettingsCardContent>
- </label>
+ <SettingsCardContent
+ icon={icon}
+ title={label}
+ description={description}
+ hasDivider={hasDivider}
+ render={<label className="toggle-row" />}
+ >
+ <Switch
+ aria-label={label}
+ checked={state.settings[setting]}
+ disabled={isPending('settings')}
+ onCheckedChange={(value) =>
+ void command({
+ type: 'settings',
+ settings: { [setting]: value },
+ })
+ }
+ />
+ </SettingsCardContent>
);
export const Settings = ({ state, isPending, command }: ActionProps) => (
<section className="settings-page">
<Section.Header title={i18n._('General')} />
- <Card.Root
- className="settings-group"
- backgroundColor="var(--t-background-secondary)"
- >
+ <Card.Root backgroundColor="var(--t-background-secondary)">
<ShortcutSetting state={state} isPending={isPending} command={command} />
<SettingsCardContent
+ hasDivider
icon={
<IconSettings
size={THEME_COMMON.icon.size.md}
@@ -115,6 +120,7 @@ export const Settings = ({ state, isPending, command }: ActionProps) => (
isPending={isPending}
command={command}
setting="showMeetingCountdown"
+ hasDivider={false}
icon={
<IconClock
size={THEME_COMMON.icon.size.md}
@@ -128,10 +134,7 @@ export const Settings = ({ state, isPending, command }: ActionProps) => (
/>
</Card.Root>
<Section.Header title={i18n._('Meetings')} className="section" />
- <Card.Root
- className="settings-group"
- backgroundColor="var(--t-background-secondary)"
- >
+ <Card.Root backgroundColor="var(--t-background-secondary)">
{(
[
{
@@ -177,6 +180,7 @@ export const Settings = ({ state, isPending, command }: ActionProps) => (
/>
))}
<SettingsCardContent
+ hasDivider
icon={
<IconUsers
size={THEME_COMMON.icon.size.md}
@@ -212,58 +216,57 @@ export const Settings = ({ state, isPending, command }: ActionProps) => (
</Button>
)}
</SettingsCardContent>
- <button
- className="settings-link"
- disabled={
- isPending('begin-permission-setup') || !!state.activeRecording
+ <SettingsCardContent
+ render={
+ <button
+ disabled={
+ isPending('begin-permission-setup') ||
+ isDefined(state.activeRecording)
+ }
+ onClick={() => void command({ type: 'begin-permission-setup' })}
+ />
}
- onClick={() => void command({ type: 'begin-permission-setup' })}
- >
- <SettingsCardContent
- icon={
- <IconMicrophone
- size={THEME_COMMON.icon.size.md}
- stroke={THEME_COMMON.icon.stroke.sm}
- />
- }
- title={i18n._('Recording permissions')}
- description={i18n._(
- 'Manage microphone, system audio, and call detection access.',
- )}
- >
- <IconChevronRight
+ icon={
+ <IconMicrophone
size={THEME_COMMON.icon.size.md}
stroke={THEME_COMMON.icon.stroke.sm}
/>
- </SettingsCardContent>
- </button>
+ }
+ title={i18n._('Recording permissions')}
+ description={i18n._(
+ 'Manage microphone, system audio, and call detection access.',
+ )}
+ >
+ <IconChevronRight
+ size={THEME_COMMON.icon.size.md}
+ stroke={THEME_COMMON.icon.stroke.sm}
+ />
+ </SettingsCardContent>
</Card.Root>
<Section.Header title={i18n._('Workspace')} className="section" />
- <Card.Root
- className="settings-group"
- backgroundColor="var(--t-background-secondary)"
- >
- <button
- className="settings-link"
- disabled={isPending('open-calendar-settings')}
- onClick={() => void command({ type: 'open-calendar-settings' })}
- >
- <SettingsCardContent
- icon={
- <IconCalendarEvent
- size={THEME_COMMON.icon.size.md}
- stroke={THEME_COMMON.icon.stroke.sm}
- />
- }
- title={i18n._('Calendar settings')}
- description={i18n._('Manage your connected calendars in Twenty.')}
- >
- <IconArrowUpRight
+ <Card.Root backgroundColor="var(--t-background-secondary)">
+ <SettingsCardContent
+ hasDivider
+ render={
+ <button
+ disabled={isPending('open-calendar-settings')}
+ onClick={() => void command({ type: 'open-calendar-settings' })}
+ />
+ }
+ icon={
+ <IconCalendarEvent
size={THEME_COMMON.icon.size.md}
stroke={THEME_COMMON.icon.stroke.sm}
/>
- </SettingsCardContent>
- </button>
+ }
+ title={i18n._('Calendar settings')}
+ description={i18n._('Manage your connected calendars in Twenty.')}
+ >
+ <IconArrowUpRight
+ size={THEME_COMMON.icon.size.md}
+ stroke={THEME_COMMON.icon.stroke.sm}
+ />
+ </SettingsCardContent>
<SettingsCardContent
icon={<WorkspaceIcon workspace={state.workspace} />}
title={state.workspace?.name}
diff --git a/packages/twenty-companion/src/renderer/components/SettingsCardContent.module.scss b/packages/twenty-companion/src/renderer/components/SettingsCardContent.module.scss
index 852bd0b97bb..9c48c03d178 100644
--- a/packages/twenty-companion/src/renderer/components/SettingsCardContent.module.scss
+++ b/packages/twenty-companion/src/renderer/components/SettingsCardContent.module.scss
@@ -2,7 +2,6 @@
align-items: center;
display: flex;
gap: var(--t-spacing-3);
- padding: var(--t-spacing-4);
}
.icon {
align-items: center;
diff --git a/packages/twenty-companion/src/renderer/components/SettingsCardContent.tsx b/packages/twenty-companion/src/renderer/components/SettingsCardContent.tsx
index e03baaa44b0..c5c5348f38f 100644
--- a/packages/twenty-companion/src/renderer/components/SettingsCardContent.tsx
+++ b/packages/twenty-companion/src/renderer/components/SettingsCardContent.tsx
@@ -1,4 +1,6 @@
import { type ReactNode } from 'react';
+import { Card, type CardContentProps } from 'twenty-ui/primitives/surfaces';
+import { isDefined } from 'twenty-ui/utilities';
import styles from './SettingsCardContent.module.scss';
type SettingsCardContentProps = {
@@ -6,6 +8,8 @@ type SettingsCardContentProps = {
title: ReactNode;
description?: ReactNode;
children?: ReactNode;
+ hasDivider?: boolean;
+ render?: CardContentProps['render'];
};
export const SettingsCardContent = ({
@@ -13,15 +17,17 @@ export const SettingsCardContent = ({
title,
description,
children,
+ hasDivider,
+ render,
}: SettingsCardContentProps) => (
- <div className={styles.content}>
- {icon != null && <div className={styles.icon}>{icon}</div>}
+ <Card.Content className={styles.content} divider={hasDivider} render={render}>
+ {isDefined(icon) && <div className={styles.icon}>{icon}</div>}
<div className={styles.text}>
<div className={styles.title}>{title}</div>
- {description != null && (
+ {isDefined(description) && (
<div className={styles.description}>{description}</div>
)}
</div>
- {children != null && <div className={styles.actions}>{children}</div>}
- </div>
+ {isDefined(children) && <div className={styles.actions}>{children}</div>}
+ </Card.Content>
);
diff --git a/packages/twenty-companion/src/renderer/components/ShortcutSetting.tsx b/packages/twenty-companion/src/renderer/components/ShortcutSetting.tsx
index 8f529949dab..dfae78e51ab 100644
--- a/packages/twenty-companion/src/renderer/components/ShortcutSetting.tsx
+++ b/packages/twenty-companion/src/renderer/components/ShortcutSetting.tsx
@@ -14,6 +14,7 @@ export const ShortcutSetting = ({ state, isPending, command }: ActionProps) => {
const [capturing, setCapturing] = useState(false);
return (
<SettingsCardContent
+ hasDivider
icon={
<IconCommand
size={THEME_COMMON.icon.size.md}
diff --git a/packages/twenty-companion/src/renderer/style.css b/packages/twenty-companion/src/renderer/style.css
index 529b89d9a49..6b118dfc770 100644
--- a/packages/twenty-companion/src/renderer/style.css
+++ b/packages/twenty-companion/src/renderer/style.css
@@ -39,12 +39,6 @@ input,
select {
-webkit-app-region: no-drag;
}
-.recording-row:focus-visible,
-.settings-link:focus-visible,
-.workspace-url-field input:focus-visible {
- outline: 2px solid var(--t-color-blue);
- outline-offset: 3px;
-}
.setup-card h1 {
font-size: var(--t-font-size-xxl);
line-height: 1.3;
@@ -82,18 +76,6 @@ select {
.shortcut-actions {
gap: var(--t-spacing-1);
}
-.titlebar .button-group > div {
- height: var(--header-control-height);
-}
-.workspace-url-field input {
- width: 100%;
- min-width: 0;
- border: 1px solid var(--t-border-color-medium);
- background: var(--t-background-primary);
- border-radius: var(--t-border-radius-md);
- height: var(--control-height-medium);
- padding: 0 var(--t-spacing-2);
-}
.app-shell {
--content-gutter: var(--t-spacing-4);
height: 100dvh;
@@ -143,21 +125,10 @@ select {
.notice {
flex-shrink: 0;
}
-.notification-container {
- position: fixed;
- right: var(--t-spacing-3);
- bottom: var(--t-spacing-3);
- max-width: calc(100% - 2 * var(--t-spacing-3));
- z-index: 1000;
-}
-.notice-text {
- flex: 1;
- text-align: center;
- margin-left: var(--t-spacing-8);
-}
-.notice .notice-close,
-.notice .notice-recovery {
- color: var(--t-font-color-inverted);
+.notice-actions {
+ align-items: center;
+ display: flex;
+ gap: var(--t-spacing-2);
}
.preview-label {
background: var(--t-background-secondary);
@@ -236,11 +207,6 @@ select {
border: 1px solid var(--t-border-color-medium);
background: var(--t-background-primary);
}
-.setup-container .permission-list,
-.setup-container .permission-item + .permission-item,
-.setup-container input {
- border-color: var(--t-border-color-medium);
-}
.setup-card {
display: grid;
gap: var(--t-spacing-8);
@@ -256,18 +222,11 @@ select {
.setup-heading p {
text-wrap: balance;
}
-.permission-list {
- overflow: hidden;
-}
.permission-item {
display: flex;
align-items: center;
- padding: var(--t-spacing-4);
gap: var(--t-spacing-3);
}
-.permission-item + .permission-item {
- border-top: 1px solid var(--t-border-color-medium);
-}
.permission-icon {
color: var(--t-font-color-secondary);
display: flex;
@@ -283,16 +242,9 @@ select {
.section {
margin-top: var(--t-spacing-9);
}
-.agenda-list {
- overflow: hidden;
-}
.agenda-day {
display: flex;
gap: var(--t-spacing-3);
- padding: 0 var(--t-spacing-4);
-}
-.agenda-day + .agenda-day {
- border-top: 1px solid var(--t-border-color-light);
}
.agenda-date {
display: flex;
@@ -326,15 +278,15 @@ select {
gap: var(--t-spacing-1);
flex-shrink: 0;
}
-.meeting-menu {
- z-index: 1000;
-}
@media (hover: hover) and (pointer: fine) {
.agenda-row:not([data-next]):not(:hover):not(:focus-within) .agenda-actions {
opacity: 0;
pointer-events: none;
}
}
+.meeting-menu-content {
+ padding: var(--t-spacing-2);
+}
.agenda-meeting-details .agenda-event-indicator {
background: var(--t-border-color-strong);
width: 1px;
@@ -360,39 +312,25 @@ select {
}
.recording-list {
display: grid;
- overflow: hidden;
}
.recording-row {
display: flex;
align-items: center;
gap: var(--t-spacing-3);
- padding: var(--t-spacing-3) var(--t-spacing-4);
- margin: 0;
- width: 100%;
- text-align: left;
- background: transparent;
- border: 0;
- border-radius: 0;
- color: var(--t-font-color-primary);
min-height: var(--t-spacing-16);
}
-.recording-row:hover:not(:disabled) {
- background: var(--t-background-tertiary);
-}
.recording-row .grow {
display: grid;
gap: var(--t-spacing-1);
}
.recording-row strong {
+ color: var(--t-font-color-primary);
font-size: var(--t-font-size-md);
font-weight: var(--t-font-weight-medium);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
-.recording-row + .recording-row {
- border-top: 1px solid var(--t-border-color-light);
-}
.recording-metadata {
display: grid;
justify-items: end;
@@ -443,7 +381,6 @@ select {
line-height: 1.4;
}
.live-card {
- padding: var(--t-spacing-4) var(--t-spacing-5);
margin-bottom: var(--t-spacing-6);
}
.live-heading {
@@ -451,8 +388,9 @@ select {
gap: var(--t-spacing-3);
align-items: center;
}
-.live-heading .live-section-header {
- margin-bottom: 0;
+.live-recording-heading {
+ display: grid;
+ gap: var(--t-spacing-2);
}
.live-actions {
display: flex;
@@ -462,29 +400,9 @@ select {
.live-card time {
font-variant-numeric: tabular-nums;
}
-.settings-group {
- overflow: hidden;
-}
.toggle-row {
- display: block;
cursor: pointer;
}
-.settings-group > :not(:last-child) {
- border-bottom: 1px solid var(--t-border-color-medium);
-}
-.settings-link {
- padding: 0;
- width: 100%;
- border: 0;
- background: transparent;
- text-align: left;
-}
-.settings-link:not(:disabled):hover {
- background: var(--t-background-transparent-light);
-}
-.settings-link:focus-visible {
- outline-offset: -3px;
-}
.workspace-avatar {
display: flex;
flex-shrink: 0;
@@ -526,12 +444,6 @@ select {
height: var(--t-spacing-5);
border-left: 1px solid var(--t-border-color-medium);
}
-.titlebar .header-navigation button,
-.titlebar .button-group button {
- box-sizing: border-box;
- height: var(--header-control-height);
- min-height: var(--header-control-height);
-}
.header-navigation {
display: flex;
align-items: center;
@@ -542,18 +454,6 @@ select {
margin-top: var(--t-spacing-2);
}
-.settings-link:disabled,
-.recording-row:disabled {
- color: var(--t-font-color-extra-light);
- cursor: not-allowed;
-}
-.settings-link:disabled > *,
-.settings-link:disabled .muted,
-.recording-row:disabled .muted,
-.settings-link:disabled > svg {
- color: inherit;
-}
-
.recordings-section:has(> .empty) {
display: flex;
flex-direction: column;
@@ -584,7 +484,6 @@ select {
padding: var(--t-spacing-7) var(--content-gutter) var(--t-spacing-10);
}
.permission-item {
- padding: var(--t-spacing-4) var(--t-spacing-3);
gap: var(--t-spacing-2);
}
.header-navigation {
@@ -608,7 +507,3 @@ select {
min-width: 170px;
}
}
-
-.settings-link:disabled {
- opacity: 0.5;
-}
diff --git a/packages/twenty-companion/src/renderer/types/NotificationProps.ts b/packages/twenty-companion/src/renderer/types/NotificationProps.ts
new file mode 100644
index 00000000000..d74052a09ed
--- /dev/null
+++ b/packages/twenty-companion/src/renderer/types/NotificationProps.ts
@@ -0,0 +1,5 @@
+export type NotificationProps = {
+ message?: string;
+ closeLabel: string;
+ onClose: () => void;
+};