From c3e4521cc89dd448eaf35bc2a6e7a8d583299c24 Mon Sep 17 00:00:00 2001 From: iliya Date: Mon, 23 Feb 2026 20:02:58 +0200 Subject: [PATCH] refactor: update IPC channel constants and improve markdown plugin usage - Replaced local IPC channel constants in `index.ts` with imports from `@preload/constants/ipcChannels` for better consistency. - Simplified the `leadRelayCapture` assignment in `TeamProvisioningService`. - Updated markdown plugin imports across multiple components to use the new `REHYPE_PLUGINS` constant. - Enhanced task status display logic in `TaskRow` for improved clarity. - Adjusted CSS for better syntax highlighting in the editor. --- src/main/index.ts | 12 +++++++----- src/main/services/team/TeamProvisioningService.ts | 4 +--- src/renderer/components/chat/CompactBoundary.tsx | 4 ++-- src/renderer/components/chat/LastOutputDisplay.tsx | 6 +++--- src/renderer/components/chat/UserChatGroup.tsx | 4 ++-- .../components/chat/viewers/MarkdownViewer.tsx | 6 +++--- src/renderer/components/common/UpdateDialog.tsx | 4 ++-- src/renderer/components/sidebar/SidebarTaskItem.tsx | 4 ++-- src/renderer/components/sidebar/taskFiltersState.ts | 2 +- src/renderer/components/team/members/MemberCard.tsx | 3 ++- src/renderer/components/team/tasks/TaskRow.tsx | 6 +++++- src/renderer/index.css | 6 ++++-- src/renderer/utils/markdownPlugins.ts | 2 +- src/renderer/utils/taskGrouping.ts | 2 +- 14 files changed, 36 insertions(+), 29 deletions(-) diff --git a/src/main/index.ts b/src/main/index.ts index 2640f5ed..11c57484 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -9,6 +9,13 @@ * - Manage application lifecycle */ +import { + CONTEXT_CHANGED, + SSH_STATUS, + TEAM_CHANGE, + WINDOW_FULLSCREEN_CHANGED, + // eslint-disable-next-line boundaries/element-types -- IPC channel constants shared between main and preload +} from '@preload/constants/ipcChannels'; import { DEFAULT_WINDOW_HEIGHT, DEFAULT_WINDOW_WIDTH, @@ -21,11 +28,6 @@ import { app, BrowserWindow } from 'electron'; import { existsSync } from 'fs'; import { join } from 'path'; -const CONTEXT_CHANGED = 'context:changed'; -const SSH_STATUS = 'ssh:status'; -const TEAM_CHANGE = 'team:change'; -const WINDOW_FULLSCREEN_CHANGED = 'window:fullscreen-changed'; - import { initializeIpcHandlers, removeIpcHandlers } from './ipc/handlers'; import { HttpServer } from './services/infrastructure/HttpServer'; import { getProjectsBasePath, getTodosBasePath } from './utils/pathDecoder'; diff --git a/src/main/services/team/TeamProvisioningService.ts b/src/main/services/team/TeamProvisioningService.ts index a3847323..6932a43e 100644 --- a/src/main/services/team/TeamProvisioningService.ts +++ b/src/main/services/team/TeamProvisioningService.ts @@ -1272,9 +1272,7 @@ export class TeamProvisioningService { reject(new Error(error)); }, }; - run.leadRelayCapture = { - ...capture, - }; + run.leadRelayCapture = capture; }); try { diff --git a/src/renderer/components/chat/CompactBoundary.tsx b/src/renderer/components/chat/CompactBoundary.tsx index 20617195..8fb8d4b8 100644 --- a/src/renderer/components/chat/CompactBoundary.tsx +++ b/src/renderer/components/chat/CompactBoundary.tsx @@ -10,7 +10,7 @@ import { TOOL_CALL_BORDER, TOOL_CALL_TEXT, } from '@renderer/constants/cssVariables'; -import { rehypePlugins } from '@renderer/utils/markdownPlugins'; +import { REHYPE_PLUGINS } from '@renderer/utils/markdownPlugins'; import { formatTokensCompact as formatTokens } from '@shared/utils/tokenFormatting'; import { format } from 'date-fns'; import { ChevronRight, Layers } from 'lucide-react'; @@ -149,7 +149,7 @@ export const CompactBoundary = ({ {compactContent ? ( {compactContent} diff --git a/src/renderer/components/chat/LastOutputDisplay.tsx b/src/renderer/components/chat/LastOutputDisplay.tsx index ede3dcbc..d4b25355 100644 --- a/src/renderer/components/chat/LastOutputDisplay.tsx +++ b/src/renderer/components/chat/LastOutputDisplay.tsx @@ -2,7 +2,7 @@ import React from 'react'; import ReactMarkdown from 'react-markdown'; import { useStore } from '@renderer/store'; -import { rehypePlugins } from '@renderer/utils/markdownPlugins'; +import { REHYPE_PLUGINS } from '@renderer/utils/markdownPlugins'; import { AlertTriangle, CheckCircle, FileCheck, XCircle } from 'lucide-react'; import remarkGfm from 'remark-gfm'; import { useShallow } from 'zustand/react/shallow'; @@ -91,7 +91,7 @@ export const LastOutputDisplay = ({
{textContent} @@ -238,7 +238,7 @@ export const LastOutputDisplay = ({
{planContent} diff --git a/src/renderer/components/chat/UserChatGroup.tsx b/src/renderer/components/chat/UserChatGroup.tsx index 4a16841e..cb53fe44 100644 --- a/src/renderer/components/chat/UserChatGroup.tsx +++ b/src/renderer/components/chat/UserChatGroup.tsx @@ -4,7 +4,7 @@ import ReactMarkdown, { type Components } from 'react-markdown'; import { api } from '@renderer/api'; import { useTabUI } from '@renderer/hooks/useTabUI'; import { useStore } from '@renderer/store'; -import { rehypePlugins } from '@renderer/utils/markdownPlugins'; +import { REHYPE_PLUGINS } from '@renderer/utils/markdownPlugins'; import { createLogger } from '@shared/utils/logger'; import { format } from 'date-fns'; import { User } from 'lucide-react'; @@ -448,7 +448,7 @@ const UserChatGroupInner = ({ userGroup }: Readonly): React.
{displayText} diff --git a/src/renderer/components/chat/viewers/MarkdownViewer.tsx b/src/renderer/components/chat/viewers/MarkdownViewer.tsx index f8730c96..f14d44a9 100644 --- a/src/renderer/components/chat/viewers/MarkdownViewer.tsx +++ b/src/renderer/components/chat/viewers/MarkdownViewer.tsx @@ -23,7 +23,7 @@ import { PROSE_TABLE_HEADER_BG, } from '@renderer/constants/cssVariables'; import { useStore } from '@renderer/store'; -import { rehypePlugins } from '@renderer/utils/markdownPlugins'; +import { REHYPE_PLUGINS } from '@renderer/utils/markdownPlugins'; import { FileText } from 'lucide-react'; import remarkGfm from 'remark-gfm'; import { useShallow } from 'zustand/react/shallow'; @@ -157,7 +157,7 @@ function createViewerMarkdownComponents(searchCtx: SearchContext | null): Compon if (isBlock) { return ( {hl(children)} @@ -336,7 +336,7 @@ export const MarkdownViewer: React.FC = ({
{content} diff --git a/src/renderer/components/common/UpdateDialog.tsx b/src/renderer/components/common/UpdateDialog.tsx index be83c21d..3f8312ab 100644 --- a/src/renderer/components/common/UpdateDialog.tsx +++ b/src/renderer/components/common/UpdateDialog.tsx @@ -10,7 +10,7 @@ import ReactMarkdown from 'react-markdown'; import { markdownComponents } from '@renderer/components/chat/markdownComponents'; import { useStore } from '@renderer/store'; -import { rehypePlugins } from '@renderer/utils/markdownPlugins'; +import { REHYPE_PLUGINS } from '@renderer/utils/markdownPlugins'; import { X } from 'lucide-react'; import remarkGfm from 'remark-gfm'; @@ -153,7 +153,7 @@ export const UpdateDialog = (): React.JSX.Element | null => { > {normalizeReleaseNotes(releaseNotes)} diff --git a/src/renderer/components/sidebar/SidebarTaskItem.tsx b/src/renderer/components/sidebar/SidebarTaskItem.tsx index 8655749e..2ecd4e5c 100644 --- a/src/renderer/components/sidebar/SidebarTaskItem.tsx +++ b/src/renderer/components/sidebar/SidebarTaskItem.tsx @@ -32,9 +32,9 @@ export const SidebarTaskItem = ({ task }: SidebarTaskItemProps): React.JSX.Eleme const unreadCount = useUnreadCommentCount(task.teamName, task.id, task.comments); const cfg = task.kanbanColumn === 'approved' - ? ({ icon: ShieldCheck, color: 'text-emerald-400', label: 'approved' } as const) + ? ({ icon: ShieldCheck, color: 'text-teal-400', label: 'approved' } as const) : task.kanbanColumn === 'review' - ? ({ icon: Eye, color: 'text-amber-400', label: 'in review' } as const) + ? ({ icon: Eye, color: 'text-orange-400', label: 'in review' } as const) : (statusConfig[task.status] ?? statusConfig.pending); const StatusIcon = cfg.icon; const dateLabel = formatTaskDate(task.createdAt); diff --git a/src/renderer/components/sidebar/taskFiltersState.ts b/src/renderer/components/sidebar/taskFiltersState.ts index 03f69d8e..3ef596fd 100644 --- a/src/renderer/components/sidebar/taskFiltersState.ts +++ b/src/renderer/components/sidebar/taskFiltersState.ts @@ -29,7 +29,7 @@ export function taskMatchesStatus( statusIds: Set ): boolean { if (statusIds.size === 0) return false; - if (statusIds.size === STATUS_OPTIONS.length) return true; + if (statusIds.size === STATUS_OPTIONS.length) return task.status !== 'deleted'; const inTodo = task.status === 'pending' && !task.kanbanColumn; const inProgress = task.status === 'in_progress' && !task.kanbanColumn; diff --git a/src/renderer/components/team/members/MemberCard.tsx b/src/renderer/components/team/members/MemberCard.tsx index 3b50ed62..48876d9f 100644 --- a/src/renderer/components/team/members/MemberCard.tsx +++ b/src/renderer/components/team/members/MemberCard.tsx @@ -100,8 +100,9 @@ export const MemberCard = ({ }} onKeyDown={(e) => { if (e.key === 'Enter' || e.key === ' ' || e.key === 'Spacebar') { - e.stopPropagation(); e.preventDefault(); + e.stopPropagation(); + onOpenTask?.(); } }} > diff --git a/src/renderer/components/team/tasks/TaskRow.tsx b/src/renderer/components/team/tasks/TaskRow.tsx index 37aaf7c3..2fbb7b7e 100644 --- a/src/renderer/components/team/tasks/TaskRow.tsx +++ b/src/renderer/components/team/tasks/TaskRow.tsx @@ -1,3 +1,5 @@ +import { KANBAN_COLUMN_DISPLAY, TASK_STATUS_LABELS } from '@renderer/utils/memberHelpers'; + import type { TeamTaskWithKanban } from '@shared/types'; interface TaskRowProps { @@ -14,7 +16,9 @@ export const TaskRow = ({ task }: TaskRowProps): React.JSX.Element => { {task.subject} {task.owner ?? '\u2014'} - {task.kanbanColumn ?? task.status} + {task.kanbanColumn && task.kanbanColumn in KANBAN_COLUMN_DISPLAY + ? KANBAN_COLUMN_DISPLAY[task.kanbanColumn].label + : (TASK_STATUS_LABELS[task.status] ?? task.status)} {blockedByIds.length > 0 ? ( diff --git a/src/renderer/index.css b/src/renderer/index.css index c2156d05..bbc0d816 100644 --- a/src/renderer/index.css +++ b/src/renderer/index.css @@ -389,10 +389,12 @@ background: transparent; } .hljs-keyword, -.hljs-selector-tag, -.hljs-addition { +.hljs-selector-tag { color: var(--syntax-keyword); } +.hljs-addition { + color: var(--diff-added-text); +} .hljs-string, .hljs-doctag { color: var(--syntax-string); diff --git a/src/renderer/utils/markdownPlugins.ts b/src/renderer/utils/markdownPlugins.ts index 4e05d5e7..74fda2c5 100644 --- a/src/renderer/utils/markdownPlugins.ts +++ b/src/renderer/utils/markdownPlugins.ts @@ -5,4 +5,4 @@ import rehypeHighlight from 'rehype-highlight'; -export const rehypePlugins = [rehypeHighlight]; +export const REHYPE_PLUGINS = [rehypeHighlight]; diff --git a/src/renderer/utils/taskGrouping.ts b/src/renderer/utils/taskGrouping.ts index c639c1ce..111726cc 100644 --- a/src/renderer/utils/taskGrouping.ts +++ b/src/renderer/utils/taskGrouping.ts @@ -77,7 +77,7 @@ export function groupTasksByProject(tasks: GlobalTask[]): ProjectTaskGroup[] { for (const task of tasks) { const path = task.projectPath?.trim() ?? ''; - const key = path ? normalizePath(path) : NO_PROJECT_KEY; + const key = path ? normalizePath(trimTrailingPathSep(path)) : NO_PROJECT_KEY; let entry = byKey.get(key); if (!entry) { entry = { path: path || '', tasks: [] };