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: block unknown archive icon in top bar (#255)

gbirman236cefbd5d6f
diff --git a/js/app/packages/app/component/split-layout/components/SplitLabel.tsx b/js/app/packages/app/component/split-layout/components/SplitLabel.tsx
index 00a854669d..4edfcbdae8 100644
--- a/js/app/packages/app/component/split-layout/components/SplitLabel.tsx
+++ b/js/app/packages/app/component/split-layout/components/SplitLabel.tsx
@@ -2,8 +2,10 @@ import { isInBlock, useBlockId, useBlockName } from '@core/block';
import {
EntityIcon,
type EntityIconSelector,
+ isArchiveType,
} from '@core/component/EntityIcon';
import { Tooltip } from '@core/component/Tooltip';
+import { blockMetadataSignal } from '@core/signal/load';
import {
useCanComment,
useCanEdit,
@@ -136,13 +138,24 @@ export function BlockItemSplitLabel(props: {
const blockName = useBlockName();
const isOwner = useIsDocumentOwner();
+ const targetType = () => {
+ // archive files have a special icon
+ if (blockName === 'unknown') {
+ const fileType = blockMetadataSignal()?.fileType;
+ if (fileType && isArchiveType(fileType)) {
+ return 'archive';
+ }
+ }
+ return blockName;
+ };
+
createEffect(() => {
panel.handle.setDisplayName(fileName());
});
return (
<div class="z-3 relative flex items-center gap-2 border-y border-edge-muted w-screen max-w-full h-full shrink">
- <EntityIcon class="shrink-0" targetType={blockName} size="xs" />
+ <EntityIcon class="shrink-0" targetType={targetType()} size="xs" />
<Show when={props.badges}>{props.badges}</Show>
<SplitLabel
label={fileName()}
diff --git a/js/app/packages/core/component/EntityIcon.tsx b/js/app/packages/core/component/EntityIcon.tsx
index 26d23af1a8..ba19f6a5b3 100644
--- a/js/app/packages/core/component/EntityIcon.tsx
+++ b/js/app/packages/core/component/EntityIcon.tsx
@@ -221,7 +221,7 @@ function isFileType(ext: string): boolean {
}
// this lets us show a archive icon for certain files which still get mapped to block-unknown
-function isArchiveType(ext: string): boolean {
+export function isArchiveType(ext: string): boolean {
return ARCHIVE_EXTENSIONS.has(ext as any);
}