< Summary - Frontend Coverage Report (WSL)

Information
Class: src/components/InventoryPanel.js
Assembly: Default
File(s): src/components/InventoryPanel.js
Line coverage
100%
Covered lines: 53
Uncovered lines: 0
Coverable lines: 53
Total lines: 53
Line coverage: 100%
Branch coverage
40%
Covered branches: 2
Total branches: 5
Branch coverage: 40%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

File(s)

src/components/InventoryPanel.js

#LineLine coverage
 11import React from 'react';
 12import { useMaintenance } from '../context/MaintenanceContext.js';
 13import { Box, AlertTriangle, CheckCircle } from 'lucide-react';
 14
 15export function InventoryPanel() {
 176    const { inventory } = useMaintenance();
 177
 178    return (
 179        <div style={{ padding: '15px' }}>
 1710            <div style={{ display: 'flex', alignItems: 'center', gap: '10px', marginBottom: '20px' }}>
 1711                <Box size={20} color="#e74c3c" />
 1712                <h3 style={{ margin: 0 }}>Parts & Inventory</h3>
 1713            </div>
 1714
 1715            <div style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>
 1716                {inventory.map((item) => {
 117                    const isCritical = item.quantity <= item.min_stock;
 118                    return (
 119                        <div key={item.id} style={{
 120                            padding: '12px',
 121                            borderRadius: '8px',
 122                            backgroundColor: '#f8f9fa',
 123                            border: `1px solid ${isCritical ? '#fab1a0' : '#e1e4e8'}`,
 124                            display: 'flex',
 125                            justifyContent: 'space-between',
 126                            alignItems: 'center'
 127                        }}>
 128                            <div>
 129                                <div style={{ fontWeight: 'bold', fontSize: '0.9rem' }}>{item.part_name}</div>
 130                                <div style={{ fontSize: '0.7rem', color: '#7f8c8d' }}>SKU: {item.sku}</div>
 131                            </div>
 132
 133                            <div style={{ textAlign: 'right' }}>
 134                                <div style={{
 135                                    display: 'flex',
 136                                    alignItems: 'center',
 137                                    gap: '5px',
 138                                    color: isCritical ? '#e17055' : '#27ae60',
 139                                    fontWeight: 'bold',
 140                                    fontSize: '1rem'
 141                                }}>
 142                                    {item.quantity}
 143                                    {isCritical ? <AlertTriangle size={14} /> : <CheckCircle size={14} />}
 144                                </div>
 145                                <div style={{ fontSize: '0.7rem', color: '#95a5a6' }}>Min: {item.min_stock}</div>
 146                            </div>
 147                        </div>
 148                    );
 1749                })}
 1750            </div>
 1751        </div>
 1752    );
 1753}

Methods/Properties

InventoryPanel