This commit is contained in:
gpt-engineer-app[bot] 2025-12-07 18:24:18 +00:00
parent af6cfb8f57
commit 7114f98499
2 changed files with 38 additions and 11 deletions

View File

@ -27,6 +27,7 @@ const commands: Record<string, string> = {
'/chat': '/ai', '/chat': '/ai',
'/achievements': '/achievements', '/achievements': '/achievements',
'/ach': '/achievements', '/ach': '/achievements',
'/a': '/achievements',
}; };
const helpText = `Available commands: const helpText = `Available commands:
@ -43,10 +44,15 @@ const helpText = `Available commands:
/breakout - Play Breakout /breakout - Play Breakout
/music, /m - Navigate to Music Player /music, /m - Navigate to Music Player
/ai, /chat - Navigate to AI Chat /ai, /chat - Navigate to AI Chat
/achievements - View achievements
/help, /h - Show this help message /help, /h - Show this help message
/clear, /c - Clear terminal output /clear, /c - Clear terminal output`;
...there may be other commands.`; const helpHint = `
...there may be other commands.
Perhaps a HINT to an easter egg exists?
`;
const TerminalCommand = () => { const TerminalCommand = () => {
const [isOpen, setIsOpen] = useState(false); const [isOpen, setIsOpen] = useState(false);
@ -114,7 +120,7 @@ const TerminalCommand = () => {
unlockAchievement('terminal_user'); unlockAchievement('terminal_user');
if (trimmedInput === '/help' || trimmedInput === '/h') { if (trimmedInput === '/help' || trimmedInput === '/h') {
setOutput(prev => [...prev, helpText]); setOutput(prev => [...prev, helpText, '---HINT---' + helpHint]);
} else if (trimmedInput === '/hint') { } else if (trimmedInput === '/hint') {
unlockAchievement('hint_seeker'); unlockAchievement('hint_seeker');
setOutput(prev => [...prev, setOutput(prev => [...prev,
@ -186,8 +192,8 @@ const TerminalCommand = () => {
className="h-48 overflow-y-auto p-4 font-mono text-sm text-primary/90" className="h-48 overflow-y-auto p-4 font-mono text-sm text-primary/90"
> >
{output.map((line, i) => ( {output.map((line, i) => (
<div key={i} className="whitespace-pre-wrap mb-1"> <div key={i} className={`whitespace-pre-wrap mb-1 ${line.startsWith('---HINT---') ? 'text-yellow-400 animate-pulse' : ''}`}>
{line} {line.startsWith('---HINT---') ? line.replace('---HINT---', '') : line}
</div> </div>
))} ))}
</div> </div>

View File

@ -40,11 +40,11 @@ const defaultAchievements: Achievement[] = [
{ id: 'all_pages', name: 'Completionist', description: 'Visit every page on the site', icon: '🗺️', unlocked: false, secret: true }, { id: 'all_pages', name: 'Completionist', description: 'Visit every page on the site', icon: '🗺️', unlocked: false, secret: true },
// Time achievements // Time achievements
{ id: 'time_1min', name: 'Quick Visit', description: 'Spend 1 minute on the site', icon: '⏱️', unlocked: false }, { id: 'time_5min', name: 'Quick Visit', description: 'Spend 5 minutes on the site', icon: '⏱️', unlocked: false },
{ id: 'time_5min', name: 'Taking Your Time', description: 'Spend 5 minutes on the site', icon: '⏰', unlocked: false }, { id: 'time_15min', name: 'Taking Your Time', description: 'Spend 15 minutes on the site', icon: '⏰', unlocked: false },
{ id: 'time_15min', name: 'Deep Dive', description: 'Spend 15 minutes on the site', icon: '🕐', unlocked: false }, { id: 'time_30min', name: 'Deep Dive', description: 'Spend 30 minutes on the site', icon: '🕐', unlocked: false },
{ id: 'time_30min', name: 'Marathon Session', description: 'Spend 30 minutes on the site', icon: '🕑', unlocked: false, secret: true }, { id: 'time_1hour', name: 'Marathon Session', description: 'Spend 1 hour on the site', icon: '🕑', unlocked: false, secret: true },
{ id: 'time_1hour', name: 'No Life', description: 'Spend 1 hour on the site', icon: '💀', unlocked: false, secret: true }, { id: 'time_2hour', name: 'No Life', description: 'Spend 2 hours on the site', icon: '💀', unlocked: false, secret: true },
// Game achievements // Game achievements
{ id: 'tetris_played', name: 'Block Stacker', description: 'Play Tetris', icon: '🧱', unlocked: false }, { id: 'tetris_played', name: 'Block Stacker', description: 'Play Tetris', icon: '🧱', unlocked: false },
@ -125,11 +125,11 @@ export const AchievementsProvider = ({ children }: { children: ReactNode }) => {
// Check time-based achievements // Check time-based achievements
useEffect(() => { useEffect(() => {
if (timeOnSite >= 60) unlockAchievement('time_1min');
if (timeOnSite >= 300) unlockAchievement('time_5min'); if (timeOnSite >= 300) unlockAchievement('time_5min');
if (timeOnSite >= 900) unlockAchievement('time_15min'); if (timeOnSite >= 900) unlockAchievement('time_15min');
if (timeOnSite >= 1800) unlockAchievement('time_30min'); if (timeOnSite >= 1800) unlockAchievement('time_30min');
if (timeOnSite >= 3600) unlockAchievement('time_1hour'); if (timeOnSite >= 3600) unlockAchievement('time_1hour');
if (timeOnSite >= 7200) unlockAchievement('time_2hour');
}, [timeOnSite]); }, [timeOnSite]);
// Check time of day achievements // Check time of day achievements
@ -187,11 +187,17 @@ export const AchievementsProvider = ({ children }: { children: ReactNode }) => {
unlockAchievement('first_visit'); unlockAchievement('first_visit');
}, []); }, []);
const [notification, setNotification] = useState<Achievement | null>(null);
const unlockAchievement = useCallback((id: string) => { const unlockAchievement = useCallback((id: string) => {
setAchievements(prev => { setAchievements(prev => {
const achievement = prev.find(a => a.id === id); const achievement = prev.find(a => a.id === id);
if (!achievement || achievement.unlocked) return prev; if (!achievement || achievement.unlocked) return prev;
// Show notification
setNotification(achievement);
setTimeout(() => setNotification(null), 4000);
const updated = prev.map(a => const updated = prev.map(a =>
a.id === id ? { ...a, unlocked: true, unlockedAt: Date.now() } : a a.id === id ? { ...a, unlocked: true, unlockedAt: Date.now() } : a
); );
@ -224,6 +230,21 @@ export const AchievementsProvider = ({ children }: { children: ReactNode }) => {
}} }}
> >
{children} {children}
{/* Achievement Notification */}
{notification && (
<div className="fixed top-4 right-4 z-[300] animate-in slide-in-from-right-5 fade-in duration-300">
<div className="bg-background border-2 border-primary p-4 box-glow-strong max-w-xs">
<div className="flex items-center gap-3">
<span className="text-2xl">{notification.icon}</span>
<div>
<div className="text-primary font-minecraft text-sm text-glow">ACHIEVEMENT UNLOCKED!</div>
<div className="text-primary font-bold">{notification.name}</div>
<div className="text-primary/70 text-xs">{notification.description}</div>
</div>
</div>
</div>
</div>
)}
</AchievementsContext.Provider> </AchievementsContext.Provider>
); );
}; };