Skip to content

Commit

Permalink
climbing: show correct number of routes in FeaturePanel (#890)
Browse files Browse the repository at this point in the history
  • Loading branch information
zbycz authored Jan 12, 2025
1 parent fac127a commit dcd5505
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/components/FeaturePanel/MemberFeatures/MemberFeatures.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Box, Chip } from '@mui/material';
import { getOsmappLink } from '../../../services/helpers';
import { getOsmappLink, getReactKey } from '../../../services/helpers';
import { useFeatureContext } from '../../utils/FeatureContext';
import { PanelLabel } from '../Climbing/PanelLabel';
import { Item } from './Item';
Expand Down Expand Up @@ -63,18 +63,18 @@ export const MemberFeatures = () => {
getDividedFeaturesBySections(memberFeatures);
const climbingRoutesFeatures = dividedFeaturesBySections.routes;
const otherFeatures = dividedFeaturesBySections.other;
const headingNum = climbingRoutesFeatures.length || memberFeatures.length;

return (
<Box mb={1}>
<PanelLabel addition={<PanelAddition />}>
{getHeading(feature)}{' '}
<Chip size="small" label={memberFeatures.length} />
{getHeading(feature)} <Chip size="small" label={headingNum} />
</PanelLabel>
{climbingRoutesFeatures.length > 0 && (
<Ul>
{climbingRoutesFeatures.map((item, index) => (
<ClimbingItem
key={getOsmappLink(item)}
key={getReactKey(item)}
feature={item}
index={index}
cragFeature={feature}
Expand All @@ -85,7 +85,7 @@ export const MemberFeatures = () => {
{otherFeatures.length > 0 && (
<Ul>
{otherFeatures.map((item) => (
<Item key={getOsmappLink(item)} feature={item} />
<Item key={getReactKey(item)} feature={item} />
))}
</Ul>
)}
Expand Down

0 comments on commit dcd5505

Please sign in to comment.