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.

style(soup): move task property display to right side of soup (#1004)

Seamusd19b4ae83de1
diff --git a/js/app/packages/core/component/Properties/component/propertyValue/CondensedPropertyValue.tsx b/js/app/packages/core/component/Properties/component/propertyValue/CondensedPropertyValue.tsx
index 87f5aefd17..33dde075e2 100644
--- a/js/app/packages/core/component/Properties/component/propertyValue/CondensedPropertyValue.tsx
+++ b/js/app/packages/core/component/Properties/component/propertyValue/CondensedPropertyValue.tsx
@@ -14,6 +14,7 @@ import {
import { PropertyTooltip } from './PropertyTooltip';
import CircleDashedEmpty from '@icon/regular/circle-dashed.svg';
import { UserGroup } from './UserGroup';
+import { cn } from '@ui/utils/classname';
type CondensedPropertyValueProps = {
property: Property;
@@ -57,12 +58,14 @@ export const CondensedPropertyValue: Component<CondensedPropertyValueProps> = (
class="flex items-center"
>
<div
- class="inline-flex items-center text-xs leading-none text-ink-muted shrink-0 p-1.5 h-6.5 transition-colors"
- classList={{
- 'cursor-pointer hover:border-edge-muted hover:bg-hover/50': canEdit,
- 'opacity-50': !validValue(),
- 'border border-edge-muted/50': !isUserProperty(),
- }}
+ class={cn(
+ 'inline-flex items-center text-xs leading-none text-ink-muted shrink-0 py-1.5 h-6.5 transition-colors',
+ {
+ 'cursor-pointer hover:border-edge-muted hover:bg-hover/50': canEdit,
+ 'opacity-50': !validValue(),
+ 'border border-edge-muted/50 px-1.5': !isUserProperty(),
+ }
+ )}
onClick={handleClick}
role={canEdit ? 'button' : undefined}
tabIndex={canEdit ? 0 : undefined}
@@ -79,7 +82,7 @@ const CondensedIcon = (props: { property: Property }) => {
if (isEntityProperty(props.property)) {
if (props.property.specificEntityType === 'USER') {
- return <UserGroup entities={props.property.value ?? []} />;
+ return <UserGroup entities={props.property.value ?? []} maxUsers={2} />;
}
}
diff --git a/js/app/packages/core/component/Properties/component/propertyValue/UserGroup.tsx b/js/app/packages/core/component/Properties/component/propertyValue/UserGroup.tsx
index f7d2182723..c2960c0f7d 100644
--- a/js/app/packages/core/component/Properties/component/propertyValue/UserGroup.tsx
+++ b/js/app/packages/core/component/Properties/component/propertyValue/UserGroup.tsx
@@ -2,40 +2,41 @@ import { createMemo, For, Show } from 'solid-js';
import type { EntityReference } from '../../types';
import { UserIcon } from '@core/component/UserIcon';
-const MAX_USER_AVATARS = 3;
-
type UserEntityPillProps = {
entities: EntityReference[];
+ maxUsers?: number;
};
/**
* Pill for multiselect user entity properties that shows user avatars in LiveIndicators style
*/
export const UserGroup = (props: UserEntityPillProps) => {
+ const max = () => props.maxUsers ?? 3;
const remaining = createMemo(() => {
- if (props.entities.length <= MAX_USER_AVATARS) return undefined;
- return props.entities.length - MAX_USER_AVATARS;
+ if (props.entities.length <= max()) return undefined;
+ return props.entities.length - max();
});
- const displayEntities = () => props.entities.slice(0, MAX_USER_AVATARS);
+ const displayEntities = () => props.entities.slice(0, max());
return (
- <div class="flex items-center shrink-0 w-fit pr-2">
+ <div class="flex items-center shrink-0 w-fit pr-3">
<For each={displayEntities()}>
{(entity) => (
- <div class="bg-panel rounded-full p-[2px] -mr-2">
+ <div class="bg-panel rounded-full p-[2px] -mr-3">
<UserIcon
id={entity.entity_id}
isDeleted={false}
size="xs"
suppressClick
+ showTooltip={false}
/>
</div>
)}
</For>
<Show when={remaining()}>
<div class="z-4">
- <div class="size-5 bg-panel border-2 text-[10px] -mr-2 text-ink border-panel rounded-full flex flex-col justify-center items-center">
+ <div class="size-5 bg-menu border-2 text-[10px] -mr-2 text-ink border-panel rounded-full flex flex-col justify-center items-center">
<span>+{remaining()}</span>
</div>
</div>
diff --git a/js/app/packages/macro-entity/src/components/EntityPropertyValues.tsx b/js/app/packages/macro-entity/src/components/EntityPropertyValues.tsx
index 9f3e3823d2..121e7ff80e 100644
--- a/js/app/packages/macro-entity/src/components/EntityPropertyValues.tsx
+++ b/js/app/packages/macro-entity/src/components/EntityPropertyValues.tsx
@@ -41,7 +41,7 @@ function sortProperties(properties: Property[]): Property[] {
});
}
-type EntityPropertyValuesProps = {
+export type EntityPropertyValuesProps = {
properties: Property[];
entityId: string;
entityType: EntityType;
@@ -105,3 +105,69 @@ export const EntityPropertyValues = (props: EntityPropertyValuesProps) => {
</Show>
);
};
+
+export const KeyPropertiesGrid = (props: EntityPropertyValuesProps) => {
+ const keyProperties = createMemo(() => {
+ const filtered = props.properties.filter((prop) =>
+ PROPERTY_SORT_ORDER.includes(
+ prop.propertyDefinitionId as (typeof PROPERTY_SORT_ORDER)[number]
+ )
+ );
+
+ return filtered.sort((a, b) => {
+ const aIndex = PROPERTY_SORT_ORDER.indexOf(
+ a.propertyDefinitionId as (typeof PROPERTY_SORT_ORDER)[number]
+ );
+ const bIndex = PROPERTY_SORT_ORDER.indexOf(
+ b.propertyDefinitionId as (typeof PROPERTY_SORT_ORDER)[number]
+ );
+ return aIndex - bIndex;
+ });
+ });
+
+ const saveMutation = useSaveEntityPropertyMutation();
+ const saveHandler: PropertySaveHandler = {
+ saveProperty: (property: Property, value: PropertyApiValues) =>
+ saveMutation.mutateAsync({
+ entityId: props.entityId,
+ entityType: props.entityType,
+ property,
+ apiValues: value,
+ }),
+ saveDate: (property: Property, date: Date) =>
+ saveMutation.mutateAsync({
+ entityId: props.entityId,
+ entityType: props.entityType,
+ property,
+ apiValues: {
+ valueType: 'DATE',
+ value: date.toISOString(),
+ },
+ }),
+ };
+
+ return (
+ <Show when={keyProperties().length > 0}>
+ <PropertiesProvider
+ entityType={props.entityType}
+ canEdit={true}
+ properties={keyProperties}
+ onRefresh={() => {}}
+ onPropertyAdded={() => {}}
+ onPropertyDeleted={() => {}}
+ saveHandler={saveHandler}
+ >
+ <div class="grid grid-cols-[auto_auto_2.4rem] gap-1 items-center">
+ <For each={keyProperties()}>
+ {(property) => (
+ <div class="relative">
+ <PropertyValue property={property} condensed />
+ </div>
+ )}
+ </For>
+ </div>
+ <Modals />
+ </PropertiesProvider>
+ </Show>
+ );
+};
diff --git a/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx b/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx
index be997ee2a6..000b911583 100644
--- a/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx
+++ b/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx
@@ -48,7 +48,7 @@ import type {
SearchLocation,
WithSearch,
} from '../types/search';
-import { EntityPropertyValues } from './EntityPropertyValues';
+import { KeyPropertiesGrid } from './EntityPropertyValues';
export type EntityClickEvent = Parameters<
JSX.EventHandler<HTMLDivElement, MouseEvent>
@@ -1063,13 +1063,6 @@ export function EntityWithEverything(
</div>
</div>
<EntityTitle />
- <Show when={isTaskEntity(props.entity) && properties().length > 0}>
- <EntityPropertyValues
- properties={properties()}
- entityId={props.entity.id}
- entityType="TASK"
- />
- </Show>
</div>
{/* Date and user - top right on mobile, end on desktop */}
<div
@@ -1097,9 +1090,16 @@ export function EntityWithEverything(
/>
)}
</Show>
+ <Show when={isTaskEntity(props.entity) && properties().length > 0}>
+ <KeyPropertiesGrid
+ properties={properties()}
+ entityId={props.entity.id}
+ entityType="TASK"
+ />
+ </Show>
<Show when={props.timestamp ?? props.entity.updatedAt}>
{(date) => (
- <span class="shrink-0 whitespace-nowrap text-xs font-mono uppercase text-ink-extra-muted @max-md/uList:hidden">
+ <span class="w-[8ch] text-right shrink-0 whitespace-nowrap text-xs font-mono uppercase text-ink-extra-muted @max-md/uList:hidden">
{createFormattedDate(date())}
</span>
)}