mirror of
https://github.com/stackblitz-labs/bolt.diy
synced 2025-06-26 18:26:38 +00:00
fixes
This commit is contained in:
parent
6d98affc3d
commit
a94330e4a4
189
app/components/settings/CHANGELOG.md
Normal file
189
app/components/settings/CHANGELOG.md
Normal file
@ -0,0 +1,189 @@
|
|||||||
|
# Settings Components Changelog
|
||||||
|
|
||||||
|
All notable changes to the settings components will be documented in this file.
|
||||||
|
|
||||||
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- New Settings Dashboard with improved UI/UX
|
||||||
|
- Tab management system with drag-and-drop reordering
|
||||||
|
- Enhanced developer tools window
|
||||||
|
- Bulk update functionality for Ollama models
|
||||||
|
- System performance monitoring in Debug tab
|
||||||
|
- Data import/export functionality
|
||||||
|
- Enhanced event logging system
|
||||||
|
- Profile customization options
|
||||||
|
- Auto energy saver mode in TaskManager
|
||||||
|
- Energy savings tracking and statistics
|
||||||
|
- Persistent settings storage using localStorage
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Removed green status indicators from TaskManagerTab for cleaner UI
|
||||||
|
- Changed connection status indicators to use neutral colors
|
||||||
|
- Updated energy saver mode indicator to use neutral colors
|
||||||
|
- Simplified process status display in TaskManager
|
||||||
|
- Improved tab organization with window-specific grouping
|
||||||
|
- Enhanced settings persistence with better localStorage handling
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Status indicator consistency across dark/light themes
|
||||||
|
- Process status updates during energy saver mode
|
||||||
|
- UI rendering issues in dark mode
|
||||||
|
- Tab visibility state management
|
||||||
|
- Settings import/export reliability
|
||||||
|
|
||||||
|
## [1.0.0] - Initial Release
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
#### User Window Components
|
||||||
|
|
||||||
|
- **Profile Tab**
|
||||||
|
|
||||||
|
- User profile and account settings management
|
||||||
|
- Avatar customization
|
||||||
|
- Account preferences
|
||||||
|
|
||||||
|
- **Settings Tab**
|
||||||
|
|
||||||
|
- Application preferences configuration
|
||||||
|
- UI behavior customization
|
||||||
|
- General settings management
|
||||||
|
|
||||||
|
- **Notifications Tab**
|
||||||
|
|
||||||
|
- Real-time notification center
|
||||||
|
- Unread notification tracking
|
||||||
|
- Notification preferences
|
||||||
|
- Support for different notification types
|
||||||
|
- Integration with logStore
|
||||||
|
|
||||||
|
- **Cloud Providers Tab**
|
||||||
|
|
||||||
|
- Cloud-based AI provider configuration
|
||||||
|
- API key management
|
||||||
|
- Cloud model selection
|
||||||
|
- Provider-specific settings
|
||||||
|
- Status monitoring
|
||||||
|
|
||||||
|
- **Local Providers Tab**
|
||||||
|
|
||||||
|
- Local AI model management
|
||||||
|
- Ollama integration and model updates
|
||||||
|
- LM Studio configuration
|
||||||
|
- Local inference settings
|
||||||
|
- Model download and updates
|
||||||
|
|
||||||
|
- **Task Manager Tab**
|
||||||
|
|
||||||
|
- System resource monitoring
|
||||||
|
- Process management
|
||||||
|
- Performance metrics and graphs
|
||||||
|
- Battery status monitoring
|
||||||
|
- Energy saving features
|
||||||
|
- Alert configurations
|
||||||
|
|
||||||
|
- **Connections Tab**
|
||||||
|
|
||||||
|
- Network status monitoring
|
||||||
|
- GitHub integration
|
||||||
|
- Connection health metrics
|
||||||
|
- Secure token storage
|
||||||
|
- Auto-reconnect settings
|
||||||
|
|
||||||
|
- **Debug Tab**
|
||||||
|
|
||||||
|
- System diagnostics
|
||||||
|
- Performance monitoring
|
||||||
|
- Error tracking
|
||||||
|
- Provider status checks
|
||||||
|
|
||||||
|
- **Event Logs Tab**
|
||||||
|
|
||||||
|
- Comprehensive system logs
|
||||||
|
- Filtered log views
|
||||||
|
- Log management tools
|
||||||
|
- Error tracking
|
||||||
|
- Performance metrics
|
||||||
|
|
||||||
|
- **Update Tab**
|
||||||
|
- Version management
|
||||||
|
- Update notifications
|
||||||
|
- Release notes
|
||||||
|
- Auto-update configuration
|
||||||
|
|
||||||
|
### Technical Enhancements
|
||||||
|
|
||||||
|
#### State Management
|
||||||
|
|
||||||
|
- Implemented Nano Stores for efficient state handling
|
||||||
|
- Added persistent settings storage
|
||||||
|
- Real-time state synchronization
|
||||||
|
- Provider state management
|
||||||
|
|
||||||
|
#### Performance
|
||||||
|
|
||||||
|
- Lazy loading of tab contents
|
||||||
|
- Efficient DOM updates
|
||||||
|
- Optimized animations
|
||||||
|
- Resource monitoring
|
||||||
|
|
||||||
|
#### Accessibility
|
||||||
|
|
||||||
|
- Keyboard navigation support
|
||||||
|
- Screen reader compatibility
|
||||||
|
- Focus management
|
||||||
|
- ARIA attributes implementation
|
||||||
|
|
||||||
|
#### UI/UX Features
|
||||||
|
|
||||||
|
- Drag & Drop tab management
|
||||||
|
- Dynamic status updates
|
||||||
|
- Responsive design with Framer Motion
|
||||||
|
- Dark/Light mode support
|
||||||
|
- Enhanced provider management
|
||||||
|
- Resource monitoring dashboard
|
||||||
|
|
||||||
|
### Dependencies
|
||||||
|
|
||||||
|
- Radix UI for accessible components
|
||||||
|
- Framer Motion for animations
|
||||||
|
- React DnD for drag and drop
|
||||||
|
- Nano Stores for state management
|
||||||
|
|
||||||
|
## Future Plans
|
||||||
|
|
||||||
|
- Additional customization options
|
||||||
|
- Enhanced theme support
|
||||||
|
- Extended API integrations
|
||||||
|
- Advanced monitoring capabilities
|
||||||
|
- Custom provider plugins
|
||||||
|
- Enhanced resource management
|
||||||
|
- Advanced debugging features
|
||||||
|
|
||||||
|
## Historical Changes
|
||||||
|
|
||||||
|
### Task Manager
|
||||||
|
|
||||||
|
- Added real-time system metrics monitoring
|
||||||
|
- Implemented process tracking functionality
|
||||||
|
- Added battery status monitoring
|
||||||
|
- Integrated energy saving features
|
||||||
|
|
||||||
|
### Connections
|
||||||
|
|
||||||
|
- Added GitHub integration
|
||||||
|
- Implemented secure token storage
|
||||||
|
- Added connection status indicators
|
||||||
|
|
||||||
|
### Notifications
|
||||||
|
|
||||||
|
- Implemented centralized notification system
|
||||||
|
- Added support for different notification types (error, warning, update)
|
||||||
|
- Integrated with logStore for persistent storage
|
@ -194,7 +194,7 @@ export default function ConnectionsTab() {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{connection.user && (
|
{connection.user && (
|
||||||
<span className="text-sm text-green-500 flex items-center gap-1">
|
<span className="text-sm text-bolt-elements-textSecondary flex items-center gap-1">
|
||||||
<div className="i-ph:check-circle w-4 h-4" />
|
<div className="i-ph:check-circle w-4 h-4" />
|
||||||
Connected to GitHub
|
Connected to GitHub
|
||||||
</span>
|
</span>
|
||||||
|
@ -4,13 +4,6 @@ import { classNames } from '~/utils/classNames';
|
|||||||
import { logStore } from '~/lib/stores/logs';
|
import { logStore } from '~/lib/stores/logs';
|
||||||
import type { LogEntry } from '~/lib/stores/logs';
|
import type { LogEntry } from '~/lib/stores/logs';
|
||||||
|
|
||||||
interface ProviderStatus {
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
status: 'online' | 'offline' | 'error';
|
|
||||||
error?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface SystemInfo {
|
interface SystemInfo {
|
||||||
os: string;
|
os: string;
|
||||||
arch: string;
|
arch: string;
|
||||||
@ -90,14 +83,24 @@ interface SystemInfo {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface WebAppInfo {
|
||||||
|
name: string;
|
||||||
|
version: string;
|
||||||
|
description: string;
|
||||||
|
license: string;
|
||||||
|
nodeVersion: string;
|
||||||
|
dependencies: { [key: string]: string };
|
||||||
|
devDependencies: { [key: string]: string };
|
||||||
|
}
|
||||||
|
|
||||||
export default function DebugTab() {
|
export default function DebugTab() {
|
||||||
const [providerStatuses, setProviderStatuses] = useState<ProviderStatus[]>([]);
|
|
||||||
const [systemInfo, setSystemInfo] = useState<SystemInfo | null>(null);
|
const [systemInfo, setSystemInfo] = useState<SystemInfo | null>(null);
|
||||||
|
const [webAppInfo, setWebAppInfo] = useState<WebAppInfo | null>(null);
|
||||||
const [loading, setLoading] = useState({
|
const [loading, setLoading] = useState({
|
||||||
systemInfo: false,
|
systemInfo: false,
|
||||||
providers: false,
|
|
||||||
performance: false,
|
performance: false,
|
||||||
errors: false,
|
errors: false,
|
||||||
|
webAppInfo: false,
|
||||||
});
|
});
|
||||||
const [errorLog, setErrorLog] = useState<{
|
const [errorLog, setErrorLog] = useState<{
|
||||||
errors: any[];
|
errors: any[];
|
||||||
@ -109,8 +112,8 @@ export default function DebugTab() {
|
|||||||
|
|
||||||
// Fetch initial data
|
// Fetch initial data
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
checkProviderStatus();
|
|
||||||
getSystemInfo();
|
getSystemInfo();
|
||||||
|
getWebAppInfo();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// Set up error listeners when component mounts
|
// Set up error listeners when component mounts
|
||||||
@ -146,75 +149,6 @@ export default function DebugTab() {
|
|||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const checkProviderStatus = async () => {
|
|
||||||
try {
|
|
||||||
setLoading((prev) => ({ ...prev, providers: true }));
|
|
||||||
|
|
||||||
// Fetch real provider statuses
|
|
||||||
const providers: ProviderStatus[] = [];
|
|
||||||
|
|
||||||
// Check OpenAI status
|
|
||||||
try {
|
|
||||||
const openaiResponse = await fetch('/api/providers/openai/status');
|
|
||||||
providers.push({
|
|
||||||
id: 'openai',
|
|
||||||
name: 'OpenAI',
|
|
||||||
status: openaiResponse.ok ? 'online' : 'error',
|
|
||||||
error: !openaiResponse.ok ? 'API Error' : undefined,
|
|
||||||
});
|
|
||||||
} catch {
|
|
||||||
providers.push({ id: 'openai', name: 'OpenAI', status: 'offline' });
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check Anthropic status
|
|
||||||
try {
|
|
||||||
const anthropicResponse = await fetch('/api/providers/anthropic/status');
|
|
||||||
providers.push({
|
|
||||||
id: 'anthropic',
|
|
||||||
name: 'Anthropic',
|
|
||||||
status: anthropicResponse.ok ? 'online' : 'error',
|
|
||||||
error: !anthropicResponse.ok ? 'API Error' : undefined,
|
|
||||||
});
|
|
||||||
} catch {
|
|
||||||
providers.push({ id: 'anthropic', name: 'Anthropic', status: 'offline' });
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check Local Models status
|
|
||||||
try {
|
|
||||||
const localResponse = await fetch('/api/providers/local/status');
|
|
||||||
providers.push({
|
|
||||||
id: 'local',
|
|
||||||
name: 'Local Models',
|
|
||||||
status: localResponse.ok ? 'online' : 'error',
|
|
||||||
error: !localResponse.ok ? 'API Error' : undefined,
|
|
||||||
});
|
|
||||||
} catch {
|
|
||||||
providers.push({ id: 'local', name: 'Local Models', status: 'offline' });
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check Ollama status
|
|
||||||
try {
|
|
||||||
const ollamaResponse = await fetch('/api/providers/ollama/status');
|
|
||||||
providers.push({
|
|
||||||
id: 'ollama',
|
|
||||||
name: 'Ollama',
|
|
||||||
status: ollamaResponse.ok ? 'online' : 'error',
|
|
||||||
error: !ollamaResponse.ok ? 'API Error' : undefined,
|
|
||||||
});
|
|
||||||
} catch {
|
|
||||||
providers.push({ id: 'ollama', name: 'Ollama', status: 'offline' });
|
|
||||||
}
|
|
||||||
|
|
||||||
setProviderStatuses(providers);
|
|
||||||
toast.success('Provider status updated');
|
|
||||||
} catch (error) {
|
|
||||||
toast.error('Failed to check provider status');
|
|
||||||
console.error('Failed to check provider status:', error);
|
|
||||||
} finally {
|
|
||||||
setLoading((prev) => ({ ...prev, providers: false }));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const getSystemInfo = async () => {
|
const getSystemInfo = async () => {
|
||||||
try {
|
try {
|
||||||
setLoading((prev) => ({ ...prev, systemInfo: true }));
|
setLoading((prev) => ({ ...prev, systemInfo: true }));
|
||||||
@ -360,6 +294,26 @@ export default function DebugTab() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getWebAppInfo = async () => {
|
||||||
|
try {
|
||||||
|
setLoading((prev) => ({ ...prev, webAppInfo: true }));
|
||||||
|
|
||||||
|
const response = await fetch('/api/system/app-info');
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error('Failed to fetch webapp info');
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = await response.json();
|
||||||
|
setWebAppInfo(data as WebAppInfo);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to fetch webapp info:', error);
|
||||||
|
toast.error('Failed to fetch webapp information');
|
||||||
|
} finally {
|
||||||
|
setLoading((prev) => ({ ...prev, webAppInfo: false }));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Helper function to format bytes to human readable format
|
// Helper function to format bytes to human readable format
|
||||||
const formatBytes = (bytes: number) => {
|
const formatBytes = (bytes: number) => {
|
||||||
const units = ['B', 'KB', 'MB', 'GB'];
|
const units = ['B', 'KB', 'MB', 'GB'];
|
||||||
@ -509,29 +463,40 @@ export default function DebugTab() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const exportDebugInfo = () => {
|
||||||
|
try {
|
||||||
|
const debugData = {
|
||||||
|
timestamp: new Date().toISOString(),
|
||||||
|
system: systemInfo,
|
||||||
|
webApp: webAppInfo,
|
||||||
|
errors: errorLog.errors,
|
||||||
|
performance: {
|
||||||
|
memory: (performance as any).memory || {},
|
||||||
|
timing: performance.timing,
|
||||||
|
navigation: performance.navigation,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const blob = new Blob([JSON.stringify(debugData, null, 2)], { type: 'application/json' });
|
||||||
|
const url = window.URL.createObjectURL(blob);
|
||||||
|
const a = document.createElement('a');
|
||||||
|
a.href = url;
|
||||||
|
a.download = `bolt-debug-info-${new Date().toISOString()}.json`;
|
||||||
|
document.body.appendChild(a);
|
||||||
|
a.click();
|
||||||
|
window.URL.revokeObjectURL(url);
|
||||||
|
document.body.removeChild(a);
|
||||||
|
toast.success('Debug information exported successfully');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to export debug info:', error);
|
||||||
|
toast.error('Failed to export debug information');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col gap-6">
|
<div className="flex flex-col gap-6">
|
||||||
{/* Action Buttons */}
|
{/* Action Buttons */}
|
||||||
<div className="flex flex-wrap gap-4">
|
<div className="flex flex-wrap gap-4">
|
||||||
<button
|
|
||||||
onClick={checkProviderStatus}
|
|
||||||
disabled={loading.providers}
|
|
||||||
className={classNames(
|
|
||||||
'flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-lg transition-colors',
|
|
||||||
'bg-[#F5F5F5] dark:bg-[#1A1A1A] hover:bg-[#E5E5E5] dark:hover:bg-[#2A2A2A]',
|
|
||||||
'text-bolt-elements-textPrimary dark:text-bolt-elements-textPrimary',
|
|
||||||
'focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2',
|
|
||||||
{ 'opacity-50 cursor-not-allowed': loading.providers },
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
{loading.providers ? (
|
|
||||||
<div className="i-ph:spinner-gap w-4 h-4 animate-spin" />
|
|
||||||
) : (
|
|
||||||
<div className="i-ph:plug w-4 h-4" />
|
|
||||||
)}
|
|
||||||
Check Providers
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<button
|
<button
|
||||||
onClick={getSystemInfo}
|
onClick={getSystemInfo}
|
||||||
disabled={loading.systemInfo}
|
disabled={loading.systemInfo}
|
||||||
@ -588,6 +553,19 @@ export default function DebugTab() {
|
|||||||
)}
|
)}
|
||||||
Check Errors
|
Check Errors
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
<button
|
||||||
|
onClick={exportDebugInfo}
|
||||||
|
className={classNames(
|
||||||
|
'flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-lg transition-colors',
|
||||||
|
'bg-[#F5F5F5] dark:bg-[#1A1A1A] hover:bg-[#E5E5E5] dark:hover:bg-[#2A2A2A]',
|
||||||
|
'text-bolt-elements-textPrimary dark:text-bolt-elements-textPrimary',
|
||||||
|
'focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2',
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<div className="i-ph:download w-4 h-4" />
|
||||||
|
Export Debug Info
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Error Log Display */}
|
{/* Error Log Display */}
|
||||||
@ -772,53 +750,6 @@ export default function DebugTab() {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Provider Status */}
|
|
||||||
<div className="p-6 rounded-xl bg-white dark:bg-[#0A0A0A] border border-[#E5E5E5] dark:border-[#1A1A1A]">
|
|
||||||
<div className="flex items-center justify-between mb-4">
|
|
||||||
<div className="flex items-center gap-3">
|
|
||||||
<div className="i-ph:robot text-purple-500 w-5 h-5" />
|
|
||||||
<h3 className="text-base font-medium text-bolt-elements-textPrimary">Provider Status</h3>
|
|
||||||
</div>
|
|
||||||
<button
|
|
||||||
onClick={checkProviderStatus}
|
|
||||||
className={classNames(
|
|
||||||
'flex items-center gap-2 px-3 py-2 rounded-lg text-sm',
|
|
||||||
'bg-[#F5F5F5] dark:bg-[#1A1A1A] hover:bg-[#E5E5E5] dark:hover:bg-[#2A2A2A]',
|
|
||||||
'text-bolt-elements-textPrimary dark:text-bolt-elements-textPrimary',
|
|
||||||
'transition-colors duration-200',
|
|
||||||
{ 'opacity-50 cursor-not-allowed': loading.providers },
|
|
||||||
)}
|
|
||||||
disabled={loading.providers}
|
|
||||||
>
|
|
||||||
<div className={classNames('i-ph:arrows-clockwise w-4 h-4', loading.providers ? 'animate-spin' : '')} />
|
|
||||||
Refresh
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div className="grid grid-cols-2 gap-4">
|
|
||||||
{providerStatuses.map((provider) => (
|
|
||||||
<div
|
|
||||||
key={provider.id}
|
|
||||||
className="flex items-center justify-between p-3 rounded-lg bg-[#F8F8F8] dark:bg-[#141414]"
|
|
||||||
>
|
|
||||||
<div className="flex items-center gap-3">
|
|
||||||
<div
|
|
||||||
className={classNames(
|
|
||||||
'w-2 h-2 rounded-full',
|
|
||||||
provider.status === 'online'
|
|
||||||
? 'bg-green-500'
|
|
||||||
: provider.status === 'offline'
|
|
||||||
? 'bg-red-500'
|
|
||||||
: 'bg-yellow-500',
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
<span className="text-sm text-bolt-elements-textPrimary">{provider.name}</span>
|
|
||||||
</div>
|
|
||||||
<span className="text-xs text-bolt-elements-textSecondary capitalize">{provider.status}</span>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Performance Metrics */}
|
{/* Performance Metrics */}
|
||||||
<div className="p-6 rounded-xl bg-white dark:bg-[#0A0A0A] border border-[#E5E5E5] dark:border-[#1A1A1A]">
|
<div className="p-6 rounded-xl bg-white dark:bg-[#0A0A0A] border border-[#E5E5E5] dark:border-[#1A1A1A]">
|
||||||
<div className="flex items-center justify-between mb-4">
|
<div className="flex items-center justify-between mb-4">
|
||||||
@ -906,6 +837,82 @@ export default function DebugTab() {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* WebApp Information */}
|
||||||
|
<div className="p-6 rounded-xl bg-white dark:bg-[#0A0A0A] border border-[#E5E5E5] dark:border-[#1A1A1A]">
|
||||||
|
<div className="flex items-center justify-between mb-4">
|
||||||
|
<div className="flex items-center gap-3">
|
||||||
|
<div className="i-ph:info text-blue-500 w-5 h-5" />
|
||||||
|
<h3 className="text-base font-medium text-bolt-elements-textPrimary">WebApp Information</h3>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
onClick={getWebAppInfo}
|
||||||
|
className={classNames(
|
||||||
|
'flex items-center gap-2 px-3 py-2 rounded-lg text-sm',
|
||||||
|
'bg-[#F5F5F5] dark:bg-[#1A1A1A] hover:bg-[#E5E5E5] dark:hover:bg-[#2A2A2A]',
|
||||||
|
'text-bolt-elements-textPrimary dark:text-bolt-elements-textPrimary',
|
||||||
|
'transition-colors duration-200',
|
||||||
|
{ 'opacity-50 cursor-not-allowed': loading.webAppInfo },
|
||||||
|
)}
|
||||||
|
disabled={loading.webAppInfo}
|
||||||
|
>
|
||||||
|
<div className={classNames('i-ph:arrows-clockwise w-4 h-4', loading.webAppInfo ? 'animate-spin' : '')} />
|
||||||
|
Refresh
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{webAppInfo ? (
|
||||||
|
<div className="grid grid-cols-2 gap-4">
|
||||||
|
<div className="space-y-2">
|
||||||
|
<div className="text-sm flex items-center gap-2">
|
||||||
|
<div className="i-ph:app-window text-bolt-elements-textSecondary w-4 h-4" />
|
||||||
|
<span className="text-bolt-elements-textSecondary">Name: </span>
|
||||||
|
<span className="text-bolt-elements-textPrimary">{webAppInfo.name}</span>
|
||||||
|
</div>
|
||||||
|
<div className="text-sm flex items-center gap-2">
|
||||||
|
<div className="i-ph:tag text-bolt-elements-textSecondary w-4 h-4" />
|
||||||
|
<span className="text-bolt-elements-textSecondary">Version: </span>
|
||||||
|
<span className="text-bolt-elements-textPrimary">{webAppInfo.version}</span>
|
||||||
|
</div>
|
||||||
|
<div className="text-sm flex items-center gap-2">
|
||||||
|
<div className="i-ph:file-text text-bolt-elements-textSecondary w-4 h-4" />
|
||||||
|
<span className="text-bolt-elements-textSecondary">Description: </span>
|
||||||
|
<span className="text-bolt-elements-textPrimary">{webAppInfo.description}</span>
|
||||||
|
</div>
|
||||||
|
<div className="text-sm flex items-center gap-2">
|
||||||
|
<div className="i-ph:certificate text-bolt-elements-textSecondary w-4 h-4" />
|
||||||
|
<span className="text-bolt-elements-textSecondary">License: </span>
|
||||||
|
<span className="text-bolt-elements-textPrimary">{webAppInfo.license}</span>
|
||||||
|
</div>
|
||||||
|
<div className="text-sm flex items-center gap-2">
|
||||||
|
<div className="i-ph:node text-bolt-elements-textSecondary w-4 h-4" />
|
||||||
|
<span className="text-bolt-elements-textSecondary">Node Version: </span>
|
||||||
|
<span className="text-bolt-elements-textPrimary">{webAppInfo.nodeVersion}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="space-y-2">
|
||||||
|
<div className="text-sm">
|
||||||
|
<div className="flex items-center gap-2 mb-2">
|
||||||
|
<div className="i-ph:package text-bolt-elements-textSecondary w-4 h-4" />
|
||||||
|
<span className="text-bolt-elements-textSecondary">Key Dependencies:</span>
|
||||||
|
</div>
|
||||||
|
<div className="pl-6 space-y-1">
|
||||||
|
{Object.entries(webAppInfo.dependencies)
|
||||||
|
.filter(([key]) => ['react', '@remix-run/react', 'next', 'typescript'].includes(key))
|
||||||
|
.map(([key, version]) => (
|
||||||
|
<div key={key} className="text-xs text-bolt-elements-textPrimary">
|
||||||
|
{key}: {version}
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div className="text-sm text-bolt-elements-textSecondary">
|
||||||
|
{loading.webAppInfo ? 'Loading webapp information...' : 'No webapp information available'}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
{/* Error Check */}
|
{/* Error Check */}
|
||||||
<div className="p-6 rounded-xl bg-white dark:bg-[#0A0A0A] border border-[#E5E5E5] dark:border-[#1A1A1A]">
|
<div className="p-6 rounded-xl bg-white dark:bg-[#0A0A0A] border border-[#E5E5E5] dark:border-[#1A1A1A]">
|
||||||
<div className="flex items-center justify-between mb-4">
|
<div className="flex items-center justify-between mb-4">
|
||||||
|
@ -1,515 +1,421 @@
|
|||||||
import React, { useCallback, useEffect, useState, useMemo, useRef } from 'react';
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { toast } from 'react-toastify';
|
import { motion } from 'framer-motion';
|
||||||
import { Switch } from '~/components/ui/Switch';
|
import { Switch } from '~/components/ui/Switch';
|
||||||
import { logStore, type LogEntry } from '~/lib/stores/logs';
|
import { logStore, type LogEntry } from '~/lib/stores/logs';
|
||||||
import { useStore } from '@nanostores/react';
|
import { useStore } from '@nanostores/react';
|
||||||
import { classNames } from '~/utils/classNames';
|
import { classNames } from '~/utils/classNames';
|
||||||
import { motion } from 'framer-motion';
|
|
||||||
|
|
||||||
interface SelectOption {
|
interface SelectOption {
|
||||||
value: string;
|
value: string;
|
||||||
label: string;
|
label: string;
|
||||||
icon: string;
|
icon?: string;
|
||||||
color?: string;
|
color?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const logLevelOptions: SelectOption[] = [
|
const logLevelOptions: SelectOption[] = [
|
||||||
{ value: 'all', label: 'All Levels', icon: 'i-ph:funnel' },
|
{
|
||||||
{ value: 'info', label: 'Info', icon: 'i-ph:info', color: 'text-blue-500' },
|
value: 'all',
|
||||||
{ value: 'warning', label: 'Warning', icon: 'i-ph:warning', color: 'text-yellow-500' },
|
label: 'All Levels',
|
||||||
{ value: 'error', label: 'Error', icon: 'i-ph:x-circle', color: 'text-red-500' },
|
icon: 'i-ph:funnel',
|
||||||
{ value: 'debug', label: 'Debug', icon: 'i-ph:bug', color: 'text-gray-500' },
|
color: '#9333ea',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'info',
|
||||||
|
label: 'Info',
|
||||||
|
icon: 'i-ph:info',
|
||||||
|
color: '#3b82f6',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'warning',
|
||||||
|
label: 'Warning',
|
||||||
|
icon: 'i-ph:warning',
|
||||||
|
color: '#f59e0b',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'error',
|
||||||
|
label: 'Error',
|
||||||
|
icon: 'i-ph:x-circle',
|
||||||
|
color: '#ef4444',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'debug',
|
||||||
|
label: 'Debug',
|
||||||
|
icon: 'i-ph:bug',
|
||||||
|
color: '#6b7280',
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const logCategoryOptions: SelectOption[] = [
|
const logCategoryOptions: SelectOption[] = [
|
||||||
{ value: 'all', label: 'All Categories', icon: 'i-ph:squares-four' },
|
{
|
||||||
{ value: 'system', label: 'System', icon: 'i-ph:desktop' },
|
value: 'all',
|
||||||
{ value: 'provider', label: 'Provider', icon: 'i-ph:plug' },
|
label: 'All Categories',
|
||||||
{ value: 'user', label: 'User', icon: 'i-ph:user' },
|
icon: 'i-ph:squares-four',
|
||||||
{ value: 'error', label: 'Error', icon: 'i-ph:warning-octagon' },
|
color: '#9333ea',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'api',
|
||||||
|
label: 'API',
|
||||||
|
icon: 'i-ph:cloud',
|
||||||
|
color: '#3b82f6',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'auth',
|
||||||
|
label: 'Auth',
|
||||||
|
icon: 'i-ph:key',
|
||||||
|
color: '#f59e0b',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'database',
|
||||||
|
label: 'Database',
|
||||||
|
icon: 'i-ph:database',
|
||||||
|
color: '#10b981',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'network',
|
||||||
|
label: 'Network',
|
||||||
|
icon: 'i-ph:wifi-high',
|
||||||
|
color: '#6366f1',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'performance',
|
||||||
|
label: 'Performance',
|
||||||
|
icon: 'i-ph:chart-line-up',
|
||||||
|
color: '#8b5cf6',
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const SegmentedGroup = ({
|
interface LogEntryItemProps {
|
||||||
value,
|
|
||||||
onChange,
|
|
||||||
options,
|
|
||||||
className,
|
|
||||||
}: {
|
|
||||||
value: string;
|
|
||||||
onChange: (value: string) => void;
|
|
||||||
options: SelectOption[];
|
|
||||||
className?: string;
|
|
||||||
}) => {
|
|
||||||
const [isExpanded, setIsExpanded] = useState(false);
|
|
||||||
const selectedOption = options.find((opt) => opt.value === value);
|
|
||||||
|
|
||||||
if (!isExpanded) {
|
|
||||||
return (
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
onClick={() => setIsExpanded(true)}
|
|
||||||
className={classNames(
|
|
||||||
'flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm',
|
|
||||||
'bg-white/50 dark:bg-gray-800/30',
|
|
||||||
'hover:bg-gray-50 dark:hover:bg-gray-800/50',
|
|
||||||
'border border-gray-200/50 dark:border-gray-700/50',
|
|
||||||
'text-bolt-elements-textPrimary',
|
|
||||||
className,
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
<div className={classNames(selectedOption?.icon, 'text-base text-purple-500')} />
|
|
||||||
<span className="text-sm">{selectedOption?.label}</span>
|
|
||||||
<div className="i-ph:caret-right text-sm text-bolt-elements-textTertiary" />
|
|
||||||
</button>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="flex items-center gap-0.5 p-0.5 rounded-lg bg-white/50 dark:bg-gray-800/30 border border-gray-200/50 dark:border-gray-700/50">
|
|
||||||
{options.map((option) => (
|
|
||||||
<button
|
|
||||||
key={option.value}
|
|
||||||
type="button"
|
|
||||||
onClick={() => {
|
|
||||||
onChange(option.value);
|
|
||||||
setIsExpanded(false);
|
|
||||||
}}
|
|
||||||
className={classNames(
|
|
||||||
'flex items-center gap-2 px-3 py-1.5 rounded-md text-sm transition-colors',
|
|
||||||
option.value === value
|
|
||||||
? 'bg-purple-100 dark:bg-purple-800/40 text-purple-900 dark:text-purple-200'
|
|
||||||
: 'text-bolt-elements-textSecondary hover:bg-gray-50 dark:hover:bg-gray-800/50',
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
<div className={classNames(option.icon, 'text-base', option.value === value ? option.color : '')} />
|
|
||||||
<span className="truncate">{option.label}</span>
|
|
||||||
</button>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const LogEntryItem = ({
|
|
||||||
log,
|
|
||||||
isExpanded: forceExpanded,
|
|
||||||
use24Hour,
|
|
||||||
}: {
|
|
||||||
log: LogEntry;
|
log: LogEntry;
|
||||||
isExpanded: boolean;
|
isExpanded: boolean;
|
||||||
use24Hour: boolean;
|
use24Hour: boolean;
|
||||||
}) => {
|
showTimestamp: boolean;
|
||||||
const [isExpanded, setIsExpanded] = useState(forceExpanded);
|
}
|
||||||
const [isCopied, setIsCopied] = useState(false);
|
|
||||||
|
|
||||||
|
const LogEntryItem = ({ log, isExpanded: forceExpanded, use24Hour, showTimestamp }: LogEntryItemProps) => {
|
||||||
|
const [localExpanded, setLocalExpanded] = useState(forceExpanded);
|
||||||
|
|
||||||
|
// Update local expanded state when forceExpanded changes
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setIsExpanded(forceExpanded);
|
setLocalExpanded(forceExpanded);
|
||||||
}, [forceExpanded]);
|
}, [forceExpanded]);
|
||||||
|
|
||||||
const handleCopy = useCallback(() => {
|
const timestamp = useMemo(() => {
|
||||||
const logText = `[${log.level.toUpperCase()}] ${log.message}\nTimestamp: ${new Date(
|
|
||||||
log.timestamp,
|
|
||||||
).toLocaleString()}\nCategory: ${log.category}\nDetails: ${JSON.stringify(log.details, null, 2)}`;
|
|
||||||
|
|
||||||
navigator.clipboard.writeText(logText).then(() => {
|
|
||||||
setIsCopied(true);
|
|
||||||
toast.success('Log copied to clipboard');
|
|
||||||
setTimeout(() => setIsCopied(false), 2000);
|
|
||||||
});
|
|
||||||
}, [log]);
|
|
||||||
|
|
||||||
const formattedTime = useMemo(() => {
|
|
||||||
const date = new Date(log.timestamp);
|
const date = new Date(log.timestamp);
|
||||||
const now = new Date();
|
|
||||||
const isToday = date.toDateString() === now.toDateString();
|
|
||||||
const isYesterday = new Date(now.setDate(now.getDate() - 1)).toDateString() === date.toDateString();
|
|
||||||
|
|
||||||
const timeStr = date.toLocaleTimeString(undefined, {
|
if (use24Hour) {
|
||||||
hour: '2-digit',
|
return date.toLocaleTimeString('en-US', { hour12: false });
|
||||||
minute: '2-digit',
|
|
||||||
hour12: !use24Hour,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (isToday) {
|
|
||||||
return {
|
|
||||||
primary: timeStr,
|
|
||||||
secondary: 'Today',
|
|
||||||
};
|
|
||||||
} else if (isYesterday) {
|
|
||||||
return {
|
|
||||||
primary: timeStr,
|
|
||||||
secondary: 'Yesterday',
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
const dateStr = date.toLocaleDateString(undefined, {
|
|
||||||
month: 'short',
|
|
||||||
day: 'numeric',
|
|
||||||
year: date.getFullYear() !== now.getFullYear() ? 'numeric' : undefined,
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
primary: dateStr,
|
|
||||||
secondary: timeStr,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return date.toLocaleTimeString('en-US', { hour12: true });
|
||||||
}, [log.timestamp, use24Hour]);
|
}, [log.timestamp, use24Hour]);
|
||||||
|
|
||||||
return (
|
const levelColor = useMemo(() => {
|
||||||
<div
|
switch (log.level) {
|
||||||
className={classNames('group transition-colors', 'hover:bg-gray-50 dark:hover:bg-gray-800/50', 'py-3', {
|
case 'error':
|
||||||
'bg-red-50/20 dark:bg-red-900/5': log.level === 'error',
|
return 'text-red-500 bg-red-50 dark:bg-red-500/10';
|
||||||
'bg-yellow-50/20 dark:bg-yellow-900/5': log.level === 'warning',
|
case 'warning':
|
||||||
'bg-blue-50/20 dark:bg-blue-900/5': log.level === 'info',
|
return 'text-yellow-500 bg-yellow-50 dark:bg-yellow-500/10';
|
||||||
'bg-gray-50/20 dark:bg-gray-800/5': log.level === 'debug',
|
case 'debug':
|
||||||
})}
|
return 'text-gray-500 bg-gray-50 dark:bg-gray-500/10';
|
||||||
>
|
default:
|
||||||
<div className="px-3">
|
return 'text-blue-500 bg-blue-50 dark:bg-blue-500/10';
|
||||||
<div className="flex items-center gap-3">
|
}
|
||||||
<span
|
}, [log.level]);
|
||||||
className={classNames('px-2 py-0.5 text-xs font-medium rounded-full', {
|
|
||||||
'bg-red-100/80 text-red-800 dark:bg-red-500/10 dark:text-red-400': log.level === 'error',
|
|
||||||
'bg-yellow-100/80 text-yellow-800 dark:bg-yellow-500/10 dark:text-yellow-400': log.level === 'warning',
|
|
||||||
'bg-blue-100/80 text-blue-800 dark:bg-blue-500/10 dark:text-blue-400': log.level === 'info',
|
|
||||||
'bg-gray-100/80 text-gray-800 dark:bg-gray-500/10 dark:text-gray-400': log.level === 'debug',
|
|
||||||
})}
|
|
||||||
>
|
|
||||||
{log.level}
|
|
||||||
</span>
|
|
||||||
<p className="flex-1 text-sm text-bolt-elements-textPrimary">{log.message}</p>
|
|
||||||
<div className="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity">
|
|
||||||
<button onClick={handleCopy} className="p-1 transition-colors rounded focus:outline-none" title="Copy log">
|
|
||||||
<div
|
|
||||||
className={classNames(
|
|
||||||
'text-base transition-colors',
|
|
||||||
isCopied
|
|
||||||
? 'i-ph:check text-green-500'
|
|
||||||
: 'i-ph:copy text-bolt-elements-textTertiary hover:text-bolt-elements-textSecondary',
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
</button>
|
|
||||||
{log.details && (
|
|
||||||
<button
|
|
||||||
onClick={() => setIsExpanded(!isExpanded)}
|
|
||||||
className="p-1 text-bolt-elements-textTertiary hover:text-bolt-elements-textSecondary transition-colors rounded focus:outline-none"
|
|
||||||
title="Toggle details"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
className={classNames('text-base transition-transform', {
|
|
||||||
'i-ph:caret-down rotate-180': isExpanded,
|
|
||||||
'i-ph:caret-down': !isExpanded,
|
|
||||||
})}
|
|
||||||
/>
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="flex items-center gap-2 mt-1 text-xs">
|
|
||||||
<div className="flex items-center gap-1">
|
|
||||||
<div className="i-ph:clock text-bolt-elements-textTertiary" />
|
|
||||||
<span className="text-bolt-elements-textSecondary">{formattedTime.primary}</span>
|
|
||||||
<span className="text-bolt-elements-textTertiary">·</span>
|
|
||||||
<span className="text-bolt-elements-textTertiary">{formattedTime.secondary}</span>
|
|
||||||
</div>
|
|
||||||
<span className="px-2 py-0.5 rounded-full bg-bolt-elements-background-depth-2 dark:bg-bolt-elements-background-depth-3">
|
|
||||||
{log.category}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{isExpanded && log.details && (
|
return (
|
||||||
<motion.div
|
<div className="p-3 hover:bg-gray-50 dark:hover:bg-gray-800/50 transition-colors">
|
||||||
initial={{ height: 0, opacity: 0 }}
|
<div className="flex items-start gap-3">
|
||||||
animate={{ height: 'auto', opacity: 1 }}
|
<div className={classNames('px-2 py-0.5 rounded text-xs font-medium uppercase', levelColor)}>{log.level}</div>
|
||||||
exit={{ height: 0, opacity: 0 }}
|
{showTimestamp && <div className="text-sm text-bolt-elements-textTertiary">{timestamp}</div>}
|
||||||
transition={{ duration: 0.2 }}
|
<div className="flex-grow">
|
||||||
className="mt-2 px-3"
|
<div className="text-sm text-bolt-elements-textPrimary">{log.message}</div>
|
||||||
>
|
{log.details && (
|
||||||
<pre className="p-2 text-sm rounded-md overflow-auto bg-bolt-elements-background-depth-2/50 dark:bg-bolt-elements-background-depth-3/50 text-bolt-elements-textSecondary">
|
<button
|
||||||
|
onClick={() => setLocalExpanded(!localExpanded)}
|
||||||
|
className="mt-1 text-xs text-bolt-elements-textTertiary hover:text-bolt-elements-textSecondary"
|
||||||
|
>
|
||||||
|
{localExpanded ? 'Hide' : 'Show'} Details
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
{log.category && (
|
||||||
|
<div className="px-2 py-0.5 rounded-full text-xs bg-gray-100 dark:bg-gray-800 text-bolt-elements-textSecondary">
|
||||||
|
{log.category}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
{localExpanded && log.details && (
|
||||||
|
<div className="mt-2 p-2 rounded bg-gray-50 dark:bg-gray-800/50">
|
||||||
|
<pre className="text-xs text-bolt-elements-textSecondary whitespace-pre-wrap">
|
||||||
{JSON.stringify(log.details, null, 2)}
|
{JSON.stringify(log.details, null, 2)}
|
||||||
</pre>
|
</pre>
|
||||||
</motion.div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO: Future Enhancements
|
|
||||||
*
|
|
||||||
* 1. Advanced Features:
|
|
||||||
* - Add export to JSON/CSV functionality
|
|
||||||
* - Implement log retention policies
|
|
||||||
* - Add custom alert rules and notifications
|
|
||||||
* - Add pattern detection and highlighting
|
|
||||||
*
|
|
||||||
* 2. Visual Improvements:
|
|
||||||
* - Add dark/light mode specific styling
|
|
||||||
* - Implement collapsible JSON viewer
|
|
||||||
* - Add timeline view with zoom capabilities
|
|
||||||
*
|
|
||||||
* 3. Performance Optimizations:
|
|
||||||
* - Implement virtualized scrolling for large logs
|
|
||||||
* - Add lazy loading for log details
|
|
||||||
* - Optimize search with indexing
|
|
||||||
*/
|
|
||||||
|
|
||||||
export function EventLogsTab() {
|
export function EventLogsTab() {
|
||||||
const logs = useStore(logStore.logs);
|
const logs = useStore(logStore.logs);
|
||||||
const [logLevel, setLogLevel] = useState<LogEntry['level'] | 'all'>('all');
|
const [selectedLevel, setSelectedLevel] = useState('all');
|
||||||
const [logCategory, setLogCategory] = useState<LogEntry['category'] | 'all'>('all');
|
const [selectedCategory, setSelectedCategory] = useState('all');
|
||||||
const [autoScroll, setAutoScroll] = useState(true);
|
|
||||||
const [searchQuery, setSearchQuery] = useState('');
|
const [searchQuery, setSearchQuery] = useState('');
|
||||||
const [expandAll, setExpandAll] = useState(false);
|
const [use24Hour, setUse24Hour] = useState(false);
|
||||||
const [use24Hour, setUse24Hour] = useState(true);
|
const [autoExpand, setAutoExpand] = useState(false);
|
||||||
|
const [showTimestamps, setShowTimestamps] = useState(true);
|
||||||
|
const [showLevelFilter, setShowLevelFilter] = useState(false);
|
||||||
|
const [showCategoryFilter, setShowCategoryFilter] = useState(false);
|
||||||
const [isRefreshing, setIsRefreshing] = useState(false);
|
const [isRefreshing, setIsRefreshing] = useState(false);
|
||||||
const logsContainerRef = useRef<HTMLDivElement>(null);
|
const logsContainerRef = useRef<HTMLDivElement>(null);
|
||||||
const [isScrolledToBottom, setIsScrolledToBottom] = useState(true);
|
const levelFilterRef = useRef<HTMLDivElement>(null);
|
||||||
|
const categoryFilterRef = useRef<HTMLDivElement>(null);
|
||||||
// Add refresh function
|
|
||||||
const handleRefresh = useCallback(async () => {
|
|
||||||
setIsRefreshing(true);
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Since logStore doesn't have refresh, we'll re-fetch logs
|
|
||||||
await new Promise((resolve) => setTimeout(resolve, 500)); // Simulate refresh
|
|
||||||
toast.success('Logs refreshed');
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Failed to refresh logs:', err);
|
|
||||||
toast.error('Failed to refresh logs');
|
|
||||||
} finally {
|
|
||||||
setIsRefreshing(false);
|
|
||||||
}
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const filteredLogs = useMemo(() => {
|
const filteredLogs = useMemo(() => {
|
||||||
const allLogs = Object.values(logs);
|
return logStore.getFilteredLogs(
|
||||||
const filtered = allLogs.filter((log) => {
|
selectedLevel === 'all' ? undefined : (selectedLevel as LogEntry['level']),
|
||||||
const matchesLevel = logLevel === 'all' || log.level === logLevel;
|
selectedCategory === 'all' ? undefined : (selectedCategory as LogEntry['category']),
|
||||||
const matchesCategory = logCategory === 'all' || log.category === logCategory;
|
searchQuery,
|
||||||
const matchesSearch =
|
);
|
||||||
!searchQuery ||
|
}, [logs, selectedLevel, selectedCategory, searchQuery]);
|
||||||
log.message?.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
|
||||||
JSON.stringify(log.details)?.toLowerCase()?.includes(searchQuery?.toLowerCase());
|
|
||||||
|
|
||||||
return matchesLevel && matchesCategory && matchesSearch;
|
|
||||||
});
|
|
||||||
|
|
||||||
return filtered.reverse();
|
|
||||||
}, [logs, logLevel, logCategory, searchQuery]);
|
|
||||||
|
|
||||||
const handleClearLogs = useCallback(() => {
|
|
||||||
if (confirm('Are you sure you want to clear all logs?')) {
|
|
||||||
logStore.clearLogs();
|
|
||||||
toast.success('Logs cleared successfully');
|
|
||||||
}
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const handleExportLogs = useCallback(() => {
|
const handleExportLogs = useCallback(() => {
|
||||||
try {
|
const exportData = {
|
||||||
const logText = logStore
|
timestamp: new Date().toISOString(),
|
||||||
.getLogs()
|
logs: filteredLogs,
|
||||||
.map(
|
filters: {
|
||||||
(log) =>
|
level: selectedLevel,
|
||||||
`[${log.level.toUpperCase()}] ${log.timestamp} - ${log.message}${
|
category: selectedCategory,
|
||||||
log.details ? '\nDetails: ' + JSON.stringify(log.details, null, 2) : ''
|
searchQuery,
|
||||||
}`,
|
},
|
||||||
)
|
};
|
||||||
.join('\n\n');
|
|
||||||
|
|
||||||
const blob = new Blob([logText], { type: 'text/plain' });
|
const blob = new Blob([JSON.stringify(exportData, null, 2)], { type: 'application/json' });
|
||||||
const url = URL.createObjectURL(blob);
|
const url = URL.createObjectURL(blob);
|
||||||
const a = document.createElement('a');
|
const a = document.createElement('a');
|
||||||
a.href = url;
|
a.href = url;
|
||||||
a.download = `event-logs-${new Date().toISOString()}.txt`;
|
a.download = `bolt-logs-${new Date().toISOString()}.json`;
|
||||||
document.body.appendChild(a);
|
document.body.appendChild(a);
|
||||||
a.click();
|
a.click();
|
||||||
document.body.removeChild(a);
|
document.body.removeChild(a);
|
||||||
URL.revokeObjectURL(url);
|
URL.revokeObjectURL(url);
|
||||||
toast.success('Logs exported successfully');
|
}, [filteredLogs, selectedLevel, selectedCategory, searchQuery]);
|
||||||
} catch (error) {
|
|
||||||
toast.error('Failed to export logs');
|
const handleRefresh = useCallback(async () => {
|
||||||
console.error('Export error:', error);
|
setIsRefreshing(true);
|
||||||
}
|
await logStore.refreshLogs();
|
||||||
|
setTimeout(() => setIsRefreshing(false), 500); // Keep animation visible for at least 500ms
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const handleScroll = () => {
|
// Close filters when clicking outside
|
||||||
const container = logsContainerRef.current;
|
|
||||||
|
|
||||||
if (!container) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const { scrollTop, scrollHeight, clientHeight } = container;
|
|
||||||
const isBottom = Math.abs(scrollHeight - clientHeight - scrollTop) < 10;
|
|
||||||
setIsScrolledToBottom(isBottom);
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const container = logsContainerRef.current;
|
const handleClickOutside = (event: MouseEvent) => {
|
||||||
|
if (levelFilterRef.current && !levelFilterRef.current.contains(event.target as Node)) {
|
||||||
|
setShowLevelFilter(false);
|
||||||
|
}
|
||||||
|
|
||||||
if (container && (autoScroll || isScrolledToBottom)) {
|
if (categoryFilterRef.current && !categoryFilterRef.current.contains(event.target as Node)) {
|
||||||
container.scrollTop = container.scrollHeight;
|
setShowCategoryFilter(false);
|
||||||
}
|
}
|
||||||
}, [filteredLogs, autoScroll, isScrolledToBottom]);
|
};
|
||||||
|
|
||||||
|
document.addEventListener('mousedown', handleClickOutside);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
document.removeEventListener('mousedown', handleClickOutside);
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const selectedLevelOption = logLevelOptions.find((opt) => opt.value === selectedLevel);
|
||||||
|
const selectedCategoryOption = logCategoryOptions.find((opt) => opt.value === selectedCategory);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col h-full gap-4 p-6">
|
<div className="flex flex-col h-full gap-4 p-6">
|
||||||
{/* Header Section */}
|
{/* Header */}
|
||||||
<div className="flex flex-col gap-4 pb-4">
|
<div className="flex items-center justify-between">
|
||||||
{/* Title and Refresh */}
|
<div className="flex items-center gap-3">
|
||||||
<div className="flex items-center justify-between">
|
<div className="i-ph:list text-xl text-purple-500" />
|
||||||
<div className="flex items-center gap-3">
|
<div>
|
||||||
<div className="i-ph:list text-xl text-purple-500" />
|
<h2 className="text-lg font-semibold">Event Logs</h2>
|
||||||
<div>
|
<p className="text-sm text-bolt-elements-textSecondary">Track system events and debug information</p>
|
||||||
<h2 className="text-lg font-semibold text-bolt-elements-textPrimary">Event Logs</h2>
|
|
||||||
<p className="text-sm text-bolt-elements-textSecondary">Track system events and debug information</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center gap-4">
|
||||||
<motion.button
|
<motion.button
|
||||||
onClick={handleRefresh}
|
onClick={handleRefresh}
|
||||||
disabled={isRefreshing}
|
className="p-2 rounded-lg text-purple-600 dark:text-purple-400 hover:bg-purple-50 dark:hover:bg-purple-900/20 transition-all duration-200"
|
||||||
className={classNames(
|
|
||||||
'p-2.5 rounded-lg',
|
|
||||||
'bg-purple-50/50 dark:bg-purple-900/10',
|
|
||||||
'text-purple-500 hover:text-purple-600',
|
|
||||||
'hover:bg-purple-100/50 dark:hover:bg-purple-900/20',
|
|
||||||
'focus:outline-none focus:ring-2 focus:ring-purple-500/20',
|
|
||||||
'transition-all duration-200 ease-in-out',
|
|
||||||
{ 'opacity-50 cursor-not-allowed': isRefreshing },
|
|
||||||
)}
|
|
||||||
whileHover={{ scale: 1.05 }}
|
whileHover={{ scale: 1.05 }}
|
||||||
whileTap={{ scale: 0.95 }}
|
whileTap={{ scale: 0.95 }}
|
||||||
title="Refresh logs"
|
animate={isRefreshing ? { rotate: 360 } : {}}
|
||||||
|
transition={isRefreshing ? { duration: 1, repeat: Infinity, ease: 'linear' } : {}}
|
||||||
>
|
>
|
||||||
<div className={classNames('text-lg transition-all duration-300', { 'animate-spin': isRefreshing })}>
|
<div className="i-ph:arrows-clockwise text-xl" />
|
||||||
<div className="i-ph:arrows-clockwise" />
|
|
||||||
</div>
|
|
||||||
</motion.button>
|
</motion.button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Controls Section */}
|
|
||||||
<div className="flex items-center justify-end gap-2 px-1">
|
|
||||||
<div className="flex items-center gap-6 p-1.5 rounded-lg bg-white/50 dark:bg-gray-800/30 border border-gray-200/50 dark:border-gray-700/50">
|
|
||||||
<motion.div
|
|
||||||
className="flex items-center gap-3"
|
|
||||||
whileHover={{ scale: 1.02 }}
|
|
||||||
transition={{ type: 'spring', stiffness: 400, damping: 20 }}
|
|
||||||
>
|
|
||||||
<span className="text-sm font-medium text-bolt-elements-textSecondary">Auto-scroll</span>
|
|
||||||
<Switch
|
|
||||||
checked={autoScroll}
|
|
||||||
onCheckedChange={setAutoScroll}
|
|
||||||
className="data-[state=checked]:bg-purple-500"
|
|
||||||
/>
|
|
||||||
</motion.div>
|
|
||||||
|
|
||||||
<div className="h-4 w-px bg-bolt-elements-borderColor" />
|
|
||||||
|
|
||||||
<motion.div
|
|
||||||
className="flex items-center gap-3"
|
|
||||||
whileHover={{ scale: 1.02 }}
|
|
||||||
transition={{ type: 'spring', stiffness: 400, damping: 20 }}
|
|
||||||
>
|
|
||||||
<span className="text-sm font-medium text-bolt-elements-textSecondary">24h Time</span>
|
|
||||||
<Switch
|
|
||||||
checked={use24Hour}
|
|
||||||
onCheckedChange={setUse24Hour}
|
|
||||||
className="data-[state=checked]:bg-purple-500"
|
|
||||||
/>
|
|
||||||
</motion.div>
|
|
||||||
|
|
||||||
<div className="h-4 w-px bg-bolt-elements-borderColor" />
|
|
||||||
|
|
||||||
<motion.div
|
|
||||||
className="flex items-center gap-3"
|
|
||||||
whileHover={{ scale: 1.02 }}
|
|
||||||
transition={{ type: 'spring', stiffness: 400, damping: 20 }}
|
|
||||||
>
|
|
||||||
<span className="text-sm font-medium text-bolt-elements-textSecondary">Expand All</span>
|
|
||||||
<Switch
|
|
||||||
checked={expandAll}
|
|
||||||
onCheckedChange={setExpandAll}
|
|
||||||
className="data-[state=checked]:bg-purple-500"
|
|
||||||
/>
|
|
||||||
</motion.div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Header with Search */}
|
{/* Top Controls */}
|
||||||
<div className="flex flex-col gap-4">
|
<div className="flex items-center gap-4">
|
||||||
<div className="relative w-72">
|
{/* Search */}
|
||||||
<div className="absolute left-2.5 top-1/2 -translate-y-1/2 text-bolt-elements-textTertiary">
|
<div className="flex-grow relative">
|
||||||
<div className="i-ph:magnifying-glass text-base" />
|
|
||||||
</div>
|
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Search logs..."
|
placeholder="Search logs..."
|
||||||
className={classNames(
|
|
||||||
'w-full pl-8 pr-3 py-1.5 rounded-md text-sm',
|
|
||||||
'bg-bolt-elements-background-depth-1 dark:bg-bolt-elements-background-depth-2',
|
|
||||||
'border border-bolt-elements-borderColor',
|
|
||||||
'text-bolt-elements-textPrimary placeholder-bolt-elements-textTertiary',
|
|
||||||
'focus:outline-none focus:ring-1 focus:ring-purple-500/30 focus:border-purple-500/30',
|
|
||||||
'transition-all duration-200',
|
|
||||||
)}
|
|
||||||
value={searchQuery}
|
value={searchQuery}
|
||||||
onChange={(e) => setSearchQuery(e.target.value)}
|
onChange={(e) => setSearchQuery(e.target.value)}
|
||||||
|
className="w-full px-3 py-1.5 pl-9 rounded-lg text-sm bg-white/50 dark:bg-gray-800/30 border border-gray-200/50 dark:border-gray-700/50"
|
||||||
/>
|
/>
|
||||||
|
<div className="absolute left-3 top-1/2 -translate-y-1/2 text-bolt-elements-textTertiary">
|
||||||
|
<div className="i-ph:magnifying-glass text-base" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Filters Row */}
|
{/* Right Controls */}
|
||||||
<div className="flex items-center -ml-1">
|
<div className="flex items-center gap-4">
|
||||||
<SegmentedGroup
|
<div className="flex items-center gap-2">
|
||||||
value={logLevel}
|
<Switch checked={showTimestamps} onCheckedChange={setShowTimestamps} />
|
||||||
onChange={(value) => setLogLevel(value as LogEntry['level'] | 'all')}
|
<span className="text-sm text-bolt-elements-textSecondary whitespace-nowrap">Show Timestamps</span>
|
||||||
options={logLevelOptions}
|
</div>
|
||||||
/>
|
|
||||||
<div className="mx-2 w-px h-4 bg-bolt-elements-borderColor" />
|
|
||||||
<SegmentedGroup
|
|
||||||
value={logCategory}
|
|
||||||
onChange={(value) => setLogCategory(value as LogEntry['category'] | 'all')}
|
|
||||||
options={logCategoryOptions}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Logs Display */}
|
<div className="flex items-center gap-2">
|
||||||
<div
|
<Switch checked={use24Hour} onCheckedChange={setUse24Hour} />
|
||||||
ref={logsContainerRef}
|
<span className="text-sm text-bolt-elements-textSecondary whitespace-nowrap">24h Time</span>
|
||||||
className="flex-1 overflow-auto rounded-lg bg-bolt-elements-background-depth-1 dark:bg-bolt-elements-background-depth-2"
|
</div>
|
||||||
onScroll={handleScroll}
|
|
||||||
>
|
<div className="flex items-center gap-2">
|
||||||
<div className="divide-y divide-bolt-elements-borderColor">
|
<Switch checked={autoExpand} onCheckedChange={setAutoExpand} />
|
||||||
{filteredLogs.map((log) => (
|
<span className="text-sm text-bolt-elements-textSecondary whitespace-nowrap">Auto Expand</span>
|
||||||
<LogEntryItem key={log.id} log={log} isExpanded={expandAll} use24Hour={use24Hour} />
|
</div>
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Status Bar */}
|
|
||||||
<div className="flex items-center justify-between py-2 px-4 text-sm text-bolt-elements-textSecondary">
|
|
||||||
<div className="flex items-center gap-6">
|
|
||||||
<span>{filteredLogs.length} logs displayed</span>
|
|
||||||
<span>{isScrolledToBottom ? 'Watching for new logs...' : 'Scroll to bottom to watch new logs'}</span>
|
|
||||||
</div>
|
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
<motion.button
|
<motion.button
|
||||||
onClick={handleExportLogs}
|
onClick={handleExportLogs}
|
||||||
className="flex items-center gap-2 px-3 py-1.5 text-sm bg-purple-500/10 text-purple-600 dark:text-purple-400 hover:bg-purple-500/20 rounded-md transition-colors"
|
className="flex items-center gap-2 px-4 py-1.5 rounded-lg text-sm bg-purple-500 hover:bg-purple-600 text-white transition-colors"
|
||||||
whileHover={{ scale: 1.02 }}
|
whileHover={{ scale: 1.02 }}
|
||||||
whileTap={{ scale: 0.98 }}
|
whileTap={{ scale: 0.98 }}
|
||||||
>
|
>
|
||||||
<div className="i-ph:download-simple" />
|
<div className="i-ph:download text-base" />
|
||||||
Export
|
Export Logs
|
||||||
</motion.button>
|
</motion.button>
|
||||||
<motion.button
|
</div>
|
||||||
onClick={handleClearLogs}
|
</div>
|
||||||
className="flex items-center gap-2 px-3 py-1.5 text-sm bg-red-500/10 text-red-600 dark:text-red-400 hover:bg-red-500/20 rounded-md transition-colors"
|
|
||||||
whileHover={{ scale: 1.02 }}
|
{/* Filters */}
|
||||||
whileTap={{ scale: 0.98 }}
|
<div className="flex items-center gap-4 -mt-2">
|
||||||
|
{/* Level Filter */}
|
||||||
|
<div ref={levelFilterRef} className="relative">
|
||||||
|
<button
|
||||||
|
onClick={() => {
|
||||||
|
setShowLevelFilter(!showLevelFilter);
|
||||||
|
setShowCategoryFilter(false);
|
||||||
|
}}
|
||||||
|
className="flex items-center gap-2 px-2 py-1 rounded hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors"
|
||||||
>
|
>
|
||||||
<div className="i-ph:trash" />
|
<div
|
||||||
Clear
|
className={classNames('text-sm', selectedLevelOption?.icon || 'i-ph:funnel')}
|
||||||
</motion.button>
|
style={{ color: selectedLevelOption?.color }}
|
||||||
|
/>
|
||||||
|
<div className="text-sm text-bolt-elements-textSecondary">{selectedLevelOption?.label || 'All Levels'}</div>
|
||||||
|
<div
|
||||||
|
className={classNames(
|
||||||
|
'i-ph:caret-down text-sm text-bolt-elements-textTertiary transition-transform',
|
||||||
|
showLevelFilter ? 'rotate-180' : '',
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
{showLevelFilter && (
|
||||||
|
<div className="absolute left-0 top-full mt-1 z-20">
|
||||||
|
<div className="p-1 rounded-lg shadow-lg bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700">
|
||||||
|
{logLevelOptions.map((option) => (
|
||||||
|
<button
|
||||||
|
key={option.value}
|
||||||
|
onClick={() => {
|
||||||
|
setSelectedLevel(option.value);
|
||||||
|
setShowLevelFilter(false);
|
||||||
|
}}
|
||||||
|
className={classNames(
|
||||||
|
'flex items-center gap-2 w-full px-3 py-1.5 rounded-md text-sm transition-colors',
|
||||||
|
option.value === selectedLevel
|
||||||
|
? 'bg-purple-100 dark:bg-purple-800/40 text-purple-900 dark:text-purple-200'
|
||||||
|
: 'hover:bg-gray-100 dark:hover:bg-gray-700/50',
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<div className={classNames(option.icon, 'text-base', option.color)} />
|
||||||
|
<span>{option.label}</span>
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="w-px h-4 bg-gray-200 dark:bg-gray-700" />
|
||||||
|
|
||||||
|
{/* Category Filter */}
|
||||||
|
<div ref={categoryFilterRef} className="relative">
|
||||||
|
<button
|
||||||
|
onClick={() => {
|
||||||
|
setShowCategoryFilter(!showCategoryFilter);
|
||||||
|
setShowLevelFilter(false);
|
||||||
|
}}
|
||||||
|
className="flex items-center gap-2 px-2 py-1 rounded hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className={classNames('text-sm', selectedCategoryOption?.icon || 'i-ph:squares-four')}
|
||||||
|
style={{ color: selectedCategoryOption?.color }}
|
||||||
|
/>
|
||||||
|
<div className="text-sm text-bolt-elements-textSecondary">
|
||||||
|
{selectedCategoryOption?.label || 'All Categories'}
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className={classNames(
|
||||||
|
'i-ph:caret-down text-sm text-bolt-elements-textTertiary transition-transform',
|
||||||
|
showCategoryFilter ? 'rotate-180' : '',
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
{showCategoryFilter && (
|
||||||
|
<div className="absolute left-0 top-full mt-1 z-20">
|
||||||
|
<div className="p-1 rounded-lg shadow-lg bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700">
|
||||||
|
{logCategoryOptions.map((option) => (
|
||||||
|
<button
|
||||||
|
key={option.value}
|
||||||
|
onClick={() => {
|
||||||
|
setSelectedCategory(option.value);
|
||||||
|
setShowCategoryFilter(false);
|
||||||
|
}}
|
||||||
|
className={classNames(
|
||||||
|
'flex items-center gap-2 w-full px-3 py-1.5 rounded-md text-sm transition-colors',
|
||||||
|
option.value === selectedCategory
|
||||||
|
? 'bg-purple-100 dark:bg-purple-800/40 text-purple-900 dark:text-purple-200'
|
||||||
|
: 'hover:bg-gray-100 dark:hover:bg-gray-700/50',
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<div className={classNames(option.icon, 'text-base', option.color)} />
|
||||||
|
<span>{option.label}</span>
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Logs Container */}
|
||||||
|
<div
|
||||||
|
ref={logsContainerRef}
|
||||||
|
className="flex-grow overflow-y-auto rounded-lg bg-white/50 dark:bg-gray-800/30 border border-gray-200/50 dark:border-gray-700/50"
|
||||||
|
>
|
||||||
|
<div className="divide-y divide-gray-200/50 dark:divide-gray-700/50">
|
||||||
|
{filteredLogs.map((log) => (
|
||||||
|
<LogEntryItem
|
||||||
|
key={log.id}
|
||||||
|
log={log}
|
||||||
|
isExpanded={autoExpand}
|
||||||
|
use24Hour={use24Hour}
|
||||||
|
showTimestamp={showTimestamps}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -11,6 +11,7 @@ import {
|
|||||||
Tooltip,
|
Tooltip,
|
||||||
Legend,
|
Legend,
|
||||||
} from 'chart.js';
|
} from 'chart.js';
|
||||||
|
import { toast } from 'react-toastify'; // Import toast
|
||||||
|
|
||||||
// Register ChartJS components
|
// Register ChartJS components
|
||||||
ChartJS.register(CategoryScale, LinearScale, PointElement, LineElement, Title, Tooltip, Legend);
|
ChartJS.register(CategoryScale, LinearScale, PointElement, LineElement, Title, Tooltip, Legend);
|
||||||
@ -120,8 +121,18 @@ export default function TaskManagerTab() {
|
|||||||
metrics: false,
|
metrics: false,
|
||||||
processes: false,
|
processes: false,
|
||||||
});
|
});
|
||||||
const [energySaverMode, setEnergySaverMode] = useState(false);
|
const [energySaverMode, setEnergySaverMode] = useState<boolean>(() => {
|
||||||
const [autoEnergySaver, setAutoEnergySaver] = useState(true);
|
// Initialize from localStorage, default to false
|
||||||
|
const saved = localStorage.getItem('energySaverMode');
|
||||||
|
return saved ? JSON.parse(saved) : false;
|
||||||
|
});
|
||||||
|
|
||||||
|
const [autoEnergySaver, setAutoEnergySaver] = useState<boolean>(() => {
|
||||||
|
// Initialize from localStorage, default to false
|
||||||
|
const saved = localStorage.getItem('autoEnergySaver');
|
||||||
|
return saved ? JSON.parse(saved) : false;
|
||||||
|
});
|
||||||
|
|
||||||
const [energySavings, setEnergySavings] = useState<EnergySavings>({
|
const [energySavings, setEnergySavings] = useState<EnergySavings>({
|
||||||
updatesReduced: 0,
|
updatesReduced: 0,
|
||||||
timeInSaverMode: 0,
|
timeInSaverMode: 0,
|
||||||
@ -130,6 +141,26 @@ export default function TaskManagerTab() {
|
|||||||
|
|
||||||
const saverModeStartTime = useRef<number | null>(null);
|
const saverModeStartTime = useRef<number | null>(null);
|
||||||
|
|
||||||
|
// Handle energy saver mode changes
|
||||||
|
const handleEnergySaverChange = (checked: boolean) => {
|
||||||
|
setEnergySaverMode(checked);
|
||||||
|
localStorage.setItem('energySaverMode', JSON.stringify(checked));
|
||||||
|
toast.success(checked ? 'Energy Saver mode enabled' : 'Energy Saver mode disabled');
|
||||||
|
};
|
||||||
|
|
||||||
|
// Handle auto energy saver changes
|
||||||
|
const handleAutoEnergySaverChange = (checked: boolean) => {
|
||||||
|
setAutoEnergySaver(checked);
|
||||||
|
localStorage.setItem('autoEnergySaver', JSON.stringify(checked));
|
||||||
|
toast.success(checked ? 'Auto Energy Saver enabled' : 'Auto Energy Saver disabled');
|
||||||
|
|
||||||
|
if (!checked) {
|
||||||
|
// When disabling auto mode, also disable energy saver mode
|
||||||
|
setEnergySaverMode(false);
|
||||||
|
localStorage.setItem('energySaverMode', 'false');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Calculate energy savings
|
// Calculate energy savings
|
||||||
const updateEnergySavings = useCallback(() => {
|
const updateEnergySavings = useCallback(() => {
|
||||||
if (!energySaverMode) {
|
if (!energySaverMode) {
|
||||||
@ -163,17 +194,25 @@ export default function TaskManagerTab() {
|
|||||||
}, [energySaverMode]);
|
}, [energySaverMode]);
|
||||||
|
|
||||||
useEffect((): (() => void) | undefined => {
|
useEffect((): (() => void) | undefined => {
|
||||||
if (energySaverMode) {
|
if (!energySaverMode) {
|
||||||
const savingsInterval = setInterval(updateEnergySavings, 1000);
|
// Clear any existing intervals and reset savings when disabled
|
||||||
return () => clearInterval(savingsInterval);
|
setEnergySavings({
|
||||||
|
updatesReduced: 0,
|
||||||
|
timeInSaverMode: 0,
|
||||||
|
estimatedEnergySaved: 0,
|
||||||
|
});
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
return undefined;
|
const savingsInterval = setInterval(updateEnergySavings, 1000);
|
||||||
|
|
||||||
|
return () => clearInterval(savingsInterval);
|
||||||
}, [energySaverMode, updateEnergySavings]);
|
}, [energySaverMode, updateEnergySavings]);
|
||||||
|
|
||||||
// Auto energy saver effect
|
|
||||||
useEffect((): (() => void) | undefined => {
|
useEffect((): (() => void) | undefined => {
|
||||||
if (!autoEnergySaver) {
|
if (!autoEnergySaver) {
|
||||||
|
// If auto mode is disabled, clear any forced energy saver state
|
||||||
|
setEnergySaverMode(false);
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,18 +233,6 @@ export default function TaskManagerTab() {
|
|||||||
return () => clearInterval(batteryCheckInterval);
|
return () => clearInterval(batteryCheckInterval);
|
||||||
}, [autoEnergySaver]);
|
}, [autoEnergySaver]);
|
||||||
|
|
||||||
const getStatusColor = (status: 'active' | 'idle' | 'suspended'): string => {
|
|
||||||
if (status === 'active') {
|
|
||||||
return 'text-green-500';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (status === 'suspended') {
|
|
||||||
return 'text-yellow-500';
|
|
||||||
}
|
|
||||||
|
|
||||||
return 'text-gray-400';
|
|
||||||
};
|
|
||||||
|
|
||||||
const getUsageColor = (usage: number): string => {
|
const getUsageColor = (usage: number): string => {
|
||||||
if (usage > 80) {
|
if (usage > 80) {
|
||||||
return 'text-red-500';
|
return 'text-red-500';
|
||||||
@ -215,7 +242,7 @@ export default function TaskManagerTab() {
|
|||||||
return 'text-yellow-500';
|
return 'text-yellow-500';
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'text-green-500';
|
return 'text-gray-500';
|
||||||
};
|
};
|
||||||
|
|
||||||
const getImpactColor = (impact: 'high' | 'medium' | 'low'): string => {
|
const getImpactColor = (impact: 'high' | 'medium' | 'low'): string => {
|
||||||
@ -227,7 +254,7 @@ export default function TaskManagerTab() {
|
|||||||
return 'text-yellow-500';
|
return 'text-yellow-500';
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'text-green-500';
|
return 'text-gray-500';
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderUsageGraph = (data: number[], label: string, color: string) => {
|
const renderUsageGraph = (data: number[], label: string, color: string) => {
|
||||||
@ -359,7 +386,7 @@ export default function TaskManagerTab() {
|
|||||||
type: 'Network',
|
type: 'Network',
|
||||||
cpuUsage: Math.random() * 5,
|
cpuUsage: Math.random() * 5,
|
||||||
memoryUsage: Math.random() * 50,
|
memoryUsage: Math.random() * 50,
|
||||||
status: 'active',
|
status: 'idle',
|
||||||
lastUpdate: new Date().toISOString(),
|
lastUpdate: new Date().toISOString(),
|
||||||
impact: 'high',
|
impact: 'high',
|
||||||
},
|
},
|
||||||
@ -368,7 +395,7 @@ export default function TaskManagerTab() {
|
|||||||
type: 'Animation',
|
type: 'Animation',
|
||||||
cpuUsage: Math.random() * 3,
|
cpuUsage: Math.random() * 3,
|
||||||
memoryUsage: Math.random() * 30,
|
memoryUsage: Math.random() * 30,
|
||||||
status: 'active',
|
status: 'idle',
|
||||||
lastUpdate: new Date().toISOString(),
|
lastUpdate: new Date().toISOString(),
|
||||||
impact: 'medium',
|
impact: 'medium',
|
||||||
},
|
},
|
||||||
@ -386,7 +413,7 @@ export default function TaskManagerTab() {
|
|||||||
type: 'Storage',
|
type: 'Storage',
|
||||||
cpuUsage: Math.random() * 1,
|
cpuUsage: Math.random() * 1,
|
||||||
memoryUsage: Math.random() * 15,
|
memoryUsage: Math.random() * 15,
|
||||||
status: 'active',
|
status: 'idle',
|
||||||
lastUpdate: new Date().toISOString(),
|
lastUpdate: new Date().toISOString(),
|
||||||
impact: 'low',
|
impact: 'low',
|
||||||
},
|
},
|
||||||
@ -395,7 +422,7 @@ export default function TaskManagerTab() {
|
|||||||
type: 'Network',
|
type: 'Network',
|
||||||
cpuUsage: Math.random() * 2,
|
cpuUsage: Math.random() * 2,
|
||||||
memoryUsage: Math.random() * 10,
|
memoryUsage: Math.random() * 10,
|
||||||
status: 'active',
|
status: 'idle',
|
||||||
lastUpdate: new Date().toISOString(),
|
lastUpdate: new Date().toISOString(),
|
||||||
impact: 'medium',
|
impact: 'medium',
|
||||||
},
|
},
|
||||||
@ -444,7 +471,7 @@ export default function TaskManagerTab() {
|
|||||||
type="checkbox"
|
type="checkbox"
|
||||||
id="autoEnergySaver"
|
id="autoEnergySaver"
|
||||||
checked={autoEnergySaver}
|
checked={autoEnergySaver}
|
||||||
onChange={(e) => setAutoEnergySaver(e.target.checked)}
|
onChange={(e) => handleAutoEnergySaverChange(e.target.checked)}
|
||||||
className="form-checkbox h-4 w-4 text-purple-600 rounded border-gray-300 dark:border-gray-700"
|
className="form-checkbox h-4 w-4 text-purple-600 rounded border-gray-300 dark:border-gray-700"
|
||||||
/>
|
/>
|
||||||
<label htmlFor="autoEnergySaver" className="text-sm text-bolt-elements-textSecondary">
|
<label htmlFor="autoEnergySaver" className="text-sm text-bolt-elements-textSecondary">
|
||||||
@ -456,7 +483,7 @@ export default function TaskManagerTab() {
|
|||||||
type="checkbox"
|
type="checkbox"
|
||||||
id="energySaver"
|
id="energySaver"
|
||||||
checked={energySaverMode}
|
checked={energySaverMode}
|
||||||
onChange={(e) => !autoEnergySaver && setEnergySaverMode(e.target.checked)}
|
onChange={(e) => !autoEnergySaver && handleEnergySaverChange(e.target.checked)}
|
||||||
disabled={autoEnergySaver}
|
disabled={autoEnergySaver}
|
||||||
className="form-checkbox h-4 w-4 text-purple-600 rounded border-gray-300 dark:border-gray-700 disabled:opacity-50"
|
className="form-checkbox h-4 w-4 text-purple-600 rounded border-gray-300 dark:border-gray-700 disabled:opacity-50"
|
||||||
/>
|
/>
|
||||||
@ -465,7 +492,7 @@ export default function TaskManagerTab() {
|
|||||||
className={classNames('text-sm text-bolt-elements-textSecondary', { 'opacity-50': autoEnergySaver })}
|
className={classNames('text-sm text-bolt-elements-textSecondary', { 'opacity-50': autoEnergySaver })}
|
||||||
>
|
>
|
||||||
Energy Saver
|
Energy Saver
|
||||||
{energySaverMode && <span className="ml-2 text-xs text-green-500">Active</span>}
|
{energySaverMode && <span className="ml-2 text-xs text-bolt-elements-textSecondary">Active</span>}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -502,7 +529,7 @@ export default function TaskManagerTab() {
|
|||||||
<p className="text-lg font-medium text-bolt-elements-textPrimary">
|
<p className="text-lg font-medium text-bolt-elements-textPrimary">
|
||||||
{Math.round(metrics.battery.level)}%
|
{Math.round(metrics.battery.level)}%
|
||||||
{metrics.battery.charging && (
|
{metrics.battery.charging && (
|
||||||
<span className="ml-2 text-green-500">
|
<span className="ml-2 text-bolt-elements-textSecondary">
|
||||||
<div className="i-ph:lightning-fill w-4 h-4 inline-block" />
|
<div className="i-ph:lightning-fill w-4 h-4 inline-block" />
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
@ -597,10 +624,9 @@ export default function TaskManagerTab() {
|
|||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td className="py-3 px-4">
|
<td className="py-3 px-4">
|
||||||
<div className="flex items-center gap-2">
|
<span className={classNames('text-sm text-bolt-elements-textSecondary capitalize')}>
|
||||||
<div className={classNames('w-2 h-2 rounded-full', getStatusColor(process.status))} />
|
{process.status}
|
||||||
<span className="text-sm text-bolt-elements-textSecondary capitalize">{process.status}</span>
|
</span>
|
||||||
</div>
|
|
||||||
</td>
|
</td>
|
||||||
<td className="py-3 px-4">
|
<td className="py-3 px-4">
|
||||||
<span className={classNames('text-sm', getImpactColor(process.impact))}>{process.impact}</span>
|
<span className={classNames('text-sm', getImpactColor(process.impact))}>{process.impact}</span>
|
||||||
|
@ -707,7 +707,7 @@ const UpdateTab = () => {
|
|||||||
<div className="max-h-[400px] overflow-y-auto">
|
<div className="max-h-[400px] overflow-y-auto">
|
||||||
{categorizeChangelog(updateInfo.changelog).map(([category, messages]) => (
|
{categorizeChangelog(updateInfo.changelog).map(([category, messages]) => (
|
||||||
<div key={category} className="border-b last:border-b-0 border-bolt-elements-borderColor">
|
<div key={category} className="border-b last:border-b-0 border-bolt-elements-borderColor">
|
||||||
<div className="p-3 bg-bolt-elements-bg-depth-4">
|
<div className="p-3 bg-[#EAEAEA] dark:bg-[#2A2A2A]">
|
||||||
<h5 className="text-sm font-medium text-bolt-elements-textPrimary">
|
<h5 className="text-sm font-medium text-bolt-elements-textPrimary">
|
||||||
{category}
|
{category}
|
||||||
<span className="ml-2 text-xs text-bolt-elements-textSecondary">
|
<span className="ml-2 text-xs text-bolt-elements-textSecondary">
|
||||||
|
@ -10,10 +10,12 @@ export interface LogEntry {
|
|||||||
level: 'info' | 'warning' | 'error' | 'debug';
|
level: 'info' | 'warning' | 'error' | 'debug';
|
||||||
message: string;
|
message: string;
|
||||||
details?: Record<string, any>;
|
details?: Record<string, any>;
|
||||||
category: 'system' | 'provider' | 'user' | 'error' | 'api' | 'auth' | 'database' | 'network';
|
category: 'system' | 'provider' | 'user' | 'error' | 'api' | 'auth' | 'database' | 'network' | 'performance';
|
||||||
subCategory?: string;
|
subCategory?: string;
|
||||||
duration?: number;
|
duration?: number;
|
||||||
statusCode?: number;
|
statusCode?: number;
|
||||||
|
source?: string;
|
||||||
|
stack?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MAX_LOGS = 1000; // Maximum number of logs to keep in memory
|
const MAX_LOGS = 1000; // Maximum number of logs to keep in memory
|
||||||
@ -109,6 +111,8 @@ class LogStore {
|
|||||||
level: LogEntry['level'] = 'info',
|
level: LogEntry['level'] = 'info',
|
||||||
category: LogEntry['category'] = 'system',
|
category: LogEntry['category'] = 'system',
|
||||||
details?: Record<string, any>,
|
details?: Record<string, any>,
|
||||||
|
statusCode?: number,
|
||||||
|
duration?: number,
|
||||||
) {
|
) {
|
||||||
const id = this._generateId();
|
const id = this._generateId();
|
||||||
const entry: LogEntry = {
|
const entry: LogEntry = {
|
||||||
@ -118,6 +122,8 @@ class LogStore {
|
|||||||
message,
|
message,
|
||||||
details,
|
details,
|
||||||
category,
|
category,
|
||||||
|
statusCode,
|
||||||
|
duration,
|
||||||
};
|
};
|
||||||
|
|
||||||
this._logs.setKey(id, entry);
|
this._logs.setKey(id, entry);
|
||||||
@ -262,6 +268,94 @@ class LogStore {
|
|||||||
this._readLogs.clear();
|
this._readLogs.clear();
|
||||||
this._saveReadLogs();
|
this._saveReadLogs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Network request logging
|
||||||
|
logNetworkRequest(
|
||||||
|
method: string,
|
||||||
|
url: string,
|
||||||
|
statusCode: number,
|
||||||
|
duration: number,
|
||||||
|
requestData?: any,
|
||||||
|
responseData?: any,
|
||||||
|
) {
|
||||||
|
this.addLog(
|
||||||
|
`${method} ${url}`,
|
||||||
|
statusCode >= 400 ? 'error' : 'info',
|
||||||
|
'network',
|
||||||
|
{
|
||||||
|
method,
|
||||||
|
url,
|
||||||
|
statusCode,
|
||||||
|
duration,
|
||||||
|
request: requestData,
|
||||||
|
response: responseData,
|
||||||
|
},
|
||||||
|
statusCode,
|
||||||
|
duration,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Authentication events
|
||||||
|
logAuthEvent(event: string, success: boolean, details?: Record<string, any>) {
|
||||||
|
this.addLog(`Auth ${event} ${success ? 'succeeded' : 'failed'}`, success ? 'info' : 'error', 'auth', details);
|
||||||
|
}
|
||||||
|
|
||||||
|
// API interactions
|
||||||
|
logApiCall(
|
||||||
|
endpoint: string,
|
||||||
|
method: string,
|
||||||
|
statusCode: number,
|
||||||
|
duration: number,
|
||||||
|
requestData?: any,
|
||||||
|
responseData?: any,
|
||||||
|
) {
|
||||||
|
this.addLog(
|
||||||
|
`API ${method} ${endpoint}`,
|
||||||
|
statusCode >= 400 ? 'error' : 'info',
|
||||||
|
'api',
|
||||||
|
{
|
||||||
|
endpoint,
|
||||||
|
method,
|
||||||
|
statusCode,
|
||||||
|
duration,
|
||||||
|
request: requestData,
|
||||||
|
response: responseData,
|
||||||
|
},
|
||||||
|
statusCode,
|
||||||
|
duration,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Performance monitoring
|
||||||
|
logPerformance(operation: string, duration: number, details?: Record<string, any>) {
|
||||||
|
this.addLog(
|
||||||
|
`Performance: ${operation}`,
|
||||||
|
duration > 1000 ? 'warning' : 'info',
|
||||||
|
'performance',
|
||||||
|
{
|
||||||
|
operation,
|
||||||
|
duration,
|
||||||
|
...details,
|
||||||
|
},
|
||||||
|
undefined,
|
||||||
|
duration,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Error logging with stack trace
|
||||||
|
logErrorWithStack(error: Error, category: LogEntry['category'] = 'error', details?: Record<string, any>) {
|
||||||
|
this.addLog(error.message, 'error', category, {
|
||||||
|
...details,
|
||||||
|
name: error.name,
|
||||||
|
stack: error.stack,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Refresh logs (useful for real-time updates)
|
||||||
|
refreshLogs() {
|
||||||
|
const currentLogs = this._logs.get();
|
||||||
|
this._logs.set({ ...currentLogs });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const logStore = new LogStore();
|
export const logStore = new LogStore();
|
||||||
|
45
app/routes/api.system.app-info.ts
Normal file
45
app/routes/api.system.app-info.ts
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
import type { ActionFunctionArgs } from '@remix-run/cloudflare';
|
||||||
|
import { json } from '@remix-run/cloudflare';
|
||||||
|
|
||||||
|
interface PackageJson {
|
||||||
|
name: string;
|
||||||
|
version: string;
|
||||||
|
description: string;
|
||||||
|
license: string;
|
||||||
|
dependencies: Record<string, string>;
|
||||||
|
devDependencies: Record<string, string>;
|
||||||
|
}
|
||||||
|
|
||||||
|
const packageJson = {
|
||||||
|
name: 'bolt.diy',
|
||||||
|
version: '0.1.0',
|
||||||
|
description: 'A DIY LLM interface',
|
||||||
|
license: 'MIT',
|
||||||
|
dependencies: {
|
||||||
|
'@remix-run/cloudflare': '^2.0.0',
|
||||||
|
react: '^18.0.0',
|
||||||
|
'react-dom': '^18.0.0',
|
||||||
|
typescript: '^5.0.0',
|
||||||
|
},
|
||||||
|
devDependencies: {
|
||||||
|
'@types/react': '^18.0.0',
|
||||||
|
'@types/react-dom': '^18.0.0',
|
||||||
|
},
|
||||||
|
} as PackageJson;
|
||||||
|
|
||||||
|
export const action = async ({ request: _request }: ActionFunctionArgs) => {
|
||||||
|
try {
|
||||||
|
return json({
|
||||||
|
name: packageJson.name,
|
||||||
|
version: packageJson.version,
|
||||||
|
description: packageJson.description,
|
||||||
|
license: packageJson.license,
|
||||||
|
nodeVersion: process.version,
|
||||||
|
dependencies: packageJson.dependencies,
|
||||||
|
devDependencies: packageJson.devDependencies,
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to get webapp info:', error);
|
||||||
|
return json({ error: 'Failed to get webapp information' }, { status: 500 });
|
||||||
|
}
|
||||||
|
};
|
214
changelogUI.md
214
changelogUI.md
@ -1,214 +0,0 @@
|
|||||||
# Bolt DIY UI Overhaul
|
|
||||||
|
|
||||||
## New User Interface Features
|
|
||||||
|
|
||||||
### 🎨 Redesigned Control Panel
|
|
||||||
|
|
||||||
The Bolt DIY interface has been completely redesigned with a modern, intuitive layout featuring two main components:
|
|
||||||
|
|
||||||
1. **Users Window** - Main control panel for regular users
|
|
||||||
2. **Developer Window** - Advanced settings and debugging tools
|
|
||||||
|
|
||||||
### 💡 Core Features
|
|
||||||
|
|
||||||
- **Drag & Drop Tab Management**: Customize tab order in both User and Developer windows
|
|
||||||
- **Dynamic Status Updates**: Real-time status indicators for updates, notifications, and system health
|
|
||||||
- **Responsive Design**: Beautiful transitions and animations using Framer Motion
|
|
||||||
- **Dark/Light Mode Support**: Full theme support with consistent styling
|
|
||||||
- **Improved Accessibility**: Using Radix UI primitives for better accessibility
|
|
||||||
- **Enhanced Provider Management**: Split view for local and cloud providers
|
|
||||||
- **Resource Monitoring**: New Task Manager for system performance tracking
|
|
||||||
|
|
||||||
### 🎯 Tab Overview
|
|
||||||
|
|
||||||
#### User Window Tabs
|
|
||||||
|
|
||||||
1. **Profile**
|
|
||||||
|
|
||||||
- Manage user profile and account settings
|
|
||||||
- Avatar customization
|
|
||||||
- Account preferences
|
|
||||||
|
|
||||||
2. **Settings**
|
|
||||||
|
|
||||||
- Configure application preferences
|
|
||||||
- Customize UI behavior
|
|
||||||
- Manage general settings
|
|
||||||
|
|
||||||
3. **Notifications**
|
|
||||||
|
|
||||||
- Real-time notification center
|
|
||||||
- Unread notification tracking
|
|
||||||
- Notification preferences
|
|
||||||
|
|
||||||
4. **Features**
|
|
||||||
|
|
||||||
- Explore new and upcoming features
|
|
||||||
- Feature preview toggles
|
|
||||||
- Early access options
|
|
||||||
|
|
||||||
5. **Data**
|
|
||||||
|
|
||||||
- Data management tools
|
|
||||||
- Storage settings
|
|
||||||
- Backup and restore options
|
|
||||||
|
|
||||||
6. **Cloud Providers**
|
|
||||||
|
|
||||||
- Configure cloud-based AI providers
|
|
||||||
- API key management
|
|
||||||
- Cloud model selection
|
|
||||||
- Provider-specific settings
|
|
||||||
- Status monitoring for each provider
|
|
||||||
|
|
||||||
7. **Local Providers**
|
|
||||||
|
|
||||||
- Manage local AI models
|
|
||||||
- Ollama integration and model updates
|
|
||||||
- LM Studio configuration
|
|
||||||
- Local inference settings
|
|
||||||
- Model download and updates
|
|
||||||
|
|
||||||
8. **Task Manager**
|
|
||||||
|
|
||||||
- System resource monitoring
|
|
||||||
- Process management
|
|
||||||
- Performance metrics
|
|
||||||
- Resource usage graphs
|
|
||||||
- Alert configurations
|
|
||||||
|
|
||||||
9. **Connection**
|
|
||||||
|
|
||||||
- Network status monitoring
|
|
||||||
- Connection health metrics
|
|
||||||
- Troubleshooting tools
|
|
||||||
- Latency tracking
|
|
||||||
- Auto-reconnect settings
|
|
||||||
|
|
||||||
10. **Debug**
|
|
||||||
|
|
||||||
- System diagnostics
|
|
||||||
- Performance monitoring
|
|
||||||
- Error tracking
|
|
||||||
- Provider status checks
|
|
||||||
- System information
|
|
||||||
|
|
||||||
11. **Event Logs**
|
|
||||||
|
|
||||||
- Comprehensive system logs
|
|
||||||
- Filtered log views
|
|
||||||
- Log management tools
|
|
||||||
- Error tracking
|
|
||||||
- Performance metrics
|
|
||||||
|
|
||||||
12. **Update**
|
|
||||||
- Version management
|
|
||||||
- Update notifications
|
|
||||||
- Release notes
|
|
||||||
- Auto-update configuration
|
|
||||||
|
|
||||||
#### Developer Window Enhancements
|
|
||||||
|
|
||||||
- **Advanced Tab Management**
|
|
||||||
|
|
||||||
- Fine-grained control over tab visibility
|
|
||||||
- Custom tab ordering
|
|
||||||
- Tab permission management
|
|
||||||
- Category-based organization
|
|
||||||
|
|
||||||
- **Developer Tools**
|
|
||||||
- Enhanced debugging capabilities
|
|
||||||
- System metrics and monitoring
|
|
||||||
- Performance optimization tools
|
|
||||||
- Advanced logging features
|
|
||||||
|
|
||||||
### 🚀 UI Improvements
|
|
||||||
|
|
||||||
1. **Enhanced Navigation**
|
|
||||||
|
|
||||||
- Intuitive back navigation
|
|
||||||
- Breadcrumb-style header
|
|
||||||
- Context-aware menu system
|
|
||||||
- Improved tab organization
|
|
||||||
|
|
||||||
2. **Status Indicators**
|
|
||||||
|
|
||||||
- Dynamic update badges
|
|
||||||
- Real-time connection status
|
|
||||||
- System health monitoring
|
|
||||||
- Provider status tracking
|
|
||||||
|
|
||||||
3. **Profile Integration**
|
|
||||||
|
|
||||||
- Quick access profile menu
|
|
||||||
- Avatar support
|
|
||||||
- Fast settings access
|
|
||||||
- Personalization options
|
|
||||||
|
|
||||||
4. **Accessibility Features**
|
|
||||||
- Keyboard navigation
|
|
||||||
- Screen reader support
|
|
||||||
- Focus management
|
|
||||||
- ARIA attributes
|
|
||||||
|
|
||||||
### 🛠 Technical Enhancements
|
|
||||||
|
|
||||||
- **State Management**
|
|
||||||
|
|
||||||
- Nano Stores for efficient state handling
|
|
||||||
- Persistent settings storage
|
|
||||||
- Real-time state synchronization
|
|
||||||
- Provider state management
|
|
||||||
|
|
||||||
- **Performance Optimizations**
|
|
||||||
|
|
||||||
- Lazy loading of tab contents
|
|
||||||
- Efficient DOM updates
|
|
||||||
- Optimized animations
|
|
||||||
- Resource monitoring
|
|
||||||
|
|
||||||
- **Developer Experience**
|
|
||||||
- Improved error handling
|
|
||||||
- Better debugging tools
|
|
||||||
- Enhanced logging system
|
|
||||||
- Performance profiling
|
|
||||||
|
|
||||||
### 🎯 Future Roadmap
|
|
||||||
|
|
||||||
- [ ] Additional customization options
|
|
||||||
- [ ] Enhanced theme support
|
|
||||||
- [ ] More developer tools
|
|
||||||
- [ ] Extended API integrations
|
|
||||||
- [ ] Advanced monitoring capabilities
|
|
||||||
- [ ] Custom provider plugins
|
|
||||||
- [ ] Enhanced resource management
|
|
||||||
- [ ] Advanced debugging features
|
|
||||||
|
|
||||||
## 🔧 Technical Details
|
|
||||||
|
|
||||||
### Dependencies
|
|
||||||
|
|
||||||
- Radix UI for accessible components
|
|
||||||
- Framer Motion for animations
|
|
||||||
- React DnD for drag and drop
|
|
||||||
- Nano Stores for state management
|
|
||||||
|
|
||||||
### Browser Support
|
|
||||||
|
|
||||||
- Modern browsers (Chrome, Firefox, Safari, Edge)
|
|
||||||
- Progressive enhancement for older browsers
|
|
||||||
|
|
||||||
### Performance
|
|
||||||
|
|
||||||
- Optimized bundle size
|
|
||||||
- Efficient state updates
|
|
||||||
- Minimal re-renders
|
|
||||||
- Resource-aware operations
|
|
||||||
|
|
||||||
## 📝 Contributing
|
|
||||||
|
|
||||||
We welcome contributions! Please see our contributing guidelines for more information.
|
|
||||||
|
|
||||||
## 📄 License
|
|
||||||
|
|
||||||
MIT License - see LICENSE for details
|
|
Loading…
Reference in New Issue
Block a user