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.

fix(tasks): fix task navigation from soup and task split preview, chg(entity): tweak as yet unuses task enity types (#521)

Seamus4efaa371c888
diff --git a/js/app/packages/app/component/Soup.tsx b/js/app/packages/app/component/Soup.tsx
index 59320c217c..d7c1d4d143 100644
--- a/js/app/packages/app/component/Soup.tsx
+++ b/js/app/packages/app/component/Soup.tsx
@@ -5,6 +5,7 @@ import {
import { useHandleFileUpload } from '@app/util/handleFileUpload';
import { playSound } from '@app/util/sound';
import { useIsAuthenticated } from '@core/auth';
+import type { BlockAliasContext } from '@core/block';
import { FileDropOverlay } from '@core/component/FileDropOverlay';
import { Button } from '@core/component/FormControls/Button';
import { ContextMenuContent, MenuItem } from '@core/component/Menu';
@@ -23,6 +24,7 @@ import { ContextMenu } from '@kobalte/core/context-menu';
import { Tabs } from '@kobalte/core/tabs';
import type { EntityData } from '@macro-entity';
import {
+ isTaskEntity,
queryKeys,
useQueryClient as useEntityQueryClient,
} from '@macro-entity';
@@ -108,13 +110,21 @@ const PreviewPanelContent: Component<{
orchestrator: BlockOrchestrator;
splitPanelContext: SplitPanelContextType;
}> = (props) => {
- const blockInstance = () =>
- props.orchestrator.createBlockInstance(
+ const blockInstance = () => {
+ const aliasContext = isTaskEntity(props.selectedEntity)
+ ? ({
+ alias: 'task',
+ baseType: 'md',
+ } as BlockAliasContext)
+ : undefined;
+ return props.orchestrator.createBlockInstance(
props.selectedEntity.type === 'document'
? fileTypeToResolvedBlockName(props.selectedEntity.fileType)
: props.selectedEntity.type,
- props.selectedEntity.id
+ props.selectedEntity.id,
+ { aliasContext }
);
+ };
const [interactedWith, setInteractedWith] = createSignal(false);
createRenderEffect((prevId: string) => {
diff --git a/js/app/packages/app/component/SoupContext.tsx b/js/app/packages/app/component/SoupContext.tsx
index 973ae490ba..da2e358600 100644
--- a/js/app/packages/app/component/SoupContext.tsx
+++ b/js/app/packages/app/component/SoupContext.tsx
@@ -668,8 +668,11 @@ export function createNavigationEntityListShortcut({
const openEntity = (entity: EntityData) => {
const { type, id } = entity;
if (type === 'document') {
- const { fileType } = entity;
- splitHandle.replace({ type: fileTypeToBlockName(fileType), id });
+ const { fileType, subType } = entity;
+ splitHandle.replace({
+ type: fileTypeToBlockName(subType ?? fileType),
+ id,
+ });
} else {
splitHandle.replace({ type, id });
}
diff --git a/js/app/packages/app/component/ViewConfig.tsx b/js/app/packages/app/component/ViewConfig.tsx
index 1de891ce84..fa27cdb508 100644
--- a/js/app/packages/app/component/ViewConfig.tsx
+++ b/js/app/packages/app/component/ViewConfig.tsx
@@ -8,7 +8,7 @@ import type { WithCustomUserInput } from '@core/user';
import type { DeepPartial } from '@core/util/withRequired';
import {
type EntityData,
- type EntityType,
+ type ExpandedEntityType,
queryKeys,
type WithNotification,
} from '@macro-entity';
@@ -60,7 +60,7 @@ export type DocumentTypeFilter =
export type FilterOptions = {
notificationFilter: 'all' | 'unread' | 'notDone';
importantFilter: boolean;
- typeFilter: EntityType[];
+ typeFilter: ExpandedEntityType[];
documentTypeFilter: DocumentTypeFilter[];
projectFilter?: string;
fromFilter?: WithCustomUserInput<'user' | 'contact'>[];
diff --git a/js/app/packages/core/component/Properties/utils/suggestedProperties.ts b/js/app/packages/core/component/Properties/utils/suggestedProperties.ts
index 44ffba3148..663b71b2be 100644
--- a/js/app/packages/core/component/Properties/utils/suggestedProperties.ts
+++ b/js/app/packages/core/component/Properties/utils/suggestedProperties.ts
@@ -1,4 +1,4 @@
-import type { EntityType } from '@macro-entity';
+import type { ExpandedEntityType } from '@macro-entity';
import type { PropertyDefinitionFlat } from '../types';
/**
@@ -11,7 +11,7 @@ import type { PropertyDefinitionFlat } from '../types';
* @returns Array of PropertyDefinitionFlat objects for quick selection
*/
export function getSuggestedProperties(
- _entityTypes: EntityType[]
+ _entityTypes: ExpandedEntityType[]
): PropertyDefinitionFlat[] {
return [];
}
diff --git a/js/app/packages/macro-entity/src/types/entity.ts b/js/app/packages/macro-entity/src/types/entity.ts
index d64296df32..72abf26d47 100644
--- a/js/app/packages/macro-entity/src/types/entity.ts
+++ b/js/app/packages/macro-entity/src/types/entity.ts
@@ -50,17 +50,16 @@ export type TaskEntity = EntityBase & {
projectId?: string;
};
-export type MarkdownNoteEntity = EntityBase & {
+export type MarkdownEntity = EntityBase & {
type: 'document';
fileType: 'md';
- subType?: undefined | null;
+ subType?: null;
projectId?: string;
};
-export type DocumentEntity =
- | BaseDocumentEntity
- | TaskEntity
- | MarkdownNoteEntity;
+export type DocumentEntity = BaseDocumentEntity | MarkdownEntity;
+
+export type NamedSubType = 'task';
export const getEntityProjectId = (e: EntityData): string | false => {
if (e.type === 'project') {
@@ -95,6 +94,7 @@ export type EntityData =
| ChannelEntity
| ChatEntity
| DocumentEntity
+ | TaskEntity
| EmailEntity
| ProjectEntity;
@@ -118,9 +118,9 @@ export const isTaskEntity = (entity: EntityData): entity is TaskEntity => {
);
};
-export const isMarkdownNoteEntity = (
+export const isMarkdownEntity = (
entity: EntityData
-): entity is MarkdownNoteEntity => {
+): entity is MarkdownEntity => {
return (
entity.type === 'document' && entity.fileType === 'md' && !entity.subType
);
@@ -128,6 +128,8 @@ export const isMarkdownNoteEntity = (
export type EntityType = EntityData['type'];
+export type ExpandedEntityType = EntityType | NamedSubType;
+
export type EntityOf<K extends EntityType> = Extract<EntityData, { type: K }>;
export type EntityMapper<T extends EntityData> = (entity: EntityData) => T;