Implement Message Content Copy to Clipboard #148
Labels
No labels
Epic 5
MCP
P1
PR-0
PR-1
api
api-layer
architecture
area:backend
area:frontend
arrow
authentication
backend
bug
chat
client
clipboard
common-module
compose
cross-cutting
cross-cutting-requirement
data-layer
data-models
database
desktop-client
documentation
duplicate
enhancement
epic
epic-1
epic-2
epic-3
epic-4
epic-5
epic-6
epic-7
epic-llm-config
error-handling
feature
frontend
good first issue
help wanted
implementation
infrastructure
installer
invalid
kotlin
ktor
llm
medium-priority
message
multiplatform
needs-review
needs-triage
packaging
performance
phase-1
phase-2
phase-3
phase-4
phase-5
phase3
phase:3
priority: high
question
refactor
refactoring
resource-sharing
security
server
server-module
services
session
session-management
settings
setup
shutdown
state
storage
streaming
sub-issue
tests
tooling
type:task
ui
ui/ux
user-accounts
user-management
ux
viewmodel
websocket
windows
windows-integration
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Torvian.eu/chatbot#148
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Overview
Wire up the existing "Copy" button in the message actions menu to actually copy message content to the clipboard. This requires creating a custom
ClipboardServicewith platform-specific implementations and extending the notification system to show success messages.Implementation Plan
1. Extend Notification System
GenericAppSuccessevent class inapp/src/commonMain/kotlin/eu/torvian/chatbot/app/domain/events/GenericAppSuccess.ktextendingAppSuccess, following the same pattern asGenericAppWarningErrorNotifiertoNotificationServiceinapp/src/commonMain/kotlin/eu/torvian/chatbot/app/viewmodel/common/ErrorNotifier.ktgenericSuccess(shortMessage: String)method that emitsGenericAppSuccessevents viaEventBusErrorNotifierthroughout the codebase (Koin modules, ViewModels, repositories) to use the newNotificationServicename2. Create ClipboardService
ClipboardServiceinterface inapp/src/commonMain/kotlin/eu/torvian/chatbot/app/service/clipboard/ClipboardService.ktwith asuspend fun copyToClipboard(text: String)methodClipboardServiceDesktop.ktindesktopMainusingjava.awt.Toolkit.getDefaultToolkit().systemClipboardClipboardServiceAndroid.ktinandroidMainusing Android'sClipboardManagerClipboardServiceWasmJs.ktinwasmJsMainusing browser'snavigator.clipboard.writeText3. Register in Koin DI
ClipboardServicein Koin DI modules usingexpect/actualpattern inapp/src/commonMain/kotlin/eu/torvian/chatbot/app/koin/ServiceModule.ktand corresponding platform-specific modules4. Wire to ViewModel
copyMessageToClipboard(message: ChatMessage)method toChatViewModelClipboardServiceandNotificationServiceinto the ViewModelclipboardService.copyToClipboard(message.content)with try-catch for error handling5. Connect UI
chatViewModel::copyMessageToClipboardtoChatAreaActions.onCopyMessagein the anonymous object implementation around line 183 ofChatScreen.ktChatArea.ktline 135 to pass the action instead ofnullto enable the Copy buttonNotes
Related Files
MessageActionRow.kt- Contains the existing Copy button UIMessageActions.kt- Contains the action data class withonCopyMessagecallbackChatArea.kt- Currently passesnullforonCopyMessage(line 135)ChatScreen.kt- Where actions are wired to the ViewModel