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(documents): add separate Videos filter to documents view (#3222)

gbirmanf3429468aeb9
diff --git a/js/app/packages/app/component/next-soup/filters/configs/base.ts b/js/app/packages/app/component/next-soup/filters/configs/base.ts
index 664d829de0..4ba53827cf 100644
--- a/js/app/packages/app/component/next-soup/filters/configs/base.ts
+++ b/js/app/packages/app/component/next-soup/filters/configs/base.ts
@@ -15,6 +15,22 @@ export const IMAGE_EXTENSIONS = [
'webp',
] as const;
+// NOTE: inlined from the block-video definition to avoid circular dependency
+export const VIDEO_EXTENSIONS = [
+ 'mp4',
+ 'mkv',
+ 'webm',
+ 'avi',
+ 'mov',
+ 'wmv',
+ 'mpg',
+ 'mpeg',
+ 'm4v',
+ 'flv',
+ 'f4v',
+ 'threegp',
+] as const;
+
export const isEmail = { exclude: { threadId: [NIL_UUID] } };
export const isAgent = { exclude: { chatId: [NIL_UUID] } };
export const isTask = { include: { subType: ['task'] } };
diff --git a/js/app/packages/app/component/next-soup/filters/configs/document.ts b/js/app/packages/app/component/next-soup/filters/configs/document.ts
index 6c46c25770..db4c15446b 100644
--- a/js/app/packages/app/component/next-soup/filters/configs/document.ts
+++ b/js/app/packages/app/component/next-soup/filters/configs/document.ts
@@ -1,6 +1,11 @@
import { codeFileExtensions } from '@block-code/util/languageSupport';
import { isDocumentEntity } from '@entity';
-import { config, IMAGE_EXTENSIONS, isEmailAttachment } from './base';
+import {
+ config,
+ IMAGE_EXTENSIONS,
+ isEmailAttachment,
+ VIDEO_EXTENSIONS,
+} from './base';
export const docMarkdownFilter = config({
id: 'doc-markdown',
@@ -60,6 +65,15 @@ export const fileDocxFilter = config({
query: { include: { fileAssoc: ['assoc:document'] } },
});
+export const fileVideoFilter = config({
+ id: 'file-video',
+ predicate: (e) => {
+ if (e.type !== 'document') return false;
+ return (VIDEO_EXTENSIONS as readonly string[]).includes(e.fileType ?? '');
+ },
+ query: { include: { fileAssoc: ['assoc:video'] } },
+});
+
export const fileOtherFilter = config({
id: 'file-other',
predicate: (e) => {
@@ -68,11 +82,12 @@ export const fileOtherFilter = config({
if (['md', 'canvas', 'pdf', 'docx'].includes(ft)) return false;
if ((codeFileExtensions as readonly string[]).includes(ft)) return false;
if ((IMAGE_EXTENSIONS as readonly string[]).includes(ft)) return false;
+ if ((VIDEO_EXTENSIONS as readonly string[]).includes(ft)) return false;
return true;
},
query: {
include: { fileAssoc: ['assoc:other'] },
- exclude: { fileAssoc: ['assoc:document', 'assoc:image'] },
+ exclude: { fileAssoc: ['assoc:document', 'assoc:image', 'assoc:video'] },
},
});
@@ -81,5 +96,6 @@ export const FILE_TYPE_FILTERS = [
fileImageFilter,
filePdfFilter,
fileDocxFilter,
+ fileVideoFilter,
fileOtherFilter,
] as const;
diff --git a/js/app/packages/app/component/next-soup/soup-view/filters-bar/unified-filter-dropdown.tsx b/js/app/packages/app/component/next-soup/soup-view/filters-bar/unified-filter-dropdown.tsx
index 578cd83aa5..a61b3e6a5f 100644
--- a/js/app/packages/app/component/next-soup/soup-view/filters-bar/unified-filter-dropdown.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/filters-bar/unified-filter-dropdown.tsx
@@ -305,6 +305,11 @@ const DOCUMENTS_FILTER_CATEGORIES: FilterCategory[] = [
label: 'DOCX',
icon: () => <EntityIcon targetType="write" size="xs" />,
},
+ {
+ id: 'file-video',
+ label: 'Videos',
+ icon: () => <EntityIcon targetType="video" size="xs" />,
+ },
{
id: 'file-other',
label: 'Other',
diff --git a/rust/cloud-storage/item_filters/src/ast/document.rs b/rust/cloud-storage/item_filters/src/ast/document.rs
index 23661f11b3..50a46f040f 100644
--- a/rust/cloud-storage/item_filters/src/ast/document.rs
+++ b/rust/cloud-storage/item_filters/src/ast/document.rs
@@ -102,7 +102,8 @@ fn expand_file_association(association: FileAssociation) -> impl Iterator<Item =
/// not pdf,
/// not md,
/// not canvas,
-/// not code
+/// not code,
+/// not video
/// yes this is kinda weird
fn other(s: &str) -> IResult<&str, impl Iterator<Item = FileType>> {
tag("other")
@@ -116,6 +117,7 @@ fn other(s: &str) -> IResult<&str, impl Iterator<Item = FileType>> {
| FileAssociation::Md(_)
| FileAssociation::Canvas(_)
| FileAssociation::Code(_)
+ | FileAssociation::Video(_)
)
})
})
diff --git a/rust/cloud-storage/item_filters/src/ast/tests/other.json b/rust/cloud-storage/item_filters/src/ast/tests/other.json
index cf3dc54fcd..4b4ad221df 100644
--- a/rust/cloud-storage/item_filters/src/ast/tests/other.json
+++ b/rust/cloud-storage/item_filters/src/ast/tests/other.json
@@ -1 +1 @@
-{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"l":{"ft":"jpeg"}},{"l":{"ft":"jpg"}}]},{"l":{"ft":"png"}}]},{"l":{"ft":"gif"}}]},{"l":{"ft":"svg"}}]},{"l":{"ft":"webp"}}]},{"l":{"ft":"avif"}}]},{"l":{"ft":"bmp"}}]},{"l":{"ft":"ico"}}]},{"l":{"ft":"tiff"}}]},{"l":{"ft":"tif"}}]},{"l":{"ft":"heic"}}]},{"l":{"ft":"heif"}}]},{"l":{"ft":"tar"}}]},{"l":{"ft":"targz"}}]},{"l":{"ft":"tgz"}}]},{"l":{"ft":"gz"}}]},{"l":{"ft":"bz2"}}]},{"l":{"ft":"tarbz2"}}]},{"l":{"ft":"tbz2"}}]},{"l":{"ft":"z"}}]},{"l":{"ft":"tarz"}}]},{"l":{"ft":"lz"}}]},{"l":{"ft":"tarlz"}}]},{"l":{"ft":"xz"}}]},{"l":{"ft":"tarxz"}}]},{"l":{"ft":"txz"}}]},{"l":{"ft":"lzma"}}]},{"l":{"ft":"tarlzma"}}]},{"l":{"ft":"rar"}}]},{"l":{"ft":"sevenz"}}]},{"l":{"ft":"zst"}}]},{"l":{"ft":"tarzst"}}]},{"l":{"ft":"tzst"}}]},{"l":{"ft":"zip"}}]},{"l":{"ft":"exe"}}]},{"l":{"ft":"msi"}}]},{"l":{"ft":"dll"}}]},{"l":{"ft":"bat"}}]},{"l":{"ft":"cmd"}}]},{"l":{"ft":"com"}}]},{"l":{"ft":"appimage"}}]},{"l":{"ft":"app"}}]},{"l":{"ft":"bin"}}]},{"l":{"ft":"deb"}}]},{"l":{"ft":"rpm"}}]},{"l":{"ft":"apk"}}]},{"l":{"ft":"dmg"}}]},{"l":{"ft":"pkg"}}]},{"l":{"ft":"crx"}}]},{"l":{"ft":"xpi"}}]},{"l":{"ft":"mp3"}}]},{"l":{"ft":"wav"}}]},{"l":{"ft":"ogg"}}]},{"l":{"ft":"flac"}}]},{"l":{"ft":"aac"}}]},{"l":{"ft":"m4a"}}]},{"l":{"ft":"wma"}}]},{"l":{"ft":"mid"}}]},{"l":{"ft":"midi"}}]},{"l":{"ft":"mp4"}}]},{"l":{"ft":"mkv"}}]},{"l":{"ft":"webm"}}]},{"l":{"ft":"avi"}}]},{"l":{"ft":"mov"}}]},{"l":{"ft":"wmv"}}]},{"l":{"ft":"mpg"}}]},{"l":{"ft":"mpeg"}}]},{"l":{"ft":"m4v"}}]},{"l":{"ft":"flv"}}]},{"l":{"ft":"f4v"}}]},{"l":{"ft":"threegp"}}]},{"l":{"ft":"ttf"}}]},{"l":{"ft":"otf"}}]},{"l":{"ft":"woff"}}]},{"l":{"ft":"woff2"}}]},{"l":{"ft":"eot"}}]},{"l":{"ft":"rtf"}}]},{"l":{"ft":"odt"}}]},{"l":{"ft":"ods"}}]},{"l":{"ft":"odp"}}]},{"l":{"ft":"odg"}}]},{"l":{"ft":"odf"}}]},{"l":{"ft":"epub"}}]},{"l":{"ft":"mobi"}}]},{"l":{"ft":"azw"}}]},{"l":{"ft":"azw3"}}]},{"l":{"ft":"djvu"}}]},{"l":{"ft":"xls"}}]},{"l":{"ft":"ppt"}}]},{"l":{"ft":"pptx"}}]},{"l":{"ft":"xlsx"}}]},{"l":{"ft":"db"}}]},{"l":{"ft":"sqlite"}}]},{"l":{"ft":"sqlite3"}}]},{"l":{"ft":"mdb"}}]},{"l":{"ft":"accdb"}}]},{"l":{"ft":"dbf"}}]},{"l":{"ft":"plist"}}]},{"l":{"ft":"toml"}}]},{"l":{"ft":"env"}}]},{"l":{"ft":"dot"}}]},{"l":{"ft":"gv"}}]},{"l":{"ft":"torrent"}}]},{"l":{"ft":"ics"}}]},{"l":{"ft":"vcf"}}]},{"l":{"ft":"ai"}}]},{"l":{"ft":"eps"}}]},{"l":{"ft":"ps"}}]},{"l":{"ft":"dxf"}}]},{"l":{"ft":"dwg"}}]},{"l":{"ft":"stl"}}]},{"l":{"ft":"obj"}}]},{"l":{"ft":"fbx"}}]},{"l":{"ft":"blend"}}]},{"l":{"ft":"dae"}}]},{"l":{"ft":"threeds"}}]},{"l":{"ft":"gltf"}}]},{"l":{"ft":"glb"}}]},{"l":{"ft":"vhd"}}]},{"l":{"ft":"vhdx"}}]},{"l":{"ft":"vmdk"}}]},{"l":{"ft":"ova"}}]},{"l":{"ft":"ovf"}}]},{"l":{"ft":"iso"}}]},{"l":{"ft":"img"}}]},{"l":{"ft":"swf"}}]}
+{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"|":[{"l":{"ft":"jpeg"}},{"l":{"ft":"jpg"}}]},{"l":{"ft":"png"}}]},{"l":{"ft":"gif"}}]},{"l":{"ft":"svg"}}]},{"l":{"ft":"webp"}}]},{"l":{"ft":"avif"}}]},{"l":{"ft":"bmp"}}]},{"l":{"ft":"ico"}}]},{"l":{"ft":"tiff"}}]},{"l":{"ft":"tif"}}]},{"l":{"ft":"heic"}}]},{"l":{"ft":"heif"}}]},{"l":{"ft":"tar"}}]},{"l":{"ft":"targz"}}]},{"l":{"ft":"tgz"}}]},{"l":{"ft":"gz"}}]},{"l":{"ft":"bz2"}}]},{"l":{"ft":"tarbz2"}}]},{"l":{"ft":"tbz2"}}]},{"l":{"ft":"z"}}]},{"l":{"ft":"tarz"}}]},{"l":{"ft":"lz"}}]},{"l":{"ft":"tarlz"}}]},{"l":{"ft":"xz"}}]},{"l":{"ft":"tarxz"}}]},{"l":{"ft":"txz"}}]},{"l":{"ft":"lzma"}}]},{"l":{"ft":"tarlzma"}}]},{"l":{"ft":"rar"}}]},{"l":{"ft":"sevenz"}}]},{"l":{"ft":"zst"}}]},{"l":{"ft":"tarzst"}}]},{"l":{"ft":"tzst"}}]},{"l":{"ft":"zip"}}]},{"l":{"ft":"exe"}}]},{"l":{"ft":"msi"}}]},{"l":{"ft":"dll"}}]},{"l":{"ft":"bat"}}]},{"l":{"ft":"cmd"}}]},{"l":{"ft":"com"}}]},{"l":{"ft":"appimage"}}]},{"l":{"ft":"app"}}]},{"l":{"ft":"bin"}}]},{"l":{"ft":"deb"}}]},{"l":{"ft":"rpm"}}]},{"l":{"ft":"apk"}}]},{"l":{"ft":"dmg"}}]},{"l":{"ft":"pkg"}}]},{"l":{"ft":"crx"}}]},{"l":{"ft":"xpi"}}]},{"l":{"ft":"mp3"}}]},{"l":{"ft":"wav"}}]},{"l":{"ft":"ogg"}}]},{"l":{"ft":"flac"}}]},{"l":{"ft":"aac"}}]},{"l":{"ft":"m4a"}}]},{"l":{"ft":"wma"}}]},{"l":{"ft":"mid"}}]},{"l":{"ft":"midi"}}]},{"l":{"ft":"ttf"}}]},{"l":{"ft":"otf"}}]},{"l":{"ft":"woff"}}]},{"l":{"ft":"woff2"}}]},{"l":{"ft":"eot"}}]},{"l":{"ft":"rtf"}}]},{"l":{"ft":"odt"}}]},{"l":{"ft":"ods"}}]},{"l":{"ft":"odp"}}]},{"l":{"ft":"odg"}}]},{"l":{"ft":"odf"}}]},{"l":{"ft":"epub"}}]},{"l":{"ft":"mobi"}}]},{"l":{"ft":"azw"}}]},{"l":{"ft":"azw3"}}]},{"l":{"ft":"djvu"}}]},{"l":{"ft":"xls"}}]},{"l":{"ft":"ppt"}}]},{"l":{"ft":"pptx"}}]},{"l":{"ft":"xlsx"}}]},{"l":{"ft":"db"}}]},{"l":{"ft":"sqlite"}}]},{"l":{"ft":"sqlite3"}}]},{"l":{"ft":"mdb"}}]},{"l":{"ft":"accdb"}}]},{"l":{"ft":"dbf"}}]},{"l":{"ft":"plist"}}]},{"l":{"ft":"toml"}}]},{"l":{"ft":"env"}}]},{"l":{"ft":"dot"}}]},{"l":{"ft":"gv"}}]},{"l":{"ft":"torrent"}}]},{"l":{"ft":"ics"}}]},{"l":{"ft":"vcf"}}]},{"l":{"ft":"ai"}}]},{"l":{"ft":"eps"}}]},{"l":{"ft":"ps"}}]},{"l":{"ft":"dxf"}}]},{"l":{"ft":"dwg"}}]},{"l":{"ft":"stl"}}]},{"l":{"ft":"obj"}}]},{"l":{"ft":"fbx"}}]},{"l":{"ft":"blend"}}]},{"l":{"ft":"dae"}}]},{"l":{"ft":"threeds"}}]},{"l":{"ft":"gltf"}}]},{"l":{"ft":"glb"}}]},{"l":{"ft":"vhd"}}]},{"l":{"ft":"vhdx"}}]},{"l":{"ft":"vmdk"}}]},{"l":{"ft":"ova"}}]},{"l":{"ft":"ovf"}}]},{"l":{"ft":"iso"}}]},{"l":{"ft":"img"}}]},{"l":{"ft":"swf"}}]}