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.

add [properties-fe] - entity icons for threads, emails, tasks (#524)

Daniel Kweon69205ef93a79
diff --git a/js/app/packages/core/component/EntityIcon.tsx b/js/app/packages/core/component/EntityIcon.tsx
index fa7416e509..8cd3ebd218 100644
--- a/js/app/packages/core/component/EntityIcon.tsx
+++ b/js/app/packages/core/component/EntityIcon.tsx
@@ -280,7 +280,7 @@ export const WIDE_ICONS: Record<EntityWithValidIcon, Component> = {
canvas: WideDiagram,
html: WideFileCode,
channel: WideChannel,
- company: WideChannel,
+ company: Building,
email: WideEmail,
code: WideFileCode,
pdf: WideBook,
diff --git a/js/app/packages/core/component/Properties/component/propertyValue/EntityIcon.tsx b/js/app/packages/core/component/Properties/component/propertyValue/EntityIcon.tsx
index cba4ca28d4..b787b91b69 100644
--- a/js/app/packages/core/component/Properties/component/propertyValue/EntityIcon.tsx
+++ b/js/app/packages/core/component/Properties/component/propertyValue/EntityIcon.tsx
@@ -1,25 +1,9 @@
-import { useChannelName } from '@core/component/ChannelsProvider';
-import { EntityIcon as CoreEntityIcon } from '@core/component/EntityIcon';
import { IconButton } from '@core/component/IconButton';
import { BlockLink } from '@core/component/LexicalMarkdown/component/core/BlockLink';
-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 DeleteIcon from '@icon/bold/x-bold.svg';
-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 User from '@icon/duotone/user-duotone.svg';
-import ThreeUsersIcon from '@icon/duotone/users-three-duotone.svg';
import type { EntityType } from '@service-properties/generated/schemas/entityType';
-import {
- type Component,
- createMemo,
- createSignal,
- type ParentProps,
- Show,
-} from 'solid-js';
+import { type Component, createSignal, type ParentProps, Show } from 'solid-js';
+import { usePropertyEntityDisplay } from '../../hooks';
import type { Property } from '../../types';
type EntityValueDisplayProps = ParentProps<{
@@ -31,141 +15,18 @@ type EntityValueDisplayProps = ParentProps<{
isSaving?: boolean;
}>;
-const ICON_CLASSES = 'size-4 text-ink-muted';
-
export const EntityIcon: Component<EntityValueDisplayProps> = (props) => {
const [isHovered, setIsHovered] = createSignal(false);
- // Get preview for items that need it (document, project, chat, channel for icon)
- const previewTypes: EntityType[] = ['DOCUMENT', 'PROJECT', 'CHAT', 'CHANNEL'];
- const needsPreview = previewTypes.includes(props.entityType);
-
- const [preview] = useItemPreview({
- id: needsPreview ? props.entityId : '',
- type: needsPreview
- ? (props.entityType.toLowerCase() as
- | 'document'
- | 'project'
- | 'chat'
- | 'channel')
- : undefined,
- });
-
- const entityName = createMemo(() => {
- switch (props.entityType) {
- case 'USER': {
- const displayName = idToDisplayName(props.entityId);
- return displayName.replace('macro|', '');
- }
- case 'CHANNEL': {
- const channelName = useChannelName(props.entityId, 'Unknown 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 ${props.entityType.toLowerCase()}`;
- }
- default:
- return props.entityId;
- }
- });
-
- const entityIcon = createMemo(() => {
- switch (props.entityType) {
- case 'USER':
- return (
- <UserIcon
- id={props.entityId}
- size="xs"
- isDeleted={false}
- suppressClick={true}
- />
- );
-
- case 'CHANNEL': {
- const previewItem = preview();
- if (
- !previewItem ||
- previewItem.loading ||
- !isAccessiblePreviewItem(previewItem)
- ) {
- return <ChannelIcon class={ICON_CLASSES} />;
- }
-
- const channelType = previewItem.channelType;
- switch (channelType) {
- case 'direct_message':
- return <User 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 'DOCUMENT': {
- const previewItem = preview();
- if (
- !previewItem ||
- previewItem.loading ||
- !isAccessiblePreviewItem(previewItem)
- ) {
- return <CoreEntityIcon targetType="unknown" size="xs" />;
- }
-
- const fileType = previewItem.fileType;
- const blockName = fileType
- ? fileTypeToBlockName(fileType, true)
- : 'unknown';
- return <CoreEntityIcon targetType={blockName} size="xs" />;
- }
-
- case 'PROJECT':
- return <CoreEntityIcon targetType="project" size="xs" />;
-
- case 'CHAT':
- return <CoreEntityIcon targetType="chat" size="xs" />;
-
- default:
- return <CoreEntityIcon targetType="unknown" size="xs" />;
- }
- });
-
- const blockOrFileType = createMemo(() => {
- // For channels and chats, use the entity type directly (lowercase for BlockLink)
- const linkableTypes: EntityType[] = ['CHANNEL', 'CHAT', 'PROJECT'];
- if (linkableTypes.includes(props.entityType)) {
- return props.entityType.toLowerCase();
- }
-
- // For documents, get the file type from preview
- if (props.entityType === 'DOCUMENT') {
- const previewItem = preview();
- if (
- !previewItem ||
- previewItem.loading ||
- !isAccessiblePreviewItem(previewItem)
- ) {
- return null;
- }
- return previewItem.fileType || null;
- }
-
- return null;
- });
+ const { name, icon, blockOrFileType } = usePropertyEntityDisplay(
+ () => props.entityId,
+ () => props.entityType
+ );
const content = (
<div class="flex items-center gap-2">
- <div class="flex-shrink-0">{entityIcon()}</div>
- <span class="truncate font-mono">{entityName()}</span>
+ <div class="flex-shrink-0">{icon()}</div>
+ <span class="truncate font-mono">{name()}</span>
</div>
);
diff --git a/js/app/packages/core/component/Properties/hooks/index.ts b/js/app/packages/core/component/Properties/hooks/index.ts
index 9aaa7a4cfd..b8f18c6f3c 100644
--- a/js/app/packages/core/component/Properties/hooks/index.ts
+++ b/js/app/packages/core/component/Properties/hooks/index.ts
@@ -2,4 +2,5 @@ export { useBooleanEditor } from './useBooleanEditor';
export { useEntityProperties } from './useEntityProperties';
export { useInlineEditor } from './useInlineEditor';
export { usePropertyEditor } from './usePropertyEditor';
+export { usePropertyEntityDisplay } from './usePropertyEntityDisplay';
export { usePropertySelection } from './usePropertySelection';
diff --git a/js/app/packages/core/component/Properties/hooks/usePropertyEntityDisplay.tsx b/js/app/packages/core/component/Properties/hooks/usePropertyEntityDisplay.tsx
new file mode 100644
index 0000000000..406a9ce844
--- /dev/null
+++ b/js/app/packages/core/component/Properties/hooks/usePropertyEntityDisplay.tsx
@@ -0,0 +1,213 @@
+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 type { EntityType } from '@service-properties/generated/schemas/entityType';
+import { type Accessor, createMemo, type JSX } from 'solid-js';
+
+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',
+ 'PROJECT',
+ 'CHAT',
+ 'CHANNEL',
+];
+
+type PropertyEntityDisplayResult = {
+ /** Resolved display name for the entity */
+ name: Accessor<string>;
+ /** Icon JSX element for the entity */
+ icon: Accessor<JSX.Element>;
+ /** Whether preview data is still loading */
+ isLoading: Accessor<boolean>;
+ /** Block or file type for linking (null if not linkable) */
+ blockOrFileType: Accessor<string | null>;
+};
+
+/**
+ * Hook to resolve entity display information (name, icon) for property entity values.
+ * Handles preview fetching, channel name resolution, and user display names.
+ *
+ * @param entityId - The entity's unique identifier
+ * @param entityType - The type of entity (USER, CHANNEL, DOCUMENT, etc.)
+ * @param options - Optional configuration
+ * @returns Object with name, icon, isLoading, and blockOrFileType accessors
+ */
+export function usePropertyEntityDisplay(
+ entityId: Accessor<string>,
+ entityType: Accessor<EntityType>,
+ options?: {
+ /** Custom fallback icon for unknown entity types (null to show nothing) */
+ fallbackIcon?: JSX.Element | null;
+ }
+): PropertyEntityDisplayResult {
+ const needsPreview = () =>
+ PREVIEWABLE_ENTITY_TYPES.includes(entityType().toUpperCase() as EntityType);
+
+ // Map entity type to preview type (TASK uses 'document' for preview lookup)
+ const getPreviewType = () => {
+ const type = entityType().toUpperCase();
+ if (type === 'TASK') return 'document';
+ return type.toLowerCase() as 'document' | 'project' | 'chat' | 'channel';
+ };
+
+ const [preview] = useItemPreview({
+ id: needsPreview() ? entityId() : '',
+ type: needsPreview() ? getPreviewType() : undefined,
+ });
+
+ const channelName = useChannelName(
+ entityType().toUpperCase() === 'CHANNEL' ? entityId() : '',
+ 'Unknown Channel'
+ );
+
+ const isLoading = createMemo(() => {
+ if (!needsPreview()) 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': {
+ 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';
+ case 'THREAD':
+ return entityId() ?? 'Thread';
+ 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 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)
+ ) {
+ return <CoreEntityIcon targetType="unknown" size="xs" />;
+ }
+
+ // Tasks are documents with subType 'task'
+ if (previewItem.subType === 'task') {
+ return <CoreEntityIcon targetType="task" size="xs" />;
+ }
+
+ const fileType = previewItem.fileType;
+ const blockName = fileType
+ ? fileTypeToBlockName(fileType, true)
+ : 'unknown';
+ 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:
+ 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();
+ }
+
+ // For documents, get the file type from preview
+ if (type === 'DOCUMENT') {
+ const previewItem = preview();
+ if (
+ !previewItem ||
+ previewItem.loading ||
+ !isAccessiblePreviewItem(previewItem)
+ ) {
+ return null;
+ }
+ return previewItem.fileType || null;
+ }
+
+ return null;
+ });
+
+ return {
+ name,
+ icon,
+ isLoading,
+ blockOrFileType,
+ };
+}
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 b60f97e652..98e01a08dc 100644
--- a/js/app/packages/macro-entity/src/components/PropertyPills/EntityPropertyPill.tsx
+++ b/js/app/packages/macro-entity/src/components/PropertyPills/EntityPropertyPill.tsx
@@ -1,31 +1,13 @@
-import { useChannelName } from '@core/component/ChannelsProvider';
-import { EntityIcon as CoreEntityIcon } from '@core/component/EntityIcon';
+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 { 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 { EntityType } from '@service-properties/generated/schemas/entityType';
+import type { EntityType } from '@service-properties/generated/schemas/entityType';
import { For, Show } from 'solid-js';
import { PropertyPillTooltip } from './PropertyPillTooltip';
-/** Entity types that require preview lookup for name/icon resolution */
-const PREVIEWABLE_ENTITY_TYPES: EntityType[] = [
- EntityType.DOCUMENT,
- EntityType.PROJECT,
- EntityType.CHAT,
- EntityType.CHANNEL,
-];
-
type EntityPropertyPillProps = {
property: Property & { valueType: 'ENTITY' };
};
@@ -57,114 +39,21 @@ type SingleEntityPillProps = {
entity: EntityReference;
};
-const ICON_CLASSES = 'size-4 text-ink-muted';
-
const SingleEntityPill = (props: SingleEntityPillProps) => {
- const entityType = () => props.entity.entity_type;
- const entityId = () => props.entity.entity_id;
-
- const needsPreview = () =>
- PREVIEWABLE_ENTITY_TYPES.includes(entityType() as 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 <UserIcon id={entityId()} size="xs" />;
-
- case 'CHANNEL': {
- const previewItem = preview();
- if (
- !previewItem ||
- previewItem.loading ||
- !isAccessiblePreviewItem(previewItem)
- ) {
- return <ChannelIcon class={ICON_CLASSES} />;
- }
-
- 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 'DOCUMENT': {
- const previewItem = preview();
- if (
- !previewItem ||
- previewItem.loading ||
- !isAccessiblePreviewItem(previewItem)
- ) {
- return <CoreEntityIcon targetType="unknown" size="xs" />;
- }
-
- const fileType = previewItem.fileType;
- const blockName = fileType
- ? fileTypeToBlockName(fileType, true)
- : 'unknown';
- return <CoreEntityIcon targetType={blockName} size="xs" />;
- }
-
- case 'PROJECT':
- return <CoreEntityIcon targetType="project" size="xs" />;
-
- case 'CHAT':
- return <CoreEntityIcon targetType="chat" size="xs" />;
-
- default:
- return (
- <PropertyDataTypeIcon
- property={{
- data_type: 'ENTITY',
- specific_entity_type: props.property.specificEntityType,
- }}
- />
- );
+ 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
@@ -188,9 +77,9 @@ const SingleEntityPill = (props: SingleEntityPillProps) => {
class="inline-flex items-center gap-1.5 p-1.5 @3xl/soup:px-2 @3xl/soup:py-1 text-xs leading-none text-ink-muted bg-panel box-border"
style={{ 'clip-path': cornerClip('calc(0.2rem - 0.5px)', 0, 0, 0) }}
>
- <Show when={entityIcon()}>{entityIcon()}</Show>
+ <Show when={icon()}>{icon()}</Show>
<span class="truncate max-w-[120px] hidden @3xl/soup:inline">
- {entityName()}
+ {name()}
</span>
</div>
</div>
@@ -207,7 +96,7 @@ const SingleEntityTooltipContent = (props: SingleEntityTooltipContentProps) => {
return (
<PropertyPillTooltip property={props.property}>
<div class="flex items-center gap-1.5 flex-wrap">
- <EntityValuePill entity={props.entity} property={props.property} />
+ <EntityValuePill entity={props.entity} />
</div>
</PropertyPillTooltip>
);
@@ -267,9 +156,7 @@ const EntityTooltipContent = (props: EntityTooltipContentProps) => {
<PropertyPillTooltip property={props.property}>
<div class="flex items-center gap-1.5 flex-wrap">
<For each={props.entities}>
- {(entity) => (
- <EntityValuePill entity={entity} property={props.property} />
- )}
+ {(entity) => <EntityValuePill entity={entity} />}
</For>
</div>
</PropertyPillTooltip>
@@ -278,109 +165,15 @@ const EntityTooltipContent = (props: EntityTooltipContentProps) => {
type EntityValuePillProps = {
entity: EntityReference;
- property: Property & { valueType: 'ENTITY' };
};
const EntityValuePill = (props: EntityValuePillProps) => {
- const entityType = () => props.entity.entity_type;
- const entityId = () => props.entity.entity_id;
-
- const needsPreview = () =>
- PREVIEWABLE_ENTITY_TYPES.includes(entityType() as 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 { name, icon } = usePropertyEntityDisplay(
+ () => props.entity.entity_id,
+ () => props.entity.entity_type as EntityType,
+ { fallbackIcon: null }
);
- 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 <UserIcon id={entityId()} size="xs" />;
-
- case 'CHANNEL': {
- const previewItem = preview();
- if (
- !previewItem ||
- previewItem.loading ||
- !isAccessiblePreviewItem(previewItem)
- ) {
- return <ChannelIcon class={ICON_CLASSES} />;
- }
-
- 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 'DOCUMENT': {
- const previewItem = preview();
- if (
- !previewItem ||
- previewItem.loading ||
- !isAccessiblePreviewItem(previewItem)
- ) {
- return <CoreEntityIcon targetType="unknown" size="xs" />;
- }
-
- const fileType = previewItem.fileType;
- const blockName = fileType
- ? fileTypeToBlockName(fileType, true)
- : 'unknown';
- return <CoreEntityIcon targetType={blockName} size="xs" />;
- }
-
- case 'PROJECT':
- return <CoreEntityIcon targetType="project" size="xs" />;
-
- case 'CHAT':
- return <CoreEntityIcon targetType="chat" size="xs" />;
-
- default:
- return null;
- }
- };
-
return (
<div
class="p-px bg-edge box-border h-fit w-fit flex items-center"
@@ -390,8 +183,8 @@ const EntityValuePill = (props: EntityValuePillProps) => {
class="inline-flex items-center gap-1.5 px-2 py-1 text-xs leading-none text-ink-muted bg-panel box-border"
style={{ 'clip-path': cornerClip('calc(0.2rem - 0.5px)', 0, 0, 0) }}
>
- <Show when={entityIcon()}>{entityIcon()}</Show>
- <span class="truncate max-w-[150px]">{entityName()}</span>
+ <Show when={icon()}>{icon()}</Show>
+ <span class="truncate max-w-[150px]">{name()}</span>
</div>
</div>
);