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.

fix: theme mentions (#1307)

Peter Chinman6576e8cea7a7
diff --git a/js/app/packages/block-theme/components/ThemeTools.tsx b/js/app/packages/block-theme/components/ThemeTools.tsx
index 253832c351..affe12e0ef 100644
--- a/js/app/packages/block-theme/components/ThemeTools.tsx
+++ b/js/app/packages/block-theme/components/ThemeTools.tsx
@@ -1,5 +1,5 @@
import { deleteTheme, exportTheme, importTheme, invertTheme, saveTheme } from '../utils/themeUtils';
-import { currentThemeId, isThemeSaved, themes } from '../signals/themeSignals';
+import { currentThemeId, isThemeSaved, themes, userThemes } from '../signals/themeSignals';
import { createEffect, createMemo, createSignal, Show } from 'solid-js';
import IconLightDark from '@macro-icons/macro-light-dark.svg';
import IconClipboard from '@macro-icons/macro-clipboard.svg';
@@ -9,8 +9,6 @@ import IconTrash from '@macro-icons/macro-trash.svg';
import { randomizeTheme } from './ThemeEditorBasic';
import IconDice from '@macro-icons/macro-dice.svg';
import IconSave from '@macro-icons/macro-save.svg';
-// import { copyTokens } from './ComputeTokens';
-import { DEFAULT_THEMES } from '../constants';
export function ThemeTools() {
let themeName!: HTMLDivElement;
@@ -25,7 +23,7 @@ export function ThemeTools() {
const [showTrash, setShowTrash] = createSignal<boolean>(true);
createEffect(() => {
- if(isThemeSaved() && !DEFAULT_THEMES.find((t) => t.id === currentThemeId())){setShowTrash(true)}
+ if(isThemeSaved() && userThemes().some((t) => t.id === currentThemeId())){setShowTrash(true)}
else{setShowTrash(false)}
});
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 d0bfdb1226..27e97c4885 100644
--- a/js/app/packages/core/component/LexicalMarkdown/component/decorator/ThemeMention.tsx
+++ b/js/app/packages/core/component/LexicalMarkdown/component/decorator/ThemeMention.tsx
@@ -1,7 +1,11 @@
import type { ThemeMentionDecoratorProps } from '@lexical-core';
import type { ThemeV1 } from '@block-theme/types/themeTypes';
import { isThemeV1 } from '@block-theme/utils/themeValidation';
-import { setUserThemes, userThemes } from '@block-theme/signals/themeSignals';
+import {
+ setUserThemes,
+ themes,
+ userThemes,
+} from '@block-theme/signals/themeSignals';
import { applyTheme } from '@block-theme/utils/themeUtils';
import { useSettingsState } from '@core/constant/SettingsState';
@@ -26,7 +30,7 @@ export function ThemeMention(props: ThemeMentionDecoratorProps) {
const t = theme();
if (!t) return;
- const existing = userThemes().find((ut: ThemeV1) => ut.id === t.id);
+ const existing = themes().find((ut) => ut.id === t.id);
if (!existing) {
setUserThemes([...userThemes(), t]);
}
@@ -36,63 +40,23 @@ export function ThemeMention(props: ThemeMentionDecoratorProps) {
};
return (
- <span
- class="pointer-events-auto"
- style={{ cursor: 'var(--cursor-pointer)' }}
- onClick={handleClick}
- >
- <span
- style={{
- display: 'inline-flex',
- 'align-items': 'center',
- gap: '3px',
- 'vertical-align': 'baseline',
- padding: '1px 4px',
- 'border-radius': '3px',
- border: '1px solid var(--color-edge-muted)',
- }}
- >
- <span
- style={{
- display: 'inline-flex',
- gap: '2px',
- 'align-items': 'center',
- }}
- >
+ <span class="pointer-events-auto mx-0.5" onClick={handleClick}>
+ <span class="inline-flex items-center gap-[3px] align-baseline px-1 py-px rounded-[3px] border border-edge-muted">
+ <span class="inline-flex items-center gap-0.5">
<span
- style={{
- display: 'inline-block',
- width: '10px',
- height: '10px',
- 'border-radius': '2px',
- 'background-color': oklch(a0()),
- border: '1px solid var(--color-edge-muted)',
- }}
+ class="inline-block size-2.5 rounded-xs border border-edge-muted"
+ style={{ 'background-color': oklch(a0()) }}
/>
<span
- style={{
- display: 'inline-block',
- width: '10px',
- height: '10px',
- 'border-radius': '2px',
- 'background-color': oklch(b0()),
- border: '1px solid var(--color-edge-muted)',
- }}
+ class="inline-block size-2.5 rounded-xs border border-edge-muted"
+ style={{ 'background-color': oklch(b0()) }}
/>
<span
- style={{
- display: 'inline-block',
- width: '10px',
- height: '10px',
- 'border-radius': '2px',
- 'background-color': oklch(c0()),
- border: '1px solid var(--color-edge-muted)',
- }}
+ class="inline-block size-2.5 rounded-xs border border-edge-muted"
+ style={{ 'background-color': oklch(c0()) }}
/>
</span>
- <span style={{ 'margin-inline': '2px', cursor: 'default' }}>
- {props.name}
- </span>
+ <span class="mx-0.5 cursor-default">{props.name}</span>
</span>
</span>
);