import React, { useState, useEffect } from 'react';
import {
Backpack,
Paintbrush,
FolderOpen,
Map,
Settings,
Search,
X,
Zap,
Hammer,
Globe,
ChevronRight,
Upload,
Heart
} from 'lucide-react';
// --- Mock Data ---
const HOTBAR_ITEMS = [
{ id: 1, icon: '🧱', name: 'Brick', count: 64 },
{ id: 2, icon: '🪵', name: 'Wood', count: 32 },
{ id: 3, icon: '🪨', name: 'Stone', count: 12 },
{ id: 4, icon: '🪜', name: 'Ladder', count: 5 },
{ id: 5, icon: '🚪', name: 'Door', count: 2 },
{ id: 6, icon: '🔦', name: 'Torch', count: 15 },
{ id: 7, icon: '⚔️', name: 'Sword', count: 1 },
{ id: 8, icon: null, name: null, count: 0 },
{ id: 9, icon: null, name: null, count: 0 },
{ id: 0, icon: null, name: null, count: 0 },
];
const CREATIONS = [
{ id: 1, name: 'Chaos Town Hall', likes: 120, tags: ['Structure'] },
{ id: 2, name: 'Underground Base', likes: 45, tags: ['Base'] },
{ id: 3, name: 'Hello Kitty Pixel Art', likes: 890, tags: ['Art'] },
];
const WARP_LOCATIONS = [
{ id: 1, name: 'Spawn Point', type: 'Public' },
{ id: 2, name: 'Chaos Town', type: 'City' },
{ id: 3, name: 'Deep Mines', type: 'Adventure' },
{ id: 4, name: 'Cloud City', type: 'Sky' },
];
// --- Components ---
const Tooltip = ({ text, children }) => (
);
const WindowBase = ({ title, icon: Icon, onClose, children }) => (
{/* Header */}
{/* Content */}
{children}
);
const InventoryWindow = ({ onClose }) => (
{Array.from({ length: 25 }).map((_, i) => (
{i < HOTBAR_ITEMS.length && HOTBAR_ITEMS[i].icon ? HOTBAR_ITEMS[i].icon : ''}
))}
);
const PaintWindow = ({ onClose }) => (
Tools
{['Brush', 'Fill', 'Eraser', 'Picker'].map(tool => (
))}
Palette
{['#ef4444', '#f97316', '#eab308', '#22c55e', '#3b82f6', '#a855f7', '#ec4899', '#ffffff'].map(color => (
))}
Canvas Preview
);
const CreationsWindow = ({ onClose }) => (
{CREATIONS.map((creation) => (
🏗️
{creation.name}
{creation.tags.map(tag => #{tag})}
{creation.likes}
))}
);
const WarpWindow = ({ onClose }) => (
{WARP_LOCATIONS.map((loc) => (
))}
);
// --- Main App Component ---
export default function App() {
const [activeSlot, setActiveSlot] = useState(0);
const [activeWindow, setActiveWindow] = useState(null); // 'inventory', 'paint', 'creations', 'warp'
const [bgImage, setBgImage] = useState(null);
const toggleWindow = (windowName) => {
setActiveWindow(activeWindow === windowName ? null : windowName);
};
const handleImageUpload = (e) => {
const file = e.target.files[0];
if (file) {
const reader = new FileReader();
reader.onload = (e) => setBgImage(e.target.result);
reader.readAsDataURL(file);
}
};
return (
{/* Background Layer */}
{bgImage ? (
) : (
)}
{/* Overlay: Gradient for visibility */}
{/* --- UI LAYER --- */}
{/* Top Bar */}
{/* Top Left: Chat / Notifications Area Mockup */}
System: Welcome to Chaos Town!
Wizirdi: anyone got extra wood?
{/* Top Right: System Menu */}
{/* Center Windows Area (Pointer events through) */}
{activeWindow === 'inventory' &&
setActiveWindow(null)} />}
{activeWindow === 'paint' && setActiveWindow(null)} />}
{activeWindow === 'creations' && setActiveWindow(null)} />}
{activeWindow === 'warp' && setActiveWindow(null)} />}
{/* Bottom Bar Area */}
{/* Left Action Cluster */}
{/* Center: HOTBAR */}
{/* Hotbar Slots */}
{HOTBAR_ITEMS.map((item, index) => {
const isActive = index === activeSlot;
return (
);
})}
{/* XP / Level Thin Bar (Optional aesthetic) */}
{/* Right Action Cluster */}
);
}