refactor: Remove experience level from recommendation system

- Remove experienceLevel from UserProfile, RecommendationRequest, and PackagePreset types
- Remove experience level validation and handling from GET/POST endpoints
- Disable localStorage persistence in useRecommendationProfile hook (session-only storage)
- Disable automatic onboarding modal on first visit
- Set recommendations section to expanded by default
- Add empty state card for recommendations with wizard button
- Add translations
This commit is contained in:
Yusuf İpek
2025-11-23 14:55:49 +03:00
parent a5b65bb4df
commit 95ad5e32fd
6 changed files with 47 additions and 77 deletions
+2 -3
View File
@@ -42,7 +42,7 @@ export function RecommendationsSection({
const [error, setError] = useState<string | null>(null)
const [viewMode, setViewMode] = useState<ViewMode>('grid')
const [filterCategory, setFilterCategory] = useState<FilterCategory>('all')
const [isExpanded, setIsExpanded] = useState(false)
const [isExpanded, setIsExpanded] = useState(true)
const fetchRecommendations = async () => {
if (!isProfileComplete()) {
@@ -61,7 +61,6 @@ export function RecommendationsSection({
body: JSON.stringify({
platform_id: getEffectiveOS(),
categories: profile.categories,
experienceLevel: profile.experienceLevel,
limit: 1000
})
})
@@ -104,7 +103,7 @@ export function RecommendationsSection({
// But for now, let's rely on the cache key changing which includes profile data
fetchRecommendations()
}
}, [profile.categories, profile.selectedOS, profile.experienceLevel])
}, [profile.categories, profile.selectedOS])
const isPackageSelected = (pkg: RecommendedPackage) => {
return selectedPackages.some(selected => selected.id === pkg.id)
+27 -5
View File
@@ -13,7 +13,10 @@ import { generateScript } from '@/lib/scriptGenerator'
import { useLocale } from '@/contexts/LocaleContext'
import { useRecommendationProfile } from '@/hooks/useRecommendationProfile'
import { Platform, Package, SelectedPackage, FilterOptions, GeneratedScript } from '@/types'
import { UserCategory, ExperienceLevel } from '@/types/recommendations'
import { UserCategory } from '@/types/recommendations'
import { Sparkles, Settings, Package as PackageIcon } from 'lucide-react'
import { Card, CardContent } from '@/components/ui/card'
import { Button } from '@/components/ui/button'
function RepoHubAppContent({ cryptomusEnabled }: { cryptomusEnabled: boolean }) {
const { t, locale } = useLocale()
@@ -50,7 +53,8 @@ function RepoHubAppContent({ cryptomusEnabled }: { cryptomusEnabled: boolean })
loadPlatforms()
}, [])
// Show onboarding modal on first visit
// Show onboarding modal on first visit - DISABLED as per user request
/*
useEffect(() => {
if (!isProfileLoading && !hasCompletedOnboarding) {
// Delay to allow page to render first
@@ -60,18 +64,17 @@ function RepoHubAppContent({ cryptomusEnabled }: { cryptomusEnabled: boolean })
return () => clearTimeout(timer)
}
}, [isProfileLoading, hasCompletedOnboarding])
*/
const handleOnboardingComplete = (data: {
categories: UserCategory[]
selectedOS?: string
experienceLevel: ExperienceLevel
}) => {
console.log('🎯 Onboarding completed with data:', data)
const success = saveProfile({
categories: data.categories,
selectedOS: data.selectedOS,
experienceLevel: data.experienceLevel,
hasCompletedOnboarding: true
})
@@ -192,13 +195,32 @@ function RepoHubAppContent({ cryptomusEnabled }: { cryptomusEnabled: boolean })
{/* Main Content */}
<div className="space-y-8">
{/* Recommendations Section - Show if profile is complete */}
{hasCompletedOnboarding && profile.categories.length > 0 && (
{hasCompletedOnboarding && profile.categories.length > 0 ? (
<RecommendationsSection
onPackageToggle={handlePackageToggle}
selectedPackages={selectedPackages}
onCustomizeClick={handleCustomizePreferences}
profile={profile}
/>
) : (
/* Empty State for Recommendations */
<Card className="w-full bg-gradient-to-r from-primary/5 to-secondary/5 border-dashed">
<CardContent className="flex flex-col items-center justify-center py-12 text-center">
<div className="bg-background p-4 rounded-full shadow-sm mb-4">
<Sparkles className="h-8 w-8 text-primary" />
</div>
<h3 className="text-xl font-semibold mb-2">
{t('recommendations.empty_title') || 'Get Personalized Recommendations'}
</h3>
<p className="text-muted-foreground max-w-md mb-6">
{t('recommendations.empty_description') || 'Tell us about your role and platform to get a curated list of essential packages.'}
</p>
<Button onClick={handleCustomizePreferences} size="lg">
<Sparkles className="h-4 w-4 mr-2" />
{t('recommendations.start') || 'Start Recommendation Wizard'}
</Button>
</CardContent>
</Card>
)}