1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-29 17:59:36 +02:00

feat: update toast messages and add city updates; enhance geocoding checks and localizations

This commit is contained in:
Sean Morley 2025-01-15 11:53:04 -05:00
parent bcbe7657ad
commit 0588555707
13 changed files with 89 additions and 37 deletions

View file

@ -1235,6 +1235,8 @@ class ReverseGeocodeViewSet(viewsets.ViewSet):
if serialized_adventure['is_visited'] == True: if serialized_adventure['is_visited'] == True:
lat = adventure.latitude lat = adventure.latitude
lon = adventure.longitude lon = adventure.longitude
if not lat or not lon:
continue
url = f"https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat={lat}&lon={lon}" url = f"https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat={lat}&lon={lon}"
headers = {'User-Agent': 'AdventureLog Server'} headers = {'User-Agent': 'AdventureLog Server'}
response = requests.get(url, headers=headers) response = requests.get(url, headers=headers)

View file

@ -217,7 +217,8 @@
"to": "Zu", "to": "Zu",
"transportation_delete_confirm": "Sind Sie sicher, dass Sie diesen Transport löschen möchten? \nDiese Aktion kann nicht rückgängig gemacht werden.", "transportation_delete_confirm": "Sind Sie sicher, dass Sie diesen Transport löschen möchten? \nDiese Aktion kann nicht rückgängig gemacht werden.",
"show_map": "Karte anzeigen", "show_map": "Karte anzeigen",
"will_be_marked": "wird als besucht markiert, sobald das Abenteuer gespeichert ist." "will_be_marked": "wird als besucht markiert, sobald das Abenteuer gespeichert ist.",
"cities_updated": "Städte aktualisiert"
}, },
"home": { "home": {
"desc_1": "Entdecken, planen und erkunden Sie mit Leichtigkeit", "desc_1": "Entdecken, planen und erkunden Sie mit Leichtigkeit",
@ -497,7 +498,8 @@
"member_since": "Mitglied seit", "member_since": "Mitglied seit",
"user_stats": "Benutzerstatistiken", "user_stats": "Benutzerstatistiken",
"visited_countries": "Besuchte Länder", "visited_countries": "Besuchte Länder",
"visited_regions": "Besuchte Regionen" "visited_regions": "Besuchte Regionen",
"visited_cities": "Besuchte Städte"
}, },
"categories": { "categories": {
"category_name": "Kategoriename", "category_name": "Kategoriename",
@ -515,7 +517,8 @@
"recent_adventures": "Aktuelle Abenteuer", "recent_adventures": "Aktuelle Abenteuer",
"total_adventures": "Totale Abenteuer", "total_adventures": "Totale Abenteuer",
"total_visited_regions": "Insgesamt besuchte Regionen", "total_visited_regions": "Insgesamt besuchte Regionen",
"welcome_back": "Willkommen zurück" "welcome_back": "Willkommen zurück",
"total_visited_cities": "Insgesamt besuchte Städte"
}, },
"immich": { "immich": {
"api_key": "Immich-API-Schlüssel", "api_key": "Immich-API-Schlüssel",

View file

@ -197,6 +197,7 @@
"mark_visited": "Mark Visited", "mark_visited": "Mark Visited",
"error_updating_regions": "Error updating regions", "error_updating_regions": "Error updating regions",
"regions_updated": "regions updated", "regions_updated": "regions updated",
"cities_updated": "cities updated",
"visited_region_check": "Visited Region Check", "visited_region_check": "Visited Region Check",
"visited_region_check_desc": "By selecting this, the server will check all of your visited adventures and mark the regions they are located in as visited in world travel.", "visited_region_check_desc": "By selecting this, the server will check all of your visited adventures and mark the regions they are located in as visited in world travel.",
"update_visited_regions": "Update Visited Regions", "update_visited_regions": "Update Visited Regions",
@ -497,7 +498,8 @@
"member_since": "Member since", "member_since": "Member since",
"user_stats": "User Stats", "user_stats": "User Stats",
"visited_countries": "Visited Countries", "visited_countries": "Visited Countries",
"visited_regions": "Visited Regions" "visited_regions": "Visited Regions",
"visited_cities": "Visited Cities"
}, },
"categories": { "categories": {
"manage_categories": "Manage Categories", "manage_categories": "Manage Categories",
@ -513,6 +515,7 @@
"countries_visited": "Countries Visited", "countries_visited": "Countries Visited",
"total_adventures": "Total Adventures", "total_adventures": "Total Adventures",
"total_visited_regions": "Total Visited Regions", "total_visited_regions": "Total Visited Regions",
"total_visited_cities": "Total Visited Cities",
"recent_adventures": "Recent Adventures", "recent_adventures": "Recent Adventures",
"no_recent_adventures": "No recent adventures?", "no_recent_adventures": "No recent adventures?",
"add_some": "Why not start planning your next adventure? You can add a new adventure by clicking the button below." "add_some": "Why not start planning your next adventure? You can add a new adventure by clicking the button below."

View file

@ -264,7 +264,8 @@
"to": "A", "to": "A",
"transportation_delete_confirm": "¿Está seguro de que desea eliminar este transporte? \nEsta acción no se puede deshacer.", "transportation_delete_confirm": "¿Está seguro de que desea eliminar este transporte? \nEsta acción no se puede deshacer.",
"show_map": "Mostrar mapa", "show_map": "Mostrar mapa",
"will_be_marked": "se marcará como visitado una vez guardada la aventura." "will_be_marked": "se marcará como visitado una vez guardada la aventura.",
"cities_updated": "ciudades actualizadas"
}, },
"worldtravel": { "worldtravel": {
"all": "Todo", "all": "Todo",
@ -497,7 +498,8 @@
"member_since": "Miembro desde", "member_since": "Miembro desde",
"user_stats": "Estadísticas de usuario", "user_stats": "Estadísticas de usuario",
"visited_countries": "Países visitados", "visited_countries": "Países visitados",
"visited_regions": "Regiones visitadas" "visited_regions": "Regiones visitadas",
"visited_cities": "Ciudades Visitadas"
}, },
"categories": { "categories": {
"category_name": "Nombre de categoría", "category_name": "Nombre de categoría",
@ -515,7 +517,8 @@
"recent_adventures": "Aventuras recientes", "recent_adventures": "Aventuras recientes",
"total_adventures": "Aventuras totales", "total_adventures": "Aventuras totales",
"total_visited_regions": "Total de regiones visitadas", "total_visited_regions": "Total de regiones visitadas",
"welcome_back": "Bienvenido de nuevo" "welcome_back": "Bienvenido de nuevo",
"total_visited_cities": "Total de ciudades visitadas"
}, },
"immich": { "immich": {
"api_key": "Clave API de Immich", "api_key": "Clave API de Immich",

View file

@ -217,7 +217,8 @@
"to": "À", "to": "À",
"transportation_delete_confirm": "Etes-vous sûr de vouloir supprimer ce transport ? \nCette action ne peut pas être annulée.", "transportation_delete_confirm": "Etes-vous sûr de vouloir supprimer ce transport ? \nCette action ne peut pas être annulée.",
"show_map": "Afficher la carte", "show_map": "Afficher la carte",
"will_be_marked": "sera marqué comme visité une fois laventure sauvegardée." "will_be_marked": "sera marqué comme visité une fois laventure sauvegardée.",
"cities_updated": "villes mises à jour"
}, },
"home": { "home": {
"desc_1": "Découvrez, planifiez et explorez en toute simplicité", "desc_1": "Découvrez, planifiez et explorez en toute simplicité",
@ -497,7 +498,8 @@
"member_since": "Membre depuis", "member_since": "Membre depuis",
"user_stats": "Statistiques des utilisateurs", "user_stats": "Statistiques des utilisateurs",
"visited_countries": "Pays visités", "visited_countries": "Pays visités",
"visited_regions": "Régions visitées" "visited_regions": "Régions visitées",
"visited_cities": "Villes visitées"
}, },
"categories": { "categories": {
"category_name": "Nom de la catégorie", "category_name": "Nom de la catégorie",
@ -515,7 +517,8 @@
"recent_adventures": "Aventures récentes", "recent_adventures": "Aventures récentes",
"total_adventures": "Aventures totales", "total_adventures": "Aventures totales",
"total_visited_regions": "Total des régions visitées", "total_visited_regions": "Total des régions visitées",
"welcome_back": "Content de te revoir" "welcome_back": "Content de te revoir",
"total_visited_cities": "Total des villes visitées"
}, },
"immich": { "immich": {
"api_key": "Clé API Immich", "api_key": "Clé API Immich",

View file

@ -217,7 +217,8 @@
"to": "A", "to": "A",
"transportation_delete_confirm": "Sei sicuro di voler eliminare questo trasporto? \nQuesta azione non può essere annullata.", "transportation_delete_confirm": "Sei sicuro di voler eliminare questo trasporto? \nQuesta azione non può essere annullata.",
"show_map": "Mostra mappa", "show_map": "Mostra mappa",
"will_be_marked": "verrà contrassegnato come visitato una volta salvata l'avventura." "will_be_marked": "verrà contrassegnato come visitato una volta salvata l'avventura.",
"cities_updated": "città aggiornate"
}, },
"home": { "home": {
"desc_1": "Scopri, pianifica ed esplora con facilità", "desc_1": "Scopri, pianifica ed esplora con facilità",
@ -497,7 +498,8 @@
"member_since": "Membro da allora", "member_since": "Membro da allora",
"user_stats": "Statistiche utente", "user_stats": "Statistiche utente",
"visited_countries": "Paesi visitati", "visited_countries": "Paesi visitati",
"visited_regions": "Regioni visitate" "visited_regions": "Regioni visitate",
"visited_cities": "Città visitate"
}, },
"categories": { "categories": {
"category_name": "Nome della categoria", "category_name": "Nome della categoria",
@ -515,7 +517,8 @@
"recent_adventures": "Avventure recenti", "recent_adventures": "Avventure recenti",
"total_adventures": "Avventure totali", "total_adventures": "Avventure totali",
"total_visited_regions": "Totale regioni visitate", "total_visited_regions": "Totale regioni visitate",
"welcome_back": "Bentornato" "welcome_back": "Bentornato",
"total_visited_cities": "Totale città visitate"
}, },
"immich": { "immich": {
"api_key": "Chiave API Immich", "api_key": "Chiave API Immich",

View file

@ -217,7 +217,8 @@
"transportation_delete_confirm": "Weet u zeker dat u dit transport wilt verwijderen? \nDeze actie kan niet ongedaan worden gemaakt.", "transportation_delete_confirm": "Weet u zeker dat u dit transport wilt verwijderen? \nDeze actie kan niet ongedaan worden gemaakt.",
"ending_airport": "Einde luchthaven", "ending_airport": "Einde luchthaven",
"show_map": "Toon kaart", "show_map": "Toon kaart",
"will_be_marked": "wordt gemarkeerd als bezocht zodra het avontuur is opgeslagen." "will_be_marked": "wordt gemarkeerd als bezocht zodra het avontuur is opgeslagen.",
"cities_updated": "steden bijgewerkt"
}, },
"home": { "home": {
"desc_1": "Ontdek, plan en verken met gemak", "desc_1": "Ontdek, plan en verken met gemak",
@ -497,7 +498,8 @@
"member_since": "Lid sinds", "member_since": "Lid sinds",
"user_stats": "Gebruikersstatistieken", "user_stats": "Gebruikersstatistieken",
"visited_countries": "Bezochte landen", "visited_countries": "Bezochte landen",
"visited_regions": "Bezochte regio's" "visited_regions": "Bezochte regio's",
"visited_cities": "Steden bezocht"
}, },
"categories": { "categories": {
"category_name": "Categorienaam", "category_name": "Categorienaam",
@ -515,7 +517,8 @@
"recent_adventures": "Recente avonturen", "recent_adventures": "Recente avonturen",
"total_adventures": "Totale avonturen", "total_adventures": "Totale avonturen",
"total_visited_regions": "Totaal bezochte regio's", "total_visited_regions": "Totaal bezochte regio's",
"welcome_back": "Welkom terug" "welcome_back": "Welkom terug",
"total_visited_cities": "Totaal bezochte steden"
}, },
"immich": { "immich": {
"api_key": "Immich API-sleutel", "api_key": "Immich API-sleutel",

View file

@ -264,7 +264,8 @@
"to": "Do", "to": "Do",
"transportation_delete_confirm": "Czy na pewno chcesz usunąć ten transport? \nTej akcji nie można cofnąć.", "transportation_delete_confirm": "Czy na pewno chcesz usunąć ten transport? \nTej akcji nie można cofnąć.",
"show_map": "Pokaż mapę", "show_map": "Pokaż mapę",
"will_be_marked": "zostanie oznaczona jako odwiedzona po zapisaniu przygody." "will_be_marked": "zostanie oznaczona jako odwiedzona po zapisaniu przygody.",
"cities_updated": "miasta zaktualizowane"
}, },
"worldtravel": { "worldtravel": {
"country_list": "Lista krajów", "country_list": "Lista krajów",
@ -497,7 +498,8 @@
"member_since": "Użytkownik od", "member_since": "Użytkownik od",
"user_stats": "Statystyki użytkownika", "user_stats": "Statystyki użytkownika",
"visited_countries": "Odwiedzone kraje", "visited_countries": "Odwiedzone kraje",
"visited_regions": "Odwiedzone regiony" "visited_regions": "Odwiedzone regiony",
"visited_cities": "Odwiedzone miasta"
}, },
"categories": { "categories": {
"manage_categories": "Zarządzaj kategoriami", "manage_categories": "Zarządzaj kategoriami",
@ -515,7 +517,8 @@
"recent_adventures": "Ostatnie przygody", "recent_adventures": "Ostatnie przygody",
"total_adventures": "Totalne przygody", "total_adventures": "Totalne przygody",
"total_visited_regions": "Łączna liczba odwiedzonych regionów", "total_visited_regions": "Łączna liczba odwiedzonych regionów",
"welcome_back": "Witamy z powrotem" "welcome_back": "Witamy z powrotem",
"total_visited_cities": "Łączna liczba odwiedzonych miast"
}, },
"immich": { "immich": {
"api_key": "Klucz API Immicha", "api_key": "Klucz API Immicha",

View file

@ -217,7 +217,8 @@
"to": "Till", "to": "Till",
"transportation_delete_confirm": "Är du säker på att du vill ta bort denna transport? \nDenna åtgärd kan inte ångras.", "transportation_delete_confirm": "Är du säker på att du vill ta bort denna transport? \nDenna åtgärd kan inte ångras.",
"show_map": "Visa karta", "show_map": "Visa karta",
"will_be_marked": "kommer att markeras som besökt när äventyret har sparats." "will_be_marked": "kommer att markeras som besökt när äventyret har sparats.",
"cities_updated": "städer uppdaterade"
}, },
"home": { "home": {
"desc_1": "Upptäck, planera och utforska med lätthet", "desc_1": "Upptäck, planera och utforska med lätthet",
@ -497,7 +498,8 @@
"member_since": "Medlem sedan", "member_since": "Medlem sedan",
"user_stats": "Användarstatistik", "user_stats": "Användarstatistik",
"visited_countries": "Besökta länder", "visited_countries": "Besökta länder",
"visited_regions": "Besökta regioner" "visited_regions": "Besökta regioner",
"visited_cities": "Besökte städer"
}, },
"categories": { "categories": {
"category_name": "Kategorinamn", "category_name": "Kategorinamn",
@ -515,7 +517,8 @@
"recent_adventures": "Senaste äventyr", "recent_adventures": "Senaste äventyr",
"total_adventures": "Totala äventyr", "total_adventures": "Totala äventyr",
"total_visited_regions": "Totalt antal besökta regioner", "total_visited_regions": "Totalt antal besökta regioner",
"welcome_back": "Välkommen tillbaka" "welcome_back": "Välkommen tillbaka",
"total_visited_cities": "Totalt antal besökta städer"
}, },
"immich": { "immich": {
"api_key": "Immich API-nyckel", "api_key": "Immich API-nyckel",

View file

@ -217,7 +217,8 @@
"to": "到", "to": "到",
"transportation_delete_confirm": "您确定要删除此交通工具吗?\n此操作无法撤消。", "transportation_delete_confirm": "您确定要删除此交通工具吗?\n此操作无法撤消。",
"show_map": "显示地图", "show_map": "显示地图",
"will_be_marked": "保存冒险后将被标记为已访问。" "will_be_marked": "保存冒险后将被标记为已访问。",
"cities_updated": "城市已更新"
}, },
"home": { "home": {
"desc_1": "轻松发现、规划和探索", "desc_1": "轻松发现、规划和探索",
@ -497,7 +498,8 @@
"member_since": "会员自", "member_since": "会员自",
"user_stats": "用户统计", "user_stats": "用户统计",
"visited_countries": "访问过的国家", "visited_countries": "访问过的国家",
"visited_regions": "访问地区" "visited_regions": "访问地区",
"visited_cities": "访问城市"
}, },
"categories": { "categories": {
"category_name": "类别名称", "category_name": "类别名称",
@ -515,7 +517,8 @@
"recent_adventures": "最近的冒险", "recent_adventures": "最近的冒险",
"total_adventures": "全面冒险", "total_adventures": "全面冒险",
"total_visited_regions": "总访问地区", "total_visited_regions": "总访问地区",
"welcome_back": "欢迎回来" "welcome_back": "欢迎回来",
"total_visited_cities": "访问城市总数"
}, },
"immich": { "immich": {
"api_key": "伊米奇 API 密钥", "api_key": "伊米奇 API 密钥",

View file

@ -8,6 +8,7 @@
import FlagCheckeredVariantIcon from '~icons/mdi/flag-checkered-variant'; import FlagCheckeredVariantIcon from '~icons/mdi/flag-checkered-variant';
import Airplane from '~icons/mdi/airplane'; import Airplane from '~icons/mdi/airplane';
import CityVariantOutline from '~icons/mdi/city-variant-outline'; import CityVariantOutline from '~icons/mdi/city-variant-outline';
import MapMarkerStarOutline from '~icons/mdi/map-marker-star-outline';
const user = data.user; const user = data.user;
const recentAdventures = data.props.adventures; const recentAdventures = data.props.adventures;
@ -26,13 +27,6 @@
<!-- Stats --> <!-- Stats -->
<div class="stats shadow mb-8 w-full bg-neutral"> <div class="stats shadow mb-8 w-full bg-neutral">
<div class="stat">
<div class="stat-figure text-primary">
<FlagCheckeredVariantIcon class="w-10 h-10 inline-block" />
</div>
<div class="stat-title text-neutral-content">{$t('dashboard.countries_visited')}</div>
<div class="stat-value text-primary">{stats.country_count}</div>
</div>
<div class="stat"> <div class="stat">
<div class="stat-figure text-secondary"> <div class="stat-figure text-secondary">
<Airplane class="w-10 h-10 inline-block" /> <Airplane class="w-10 h-10 inline-block" />
@ -40,13 +34,27 @@
<div class="stat-title text-neutral-content">{$t('dashboard.total_adventures')}</div> <div class="stat-title text-neutral-content">{$t('dashboard.total_adventures')}</div>
<div class="stat-value text-secondary">{stats.adventure_count}</div> <div class="stat-value text-secondary">{stats.adventure_count}</div>
</div> </div>
<div class="stat">
<div class="stat-figure text-primary">
<FlagCheckeredVariantIcon class="w-10 h-10 inline-block" />
</div>
<div class="stat-title text-neutral-content">{$t('dashboard.countries_visited')}</div>
<div class="stat-value text-primary">{stats.visited_country_count}</div>
</div>
<div class="stat"> <div class="stat">
<div class="stat-figure text-success"> <div class="stat-figure text-success">
<CityVariantOutline class="w-10 h-10 inline-block" /> <MapMarkerStarOutline class="w-10 h-10 inline-block" />
</div> </div>
<div class="stat-title text-neutral-content">{$t('dashboard.total_visited_regions')}</div> <div class="stat-title text-neutral-content">{$t('dashboard.total_visited_regions')}</div>
<div class="stat-value text-success">{stats.visited_region_count}</div> <div class="stat-value text-success">{stats.visited_region_count}</div>
</div> </div>
<div class="stat">
<div class="stat-figure text-info">
<CityVariantOutline class="w-10 h-10 inline-block" />
</div>
<div class="stat-title text-neutral-content">{$t('dashboard.total_visited_cities')}</div>
<div class="stat-value text-info">{stats.visited_city_count}</div>
</div>
</div> </div>
<!-- Recent Adventures --> <!-- Recent Adventures -->

View file

@ -3,12 +3,14 @@
import { t } from 'svelte-i18n'; import { t } from 'svelte-i18n';
let stats: { let stats: {
country_count: number; visited_country_count: number;
total_regions: number; total_regions: number;
trips_count: number; trips_count: number;
adventure_count: number; adventure_count: number;
visited_region_count: number; visited_region_count: number;
total_countries: number; total_countries: number;
visited_city_count: number;
total_cities: number;
} | null; } | null;
stats = data.stats || null; stats = data.stats || null;
@ -73,10 +75,10 @@
<div class="stat"> <div class="stat">
<div class="stat-title">{$t('profile.visited_countries')}</div> <div class="stat-title">{$t('profile.visited_countries')}</div>
<div class="stat-value text-center"> <div class="stat-value text-center">
{Math.round((stats.country_count / stats.total_countries) * 100)}% {Math.round((stats.visited_country_count / stats.total_countries) * 100)}%
</div> </div>
<div class="stat-desc text-center"> <div class="stat-desc text-center">
{stats.country_count}/{stats.total_countries} {stats.visited_country_count}/{stats.total_countries}
</div> </div>
</div> </div>
@ -89,6 +91,16 @@
{stats.visited_region_count}/{stats.total_regions} {stats.visited_region_count}/{stats.total_regions}
</div> </div>
</div> </div>
<div class="stat">
<div class="stat-title">{$t('profile.visited_cities')}</div>
<div class="stat-value text-center">
{Math.round((stats.visited_city_count / stats.total_cities) * 100)}%
</div>
<div class="stat-desc text-center">
{stats.visited_city_count}/{stats.total_cities}
</div>
</div>
</div> </div>
</div> </div>
{/if} {/if}

View file

@ -62,7 +62,10 @@
}); });
let data = await res.json(); let data = await res.json();
if (res.ok) { if (res.ok) {
addToast('success', `${data.new_regions} ${$t('adventures.regions_updated')}`); addToast(
'success',
`${data.new_regions} ${$t('adventures.regions_updated')}. ${data.new_cities} ${$t('adventures.cities_updated')}.`
);
} else { } else {
addToast('error', $t('adventures.error_updating_regions')); addToast('error', $t('adventures.error_updating_regions'));
} }