|
| 1 | +import React, {useState, useEffect} from 'react'; |
| 2 | +import {Link} from 'react-router-dom'; |
| 3 | +import {ArrowLeftIcon, PushPin, Star, ArrowRight, Crown} from '@phosphor-icons/react'; |
| 4 | +import {motion} from 'framer-motion'; |
| 5 | +import useSeo from '../hooks/useSeo'; |
| 6 | +import {appIcons} from '../utils/appIcons'; |
| 7 | + |
| 8 | +const PinnedAppCard = ({app, index}) => { |
| 9 | + const Icon = appIcons[app.icon] || Star; |
| 10 | + const isTop3 = index < 3; |
| 11 | + // Special styling for Top 3 |
| 12 | + const rankColors = { |
| 13 | + 0: 'text-yellow-400 border-yellow-500/50 bg-yellow-500/10', // Gold |
| 14 | + 1: 'text-gray-300 border-gray-400/50 bg-gray-400/10', // Silver |
| 15 | + 2: 'text-amber-600 border-amber-700/50 bg-amber-700/10', // Bronze |
| 16 | + }; |
| 17 | + |
| 18 | + const rankStyle = rankColors[index] || 'text-gray-500 border-gray-700/50 bg-gray-800/50'; |
| 19 | + return ( |
| 20 | + <Link to={app.to} |
| 21 | + className={`block group relative h-full ${isTop3 ? 'col-span-1 md:col-span-1 lg:col-span-1' : ''}`}> |
| 22 | + <div |
| 23 | + className={`relative flex flex-col h-full bg-gray-900/60 backdrop-blur-md border border-white/10 rounded-3xl p-6 hover:bg-gray-800/80 transition-all duration-300 overflow-hidden group-hover:border-primary-500/30 group-hover:shadow-2xl group-hover:shadow-primary-500/20 group-hover:-translate-y-2`}> |
| 24 | + {/* Watermark Icon */} |
| 25 | + <div |
| 26 | + className="absolute -bottom-10 -right-10 opacity-20 group-hover:opacity-30 transition-opacity duration-500 rotate-12 pointer-events-none text-white"> |
| 27 | + <Icon size={220} weight="fill"/> |
| 28 | + </div> |
| 29 | + {/* Rank Badge */} |
| 30 | + <div className="flex justify-between items-start mb-6 relative z-10"> |
| 31 | + <div |
| 32 | + className={`p-3 rounded-2xl bg-gray-800/80 border border-white/5 text-primary-400 group-hover:scale-110 transition-transform duration-300 shadow-inner`}> |
| 33 | + <Icon size={32} weight="duotone"/> |
| 34 | + </div> |
| 35 | + <div |
| 36 | + className={`flex items-center justify-center w-10 h-10 rounded-full border ${rankStyle} font-bold font-mono text-lg shadow-sm backdrop-blur-sm`}> |
| 37 | + {index < 3 && <Crown size={14} weight="fill" className="mr-1 -ml-1"/>} |
| 38 | + {app.pinned_order} |
| 39 | + </div> |
| 40 | + </div> |
| 41 | + <div className="relative z-10 flex-grow"> |
| 42 | + <h3 |
| 43 | + className={`font-bold text-white mb-3 group-hover:text-primary-400 transition-colors font-mono ${isTop3 ? 'text-2xl' : 'text-xl'}`}> |
| 44 | + {app.title} |
| 45 | + </h3> |
| 46 | + <p className="text-gray-400 text-sm leading-relaxed line-clamp-3 group-hover:text-gray-300 transition-colors"> |
| 47 | + {app.description} |
| 48 | + </p> |
| 49 | + </div> |
| 50 | + <div |
| 51 | + className="relative z-10 mt-6 flex items-center text-sm font-medium text-primary-400 group-hover:text-primary-300 transition-colors"> |
| 52 | + Launch App <ArrowRight size={16} className="ml-2 transition-transform group-hover:translate-x-1"/> |
| 53 | + </div> |
| 54 | + </div> |
| 55 | + </Link> |
| 56 | + ); |
| 57 | +}; |
| 58 | +const PinnedAppPage = () => { |
| 59 | + useSeo({ |
| 60 | + title: 'Pinned Apps | Fezcodex', |
| 61 | + description: 'A curated selection of my favorite and most used apps.', |
| 62 | + keywords: ['pinned', 'favorite', 'apps', 'tools', 'hall of fame'], |
| 63 | + }); |
| 64 | + |
| 65 | + const [pinnedApps, setPinnedApps] = useState([]); |
| 66 | + const [isLoading, setIsLoading] = useState(true); |
| 67 | + useEffect(() => { |
| 68 | + fetch('/apps/apps.json') |
| 69 | + .then((res) => res.json()) |
| 70 | + .then((data) => { |
| 71 | + const allApps = Object.values(data).flatMap((cat) => categoryToApps(cat)); |
| 72 | + const pinned = allApps |
| 73 | + .filter((app) => app.pinned_order) |
| 74 | + .sort((a, b) => a.pinned_order - b.pinned_order); |
| 75 | + setPinnedApps(pinned); |
| 76 | + }) |
| 77 | + .catch((err) => console.error(err)) |
| 78 | + .finally(() => setIsLoading(false)); |
| 79 | + }, []); |
| 80 | + |
| 81 | + const categoryToApps = (category) => { |
| 82 | + return category.apps.map(app => ({...app, categoryName: category.name})); |
| 83 | + }; |
| 84 | + |
| 85 | + return ( |
| 86 | + <div className="min-h-screen bg-gray-950 py-16 sm:py-24 relative overflow-hidden"> |
| 87 | + {/* Background Glows */} |
| 88 | + <div |
| 89 | + className="absolute top-0 left-1/2 -translate-x-1/2 w-3/4 h-[500px] bg-primary-500/10 blur-[120px] rounded-full pointer-events-none mix-blend-screen"/> |
| 90 | + <div |
| 91 | + className="absolute bottom-0 right-0 w-[600px] h-[600px] bg-blue-600/10 blur-[120px] rounded-full pointer-events-none mix-blend-screen"/> |
| 92 | + |
| 93 | + <div className="mx-auto max-w-7xl px-6 lg:px-8 relative z-10"> |
| 94 | + <div className="relative mb-16 text-center"> |
| 95 | + <div className="absolute left-0 top-1/2 -translate-y-1/2 hidden md:block"> |
| 96 | + <Link |
| 97 | + to="/" |
| 98 | + className="group text-primary-400 hover:text-primary-300 hover:underline flex items-center gap-2 text-sm transition-colors" |
| 99 | + > |
| 100 | + <ArrowLeftIcon size={18} className="transition-transform group-hover:-translate-x-1"/> Home |
| 101 | + </Link> |
| 102 | + </div> |
| 103 | + |
| 104 | + <motion.div |
| 105 | + |
| 106 | + initial={{opacity: 0, y: 20}} |
| 107 | + |
| 108 | + animate={{opacity: 1, y: 0}} |
| 109 | + |
| 110 | + transition={{duration: 0.5}} |
| 111 | + |
| 112 | + > |
| 113 | + |
| 114 | + <h1 className="text-5xl md:text-6xl font-bold tracking-tight text-white font-mono mb-6"> |
| 115 | + |
| 116 | + Hall of <span |
| 117 | + className="text-transparent bg-clip-text bg-gradient-to-r from-yellow-400 to-orange-500">Fame</span> |
| 118 | + |
| 119 | + </h1> |
| 120 | + |
| 121 | + <p className="text-lg text-gray-400 max-w-2xl mx-auto font-light"> |
| 122 | + |
| 123 | + The essential toolkit. Hand-picked and pinned for quick access. |
| 124 | + |
| 125 | + </p> |
| 126 | + |
| 127 | + </motion.div> |
| 128 | + </div> |
| 129 | + |
| 130 | + {isLoading ? ( |
| 131 | + |
| 132 | + <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"> |
| 133 | + |
| 134 | + {[...Array(8)].map((_, i) => ( |
| 135 | + |
| 136 | + <div key={i} className="bg-gray-900/30 border border-gray-800 rounded-3xl h-72 animate-pulse"></div> |
| 137 | + |
| 138 | + ))} |
| 139 | + |
| 140 | + </div> |
| 141 | + |
| 142 | + ) : ( |
| 143 | + |
| 144 | + <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 auto-rows-fr"> |
| 145 | + |
| 146 | + {pinnedApps.map((app, index) => ( |
| 147 | + |
| 148 | + <motion.div |
| 149 | + |
| 150 | + key={app.slug} |
| 151 | + |
| 152 | + initial={{opacity: 0, scale: 0.95}} |
| 153 | + |
| 154 | + animate={{opacity: 1, scale: 1}} |
| 155 | + |
| 156 | + transition={{duration: 0.3, delay: index * 0.05}} |
| 157 | + |
| 158 | + > |
| 159 | + |
| 160 | + <PinnedAppCard app={app} index={index}/> |
| 161 | + |
| 162 | + </motion.div> |
| 163 | + |
| 164 | + ))} |
| 165 | + |
| 166 | + </div> |
| 167 | + |
| 168 | + )} |
| 169 | + </div> |
| 170 | + </div> |
| 171 | + ); |
| 172 | +}; |
| 173 | + |
| 174 | +export default PinnedAppPage; |
0 commit comments