notifications big
This commit is contained in:
parent
cc1bab76c7
commit
8285eeb9ec
@ -198,33 +198,35 @@ export const NotificationBadge = memo(function NotificationBadge({ className }:
|
||||
<div className="w-full">
|
||||
<div className="flex items-start justify-between">
|
||||
<div className="max-w-[90%]">
|
||||
<div className="text-sm font-medium">
|
||||
{notification.title}
|
||||
<div className="flex items-center gap-2 flex-wrap">
|
||||
<span className="text-sm font-medium">
|
||||
{notification.title}
|
||||
</span>
|
||||
{!notification.isRead && (
|
||||
<Badge variant="secondary" className="ml-2 bg-blue-500 text-white">New</Badge>
|
||||
<Badge variant="secondary" className="bg-blue-500 text-white">New</Badge>
|
||||
)}
|
||||
{notification.source === 'leantime' && (
|
||||
<Badge variant="outline" className="ml-2 text-[10px] py-0 px-1.5 bg-amber-50 text-amber-700 border-amber-200 flex items-center">
|
||||
<Badge variant="outline" className="text-[10px] py-0 px-1.5 bg-amber-50 text-amber-700 border-amber-200 flex items-center">
|
||||
<Kanban className="mr-1 h-2.5 w-2.5" />
|
||||
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">
|
||||
<Badge variant="outline" className="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>
|
||||
)}
|
||||
{notification.source === 'email' && (
|
||||
<Badge variant="outline" className="ml-2 text-[10px] py-0 px-1.5 bg-green-50 text-green-700 border-green-200 flex items-center">
|
||||
<Badge variant="outline" className="text-[10px] py-0 px-1.5 bg-green-50 text-green-700 border-green-200 flex items-center">
|
||||
<Mail className="mr-1 h-2.5 w-2.5" />
|
||||
Courrier
|
||||
</Badge>
|
||||
)}
|
||||
<span className="text-xs text-muted-foreground">
|
||||
{formatDistanceToNow(new Date(notification.timestamp), { addSuffix: true })}
|
||||
</span>
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{formatDistanceToNow(new Date(notification.timestamp), { addSuffix: true })}
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex space-x-1 ml-2">
|
||||
{!notification.isRead && (
|
||||
@ -239,7 +241,7 @@ export const NotificationBadge = memo(function NotificationBadge({ className }:
|
||||
</Button>
|
||||
)}
|
||||
{notification.link && (
|
||||
<Link href={notification.link} target="_blank">
|
||||
<Link href={notification.link}>
|
||||
<Button variant="ghost" size="sm" className="h-6 w-6 p-0">
|
||||
<ExternalLink className="h-3.5 w-3.5" />
|
||||
<span className="sr-only">Open</span>
|
||||
|
||||
@ -661,6 +661,13 @@ export class LeantimeAdapter implements NotificationAdapter {
|
||||
const date = notification.date || notification.datetime || notification.createdDate || new Date().toISOString();
|
||||
const url = notification.url || notification.link || '';
|
||||
|
||||
// Convert external Leantime URL to hub.slm-lab.net/agilite
|
||||
let link = url.startsWith('http') ? url : `${this.apiUrl}${url.startsWith('/') ? '' : '/'}${url}`;
|
||||
// Replace external Leantime URL with hub.slm-lab.net/agilite
|
||||
if (link.includes('agilite.slm-lab.net') || link.includes(this.apiUrl)) {
|
||||
link = '/agilite';
|
||||
}
|
||||
|
||||
return {
|
||||
id: `${this.sourceName}-${id}`,
|
||||
source: this.sourceName as 'leantime',
|
||||
@ -668,7 +675,7 @@ export class LeantimeAdapter implements NotificationAdapter {
|
||||
type: type,
|
||||
title: type, // Use type as title if no specific title field
|
||||
message: message,
|
||||
link: url.startsWith('http') ? url : `${this.apiUrl}${url.startsWith('/') ? '' : '/'}${url}`,
|
||||
link: link,
|
||||
isRead: read === 1 || read === true,
|
||||
timestamp: new Date(date),
|
||||
priority: 'normal',
|
||||
|
||||
@ -467,6 +467,7 @@ export class RocketChatAdapter implements NotificationAdapter {
|
||||
? `${senderName}: ${latestMessage.msg || ''}`
|
||||
: `${senderName} dans ${roomName}: ${latestMessage.msg || ''}`;
|
||||
|
||||
// Link to hub.slm-lab.net/parole instead of external RocketChat URL
|
||||
const notification: Notification = {
|
||||
id: `rocketchat-${latestMessage._id}`,
|
||||
source: 'rocketchat',
|
||||
@ -474,7 +475,7 @@ export class RocketChatAdapter implements NotificationAdapter {
|
||||
type: 'message',
|
||||
title: title,
|
||||
message: formattedMessage,
|
||||
link: `${this.baseUrl}/${roomTypePath}/${subscription.name}`,
|
||||
link: `/parole`,
|
||||
isRead: false, // All messages here are unread
|
||||
timestamp: new Date(latestMessage.ts),
|
||||
priority: subscription.alert ? 'high' : 'normal',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user