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
improve [properties-fe] - more refactor properties (#209)
Daniel Kweon9fee9361fff4
diff --git a/js/app/packages/app/component/custom-cursor/custom-cursor.ts b/js/app/packages/app/component/custom-cursor/custom-cursor.tsindex 12f6b89b54..06fa0df86e 100644--- a/js/app/packages/app/component/custom-cursor/custom-cursor.ts+++ b/js/app/packages/app/component/custom-cursor/custom-cursor.ts@@ -45,8 +45,8 @@ let hexColor: string = '';let cursorCache: Record<string, string> = {};let currentCursorType: string | null = 'auto';const shadowRoots = new Set<ShadowRoot>();-let overridedCursorTargetEl: HTMLElement | null = null;-const overrideCursorAttr = 'data-override-cursor';+let _overridedCursorTargetEl: HTMLElement | null = null;+const _overrideCursorAttr = 'data-override-cursor';// const overrideCursorSelector = `[${overrideCursorAttr}]`const overrideCursorSelector = `*`;@@ -399,7 +399,7 @@ function initCursor() {}// Add mousemove listener to handle cursor states and text glyph detection- const onMouseMove = (e: MouseEvent) => {+ const _onMouseMove = (e: MouseEvent) => {if (!getCustomCursorEnabled()) {clearCursorOverrideStyle();return;@@ -410,7 +410,7 @@ function initCursor() {if (target.shadowRoot) {shadowRoots.add(target.shadowRoot);[...target.shadowRoot.children].forEach((child) => {- child.addEventListener('mousemove', onMouseMove);+ child.addEventListener('mousemove', _onMouseMove);});return;}diff --git a/js/app/packages/block-md/component/FrontMatterProperties.tsx b/js/app/packages/block-md/component/FrontMatterProperties.tsxindex 28d3c7beae..275bc87a44 100644--- a/js/app/packages/block-md/component/FrontMatterProperties.tsx+++ b/js/app/packages/block-md/component/FrontMatterProperties.tsx@@ -4,10 +4,10 @@ import {ADD_PINNED_PROPERTY_COMMAND,REMOVE_PINNED_PROPERTY_COMMAND,} from '@core/component/LexicalMarkdown/plugins';-import { PropertiesContent } from '@core/component/Properties/components/PropertiesContent';-import { PropertiesModals } from '@core/component/Properties/components/PropertiesModals';+import { Modals } from '@core/component/Properties/component/modal';+import { PanelContainer } from '@core/component/Properties/component/panel';import { PropertiesProvider } from '@core/component/Properties/context/PropertiesContext';-import { useProperties } from '@core/component/Properties/hooks';+import { useEntityProperties } from '@core/component/Properties/hooks';import CaretDown from '@icon/bold/caret-down-bold.svg';import CaretRight from '@icon/bold/caret-right-bold.svg';import EyeSlash from '@icon/bold/eye-slash-bold.svg';@@ -37,7 +37,7 @@ export function FrontMatterProperties(props: FrontMatterPropertiesProps) {const blockId = useBlockId();const mdData = mdStore.get; // Access block store at component level- const { properties, isLoading, error, refetch } = useProperties(+ const { properties, isLoading, error, refetch } = useEntityProperties(blockId,'DOCUMENT' as EntityType,true // includeMetadata@@ -172,7 +172,7 @@ export function FrontMatterProperties(props: FrontMatterPropertiesProps) {<div class="text-failure-ink text-center py-4">{error()}</div></Show>- <PropertiesContent+ <PanelContainerproperties={filteredPinnedProperties}isLoading={isLoading}error={error}@@ -191,7 +191,7 @@ export function FrontMatterProperties(props: FrontMatterPropertiesProps) {</button></div>- <PropertiesModals />+ <Modals /></div><div class="border-t-2 border-edge pt-2" /></Show>diff --git a/js/app/packages/block-md/component/InlineProperties.tsx b/js/app/packages/block-md/component/InlineProperties.tsxindex 45519ad314..5fb59d5511 100644--- a/js/app/packages/block-md/component/InlineProperties.tsx+++ b/js/app/packages/block-md/component/InlineProperties.tsx@@ -4,12 +4,12 @@ import {ADD_PINNED_PROPERTY_COMMAND,REMOVE_PINNED_PROPERTY_COMMAND,} from '@core/component/LexicalMarkdown/plugins';+import { EntityIcon } from '@core/component/Properties/component/propertyValue';import {PropertiesProvider,usePropertiesContext,} from '@core/component/Properties/context/PropertiesContext';-import { EntityValueDisplay } from '@core/component/Properties/EntityValueDisplay';-import { useProperties } from '@core/component/Properties/hooks';+import { useEntityProperties } from '@core/component/Properties/hooks';import {extractDomain,formatPropertyValue,@@ -110,13 +110,13 @@ function InlineEntityValue(props: {};// For inline display, we want entity values to be clickable- // So we wrap EntityValueDisplay in a clickable element+ // So we wrap EntityIcon in a clickable elementreturn (<div class="flex items-center gap-1"><For each={entities()}>{(entityRef) => (<div onClick={handleEntityClick} class="cursor-pointer">- <EntityValueDisplay+ <EntityIconproperty={props.property}entityId={entityRef.entity_id}entityType={entityRef.entity_type}@@ -133,7 +133,7 @@ export function InlineProperties(props: InlinePropertiesProps) {const blockId = useBlockId();const mdData = mdStore.get;- const { properties, isLoading, error, refetch } = useProperties(+ const { properties, isLoading, error, refetch } = useEntityProperties(blockId,'DOCUMENT' as EntityType,true // includeMetadata@@ -234,7 +234,7 @@ export function InlineProperties(props: InlinePropertiesProps) {// Format value for displayconst displayValue = createMemo(() => {if (property.valueType === 'ENTITY') {- // For entity types (like Owner), we'll render EntityValueDisplay+ // For entity types (like Owner), we'll render EntityIconreturn null;}if (diff --git a/js/app/packages/core/component/Properties/PropertiesView.tsx b/js/app/packages/core/component/Properties/PropertiesView.tsxindex fe18fac3f4..5494784c6d 100644--- a/js/app/packages/core/component/Properties/PropertiesView.tsx+++ b/js/app/packages/core/component/Properties/PropertiesView.tsx@@ -1,14 +1,14 @@import { useBlockId } from '@core/block';import LoadingSpinner from '@icon/regular/spinner.svg';import { type Accessor, createMemo, Show } from 'solid-js';-import { AddPropertyButton } from './components/AddPropertyButton';-import { PropertiesContent } from './components/PropertiesContent';-import { PropertiesModals } from './components/PropertiesModals';+import { Modals } from './component/modal/Modals';+import { AddPropertyButton } from './component/panel/AddPropertyButton';+import { PanelContainer } from './component/panel/PanelContainer';import {PropertiesProvider,usePropertiesContext,} from './context/PropertiesContext';-import { useProperties } from './hooks';+import { useEntityProperties } from './hooks';import type { PropertiesPanelProps, Property } from './types';const CONTAINER_CLASSES =@@ -19,7 +19,7 @@ const SPINNER_CLASSES = 'w-5 h-5 animate-spin';export function PropertiesView(props: PropertiesPanelProps) {const blockId = useBlockId();- const { properties, isLoading, error, refetch } = useProperties(+ const { properties, isLoading, error, refetch } = useEntityProperties(blockId,props.entityType,true // includeMetadata@@ -89,7 +89,7 @@ function PropertiesViewContent(props: {<div class="text-failure-ink text-center py-4">{props.error()}</div></Show>- <PropertiesContent+ <PanelContainerproperties={props.properties}isLoading={props.isLoading}error={props.error}@@ -101,7 +101,7 @@ function PropertiesViewContent(props: {</div></Show>- <PropertiesModals />+ <Modals /></div>);}diff --git a/js/app/packages/core/component/Properties/api/properties.ts b/js/app/packages/core/component/Properties/api/fetchProperties.tssimilarity index 100%rename from js/app/packages/core/component/Properties/api/properties.tsrename to js/app/packages/core/component/Properties/api/fetchProperties.tsdiff --git a/js/app/packages/core/component/Properties/api/index.ts b/js/app/packages/core/component/Properties/api/index.tsindex 7452bc6308..400ea77c41 100644--- a/js/app/packages/core/component/Properties/api/index.ts+++ b/js/app/packages/core/component/Properties/api/index.ts@@ -1,5 +1,5 @@export { fromApiFormat, toApiFormat } from './converters';-export { fetchEntityProperties } from './properties';+export { fetchEntityProperties } from './fetchProperties';export {addPropertyToEntity,deleteEntityProperty,diff --git a/js/app/packages/core/component/Properties/apiUtils.ts b/js/app/packages/core/component/Properties/api/utils.tssimilarity index 94%rename from js/app/packages/core/component/Properties/apiUtils.tsrename to js/app/packages/core/component/Properties/api/utils.tsindex b91ffc3565..f7b3d23d82 100644--- a/js/app/packages/core/component/Properties/apiUtils.ts+++ b/js/app/packages/core/component/Properties/api/utils.ts@@ -1,12 +1,12 @@import { toast } from '@core/component/Toast/Toast';import type { EntityType } from '@service-properties/generated/schemas/entityType';+import type { Property, PropertyApiValues } from '../types';+import { ErrorHandler } from '../utils/errorHandling';import {addPropertyToEntity as apiAddPropertyToEntity,deleteEntityProperty as apiDeleteEntityProperty,savePropertyValue as apiSavePropertyValue,-} from './api';-import type { Property, PropertyApiValues } from './types';-import { ErrorHandler } from './utils/errorHandling';+} from './index';/*** Shared utility for saving property values with consistent error handlingdiff --git a/js/app/packages/core/component/Properties/components/CreatePropertyModal.tsx b/js/app/packages/core/component/Properties/component/modal/CreatePropertyModal.tsxsimilarity index 99%rename from js/app/packages/core/component/Properties/components/CreatePropertyModal.tsxrename to js/app/packages/core/component/Properties/component/modal/CreatePropertyModal.tsxindex 852ae47ab9..1f902f23ff 100644--- a/js/app/packages/core/component/Properties/components/CreatePropertyModal.tsx+++ b/js/app/packages/core/component/Properties/component/modal/CreatePropertyModal.tsx@@ -20,13 +20,13 @@ import {BUTTON_BASE_CLASSES,PRIMARY_BUTTON_CLASSES,SECONDARY_BUTTON_CLASSES,-} from '../constants';+} from '../../constants';import {getPropertyDataTypeDropdownOptions,usePropertyNameFocus,-} from '../utils';-import { ERROR_MESSAGES } from '../utils/errorHandling';-import { Dropdown, type DropdownOption } from './Dropdown';+} from '../../utils';+import { ERROR_MESSAGES } from '../../utils/errorHandling';+import { Dropdown, type DropdownOption } from './shared/Dropdown';// Derive DataTypeValue from the dropdown optionstype DataTypeValue = ReturnType<diff --git a/js/app/packages/core/component/Properties/PropertyEditor.tsx b/js/app/packages/core/component/Properties/component/modal/EditPropertyValueModal.tsxsimilarity index 91%rename from js/app/packages/core/component/Properties/PropertyEditor.tsxrename to js/app/packages/core/component/Properties/component/modal/EditPropertyValueModal.tsxindex 13725251eb..e265167716 100644--- a/js/app/packages/core/component/Properties/PropertyEditor.tsx+++ b/js/app/packages/core/component/Properties/component/modal/EditPropertyValueModal.tsx@@ -14,18 +14,18 @@ import {Show,} from 'solid-js';import { Portal } from 'solid-js/web';-import { savePropertyValue } from './api/propertyValues';-import { MODAL_DIMENSIONS } from './constants';-import { EntityInput } from './EntityInput';-import { usePropertyEditor } from './hooks/usePropertyManagement';-import { PropertyOptionsList } from './PropertyOptionsList';-import type { PropertyApiValues, PropertyEditorProps } from './types';-import { getValueTypeDisplay } from './utils';+import { savePropertyValue } from '../../api/propertyValues';+import { MODAL_DIMENSIONS } from '../../constants';+import { usePropertyEditor } from '../../hooks/usePropertyModals';+import type { PropertyApiValues, PropertyEditorProps } from '../../types';+import { getValueTypeDisplay } from '../../utils';import {entityReferencesToIdSet,updateEntityReferences,-} from './utils/entityConversion';-import { ErrorHandler } from './utils/errorHandling';+} from '../../utils/entityConversion';+import { ErrorHandler } from '../../utils/errorHandling';+import { PropertyEntitySelector } from './shared/PropertyEntitySelector';+import { PropertyOptionSelector } from './shared/PropertyOptionSelector';// Common CSS classesconst MODAL_BASE =@@ -33,7 +33,7 @@ const MODAL_BASE =const HEADER_CLASSES = 'flex items-center justify-between pt-3 pb-2 px-4';const CONTENT_CLASSES = 'flex-1 max-h-64 pt-2 px-4 pb-4';-export function PropertyEditor(props: PropertyEditorProps) {+export function EditPropertyValueModal(props: PropertyEditorProps) {const blockId = useBlockId();const [selectedEntityRefs, setSelectedEntityRefs] = createSignal<@@ -223,7 +223,7 @@ export function PropertyEditor(props: PropertyEditorProps) {}fallback={<Show when={props.property.valueType === 'ENTITY'}>- <EntityInput+ <PropertyEntitySelectorproperty={props.property}selectedOptions={() => {const refs = selectedEntityRefs();@@ -243,7 +243,7 @@ export function PropertyEditor(props: PropertyEditorProps) {</Show>}>- <PropertyOptionsList+ <PropertyOptionSelectorproperty={props.property}options={editorState().options}isLoading={editorState().isLoading}diff --git a/js/app/packages/core/component/Properties/components/PropertiesModals.tsx b/js/app/packages/core/component/Properties/component/modal/Modals.tsxsimilarity index 87%rename from js/app/packages/core/component/Properties/components/PropertiesModals.tsxrename to js/app/packages/core/component/Properties/component/modal/Modals.tsxindex aefc570a88..f7b1d094db 100644--- a/js/app/packages/core/component/Properties/components/PropertiesModals.tsx+++ b/js/app/packages/core/component/Properties/component/modal/Modals.tsx@@ -2,14 +2,14 @@ import { useBlockId } from '@core/block';import { DatePicker } from '@core/component/DatePicker';import { type Component, createMemo } from 'solid-js';import { Portal, Show } from 'solid-js/web';-import { savePropertyValue } from '../apiUtils';-import { usePropertiesContext } from '../context/PropertiesContext';-import { PropertyEditor } from '../PropertyEditor';-import { PropertySelector } from '../PropertySelector';-import type { Property } from '../types';+import { savePropertyValue } from '../../api/utils';+import { usePropertiesContext } from '../../context/PropertiesContext';+import type { Property } from '../../types';import { CreatePropertyModal } from './CreatePropertyModal';+import { EditPropertyValueModal } from './EditPropertyValueModal';+import { SelectPropertyModal } from './SelectPropertyModal';-export const PropertiesModals: Component = () => {+export const Modals: Component = () => {const blockId = useBlockId();const {entityType,@@ -56,7 +56,7 @@ export const PropertiesModals: Component = () => {return (<><Show when={propertySelectorModal()}>- <PropertySelector+ <SelectPropertyModalisOpen={true}onClose={closePropertySelector}existingPropertyIds={existingPropertyIds()}@@ -73,7 +73,7 @@ export const PropertiesModals: Component = () => {: undefined;return (- <PropertyEditor+ <EditPropertyValueModalproperty={state().property}onClose={closePropertyEditor}onSaved={handlePropertySaved}diff --git a/js/app/packages/core/component/Properties/PropertySelector.tsx b/js/app/packages/core/component/Properties/component/modal/SelectPropertyModal.tsxsimilarity index 95%rename from js/app/packages/core/component/Properties/PropertySelector.tsxrename to js/app/packages/core/component/Properties/component/modal/SelectPropertyModal.tsxindex a1dcb7de2c..c120f3ca9a 100644--- a/js/app/packages/core/component/Properties/PropertySelector.tsx+++ b/js/app/packages/core/component/Properties/component/modal/SelectPropertyModal.tsx@@ -7,8 +7,7 @@ import LoadingSpinner from '@icon/regular/spinner.svg';import XIcon from '@icon/regular/x.svg';import { createEffect, createSignal, For, Show } from 'solid-js';import { Portal } from 'solid-js/web';-import { addEntityProperty } from './apiUtils';-import { CreatePropertyModal } from './components/CreatePropertyModal';+import { addEntityProperty } from '../../api/utils';import {ACCENT_BUTTON_CLASSES,BUTTON_BASE_CLASSES,@@ -16,14 +15,18 @@ import {MODAL_DIMENSIONS,PRIMARY_BUTTON_CLASSES,SECONDARY_BUTTON_CLASSES,-} from './constants';-import { usePropertiesContext } from './context/PropertiesContext';-import { usePropertyManagement } from './hooks/usePropertyManagement';-import { PROPERTY_STYLES } from './styles/propertyStyles';-import type { PropertySelectorProps } from './types';-import { getPropertyDefinitionTypeDisplay, useSearchInputFocus } from './utils';+} from '../../constants';+import { usePropertiesContext } from '../../context/PropertiesContext';+import { usePropertyModals } from '../../hooks/usePropertyModals';+import { PROPERTY_STYLES } from '../../styles/styles';+import type { PropertySelectorProps } from '../../types';+import {+ getPropertyDefinitionTypeDisplay,+ useSearchInputFocus,+} from '../../utils';+import { CreatePropertyModal } from './CreatePropertyModal';-export function PropertySelector(props: PropertySelectorProps) {+export function SelectPropertyModal(props: PropertySelectorProps) {const blockId = useBlockId();const { entityType, onPropertyAdded } = usePropertiesContext();const [isAdding, setIsAdding] = createSignal(false);@@ -38,7 +41,7 @@ export function PropertySelector(props: PropertySelectorProps) {filteredProperties,fetchAvailableProperties,togglePropertySelection,- } = usePropertyManagement(props.existingPropertyIds, () => searchQuery());+ } = usePropertyModals(props.existingPropertyIds, () => searchQuery());const handleAddProperties = async () => {const selected = state().selectedPropertyIds;diff --git a/js/app/packages/core/component/Properties/component/modal/index.ts b/js/app/packages/core/component/Properties/component/modal/index.tsnew file mode 100644index 0000000000..10e1178d71--- /dev/null+++ b/js/app/packages/core/component/Properties/component/modal/index.ts@@ -0,0 +1,5 @@+export { CreatePropertyModal } from './CreatePropertyModal';+export { EditPropertyValueModal } from './EditPropertyValueModal';+export { Modals } from './Modals';+export { SelectPropertyModal } from './SelectPropertyModal';+export * from './shared';diff --git a/js/app/packages/core/component/Properties/components/Dropdown.tsx b/js/app/packages/core/component/Properties/component/modal/shared/Dropdown.tsxsimilarity index 100%rename from js/app/packages/core/component/Properties/components/Dropdown.tsxrename to js/app/packages/core/component/Properties/component/modal/shared/Dropdown.tsxdiff --git a/js/app/packages/core/component/Properties/EntityInput.tsx b/js/app/packages/core/component/Properties/component/modal/shared/PropertyEntitySelector.tsxsimilarity index 98%rename from js/app/packages/core/component/Properties/EntityInput.tsxrename to js/app/packages/core/component/Properties/component/modal/shared/PropertyEntitySelector.tsxindex 868df94f14..e4da791b36 100644--- a/js/app/packages/core/component/Properties/EntityInput.tsx+++ b/js/app/packages/core/component/Properties/component/modal/shared/PropertyEntitySelector.tsx@@ -21,9 +21,9 @@ import type { EntityType } from '@service-properties/generated/schemas/entityTypimport type { Item } from '@service-storage/generated/schemas/item';import { useHistory } from '@service-storage/history';import { createMemo, createSignal, For, on, Show } from 'solid-js';-import { PROPERTY_STYLES } from './styles/propertyStyles';-import type { Property } from './types';-import { useSearchInputFocus } from './utils';+import { PROPERTY_STYLES } from '../../../styles/styles';+import type { Property } from '../../../types';+import { useSearchInputFocus } from '../../../utils';type EntityInputProps = {property: Property;@@ -186,7 +186,7 @@ function useEntityData(specificEntityType: EntityType | null | undefined) {return { entities };}-export function EntityInput(props: EntityInputProps) {+export function PropertyEntitySelector(props: EntityInputProps) {const [searchTerm, setSearchTerm] = createSignal('');const [lastSearchTerm, setLastSearchTerm] = createSignal('');diff --git a/js/app/packages/core/component/Properties/PropertyOptionsList.tsx b/js/app/packages/core/component/Properties/component/modal/shared/PropertyOptionSelector.tsxsimilarity index 96%rename from js/app/packages/core/component/Properties/PropertyOptionsList.tsxrename to js/app/packages/core/component/Properties/component/modal/shared/PropertyOptionSelector.tsxindex ed74cc6e23..ad13ebd7c6 100644--- a/js/app/packages/core/component/Properties/PropertyOptionsList.tsx+++ b/js/app/packages/core/component/Properties/component/modal/shared/PropertyOptionSelector.tsx@@ -5,10 +5,10 @@ import LoadingSpinner from '@icon/regular/spinner.svg';import type * as schemas from '@service-properties/generated/zod';import { createMemo, createSignal, For, Show } from 'solid-js';import type { z } from 'zod';-import { PROPERTY_STYLES } from './styles/propertyStyles';-import type { Property } from './types';-import { formatOptionValue, useSearchInputFocus } from './utils';-import { ErrorHandler } from './utils/errorHandling';+import { PROPERTY_STYLES } from '../../../styles/styles';+import type { Property } from '../../../types';+import { formatOptionValue, useSearchInputFocus } from '../../../utils';+import { ErrorHandler } from '../../../utils/errorHandling';type PropertyOption = z.infer<typeof schemas.getPropertyOptionsResponseItem>;@@ -26,7 +26,7 @@ type SelectOptionsProps = {const ADD_OPTION_BASE_CLASSES ='flex flex-row w-full justify-between items-center gap-4 cursor-pointer p-2 border border-dashed border-accent/50 hover:border-accent hover:bg-accent/5 text-accent';-export const PropertyOptionsList = (props: SelectOptionsProps) => {+export const PropertyOptionSelector = (props: SelectOptionsProps) => {const [searchQuery, setSearchQuery] = createSignal('');const [isAddingOption, setIsAddingOption] = createSignal(false);diff --git a/js/app/packages/core/component/Properties/component/modal/shared/index.ts b/js/app/packages/core/component/Properties/component/modal/shared/index.tsnew file mode 100644index 0000000000..13a105111a--- /dev/null+++ b/js/app/packages/core/component/Properties/component/modal/shared/index.ts@@ -0,0 +1,4 @@+export type { DropdownOption } from './Dropdown';+export { Dropdown } from './Dropdown';+export { PropertyEntitySelector } from './PropertyEntitySelector';+export { PropertyOptionSelector } from './PropertyOptionSelector';diff --git a/js/app/packages/core/component/Properties/components/AddPropertyButton.tsx b/js/app/packages/core/component/Properties/component/panel/AddPropertyButton.tsxsimilarity index 100%rename from js/app/packages/core/component/Properties/components/AddPropertyButton.tsxrename to js/app/packages/core/component/Properties/component/panel/AddPropertyButton.tsxdiff --git a/js/app/packages/core/component/Properties/components/PropertiesContent.tsx b/js/app/packages/core/component/Properties/component/panel/PanelContainer.tsxsimilarity index 77%rename from js/app/packages/core/component/Properties/components/PropertiesContent.tsxrename to js/app/packages/core/component/Properties/component/panel/PanelContainer.tsxindex c4727871e7..d09eaf6259 100644--- a/js/app/packages/core/component/Properties/components/PropertiesContent.tsx+++ b/js/app/packages/core/component/Properties/component/panel/PanelContainer.tsx@@ -1,7 +1,7 @@import type { Accessor, Component } from 'solid-js';import { createMemo, Show } from 'solid-js';-import type { Property } from '../types';-import { PropertiesList } from './PropertiesList';+import type { Property } from '../../types';+import { PropertyGrid } from './PropertyGrid';interface PropertiesContentProps {properties: Accessor<Property[]>;@@ -10,7 +10,7 @@ interface PropertiesContentProps {emptyMessage?: string;}-export const PropertiesContent: Component<PropertiesContentProps> = (props) => {+export const PanelContainer: Component<PropertiesContentProps> = (props) => {const hasProperties = createMemo(() => props.properties().length > 0);const showContent = createMemo(() => hasProperties() || (!props.isLoading() && !props.error())@@ -26,7 +26,7 @@ export const PropertiesContent: Component<PropertiesContentProps> = (props) => {<Show when={hasProperties()}><div class="flex-1 overflow-y-auto overflow-x-auto px-2 pb-2">- <PropertiesList properties={props.properties()} />+ <PropertyGrid properties={props.properties()} /></div></Show></Show>diff --git a/js/app/packages/core/component/Properties/components/PropertiesList.tsx b/js/app/packages/core/component/Properties/component/panel/PropertyGrid.tsxsimilarity index 92%rename from js/app/packages/core/component/Properties/components/PropertiesList.tsxrename to js/app/packages/core/component/Properties/component/panel/PropertyGrid.tsxindex a3e195d8e9..8e8110b964 100644--- a/js/app/packages/core/component/Properties/components/PropertiesList.tsx+++ b/js/app/packages/core/component/Properties/component/panel/PropertyGrid.tsx@@ -1,13 +1,13 @@import { type Component, createMemo, For, Show } from 'solid-js';-import { usePropertiesContext } from '../context/PropertiesContext';-import type { Property } from '../types';+import { usePropertiesContext } from '../../context/PropertiesContext';+import type { Property } from '../../types';import { PropertyRow } from './PropertyRow';interface PropertiesListProps {properties: Property[];}-export const PropertiesList: Component<PropertiesListProps> = (props) => {+export const PropertyGrid: Component<PropertiesListProps> = (props) => {const { openPropertyEditor, openDatePicker } = usePropertiesContext();const metadataProperties = createMemo(() =>diff --git a/js/app/packages/core/component/Properties/components/PropertyLabel.tsx b/js/app/packages/core/component/Properties/component/panel/PropertyLabel.tsxsimilarity index 96%rename from js/app/packages/core/component/Properties/components/PropertyLabel.tsxrename to js/app/packages/core/component/Properties/component/panel/PropertyLabel.tsxindex c2d5b0a7cc..10b893d9f0 100644--- a/js/app/packages/core/component/Properties/components/PropertyLabel.tsx+++ b/js/app/packages/core/component/Properties/component/panel/PropertyLabel.tsx@@ -5,9 +5,9 @@ import UnpinIcon from '@icon/regular/push-pin-slash.svg';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 { usePropertiesContext } from '../context/PropertiesContext';-import type { Property } from '../types';+import { deleteEntityProperty } from '../../api';+import { usePropertiesContext } from '../../context/PropertiesContext';+import type { Property } from '../../types';type PropertyLabelProps = {property: Property;diff --git a/js/app/packages/core/component/Properties/components/PropertyRow.tsx b/js/app/packages/core/component/Properties/component/panel/PropertyRow.tsxsimilarity index 83%rename from js/app/packages/core/component/Properties/components/PropertyRow.tsxrename to js/app/packages/core/component/Properties/component/panel/PropertyRow.tsxindex a9bba97d79..f61b4cd1ee 100644--- a/js/app/packages/core/component/Properties/components/PropertyRow.tsx+++ b/js/app/packages/core/component/Properties/component/panel/PropertyRow.tsx@@ -1,7 +1,7 @@import type { Component } from 'solid-js';-import type { Property } from '../types';+import type { Property } from '../../types';+import { PropertyValue } from '../propertyValue/PropertyValue';import { PropertyLabel } from './PropertyLabel';-import { PropertyValue } from './property-display/PropertyValue';interface PropertyRowProps {property: Property;diff --git a/js/app/packages/core/component/Properties/component/panel/index.ts b/js/app/packages/core/component/Properties/component/panel/index.tsnew file mode 100644index 0000000000..bd337e8272--- /dev/null+++ b/js/app/packages/core/component/Properties/component/panel/index.ts@@ -0,0 +1,5 @@+export { AddPropertyButton } from './AddPropertyButton';+export { PanelContainer } from './PanelContainer';+export { PropertyGrid } from './PropertyGrid';+export { PropertyLabel } from './PropertyLabel';+export { PropertyRow } from './PropertyRow';diff --git a/js/app/packages/core/component/Properties/components/property-display/BooleanValue.tsx b/js/app/packages/core/component/Properties/component/propertyValue/BooleanValue.tsxsimilarity index 93%rename from js/app/packages/core/component/Properties/components/property-display/BooleanValue.tsxrename to js/app/packages/core/component/Properties/component/propertyValue/BooleanValue.tsxindex c501cf091a..73442848c0 100644--- a/js/app/packages/core/component/Properties/components/property-display/BooleanValue.tsx+++ b/js/app/packages/core/component/Properties/component/propertyValue/BooleanValue.tsx@@ -2,7 +2,7 @@ import CheckIcon from '@icon/bold/check-bold.svg';import type { EntityType } from '@service-properties/generated/schemas/entityType';import type { Component } from 'solid-js';import { Show } from 'solid-js';-import { useBooleanToggle } from '../../hooks';+import { useBooleanEditor } from '../../hooks';import type { Property } from '../../types';type BooleanValueProps = {@@ -17,7 +17,7 @@ type BooleanValueProps = {* Treats undefined as false (unchecked)*/export const BooleanValue: Component<BooleanValueProps> = (props) => {- const { value, isSaving, toggle } = useBooleanToggle(+ const { value, isSaving, toggle } = useBooleanEditor(props.property as Property & { valueType: 'boolean' },props.entityType,props.onRefreshdiff --git a/js/app/packages/core/component/Properties/components/property-display/DateValue.tsx b/js/app/packages/core/component/Properties/component/propertyValue/DateValue.tsxsimilarity index 95%rename from js/app/packages/core/component/Properties/components/property-display/DateValue.tsxrename to js/app/packages/core/component/Properties/component/propertyValue/DateValue.tsxindex cd8b8d5e94..bef6f0a53d 100644--- a/js/app/packages/core/component/Properties/components/property-display/DateValue.tsx+++ b/js/app/packages/core/component/Properties/component/propertyValue/DateValue.tsx@@ -2,7 +2,7 @@ import type { Component } from 'solid-js';import { Show } from 'solid-js';import type { Property } from '../../types';import { formatDate } from '../../utils';-import { EmptyValue } from './PropertyValuePrimitives';+import { EmptyValue } from './ValueComponents';type DateValueProps = {property: Property;diff --git a/js/app/packages/core/component/Properties/EntityValueDisplay.tsx b/js/app/packages/core/component/Properties/component/propertyValue/EntityIcon.tsxsimilarity index 92%rename from js/app/packages/core/component/Properties/EntityValueDisplay.tsxrename to js/app/packages/core/component/Properties/component/propertyValue/EntityIcon.tsxindex b34f410064..cba4ca28d4 100644--- a/js/app/packages/core/component/Properties/EntityValueDisplay.tsx+++ b/js/app/packages/core/component/Properties/component/propertyValue/EntityIcon.tsx@@ -1,5 +1,5 @@import { useChannelName } from '@core/component/ChannelsProvider';-import { EntityIcon } from '@core/component/EntityIcon';+import { EntityIcon as CoreEntityIcon } from '@core/component/EntityIcon';import { IconButton } from '@core/component/IconButton';import { BlockLink } from '@core/component/LexicalMarkdown/component/core/BlockLink';import { UserIcon } from '@core/component/UserIcon';@@ -20,7 +20,7 @@ import {type ParentProps,Show,} from 'solid-js';-import type { Property } from './types';+import type { Property } from '../../types';type EntityValueDisplayProps = ParentProps<{property: Property;@@ -33,9 +33,7 @@ type EntityValueDisplayProps = ParentProps<{const ICON_CLASSES = 'size-4 text-ink-muted';-export const EntityValueDisplay: Component<EntityValueDisplayProps> = (- props-) => {+export const EntityIcon: Component<EntityValueDisplayProps> = (props) => {const [isHovered, setIsHovered] = createSignal(false);// Get preview for items that need it (document, project, chat, channel for icon)@@ -120,24 +118,24 @@ export const EntityValueDisplay: Component<EntityValueDisplayProps> = (previewItem.loading ||!isAccessiblePreviewItem(previewItem)) {- return <EntityIcon targetType="unknown" size="xs" />;+ return <CoreEntityIcon targetType="unknown" size="xs" />;}const fileType = previewItem.fileType;const blockName = fileType? fileTypeToBlockName(fileType, true): 'unknown';- return <EntityIcon targetType={blockName} size="xs" />;+ return <CoreEntityIcon targetType={blockName} size="xs" />;}case 'PROJECT':- return <EntityIcon targetType="project" size="xs" />;+ return <CoreEntityIcon targetType="project" size="xs" />;case 'CHAT':- return <EntityIcon targetType="chat" size="xs" />;+ return <CoreEntityIcon targetType="chat" size="xs" />;default:- return <EntityIcon targetType="unknown" size="xs" />;+ return <CoreEntityIcon targetType="unknown" size="xs" />;}});diff --git a/js/app/packages/core/component/Properties/components/property-display/EntityValue.tsx b/js/app/packages/core/component/Properties/component/propertyValue/EntityValue.tsxsimilarity index 94%rename from js/app/packages/core/component/Properties/components/property-display/EntityValue.tsxrename to js/app/packages/core/component/Properties/component/propertyValue/EntityValue.tsxindex 278cbcb706..cca10c74cc 100644--- a/js/app/packages/core/component/Properties/components/property-display/EntityValue.tsx+++ b/js/app/packages/core/component/Properties/component/propertyValue/EntityValue.tsx@@ -4,9 +4,9 @@ import type { EntityType } from '@service-properties/generated/schemas/entityTypimport type { Component } from 'solid-js';import { createSignal, For, Show } from 'solid-js';import { savePropertyValue } from '../../api/propertyValues';-import { EntityValueDisplay } from '../../EntityValueDisplay';import type { Property } from '../../types';-import { AddPropertyValueButton, EmptyValue } from './PropertyValuePrimitives';+import { EntityIcon } from './EntityIcon';+import { AddPropertyValueButton, EmptyValue } from './ValueComponents';type EntityValueProps = {property: Property;@@ -67,7 +67,7 @@ export const EntityValue: Component<EntityValueProps> = (props) => {<div class="flex flex-wrap gap-1 justify-start items-start w-full min-w-0"><For each={entities}>{(entityRef) => (- <EntityValueDisplay+ <EntityIconproperty={props.property}entityId={entityRef.entity_id}entityType={entityRef.entity_type}diff --git a/js/app/packages/core/component/Properties/components/property-display/LinkValue.tsx b/js/app/packages/core/component/Properties/component/propertyValue/LinkValue.tsxsimilarity index 94%rename from js/app/packages/core/component/Properties/components/property-display/LinkValue.tsxrename to js/app/packages/core/component/Properties/component/propertyValue/LinkValue.tsxindex 05d07e8d7c..3c2f98afbe 100644--- a/js/app/packages/core/component/Properties/components/property-display/LinkValue.tsx+++ b/js/app/packages/core/component/Properties/component/propertyValue/LinkValue.tsx@@ -11,7 +11,7 @@ import { createStore } from 'solid-js/store';import { savePropertyValue } from '../../api/propertyValues';import type { Property } from '../../types';import { extractDomain, isValidUrl, normalizeUrl } from '../../utils';-import { AddPropertyValueButton, EmptyValue } from './PropertyValuePrimitives';+import { AddPropertyValueButton, EmptyValue } from './ValueComponents';type LinkValueProps = {property: Property;@@ -20,8 +20,6 @@ type LinkValueProps = {onRefresh?: () => void;};-const [badLinks, setBadLinks] = createStore<Record<string, true>>({});-export const LinkValue: Component<LinkValueProps> = (props) => {const blockId = useBlockId();const [isAdding, setIsAdding] = createSignal(false);@@ -29,6 +27,7 @@ export const LinkValue: Component<LinkValueProps> = (props) => {const [error, setError] = createSignal<string | null>(null);const [hoveredLink, setHoveredLink] = createSignal<string | null>(null);const [isSaving, setIsSaving] = createSignal(false);+ const [badLinks, setBadLinks] = createStore<Record<string, true>>({});const isReadOnly = () => props.property.isMetadata || !props.canEdit;const linkValues = (props.property.value || []) as string[];@@ -174,6 +173,8 @@ export const LinkValue: Component<LinkValueProps> = (props) => {isRemoving={isSaving()}hoveredLink={hoveredLink()}setHoveredLink={setHoveredLink}+ badLinks={badLinks}+ setBadLinks={setBadLinks}/>)}</For>@@ -211,6 +212,8 @@ type LinkDisplayProps = {isRemoving: boolean;hoveredLink: string | null;setHoveredLink: (url: string | null) => void;+ badLinks: Record<string, true>;+ setBadLinks: (key: string, value: true) => void;};const LinkDisplay: Component<LinkDisplayProps> = (props) => {@@ -264,7 +267,9 @@ const LinkDisplay: Component<LinkDisplayProps> = (props) => {><div class="shrink-0 w-4 h-4 flex items-center justify-center"><Show- when={faviconUrl() && !imageError() && !badLinks[faviconUrl()!]}+ when={+ faviconUrl() && !imageError() && !props.badLinks[faviconUrl()!]+ }fallback={<LinkIcon class="w-3.5 h-3.5 text-ink-muted" />}><img@@ -275,7 +280,7 @@ const LinkDisplay: Component<LinkDisplayProps> = (props) => {onError={() => {setImageError(true);if (faviconUrl()) {- setBadLinks(faviconUrl()!, true);+ props.setBadLinks(faviconUrl()!, true);}}}/>diff --git a/js/app/packages/core/component/Properties/components/property-display/NumberValue.tsx b/js/app/packages/core/component/Properties/component/propertyValue/NumberValue.tsxsimilarity index 97%rename from js/app/packages/core/component/Properties/components/property-display/NumberValue.tsxrename to js/app/packages/core/component/Properties/component/propertyValue/NumberValue.tsxindex 034fe43cb0..8f965a2188 100644--- a/js/app/packages/core/component/Properties/components/property-display/NumberValue.tsx+++ b/js/app/packages/core/component/Properties/component/propertyValue/NumberValue.tsx@@ -4,7 +4,7 @@ import { Show } from 'solid-js';import { useInlineEditor } from '../../hooks';import type { Property } from '../../types';import { formatNumber } from '../../utils';-import { EmptyValue } from './PropertyValuePrimitives';+import { EmptyValue } from './ValueComponents';type NumberValueProps = {property: Property;diff --git a/js/app/packages/core/component/Properties/components/property-display/PropertyValue.tsx b/js/app/packages/core/component/Properties/component/propertyValue/PropertyValue.tsxsimilarity index 100%rename from js/app/packages/core/component/Properties/components/property-display/PropertyValue.tsxrename to js/app/packages/core/component/Properties/component/propertyValue/PropertyValue.tsxdiff --git a/js/app/packages/core/component/Properties/components/property-display/SelectValue.tsx b/js/app/packages/core/component/Properties/component/propertyValue/SelectValue.tsxsimilarity index 96%rename from js/app/packages/core/component/Properties/components/property-display/SelectValue.tsxrename to js/app/packages/core/component/Properties/component/propertyValue/SelectValue.tsxindex bef191c51d..e0695d0113 100644--- a/js/app/packages/core/component/Properties/components/property-display/SelectValue.tsx+++ b/js/app/packages/core/component/Properties/component/propertyValue/SelectValue.tsx@@ -5,10 +5,10 @@ import type { EntityType } from '@service-properties/generated/schemas/entityTypimport type { Component } from 'solid-js';import { createSignal, For, Show } from 'solid-js';import { savePropertyValue } from '../../api/propertyValues';-import { PROPERTY_STYLES } from '../../styles/propertyStyles';+import { PROPERTY_STYLES } from '../../styles/styles';import type { Property } from '../../types';import { formatPropertyValue } from '../../utils';-import { AddPropertyValueButton, EmptyValue } from './PropertyValuePrimitives';+import { AddPropertyValueButton, EmptyValue } from './ValueComponents';type SelectValueProps = {property: Property;diff --git a/js/app/packages/core/component/Properties/components/property-display/TextValue.tsx b/js/app/packages/core/component/Properties/component/propertyValue/TextValue.tsxsimilarity index 97%rename from js/app/packages/core/component/Properties/components/property-display/TextValue.tsxrename to js/app/packages/core/component/Properties/component/propertyValue/TextValue.tsxindex ef72cc0e6b..4c2391c553 100644--- a/js/app/packages/core/component/Properties/components/property-display/TextValue.tsx+++ b/js/app/packages/core/component/Properties/component/propertyValue/TextValue.tsx@@ -4,7 +4,7 @@ import { Show } from 'solid-js';import { useInlineEditor } from '../../hooks';import type { Property } from '../../types';import { formatPropertyValue } from '../../utils';-import { EmptyValue } from './PropertyValuePrimitives';+import { EmptyValue } from './ValueComponents';type TextValueProps = {property: Property;diff --git a/js/app/packages/core/component/Properties/components/property-display/PropertyValuePrimitives.tsx b/js/app/packages/core/component/Properties/component/propertyValue/ValueComponents.tsxsimilarity index 100%rename from js/app/packages/core/component/Properties/components/property-display/PropertyValuePrimitives.tsxrename to js/app/packages/core/component/Properties/component/propertyValue/ValueComponents.tsxdiff --git a/js/app/packages/core/component/Properties/components/property-display/index.ts b/js/app/packages/core/component/Properties/component/propertyValue/index.tssimilarity index 72%rename from js/app/packages/core/component/Properties/components/property-display/index.tsrename to js/app/packages/core/component/Properties/component/propertyValue/index.tsindex ecf402a175..5d38f9dbc3 100644--- a/js/app/packages/core/component/Properties/components/property-display/index.ts+++ b/js/app/packages/core/component/Properties/component/propertyValue/index.ts@@ -1,7 +1,10 @@export { BooleanValue } from './BooleanValue';export { DateValue } from './DateValue';+export { EntityIcon } from './EntityIcon';export { EntityValue } from './EntityValue';+export { LinkValue } from './LinkValue';export { NumberValue } from './NumberValue';export { PropertyValue } from './PropertyValue';export { SelectValue } from './SelectValue';export { TextValue } from './TextValue';+export * from './ValueComponents';diff --git a/js/app/packages/core/component/Properties/components/index.ts b/js/app/packages/core/component/Properties/components/index.tsdeleted file mode 100644index 199746a04b..0000000000--- a/js/app/packages/core/component/Properties/components/index.ts+++ /dev/null@@ -1,11 +0,0 @@-// Export all property display components--export { AddPropertyButton } from './AddPropertyButton';-export { CreatePropertyModal } from './CreatePropertyModal';-export { PropertiesContent } from './PropertiesContent';-// Export new components-export { PropertiesList } from './PropertiesList';-export { PropertiesModals } from './PropertiesModals';-export { PropertyLabel } from './PropertyLabel';-export { PropertyRow } from './PropertyRow';-export * from './property-display';diff --git a/js/app/packages/core/component/Properties/hooks/index.ts b/js/app/packages/core/component/Properties/hooks/index.tsindex 7cd30c01ae..223a2efc45 100644--- a/js/app/packages/core/component/Properties/hooks/index.ts+++ b/js/app/packages/core/component/Properties/hooks/index.ts@@ -1,4 +1,4 @@-export { useBooleanToggle } from './useBooleanToggle';+export { useBooleanEditor } from './useBooleanEditor';+export { useEntityProperties } from './useEntityProperties';export { useInlineEditor } from './useInlineEditor';-export { useProperties } from './useProperties';-export { usePropertyManagement } from './usePropertyManagement';+export { usePropertyModals } from './usePropertyModals';diff --git a/js/app/packages/core/component/Properties/hooks/useBooleanToggle.ts b/js/app/packages/core/component/Properties/hooks/useBooleanEditor.tssimilarity index 95%rename from js/app/packages/core/component/Properties/hooks/useBooleanToggle.tsrename to js/app/packages/core/component/Properties/hooks/useBooleanEditor.tsindex 7ad9d17780..9608dead26 100644--- a/js/app/packages/core/component/Properties/hooks/useBooleanToggle.ts+++ b/js/app/packages/core/component/Properties/hooks/useBooleanEditor.ts@@ -5,13 +5,13 @@ import { savePropertyValue } from '../api';import type { Property } from '../types';/**- * Hook for toggling boolean properties+ * Hook for editing boolean properties** @param property - The property to toggle* @param entityType - The type of entity* @param onSaved - Callback when save succeeds*/-export function useBooleanToggle(+export function useBooleanEditor(property: Property & { valueType: 'BOOLEAN' },entityType: EntityType,onSaved?: () => voiddiff --git a/js/app/packages/core/component/Properties/hooks/useProperties.ts b/js/app/packages/core/component/Properties/hooks/useEntityProperties.tssimilarity index 98%rename from js/app/packages/core/component/Properties/hooks/useProperties.tsrename to js/app/packages/core/component/Properties/hooks/useEntityProperties.tsindex 36d53b399d..3b20a13a95 100644--- a/js/app/packages/core/component/Properties/hooks/useProperties.ts+++ b/js/app/packages/core/component/Properties/hooks/useEntityProperties.ts@@ -17,7 +17,7 @@ import type { Property } from '../types';* @param entityType - The type of entity (e.g., 'document', 'channel', 'project')* @param includeMetadata - Whether to include metadata properties*/-export function useProperties(+export function useEntityProperties(entityId: string,entityType: EntityType,includeMetadata: booleandiff --git a/js/app/packages/core/component/Properties/hooks/usePropertyManagement.ts b/js/app/packages/core/component/Properties/hooks/usePropertyModals.tssimilarity index 96%rename from js/app/packages/core/component/Properties/hooks/usePropertyManagement.tsrename to js/app/packages/core/component/Properties/hooks/usePropertyModals.tsindex 435c77a949..16a7dc3c5a 100644--- a/js/app/packages/core/component/Properties/hooks/usePropertyManagement.ts+++ b/js/app/packages/core/component/Properties/hooks/usePropertyModals.ts@@ -15,7 +15,7 @@ export interface PropertyManagementState {error: string | null;}-export function usePropertyManagement(+export function usePropertyModals(existingPropertyIds: string[],searchQuery?: () => string) {@@ -26,17 +26,17 @@ export function usePropertyManagement(error: null,});+ // Memoize Set creation to avoid recreation on every search keystroke+ const existingPropertyIdsSet = createMemo(() => new Set(existingPropertyIds));+const filteredProperties = createMemo(() => {const currentState = state();const query = searchQuery ? searchQuery().toLowerCase().trim() : '';-- // Convert existing property IDs to Set for O(1) lookup- const existingPropertyIdsSet = new Set(existingPropertyIds);+ const existingIds = existingPropertyIdsSet();// First filter out existing properties (reactive to existingPropertyIds changes)const availableProperties = currentState.availableProperties.filter(- (property) =>- property && property.id && !existingPropertyIdsSet.has(property.id)+ (property) => property && property.id && !existingIds.has(property.id));// Then apply search filterdiff --git a/js/app/packages/core/component/Properties/styles/index.ts b/js/app/packages/core/component/Properties/styles/index.tsindex e69de29bb2..15c73a4500 100644--- a/js/app/packages/core/component/Properties/styles/index.ts+++ b/js/app/packages/core/component/Properties/styles/index.ts@@ -0,0 +1 @@+export * from './styles';diff --git a/js/app/packages/core/component/Properties/styles/propertyStyles.ts b/js/app/packages/core/component/Properties/styles/styles.tssimilarity index 100%rename from js/app/packages/core/component/Properties/styles/propertyStyles.tsrename to js/app/packages/core/component/Properties/styles/styles.ts