mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-30 14:22:02 +00:00
- Added ErrorState component to display error messages with retry functionality, enhancing user experience during issue loading failures. - Implemented LoadingState component to provide visual feedback while issues are being fetched, improving the overall responsiveness of the GitHubIssuesView. - Refactored GitHubIssuesView to utilize the new components, streamlining error and loading handling logic.
34 lines
1008 B
TypeScript
34 lines
1008 B
TypeScript
import type { IssueComplexity } from '@/lib/electron';
|
|
import { VALIDATION_STALENESS_HOURS } from './constants';
|
|
|
|
/**
|
|
* Map issue complexity to feature priority.
|
|
* Lower complexity issues get higher priority (1 = high, 2 = medium).
|
|
*/
|
|
export function getFeaturePriority(complexity: IssueComplexity | undefined): number {
|
|
switch (complexity) {
|
|
case 'trivial':
|
|
case 'simple':
|
|
return 1; // High priority for easy wins
|
|
case 'moderate':
|
|
case 'complex':
|
|
case 'very_complex':
|
|
default:
|
|
return 2; // Medium priority for larger efforts
|
|
}
|
|
}
|
|
|
|
export function formatDate(dateString: string): string {
|
|
const date = new Date(dateString);
|
|
return date.toLocaleDateString('en-US', {
|
|
month: 'short',
|
|
day: 'numeric',
|
|
year: 'numeric',
|
|
});
|
|
}
|
|
|
|
export function isValidationStale(validatedAt: string): boolean {
|
|
const hoursSinceValidation = (Date.now() - new Date(validatedAt).getTime()) / (1000 * 60 * 60);
|
|
return hoursSinceValidation > VALIDATION_STALENESS_HOURS;
|
|
}
|