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.
This commit is contained in:
@@ -2,27 +2,107 @@ export interface UpdateCheckResult {
|
||||
available: boolean;
|
||||
version: string;
|
||||
releaseNotes?: string;
|
||||
error?: {
|
||||
type: 'rate_limit' | 'network' | 'auth' | 'unknown';
|
||||
message: string;
|
||||
};
|
||||
}
|
||||
|
||||
interface PackageJson {
|
||||
version: string;
|
||||
name: string;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
function compareVersions(v1: string, v2: string): number {
|
||||
// Remove 'v' prefix if present
|
||||
const version1 = v1.replace(/^v/, '');
|
||||
const version2 = v2.replace(/^v/, '');
|
||||
|
||||
const parts1 = version1.split('.').map(Number);
|
||||
const parts2 = version2.split('.').map(Number);
|
||||
|
||||
for (let i = 0; i < Math.max(parts1.length, parts2.length); i++) {
|
||||
const part1 = parts1[i] || 0;
|
||||
const part2 = parts2[i] || 0;
|
||||
|
||||
if (part1 !== part2) {
|
||||
return part1 - part2;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
export const checkForUpdates = async (): Promise<UpdateCheckResult> => {
|
||||
/*
|
||||
* TODO: Implement actual update check logic
|
||||
* This is a mock implementation
|
||||
*/
|
||||
return {
|
||||
available: Math.random() > 0.7, // 30% chance of update
|
||||
version: '1.0.1',
|
||||
releaseNotes: 'Bug fixes and performance improvements',
|
||||
};
|
||||
try {
|
||||
// Get the current version from local package.json
|
||||
const packageResponse = await fetch('/package.json');
|
||||
|
||||
if (!packageResponse.ok) {
|
||||
throw new Error('Failed to fetch local package.json');
|
||||
}
|
||||
|
||||
const packageData = (await packageResponse.json()) as PackageJson;
|
||||
|
||||
if (!packageData.version || typeof packageData.version !== 'string') {
|
||||
throw new Error('Invalid package.json format: missing or invalid version');
|
||||
}
|
||||
|
||||
const currentVersion = packageData.version;
|
||||
|
||||
/*
|
||||
* Get the latest version from GitHub's main branch package.json
|
||||
* Using raw.githubusercontent.com which doesn't require authentication
|
||||
*/
|
||||
const latestPackageResponse = await fetch(
|
||||
'https://raw.githubusercontent.com/stackblitz-labs/bolt.diy/main/package.json',
|
||||
);
|
||||
|
||||
if (!latestPackageResponse.ok) {
|
||||
throw new Error(`Failed to fetch latest package.json: ${latestPackageResponse.status}`);
|
||||
}
|
||||
|
||||
const latestPackageData = (await latestPackageResponse.json()) as PackageJson;
|
||||
|
||||
if (!latestPackageData.version || typeof latestPackageData.version !== 'string') {
|
||||
throw new Error('Invalid remote package.json format: missing or invalid version');
|
||||
}
|
||||
|
||||
const latestVersion = latestPackageData.version;
|
||||
|
||||
// Compare versions semantically
|
||||
const hasUpdate = compareVersions(latestVersion, currentVersion) > 0;
|
||||
|
||||
return {
|
||||
available: hasUpdate,
|
||||
version: latestVersion,
|
||||
releaseNotes: hasUpdate ? 'Update available. Check GitHub for release notes.' : undefined,
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('Error checking for updates:', error);
|
||||
|
||||
// Determine error type
|
||||
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
||||
const isNetworkError =
|
||||
errorMessage.toLowerCase().includes('network') || errorMessage.toLowerCase().includes('fetch');
|
||||
|
||||
return {
|
||||
available: false,
|
||||
version: 'unknown',
|
||||
error: {
|
||||
type: isNetworkError ? 'network' : 'unknown',
|
||||
message: `Failed to check for updates: ${errorMessage}`,
|
||||
},
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
export const acknowledgeUpdate = async (version: string): Promise<void> => {
|
||||
/*
|
||||
* TODO: Implement actual update acknowledgment logic
|
||||
* This is a mock implementation that would typically:
|
||||
* 1. Store the acknowledged version in a persistent store
|
||||
* 2. Update the UI state
|
||||
* 3. Potentially send analytics
|
||||
*/
|
||||
console.log(`Acknowledging update version ${version}`);
|
||||
// Store the acknowledged version in localStorage
|
||||
try {
|
||||
localStorage.setItem('last_acknowledged_update', version);
|
||||
} catch (error) {
|
||||
console.error('Failed to store acknowledged version:', error);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user