|
| 1 | +"use client"; |
| 2 | + |
| 3 | +import { useFavorites } from "hooks/useFavorites"; |
| 4 | +import { presets } from "lib/public/presets"; |
| 5 | +import Header from "components/Header"; |
| 6 | +import Footer from "components/Footer"; |
| 7 | +import { PresetCard } from "components/PresetCard"; |
| 8 | +import { ReactElement } from "react"; |
| 9 | +import Link from "next/link"; |
| 10 | + |
| 11 | +export default function FavoritesPage(): ReactElement { |
| 12 | + const { favorites, isLoaded } = useFavorites(); |
| 13 | + |
| 14 | + // Фильтруем пресеты по избранным ID |
| 15 | + const favoritePresets = presets.filter((preset) => |
| 16 | + favorites.includes(preset.id), |
| 17 | + ); |
| 18 | + |
| 19 | + return ( |
| 20 | + <div className="min-h-screen flex flex-col bg-gray-900 text-white"> |
| 21 | + <Header /> |
| 22 | + <main className="flex-grow"> |
| 23 | + <div className="container mx-auto px-4 py-8"> |
| 24 | + <div className="flex items-center gap-4 mb-6"> |
| 25 | + <svg |
| 26 | + width="32" |
| 27 | + height="32" |
| 28 | + viewBox="0 0 24 24" |
| 29 | + fill="currentColor" |
| 30 | + className="text-pink-400" |
| 31 | + > |
| 32 | + <polygon points="12,2 15.09,8.26 22,9.27 17,14.14 18.18,21.02 12,17.77 5.82,21.02 7,14.14 2,9.27 8.91,8.26" /> |
| 33 | + </svg> |
| 34 | + <h1 className="text-4xl font-bold text-white">Favorite Presets</h1> |
| 35 | + </div> |
| 36 | + |
| 37 | + <p className="mb-8 text-gray-300 leading-relaxed"> |
| 38 | + Here are all your favorite presets for{" "} |
| 39 | + <strong>NUX Mighty Plug Pro</strong> and{" "} |
| 40 | + <strong>Mighty Space</strong>. Add your favorite tones to quickly |
| 41 | + find them later. |
| 42 | + </p> |
| 43 | + |
| 44 | + {!isLoaded ? ( |
| 45 | + <div className="flex items-center justify-center py-12"> |
| 46 | + <div className="text-gray-400">Loading favorite presets...</div> |
| 47 | + </div> |
| 48 | + ) : favoritePresets.length === 0 ? ( |
| 49 | + <div className="text-center py-12"> |
| 50 | + <div className="mb-4"> |
| 51 | + <svg |
| 52 | + width="64" |
| 53 | + height="64" |
| 54 | + viewBox="0 0 24 24" |
| 55 | + fill="none" |
| 56 | + stroke="currentColor" |
| 57 | + strokeWidth="1" |
| 58 | + strokeLinecap="round" |
| 59 | + strokeLinejoin="round" |
| 60 | + className="mx-auto text-gray-500" |
| 61 | + > |
| 62 | + <polygon points="12,2 15.09,8.26 22,9.27 17,14.14 18.18,21.02 12,17.77 5.82,21.02 7,14.14 2,9.27 8.91,8.26" /> |
| 63 | + </svg> |
| 64 | + </div> |
| 65 | + <h2 className="text-xl font-semibold mb-2 text-gray-300"> |
| 66 | + No favorite presets yet |
| 67 | + </h2> |
| 68 | + <p className="text-gray-400 mb-6"> |
| 69 | + Add presets to favorites by clicking the star on preset cards. |
| 70 | + </p> |
| 71 | + <Link |
| 72 | + href="/preset" |
| 73 | + className="inline-flex items-center gap-2 px-6 py-3 bg-pink-500 hover:bg-pink-600 text-white rounded-lg transition-colors" |
| 74 | + > |
| 75 | + Browse All Presets |
| 76 | + </Link> |
| 77 | + </div> |
| 78 | + ) : ( |
| 79 | + <> |
| 80 | + <div className="mb-6 text-sm text-gray-400"> |
| 81 | + Found {favoritePresets.length} favorite preset |
| 82 | + {favoritePresets.length !== 1 ? "s" : ""} |
| 83 | + </div> |
| 84 | + |
| 85 | + <div className="grid gap-6"> |
| 86 | + {favoritePresets.map((preset) => ( |
| 87 | + <PresetCard key={preset.id} preset={preset} /> |
| 88 | + ))} |
| 89 | + </div> |
| 90 | + </> |
| 91 | + )} |
| 92 | + </div> |
| 93 | + </main> |
| 94 | + <Footer> |
| 95 | + <div className="container mx-auto px-4"> |
| 96 | + <p className="text-gray-300 text-center"> |
| 97 | + Manage your favorite presets for NUX Mighty Plug Pro and Mighty |
| 98 | + Space. |
| 99 | + </p> |
| 100 | + </div> |
| 101 | + </Footer> |
| 102 | + </div> |
| 103 | + ); |
| 104 | +} |
0 commit comments