Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(ui): single check (#3620)

Fake-Userde44f16a1b01
diff --git a/js/app/packages/app/component/next-soup/soup-view/filters-bar/group-dropdown.tsx b/js/app/packages/app/component/next-soup/soup-view/filters-bar/group-dropdown.tsx
index 68ad00c6ed..79d07a4c84 100644
--- a/js/app/packages/app/component/next-soup/soup-view/filters-bar/group-dropdown.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/filters-bar/group-dropdown.tsx
@@ -3,9 +3,8 @@ import type {
GroupOptionId,
} from '@app/component/next-soup/soup-view/group-options';
import StackSimpleIcon from '@phosphor/stack-simple.svg';
-import { Dropdown, Tooltip } from '@ui';
+import { Dropdown, SingleSelectCheck, Tooltip } from '@ui';
import { type Component, For } from 'solid-js';
-import { TypeIndicator } from './unified-filter-dropdown';
interface GroupDropdownProps {
value: () => GroupOptionId;
@@ -33,16 +32,8 @@ export const GroupDropdown: Component<GroupDropdownProps> = (props) => {
<For each={props.options}>
{(option) => (
<Dropdown.Item onSelect={() => props.onChange(option.value)}>
- <TypeIndicator active={props.value() === option.value} />
- <span
- class="flex-1 truncate"
- classList={{
- 'text-ink font-medium': props.value() === option.value,
- 'text-ink-muted': props.value() !== option.value,
- }}
- >
- {option.label}
- </span>
+ <span class="flex-1 truncate">{option.label}</span>
+ <SingleSelectCheck active={props.value() === option.value} />
</Dropdown.Item>
)}
</For>
diff --git a/js/app/packages/app/component/next-soup/soup-view/filters-bar/mobile-filter-drawer.tsx b/js/app/packages/app/component/next-soup/soup-view/filters-bar/mobile-filter-drawer.tsx
index d2e9efd3fc..6057003f4c 100644
--- a/js/app/packages/app/component/next-soup/soup-view/filters-bar/mobile-filter-drawer.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/filters-bar/mobile-filter-drawer.tsx
@@ -255,16 +255,7 @@ export const MobileFilterDrawer = () => {
</span>
)}
</Show>
- <span
- class={cn(
- 'flex-1 truncate',
- active()
- ? 'text-ink font-medium'
- : 'text-ink-muted'
- )}
- >
- {option.label}
- </span>
+ <span class="flex-1 truncate">{option.label}</span>
<Show when={active()}>
<CheckIcon class="size-3.5 text-accent shrink-0" />
</Show>
diff --git a/js/app/packages/app/component/next-soup/soup-view/filters-bar/sort-dropdown.tsx b/js/app/packages/app/component/next-soup/soup-view/filters-bar/sort-dropdown.tsx
index 4453989d1f..dbc9d03c8c 100644
--- a/js/app/packages/app/component/next-soup/soup-view/filters-bar/sort-dropdown.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/filters-bar/sort-dropdown.tsx
@@ -4,9 +4,8 @@ import type {
} from '@app/component/next-soup/soup-view/sort-options';
import { TOKENS } from '@core/hotkey/tokens';
import SortIcon from '@phosphor-icons/core/regular/funnel-simple.svg?component-solid';
-import { Dropdown, Tooltip } from '@ui';
+import { Dropdown, SingleSelectCheck, Tooltip } from '@ui';
import { type Component, For, Show } from 'solid-js';
-import { TypeIndicator } from './unified-filter-dropdown';
interface SortDropdownProps {
/** Current sort value */
@@ -41,7 +40,6 @@ export const SortDropdown: Component<SortDropdownProps> = (props) => {
<For each={options()}>
{(option) => (
<Dropdown.Item onSelect={() => props.onChange(option.value)}>
- <TypeIndicator active={props.value() === option.value} />
<Show when={option.icon}>
{(icon) => (
<span class="size-3.5 flex items-center justify-center shrink-0 text-ink-muted">
@@ -49,15 +47,8 @@ export const SortDropdown: Component<SortDropdownProps> = (props) => {
</span>
)}
</Show>
- <span
- class="flex-1 truncate"
- classList={{
- 'text-ink font-medium': props.value() === option.value,
- 'text-ink-muted': props.value() !== option.value,
- }}
- >
- {option.label}
- </span>
+ <span class="flex-1 truncate">{option.label}</span>
+ <SingleSelectCheck active={props.value() === option.value} />
</Dropdown.Item>
)}
</For>
diff --git a/js/app/packages/app/component/next-soup/soup-view/filters-bar/unified-filter-dropdown.tsx b/js/app/packages/app/component/next-soup/soup-view/filters-bar/unified-filter-dropdown.tsx
index 9d827d7332..92a3ee9d1e 100644
--- a/js/app/packages/app/component/next-soup/soup-view/filters-bar/unified-filter-dropdown.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/filters-bar/unified-filter-dropdown.tsx
@@ -26,7 +26,7 @@ import SlidersHorizontalIcon from '@phosphor-icons/core/regular/sliders-horizont
import { PropertyValueIcon } from '@property/component/propertyValue/PropertyValueIcon';
import { PROPERTY_OPTION_IDS, SYSTEM_PROPERTY_IDS } from '@property/constants';
import { useContacts } from '@queries/contacts/contacts';
-import { cn, Dropdown, Tooltip } from '@ui';
+import { cn, Dropdown, SingleSelectCheck, Tooltip } from '@ui';
import {
type Accessor,
batch,
@@ -478,15 +478,8 @@ function SingleValueSubmenu<T>(props: {
onSelect={() => props.onSelect(option.value)}
closeOnSelect
>
- <TypeIndicator active={active()} />
- <span
- class={cn(
- 'flex-1 truncate',
- active() ? 'text-ink' : 'text-ink-muted'
- )}
- >
- {option.label}
- </span>
+ <span class="flex-1 truncate">{option.label}</span>
+ <SingleSelectCheck active={active()} />
</Dropdown.Item>
);
}}
@@ -602,7 +595,6 @@ const SearchIndexRowLabel = (props: {
active: Accessor<boolean>;
}) => (
<>
- <TypeIndicator active={props.active()} />
<Show when={props.option.icon}>
{(icon) => (
<span class="size-4 flex items-center justify-center shrink-0">
@@ -610,14 +602,8 @@ const SearchIndexRowLabel = (props: {
</span>
)}
</Show>
- <span
- class={cn(
- 'flex-1 truncate',
- props.active() ? 'text-ink' : 'text-ink-muted'
- )}
- >
- {props.option.label}
- </span>
+ <span class="flex-1 truncate">{props.option.label}</span>
+ <SingleSelectCheck active={props.active()} />
</>
);
@@ -1003,15 +989,8 @@ export const UnifiedFilterDropdown = (
onSelect={() => handleIndexChange('all')}
closeOnSelect
>
- <TypeIndicator active={!hasActiveIndex()} />
- <span
- class={cn(
- 'flex-1 truncate',
- !hasActiveIndex() ? 'text-ink' : 'text-ink-muted'
- )}
- >
- All
- </span>
+ <span class="flex-1 truncate">All</span>
+ <SingleSelectCheck active={!hasActiveIndex()} />
</Dropdown.Item>
</Show>
</>
diff --git a/js/app/packages/channel/Call/CallControls/CallControlsDefaultAndPanelRow.tsx b/js/app/packages/channel/Call/CallControls/CallControlsDefaultAndPanelRow.tsx
index 921addc44a..92b94a58af 100644
--- a/js/app/packages/channel/Call/CallControls/CallControlsDefaultAndPanelRow.tsx
+++ b/js/app/packages/channel/Call/CallControls/CallControlsDefaultAndPanelRow.tsx
@@ -6,14 +6,11 @@ import MicrophoneSlash from '@phosphor/microphone-slash.svg';
import Screencast from '@phosphor/screencast.svg';
import VideoCamera from '@phosphor/video-camera.svg';
import VideoCameraSlash from '@phosphor/video-camera-slash.svg';
-import { Button, Dropdown } from '@ui';
+import { Button, Dropdown, SingleSelectCheck } from '@ui';
import { For, type JSX, Show } from 'solid-js';
-import { match } from 'ts-pattern';
import { BACKGROUND_IMAGES, useCallContext } from '../CallContext';
import { CallDeviceList } from '../CallDeviceList';
-import { MenuDivider, MenuLabel } from './CallMenuPrimitives';
-
export type CallControlsDefaultAndPanelRowProps = {
onLeave: () => void | Promise<void>;
};
@@ -84,26 +81,55 @@ function BackgroundEffectSelector() {
};
return (
- <Dropdown.RadioGroup value={currentEffectValue()} onChange={handleChange}>
- <MenuLabel>Background</MenuLabel>
- <Dropdown.RadioItem value="none">None</Dropdown.RadioItem>
- <MenuDivider />
- <MenuLabel>Blur</MenuLabel>
- <Dropdown.RadioItem value="blur-light">Light</Dropdown.RadioItem>
- <Dropdown.RadioItem value="blur-medium">Medium</Dropdown.RadioItem>
- <Dropdown.RadioItem value="blur-heavy">Heavy</Dropdown.RadioItem>
- <Show when={BACKGROUND_IMAGES.length}>
- <MenuDivider />
- <MenuLabel>Image</MenuLabel>
- <For each={BACKGROUND_IMAGES}>
- {(bg) => (
- <Dropdown.RadioItem value={`image-${bg.id}`}>
- {bg.label}
- </Dropdown.RadioItem>
- )}
+ <>
+ <Dropdown.Group>
+ <Dropdown.GroupLabel>Background</Dropdown.GroupLabel>
+ <Dropdown.Item
+ closeOnSelect={false}
+ onSelect={() => handleChange('none')}
+ >
+ <span class="flex-1 truncate">None</span>
+ <SingleSelectCheck active={currentEffectValue() === 'none'} />
+ </Dropdown.Item>
+ </Dropdown.Group>
+ <Dropdown.Group>
+ <Dropdown.GroupLabel>Blur</Dropdown.GroupLabel>
+ <For each={['light', 'medium', 'heavy'] as const}>
+ {(intensity) => {
+ const value = `blur-${intensity}`;
+ const label = intensity[0]!.toUpperCase() + intensity.slice(1);
+ return (
+ <Dropdown.Item
+ closeOnSelect={false}
+ onSelect={() => handleChange(value)}
+ >
+ <span class="flex-1 truncate">{label}</span>
+ <SingleSelectCheck active={currentEffectValue() === value} />
+ </Dropdown.Item>
+ );
+ }}
</For>
+ </Dropdown.Group>
+ <Show when={BACKGROUND_IMAGES.length}>
+ <Dropdown.Group>
+ <Dropdown.GroupLabel>Image</Dropdown.GroupLabel>
+ <For each={BACKGROUND_IMAGES}>
+ {(bg) => {
+ const value = `image-${bg.id}`;
+ return (
+ <Dropdown.Item
+ closeOnSelect={false}
+ onSelect={() => handleChange(value)}
+ >
+ <span class="flex-1 truncate">{bg.label}</span>
+ <SingleSelectCheck active={currentEffectValue() === value} />
+ </Dropdown.Item>
+ );
+ }}
+ </For>
+ </Dropdown.Group>
</Show>
- </Dropdown.RadioGroup>
+ </>
);
}
@@ -122,12 +148,6 @@ export function CallControlsDefaultAndPanelRow(
) {
const callCtx = useCallContext();
const isConnecting = () => callCtx.isConnecting();
- const noiseSuppressionModeLabel = () =>
- match(callCtx.noiseSuppressionMode())
- .with('krisp', () => 'Krisp')
- .with('browser', () => 'Browser')
- .with('off', () => 'Off')
- .exhaustive();
return (
<div class="inline-flex items-center overflow-hidden rounded-lg border border-ink-muted/[0.08] bg-ink-muted/[0.025] divide-x divide-ink-muted/[0.08]">
@@ -195,38 +215,40 @@ export function CallControlsDefaultAndPanelRow(
activeDeviceId={callCtx.activeAudioInputDeviceId()}
onSelect={(id) => callCtx.switchAudioInput(id)}
/>
- <Show when={callCtx.audioOutputDevices().length > 0}>
- <MenuDivider />
+ </Dropdown.Group>
+ <Show when={callCtx.audioOutputDevices().length > 0}>
+ <Dropdown.Group>
<CallDeviceList
label="Speaker"
devices={callCtx.audioOutputDevices()}
activeDeviceId={callCtx.activeAudioOutputDeviceId()}
onSelect={(id) => callCtx.switchAudioOutput(id)}
/>
- </Show>
- <MenuDivider />
+ </Dropdown.Group>
+ </Show>
+ <Dropdown.Group>
<CallDeviceList
label="Camera"
devices={callCtx.videoInputDevices()}
activeDeviceId={callCtx.activeVideoInputDeviceId()}
onSelect={(id) => callCtx.switchVideoInput(id)}
/>
- <MenuDivider />
- <MenuLabel>Audio processing</MenuLabel>
+ </Dropdown.Group>
+ <Dropdown.Group>
+ <Dropdown.GroupLabel>Audio processing</Dropdown.GroupLabel>
<Dropdown.Item
closeOnSelect={false}
onSelect={() => void callCtx.toggleNoiseSuppression()}
>
<span class="flex-1 truncate">Noise suppression</span>
- <span class="text-xs text-ink-muted">
- {noiseSuppressionModeLabel()}
- </span>
+ <SingleSelectCheck
+ active={callCtx.noiseSuppressionMode() !== 'off'}
+ />
</Dropdown.Item>
- <Show when={isBackgroundBlurSupported()}>
- <MenuDivider />
- <BackgroundEffectSelector />
- </Show>
</Dropdown.Group>
+ <Show when={isBackgroundBlurSupported()}>
+ <BackgroundEffectSelector />
+ </Show>
</Dropdown.Content>
</Dropdown>
</Cell>
diff --git a/js/app/packages/channel/Call/CallDeviceList.tsx b/js/app/packages/channel/Call/CallDeviceList.tsx
index 44c731a1fa..9f8bde1a2e 100644
--- a/js/app/packages/channel/Call/CallDeviceList.tsx
+++ b/js/app/packages/channel/Call/CallDeviceList.tsx
@@ -1,6 +1,5 @@
-import CheckIcon from '@phosphor/check.svg';
-import { Dropdown } from '@ui';
-import { For, Show } from 'solid-js';
+import { Dropdown, SingleSelectCheck } from '@ui';
+import { For } from 'solid-js';
import type { MediaDeviceInfo } from './CallContext';
/**
@@ -24,13 +23,11 @@ export function CallDeviceList(props: {
>
<For each={props.devices}>
{(device) => (
- <Dropdown.RadioItem value={device.deviceId}>
+ <Dropdown.RadioItem closeOnSelect={false} value={device.deviceId}>
<span class="min-w-0 flex-1 truncate">{device.label}</span>
- <span class="size-3.5 flex items-center justify-center shrink-0">
- <Show when={props.activeDeviceId === device.deviceId}>
- <CheckIcon class="size-3 text-accent" />
- </Show>
- </span>
+ <SingleSelectCheck
+ active={props.activeDeviceId === device.deviceId}
+ />
</Dropdown.RadioItem>
)}
</For>
diff --git a/js/app/packages/channel/Call/CallOverlay.tsx b/js/app/packages/channel/Call/CallOverlay.tsx
index 414c117392..28fd58245c 100644
--- a/js/app/packages/channel/Call/CallOverlay.tsx
+++ b/js/app/packages/channel/Call/CallOverlay.tsx
@@ -43,12 +43,10 @@ function ParticipantTileWrapper(props: {
<div
class={cn(
'relative flex items-center justify-center rounded-lg overflow-hidden bg-message min-h-30 border border-edge-muted',
+ props.isSpeaking && 'ring-inset ring-2 ring-accent-2',
+ props.isConnecting && 'animate-pulse',
props.class
)}
- classList={{
- 'ring-inset ring-2 ring-accent-2': props.isSpeaking,
- 'animate-pulse': props.isConnecting,
- }}
>
{props.children}
</div>
diff --git a/js/app/packages/ui/components/Checkbox.tsx b/js/app/packages/ui/components/Checkbox.tsx
index 006573d834..e9b89aa0ab 100644
--- a/js/app/packages/ui/components/Checkbox.tsx
+++ b/js/app/packages/ui/components/Checkbox.tsx
@@ -1,8 +1,9 @@
import { Checkbox as KobalteCheckbox } from '@kobalte/core/checkbox';
+import type { ComponentProps } from 'solid-js';
import CheckIcon from '@phosphor/check.svg';
import MinusIcon from '@phosphor/minus.svg';
-import { splitProps, type ComponentProps } from 'solid-js';
import { cn } from '../utils/classname';
+import { splitProps } from 'solid-js';
/*
<Checkbox checked={...} onChange={...}>
@@ -79,3 +80,12 @@ export const Checkbox = Object.assign(
Control: CheckboxControl,
},
);
+
+export const SingleSelectCheck = (props: { active: boolean }) => (
+ <CheckIcon
+ class={cn(
+ 'size-3 text-accent shrink-0',
+ !props.active && 'hidden'
+ )}
+ />
+);
diff --git a/js/app/packages/ui/index.ts b/js/app/packages/ui/index.ts
index 3ee7c33019..9bc461dc65 100644
--- a/js/app/packages/ui/index.ts
+++ b/js/app/packages/ui/index.ts
@@ -1,10 +1,10 @@
/* components */
+export { Checkbox, SingleSelectCheck } from './components/Checkbox';
export { SegmentedControl } from './components/SegmentedControl';
export { TabbedControl } from './components/TabbedControl';
export { Avatar, AvatarGroup } from './components/Avatar';
export { LogoProgress } from './components/LogoProgress';
export { ToggleSwitch } from './components/ToggleSwitch';
-export { Checkbox } from './components/Checkbox';
export { ButtonGroup } from './components/ButtonGroup';
export { SendButton } from './components/SendButton';
export { HoverCard } from './components/HoverCard';