Skip to content

Commit

Permalink
FeaturePanel: add geoUri to coordinates dropdown (#153)
Browse files Browse the repository at this point in the history
* FeaturePanel: add geoUri to coordinates dropdown

* added polish translation (#170)

* mobile only + translations

---------

Co-authored-by: orl0pl <93262125+orl0pl@users.noreply.github.com>
  • Loading branch information
zbycz and orl0pl authored Feb 18, 2024
1 parent 7ac8bf8 commit 5ec6213
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/components/FeaturePanel/Coordinates.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { useFeatureContext } from '../utils/FeatureContext';
import { getIdEditorLink, positionToDeg, positionToDM } from '../../utils';
import { PositionBoth } from '../../services/types';
import { getFullOsmappLink } from '../../services/helpers';
import { t } from '../../services/intl';

const StyledMenuItem = styled(MenuItem)`
svg {
Expand Down Expand Up @@ -47,7 +48,9 @@ export const ToggleButton = forwardRef<any, any>(

const CopyTextItem = ({ text }) => (
<MenuItem onClick={() => navigator.clipboard.writeText(text)}>
Copy {text.replace(/^https:\/\//, '')}
{t('coordinates.copy_value', {
value: text.replace(/^https:\/\//, ''),
})}
</MenuItem>
);

Expand Down Expand Up @@ -93,6 +96,14 @@ const useGetItems = ([lon, lat]: PositionBoth) => {
label: 'iD editor',
href: getIdEditorLink(feature, view), // TODO coordsFeature has random id which gets forwarded LOL
},
...(/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)
? [
{
label: t('coordinates.geo_uri'),
href: `geo:${lat},${lon}`,
},
]
: []),
];
};

Expand Down
3 changes: 3 additions & 0 deletions src/locales/cs.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ export default {
'tags.phone': 'Telefon',
'tags.opening_hours': 'Otevírací doba',

'coordinates.geo_uri': 'GeoURI (mapová appka v telefonu)',
'coordinates.copy_value': 'Copy __value__', // keep it short, don't mention clipboard

'layerswitcher.button': 'Mapy',
'layerswitcher.heading': 'Mapové vrstvy',
'layerswitcher.intro': 'Díky tomu, že OpenStreetMap nabízí zdrojová data, tak kdokoliv může vyrobit různé varianty mapy.',
Expand Down
3 changes: 3 additions & 0 deletions src/locales/pl.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ export default {
'tags.phone': 'Telefon',
'tags.opening_hours': 'Godziny otwarcia',

'coordinates.geo_uri': 'GeoURI (aplikacja mapowa na telefonie)',
'coordinates.copy_value': 'Kopiuj __value__', // keep it short, don't mention clipboard

'layerswitcher.button': 'Mapy',
'layerswitcher.heading': 'Warstwy mapy',
'layerswitcher.intro': 'Dzięki temu, że OpenStreetMap oferuje dane źródłowe, każdy może stworzyć różne warianty mapy.',
Expand Down
3 changes: 3 additions & 0 deletions src/locales/vocabulary.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ export default {
'tags.phone': 'Phone',
'tags.opening_hours': 'Hours',

'coordinates.geo_uri': 'GeoURI (phone map app)',
'coordinates.copy_value': 'Copy __value__', // keep it short, don't mention clipboard

'layerswitcher.button': 'Layers',
'layerswitcher.heading': 'Map layers',
'layerswitcher.intro': 'Thanks to the fact that OpenStreetMap offers source data, anyone can produce different variants of the map.',
Expand Down

0 comments on commit 5ec6213

Please sign in to comment.