Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat: support file archive icon (#243)
gbirman4ecac638bc00
diff --git a/js/app/packages/core/component/EntityIcon.tsx b/js/app/packages/core/component/EntityIcon.tsxindex 195ab58aa2..26d23af1a8 100644--- a/js/app/packages/core/component/EntityIcon.tsx+++ b/js/app/packages/core/component/EntityIcon.tsx@@ -9,6 +9,7 @@ import Chat from '@icon/duotone/chat-duotone.svg';import FileCode from '@icon/duotone/code-duotone.svg';import Email from '@icon/duotone/envelope-duotone.svg';import EmailRead from '@icon/duotone/envelope-open-duotone.svg';+import FileArchive from '@icon/duotone/file-archive-duotone.svg';import FileDoc from '@icon/duotone/file-doc-duotone.svg';import File from '@icon/duotone/file-duotone.svg';import FileHtml from '@icon/duotone/file-html-duotone.svg';@@ -44,6 +45,7 @@ import PixelUser from '@macro-icons/pixel/user.svg';import PixelUsers from '@macro-icons/pixel/users.svg';import PixelVideo from '@macro-icons/pixel/video.svg';import PixelWord from '@macro-icons/pixel/write.svg';+import { FileTypeMap } from '@service-storage/fileTypeMap';import type { FileType } from '@service-storage/generated/schemas/fileType';import type { Component, JSX } from 'solid-js';import { Dynamic } from 'solid-js/web';@@ -62,7 +64,14 @@ export type EntityWithValidIcon =| 'company'| 'user'| 'directMessage'- | 'emailRead';+ | 'emailRead'+ | 'archive';++const ARCHIVE_EXTENSIONS = new Set(+ Object.values(FileTypeMap)+ .filter((ft) => ft.app === 'archive')+ .map((ft) => ft.extension)+);export const ENTITY_ICON_CONFIGS: Record<EntityWithValidIcon, IconConfig> = {canvas: {@@ -161,6 +170,12 @@ export const ENTITY_ICON_CONFIGS: Record<EntityWithValidIcon, IconConfig> = {background: 'bg-default-bg',prettyName: 'File',},+ archive: {+ icon: FileArchive,+ foreground: 'text-default',+ background: 'bg-default-bg',+ prettyName: 'Archive',+ },video: {icon: FileVideo,foreground: 'text-video',@@ -199,20 +214,27 @@ export const ENTITY_ICON_CONFIGS: Record<EntityWithValidIcon, IconConfig> = {},};-function isFileType(entity: string): boolean {- return blockAcceptedFileExtensionSet.has(entity);+// this will match fall-through cases like code files which match multiple extensions+// or docx files which no longer have their own block+function isFileType(ext: string): boolean {+ return blockAcceptedFileExtensionSet.has(ext);+}++// this lets us show a archive icon for certain files which still get mapped to block-unknown+function isArchiveType(ext: string): boolean {+ return ARCHIVE_EXTENSIONS.has(ext as any);}function validateEntity(entity: string): EntityWithValidIcon {if (entity in ENTITY_ICON_CONFIGS) {return entity as EntityWithValidIcon;+ } else if (isFileType(entity)) {+ return fileTypeToBlockName(entity, true);+ } else if (isArchiveType(entity)) {+ return 'archive';} else {- if (isFileType(entity)) {- const blockName = fileTypeToBlockName(entity, true);- return blockName as EntityWithValidIcon;- }+ return 'default';}- return 'default';}export const PIXEL_ICONS: Record<EntityWithValidIcon, Component> = {@@ -232,6 +254,7 @@ export const PIXEL_ICONS: Record<EntityWithValidIcon, Component> = {project: PixelFolder,sharedProject: PixelFolder,unknown: PixelUnknown,+ archive: PixelUnknown,video: PixelVideo,contact: PixelUser,default: PixelFile,