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 [properties-fe] - display properties as chips on row compact view (#371)

Daniel Kweon223b9d5e89f7
diff --git a/js/app/packages/app/component/Soup.tsx b/js/app/packages/app/component/Soup.tsx
index 68df771e1c..6396343428 100644
--- a/js/app/packages/app/component/Soup.tsx
+++ b/js/app/packages/app/component/Soup.tsx
@@ -394,7 +394,7 @@ export function Soup() {
>
<Tabs
ref={tabsRef}
- class="@container/soup flex flex-col gap-1 size-full overflow-x-clip"
+ class="@container/soup [container-type:inline-size] flex flex-col gap-1 size-full overflow-x-clip"
classList={{
'border-r border-edge-muted': preview(),
'pt-2 pb-0': showHelpDrawer().has(selectedView()),
diff --git a/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx b/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx
index 88876e3e80..efc65f98e7 100644
--- a/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx
+++ b/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx
@@ -533,11 +533,11 @@ export function EntityWithEverything(
}}
>
<div class="flex flex-row items-center justify-end gap-2 min-w-0">
- <div class="flex flex-row items-center justify-end w-fit h-full pr-3">
- <Show when={properties().length > 0}>
+ <Show when={properties().length > 0}>
+ <div class="pr-2 overflow-hidden shrink min-w-0">
<PropertyPills properties={properties()} />
- </Show>
- </div>
+ </div>
+ </Show>
<Show when={sharedData()}>
{(shared) => (
<Tooltip
diff --git a/js/app/packages/macro-entity/src/components/PropertyPills/BooleanPropertyPill.tsx b/js/app/packages/macro-entity/src/components/PropertyPills/BooleanPropertyPill.tsx
index 914184a200..a66108cb35 100644
--- a/js/app/packages/macro-entity/src/components/PropertyPills/BooleanPropertyPill.tsx
+++ b/js/app/packages/macro-entity/src/components/PropertyPills/BooleanPropertyPill.tsx
@@ -30,15 +30,16 @@ export const BooleanPropertyPill = (props: BooleanPropertyPillProps) => {
style={{ 'clip-path': cornerClip('0.2rem', 0, 0, 0) }}
>
<div
- class="inline-flex items-center gap-1.5 px-2 py-1 text-xs leading-none text-ink-muted bg-panel box-border"
+ class="inline-flex items-center gap-1.5 p-1.5 @3xl/soup:px-2 @3xl/soup:py-1 text-xs leading-none text-ink-muted bg-panel box-border"
style={{ 'clip-path': cornerClip('calc(0.2rem - 0.5px)', 0, 0, 0) }}
>
<PropertyDataTypeIcon
property={{
data_type: 'BOOLEAN',
}}
+ class="size-3.5 shrink-0"
/>
- <span class="truncate max-w-[120px]">
+ <span class="truncate max-w-[120px] hidden @3xl/soup:inline">
{props.property.displayName}
</span>
</div>
diff --git a/js/app/packages/macro-entity/src/components/PropertyPills/EntityPropertyPill.tsx b/js/app/packages/macro-entity/src/components/PropertyPills/EntityPropertyPill.tsx
index f5168d946b..b60f97e652 100644
--- a/js/app/packages/macro-entity/src/components/PropertyPills/EntityPropertyPill.tsx
+++ b/js/app/packages/macro-entity/src/components/PropertyPills/EntityPropertyPill.tsx
@@ -185,11 +185,13 @@ const SingleEntityPill = (props: SingleEntityPillProps) => {
style={{ 'clip-path': cornerClip('0.2rem', 0, 0, 0) }}
>
<div
- class="inline-flex items-center gap-1.5 px-2 py-1 text-xs leading-none text-ink-muted bg-panel box-border"
+ class="inline-flex items-center gap-1.5 p-1.5 @3xl/soup:px-2 @3xl/soup:py-1 text-xs leading-none text-ink-muted bg-panel box-border"
style={{ 'clip-path': cornerClip('calc(0.2rem - 0.5px)', 0, 0, 0) }}
>
<Show when={entityIcon()}>{entityIcon()}</Show>
- <span class="truncate max-w-[120px]">{entityName()}</span>
+ <span class="truncate max-w-[120px] hidden @3xl/soup:inline">
+ {entityName()}
+ </span>
</div>
</div>
</Tooltip>
@@ -236,7 +238,7 @@ const MultiEntityPill = (props: MultiEntityPillProps) => {
style={{ 'clip-path': cornerClip('0.2rem', 0, 0, 0) }}
>
<div
- class="inline-flex items-center gap-1.5 px-2 py-1 text-xs leading-none text-ink-muted bg-panel box-border"
+ class="inline-flex items-center gap-1.5 p-1.5 @3xl/soup:px-2 @3xl/soup:py-1 text-xs leading-none text-ink-muted bg-panel box-border"
style={{ 'clip-path': cornerClip('calc(0.2rem - 0.5px)', 0, 0, 0) }}
>
<PropertyDataTypeIcon
@@ -244,8 +246,9 @@ const MultiEntityPill = (props: MultiEntityPillProps) => {
data_type: 'ENTITY',
specific_entity_type: props.property.specificEntityType,
}}
+ class="size-3.5 shrink-0"
/>
- <span class="truncate max-w-[120px]">
+ <span class="truncate max-w-[120px] hidden @3xl/soup:inline">
{props.property.displayName} ({props.entities.length})
</span>
</div>
diff --git a/js/app/packages/macro-entity/src/components/PropertyPills/LinkPropertyPill.tsx b/js/app/packages/macro-entity/src/components/PropertyPills/LinkPropertyPill.tsx
index f32256d221..fd84674d1e 100644
--- a/js/app/packages/macro-entity/src/components/PropertyPills/LinkPropertyPill.tsx
+++ b/js/app/packages/macro-entity/src/components/PropertyPills/LinkPropertyPill.tsx
@@ -81,22 +81,24 @@ const SingleLinkPill = (props: SingleLinkPillProps) => {
style={{ 'clip-path': cornerClip('0.2rem', 0, 0, 0) }}
>
<div
- class="inline-flex items-center gap-1.5 px-2 py-1 text-xs leading-none text-ink-muted bg-panel box-border"
+ class="inline-flex items-center gap-1.5 p-1.5 @3xl/soup:px-2 @3xl/soup:py-1 text-xs leading-none text-ink-muted bg-panel box-border"
style={{ 'clip-path': cornerClip('calc(0.2rem - 0.5px)', 0, 0, 0) }}
>
<Show
when={faviconUrl() && !imageError()}
- fallback={<LinkIcon class="size-4 text-ink-muted" />}
+ fallback={<LinkIcon class="size-4 text-ink-muted shrink-0" />}
>
<img
src={faviconUrl()!}
- class="size-4 object-cover rounded"
+ class="size-4 object-cover rounded shrink-0"
crossorigin="anonymous"
alt=""
onError={() => setImageError(true)}
/>
</Show>
- <span class="truncate max-w-[100px]">{title()}</span>
+ <span class="truncate max-w-[100px] hidden @3xl/soup:inline">
+ {title()}
+ </span>
</div>
</div>
</Tooltip>
@@ -170,15 +172,16 @@ const MultiLinkPill = (props: MultiLinkPillProps) => {
style={{ 'clip-path': cornerClip('0.2rem', 0, 0, 0) }}
>
<div
- class="inline-flex items-center gap-1.5 px-2 py-1 text-xs leading-none text-ink-muted bg-panel box-border"
+ class="inline-flex items-center gap-1.5 p-1.5 @3xl/soup:px-2 @3xl/soup:py-1 text-xs leading-none text-ink-muted bg-panel box-border"
style={{ 'clip-path': cornerClip('calc(0.2rem - 0.5px)', 0, 0, 0) }}
>
<PropertyDataTypeIcon
property={{
data_type: 'LINK',
}}
+ class="size-3.5 shrink-0"
/>
- <span class="truncate max-w-[120px]">
+ <span class="truncate max-w-[120px] hidden @3xl/soup:inline">
{props.property.displayName} ({props.urls.length})
</span>
</div>
diff --git a/js/app/packages/macro-entity/src/components/PropertyPills/PropertyPills.tsx b/js/app/packages/macro-entity/src/components/PropertyPills/PropertyPills.tsx
index d223a328ea..ad194df30a 100644
--- a/js/app/packages/macro-entity/src/components/PropertyPills/PropertyPills.tsx
+++ b/js/app/packages/macro-entity/src/components/PropertyPills/PropertyPills.tsx
@@ -26,7 +26,7 @@ export const PropertyPills = (props: PropertyPillsProps) => {
return (
<Show when={props.properties.length > 0}>
- <div class="flex items-center gap-1 flex-wrap justify-end">
+ <div class="flex items-center gap-1 justify-end">
<For each={displayProperties()}>
{(property) => <PropertyPill property={property} />}
</For>
@@ -65,7 +65,10 @@ const PropertyPill = (props: PropertyPillProps) => {
};
/**
- * Pill for String, Number, Date, Select types
+ * Pill - shows icon + text when wide, icon only when narrow
+ * Uses @container/soup from Soup.tsx
+ * - >= @3xl (~768px): full (icon + text)
+ * - < @3xl: compact (icon only)
*/
const TextPropertyPill = (props: PropertyPillProps) => {
const displayValue = () => formatPillValue(props.property);
@@ -83,11 +86,11 @@ const TextPropertyPill = (props: PropertyPillProps) => {
}}
>
<div
- class="p-px bg-edge box-border h-fit flex items-center"
+ class="p-px bg-edge box-border h-fit flex items-center shrink-0"
style={{ 'clip-path': cornerClip('0.2rem', 0, 0, 0) }}
>
<div
- class="inline-flex items-center gap-1.5 px-2 py-1 text-xs leading-none text-ink-muted bg-panel box-border"
+ class="inline-flex items-center gap-1.5 p-1.5 @3xl/soup:px-2 @3xl/soup:py-1 text-xs leading-none text-ink-muted bg-panel box-border"
style={{ 'clip-path': cornerClip('calc(0.2rem - 0.5px)', 0, 0, 0) }}
>
<PropertyDataTypeIcon
@@ -95,8 +98,9 @@ const TextPropertyPill = (props: PropertyPillProps) => {
data_type: props.property.valueType,
specific_entity_type: props.property.specificEntityType,
}}
+ class="size-3.5 shrink-0"
/>
- <span class="truncate max-w-[120px]" title={value}>
+ <span class="truncate max-w-[100px] hidden @3xl/soup:inline">
{value}
</span>
</div>