From 73a58cdecae208a4ea378e84ef97587ff988b767 Mon Sep 17 00:00:00 2001 From: Jo du Plessis Date: Sun, 2 Nov 2025 10:15:11 +0200 Subject: [PATCH 1/2] add task type --- packages/core/src/attachment/attachment.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/core/src/attachment/attachment.tsx b/packages/core/src/attachment/attachment.tsx index 3cea9ca1..1836f036 100644 --- a/packages/core/src/attachment/attachment.tsx +++ b/packages/core/src/attachment/attachment.tsx @@ -78,6 +78,7 @@ export const MIME = { 'audio/3gpp': '3GPPaudio/video container', 'audio/3gpp2': '3GPP2audio/video container', 'application/x-7z-compressed': '7-ziparchive', + 'task': 'Task', }, ICON: { 'audio/aac': 'audio', @@ -151,6 +152,7 @@ export const MIME = { 'audio/3gpp': 'audio', 'audio/3gpp2': 'audio', 'application/x-7z-compressed': 'paperclip', + 'task': 'check', }, } @@ -168,7 +170,7 @@ export type AttachmentProps = { loading?: boolean loadingProgress?: number label?: string -} & CoreViewProps & { href?: string } +} & CoreViewProps & { href?: string, target?: string } export const Attachment = (props: AttachmentProps) => { const { From 280c7d469456e5579768d6425fa5d5f5451fcbf9 Mon Sep 17 00:00:00 2001 From: Jo du Plessis Date: Sun, 2 Nov 2025 10:21:55 +0200 Subject: [PATCH 2/2] move MIME data to window object --- packages/core/src/attachment/attachment.tsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/core/src/attachment/attachment.tsx b/packages/core/src/attachment/attachment.tsx index 1836f036..4541154b 100644 --- a/packages/core/src/attachment/attachment.tsx +++ b/packages/core/src/attachment/attachment.tsx @@ -1,11 +1,13 @@ import React, { ReactElement, ReactNode } from 'react' import { Icon, If, Image, Progress, Spinner, SpinnerOverlay, View } from '../' -import { bytesToSize, classNames } from '../helpers' +import { bytesToSize, classNames, windowObject } from '../helpers' import { Text } from '../text/text' import { CoreViewProps } from '../types' import { IconLib } from '../icon' -export const MIME = { +export const FOLD_ATTACHMENT_MIME_TYPES = 'FOLD_ATTACHMENT_MIME_TYPES' + +windowObject[FOLD_ATTACHMENT_MIME_TYPES] = { DESCRIPTION: { 'audio/aac': 'AAC audio', 'application/x-abiword': 'AbiWorddocument', @@ -197,7 +199,8 @@ export const Attachment = (props: AttachmentProps) => { }, [props.className, size] ) - const icon: string = mime ? MIME.ICON[mime] : error ? 'warning' : 'paperclip' + + const icon: string = mime ? windowObject[FOLD_ATTACHMENT_MIME_TYPES].ICON[mime] : error ? 'warning' : 'paperclip' return ( { as="span" className="f-attachment__text-meta"> - {MIME.DESCRIPTION[mime]} + {windowObject[FOLD_ATTACHMENT_MIME_TYPES].DESCRIPTION[mime]} )} @@ -312,7 +315,7 @@ export const AttachmentThumb = (props: AttachmentThumbProps) => { }, [props.className] ) - const icon: string = mime ? MIME.ICON[mime] : error ? 'warning' : 'paperclip' + const icon: string = mime ? windowObject[FOLD_ATTACHMENT_MIME_TYPES].ICON[mime] : error ? 'warning' : 'paperclip' return (