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
import type { SplitRouteMatch } from '@app/lib/split-router';
import { paneRoute } from '@app/routes/app-route';
import type { SplitContent } from '@components/app/split-layout/layoutManager';
import type { DriveLocation } from './core/types';
import {
type DriveDocumentRoute,
driveDocumentFromContent,
} from './primitives/drive-route';
function driveDocumentContent(
location: DriveLocation,
document: DriveDocumentRoute
): SplitContent {
const matches: [SplitRouteMatch, ...SplitRouteMatch[]] = [
{ id: 'drive', params: {} },
];
if (location.kind === 'folder') {
matches.push({
id: 'drive-folder',
params: { view: 'folder', folderId: location.id ?? undefined },
});
} else if (location.tab !== 'owned') {
matches.push({ id: 'drive-tab', params: { tab: location.tab } });
}
matches.push({
id:
location.kind === 'folder'
? 'drive-folder-document'
: location.tab === 'owned'
? 'drive-document'
: 'drive-tab-document',
params: { documentId: document.id, documentType: document.type },
});
return {
type: 'component',
id: 'documents',
entryMetadata: { route: paneRoute(...matches) },
};
}
/** A split showing a folder on Drive's own route. */
export function driveFolderContent(folderId: string): SplitContent {
return {
type: 'component',
id: 'documents',
entryMetadata: {
route: paneRoute(
{ id: 'drive', params: {} },
{ id: 'drive-folder', params: { view: 'folder', folderId } }
),
},
};
}
/** Construct Drive-owned split content before the layout mounts a block. */
export function driveHostedContent(
content: { type: string; id: string },
options: {
allowDocuments: boolean;
}
): SplitContent | undefined {
const document = options.allowDocuments
? driveDocumentFromContent(content)
: undefined;
if (document)
return driveDocumentContent({ kind: 'tab', tab: 'owned' }, document);
}