fix(frontend): resolve missing formatHeat function in EventChatPage
Bug: EventChatPage referenced formatHeat() function in header's heat display (line 365) but the function was removed during Phase 3 refactoring when creating the HeatBadges component. Solution: 1. Enhanced HeatBadges component with badgeClassName prop to support custom styling (needed for dark header background) 2. Replaced manual heat rendering in EventChatPage header with HeatBadges component 3. Passed custom badge styling to match the dark primary-700 header Changes: - HeatBadges.jsx: Added badgeClassName prop for style customization - EventChatPage.jsx: Replaced manual heat map with HeatBadges component Fixes: "Uncaught ReferenceError: formatHeat is not defined" error
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
* @param {number} maxVisible - Maximum number of badges to show before "+X more" (default: 3)
|
||||
* @param {boolean} compact - Use compact display (default: true)
|
||||
* @param {string} className - Additional CSS classes for container
|
||||
* @param {string} badgeClassName - Custom CSS classes for individual badges (overrides default styling)
|
||||
*
|
||||
* @example
|
||||
* <HeatBadges heats={userHeats} maxVisible={3} />
|
||||
@@ -15,7 +16,8 @@ const HeatBadges = ({
|
||||
heats = [],
|
||||
maxVisible = 3,
|
||||
compact = true,
|
||||
className = ''
|
||||
className = '',
|
||||
badgeClassName = ''
|
||||
}) => {
|
||||
if (!heats || heats.length === 0) return null;
|
||||
|
||||
@@ -39,12 +41,15 @@ const HeatBadges = ({
|
||||
const visibleHeats = heats.slice(0, maxVisible);
|
||||
const remainingCount = heats.length - maxVisible;
|
||||
|
||||
const defaultBadgeClass = "text-xs px-1.5 py-0.5 bg-amber-100 text-amber-800 rounded font-mono";
|
||||
const badgeClass = badgeClassName || defaultBadgeClass;
|
||||
|
||||
return (
|
||||
<div className={`flex flex-wrap gap-1 ${className}`}>
|
||||
{visibleHeats.map((heat, idx) => (
|
||||
<span
|
||||
key={idx}
|
||||
className="text-xs px-1.5 py-0.5 bg-amber-100 text-amber-800 rounded font-mono"
|
||||
className={badgeClass}
|
||||
title={`${heat.competitionType?.name || ''} ${heat.division?.name || ''} Heat ${heat.heatNumber} (${heat.role || ''})`}
|
||||
>
|
||||
{formatHeat(heat)}
|
||||
|
||||
Reference in New Issue
Block a user