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 CSV icon and display it for .csv files in soup and block header (#876)

Aidan Holloway-Bidwell8af22515e92c
diff --git a/js/app/packages/block-code/definition.ts b/js/app/packages/block-code/definition.ts
index f42a41450b..eca9df8931 100644
--- a/js/app/packages/block-code/definition.ts
+++ b/js/app/packages/block-code/definition.ts
@@ -12,6 +12,7 @@ import { supportedExtensions } from './util/languageSupport';
export const definition = defineBlock({
name: 'code',
description: 'Edit code files with syntax highlighting and formatting',
+ aliases: [{ name: 'csv', defaultFileName: 'New CSV' }],
component: BlockCode,
async load(source, intent) {
if (intent === 'preload') {
diff --git a/js/app/packages/core/block.ts b/js/app/packages/core/block.ts
index a090ea76ad..1ceccbe905 100644
--- a/js/app/packages/core/block.ts
+++ b/js/app/packages/core/block.ts
@@ -71,7 +71,7 @@ export type BlockName = (typeof BlockRegistry)[BlockNameKeys];
* List of strongly-typed, valid aliases that can be used as pseudo-differentiated
* block types.
*/
-export const BlockAliasRegistry = ['task'] as const;
+export const BlockAliasRegistry = ['csv', 'task'] as const;
type BlockAliasKeys = keyof typeof BlockAliasRegistry & number;
diff --git a/js/app/packages/core/component/EntityIcon.tsx b/js/app/packages/core/component/EntityIcon.tsx
index 8cd3ebd218..d2f2e1a2c0 100644
--- a/js/app/packages/core/component/EntityIcon.tsx
+++ b/js/app/packages/core/component/EntityIcon.tsx
@@ -49,6 +49,7 @@ import PixelWord from '@macro-icons/pixel/write.svg';
import WideBook from '@macro-icons/wide/book.svg';
import WideChannel from '@macro-icons/wide/channel.svg';
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 WideEmail from '@macro-icons/wide/email.svg';
@@ -128,6 +129,12 @@ export const ENTITY_ICON_CONFIGS: Record<EntityWithValidIcon, IconConfig> = {
background: 'bg-code-bg',
prettyName: 'Code',
},
+ csv: {
+ icon: WideCsv,
+ foreground: 'text-code',
+ background: 'bg-code-bg',
+ prettyName: 'CSV',
+ },
pdf: {
icon: FilePdf,
foreground: 'text-pdf',
@@ -258,6 +265,7 @@ export const PIXEL_ICONS: Record<EntityWithValidIcon, Component> = {
company: PixelBuilding,
email: PixelEmail,
code: PixelCode,
+ csv: PixelCode,
pdf: PixelPdf,
md: PixelMd,
image: PixelImage,
@@ -283,6 +291,7 @@ export const WIDE_ICONS: Record<EntityWithValidIcon, Component> = {
company: Building,
email: WideEmail,
code: WideFileCode,
+ csv: WideCsv,
pdf: WideBook,
md: WideFileMd,
image: WideFileImage,
diff --git a/js/app/packages/core/component/FileList/constants.tsx b/js/app/packages/core/component/FileList/constants.tsx
index d24567e225..4f9a125c20 100644
--- a/js/app/packages/core/component/FileList/constants.tsx
+++ b/js/app/packages/core/component/FileList/constants.tsx
@@ -64,6 +64,7 @@ export const fileTypeColors: Record<
pdf: 'bg-pdf/20 group/item',
md: 'bg-note/20 group/item',
code: 'bg-code/20 group/item',
+ csv: 'bg-code/20 group/item',
image: 'bg-image/20 group/item',
canvas: 'bg-canvas/20 group/item',
video: 'bg-video/20 group/item',
diff --git a/js/app/packages/macro-icons/wide/csv.svg b/js/app/packages/macro-icons/wide/csv.svg
new file mode 100644
index 0000000000..664efce41c
--- /dev/null
+++ b/js/app/packages/macro-icons/wide/csv.svg
@@ -0,0 +1,8 @@
+<svg width="100%" height="100%" viewBox="0 -3 18 18" fill="currentColor" stroke="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M17.39 0H1.64V1.5H16.64V10.5H18.14V0.75C18.14 0.34 17.8 0 17.39 0Z"/>
+<path d="M1.64 1.5H0.14V6H1.64V1.5Z"/>
+<path d="M1.83 12.1C1.43 12.1 1.1 12.01 0.83 11.84C0.56 11.67 0.35 11.41 0.21 11.07C0.07 10.73 0 10.32 0 9.83C0 9.11 0.16 8.55 0.47 8.15C0.78 7.75 1.23 7.55 1.83 7.55C2.15 7.55 2.43 7.61 2.67 7.73C2.91 7.85 3.1 8.03 3.25 8.27C3.4 8.51 3.49 8.81 3.53 9.17C3.53 9.21 3.52 9.22 3.48 9.22H2.46C2.46 9.22 2.41 9.2 2.41 9.17C2.38 8.9 2.32 8.71 2.23 8.59C2.13 8.47 2 8.41 1.84 8.41C1.62 8.41 1.45 8.52 1.34 8.75C1.23 8.98 1.18 9.33 1.18 9.82C1.18 10.31 1.23 10.68 1.34 10.9C1.45 11.12 1.62 11.23 1.84 11.23C2.02 11.23 2.15 11.17 2.25 11.04C2.35 10.91 2.41 10.72 2.42 10.47C2.42 10.44 2.44 10.42 2.47 10.42H3.51C3.51 10.42 3.56 10.44 3.56 10.48C3.48 11.01 3.29 11.41 3 11.68C2.71 11.95 2.32 12.09 1.83 12.09V12.1Z"/>
+<path d="M5.73 12.1C5.36 12.1 5.03 12.04 4.77 11.93C4.5 11.81 4.29 11.64 4.14 11.42C3.99 11.2 3.9 10.93 3.88 10.61C3.88 10.58 3.89 10.56 3.93 10.56H4.99C4.99 10.56 5.04 10.58 5.04 10.61C5.06 10.75 5.1 10.87 5.15 10.97C5.21 11.07 5.28 11.14 5.38 11.19C5.48 11.24 5.6 11.26 5.74 11.26C5.86 11.26 5.97 11.24 6.06 11.21C6.15 11.18 6.22 11.12 6.26 11.06C6.3 11 6.33 10.91 6.33 10.82C6.33 10.7 6.29 10.6 6.2 10.53C6.11 10.46 6 10.41 5.86 10.37C5.72 10.33 5.56 10.29 5.39 10.26C5.22 10.23 5.05 10.18 4.88 10.13C4.71 10.08 4.56 10 4.41 9.91C4.27 9.82 4.16 9.69 4.07 9.53C3.98 9.37 3.94 9.16 3.94 8.91C3.94 8.62 4.01 8.38 4.14 8.18C4.27 7.98 4.46 7.83 4.71 7.72C4.96 7.61 5.25 7.56 5.6 7.56C5.95 7.56 6.23 7.61 6.47 7.71C6.71 7.81 6.9 7.96 7.05 8.16C7.2 8.36 7.29 8.6 7.33 8.89C7.33 8.93 7.32 8.94 7.29 8.94H6.22C6.22 8.94 6.17 8.92 6.17 8.89C6.15 8.73 6.1 8.6 6 8.52C5.9 8.44 5.77 8.4 5.6 8.4C5.44 8.4 5.31 8.43 5.22 8.5C5.13 8.57 5.08 8.67 5.08 8.79C5.08 8.91 5.12 9 5.21 9.07C5.3 9.14 5.41 9.19 5.55 9.23C5.69 9.27 5.85 9.3 6.02 9.34C6.19 9.37 6.36 9.42 6.53 9.47C6.7 9.52 6.86 9.59 7 9.69C7.14 9.79 7.26 9.91 7.35 10.08C7.44 10.24 7.48 10.45 7.48 10.7C7.48 11 7.41 11.25 7.27 11.46C7.13 11.67 6.93 11.83 6.67 11.94C6.41 12.05 6.1 12.11 5.73 12.11V12.1Z"/>
+<path d="M8.93 11.99C8.93 11.99 8.88 11.98 8.87 11.95L7.75 7.71C7.75 7.71 7.75 7.65 7.8 7.65H8.95C8.95 7.65 9 7.66 9.01 7.69L9.67 10.76L10.34 7.69C10.34 7.69 10.37 7.65 10.4 7.65H11.42C11.42 7.65 11.47 7.67 11.47 7.71L10.34 11.95C10.34 11.95 10.31 11.99 10.28 11.99H8.93Z"/>
+<path d="M16.64 10.5H12.14V12H16.64V10.5Z"/>
+</svg>