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 [tasks] - automatically set pinned properties (#518)

Daniel Kweonb596816db9f6
diff --git a/js/app/packages/block-md/component/FrontMatterProperties.tsx b/js/app/packages/block-md/component/FrontMatterProperties.tsx
index 96f31f2d41..86c6529730 100644
--- a/js/app/packages/block-md/component/FrontMatterProperties.tsx
+++ b/js/app/packages/block-md/component/FrontMatterProperties.tsx
@@ -7,6 +7,7 @@ import {
} from '@core/component/LexicalMarkdown/plugins';
import { Modals } from '@core/component/Properties/component/modal';
import { PanelContainer } from '@core/component/Properties/component/panel';
+import { getDefaultPinnedProperties } from '@core/component/Properties/constants';
import { PropertiesProvider } from '@core/component/Properties/context/PropertiesContext';
import { useEntityProperties } from '@core/component/Properties/hooks';
import CaretDown from '@icon/bold/caret-down-bold.svg';
@@ -101,15 +102,17 @@ export function FrontMatterProperties(props: FrontMatterPropertiesProps) {
onCleanup(unregister);
});
- // Filter properties to show metadata/system properties and pinned ones
+ // Filter properties to show metadata, default pinned, and user-pinned properties
const filteredPinnedProperties = createMemo(() => {
const allProps = properties();
const pinnedIds = pinnedPropertyIds();
+ const defaultPinnedIds = getDefaultPinnedProperties(blockName);
return allProps.filter(
(prop) =>
- (prop.isMetadata || pinnedIds.includes(prop.propertyId)) &&
- !(prop.displayName === 'Document Name')
+ (prop.isMetadata && !(prop.displayName === 'Document Name')) ||
+ defaultPinnedIds.includes(prop.propertyDefinitionId) ||
+ pinnedIds.includes(prop.propertyId)
);
});
diff --git a/js/app/packages/core/component/Properties/component/panel/PropertyLabel.tsx b/js/app/packages/core/component/Properties/component/panel/PropertyLabel.tsx
index ee54e94601..2efdea62d7 100644
--- a/js/app/packages/core/component/Properties/component/panel/PropertyLabel.tsx
+++ b/js/app/packages/core/component/Properties/component/panel/PropertyLabel.tsx
@@ -7,7 +7,10 @@ import XIcon from '@icon/regular/x.svg';
import { Dialog } from '@kobalte/core/dialog';
import { type Component, createMemo, createSignal, Show } from 'solid-js';
import { deleteEntityProperty } from '../../api';
-import { getBuiltinPropertyIds } from '../../constants';
+import {
+ getBuiltinPropertyIds,
+ getDefaultPinnedProperties,
+} from '../../constants';
import { usePropertiesContext } from '../../context/PropertiesContext';
import type { Property } from '../../types';
import { PropertyDataTypeIcon } from '../../utils';
@@ -29,6 +32,9 @@ export const PropertyLabel: Component<PropertyLabelProps> = (props) => {
const isBuiltin = getBuiltinPropertyIds(blockName).includes(
props.property.propertyDefinitionId
);
+ const isDefaultPinned = getDefaultPinnedProperties(blockName).includes(
+ props.property.propertyDefinitionId
+ );
const isPinned = createMemo(
() => pinnedPropertyIds?.()?.includes(props.property.propertyId) ?? false
@@ -87,7 +93,9 @@ export const PropertyLabel: Component<PropertyLabelProps> = (props) => {
when={canEdit && !props.property.isMetadata}
fallback={<div class="w-3 h-3 flex-shrink-0" />}
>
- <Show when={onPropertyPinned && onPropertyUnpinned}>
+ <Show
+ when={onPropertyPinned && onPropertyUnpinned && !isDefaultPinned}
+ >
<div
class={`flex-shrink-0 transition-opacity ${
isHovered() ? 'opacity-100' : 'opacity-0'
diff --git a/js/app/packages/core/component/Properties/constants.ts b/js/app/packages/core/component/Properties/constants.ts
index dc9b3b2023..e863fa1711 100644
--- a/js/app/packages/core/component/Properties/constants.ts
+++ b/js/app/packages/core/component/Properties/constants.ts
@@ -53,6 +53,30 @@ export const BUILTIN_PROPERTIES_BY_BLOCK: Partial<
],
} as const;
+/**
+ * Default pinned properties by block type.
+ * These are automatically pinned when a new entity of this block type is created.
+ */
+export const DEFAULT_PINNED_PROPERTIES_BY_BLOCK: Partial<
+ Record<BlockName | BlockAlias, readonly string[]>
+> = {
+ task: [
+ SYSTEM_PROPERTY_IDS.STATUS,
+ SYSTEM_PROPERTY_IDS.PRIORITY,
+ SYSTEM_PROPERTY_IDS.ASSIGNEES,
+ ],
+} as const;
+
+/**
+ * Get the default pinned property definition IDs for a block type.
+ * Returns empty array if block has no default pinned properties.
+ */
+export function getDefaultPinnedProperties(
+ blockType: BlockName | BlockAlias
+): readonly string[] {
+ return DEFAULT_PINNED_PROPERTIES_BY_BLOCK[blockType] ?? [];
+}
+
/**
* Get the builtin property definition IDs for a block type.
* Returns empty array if block has no builtin properties.