Skip to content

Commit

Permalink
reorder
Browse files Browse the repository at this point in the history
  • Loading branch information
karussell committed Jun 4, 2024
1 parent 46bae86 commit b539ae4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 26 deletions.
1 change: 1 addition & 0 deletions src/layers/MapFeaturePopup.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
flex-direction: row;
gap: 7px;
padding-top: 5px;
padding-bottom: 5px;
}

.poiPopupButton svg {
Expand Down
43 changes: 21 additions & 22 deletions src/layers/POIPopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,35 +106,34 @@ export default function POIStatePopup({ map, poiState }: POIStatePopupProps) {
<div className={styles.poiPopup}>
<div>{selectedPOI?.name}</div>
<div>{selectedPOI?.address}</div>
<div
className={styles.poiPopupButton}
onClick={() => {
if (selectedPOI && oldQueryPoint) {
// TODO NOW how to use the POI as either start or destination?
// Might be too unintuitive if it relies on with which input we searched the POIs
const queryPoint = {
...oldQueryPoint,
queryText: selectedPOI?.name,
coordinate: selectedPOI?.coordinate,
isInitialized: true,
}
Dispatcher.dispatch(new SetPoint(queryPoint, false))
Dispatcher.dispatch(new SelectPOI(null))
Dispatcher.dispatch(new SetPOIs([], null))
}
}}
>
{oldQueryPoint && <MarkerComponent color={oldQueryPoint.color} size={18} />}
<PlainButton>{tr('Use in route')}</PlainButton>
</div>
{Object.keys(kv).length == 0 && <PlainButton>{tr('Fetching more info...')}</PlainButton>}
<KVTable kv={kv} poi={selectedPOI} />
<div className={styles.osmLink}>
<a href={'https://www.openstreetmap.org/' + type + '/' + selectedPOI?.osm_id} target="_blank">
OpenStreetMap.org
</a>
</div>
<div className={styles.poiPopupButton}>
{oldQueryPoint && <MarkerComponent color={oldQueryPoint.color} size={18} />}
<PlainButton
onClick={() => {
if (selectedPOI && oldQueryPoint) {
// TODO NOW how to use the POI as either start or destination?
// Might be too unintuitive if it relies on with which input we searched the POIs
const queryPoint = {
...oldQueryPoint,
queryText: selectedPOI?.name,
coordinate: selectedPOI?.coordinate,
isInitialized: true,
}
Dispatcher.dispatch(new SetPoint(queryPoint, false))
Dispatcher.dispatch(new SelectPOI(null))
Dispatcher.dispatch(new SetPOIs([], null))
}
}}
>
{tr('Use in route')}
</PlainButton>
</div>
</div>
</MapPopup>
)
Expand Down
9 changes: 5 additions & 4 deletions src/pois/AddressParseResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,11 @@ export class AddressParseResult {

// because of the static method we need to inject the Translation object as otherwise jest has a problem
static setPOITriggerPhrases(translation: Translation) {
const t = (s: string) => translation
.get(s)
.split(',')
.map(s => s.trim().toLowerCase())
const t = (s: string) =>
translation
.get(s)
.split(',')
.map(s => s.trim().toLowerCase())
AddressParseResult.REMOVE_VALUES = t('poi_removal_words')
AddressParseResult.TRIGGER_VALUES = [
{ k: 'poi_airports', t: ['aeroway:aerodrome'], i: 'flight_takeoff' },
Expand Down

0 comments on commit b539ae4

Please sign in to comment.