{"version":3,"file":"Footer.mjs","names":[],"sources":["../../src/Heatmaps/Footer.tsx"],"sourcesContent":["import { cx } from 'antd-style';\nimport isEqual from 'fast-deep-equal';\nimport { memo, useMemo } from 'react';\n\nimport { styles } from './styles';\n\ninterface TotalCountProps {\n  totalCount: number;\n  totalCountText?: string;\n  year: number;\n}\n\n// Simple component - memo not needed as props are primitives and component is lightweight\nconst TotalCount = ({ totalCount, year, totalCountText }: TotalCountProps) => {\n  const text = useMemo(() => {\n    if (totalCountText) {\n      return totalCountText\n        .replace('{{count}}', String(totalCount))\n        .replace('{{year}}', String(year));\n    }\n    return `${totalCount} activities in ${year}`;\n  }, [totalCountText, totalCount, year]);\n\n  return <div className={cx('count')}>{text}</div>;\n};\n\nTotalCount.displayName = 'TotalCount';\n\ninterface ColorLegendProps {\n  blockRadius: number;\n  blockSize: number;\n  colorScale: string[];\n  lessLabel: string;\n  maxLevel: number;\n  moreLabel: string;\n}\n\n// Simple component - Footer already memoized, so this doesn't need memo\nconst ColorLegend = ({\n  blockSize,\n  blockRadius,\n  colorScale,\n  maxLevel,\n  lessLabel,\n  moreLabel,\n}: ColorLegendProps) => {\n  const colorLevels = useMemo(() => {\n    return Array.from({ length: maxLevel + 1 }, (_, level) => level);\n  }, [maxLevel]);\n\n  return (\n    <div className={cx('legend-colors', styles.legendColors)}>\n      <span style={{ marginRight: '0.4em' }}>{lessLabel}</span>\n      {colorLevels.map((level) => (\n        <svg height={blockSize} key={level} width={blockSize}>\n          <rect\n            fill={colorScale[level]}\n            height={blockSize}\n            rx={blockRadius}\n            ry={blockRadius}\n            width={blockSize}\n          />\n        </svg>\n      ))}\n      <span style={{ marginLeft: '0.4em' }}>{moreLabel}</span>\n    </div>\n  );\n};\n\nColorLegend.displayName = 'ColorLegend';\n\ninterface FooterProps {\n  blockRadius: number;\n  blockSize: number;\n  colorScale: string[];\n  hideColorLegend?: boolean;\n  hideTotalCount?: boolean;\n  labels: {\n    legend: {\n      less: string;\n      more: string;\n    };\n    totalCount?: string;\n  };\n  loading: boolean;\n  maxLevel: number;\n  totalCount: number;\n  weekdayLabelOffset?: number;\n  year: number;\n}\n\nconst Footer = memo<FooterProps>(\n  ({\n    hideTotalCount,\n    hideColorLegend,\n    weekdayLabelOffset,\n    loading,\n    labels,\n    year,\n    maxLevel,\n    blockSize,\n    colorScale,\n    blockRadius,\n    totalCount,\n  }) => {\n    // Memoize footer style\n    const footerStyle = useMemo(() => {\n      return { marginLeft: weekdayLabelOffset };\n    }, [weekdayLabelOffset]);\n\n    return (\n      <footer className={cx('footer', styles.footer)} style={footerStyle}>\n        {/* Placeholder */}\n        {loading && <div>&nbsp;</div>}\n\n        {!loading && !hideTotalCount && (\n          <TotalCount totalCount={totalCount} totalCountText={labels.totalCount} year={year} />\n        )}\n\n        {!loading && !hideColorLegend && (\n          <ColorLegend\n            blockRadius={blockRadius}\n            blockSize={blockSize}\n            colorScale={colorScale}\n            lessLabel={labels.legend.less}\n            maxLevel={maxLevel}\n            moreLabel={labels.legend.more}\n          />\n        )}\n      </footer>\n    );\n  },\n  isEqual,\n);\n\nFooter.displayName = 'Footer';\n\nexport default Footer;\n"],"mappings":";;;;;;AAaA,MAAM,cAAc,EAAE,YAAY,MAAM,qBAAsC;CAC5E,MAAM,OAAO,cAAc;EACzB,IAAI,gBACF,OAAO,eACJ,QAAQ,aAAa,OAAO,UAAU,CAAC,CAAC,CACxC,QAAQ,YAAY,OAAO,IAAI,CAAC;EAErC,OAAO,GAAG,WAAW,iBAAiB;CACxC,GAAG;EAAC;EAAgB;EAAY;CAAI,CAAC;CAErC,OAAO,oBAAC,OAAD;EAAK,WAAW,GAAG,OAAO;EAAI,UAAA;CAAU,CAAA;AACjD;AAEA,WAAW,cAAc;AAYzB,MAAM,eAAe,EACnB,WACA,aACA,YACA,UACA,WACA,gBACsB;CACtB,MAAM,cAAc,cAAc;EAChC,OAAO,MAAM,KAAK,EAAE,QAAQ,WAAW,EAAE,IAAI,GAAG,UAAU,KAAK;CACjE,GAAG,C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