|
| 1 | +import React, { useState } from 'react'; |
| 2 | +import { Link } from 'react-router-dom'; |
| 3 | +import { motion, AnimatePresence } from 'framer-motion'; |
| 4 | +import Seo from '../../components/Seo'; |
| 5 | +import { useCommandPalette } from '../../context/CommandPaletteContext'; |
| 6 | +import { |
| 7 | + ArrowLeftIcon, |
| 8 | + TerminalWindowIcon, |
| 9 | + CommandIcon, |
| 10 | +} from '@phosphor-icons/react'; |
| 11 | +import GenerativeArt from '../../components/GenerativeArt'; |
| 12 | +import { commands as commandsData } from '../../data/commands'; |
| 13 | + |
| 14 | +const CommandListItem = ({ cmd, isActive, onHover, onClick }) => { |
| 15 | + return ( |
| 16 | + <motion.div |
| 17 | + initial={{ opacity: 0, x: -10 }} |
| 18 | + whileInView={{ opacity: 1, x: 0 }} |
| 19 | + viewport={{ once: true }} |
| 20 | + onMouseEnter={() => onHover(cmd)} |
| 21 | + onClick={onClick} |
| 22 | + className="relative pl-6 md:pl-8 py-3 group cursor-pointer" |
| 23 | + > |
| 24 | + <div |
| 25 | + className={`absolute left-0 top-0 bottom-0 w-0.5 transition-all duration-300 ${ |
| 26 | + isActive ? 'bg-[#C96442] h-full' : 'bg-transparent h-0 group-hover:h-full group-hover:bg-[#1A161320]' |
| 27 | + }`} |
| 28 | + /> |
| 29 | + |
| 30 | + <div className="flex items-baseline justify-between pr-4"> |
| 31 | + <h3 |
| 32 | + className={`text-lg font-playfairDisplay transition-all duration-300 ${ |
| 33 | + isActive |
| 34 | + ? 'text-[#1A1613] italic translate-x-2' |
| 35 | + : 'text-[#2E2620]/60 group-hover:text-[#1A1613]' |
| 36 | + }`} |
| 37 | + > |
| 38 | + {cmd.title} |
| 39 | + </h3> |
| 40 | + |
| 41 | + {isActive && ( |
| 42 | + <motion.div |
| 43 | + initial={{ opacity: 0, x: -10 }} |
| 44 | + animate={{ opacity: 1, x: 0 }} |
| 45 | + className="hidden md:block text-[#C96442]" |
| 46 | + > |
| 47 | + <ArrowLeftIcon className="rotate-180" /> |
| 48 | + </motion.div> |
| 49 | + )} |
| 50 | + </div> |
| 51 | + </motion.div> |
| 52 | + ); |
| 53 | +}; |
| 54 | + |
| 55 | +function TerracottaCommandsPage() { |
| 56 | + const { togglePalette, triggerCommand } = useCommandPalette(); |
| 57 | + const [activeCommand, setActiveCommand] = useState(null); |
| 58 | + |
| 59 | + return ( |
| 60 | + <div className="flex min-h-screen bg-[#F3ECE0] text-[#1A1613] overflow-hidden relative selection:bg-[#C96442]/25"> |
| 61 | + <Seo title="All Commands | Fezcodex" description="All available commands in Fezcodex." /> |
| 62 | + |
| 63 | + <div className="absolute inset-0 xl:hidden opacity-20 pointer-events-none z-0"> |
| 64 | + <GenerativeArt seed="Commands" className="w-full h-full filter blur-3xl" /> |
| 65 | + </div> |
| 66 | + |
| 67 | + <div className="w-full xl:pr-[50vw] relative z-10 flex flex-col min-h-screen py-24 px-6 md:pl-20 overflow-y-auto overflow-x-hidden no-scrollbar transition-all duration-300"> |
| 68 | + <header className="mb-20 text-center md:text-left"> |
| 69 | + <Link |
| 70 | + to="/" |
| 71 | + className="mb-8 inline-flex items-center gap-2 text-xs font-mono text-[#2E2620]/60 hover:text-[#1A1613] transition-colors uppercase tracking-widest" |
| 72 | + > |
| 73 | + <ArrowLeftIcon weight="bold" /> |
| 74 | + <span>Back to Home</span> |
| 75 | + </Link> |
| 76 | + <h1 className="text-6xl md:text-8xl font-playfairDisplay italic tracking-tight text-[#1A1613] mb-4 leading-none"> |
| 77 | + Commands |
| 78 | + </h1> |
| 79 | + <p className="text-[#2E2620]/60 font-mono text-sm max-w-sm uppercase tracking-widest mb-8"> |
| 80 | + Available Commands |
| 81 | + </p> |
| 82 | + |
| 83 | + <button |
| 84 | + onClick={togglePalette} |
| 85 | + className="group relative inline-flex items-center gap-3 px-6 py-3 bg-[#E8DECE]/60 border border-[#1A161320] hover:bg-[#1A1613] hover:text-[#F3ECE0] transition-all duration-300 font-mono uppercase tracking-widest text-xs rounded-sm mb-12" |
| 86 | + > |
| 87 | + <CommandIcon size={18} /> |
| 88 | + <span>Open Palette</span> |
| 89 | + </button> |
| 90 | + </header> |
| 91 | + |
| 92 | + <div className="flex flex-col pb-32 gap-12"> |
| 93 | + {commandsData.map((category, catIndex) => ( |
| 94 | + <div key={catIndex}> |
| 95 | + <h2 className="font-mono text-xs text-[#9E4A2F] uppercase tracking-widest mb-6 border-b border-[#1A161320] pb-2"> |
| 96 | + {category.category} |
| 97 | + </h2> |
| 98 | + <div className="flex flex-col"> |
| 99 | + {category.items.map((cmd) => ( |
| 100 | + <CommandListItem |
| 101 | + key={cmd.title} |
| 102 | + cmd={cmd} |
| 103 | + isActive={activeCommand?.title === cmd.title} |
| 104 | + onHover={setActiveCommand} |
| 105 | + onClick={() => triggerCommand(cmd.commandId)} |
| 106 | + /> |
| 107 | + ))} |
| 108 | + </div> |
| 109 | + </div> |
| 110 | + ))} |
| 111 | + </div> |
| 112 | + </div> |
| 113 | + |
| 114 | + <div className="hidden xl:flex fixed right-0 top-0 h-screen w-1/2 bg-[#1A1613] overflow-hidden border-l border-[#1A161320] z-20 flex-col"> |
| 115 | + <div className="flex-1 relative overflow-hidden"> |
| 116 | + <AnimatePresence mode="wait"> |
| 117 | + {activeCommand ? ( |
| 118 | + <motion.div |
| 119 | + key={activeCommand.title} |
| 120 | + initial={{ opacity: 0 }} |
| 121 | + animate={{ opacity: 1 }} |
| 122 | + exit={{ opacity: 0 }} |
| 123 | + transition={{ duration: 0.4 }} |
| 124 | + className="absolute inset-0 flex flex-col justify-end p-20 pb-8" |
| 125 | + > |
| 126 | + <div className="absolute inset-0 z-0"> |
| 127 | + <GenerativeArt seed={activeCommand.title} className="w-full h-full opacity-60" /> |
| 128 | + <div className="absolute inset-0 bg-gradient-to-t from-[#1A1613] via-[#1A1613]/80 to-transparent" /> |
| 129 | + </div> |
| 130 | + |
| 131 | + <div className="relative z-10"> |
| 132 | + <div className="mb-6"> |
| 133 | + <span className="inline-block px-3 py-1 text-xs font-mono uppercase tracking-wider rounded-full border text-[#C96442] border-[#C96442]/40 bg-[#C96442]/10"> |
| 134 | + {activeCommand.color} |
| 135 | + </span> |
| 136 | + </div> |
| 137 | + |
| 138 | + <h2 className="text-5xl font-playfairDisplay italic text-[#F3ECE0] mb-6 leading-tight"> |
| 139 | + {activeCommand.title} |
| 140 | + </h2> |
| 141 | + |
| 142 | + <p className="text-xl text-[#F3ECE0]/80 font-light max-w-xl leading-relaxed"> |
| 143 | + {activeCommand.description} |
| 144 | + </p> |
| 145 | + </div> |
| 146 | + </motion.div> |
| 147 | + ) : ( |
| 148 | + <motion.div |
| 149 | + key="default-state" |
| 150 | + initial={{ opacity: 0 }} |
| 151 | + animate={{ opacity: 1 }} |
| 152 | + exit={{ opacity: 0 }} |
| 153 | + className="absolute inset-0 flex items-center justify-center p-12 text-center" |
| 154 | + > |
| 155 | + <div className="relative z-10 max-w-lg"> |
| 156 | + <TerminalWindowIcon size={64} className="mx-auto mb-8 text-[#C96442]/60" /> |
| 157 | + <h2 className="text-4xl font-playfairDisplay italic text-[#F3ECE0] mb-6"> |
| 158 | + Command Palette |
| 159 | + </h2> |
| 160 | + <p className="text-[#F3ECE0]/60 mb-8 leading-relaxed"> |
| 161 | + Access all features and navigations quickly. |
| 162 | + <br /> |
| 163 | + Hover over the list to see details. |
| 164 | + </p> |
| 165 | + </div> |
| 166 | + </motion.div> |
| 167 | + )} |
| 168 | + </AnimatePresence> |
| 169 | + </div> |
| 170 | + |
| 171 | + <div className="p-8 border-t border-[#F3ECE0]/10 bg-[#1A1613]/80 backdrop-blur-md z-30 flex items-center justify-between gap-6"> |
| 172 | + <div className="hidden xl:flex items-center gap-4 text-sm font-mono text-[#F3ECE0]/70"> |
| 173 | + <div className="flex gap-1"> |
| 174 | + <kbd className="px-2 py-1 bg-[#F3ECE0]/10 rounded border border-[#F3ECE0]/20 text-[#F3ECE0]">Ctrl</kbd> |
| 175 | + <span className="self-center">+</span> |
| 176 | + <kbd className="px-2 py-1 bg-[#F3ECE0]/10 rounded border border-[#F3ECE0]/20 text-[#F3ECE0]">K</kbd> |
| 177 | + </div> |
| 178 | + <span>to open anywhere</span> |
| 179 | + </div> |
| 180 | + |
| 181 | + <button |
| 182 | + onClick={togglePalette} |
| 183 | + className="flex-1 xl:flex-none group relative inline-flex items-center justify-center gap-3 px-6 py-4 bg-[#F3ECE0] text-[#1A1613] hover:bg-[#C96442] hover:text-[#F3ECE0] transition-colors duration-300 font-mono uppercase tracking-widest text-sm" |
| 184 | + > |
| 185 | + <CommandIcon size={20} /> |
| 186 | + <span>Open Palette</span> |
| 187 | + </button> |
| 188 | + </div> |
| 189 | + </div> |
| 190 | + </div> |
| 191 | + ); |
| 192 | +} |
| 193 | + |
| 194 | +export default TerracottaCommandsPage; |
0 commit comments