- Added support for city selection in MapViewer, allowing users to click on cities to view details. - Integrated map layout data to improve city rendering and positioning. - Introduced SelectedCityPanel to display information about the selected city. - Updated map asset handling with utility functions for building asset URLs. - Enhanced state management in mapViewer store to track selected city. - Improved responsiveness and styling of map components. - Added new API endpoint for loading map layouts from legacy data.
22 lines
717 B
TypeScript
22 lines
717 B
TypeScript
const normalizeBase = (value: string | undefined | null): string => {
|
|
const base = (value ?? '').trim();
|
|
return base.replace(/\/+$/, '');
|
|
};
|
|
|
|
export const buildAssetUrl = (base: string | undefined | null, path: string): string => {
|
|
const normalizedBase = normalizeBase(base);
|
|
const normalizedPath = path.replace(/^\/+/, '');
|
|
if (!normalizedBase) {
|
|
return `/${normalizedPath}`;
|
|
}
|
|
return `${normalizedBase}/${normalizedPath}`;
|
|
};
|
|
|
|
export const normalizeColorToken = (color: string | undefined | null): string | null => {
|
|
if (!color) {
|
|
return null;
|
|
}
|
|
const cleaned = color.trim().replace(/^#/, '').toUpperCase();
|
|
return cleaned.length > 0 ? cleaned : null;
|
|
};
|