import React, { useState, useRef } from 'react'; import { Camera, Building, Recycle, DollarSign, Truck, MapPin, Search, Filter } from 'lucide-react'; const DigitalQuarry = () => { const [selectedImage, setSelectedImage] = useState(null); const [analysis, setAnalysis] = useState(null); const [loading, setLoading] = useState(false); const [userType, setUserType] = useState('demolition'); const [marketplace, setMarketplace] = useState([]); const [dragActive, setDragActive] = useState(false); const fileInputRef = useRef(null); const handleImageUpload = (event) => { const file = event.target.files[0]; if (file) { const reader = new FileReader(); reader.onload = (e) => { setSelectedImage(e.target.result); analyzeBuildingMaterials(file); }; reader.readAsDataURL(file); } }; const analyzeBuildingMaterials = async (imageFile) => { setLoading(true); // Simulate AI analysis of building materials setTimeout(async () => { const mockAnalysis = { buildingType: 'Commercial Office Building', totalValue: 485000, co2Savings: 1250, // tons CO2 saved vs new materials materials: [ { type: 'Structural Steel I-Beams', quantity: '45 units (30-foot)', grade: 'A992 Grade 50', condition: 'Excellent', estimatedValue: 125000, weight: '18,500 lbs', co2Savings: 425, // tons applications: ['High-rise construction', 'Industrial buildings', 'Bridges'] }, { type: 'Concrete Slabs', quantity: '2,400 sq ft', grade: '4000 PSI', condition: 'Good', estimatedValue: 85000, weight: '240,000 lbs', co2Savings: 380, applications: ['Foundation work', 'Parking structures', 'Flooring'] }, { type: 'Hardwood Flooring', quantity: '3,200 sq ft', grade: 'Red Oak Premium', condition: 'Very Good', estimatedValue: 95000, weight: '8,000 lbs', co2Savings: 125, applications: ['Residential flooring', 'Commercial spaces', 'Furniture'] }, { type: 'Copper Wiring', quantity: '2,800 linear feet', grade: '12 AWG THHN', condition: 'Excellent', estimatedValue: 45000, weight: '850 lbs', co2Savings: 85, applications: ['Electrical systems', 'HVAC', 'Telecommunications'] }, { type: 'Aluminum Windows', quantity: '28 units', grade: 'Double-pane Low-E', condition: 'Good', estimatedValue: 65000, weight: '1,200 lbs', co2Savings: 95, applications: ['Residential construction', 'Office buildings', 'Renovations'] }, { type: 'Brick Facade', quantity: '8,500 bricks', grade: 'Clay Common Brick', condition: 'Excellent', estimatedValue: 35000, weight: '42,500 lbs', co2Savings: 140, applications: ['Exterior walls', 'Landscaping', 'Decorative features'] } ], logistics: { demolitionDate: '2024-03-15', location: 'Downtown Seattle, WA', accessibility: 'Good - Street level access', storageRequired: '2 weeks', transportationCost: 12000 }, marketDemand: { steel: 'High - 15 active buyers within 50 miles', concrete: 'Medium - 8 active buyers', hardwood: 'Very High - 22 active buyers', copper: 'Critical - 31 active buyers', aluminum: 'High - 18 active buyers', brick: 'Medium - 12 active buyers' } }; setAnalysis(mockAnalysis); // Log activity for dashboard try { const { authManager } = await import('../utils/auth'); await authManager.logActivity('Building materials analyzed', { buildingType: mockAnalysis.buildingType, totalValue: mockAnalysis.totalValue, co2Savings: mockAnalysis.co2Savings, materialsCount: mockAnalysis.materials.length }); } catch (error) { console.warn('Failed to log activity:', error); } setLoading(false); }, 3000); }; const handleDrop = (e) => { e.preventDefault(); e.stopPropagation(); setDragActive(false); const files = e.dataTransfer.files; if (files && files[0]) { const file = files[0]; if (file.type.startsWith('image/')) { const reader = new FileReader(); reader.onload = (e) => { setSelectedImage(e.target.result); analyzeBuildingMaterials(file); }; reader.readAsDataURL(file); } else { alert('Please upload an image file'); } } }; const handleDragOver = (e) => { e.preventDefault(); e.stopPropagation(); setDragActive(true); }; const handleDragLeave = (e) => { e.preventDefault(); e.stopPropagation(); setDragActive(false); }; const getConditionColor = (condition) => { switch (condition) { case 'Excellent': return '#4CAF50'; case 'Very Good': return '#8BC34A'; case 'Good': return '#FF9800'; case 'Fair': return '#FF5722'; default: return '#666'; } }; const getDemandColor = (demand) => { if (!demand || typeof demand !== 'string') return '#4CAF50'; if (demand.includes('Critical')) return '#f44336'; if (demand.includes('Very High')) return '#FF5722'; if (demand.includes('High')) return '#FF9800'; return '#4CAF50'; }; return (
{/* Header */}

🏗️ Digital Quarry: Construction Waste Marketplace

AI-powered platform turning demolition waste into construction gold

🤖 LiDAR Analysis • 💰 B2B Marketplace • 🌍 1,250 Tons CO₂ Saved • 📊 Real-time Matching
{/* Prototype Disclaimer */}
⚠️

Prototype Demonstration

This tool uses simulated data for demonstration purposes.

All building analysis, material valuations, and marketplace data are generated examples. Production version would integrate with real LiDAR equipment and live commodity markets.

{/* Problem Statement */}

🚨 The Construction Waste Crisis

Construction waste accounts for 40% of global solid waste, while new material production generates 15% of global CO₂ emissions. Perfectly good steel beams, concrete, and fixtures are crushed and landfilled while new buildings demand fresh materials.

• 600 million tons of construction waste generated annually in US
• $4.3 billion worth of reusable materials sent to landfills yearly
• Steel and concrete production account for 15% of global CO₂ emissions
• No efficient marketplace connecting demolition sites with construction projects
{/* Solution */}

💡 The Digital Quarry Revolution

🎯 Urban Mining with AI:

Transform every demolition site into a digital quarry. Our AI scans buildings before demolition, identifies and grades every reusable material, then connects supply with demand through a real-time B2B marketplace.

📱

1. Scan Building

LiDAR/photo analysis of structure

🤖

2. AI Cataloging

Identify, grade, and value materials

🏪

3. B2B Marketplace

Match supply with construction demand

🚚

4. Logistics

Coordinate pickup and delivery

{/* User Type Selection */}

👤 I am a...

{userType === 'demolition' && ( <> {/* Building Analysis Upload */}

📸 Building Material Analysis

fileInputRef.current?.click()} style={{ border: `2px dashed ${dragActive ? '#4CAF50' : '#ccc'}`, borderRadius: '12px', padding: '40px 20px', textAlign: 'center', background: dragActive ? '#e8f5e8' : '#f9f9f9', transition: 'all 0.3s ease', cursor: 'pointer', marginBottom: '20px' }} > {selectedImage ? ( Building analysis ) : (
{dragActive ? '📤' : '🏗️'}

{dragActive ? 'Drop building photos here!' : 'Drag & drop building photos or LiDAR scans'}

For best results: Multiple angles, interior/exterior, structural elements visible

)}
{/* Analysis Results */} {loading && (

🤖 Analyzing building materials with AI...

Identifying structural elements, grading condition, calculating value...

)} {analysis && !loading && (
{/* Overview */}

📊 Building Analysis Overview

Building: {analysis.buildingType}

Total Value: ${analysis.totalValue.toLocaleString()}
Materials Identified: {analysis.materials.length}
CO₂ Savings: {analysis.co2Savings} tons
Demolition Date: {analysis.logistics.demolitionDate}
Location: {analysis.logistics.location}
{/* Materials Breakdown */}
{analysis.materials.map((material, index) => (
{material.type}

{material.quantity} • {material.grade}

{material.condition}
${material.estimatedValue.toLocaleString()}
Weight: {material.weight}
CO₂ Savings: {material.co2Savings} tons
Market Demand: {analysis.marketDemand[material.type.toLowerCase().split(' ')[0]] || 'Medium'}
Applications:
{material.applications.map((app, appIndex) => ( {app} ))}
))}
{/* Marketplace Listing */}

🏪 List on Marketplace

Estimated total interest: 89 potential buyers within 50 miles

)} )} {userType === 'construction' && (

🔍 Browse Available Materials

🏗️

Construction marketplace coming soon!

Browse reclaimed materials from demolition sites in your area

)} {userType === 'architect' && (

📐 Design with Reclaimed Materials

🎨

Architect tools coming soon!

Design sustainable buildings with available reclaimed materials

)}
); }; export default DigitalQuarry;