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

feat: Climb/Route coordinates #1092

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
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
15 changes: 15 additions & 0 deletions src/assets/contributors-map.geojson
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,21 @@
]
}
},
{
"type": "Feature",
"properties": {
"firstName": "Alex",
"githubId": "alexoj46",
"favoriteCrag": "b81f8942-4e04-56eb-a681-84568676c681"
},
"geometry": {
"type": "Point",
"coordinates": [
34.18008,
-85.81680
Comment on lines +149 to +150
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you swap the order? Coordinate pair is expressed as longitude/lat (x,y) in geojson

]
}
},
{
"type": "Feature",
"properties": {
Expand Down
41 changes: 35 additions & 6 deletions src/pages/climbs/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { ClientSideFormSaveAction, Skeleton as ContentSkeleton } from '../../com
import { ArticleLastUpdate } from '../../components/edit/ArticleLastUpdate'
import { TradSportGradeInput, BoulderingGradeInput } from '../../components/edit/form/GradeTextInput'
import Grade from '../../js/grades/Grade'
import { removeTypenameFromDisciplines } from '../../js/utils'
import { getMapHref, removeTypenameFromDisciplines } from '../../js/utils'
import { TotalLengthInput } from '../../components/edit/form/TotalLengthInput'
import { LegacyFAInput } from '../../components/edit/form/LegacyFAInput'
import { getClimbById } from '../../js/graphql/api'
Expand All @@ -35,6 +35,7 @@ import { ClimbList } from '@/app/(default)/editArea/[slug]/general/components/cl
import { getArea } from '@/js/graphql/getArea'
import { climbLeftRightIndexComparator } from '@/js/utils'
import { NeighboringRoutesNav } from '@/components/crag/NeighboringRoute'
import { MapPinLine } from '@phosphor-icons/react/dist/ssr'

export const CLIMB_DESCRIPTION_FORM_VALIDATION_RULES: RulesType = {
maxLength: {
Expand Down Expand Up @@ -110,7 +111,7 @@ const Body = ({ climb, leftClimb, rightClimb, parentArea }: ClimbPageProps): JSX
id, name, fa: legacyFA, length, yds, grades, type, content, safety, metadata, ancestors, pathTokens, authorMetadata,
parent
} = climb
const { climbId } = metadata
const { lat, lng, climbId } = metadata

const gradesObj = new Grade(parent.gradeContext, grades, type, parent.metadata.isBoulder)

Expand Down Expand Up @@ -287,10 +288,38 @@ const Body = ({ climb, leftClimb, rightClimb, parentArea }: ClimbPageProps): JSX
</div>)}
</div>

{(authorMetadata.createdAt != null || authorMetadata.updatedAt != null) &&
<div className='mt-8 border-t border-b'>
<ArticleLastUpdate {...authorMetadata} />
</div>}
{/* trying to put my stuff here */}
<div className='mt-6 flex flex-col text-xs text-secondary border-t border-b divide-y'>
<a
href={getMapHref({
lat,
lng
})}
target='blank'
className='flex items-center gap-2 py-3'
>
<MapPinLine size={20} />
<span className='mt-0.5'>
<b>LAT,LNG</b>&nbsp;
<span className='link-dotted'>
{(lat != null && lng != null)
? (
<span className='link-dotted'>
{lat.toFixed(5)}, {lng.toFixed(5)}
</span>
)
: (
<span className='link-dotted'>
NA, NA
</span>
)}
</span>
</span>
</a>

{(authorMetadata.createdAt != null || authorMetadata.updatedAt != null) &&
<ArticleLastUpdate {...authorMetadata} />}
</div>

{!editMode &&
<div className='mt-8'>
Expand Down
Loading