bolt.diy/app/lib/api/notifications.ts
Stijnus fc3dd8c84c Final UI V3
# UI V3 Changelog

Major updates and improvements in this release:

## Core Changes
- Complete NEW REWRITTEN UI system overhaul (V3) with semantic design tokens
- New settings management system with drag-and-drop capabilities
- Enhanced provider system supporting multiple AI services
- Improved theme system with better dark mode support
- New component library with consistent design patterns

## Technical Updates
- Reorganized project architecture for better maintainability
- Performance optimizations and bundle size improvements
- Enhanced security features and access controls
- Improved developer experience with better tooling
- Comprehensive testing infrastructure

## New Features
- Background rays effect for improved visual feedback
- Advanced tab management system
- Automatic and manual update support
- Enhanced error handling and visualization
- Improved accessibility across all components

For detailed information about all changes and improvements, please see the full changelog.
2025-02-02 01:42:30 +01:00

59 lines
1.6 KiB
TypeScript

import { logStore } from '~/lib/stores/logs';
import type { LogEntry } from '~/lib/stores/logs';
export interface Notification {
id: string;
title: string;
message: string;
type: 'info' | 'warning' | 'error' | 'success';
timestamp: string;
read: boolean;
details?: Record<string, unknown>;
}
export interface LogEntryWithRead extends LogEntry {
read: boolean;
}
export const getNotifications = async (): Promise<Notification[]> => {
// Get notifications from the log store
const logs = Object.values(logStore.logs.get());
return logs
.filter((log) => log.category !== 'system') // Filter out system logs
.map((log) => ({
id: log.id,
title: (log.details?.title as string) || log.message.split('\n')[0],
message: log.message,
type: log.level as 'info' | 'warning' | 'error' | 'success',
timestamp: log.timestamp,
read: logStore.isRead(log.id),
details: log.details,
}))
.sort((a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime());
};
export const markNotificationRead = async (notificationId: string): Promise<void> => {
logStore.markAsRead(notificationId);
};
export const clearNotifications = async (): Promise<void> => {
logStore.clearLogs();
};
export const getUnreadCount = (): number => {
const logs = Object.values(logStore.logs.get()) as LogEntryWithRead[];
return logs.filter((log) => {
if (!logStore.isRead(log.id)) {
if (log.details?.type === 'update') {
return true;
}
return log.level === 'error' || log.level === 'warning';
}
return false;
}).length;
};