mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-30 16:33:16 +00:00
feat(atlas): the globe Atlas with its hub, on desktop and phone
The Atlas page is now the globe. Everything the classic map offered carries over: visited countries and regions, planned countries, the wishlist with places and target dates, Dawarich, tours, plugin layers and the place search. New: - regions on the globe, with how much of a country has been seen (#2675, #316, #487) - flight arcs (#1369, #2642) - a hub with statistics, badges, wishlist, Dawarich, tours and travellers - an instance ranking, traveller profiles and a compare overlay - a timeline that plays back how the map grew - phone layouts of their own: sheets, chips and swipe actions The classic Leaflet Atlas and its phone screen are removed.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import type { ComponentType } from 'react'
|
||||
import { useTranslation } from '../../i18n'
|
||||
import { Puzzle, ListChecks, Wallet, FileText, CalendarDays, Globe, Briefcase, Image, Terminal, Link2, Compass, BookOpen, Sparkles, Luggage, Plane, Bookmark, Users, Loader2, Mountain, CarFront, Radar } from 'lucide-react'
|
||||
import { Puzzle, ListChecks, Wallet, FileText, CalendarDays, Globe, Briefcase, Image, Terminal, Link2, Compass, BookOpen, Sparkles, Luggage, Plane, Bookmark, Users, Loader2, Mountain, CarFront, Radar, Trophy } from 'lucide-react'
|
||||
import EmptyState from '../shared/EmptyState'
|
||||
import DawarichIcon from '../shared/DawarichIcon'
|
||||
import AirTrailIcon from '../shared/AirTrailIcon'
|
||||
@@ -94,6 +94,8 @@ export default function AddonManager({ bagTrackingEnabled, onToggleBagTracking,
|
||||
wandererOffered,
|
||||
toggleToursWanderer,
|
||||
mapSwitches,
|
||||
atlasCompare,
|
||||
toggleAtlasCompare,
|
||||
} = useAddonManager()
|
||||
if (loading) {
|
||||
return (
|
||||
@@ -109,6 +111,17 @@ export default function AddonManager({ bagTrackingEnabled, onToggleBagTracking,
|
||||
* parent as shelf rows, and each shelf only shows while its parent is on —
|
||||
* a provider toggled under a disabled Journey would hit the server's 409. */
|
||||
const shelfFor = (addon: Addon) => {
|
||||
if (addon.id === 'atlas' && addon.enabled) {
|
||||
return (
|
||||
<AddonSubRow
|
||||
icon={<Trophy size={14} />}
|
||||
title={t('admin.atlasCompare.title')}
|
||||
description={t('admin.atlasCompare.subtitle')}
|
||||
enabled={atlasCompare}
|
||||
onToggle={() => void toggleAtlasCompare()}
|
||||
/>
|
||||
)
|
||||
}
|
||||
if (addon.id === 'packing' && addon.enabled && onToggleBagTracking) {
|
||||
return (
|
||||
<AddonSubRow
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { AdminFeatureToggleResponse } from '@trek/shared';
|
||||
import { Bike, Footprints, MountainSnow } from 'lucide-react';
|
||||
import { useEffect, useEffectEvent, useState } from 'react';
|
||||
|
||||
import { adminApi } from '../../../api/client';
|
||||
import { adminApi, authApi } from '../../../api/client';
|
||||
import { cycleMapAdminApi, hikingMapAdminApi, skiRoutingAdminApi } from '../../../api/tourBaseMaps';
|
||||
import { wandererAdminApi } from '../../../api/wanderer';
|
||||
import { useTranslation } from '../../../i18n';
|
||||
@@ -43,6 +43,9 @@ export function useAddonManager() {
|
||||
const [toursHikingMap, setToursHikingMap] = useState(false);
|
||||
const [toursCycleMap, setToursCycleMap] = useState(false);
|
||||
const [toursSkiRouting, setToursSkiRouting] = useState(false);
|
||||
// The Atlas ranking switch is an app setting the app config already carries.
|
||||
const atlasCompare = useAuthStore((s) => s.atlasCompareEnabled);
|
||||
const setAtlasCompare = useAuthStore((s) => s.setAtlasCompareEnabled);
|
||||
|
||||
const loadAddons = async () => {
|
||||
try {
|
||||
@@ -105,6 +108,11 @@ export function useAddonManager() {
|
||||
void refreshGlobalAddons();
|
||||
toast.success(t('admin.addons.toast.updated'));
|
||||
};
|
||||
/** Whether travellers on this instance see the Atlas ranking and each other's profiles. */
|
||||
const toggleAtlasCompare = () =>
|
||||
flipToursSwitch(atlasCompare, setAtlasCompare, (enabled) =>
|
||||
authApi.updateAppSettings({ atlas_compare_enabled: enabled })
|
||||
);
|
||||
const toggleToursWanderer = () => flipToursSwitch(toursWanderer, setToursWanderer, wandererAdminApi.update);
|
||||
/** The maps and the piste router Tours offers on their operators' terms, one switch each (MAP-01, BIK-06, SKI-02). */
|
||||
const mapSwitches = [
|
||||
@@ -167,5 +175,7 @@ export function useAddonManager() {
|
||||
wandererOffered,
|
||||
toggleToursWanderer,
|
||||
mapSwitches,
|
||||
atlasCompare,
|
||||
toggleAtlasCompare,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user