feat(settings): pick your own map template or the theme style for MapLibre

The MapLibre style picker offers two more entries after the OpenFreeMap
styles: OpenFreeMap that follows the light or dark theme (trek:ofm-auto),
and the user's own map template (trek:template), which brings the template
field under the picker, and the CARTO key for a CARTO template. Where the
trip map will draw the template with the classic 2D map (Amap, a host the
CSP does not name) the form says so and the preview shows that map. The
preview draws exactly what the trip map will.

Every place the forms load or save a MapLibre style keeps a keyword now,
where it used to turn it into Liberty on the first unchanged save: the
user form on desktop and phone (load, save, the phone's mirrored field,
a provider switch there and back) and the admin defaults (provider switch,
preset pick, typed style). The rules live in mapSettingsModel, so both
shells render from one decision:

- the template keyword with an empty template saves Liberty;
- switching from Leaflet with a template and an empty MapLibre slot
  preselects the template, shown and not saved until Save;
- Leaflet never writes a keyword into the Mapbox slot, and Mapbox shows its
  default for one.

New strings in all locales.
This commit is contained in:
Maurice
2026-11-30 15:35:46 +01:00
parent d39d544297
commit 69eacd5316
40 changed files with 726 additions and 147 deletions
@@ -158,4 +158,44 @@ describe('useDefaultUserSettings', () => {
await waitFor(() => expect(update).toHaveBeenLastCalledWith({ maplibre_style: OPENFREEMAP_DEFAULT_STYLE }));
await waitFor(() => expect(toast.success).toHaveBeenCalledTimes(3));
});
it('FE-COMP-DEFAULTSETTINGS-007: a MapLibre keyword default survives loading, a switch, a pick and a typed commit', async () => {
const update = stub({
map_provider: 'maplibre-gl',
maplibre_style: 'trek:template',
mapbox_style: 'mapbox://styles/me/x',
});
const { result } = await loaded();
expect(result.current.mapboxStyle).toBe('trek:template');
// The picker names both keywords after the OpenFreeMap styles.
expect(result.current.glStylePresets.slice(-2)).toEqual([
{ name: 'settings.mapStyleFollowTheme', url: 'trek:ofm-auto', tags: ['OpenFreeMap'] },
{ name: 'settings.mapStyleTemplate', url: 'trek:template' },
]);
act(() => result.current.commitStyle());
await waitFor(() => expect(update).toHaveBeenLastCalledWith({ maplibre_style: 'trek:template' }));
act(() => result.current.saveMapProvider('mapbox-gl'));
await waitFor(() =>
expect(update).toHaveBeenLastCalledWith({ map_provider: 'mapbox-gl', mapbox_style: 'mapbox://styles/me/x' })
);
act(() => result.current.saveMapProvider('maplibre-gl'));
await waitFor(() =>
expect(update).toHaveBeenLastCalledWith({ map_provider: 'maplibre-gl', maplibre_style: 'trek:template' })
);
expect(result.current.mapboxStyle).toBe('trek:template');
act(() => result.current.pickStylePreset('trek:ofm-auto'));
await waitFor(() => expect(update).toHaveBeenLastCalledWith({ maplibre_style: 'trek:ofm-auto' }));
});
it('FE-COMP-DEFAULTSETTINGS-008: a keyword typed for Mapbox is not kept, Mapbox draws neither', async () => {
const update = stub({ map_provider: 'mapbox-gl', mapbox_style: 'trek:template' });
const { result } = await loaded();
expect(result.current.mapboxStyle).toBe(MAPBOX_DEFAULT_STYLE);
expect(result.current.glStylePresets.map((p) => p.url)).not.toContain('trek:template');
act(() => result.current.commitStyle());
await waitFor(() => expect(update).toHaveBeenLastCalledWith({ mapbox_style: MAPBOX_DEFAULT_STYLE }));
});
});
@@ -7,16 +7,13 @@ import { useAuthStore } from '../../store/authStore';
import { useSettingsStore } from '../../store/settingsStore';
import type { DateFormat, DistanceUnit, Place, WeekStart } from '../../types';
import { normalizeTileUrl } from '../../utils/tileUrl';
import {
defaultStyleForProvider,
getStylePresets,
normalizeStyleForProvider,
styleSettingKey,
} from '../Map/glProviders';
import { defaultStyleForProvider, styleSettingKey } from '../Map/glProviders';
import {
type MapProvider,
glStylePresetsFor,
mapboxOffered,
mapPresetsFor,
normalizeGlSelection,
normalizeProvider,
styleForProvider,
} from '../Settings/mapSettingsModel';
@@ -127,7 +124,8 @@ export function useDefaultUserSettings({ errorMessage, previewCreatedAt }: Defau
const [mapPreviewPlaces] = useState((): Place[] => [adminPreviewPlace(previewCreatedAt())]);
const mapProvider = normalizeProvider(defaults.map_provider);
const glStylePresets = mapProvider === 'leaflet' ? [] : getStylePresets(mapProvider);
// MapLibre also offers its keywords: a default that follows the colour scheme, or the template above.
const glStylePresets = mapProvider === 'leaflet' ? [] : glStylePresetsFor(mapProvider, t);
const styleKey: keyof Defaults = mapProvider === 'maplibre-gl' ? 'maplibre_style' : 'mapbox_style';
const saveMapProvider = (nextProvider: MapProvider) => {
@@ -158,11 +156,11 @@ export function useDefaultUserSettings({ errorMessage, previewCreatedAt }: Defau
}
};
/** A typed style is normalized for the provider before it is saved. */
/** A typed style is normalized for the provider before it is saved; a MapLibre keyword stays. */
const commitStyle = () => {
// The style input never renders for leaflet; this only narrows the provider type.
if (mapProvider === 'leaflet') return;
const nextStyle = normalizeStyleForProvider(mapProvider, mapboxStyle);
const nextStyle = normalizeGlSelection(mapProvider, mapboxStyle);
setMapboxStyle(nextStyle);
void save({ [styleKey]: nextStyle });
};
@@ -1,4 +1,4 @@
// FE-COMP-MAP-001 to FE-COMP-MAP-036
// FE-COMP-MAP-001 to FE-COMP-MAP-037
import { render, screen, waitFor, within, fireEvent } from '../../../tests/helpers/render';
import userEvent from '@testing-library/user-event';
import { useAuthStore } from '../../store/authStore';
@@ -482,4 +482,28 @@ describe('MapSettingsTab – CARTO key', () => {
await user.click(screen.getByText('Save Map'));
expect(updateSettings).toHaveBeenCalledWith(expect.objectContaining({ map_hide_basemap_pois: true }));
});
it('FE-COMP-MAP-037: MapLibre picks its own map template from the style picker and saves both keys', async () => {
const user = userEvent.setup();
const updateSettings = vi.fn().mockResolvedValue(undefined);
seedStore(useSettingsStore, { settings: buildSettings({ map_provider: 'maplibre-gl', map_tile_url: '' }), updateSettings });
render(<MapSettingsTab />);
expect(screen.queryByText('Map Template')).not.toBeInTheDocument();
await user.click(within(styleDropdown()).getByRole('button'));
await user.click(await screen.findByText('My map template'));
// The URL box goes, the template field and its picker follow the style picker.
expect(screen.queryByDisplayValue('trek:template')).not.toBeInTheDocument();
expect(screen.getByText('Map Template')).toBeInTheDocument();
await user.click(screen.getByText('Select template...'));
await user.click(await screen.findByText('OpenStreetMap DE'));
await user.click(screen.getByText('Save Map'));
expect(updateSettings).toHaveBeenCalledWith(expect.objectContaining({
map_provider: 'maplibre-gl',
maplibre_style: 'trek:template',
map_tile_url: 'https://tile.openstreetmap.de/{z}/{x}/{y}.png',
}));
});
});
@@ -14,7 +14,7 @@ import Section from './Section'
import ToggleSwitch from './ToggleSwitch'
import { SETTINGS_BUTTON_PRIMARY, SettingRow, SettingRows, SettingsHint, StatusPill } from './settingsKit'
import { withTileApiKey } from '../../utils/tileUrl'
import { defaultStyleForProvider, getStylePresets, type GlMapProvider } from '../Map/glProviders'
import { defaultStyleForProvider, type GlMapProvider, type GlStylePreset } from '../Map/glProviders'
import { PREVIEW_CENTER, PREVIEW_ZOOM } from './mapSettingsModel'
import { useMapSettingsForm } from './useMapSettingsForm'
@@ -30,11 +30,15 @@ function TagChip({ tag }: { tag: string }) {
)
}
function StyleDropdown({ value, provider, onChange }: { value: string; provider: GlMapProvider; onChange: (v: string) => void }) {
function StyleDropdown({ value, provider, presets, onChange }: {
value: string
provider: GlMapProvider
presets: GlStylePreset[]
onChange: (v: string) => void
}) {
const { t } = useTranslation()
const [open, setOpen] = useState(false)
const ref = useRef<HTMLDivElement>(null)
const presets = getStylePresets(provider)
useEffect(() => {
if (!open) return
@@ -130,8 +134,9 @@ function ProviderTile({ active, onClick, icon: Icon, name, subtitle, badge }: {
export default function MapSettingsTab(): React.ReactElement {
const { t } = useTranslation()
const {
managed, presets, canMapbox, saving, provider, changeProvider, mapTileUrl, setMapTileUrl, mapboxToken, setMapboxToken,
cartoKey, setCartoKey, cartoNeedsKey, mapboxStyle, setMapboxStyle, mapbox3d, setMapbox3d,
managed, presets, stylePresets, canMapbox, saving, provider, changeProvider, mapTileUrl, setMapTileUrl,
templateMode, templateNeedsClassic, showCartoKey, mapboxToken, setMapboxToken,
cartoKey, setCartoKey, cartoNeedsKey, mapboxStyle, setMapboxStyle, showStyleUrl, previewStyle, mapbox3d, setMapbox3d,
mapboxQuality, setMapboxQuality, hideBasemapPois, setHideBasemapPois, mapboxPreview, previewPlaces, glPreview,
webgl2Missing, save: saveMapSettings,
} = useMapSettingsForm()
@@ -145,6 +150,60 @@ export default function MapSettingsTab(): React.ReactElement {
const supports3d = true
const link = 'font-medium text-content-secondary underline decoration-edge underline-offset-2 hover:text-content'
// The map template and its CARTO key: right under the provider on Leaflet, under the
// style picker on MapLibre once its own map template is picked there.
const templateFields = (
<>
<EditorField label={t('settings.mapTemplate')} htmlFor={`${fieldId}-tile`} hint={t('settings.mapDefaultHint')}>
<div className="flex flex-col gap-2">
<CustomSelect
value={mapTileUrl}
onChange={(value: string) => { if (value) setMapTileUrl(value) }}
placeholder={t('settings.mapTemplatePlaceholder.select')}
options={presets.map(p => ({ value: p.url, label: p.name }))}
/>
<input
id={`${fieldId}-tile`}
type="text"
value={mapTileUrl}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setMapTileUrl(e.target.value)}
placeholder="https://tile.openstreetmap.org/{z}/{x}/{y}.png"
className={CODE_INPUT}
/>
</div>
</EditorField>
{templateNeedsClassic && <SettingsHint>{t('settings.mapTemplateClassicHint')}</SettingsHint>}
{/* Same deal as the Mapbox token: a managed install brings its own key. */}
{showCartoKey && (
<EditorField
label={t('settings.mapCartoKey')}
htmlFor={`${fieldId}-carto`}
hint={
<>
{t('settings.mapCartoKeyHint')}{' '}
<a href="https://carto.com/basemaps/apikey/" target="_blank" rel="noreferrer" className={link}>
{t('settings.mapCartoKeyLink')}
</a>
{cartoNeedsKey && (
<span className="mt-1 block font-medium text-warning">{t('settings.mapCartoKeyMissing')}</span>
)}
</>
}
>
<input
id={`${fieldId}-carto`}
type="text"
value={cartoKey}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setCartoKey(e.target.value)}
spellCheck={false}
autoComplete="off"
className={CODE_INPUT}
/>
</EditorField>
)}
</>
)
return (
<Section title={t('settings.map')} icon={Map}>
{/* Provider picker — big tiles so the choice is obvious */}
@@ -179,55 +238,7 @@ export default function MapSettingsTab(): React.ReactElement {
</SettingRows>
{/* Leaflet settings */}
{provider === 'leaflet' && (
<EditorField label={t('settings.mapTemplate')} htmlFor={`${fieldId}-tile`} hint={t('settings.mapDefaultHint')}>
<div className="flex flex-col gap-2">
<CustomSelect
value={mapTileUrl}
onChange={(value: string) => { if (value) setMapTileUrl(value) }}
placeholder={t('settings.mapTemplatePlaceholder.select')}
options={presets.map(p => ({ value: p.url, label: p.name }))}
/>
<input
id={`${fieldId}-tile`}
type="text"
value={mapTileUrl}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setMapTileUrl(e.target.value)}
placeholder="https://tile.openstreetmap.org/{z}/{x}/{y}.png"
className={CODE_INPUT}
/>
</div>
</EditorField>
)}
{/* Same deal as the Mapbox token: a managed install brings its own key. */}
{provider === 'leaflet' && !managed && (
<EditorField
label={t('settings.mapCartoKey')}
htmlFor={`${fieldId}-carto`}
hint={
<>
{t('settings.mapCartoKeyHint')}{' '}
<a href="https://carto.com/basemaps/apikey/" target="_blank" rel="noreferrer" className={link}>
{t('settings.mapCartoKeyLink')}
</a>
{cartoNeedsKey && (
<span className="mt-1 block font-medium text-warning">{t('settings.mapCartoKeyMissing')}</span>
)}
</>
}
>
<input
id={`${fieldId}-carto`}
type="text"
value={cartoKey}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setCartoKey(e.target.value)}
spellCheck={false}
autoComplete="off"
className={CODE_INPUT}
/>
</EditorField>
)}
{provider === 'leaflet' && templateFields}
{/* GL settings */}
{provider !== 'leaflet' && (
@@ -264,18 +275,23 @@ export default function MapSettingsTab(): React.ReactElement {
hint={provider === 'maplibre-gl' ? t('settings.mapOpenFreeMapStyleHint') : t('settings.mapStyleHint')}
>
<div className="flex flex-col gap-2">
<StyleDropdown value={mapboxStyle} provider={provider} onChange={setMapboxStyle} />
<input
id={`${fieldId}-style`}
type="text"
value={mapboxStyle}
onChange={(e) => setMapboxStyle(e.target.value)}
placeholder={defaultStyleForProvider(provider)}
className={CODE_INPUT}
/>
<StyleDropdown value={mapboxStyle} provider={provider} presets={stylePresets} onChange={setMapboxStyle} />
{showStyleUrl && (
<input
id={`${fieldId}-style`}
type="text"
value={mapboxStyle}
onChange={(e) => setMapboxStyle(e.target.value)}
placeholder={defaultStyleForProvider(provider)}
className={CODE_INPUT}
/>
)}
</div>
</EditorField>
{/* MapLibre drawing the user's own template: its fields follow the picker. */}
{templateMode && templateFields}
{provider === 'mapbox-gl' && (
<>
<SettingRows>
@@ -333,7 +349,7 @@ export default function MapSettingsTab(): React.ReactElement {
<GlMapPreview
provider={provider}
token={mapboxToken}
style={mapboxStyle}
style={previewStyle}
lat={PREVIEW_CENTER[0]}
lng={PREVIEW_CENTER[1]}
// Zoom in close so the style's character (3D buildings,
@@ -49,6 +49,7 @@ import { MAPBOX_DEFAULT_STYLE, OPENFREEMAP_DEFAULT_STYLE } from '../Map/glProvid
import mapboxgl from 'mapbox-gl';
import * as maplibregl from 'maplibre-gl';
import GlMapPreviewWithEngine from './MapboxPreview';
import { mapLibreBasemap } from '../Map/glBasemap';
// The engine is a prop now, not a module import — that is what keeps mapbox-gl and
// maplibre-gl in separate chunks. This shim preserves the suite's existing call
@@ -138,6 +139,13 @@ describe('GlMapPreview', () => {
expect(mapOptions(maplibreCtor).style).toBe(OPENFREEMAP_DEFAULT_STYLE);
});
it('FE-COMP-GLPREVIEW-006b: a style a MapLibre keyword resolved to is drawn as it is, up to the raster zoom', () => {
const style = mapLibreBasemap('trek:template', 'https://tile.openstreetmap.de/{z}/{x}/{y}.png', false, []).style;
render(<GlMapPreview provider="maplibre-gl" style={style} lat={48.8} lng={2.3} zoom={16} enable3d={false} />);
expect(mapOptions(maplibreCtor)).toMatchObject({ style, maxZoom: 19 });
});
it('FE-COMP-GLPREVIEW-007: loading a style that wants terrain adds terrain and buildings', () => {
vi.mocked(wantsTerrain).mockReturnValue(true);
render(<GlMapPreview token="pk.test" style={OUTDOORS} lat={48.8} lng={2.3} zoom={16} enable3d />);
@@ -1,6 +1,7 @@
import { useEffect, useRef } from 'react'
import { isStandardFamily } from '../Map/mapboxSetup'
import { applyGl3d, glMapOptions } from '../Map/glMapOptions'
import type { GlStyle } from '../Map/glBasemap'
import { normalizeStyleForProvider, type GlMapProvider } from '../Map/glProviders'
import { buildGlMap } from '../Map/glSupport'
import { setBasemapConfig } from '../Map/useStandardBasemapConfig'
@@ -9,7 +10,8 @@ import { fs } from '../shared/DialogShell'
interface Props {
provider?: GlMapProvider
token?: string
style: string
/** A style URL, or the style a MapLibre keyword resolved to (useMapSettingsForm). */
style: GlStyle
lat: number
lng: number
zoom: number
@@ -34,7 +36,7 @@ export default function GlMapPreview({ provider = 'mapbox-gl', token = '', style
const onClickRef = useRef(onClick)
onClickRef.current = onClick
const isMapLibre = provider === 'maplibre-gl'
const glStyle = normalizeStyleForProvider(provider, style)
const glStyle = typeof style === 'string' ? normalizeStyleForProvider(provider, style) : style
const enableMapbox3d = !isMapLibre && enable3d
useEffect(() => {
@@ -1,7 +1,17 @@
// FE-MAP-MODEL-001 to FE-MAP-MODEL-004
// FE-MAP-MODEL-001 onwards
import { describe, expect, it } from 'vitest';
import { AMAP_ROAD, AMAP_SATELLITE } from '../../constants/mapDefaults';
import { MAP_PRESETS, mapboxOffered, mapPresetsFor } from './mapSettingsModel';
import { MAPBOX_DEFAULT_STYLE, OPENFREEMAP_DEFAULT_STYLE } from '../Map/glProviders';
import {
glStylePresetsFor,
MAP_PRESETS,
mapboxOffered,
mapLibreStyleOnSwitch,
mapLibreStyleToSave,
mapPresetsFor,
normalizeGlSelection,
styleForProvider,
} from './mapSettingsModel';
const urls = (list: { url: string }[]) => list.map((p) => p.url);
@@ -31,3 +41,53 @@ describe('mapboxOffered', () => {
expect(mapboxOffered(true, 'pk.operator')).toBe(true);
});
});
describe('the MapLibre keywords in the forms', () => {
const OSM = 'https://tile.openstreetmap.org/{z}/{x}/{y}.png';
const BRIGHT = 'https://tiles.openfreemap.org/styles/bright';
it('FE-MAP-MODEL-005: MapLibre keeps a keyword, Mapbox shows its default for one', () => {
expect(styleForProvider('maplibre-gl', 'trek:template')).toBe('trek:template');
expect(styleForProvider('maplibre-gl', 'trek:ofm-auto')).toBe('trek:ofm-auto');
expect(styleForProvider('mapbox-gl', 'trek:template')).toBe(MAPBOX_DEFAULT_STYLE);
expect(styleForProvider('leaflet', 'trek:template')).toBe('trek:template');
expect(normalizeGlSelection('maplibre-gl', ' trek:template ')).toBe('trek:template');
expect(normalizeGlSelection('maplibre-gl', 'mapbox://styles/x/y')).toBe(OPENFREEMAP_DEFAULT_STYLE);
// Mapbox keeps what was typed, as it always did.
expect(normalizeGlSelection('mapbox-gl', BRIGHT)).toBe(BRIGHT);
expect(normalizeGlSelection('mapbox-gl', '')).toBe(MAPBOX_DEFAULT_STYLE);
});
it('FE-MAP-MODEL-006: a switch to MapLibre keeps a MapLibre choice and brings a stored keyword back', () => {
expect(mapLibreStyleOnSwitch(BRIGHT, 'trek:template', OSM, true)).toBe(BRIGHT);
expect(mapLibreStyleOnSwitch('trek:ofm-auto', null, OSM, false)).toBe('trek:ofm-auto');
expect(mapLibreStyleOnSwitch(MAPBOX_DEFAULT_STYLE, 'trek:template', '', false)).toBe('trek:template');
expect(mapLibreStyleOnSwitch(MAPBOX_DEFAULT_STYLE, BRIGHT, OSM, true)).toBe(OPENFREEMAP_DEFAULT_STYLE);
});
it('FE-MAP-MODEL-007: from Leaflet with a template and an empty slot, the template is preselected', () => {
expect(mapLibreStyleOnSwitch(MAPBOX_DEFAULT_STYLE, '', OSM, true)).toBe('trek:template');
expect(mapLibreStyleOnSwitch(MAPBOX_DEFAULT_STYLE, undefined, OSM, true)).toBe('trek:template');
// Not from Mapbox, not without a template.
expect(mapLibreStyleOnSwitch(MAPBOX_DEFAULT_STYLE, '', OSM, false)).toBe(OPENFREEMAP_DEFAULT_STYLE);
expect(mapLibreStyleOnSwitch(MAPBOX_DEFAULT_STYLE, '', ' ', true)).toBe(OPENFREEMAP_DEFAULT_STYLE);
});
it('FE-MAP-MODEL-008: the template keyword without a template saves Liberty', () => {
expect(mapLibreStyleToSave('trek:template', OSM)).toBe('trek:template');
expect(mapLibreStyleToSave('trek:template', ' ')).toBe(OPENFREEMAP_DEFAULT_STYLE);
expect(mapLibreStyleToSave('trek:ofm-auto', '')).toBe('trek:ofm-auto');
expect(mapLibreStyleToSave('', OSM)).toBe(OPENFREEMAP_DEFAULT_STYLE);
});
it('FE-MAP-MODEL-009: the MapLibre picker adds the two keywords after the OpenFreeMap styles, Mapbox none', () => {
const t = (key: string) => `t:${key}`;
const maplibre = glStylePresetsFor('maplibre-gl', t);
expect(maplibre.slice(-2)).toEqual([
{ name: 't:settings.mapStyleFollowTheme', url: 'trek:ofm-auto', tags: ['OpenFreeMap'] },
{ name: 't:settings.mapStyleTemplate', url: 'trek:template' },
]);
expect(maplibre[0]?.url).toBe(OPENFREEMAP_DEFAULT_STYLE);
expect(glStylePresetsFor('mapbox-gl', t).map((p) => p.url)).not.toContain('trek:template');
});
});
@@ -1,10 +1,16 @@
import { MAPLIBRE_FROM_TEMPLATE, MAPLIBRE_OFM_AUTO } from '@trek/shared';
import { AMAP_ROAD, AMAP_SATELLITE } from '../../constants/mapDefaults';
import type { Place } from '../../types';
import {
MAPBOX_DEFAULT_STYLE,
getStylePresets,
isMapLibreKeyword,
isOpenFreeMapStyle,
normalizeMapLibreSelection,
normalizeStyleForProvider,
type GlMapProvider,
type GlStylePreset,
} from '../Map/glProviders';
/**
@@ -67,12 +73,141 @@ export function normalizeProvider(value: unknown): MapProvider {
return value === 'mapbox-gl' || value === 'maplibre-gl' ? value : 'leaflet';
}
/**
* The style a form shows for a provider. MapLibre keeps an OpenFreeMap style or
* a keyword (trek:template, trek:ofm-auto); Mapbox draws neither, so either
* shows its default; Leaflet keeps whatever the field holds.
*/
export function styleForProvider(provider: MapProvider, style?: string | null): string {
if (provider === 'leaflet') return style || MAPBOX_DEFAULT_STYLE;
if (provider === 'mapbox-gl' && isOpenFreeMapStyle(style)) return MAPBOX_DEFAULT_STYLE;
if (provider === 'maplibre-gl') return normalizeMapLibreSelection(style);
if (isOpenFreeMapStyle(style) || isMapLibreKeyword(style)) return MAPBOX_DEFAULT_STYLE;
return normalizeStyleForProvider(provider, style);
}
/**
* A typed or picked style as it is saved: MapLibre keeps its OpenFreeMap styles
* and keywords, Mapbox keeps what was typed, an empty field becomes the default.
*/
export function normalizeGlSelection(provider: GlMapProvider, style?: string | null): string {
return provider === 'maplibre-gl' ? normalizeMapLibreSelection(style) : normalizeStyleForProvider(provider, style);
}
/**
* The MapLibre style a form shows once the user switches to MapLibre, given the
* style the field held (`carried`), the one MapLibre's slot holds (`stored`) and
* the map template. A MapLibre choice in the field stays; a keyword in the slot
* comes back, so the template survives a switch away and back. Coming from
* Leaflet with a template and nothing in the slot, the template is preselected:
* MapLibre then draws the map the user had. Nothing is saved before "Save".
*/
export function mapLibreStyleOnSwitch(
carried: string,
stored: string | null | undefined,
template: string,
fromLeaflet: boolean
): string {
if (isOpenFreeMapStyle(carried) || isMapLibreKeyword(carried)) return carried.trim();
if (isMapLibreKeyword(stored)) return normalizeMapLibreSelection(stored);
if (fromLeaflet && !stored?.trim() && template.trim()) return MAPLIBRE_FROM_TEMPLATE;
return normalizeMapLibreSelection(carried);
}
/**
* The MapLibre style to save. The template keyword with no template behind it
* would draw the app default, so Liberty is saved instead, what MapLibre draws
* for a user who chose nothing.
*/
export function mapLibreStyleToSave(style: string, template: string): string {
const selection = normalizeMapLibreSelection(style);
return selection === MAPLIBRE_FROM_TEMPLATE && !template.trim() ? normalizeMapLibreSelection('') : selection;
}
/**
* The style the field shows once the user picks another provider. MapLibre
* follows mapLibreStyleOnSwitch, with the MapLibre slot as saved and the
* template as the form holds it; Mapbox drops what only MapLibre draws; Leaflet
* leaves the field as it is (it has no style of its own).
*/
export function styleOnProviderChange(
from: MapProvider,
to: MapProvider,
style: string,
context: { savedMaplibreStyle: string | undefined; template: string }
): string {
if (to === 'maplibre-gl') {
return mapLibreStyleOnSwitch(style, context.savedMaplibreStyle, context.template, from === 'leaflet');
}
return to === 'leaflet' ? style : styleForProvider(to, style);
}
/**
* What a save writes for the style, and what the field shows afterwards. Each
* GL provider writes its own slot; Leaflet writes the Mapbox slot as it always
* did, except that a MapLibre keyword still in the field after a switch never
* lands there: that slot keeps the style it holds (`storedMapboxStyle`).
*/
export function styleToSave(
provider: MapProvider,
style: string,
template: string,
storedMapboxStyle: string | undefined
): { shown: string; patch: { maplibre_style: string } | { mapbox_style: string } } {
if (provider === 'maplibre-gl') {
const saved = mapLibreStyleToSave(style, template);
return { shown: saved, patch: { maplibre_style: saved } };
}
if (provider === 'mapbox-gl') {
const saved = normalizeGlSelection(provider, style);
return { shown: saved, patch: { mapbox_style: saved } };
}
const kept = isMapLibreKeyword(style) ? styleForProvider('leaflet', storedMapboxStyle) : style;
return { shown: style, patch: { mapbox_style: kept } };
}
interface MapFormInput {
provider: MapProvider;
style: string;
template: string;
cartoKey: string;
managed: boolean;
/** MapLibre cannot draw the template here (glBasemap.ts), so the trip map draws it with Leaflet. */
needsLeaflet: boolean;
}
/** Which parts of the map form show, from what it holds. Both shells render from this. */
export function mapFormView({ provider, style, template, cartoKey, managed, needsLeaflet }: MapFormInput) {
const templateMode = provider === 'maplibre-gl' && style.trim() === MAPLIBRE_FROM_TEMPLATE;
// Only CARTO burns a watermark into keyless tiles, so the key and its nudge are scoped to its hosts.
const cartoTemplate = template.includes('basemaps.cartocdn.com');
return {
/** MapLibre draws the template: the template field (always there on Leaflet) shows under the style picker. */
templateMode,
/** The trip map draws the template with the classic 2D map (GCJ-02, a host outside the policy). */
templateNeedsClassic: templateMode && needsLeaflet,
/** A managed install brings its own key; MapLibre asks for one only for a CARTO template. */
showCartoKey: !managed && (provider === 'leaflet' || (templateMode && cartoTemplate)),
cartoNeedsKey: cartoTemplate && !cartoKey.trim(),
/** A keyword is chosen from the picker; there is no URL to show or type. */
showStyleUrl: !isMapLibreKeyword(style),
};
}
/**
* The style presets a picker offers for a provider. MapLibre adds the two
* keywords after the OpenFreeMap styles: the style that follows the colour
* scheme and the user's own map template. Both are named through `t`, the
* OpenFreeMap and Mapbox names are their own.
*/
export function glStylePresetsFor(provider: GlMapProvider, t: (key: string) => string): GlStylePreset[] {
if (provider !== 'maplibre-gl') return getStylePresets(provider);
return [
...getStylePresets(provider),
{ name: t('settings.mapStyleFollowTheme'), url: MAPLIBRE_OFM_AUTO, tags: ['OpenFreeMap'] },
{ name: t('settings.mapStyleTemplate'), url: MAPLIBRE_FROM_TEMPLATE },
];
}
// Each GL provider has its own style slot, so toggling providers never clobbers the
// other one's style. Leaflet/Mapbox use mapbox_style; MapLibre uses maplibre_style.
export function slotStyle(
@@ -134,4 +134,119 @@ describe('useMapSettingsForm', () => {
const { result } = renderHook(() => useMapSettingsForm());
expect(result.current.mapboxPreview).toEqual({ enable3d: false, quality: false, hidePois: false });
});
describe("MapLibre drawing the user's template (trek:template)", () => {
const OSM_DE = 'https://tile.openstreetmap.de/{z}/{x}/{y}.png';
it('FE-COMP-MAPFORM-011: an unchanged save keeps the keyword and the template, on both shells', async () => {
for (const mirrorStyleBeforeSave of [false, true]) {
updateSettings.mockClear();
seed({ map_provider: 'maplibre-gl', maplibre_style: 'trek:template', map_tile_url: OSM_DE });
const { result } = renderHook(() => useMapSettingsForm({ mirrorStyleBeforeSave }));
expect(result.current.mapboxStyle).toBe('trek:template');
await act(() => result.current.save());
expect(updateSettings).toHaveBeenCalledWith(
expect.objectContaining({
map_provider: 'maplibre-gl',
maplibre_style: 'trek:template',
map_tile_url: OSM_DE,
})
);
expect(result.current.mapboxStyle).toBe('trek:template');
}
});
it('FE-COMP-MAPFORM-012: picking a raster template writes both keys', async () => {
seed({ map_provider: 'maplibre-gl' });
const { result } = renderHook(() => useMapSettingsForm());
act(() => result.current.setMapboxStyle('trek:template'));
act(() => result.current.setMapTileUrl(OSM_DE));
expect(result.current.templateMode).toBe(true);
await act(() => result.current.save());
expect(updateSettings).toHaveBeenCalledWith(
expect.objectContaining({ maplibre_style: 'trek:template', map_tile_url: OSM_DE })
);
});
it('FE-COMP-MAPFORM-013: the template keyword with no template saves Liberty', async () => {
seed({ map_provider: 'maplibre-gl' });
const { result } = renderHook(() => useMapSettingsForm());
act(() => result.current.setMapboxStyle('trek:template'));
await act(() => result.current.save());
expect(updateSettings).toHaveBeenCalledWith(
expect.objectContaining({ maplibre_style: OPENFREEMAP_DEFAULT_STYLE })
);
});
it('FE-COMP-MAPFORM-014: from Leaflet with a template and an empty MapLibre slot, the template is preselected', () => {
seed({ map_provider: 'leaflet', map_tile_url: OSM_DE, maplibre_style: '' });
const { result } = renderHook(() => useMapSettingsForm());
act(() => result.current.changeProvider('maplibre-gl'));
expect(result.current.mapboxStyle).toBe('trek:template');
expect(result.current.templateMode).toBe(true);
// Shown, not saved: nothing leaves the form before "Save".
expect(updateSettings).not.toHaveBeenCalled();
});
it('FE-COMP-MAPFORM-015: the keyword survives a switch to Leaflet and to Mapbox and back', async () => {
seed({
map_provider: 'maplibre-gl',
maplibre_style: 'trek:template',
map_tile_url: OSM_DE,
mapbox_style: 'mapbox://styles/me/x',
});
const { result } = renderHook(() => useMapSettingsForm());
act(() => result.current.changeProvider('leaflet'));
act(() => result.current.changeProvider('maplibre-gl'));
expect(result.current.mapboxStyle).toBe('trek:template');
act(() => result.current.changeProvider('mapbox-gl'));
expect(result.current.mapboxStyle).toBe(MAPBOX_DEFAULT_STYLE);
act(() => result.current.changeProvider('maplibre-gl'));
expect(result.current.mapboxStyle).toBe('trek:template');
});
it('FE-COMP-MAPFORM-016: saving Leaflet with the keyword still in the field leaves the Mapbox slot as it was', async () => {
seed({
map_provider: 'maplibre-gl',
maplibre_style: 'trek:template',
map_tile_url: OSM_DE,
mapbox_style: 'mapbox://styles/me/x',
});
const { result } = renderHook(() => useMapSettingsForm());
act(() => result.current.changeProvider('leaflet'));
await act(() => result.current.save());
expect(updateSettings).toHaveBeenCalledWith(
expect.objectContaining({ map_provider: 'leaflet', mapbox_style: 'mapbox://styles/me/x' })
);
});
it('FE-COMP-MAPFORM-017: the template field, the CARTO key and the URL box follow the keyword', () => {
seed({ map_provider: 'maplibre-gl', maplibre_style: 'trek:template', map_tile_url: MAP_PRESETS[4].url });
const { result } = renderHook(() => useMapSettingsForm());
expect(result.current.showStyleUrl).toBe(false);
expect(result.current.showCartoKey).toBe(true);
act(() => result.current.setMapTileUrl(OSM_DE));
expect(result.current.showCartoKey).toBe(false);
act(() => result.current.setMapboxStyle(OPENFREEMAP_DEFAULT_STYLE));
expect(result.current.templateMode).toBe(false);
expect(result.current.showStyleUrl).toBe(true);
});
it('FE-COMP-MAPFORM-018: a template only Leaflet can draw says so and previews with Leaflet', () => {
seed({ map_provider: 'maplibre-gl', maplibre_style: 'trek:template', map_tile_url: AMAP_ROAD });
const { result } = renderHook(() => useMapSettingsForm());
expect(result.current.templateNeedsClassic).toBe(true);
expect(result.current.glPreview).toBe(false);
});
it('FE-COMP-MAPFORM-019: the preview draws what MapLibre makes of the keyword', () => {
seed({ map_provider: 'maplibre-gl', maplibre_style: 'trek:ofm-auto' });
const { result } = renderHook(() => useMapSettingsForm());
expect(result.current.previewStyle).toBe(OPENFREEMAP_DEFAULT_STYLE);
expect(result.current.templateNeedsClassic).toBe(false);
expect(result.current.stylePresets.map((p) => p.url)).toEqual(
expect.arrayContaining(['trek:ofm-auto', 'trek:template'])
);
});
});
});
@@ -1,20 +1,27 @@
import { useEffect, useMemo, useState } from 'react';
import { OFM_POSITRON } from '../../constants/mapDefaults';
import { useIsDark } from '../../hooks/useIsDark';
import { useTranslation } from '../../i18n';
import { useAuthStore } from '../../store/authStore';
import { useSettingsStore } from '../../store/settingsStore';
import type { Place } from '../../types';
import { normalizeStyleForProvider } from '../Map/glProviders';
import { resolveTileUrl } from '../../utils/tileUrl';
import { mapLibreBasemap } from '../Map/glBasemap';
import { useWebGL2 } from '../Map/glSupport';
import { useToast } from '../shared/Toast';
import {
type MapProvider,
glStylePresetsFor,
mapboxOffered,
mapFormView,
mapPresetsFor,
normalizeProvider,
previewPlace,
slotStyle,
styleForProvider,
styleOnProviderChange,
styleToSave,
} from './mapSettingsModel';
export interface MapSettingsFormOptions {
@@ -31,6 +38,10 @@ export interface MapSettingsFormOptions {
* and CARTO key, the Mapbox token, the GL style, the 3D and quality toggles and the switch
* for the basemap's own points of interest,
* seeded from the settings store and saved back in one patch.
*
* On MapLibre the style can also be a keyword: the style that follows the colour
* scheme, or the user's map template, which brings the template field (and the
* CARTO key for a CARTO template) to MapLibre too.
*/
export function useMapSettingsForm({ mirrorStyleBeforeSave = false }: MapSettingsFormOptions = {}) {
const { settings, updateSettings } = useSettingsStore();
@@ -42,6 +53,7 @@ export function useMapSettingsForm({ mirrorStyleBeforeSave = false }: MapSetting
const [mapTileUrl, setMapTileUrl] = useState<string>(settings.map_tile_url || '');
const managed = useAuthStore((s) => s.managed);
const hasAmapKey = useAuthStore((s) => s.hasAmapKey);
const extraHosts = useAuthStore((s) => s.mapExtraConnectHosts);
const [mapboxToken, setMapboxToken] = useState<string>(settings.mapbox_access_token || '');
const [cartoKey, setCartoKey] = useState<string>(settings.carto_api_key || '');
const [mapboxStyle, setMapboxStyle] = useState<string>(
@@ -67,28 +79,48 @@ export function useMapSettingsForm({ mirrorStyleBeforeSave = false }: MapSetting
// Both GL engines need WebGL2. Without it the preview shows the Leaflet map the
// trip planner falls back to, and both shells say why.
const webgl2 = useWebGL2();
const glPreview = provider !== 'leaflet' && webgl2;
const dark = useIsDark();
// What MapLibre makes of a keyword, from the template as it is being edited,
// resolved the way the trip map resolves it, so the preview shows that map.
const keyword = useMemo(
() =>
mapLibreBasemap(
provider === 'maplibre-gl' ? mapboxStyle : '',
resolveTileUrl(mapTileUrl, OFM_POSITRON, cartoKey),
dark,
extraHosts
),
[provider, mapboxStyle, mapTileUrl, cartoKey, dark, extraHosts]
);
const view = mapFormView({
provider,
style: mapboxStyle,
template: mapTileUrl,
cartoKey,
managed,
needsLeaflet: keyword.needsLeaflet,
});
const glPreview = provider !== 'leaflet' && webgl2 && !keyword.needsLeaflet;
const webgl2Missing = provider !== 'leaflet' && !webgl2;
const save = async (): Promise<void> => {
setSaving(true);
try {
const glStyle = provider === 'leaflet' ? mapboxStyle : normalizeStyleForProvider(provider, mapboxStyle);
if (mirrorStyleBeforeSave) setMapboxStyle(glStyle);
// Save into the active provider's own slot so the other provider's style survives.
const stylePatch = provider === 'maplibre-gl' ? { maplibre_style: glStyle } : { mapbox_style: glStyle };
// Each provider saves into its own slot, so the other provider's style survives.
const { shown, patch } = styleToSave(provider, mapboxStyle, mapTileUrl, settings.mapbox_style);
if (mirrorStyleBeforeSave) setMapboxStyle(shown);
await updateSettings({
map_provider: provider,
map_tile_url: mapTileUrl,
mapbox_access_token: mapboxToken,
carto_api_key: cartoKey,
...stylePatch,
...patch,
mapbox_3d_enabled: mapbox3d,
mapbox_quality_mode: mapboxQuality,
map_hide_basemap_pois: hideBasemapPois,
});
// Only mirror the normalized style into the form once it is actually persisted.
if (!mirrorStyleBeforeSave) setMapboxStyle(glStyle);
if (!mirrorStyleBeforeSave) setMapboxStyle(shown);
toast.success(t('settings.toast.mapSaved'));
} catch (err: unknown) {
toast.error(err instanceof Error ? err.message : t('common.error'));
@@ -99,28 +131,29 @@ export function useMapSettingsForm({ mirrorStyleBeforeSave = false }: MapSetting
const changeProvider = (nextProvider: MapProvider) => {
setProvider(nextProvider);
if (nextProvider !== 'leaflet') setMapboxStyle(styleForProvider(nextProvider, mapboxStyle));
const context = { savedMaplibreStyle: settings.maplibre_style, template: mapTileUrl };
setMapboxStyle(styleOnProviderChange(provider, nextProvider, mapboxStyle, context));
};
// Only CARTO burns a watermark into keyless tiles, so the nudge is scoped to its hosts.
const cartoNeedsKey = mapTileUrl.includes('basemaps.cartocdn.com') && !cartoKey.trim();
return {
managed,
presets: mapPresetsFor(managed, hasAmapKey),
stylePresets: provider === 'leaflet' ? [] : glStylePresetsFor(provider, t),
canMapbox: mapboxOffered(managed, settings.mapbox_access_token),
saving,
provider,
changeProvider,
mapTileUrl,
setMapTileUrl,
...view,
mapboxToken,
setMapboxToken,
cartoKey,
setCartoKey,
cartoNeedsKey,
mapboxStyle,
setMapboxStyle,
/** What the GL preview draws: the style, or what MapLibre makes of a keyword. */
previewStyle: keyword.style ?? mapboxStyle,
mapbox3d,
setMapbox3d,
mapboxQuality,
@@ -5,7 +5,7 @@ import { MapView } from '../../../components/Map/MapView'
// Same as the desktop map settings tab: on demand, and paired with one engine.
import ErrorBoundary from '../../../components/shared/ErrorBoundary'
import { GlMapPreviewMapbox, GlMapPreviewMaplibre } from '../../../components/Map/glLazy'
import { defaultStyleForProvider, getStylePresets } from '../../../components/Map/glProviders'
import { defaultStyleForProvider } from '../../../components/Map/glProviders'
import { PREVIEW_CENTER, PREVIEW_ZOOM, type MapProvider } from '../../../components/Settings/mapSettingsModel'
import { useMapSettingsForm } from '../../../components/Settings/useMapSettingsForm'
import { withTileApiKey } from '../../../utils/tileUrl'
@@ -20,8 +20,9 @@ import MSetPickerSheet from './MSetPickerSheet'
export default function MSettingsMap() {
const { t } = useTranslation()
const {
managed, presets: tilePresets, canMapbox, saving, provider, changeProvider, mapTileUrl, setMapTileUrl, mapboxToken, setMapboxToken,
cartoKey, setCartoKey, cartoNeedsKey, mapboxStyle, setMapboxStyle, mapbox3d, setMapbox3d,
managed, presets: tilePresets, stylePresets: presets, canMapbox, saving, provider, changeProvider, mapTileUrl, setMapTileUrl,
templateMode, templateNeedsClassic, showCartoKey, mapboxToken, setMapboxToken,
cartoKey, setCartoKey, cartoNeedsKey, mapboxStyle, setMapboxStyle, showStyleUrl, previewStyle, mapbox3d, setMapbox3d,
mapboxQuality, setMapboxQuality, hideBasemapPois, setHideBasemapPois, mapboxPreview, previewPlaces, glPreview,
webgl2Missing, save,
} = useMapSettingsForm({ mirrorStyleBeforeSave: true })
@@ -34,13 +35,59 @@ export default function MSettingsMap() {
{ id: 'maplibre-gl', name: 'MapLibre GL', sub: t('settings.mapMapLibreSubtitle'), icon: Globe2 },
]
const presets = provider === 'leaflet' ? [] : getStylePresets(provider)
const selectedPreset = presets.find((p) => p.url === mapboxStyle)
const chevron = <ChevronDown size={13} strokeWidth={2} className="flex-none text-m-faint" />
// One chunk per engine — see components/Map/glLazy.tsx.
const GlMapPreview = provider === 'maplibre-gl' ? GlMapPreviewMaplibre : GlMapPreviewMapbox
// The map template and its CARTO key: under the provider on Leaflet, under the style
// picker on MapLibre once its own map template is picked there.
const templateFields = (
<>
<MSetEyebrow className="mb-[5px] mt-[14px]">{t('settings.mapTemplate')}</MSetEyebrow>
<MSetSelectRow
label={tilePresets.find((p) => p.url === mapTileUrl)?.name || t('settings.mapTemplatePlaceholder.select')}
trailing={chevron}
onClick={() => setPresetOpen(true)}
/>
<MSetInput
mono
className="mt-[6px]"
value={mapTileUrl}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setMapTileUrl(e.target.value)}
placeholder="https://tile.openstreetmap.org/{z}/{x}/{y}.png"
/>
<MSetHint>{t('settings.mapDefaultHint')}</MSetHint>
{templateNeedsClassic && <MSetHint>{t('settings.mapTemplateClassicHint')}</MSetHint>}
{/* A managed install brings its own key, same as the Mapbox token below. */}
{showCartoKey && (
<>
<MSetEyebrow className="mb-[5px] mt-[14px]">{t('settings.mapCartoKey')}</MSetEyebrow>
<MSetInput
mono
value={cartoKey}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setCartoKey(e.target.value)}
spellCheck={false}
autoComplete="off"
/>
<MSetHint>
{t('settings.mapCartoKeyHint')}{' '}
<a href="https://carto.com/basemaps/apikey/" target="_blank" rel="noreferrer" className="underline">
{t('settings.mapCartoKeyLink')}
</a>
</MSetHint>
{cartoNeedsKey && (
<p className="mt-[6px] font-geist text-[0.625rem] leading-relaxed text-[color:var(--m-st-pending)]">
{t('settings.mapCartoKeyMissing')}
</p>
)}
</>
)}
</>
)
return (
<MSetCard title={t('settings.map')} icon={Map}>
<MSetEyebrow className="mb-[6px]">{t('settings.mapProvider')}</MSetEyebrow>
@@ -70,49 +117,7 @@ export default function MSettingsMap() {
</div>
<MSetHint>{t('settings.mapProviderHint')}</MSetHint>
{provider === 'leaflet' && (
<>
<MSetEyebrow className="mb-[5px] mt-[14px]">{t('settings.mapTemplate')}</MSetEyebrow>
<MSetSelectRow
label={tilePresets.find((p) => p.url === mapTileUrl)?.name || t('settings.mapTemplatePlaceholder.select')}
trailing={chevron}
onClick={() => setPresetOpen(true)}
/>
<MSetInput
mono
className="mt-[6px]"
value={mapTileUrl}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setMapTileUrl(e.target.value)}
placeholder="https://tile.openstreetmap.org/{z}/{x}/{y}.png"
/>
<MSetHint>{t('settings.mapDefaultHint')}</MSetHint>
{/* A managed install brings its own key, same as the Mapbox token below. */}
{!managed && (
<>
<MSetEyebrow className="mb-[5px] mt-[14px]">{t('settings.mapCartoKey')}</MSetEyebrow>
<MSetInput
mono
value={cartoKey}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setCartoKey(e.target.value)}
spellCheck={false}
autoComplete="off"
/>
<MSetHint>
{t('settings.mapCartoKeyHint')}{' '}
<a href="https://carto.com/basemaps/apikey/" target="_blank" rel="noreferrer" className="underline">
{t('settings.mapCartoKeyLink')}
</a>
</MSetHint>
{cartoNeedsKey && (
<p className="mt-[6px] font-geist text-[0.625rem] leading-relaxed text-[color:var(--m-st-pending)]">
{t('settings.mapCartoKeyMissing')}
</p>
)}
</>
)}
</>
)}
{provider === 'leaflet' && templateFields}
{provider !== 'leaflet' && (
<>
@@ -141,15 +146,20 @@ export default function MSettingsMap() {
trailing={chevron}
onClick={() => setStyleOpen(true)}
/>
<MSetInput
mono
className="mt-[6px]"
value={mapboxStyle}
onChange={(e) => setMapboxStyle(e.target.value)}
placeholder={defaultStyleForProvider(provider)}
/>
{showStyleUrl && (
<MSetInput
mono
className="mt-[6px]"
value={mapboxStyle}
onChange={(e) => setMapboxStyle(e.target.value)}
placeholder={defaultStyleForProvider(provider)}
/>
)}
<MSetHint>{provider === 'maplibre-gl' ? t('settings.mapOpenFreeMapStyleHint') : t('settings.mapStyleHint')}</MSetHint>
{/* MapLibre drawing the user's own template: its fields follow the picker. */}
{templateMode && templateFields}
{provider === 'mapbox-gl' && (
<div className="mt-1">
<MSetRow
@@ -183,7 +193,7 @@ export default function MSettingsMap() {
<GlMapPreview
provider={provider}
token={mapboxToken}
style={mapboxStyle}
style={previewStyle}
lat={PREVIEW_CENTER[0]}
lng={PREVIEW_CENTER[1]}
zoom={PREVIEW_ZOOM}
@@ -351,4 +351,34 @@ describe('MSettingsMap', () => {
await user.click(screen.getByRole('button', { name: 'Save Map' }));
expect(updateSettings).toHaveBeenCalledWith(expect.objectContaining({ map_hide_basemap_pois: true }));
});
it('FE-MOB-SETMAP-026: MapLibre on its own map template shows the template under the picker and keeps it on save', async () => {
const user = userEvent.setup();
const osmDe = 'https://tile.openstreetmap.de/{z}/{x}/{y}.png';
const updateSettings = seedMap({ map_provider: 'maplibre-gl', maplibre_style: 'trek:template', map_tile_url: osmDe });
renderMap();
expect(screen.getByText('My map template')).toBeInTheDocument();
expect(screen.getByDisplayValue(osmDe)).toBeInTheDocument();
// A keyword has no URL to show or type.
expect(screen.queryByDisplayValue('trek:template')).not.toBeInTheDocument();
expect(await screen.findByTestId('gl-preview')).toBeInTheDocument();
await user.click(screen.getByRole('button', { name: 'Save Map' }));
expect(updateSettings).toHaveBeenCalledWith(
expect.objectContaining({ map_provider: 'maplibre-gl', maplibre_style: 'trek:template', map_tile_url: osmDe }),
);
});
it('FE-MOB-SETMAP-027: a template only the classic map draws says so and previews with Leaflet', () => {
seedMap({
map_provider: 'maplibre-gl',
maplibre_style: 'trek:template',
map_tile_url: 'https://webrd01.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&x={x}&y={y}&z={z}',
});
renderMap();
expect(screen.getByText(/drawn with the classic 2D map/)).toBeInTheDocument();
expect(screen.getByTestId('leaflet-preview')).toBeInTheDocument();
});
});
+4
View File
@@ -56,6 +56,10 @@ const settings: TranslationStrings = {
'settings.mapStyleHint': 'إعداد مسبق أو عنوان URL mapbox://styles/USER/ID خاص بك',
'settings.mapOpenFreeMapStylePlaceholder': 'اختر نمط OpenFreeMap',
'settings.mapOpenFreeMapStyleHint': 'إعداد مسبق أو عنوان URL لنمط OpenFreeMap. تعمل أنماط OpenFreeMap بدون رمز.',
'settings.mapStyleFollowTheme': 'OpenFreeMap، فاتحة أو داكنة حسب المظهر',
'settings.mapStyleTemplate': 'قالب الخريطة الخاص بي',
'settings.mapTemplateClassicHint':
'لا يستطيع MapLibre رسم هذا القالب هنا، لذا تعرضه خرائطك على الخريطة الكلاسيكية ثنائية الأبعاد.',
'settings.map3dBuildings': 'مبانٍ ثلاثية الأبعاد وتضاريس',
'settings.map3dHint': 'إمالة + مبانٍ ثلاثية الأبعاد حقيقية — يعمل مع كل نمط بما في ذلك الأقمار الصناعية.',
'settings.mapHighQuality': 'وضع الجودة العالية',
+4
View File
@@ -79,6 +79,10 @@ const settings: TranslationStrings = {
'settings.mapOpenFreeMapStylePlaceholder': 'OpenFreeMap üslubu seçin',
'settings.mapOpenFreeMapStyleHint':
'Hazır üslub və ya OpenFreeMap üslub URL-i. OpenFreeMap üslubları tokensiz işləyir.',
'settings.mapStyleFollowTheme': 'OpenFreeMap, mövzuya görə açıq və ya tünd',
'settings.mapStyleTemplate': 'Mənim xəritə şablonum',
'settings.mapTemplateClassicHint':
'MapLibre bu şablonu burada çəkə bilmir, ona görə xəritələriniz onu klassik 2D xəritə ilə göstərir.',
'settings.map3dBuildings': '3D binalar və relyef',
'settings.map3dHint': 'Maililik və real 3D bina modelləri — peyk görünüşü daxil olmaqla bütün üslublarda işləyir.',
+4
View File
@@ -62,6 +62,10 @@ const settings: TranslationStrings = {
'settings.mapOpenFreeMapStylePlaceholder': 'Selecionar um estilo OpenFreeMap',
'settings.mapOpenFreeMapStyleHint':
'Preset ou URL de estilo OpenFreeMap. Os estilos OpenFreeMap funcionam sem token.',
'settings.mapStyleFollowTheme': 'OpenFreeMap, claro ou escuro conforme o tema',
'settings.mapStyleTemplate': 'Meu modelo de mapa',
'settings.mapTemplateClassicHint':
'O MapLibre não consegue desenhar este modelo aqui, então seus mapas o mostram com o mapa 2D clássico.',
'settings.map3dBuildings': 'Prédios 3D & terreno',
'settings.map3dHint': 'Inclinação + extrusões 3D reais de prédios — funciona em todo estilo, incluindo satélite.',
'settings.mapHighQuality': 'Modo alta qualidade',
+4
View File
@@ -395,6 +395,10 @@ const settings: TranslationStrings = {
'settings.mapOpenFreeMapStylePlaceholder': "Selecciona un estil d'OpenFreeMap",
'settings.mapOpenFreeMapStyleHint':
"URL d'estil o predefinit d'OpenFreeMap. Els estils d'OpenFreeMap funcionen sense token.",
'settings.mapStyleFollowTheme': 'OpenFreeMap, clar o fosc segons el tema',
'settings.mapStyleTemplate': 'La meva plantilla del mapa',
'settings.mapTemplateClassicHint':
'MapLibre no pot dibuixar aquesta plantilla aquí, així que els mapes la mostren amb el mapa 2D clàssic.',
'settings.distance': 'Unitat de distància',
'settings.aiAlwaysRetry': 'Reintentar sempre les importacions de reserves com a IA',
'settings.aiAlwaysRetryHint':
+4
View File
@@ -60,6 +60,10 @@ const settings: TranslationStrings = {
'settings.mapStyleHint': 'Preset nebo vaše vlastní URL mapbox://styles/USER/ID',
'settings.mapOpenFreeMapStylePlaceholder': 'Vyberte styl OpenFreeMap',
'settings.mapOpenFreeMapStyleHint': 'Preset nebo URL stylu OpenFreeMap. Styly OpenFreeMap fungují bez tokenu.',
'settings.mapStyleFollowTheme': 'OpenFreeMap, světlá nebo tmavá podle motivu',
'settings.mapStyleTemplate': 'Moje šablona mapy',
'settings.mapTemplateClassicHint':
'MapLibre tuto šablonu zde nedokáže vykreslit, proto ji mapy zobrazí klasickou 2D mapou.',
'settings.map3dBuildings': '3D budovy a terén',
'settings.map3dHint': 'Náklon + skutečné 3D vyvýšení budov — funguje s každým stylem, včetně satelitu.',
'settings.mapHighQuality': 'Režim vysoké kvality',
+4
View File
@@ -61,6 +61,10 @@ const settings: TranslationStrings = {
'settings.mapStyleHint': 'Preset oder eigene mapbox://styles/USER/ID URL',
'settings.mapOpenFreeMapStylePlaceholder': 'OpenFreeMap-Stil wählen',
'settings.mapOpenFreeMapStyleHint': 'Preset oder OpenFreeMap-Stil-URL. OpenFreeMap-Stile funktionieren ohne Token.',
'settings.mapStyleFollowTheme': 'OpenFreeMap, hell oder dunkel nach Design',
'settings.mapStyleTemplate': 'Meine Karten-Vorlage',
'settings.mapTemplateClassicHint':
'MapLibre kann diese Vorlage hier nicht zeichnen, deshalb zeigen die Karten sie mit der klassischen 2D-Karte.',
'settings.map3dBuildings': '3D-Gebäude & Terrain',
'settings.map3dHint': 'Neigung + echte 3D-Gebäude-Extrusionen — funktioniert mit jedem Stil, auch Satellit.',
'settings.mapHighQuality': 'Hochqualitäts-Modus',
+4
View File
@@ -69,6 +69,10 @@ const settings: TranslationStrings = {
'settings.mapStyleHint': 'Preset or your own mapbox://styles/USER/ID URL',
'settings.mapOpenFreeMapStylePlaceholder': 'Select an OpenFreeMap style',
'settings.mapOpenFreeMapStyleHint': 'Preset or OpenFreeMap style URL. OpenFreeMap styles work without a token.',
'settings.mapStyleFollowTheme': 'OpenFreeMap, light or dark with the theme',
'settings.mapStyleTemplate': 'My map template',
'settings.mapTemplateClassicHint':
'MapLibre cannot draw this template here, so your maps show it drawn with the classic 2D map.',
'settings.map3dBuildings': '3D Buildings & Terrain',
'settings.map3dHint': 'Pitch + real 3D building extrusions — works on every style, including satellite.',
'settings.mapHighQuality': 'High Quality Mode',
+4
View File
@@ -61,6 +61,10 @@ const settings: TranslationStrings = {
'settings.mapOpenFreeMapStylePlaceholder': 'Seleccionar un estilo de OpenFreeMap',
'settings.mapOpenFreeMapStyleHint':
'Preset o URL de estilo de OpenFreeMap. Los estilos de OpenFreeMap funcionan sin token.',
'settings.mapStyleFollowTheme': 'OpenFreeMap, claro u oscuro según el tema',
'settings.mapStyleTemplate': 'Mi plantilla del mapa',
'settings.mapTemplateClassicHint':
'MapLibre no puede dibujar esta plantilla aquí, así que los mapas la muestran con el mapa 2D clásico.',
'settings.map3dBuildings': 'Edificios 3D y terreno',
'settings.map3dHint':
'Inclinación + extrusiones 3D reales de edificios — funciona con todos los estilos, incluyendo satélite.',
+4
View File
@@ -70,6 +70,10 @@ const settings: TranslationStrings = {
'settings.mapStyleHint': 'Valmisstiil või sinu enda mapbox://styles/USER/ID URL',
'settings.mapOpenFreeMapStylePlaceholder': 'Vali OpenFreeMapi stiil',
'settings.mapOpenFreeMapStyleHint': 'Valmisstiil või OpenFreeMapi stiili URL. OpenFreeMapi stiilid töötavad pääseta.',
'settings.mapStyleFollowTheme': 'OpenFreeMap, hele või tume vastavalt teemale',
'settings.mapStyleTemplate': 'Minu kaardimall',
'settings.mapTemplateClassicHint':
'MapLibre ei saa seda malli siin joonistada, seega näitavad kaardid seda klassikalise 2D-kaardiga.',
'settings.map3dBuildings': '3D-hooned ja maastik',
'settings.map3dHint': 'Kallutamine ja ruumilised 3D-hooned — töötab kõigi stiilidega, sealhulgas satelliidivaatega.',
'settings.mapHighQuality': 'Kõrge kvaliteediga režiim',
+4
View File
@@ -62,6 +62,10 @@ const settings: TranslationStrings = {
'settings.mapOpenFreeMapStylePlaceholder': 'Sélectionner un style OpenFreeMap',
'settings.mapOpenFreeMapStyleHint':
'Preset ou URL de style OpenFreeMap. Les styles OpenFreeMap fonctionnent sans jeton.',
'settings.mapStyleFollowTheme': 'OpenFreeMap, clair ou sombre selon le thème',
'settings.mapStyleTemplate': 'Mon modèle de carte',
'settings.mapTemplateClassicHint':
"MapLibre ne peut pas dessiner ce modèle ici, les cartes l'affichent donc avec la carte 2D classique.",
'settings.map3dBuildings': 'Bâtiments 3D & terrain',
'settings.map3dHint':
'Inclinaison + extrusions 3D réelles des bâtiments — fonctionne avec tous les styles, y compris satellite.',
+4
View File
@@ -64,6 +64,10 @@ const settings: TranslationStrings = {
'settings.mapOpenFreeMapStylePlaceholder': 'Επιλέξτε ένα στυλ OpenFreeMap',
'settings.mapOpenFreeMapStyleHint':
'Προκαθορισμένο ή URL στυλ OpenFreeMap. Τα στυλ OpenFreeMap λειτουργούν χωρίς token.',
'settings.mapStyleFollowTheme': 'OpenFreeMap, φωτεινό ή σκοτεινό ανάλογα με το θέμα',
'settings.mapStyleTemplate': 'Το πρότυπο χάρτη μου',
'settings.mapTemplateClassicHint':
'Το MapLibre δεν μπορεί να σχεδιάσει αυτό το πρότυπο εδώ, οπότε οι χάρτες το δείχνουν με τον κλασικό χάρτη 2D.',
'settings.map3dBuildings': '3D Κτίρια & Ανάγλυφο',
'settings.map3dHint':
'Κλίση + πραγματικές 3D προεξοχές κτιρίων — λειτουργεί σε κάθε στυλ, συμπεριλαμβανομένου του δορυφορικού.',
+4
View File
@@ -70,6 +70,10 @@ const settings: TranslationStrings = {
'settings.mapOpenFreeMapStylePlaceholder': 'בחירת סגנון OpenFreeMap',
'settings.mapOpenFreeMapStyleHint':
'סגנון מוכן או כתובת סגנון של OpenFreeMap. סגנונות OpenFreeMap עובדים בלי אסימון.',
'settings.mapStyleFollowTheme': 'OpenFreeMap, בהירה או כהה לפי ערכת הנושא',
'settings.mapStyleTemplate': 'תבנית המפה שלי',
'settings.mapTemplateClassicHint':
'MapLibre לא יכול לצייר כאן את התבנית הזו, ולכן המפות מציגות אותה במפת 2D הקלאסית.',
'settings.map3dBuildings': 'בניינים ותבליט בתלת-ממד',
'settings.map3dHint': 'הטיה ובניינים אמיתיים בתלת-ממד — עובד בכל סגנון, כולל לוויין.',
'settings.mapHighQuality': 'מצב איכות גבוהה',
+4
View File
@@ -62,6 +62,10 @@ const settings: TranslationStrings = {
'settings.mapOpenFreeMapStylePlaceholder': 'Válassz OpenFreeMap stílust',
'settings.mapOpenFreeMapStyleHint':
'Preset vagy OpenFreeMap stílus URL. Az OpenFreeMap stílusok token nélkül működnek.',
'settings.mapStyleFollowTheme': 'OpenFreeMap, világos vagy sötét a témához igazodva',
'settings.mapStyleTemplate': 'Saját térkép sablon',
'settings.mapTemplateClassicHint':
'A MapLibre itt nem tudja megrajzolni ezt a sablont, ezért a térképek a klasszikus 2D térképpel mutatják.',
'settings.map3dBuildings': '3D épületek és terep',
'settings.map3dHint': 'Dőlés + valódi 3D épület-kiemelés — minden stílussal működik, beleértve a műholdast.',
'settings.mapHighQuality': 'Magas minőség mód',
+4
View File
@@ -60,6 +60,10 @@ const settings: TranslationStrings = {
'settings.mapStyleHint': 'Preset atau URL mapbox://styles/USER/ID milikmu',
'settings.mapOpenFreeMapStylePlaceholder': 'Pilih gaya OpenFreeMap',
'settings.mapOpenFreeMapStyleHint': 'Preset atau URL gaya OpenFreeMap. Gaya OpenFreeMap berfungsi tanpa token.',
'settings.mapStyleFollowTheme': 'OpenFreeMap, terang atau gelap mengikuti tema',
'settings.mapStyleTemplate': 'Template peta saya',
'settings.mapTemplateClassicHint':
'MapLibre tidak dapat menggambar template ini di sini, jadi peta menampilkannya dengan peta 2D klasik.',
'settings.map3dBuildings': 'Bangunan 3D & medan',
'settings.map3dHint': 'Kemiringan + ekstrusi bangunan 3D nyata — bekerja di semua gaya, termasuk satelit.',
'settings.mapHighQuality': 'Mode kualitas tinggi',
+4
View File
@@ -61,6 +61,10 @@ const settings: TranslationStrings = {
'settings.mapOpenFreeMapStylePlaceholder': 'Seleziona uno stile OpenFreeMap',
'settings.mapOpenFreeMapStyleHint':
'Preset o URL di stile OpenFreeMap. Gli stili OpenFreeMap funzionano senza token.',
'settings.mapStyleFollowTheme': 'OpenFreeMap, chiara o scura secondo il tema',
'settings.mapStyleTemplate': 'Il mio modello mappa',
'settings.mapTemplateClassicHint':
'MapLibre non può disegnare questo modello qui, quindi le mappe lo mostrano con la mappa 2D classica.',
'settings.map3dBuildings': 'Edifici 3D e terreno',
'settings.map3dHint':
'Inclinazione + estrusioni 3D reali degli edifici — funziona con ogni stile, incluso satellite.',
+4
View File
@@ -61,6 +61,10 @@ const settings: TranslationStrings = {
'settings.mapOpenFreeMapStylePlaceholder': 'OpenFreeMapスタイルを選択',
'settings.mapOpenFreeMapStyleHint':
'プリセットまたは OpenFreeMap スタイルのURL。OpenFreeMap スタイルはトークンなしで動作します。',
'settings.mapStyleFollowTheme': 'OpenFreeMap、テーマに合わせてライトまたはダーク',
'settings.mapStyleTemplate': '自分の地図テンプレート',
'settings.mapTemplateClassicHint':
'MapLibre はここでこのテンプレートを描画できないため、地図はクラシック 2D マップで表示されます。',
'settings.map3dBuildings': '3D建物・地形',
'settings.map3dHint': 'ピッチ+実際の3D押し出し表示。衛星含む全スタイルで動作。',
'settings.mapHighQuality': '高品質モード',
+3
View File
@@ -61,6 +61,9 @@ const settings: TranslationStrings = {
'settings.mapStyleHint': '프리셋 또는 mapbox://styles/USER/ID URL 직접 입력',
'settings.mapOpenFreeMapStylePlaceholder': 'OpenFreeMap 스타일 선택',
'settings.mapOpenFreeMapStyleHint': '프리셋 또는 OpenFreeMap 스타일 URL. OpenFreeMap 스타일은 토큰 없이 작동합니다.',
'settings.mapStyleFollowTheme': 'OpenFreeMap, 테마에 따라 밝게 또는 어둡게',
'settings.mapStyleTemplate': '내 지도 템플릿',
'settings.mapTemplateClassicHint': 'MapLibre가 여기서 이 템플릿을 그릴 수 없어 지도에는 클래식 2D 지도로 표시됩니다.',
'settings.map3dBuildings': '3D 건물 및 지형',
'settings.map3dHint': '기울기 + 실제 3D 건물 돌출 — 위성 포함 모든 스타일에서 작동합니다.',
'settings.mapHighQuality': '고품질 모드',
+4
View File
@@ -61,6 +61,10 @@ const settings: TranslationStrings = {
'settings.mapStyleHint': 'Preset of eigen mapbox://styles/USER/ID URL',
'settings.mapOpenFreeMapStylePlaceholder': 'Kies een OpenFreeMap-stijl',
'settings.mapOpenFreeMapStyleHint': 'Preset of OpenFreeMap-stijl-URL. OpenFreeMap-stijlen werken zonder token.',
'settings.mapStyleFollowTheme': 'OpenFreeMap, licht of donker volgens het thema',
'settings.mapStyleTemplate': 'Mijn kaartsjabloon',
'settings.mapTemplateClassicHint':
'MapLibre kan dit sjabloon hier niet tekenen, dus de kaarten tonen het met de klassieke 2D-kaart.',
'settings.map3dBuildings': '3D-gebouwen & terrein',
'settings.map3dHint': 'Kanteling + echte 3D-gebouwenextrusies — werkt op elke stijl, inclusief satelliet.',
'settings.mapHighQuality': 'Hoge kwaliteit modus',
+4
View File
@@ -60,6 +60,10 @@ const settings: TranslationStrings = {
'settings.mapStyleHint': 'Preset lub własny URL mapbox://styles/USER/ID',
'settings.mapOpenFreeMapStylePlaceholder': 'Wybierz styl OpenFreeMap',
'settings.mapOpenFreeMapStyleHint': 'Preset lub URL stylu OpenFreeMap. Style OpenFreeMap działają bez tokena.',
'settings.mapStyleFollowTheme': 'OpenFreeMap, jasna lub ciemna zgodnie z motywem',
'settings.mapStyleTemplate': 'Mój szablon mapy',
'settings.mapTemplateClassicHint':
'MapLibre nie może tu narysować tego szablonu, więc mapy pokazują go na klasycznej mapie 2D.',
'settings.map3dBuildings': 'Budynki 3D i teren',
'settings.map3dHint': 'Nachylenie + prawdziwe wytłaczanie budynków 3D — działa w każdym stylu, także satelitarnym.',
'settings.mapHighQuality': 'Tryb wysokiej jakości',
+4
View File
@@ -61,6 +61,10 @@ const settings: TranslationStrings = {
'settings.mapStyleHint': 'Preset или собственный URL mapbox://styles/USER/ID',
'settings.mapOpenFreeMapStylePlaceholder': 'Выберите стиль OpenFreeMap',
'settings.mapOpenFreeMapStyleHint': 'Preset или URL стиля OpenFreeMap. Стили OpenFreeMap работают без токена.',
'settings.mapStyleFollowTheme': 'OpenFreeMap, светлая или тёмная по теме',
'settings.mapStyleTemplate': 'Мой шаблон карты',
'settings.mapTemplateClassicHint':
'MapLibre не может отрисовать этот шаблон здесь, поэтому карты показывают его на классической 2D-карте.',
'settings.map3dBuildings': '3D-здания и рельеф',
'settings.map3dHint': 'Наклон + настоящие 3D-здания — работает со всеми стилями, включая спутник.',
'settings.mapHighQuality': 'Режим высокого качества',
+4
View File
@@ -69,6 +69,10 @@ const settings: TranslationStrings = {
'settings.mapStyleHint': 'Predvoľba alebo vaša vlastná URL mapbox://styles/USER/ID',
'settings.mapOpenFreeMapStylePlaceholder': 'Vyberte štýl OpenFreeMap',
'settings.mapOpenFreeMapStyleHint': 'Predvoľba alebo URL štýlu OpenFreeMap. Štýly OpenFreeMap fungujú bez tokenu.',
'settings.mapStyleFollowTheme': 'OpenFreeMap, svetlá alebo tmavá podľa motívu',
'settings.mapStyleTemplate': 'Moja šablóna mapy',
'settings.mapTemplateClassicHint':
'MapLibre tu túto šablónu nedokáže vykresliť, preto ju mapy zobrazia klasickou 2D mapou.',
'settings.map3dBuildings': '3D budovy a terén',
'settings.map3dHint': 'Náklon + skutočné 3D vyvýšenie budov — funguje s každým štýlom, vrátane satelitu.',
'settings.mapHighQuality': 'Režim vysokej kvality',
+4
View File
@@ -49,6 +49,10 @@ const settings: TranslationStrings = {
'settings.mapOpenFreeMapStylePlaceholder': 'Välj en OpenFreeMap-stil',
'settings.mapOpenFreeMapStyleHint':
'Förinställning eller OpenFreeMap-stil-URL. OpenFreeMap-stilar fungerar utan token.',
'settings.mapStyleFollowTheme': 'OpenFreeMap, ljus eller mörk efter temat',
'settings.mapStyleTemplate': 'Min kartmall',
'settings.mapTemplateClassicHint':
'MapLibre kan inte rita den här mallen här, så kartorna visar den med den klassiska 2D-kartan.',
'settings.mapExperimental': 'Experimentell',
'settings.mapMapboxToken': 'Mapbox-åtkomsttoken',
'settings.mapMapboxTokenHint': 'Offentlig token (pk.*) från',
+3
View File
@@ -57,6 +57,9 @@ const settings: TranslationStrings = {
'settings.mapOpenFreeMapStylePlaceholder': 'เลือกสไตล์ OpenFreeMap',
'settings.mapOpenFreeMapStyleHint':
'เลือกสไตล์ที่ตั้งไว้ล่วงหน้าหรือระบุ URL สไตล์ของ OpenFreeMap สไตล์ OpenFreeMap ใช้งานได้โดยไม่ต้องใช้โทเค็น',
'settings.mapStyleFollowTheme': 'OpenFreeMap สว่างหรือมืดตามธีม',
'settings.mapStyleTemplate': 'แม่แบบแผนที่ของฉัน',
'settings.mapTemplateClassicHint': 'MapLibre วาดแม่แบบนี้ที่นี่ไม่ได้ แผนที่จึงแสดงด้วยแผนที่ 2D แบบคลาสสิก',
'settings.map3dBuildings': 'สิ่งปลูกสร้าง 3 มิติและภูมิประเทศ',
'settings.map3dHint': 'Pitch + การอัดขึ้นรูปอาคาร 3 มิติจริง — ใช้ได้กับทุกสไตล์ รวมถึงดาวเทียมด้วย',
'settings.mapHighQuality': 'โหมดคุณภาพสูง',
+4
View File
@@ -62,6 +62,10 @@ const settings: TranslationStrings = {
'settings.mapOpenFreeMapStylePlaceholder': 'Bir OpenFreeMap stili seçin',
'settings.mapOpenFreeMapStyleHint':
"Ön ayar veya OpenFreeMap stil URL'si. OpenFreeMap stilleri anahtar gerektirmeden çalışır.",
'settings.mapStyleFollowTheme': 'OpenFreeMap, temaya göre açık veya koyu',
'settings.mapStyleTemplate': 'Harita şablonum',
'settings.mapTemplateClassicHint':
'MapLibre bu şablonu burada çizemiyor, bu yüzden haritalar onu klasik 2D haritayla gösteriyor.',
'settings.map3dBuildings': '3D Binalar ve Arazi',
'settings.map3dHint': 'Eğim + gerçek 3D bina çıkıntıları — uydu dahil her stilde çalışır.',
'settings.mapHighQuality': 'Yüksek Kalite Modu',
+4
View File
@@ -62,6 +62,10 @@ const settings: TranslationStrings = {
'settings.mapStyleHint': 'Preset або власний URL mapbox://styles/USER/ID',
'settings.mapOpenFreeMapStylePlaceholder': 'Виберіть стиль OpenFreeMap',
'settings.mapOpenFreeMapStyleHint': 'Preset або URL стилю OpenFreeMap. Стилі OpenFreeMap працюють без токена.',
'settings.mapStyleFollowTheme': 'OpenFreeMap, світла або темна за темою',
'settings.mapStyleTemplate': 'Мій шаблон карти',
'settings.mapTemplateClassicHint':
'MapLibre не може намалювати цей шаблон тут, тому карти показують його на класичній 2D-карті.',
'settings.map3dBuildings': '3D-будинки та рельєф',
'settings.map3dHint': 'Нахил + справжні 3D-будинки — працює з усіма стилями, включаючи супутник.',
'settings.mapHighQuality': 'Режим високої якості',
+4
View File
@@ -62,6 +62,10 @@ const settings: TranslationStrings = {
'settings.mapOpenFreeMapStylePlaceholder': 'Chọn kiểu OpenFreeMap',
'settings.mapOpenFreeMapStyleHint':
'Đặt trước hoặc kiểu OpenFreeMap URL. Kiểu OpenFreeMap hoạt động mà không cần mã thông báo.',
'settings.mapStyleFollowTheme': 'OpenFreeMap, sáng hoặc tối theo giao diện',
'settings.mapStyleTemplate': 'Mẫu bản đồ của tôi',
'settings.mapTemplateClassicHint':
'MapLibre không thể vẽ mẫu này ở đây, nên bản đồ hiển thị nó bằng bản đồ 2D cổ điển.',
'settings.map3dBuildings': 'Tòa nhà & địa hình 3D',
'settings.map3dHint': 'Cao độ + ép đùn tòa nhà 3D thực - hoạt động trên mọi phong cách, bao gồm cả vệ tinh.',
'settings.mapHighQuality': 'Chế độ chất lượng cao',
+3
View File
@@ -60,6 +60,9 @@ const settings: TranslationStrings = {
'settings.mapStyleHint': '預設或您自己的 mapbox://styles/USER/ID URL',
'settings.mapOpenFreeMapStylePlaceholder': '選擇 OpenFreeMap 樣式',
'settings.mapOpenFreeMapStyleHint': '預設或 OpenFreeMap 樣式 URL。OpenFreeMap 樣式無需權杖即可使用。',
'settings.mapStyleFollowTheme': 'OpenFreeMap,隨主題切換淺色或深色',
'settings.mapStyleTemplate': '我的地圖模板',
'settings.mapTemplateClassicHint': 'MapLibre 無法在此繪製此模板,因此地圖會使用經典 2D 地圖顯示。',
'settings.map3dBuildings': '3D 建築和地形',
'settings.map3dHint': '傾斜 + 真實 3D 建築拉伸 — 適用於所有樣式,包括衛星。',
'settings.mapHighQuality': '高畫質模式',
+3
View File
@@ -60,6 +60,9 @@ const settings: TranslationStrings = {
'settings.mapStyleHint': '预设或您自己的 mapbox://styles/USER/ID URL',
'settings.mapOpenFreeMapStylePlaceholder': '选择 OpenFreeMap 样式',
'settings.mapOpenFreeMapStyleHint': '预设或 OpenFreeMap 样式 URL。OpenFreeMap 样式无需令牌即可使用。',
'settings.mapStyleFollowTheme': 'OpenFreeMap,随主题切换浅色或深色',
'settings.mapStyleTemplate': '我的地图模板',
'settings.mapTemplateClassicHint': 'MapLibre 无法在此绘制该模板,因此地图会使用经典 2D 地图显示它。',
'settings.map3dBuildings': '3D 建筑和地形',
'settings.map3dHint': '倾斜 + 真实 3D 建筑拉伸 — 适用于所有样式,包括卫星。',
'settings.mapHighQuality': '高画质模式',