From 80c901dd98c9f3f2d07ea189316e5dd825f1db6b Mon Sep 17 00:00:00 2001 From: Daniel Kweon Date: Mon, 24 Nov 2025 16:35:29 -0500 Subject: [PATCH 1/9] change 6 > 4 max display properties --- js/app/packages/app/component/PropertyDisplayControl.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/app/packages/app/component/PropertyDisplayControl.tsx b/js/app/packages/app/component/PropertyDisplayControl.tsx index 55201dc5a8d..899e206e46c 100644 --- a/js/app/packages/app/component/PropertyDisplayControl.tsx +++ b/js/app/packages/app/component/PropertyDisplayControl.tsx @@ -18,6 +18,8 @@ import { } from 'solid-js'; import type { DisplayOptions } from './ViewConfig'; +const MAX_DISPLAY_PROPERTIES = 4; + type PropertyDisplayControlProps = { selectedPropertyIds: Accessor; setSelectedPropertyIds: ( @@ -212,7 +214,7 @@ export const PropertyDisplayControl: Component = ( if (!currentIds.includes(property.id)) { const currentIds = props.selectedPropertyIds(); // Enforce max 6 properties - if (currentIds.length >= 6) { + if (currentIds.length >= MAX_DISPLAY_PROPERTIES) { toast.failure('You can only select up to 6 properties to display.'); return; } From 5032725daa6bffa6f6960ca72024b2e84c4a170c Mon Sep 17 00:00:00 2001 From: Daniel Kweon Date: Thu, 27 Nov 2025 16:59:28 -0500 Subject: [PATCH 2/9] biome fixes --- js/app/packages/app/component/split-layout/layoutManager.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/app/packages/app/component/split-layout/layoutManager.ts b/js/app/packages/app/component/split-layout/layoutManager.ts index 382ec578fb0..0dba804c74f 100644 --- a/js/app/packages/app/component/split-layout/layoutManager.ts +++ b/js/app/packages/app/component/split-layout/layoutManager.ts @@ -1,5 +1,5 @@ import type { BlockName } from '@core/block'; -import { ResizeZoneCtx } from '@core/component/Resize/types'; +import type { ResizeZoneCtx } from '@core/component/Resize/types'; import type { BlockInstanceHandle, BlockOrchestrator, From fcf4f498595dbbf73829fdd05d8dcd49989dfc1f Mon Sep 17 00:00:00 2001 From: Daniel Kweon Date: Fri, 28 Nov 2025 10:43:32 -0500 Subject: [PATCH 3/9] feat: add property pills to unified list rows --- .../src/components/EntityWithEverything.tsx | 18 +++++++++++++++++- .../src/components/PropertyPills/index.tsx | 1 + 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 js/app/packages/macro-entity/src/components/PropertyPills/index.tsx diff --git a/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx b/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx index b4107c2ec43..7645d06289b 100644 --- a/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx +++ b/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx @@ -1,4 +1,5 @@ import { EntityIcon } from '@core/component/EntityIcon'; +import type { Property } from '@core/component/Properties/types'; import { LabelAndHotKey, Tooltip } from '@core/component/Tooltip'; import { TOKENS } from '@core/hotkey/tokens'; import { matches } from '@core/util/match'; @@ -41,6 +42,7 @@ import type { WithSearch, } from '../types/search'; import type { EntityClickEvent, EntityClickHandler } from './Entity'; +import { PropertyPills } from './PropertyPills'; function UnreadIndicator(props: { active?: boolean }) { return ( @@ -134,7 +136,7 @@ interface EntityProps> onMouseLeave?: () => void; onFocusIn?: () => void; onContextMenu?: () => void; - properties?: Record; + properties?: Property[]; contentPlacement?: 'middle' | 'bottom-row'; unreadIndicatorActive?: boolean; fadeIfRead?: boolean; @@ -404,6 +406,15 @@ export function EntityWithEverything( }; }; + /** + * Properties for this entity + * TODO - @danielkweon: Once endpoint includes properties, remove temp data and use: props.displayProperties ?? [] + */ + const properties = (): Property[] => { + // Use real properties if provided, otherwise use temp data for testing + return props.properties ?? []; + }; + return (
+
+ 0}> + + +
{(shared) => ( Date: Fri, 28 Nov 2025 11:35:39 -0500 Subject: [PATCH 4/9] feat: add BooleanPropertyPill with cornerClip styling --- .../PropertyPills/BooleanPropertyPill.tsx | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 js/app/packages/macro-entity/src/components/PropertyPills/BooleanPropertyPill.tsx diff --git a/js/app/packages/macro-entity/src/components/PropertyPills/BooleanPropertyPill.tsx b/js/app/packages/macro-entity/src/components/PropertyPills/BooleanPropertyPill.tsx new file mode 100644 index 00000000000..91e557b81a8 --- /dev/null +++ b/js/app/packages/macro-entity/src/components/PropertyPills/BooleanPropertyPill.tsx @@ -0,0 +1,35 @@ +import type { Property } from '@core/component/Properties/types'; +import { PropertyDataTypeIcon } from '@core/component/Properties/utils'; +import { cornerClip } from '@core/util/clipPath'; + +type BooleanPropertyPillProps = { + property: Property & { valueType: 'BOOLEAN' }; +}; + +/** + * Pill for boolean properties + * Only shows when value is true (false = no pill displayed) + */ +export function BooleanPropertyPill(props: BooleanPropertyPillProps) { + // Don't show pill for false or null values + if (!props.property.value) return null; + + return ( +
+
+ + {props.property.displayName} +
+
+ ); +} From e73dfbed50f1e09ed5b636e94a29b62c584b88b0 Mon Sep 17 00:00:00 2001 From: Daniel Kweon Date: Fri, 28 Nov 2025 14:30:55 -0500 Subject: [PATCH 5/9] feat: add LinkPropertyPill with single/multi link display --- .../PropertyPills/LinkPropertyPill.tsx | 118 ++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 js/app/packages/macro-entity/src/components/PropertyPills/LinkPropertyPill.tsx diff --git a/js/app/packages/macro-entity/src/components/PropertyPills/LinkPropertyPill.tsx b/js/app/packages/macro-entity/src/components/PropertyPills/LinkPropertyPill.tsx new file mode 100644 index 00000000000..49a13709ee8 --- /dev/null +++ b/js/app/packages/macro-entity/src/components/PropertyPills/LinkPropertyPill.tsx @@ -0,0 +1,118 @@ +import type { Property } from '@core/component/Properties/types'; +import { + extractDomain, + PropertyDataTypeIcon, +} from '@core/component/Properties/utils'; +import { useUnfurl } from '@core/signal/unfurl'; +import { cornerClip } from '@core/util/clipPath'; +import LinkIcon from '@icon/regular/link.svg'; +import { proxyResource } from '@service-unfurl/client'; +import { createSignal, Show } from 'solid-js'; + +type LinkPropertyPillProps = { + property: Property & { valueType: 'LINK' }; +}; + +/** + * Pill for link properties + * Single value: shows unfurled title or domain + * Multi value: shows "Links (N)" + */ +export function 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 ; + } + + // Multiple links - show count + return ; +} + +type SingleLinkPillProps = { + property: Property & { valueType: 'LINK' }; + url: string; +}; + +function 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 ( + + ); +} + +type MultiLinkPillProps = { + property: Property & { valueType: 'LINK' }; + urls: string[]; +}; + +function MultiLinkPill(props: MultiLinkPillProps) { + return ( +
+
+ + + {props.property.displayName} ({props.urls.length}) + +
+
+ ); +} From 49d90dbd77a7b145d893ff429f091fbf7882deb3 Mon Sep 17 00:00:00 2001 From: Daniel Kweon Date: Fri, 28 Nov 2025 14:46:36 -0500 Subject: [PATCH 6/9] feat: add EntityPropertyPill with support for all entity types --- .../Properties/utils/PropertyDataTypeIcon.tsx | 4 +- .../PropertyPills/EntityPropertyPill.tsx | 202 ++++++++++++++++++ 2 files changed, 204 insertions(+), 2 deletions(-) create mode 100644 js/app/packages/macro-entity/src/components/PropertyPills/EntityPropertyPill.tsx diff --git a/js/app/packages/core/component/Properties/utils/PropertyDataTypeIcon.tsx b/js/app/packages/core/component/Properties/utils/PropertyDataTypeIcon.tsx index 0d8cb41e817..a4e29fb6028 100644 --- a/js/app/packages/core/component/Properties/utils/PropertyDataTypeIcon.tsx +++ b/js/app/packages/core/component/Properties/utils/PropertyDataTypeIcon.tsx @@ -4,11 +4,11 @@ import ChatIcon from '@icon/regular/chat.svg'; import CheckSquareIcon from '@icon/regular/check-square.svg'; import FileIcon from '@icon/regular/file.svg'; import FolderIcon from '@icon/regular/folder.svg'; -import GlobeIcon from '@icon/regular/globe.svg'; import HashIcon from '@icon/regular/hash.svg'; import LinkIcon from '@icon/regular/link.svg'; import ListBulletIcon from '@icon/regular/list-bullets.svg'; 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'; @@ -39,7 +39,7 @@ export const PropertyDataTypeIcon: Component = ( case 'CHANNEL': return ; default: - return ; + return ; } } diff --git a/js/app/packages/macro-entity/src/components/PropertyPills/EntityPropertyPill.tsx b/js/app/packages/macro-entity/src/components/PropertyPills/EntityPropertyPill.tsx new file mode 100644 index 00000000000..4c3e8f46c87 --- /dev/null +++ b/js/app/packages/macro-entity/src/components/PropertyPills/EntityPropertyPill.tsx @@ -0,0 +1,202 @@ +import { useChannelName } from '@core/component/ChannelsProvider'; +import { EntityIcon as CoreEntityIcon } from '@core/component/EntityIcon'; +import type { Property } from '@core/component/Properties/types'; +import { PropertyDataTypeIcon } from '@core/component/Properties/utils'; +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 { cornerClip } from '@core/util/clipPath'; +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 type { EntityReference } from '@service-properties/generated/schemas/entityReference'; +import { Show } from 'solid-js'; + +type EntityPropertyPillProps = { + property: Property & { valueType: 'ENTITY' }; +}; + +/** + * Pill for entity properties + * Single value: shows entity name directly + * Multi value: shows "Property Name (N)" + */ +export function EntityPropertyPill(props: EntityPropertyPillProps) { + const entities = () => props.property.value ?? []; + const count = () => entities().length; + + if (count() === 0) return null; + + // Single entity - show name directly in pill + if (count() === 1) { + return ( + + ); + } + + // Multiple entities - show count + return ; +} + +type SingleEntityPillProps = { + property: Property & { valueType: 'ENTITY' }; + entity: EntityReference; +}; + +const ICON_CLASSES = 'size-4 text-ink-muted'; + +function SingleEntityPill(props: SingleEntityPillProps) { + const entityType = () => props.entity.entity_type; + const entityId = () => props.entity.entity_id; + + // Get preview for items that need it + const previewTypes = ['DOCUMENT', 'PROJECT', 'CHAT', 'CHANNEL']; + const needsPreview = () => previewTypes.includes(entityType()); + + const [preview] = useItemPreview({ + id: needsPreview() ? entityId() : '', + type: needsPreview() + ? (entityType().toLowerCase() as + | 'document' + | 'project' + | 'chat' + | 'channel') + : undefined, + }); + + const channelName = useChannelName( + entityType() === 'CHANNEL' ? entityId() : '', + 'Unknown Channel' + ); + + const entityName = () => { + switch (entityType()) { + case 'USER': + return idToDisplayName(entityId()).replace('macro|', ''); + case 'CHANNEL': + return channelName(); + case 'DOCUMENT': + case 'PROJECT': + case 'CHAT': { + const previewItem = preview(); + if (!previewItem || previewItem.loading) return 'Loading...'; + if (!isAccessiblePreviewItem(previewItem)) return 'Unavailable'; + return previewItem.name || `Unknown ${entityType().toLowerCase()}`; + } + default: + return entityId(); + } + }; + + const entityIcon = () => { + switch (entityType()) { + case 'USER': + return ; + + case 'CHANNEL': { + const previewItem = preview(); + if ( + !previewItem || + previewItem.loading || + !isAccessiblePreviewItem(previewItem) + ) { + return ; + } + + const channelType = previewItem.channelType; + switch (channelType) { + case 'direct_message': + return ; + case 'private': + return ; + case 'organization': + return ; + case 'public': + return ; + default: + return ; + } + } + + case 'DOCUMENT': { + const previewItem = preview(); + if ( + !previewItem || + previewItem.loading || + !isAccessiblePreviewItem(previewItem) + ) { + return ; + } + + const fileType = previewItem.fileType; + const blockName = fileType + ? fileTypeToBlockName(fileType, true) + : 'unknown'; + return ; + } + + case 'PROJECT': + return ; + + case 'CHAT': + return ; + + default: + return ( + + ); + } + }; + + return ( +
+
+ {entityIcon()} + {entityName()} +
+
+ ); +} + +type MultiEntityPillProps = { + property: Property & { valueType: 'ENTITY' }; + entities: EntityReference[]; +}; + +function MultiEntityPill(props: MultiEntityPillProps) { + return ( +
+
+ + + {props.property.displayName} ({props.entities.length}) + +
+
+ ); +} From e1591efbb23562f5579316904d8e438e87ef5826 Mon Sep 17 00:00:00 2001 From: Daniel Kweon Date: Fri, 28 Nov 2025 15:03:38 -0500 Subject: [PATCH 7/9] refactor: convert PropertyPills to const arrow functions and simplify formatPillValue --- .../PropertyPills/PropertyPills.tsx | 134 ++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 js/app/packages/macro-entity/src/components/PropertyPills/PropertyPills.tsx diff --git a/js/app/packages/macro-entity/src/components/PropertyPills/PropertyPills.tsx b/js/app/packages/macro-entity/src/components/PropertyPills/PropertyPills.tsx new file mode 100644 index 00000000000..84bf3755382 --- /dev/null +++ b/js/app/packages/macro-entity/src/components/PropertyPills/PropertyPills.tsx @@ -0,0 +1,134 @@ +import type { Property } from '@core/component/Properties/types'; +import { + formatPropertyValue, + PropertyDataTypeIcon, +} from '@core/component/Properties/utils'; +import { cornerClip } from '@core/util/clipPath'; +import { For, Match, Show, Switch } from 'solid-js'; +import { BooleanPropertyPill } from './BooleanPropertyPill'; +import { EntityPropertyPill } from './EntityPropertyPill'; +import { LinkPropertyPill } from './LinkPropertyPill'; + +type PropertyPillsProps = { + properties: Property[]; +}; + +/** + * Component to display multiple property pills + * Properties are displayed in the order provided (which should match displayProperties order) + */ +const MAX_DISPLAY_PILLS = 4; + +export const PropertyPills = (props: PropertyPillsProps) => { + const displayProperties = () => props.properties.slice(0, MAX_DISPLAY_PILLS); + + return ( + 0}> +
+ + {(property) => } + +
+
+ ); +}; + +type PropertyPillProps = { + property: Property; +}; + +/** + * Routes to specialized pill components based on property type + */ +const PropertyPill = (props: PropertyPillProps) => { + return ( + }> + + + + + + + + + + + ); +}; + +/** + * Pill for String, Number, Date, Select types + */ +const TextPropertyPill = (props: PropertyPillProps) => { + const displayValue = () => formatPillValue(props.property); + + const value = displayValue(); + if (!value) return null; + + return ( +
+
+ + + {value} + +
+
+ ); +}; + +/** + * 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; +}; From d35a9699d7d8a346c156a2bbdd06b5078d4953d1 Mon Sep 17 00:00:00 2001 From: Daniel Kweon Date: Fri, 28 Nov 2025 15:41:01 -0500 Subject: [PATCH 8/9] feat: add tooltips to all property pills with consistent styling --- .../PropertyPills/BooleanPropertyPill.tsx | 63 ++++- .../PropertyPills/EntityPropertyPill.tsx | 242 ++++++++++++++++-- .../PropertyPills/LinkPropertyPill.tsx | 214 +++++++++++++--- .../PropertyPills/PropertyPillTooltip.tsx | 42 +++ .../PropertyPills/PropertyPills.tsx | 94 +++++-- 5 files changed, 561 insertions(+), 94 deletions(-) create mode 100644 js/app/packages/macro-entity/src/components/PropertyPills/PropertyPillTooltip.tsx diff --git a/js/app/packages/macro-entity/src/components/PropertyPills/BooleanPropertyPill.tsx b/js/app/packages/macro-entity/src/components/PropertyPills/BooleanPropertyPill.tsx index 91e557b81a8..914184a200c 100644 --- a/js/app/packages/macro-entity/src/components/PropertyPills/BooleanPropertyPill.tsx +++ b/js/app/packages/macro-entity/src/components/PropertyPills/BooleanPropertyPill.tsx @@ -1,6 +1,8 @@ import type { Property } from '@core/component/Properties/types'; import { PropertyDataTypeIcon } from '@core/component/Properties/utils'; +import { Tooltip } from '@core/component/Tooltip'; import { cornerClip } from '@core/util/clipPath'; +import { PropertyPillTooltip } from './PropertyPillTooltip'; type BooleanPropertyPillProps = { property: Property & { valueType: 'BOOLEAN' }; @@ -10,26 +12,59 @@ type BooleanPropertyPillProps = { * Pill for boolean properties * Only shows when value is true (false = no pill displayed) */ -export function BooleanPropertyPill(props: BooleanPropertyPillProps) { +export const BooleanPropertyPill = (props: BooleanPropertyPillProps) => { // Don't show pill for false or null values if (!props.property.value) return null; return ( -
} + floatingOptions={{ + offset: 4, + flip: true, + shift: { padding: 8 }, + }} >
- - {props.property.displayName} +
+ + + {props.property.displayName} + +
-
+
); -} +}; + +const BooleanTooltipContent = (props: { + property: Property & { valueType: 'BOOLEAN' }; +}) => { + return ( + +
+
+
+ True +
+
+
+
+ ); +}; diff --git a/js/app/packages/macro-entity/src/components/PropertyPills/EntityPropertyPill.tsx b/js/app/packages/macro-entity/src/components/PropertyPills/EntityPropertyPill.tsx index 4c3e8f46c87..fb93eece6c1 100644 --- a/js/app/packages/macro-entity/src/components/PropertyPills/EntityPropertyPill.tsx +++ b/js/app/packages/macro-entity/src/components/PropertyPills/EntityPropertyPill.tsx @@ -2,6 +2,7 @@ import { useChannelName } from '@core/component/ChannelsProvider'; import { EntityIcon as CoreEntityIcon } from '@core/component/EntityIcon'; 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 { fileTypeToBlockName } from '@core/constant/allBlocks'; import { isAccessiblePreviewItem, useItemPreview } from '@core/signal/preview'; @@ -13,7 +14,8 @@ 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 type { EntityReference } from '@service-properties/generated/schemas/entityReference'; -import { Show } from 'solid-js'; +import { For, Show } from 'solid-js'; +import { PropertyPillTooltip } from './PropertyPillTooltip'; type EntityPropertyPillProps = { property: Property & { valueType: 'ENTITY' }; @@ -21,10 +23,10 @@ type EntityPropertyPillProps = { /** * Pill for entity properties - * Single value: shows entity name directly - * Multi value: shows "Property Name (N)" + * Single value: shows entity name directly with tooltip + * Multi value: shows "Property Name (N)" with tooltip */ -export function EntityPropertyPill(props: EntityPropertyPillProps) { +export const EntityPropertyPill = (props: EntityPropertyPillProps) => { const entities = () => props.property.value ?? []; const count = () => entities().length; @@ -37,9 +39,9 @@ export function EntityPropertyPill(props: EntityPropertyPillProps) { ); } - // Multiple entities - show count + // Multiple entities - show count with tooltip return ; -} +}; type SingleEntityPillProps = { property: Property & { valueType: 'ENTITY' }; @@ -48,7 +50,7 @@ type SingleEntityPillProps = { const ICON_CLASSES = 'size-4 text-ink-muted'; -function SingleEntityPill(props: SingleEntityPillProps) { +const SingleEntityPill = (props: SingleEntityPillProps) => { const entityType = () => props.entity.entity_type; const entityId = () => props.entity.entity_id; @@ -157,46 +159,230 @@ function SingleEntityPill(props: SingleEntityPillProps) { }; return ( -
+ } + floatingOptions={{ + offset: 4, + flip: true, + shift: { padding: 8 }, + }} >
- {entityIcon()} - {entityName()} +
+ {entityIcon()} + {entityName()} +
-
+ ); -} +}; + +type SingleEntityTooltipContentProps = { + property: Property & { valueType: 'ENTITY' }; + entity: EntityReference; +}; + +const SingleEntityTooltipContent = (props: SingleEntityTooltipContentProps) => { + return ( + +
+ +
+
+ ); +}; type MultiEntityPillProps = { property: Property & { valueType: 'ENTITY' }; entities: EntityReference[]; }; -function MultiEntityPill(props: MultiEntityPillProps) { +const MultiEntityPill = (props: MultiEntityPillProps) => { + return ( + + } + floatingOptions={{ + offset: 4, + flip: true, + shift: { padding: 8 }, + }} + > +
+
+ + + {props.property.displayName} ({props.entities.length}) + +
+
+
+ ); +}; + +type EntityTooltipContentProps = { + property: Property & { valueType: 'ENTITY' }; + entities: EntityReference[]; +}; + +const EntityTooltipContent = (props: EntityTooltipContentProps) => { + return ( + +
+ + {(entity) => ( + + )} + +
+
+ ); +}; + +type EntityValuePillProps = { + entity: EntityReference; + property: Property & { valueType: 'ENTITY' }; +}; + +const EntityValuePill = (props: EntityValuePillProps) => { + const entityType = () => props.entity.entity_type; + const entityId = () => props.entity.entity_id; + + // Get preview for items that need it + const previewTypes = ['DOCUMENT', 'PROJECT', 'CHAT', 'CHANNEL']; + const needsPreview = () => previewTypes.includes(entityType()); + + const [preview] = useItemPreview({ + id: needsPreview() ? entityId() : '', + type: needsPreview() + ? (entityType().toLowerCase() as + | 'document' + | 'project' + | 'chat' + | 'channel') + : undefined, + }); + + const channelName = useChannelName( + entityType() === 'CHANNEL' ? entityId() : '', + 'Unknown Channel' + ); + + const entityName = () => { + switch (entityType()) { + case 'USER': + return idToDisplayName(entityId()).replace('macro|', ''); + case 'CHANNEL': + return channelName(); + case 'DOCUMENT': + case 'PROJECT': + case 'CHAT': { + const previewItem = preview(); + if (!previewItem || previewItem.loading) return 'Loading...'; + if (!isAccessiblePreviewItem(previewItem)) return 'Unavailable'; + return previewItem.name || `Unknown ${entityType().toLowerCase()}`; + } + default: + return entityId(); + } + }; + + const entityIcon = () => { + switch (entityType()) { + case 'USER': + return ; + + case 'CHANNEL': { + const previewItem = preview(); + if ( + !previewItem || + previewItem.loading || + !isAccessiblePreviewItem(previewItem) + ) { + return ; + } + + const channelType = previewItem.channelType; + switch (channelType) { + case 'direct_message': + return ; + case 'private': + return ; + case 'organization': + return ; + case 'public': + return ; + default: + return ; + } + } + + case 'DOCUMENT': { + const previewItem = preview(); + if ( + !previewItem || + previewItem.loading || + !isAccessiblePreviewItem(previewItem) + ) { + return ; + } + + const fileType = previewItem.fileType; + const blockName = fileType + ? fileTypeToBlockName(fileType, true) + : 'unknown'; + return ; + } + + case 'PROJECT': + return ; + + case 'CHAT': + return ; + + default: + return null; + } + }; + return (
- - - {props.property.displayName} ({props.entities.length}) - + {entityIcon()} + {entityName()}
); -} +}; diff --git a/js/app/packages/macro-entity/src/components/PropertyPills/LinkPropertyPill.tsx b/js/app/packages/macro-entity/src/components/PropertyPills/LinkPropertyPill.tsx index 49a13709ee8..f32256d2216 100644 --- a/js/app/packages/macro-entity/src/components/PropertyPills/LinkPropertyPill.tsx +++ b/js/app/packages/macro-entity/src/components/PropertyPills/LinkPropertyPill.tsx @@ -3,11 +3,13 @@ import { extractDomain, PropertyDataTypeIcon, } from '@core/component/Properties/utils'; +import { Tooltip } from '@core/component/Tooltip'; import { useUnfurl } from '@core/signal/unfurl'; import { cornerClip } from '@core/util/clipPath'; import LinkIcon from '@icon/regular/link.svg'; import { proxyResource } from '@service-unfurl/client'; -import { createSignal, Show } from 'solid-js'; +import { createSignal, For, Show } from 'solid-js'; +import { PropertyPillTooltip } from './PropertyPillTooltip'; type LinkPropertyPillProps = { property: Property & { valueType: 'LINK' }; @@ -15,10 +17,10 @@ type LinkPropertyPillProps = { /** * Pill for link properties - * Single value: shows unfurled title or domain - * Multi value: shows "Links (N)" + * Single value: shows unfurled title or domain with tooltip + * Multi value: shows "Links (N)" with tooltip */ -export function LinkPropertyPill(props: LinkPropertyPillProps) { +export const LinkPropertyPill = (props: LinkPropertyPillProps) => { const links = () => props.property.value ?? []; const count = () => links().length; @@ -29,16 +31,182 @@ export function LinkPropertyPill(props: LinkPropertyPillProps) { return ; } - // Multiple links - show count + // Multiple links - show count with tooltip return ; -} +}; type SingleLinkPillProps = { property: Property & { valueType: 'LINK' }; url: string; }; -function SingleLinkPill(props: SingleLinkPillProps) { +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 ( + + } + floatingOptions={{ + offset: 4, + flip: true, + shift: { padding: 8 }, + }} + > +
+
+ } + > + setImageError(true)} + /> + + {title()} +
+
+
+ ); +}; + +type SingleLinkTooltipContentProps = { + property: Property & { valueType: 'LINK' }; + url: string; + title: string; + faviconUrl: string | null; +}; + +const SingleLinkTooltipContent = (props: SingleLinkTooltipContentProps) => { + const [imageError, setImageError] = createSignal(false); + + return ( + + + + ); +}; + +type MultiLinkPillProps = { + property: Property & { valueType: 'LINK' }; + urls: string[]; +}; + +const MultiLinkPill = (props: MultiLinkPillProps) => { + return ( + + } + floatingOptions={{ + offset: 4, + flip: true, + shift: { padding: 8 }, + }} + > +
+
+ + + {props.property.displayName} ({props.urls.length}) + +
+
+
+ ); +}; + +type LinkTooltipContentProps = { + property: Property & { valueType: 'LINK' }; + urls: string[]; +}; + +const LinkTooltipContent = (props: LinkTooltipContentProps) => { + return ( + +
+ {(url) => } +
+
+ ); +}; + +type LinkValuePillProps = { + url: string; +}; + +const LinkValuePill = (props: LinkValuePillProps) => { const [unfurlData] = useUnfurl(props.url); const [imageError, setImageError] = createSignal(false); @@ -60,7 +228,7 @@ function SingleLinkPill(props: SingleLinkPillProps) { return ( ); -} - -type MultiLinkPillProps = { - property: Property & { valueType: 'LINK' }; - urls: string[]; }; - -function MultiLinkPill(props: MultiLinkPillProps) { - return ( -
-
- - - {props.property.displayName} ({props.urls.length}) - -
-
- ); -} diff --git a/js/app/packages/macro-entity/src/components/PropertyPills/PropertyPillTooltip.tsx b/js/app/packages/macro-entity/src/components/PropertyPills/PropertyPillTooltip.tsx new file mode 100644 index 00000000000..7a13022f2cc --- /dev/null +++ b/js/app/packages/macro-entity/src/components/PropertyPills/PropertyPillTooltip.tsx @@ -0,0 +1,42 @@ +import type { Property } from '@core/component/Properties/types'; +import { PropertyDataTypeIcon } from '@core/component/Properties/utils'; +import { cornerClip } from '@core/util/clipPath'; +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) => { + return ( +
+
+
+ + + {props.property.displayName} + +
+ {props.children} +
+
+ ); +}; diff --git a/js/app/packages/macro-entity/src/components/PropertyPills/PropertyPills.tsx b/js/app/packages/macro-entity/src/components/PropertyPills/PropertyPills.tsx index 84bf3755382..7e28c310a43 100644 --- a/js/app/packages/macro-entity/src/components/PropertyPills/PropertyPills.tsx +++ b/js/app/packages/macro-entity/src/components/PropertyPills/PropertyPills.tsx @@ -3,11 +3,13 @@ import { formatPropertyValue, PropertyDataTypeIcon, } from '@core/component/Properties/utils'; +import { Tooltip } from '@core/component/Tooltip'; import { cornerClip } from '@core/util/clipPath'; 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[]; @@ -72,25 +74,87 @@ const TextPropertyPill = (props: PropertyPillProps) => { if (!value) return null; return ( -
} + floatingOptions={{ + offset: 4, + flip: true, + shift: { padding: 8 }, + }} >
- - - {value} - +
+ + + {value} + +
+
+ + ); +}; + +const TextTooltipContent = (props: { property: Property }) => { + const getValues = (): string[] => { + const { property } = props; + 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 []; + }; + + return ( + +
+ + {(value) => ( +
+
+ {value} +
+
+ )} +
-
+ ); }; From 8282101d172464719b433cbb5e2692f4392fbdd1 Mon Sep 17 00:00:00 2001 From: Daniel Kweon Date: Sat, 29 Nov 2025 09:19:29 -0500 Subject: [PATCH 9/9] feat: add responsive property pills with container queries - Add container-type:inline-size to Soup.tsx @container/soup - Update all property pill components to collapse at @3xl breakpoint (768px) - Pills show icon + text when wide (>=768px), icon-only when narrow - Applied to TextPropertyPill, BooleanPropertyPill, EntityPropertyPill, LinkPropertyPill - Preserves tooltips for all collapsed pills --- js/app/packages/app/component/Soup.tsx | 2 +- .../src/components/EntityWithEverything.tsx | 8 ++++---- .../PropertyPills/BooleanPropertyPill.tsx | 5 +++-- .../PropertyPills/EntityPropertyPill.tsx | 11 +++++++---- .../PropertyPills/LinkPropertyPill.tsx | 15 +++++++++------ .../components/PropertyPills/PropertyPills.tsx | 17 ++++++++++++----- 6 files changed, 36 insertions(+), 22 deletions(-) diff --git a/js/app/packages/app/component/Soup.tsx b/js/app/packages/app/component/Soup.tsx index 68df771e1cc..63963434289 100644 --- a/js/app/packages/app/component/Soup.tsx +++ b/js/app/packages/app/component/Soup.tsx @@ -394,7 +394,7 @@ export function Soup() { >
-
- 0}> + 0}> +
- -
+
+ {(shared) => ( { style={{ 'clip-path': cornerClip('0.2rem', 0, 0, 0) }} >
- +
diff --git a/js/app/packages/macro-entity/src/components/PropertyPills/EntityPropertyPill.tsx b/js/app/packages/macro-entity/src/components/PropertyPills/EntityPropertyPill.tsx index fb93eece6c1..2621859adcd 100644 --- a/js/app/packages/macro-entity/src/components/PropertyPills/EntityPropertyPill.tsx +++ b/js/app/packages/macro-entity/src/components/PropertyPills/EntityPropertyPill.tsx @@ -177,11 +177,13 @@ const SingleEntityPill = (props: SingleEntityPillProps) => { style={{ 'clip-path': cornerClip('0.2rem', 0, 0, 0) }} >
{entityIcon()} - {entityName()} +
@@ -228,7 +230,7 @@ const MultiEntityPill = (props: MultiEntityPillProps) => { style={{ 'clip-path': cornerClip('0.2rem', 0, 0, 0) }} >
{ data_type: 'ENTITY', specific_entity_type: props.property.specificEntityType, }} + class="size-3.5 shrink-0" /> - +
diff --git a/js/app/packages/macro-entity/src/components/PropertyPills/LinkPropertyPill.tsx b/js/app/packages/macro-entity/src/components/PropertyPills/LinkPropertyPill.tsx index f32256d2216..fd84674d1e2 100644 --- a/js/app/packages/macro-entity/src/components/PropertyPills/LinkPropertyPill.tsx +++ b/js/app/packages/macro-entity/src/components/PropertyPills/LinkPropertyPill.tsx @@ -81,22 +81,24 @@ const SingleLinkPill = (props: SingleLinkPillProps) => { style={{ 'clip-path': cornerClip('0.2rem', 0, 0, 0) }} >
} + fallback={} > setImageError(true)} /> - {title()} +
@@ -170,15 +172,16 @@ const MultiLinkPill = (props: MultiLinkPillProps) => { style={{ 'clip-path': cornerClip('0.2rem', 0, 0, 0) }} >
- +
diff --git a/js/app/packages/macro-entity/src/components/PropertyPills/PropertyPills.tsx b/js/app/packages/macro-entity/src/components/PropertyPills/PropertyPills.tsx index 7e28c310a43..6cd38546392 100644 --- a/js/app/packages/macro-entity/src/components/PropertyPills/PropertyPills.tsx +++ b/js/app/packages/macro-entity/src/components/PropertyPills/PropertyPills.tsx @@ -26,7 +26,7 @@ export const PropertyPills = (props: PropertyPillsProps) => { return ( 0}> -
+
{(property) => } @@ -65,7 +65,10 @@ const PropertyPill = (props: PropertyPillProps) => { }; /** - * Pill for String, Number, Date, Select types + * Pill - shows icon + text when wide, icon only when narrow + * Uses @container/soup from Soup.tsx + * - >= @3xl (~768px): full (icon + text) + * - < @3xl: compact (icon only) */ const TextPropertyPill = (props: PropertyPillProps) => { const displayValue = () => formatPillValue(props.property); @@ -83,11 +86,11 @@ const TextPropertyPill = (props: PropertyPillProps) => { }} >
{ data_type: props.property.valueType, specific_entity_type: props.property.specificEntityType, }} + class="size-3.5 shrink-0" /> - +
@@ -105,6 +109,9 @@ const TextPropertyPill = (props: PropertyPillProps) => { ); }; +/** + * Tooltip content for a property pill + */ const TextTooltipContent = (props: { property: Property }) => { const getValues = (): string[] => { const { property } = props;