Refactor map page

This commit is contained in:
Sean Morley
2024-11-02 21:18:52 -04:00
parent e6c5bc9ca8
commit 07263c5697
7 changed files with 127 additions and 182 deletions

View File

@@ -70,7 +70,8 @@
images: adventureToEdit?.images || [],
user_id: adventureToEdit?.user_id || null,
collection: adventureToEdit?.collection || collection?.id || null,
visits: adventureToEdit?.visits || []
visits: adventureToEdit?.visits || [],
is_visited: adventureToEdit?.is_visited || false
};
let markers: Point[] = [];

View File

@@ -253,6 +253,39 @@ export let ADVENTURE_TYPES = [
{ type: 'other', label: 'Other' }
];
// adventure type to icon mapping
export let ADVENTURE_TYPE_ICONS = {
general: '🌍',
outdoor: '🏞️',
lodging: '🛌',
dining: '🍽️',
activity: '🏄',
attraction: '🎢',
shopping: '🛍️',
nightlife: '🌃',
event: '🎉',
transportation: '🚗',
culture: '🎭',
water_sports: '🚤',
hiking: '🥾',
wildlife: '🦒',
historical_sites: '🏛️',
music_concerts: '🎶',
fitness: '🏋️',
art_museums: '🎨',
festivals: '🎪',
spiritual_journeys: '🧘‍♀️',
volunteer_work: '🤝',
other: '❓'
};
type AdventureType = keyof typeof ADVENTURE_TYPE_ICONS;
export function getAdventureTypeLabel(type: AdventureType) {
const typeObj = ADVENTURE_TYPE_ICONS[type];
return typeObj;
}
export function getRandomBackground() {
const randomIndex = Math.floor(Math.random() * randomBackgrounds.backgrounds.length);
return randomBackgrounds.backgrounds[randomIndex] as Background;

View File

@@ -63,6 +63,9 @@ export type VisitedRegion = {
id: number;
region: number;
user_id: number;
longitude: number;
latitude: number;
name: string;
};
export type Point = {