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] - handle entity type threads (#528)

Daniel Kweona720217d541e
diff --git a/js/app/packages/core/component/Properties/component/modal/shared/PropertyEntitySelector.tsx b/js/app/packages/core/component/Properties/component/modal/shared/PropertyEntitySelector.tsx
index d6b40f125f..3e4661fcdd 100644
--- a/js/app/packages/core/component/Properties/component/modal/shared/PropertyEntitySelector.tsx
+++ b/js/app/packages/core/component/Properties/component/modal/shared/PropertyEntitySelector.tsx
@@ -8,6 +8,7 @@ import { createFreshSearch } from '@core/util/freshSort';
import CheckIcon from '@icon/bold/check-bold.svg';
import CompanyIcon from '@icon/duotone/building-duotone.svg';
import ChannelBuildingIcon from '@icon/duotone/building-office-duotone.svg';
+import ThreadIcon from '@icon/duotone/envelope-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';
@@ -67,7 +68,8 @@ type CombinedEntity =
| { kind: 'item'; id: string; data: Item }
| { kind: 'user'; id: string; data: IUser }
| { kind: 'channel'; id: string; data: ChannelWithParticipants }
- | { kind: 'company'; id: string; data: null };
+ | { kind: 'company'; id: string; data: null }
+ | { kind: 'thread'; id: string; data: null };
function entityMapper(kind: 'item' | 'user' | 'channel') {
return (data: Item | IUser | ChannelWithParticipants): CombinedEntity => {
@@ -88,6 +90,8 @@ function getEntityName(entity: CombinedEntity): string {
return entity.data.name ?? '';
case 'company':
return entity.id;
+ case 'thread':
+ return entity.id;
}
}
@@ -104,6 +108,8 @@ function getEntitySearchText(entity: CombinedEntity): string {
return entity.data.name ?? '';
case 'company':
return entity.id;
+ case 'thread':
+ return entity.id;
}
}
@@ -117,6 +123,8 @@ function getEntityType(entity: CombinedEntity): string {
return entity.data.type.toUpperCase();
case 'company':
return 'COMPANY';
+ case 'thread':
+ return 'THREAD';
}
}
@@ -157,6 +165,8 @@ function getEntityIcon(entity: CombinedEntity) {
}
case 'company':
return <CompanyIcon class={ICON_CLASSES} />;
+ case 'thread':
+ return <ThreadIcon class={ICON_CLASSES} />;
}
}
@@ -195,6 +205,11 @@ export function PropertyEntitySelector(props: EntityInputProps) {
return [];
}
+ if (specificEntityType === 'THREAD') {
+ // TODO: Implement thread data source
+ return [];
+ }
+
const itemTypes: EntityType[] = ['DOCUMENT', 'PROJECT', 'CHAT'];
if (itemTypes.includes(specificEntityType)) {
return history()
diff --git a/js/app/packages/core/component/Properties/utils/PropertyDataTypeIcon.tsx b/js/app/packages/core/component/Properties/utils/PropertyDataTypeIcon.tsx
index 42aadc2dc1..5c10c1becc 100644
--- a/js/app/packages/core/component/Properties/utils/PropertyDataTypeIcon.tsx
+++ b/js/app/packages/core/component/Properties/utils/PropertyDataTypeIcon.tsx
@@ -1,4 +1,5 @@
import CompanyIcon from '@icon/duotone/building-duotone.svg';
+import ThreadIcon from '@icon/duotone/envelope-duotone.svg';
import CalculatorIcon from '@icon/regular/calculator.svg';
import CalendarBlankIcon from '@icon/regular/calendar-blank.svg';
import ChatIcon from '@icon/regular/chat.svg';
@@ -41,6 +42,8 @@ export const PropertyDataTypeIcon: Component<PropertyDataTypeIconProps> = (
return <HashIcon class={iconClasses} />;
case 'COMPANY':
return <CompanyIcon class={iconClasses} />;
+ case 'THREAD':
+ return <ThreadIcon class={iconClasses} />;
default:
return <SimpleTagIcon class={iconClasses} />;
}
diff --git a/js/app/packages/core/component/Properties/utils/display.ts b/js/app/packages/core/component/Properties/utils/display.ts
index 1e88aa0deb..2c47b64514 100644
--- a/js/app/packages/core/component/Properties/utils/display.ts
+++ b/js/app/packages/core/component/Properties/utils/display.ts
@@ -18,7 +18,7 @@ export const getPropertyDataTypeDropdownOptions = () => [
{ value: 'entity:PROJECT' as const, label: 'Project' },
{ value: 'entity:CHAT' as const, label: 'Chat' },
// { value: 'entity:COMPANY' as const, label: 'Company' },
- // { value: 'entity:THREAD' as const, label: 'Thread' }, // Not yet supported
+ // { value: 'entity:THREAD' as const, label: 'Thread' },
{ value: 'entity' as const, label: 'Any Entity' },
];