Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

climbing: add other list below CragsInArea #949

Merged
merged 1 commit into from
Feb 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions src/components/FeaturePanel/CragsInArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import React from 'react';
import Router from 'next/router';
import ArrowForwardIosIcon from '@mui/icons-material/ArrowForwardIos';
import { useFeatureContext } from '../utils/FeatureContext';
import { getOsmappLink, getUrlOsmId } from '../../services/helpers';
import {
getOsmappLink,
getReactKey,
getUrlOsmId,
} from '../../services/helpers';
import { Feature, isInstant } from '../../services/types';
import { useMobileMode } from '../helpers';
import { getLabel } from '../../helpers/featureLabel';
Expand All @@ -17,9 +21,15 @@ import Link from 'next/link';
import { naturalSort } from './Climbing/utils/array';
import { PanelLabel } from './Climbing/PanelLabel';
import { PROJECT_ID } from '../../services/project';
import { Item } from './MemberFeatures/Item';

const isOpenClimbing = PROJECT_ID === 'openclimbing';

const Ul = styled.ul`
padding: 0;
list-style: none;
`;

const ArrowIcon = styled(ArrowForwardIosIcon)`
opacity: 0.2;
margin-left: 12px;
Expand Down Expand Up @@ -155,6 +165,9 @@ export const CragsInArea = () => {
return null;
}

const crags = feature.memberFeatures.filter(({ tags }) => tags.climbing);
const other = feature.memberFeatures.filter(({ tags }) => !tags.climbing);

return (
<>
<PanelLabel>
Expand All @@ -165,10 +178,18 @@ export const CragsInArea = () => {
</PanelLabel>
<Box mt={2} mb={2}>
<CragList>
{feature.memberFeatures.map((item) => (
{crags.map((item) => (
<CragItem key={getOsmappLink(item)} feature={item} />
))}
</CragList>

{other.length > 0 && (
<Ul>
{other.map((item) => (
<Item key={getReactKey(item)} feature={item} />
))}
</Ul>
)}
</Box>
</>
);
Expand Down