diff --git a/apps/desktop/src/components/material/MaterialCard.tsx b/apps/desktop/src/components/material/MaterialCard.tsx index 1a0d49a..3129457 100644 --- a/apps/desktop/src/components/material/MaterialCard.tsx +++ b/apps/desktop/src/components/material/MaterialCard.tsx @@ -63,6 +63,170 @@ const MaterialCard: React.FC = ({ const primaryProduct = material.products[0]; const hasMultipleProducts = material.products.length > 1; + // 列表视图的特殊布局 + if (compact) { + return ( +
setIsHovered(true)} + onMouseLeave={() => setIsHovered(false)} + > + {/* 装饰性背景 */} +
+ + {/* 左侧图片 */} +
+
+ {!imageError ? ( + {material.style_description} + ) : ( +
+ +
+ )} + + {/* 加载状态 */} + {!imageLoaded && !imageError && ( +
+
+
+ )} +
+ + {/* 评分标识 */} + {showScore && ( +
+ + {MaterialSearchService.formatRelevanceScore(material.relevance_score)} +
+ )} +
+ + {/* 中间内容 */} +
+ {/* 标题和描述 */} +
+

+ {material.style_description || '时尚素材'} +

+ {primaryProduct && ( +

+ {primaryProduct.description} +

+ )} +
+ + {/* 标签行 */} +
+ {/* 类别标签 */} + {primaryProduct && ( +
+ + {primaryProduct.category} + {hasMultipleProducts && ( + +{material.products.length - 1} + )} +
+ )} + + {/* 环境标签 */} + {material.environment_tags.slice(0, 2).map((tag, index) => ( +
+ {tag} +
+ ))} + {material.environment_tags.length > 2 && ( +
+ +{material.environment_tags.length - 2} +
+ )} +
+ + {/* 设计风格 */} + {primaryProduct && primaryProduct.design_styles.length > 0 && ( +
+ {primaryProduct.design_styles.slice(0, 3).map((style, index) => ( +
+ {style} +
+ ))} + {primaryProduct.design_styles.length > 3 && ( +
+ +{primaryProduct.design_styles.length - 3} +
+ )} +
+ )} +
+ + {/* 右侧操作区域 */} +
+ {/* 颜色信息 */} + {primaryProduct && ( +
+ +
+
+ )} + + {/* 操作按钮 */} + + + {/* 时间信息 */} +
+ {new Date(material.created_at).toLocaleDateString()} +
+
+ + {/* AI推荐标识 */} +
+ + AI推荐 +
+
+ ); + } + + // 网格视图的原有布局 return (
= ({ hover:shadow-lg hover:shadow-primary-500/10 hover:-translate-y-1 border border-gray-200 hover:border-primary-300 transform-gpu will-change-transform - ${compact ? 'p-4' : 'p-5'} + p-5 ${className} `} onClick={handleCardClick} diff --git a/apps/desktop/src/components/material/MaterialSearchResults.tsx b/apps/desktop/src/components/material/MaterialSearchResults.tsx index d3f94d6..b19205f 100644 --- a/apps/desktop/src/components/material/MaterialSearchResults.tsx +++ b/apps/desktop/src/components/material/MaterialSearchResults.tsx @@ -191,7 +191,7 @@ const MaterialSearchResults: React.FC = ({
{results.map((material, index) => ( = ({ onSelect={handleMaterialSelect} showScore={true} compact={viewMode === 'list'} - className={`animate-fade-in-up ${isLoading ? 'opacity-50 pointer-events-none' : ''} ${ - viewMode === 'list' ? 'flex flex-row items-center gap-4 p-4' : '' - }`} + className={`animate-fade-in-up ${isLoading ? 'opacity-50 pointer-events-none' : ''}`} /> ))}