notifications big

This commit is contained in:
alma 2026-01-11 22:45:06 +01:00
parent 95fc180d3c
commit f8a4b14a96
2 changed files with 26 additions and 7 deletions

View File

@ -1,6 +1,6 @@
import React, { memo, useState, useEffect } from 'react';
import Link from 'next/link';
import { Bell, Check, ExternalLink, AlertCircle, LogIn, Kanban } from 'lucide-react';
import { Bell, Check, ExternalLink, AlertCircle, LogIn, Kanban, MessageSquare } from 'lucide-react';
import { Badge } from '@/components/ui/badge';
import { useNotifications } from '@/hooks/use-notifications';
import { Button } from '@/components/ui/button';
@ -209,12 +209,20 @@ export const NotificationBadge = memo(function NotificationBadge({ className }:
Agilité
</Badge>
)}
{notification.source === 'rocketchat' && (
<Badge variant="outline" className="ml-2 text-[10px] py-0 px-1.5 bg-blue-50 text-blue-700 border-blue-200 flex items-center">
<MessageSquare className="mr-1 h-2.5 w-2.5" />
Parole
</Badge>
)}
</div>
<p className="text-xs text-muted-foreground">
{formatDistanceToNow(new Date(notification.timestamp), { addSuffix: true })}
{notification.source && (
<span className="ml-1 opacity-75">
{notification.source === 'leantime' ? 'Leantime' : notification.source}
{notification.source === 'leantime' ? 'Leantime' :
notification.source === 'rocketchat' ? 'Parole' :
notification.source}
</span>
)}
</p>

View File

@ -454,22 +454,33 @@ export class RocketChatAdapter implements NotificationAdapter {
if (subscription.t === 'd') roomTypePath = 'direct';
else if (subscription.t === 'p') roomTypePath = 'group';
// Format title similar to Leantime (simple and consistent)
const title = subscription.t === 'd'
? 'Message'
: subscription.t === 'p'
? 'Message de groupe'
: 'Message de canal';
// Format message with sender and room info
const senderName = messageUser.name || messageUser.username || 'Utilisateur';
const formattedMessage = subscription.t === 'd'
? `${senderName}: ${latestMessage.msg || ''}`
: `${senderName} dans ${roomName}: ${latestMessage.msg || ''}`;
const notification: Notification = {
id: `rocketchat-${latestMessage._id}`,
source: 'rocketchat',
sourceId: latestMessage._id,
type: 'message',
title: subscription.t === 'd'
? `Message de ${messageUser.name || messageUser.username || 'Utilisateur'}`
: `${messageUser.name || messageUser.username || 'Utilisateur'} dans ${roomName}`,
message: latestMessage.msg || '',
title: title,
message: formattedMessage,
link: `${this.baseUrl}/${roomTypePath}/${subscription.name}`,
isRead: false, // All messages here are unread
timestamp: new Date(latestMessage.ts),
priority: subscription.alert ? 'high' : 'normal',
user: {
id: messageUser._id || '',
name: messageUser.name || messageUser.username || 'Utilisateur',
name: senderName,
},
metadata: {
roomId: subscription.rid,