Skip to content

Commit

Permalink
Début de l'infra pour l'annuaire des lieux
Browse files Browse the repository at this point in the history
  • Loading branch information
laem committed Jan 18, 2025
1 parent 3341150 commit c70c936
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 15 deletions.
5 changes: 3 additions & 2 deletions app/QuickFeatureSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ export const exactThreshold = 0.005
export default function QuickFeatureSearch({
searchParams,
searchInput,
setSnap,
setSnap = () => null,
snap,
quickSearchFeaturesMap,
center,
noPhotos = false,
}) {
const [categoriesSet] = getCategories(searchParams)
console.log('indigo t', categoriesSet)
Expand Down Expand Up @@ -97,7 +98,7 @@ export default function QuickFeatureSearch({
<div>
<FeatureListWrapper>
<FeatureList $showMore={showMore}>
{!doFilter && (
{!doFilter && !noPhotos && (
<>
<QuickSearchElement
key="photos"
Expand Down
36 changes: 36 additions & 0 deletions app/lieux/[ville]/Annuaire.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import QuickFeatureSearch from '@/app/QuickFeatureSearch'
import { PresentationWrapper } from '@/app/presentation/UI'
import StaticPageHeader from '@/components/StaticPageHeader'
import { buildPlaceMap } from '@/components/buildPlaceMap'
import { capitalise0 } from '@/components/utils/utils'
import { styled } from 'next-yak'
import Image from 'next/image'

const description = ''
export default function Page({ ville, searchParams }) {
return (
<PresentationWrapper>
<StaticPageHeader small={true} />
<header>
<h1>Annuaire des lieux de {capitalise0(ville)}</h1>
<p>{description}</p>
<PlaceImage
src={buildPlaceMap(48.1113404, -1.6793235)}
width="200"
height="200"
alt={'Miniature de la carte de ' + ville}
/>
</header>
<QuickFeatureSearch
{...{ quickSearchFeaturesMap: {}, searchParams, noPhotos: true }}
/>
</PresentationWrapper>
)
}

const PlaceImage = styled(Image)`
width: 14rem;
height: 8rem;
object-fit: cover;
border-radius: 2rem;
`
12 changes: 12 additions & 0 deletions app/lieux/[ville]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Annuaire from './Annuaire'

export const metadata: Metadata = {
title: '',
description: '',
}

export default async function (props) {
const { ville } = await props.params
const searchParams = await props.searchParams
return <Annuaire ville={ville} searchParams={searchParams} />
}
7 changes: 1 addition & 6 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import getName from './osm/getName'
import getUrl from './osm/getUrl'
import { getFetchUrlBase, gtfsServerUrl } from './serverUrls'
import { stepOsmRequest } from './stepOsmRequest'
import { buildPlaceMap } from '@/components/buildPlaceMap'

export async function generateMetadata(
props: Props,
Expand Down Expand Up @@ -151,9 +152,3 @@ const Page = async (props) => {
}

export default Page

export function buildPlaceMap(lat, lon) {
return (
lat && lon && `${gtfsServerUrl}/placeMap/?lat=${lat}&lon=${lon}&zoom=13`
)
}
2 changes: 1 addition & 1 deletion components/StaticPageHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function ({ small }) {
font-size: 130%;
margin-bottom: 0.4rem;
`
: ''
: css``
}
>
<Image src={Logo} alt="Logo de cartes.app" /> Cartes
Expand Down
7 changes: 7 additions & 0 deletions components/buildPlaceMap.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { gtfsServerUrl } from '@/app/serverUrls'

export function buildPlaceMap(lat, lon) {
return (
lat && lon && `${gtfsServerUrl}/placeMap/?lat=${lat}&lon=${lon}&zoom=13`
)
}
10 changes: 4 additions & 6 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,12 @@ const nextConfig = {
protocol: 'https',
hostname: 'avatars.githubusercontent.com',
},
{
protocol: 'https',
hostname: 'serveur.cartes.app',
},
],
},
/*
compilerOptions: {
baseUrl: '.',
},
*/
eslint: {
// Warning: This allows production builds to successfully complete even if
// your project has ESLint errors.
Expand Down Expand Up @@ -154,4 +153,3 @@ export default withSentryConfig(
automaticVercelMonitors: true,
}
)

0 comments on commit c70c936

Please sign in to comment.