Misc frontend fixes

This commit is contained in:
2025-01-28 20:30:26 -05:00
parent 1410dc5571
commit a661b6a11e
7 changed files with 15 additions and 24 deletions

View File

@@ -93,7 +93,7 @@ export function CategoryPerformance() {
>
{data.distribution.map((entry, index) => (
<Cell
key={`${entry.category}-${index}`}
key={`${entry.category}-${entry.value}-${index}`}
fill={COLORS[index % COLORS.length]}
/>
))}
@@ -170,7 +170,7 @@ export function CategoryPerformance() {
<CardContent>
<div className="space-y-4">
{data.performance.map((category) => (
<div key={category.category} className="flex items-center">
<div key={`${category.category}-${category.revenue}`} className="flex items-center">
<div className="flex-1">
<div className="space-y-1">
<p className="text-sm font-medium">{getShortCategoryName(category.categoryPath)}</p>

View File

@@ -154,7 +154,7 @@ export function PriceAnalysis() {
<CardContent>
<div className="space-y-4">
{data.recommendations.map((item) => (
<div key={item.product} className="flex items-center">
<div key={`${item.product}-${item.currentPrice}`} className="flex items-center">
<div className="flex-1">
<p className="text-sm font-medium">{item.product}</p>
<p className="text-sm text-muted-foreground">

View File

@@ -150,7 +150,7 @@ export function ProfitAnalysis() {
<CardContent>
<div className="space-y-4">
{data.topProducts.map((product) => (
<div key={product.product} className="flex items-center">
<div key={`${product.product}-${product.category}`} className="flex items-center">
<div className="flex-1">
<p className="text-sm font-medium">{product.product}</p>
<div className="text-xs text-muted-foreground space-y-1">

View File

@@ -145,7 +145,7 @@ export function StockAnalysis() {
<CardContent>
<div className="space-y-4">
{data.criticalItems.map((item) => (
<div key={item.sku} className="flex items-center">
<div key={`${item.sku}-${item.product}`} className="flex items-center">
<div className="flex-1">
<div className="flex items-center gap-2">
<p className="text-sm font-medium">{item.product}</p>

View File

@@ -131,7 +131,7 @@ export function VendorPerformance() {
<CardContent>
<div className="space-y-4">
{data.performance.map((vendor) => (
<div key={vendor.vendor} className="flex items-center">
<div key={`${vendor.vendor}-${vendor.salesVolume}`} className="flex items-center">
<div className="flex-1">
<p className="text-sm font-medium">{vendor.vendor}</p>
<p className="text-sm text-muted-foreground">

View File

@@ -28,6 +28,11 @@ interface Category {
};
}
interface TypeCount {
type: number;
count: number;
}
interface CategoryFilters {
search: string;
type: string;
@@ -286,7 +291,7 @@ export function Categories() {
</SelectTrigger>
<SelectContent>
<SelectItem value="all">All Types</SelectItem>
{data?.typeCounts?.map(tc => (
{data?.typeCounts?.map((tc: TypeCount) => (
<SelectItem key={tc.type} value={tc.type.toString()}>
{TYPE_LABELS[tc.type]} ({tc.count})
</SelectItem>
@@ -345,9 +350,7 @@ export function Categories() {
<div className="flex flex-col gap-1">
<div className="flex items-center gap-2">
<span className="font-medium">{category.name}</span>
<Badge variant="outline" className="h-5">
{TYPE_LABELS[category.type]}
</Badge>
</div>
{category.description && (
<div className="text-xs text-muted-foreground">{category.description}</div>