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(icon): display calendar icon on invite emails (#2056)

Aidan Holloway-Bidwell90a8efacb279
diff --git a/js/app/packages/block-email/component/TopBar.tsx b/js/app/packages/block-email/component/TopBar.tsx
index 705e22eaab..b3c4ee7f29 100644
--- a/js/app/packages/block-email/component/TopBar.tsx
+++ b/js/app/packages/block-email/component/TopBar.tsx
@@ -41,6 +41,11 @@ export function TopBar(props: {
const soup = useMaybeSoup();
const linksQuery = useEmailLinksQuery();
+ const isInvite = () => {
+ const entity = soup?.items.get(props.id);
+ return entity?.type === 'email' && entity.hasIcsAttachment === true;
+ };
+
const isOwnThread = () => {
const thread = emailCtx.thread();
const links = linksQuery.data?.links;
@@ -128,7 +133,7 @@ export function TopBar(props: {
<>
<SplitHeaderLeft>
<StaticSplitLabel
- iconType="email"
+ iconType={isInvite() ? 'emailInvite' : 'email'}
label={props.title}
badges={
props.isDraft
diff --git a/js/app/packages/core/component/EntityIcon.tsx b/js/app/packages/core/component/EntityIcon.tsx
index 172bcc2b70..a90a2fea59 100644
--- a/js/app/packages/core/component/EntityIcon.tsx
+++ b/js/app/packages/core/component/EntityIcon.tsx
@@ -32,6 +32,7 @@ import WideChat from '@macro-icons/wide/chat.svg';
import WideCsv from '@macro-icons/wide/csv.svg';
import WideDiagram from '@macro-icons/wide/diagram.svg';
import WideDocx from '@macro-icons/wide/docx.svg';
+import WideCalendar from '@macro-icons/wide/calendar.svg';
import WideEmail from '@macro-icons/wide/email.svg';
import WideFileCode from '@macro-icons/wide/file-code.svg';
import WideFileImage from '@macro-icons/wide/file-image.svg';
@@ -70,6 +71,7 @@ export type EntityWithValidIcon =
| 'default'
| 'sharedProject'
| 'emailRead'
+ | 'emailInvite'
| 'archive'
| 'html';
@@ -218,6 +220,12 @@ export const ENTITY_ICON_CONFIGS: Record<EntityWithValidIcon, IconConfig> = {
background: 'bg-default-bg',
prettyName: 'Read Email',
},
+ emailInvite: {
+ icon: WideCalendar,
+ foreground: 'text-email',
+ background: 'bg-email-bg',
+ prettyName: 'Calendar Invite',
+ },
task: {
icon: Check,
foreground: 'text-task',
@@ -275,6 +283,7 @@ export const WIDE_ICONS: Record<EntityWithValidIcon, Component> = {
contact: WideUser,
default: WideUnknown,
emailRead: WideEmail,
+ emailInvite: WideCalendar,
task: WideTask,
};
diff --git a/js/app/packages/entity/src/extractors/entity-icon.tsx b/js/app/packages/entity/src/extractors/entity-icon.tsx
index 77f2d6689d..39eff43cd5 100644
--- a/js/app/packages/entity/src/extractors/entity-icon.tsx
+++ b/js/app/packages/entity/src/extractors/entity-icon.tsx
@@ -60,7 +60,9 @@ export function EntityIcon(props: EntityIconProps) {
})
.with({ type: 'chat' }, () => 'chat')
.with({ type: 'project' }, () => 'project')
- .with({ type: 'email' }, ({ isRead }) => (isRead ? 'emailRead' : 'email'))
+ .with({ type: 'email' }, ({ isRead, hasIcsAttachment }) =>
+ hasIcsAttachment ? 'emailInvite' : isRead ? 'emailRead' : 'email'
+ )
.otherwise(() => 'default');
};