Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix(tasks): improve assignee property editing UX (#2536)
gbirmanaec94576d002
diff --git a/js/app/packages/core/component/Properties/component/modal/EditPropertyValueModal.tsx b/js/app/packages/core/component/Properties/component/modal/EditPropertyValueModal.tsxindex 050b81413b..515ba77067 100644--- a/js/app/packages/core/component/Properties/component/modal/EditPropertyValueModal.tsx+++ b/js/app/packages/core/component/Properties/component/modal/EditPropertyValueModal.tsx@@ -58,13 +58,15 @@ export function EditPropertyValueModal(props: PropertyEditorProps) {false);- const [selectedEntityRefs, setSelectedEntityRefs] = createSignal<- EntityReference[]- >(+ const initialEntityRefs =props.property.valueType === 'ENTITY' && props.property.value != null? props.property.value- : []- );+ : [];++ const originalEntityOptions = entityReferencesToIdSet(initialEntityRefs);++ const [selectedEntityRefs, setSelectedEntityRefs] =+ createSignal<EntityReference[]>(initialEntityRefs);const [selectedDate, setSelectedDate] = createSignal<Date | null>(props.property.valueType === 'DATE' && props.property.value != null@@ -258,6 +260,7 @@ export function EditPropertyValueModal(props: PropertyEditorProps) {const refs = selectedEntityRefs();return entityReferencesToIdSet(refs);}}+ originalOptions={() => originalEntityOptions}setSelectedOptions={(newOptions, entityInfo) => {const currentRefs = selectedEntityRefs();const updatedRefs = updateEntityReferences(@@ -307,6 +310,22 @@ export function EditPropertyValueModal(props: PropertyEditorProps) {/></Show></div>+ <Show when={props.property.isMultiSelect}>+ <div class="border-t border-edge-muted px-2 py-1.5 flex justify-end gap-1">+ <button+ class="text-xs text-ink-muted hover:text-ink px-2 py-1"+ onClick={() => props.onClose()}+ >+ Cancel+ </button>+ <button+ class="text-xs text-ink-muted hover:text-ink px-2 py-1"+ onClick={handleClose}+ >+ Done+ </button>+ </div>+ </Show></div></Show></div>diff --git a/js/app/packages/core/component/Properties/component/modal/shared/PropertyEntitySelector.tsx b/js/app/packages/core/component/Properties/component/modal/shared/PropertyEntitySelector.tsxindex 1eeb23d514..89e7e45100 100644--- a/js/app/packages/core/component/Properties/component/modal/shared/PropertyEntitySelector.tsx+++ b/js/app/packages/core/component/Properties/component/modal/shared/PropertyEntitySelector.tsx@@ -41,6 +41,7 @@ import type { EntityType } from '@service-properties/generated/schemas/entityTyptype EntityInputProps = {config: EntitySelectorConfig;selectedOptions: () => Set<string>;+ originalOptions?: () => Set<string>;setSelectedOptions: (options: Set<string>,entityInfo?: { id: string; entity_type: string }[]@@ -375,11 +376,11 @@ export function PropertyEntitySelector(props: EntityInputProps) {setSelectedIndex(0);});- // Scroll VList to selected index (offset by pinned count)+ // Scroll VList to selected index only during keyboard navigationcreateEffect(() => {const index = selectedIndex();const pCount = pinnedCount();- if (index >= pCount && virtualizerHandle) {+ if (keyboardMode() && index >= pCount && virtualizerHandle) {virtualizerHandle.scrollToIndex(index - pCount, { align: 'nearest' });}});@@ -494,6 +495,10 @@ export function PropertyEntitySelector(props: EntityInputProps) {{(entity, index) => {const adjustedIndex = () => index() + pinnedCount();const isSelected = () => props.selectedOptions().has(entity.id);+ const wasOriginal = () =>+ props.originalOptions?.().has(entity.id) ?? false;+ const isAdded = () => isSelected() && !wasOriginal();+ const isRemoved = () => !isSelected() && wasOriginal();const isKeyboardSelected = () =>adjustedIndex() === selectedIndex();@@ -503,7 +508,10 @@ export function PropertyEntitySelector(props: EntityInputProps) {class="flex items-center justify-between gap-2 py-1.5 px-2 min-w-0 h-8"classList={{'bg-hover': isKeyboardSelected(),- 'bg-accent/10': isSelected(),+ 'bg-success-bg': isAdded(),+ 'bg-failure-bg': isRemoved(),+ 'bg-accent/10':+ isSelected() && !isAdded() && !isRemoved(),}}onClick={() => toggleEntity(entity)}onKeyDown={(e) => e.key === 'Enter' && toggleEntity(entity)}diff --git a/js/app/packages/core/component/Properties/component/propertyValue/EntityIcon.tsx b/js/app/packages/core/component/Properties/component/propertyValue/EntityIcon.tsxindex 521662e892..08e1851331 100644--- a/js/app/packages/core/component/Properties/component/propertyValue/EntityIcon.tsx+++ b/js/app/packages/core/component/Properties/component/propertyValue/EntityIcon.tsx@@ -3,10 +3,7 @@ import type { EntityType } from '@service-properties/generated/schemas/entityTypimport { type Component, createSignal, type ParentProps, Show } from 'solid-js';import { usePropertyEntityDisplay } from '../../hooks';import type { Property } from '../../types';-import {- PropertyValueDeleteButton,- PropertyValueEditButton,-} from './ValueComponents';+import DeleteIcon from '@icon/bold/x-bold.svg';type EntityValueDisplayProps = ParentProps<{property: Property;@@ -52,6 +49,12 @@ export const EntityIcon: Component<EntityValueDisplayProps> = (props) => {</Show>);+ const handleClick = (e: MouseEvent) => {+ if (!props.canEdit || !props.onEdit) return;+ e.stopPropagation();+ props.onEdit(containerRef);+ };+return (<divref={containerRef}@@ -59,28 +62,30 @@ export const EntityIcon: Component<EntityValueDisplayProps> = (props) => {onMouseEnter={() => setIsHovered(true)}onMouseLeave={() => setIsHovered(false)}>- <div class="px-2 py-0.5 border border-edge-muted hover:bg-hover bg-transparent text-ink inline-flex items-center w-full">+ <div+ class="px-2 py-0.5 border border-edge-muted hover:bg-hover bg-transparent text-ink inline-flex items-center w-full"+ onClick={handleClick}+ role={props.canEdit && props.onEdit ? 'button' : undefined}+ tabIndex={props.canEdit && props.onEdit ? 0 : undefined}+ ><span class="truncate flex-1">{innerContent}</span><Showwhen={- props.canEdit &&- isHovered() &&- !props.isSaving &&- (props.onRemove || props.onEdit)+ props.canEdit && isHovered() && !props.isSaving && props.onRemove}>- <div class="absolute right-1 inset-y-0 flex items-center gap-1">- <Show when={props.onEdit}>- <PropertyValueEditButton- onClick={() => props.onEdit!(containerRef)}- disabled={props.isSaving}- />- </Show>+ <div+ class="absolute right-0 inset-y-0 flex items-center pr-1 pl-2 bg-gradient-to-r from-transparent to-hover to-40%"+ onClick={(e: MouseEvent) => e.stopPropagation()}+ ><Show when={props.onRemove}>- <PropertyValueDeleteButton- onClick={props.onRemove!}+ <button+ onClick={() => props.onRemove!()}disabled={props.isSaving}- />+ class="size-4 p-0.5 flex items-center justify-center text-ink-muted hover:text-failure-ink"+ >+ <DeleteIcon class="size-3" />+ </button></Show></div></Show>diff --git a/js/app/packages/core/component/Properties/component/propertyValue/EntityValue.tsx b/js/app/packages/core/component/Properties/component/propertyValue/EntityValue.tsxindex 229ac18014..fd0b8c6407 100644--- a/js/app/packages/core/component/Properties/component/propertyValue/EntityValue.tsx+++ b/js/app/packages/core/component/Properties/component/propertyValue/EntityValue.tsx@@ -68,9 +68,7 @@ export const EntityValue: Component<PropertyValueProps> = (props) => {specificMessageId={entityRef.specific_message_id}canEdit={!isReadOnly()}onRemove={() => handleRemoveEntity(entityRef)}- onEdit={- !props.property.isMultiSelect ? handleEditEntity : undefined- }+ onEdit={handleEditEntity}isSaving={isSaving()}/>)}