feat: remove Globe Spin discover feature
This commit is contained in:
@@ -2,18 +2,31 @@
|
||||
|
||||
from django.urls import include, path
|
||||
from rest_framework.routers import DefaultRouter
|
||||
from .views import CountryViewSet, RegionViewSet, VisitedRegionViewSet, regions_by_country, visits_by_country, cities_by_region, VisitedCityViewSet, visits_by_region, globespin
|
||||
from .views import (
|
||||
CountryViewSet,
|
||||
RegionViewSet,
|
||||
VisitedRegionViewSet,
|
||||
regions_by_country,
|
||||
visits_by_country,
|
||||
cities_by_region,
|
||||
VisitedCityViewSet,
|
||||
visits_by_region,
|
||||
)
|
||||
|
||||
router = DefaultRouter()
|
||||
router.register(r'countries', CountryViewSet, basename='countries')
|
||||
router.register(r'regions', RegionViewSet, basename='regions')
|
||||
router.register(r'visitedregion', VisitedRegionViewSet, basename='visitedregion')
|
||||
router.register(r'visitedcity', VisitedCityViewSet, basename='visitedcity')
|
||||
router.register(r"countries", CountryViewSet, basename="countries")
|
||||
router.register(r"regions", RegionViewSet, basename="regions")
|
||||
router.register(r"visitedregion", VisitedRegionViewSet, basename="visitedregion")
|
||||
router.register(r"visitedcity", VisitedCityViewSet, basename="visitedcity")
|
||||
|
||||
urlpatterns = [
|
||||
path('', include(router.urls)),
|
||||
path('<str:country_code>/regions/', regions_by_country, name='regions-by-country'),
|
||||
path('<str:country_code>/visits/', visits_by_country, name='visits-by-country'),
|
||||
path('regions/<str:region_id>/cities/', cities_by_region, name='cities-by-region'),
|
||||
path('regions/<str:region_id>/cities/visits/', visits_by_region, name='visits-by-region'),
|
||||
path('globespin/', globespin, name='globespin'),
|
||||
path("", include(router.urls)),
|
||||
path("<str:country_code>/regions/", regions_by_country, name="regions-by-country"),
|
||||
path("<str:country_code>/visits/", visits_by_country, name="visits-by-country"),
|
||||
path("regions/<str:region_id>/cities/", cities_by_region, name="cities-by-region"),
|
||||
path(
|
||||
"regions/<str:region_id>/cities/visits/",
|
||||
visits_by_region,
|
||||
name="visits-by-region",
|
||||
),
|
||||
]
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
from django.shortcuts import get_object_or_404
|
||||
from .models import Country, Region, VisitedRegion, City, VisitedCity
|
||||
from .serializers import CitySerializer, CountrySerializer, RegionSerializer, VisitedRegionSerializer, VisitedCitySerializer
|
||||
from .serializers import (
|
||||
CitySerializer,
|
||||
CountrySerializer,
|
||||
RegionSerializer,
|
||||
VisitedRegionSerializer,
|
||||
VisitedCitySerializer,
|
||||
)
|
||||
from rest_framework import viewsets, status
|
||||
from rest_framework.permissions import IsAuthenticated
|
||||
from rest_framework.response import Response
|
||||
@@ -8,15 +14,17 @@ from rest_framework.decorators import api_view, permission_classes, action
|
||||
from django.contrib.gis.geos import Point
|
||||
from adventures.models import Location
|
||||
|
||||
@api_view(['GET'])
|
||||
|
||||
@api_view(["GET"])
|
||||
@permission_classes([IsAuthenticated])
|
||||
def regions_by_country(request, country_code):
|
||||
country = get_object_or_404(Country, country_code=country_code)
|
||||
regions = Region.objects.filter(country=country).order_by('name')
|
||||
regions = Region.objects.filter(country=country).order_by("name")
|
||||
serializer = RegionSerializer(regions, many=True)
|
||||
return Response(serializer.data)
|
||||
|
||||
@api_view(['GET'])
|
||||
|
||||
@api_view(["GET"])
|
||||
@permission_classes([IsAuthenticated])
|
||||
def visits_by_country(request, country_code):
|
||||
country = get_object_or_404(Country, country_code=country_code)
|
||||
@@ -24,15 +32,17 @@ def visits_by_country(request, country_code):
|
||||
serializer = VisitedRegionSerializer(visits, many=True)
|
||||
return Response(serializer.data)
|
||||
|
||||
@api_view(['GET'])
|
||||
|
||||
@api_view(["GET"])
|
||||
@permission_classes([IsAuthenticated])
|
||||
def cities_by_region(request, region_id):
|
||||
region = get_object_or_404(Region, id=region_id)
|
||||
cities = City.objects.filter(region=region).order_by('name')
|
||||
cities = City.objects.filter(region=region).order_by("name")
|
||||
serializer = CitySerializer(cities, many=True)
|
||||
return Response(serializer.data)
|
||||
|
||||
@api_view(['GET'])
|
||||
|
||||
@api_view(["GET"])
|
||||
@permission_classes([IsAuthenticated])
|
||||
def visits_by_region(request, region_id):
|
||||
region = get_object_or_404(Region, id=region_id)
|
||||
@@ -40,122 +50,127 @@ def visits_by_region(request, region_id):
|
||||
serializer = VisitedCitySerializer(visits, many=True)
|
||||
return Response(serializer.data)
|
||||
|
||||
# view called spin the globe that return a random country, a random region in that country and a random city in that region
|
||||
@api_view(['GET'])
|
||||
@permission_classes([IsAuthenticated])
|
||||
def globespin(request):
|
||||
country = Country.objects.order_by('?').first()
|
||||
data = {
|
||||
"country": CountrySerializer(country).data,
|
||||
}
|
||||
|
||||
regions = Region.objects.filter(country=country)
|
||||
if regions.exists():
|
||||
region = regions.order_by('?').first()
|
||||
data["region"] = RegionSerializer(region).data
|
||||
|
||||
cities = City.objects.filter(region=region)
|
||||
if cities.exists():
|
||||
city = cities.order_by('?').first()
|
||||
data["city"] = CitySerializer(city).data
|
||||
|
||||
return Response(data)
|
||||
|
||||
class CountryViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
queryset = Country.objects.all().order_by('name')
|
||||
queryset = Country.objects.all().order_by("name")
|
||||
serializer_class = CountrySerializer
|
||||
permission_classes = [IsAuthenticated]
|
||||
|
||||
@action(detail=False, methods=['get'])
|
||||
@action(detail=False, methods=["get"])
|
||||
def check_point_in_region(self, request):
|
||||
lat = float(request.query_params.get('lat'))
|
||||
lon = float(request.query_params.get('lon'))
|
||||
lat = float(request.query_params.get("lat"))
|
||||
lon = float(request.query_params.get("lon"))
|
||||
point = Point(lon, lat, srid=4326)
|
||||
region = Region.objects.filter(geometry__contains=point).first()
|
||||
if region:
|
||||
return Response({'in_region': True, 'region_name': region.name, 'region_id': region.id})
|
||||
return Response(
|
||||
{"in_region": True, "region_name": region.name, "region_id": region.id}
|
||||
)
|
||||
else:
|
||||
return Response({'in_region': False})
|
||||
return Response({"in_region": False})
|
||||
|
||||
@action(detail=False, methods=['post'])
|
||||
@action(detail=False, methods=["post"])
|
||||
def region_check_all_adventures(self, request):
|
||||
adventures = Location.objects.filter(user=request.user.id, type='visited')
|
||||
adventures = Location.objects.filter(user=request.user.id, type="visited")
|
||||
count = 0
|
||||
for adventure in adventures:
|
||||
if adventure.latitude is not None and adventure.longitude is not None:
|
||||
try:
|
||||
point = Point(float(adventure.longitude), float(adventure.latitude), srid=4326)
|
||||
point = Point(
|
||||
float(adventure.longitude), float(adventure.latitude), srid=4326
|
||||
)
|
||||
region = Region.objects.filter(geometry__contains=point).first()
|
||||
if region:
|
||||
if not VisitedRegion.objects.filter(user=request.user.id, region=region).exists():
|
||||
VisitedRegion.objects.create(user=request.user, region=region)
|
||||
if not VisitedRegion.objects.filter(
|
||||
user=request.user.id, region=region
|
||||
).exists():
|
||||
VisitedRegion.objects.create(
|
||||
user=request.user, region=region
|
||||
)
|
||||
count += 1
|
||||
except Exception as e:
|
||||
print(f"Error processing adventure {adventure.id}: {e}")
|
||||
continue
|
||||
return Response({'regions_visited': count})
|
||||
return Response({"regions_visited": count})
|
||||
|
||||
|
||||
class RegionViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
queryset = Region.objects.all()
|
||||
serializer_class = RegionSerializer
|
||||
permission_classes = [IsAuthenticated]
|
||||
|
||||
|
||||
class VisitedRegionViewSet(viewsets.ModelViewSet):
|
||||
serializer_class = VisitedRegionSerializer
|
||||
permission_classes = [IsAuthenticated]
|
||||
|
||||
def get_queryset(self):
|
||||
return VisitedRegion.objects.filter(user=self.request.user.id)
|
||||
|
||||
|
||||
def perform_create(self, serializer):
|
||||
serializer.save(user=self.request.user)
|
||||
|
||||
def create(self, request, *args, **kwargs):
|
||||
request.data['user'] = request.user
|
||||
if VisitedRegion.objects.filter(user=request.user.id, region=request.data['region']).exists():
|
||||
request.data["user"] = request.user
|
||||
if VisitedRegion.objects.filter(
|
||||
user=request.user.id, region=request.data["region"]
|
||||
).exists():
|
||||
return Response({"error": "Region already visited by user."}, status=400)
|
||||
serializer = self.get_serializer(data=request.data)
|
||||
serializer.is_valid(raise_exception=True)
|
||||
self.perform_create(serializer)
|
||||
headers = self.get_success_headers(serializer.data)
|
||||
return Response(serializer.data, status=status.HTTP_201_CREATED, headers=headers)
|
||||
|
||||
return Response(
|
||||
serializer.data, status=status.HTTP_201_CREATED, headers=headers
|
||||
)
|
||||
|
||||
def destroy(self, request, **kwargs):
|
||||
region = get_object_or_404(Region, id=kwargs['pk'])
|
||||
visited_region = VisitedRegion.objects.filter(user=request.user.id, region=region)
|
||||
region = get_object_or_404(Region, id=kwargs["pk"])
|
||||
visited_region = VisitedRegion.objects.filter(
|
||||
user=request.user.id, region=region
|
||||
)
|
||||
if visited_region.exists():
|
||||
visited_region.delete()
|
||||
return Response(status=status.HTTP_204_NO_CONTENT)
|
||||
else:
|
||||
return Response({"error": "Visited region not found."}, status=status.HTTP_404_NOT_FOUND)
|
||||
|
||||
return Response(
|
||||
{"error": "Visited region not found."}, status=status.HTTP_404_NOT_FOUND
|
||||
)
|
||||
|
||||
|
||||
class VisitedCityViewSet(viewsets.ModelViewSet):
|
||||
serializer_class = VisitedCitySerializer
|
||||
permission_classes = [IsAuthenticated]
|
||||
|
||||
def get_queryset(self):
|
||||
return VisitedCity.objects.filter(user=self.request.user.id)
|
||||
|
||||
|
||||
def perform_create(self, serializer):
|
||||
serializer.save(user=self.request.user)
|
||||
|
||||
def create(self, request, *args, **kwargs):
|
||||
request.data['user'] = request.user
|
||||
request.data["user"] = request.user
|
||||
serializer = self.get_serializer(data=request.data)
|
||||
serializer.is_valid(raise_exception=True)
|
||||
self.perform_create(serializer)
|
||||
# Ensure a VisitedRegion exists for the city
|
||||
region = serializer.validated_data['city'].region
|
||||
if not VisitedRegion.objects.filter(user=request.user.id, region=region).exists():
|
||||
region = serializer.validated_data["city"].region
|
||||
if not VisitedRegion.objects.filter(
|
||||
user=request.user.id, region=region
|
||||
).exists():
|
||||
VisitedRegion.objects.create(user=request.user, region=region)
|
||||
headers = self.get_success_headers(serializer.data)
|
||||
return Response(serializer.data, status=status.HTTP_201_CREATED, headers=headers)
|
||||
|
||||
return Response(
|
||||
serializer.data, status=status.HTTP_201_CREATED, headers=headers
|
||||
)
|
||||
|
||||
def destroy(self, request, **kwargs):
|
||||
city = get_object_or_404(City, id=kwargs['pk'])
|
||||
city = get_object_or_404(City, id=kwargs["pk"])
|
||||
visited_city = VisitedCity.objects.filter(user=request.user.id, city=city)
|
||||
if visited_city.exists():
|
||||
visited_city.delete()
|
||||
return Response(status=status.HTTP_204_NO_CONTENT)
|
||||
else:
|
||||
return Response({"error": "Visited city not found."}, status=status.HTTP_404_NOT_FOUND)
|
||||
return Response(
|
||||
{"error": "Visited city not found."}, status=status.HTTP_404_NOT_FOUND
|
||||
)
|
||||
|
||||
@@ -1049,21 +1049,9 @@
|
||||
"visit_remove_failed": "فشل في إزالة الزيارة",
|
||||
"visit_to": "زيارة",
|
||||
"getting_location_details": "الحصول على تفاصيل الموقع",
|
||||
"cities_available": "المدن المتاحة",
|
||||
"destination_revealed": "كشفت الوجهة!",
|
||||
"dive_deeper": "الغوص أعمق",
|
||||
"exploration_progress": "تقدم الاستكشاف",
|
||||
"explore_country": "استكشف البلد",
|
||||
"globe_spin_error_desc": "خطأ جلب بيانات الدوران العالمي",
|
||||
"hide_globe_spin": "إخفاء الدوران العالمي",
|
||||
"in": "في",
|
||||
"loading_globe_spin": "تحميل الكرة الأرضية",
|
||||
"no_globe_spin_data": "لا توجد بيانات تدور حول العالم",
|
||||
"show_globe_spin": "عرض Globe Spin",
|
||||
"spin_again": "تدور مرة أخرى",
|
||||
"spinning_globe": "كرة الغزل",
|
||||
"try_again": "حاول ثانية",
|
||||
"your_random_adventure_awaits": "مغامرتك العشوائية تنتظر!",
|
||||
"about_country": "حول البلد",
|
||||
"about_region": "حول المنطقة",
|
||||
"show_less": "عرض أقل",
|
||||
|
||||
@@ -573,21 +573,9 @@
|
||||
"total_countries": "Länder gesamt",
|
||||
"total_regions": "Regionen gesamt",
|
||||
"getting_location_details": "Erhalten von Standortdetails",
|
||||
"cities_available": "verfügbare Städte",
|
||||
"destination_revealed": "Ziel enthüllt!",
|
||||
"dive_deeper": "tiefer Tauchen",
|
||||
"exploration_progress": "Explorationsfortschritt",
|
||||
"explore_country": "Land erkunden",
|
||||
"globe_spin_error_desc": "Fehler beim Abrufen von Globus-Drehung-Daten",
|
||||
"hide_globe_spin": "Globusdrehung verstecken",
|
||||
"in": "in",
|
||||
"loading_globe_spin": "Globusdrehung wird geladen",
|
||||
"no_globe_spin_data": "Keine Globus-Drehung-Daten",
|
||||
"show_globe_spin": "Globus Drehung anzeigen",
|
||||
"spin_again": "Nochmal drehen",
|
||||
"spinning_globe": "Drehender Globus",
|
||||
"try_again": "Versuchen Sie es erneut",
|
||||
"your_random_adventure_awaits": "Ihr zufälliges Abenteuer wartet!",
|
||||
"about_country": "Über Land",
|
||||
"about_region": "Über die Region",
|
||||
"show_less": "Weniger anzeigen",
|
||||
|
||||
@@ -594,21 +594,9 @@
|
||||
"total_cities": "Total Cities",
|
||||
"region_completed": "Region completed",
|
||||
"getting_location_details": "Getting location details",
|
||||
"hide_globe_spin": "Hide Globe Spin",
|
||||
"show_globe_spin": "Show Globe Spin",
|
||||
"loading_globe_spin": "Loading Globe Spin",
|
||||
"spinning_globe": "Spinning Globe",
|
||||
"destination_revealed": "Destination Revealed!",
|
||||
"your_random_adventure_awaits": "Your Random Adventure Awaits!",
|
||||
"exploration_progress": "Exploration Progress",
|
||||
"dive_deeper": "Dive Deeper",
|
||||
"cities_available": "Cities Available",
|
||||
"in": "in",
|
||||
"explore_country": "Explore Country",
|
||||
"spin_again": "Spin Again",
|
||||
"globe_spin_error_desc": "Error fetching globe spin data",
|
||||
"try_again": "Try Again",
|
||||
"no_globe_spin_data": "No Globe Spin Data",
|
||||
"show_less": "Show Less",
|
||||
"show_more": "Show More",
|
||||
"about_country": "About Country",
|
||||
|
||||
@@ -544,21 +544,9 @@
|
||||
"region_completed": "Región completada",
|
||||
"total_cities": "Ciudades totales",
|
||||
"getting_location_details": "Obtener detalles de ubicación",
|
||||
"cities_available": "Ciudades disponibles",
|
||||
"destination_revealed": "¡Destino revelado!",
|
||||
"dive_deeper": "Sumergirse",
|
||||
"exploration_progress": "Progreso de exploración",
|
||||
"explore_country": "Explorar el país",
|
||||
"globe_spin_error_desc": "Error al obtener datos de giro global",
|
||||
"hide_globe_spin": "Ocultar giro global",
|
||||
"in": "en",
|
||||
"loading_globe_spin": "Cargando giro global",
|
||||
"no_globe_spin_data": "Sin datos de giro de globo",
|
||||
"show_globe_spin": "Show Globe Spin",
|
||||
"spin_again": "Girar de nuevo",
|
||||
"spinning_globe": "Globo hilado",
|
||||
"try_again": "Intentar otra vez",
|
||||
"your_random_adventure_awaits": "¡Tu aventura aleatoria te espera!",
|
||||
"about_country": "Acerca del país",
|
||||
"about_region": "Acerca de la región",
|
||||
"show_less": "Mostrar menos",
|
||||
|
||||
@@ -573,21 +573,9 @@
|
||||
"total_countries": "Total des pays",
|
||||
"total_regions": "Régions totales",
|
||||
"getting_location_details": "Obtenir les détails de l'emplacement",
|
||||
"cities_available": "Villes disponibles",
|
||||
"destination_revealed": "Destination révélée!",
|
||||
"dive_deeper": "Plonger plus profondément",
|
||||
"exploration_progress": "Progrès de l'exploration",
|
||||
"explore_country": "Explorer le pays",
|
||||
"globe_spin_error_desc": "Erreur pour récupérer les données de spin globe",
|
||||
"hide_globe_spin": "Hide Globe Spin",
|
||||
"in": "dans",
|
||||
"loading_globe_spin": "Chargement du globe Spin",
|
||||
"no_globe_spin_data": "Pas de données de spin globe",
|
||||
"show_globe_spin": "Montrer le spin au globe",
|
||||
"spin_again": "Remonter",
|
||||
"spinning_globe": "Globe de rotation",
|
||||
"try_again": "Essayer à nouveau",
|
||||
"your_random_adventure_awaits": "Votre aventure aléatoire vous attend!",
|
||||
"about_country": "À propos du pays",
|
||||
"about_region": "À propos de la région",
|
||||
"show_less": "Afficher moins",
|
||||
|
||||
@@ -544,21 +544,9 @@
|
||||
"total_cities": "Összes város",
|
||||
"region_completed": "Régió teljesítve",
|
||||
"getting_location_details": "Helyadatok lekérése",
|
||||
"hide_globe_spin": "Földgömb forgás elrejtése",
|
||||
"show_globe_spin": "Földgömb forgás megjelenítése",
|
||||
"loading_globe_spin": "Földgömb forgás betöltése",
|
||||
"spinning_globe": "Forgó földgömb",
|
||||
"destination_revealed": "Úticél felfedve!",
|
||||
"your_random_adventure_awaits": "A véletlenszerű kalandod vár rád!",
|
||||
"exploration_progress": "Felfedezés előrehaladása",
|
||||
"dive_deeper": "Merülj mélyebbre",
|
||||
"cities_available": "Elérhető városok",
|
||||
"in": "itt:",
|
||||
"explore_country": "Ország felfedezése",
|
||||
"spin_again": "Forgatás újra",
|
||||
"globe_spin_error_desc": "Hiba történt a földgömb adatainak lekérésekor",
|
||||
"try_again": "Próbáld újra",
|
||||
"no_globe_spin_data": "Nincsenek földgömb adatok",
|
||||
"about_country": "Országról",
|
||||
"about_region": "A régióról",
|
||||
"show_less": "Mutass kevesebbet",
|
||||
|
||||
@@ -573,21 +573,9 @@
|
||||
"total_countries": "Paesi totali",
|
||||
"total_regions": "Regioni totali",
|
||||
"getting_location_details": "Ottenere dettagli sulla posizione",
|
||||
"cities_available": "Città disponibili",
|
||||
"destination_revealed": "Destinazione rivelata!",
|
||||
"dive_deeper": "Immergersi più in profondità",
|
||||
"exploration_progress": "Progressi di esplorazione",
|
||||
"explore_country": "Esplora il paese",
|
||||
"globe_spin_error_desc": "Errore che recupera i dati di spin Globe",
|
||||
"hide_globe_spin": "Nascondi lo spin di globo",
|
||||
"in": "In",
|
||||
"loading_globe_spin": "Caricamento di rotazione del globo",
|
||||
"no_globe_spin_data": "Nessun dati di spin Globe",
|
||||
"show_globe_spin": "Mostra lo spin globo",
|
||||
"spin_again": "Girare di nuovo",
|
||||
"spinning_globe": "Globe rotante",
|
||||
"try_again": "Riprova",
|
||||
"your_random_adventure_awaits": "La tua avventura casuale ti aspetta!",
|
||||
"about_country": "Informazioni sul paese",
|
||||
"about_region": "A proposito di Regione",
|
||||
"show_less": "Mostra meno",
|
||||
|
||||
@@ -1049,21 +1049,9 @@
|
||||
"visit_remove_failed": "訪問を削除できませんでした",
|
||||
"visit_to": "訪問",
|
||||
"getting_location_details": "場所の詳細を取得します",
|
||||
"cities_available": "利用可能な都市",
|
||||
"destination_revealed": "目的地が明らかに!",
|
||||
"dive_deeper": "より深く潜ります",
|
||||
"exploration_progress": "探索の進行",
|
||||
"explore_country": "国を探索します",
|
||||
"globe_spin_error_desc": "グローブスピンデータの取得エラー",
|
||||
"hide_globe_spin": "グローブスピンを隠します",
|
||||
"in": "で",
|
||||
"loading_globe_spin": "グローブスピンのロード",
|
||||
"no_globe_spin_data": "グローブスピンデータはありません",
|
||||
"show_globe_spin": "グローブスピンを表示します",
|
||||
"spin_again": "もう一度スピンします",
|
||||
"spinning_globe": "スピニンググローブ",
|
||||
"try_again": "もう一度やり直してください",
|
||||
"your_random_adventure_awaits": "あなたのランダムな冒険が待っています!",
|
||||
"about_country": "国について",
|
||||
"about_region": "地域について",
|
||||
"show_less": "表示を減らす",
|
||||
|
||||
@@ -973,21 +973,9 @@
|
||||
"total_countries": "총 국가",
|
||||
"total_regions": "총 지역",
|
||||
"getting_location_details": "위치 세부 정보 얻기",
|
||||
"dive_deeper": "더 깊이 다이빙하십시오",
|
||||
"exploration_progress": "탐사 진행",
|
||||
"explore_country": "국가를 탐험하십시오",
|
||||
"globe_spin_error_desc": "오류 페치 글로브 스핀 데이터",
|
||||
"hide_globe_spin": "글로브 스핀을 숨기십시오",
|
||||
"in": "~에",
|
||||
"loading_globe_spin": "로드 글로브 스핀",
|
||||
"no_globe_spin_data": "글로브 스핀 데이터가 없습니다",
|
||||
"show_globe_spin": "글로브 스핀을 보여주십시오",
|
||||
"spin_again": "다시 회전하십시오",
|
||||
"spinning_globe": "회전하는 글로브",
|
||||
"try_again": "다시 시도하십시오",
|
||||
"your_random_adventure_awaits": "당신의 임의의 모험이 기다리고 있습니다!",
|
||||
"cities_available": "이용 가능",
|
||||
"destination_revealed": "목적지 공개!",
|
||||
"about_country": "국가 소개",
|
||||
"about_region": "지역정보",
|
||||
"show_less": "간략히 표시",
|
||||
|
||||
@@ -573,21 +573,9 @@
|
||||
"total_countries": "Totale landen",
|
||||
"total_regions": "Totaal aantal regio's",
|
||||
"getting_location_details": "Locatiegegevens krijgen",
|
||||
"cities_available": "Steden beschikbaar",
|
||||
"destination_revealed": "Bestemming onthuld!",
|
||||
"dive_deeper": "Duik dieper",
|
||||
"exploration_progress": "Verkennings voortgang",
|
||||
"explore_country": "Verken het land",
|
||||
"globe_spin_error_desc": "Fout bij het ophalen van globe spin -gegevens",
|
||||
"hide_globe_spin": "Globe spin verbergen",
|
||||
"in": "in",
|
||||
"loading_globe_spin": "Globe spin laden",
|
||||
"no_globe_spin_data": "Geen Globe spin -gegevens",
|
||||
"show_globe_spin": "Toon Globe Spin",
|
||||
"spin_again": "Weer spinnen",
|
||||
"spinning_globe": "Spinnende bol",
|
||||
"try_again": "Probeer het opnieuw",
|
||||
"your_random_adventure_awaits": "Je willekeurige avontuur wacht!",
|
||||
"about_country": "Over land",
|
||||
"about_region": "Over Regio",
|
||||
"show_less": "Toon minder",
|
||||
|
||||
@@ -544,21 +544,9 @@
|
||||
"total_countries": "Totalt land",
|
||||
"total_regions": "Totale regioner",
|
||||
"getting_location_details": "Få stedsdetaljer",
|
||||
"cities_available": "Byer tilgjengelig",
|
||||
"destination_revealed": "Destinasjon avslørt!",
|
||||
"dive_deeper": "Dykk dypere",
|
||||
"exploration_progress": "Utforskningsfremgang",
|
||||
"explore_country": "Utforsk landet",
|
||||
"globe_spin_error_desc": "Feilhåndtering av klode -spinndata",
|
||||
"hide_globe_spin": "Skjul klode spinn",
|
||||
"in": "i",
|
||||
"loading_globe_spin": "Laster klode spinn",
|
||||
"no_globe_spin_data": "Ingen klode spinndata",
|
||||
"show_globe_spin": "Vis Globe Spin",
|
||||
"spin_again": "Spinn igjen",
|
||||
"spinning_globe": "Spinnende klode",
|
||||
"try_again": "Prøv igjen",
|
||||
"your_random_adventure_awaits": "Ditt tilfeldige eventyr venter!",
|
||||
"about_country": "Om landet",
|
||||
"about_region": "Om regionen",
|
||||
"show_less": "Vis mindre",
|
||||
|
||||
@@ -544,21 +544,9 @@
|
||||
"all_regions": "Wszystkie regiony",
|
||||
"cities_in": "Miasta w",
|
||||
"getting_location_details": "Uzyskanie szczegółów lokalizacji",
|
||||
"cities_available": "Dostępne miasta",
|
||||
"destination_revealed": "Ujawnione miejsce docelowe!",
|
||||
"dive_deeper": "Nurkuj głębiej",
|
||||
"exploration_progress": "Postęp eksploracyjny",
|
||||
"explore_country": "Poznaj kraj",
|
||||
"globe_spin_error_desc": "Błąd przyciąganie danych spinowych globe",
|
||||
"hide_globe_spin": "Ukryj globe spin",
|
||||
"in": "W",
|
||||
"loading_globe_spin": "Ładowanie globowego spinu",
|
||||
"no_globe_spin_data": "Brak danych spinowych globe",
|
||||
"show_globe_spin": "Pokaż globe spin",
|
||||
"spin_again": "Obrócić ponownie",
|
||||
"spinning_globe": "Spinning Globe",
|
||||
"try_again": "Spróbuj ponownie",
|
||||
"your_random_adventure_awaits": "Twoja przypadkowa przygoda czeka!",
|
||||
"about_country": "O kraju",
|
||||
"about_region": "O Regionie",
|
||||
"show_less": "Pokaż mniej",
|
||||
|
||||
@@ -1051,23 +1051,11 @@
|
||||
"visit_to": "Visita a",
|
||||
"about_country": "Sobre o país",
|
||||
"about_region": "Sobre a região",
|
||||
"cities_available": "Cidades disponíveis",
|
||||
"destination_revealed": "Destino revelado!",
|
||||
"dive_deeper": "Mergulhe mais fundo",
|
||||
"exploration_progress": "Progresso da Exploração",
|
||||
"explore_country": "Explorar o país",
|
||||
"globe_spin_error_desc": "Erro ao buscar dados de rotação do globo",
|
||||
"hide_globe_spin": "Ocultar rotação do globo",
|
||||
"in": "em",
|
||||
"loading_globe_spin": "Carregando Globo Spin",
|
||||
"no_globe_spin_data": "Sem dados de rotação do globo",
|
||||
"show_globe_spin": "Mostrar rotação do globo",
|
||||
"show_less": "Mostrar menos",
|
||||
"show_more": "Mostrar mais",
|
||||
"spin_again": "Gire novamente",
|
||||
"spinning_globe": "Globo giratório",
|
||||
"try_again": "Tente novamente",
|
||||
"your_random_adventure_awaits": "Sua aventura aleatória o aguarda!",
|
||||
"all_locations_visited": "Todos os locais visitados!"
|
||||
},
|
||||
"collections": {
|
||||
|
||||
@@ -1090,7 +1090,6 @@
|
||||
"all_regions": "Toate Regiunile",
|
||||
"available_to_explore": "Disponibil pentru a explora",
|
||||
"cities": "orase",
|
||||
"cities_available": "Orașe disponibile",
|
||||
"cities_in": "Orașe în",
|
||||
"clear_all": "Ștergeți tot",
|
||||
"clear_all_filters": "Ștergeți toate filtrele",
|
||||
@@ -1099,29 +1098,22 @@
|
||||
"countries": "ţări",
|
||||
"country_completed": "Țara finalizată",
|
||||
"country_list": "Lista țărilor",
|
||||
"destination_revealed": "Destinația dezvăluită!",
|
||||
"dive_deeper": "Scufundați mai adânc",
|
||||
"exploration_progress": "Progresul de explorare",
|
||||
"explore_country": "Explorează țara",
|
||||
"failed_to_mark_visit": "Nu s-a marcat vizita la",
|
||||
"failed_to_remove_visit": "Nu s-a putut elimina vizita la",
|
||||
"filter_by": "Filtrați după",
|
||||
"filter_by_region": "Filtrați după regiune",
|
||||
"getting_location_details": "Obținerea detaliilor locației",
|
||||
"globe_spin_error_desc": "Eroare la preluarea datelor de rotație a globului",
|
||||
"hide_globe_spin": "Ascunde Globe Spin",
|
||||
"hide_map": "Ascunde harta",
|
||||
"hide_map_labels": "Ascundeți etichetele hărții",
|
||||
"in": "în",
|
||||
"interactive_map": "Hartă interactivă",
|
||||
"loading_globe_spin": "Se încarcă Globe Spin",
|
||||
"marked_visited": "marcat ca vizitat",
|
||||
"no_cities_found": "Nu s-au găsit orașe",
|
||||
"no_countries_found": "Nu au fost găsite țări",
|
||||
"no_countries_found_desc": "Încercați să ajustați termenii sau filtrele de căutare pentru a găsi țările pe care le căutați.",
|
||||
"no_country_data_available": "Nu sunt disponibile date despre țară",
|
||||
"no_country_data_available_desc": "Vă rugăm să verificați documentația pentru actualizarea datelor din regiune.",
|
||||
"no_globe_spin_data": "Fără date de rotație a globului",
|
||||
"no_regions_found": "Nu au fost găsite regiuni",
|
||||
"of": "de",
|
||||
"partial": "Parţial",
|
||||
@@ -1132,20 +1124,16 @@
|
||||
"regions_in": "Regiunile din",
|
||||
"remaining": "Rămânând",
|
||||
"removed": "îndepărtat",
|
||||
"show_globe_spin": "Arată Globe Spin",
|
||||
"show_less": "Arată mai puțin",
|
||||
"show_map": "Afișați harta",
|
||||
"show_map_labels": "Afișați etichetele hărții",
|
||||
"show_more": "Arată mai mult",
|
||||
"spin_again": "Învârte din nou",
|
||||
"spinning_globe": "Globul care se învârte",
|
||||
"total_cities": "Total orașe",
|
||||
"total_countries": "Total Țări",
|
||||
"total_regions": "Total regiuni",
|
||||
"try_again": "Încearcă din nou",
|
||||
"view_cities": "Vedeți orașele",
|
||||
"visit_remove_failed": "Nu s-a eliminat vizita",
|
||||
"visit_to": "Vizită la",
|
||||
"your_random_adventure_awaits": "Aventura ta aleatorie vă așteaptă!"
|
||||
"visit_to": "Vizită la"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -544,21 +544,9 @@
|
||||
"total_countries": "Всего стран",
|
||||
"total_regions": "Всего регионов",
|
||||
"getting_location_details": "Получение деталей локации",
|
||||
"cities_available": "Города доступны",
|
||||
"destination_revealed": "Открыто место!",
|
||||
"dive_deeper": "Погрузитесь глубже",
|
||||
"exploration_progress": "Прогресс исследования",
|
||||
"explore_country": "Исследуйте страну",
|
||||
"globe_spin_error_desc": "Ошибка извлечения данных спиновых глобусов",
|
||||
"hide_globe_spin": "Скрыть глобус спин",
|
||||
"in": "в",
|
||||
"loading_globe_spin": "Загрузка глобуса спина",
|
||||
"no_globe_spin_data": "Нет данных о вращении Globe",
|
||||
"show_globe_spin": "Показать Globe Spin",
|
||||
"spin_again": "Снова спите",
|
||||
"spinning_globe": "Вращающийся глобус",
|
||||
"try_again": "Попробуйте еще раз",
|
||||
"your_random_adventure_awaits": "Ваше случайное приключение ждет!",
|
||||
"about_country": "О стране",
|
||||
"about_region": "О регионе",
|
||||
"show_less": "Показать меньше",
|
||||
|
||||
@@ -544,20 +544,8 @@
|
||||
"total_cities": "Celkový počet miest",
|
||||
"region_completed": "Región dokončený",
|
||||
"getting_location_details": "Získavajú sa detaily miesta",
|
||||
"cities_available": "Mestá k dispozícii",
|
||||
"destination_revealed": "Destinácia odhalená!",
|
||||
"dive_deeper": "Ponorte sa hlbšie",
|
||||
"exploration_progress": "Pokrok v preskúmavaní",
|
||||
"explore_country": "Preskúmať krajinu",
|
||||
"globe_spin_error_desc": "Chyba načítania náhodnej destinácie",
|
||||
"loading_globe_spin": "Načítavanie náhodnej destinácie",
|
||||
"no_globe_spin_data": "Žiadne údaje náhodnej destinácie",
|
||||
"show_globe_spin": "Zobraziť náhodnú destináciu",
|
||||
"spin_again": "Iná náhodná destinácia",
|
||||
"spinning_globe": "Glóbus sa točí",
|
||||
"try_again": "Skúsiť znova",
|
||||
"your_random_adventure_awaits": "Čaká vaše náhodné dobrodružstvo!",
|
||||
"hide_globe_spin": "Skryť náhodnú destináciu",
|
||||
"in": "v",
|
||||
"about_country": "O krajine",
|
||||
"about_region": "O regióne",
|
||||
|
||||
@@ -544,21 +544,9 @@
|
||||
"total_countries": "Totala länder",
|
||||
"total_regions": "Totala regioner",
|
||||
"getting_location_details": "Få platsinformation",
|
||||
"cities_available": "Städer tillgängliga",
|
||||
"destination_revealed": "Destination avslöjad!",
|
||||
"dive_deeper": "Dyk djupare",
|
||||
"exploration_progress": "Undersökningens framsteg",
|
||||
"explore_country": "Utforska land",
|
||||
"globe_spin_error_desc": "Fel som hämtar Globe Spin Data",
|
||||
"hide_globe_spin": "Dölj jordklot",
|
||||
"in": "i",
|
||||
"loading_globe_spin": "Loading Globe Spin",
|
||||
"no_globe_spin_data": "Inga Globe Spin -data",
|
||||
"show_globe_spin": "Show Globe Spin",
|
||||
"spin_again": "Snurra igen",
|
||||
"spinning_globe": "Snurrande jordklot",
|
||||
"try_again": "Försök igen",
|
||||
"your_random_adventure_awaits": "Ditt slumpmässiga äventyr väntar!",
|
||||
"about_country": "Om Country",
|
||||
"about_region": "Om regionen",
|
||||
"show_less": "Visa mindre",
|
||||
|
||||
@@ -544,21 +544,9 @@
|
||||
"total_cities": "Toplam Şehir",
|
||||
"region_completed": "Bölge Tamamlandı",
|
||||
"getting_location_details": "Konum detayları alınıyor",
|
||||
"hide_globe_spin": "Küre Dönüşünü Gizle",
|
||||
"show_globe_spin": "Küre Dönüşünü Göster",
|
||||
"loading_globe_spin": "Küre Dönüşü Yükleniyor",
|
||||
"spinning_globe": "Dönen Küre",
|
||||
"destination_revealed": "Hedef Keşfedildi!",
|
||||
"your_random_adventure_awaits": "Rastgele Maceran Seni Bekliyor!",
|
||||
"exploration_progress": "Keşif İlerlemesi",
|
||||
"dive_deeper": "Daha Fazlasını Keşfet",
|
||||
"cities_available": "Mevcut Şehirler",
|
||||
"in": "içinde",
|
||||
"explore_country": "Ülkeyi Keşfet",
|
||||
"spin_again": "Tekrar Döndür",
|
||||
"globe_spin_error_desc": "Küre dönüşü verisi alınamadı",
|
||||
"try_again": "Tekrar Deneyin",
|
||||
"no_globe_spin_data": "Küre Dönüşü Verisi Yok",
|
||||
"about_country": "Ülke Hakkında",
|
||||
"about_region": "Bölge Hakkında",
|
||||
"show_less": "Daha Az Göster",
|
||||
|
||||
@@ -1011,7 +1011,6 @@
|
||||
"all_regions": "Всі регіони",
|
||||
"available_to_explore": "Доступний для дослідження",
|
||||
"cities": "міст",
|
||||
"cities_available": "Доступні міста",
|
||||
"cities_in": "Міста в",
|
||||
"clear_all": "Очистити все",
|
||||
"clear_all_filters": "Очистити всі фільтри",
|
||||
@@ -1020,29 +1019,22 @@
|
||||
"countries": "країни",
|
||||
"country_completed": "Країна завершена",
|
||||
"country_list": "Список країн",
|
||||
"destination_revealed": "Пункт призначення відомий!",
|
||||
"dive_deeper": "Пірни глибше",
|
||||
"exploration_progress": "Хід розвідки",
|
||||
"explore_country": "Досліджуйте країну",
|
||||
"failed_to_mark_visit": "Не вдалося позначити відвідування",
|
||||
"failed_to_remove_visit": "Не вдалося видалити відвідування",
|
||||
"filter_by": "Фільтрувати за",
|
||||
"filter_by_region": "Фільтрувати за регіоном",
|
||||
"getting_location_details": "Отримання інформації про місцезнаходження",
|
||||
"globe_spin_error_desc": "Помилка отримання даних обертання глобуса",
|
||||
"hide_globe_spin": "Приховати обертання глобуса",
|
||||
"hide_map": "Приховати карту",
|
||||
"hide_map_labels": "Приховати мітки на карті",
|
||||
"in": "в",
|
||||
"interactive_map": "Інтерактивна карта",
|
||||
"loading_globe_spin": "Обертання глобуса завантаження",
|
||||
"marked_visited": "позначено як відвідане",
|
||||
"no_cities_found": "Міста не знайдено",
|
||||
"no_countries_found": "Країни не знайдено",
|
||||
"no_countries_found_desc": "Спробуйте налаштувати пошукові терміни або фільтри, щоб знайти країни, які ви шукаєте.",
|
||||
"no_country_data_available": "Немає даних по країні",
|
||||
"no_country_data_available_desc": "Будь ласка, перевірте документацію щодо оновлення даних регіону.",
|
||||
"no_globe_spin_data": "Немає даних обертання глобуса",
|
||||
"no_regions_found": "Регіонів не знайдено",
|
||||
"of": "з",
|
||||
"partial": "Частковий",
|
||||
@@ -1053,12 +1045,9 @@
|
||||
"regions_in": "Регіони в",
|
||||
"remaining": "Залишилося",
|
||||
"removed": "видалено",
|
||||
"show_globe_spin": "Показати обертання глобуса",
|
||||
"show_less": "Показати менше",
|
||||
"show_map": "Показати карту",
|
||||
"show_map_labels": "Показати мітки на карті",
|
||||
"spin_again": "Знову обертання",
|
||||
"spinning_globe": "Обертовий глобус",
|
||||
"total_cities": "Всього міст",
|
||||
"total_countries": "Всього країн",
|
||||
"total_regions": "Всього регіонів",
|
||||
@@ -1066,7 +1055,6 @@
|
||||
"view_cities": "Переглянути міста",
|
||||
"visit_remove_failed": "Не вдалося видалити відвідування",
|
||||
"visit_to": "Візит до",
|
||||
"your_random_adventure_awaits": "Ваша випадкова пригода чекає!",
|
||||
"show_more": "Показати Більше",
|
||||
"all_locations_visited": "Всі відвідані локації!"
|
||||
},
|
||||
|
||||
@@ -570,21 +570,9 @@
|
||||
"total_cities": "总城市",
|
||||
"total_countries": "总国家",
|
||||
"getting_location_details": "获取地点详细信息",
|
||||
"cities_available": "可用的城市",
|
||||
"destination_revealed": "目的地揭示了!",
|
||||
"dive_deeper": "深入潜水",
|
||||
"exploration_progress": "勘探进度",
|
||||
"explore_country": "探索国家",
|
||||
"globe_spin_error_desc": "错误获取地球旋转数据",
|
||||
"hide_globe_spin": "隐藏环球旋转",
|
||||
"in": "在",
|
||||
"loading_globe_spin": "加载地球旋转",
|
||||
"no_globe_spin_data": "没有地球旋转数据",
|
||||
"show_globe_spin": "显示环球旋转",
|
||||
"spin_again": "再次旋转",
|
||||
"spinning_globe": "旋转地球",
|
||||
"try_again": "再试一次",
|
||||
"your_random_adventure_awaits": "您的随机冒险在等待!",
|
||||
"about_country": "关于国家",
|
||||
"about_region": "关于地区",
|
||||
"show_less": "显示较少",
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
const allCountries: Country[] = data.props?.countries || [];
|
||||
let worldSubregions: string[] = [];
|
||||
let showMap: boolean = false;
|
||||
let showGlobeSpin: boolean = false;
|
||||
let sidebarOpen = false;
|
||||
|
||||
type VisitStatus = 'not_visited' | 'partial' | 'complete';
|
||||
@@ -223,39 +222,6 @@
|
||||
.filter((feature): feature is CountryFeature => feature !== null)
|
||||
};
|
||||
|
||||
// when isGlobeSpin is enabled, fetch /api/globespin/
|
||||
type GlobeSpinData = {
|
||||
country: {
|
||||
flag_url: string;
|
||||
name: string;
|
||||
country_code: string;
|
||||
num_visits: number;
|
||||
subregion: string;
|
||||
capital: string;
|
||||
num_regions: number;
|
||||
};
|
||||
region: { name: string; num_cities: number };
|
||||
city: { name: string; region_name: string };
|
||||
};
|
||||
let globeSpinData: GlobeSpinData | null = null;
|
||||
let isLoadingGlobeSpin = false;
|
||||
|
||||
async function fetchGlobeSpin() {
|
||||
isLoadingGlobeSpin = true;
|
||||
try {
|
||||
const response = await fetch('/api/globespin/');
|
||||
if (response.ok) {
|
||||
globeSpinData = await response.json();
|
||||
} else {
|
||||
console.error('Failed to fetch globe spin data');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error fetching globe spin data:', error);
|
||||
} finally {
|
||||
isLoadingGlobeSpin = false;
|
||||
}
|
||||
}
|
||||
|
||||
function toggleSidebar() {
|
||||
sidebarOpen = !sidebarOpen;
|
||||
}
|
||||
@@ -350,25 +316,7 @@
|
||||
<span class="hidden sm:inline">{$t('worldtravel.hide_map')}</span>
|
||||
{:else}
|
||||
<Map class="w-4 h-4" />
|
||||
<span class="hidden sm:inline">{$t('worldtravel.show_map')}</span>
|
||||
{/if}
|
||||
</button>
|
||||
<!-- Globe Spin Toggle -->
|
||||
<button
|
||||
class="btn btn-outline gap-2 {showGlobeSpin ? 'btn-active' : ''}"
|
||||
on:click={() => {
|
||||
showGlobeSpin = !showGlobeSpin;
|
||||
if (showGlobeSpin) {
|
||||
fetchGlobeSpin();
|
||||
}
|
||||
}}
|
||||
>
|
||||
{#if showGlobeSpin}
|
||||
<Globe class="w-4 h-4" />
|
||||
<span class="hidden sm:inline">{$t('worldtravel.hide_globe_spin')}</span>
|
||||
{:else}
|
||||
<Globe class="w-4 h-4" />
|
||||
<span class="hidden sm:inline">{$t('worldtravel.show_globe_spin')}</span>
|
||||
<span class="hidden sm:inline">{$t('worldtravel.show_map')}</span>
|
||||
{/if}
|
||||
</button>
|
||||
</div>
|
||||
@@ -449,257 +397,6 @@
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Globe Spin Section -->
|
||||
{#if showGlobeSpin}
|
||||
<div class="container mx-auto px-6 py-4">
|
||||
<div class="card bg-base-100 shadow-xl overflow-hidden">
|
||||
<div class="card-body p-6">
|
||||
{#if isLoadingGlobeSpin}
|
||||
<!-- Loading State with Spinning Globe -->
|
||||
<div class="flex flex-col items-center py-12">
|
||||
<div class="relative">
|
||||
<!-- Spinning globe with pulse effect -->
|
||||
<div class="relative animate-spin" style="animation-duration: 3s;">
|
||||
<div
|
||||
class="w-24 h-24 rounded-full bg-gradient-to-br from-primary/20 to-accent/30 flex items-center justify-center border-4 border-primary/30"
|
||||
>
|
||||
<Globe class="w-12 h-12 text-primary" />
|
||||
</div>
|
||||
<!-- Orbit rings -->
|
||||
<div
|
||||
class="absolute inset-0 rounded-full border-2 border-dashed border-primary/20 animate-pulse"
|
||||
></div>
|
||||
<div
|
||||
class="absolute -inset-2 rounded-full border border-dashed border-accent/20 animate-pulse"
|
||||
style="animation-delay: 0.5s;"
|
||||
></div>
|
||||
</div>
|
||||
<!-- Sparkle effects -->
|
||||
<div
|
||||
class="absolute -top-2 -right-2 w-3 h-3 bg-yellow-400 rounded-full animate-ping"
|
||||
></div>
|
||||
<div
|
||||
class="absolute -bottom-3 -left-3 w-2 h-2 bg-blue-400 rounded-full animate-ping"
|
||||
style="animation-delay: 1s;"
|
||||
></div>
|
||||
<div
|
||||
class="absolute top-1/2 -right-4 w-1.5 h-1.5 bg-green-400 rounded-full animate-ping"
|
||||
style="animation-delay: 2s;"
|
||||
></div>
|
||||
</div>
|
||||
<div class="mt-6 text-center">
|
||||
<h3 class="text-xl font-bold text-primary mb-2">
|
||||
{$t('worldtravel.spinning_globe') + '...'}
|
||||
</h3>
|
||||
<p class="text-base-content/70 animate-pulse">
|
||||
{$t('worldtravel.loading_globe_spin')}
|
||||
</p>
|
||||
<div class="flex items-center justify-center gap-1 mt-3">
|
||||
<div class="w-2 h-2 bg-primary rounded-full animate-bounce"></div>
|
||||
<div
|
||||
class="w-2 h-2 bg-primary rounded-full animate-bounce"
|
||||
style="animation-delay: 0.2s;"
|
||||
></div>
|
||||
<div
|
||||
class="w-2 h-2 bg-primary rounded-full animate-bounce"
|
||||
style="animation-delay: 0.4s;"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{:else if globeSpinData}
|
||||
<!-- Result Display with Amazing Animations -->
|
||||
<div class="text-center">
|
||||
<div class="mb-6">
|
||||
<h3
|
||||
class="text-2xl font-bold text-primary mb-2 flex items-center justify-center gap-3"
|
||||
>
|
||||
<Globe class="w-8 h-8 animate-spin" style="animation-duration: 4s;" />
|
||||
{$t('worldtravel.destination_revealed')}
|
||||
<Globe
|
||||
class="w-8 h-8 animate-spin"
|
||||
style="animation-duration: 4s; animation-direction: reverse;"
|
||||
/>
|
||||
</h3>
|
||||
<p class="text-base-content/60">
|
||||
{$t('worldtravel.your_random_adventure_awaits')}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Country Card with Entrance Animation -->
|
||||
<div class="animate-slideInUp" style="animation-duration: 0.8s;">
|
||||
<!-- Flag with Reveal Effect -->
|
||||
<div class="relative mb-6 mx-auto w-fit">
|
||||
<div
|
||||
class="relative overflow-hidden rounded-2xl shadow-2xl border-4 border-primary/20 hover:border-primary/40 transition-colors duration-300"
|
||||
>
|
||||
<img
|
||||
src={globeSpinData.country.flag_url}
|
||||
alt="{globeSpinData.country.name} flag"
|
||||
class="w-64 h-40 object-cover hover:scale-105 transition-transform duration-500"
|
||||
/>
|
||||
<!-- Shimmer overlay -->
|
||||
<div
|
||||
class="absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full animate-shimmer"
|
||||
></div>
|
||||
</div>
|
||||
<!-- Floating badges -->
|
||||
<div
|
||||
class="absolute -top-3 -right-3 badge badge-primary badge-lg animate-bounce shadow-lg"
|
||||
>
|
||||
{globeSpinData.country.country_code}
|
||||
</div>
|
||||
{#if globeSpinData.country.num_visits > 0}
|
||||
<div
|
||||
class="absolute -top-3 -left-3 badge badge-success badge-lg animate-pulse shadow-lg"
|
||||
>
|
||||
<Check class="w-4 h-4 mr-1" />
|
||||
{$t('adventures.visited')}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<!-- Country Info -->
|
||||
<div class="space-y-4 animate-fadeInUp" style="animation-delay: 0.2s;">
|
||||
<h2
|
||||
class="text-4xl font-bold text-primary bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent pb-2"
|
||||
>
|
||||
{globeSpinData.country.name}
|
||||
</h2>
|
||||
|
||||
<div class="flex flex-wrap justify-center gap-4">
|
||||
<div class="badge badge-lg badge-outline gap-2">
|
||||
<Pin class="w-4 h-4" />
|
||||
{globeSpinData.country.subregion}
|
||||
</div>
|
||||
{#if globeSpinData.country.capital}
|
||||
<div class="badge badge-lg badge-outline gap-2">
|
||||
<Globe class="w-4 h-4" />
|
||||
{globeSpinData.country.capital}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<!-- Progress Info -->
|
||||
<div
|
||||
class="card bg-gradient-to-br from-base-200/50 to-base-300/30 p-4 max-w-md mx-auto"
|
||||
>
|
||||
<div class="flex justify-between items-center mb-2">
|
||||
<span class="text-sm font-medium"
|
||||
>{$t('worldtravel.exploration_progress')}</span
|
||||
>
|
||||
<span class="text-lg font-bold text-primary">
|
||||
{globeSpinData.country.num_visits}/{globeSpinData.country.num_regions}
|
||||
</span>
|
||||
</div>
|
||||
<progress
|
||||
class="progress progress-primary w-full"
|
||||
value={globeSpinData.country.num_visits}
|
||||
max={globeSpinData.country.num_regions}
|
||||
></progress>
|
||||
<div class="text-xs text-base-content/60 mt-1">
|
||||
{Math.round(
|
||||
(globeSpinData.country.num_visits / globeSpinData.country.num_regions) *
|
||||
100
|
||||
)}% explored
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Region & City Info (if available) -->
|
||||
{#if globeSpinData.region || globeSpinData.city}
|
||||
<div class="mt-8 space-y-4 animate-fadeInUp" style="animation-delay: 0.4s;">
|
||||
<div class="divider">
|
||||
<span class="text-primary font-semibold"
|
||||
>{$t('worldtravel.dive_deeper')}</span
|
||||
>
|
||||
</div>
|
||||
|
||||
<div class="grid md:grid-cols-2 gap-4 max-w-2xl mx-auto">
|
||||
{#if globeSpinData.region}
|
||||
<div
|
||||
class="card bg-gradient-to-br from-accent/10 to-secondary/10 border border-accent/20"
|
||||
>
|
||||
<div class="card-body p-4">
|
||||
<h4 class="font-bold text-accent flex items-center gap-2">
|
||||
<Pin class="w-5 h-5" />
|
||||
{$t('adventures.region')}
|
||||
</h4>
|
||||
<p class="text-lg font-semibold">{globeSpinData.region.name}</p>
|
||||
<p class="text-sm text-base-content/60">
|
||||
{globeSpinData.region.num_cities}
|
||||
{$t('worldtravel.cities_available')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if globeSpinData.city}
|
||||
<div
|
||||
class="card bg-gradient-to-br from-success/10 to-info/10 border border-success/20"
|
||||
>
|
||||
<div class="card-body p-4">
|
||||
<h4 class="font-bold text-success flex items-center gap-2">
|
||||
<Map class="w-5 h-5" />
|
||||
{$t('adventures.city')}
|
||||
</h4>
|
||||
<p class="text-lg font-semibold">{globeSpinData.city.name}</p>
|
||||
<p class="text-sm text-base-content/60">
|
||||
{$t('worldtravel.in')}
|
||||
{globeSpinData.city.region_name}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Action Buttons -->
|
||||
<div
|
||||
class="mt-8 flex flex-wrap justify-center gap-4 animate-fadeInUp"
|
||||
style="animation-delay: 0.6s;"
|
||||
>
|
||||
<a
|
||||
href="/worldtravel/{globeSpinData.country.country_code}"
|
||||
class="btn btn-primary btn-lg gap-2 shadow-lg hover:shadow-xl transition-all duration-300 hover:scale-105"
|
||||
>
|
||||
<Globe class="w-5 h-5" />
|
||||
{$t('worldtravel.explore_country')}
|
||||
</a>
|
||||
<button
|
||||
class="btn btn-outline btn-lg gap-2 hover:scale-105 transition-all duration-300"
|
||||
on:click={fetchGlobeSpin}
|
||||
>
|
||||
<Globe class="w-5 h-5 animate-spin" style="animation-duration: 2s;" />
|
||||
{$t('worldtravel.spin_again')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
<!-- No Data State -->
|
||||
<div class="flex flex-col items-center py-12">
|
||||
<div class="p-6 bg-error/10 rounded-2xl mb-6">
|
||||
<Cancel class="w-16 h-16 text-error/50" />
|
||||
</div>
|
||||
<h3 class="text-xl font-semibold text-base-content/70 mb-2">
|
||||
{$t('worldtravel.no_globe_spin_data')}
|
||||
</h3>
|
||||
<p class="text-base-content/50 text-center max-w-md mb-6">
|
||||
{$t('worldtravel.globe_spin_error_desc')}
|
||||
</p>
|
||||
<button class="btn btn-primary gap-2" on:click={fetchGlobeSpin}>
|
||||
<Globe class="w-4 h-4" />
|
||||
{$t('worldtravel.try_again')}
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Main Content -->
|
||||
<div class="container mx-auto px-6 py-8">
|
||||
{#if filteredCountries.length === 0}
|
||||
@@ -870,48 +567,3 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
@keyframes slideInUp {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(30px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fadeInUp {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(20px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes shimmer {
|
||||
0% {
|
||||
transform: translateX(-100%);
|
||||
}
|
||||
100% {
|
||||
transform: translateX(100%);
|
||||
}
|
||||
}
|
||||
|
||||
.animate-slideInUp {
|
||||
animation: slideInUp ease-out forwards;
|
||||
}
|
||||
|
||||
.animate-fadeInUp {
|
||||
animation: fadeInUp ease-out forwards;
|
||||
}
|
||||
|
||||
.animate-shimmer {
|
||||
animation: shimmer 2s infinite;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user