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(md): improve sidepanel style and prop rendering (#3511)

Seamus0549f790927e
diff --git a/js/app/packages/app/component/next-soup/soup-view/views/tasks/list-property-value.tsx b/js/app/packages/app/component/next-soup/soup-view/views/tasks/list-property-value.tsx
index beb7a21ed1..1f92a79696 100644
--- a/js/app/packages/app/component/next-soup/soup-view/views/tasks/list-property-value.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/views/tasks/list-property-value.tsx
@@ -46,7 +46,7 @@ export const ListPropertyValue: Component<ListPropertyValueProps> = (props) => {
<>
<CircleDashedEmpty class="size-3 shrink-0 opacity-50" />
<span class="truncate flex-1 opacity-50 @max-[840px]/u-list:hidden">
- None
+ {props.property.displayName}
</span>
</>
}
diff --git a/js/app/packages/app/component/side-panel/SidePanel.tsx b/js/app/packages/app/component/side-panel/SidePanel.tsx
index 7ae51c7fef..c84ab87b0a 100644
--- a/js/app/packages/app/component/side-panel/SidePanel.tsx
+++ b/js/app/packages/app/component/side-panel/SidePanel.tsx
@@ -239,16 +239,16 @@ function Section(
order: props.order,
component: () => (
<Accordion.Item value={props.id}>
- <Panel depth={2} style={{ height: 'auto' }} class="rounded-lg">
+ <Panel depth={2} style={{ height: 'auto' }} class="rounded-xl">
<Accordion.Header class="group">
- <Accordion.Trigger class="px-2 py-3 flex w-full items-center gap-2 text-sm hover:underline">
+ <Accordion.Trigger class="px-2 py-3 flex w-full items-center gap-2 text-xs hover:underline">
<CaretRight class="size-3 text-ink-muted transition-transform duration-90 group-data-expanded:rotate-90" />
<span>{props.title}</span>
</Accordion.Trigger>
</Accordion.Header>
<Accordion.Content class="group/content overflow-hidden data-expanded:animate-accordion-down data-closed:animate-accordion-up">
<Suspense fallback={<div class="h-4" />}>
- <div class="px-2 pb-3 text-sm opacity-0 group-data-expanded/content:opacity-100 transition-opacity duration-150 ease-out">
+ <div class="px-2 pb-2 text-sm opacity-0 group-data-expanded/content:opacity-100 transition-opacity duration-150 ease-out">
{props.children}
</div>
</Suspense>
diff --git a/js/app/packages/app/index.css b/js/app/packages/app/index.css
index 62239c008e..2970097820 100644
--- a/js/app/packages/app/index.css
+++ b/js/app/packages/app/index.css
@@ -188,6 +188,12 @@
--z-index-modal: 110;
--z-index-modal-content: 120;
--z-index-tool-tip: 200;
+
+ /* Shared label column width for side-panel two-column grids so labels line
+ up across sub-panels (Details, Properties, ...). Consumers should use
+ `grid-cols-[var(--sidepanel-label-width,auto)_1fr]` so the column falls
+ back to auto when the variable isn't set. */
+ --sidepanel-label-width: 5.5rem;
}
/* scuffed: might wan to use signals for this */
diff --git a/js/app/packages/block-md/component/InlinePropertyValue.tsx b/js/app/packages/block-md/component/InlinePropertyValue.tsx
index 9cfdc5c2e6..9e04e86876 100644
--- a/js/app/packages/block-md/component/InlinePropertyValue.tsx
+++ b/js/app/packages/block-md/component/InlinePropertyValue.tsx
@@ -73,7 +73,11 @@ export const InlinePropertyValue: Component<InlinePropertyValueProps> = (
</Switch>
<Property.Text
property={props.property}
- fallback={<Property.Empty label={props.emptyLabel ?? 'None'} />}
+ fallback={
+ <Property.Empty
+ label={props.emptyLabel ?? props.property.displayName}
+ />
+ }
/>
<Property.Caret />
</Property.EditTrigger>
diff --git a/js/app/packages/block-md/component/sidepanel/MarkdownSidePanelSections.tsx b/js/app/packages/block-md/component/sidepanel/MarkdownSidePanelSections.tsx
index 4f7bca861f..ce2ec59a00 100644
--- a/js/app/packages/block-md/component/sidepanel/MarkdownSidePanelSections.tsx
+++ b/js/app/packages/block-md/component/sidepanel/MarkdownSidePanelSections.tsx
@@ -11,8 +11,11 @@ import {
} from '@core/component/LexicalMarkdown/plugins';
import { Notifications } from '@core/component/Notifications';
import { Modals } from '@core/component/Properties/component/modal';
-import { PanelContainer } from '@core/component/Properties/component/panel';
-import { getDefaultPinnedProperties } from '@core/component/Properties/constants';
+import { PropertyValueIcon } from '@core/component/Properties/component/propertyValue/PropertyValueIcon';
+import {
+ getDefaultPinnedProperties,
+ SYSTEM_PROPERTY_IDS,
+} from '@core/component/Properties/constants';
import {
PropertiesProvider,
type PropertySaveHandler,
@@ -23,30 +26,37 @@ import type {
Property,
PropertyApiValues,
} from '@core/component/Properties/types';
+import { hasValue } from '@core/component/Properties/utils';
import { References } from '@core/component/References';
import { UserIcon } from '@core/component/UserIcon';
import type { Entity, EntityType } from '@core/types';
import { tryMacroId, useDisplayName } from '@core/user';
import { type DateValue, formatDate } from '@core/util/date';
-
import { useSplitNavigationHandler } from '@core/util/useSplitNavigationHandler';
import { useNotificationsForEntity } from '@notifications';
+import CircleDashedEmpty from '@phosphor/circle-dashed.svg';
+import ClockIcon from '@phosphor/clock.svg';
import Plus from '@phosphor/plus.svg';
import LoadingSpinner from '@phosphor/spinner.svg';
+import { Property as PropertyNS } from '@property';
import { useBulkSaveEntityPropertiesMutation } from '@queries/properties/entity';
import { useDocumentMetadataQuery } from '@queries/storage/document-metadata';
import { commsServiceClient } from '@service-comms/client';
import type { EntityType as PropertiesEntityType } from '@service-properties/generated/schemas/entityType';
import { blockNameToItemType } from '@service-storage/client';
import { createCallback } from '@solid-primitives/rootless';
+import { cn } from '@ui/utils/classname';
import {
createEffect,
createMemo,
createResource,
createSignal,
+ For,
+ Match,
onCleanup,
Show,
Suspense,
+ Switch,
} from 'solid-js';
import { mdStore } from '../../signal/markdownBlockData';
@@ -139,7 +149,7 @@ function DetailsGrid(props: {
updatedAt: () => DateValue | null | undefined;
}) {
return (
- <div class="grid grid-cols-[auto_1fr] gap-x-2 gap-y-2 items-center text-xs">
+ <div class="grid grid-cols-[var(--sidepanel-label-width,auto)_1fr] gap-x-3 items-center text-xs auto-rows-[2rem]">
<Show when={props.owner()}>
{(ownerId) => (
<DetailsRow label="Owner">
@@ -157,14 +167,14 @@ function DetailsGrid(props: {
<Show when={props.createdAt()}>
{(created) => (
<DetailsRow label="Created">
- <span>{formatDate(created(), { showTime: true })}</span>
+ <DateValueDisplay value={created()} />
</DetailsRow>
)}
</Show>
<Show when={props.updatedAt()}>
{(updated) => (
<DetailsRow label="Last updated">
- <span>{formatDate(updated(), { showTime: true })}</span>
+ <DateValueDisplay value={updated()} />
</DetailsRow>
)}
</Show>
@@ -178,7 +188,9 @@ function DetailsRow(props: {
}) {
return (
<>
- <span class="text-ink-muted">{props.label}</span>
+ <span class="text-ink-muted truncate" title={props.label}>
+ {props.label}
+ </span>
<div class="flex items-center gap-2 min-w-0">{props.children}</div>
</>
);
@@ -207,15 +219,24 @@ function FolderLink(props: { projectId: string; projectName: string }) {
function OwnerValue(props: { ownerId: string }) {
const [displayName] = useDisplayName(tryMacroId(props.ownerId));
return (
- <div class="rounded-full flex gap-1 items-center px-1">
- <div class="flex">
- <UserIcon id={props.ownerId} size="sm" showTooltip suppressClick />
- </div>
+ <div class={cn(PILL_CLASS, 'w-fit')}>
+ <UserIcon id={props.ownerId} size="sm" showTooltip suppressClick />
<span class="truncate">{displayName()}</span>
</div>
);
}
+function DateValueDisplay(props: { value: DateValue }) {
+ return (
+ <div class={cn(PILL_CLASS, 'w-fit')}>
+ <ClockIcon class="size-3 shrink-0" />
+ <span class="truncate">
+ {formatDate(props.value, { showTime: true })}
+ </span>
+ </div>
+ );
+}
+
// ─────────────────────────────────────────────────────────────────────────────
// Properties Section
// ─────────────────────────────────────────────────────────────────────────────
@@ -258,27 +279,6 @@ function PropertiesSectionContent(props: {
onCleanup(unregister);
});
- const docMetadataQuery = useDocumentMetadataQuery(() => blockId);
- const createdByProperty = createMemo<Property | null>(() => {
- if (entityType !== 'TASK') return null;
- const ownerId = docMetadataQuery.data?.owner;
- if (!ownerId) return null;
- const now = new Date();
- return {
- propertyId: `${blockId}-created-by`,
- propertyDefinitionId: 'ffffffff-ffff-ffff-ffff-ffffffffffff',
- displayName: 'Created By',
- isMultiSelect: false,
- isMetadata: true,
- owner: { scope: 'system' },
- specificEntityType: 'USER',
- createdAt: now,
- updatedAt: now,
- valueType: 'ENTITY',
- value: [{ entity_id: ownerId, entity_type: 'USER' }],
- };
- });
-
const filteredPinnedProperties = createMemo(() => {
const allProps = properties();
const pinnedIds = pinnedPropertyIds();
@@ -291,8 +291,7 @@ function PropertiesSectionContent(props: {
pinnedIds.includes(prop.propertyId))
);
- const createdBy = createdByProperty();
- return createdBy ? [createdBy, ...pinned] : pinned;
+ return sortPinnedProperties(pinned);
});
const [pendingPinDefIds, setPendingPinDefIds] = createSignal<Set<string>>(
@@ -391,17 +390,15 @@ function PropertiesSectionContent(props: {
</Show>
<Show when={filteredPinnedProperties().length > 0}>
- <PanelContainer
- properties={filteredPinnedProperties}
- isLoading={isLoading}
- error={error}
- />
+ <div class="grid grid-cols-[var(--sidepanel-label-width,auto)_1fr] gap-x-3 items-center py-2 auto-rows-[2rem]">
+ <For each={filteredPinnedProperties()}>
+ {(property) => <SidePanelPropertyRow property={property} />}
+ </For>
+ </div>
</Show>
<Show when={props.canEdit}>
- <div class="py-2">
- <AddPinnedPropertyButton />
- </div>
+ <AddPinnedPropertyButton />
</Show>
<Modals />
</PropertiesProvider>
@@ -415,15 +412,194 @@ function AddPinnedPropertyButton() {
const { openPropertySelector } = usePropertiesContext();
return (
<button
- class="flex items-center gap-1 opacity-75 hover:opacity-50 transition-opacity"
onClick={openPropertySelector}
+ class={cn(
+ 'inline-flex items-center gap-1.5 ring ring-edge-muted bg-surface',
+ 'px-2 py-1 leading-tight rounded-full text-ink-muted',
+ 'hover:bg-hover hover:text-ink transition-colors'
+ )}
>
- <Plus class="w-3 h-3 mr-2" />
- <span class="text-ink-muted">Add property</span>
+ <Plus class="size-3" />
+ <span>Add property</span>
</button>
);
}
+// Side-panel ordering: Status, Priority, Assignees pinned to the top so the
+// most-frequently scanned task properties always sit in the same place; the
+// remaining properties keep their incoming order below.
+const PINNED_ORDER: readonly string[] = [
+ SYSTEM_PROPERTY_IDS.STATUS,
+ SYSTEM_PROPERTY_IDS.PRIORITY,
+ SYSTEM_PROPERTY_IDS.ASSIGNEES,
+];
+
+function sortPinnedProperties<T extends Property>(properties: T[]): T[] {
+ const rank = (id: string) => {
+ const i = PINNED_ORDER.indexOf(id);
+ return i === -1 ? PINNED_ORDER.length : i;
+ };
+ return [...properties].sort(
+ (a, b) => rank(a.propertyDefinitionId) - rank(b.propertyDefinitionId)
+ );
+}
+
+// ─────────────────────────────────────────────────────────────────────────────
+// Pinned property rows — sidepanel-specific. Rendered into a two-column grid:
+// the displayName label sits in the left column, the value pill in the right.
+// Pills have no ring in this layout (the grid handles spacing/alignment).
+// ─────────────────────────────────────────────────────────────────────────────
+
+const PILL_CLASS = cn(
+ 'inline-flex items-center gap-1.5 min-w-0 max-w-full',
+ 'px-2 py-1 leading-tight text-left rounded-full'
+);
+
+function SidePanelPropertyRow(props: { property: Property }) {
+ const ctx = usePropertiesContext();
+ const blockId = useBlockId();
+ const t = () => props.property.valueType;
+ const isMulti = () => !!props.property.isMultiSelect;
+
+ const isMultiValueRow = () =>
+ isMulti() &&
+ (t() === 'SELECT_STRING' || t() === 'SELECT_NUMBER' || t() === 'ENTITY');
+ const isInputType = () =>
+ t() === 'STRING' || t() === 'NUMBER' || t() === 'LINK' || t() === 'BOOLEAN';
+
+ return (
+ <>
+ <span
+ class="text-ink-muted truncate self-center"
+ title={props.property.displayName}
+ >
+ {props.property.displayName}
+ </span>
+ <div class="min-w-0 self-center">
+ <PropertyNS.Root
+ property={props.property}
+ canEdit={ctx.canEdit}
+ onSave={ctx.saveHandler.saveProperty}
+ onRefresh={ctx.onRefresh}
+ >
+ <Switch fallback={<SinglePill property={props.property} />}>
+ <Match when={isInputType()}>
+ <InputValue />
+ </Match>
+ <Match when={isMultiValueRow()}>
+ <MultiValue property={props.property} />
+ </Match>
+ </Switch>
+ <PropertyNS.PopoverEditor
+ entitySelfFilter={{ entityType: ctx.entityType, blockId }}
+ />
+ </PropertyNS.Root>
+ </div>
+ </>
+ );
+}
+
+function EmptyPillIndicator() {
+ return <CircleDashedEmpty class="size-3 shrink-0 opacity-50" />;
+}
+
+function SinglePill(props: { property: Property }) {
+ const ctx = usePropertiesContext();
+ const isReadOnly = () => !ctx.canEdit || props.property.isMetadata;
+ const empty = () => !hasValue(props.property);
+
+ return (
+ <PropertyNS.Tooltip property={props.property}>
+ <PropertyNS.EditTrigger
+ class={cn(PILL_CLASS, 'w-fit', {
+ 'hover:bg-hover': !isReadOnly(),
+ })}
+ >
+ <Show when={!empty()} fallback={<EmptyPillIndicator />}>
+ <PropertyNS.Icon property={props.property} class="size-3 shrink-0" />
+ <PropertyNS.Text property={props.property} />
+ </Show>
+ <PropertyNS.Caret />
+ </PropertyNS.EditTrigger>
+ </PropertyNS.Tooltip>
+ );
+}
+
+function UserStackPill(props: { property: Property }) {
+ const ctx = usePropertiesContext();
+ const isReadOnly = () => !ctx.canEdit || props.property.isMetadata;
+ const empty = () => !hasValue(props.property);
+
+ return (
+ <PropertyNS.Tooltip property={props.property}>
+ <PropertyNS.EditTrigger
+ class={cn(PILL_CLASS, 'w-fit', {
+ 'hover:bg-hover': !isReadOnly(),
+ })}
+ >
+ <Show when={!empty()} fallback={<EmptyPillIndicator />}>
+ <PropertyNS.UserStack property={props.property} maxUsers={3} />
+ <PropertyNS.Text property={props.property} />
+ </Show>
+ <PropertyNS.Caret />
+ </PropertyNS.EditTrigger>
+ </PropertyNS.Tooltip>
+ );
+}
+
+function MultiValue(props: { property: Property }) {
+ const ctx = usePropertiesContext();
+ const isReadOnly = () => !ctx.canEdit || props.property.isMetadata;
+ const isEntity = () => props.property.valueType === 'ENTITY';
+ const isUserEntity = () =>
+ isEntity() && props.property.specificEntityType === 'USER';
+
+ return (
+ <Show
+ when={!isUserEntity()}
+ fallback={<UserStackPill property={props.property} />}
+ >
+ <PropertyNS.Tooltip property={props.property}>
+ <Show when={!isEntity()} fallback={<PropertyNS.Display />}>
+ <div class="flex flex-wrap items-center gap-1.5">
+ <PropertyNS.Chips
+ property={props.property}
+ renderChip={(chip) => (
+ <span class={cn(PILL_CLASS, 'text-xs max-w-35 bg-hover')}>
+ <PropertyValueIcon
+ optionId={chip.key}
+ class="size-3 shrink-0"
+ />
+ <span class="truncate">{chip.label}</span>
+ </span>
+ )}
+ />
+ <Show when={!isReadOnly()}>
+ <PropertyNS.EditTrigger
+ class={cn(
+ 'inline-flex items-center justify-center size-5 rounded-full',
+ 'text-ink-muted hover:bg-hover hover:text-ink transition-colors'
+ )}
+ aria-label={`Add ${props.property.displayName}`}
+ >
+ <Plus class="size-3" />
+ </PropertyNS.EditTrigger>
+ </Show>
+ </div>
+ </Show>
+ </PropertyNS.Tooltip>
+ </Show>
+ );
+}
+
+function InputValue() {
+ return (
+ <div class="min-w-0 w-full">
+ <PropertyNS.Display />
+ </div>
+ );
+}
+
// ─────────────────────────────────────────────────────────────────────────────
// Stats Section
// ─────────────────────────────────────────────────────────────────────────────
diff --git a/js/app/packages/core/component/DocumentPreview.tsx b/js/app/packages/core/component/DocumentPreview.tsx
index 363cdfba92..ea213c0756 100644
--- a/js/app/packages/core/component/DocumentPreview.tsx
+++ b/js/app/packages/core/component/DocumentPreview.tsx
@@ -48,7 +48,7 @@ import { blockNameToItemType } from '@service-storage/client';
import { fetchBinary } from '@service-storage/util/fetchBinary';
import { createCallback } from '@solid-primitives/rootless';
import { useNavigate } from '@solidjs/router';
-import { cn, Surface, Tooltip } from '@ui';
+import { cn, Layer, Surface, Tooltip } from '@ui';
import { globalSplitManager } from 'app/signal/splitLayout';
import type { Component, JSX } from 'solid-js';
import {
@@ -407,6 +407,7 @@ export function TaskPropertiesPreview(props: { taskId: string }) {
/**
* Compact read-only pill for the document preview popup. The popup itself is
* already a tooltip-like surface, so there's no edit trigger or hover-card.
+ * Visually matches the side-panel Properties pills.
*/
function PreviewPropertyPill(props: {
property: import('@core/component/Properties/types').Property;
@@ -422,21 +423,31 @@ function PreviewPropertyPill(props: {
return (
<Property.Root property={props.property}>
- <div class="inline-flex items-center gap-1.5 px-2 py-0.5 rounded-sm bg-hover">
- <Switch
- fallback={
- <Property.Icon property={props.property} class="size-3 shrink-0" />
- }
+ <Layer depth={2}>
+ <div
+ class={cn(
+ 'inline-flex items-center gap-1.5 min-w-0 max-w-full ring ring-edge-muted',
+ 'px-2 py-1 leading-tight text-left rounded-full bg-surface'
+ )}
>
- <Match when={isMultiUser()}>
- <Property.UserStack property={props.property} maxUsers={2} />
- </Match>
- <Match when={isUserEntity()}>
- <Property.Icon property={props.property} />
- </Match>
- </Switch>
- <Property.Text property={props.property} class="truncate" />
- </div>
+ <Switch
+ fallback={
+ <Property.Icon
+ property={props.property}
+ class="size-3 shrink-0"
+ />
+ }
+ >
+ <Match when={isMultiUser()}>
+ <Property.UserStack property={props.property} maxUsers={2} />
+ </Match>
+ <Match when={isUserEntity()}>
+ <Property.Icon property={props.property} />
+ </Match>
+ </Switch>
+ <Property.Text property={props.property} class="truncate" />
+ </div>
+ </Layer>
</Property.Root>
);
}
diff --git a/js/app/packages/core/component/LexicalMarkdown/component/decorator/ContactMention.tsx b/js/app/packages/core/component/LexicalMarkdown/component/decorator/ContactMention.tsx
index f0451df42f..1d1547a7c6 100644
--- a/js/app/packages/core/component/LexicalMarkdown/component/decorator/ContactMention.tsx
+++ b/js/app/packages/core/component/LexicalMarkdown/component/decorator/ContactMention.tsx
@@ -105,7 +105,7 @@ export function ContactMention(props: ContactMentionDecoratorProps) {
<span
ref={mentionRef}
class={cn(
- 'relative p-0.5 cursor-default rounded-xs bg-accent/8 hover:bg-accent/20 focus:bg-accent/20 text-accent',
+ 'relative p-0.5 cursor-default rounded-md bg-accent/8 hover:bg-accent/20 focus:bg-accent/20 text-accent',
isSelectedAsNode() && 'bg-active'
)}
{...navHandlers}
diff --git a/js/app/packages/core/component/LexicalMarkdown/component/decorator/DateMention.tsx b/js/app/packages/core/component/LexicalMarkdown/component/decorator/DateMention.tsx
index 3505a0180f..f61299ea5d 100644
--- a/js/app/packages/core/component/LexicalMarkdown/component/decorator/DateMention.tsx
+++ b/js/app/packages/core/component/LexicalMarkdown/component/decorator/DateMention.tsx
@@ -113,7 +113,7 @@ export function DateMention(props: DateMentionDecoratorProps) {
<>
<span
ref={mentionRef}
- class="relative p-0.5 rounded-xs bg-accent/8 hover:bg-accent/20 focus:bg-accent/20 text-accent cursor-default"
+ class="relative p-0.5 rounded-md bg-accent/8 hover:bg-accent/20 focus:bg-accent/20 text-accent cursor-default"
classList={{
'bg-active': isSelectedAsNode(),
}}
diff --git a/js/app/packages/core/component/LexicalMarkdown/component/decorator/DocumentMention.tsx b/js/app/packages/core/component/LexicalMarkdown/component/decorator/DocumentMention.tsx
index 9477e9cbf6..4bb4c2ac70 100644
--- a/js/app/packages/core/component/LexicalMarkdown/component/decorator/DocumentMention.tsx
+++ b/js/app/packages/core/component/LexicalMarkdown/component/decorator/DocumentMention.tsx
@@ -221,7 +221,7 @@ function InlinePreview(props: {
<Show when={props.documentName} fallback={'Unknown'}>
{(name) => name().replaceAll('\n', ' ').trim()}
</Show>
- <span class="relative text-[0.8em] text-current/50 rounded-xs">
+ <span class="relative text-[0.8em] text-current/50 rounded-md">
{(() => {
const accessories = mentionsAccessories(
props.blockName as BlockName,
diff --git a/js/app/packages/core/component/LexicalMarkdown/component/decorator/GroupMention.tsx b/js/app/packages/core/component/LexicalMarkdown/component/decorator/GroupMention.tsx
index 8040823e77..e64a4ce882 100644
--- a/js/app/packages/core/component/LexicalMarkdown/component/decorator/GroupMention.tsx
+++ b/js/app/packages/core/component/LexicalMarkdown/component/decorator/GroupMention.tsx
@@ -16,7 +16,7 @@ export function GroupMention(props: GroupMentionDecoratorProps) {
return (
<span
class={cn(
- 'relative p-0.5 cursor-default rounded-xs bg-accent/8 hover:bg-accent/20 focus:bg-accent/20 text-accent',
+ 'relative p-0.5 cursor-default rounded-md bg-accent/8 hover:bg-accent/20 focus:bg-accent/20 text-accent',
isSelectedAsNode() && 'bg-active'
)}
>
diff --git a/js/app/packages/core/component/LexicalMarkdown/component/decorator/ThemeMention.tsx b/js/app/packages/core/component/LexicalMarkdown/component/decorator/ThemeMention.tsx
index fd8415bf86..eec1021861 100644
--- a/js/app/packages/core/component/LexicalMarkdown/component/decorator/ThemeMention.tsx
+++ b/js/app/packages/core/component/LexicalMarkdown/component/decorator/ThemeMention.tsx
@@ -4,9 +4,20 @@ import { setUserThemes, themes, userThemes } from '@theme/signals/themeSignals';
import type { ThemeV2 } from '@theme/types/themeTypes';
import { applyTheme } from '@theme/utils/themeUtils';
import { isThemeV2 } from '@theme/utils/themeValidation';
+import { cn } from '@ui';
+import { useContext } from 'solid-js';
+import { LexicalWrapperContext } from '../../context/LexicalWrapperContext';
export function ThemeMention(props: ThemeMentionDecoratorProps) {
const { openSettings } = useSettingsState();
+ const lexicalWrapper = useContext(LexicalWrapperContext);
+ const selection = () => lexicalWrapper?.selection;
+
+ const isSelectedAsNode = () => {
+ const sel = selection();
+ if (!sel) return false;
+ return sel.type === 'node' && sel.nodeKeys.has(props.key);
+ };
const theme = (): ThemeV2 | null => {
if (isThemeV2(props.data)) return props.data;
@@ -37,7 +48,10 @@ export function ThemeMention(props: ThemeMentionDecoratorProps) {
return (
<button
- class="pointer-events-auto mx-0.5 inline-flex items-center gap-0.75 align-baseline px-1 py-px rounded-[3px] border border-edge-muted bg-transparent"
+ class={cn(
+ 'pointer-events-auto mx-0.5 inline-flex items-center gap-0.75 align-baseline px-1 py-px rounded-md border border-edge-muted bg-transparent',
+ isSelectedAsNode() && 'bg-active'
+ )}
onClick={handleClick}
type="button"
>
diff --git a/js/app/packages/core/component/LexicalMarkdown/component/decorator/UnknownMention.tsx b/js/app/packages/core/component/LexicalMarkdown/component/decorator/UnknownMention.tsx
index 01423d25f9..5af34dd261 100644
--- a/js/app/packages/core/component/LexicalMarkdown/component/decorator/UnknownMention.tsx
+++ b/js/app/packages/core/component/LexicalMarkdown/component/decorator/UnknownMention.tsx
@@ -15,7 +15,7 @@ export function UnknownMention(props: UnknownMentionDecoratorProps) {
return (
<span
- class="relative p-0.5 cursor-default text-ink-muted/50"
+ class="relative rounded-md p-0.5 cursor-default text-ink-muted/50"
classList={{
'bg-active': isSelectedAsNode(),
}}
diff --git a/js/app/packages/core/component/LexicalMarkdown/component/decorator/UserMention.tsx b/js/app/packages/core/component/LexicalMarkdown/component/decorator/UserMention.tsx
index 5e6ca24eb8..8440b090f6 100644
--- a/js/app/packages/core/component/LexicalMarkdown/component/decorator/UserMention.tsx
+++ b/js/app/packages/core/component/LexicalMarkdown/component/decorator/UserMention.tsx
@@ -43,7 +43,7 @@ export function UserMention(props: UserMentionDecoratorProps) {
trigger={
<span
class={cn(
- 'relative p-0.5 cursor-default rounded-xs bg-accent/8 hover:bg-accent/20 focus:bg-accent/20 text-accent',
+ 'relative p-0.5 cursor-default rounded-md bg-accent/8 hover:bg-accent/20 focus:bg-accent/20 text-accent',
isSelectedAsNode() && 'bg-active'
)}
>