diff --git a/GPTutor-Frontend/src/components/Messenger/MessengerList/Message/Message.tsx b/GPTutor-Frontend/src/components/Messenger/MessengerList/Message/Message.tsx
index fa77bc3e..23afc1d0 100644
--- a/GPTutor-Frontend/src/components/Messenger/MessengerList/Message/Message.tsx
+++ b/GPTutor-Frontend/src/components/Messenger/MessengerList/Message/Message.tsx
@@ -8,7 +8,7 @@ import {
Text,
Title,
} from "@vkontakte/vkui";
-import { Icon24CheckCircleOutline } from "@vkontakte/icons";
+import { Icon24CheckCircleOutline, Icon24Share } from "@vkontakte/icons";
import { GptMessage } from "$/entity/GPT";
@@ -23,6 +23,7 @@ import classes from "./Message.module.css";
import { Copy } from "$/components/Copy";
import { ChatGptTemplate } from "$/entity/GPT/ChatGptTemplate";
import { appService } from "$/services/AppService";
+import { shareService } from "$/services/ShareService";
interface IProps {
chatGpt: ChatGptTemplate;
@@ -45,6 +46,15 @@ function Message({ chatGpt, message }: IProps) {
message.toggleSelected();
};
+ const onForwardMessage = (e: any) => {
+ e.stopPropagation();
+ const senderName = message.role === "assistant"
+ ? appService.getGPTName()
+ : vkUser?.first_name || "Пользователь";
+
+ shareService.forwardMessage(message.content$.get(), senderName);
+ };
+
return (
)}
+
+
+
{
+ console.log("Message forwarded successfully:", data);
+ return data;
+ })
+ .catch((error) => {
+ console.error("Error forwarding message:", error);
+ throw error;
+ });
+ }
}
export const shareService = new ShareService();
diff --git a/examples/test-forward-functionality.md b/examples/test-forward-functionality.md
new file mode 100644
index 00000000..cf70e1a5
--- /dev/null
+++ b/examples/test-forward-functionality.md
@@ -0,0 +1,45 @@
+# Testing Message Forwarding Functionality
+
+## Changes Made
+
+1. **ShareService.ts** - Added `forwardMessage` method
+ - Takes message content and sender name
+ - Creates formatted message with source attribution
+ - Uses VK Bridge to show wall post box
+ - Returns promise for proper error handling
+
+2. **Message.tsx** - Added forward button
+ - Added `Icon24Share` import from VK icons
+ - Added `shareService` import
+ - Created `onForwardMessage` handler
+ - Added IconButton with share icon in the icons block
+
+## Expected Behavior
+
+When user clicks the forward (share) icon on any message:
+1. The `onForwardMessage` handler is triggered
+2. It extracts the sender name (GPT name for assistant or user's first name)
+3. Creates formatted forwarding text including:
+ - Original sender identification
+ - Complete message content
+ - Attribution to GPTutor app
+4. Opens VK wall post box with the formatted message
+5. User can share to their wall or send to friends
+
+## Integration Points
+
+- Uses existing VK Bridge integration
+- Follows existing UI patterns (same icon styling as copy/select buttons)
+- Maintains existing message structure and styling
+- Compatible with existing message selection system
+
+## Files Modified
+
+- `/src/services/ShareService.ts` - Added forwardMessage method
+- `/src/components/Messenger/MessengerList/Message/Message.tsx` - Added forward button and handler
+
+## Russian Context
+
+The forwarding message is formatted in Russian:
+- "Сообщение от [Sender Name]:" - "Message from [Sender Name]:"
+- "Передано через GPTutor:" - "Forwarded via GPTutor:"
\ No newline at end of file