diff --git a/src/app/(agent)/agent/notifications/page.tsx b/src/app/(agent)/agent/notifications/page.tsx index 65bf5cb..c34cd50 100644 --- a/src/app/(agent)/agent/notifications/page.tsx +++ b/src/app/(agent)/agent/notifications/page.tsx @@ -5,6 +5,17 @@ import Image from 'next/image'; import Link from 'next/link'; import { notificationsApiService, type AppNotification } from '@/services/notifications-api.service'; +function formatDescription(description: string): string { + const trimmed = description.trim(); + if (trimmed.startsWith('http://') || trimmed.startsWith('https://')) { + const lower = trimmed.toLowerCase(); + if (lower.includes('.gif')) return 'Sent a GIF'; + if (lower.includes('.png') || lower.includes('.jpg') || lower.includes('.jpeg') || lower.includes('.webp')) return 'Sent an image'; + return 'Sent a link'; + } + return description; +} + function getNotificationIcon(type: AppNotification['type']) { switch (type) { case 'connection': @@ -221,7 +232,7 @@ export default function AgentNotificationsPage() { {notification.title}

- {notification.description} + {formatDescription(notification.description)}

diff --git a/src/app/(user)/user/notifications/page.tsx b/src/app/(user)/user/notifications/page.tsx index ed92f7d..5b6a139 100644 --- a/src/app/(user)/user/notifications/page.tsx +++ b/src/app/(user)/user/notifications/page.tsx @@ -5,6 +5,17 @@ import Image from 'next/image'; import Link from 'next/link'; import { notificationsApiService, type AppNotification } from '@/services/notifications-api.service'; +function formatDescription(description: string): string { + const trimmed = description.trim(); + if (trimmed.startsWith('http://') || trimmed.startsWith('https://')) { + const lower = trimmed.toLowerCase(); + if (lower.includes('.gif')) return 'Sent a GIF'; + if (lower.includes('.png') || lower.includes('.jpg') || lower.includes('.jpeg') || lower.includes('.webp')) return 'Sent an image'; + return 'Sent a link'; + } + return description; +} + function getNotificationIcon(type: AppNotification['type']) { switch (type) { case 'connection': @@ -213,7 +224,7 @@ export default function UserNotificationsPage() { {notification.title}

- {notification.description} + {formatDescription(notification.description)}