refactor: standardize string quotes and improve code readability across multiple files

- Updated string quotes from single to double in useRecommendationProfile.ts, client.ts, recommendationService.ts, and recommendations.ts for consistency.
- Enhanced error handling and logging in API client and recommendation service.
- Improved code structure and formatting for better readability and maintainability.
- Ensured consistent use of semicolons and spacing throughout the codebase.
This commit is contained in:
ersaayan
2025-11-22 16:21:15 +03:00
parent 73f9248e98
commit bcf8652728
10 changed files with 1129 additions and 1054 deletions
+54 -54
View File
@@ -1,99 +1,99 @@
import { Package, Platform } from './index'
import { Package, Platform } from "./index";
/**
* User category types for package recommendations
*/
export type UserCategory =
| 'development'
| 'design'
| 'multimedia'
| 'system-tools'
| 'gaming'
| 'productivity'
| 'education'
export type UserCategory =
| "development"
| "design"
| "multimedia"
| "system-tools"
| "gaming"
| "productivity"
| "education";
/**
* User experience level
*/
export type ExperienceLevel = 'beginner' | 'intermediate' | 'advanced'
export type ExperienceLevel = "beginner" | "intermediate" | "advanced";
/**
* User profile stored in localStorage
*/
export interface UserProfile {
categories: UserCategory[]
detectedOS?: string
selectedOS?: string // Manual override
experienceLevel?: ExperienceLevel
hasCompletedOnboarding: boolean
createdAt: string
lastUpdated: string
categories: UserCategory[];
detectedOS?: string;
selectedOS?: string; // Manual override
experienceLevel?: ExperienceLevel;
hasCompletedOnboarding: boolean;
createdAt: string;
lastUpdated: string;
}
/**
* Request payload for recommendation API
*/
export interface RecommendationRequest {
platform_id: string
categories: UserCategory[]
experienceLevel?: ExperienceLevel
limit?: number
platform_id: string;
categories: UserCategory[];
experienceLevel?: ExperienceLevel;
limit?: number;
}
/**
* Recommended package with score
*/
export interface RecommendedPackage {
id: string
name: string
description: string
version: string
category?: string
license?: string
type: 'gui' | 'cli'
platform?: string | any
platform_id?: string
repository: 'official' | 'third-party' | 'aur'
download_url?: string
lastUpdated?: string
downloads?: number
popularity?: number
popularity_score?: number
tags?: string[]
recommendationScore: number
recommendationReason: string
presetMatch?: boolean
id: string;
name: string;
description: string;
version: string;
category?: string;
license?: string;
type: "gui" | "cli";
platform?: string | any;
platform_id?: string;
repository: "official" | "third-party" | "aur";
download_url?: string;
lastUpdated?: string;
downloads?: number;
popularity?: number;
popularity_score?: number;
tags?: string[];
recommendationScore: number;
recommendationReason: string;
presetMatch?: boolean;
}
/**
* Preset package configuration
*/
export interface PackagePreset {
packageName: string
platforms: string[] // ['windows', 'macos', 'ubuntu', 'arch', 'fedora']
priority: number // 1-10, higher = more important
reason: string // Why this package is recommended
experienceLevel?: ExperienceLevel[] // Target experience levels
packageName: string;
platforms: string[]; // ['windows', 'macos', 'ubuntu', 'arch', 'fedora']
priority: number; // 1-10, higher = more important
reason: string; // Why this package is recommended
experienceLevel?: ExperienceLevel[]; // Target experience levels
}
/**
* Category preset configuration
*/
export interface CategoryPreset {
category: UserCategory
packages: PackagePreset[]
description: string
icon: string
category: UserCategory;
packages: PackagePreset[];
description: string;
icon: string;
}
/**
* Recommendation response
*/
export interface RecommendationResponse {
recommendations: RecommendedPackage[]
total: number
recommendations: RecommendedPackage[];
total: number;
userProfile: {
categories: UserCategory[]
platform: string
}
categories: UserCategory[];
platform: string;
};
}