Major restructure: Remove Confluence, add V2 data structure, organize for dev/prod

- Import real data from PDF (35 Bambu Lab filaments)
- Remove all Confluence integration and dependencies
- Implement new V2 data structure with proper inventory tracking
- Add backwards compatibility for existing data
- Create enhanced UI components (ColorSwatch, InventoryBadge, MaterialBadge)
- Add advanced filtering with quick filters and multi-criteria search
- Organize codebase for dev/prod environments
- Update Lambda functions to support both V1/V2 formats
- Add inventory summary dashboard
- Clean up project structure and documentation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
DaX
2025-06-20 01:12:50 +02:00
parent a2252fa923
commit 18110ab159
40 changed files with 2171 additions and 1094 deletions

View File

@@ -2,6 +2,7 @@
import { useState, useEffect } from 'react';
import { FilamentTable } from '../src/components/FilamentTable';
import { FilamentTableV2 } from '../src/components/FilamentTableV2';
import { Filament } from '../src/types/filament';
import axios from 'axios';
@@ -12,6 +13,7 @@ export default function Home() {
const [lastUpdate, setLastUpdate] = useState<Date | null>(null);
const [darkMode, setDarkMode] = useState(false);
const [mounted, setMounted] = useState(false);
const [useV2, setUseV2] = useState(true); // Default to new UI
// Initialize dark mode from localStorage after mounting
useEffect(() => {
@@ -39,17 +41,22 @@ export default function Home() {
setLoading(true);
setError(null);
// Use API if available, fallback to static JSON
const apiUrl = process.env.NEXT_PUBLIC_API_URL;
const url = apiUrl ? `${apiUrl}/filaments` : '/data.json';
console.log('Fetching from:', url);
console.log('API URL configured:', apiUrl);
const response = await axios.get(url);
console.log('Response data:', response.data);
if (!apiUrl) {
throw new Error('API URL not configured');
}
const url = `${apiUrl}/filaments`;
const headers = useV2 ? { 'X-Accept-Format': 'v2' } : {};
const response = await axios.get(url, { headers });
setFilaments(response.data);
setLastUpdate(new Date());
} catch (err) {
setError(err instanceof Error ? err.message : 'Greška pri učitavanju filamenata');
console.error('API Error:', err);
if (axios.isAxiosError(err)) {
setError(`API Error: ${err.response?.status || 'Network'} - ${err.message}`);
} else {
setError(err instanceof Error ? err.message : 'Greška pri učitavanju filamenata');
}
} finally {
setLoading(false);
}
@@ -86,13 +93,22 @@ export default function Home() {
{loading ? 'Ažuriranje...' : 'Osveži'}
</button>
{mounted && (
<button
onClick={() => setDarkMode(!darkMode)}
className="px-4 py-2 bg-gray-200 dark:bg-gray-700 text-gray-800 dark:text-gray-200 rounded hover:bg-gray-300 dark:hover:bg-gray-600 transition-colors"
title={darkMode ? 'Svetla tema' : 'Tamna tema'}
>
{darkMode ? '☀️' : '🌙'}
</button>
<>
<button
onClick={() => setUseV2(!useV2)}
className="px-4 py-2 bg-blue-200 dark:bg-blue-700 text-blue-800 dark:text-blue-200 rounded hover:bg-blue-300 dark:hover:bg-blue-600 transition-colors"
title={useV2 ? 'Stari prikaz' : 'Novi prikaz'}
>
{useV2 ? 'V2' : 'V1'}
</button>
<button
onClick={() => setDarkMode(!darkMode)}
className="px-4 py-2 bg-gray-200 dark:bg-gray-700 text-gray-800 dark:text-gray-200 rounded hover:bg-gray-300 dark:hover:bg-gray-600 transition-colors"
title={darkMode ? 'Svetla tema' : 'Tamna tema'}
>
{darkMode ? '☀️' : '🌙'}
</button>
</>
)}
</div>
</div>
@@ -100,11 +116,19 @@ export default function Home() {
</header>
<main className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
<FilamentTable
filaments={filaments}
loading={loading}
error={error || undefined}
/>
{useV2 ? (
<FilamentTableV2
filaments={filaments}
loading={loading}
error={error || undefined}
/>
) : (
<FilamentTable
filaments={filaments}
loading={loading}
error={error || undefined}
/>
)}
</main>
</div>