feat: add event configuration for chat, mail, API, and webhooks#88
feat: add event configuration for chat, mail, API, and webhooks#88felix-schultz merged 2 commits intodevfrom
Conversation
- Introduced EVENT_CONFIG to manage event mappings for chat, mail, API, and simple actions. - Created configuration interfaces for SimpleChat, UserMail, API, and Webhook. - Updated ChatInterface to support memoization and improved loading states for messages. - Enhanced event form to handle dynamic event types and configurations based on selected nodes. - Refactored interfaces to include new configuration props and types for better type safety.
|
Here's the code health analysis summary for commits Analysis Summary
|
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a centralized EVENT_CONFIG for mapping event types to their configuration and interface components, updates the event form to dynamically set event types and configs based on node selection, and refactors chat and UI components to support loading states, memoization, and improved type safety.
- Added
IEventMappinginterfaces and config components for chat, mail, API, and webhooks - Enhanced
EventFormto accepteventConfig, set default event type/config on node select - Refactored
ChatInterfaceandMessageComponentto handle loading states and memoization
Reviewed Changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/ui/components/ui/event-form.tsx | Added eventConfig prop, auto-assign event_type & config on node change |
| packages/ui/components/interfaces/interfaces.tsx | Expanded interfaces with IEventMapping, IUseInterfaceProps, etc. |
| packages/ui/components/interfaces/index.ts | Exported new config and mapping types and config components |
| packages/ui/components/interfaces/configs/* | New config UIs: WebhookConfig, UserMailConfig, SimpleChatConfig, ApiConfig, EventTypeConfiguration, EventTranslation |
| packages/ui/components/interfaces/chat-default/message.tsx | Renamed noToolbar to loading, updated toolbar toggle & markdown placeholder |
| packages/ui/components/interfaces/chat-default/chat.tsx | Passed loading flag to MessageComponent for pending messages |
| packages/ui/components/interfaces/chat-default.tsx | Memoized ChatInterface, split wrapper and memoized component |
| apps/desktop/lib/event-config.ts | Defined EVENT_CONFIG with mappings for all event groups |
| apps/desktop/app/use/page.tsx | Switched from static USABLE_EVENTS to dynamic EVENT_CONFIG lookup |
| apps/desktop/app/library/config/layout.tsx | Replaced USABLE_EVENTS with EVENT_CONFIG for quick actions |
| apps/desktop/app/library/config/events/page.tsx | Wired eventConfig into EventForm, EventTypeConfiguration, EventTranslation |
| import { | ||
| convertJsonToUint8Array, | ||
| parseUint8ArrayToJson, | ||
| } from "../../lib/uint8"; |
There was a problem hiding this comment.
The imported parseUint8ArrayToJson is not used in this file—consider removing it to avoid dead code.
| import { | |
| convertJsonToUint8Array, | |
| parseUint8ArrayToJson, | |
| } from "../../lib/uint8"; | |
| import { convertJsonToUint8Array } from "../../lib/uint8"; |
| board_version: undefined, | ||
| node_id: event?.node_id || "", | ||
| board_id: event?.board_id || "", | ||
| event_type: undefined, |
There was a problem hiding this comment.
When editing an existing event, event_type should be initialized from event?.event_type instead of undefined, so the form stays in sync with the loaded data.
| event_type: undefined, | |
| event_type: event?.event_type || undefined, |
| }, | ||
| useInterfaces: {}, | ||
| }, | ||
| events_simple: { |
There was a problem hiding this comment.
The configs map for events_simple is empty but defaultEventType is "quick_action"; add a quick_action entry (and any others in eventTypes) so defaults resolve reliably.
closes #87