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.

feat(properties): edit task properties from list, task code cleanup (#992)

Seamusd5fb406d28b4
diff --git a/js/app/packages/app/component/PropertyDisplayControl.tsx b/js/app/packages/app/component/PropertyDisplayControl.tsx
index cc7acb9aff..92c72bc183 100644
--- a/js/app/packages/app/component/PropertyDisplayControl.tsx
+++ b/js/app/packages/app/component/PropertyDisplayControl.tsx
@@ -1,5 +1,8 @@
-import type { PropertyDefinitionFlat } from '@core/component/Properties/types';
-import { PropertyDataTypeIcon } from '@core/component/Properties/utils';
+import type { PropertyDefinitionDomain } from '@core/component/Properties/types';
+import {
+ PropertyDataTypeIcon,
+ toPropertyDefinitionDomain,
+} from '@core/component/Properties/utils';
import { ERROR_MESSAGES } from '@core/component/Properties/utils/errorHandling';
import { toast } from '@core/component/Toast/Toast';
import { isErr } from '@core/util/maybeResult';
@@ -25,22 +28,22 @@ type PropertyDisplayControlProps = {
setSelectedPropertyIds: (
properties: DisplayOptions['displayProperties']
) => void;
- suggestedProperties?: PropertyDefinitionFlat[];
+ suggestedProperties?: PropertyDefinitionDomain[];
};
type PropertyPillProps = {
- property: PropertyDefinitionFlat;
+ property: PropertyDefinitionDomain;
onRemove: () => void;
};
type SuggestedPillProps = {
- property: PropertyDefinitionFlat;
+ property: PropertyDefinitionDomain;
onClick: () => void;
};
type PropertyDropdownProps = {
- filteredProperties: Accessor<PropertyDefinitionFlat[]>;
- onSelectProperty: (property: PropertyDefinitionFlat) => void;
+ filteredProperties: Accessor<PropertyDefinitionDomain[]>;
+ onSelectProperty: (property: PropertyDefinitionDomain) => void;
dropdownRef: (el: HTMLDivElement) => void;
isOpen: Accessor<boolean>;
};
@@ -79,7 +82,7 @@ const PropertyDropdown: Component<PropertyDropdownProps> = (props) => {
text-left"
>
<PropertyDataTypeIcon property={property} />
- <span class="truncate flex-1">{property.display_name}</span>
+ <span class="truncate flex-1">{property.displayName}</span>
</button>
)}
</For>
@@ -106,7 +109,7 @@ const SuggestedPill: Component<SuggestedPillProps> = (props) => {
>
<PropertyDataTypeIcon property={props.property} />
<span class="truncate flex-1 font-mono">
- {props.property.display_name}
+ {props.property.displayName}
</span>
</button>
);
@@ -128,7 +131,7 @@ const PropertyPill: Component<PropertyPillProps> = (props) => {
property={props.property}
class="size-4 text-ink-muted shrink-0"
/>
- <span class="truncate font-mono">{props.property.display_name}</span>
+ <span class="truncate font-mono">{props.property.displayName}</span>
</div>
<button
type="button"
@@ -148,7 +151,7 @@ export const PropertyDisplayControl: Component<PropertyDisplayControlProps> = (
props
) => {
const [availableProperties, setAvailableProperties] = createSignal<
- PropertyDefinitionFlat[]
+ PropertyDefinitionDomain[]
>([]);
const [_isLoading, setIsLoading] = createSignal(false);
const [_error, setError] = createSignal<string | null>(null);
@@ -178,9 +181,10 @@ export const PropertyDisplayControl: Component<PropertyDisplayControlProps> = (
const [, data] = result;
const properties = Array.isArray(data) ? data : [];
- const normalizedProperties = properties.map((item) =>
- 'definition' in item ? item.definition : item
- );
+ const normalizedProperties = properties.map((item) => {
+ const definition = 'definition' in item ? item.definition : item;
+ return toPropertyDefinitionDomain(definition);
+ });
setAvailableProperties(normalizedProperties);
setIsLoading(false);
@@ -204,7 +208,7 @@ export const PropertyDisplayControl: Component<PropertyDisplayControlProps> = (
return allSuggested.filter((property) => !selectedIds.has(property.id));
});
- const handleSuggestedSelect = (property: PropertyDefinitionFlat) => {
+ const handleSuggestedSelect = (property: PropertyDefinitionDomain) => {
const currentIds = props.selectedPropertyIds();
if (!currentIds.includes(property.id)) {
const currentIds = props.selectedPropertyIds();
@@ -223,7 +227,7 @@ export const PropertyDisplayControl: Component<PropertyDisplayControlProps> = (
props.setSelectedPropertyIds(currentIds.filter((id) => id !== propertyId));
};
- const handleSelectProperty = (property: PropertyDefinitionFlat) => {
+ const handleSelectProperty = (property: PropertyDefinitionDomain) => {
const currentIds = props.selectedPropertyIds();
// Enforce max 4 properties
if (currentIds.length >= MAX_DISPLAY_PROPERTIES) {
@@ -250,14 +254,14 @@ export const PropertyDisplayControl: Component<PropertyDisplayControlProps> = (
if (!query) return available;
return available.filter((property) => {
- const name = property.display_name.toLowerCase();
+ const name = property.displayName.toLowerCase();
if (name.includes(query)) return true;
- const dataType = property.data_type;
+ const dataType = property.valueType;
let typeDisplay = dataType;
- if (dataType === 'ENTITY' && property.specific_entity_type) {
- typeDisplay += ` ${property.specific_entity_type}`;
+ if (dataType === 'ENTITY' && property.specificEntityType) {
+ typeDisplay += ` ${property.specificEntityType}`;
}
return typeDisplay.toLowerCase().includes(query);
diff --git a/js/app/packages/app/component/PropertyFilter/FilterAction.tsx b/js/app/packages/app/component/PropertyFilter/FilterAction.tsx
index 50eb7300c6..f1526cf938 100644
--- a/js/app/packages/app/component/PropertyFilter/FilterAction.tsx
+++ b/js/app/packages/app/component/PropertyFilter/FilterAction.tsx
@@ -1,4 +1,4 @@
-import type { PropertyDefinition } from '@service-properties/generated/schemas/propertyDefinition';
+import type { PropertyDefinitionDomain } from '@core/component/Properties/types';
import type { Component } from 'solid-js';
import {
createMemo,
@@ -16,7 +16,7 @@ import {
} from '../PropertyFilterTypes';
export type FilterActionSelectProps = {
- property: PropertyDefinition;
+ property: PropertyDefinitionDomain;
selectedAction: FilterAction | null;
onSelectAction: (action: FilterAction) => void;
};
@@ -31,8 +31,8 @@ export const FilterActionSelect: Component<FilterActionSelectProps> = (
const validActions = createMemo(() => {
return getValidFilterActions(
- props.property.data_type,
- props.property.is_multi_select ?? false
+ props.property.valueType,
+ props.property.isMultiSelect ?? false
);
});
diff --git a/js/app/packages/app/component/PropertyFilter/FilterProperty.tsx b/js/app/packages/app/component/PropertyFilter/FilterProperty.tsx
index eb3e00b05a..ac830c420a 100644
--- a/js/app/packages/app/component/PropertyFilter/FilterProperty.tsx
+++ b/js/app/packages/app/component/PropertyFilter/FilterProperty.tsx
@@ -1,8 +1,11 @@
-import { isPropertyDefinition } from '@core/component/Properties/utils';
-import { PropertyDataTypeIcon } from '@core/component/Properties/utils/PropertyDataTypeIcon';
+import type { PropertyDefinitionDomain } from '@core/component/Properties/types';
+import {
+ isPropertyDefinition,
+ PropertyDataTypeIcon,
+ toPropertyDefinitionDomain,
+} from '@core/component/Properties/utils';
import MagnifyingGlassIcon from '@phosphor-icons/core/assets/regular/magnifying-glass.svg';
import { useListPropertiesQuery } from '@queries/properties/definitions';
-import type { PropertyDefinition } from '@service-properties/generated/schemas/propertyDefinition';
import type { Component } from 'solid-js';
import {
createMemo,
@@ -15,7 +18,7 @@ import {
import { isFilterableDataType } from '../PropertyFilterTypes';
export type FilterPropertySelectProps = {
- onSelectProperty: (property: PropertyDefinition) => void;
+ onSelectProperty: (property: PropertyDefinitionDomain) => void;
onCancel?: () => void;
};
@@ -34,18 +37,20 @@ export const FilterPropertySelect: Component<FilterPropertySelectProps> = (
includeOptions: false,
}));
- const availableProperties = createMemo((): PropertyDefinition[] => {
+ const availableProperties = createMemo((): PropertyDefinitionDomain[] => {
const data = propertiesQuery.data;
if (!data) return [];
- return (Array.isArray(data) ? data : []).filter(isPropertyDefinition);
+ return (Array.isArray(data) ? data : [])
+ .filter(isPropertyDefinition)
+ .map((def) => toPropertyDefinitionDomain(def));
});
// Filter to only filterable properties (exclude COMPANY entity type)
const filterableProperties = createMemo(() => {
return availableProperties().filter(
(property) =>
- isFilterableDataType(property.data_type) &&
- property.specific_entity_type !== 'COMPANY'
+ isFilterableDataType(property.valueType) &&
+ property.specificEntityType !== 'COMPANY'
);
});
@@ -56,12 +61,12 @@ export const FilterPropertySelect: Component<FilterPropertySelectProps> = (
if (!query) return properties;
return properties.filter((property) => {
- const name = property.display_name.toLowerCase();
+ const name = property.displayName.toLowerCase();
return name.includes(query);
});
});
- const handleSelectProperty = (property: PropertyDefinition) => {
+ const handleSelectProperty = (property: PropertyDefinitionDomain) => {
props.onSelectProperty(property);
setSearchQuery('');
setIsDropdownOpen(false);
@@ -131,7 +136,7 @@ export const FilterPropertySelect: Component<FilterPropertySelectProps> = (
class="w-full px-2 py-1.5 text-[10px] text-ink hover:bg-hover flex items-center gap-2 text-left"
>
<PropertyDataTypeIcon property={property} />
- <span class="truncate flex-1">{property.display_name}</span>
+ <span class="truncate flex-1">{property.displayName}</span>
</button>
)}
</For>
diff --git a/js/app/packages/app/component/PropertyFilter/FilterPropertyPill.tsx b/js/app/packages/app/component/PropertyFilter/FilterPropertyPill.tsx
index b07ef519ce..f2396f9f7d 100644
--- a/js/app/packages/app/component/PropertyFilter/FilterPropertyPill.tsx
+++ b/js/app/packages/app/component/PropertyFilter/FilterPropertyPill.tsx
@@ -1,7 +1,7 @@
+import type { PropertyDefinitionDomain } from '@core/component/Properties/types';
import { PropertyDataTypeIcon } from '@core/component/Properties/utils/PropertyDataTypeIcon';
import CheckIcon from '@phosphor-icons/core/assets/regular/check.svg';
import XIcon from '@phosphor-icons/core/assets/regular/x.svg';
-import type { PropertyDefinition } from '@service-properties/generated/schemas/propertyDefinition';
import type { Component } from 'solid-js';
import { createSignal, Match, Show, Switch } from 'solid-js';
import type {
@@ -44,7 +44,7 @@ type FilterPillProps = {
id: string;
savedData: PropertyFilter | null; // null = pending, non-null = saved
/** Property definition for restoring saved filters (looked up by parent) */
- initialProperty?: PropertyDefinition;
+ initialProperty?: PropertyDefinitionDomain;
onSave: (data: PropertyFilter) => void;
onCancel: () => void;
};
@@ -117,7 +117,9 @@ export const FilterPropertyPill: Component<FilterPillProps> = (props) => {
// Internal editing state - initialized from props
const [selectedProperty, setSelectedProperty] =
- createSignal<PropertyDefinition | null>(props.initialProperty ?? null);
+ createSignal<PropertyDefinitionDomain | null>(
+ props.initialProperty ?? null
+ );
const [action, setAction] = createSignal<FilterAction | null>(
props.savedData?.action ?? null
);
@@ -147,7 +149,7 @@ export const FilterPropertyPill: Component<FilterPillProps> = (props) => {
// Track if user is editing property (to show search instead of pill)
const [previousProperty, setPreviousProperty] =
- createSignal<PropertyDefinition | null>(null);
+ createSignal<PropertyDefinitionDomain | null>(null);
const isPending = () => props.savedData === null;
@@ -163,31 +165,31 @@ export const FilterPropertyPill: Component<FilterPillProps> = (props) => {
const property = selectedProperty();
if (!property) return false;
- if (property.data_type === 'BOOLEAN') {
+ if (property.valueType === 'BOOLEAN') {
return booleanValue() !== null;
}
- if (property.data_type === 'DATE') {
+ if (property.valueType === 'DATE') {
if (isComparisonAction(action())) {
return dateValue() !== null;
}
return dateValues().length > 0; // Equality actions use multi-date
}
- if (property.data_type === 'NUMBER') {
+ if (property.valueType === 'NUMBER') {
if (isComparisonAction(action())) {
return numberValue() !== null;
}
return numberValues().length > 0; // Equality actions use multi-number
}
if (
- property.data_type === 'SELECT_STRING' ||
- property.data_type === 'SELECT_NUMBER'
+ property.valueType === 'SELECT_STRING' ||
+ property.valueType === 'SELECT_NUMBER'
) {
if (isComparisonAction(action())) {
return selectValue() !== null;
}
return selectValues().length > 0; // Equality actions use multi-select
}
- if (property.data_type === 'ENTITY') {
+ if (property.valueType === 'ENTITY') {
return entityValues().length > 0;
}
return values().length > 0;
@@ -195,7 +197,7 @@ export const FilterPropertyPill: Component<FilterPillProps> = (props) => {
const canConfirm = () => selectedProperty() && action() && hasValue();
- const handleSelectProperty = (property: PropertyDefinition) => {
+ const handleSelectProperty = (property: PropertyDefinitionDomain) => {
// Only clear action/values if property actually changed
const prev = previousProperty();
if (prev && prev.id !== property.id) {
@@ -247,15 +249,15 @@ export const FilterPropertyPill: Component<FilterPillProps> = (props) => {
if (!property) return;
// Set the appropriate value based on data type
- if (property.data_type === 'BOOLEAN' && typeof value === 'boolean') {
+ if (property.valueType === 'BOOLEAN' && typeof value === 'boolean') {
setBooleanValue(value);
- } else if (property.data_type === 'DATE' && typeof value === 'string') {
+ } else if (property.valueType === 'DATE' && typeof value === 'string') {
setDateValue(value);
- } else if (property.data_type === 'NUMBER' && typeof value === 'number') {
+ } else if (property.valueType === 'NUMBER' && typeof value === 'number') {
setNumberValue(value);
} else if (
- (property.data_type === 'SELECT_STRING' ||
- property.data_type === 'SELECT_NUMBER') &&
+ (property.valueType === 'SELECT_STRING' ||
+ property.valueType === 'SELECT_NUMBER') &&
typeof value === 'string'
) {
setSelectValue(value);
@@ -346,11 +348,11 @@ export const FilterPropertyPill: Component<FilterPillProps> = (props) => {
// Build a PropertyFilter from the current state
const buildPartialFilter = (
- property: PropertyDefinition,
+ property: PropertyDefinitionDomain,
filterAction: FilterAction,
_filterValues: string[] = []
): PropertyFilter | null => {
- const dataType = property.data_type;
+ const dataType = property.valueType;
const propertyId = property.id;
switch (dataType) {
@@ -480,7 +482,7 @@ export const FilterPropertyPill: Component<FilterPillProps> = (props) => {
class="size-3.5 shrink-0"
/>
<span class="truncate max-w-[120px]">
- {selectedProperty()!.display_name}
+ {selectedProperty()!.displayName}
</span>
</button>
@@ -505,7 +507,7 @@ export const FilterPropertyPill: Component<FilterPillProps> = (props) => {
</button>
}
>
- <Match when={selectedProperty()?.data_type === 'BOOLEAN'}>
+ <Match when={selectedProperty()?.valueType === 'BOOLEAN'}>
<FilterValueBoolean
value={booleanValue()}
onSelect={handleValueChange}
@@ -513,7 +515,7 @@ export const FilterPropertyPill: Component<FilterPillProps> = (props) => {
</Match>
<Match
when={
- selectedProperty()?.data_type === 'DATE' &&
+ selectedProperty()?.valueType === 'DATE' &&
isComparisonAction(action())
}
>
@@ -524,7 +526,7 @@ export const FilterPropertyPill: Component<FilterPillProps> = (props) => {
</Match>
<Match
when={
- selectedProperty()?.data_type === 'DATE' &&
+ selectedProperty()?.valueType === 'DATE' &&
!isComparisonAction(action())
}
>
@@ -535,7 +537,7 @@ export const FilterPropertyPill: Component<FilterPillProps> = (props) => {
</Match>
<Match
when={
- selectedProperty()?.data_type === 'NUMBER' &&
+ selectedProperty()?.valueType === 'NUMBER' &&
isComparisonAction(action())
}
>
@@ -546,7 +548,7 @@ export const FilterPropertyPill: Component<FilterPillProps> = (props) => {
</Match>
<Match
when={
- selectedProperty()?.data_type === 'NUMBER' &&
+ selectedProperty()?.valueType === 'NUMBER' &&
!isComparisonAction(action())
}
>
@@ -557,15 +559,15 @@ export const FilterPropertyPill: Component<FilterPillProps> = (props) => {
</Match>
<Match
when={
- (selectedProperty()?.data_type === 'SELECT_STRING' ||
- selectedProperty()?.data_type === 'SELECT_NUMBER') &&
+ (selectedProperty()?.valueType === 'SELECT_STRING' ||
+ selectedProperty()?.valueType === 'SELECT_NUMBER') &&
isComparisonAction(action())
}
>
<FilterValueSelect
propertyId={selectedProperty()!.id}
dataType={
- selectedProperty()!.data_type as
+ selectedProperty()!.valueType as
| 'SELECT_STRING'
| 'SELECT_NUMBER'
}
@@ -575,15 +577,15 @@ export const FilterPropertyPill: Component<FilterPillProps> = (props) => {
</Match>
<Match
when={
- (selectedProperty()?.data_type === 'SELECT_STRING' ||
- selectedProperty()?.data_type === 'SELECT_NUMBER') &&
+ (selectedProperty()?.valueType === 'SELECT_STRING' ||
+ selectedProperty()?.valueType === 'SELECT_NUMBER') &&
!isComparisonAction(action())
}
>
<FilterValueSelectMulti
propertyId={selectedProperty()!.id}
dataType={
- selectedProperty()!.data_type as
+ selectedProperty()!.valueType as
| 'SELECT_STRING'
| 'SELECT_NUMBER'
}
@@ -591,9 +593,9 @@ export const FilterPropertyPill: Component<FilterPillProps> = (props) => {
onChange={handleSelectValuesChange}
/>
</Match>
- <Match when={selectedProperty()?.data_type === 'ENTITY'}>
+ <Match when={selectedProperty()?.valueType === 'ENTITY'}>
<FilterValueEntity
- specificEntityType={selectedProperty()!.specific_entity_type!}
+ specificEntityType={selectedProperty()!.specificEntityType!}
values={entityValues()}
onChange={handleEntityValuesChange}
/>
diff --git a/js/app/packages/app/component/PropertyFilterControl.tsx b/js/app/packages/app/component/PropertyFilterControl.tsx
index 1ebb251a96..d8c1dd8065 100644
--- a/js/app/packages/app/component/PropertyFilterControl.tsx
+++ b/js/app/packages/app/component/PropertyFilterControl.tsx
@@ -1,6 +1,9 @@
-import { isPropertyDefinition } from '@core/component/Properties/utils';
+import type { PropertyDefinitionDomain } from '@core/component/Properties/types';
+import {
+ isPropertyDefinition,
+ toPropertyDefinitionDomain,
+} from '@core/component/Properties/utils';
import { useListPropertiesQuery } from '@queries/properties/definitions';
-import type { PropertyDefinition } from '@service-properties/generated/schemas/propertyDefinition';
import type { Accessor, Component } from 'solid-js';
import { createEffect, createMemo, For, Show } from 'solid-js';
import { createStore, reconcile } from 'solid-js/store';
@@ -31,14 +34,16 @@ export const PropertyFilterControl: Component<PropertyFilterControlProps> = (
includeOptions: false,
}));
- const allProperties = createMemo((): PropertyDefinition[] => {
+ const allProperties = createMemo((): PropertyDefinitionDomain[] => {
const data = propertiesQuery.data;
if (!data) return [];
- return (Array.isArray(data) ? data : []).filter(isPropertyDefinition);
+ return (Array.isArray(data) ? data : [])
+ .filter(isPropertyDefinition)
+ .map((def) => toPropertyDefinitionDomain(def));
});
// Look up property definition by ID
- const getPropertyById = (id: string): PropertyDefinition | undefined =>
+ const getPropertyById = (id: string): PropertyDefinitionDomain | undefined =>
allProperties().find((p) => p.id === id);
// Simple incrementing ID generator (unique within component lifetime)
diff --git a/js/app/packages/app/component/PropertyFilterTypes.ts b/js/app/packages/app/component/PropertyFilterTypes.ts
index b51d74d086..7836b7e5db 100644
--- a/js/app/packages/app/component/PropertyFilterTypes.ts
+++ b/js/app/packages/app/component/PropertyFilterTypes.ts
@@ -1,4 +1,4 @@
-import { DataType } from '@service-properties/generated/schemas/dataType';
+import type { ValueType } from '@core/component/Properties/types';
import type { EntityType } from '@service-properties/generated/schemas/entityType';
// ============================================
@@ -7,13 +7,13 @@ import type { EntityType } from '@service-properties/generated/schemas/entityTyp
/** Data types that support filtering */
export const FILTERABLE_DATA_TYPES = [
- DataType.BOOLEAN,
- DataType.DATE,
- DataType.NUMBER,
- DataType.SELECT_NUMBER,
- DataType.SELECT_STRING,
- DataType.ENTITY,
-] as const;
+ 'BOOLEAN',
+ 'DATE',
+ 'NUMBER',
+ 'SELECT_NUMBER',
+ 'SELECT_STRING',
+ 'ENTITY',
+] as const satisfies readonly ValueType[];
/** Equality actions - matches against one or more values (OR logic for multiple) */
export const EqualityAction = {
@@ -148,13 +148,13 @@ export type PropertyFilter =
};
/** Helper: Check if a data type is filterable */
-export const isFilterableDataType = (dataType: DataType): boolean => {
- return (FILTERABLE_DATA_TYPES as readonly DataType[]).includes(dataType);
+export const isFilterableDataType = (dataType: ValueType): boolean => {
+ return (FILTERABLE_DATA_TYPES as readonly ValueType[]).includes(dataType);
};
/** Helper: Get valid filter actions for a property based on data type and multi-select */
export const getValidFilterActions = (
- dataType: DataType,
+ dataType: ValueType,
isMultiSelect: boolean
): FilterAction[] => {
const actions: FilterAction[] = [];
@@ -168,12 +168,12 @@ export const getValidFilterActions = (
}
// BOOLEAN: only equality
- if (dataType === DataType.BOOLEAN) {
+ if (dataType === 'BOOLEAN') {
return [EqualityAction.EQUAL, EqualityAction.NOT_EQUAL];
}
// ENTITY (single-value): only equality
- if (dataType === DataType.ENTITY) {
+ if (dataType === 'ENTITY') {
return [EqualityAction.EQUAL, EqualityAction.NOT_EQUAL];
}
diff --git a/js/app/packages/core/component/Properties/component/modal/SelectPropertyModal.tsx b/js/app/packages/core/component/Properties/component/modal/SelectPropertyModal.tsx
index e2176c9e1f..052be2fd6f 100644
--- a/js/app/packages/core/component/Properties/component/modal/SelectPropertyModal.tsx
+++ b/js/app/packages/core/component/Properties/component/modal/SelectPropertyModal.tsx
@@ -13,11 +13,12 @@ import { usePropertiesContext } from '../../context/PropertiesContext';
import { usePropertySelection } from '../../hooks/usePropertySelection';
import { PROPERTY_STYLES } from '../../styles';
import type {
- PropertyDefinitionFlat,
+ PropertyDefinitionDomain,
PropertySelectorProps,
} from '../../types';
import {
getPropertyDefinitionTypeDisplay,
+ toPropertyDefinitionDomain,
useSearchInputFocus,
} from '../../utils';
import { useListPropertiesQuery } from '@queries/properties/definitions';
@@ -37,7 +38,7 @@ export function SelectPropertyModal(props: PropertySelectorProps) {
forEntityType: entityType,
}));
- const availableProperties = createMemo((): PropertyDefinitionFlat[] => {
+ const availableProperties = createMemo((): PropertyDefinitionDomain[] => {
if (
listPropertiesQuery.isLoading ||
listPropertiesQuery.isError ||
@@ -51,15 +52,12 @@ export function SelectPropertyModal(props: PropertySelectorProps) {
const properties = Array.isArray(data) ? data : [];
return properties.map((item) => {
if ('definition' in item) {
- return {
- ...item.definition,
- propertyOptions: item.property_options || [],
- };
+ return toPropertyDefinitionDomain(
+ item.definition,
+ item.property_options || []
+ );
}
- return {
- ...item,
- propertyOptions: [],
- };
+ return toPropertyDefinitionDomain(item);
});
});
@@ -256,15 +254,15 @@ export function SelectPropertyModal(props: PropertySelectorProps) {
<div class="flex-1">
<div class="flex items-center gap-2">
<h4 class="font-medium text-xs">
- {property.display_name}
+ {property.displayName}
</h4>
</div>
<div class="text-xs text-ink-muted mt-0.5">
{getPropertyDefinitionTypeDisplay({
- dataType: property.data_type,
+ dataType: property.valueType,
specificEntityType:
- property.specific_entity_type,
- isMultiSelect: property.is_multi_select,
+ property.specificEntityType,
+ isMultiSelect: property.isMultiSelect,
})}
</div>
</div>
diff --git a/js/app/packages/core/component/Properties/component/panel/PropertyLabel.tsx b/js/app/packages/core/component/Properties/component/panel/PropertyLabel.tsx
index 1e23cbed4f..c875398445 100644
--- a/js/app/packages/core/component/Properties/component/panel/PropertyLabel.tsx
+++ b/js/app/packages/core/component/Properties/component/panel/PropertyLabel.tsx
@@ -91,10 +91,7 @@ export const PropertyLabel: Component<PropertyLabelProps> = (props) => {
onMouseLeave={() => setIsHovered(false)}
>
<PropertyDataTypeIcon
- property={{
- data_type: props.property.valueType,
- specific_entity_type: props.property.specificEntityType,
- }}
+ property={props.property}
class="size-4 shrink-0 opacity-40"
/>
<span class="truncate flex-shrink min-w-0">
diff --git a/js/app/packages/core/component/Properties/component/propertyValue/BooleanValue.tsx b/js/app/packages/core/component/Properties/component/propertyValue/BooleanValue.tsx
index 4ded31e039..ccc2a54196 100644
--- a/js/app/packages/core/component/Properties/component/propertyValue/BooleanValue.tsx
+++ b/js/app/packages/core/component/Properties/component/propertyValue/BooleanValue.tsx
@@ -1,22 +1,15 @@
import CheckIcon from '@icon/bold/check-bold.svg';
-import type { EntityType } from '@service-properties/generated/schemas/entityType';
import type { Component } from 'solid-js';
import { Show } from 'solid-js';
import { useBooleanEditor } from '../../hooks';
import type { Property } from '../../types';
-
-type BooleanValueProps = {
- property: Property;
- canEdit: boolean;
- entityType: EntityType;
- onRefresh?: () => void;
-};
+import type { PropertyValueProps } from './ValueComponents';
/**
* Display component for boolean properties with instant toggle
* Treats null as false (unchecked)
*/
-export const BooleanValue: Component<BooleanValueProps> = (props) => {
+export const BooleanValue: Component<PropertyValueProps> = (props) => {
const { value, isSaving, toggle } = useBooleanEditor(
props.property as Property & { valueType: 'BOOLEAN' },
props.onRefresh
diff --git a/js/app/packages/core/component/Properties/component/propertyValue/CondensedPropertyValue.tsx b/js/app/packages/core/component/Properties/component/propertyValue/CondensedPropertyValue.tsx
new file mode 100644
index 0000000000..87f5aefd17
--- /dev/null
+++ b/js/app/packages/core/component/Properties/component/propertyValue/CondensedPropertyValue.tsx
@@ -0,0 +1,103 @@
+import { getSelectValues } from '@core/component/Properties/utils';
+import { PropertyValueIcon } from './PropertyValueIcon';
+import { Tooltip } from '@core/component/Tooltip';
+import { usePropertiesContext } from '../../context/PropertiesContext';
+import type { Component } from 'solid-js';
+import { Show } from 'solid-js';
+import type { Property } from '../../types';
+import {
+ isDateProperty,
+ hasValue,
+ isSelectProperty,
+ isEntityProperty,
+} from '../../utils/typeGuards';
+import { PropertyTooltip } from './PropertyTooltip';
+import CircleDashedEmpty from '@icon/regular/circle-dashed.svg';
+import { UserGroup } from './UserGroup';
+
+type CondensedPropertyValueProps = {
+ property: Property;
+};
+
+/**
+ * Condensed property value display - shows as an icon-only pill but launches full modals for editing
+ * Similar to PropertyPills but integrated with the Properties context for editing
+ */
+export const CondensedPropertyValue: Component<CondensedPropertyValueProps> = (
+ props
+) => {
+ const { canEdit, openPropertyEditor, openDatePicker } =
+ usePropertiesContext();
+
+ const validValue = () => hasValue(props.property);
+
+ const handleClick = (e: MouseEvent) => {
+ if (!canEdit) return;
+ e.preventDefault();
+ e.stopPropagation();
+ const target = e.currentTarget as HTMLElement;
+ if (isDateProperty(props.property)) {
+ openDatePicker(props.property, target);
+ } else {
+ openPropertyEditor(props.property, target);
+ }
+ };
+
+ const isUserProperty = () => {
+ return (
+ isEntityProperty(props.property) &&
+ props.property.specificEntityType === 'USER'
+ );
+ };
+
+ return (
+ <Tooltip
+ unstyled
+ tooltip={<PropertyTooltip property={props.property} />}
+ class="flex items-center"
+ >
+ <div
+ class="inline-flex items-center text-xs leading-none text-ink-muted shrink-0 p-1.5 h-6.5 transition-colors"
+ classList={{
+ 'cursor-pointer hover:border-edge-muted hover:bg-hover/50': canEdit,
+ 'opacity-50': !validValue(),
+ 'border border-edge-muted/50': !isUserProperty(),
+ }}
+ onClick={handleClick}
+ role={canEdit ? 'button' : undefined}
+ tabIndex={canEdit ? 0 : undefined}
+ >
+ <CondensedIcon property={props.property} />
+ </div>
+ </Tooltip>
+ );
+};
+
+const CondensedIcon = (props: { property: Property }) => {
+ const internal = () => {
+ if (!hasValue(props.property)) return null;
+
+ if (isEntityProperty(props.property)) {
+ if (props.property.specificEntityType === 'USER') {
+ return <UserGroup entities={props.property.value ?? []} />;
+ }
+ }
+
+ if (isSelectProperty(props.property)) {
+ const values = getSelectValues(props.property);
+ if (values.length > 0) {
+ return PropertyValueIcon({ optionId: values[0] });
+ }
+ return null;
+ }
+ };
+
+ return (
+ <Show
+ when={internal()}
+ fallback={<CircleDashedEmpty class="size-3 shrink-0" />}
+ >
+ {(Icon) => Icon()}
+ </Show>
+ );
+};
diff --git a/js/app/packages/core/component/Properties/component/propertyValue/DateValue.tsx b/js/app/packages/core/component/Properties/component/propertyValue/DateValue.tsx
index 07e85fabfd..925ed7a901 100644
--- a/js/app/packages/core/component/Properties/component/propertyValue/DateValue.tsx
+++ b/js/app/packages/core/component/Properties/component/propertyValue/DateValue.tsx
@@ -1,22 +1,18 @@
import type { Component } from 'solid-js';
import { createSignal, Show } from 'solid-js';
import { usePropertiesContext } from '../../context/PropertiesContext';
-import type { Property } from '../../types';
import { formatDate } from '../../utils';
-import { EmptyValue, PropertyValueDeleteButton } from './ValueComponents';
-
-type DateValueProps = {
- property: Property;
- canEdit: boolean;
- onEdit?: (property: Property, anchor?: HTMLElement) => void;
- onRefresh?: () => void;
-};
+import {
+ EmptyValue,
+ PropertyValueDeleteButton,
+ type PropertyValueProps,
+} from './ValueComponents';
/**
* Display component for date properties
* Opens date picker modal on click
*/
-export const DateValue: Component<DateValueProps> = (props) => {
+export const DateValue: Component<PropertyValueProps> = (props) => {
const { saveHandler } = usePropertiesContext();
const [isHovered, setIsHovered] = createSignal(false);
const [isSaving, setIsSaving] = createSignal(false);
diff --git a/js/app/packages/core/component/Properties/component/propertyValue/EntityValue.tsx b/js/app/packages/core/component/Properties/component/propertyValue/EntityValue.tsx
index d63c08b031..b8cf9f384f 100644
--- a/js/app/packages/core/component/Properties/component/propertyValue/EntityValue.tsx
+++ b/js/app/packages/core/component/Properties/component/propertyValue/EntityValue.tsx
@@ -1,26 +1,20 @@
import type { EntityReference } from '@service-properties/generated/schemas/entityReference';
-import type { EntityType } from '@service-properties/generated/schemas/entityType';
import type { Component } from 'solid-js';
import { createSignal, For, Show } from 'solid-js';
import { usePropertiesContext } from '../../context/PropertiesContext';
-import type { Property } from '../../types';
import { getEntityValues } from '../../utils';
import { EntityIcon } from './EntityIcon';
-import { AddPropertyValueButton, EmptyValue } from './ValueComponents';
-
-type EntityValueProps = {
- property: Property;
- canEdit: boolean;
- entityType: EntityType;
- onEdit?: (property: Property, anchor?: HTMLElement) => void;
- onRefresh?: () => void;
-};
+import {
+ AddPropertyValueButton,
+ EmptyValue,
+ type PropertyValueProps,
+} from './ValueComponents';
/**
* Display component for entity properties
* Shows entity badges and opens modal on click
*/
-export const EntityValue: Component<EntityValueProps> = (props) => {
+export const EntityValue: Component<PropertyValueProps> = (props) => {
const { saveHandler } = usePropertiesContext();
const [isSaving, setIsSaving] = createSignal(false);
diff --git a/js/app/packages/core/component/Properties/component/propertyValue/LinkValue.tsx b/js/app/packages/core/component/Properties/component/propertyValue/LinkValue.tsx
index 38a3a338c1..731324c941 100644
--- a/js/app/packages/core/component/Properties/component/propertyValue/LinkValue.tsx
+++ b/js/app/packages/core/component/Properties/component/propertyValue/LinkValue.tsx
@@ -1,12 +1,10 @@
import { useUnfurl } from '@core/signal/unfurl';
import LinkIcon from '@icon/regular/link.svg';
-import type { EntityType } from '@service-properties/generated/schemas/entityType';
import { proxyResource } from '@service-unfurl/client';
import type { Component } from 'solid-js';
import { createSignal, For, Show } from 'solid-js';
import { createStore } from 'solid-js/store';
import { usePropertiesContext } from '../../context/PropertiesContext';
-import type { Property } from '../../types';
import {
extractDomain,
getLinkValues,
@@ -17,16 +15,10 @@ import {
AddPropertyValueButton,
EmptyValue,
PropertyValueDeleteButton,
+ type PropertyValueProps,
} from './ValueComponents';
-type LinkValueProps = {
- property: Property;
- canEdit: boolean;
- entityType: EntityType;
- onRefresh?: () => void;
-};
-
-export const LinkValue: Component<LinkValueProps> = (props) => {
+export const LinkValue: Component<PropertyValueProps> = (props) => {
const { saveHandler } = usePropertiesContext();
const [isAdding, setIsAdding] = createSignal(false);
const [inputValue, setInputValue] = createSignal('');
diff --git a/js/app/packages/core/component/Properties/component/propertyValue/NumberValue.tsx b/js/app/packages/core/component/Properties/component/propertyValue/NumberValue.tsx
index 30b2802964..f22598b641 100644
--- a/js/app/packages/core/component/Properties/component/propertyValue/NumberValue.tsx
+++ b/js/app/packages/core/component/Properties/component/propertyValue/NumberValue.tsx
@@ -1,23 +1,14 @@
-import type { EntityType } from '@service-properties/generated/schemas/entityType';
import type { Component } from 'solid-js';
import { Show } from 'solid-js';
import { useInlineEditor } from '../../hooks';
-import type { Property } from '../../types';
import { formatNumber } from '../../utils';
-import { EmptyValue } from './ValueComponents';
-
-type NumberValueProps = {
- property: Property;
- canEdit: boolean;
- entityType: EntityType;
- onRefresh?: () => void;
-};
+import { EmptyValue, type PropertyValueProps } from './ValueComponents';
/**
* Display component for number properties with inline editing
* Numbers are formatted to 4 decimal places
*/
-export const NumberValue: Component<NumberValueProps> = (props) => {
+export const NumberValue: Component<PropertyValueProps> = (props) => {
const editor = useInlineEditor(props.property, props.onRefresh);
const supportsInline = () =>
diff --git a/js/app/packages/core/component/Properties/component/propertyValue/PropertyTooltip.tsx b/js/app/packages/core/component/Properties/component/propertyValue/PropertyTooltip.tsx
new file mode 100644
index 0000000000..d9caa5a721
--- /dev/null
+++ b/js/app/packages/core/component/Properties/component/propertyValue/PropertyTooltip.tsx
@@ -0,0 +1,334 @@
+import { usePropertyEntityDisplay } from '@core/component/Properties/hooks';
+import type { Property } from '@core/component/Properties/types';
+import {
+ extractDomain,
+ formatPropertyValue,
+ isBooleanProperty,
+ isDateProperty,
+ isEntityProperty,
+ isLinkProperty,
+ isNumberProperty,
+ isSelectProperty,
+ isStringProperty,
+ PropertyDataTypeIcon,
+} from '@core/component/Properties/utils';
+import { UserIcon } from '@core/component/UserIcon';
+import LinkIcon from '@icon/regular/link.svg';
+import type { EntityReference } from '@service-properties/generated/schemas/entityReference';
+import type { EntityType } from '@service-properties/generated/schemas/entityType';
+import { useUnfurl } from '@core/signal/unfurl';
+import { proxyResource } from '@service-unfurl/client';
+import {
+ createSignal,
+ For,
+ type JSX,
+ Match,
+ type ParentProps,
+ Show,
+ Switch,
+} from 'solid-js';
+import { PropertyValueIcon } from './PropertyValueIcon';
+import { hasValue as propertyHasValue } from '@core/component/Properties/utils';
+
+type PropertyTooltipProps = ParentProps<{
+ property: Property;
+}>;
+
+/**
+ * Tooltip content component for property values
+ * Routes to type-specific tooltip content based on valueType
+ */
+export const PropertyTooltip = (props: PropertyTooltipProps): JSX.Element => {
+ return (
+ <Switch>
+ <Match when={isStringProperty(props.property) && props.property}>
+ {(property) => <StringTooltipContent property={property()} />}
+ </Match>
+ <Match when={isNumberProperty(props.property) && props.property}>
+ {(property) => <NumberTooltipContent property={property()} />}
+ </Match>
+ <Match when={isBooleanProperty(props.property) && props.property}>
+ {(property) => <BooleanTooltipContent property={property()} />}
+ </Match>
+ <Match when={isDateProperty(props.property) && props.property}>
+ {(property) => <DateTooltipContent property={property()} />}
+ </Match>
+ <Match when={isSelectProperty(props.property) && props.property}>
+ {(property) => <SelectTooltipContent property={property()} />}
+ </Match>
+ <Match when={isEntityProperty(props.property) && props.property}>
+ {(property) => <EntityTooltipContent property={property()} />}
+ </Match>
+ <Match when={isLinkProperty(props.property) && props.property}>
+ {(property) => <LinkTooltipContent property={property()} />}
+ </Match>
+ </Switch>
+ );
+};
+
+/**
+ * Shared tooltip wrapper with consistent header styling
+ */
+const TooltipWrapper = (props: {
+ property: Property;
+ children: JSX.Element;
+}) => {
+ const singleSelect = () => !props.property.isMultiSelect;
+ const hasValue = () => propertyHasValue(props.property);
+ return (
+ <Show
+ when={hasValue()}
+ fallback={
+ <div class="p-2 border border-edge-muted bg-panel text-xs">
+ No {props.property.displayName} set
+ </div>
+ }
+ >
+ <div
+ class="p-2 border border-edge-muted bg-panel"
+ classList={{
+ 'flex flex-row gap-2 items-center': singleSelect(),
+ 'min-w-48 max-w-72': !singleSelect(),
+ }}
+ >
+ <div
+ class="flex items-center gap-2 text-ink-muted"
+ classList={{
+ 'border-b border-edge-muted/50 pb-1.5 mb-1.5': !singleSelect(),
+ }}
+ >
+ <PropertyDataTypeIcon
+ property={props.property}
+ class="size-3.5 text-ink-muted"
+ />
+ <span class="text-xs">{props.property.displayName}</span>
+ </div>
+ {props.children}
+ </div>
+ </Show>
+ );
+};
+
+const ValueContainer = (props: { children: JSX.Element }) => (
+ <div class="inline-flex items-center gap-1.5 px-2 py-1 text-xs leading-none text-ink-muted border border-edge-muted h-fit w-fit">
+ {props.children}
+ </div>
+);
+
+const StringTooltipContent = (props: {
+ property: Property & { valueType: 'STRING' };
+}) => {
+ return (
+ <TooltipWrapper property={props.property}>
+ <div class="flex items-center gap-1.5 flex-wrap">
+ <ValueContainer>
+ <span class="truncate max-w-[150px]">{props.property.value}</span>
+ </ValueContainer>
+ </div>
+ </TooltipWrapper>
+ );
+};
+
+const NumberTooltipContent = (props: {
+ property: Property & { valueType: 'NUMBER' };
+}) => {
+ const displayValue = () =>
+ formatPropertyValue(props.property, props.property.value);
+
+ return (
+ <TooltipWrapper property={props.property}>
+ <div class="flex items-center gap-1.5 flex-wrap">
+ <ValueContainer>
+ <span class="truncate max-w-[150px]">{displayValue()}</span>
+ </ValueContainer>
+ </div>
+ </TooltipWrapper>
+ );
+};
+
+const BooleanTooltipContent = (props: {
+ property: Property & { valueType: 'BOOLEAN' };
+}) => {
+ const displayValue = () =>
+ formatPropertyValue(props.property, props.property.value);
+
+ return (
+ <TooltipWrapper property={props.property}>
+ <div class="flex items-center gap-1.5 flex-wrap">
+ <ValueContainer>
+ <span>{displayValue()}</span>
+ </ValueContainer>
+ </div>
+ </TooltipWrapper>
+ );
+};
+
+const DateTooltipContent = (props: {
+ property: Property & { valueType: 'DATE' };
+}) => {
+ const displayValue = () =>
+ formatPropertyValue(props.property, props.property.value);
+
+ return (
+ <TooltipWrapper property={props.property}>
+ <div class="flex items-center gap-1.5 flex-wrap">
+ <ValueContainer>
+ <span class="truncate max-w-[150px]">{displayValue()}</span>
+ </ValueContainer>
+ </div>
+ </TooltipWrapper>
+ );
+};
+
+const SelectTooltipContent = (props: {
+ property: Property & { valueType: 'SELECT_STRING' | 'SELECT_NUMBER' };
+}) => {
+ const values = () => props.property.value ?? [];
+ return (
+ <TooltipWrapper property={props.property}>
+ <div class="flex items-center gap-1.5 flex-wrap">
+ <For each={values()}>
+ {(optionId, index) => (
+ <ValueContainer>
+ <SelectValueIcon property={props.property} valueIndex={index()} />
+ <span class="truncate max-w-[150px]">
+ {formatPropertyValue(props.property, optionId)}
+ </span>
+ </ValueContainer>
+ )}
+ </For>
+ </div>
+ </TooltipWrapper>
+ );
+};
+
+const SelectValueIcon = (props: {
+ property: Property & { valueType: 'SELECT_STRING' | 'SELECT_NUMBER' };
+ valueIndex: number;
+}) => {
+ const optionId = () => props.property.value?.[props.valueIndex];
+ return (
+ <Show when={optionId()}>
+ <PropertyValueIcon optionId={optionId()!} class="size-3 shrink-0" />
+ </Show>
+ );
+};
+
+const EntityTooltipContent = (props: {
+ property: Property & { valueType: 'ENTITY' };
+}) => {
+ const entities = () => props.property.value ?? [];
+ const isUserType = () => props.property.specificEntityType === 'USER';
+
+ return (
+ <TooltipWrapper property={props.property}>
+ <div class="flex items-center gap-1.5 flex-wrap">
+ <Switch>
+ <Match when={isUserType()}>
+ <div class="flex flex-col gap-1.5">
+ <For each={entities()}>
+ {(entity) => <UserEntityItem entity={entity} />}
+ </For>
+ </div>
+ </Match>
+ <Match when={!isUserType()}>
+ <For each={entities()}>
+ {(entity) => <EntityValuePill entity={entity} />}
+ </For>
+ </Match>
+ </Switch>
+ </div>
+ </TooltipWrapper>
+ );
+};
+
+const EntityValuePill = (props: { entity: EntityReference }) => {
+ const { name, icon } = usePropertyEntityDisplay(
+ () => props.entity.entity_id,
+ () => props.entity.entity_type as EntityType,
+ { fallbackIcon: null }
+ );
+
+ return (
+ <ValueContainer>
+ <Show when={icon()}>{icon()}</Show>
+ <span class="truncate max-w-[150px]">{name()}</span>
+ </ValueContainer>
+ );
+};
+
+const UserEntityItem = (props: { entity: EntityReference }) => {
+ const { name } = usePropertyEntityDisplay(
+ () => props.entity.entity_id,
+ () => props.entity.entity_type as EntityType,
+ { fallbackIcon: null }
+ );
+
+ return (
+ <ValueContainer>
+ <div class="size-4 rounded-full overflow-hidden shrink-0">
+ <UserIcon id={props.entity.entity_id} isDeleted={false} size="fill" />
+ </div>
+ <span class="truncate max-w-[150px]">{name()}</span>
+ </ValueContainer>
+ );
+};
+
+const LinkTooltipContent = (props: {
+ property: Property & { valueType: 'LINK' };
+}) => {
+ const links = () => props.property.value ?? [];
+
+ return (
+ <TooltipWrapper property={props.property}>
+ <div class="flex items-center gap-1.5 flex-wrap">
+ <For each={links()}>{(url) => <LinkValuePill url={url} />}</For>
+ </div>
+ </TooltipWrapper>
+ );
+};
+
+const LinkValuePill = (props: { url: string }) => {
+ const [unfurlData] = useUnfurl(props.url);
+ const [imageError, setImageError] = createSignal(false);
+
+ const title = () => {
+ const data = unfurlData();
+ if (data?.type === 'success' && data.data.title) {
+ return data.data.title;
+ }
+ return extractDomain(props.url);
+ };
+
+ const faviconUrl = () => {
+ const data = unfurlData();
+ if (data?.type === 'success' && data.data.favicon_url) {
+ return proxyResource(data.data.favicon_url);
+ }
+ return null;
+ };
+
+ return (
+ <a
+ href={props.url}
+ target="_blank"
+ rel="noopener noreferrer"
+ class="inline-flex items-center gap-1.5 px-2 py-1 text-xs leading-none text-ink-muted border border-edge-muted h-fit w-fit"
+ title={props.url}
+ >
+ <Show
+ when={faviconUrl() && !imageError()}
+ fallback={<LinkIcon class="size-4 text-ink-muted" />}
+ >
+ <img
+ src={faviconUrl()!}
+ class="size-4 object-cover rounded"
+ crossorigin="anonymous"
+ alt=""
+ onError={() => setImageError(true)}
+ />
+ </Show>
+ <span class="truncate max-w-[150px]">{title()}</span>
+ </a>
+ );
+};
diff --git a/js/app/packages/core/component/Properties/component/propertyValue/PropertyValue.tsx b/js/app/packages/core/component/Properties/component/propertyValue/PropertyValue.tsx
index 1fcc38b1a5..6b9bbb3151 100644
--- a/js/app/packages/core/component/Properties/component/propertyValue/PropertyValue.tsx
+++ b/js/app/packages/core/component/Properties/component/propertyValue/PropertyValue.tsx
@@ -1,7 +1,10 @@
import type { Component } from 'solid-js';
+import { Dynamic, Show } from 'solid-js/web';
+import { match } from 'ts-pattern';
import { usePropertiesContext } from '../../context/PropertiesContext';
import type { Property } from '../../types';
import { BooleanValue } from './BooleanValue';
+import { CondensedPropertyValue } from './CondensedPropertyValue';
import { DateValue } from './DateValue';
import { EntityValue } from './EntityValue';
import { LinkValue } from './LinkValue';
@@ -9,106 +12,42 @@ import { NumberValue } from './NumberValue';
import { SelectValue } from './SelectValue';
import { TextValue } from './TextValue';
-type PropertyValueProps = {
- property: Property;
- onEdit?: (property: Property, anchor?: HTMLElement) => void;
-};
-
/**
* Router component that delegates to type-specific display components
- * This is the decision maker for which editing method to use
*/
-export const PropertyValue: Component<PropertyValueProps> = (props) => {
+export const PropertyValue: Component<{
+ property: Property;
+ onEdit?: (property: Property, anchor?: HTMLElement) => void;
+ condensed?: boolean;
+}> = (props) => {
const { entityType, canEdit, onRefresh } = usePropertiesContext();
-
- // Route based on valueType
- switch (props.property.valueType) {
- case 'STRING':
- return (
- <TextValue
- property={props.property}
- canEdit={canEdit}
- entityType={entityType}
- onRefresh={onRefresh}
- />
- );
-
- case 'NUMBER':
- return (
- <NumberValue
- property={props.property}
- canEdit={canEdit}
- entityType={entityType}
- onRefresh={onRefresh}
- />
- );
-
- case 'BOOLEAN':
- return (
- <BooleanValue
- property={props.property}
- canEdit={canEdit}
- entityType={entityType}
- onRefresh={onRefresh}
- />
- );
-
- case 'DATE':
- return (
- <DateValue
- property={props.property}
- canEdit={canEdit}
- onEdit={props.onEdit}
- onRefresh={onRefresh}
- />
- );
-
- case 'SELECT_STRING':
- case 'SELECT_NUMBER':
- return (
- <SelectValue
- property={props.property}
- canEdit={canEdit}
- entityType={entityType}
- onEdit={props.onEdit}
- onRefresh={onRefresh}
- />
- );
-
- case 'ENTITY':
- return (
- <EntityValue
- property={props.property}
- canEdit={canEdit}
- entityType={entityType}
- onEdit={props.onEdit}
- onRefresh={onRefresh}
- />
- );
-
- case 'LINK':
- return (
- <LinkValue
- property={props.property}
- canEdit={canEdit}
- entityType={entityType}
- onRefresh={onRefresh}
- />
- );
-
- default: {
- // Exhaustive check: if we reach here, TypeScript will error
- // because we haven't handled all PropertyValue types
- const _exhaustiveCheck: never = props.property;
- console.error(
- 'Unhandled property type in PropertyValue:',
- (_exhaustiveCheck as Property).valueType
- );
- return (
- <div class="text-failure-ink text-xs px-2 py-1">
- Unsupported Property Type
- </div>
- );
- }
- }
+ const expanded = () => !props.condensed;
+
+ const valueComponent = () =>
+ match(props.property)
+ .with({ valueType: 'STRING' }, () => TextValue)
+ .with({ valueType: 'NUMBER' }, () => NumberValue)
+ .with({ valueType: 'BOOLEAN' }, () => BooleanValue)
+ .with({ valueType: 'DATE' }, () => DateValue)
+ .with({ valueType: 'SELECT_STRING' }, () => SelectValue)
+ .with({ valueType: 'SELECT_NUMBER' }, () => SelectValue)
+ .with({ valueType: 'ENTITY' }, () => EntityValue)
+ .with({ valueType: 'LINK' }, () => LinkValue)
+ .exhaustive();
+
+ return (
+ <Show
+ when={expanded()}
+ fallback={<CondensedPropertyValue property={props.property} />}
+ >
+ <Dynamic
+ component={valueComponent()}
+ property={props.property}
+ canEdit={canEdit}
+ entityType={entityType}
+ onEdit={props.onEdit}
+ onRefresh={onRefresh}
+ />
+ </Show>
+ );
};
diff --git a/js/app/packages/core/component/Properties/component/propertyValue/PropertyValueIcon.tsx b/js/app/packages/core/component/Properties/component/propertyValue/PropertyValueIcon.tsx
index 37c971ee82..795f99bf52 100644
--- a/js/app/packages/core/component/Properties/component/propertyValue/PropertyValueIcon.tsx
+++ b/js/app/packages/core/component/Properties/component/propertyValue/PropertyValueIcon.tsx
@@ -16,6 +16,10 @@ type PropertyValueIconProps = {
class?: string;
};
+const knownPropertyIds = new Set<string>(
+ Object.values(PROPERTY_OPTION_IDS).flatMap((group) => Object.values(group))
+);
+
/**
* Render appropriate icons for property option values - based on common,
* hard-coded property option ids.
@@ -28,6 +32,9 @@ type PropertyValueIconProps = {
* ```
*/
export const PropertyValueIcon: Component<PropertyValueIconProps> = (props) => {
+ if (!knownPropertyIds.has(props.optionId)) {
+ return null;
+ }
return (
<Switch>
{/* Priority */}
diff --git a/js/app/packages/core/component/Properties/component/propertyValue/SelectValue.tsx b/js/app/packages/core/component/Properties/component/propertyValue/SelectValue.tsx
index 25463346cc..be0e208c26 100644
--- a/js/app/packages/core/component/Properties/component/propertyValue/SelectValue.tsx
+++ b/js/app/packages/core/component/Properties/component/propertyValue/SelectValue.tsx
@@ -1,30 +1,21 @@
-import type { EntityType } from '@service-properties/generated/schemas/entityType';
import type { Component } from 'solid-js';
import { createSignal, For, Show } from 'solid-js';
import { usePropertiesContext } from '../../context/PropertiesContext';
import { PROPERTY_STYLES } from '../../styles/styles';
-import type { Property } from '../../types';
import { formatPropertyValue, getSelectValues } from '../../utils';
import { PropertyValueIcon } from './PropertyValueIcon';
import {
AddPropertyValueButton,
EmptyValue,
PropertyValueDeleteButton,
+ type PropertyValueProps,
} from './ValueComponents';
-type SelectValueProps = {
- property: Property;
- canEdit: boolean;
- entityType: EntityType;
- onEdit?: (property: Property, anchor?: HTMLElement) => void;
- onRefresh?: () => void;
-};
-
/**
* Display component for select_string and select_number properties
* Opens options modal on click
*/
-export const SelectValue: Component<SelectValueProps> = (props) => {
+export const SelectValue: Component<PropertyValueProps> = (props) => {
const { saveHandler } = usePropertiesContext();
const [hoveredValue, setHoveredValue] = createSignal<string | null>(null);
const [isSaving, setIsSaving] = createSignal(false);
diff --git a/js/app/packages/core/component/Properties/component/propertyValue/TextValue.tsx b/js/app/packages/core/component/Properties/component/propertyValue/TextValue.tsx
index 4670e2be47..054221a95d 100644
--- a/js/app/packages/core/component/Properties/component/propertyValue/TextValue.tsx
+++ b/js/app/packages/core/component/Properties/component/propertyValue/TextValue.tsx
@@ -1,22 +1,13 @@
-import type { EntityType } from '@service-properties/generated/schemas/entityType';
import type { Component } from 'solid-js';
import { Show } from 'solid-js';
import { useInlineEditor } from '../../hooks';
-import type { Property } from '../../types';
import { formatPropertyValue } from '../../utils';
-import { EmptyValue } from './ValueComponents';
-
-type TextValueProps = {
- property: Property;
- canEdit: boolean;
- entityType: EntityType;
- onRefresh?: () => void;
-};
+import { EmptyValue, type PropertyValueProps } from './ValueComponents';
/**
* Display component for string properties with inline editing
*/
-export const TextValue: Component<TextValueProps> = (props) => {
+export const TextValue: Component<PropertyValueProps> = (props) => {
const editor = useInlineEditor(props.property, props.onRefresh);
const supportsInline = () =>
diff --git a/js/app/packages/core/component/Properties/component/propertyValue/UserGroup.tsx b/js/app/packages/core/component/Properties/component/propertyValue/UserGroup.tsx
new file mode 100644
index 0000000000..f7d2182723
--- /dev/null
+++ b/js/app/packages/core/component/Properties/component/propertyValue/UserGroup.tsx
@@ -0,0 +1,45 @@
+import { createMemo, For, Show } from 'solid-js';
+import type { EntityReference } from '../../types';
+import { UserIcon } from '@core/component/UserIcon';
+
+const MAX_USER_AVATARS = 3;
+
+type UserEntityPillProps = {
+ entities: EntityReference[];
+};
+
+/**
+ * Pill for multiselect user entity properties that shows user avatars in LiveIndicators style
+ */
+export const UserGroup = (props: UserEntityPillProps) => {
+ const remaining = createMemo(() => {
+ if (props.entities.length <= MAX_USER_AVATARS) return undefined;
+ return props.entities.length - MAX_USER_AVATARS;
+ });
+
+ const displayEntities = () => props.entities.slice(0, MAX_USER_AVATARS);
+
+ return (
+ <div class="flex items-center shrink-0 w-fit pr-2">
+ <For each={displayEntities()}>
+ {(entity) => (
+ <div class="bg-panel rounded-full p-[2px] -mr-2">
+ <UserIcon
+ id={entity.entity_id}
+ isDeleted={false}
+ size="xs"
+ suppressClick
+ />
+ </div>
+ )}
+ </For>
+ <Show when={remaining()}>
+ <div class="z-4">
+ <div class="size-5 bg-panel border-2 text-[10px] -mr-2 text-ink border-panel rounded-full flex flex-col justify-center items-center">
+ <span>+{remaining()}</span>
+ </div>
+ </div>
+ </Show>
+ </div>
+ );
+};
diff --git a/js/app/packages/core/component/Properties/component/propertyValue/ValueComponents.tsx b/js/app/packages/core/component/Properties/component/propertyValue/ValueComponents.tsx
index 317edf4d79..b1688241da 100644
--- a/js/app/packages/core/component/Properties/component/propertyValue/ValueComponents.tsx
+++ b/js/app/packages/core/component/Properties/component/propertyValue/ValueComponents.tsx
@@ -1,8 +1,21 @@
import SwapIcon from '@icon/bold/swap-bold.svg';
import DeleteIcon from '@icon/bold/x-bold.svg';
+import type { EntityType } from '@service-properties/generated/schemas/entityType';
import { Button } from '@ui/components/Button';
import type { Component, JSX } from 'solid-js';
import { twMerge } from 'tailwind-merge';
+import type { Property } from '../../types';
+
+/**
+ * Shared props type for all property value display components
+ */
+export type PropertyValueProps = {
+ property: Property;
+ canEdit: boolean;
+ entityType: EntityType;
+ onEdit?: (property: Property, anchor?: HTMLElement) => void;
+ onRefresh?: () => void;
+};
/**
* Shared UI primitives for property value display components
diff --git a/js/app/packages/core/component/Properties/component/propertyValue/index.ts b/js/app/packages/core/component/Properties/component/propertyValue/index.ts
index a0b38f2a3d..7f6fb668fc 100644
--- a/js/app/packages/core/component/Properties/component/propertyValue/index.ts
+++ b/js/app/packages/core/component/Properties/component/propertyValue/index.ts
@@ -1,9 +1,11 @@
export { BooleanValue } from './BooleanValue';
+export { CondensedPropertyValue } from './CondensedPropertyValue';
export { DateValue } from './DateValue';
export { EntityIcon } from './EntityIcon';
export { EntityValue } from './EntityValue';
export { LinkValue } from './LinkValue';
export { NumberValue } from './NumberValue';
+export { PropertyTooltip } from './PropertyTooltip';
export { PropertyValue } from './PropertyValue';
export { PropertyValueIcon } from './PropertyValueIcon';
export { SelectValue } from './SelectValue';
diff --git a/js/app/packages/core/component/Properties/context/PropertiesContext.tsx b/js/app/packages/core/component/Properties/context/PropertiesContext.tsx
index ed2fd7ab49..b94431a9bf 100644
--- a/js/app/packages/core/component/Properties/context/PropertiesContext.tsx
+++ b/js/app/packages/core/component/Properties/context/PropertiesContext.tsx
@@ -86,7 +86,7 @@ export interface PropertiesProviderProps extends ParentProps {
saveHandler: PropertySaveHandler;
}
-const PropertiesContext = createContext<PropertiesContextValue>();
+export const PropertiesContext = createContext<PropertiesContextValue>();
export function PropertiesProvider(props: PropertiesProviderProps) {
// Modal state signals
diff --git a/js/app/packages/core/component/Properties/context/index.ts b/js/app/packages/core/component/Properties/context/index.ts
new file mode 100644
index 0000000000..ee67ecf9ce
--- /dev/null
+++ b/js/app/packages/core/component/Properties/context/index.ts
@@ -0,0 +1,5 @@
+export { PropertiesProvider, usePropertiesContext } from './PropertiesContext';
+export type {
+ PropertiesContextValue,
+ PropertySaveHandler,
+} from './PropertiesContext';
diff --git a/js/app/packages/core/component/Properties/hooks/usePropertyEntityDisplay.tsx b/js/app/packages/core/component/Properties/hooks/usePropertyEntityDisplay.tsx
index 9d31e7cad3..88896145a7 100644
--- a/js/app/packages/core/component/Properties/hooks/usePropertyEntityDisplay.tsx
+++ b/js/app/packages/core/component/Properties/hooks/usePropertyEntityDisplay.tsx
@@ -2,19 +2,18 @@ import { useChannelName } from '@core/component/ChannelsProvider';
import { EntityIcon as CoreEntityIcon } from '@core/component/EntityIcon';
import { UserIcon } from '@core/component/UserIcon';
import { fileTypeToBlockName } from '@core/constant/allBlocks';
-import { isAccessiblePreviewItem, useItemPreview } from '@core/signal/preview';
-import { idToDisplayName } from '@core/user';
-import ChannelBuildingIcon from '@icon/duotone/building-office-duotone.svg';
-import GlobeIcon from '@icon/duotone/globe-duotone.svg';
-import ChannelIcon from '@icon/duotone/hash-duotone.svg';
-import UserDuotoneIcon from '@icon/duotone/user-duotone.svg';
-import ThreeUsersIcon from '@icon/duotone/users-three-duotone.svg';
+import {
+ isAccessiblePreviewItem,
+ type PreviewItem,
+ type PreviewItemAccess,
+ useItemPreview,
+} from '@core/signal/preview';
+import { tryMacroId, useDisplayName } from '@core/user';
import type { EntityType } from '@service-properties/generated/schemas/entityType';
import { type Accessor, createMemo, type JSX } from 'solid-js';
+import { entityTypeToItemType } from '../utils';
+import { match } from 'ts-pattern';
-const ICON_CLASSES = 'size-4 text-ink-muted';
-
-/** Entity types that require preview lookup for name/icon resolution */
const PREVIEWABLE_ENTITY_TYPES: EntityType[] = [
'DOCUMENT',
'TASK',
@@ -22,7 +21,16 @@ const PREVIEWABLE_ENTITY_TYPES: EntityType[] = [
'CHAT',
'CHANNEL',
'THREAD',
-];
+] as const;
+
+type PreviewableEntityType = (typeof PREVIEWABLE_ENTITY_TYPES)[number];
+
+const isPreviewable = (
+ type: EntityType | undefined
+): type is PreviewableEntityType => {
+ if (!type) return false;
+ return PREVIEWABLE_ENTITY_TYPES.includes(type);
+};
type PropertyEntityDisplayResult = {
/** Resolved display name for the entity */
@@ -37,6 +45,13 @@ type PropertyEntityDisplayResult = {
linkParams: Accessor<Record<string, string> | undefined>;
};
+const checkPreviewItem = (item?: PreviewItem): item is PreviewItemAccess => {
+ if (!item) return false;
+ if (!isAccessiblePreviewItem(item)) return false;
+ if (item.loading) return false;
+ return true;
+};
+
/**
* Hook to resolve entity display information (name, icon) for property entity values.
* Handles preview fetching, channel name resolution, and user display names.
@@ -56,188 +71,112 @@ export function usePropertyEntityDisplay(
specificMessageId?: Accessor<string | null | undefined>;
}
): PropertyEntityDisplayResult {
- const needsPreview = () =>
- PREVIEWABLE_ENTITY_TYPES.includes(entityType().toUpperCase() as EntityType);
-
- // Map entity type to preview type
- const getPreviewType = () => {
- const type = entityType().toUpperCase();
- if (type === 'TASK') return 'document';
- if (type === 'THREAD') return 'email';
- return type.toLowerCase() as 'document' | 'project' | 'chat' | 'channel';
+ const previewType = () => entityTypeToItemType(entityType());
+
+ const previewWrapper = () => {
+ const eType = entityType();
+ const pType = previewType();
+ if (isPreviewable(eType)) {
+ return useItemPreview({
+ id: entityId(),
+ type: pType,
+ })[0];
+ }
};
+ const preview = createMemo(() => previewWrapper()?.());
- const [preview] = useItemPreview({
- id: needsPreview() ? entityId() : '',
- type: needsPreview() ? getPreviewType() : undefined,
- });
+ const channelNameWrapper = () => {
+ const eType = entityType();
+ if (eType === 'CHANNEL') {
+ return useChannelName(entityId());
+ }
+ };
+ const channelName = createMemo(() => channelNameWrapper()?.());
- const channelName = useChannelName(
- entityType().toUpperCase() === 'CHANNEL' ? entityId() : '',
- 'Unknown Channel'
- );
+ const userNameWrapper = () => {
+ const eType = entityType();
+ if (eType === 'USER') {
+ return useDisplayName(tryMacroId(entityId()))[0];
+ }
+ };
+ const userName = createMemo(() => userNameWrapper()?.() ?? '');
const isLoading = createMemo(() => {
- if (!needsPreview()) return false;
+ if (!isPreviewable(entityType())) return false;
const previewItem = preview();
return !previewItem || previewItem.loading;
});
- const name = createMemo(() => {
- const type = entityType().toUpperCase();
- switch (type) {
- case 'USER': {
- const displayName = idToDisplayName(entityId());
- return displayName.replace('macro|', '');
- }
- case 'CHANNEL':
- return channelName() ?? 'Unknown Channel';
- case 'DOCUMENT':
- case 'TASK':
- case 'PROJECT':
- case 'CHAT':
- case 'THREAD': {
- const previewItem = preview();
- if (!previewItem || previewItem.loading) return 'Loading...';
- if (!isAccessiblePreviewItem(previewItem)) return 'Unavailable';
- return previewItem.name || `Unknown ${type.toLowerCase()}`;
- }
- case 'COMPANY':
- return entityId() ?? 'Company';
- default:
- return entityId();
- }
- });
-
- const icon = createMemo(() => {
- const type = entityType().toUpperCase();
- switch (type) {
- case 'USER':
- return <UserIcon id={entityId()} size="xs" />;
-
- case 'CHANNEL': {
- const previewItem = preview();
- if (
- !previewItem ||
- previewItem.loading ||
- !isAccessiblePreviewItem(previewItem)
- ) {
- return <ChannelIcon class={ICON_CLASSES} />;
+ const name = createMemo(() =>
+ match(entityType())
+ .with('USER', () => userName())
+ .with('CHANNEL', () => channelName() || 'Channel')
+ .with('COMPANY', () => entityId())
+ .otherwise(() => {
+ const item = preview();
+ if (!item || item.loading) return 'Loading...';
+ if (isAccessiblePreviewItem(item)) {
+ return item.name;
}
+ return `Unknown ${entityType().toLowerCase()}`;
+ })
+ );
- const channelType = previewItem.channelType;
- switch (channelType) {
- case 'direct_message':
- return <UserDuotoneIcon class={ICON_CLASSES} />;
- case 'private':
- return <ThreeUsersIcon class={ICON_CLASSES} />;
- case 'organization':
- return <ChannelBuildingIcon class={ICON_CLASSES} />;
- case 'public':
- return <GlobeIcon class={ICON_CLASSES} />;
- default:
- return <ChannelIcon class={ICON_CLASSES} />;
- }
- }
-
- case 'TASK':
- return <CoreEntityIcon targetType="task" size="xs" />;
-
- case 'DOCUMENT': {
- const previewItem = preview();
- if (
- !previewItem ||
- previewItem.loading ||
- !isAccessiblePreviewItem(previewItem)
- ) {
+ const icon = createMemo(() =>
+ match(entityType())
+ .with('USER', () => <UserIcon id={entityId()} size="xs" />)
+ .with('CHANNEL', () => <CoreEntityIcon targetType="channel" size="xs" />)
+ .with('TASK', () => <CoreEntityIcon targetType="task" size="xs" />)
+ .with('DOCUMENT', () => {
+ const item = preview();
+ if (!checkPreviewItem(item)) {
return <CoreEntityIcon targetType="unknown" size="xs" />;
}
-
- // Tasks are documents with subType 'task'
- if (previewItem.subType?.type === 'task') {
- return <CoreEntityIcon targetType="task" size="xs" />;
- }
-
- const fileType = previewItem.fileType;
- const blockName = fileType
- ? fileTypeToBlockName(fileType, true)
- : 'unknown';
+ const { subType, fileType } = item;
+ const blockName = fileTypeToBlockName(subType?.type ?? fileType, true);
return <CoreEntityIcon targetType={blockName} size="xs" />;
- }
-
- case 'PROJECT':
- return <CoreEntityIcon targetType="project" size="xs" />;
-
- case 'CHAT':
- return <CoreEntityIcon targetType="chat" size="xs" />;
-
- case 'COMPANY':
- return <CoreEntityIcon targetType="company" size="xs" />;
-
- case 'THREAD':
- return <CoreEntityIcon targetType="email" size="xs" />;
-
- default:
+ })
+ .with('PROJECT', () => <CoreEntityIcon targetType="project" size="xs" />)
+ .with('CHAT', () => <CoreEntityIcon targetType="chat" size="xs" />)
+ .with('COMPANY', () => <CoreEntityIcon targetType="company" size="xs" />)
+ .with('THREAD', () => <CoreEntityIcon targetType="email" size="xs" />)
+ .otherwise(() => {
if (options && 'fallbackIcon' in options) {
return options.fallbackIcon;
}
return <CoreEntityIcon targetType="unknown" size="xs" />;
- }
- });
-
- const blockOrFileType = createMemo(() => {
- const type = entityType().toUpperCase();
- // For channels and chats, use the entity type directly (lowercase for BlockLink)
- const linkableTypes: EntityType[] = ['CHANNEL', 'CHAT', 'PROJECT'];
- if (linkableTypes.includes(type as EntityType)) {
- return type.toLowerCase();
- }
-
- // Tasks are aliased as 'task' for routing
- if (type === 'TASK') {
- return 'task';
- }
-
- // Threads route to email block
- if (type === 'THREAD') {
- return 'email';
- }
-
- // For documents, get the file type from preview
- if (type === 'DOCUMENT') {
- const previewItem = preview();
- if (
- !previewItem ||
- previewItem.loading ||
- !isAccessiblePreviewItem(previewItem)
- ) {
- return null;
- }
- // Tasks are documents with subType 'task'
- if (previewItem.subType?.type === 'task') {
- return 'task';
- }
- return previewItem.fileType || null;
- }
+ })
+ );
- return null;
- });
+ const blockOrFileType = createMemo(() =>
+ match(entityType())
+ .with('CHANNEL', () => 'channel')
+ .with('CHAT', () => 'chat')
+ .with('PROJECT', () => 'project')
+ .with('TASK', () => 'task')
+ .with('THREAD', () => 'email')
+ .with('DOCUMENT', () => {
+ const item = preview();
+ if (!checkPreviewItem(item)) {
+ return null;
+ }
+ if (item.subType?.type === 'task') {
+ return 'task';
+ }
+ return item.fileType || null;
+ })
+ .otherwise(() => null)
+ );
const linkParams = createMemo((): Record<string, string> | undefined => {
const messageId = options?.specificMessageId?.();
if (!messageId) return undefined;
- const type = entityType().toUpperCase();
- switch (type) {
- case 'THREAD':
- return { email_message_id: messageId };
- case 'CHANNEL':
- return { channel_message_id: messageId };
- case 'CHAT':
- return { message_id: messageId };
- default:
- return undefined;
- }
+ return match(entityType())
+ .with('THREAD', () => ({ email_message_id: messageId }))
+ .with('CHANNEL', () => ({ channel_message_id: messageId }))
+ .with('CHAT', () => ({ message_id: messageId }))
+ .otherwise(() => undefined);
});
return {
diff --git a/js/app/packages/core/component/Properties/hooks/usePropertySelection.ts b/js/app/packages/core/component/Properties/hooks/usePropertySelection.ts
index 40a4c00fcb..a600e362e8 100644
--- a/js/app/packages/core/component/Properties/hooks/usePropertySelection.ts
+++ b/js/app/packages/core/component/Properties/hooks/usePropertySelection.ts
@@ -1,9 +1,9 @@
import { type Accessor, createMemo, createSignal } from 'solid-js';
-import type { PropertyDefinitionFlat } from '../types';
+import type { PropertyDefinitionDomain } from '../types';
export function usePropertySelection(
existingPropertyIds: () => string[],
- availableProperties: Accessor<PropertyDefinitionFlat[]>,
+ availableProperties: Accessor<PropertyDefinitionDomain[]>,
searchQuery?: () => string
) {
const [selectedPropertyIds, setSelectedPropertyIds] = createSignal<
@@ -24,23 +24,23 @@ export function usePropertySelection(
property.id &&
!existingIds.has(property.id) &&
// COMPANY entity properties not yet implemented
- property.specific_entity_type !== 'COMPANY'
+ property.specificEntityType !== 'COMPANY'
);
// Then apply search filter
if (!query) return filtered;
return filtered.filter((property) => {
- const name = property.display_name.toLowerCase();
+ const name = property.displayName.toLowerCase();
if (name.includes(query)) {
return true;
}
- const dataType = property.data_type;
+ const dataType = property.valueType;
let typeDisplay = dataType;
- if (dataType === 'ENTITY' && property.specific_entity_type) {
- typeDisplay += ` ${property.specific_entity_type}`;
+ if (dataType === 'ENTITY' && property.specificEntityType) {
+ typeDisplay += ` ${property.specificEntityType}`;
}
return typeDisplay.toLowerCase().includes(query);
diff --git a/js/app/packages/core/component/Properties/types.ts b/js/app/packages/core/component/Properties/types.ts
index 3480f6d96a..256db39b68 100644
--- a/js/app/packages/core/component/Properties/types.ts
+++ b/js/app/packages/core/component/Properties/types.ts
@@ -66,48 +66,57 @@ export type Property = {
| { valueType: 'LINK'; value: string[] | null }
);
+type PropertyOfType<T extends ValueType> = Extract<Property, { valueType: T }>;
+
+export type StringProperty = PropertyOfType<'STRING'>;
+export type NumberProperty = PropertyOfType<'NUMBER'>;
+export type BooleanProperty = PropertyOfType<'BOOLEAN'>;
+export type DateProperty = PropertyOfType<'DATE'>;
+export type SelectStringProperty = PropertyOfType<'SELECT_STRING'>;
+export type SelectNumberProperty = PropertyOfType<'SELECT_NUMBER'>;
+export type EntityProperty = PropertyOfType<'ENTITY'>;
+export type LinkProperty = PropertyOfType<'LINK'>;
+
+/** Properties that hold a single primitive value */
+export type SingleValueProperty =
+ | StringProperty
+ | NumberProperty
+ | BooleanProperty
+ | DateProperty;
+
+/** Properties that hold multiple values (arrays) */
+export type MultiValueProperty =
+ | SelectStringProperty
+ | SelectNumberProperty
+ | EntityProperty
+ | LinkProperty;
+
+export type SelectProperty = SelectStringProperty | SelectNumberProperty;
+
/**
- * Flat property definition type (when include_options is false)
- * Used for property selection and display
+ * Domain type for property definitions (camelCase, frontend-friendly)
+ *
+ * This is the UI layer representation of a property definition.
+ * Use `toPropertyDefinitionDomain` to transform from API types.
+ *
+ * Note: Uses `valueType` to match the `Property` type, enabling shared
+ * components like `PropertyDataTypeIcon` to work with both types.
*
- * Note: Uses backend UPPERCASE enum values for data_type and specific_entity_type
+ * @see PropertyDefinition - Generated API type (snake_case)
+ * @see Property - Domain type for property instances with values
*/
-export type PropertyDefinitionFlat = {
- created_at: string;
- data_type:
- | 'BOOLEAN'
- | 'DATE'
- | 'NUMBER'
- | 'STRING'
- | 'SELECT_NUMBER'
- | 'SELECT_STRING'
- | 'ENTITY'
- | 'LINK';
- display_name: string;
+export type PropertyDefinitionDomain = {
id: string;
- is_metadata: boolean;
- is_multi_select: boolean;
- is_system: boolean;
- owner:
- | {
- scope: 'user';
- user_id: string;
- }
- | {
- scope: 'organization';
- organization_id: number;
- }
- | {
- scope: 'user_and_organization';
- user_id: string;
- organization_id: number;
- }
- | {
- scope: 'system';
- };
- propertyOptions?: PropertyOption[];
- specific_entity_type?: EntityType | null;
- updated_at: string;
+ displayName: string;
+ valueType: ValueType;
+ isMultiSelect: boolean;
+ isMetadata: boolean;
+ isSystem: boolean;
+ owner: PropertyOwner;
+ specificEntityType?: EntityType | null;
+ options?: PropertyOption[];
+ createdAt: string;
+ updatedAt: string;
};
export type PropertiesPanelProps = {
diff --git a/js/app/packages/core/component/Properties/utils/PropertyDataTypeIcon.tsx b/js/app/packages/core/component/Properties/utils/PropertyDataTypeIcon.tsx
index 5fdb2e75b4..66c1ee40ea 100644
--- a/js/app/packages/core/component/Properties/utils/PropertyDataTypeIcon.tsx
+++ b/js/app/packages/core/component/Properties/utils/PropertyDataTypeIcon.tsx
@@ -14,59 +14,49 @@ import PencilIcon from '@icon/regular/pencil.svg';
import SimpleTagIcon from '@icon/regular/tag-simple.svg';
import UserCircleIcon from '@icon/regular/user-circle.svg';
import type { Component } from 'solid-js';
-import type { PropertyDefinitionFlat } from '../types';
+import type { Property } from '../types';
+import { match } from 'ts-pattern';
+import { twMerge } from 'tailwind-merge';
+import { Dynamic } from 'solid-js/web';
-type PropertyDataTypeIconProps = {
- property: Pick<PropertyDefinitionFlat, 'data_type' | 'specific_entity_type'>;
+export const EntityDataTypeIcon: Component<{
+ property: Pick<Property, 'specificEntityType'>;
class?: string;
-};
-
-export const PropertyDataTypeIcon: Component<PropertyDataTypeIconProps> = (
- props
-) => {
- const dataTypeLower = props.property.data_type.toLowerCase();
- const iconClasses = props.class ?? 'size-4 text-ink-muted';
+}> = (props) => {
+ const iconClass = () => twMerge('size-4 text-ink-muted', props.class);
+ const icon = () =>
+ match(props.property.specificEntityType)
+ .with('USER', () => UserCircleIcon)
+ .with('DOCUMENT', () => FileIcon)
+ .with('PROJECT', () => FolderIcon)
+ .with('CHAT', () => ChatIcon)
+ .with('CHANNEL', () => HashIcon)
+ .with('COMPANY', () => CompanyIcon)
+ .with('THREAD', () => ThreadIcon)
+ .with('TASK', () => TaskIcon)
+ .otherwise(() => SimpleTagIcon);
- if (dataTypeLower === 'entity') {
- const specificType = props.property.specific_entity_type?.toUpperCase();
+ return <Dynamic component={icon()} class={iconClass()} />;
+};
- switch (specificType) {
- case 'USER':
- return <UserCircleIcon class={iconClasses} />;
- case 'DOCUMENT':
- return <FileIcon class={iconClasses} />;
- case 'PROJECT':
- return <FolderIcon class={iconClasses} />;
- case 'CHAT':
- return <ChatIcon class={iconClasses} />;
- case 'CHANNEL':
- return <HashIcon class={iconClasses} />;
- case 'COMPANY':
- return <CompanyIcon class={iconClasses} />;
- case 'THREAD':
- return <ThreadIcon class={iconClasses} />;
- case 'TASK':
- return <TaskIcon class={iconClasses} />;
- default:
- return <SimpleTagIcon class={iconClasses} />;
- }
- }
+export const PropertyDataTypeIcon: Component<{
+ property: Pick<Property, 'valueType' | 'specificEntityType'>;
+ class?: string;
+}> = (props) => {
+ const iconClass = () => twMerge('size-4 text-ink-muted', props.class);
+ const icon = () =>
+ match(props.property.valueType)
+ .with('ENTITY', () => () => (
+ <EntityDataTypeIcon property={props.property} class={props.class} />
+ ))
+ .with('STRING', () => PencilIcon)
+ .with('NUMBER', () => CalculatorIcon)
+ .with('BOOLEAN', () => CheckSquareIcon)
+ .with('DATE', () => CalendarBlankIcon)
+ .with('LINK', () => LinkIcon)
+ .with('SELECT_STRING', () => ListBulletIcon)
+ .with('SELECT_NUMBER', () => ListBulletIcon)
+ .otherwise(() => SimpleTagIcon);
- switch (dataTypeLower) {
- case 'string':
- return <PencilIcon class={iconClasses} />;
- case 'number':
- return <CalculatorIcon class={iconClasses} />;
- case 'boolean':
- return <CheckSquareIcon class={iconClasses} />;
- case 'date':
- return <CalendarBlankIcon class={iconClasses} />;
- case 'link':
- return <LinkIcon class={iconClasses} />;
- case 'select_string':
- case 'select_number':
- return <ListBulletIcon class={iconClasses} />;
- default:
- return null;
- }
+ return <Dynamic component={icon()} class={iconClass()} />;
};
diff --git a/js/app/packages/core/component/Properties/utils/entityConversion.ts b/js/app/packages/core/component/Properties/utils/entityConversion.ts
index cadb6d8ac7..4054a59df7 100644
--- a/js/app/packages/core/component/Properties/utils/entityConversion.ts
+++ b/js/app/packages/core/component/Properties/utils/entityConversion.ts
@@ -1,4 +1,7 @@
import type { EntityReference } from '@service-properties/generated/schemas/entityReference';
+import type { EntityType } from '@service-properties/generated/schemas/entityType';
+import type { ItemType } from '@service-storage/client';
+import { match } from 'ts-pattern';
/**
* Converts EntityReference[] to Set of entity IDs for compatibility with EntityInput
@@ -43,3 +46,16 @@ export function updateEntityReferences(
return updatedRefs;
}
+
+export function entityTypeToItemType(type: EntityType): ItemType | undefined {
+ return match(type)
+ .with('TASK', () => 'document' as ItemType)
+ .with('DOCUMENT', () => 'document' as ItemType)
+ .with('PROJECT', () => 'project' as ItemType)
+ .with('CHANNEL', () => 'channel' as ItemType)
+ .with('CHAT', () => 'chat' as ItemType)
+ .with('COMPANY', () => undefined) // huh
+ .with('USER', () => undefined) // huh
+ .with('THREAD', () => 'email' as ItemType)
+ .exhaustive();
+}
diff --git a/js/app/packages/core/component/Properties/utils/index.ts b/js/app/packages/core/component/Properties/utils/index.ts
index 614eb414e6..551b9c9614 100644
--- a/js/app/packages/core/component/Properties/utils/index.ts
+++ b/js/app/packages/core/component/Properties/utils/index.ts
@@ -10,5 +10,6 @@ export * from './formatting';
export { PropertyDataTypeIcon } from './PropertyDataTypeIcon';
export * from './position';
export * from './suggestedProperties';
+export * from './transforms';
export * from './typeGuards';
export * from './validation';
diff --git a/js/app/packages/core/component/Properties/utils/suggestedProperties.ts b/js/app/packages/core/component/Properties/utils/suggestedProperties.ts
index 663b71b2be..5050142f88 100644
--- a/js/app/packages/core/component/Properties/utils/suggestedProperties.ts
+++ b/js/app/packages/core/component/Properties/utils/suggestedProperties.ts
@@ -1,5 +1,5 @@
import type { ExpandedEntityType } from '@macro-entity';
-import type { PropertyDefinitionFlat } from '../types';
+import type { PropertyDefinitionDomain } from '../types';
/**
* Get suggested properties for a given entity type filter.
@@ -8,10 +8,10 @@ import type { PropertyDefinitionFlat } from '../types';
* TODO: Add scoring system to dynamically select best properties
*
* @param entityTypes - Array of entity types from the filter (e.g., ['document', 'chat'])
- * @returns Array of PropertyDefinitionFlat objects for quick selection
+ * @returns Array of PropertyDefinitionDomain objects for quick selection
*/
export function getSuggestedProperties(
_entityTypes: ExpandedEntityType[]
-): PropertyDefinitionFlat[] {
+): PropertyDefinitionDomain[] {
return [];
}
diff --git a/js/app/packages/core/component/Properties/utils/transforms.ts b/js/app/packages/core/component/Properties/utils/transforms.ts
new file mode 100644
index 0000000000..4b59e9dbb7
--- /dev/null
+++ b/js/app/packages/core/component/Properties/utils/transforms.ts
@@ -0,0 +1,32 @@
+import type { PropertyDefinition } from '@service-properties/generated/schemas/propertyDefinition';
+import type { PropertyOption } from '@service-properties/generated/schemas/propertyOption';
+import type { PropertyDefinitionDomain, ValueType } from '../types';
+
+/**
+ * Transforms a backend PropertyDefinition (snake_case) to the frontend
+ * PropertyDefinitionDomain (camelCase).
+ *
+ * Use this at the boundary between API responses and UI components.
+ *
+ * @param definition - The API property definition
+ * @param options - Optional property options (from PropertyDefinitionWithOptions)
+ * @returns The domain representation for UI consumption
+ */
+export function toPropertyDefinitionDomain(
+ definition: PropertyDefinition,
+ options?: PropertyOption[]
+): PropertyDefinitionDomain {
+ return {
+ id: definition.id,
+ displayName: definition.display_name,
+ valueType: definition.data_type as ValueType,
+ isMultiSelect: definition.is_multi_select,
+ isMetadata: definition.is_metadata,
+ isSystem: definition.is_system,
+ owner: definition.owner,
+ specificEntityType: definition.specific_entity_type,
+ options,
+ createdAt: definition.created_at,
+ updatedAt: definition.updated_at,
+ };
+}
diff --git a/js/app/packages/core/component/Properties/utils/typeGuards.ts b/js/app/packages/core/component/Properties/utils/typeGuards.ts
index bb89548095..4e374bc9dd 100644
--- a/js/app/packages/core/component/Properties/utils/typeGuards.ts
+++ b/js/app/packages/core/component/Properties/utils/typeGuards.ts
@@ -1,42 +1,127 @@
import type { EntityReference } from '@service-properties/generated/schemas/entityReference';
import type { PropertyDefinition } from '@service-properties/generated/schemas/propertyDefinition';
import type { PropertyDefinitionResponse } from '@service-properties/generated/schemas/propertyDefinitionResponse';
-import type { Property } from '../types';
+import type {
+ BooleanProperty,
+ DateProperty,
+ EntityProperty,
+ LinkProperty,
+ MultiValueProperty,
+ NumberProperty,
+ Property,
+ SelectNumberProperty,
+ SelectProperty,
+ SelectStringProperty,
+ SingleValueProperty,
+ StringProperty,
+} from '../types';
-/**
- * Type guard to check if property is a LINK type
- */
-export function isLinkProperty(
+export const isStringProperty = (
property: Property
-): property is Property & { valueType: 'LINK'; value: string[] | null } {
- return property.valueType === 'LINK';
-}
+): property is StringProperty => {
+ return property.valueType === 'STRING';
+};
-/**
- * Type guard to check if property is a SELECT_STRING or SELECT_NUMBER type
- */
-export function isSelectProperty(
+export const isNumberProperty = (
+ property: Property
+): property is NumberProperty => {
+ return property.valueType === 'NUMBER';
+};
+
+export const isBooleanProperty = (
+ property: Property
+): property is BooleanProperty => {
+ return property.valueType === 'BOOLEAN';
+};
+
+export const isDateProperty = (
+ property: Property
+): property is DateProperty => {
+ return property.valueType === 'DATE';
+};
+
+export const isSelectStringProperty = (
property: Property
-): property is Property &
- (
- | { valueType: 'SELECT_STRING'; value: string[] | null }
- | { valueType: 'SELECT_NUMBER'; value: string[] | null }
- ) {
+): property is SelectStringProperty => {
+ return property.valueType === 'SELECT_STRING';
+};
+
+export const isSelectNumberProperty = (
+ property: Property
+): property is SelectNumberProperty => {
+ return property.valueType === 'SELECT_NUMBER';
+};
+
+export const isSelectProperty = (
+ property: Property
+): property is SelectProperty => {
return (
property.valueType === 'SELECT_STRING' ||
property.valueType === 'SELECT_NUMBER'
);
-}
+};
-/**
- * Type guard to check if property is an ENTITY type
- */
-export function isEntityProperty(property: Property): property is Property & {
- valueType: 'ENTITY';
- value: EntityReference[] | null;
-} {
+export const isEntityProperty = (
+ property: Property
+): property is EntityProperty => {
return property.valueType === 'ENTITY';
-}
+};
+
+export const isLinkProperty = (
+ property: Property
+): property is LinkProperty => {
+ return property.valueType === 'LINK';
+};
+
+export const isSingleValueProperty = (
+ property: Property
+): property is SingleValueProperty => {
+ return (
+ property.valueType === 'STRING' ||
+ property.valueType === 'NUMBER' ||
+ property.valueType === 'BOOLEAN' ||
+ property.valueType === 'DATE'
+ );
+};
+
+export const isMultiValueProperty = (
+ property: Property
+): property is MultiValueProperty => {
+ return (
+ property.valueType === 'SELECT_STRING' ||
+ property.valueType === 'SELECT_NUMBER' ||
+ property.valueType === 'ENTITY' ||
+ property.valueType === 'LINK'
+ );
+};
+
+export const getStringValue = (property: StringProperty): string | null => {
+ return property.value;
+};
+
+export const getNumberValue = (property: NumberProperty): number | null => {
+ return property.value;
+};
+
+export const getBooleanValue = (property: BooleanProperty): boolean | null => {
+ return property.value;
+};
+
+export const getDateValue = (property: DateProperty): Date | null => {
+ return property.value;
+};
+
+export const getSelectStringValues = (
+ property: SelectStringProperty
+): string[] | null => {
+ return property.value;
+};
+
+export const getSelectNumberValues = (
+ property: SelectNumberProperty
+): string[] | null => {
+ return property.value;
+};
/**
* Safely extract link values from a property
@@ -106,3 +191,23 @@ export function isPropertyDefinition(
): p is PropertyDefinition {
return !('definition' in p);
}
+
+export const hasValue = (property: Property): boolean => {
+ if (property.value === null) {
+ return false;
+ }
+
+ if (Array.isArray(property.value)) {
+ return property.value.length > 0;
+ }
+
+ return true;
+};
+
+export const hasSingleValue = (property: MultiValueProperty): boolean => {
+ return property.value !== null && property.value.length === 1;
+};
+
+export const hasMultiValue = (property: MultiValueProperty): boolean => {
+ return property.value !== null && property.value.length > 1;
+};
diff --git a/js/app/packages/macro-entity/src/components/EntityPropertyValues.tsx b/js/app/packages/macro-entity/src/components/EntityPropertyValues.tsx
new file mode 100644
index 0000000000..9f3e3823d2
--- /dev/null
+++ b/js/app/packages/macro-entity/src/components/EntityPropertyValues.tsx
@@ -0,0 +1,107 @@
+import { PropertyValue } from '@core/component/Properties/component/propertyValue/PropertyValue';
+import {
+ PropertiesProvider,
+ type PropertySaveHandler,
+} from '@core/component/Properties/context/PropertiesContext';
+import { Modals } from '@core/component/Properties/component/modal';
+import type {
+ Property,
+ PropertyApiValues,
+} from '@core/component/Properties/types';
+import { SYSTEM_PROPERTY_IDS } from '@core/component/Properties/constants';
+import type { EntityType } from '@service-properties/generated/schemas/entityType';
+import { For, Show, createMemo } from 'solid-js';
+import { useSaveEntityPropertyMutation } from '@queries/properties/entity';
+
+const PROPERTY_SORT_ORDER = [
+ SYSTEM_PROPERTY_IDS.STATUS,
+ SYSTEM_PROPERTY_IDS.PRIORITY,
+ SYSTEM_PROPERTY_IDS.ASSIGNEES,
+] as const;
+
+function sortProperties(properties: Property[]): Property[] {
+ return [...properties].sort((a, b) => {
+ const aIndex = PROPERTY_SORT_ORDER.indexOf(
+ a.propertyDefinitionId as (typeof PROPERTY_SORT_ORDER)[number]
+ );
+ const bIndex = PROPERTY_SORT_ORDER.indexOf(
+ b.propertyDefinitionId as (typeof PROPERTY_SORT_ORDER)[number]
+ );
+
+ if (aIndex !== -1 && bIndex !== -1) {
+ return aIndex - bIndex;
+ }
+ if (aIndex !== -1) {
+ return -1;
+ }
+ if (bIndex !== -1) {
+ return 1;
+ }
+ return 0;
+ });
+}
+
+type EntityPropertyValuesProps = {
+ properties: Property[];
+ entityId: string;
+ entityType: EntityType;
+ excludeKeyProperties?: boolean;
+ maxDisplay?: number;
+ onRefresh?: () => void;
+};
+
+const MAX_DEFAULT_DISPLAY = 4;
+
+export const EntityPropertyValues = (props: EntityPropertyValuesProps) => {
+ const displayProperties = createMemo(() => {
+ const sorted = sortProperties(props.properties);
+ return sorted.slice(0, props.maxDisplay ?? MAX_DEFAULT_DISPLAY);
+ });
+
+ const saveMutation = useSaveEntityPropertyMutation();
+
+ const saveHandler: PropertySaveHandler = {
+ saveProperty: (property: Property, value: PropertyApiValues) =>
+ saveMutation.mutateAsync({
+ entityId: props.entityId,
+ entityType: props.entityType,
+ property,
+ apiValues: value,
+ }),
+ saveDate: (property: Property, date: Date) =>
+ saveMutation.mutateAsync({
+ entityId: props.entityId,
+ entityType: props.entityType,
+ property,
+ apiValues: {
+ valueType: 'DATE',
+ value: date.toISOString(),
+ },
+ }),
+ };
+
+ return (
+ <Show when={props.properties.length > 0}>
+ <PropertiesProvider
+ entityType={props.entityType}
+ canEdit={true}
+ properties={displayProperties}
+ onRefresh={() => {}}
+ onPropertyAdded={() => {}}
+ onPropertyDeleted={() => {}}
+ saveHandler={saveHandler}
+ >
+ <div class="flex items-center gap-1 justify-start overflow-hidden">
+ <For each={displayProperties()}>
+ {(property) => (
+ <div class="relative">
+ <PropertyValue property={property} condensed />
+ </div>
+ )}
+ </For>
+ </div>
+ <Modals />
+ </PropertiesProvider>
+ </Show>
+ );
+};
diff --git a/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx b/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx
index d1a4424f26..be997ee2a6 100644
--- a/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx
+++ b/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx
@@ -48,7 +48,7 @@ import type {
SearchLocation,
WithSearch,
} from '../types/search';
-import { KeyPropertiesGrid, PropertyPills } from './PropertyPills';
+import { EntityPropertyValues } from './EntityPropertyValues';
export type EntityClickEvent = Parameters<
JSX.EventHandler<HTMLDivElement, MouseEvent>
@@ -1064,7 +1064,11 @@ export function EntityWithEverything(
</div>
<EntityTitle />
<Show when={isTaskEntity(props.entity) && properties().length > 0}>
- <KeyPropertiesGrid properties={properties()} />
+ <EntityPropertyValues
+ properties={properties()}
+ entityId={props.entity.id}
+ entityType="TASK"
+ />
</Show>
</div>
{/* Date and user - top right on mobile, end on desktop */}
@@ -1075,14 +1079,6 @@ export function EntityWithEverything(
}}
>
<div class="flex flex-row items-center justify-end gap-2 min-w-0 @max-md/uList:justify-start @max-md/uList:flex-wrap">
- <Show when={properties().length > 0}>
- <div class="pr-2 overflow-hidden shrink min-w-0">
- <PropertyPills
- properties={properties()}
- excludeKeyProperties={isTaskEntity(props.entity)}
- />
- </div>
- </Show>
<Show when={sharedData()}>
{(shared) => (
<Tooltip
diff --git a/js/app/packages/macro-entity/src/components/PropertyPills/BooleanPropertyPill.tsx b/js/app/packages/macro-entity/src/components/PropertyPills/BooleanPropertyPill.tsx
deleted file mode 100644
index 824975eb1c..0000000000
--- a/js/app/packages/macro-entity/src/components/PropertyPills/BooleanPropertyPill.tsx
+++ /dev/null
@@ -1,66 +0,0 @@
-import type { Property } from '@core/component/Properties/types';
-import { PropertyDataTypeIcon } from '@core/component/Properties/utils';
-import { Tooltip } from '@core/component/Tooltip';
-
-import { PropertyPillTooltip } from './PropertyPillTooltip';
-
-type BooleanPropertyPillProps = {
- property: Property & { valueType: 'BOOLEAN' };
- compressed?: boolean;
-};
-
-/**
- * Pill for boolean properties
- * Only shows when value is true (false = no pill displayed)
- */
-export const BooleanPropertyPill = (props: BooleanPropertyPillProps) => {
- // Don't show pill for false or null values
- if (!props.property.value) return null;
-
- return (
- <Tooltip
- tooltip={<BooleanTooltipContent property={props.property} />}
- floatingOptions={{
- offset: 4,
- flip: true,
- shift: { padding: 8 },
- }}
- >
- <div
- class="inline-flex items-center gap-1.5 text-xs leading-none text-ink-muted border border-edge-muted h-fit p-1.5"
- classList={{
- '@3xl/soup:px-2 @3xl/soup:py-1': !props.compressed,
- }}
- >
- <PropertyDataTypeIcon
- property={{
- data_type: 'BOOLEAN',
- }}
- class="size-3.5 shrink-0"
- />
- <span
- class="truncate max-w-[120px] hidden"
- classList={{
- '@3xl/soup:inline': !props.compressed,
- }}
- >
- {props.property.displayName}
- </span>
- </div>
- </Tooltip>
- );
-};
-
-const BooleanTooltipContent = (props: {
- property: Property & { valueType: 'BOOLEAN' };
-}) => {
- return (
- <PropertyPillTooltip property={props.property}>
- <div class="flex items-center gap-1.5 flex-wrap">
- <div class="inline-flex items-center px-2 py-1 text-xs leading-none text-ink-muted border border-edge-muted h-fit w-fit">
- <span>True</span>
- </div>
- </div>
- </PropertyPillTooltip>
- );
-};
diff --git a/js/app/packages/macro-entity/src/components/PropertyPills/EntityPropertyPill.tsx b/js/app/packages/macro-entity/src/components/PropertyPills/EntityPropertyPill.tsx
deleted file mode 100644
index a8ce60d77a..0000000000
--- a/js/app/packages/macro-entity/src/components/PropertyPills/EntityPropertyPill.tsx
+++ /dev/null
@@ -1,305 +0,0 @@
-import { usePropertyEntityDisplay } from '@core/component/Properties/hooks';
-import type { Property } from '@core/component/Properties/types';
-import { PropertyDataTypeIcon } from '@core/component/Properties/utils';
-import { Tooltip } from '@core/component/Tooltip';
-import { UserIcon } from '@core/component/UserIcon';
-import type { EntityReference } from '@service-properties/generated/schemas/entityReference';
-import type { EntityType } from '@service-properties/generated/schemas/entityType';
-import { createMemo, For, Show } from 'solid-js';
-import { PropertyPillTooltip } from './PropertyPillTooltip';
-
-type EntityPropertyPillProps = {
- property: Property & { valueType: 'ENTITY' };
- compressed?: boolean;
-};
-
-/**
- * Pill for entity properties
- * Single value: shows entity name directly with tooltip
- * Multi value: shows "Property Name (N)" with tooltip
- */
-export const EntityPropertyPill = (props: EntityPropertyPillProps) => {
- const entities = () => props.property.value ?? [];
- const count = () => entities().length;
-
- if (count() === 0) return null;
-
- // Show user avatars for multiselect user entity properties
- if (props.property.specificEntityType === 'USER') {
- return (
- <UserEntityPill
- property={props.property}
- entities={entities()}
- compressed={props.compressed}
- />
- );
- }
-
- // Single entity - show name directly in pill
- if (count() === 1) {
- return (
- <SingleEntityPill
- property={props.property}
- entity={entities()[0]}
- compressed={props.compressed}
- />
- );
- }
-
- // Multiple entities - show count with tooltip
- return (
- <MultiEntityPill
- property={props.property}
- entities={entities()}
- compressed={props.compressed}
- />
- );
-};
-
-type SingleEntityPillProps = {
- property: Property & { valueType: 'ENTITY' };
- entity: EntityReference;
- compressed?: boolean;
-};
-
-const SingleEntityPill = (props: SingleEntityPillProps) => {
- const { name, icon } = usePropertyEntityDisplay(
- () => props.entity.entity_id,
- () => props.entity.entity_type as EntityType,
- {
- fallbackIcon: (
- <PropertyDataTypeIcon
- property={{
- data_type: 'ENTITY',
- specific_entity_type: props.property.specificEntityType,
- }}
- />
- ),
- }
- );
-
- return (
- <Tooltip
- unstyled
- tooltip={
- <SingleEntityTooltipContent
- property={props.property}
- entity={props.entity}
- />
- }
- floatingOptions={{
- offset: 4,
- flip: true,
- shift: { padding: 8 },
- }}
- >
- <div
- class="inline-flex items-center gap-1.5 text-xs leading-none text-ink-muted border border-edge-muted h-fit p-1.5"
- classList={{
- '@3xl/soup:px-2 @3xl/soup:py-1': !props.compressed,
- }}
- >
- <Show when={icon()}>{icon()}</Show>
- <span
- class="truncate max-w-[120px] hidden"
- classList={{
- '@3xl/soup:inline': !props.compressed,
- }}
- >
- {name()}
- </span>
- </div>
- </Tooltip>
- );
-};
-
-type SingleEntityTooltipContentProps = {
- property: Property & { valueType: 'ENTITY' };
- entity: EntityReference;
-};
-
-const SingleEntityTooltipContent = (props: SingleEntityTooltipContentProps) => {
- return (
- <PropertyPillTooltip property={props.property}>
- <div class="flex items-center gap-1.5 flex-wrap">
- <EntityValuePill entity={props.entity} />
- </div>
- </PropertyPillTooltip>
- );
-};
-
-type MultiEntityPillProps = {
- property: Property & { valueType: 'ENTITY' };
- entities: EntityReference[];
- compressed?: boolean;
-};
-
-const MultiEntityPill = (props: MultiEntityPillProps) => {
- return (
- <Tooltip
- unstyled
- tooltip={
- <EntityTooltipContent
- property={props.property}
- entities={props.entities}
- />
- }
- floatingOptions={{
- offset: 4,
- flip: true,
- shift: { padding: 8 },
- }}
- >
- <div
- class="inline-flex items-center gap-1.5 text-xs leading-none text-ink-muted border border-edge-muted h-fit p-1.5"
- classList={{
- '@3xl/soup:px-2 @3xl/soup:py-1': !props.compressed,
- }}
- >
- <PropertyDataTypeIcon
- property={{
- data_type: 'ENTITY',
- specific_entity_type: props.property.specificEntityType,
- }}
- class="size-3.5 shrink-0"
- />
- <span
- class="truncate max-w-[120px] hidden"
- classList={{
- '@3xl/soup:inline': !props.compressed,
- }}
- >
- {props.property.displayName} ({props.entities.length})
- </span>
- </div>
- </Tooltip>
- );
-};
-
-type EntityTooltipContentProps = {
- property: Property & { valueType: 'ENTITY' };
- entities: EntityReference[];
-};
-
-const EntityTooltipContent = (props: EntityTooltipContentProps) => {
- return (
- <PropertyPillTooltip property={props.property}>
- <div class="flex items-center gap-1.5 flex-wrap">
- <For each={props.entities}>
- {(entity) => <EntityValuePill entity={entity} />}
- </For>
- </div>
- </PropertyPillTooltip>
- );
-};
-
-type EntityValuePillProps = {
- entity: EntityReference;
-};
-
-const EntityValuePill = (props: EntityValuePillProps) => {
- const { name, icon } = usePropertyEntityDisplay(
- () => props.entity.entity_id,
- () => props.entity.entity_type as EntityType,
- { fallbackIcon: null }
- );
-
- return (
- <div class="inline-flex items-center gap-1.5 px-2 py-1 text-xs leading-none text-ink-muted border border-edge-muted h-fit w-fit">
- <Show when={icon()}>{icon()}</Show>
- <span class="truncate max-w-[150px]">{name()}</span>
- </div>
- );
-};
-
-const MAX_USER_AVATARS = 3;
-
-type UserEntityPillProps = {
- property: Property & { valueType: 'ENTITY' };
- entities: EntityReference[];
- compressed?: boolean;
-};
-
-/**
- * Pill for multiselect user entity properties that shows user avatars in LiveIndicators style
- */
-const UserEntityPill = (props: UserEntityPillProps) => {
- const remaining = createMemo(() => {
- if (props.entities.length <= MAX_USER_AVATARS) return undefined;
- return props.entities.length - MAX_USER_AVATARS;
- });
-
- const displayEntities = () => props.entities.slice(0, MAX_USER_AVATARS);
-
- return (
- <Tooltip
- unstyled
- tooltip={
- <UserEntityTooltipContent
- property={props.property}
- entities={props.entities}
- />
- }
- floatingOptions={{
- offset: 4,
- flip: true,
- shift: { padding: 8 },
- }}
- >
- <div class="flex items-center h-fit shrink-0 overflow-hidden w-fit isolate pr-2">
- <For each={displayEntities()}>
- {(entity) => (
- <div class="bg-panel rounded-full p-[2px] -mr-2">
- <UserIcon id={entity.entity_id} isDeleted={false} size="xs" />
- </div>
- )}
- </For>
- <Show when={remaining()}>
- <div class="z-4">
- <div class="size-6 bg-menu border-2 text-[10px] -mr-2 border-panel rounded-full flex flex-col justify-center items-center">
- <span>+{remaining()}</span>
- </div>
- </div>
- </Show>
- </div>
- </Tooltip>
- );
-};
-
-type UserEntityTooltipContentProps = {
- property: Property & { valueType: 'ENTITY' };
- entities: EntityReference[];
-};
-
-const UserEntityTooltipContent = (props: UserEntityTooltipContentProps) => {
- return (
- <PropertyPillTooltip property={props.property}>
- <div class="flex flex-col gap-1.5">
- <For each={props.entities}>
- {(entity) => <UserEntityTooltipItem entity={entity} />}
- </For>
- </div>
- </PropertyPillTooltip>
- );
-};
-
-type UserEntityTooltipItemProps = {
- entity: EntityReference;
-};
-
-const UserEntityTooltipItem = (props: UserEntityTooltipItemProps) => {
- const { name } = usePropertyEntityDisplay(
- () => props.entity.entity_id,
- () => props.entity.entity_type as EntityType,
- { fallbackIcon: null }
- );
-
- return (
- <div class="inline-flex items-center gap-1.5 px-2 py-1 text-xs leading-none text-ink-muted border border-edge-muted h-fit w-fit">
- <div class="size-4 rounded-full overflow-hidden shrink-0">
- <UserIcon id={props.entity.entity_id} isDeleted={false} size="fill" />
- </div>
- <span class="truncate max-w-[150px]">{name()}</span>
- </div>
- );
-};
diff --git a/js/app/packages/macro-entity/src/components/PropertyPills/KeyPropertiesGrid.tsx b/js/app/packages/macro-entity/src/components/PropertyPills/KeyPropertiesGrid.tsx
deleted file mode 100644
index 704f60c4d7..0000000000
--- a/js/app/packages/macro-entity/src/components/PropertyPills/KeyPropertiesGrid.tsx
+++ /dev/null
@@ -1,90 +0,0 @@
-import { SYSTEM_PROPERTY_IDS } from '@core/component/Properties/constants';
-import type { Property } from '@core/component/Properties/types';
-import { Tooltip } from '@core/component/Tooltip';
-import CircleDashed from '@icon/regular/circle-dashed.svg';
-
-import { createMemo, For, Show } from 'solid-js';
-import { PropertyPills } from './PropertyPills';
-
-type KeyPropertiesGridProps = {
- properties: Property[];
-};
-
-const KEY_PROPERTY_ORDER = [
- SYSTEM_PROPERTY_IDS.STATUS,
- SYSTEM_PROPERTY_IDS.PRIORITY,
- SYSTEM_PROPERTY_IDS.ASSIGNEES,
-];
-
-/**
- * Grid layout for key task properties: Status, Priority, Assignees
- * Always shows 3 cells in a row, empty cells when property is not present
- * Uses regular PropertyPills with compressed=true for consistency
- */
-export const KeyPropertiesGrid = (props: KeyPropertiesGridProps) => {
- const keyProperties = createMemo(() => {
- const propertyMap = new Map<string, Property>();
- for (const property of props.properties) {
- propertyMap.set(property.propertyDefinitionId, property);
- }
-
- return KEY_PROPERTY_ORDER.map((id) => propertyMap.get(id) || null);
- });
-
- return (
- <div class="grid grid-cols-[1fr_1fr_4fr] gap-2 w-fit">
- <For each={keyProperties()}>
- {(property, index) => (
- <div
- class="h-6 flex items-center"
- classList={{
- 'w-6 justify-center': index() < 2, // Status and Priority get fixed width, centered
- 'min-w-6 justify-start': index() === 2, // Assignees get flexible width, left aligned
- }}
- >
- <Show when={property}>
- {(prop) =>
- prop().value === null ? (
- <PlaceholderPill property={prop()} index={index()} />
- ) : (
- <PropertyPills properties={[prop()]} compressed={true} />
- )
- }
- </Show>
- </div>
- )}
- </For>
- </div>
- );
-};
-
-type PlaceholderPillProps = {
- property: Property;
- index: number;
-};
-
-const PlaceholderPill = (props: PlaceholderPillProps) => {
- return (
- <Tooltip
- unstyled
- tooltip={
- <div class="bg-panel border border-edge-muted text-xs text-ink-muted p-2">{`No ${props.property.displayName.toLowerCase()} set`}</div>
- }
- floatingOptions={{
- offset: 4,
- flip: true,
- shift: { padding: 8 },
- }}
- >
- <div
- class="inline-flex items-center justify-center text-xs leading-none text-ink-muted"
- classList={{
- 'p-1.5': props.property.valueType !== 'ENTITY',
- 'py-1.5 px-0.5': props.property.valueType === 'ENTITY',
- }}
- >
- <CircleDashed class="size-4 opacity-20" />
- </div>
- </Tooltip>
- );
-};
diff --git a/js/app/packages/macro-entity/src/components/PropertyPills/LinkPropertyPill.tsx b/js/app/packages/macro-entity/src/components/PropertyPills/LinkPropertyPill.tsx
deleted file mode 100644
index 5f90fce288..0000000000
--- a/js/app/packages/macro-entity/src/components/PropertyPills/LinkPropertyPill.tsx
+++ /dev/null
@@ -1,268 +0,0 @@
-import type { Property } from '@core/component/Properties/types';
-import {
- extractDomain,
- PropertyDataTypeIcon,
-} from '@core/component/Properties/utils';
-import { Tooltip } from '@core/component/Tooltip';
-import { useUnfurl } from '@core/signal/unfurl';
-
-import LinkIcon from '@icon/regular/link.svg';
-import { proxyResource } from '@service-unfurl/client';
-import { createSignal, For, Show } from 'solid-js';
-import { PropertyPillTooltip } from './PropertyPillTooltip';
-
-type LinkPropertyPillProps = {
- property: Property & { valueType: 'LINK' };
- compressed?: boolean;
-};
-
-/**
- * Pill for link properties
- * Single value: shows unfurled title or domain with tooltip
- * Multi value: shows "Links (N)" with tooltip
- */
-export const LinkPropertyPill = (props: LinkPropertyPillProps) => {
- const links = () => props.property.value ?? [];
- const count = () => links().length;
-
- if (count() === 0) return null;
-
- // Single link - show title/domain directly in pill
- if (count() === 1) {
- return (
- <SingleLinkPill
- property={props.property}
- url={links()[0]}
- compressed={props.compressed}
- />
- );
- }
-
- // Multiple links - show count with tooltip
- return (
- <MultiLinkPill
- property={props.property}
- urls={links()}
- compressed={props.compressed}
- />
- );
-};
-
-type SingleLinkPillProps = {
- property: Property & { valueType: 'LINK' };
- url: string;
- compressed?: boolean;
-};
-
-const SingleLinkPill = (props: SingleLinkPillProps) => {
- const [unfurlData] = useUnfurl(props.url);
- const [imageError, setImageError] = createSignal(false);
-
- const title = () => {
- const data = unfurlData();
- if (data?.type === 'success' && data.data.title) {
- return data.data.title;
- }
- return extractDomain(props.url);
- };
-
- const faviconUrl = () => {
- const data = unfurlData();
- if (data?.type === 'success' && data.data.favicon_url) {
- return proxyResource(data.data.favicon_url);
- }
- return null;
- };
-
- return (
- <Tooltip
- tooltip={
- <SingleLinkTooltipContent
- property={props.property}
- url={props.url}
- title={title()}
- faviconUrl={faviconUrl()}
- />
- }
- floatingOptions={{
- offset: 4,
- flip: true,
- shift: { padding: 8 },
- }}
- >
- <div
- class="inline-flex items-center gap-1.5 text-xs leading-none text-ink-muted border border-edge-muted h-fit p-1.5"
- classList={{
- '@3xl/soup:px-2 @3xl/soup:py-1': !props.compressed,
- }}
- >
- <Show
- when={faviconUrl() && !imageError()}
- fallback={<LinkIcon class="size-4 text-ink-muted shrink-0" />}
- >
- <img
- src={faviconUrl()!}
- class="size-4 object-cover rounded shrink-0"
- crossorigin="anonymous"
- alt=""
- onError={() => setImageError(true)}
- />
- </Show>
- <span
- class="truncate max-w-[100px] hidden"
- classList={{
- '@3xl/soup:inline': !props.compressed,
- }}
- >
- {title()}
- </span>
- </div>
- </Tooltip>
- );
-};
-
-type SingleLinkTooltipContentProps = {
- property: Property & { valueType: 'LINK' };
- url: string;
- title: string;
- faviconUrl: string | null;
-};
-
-const SingleLinkTooltipContent = (props: SingleLinkTooltipContentProps) => {
- const [imageError, setImageError] = createSignal(false);
-
- return (
- <PropertyPillTooltip property={props.property}>
- <div class="flex items-center gap-1.5 flex-wrap">
- <a
- href={props.url}
- target="_blank"
- rel="noopener noreferrer"
- class="inline-flex items-center gap-1.5 px-2 py-1 text-xs leading-none text-ink-muted border border-edge-muted h-fit w-fit"
- title={props.url}
- >
- <Show
- when={props.faviconUrl && !imageError()}
- fallback={<LinkIcon class="size-4 text-ink-muted" />}
- >
- <img
- src={props.faviconUrl!}
- class="size-4 object-cover rounded"
- crossorigin="anonymous"
- alt=""
- onError={() => setImageError(true)}
- />
- </Show>
- <span class="truncate max-w-[150px]">{props.title}</span>
- </a>
- </div>
- </PropertyPillTooltip>
- );
-};
-
-type MultiLinkPillProps = {
- property: Property & { valueType: 'LINK' };
- urls: string[];
- compressed?: boolean;
-};
-
-const MultiLinkPill = (props: MultiLinkPillProps) => {
- return (
- <Tooltip
- tooltip={
- <LinkTooltipContent property={props.property} urls={props.urls} />
- }
- floatingOptions={{
- offset: 4,
- flip: true,
- shift: { padding: 8 },
- }}
- >
- <div
- class="inline-flex items-center gap-1.5 text-xs leading-none text-ink-muted border border-edge-muted h-fit p-1.5"
- classList={{
- '@3xl/soup:px-2 @3xl/soup:py-1': !props.compressed,
- }}
- >
- <PropertyDataTypeIcon
- property={{
- data_type: 'LINK',
- }}
- class="size-3.5 shrink-0"
- />
- <span
- class="truncate max-w-[120px] hidden"
- classList={{
- '@3xl/soup:inline': !props.compressed,
- }}
- >
- {props.property.displayName} ({props.urls.length})
- </span>
- </div>
- </Tooltip>
- );
-};
-
-type LinkTooltipContentProps = {
- property: Property & { valueType: 'LINK' };
- urls: string[];
-};
-
-const LinkTooltipContent = (props: LinkTooltipContentProps) => {
- return (
- <PropertyPillTooltip property={props.property}>
- <div class="flex items-center gap-1.5 flex-wrap">
- <For each={props.urls}>{(url) => <LinkValuePill url={url} />}</For>
- </div>
- </PropertyPillTooltip>
- );
-};
-
-type LinkValuePillProps = {
- url: string;
-};
-
-const LinkValuePill = (props: LinkValuePillProps) => {
- const [unfurlData] = useUnfurl(props.url);
- const [imageError, setImageError] = createSignal(false);
-
- const title = () => {
- const data = unfurlData();
- if (data?.type === 'success' && data.data.title) {
- return data.data.title;
- }
- return extractDomain(props.url);
- };
-
- const faviconUrl = () => {
- const data = unfurlData();
- if (data?.type === 'success' && data.data.favicon_url) {
- return proxyResource(data.data.favicon_url);
- }
- return null;
- };
-
- return (
- <a
- href={props.url}
- target="_blank"
- rel="noopener noreferrer"
- class="inline-flex items-center gap-1.5 px-2 py-1 text-xs leading-none text-ink-muted border border-edge-muted h-fit w-fit"
- title={props.url}
- >
- <Show
- when={faviconUrl() && !imageError()}
- fallback={<LinkIcon class="size-4 text-ink-muted" />}
- >
- <img
- src={faviconUrl()!}
- class="size-4 object-cover rounded"
- crossorigin="anonymous"
- alt=""
- onError={() => setImageError(true)}
- />
- </Show>
- <span class="truncate max-w-[150px]">{title()}</span>
- </a>
- );
-};
diff --git a/js/app/packages/macro-entity/src/components/PropertyPills/PropertyPillTooltip.tsx b/js/app/packages/macro-entity/src/components/PropertyPills/PropertyPillTooltip.tsx
deleted file mode 100644
index 0cb22aea1f..0000000000
--- a/js/app/packages/macro-entity/src/components/PropertyPills/PropertyPillTooltip.tsx
+++ /dev/null
@@ -1,43 +0,0 @@
-import type { Property } from '@core/component/Properties/types';
-import { PropertyDataTypeIcon } from '@core/component/Properties/utils';
-import type { ParentProps } from 'solid-js';
-
-type PropertyPillTooltipProps = ParentProps<{
- property: Property;
-}>;
-
-/**
- * Shared tooltip content wrapper for property pills
- * Provides consistent header with icon and display name
- * Children are rendered as the values body
- */
-export const PropertyPillTooltip = (props: PropertyPillTooltipProps) => {
- const singleSelect = () => !props.property.isMultiSelect;
- return (
- <div
- class="p-2 border border-edge-muted bg-panel"
- classList={{
- 'flex flex-row gap-2 items-center': singleSelect(),
- 'min-w-48 max-w-72': !singleSelect(),
- }}
- >
- <div
- class="flex items-center gap-2 text-ink-muted"
- classList={{
- 'border-b border-edge-muted/50 pb-1.5 mb-1.5': !singleSelect(),
- }}
- >
- <PropertyDataTypeIcon
- property={{
- data_type: props.property.valueType,
- specific_entity_type:
- props.property.specificEntityType ?? undefined,
- }}
- class="size-3.5 text-ink-muted"
- />
- <span class="text-xs">{props.property.displayName}</span>
- </div>
- {props.children}
- </div>
- );
-};
diff --git a/js/app/packages/macro-entity/src/components/PropertyPills/PropertyPills.tsx b/js/app/packages/macro-entity/src/components/PropertyPills/PropertyPills.tsx
deleted file mode 100644
index 245903c242..0000000000
--- a/js/app/packages/macro-entity/src/components/PropertyPills/PropertyPills.tsx
+++ /dev/null
@@ -1,277 +0,0 @@
-import { PropertyValueIcon } from '@core/component/Properties/component/propertyValue/PropertyValueIcon';
-import { SYSTEM_PROPERTY_IDS } from '@core/component/Properties/constants';
-import type { Property } from '@core/component/Properties/types';
-import {
- formatPropertyValue,
- PropertyDataTypeIcon,
-} from '@core/component/Properties/utils';
-import { Tooltip } from '@core/component/Tooltip';
-
-import { For, Match, Show, Switch } from 'solid-js';
-import { BooleanPropertyPill } from './BooleanPropertyPill';
-import { EntityPropertyPill } from './EntityPropertyPill';
-import { LinkPropertyPill } from './LinkPropertyPill';
-import { PropertyPillTooltip } from './PropertyPillTooltip';
-
-type PropertyPillsProps = {
- properties: Property[];
- /** For tasks, exclude key properties (status, priority, assignees) that are shown in KeyPropertiesGrid */
- excludeKeyProperties?: boolean;
- /** Force compressed styling regardless of container query */
- compressed?: boolean;
-};
-
-/**
- * Component to display multiple property pills
- * Properties are displayed in the order provided (which should match displayProperties order)
- */
-const MAX_DISPLAY_PILLS = 4;
-
-const TASK_KEY_PROPERTY_IDS = [
- SYSTEM_PROPERTY_IDS.STATUS,
- SYSTEM_PROPERTY_IDS.PRIORITY,
- SYSTEM_PROPERTY_IDS.ASSIGNEES,
-] as const;
-
-export const PropertyPills = (props: PropertyPillsProps) => {
- const filteredProperties = () => {
- if (props.excludeKeyProperties) {
- return props.properties.filter(
- (property) =>
- !TASK_KEY_PROPERTY_IDS.includes(property.propertyDefinitionId as any)
- );
- }
- return props.properties;
- };
-
- const displayProperties = () =>
- filteredProperties().slice(0, MAX_DISPLAY_PILLS);
-
- return (
- <Show when={filteredProperties().length > 0}>
- <div class="flex items-center gap-1 justify-end">
- <For each={displayProperties()}>
- {(property) => (
- <PropertyPill property={property} compressed={props.compressed} />
- )}
- </For>
- </div>
- </Show>
- );
-};
-
-type PropertyPillProps = {
- property: Property;
- compressed?: boolean;
-};
-
-/**
- * Routes to specialized pill components based on property type
- */
-const PropertyPill = (props: PropertyPillProps) => {
- return (
- <Switch
- fallback={
- <TextPropertyPill
- property={props.property}
- compressed={props.compressed}
- />
- }
- >
- <Match when={props.property.valueType === 'BOOLEAN'}>
- <BooleanPropertyPill
- property={props.property as Property & { valueType: 'BOOLEAN' }}
- compressed={props.compressed}
- />
- </Match>
- <Match when={props.property.valueType === 'ENTITY'}>
- <EntityPropertyPill
- property={props.property as Property & { valueType: 'ENTITY' }}
- compressed={props.compressed}
- />
- </Match>
- <Match when={props.property.valueType === 'LINK'}>
- <LinkPropertyPill
- property={props.property as Property & { valueType: 'LINK' }}
- compressed={props.compressed}
- />
- </Match>
- </Switch>
- );
-};
-
-/**
- * Pill - shows icon + text when wide, icon only when narrow
- * Uses @container/soup from Soup.tsx and compressed prop
- * - >= @3xl (~768px) AND not compressed: full (icon + text)
- * - < @3xl OR compressed: compact (icon only)
- * - Status and Priority properties always show as compact (icon only)
- */
-const TextPropertyPill = (props: PropertyPillProps) => {
- const displayValue = () => formatPillValue(props.property);
-
- const value = displayValue();
- if (!value) return null;
-
- return (
- <Tooltip
- unstyled
- tooltip={<TextTooltipContent property={props.property} />}
- floatingOptions={{
- offset: 4,
- flip: true,
- shift: { padding: 8 },
- }}
- >
- <div
- class="inline-flex items-center gap-1.5 text-xs leading-none text-ink-muted border border-edge-muted/50 h-fit shrink-0 p-1.5"
- classList={{
- '@3xl/soup:px-2 @3xl/soup:py-1': !props.compressed,
- }}
- >
- <PillIcon property={props.property} />
- <span
- class="truncate max-w-[100px] hidden"
- classList={{
- '@3xl/soup:inline': !props.compressed,
- }}
- >
- {value}
- </span>
- </div>
- </Tooltip>
- );
-};
-
-const getValues = (property: Property): string[] => {
- if (property.value === null || property.value === undefined) return [];
-
- if (
- (property.valueType === 'SELECT_STRING' ||
- property.valueType === 'SELECT_NUMBER') &&
- Array.isArray(property.value)
- ) {
- return property.value.map((v) => formatPropertyValue(property, v));
- }
-
- if (property.valueType === 'DATE' && property.value instanceof Date) {
- return [formatPropertyValue(property, property.value)];
- }
-
- if (property.valueType === 'NUMBER' && typeof property.value === 'number') {
- return [formatPropertyValue(property, property.value)];
- }
-
- if (property.valueType === 'STRING' && typeof property.value === 'string') {
- return property.value ? [property.value] : [];
- }
-
- return [];
-};
-
-const TextTooltipContent = (props: { property: Property }) => {
- return (
- <PropertyPillTooltip property={props.property}>
- <div class="flex items-center gap-1.5 flex-wrap">
- <For each={getValues(props.property)}>
- {(value, index) => (
- <div class="inline-flex items-center gap-1.5 px-2 py-1 text-xs leading-none text-ink-muted border border-edge-muted/50 h-fit w-fit">
- <TooltipValueIcon
- property={props.property}
- valueIndex={index()}
- />
- <span class="truncate max-w-[150px]">{value}</span>
- </div>
- )}
- </For>
- </div>
- </PropertyPillTooltip>
- );
-};
-
-/**
- * Format property value for display in pill (default types only)
- */
-const formatPillValue = (property: Property): string | null => {
- if (property.value === null || property.value === undefined) {
- return null;
- }
-
- if (
- (property.valueType === 'DATE' && property.value instanceof Date) ||
- (property.valueType === 'NUMBER' && typeof property.value === 'number')
- ) {
- return formatPropertyValue(property, property.value);
- }
-
- if (property.valueType === 'STRING' && typeof property.value === 'string') {
- return property.value || null;
- }
-
- // Handle SELECT_STRING and SELECT_NUMBER
- if (
- (property.valueType === 'SELECT_STRING' ||
- property.valueType === 'SELECT_NUMBER') &&
- Array.isArray(property.value)
- ) {
- if (property.value.length === 0) {
- return null;
- }
- // Multi-select with multiple values: show "Property Name (N)"
- if (property.isMultiSelect && property.value.length > 1) {
- return `${property.displayName} (${property.value.length})`;
- }
- // Single value (or multi-select with 1 value): show the value
- return formatPropertyValue(property, property.value[0]);
- }
-
- return null;
-};
-
-/**
- * Icon component for property pills - uses special icons for select values when available
- */
-const PillIcon = (props: { property: Property }) => {
- // For SELECT_STRING and SELECT_NUMBER with single value, try to use special icon
- if (
- (props.property.valueType === 'SELECT_STRING' ||
- props.property.valueType === 'SELECT_NUMBER') &&
- props.property.value &&
- props.property.value.length === 1
- ) {
- const optionId = props.property.value[0];
- return <PropertyValueIcon optionId={optionId} class="size-3.5 shrink-0" />;
- }
-
- // Default to data type icon
- return (
- <PropertyDataTypeIcon
- property={{
- data_type: props.property.valueType,
- specific_entity_type: props.property.specificEntityType,
- }}
- class="size-3.5 shrink-0"
- />
- );
-};
-
-/**
- * Icon component for tooltip values - uses special icons for select values when available
- */
-const TooltipValueIcon = (props: {
- property: Property;
- valueIndex: number;
-}) => {
- // For SELECT_STRING and SELECT_NUMBER, try to use special icon for the specific value
- if (
- (props.property.valueType === 'SELECT_STRING' ||
- props.property.valueType === 'SELECT_NUMBER') &&
- props.property.value &&
- props.property.value[props.valueIndex]
- ) {
- const optionId = props.property.value[props.valueIndex];
- return <PropertyValueIcon optionId={optionId} class="size-3 shrink-0" />;
- }
-
- return null;
-};
diff --git a/js/app/packages/macro-entity/src/components/PropertyPills/index.tsx b/js/app/packages/macro-entity/src/components/PropertyPills/index.tsx
deleted file mode 100644
index 9a5ec4f5c1..0000000000
--- a/js/app/packages/macro-entity/src/components/PropertyPills/index.tsx
+++ /dev/null
@@ -1,2 +0,0 @@
-export { KeyPropertiesGrid } from './KeyPropertiesGrid';
-export { PropertyPills } from './PropertyPills';
diff --git a/js/app/packages/macro-entity/src/components/Sort.tsx b/js/app/packages/macro-entity/src/components/Sort.tsx
index ed95f9f342..b8b43c3e9a 100644
--- a/js/app/packages/macro-entity/src/components/Sort.tsx
+++ b/js/app/packages/macro-entity/src/components/Sort.tsx
@@ -11,8 +11,11 @@ import XIcon from '@phosphor-icons/core/assets/regular/x.svg';
import { propertiesServiceClient } from '@service-properties/client';
import { SegmentedControl } from 'core/component/FormControls/SegmentControls';
import { ToggleButton } from 'core/component/FormControls/ToggleButton';
-import type { PropertyDefinitionFlat } from 'core/component/Properties/types';
-import { PropertyDataTypeIcon } from 'core/component/Properties/utils/PropertyDataTypeIcon';
+import type { PropertyDefinitionDomain } from 'core/component/Properties/types';
+import {
+ PropertyDataTypeIcon,
+ toPropertyDefinitionDomain,
+} from 'core/component/Properties/utils';
import { isErr } from 'core/util/maybeResult';
import {
type Accessor,
@@ -36,12 +39,12 @@ export function Sort() {
}
type PropertySortSearchProps = {
- onSelectProperty?: (property: PropertyDefinitionFlat) => void;
+ onSelectProperty?: (property: PropertyDefinitionDomain) => void;
};
function PropertySortSearch(props: PropertySortSearchProps) {
const [availableProperties, setAvailableProperties] = createSignal<
- PropertyDefinitionFlat[]
+ PropertyDefinitionDomain[]
>([]);
const [searchQuery, setSearchQuery] = createSignal('');
const [isDropdownOpen, setIsDropdownOpen] = createSignal(false);
@@ -63,9 +66,10 @@ function PropertySortSearch(props: PropertySortSearchProps) {
const [, data] = result;
const properties = Array.isArray(data) ? data : [];
- const normalizedProperties = properties.map((item) =>
- 'definition' in item ? item.definition : item
- );
+ const normalizedProperties = properties.map((item) => {
+ const definition = 'definition' in item ? item.definition : item;
+ return toPropertyDefinitionDomain(definition);
+ });
setAvailableProperties(normalizedProperties);
} catch (_apiError) {
// Silently fail
@@ -76,8 +80,8 @@ function PropertySortSearch(props: PropertySortSearchProps) {
const sortableProperties = createMemo(() => {
return availableProperties().filter((property) => {
if (
- ['BOOLEAN', 'ENTITY', 'LINK', 'STRING'].includes(property.data_type) ||
- property.is_multi_select
+ ['BOOLEAN', 'ENTITY', 'LINK', 'STRING'].includes(property.valueType) ||
+ property.isMultiSelect
)
return false;
return true;
@@ -91,12 +95,12 @@ function PropertySortSearch(props: PropertySortSearchProps) {
if (!query) return properties;
return properties.filter((property) => {
- const name = property.display_name.toLowerCase();
+ const name = property.displayName.toLowerCase();
return name.includes(query);
});
});
- const handleSelectProperty = (property: PropertyDefinitionFlat) => {
+ const handleSelectProperty = (property: PropertyDefinitionDomain) => {
props.onSelectProperty?.(property);
setSearchQuery('');
setIsDropdownOpen(false);
@@ -168,7 +172,7 @@ function PropertySortSearch(props: PropertySortSearchProps) {
class="w-full px-2 py-1.5 text-xs text-ink hover:bg-hover flex items-center gap-2 text-left"
>
<PropertyDataTypeIcon property={property} />
- <span class="truncate flex-1">{property.display_name}</span>
+ <span class="truncate flex-1">{property.displayName}</span>
</button>
)}
</For>
@@ -337,7 +341,7 @@ export function createSort<
// Track the full property object for display (fetched when needed)
const [selectedProperty, setSelectedProperty] =
- createSignal<PropertyDefinitionFlat | null>(null);
+ createSignal<PropertyDefinitionDomain | null>(null);
// Fetch property details when propertyId changes
createEffect(
@@ -350,9 +354,10 @@ export function createSort<
if (isErr(result)) return;
const [, data] = result;
const properties = Array.isArray(data) ? data : [];
- const normalizedProperties = properties.map((item) =>
- 'definition' in item ? item.definition : item
- );
+ const normalizedProperties = properties.map((item) => {
+ const definition = 'definition' in item ? item.definition : item;
+ return toPropertyDefinitionDomain(definition);
+ });
const property = normalizedProperties.find((p) => p.id === id);
if (property) {
setSelectedProperty(property);
@@ -368,7 +373,7 @@ export function createSort<
return propertyId() !== null;
});
- const handleSelectProperty = (property: PropertyDefinitionFlat) => {
+ const handleSelectProperty = (property: PropertyDefinitionDomain) => {
setPropertyId(property.id);
setSelectedProperty(property);
};
@@ -502,7 +507,7 @@ export function createSort<
class="text-panel size-3.5 shrink-0"
/>
<span class="truncate">
- {selectedProperty()?.display_name}
+ {selectedProperty()?.displayName}
</span>
</div>
</Show>