mirror of
https://github.com/yusufipk/RepoHub.git
synced 2026-09-12 11:06:09 +00:00
feat: Add smart package recommendations feature
- Implement onboarding modal with 3-step wizard - Category selection (up to 3 categories) - OS detection with manual override - Experience level selection - Add intelligent recommendation engine - Hybrid scoring algorithm (category 40%, popularity 30%, OS 20%, preset 10%) - 7 curated categories with preset packages - Support for all platforms (Windows, macOS, Ubuntu, Debian, Arch, Fedora) - Create recommendation UI components - RecommendationsSection with grid layout - Package cards with recommendation scores and reasons - User profile display with customization options - Add localStorage-based profile management - Persistent user preferences - Automatic OS detection - Profile CRUD operations via useRecommendationProfile hook - Implement API endpoint - POST /api/recommendations - GET /api/recommendations (query params) - Request validation and error handling - Add full i18n support - English and Turkish translations - Onboarding flow, categories, and UI labels - Update TypeScript config (lib: es2017 for array.includes) Closes #1
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
import { Package, Platform } from './index'
|
||||
|
||||
/**
|
||||
* User category types for package recommendations
|
||||
*/
|
||||
export type UserCategory =
|
||||
| 'development'
|
||||
| 'design'
|
||||
| 'multimedia'
|
||||
| 'system-tools'
|
||||
| 'gaming'
|
||||
| 'productivity'
|
||||
| 'education'
|
||||
|
||||
/**
|
||||
* User experience level
|
||||
*/
|
||||
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
|
||||
}
|
||||
|
||||
/**
|
||||
* Request payload for recommendation API
|
||||
*/
|
||||
export interface RecommendationRequest {
|
||||
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
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
}
|
||||
|
||||
/**
|
||||
* Category preset configuration
|
||||
*/
|
||||
export interface CategoryPreset {
|
||||
category: UserCategory
|
||||
packages: PackagePreset[]
|
||||
description: string
|
||||
icon: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Recommendation response
|
||||
*/
|
||||
export interface RecommendationResponse {
|
||||
recommendations: RecommendedPackage[]
|
||||
total: number
|
||||
userProfile: {
|
||||
categories: UserCategory[]
|
||||
platform: string
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user