mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-28 23:50:08 +00:00
fix(atlas): clear the client gates of the globe Atlas
Client lint, checks and tests were red on the globe Atlas: - The views own the globe and sky refs and hand them into useAtlasGlobe, so reading its state while rendering no longer counts as reading refs. - Helpers that shared a file with components move to their own modules (badge tiers, medal label, Dawarich notes, hub tabs, period label). - The place search derives its loading state, the search resets its active row on input, and the two silenced hook dependencies are named. - placeLabels, the hover chip and the overview figures are split up. - Raw text sizes become type tiers, the badge unlock docks on --z-overlay. - The stats card test follows the GlobeStat props; baselines lowered to the counts the run reported.
This commit is contained in:
@@ -1,24 +1,24 @@
|
||||
{
|
||||
"src": {
|
||||
"@typescript-eslint/no-non-null-assertion": 354,
|
||||
"@typescript-eslint/no-misused-promises": 820,
|
||||
"no-console": 88,
|
||||
"@typescript-eslint/no-non-null-assertion": 345,
|
||||
"@typescript-eslint/no-misused-promises": 812,
|
||||
"no-console": 85,
|
||||
"complexity": 216,
|
||||
"@typescript-eslint/no-explicit-any": 138,
|
||||
"trek/no-swallowed-catch": 126,
|
||||
"@typescript-eslint/no-explicit-any": 114,
|
||||
"trek/no-swallowed-catch": 124,
|
||||
"max-params": 31,
|
||||
"trek/store-without-selector": 66,
|
||||
"trek/store-without-selector": 65,
|
||||
"react-hooks/refs": 533,
|
||||
"react-hooks/set-state-in-effect": 189,
|
||||
"@typescript-eslint/no-floating-promises": 162,
|
||||
"react-hooks/exhaustive-deps": 113,
|
||||
"@typescript-eslint/no-unused-vars": 116,
|
||||
"react-hooks/immutability": 28,
|
||||
"max-lines-per-function": 127,
|
||||
"@typescript-eslint/no-unused-vars": 101,
|
||||
"react-hooks/immutability": 26,
|
||||
"max-lines-per-function": 126,
|
||||
"react-hooks/static-components": 38,
|
||||
"react-hooks/preserve-manual-memoization": 12,
|
||||
"no-useless-assignment": 7,
|
||||
"no-empty": 19,
|
||||
"no-empty": 18,
|
||||
"trek/no-window-globals": 41,
|
||||
"react-refresh/only-export-components": 44,
|
||||
"unused-disable-directive": 5,
|
||||
@@ -34,18 +34,17 @@
|
||||
"react-hooks/exhaustive-deps": 44
|
||||
},
|
||||
"tests": {
|
||||
"@typescript-eslint/no-explicit-any": 489,
|
||||
"@typescript-eslint/no-non-null-assertion": 1872,
|
||||
"@typescript-eslint/no-explicit-any": 484,
|
||||
"@typescript-eslint/no-non-null-assertion": 1849,
|
||||
"@typescript-eslint/no-misused-promises": 22,
|
||||
"@typescript-eslint/no-unused-vars": 51,
|
||||
"@typescript-eslint/no-unused-vars": 48,
|
||||
"@typescript-eslint/no-floating-promises": 33,
|
||||
"trek/no-window-globals": 325,
|
||||
"trek/no-swallowed-catch": 14,
|
||||
"react-hooks/globals": 5,
|
||||
"react-hooks/refs": 22,
|
||||
"trek/no-window-globals": 321,
|
||||
"trek/no-swallowed-catch": 6,
|
||||
"react-hooks/globals": 4,
|
||||
"react-hooks/refs": 16,
|
||||
"@typescript-eslint/no-this-alias": 1,
|
||||
"trek/store-without-selector": 3,
|
||||
"@typescript-eslint/no-unsafe-function-type": 2,
|
||||
"no-console": 2,
|
||||
"react-refresh/only-export-components": 1
|
||||
}
|
||||
|
||||
@@ -82,7 +82,6 @@
|
||||
"mobile/screens/trip/map/MMapArea.tsx": 3,
|
||||
"mobile/screens/trip/tabs/MFileLightbox.tsx": 2,
|
||||
"mobile/screens/vacay/MVacayMonth.tsx": 1,
|
||||
"pages/AtlasPage.tsx": 2,
|
||||
"pages/JourneyDetailPage.tsx": 1,
|
||||
"pages/JourneyPublicPage.tsx": 3,
|
||||
"pages/LoginPage.tsx": 23,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"components/AtlasGlobe/atlasGlobe.css": 1,
|
||||
"components/Collections/CollectionMap.tsx": 1,
|
||||
"components/Packing/PackingItemDetail.tsx": 1,
|
||||
"components/Studio/LineHandles.tsx": 1,
|
||||
@@ -8,5 +9,6 @@
|
||||
"mobile/screens/trip/MTripShell.tsx": 1,
|
||||
"mobile/screens/vacay/MVacay.tsx": 1,
|
||||
"pages/CollectionsPage.tsx": 1,
|
||||
"pages/atlas/AtlasGlobeView.tsx": 1,
|
||||
"pages/tripPlanner/PlanMapStage.tsx": 4
|
||||
}
|
||||
|
||||
@@ -162,9 +162,8 @@
|
||||
"mobile/screens/admin/MAdminUi.tsx": 7,
|
||||
"mobile/screens/admin/MAdminUsersSection.tsx": 13,
|
||||
"mobile/screens/admin/MApiProviderBlocks.tsx": 10,
|
||||
"mobile/screens/atlas/MAtlas.tsx": 5,
|
||||
"mobile/screens/atlas/MAtlasCountryPopup.tsx": 11,
|
||||
"mobile/screens/atlas/MAtlasStatsCard.tsx": 3,
|
||||
"mobile/screens/atlas/MAtlasStatsCard.tsx": 2,
|
||||
"mobile/screens/collections/MCollAddSheet.tsx": 6,
|
||||
"mobile/screens/collections/MCollCategoryPicker.tsx": 2,
|
||||
"mobile/screens/collections/MCollEditSheet.tsx": 2,
|
||||
@@ -279,7 +278,6 @@
|
||||
"mobile/screens/vacay/MVacaySettingsSheet.tsx": 34,
|
||||
"mobile/screens/vacay/MVacayShareSheet.tsx": 10,
|
||||
"mobile/screens/vacay/vacayDayModel.ts": 1,
|
||||
"pages/AtlasPage.tsx": 32,
|
||||
"pages/DashboardPage.tsx": 1,
|
||||
"pages/FilesPage.tsx": 11,
|
||||
"pages/ForgotPasswordPage.tsx": 18,
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
"components/Admin/GitHubPanel.tsx": 3,
|
||||
"components/Admin/PluginPoiCategoryList.tsx": 1,
|
||||
"components/Admin/useCategoryAdmin.ts": 1,
|
||||
"components/AtlasGlobe/BadgeMedal.tsx": 2,
|
||||
"components/AtlasGlobe/badgeTiers.ts": 4,
|
||||
"components/Budget/CostsPanel.tsx": 1,
|
||||
"components/Budget/CostsToolbar.tsx": 1,
|
||||
"components/Collab/CollabNotesFilePreviewPortal.tsx": 3,
|
||||
@@ -55,8 +57,8 @@
|
||||
"components/shared/PasswordChecklist.tsx": 2,
|
||||
"mobile/components/MSheet.tsx": 1,
|
||||
"mobile/components/MWalletButton.tsx": 1,
|
||||
"mobile/screens/atlas/MAtlas.tsx": 1,
|
||||
"mobile/screens/atlas/MAtlasCountryPopup.tsx": 2,
|
||||
"mobile/screens/atlas/hub/MHubTravellers.tsx": 1,
|
||||
"mobile/screens/collections/MCollEditSheet.tsx": 2,
|
||||
"mobile/screens/collections/MCollPlaceSheet.tsx": 2,
|
||||
"mobile/screens/collections/MCollShareSheet.tsx": 1,
|
||||
@@ -69,8 +71,11 @@
|
||||
"mobile/screens/trip/roadtrip/MRtKindSheet.tsx": 1,
|
||||
"mobile/screens/trip/roadtrip/MRtStopSheet.tsx": 1,
|
||||
"mobile/screens/trip/sheets/MCostSheet.tsx": 1,
|
||||
"pages/AtlasPage.tsx": 1,
|
||||
"pages/admin/AdminUserModals.tsx": 1,
|
||||
"pages/atlas/AtlasCountryActionDialog.tsx": 1,
|
||||
"pages/atlas/AtlasGlobeView.tsx": 2,
|
||||
"pages/atlas/atlasGlobePaint.ts": 10,
|
||||
"pages/atlas/useAtlasGlobe.ts": 1,
|
||||
"pages/sharedTrip/SharedChrome.tsx": 4,
|
||||
"pages/sharedTrip/SharedMap.tsx": 2
|
||||
}
|
||||
|
||||
@@ -18,18 +18,10 @@ import { Tooltip } from '../../shared/Tooltip';
|
||||
import { FigureBadge } from '../../Tours/paddle/FigureBadge';
|
||||
import { TourDayRowPill } from '../../Tours/TourDayRowFacts';
|
||||
import { tourDayRowIcon } from '../../Tours/tourDayRowIcon';
|
||||
import { typeIcon, typeLabel, type Translate } from './tourActivityReading';
|
||||
import { periodYear, type ActivityPeriod, type ActivityType } from './tourActivityStatsModel';
|
||||
import { periodLabel, typeIcon, typeLabel } from './tourActivityReading';
|
||||
import { type ActivityType } from './tourActivityStatsModel';
|
||||
import type { TourActivityStats } from './useTourActivityStats';
|
||||
|
||||
/** What a period is called in the filter. */
|
||||
export function periodLabel(period: ActivityPeriod, t: Translate): string {
|
||||
if (period === 'all') return t('tours.stats.period.all');
|
||||
if (period === 'thisYear') return t('tours.stats.period.thisYear');
|
||||
if (period === 'last12') return t('tours.stats.period.last12');
|
||||
return String(periodYear(period));
|
||||
}
|
||||
|
||||
/** The period and type filters, as head band pills or quiet ones in a panel. */
|
||||
export function ActivityFilters({ stats, quiet = false }: { stats: TourActivityStats; quiet?: boolean }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useSettingsStore } from '../../../store/settingsStore';
|
||||
import type { DistanceUnit } from '../../../types';
|
||||
import { formatDistance, formatElevation } from '../../../utils/units';
|
||||
import { tourDayRowIcon } from '../../Tours/tourDayRowIcon';
|
||||
import { sumReading, type ActivityType } from './tourActivityStatsModel';
|
||||
import { periodYear, sumReading, type ActivityPeriod, type ActivityType } from './tourActivityStatsModel';
|
||||
|
||||
export type Translate = (key: string, params?: Record<string, unknown>) => string;
|
||||
|
||||
@@ -37,3 +37,11 @@ export function heightReading(sum: TourActivityTotals['ascentM'], unit: Distance
|
||||
export function partialHint(sum: TourActivityTotals['distanceKm'], t: Translate): string {
|
||||
return t('tours.scope.partialBody', { known: sum.known, of: sum.of });
|
||||
}
|
||||
|
||||
/** What a period is called in the filter. */
|
||||
export function periodLabel(period: ActivityPeriod, t: Translate): string {
|
||||
if (period === 'all') return t('tours.stats.period.all');
|
||||
if (period === 'thisYear') return t('tours.stats.period.thisYear');
|
||||
if (period === 'last12') return t('tours.stats.period.last12');
|
||||
return String(periodYear(period));
|
||||
}
|
||||
|
||||
@@ -85,18 +85,20 @@ const AtlasGlobe = forwardRef<AtlasGlobeHandle, AtlasGlobeProps>(function AtlasG
|
||||
};
|
||||
}, []);
|
||||
|
||||
const { dark, paint, paintKey } = props;
|
||||
useEffect(() => {
|
||||
engineRef.current?.setTheme(globeTheme(props.dark));
|
||||
}, [props.dark]);
|
||||
engineRef.current?.setTheme(globeTheme(dark));
|
||||
}, [dark]);
|
||||
|
||||
// paint changes with everything it reads; paintKey also with the regions that
|
||||
// arrived since, which paint reads from the engine.
|
||||
useEffect(() => {
|
||||
const e = engineRef.current;
|
||||
if (e && ready) {
|
||||
props.paint(e);
|
||||
if (e && ready && paintKey !== undefined) {
|
||||
paint(e);
|
||||
e.kick();
|
||||
}
|
||||
// paintKey stands for everything paint() reads.
|
||||
}, [props.paintKey, ready]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
}, [paint, paintKey, ready]);
|
||||
|
||||
useEffect(() => {
|
||||
engineRef.current?.setInsetBottom(props.insetBottom ?? 0);
|
||||
|
||||
@@ -21,6 +21,7 @@ import {
|
||||
type LucideIcon,
|
||||
} from 'lucide-react';
|
||||
import React from 'react';
|
||||
import { TIERS } from './badgeTiers';
|
||||
|
||||
/**
|
||||
* A badge as a hexagonal glass medal: a tinted glass body, a ring in the tier's
|
||||
@@ -29,13 +30,6 @@ import React from 'react';
|
||||
* surfaces, so the colours are literal here.
|
||||
*/
|
||||
|
||||
export const TIERS: Record<BadgeTier, [string, string]> = {
|
||||
bronze: ['#f5b06b', '#a55a1e'], // theme-lint-disable: medal metal
|
||||
silver: ['#eef2f7', '#8a97ab'], // theme-lint-disable: medal metal
|
||||
gold: ['#fde68a', '#c98a0e'], // theme-lint-disable: medal metal
|
||||
aurora: ['#5eead4', '#a78bfa'], // theme-lint-disable: medal metal
|
||||
};
|
||||
|
||||
const HEX = '46,3 89,27 89,77 46,101 3,77 3,27';
|
||||
const INNER = '46,12 80,31 80,73 46,92 12,73 12,31';
|
||||
const INK = '#e0f2fe'; // theme-lint-disable: medal line art
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import React from 'react';
|
||||
import DawarichIcon from '../shared/DawarichIcon';
|
||||
|
||||
/** Dawarich's mark at an icon's size, round like the symbols beside it. */
|
||||
export default function DawarichMark({ size = 16 }: { size?: number }): React.ReactElement {
|
||||
return (
|
||||
<span className="flex flex-none overflow-hidden rounded-full" style={{ width: size + 2, height: size + 2 }}>
|
||||
<DawarichIcon size={size + 2} />
|
||||
</span>
|
||||
);
|
||||
}
|
||||
@@ -53,7 +53,7 @@ html:not(.dark) .ag-bar {
|
||||
|
||||
.atlas-globe-label {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
left: 0; /* rtl-lint-disable: placed by a measured x on the canvas, physical on purpose */
|
||||
top: 0;
|
||||
white-space: nowrap;
|
||||
font-weight: 500;
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
import type { BadgeTier } from '@trek/shared';
|
||||
|
||||
/** The two tones of each tier's metal, light and deep; medal paint, not UI surfaces. */
|
||||
export const TIERS: Record<BadgeTier, [string, string]> = {
|
||||
bronze: ['#f5b06b', '#a55a1e'], // theme-lint-disable: medal metal
|
||||
silver: ['#eef2f7', '#8a97ab'], // theme-lint-disable: medal metal
|
||||
gold: ['#fde68a', '#c98a0e'], // theme-lint-disable: medal metal
|
||||
aurora: ['#5eead4', '#a78bfa'], // theme-lint-disable: medal metal
|
||||
};
|
||||
@@ -51,55 +51,9 @@ export function placeLabels(
|
||||
const minArea = minAreaFor(zoom);
|
||||
const regionA = engine.regionAlpha;
|
||||
|
||||
// From the region label zoom on, every country in view with regions names them,
|
||||
// and its own name gives way (Kansas, not "United States" above it). The
|
||||
// regions nearest the middle of the view come first, the country under the
|
||||
// middle ahead of all; the collision check below keeps it from being a wall.
|
||||
const regionsOn = zoom >= (width < NARROW_WIDTH ? REGION_LABEL_ZOOM_PHONE : REGION_LABEL_ZOOM_WIDE);
|
||||
const focus = regionsOn ? centreCountry(engine) : null;
|
||||
const named = new Set<string>();
|
||||
const cx = width / 2;
|
||||
const cy = height / 2;
|
||||
if (regionsOn) {
|
||||
for (const [a2, idx] of engine.regionIndex) {
|
||||
for (const f of idx.features) {
|
||||
if (!f.anchor) continue;
|
||||
const p = engine.project(f.anchor[0], f.anchor[1]);
|
||||
if (p.visible < 0.1 || p.x < 0 || p.x > width || p.y < 0 || p.y > height) continue;
|
||||
named.add(a2);
|
||||
const near = 1 - Math.min(1, Math.hypot(p.x - cx, p.y - cy) / Math.hypot(cx, cy));
|
||||
cands.push({
|
||||
key: `${a2}:${f.code ?? f.name}`,
|
||||
text: f.nameEn ?? f.name ?? '',
|
||||
x: p.x,
|
||||
y: p.y,
|
||||
rank: (a2 === focus ? 2e7 : 1e7) + near * 1e6,
|
||||
region: true,
|
||||
fade: regionA,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const c of m.countries) {
|
||||
if (!c.a2 || !c.anchor) continue;
|
||||
if (named.has(c.a2)) continue;
|
||||
// Countries the user has been to are named earlier than the rest.
|
||||
const mine = labelRegionsOf ? labelRegionsOf(c.a2) : false;
|
||||
if (c.area < minArea * (mine ? 0.3 : 1)) continue;
|
||||
const p = engine.project(c.anchor[0], c.anchor[1]);
|
||||
if (p.visible < 0.12 || p.x < -40 || p.x > width + 40 || p.y < -20 || p.y > height + 20) continue;
|
||||
const text = labelFor(c.a2);
|
||||
if (!text) continue;
|
||||
cands.push({
|
||||
key: c.a2,
|
||||
text,
|
||||
x: p.x,
|
||||
y: p.y,
|
||||
rank: c.area * (mine ? 4 : 1) * (1 - regionA * 0.7),
|
||||
region: false,
|
||||
fade: Math.min(1, p.visible * 4) * (1 - regionA * 0.55),
|
||||
});
|
||||
}
|
||||
const named = regionsOn ? regionCandidates(engine, cands) : new Set<string>();
|
||||
countryCandidates(engine, cands, named, minArea, regionA, labelFor, labelRegionsOf);
|
||||
cands.sort((a, b) => b.rank - a.rank);
|
||||
let regionCount = 0;
|
||||
|
||||
@@ -139,6 +93,73 @@ export function placeLabels(
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* From the region label zoom on, every country in view with regions names
|
||||
* them, and its own name gives way (Kansas, not "United States" above it).
|
||||
* The regions nearest the middle of the view come first, the country under the
|
||||
* middle ahead of all; the collision check keeps it from being a wall.
|
||||
* Returns the countries whose regions were named.
|
||||
*/
|
||||
function regionCandidates(engine: GlobeEngine, cands: Candidate[]): Set<string> {
|
||||
const { width, height } = engine.vp;
|
||||
const focus = centreCountry(engine);
|
||||
const named = new Set<string>();
|
||||
const cx = width / 2;
|
||||
const cy = height / 2;
|
||||
for (const [a2, idx] of engine.regionIndex) {
|
||||
for (const f of idx.features) {
|
||||
if (!f.anchor) continue;
|
||||
const p = engine.project(f.anchor[0], f.anchor[1]);
|
||||
if (p.visible < 0.1 || p.x < 0 || p.x > width || p.y < 0 || p.y > height) continue;
|
||||
named.add(a2);
|
||||
const near = 1 - Math.min(1, Math.hypot(p.x - cx, p.y - cy) / Math.hypot(cx, cy));
|
||||
cands.push({
|
||||
key: `${a2}:${f.code ?? f.name}`,
|
||||
text: f.nameEn ?? f.name ?? '',
|
||||
x: p.x,
|
||||
y: p.y,
|
||||
rank: (a2 === focus ? 2e7 : 1e7) + near * 1e6,
|
||||
region: true,
|
||||
fade: engine.regionAlpha,
|
||||
});
|
||||
}
|
||||
}
|
||||
return named;
|
||||
}
|
||||
|
||||
/** Country names, the large ones first; the user's own countries are named earlier than the rest. */
|
||||
function countryCandidates(
|
||||
engine: GlobeEngine,
|
||||
cands: Candidate[],
|
||||
named: Set<string>,
|
||||
minArea: number,
|
||||
regionA: number,
|
||||
labelFor: (a2: string) => string | null,
|
||||
labelRegionsOf?: (a2: string) => boolean
|
||||
): void {
|
||||
const m = engine.manifest;
|
||||
if (!m) return;
|
||||
const { width, height } = engine.vp;
|
||||
for (const c of m.countries) {
|
||||
if (!c.a2 || !c.anchor || named.has(c.a2)) continue;
|
||||
const mine = labelRegionsOf ? labelRegionsOf(c.a2) : false;
|
||||
if (c.area < minArea * (mine ? 0.3 : 1)) continue;
|
||||
const p = engine.project(c.anchor[0], c.anchor[1]);
|
||||
if (p.visible < 0.12 || p.x < -40 || p.x > width + 40 || p.y < -20 || p.y > height + 20) continue;
|
||||
const text = labelFor(c.a2);
|
||||
if (!text) continue;
|
||||
cands.push({
|
||||
key: c.a2,
|
||||
text,
|
||||
x: p.x,
|
||||
y: p.y,
|
||||
rank: c.area * (mine ? 4 : 1) * (1 - regionA * 0.7),
|
||||
region: false,
|
||||
fade: Math.min(1, p.visible * 4) * (1 - regionA * 0.55),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/** The country whose label anchor sits nearest the middle of the view. */
|
||||
function centreCountry(engine: GlobeEngine): string | null {
|
||||
const under = engine.focusCountry();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { DawarichAtlasSuggestions, DawarichBucketScan } from '@trek/shared';
|
||||
import { DAWARICH_BUCKET_MATCH_MIN_MINUTES, DAWARICH_BUCKET_MATCH_RADIUS_M } from '@trek/shared';
|
||||
import { useState } from 'react';
|
||||
import { useTranslation } from '../../i18n';
|
||||
import { DawarichOfflineError, dawarichRepo } from '../../repo/dawarichRepo';
|
||||
@@ -180,3 +181,25 @@ export function useDawarichAtlas({
|
||||
}
|
||||
|
||||
export type DawarichAtlasState = ReturnType<typeof useDawarichAtlas>;
|
||||
|
||||
/** What Dawarich offers for one question, built once for the desktop tab; the phone builds its own rows. */
|
||||
export function dawarichNotes(
|
||||
d: DawarichAtlasState,
|
||||
t: (key: string, params?: Record<string, string | number>) => string
|
||||
): string[] {
|
||||
if (d.tab === 'wishes') {
|
||||
return [
|
||||
d.scan && d.scan.skippedWithoutCoordinates > 0
|
||||
? t('dawarich.bucket.skipped', { count: d.scan.skippedWithoutCoordinates })
|
||||
: null,
|
||||
d.scan?.truncated ? t('dawarich.bucket.truncated') : null,
|
||||
t('dawarich.bucket.rule', { meters: DAWARICH_BUCKET_MATCH_RADIUS_M, count: DAWARICH_BUCKET_MATCH_MIN_MINUTES }),
|
||||
].filter((n): n is string => !!n);
|
||||
}
|
||||
return [
|
||||
d.countries && d.countries.unresolved.length > 0
|
||||
? t('dawarich.atlas.unresolved', { names: d.countries.unresolved.join(', ') })
|
||||
: null,
|
||||
d.countries ? t('dawarich.atlas.window') : null,
|
||||
].filter((n): n is string => !!n);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Globe2, Layers, X } from 'lucide-react';
|
||||
import React from 'react';
|
||||
import { useNavigate, useSearchParams } from 'react-router';
|
||||
import AtlasGlobe from '../../../components/AtlasGlobe/AtlasGlobe';
|
||||
import AtlasGlobe, { type AtlasGlobeHandle } from '../../../components/AtlasGlobe/AtlasGlobe';
|
||||
import type { GlobeEngine } from '../../../components/AtlasGlobe/GlobeEngine';
|
||||
import GlobePins, { type GlobePinsHandle } from '../../../components/AtlasGlobe/GlobePins';
|
||||
import GlobeSky from '../../../components/AtlasGlobe/GlobeSky';
|
||||
import GlobeSky, { type GlobeSkyHandle } from '../../../components/AtlasGlobe/GlobeSky';
|
||||
import '../../../components/AtlasGlobe/atlasGlobe.css';
|
||||
import { segmentStyle } from '../../../components/Map/mapControlShadow';
|
||||
import AtlasBadgeUnlock from '../../../pages/atlas/AtlasBadgeUnlock';
|
||||
@@ -27,7 +27,9 @@ import MAtlasHub from './hub/MAtlasHub';
|
||||
* same dialogs as the desktop. State and data come from useAtlasGlobe.
|
||||
*/
|
||||
export default function MAtlasGlobe(): React.ReactElement {
|
||||
const s = useAtlasGlobe();
|
||||
const globeRef = React.useRef<AtlasGlobeHandle>(null);
|
||||
const skyRef = React.useRef<GlobeSkyHandle>(null);
|
||||
const s = useAtlasGlobe({ globeRef, skyRef });
|
||||
const stats = useGlobeStats(s);
|
||||
const navigate = useNavigate();
|
||||
const [layersOpen, setLayersOpen] = React.useState(false);
|
||||
@@ -43,19 +45,18 @@ export default function MAtlasGlobe(): React.ReactElement {
|
||||
setSearchParams(next, { replace: true });
|
||||
setFocusSearch((n) => n + 1);
|
||||
}, [searchParams, setSearchParams]);
|
||||
const onFrame = React.useCallback(
|
||||
(e: GlobeEngine) => {
|
||||
s.skyRef.current?.layout(e);
|
||||
pinsRef.current?.layout(e);
|
||||
},
|
||||
[s.skyRef]
|
||||
);
|
||||
// A plain function: AtlasGlobe reads its props through a ref, so a new one
|
||||
// each render costs nothing.
|
||||
const onFrame = (e: GlobeEngine) => {
|
||||
skyRef.current?.layout(e);
|
||||
pinsRef.current?.layout(e);
|
||||
};
|
||||
|
||||
return (
|
||||
// h-dvh, as the classic phone Atlas: the shell gives no definite height (#1809).
|
||||
<div className="atlas-globe m-bleed relative h-dvh overflow-hidden">
|
||||
<AtlasGlobe
|
||||
ref={s.globeRef}
|
||||
ref={globeRef}
|
||||
fetchJson={s.fetchJson}
|
||||
dark
|
||||
labelFor={s.labelFor}
|
||||
@@ -69,7 +70,7 @@ export default function MAtlasGlobe(): React.ReactElement {
|
||||
insetBottom={170}
|
||||
/>
|
||||
<div className="pointer-events-none absolute inset-0">
|
||||
<GlobeSky ref={s.skyRef} dark />
|
||||
<GlobeSky ref={skyRef} dark />
|
||||
</div>
|
||||
<div className="pointer-events-none absolute inset-0 overflow-hidden">
|
||||
<GlobePins ref={pinsRef} pins={s.pins} />
|
||||
|
||||
@@ -89,7 +89,7 @@ export default function MAtlasLayersSheet({
|
||||
<div className="px-1 text-caption font-bold uppercase tracking-wide text-m-muted">
|
||||
{s.t('atlas.globe.colorBy')}
|
||||
</div>
|
||||
<MSegmented value={s.colorMode} onChange={s.setColorMode} options={modes} />
|
||||
<MSegmented<GlobeColorMode> value={s.colorMode} onChange={s.setColorMode} options={modes} />
|
||||
</div>
|
||||
</div>
|
||||
</MSheet>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { X } from 'lucide-react';
|
||||
import React from 'react';
|
||||
import { useHubTabs } from '../../../../pages/atlas/AtlasHubRail';
|
||||
import type { AtlasGlobeState } from '../../../../pages/atlas/useAtlasGlobe';
|
||||
import { useHubTabs } from '../../../../pages/atlas/useHubTabs';
|
||||
import MChip from '../../../components/MChip';
|
||||
import MChipStrip from '../../../components/MChipStrip';
|
||||
import MIconBtn from '../../../components/MIconBtn';
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { BADGE_CATEGORIES, type Badge } from '@trek/shared';
|
||||
import { CalendarCheck, CheckCircle2, Hourglass, Target, Users, X } from 'lucide-react';
|
||||
import React from 'react';
|
||||
import BadgeMedal, { TIERS } from '../../../../components/AtlasGlobe/BadgeMedal';
|
||||
import BadgeMedal from '../../../../components/AtlasGlobe/BadgeMedal';
|
||||
import { TIERS } from '../../../../components/AtlasGlobe/badgeTiers';
|
||||
import CountryFlag from '../../../../components/shared/CountryFlag';
|
||||
import { medalLabel } from '../../../../pages/atlas/AtlasGlobeBadges';
|
||||
import { badgeHolders, badgeLadder, formatNum } from '../../../../pages/atlas/atlasHubModel';
|
||||
import { fs } from '../../../../components/shared/DialogShell';
|
||||
import { badgeHolders, badgeLadder, formatNum, medalLabel } from '../../../../pages/atlas/atlasHubModel';
|
||||
import type { AtlasGlobeState } from '../../../../pages/atlas/useAtlasGlobe';
|
||||
import MIconBtn from '../../../components/MIconBtn';
|
||||
import MProgress from '../../../components/MProgress';
|
||||
@@ -52,7 +53,7 @@ export default function MHubBadges({ s }: { s: AtlasGlobeState }): React.ReactEl
|
||||
<span className="line-clamp-2 text-caption font-semibold leading-tight text-m-ink">
|
||||
{titleOf(s, b)}
|
||||
</span>
|
||||
<span className="text-[0.6875rem] tabular-nums text-m-muted">
|
||||
<span className="tabular-nums text-m-muted" style={fs(11, 'caption')}>
|
||||
{b.earned ? (b.year ?? '') : `${formatNum(b.current)} / ${formatNum(b.target)}`}
|
||||
</span>
|
||||
</button>
|
||||
@@ -196,7 +197,9 @@ function BadgeSheet({
|
||||
progress={x.target ? x.current / x.target : 0}
|
||||
label={medalLabel(x)}
|
||||
/>
|
||||
<span className="w-full truncate text-[0.6875rem] font-semibold text-m-muted">{titleOf(s, x)}</span>
|
||||
<span className="w-full truncate font-semibold text-m-muted" style={fs(11, 'caption')}>
|
||||
{titleOf(s, x)}
|
||||
</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -2,9 +2,12 @@ import { Check, Globe2, Info, Loader2, RefreshCw, Star } from 'lucide-react';
|
||||
import React from 'react';
|
||||
import { cityLine, countryLabel, formatDistance } from '../../../../components/Dawarich/dawarichAtlasModel';
|
||||
import { formatDuration } from '../../../../components/Dawarich/dawarichSuggestionModel';
|
||||
import { useDawarichAtlas } from '../../../../components/Dawarich/useDawarichAtlas';
|
||||
import {
|
||||
type DawarichAtlasTab,
|
||||
dawarichNotes,
|
||||
useDawarichAtlas,
|
||||
} from '../../../../components/Dawarich/useDawarichAtlas';
|
||||
import CountryFlag from '../../../../components/shared/CountryFlag';
|
||||
import { dawarichNotes } from '../../../../pages/atlas/AtlasGlobeDawarich';
|
||||
import type { AtlasGlobeState } from '../../../../pages/atlas/useAtlasGlobe';
|
||||
import MSegmented from '../../../components/MSegmented';
|
||||
import { M_CARD, M_INNER, MHubAction, MHubEmpty } from './mHubKit';
|
||||
@@ -24,7 +27,7 @@ export default function MHubDawarich({ s }: { s: AtlasGlobeState }): React.React
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-4">
|
||||
<MSegmented
|
||||
<MSegmented<DawarichAtlasTab>
|
||||
value={d.tab}
|
||||
onChange={d.setTab}
|
||||
options={[
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { Briefcase, Building2, CalendarDays, ChevronRight, Flame, Map as MapIcon, MapPin, Plane } from 'lucide-react';
|
||||
import { ChevronRight } from 'lucide-react';
|
||||
import React from 'react';
|
||||
import { useNavigate } from 'react-router';
|
||||
import { continentCounts, WORLD_COUNTRIES } from '../../../../pages/atlas/atlasHubModel';
|
||||
import { fs } from '../../../../components/shared/DialogShell';
|
||||
import { continentCounts, overviewFigures, WORLD_COUNTRIES } from '../../../../pages/atlas/atlasHubModel';
|
||||
import type { AtlasGlobeState } from '../../../../pages/atlas/useAtlasGlobe';
|
||||
import MProgress from '../../../components/MProgress';
|
||||
import { M_CARD, MHubDawarichEntry, MHubHero, MHubSection, MHubTiles } from './mHubKit';
|
||||
@@ -41,7 +42,9 @@ export default function MHubOverview({ s }: { s: AtlasGlobeState }): React.React
|
||||
{typeof next.daysUntil === 'number' && (
|
||||
<span className="flex flex-none flex-col items-center rounded-[14px] bg-m-act px-3 py-1.5 text-m-actfg">
|
||||
<span className="text-subtitle font-bold tabular-nums leading-none">{next.daysUntil}</span>
|
||||
<span className="text-[0.625rem] font-semibold">{s.t('atlas.daysLeft')}</span>
|
||||
<span className="font-semibold" style={fs(10, 'caption')}>
|
||||
{s.t('atlas.daysLeft')}
|
||||
</span>
|
||||
</span>
|
||||
)}
|
||||
<span className="min-w-0 flex-1">
|
||||
@@ -77,21 +80,7 @@ export default function MHubOverview({ s }: { s: AtlasGlobeState }): React.React
|
||||
/>
|
||||
)}
|
||||
|
||||
<MHubTiles
|
||||
tiles={[
|
||||
{ Icon: MapIcon, value: s.totals.regions, label: s.t('atlas.regions', { count: s.totals.regions }) },
|
||||
{ Icon: Briefcase, value: st?.totalTrips ?? 0, label: s.t('atlas.trips', { count: st?.totalTrips ?? 0 }) },
|
||||
{ Icon: MapPin, value: st?.totalPlaces ?? 0, label: s.t('atlas.places', { count: st?.totalPlaces ?? 0 }) },
|
||||
{ Icon: Building2, value: st?.totalCities ?? 0, label: s.t('atlas.cities', { count: st?.totalCities ?? 0 }) },
|
||||
{ Icon: CalendarDays, value: st?.totalDays ?? 0, label: s.t('atlas.days', { count: st?.totalDays ?? 0 }) },
|
||||
{ Icon: Flame, value: d?.streak ?? 0, label: s.t('atlas.yearsInRow', { count: d?.streak ?? 0 }) },
|
||||
{
|
||||
Icon: Plane,
|
||||
value: d?.tripsThisYear ?? 0,
|
||||
label: `${s.t('atlas.tripsIn', { count: d?.tripsThisYear ?? 0 })} ${new Date().getFullYear()}`,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<MHubTiles tiles={overviewFigures(s.t, s.totals.regions, d)} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3,12 +3,12 @@ import React from 'react';
|
||||
import {
|
||||
ActivityStatusLine,
|
||||
BasisBadges,
|
||||
periodLabel,
|
||||
UncountedBadges,
|
||||
} from '../../../../components/Atlas/tourActivity/tourActivityParts';
|
||||
import {
|
||||
distanceReading,
|
||||
heightReading,
|
||||
periodLabel,
|
||||
typeIcon,
|
||||
typeLabel,
|
||||
useDistanceUnit,
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { ChevronRight, Flag, Globe2, Layers, Map as MapIcon, Plane, Users, X } from 'lucide-react';
|
||||
import React from 'react';
|
||||
import BadgeMedal from '../../../../components/AtlasGlobe/BadgeMedal';
|
||||
import { medalLabel } from '../../../../pages/atlas/AtlasGlobeBadges';
|
||||
import { fs } from '../../../../components/shared/DialogShell';
|
||||
import { medalLabel } from '../../../../pages/atlas/atlasHubModel';
|
||||
import type { AtlasGlobeState } from '../../../../pages/atlas/useAtlasGlobe';
|
||||
import MIconBtn from '../../../components/MIconBtn';
|
||||
import MSheet from '../../../components/MSheet';
|
||||
@@ -82,7 +83,10 @@ export default function MHubTravellers({ s }: { s: AtlasGlobeState }): React.Rea
|
||||
<span className="flex min-w-0 items-center gap-1.5">
|
||||
<span className="truncate text-body font-semibold text-m-ink">{p.username}</span>
|
||||
{isMe && (
|
||||
<span className="flex-none rounded-full bg-m-act px-1.5 py-px text-[0.625rem] font-bold text-m-actfg">
|
||||
<span
|
||||
className="flex-none rounded-full bg-m-act px-1.5 py-px font-bold text-m-actfg"
|
||||
style={fs(10, 'caption')}
|
||||
>
|
||||
{s.t('atlas.globe.you')}
|
||||
</span>
|
||||
)}
|
||||
@@ -100,7 +104,9 @@ export default function MHubTravellers({ s }: { s: AtlasGlobeState }): React.Rea
|
||||
<span className="text-subtitle font-bold tabular-nums leading-none text-m-ink">
|
||||
{p.countries}
|
||||
</span>
|
||||
<span className="mt-0.5 text-[0.625rem] text-m-muted">{s.t('atlas.countries')}</span>
|
||||
<span className="mt-0.5 text-m-muted" style={fs(10, 'caption')}>
|
||||
{s.t('atlas.countries')}
|
||||
</span>
|
||||
</span>
|
||||
<ChevronRight
|
||||
size={16}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { ChevronRight, type LucideIcon } from 'lucide-react';
|
||||
import React from 'react';
|
||||
import DawarichIcon from '../../../../components/shared/DawarichIcon';
|
||||
import { fs } from '../../../../components/shared/DialogShell';
|
||||
|
||||
/**
|
||||
* The phone's own pieces for the Atlas hub, on the mobile tokens (--m-*): a
|
||||
@@ -32,7 +33,9 @@ export function MHubHero({
|
||||
}}
|
||||
/>
|
||||
<div className="relative flex items-end gap-2">
|
||||
<span className="text-[3.25rem] font-bold tabular-nums leading-none tracking-tight text-m-ink">{value}</span>
|
||||
<span className="font-bold tabular-nums leading-none tracking-tight text-m-ink" style={fs(52, 'title')}>
|
||||
{value}
|
||||
</span>
|
||||
{unit && <span className="mb-1 text-subtitle font-semibold text-m-muted">{unit}</span>}
|
||||
</div>
|
||||
{children && <div className="relative mt-3.5">{children}</div>}
|
||||
@@ -60,7 +63,9 @@ export function MHubTiles({ tiles, cols = 2 }: { tiles: MHubTileData[]; cols?: 2
|
||||
<span className="whitespace-nowrap text-body font-bold tabular-nums leading-tight text-m-ink">
|
||||
{value}
|
||||
</span>
|
||||
<span className="line-clamp-2 text-[0.6875rem] leading-tight text-m-muted">{label}</span>
|
||||
<span className="line-clamp-2 leading-tight text-m-muted" style={fs(11, 'caption')}>
|
||||
{label}
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -73,12 +78,7 @@ export function MHubTiles({ tiles, cols = 2 }: { tiles: MHubTileData[]; cols?: 2
|
||||
<span className="block text-title font-bold tabular-nums leading-tight text-m-ink">{value}</span>
|
||||
<span className="block truncate text-caption text-m-muted">{label}</span>
|
||||
</span>
|
||||
<Icon
|
||||
size={cols === 3 ? 22 : 30}
|
||||
strokeWidth={1.6}
|
||||
className="flex-none text-m-faint opacity-70"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<Icon size={30} strokeWidth={1.6} className="flex-none text-m-faint opacity-70" aria-hidden="true" />
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { Badge } from '@trek/shared';
|
||||
import React from 'react';
|
||||
import BadgeMedal from '../../components/AtlasGlobe/BadgeMedal';
|
||||
import { fs } from '../../components/shared/DialogShell';
|
||||
import { medalLabel } from './AtlasGlobeBadges';
|
||||
import { medalLabel } from './atlasHubModel';
|
||||
import type { AtlasGlobeState } from './useAtlasGlobe';
|
||||
|
||||
const KEY = (userId: number) => `trek_atlas_badges_seen_${userId}`;
|
||||
@@ -90,7 +90,7 @@ export default function AtlasBadgeUnlock({ s }: { s: AtlasGlobeState }): React.R
|
||||
if (typeof params.country === 'string') params.country = s.resolveName(params.country) || params.country;
|
||||
const label = medalLabel(current);
|
||||
return (
|
||||
<div className="pointer-events-none fixed inset-0 z-[200] grid place-items-center" aria-live="polite">
|
||||
<div className="pointer-events-none fixed inset-0 z-[var(--z-overlay)] grid place-items-center" aria-live="polite">
|
||||
<div ref={medalRef} className="flex flex-col items-center gap-3" style={{ perspective: 800 }}>
|
||||
<span className="ag-unlock-ring" />
|
||||
<BadgeMedal
|
||||
|
||||
@@ -1,34 +1,14 @@
|
||||
import { BADGE_CATEGORIES, type Badge } from '@trek/shared';
|
||||
import { ArrowLeft, CalendarCheck, CheckCircle2, Hourglass, Target, Users } from 'lucide-react';
|
||||
import React from 'react';
|
||||
import BadgeMedal, { TIERS } from '../../components/AtlasGlobe/BadgeMedal';
|
||||
import BadgeMedal from '../../components/AtlasGlobe/BadgeMedal';
|
||||
import { TIERS } from '../../components/AtlasGlobe/badgeTiers';
|
||||
import CountryFlag from '../../components/shared/CountryFlag';
|
||||
import { fs } from '../../components/shared/DialogShell';
|
||||
import { HUB_CARD, HubBar, HubGlow, HubPill, HubSection, HubTiles, type HubTileData } from './atlasHubKit';
|
||||
import { badgeHolders, badgeLadder, formatNum } from './atlasHubModel';
|
||||
import { badgeHolders, badgeLadder, formatNum, medalLabel } from './atlasHubModel';
|
||||
import type { AtlasGlobeState } from './useAtlasGlobe';
|
||||
|
||||
/** The number a stepped medal carries under its symbol (5, 10, 25 countries; 3/5 regions; five times round). */
|
||||
export function medalLabel(b: Pick<Badge, 'motif' | 'target' | 'current'>): string | undefined {
|
||||
switch (b.motif) {
|
||||
case 'countries':
|
||||
case 'continents':
|
||||
case 'flights':
|
||||
case 'airports':
|
||||
case 'streak':
|
||||
case 'burst':
|
||||
case 'wish':
|
||||
case 'islands':
|
||||
return String(b.target);
|
||||
case 'region':
|
||||
return `${b.current}/${b.target}`;
|
||||
case 'earth':
|
||||
return b.target > 40075 ? `${Math.round(b.target / 40075)}×` : undefined;
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
/** Title params with a country code turned into the country's name. */
|
||||
function badgeParams(s: AtlasGlobeState, b: Badge): Record<string, string | number> {
|
||||
const params: Record<string, string | number> = { ...(b.params ?? {}) };
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { DAWARICH_BUCKET_MATCH_MIN_MINUTES, DAWARICH_BUCKET_MATCH_RADIUS_M } from '@trek/shared';
|
||||
import {
|
||||
Building2,
|
||||
CalendarDays,
|
||||
@@ -14,31 +13,12 @@ import {
|
||||
import React from 'react';
|
||||
import { cityLine, countryLabel, formatDistance } from '../../components/Dawarich/dawarichAtlasModel';
|
||||
import { formatDuration } from '../../components/Dawarich/dawarichSuggestionModel';
|
||||
import { useDawarichAtlas, type DawarichAtlasState } from '../../components/Dawarich/useDawarichAtlas';
|
||||
import { dawarichNotes, useDawarichAtlas } from '../../components/Dawarich/useDawarichAtlas';
|
||||
import CountryFlag from '../../components/shared/CountryFlag';
|
||||
import { fs } from '../../components/shared/DialogShell';
|
||||
import { HUB_CARD, HubEmpty, HubGhost, HubPill, HubPrimary, HubRow, HubRows } from './atlasHubKit';
|
||||
import type { AtlasGlobeState } from './useAtlasGlobe';
|
||||
|
||||
/** What Dawarich offers for one question, built once for the desktop tab; the phone builds its own rows. */
|
||||
export function dawarichNotes(d: DawarichAtlasState, t: AtlasGlobeState['t']): string[] {
|
||||
if (d.tab === 'wishes') {
|
||||
return [
|
||||
d.scan && d.scan.skippedWithoutCoordinates > 0
|
||||
? t('dawarich.bucket.skipped', { count: d.scan.skippedWithoutCoordinates })
|
||||
: null,
|
||||
d.scan?.truncated ? t('dawarich.bucket.truncated') : null,
|
||||
t('dawarich.bucket.rule', { meters: DAWARICH_BUCKET_MATCH_RADIUS_M, count: DAWARICH_BUCKET_MATCH_MIN_MINUTES }),
|
||||
].filter((n): n is string => !!n);
|
||||
}
|
||||
return [
|
||||
d.countries && d.countries.unresolved.length > 0
|
||||
? t('dawarich.atlas.unresolved', { names: d.countries.unresolved.join(', ') })
|
||||
: null,
|
||||
d.countries ? t('dawarich.atlas.window') : null,
|
||||
].filter((n): n is string => !!n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dawarich inside the Atlas hub (addon): which wishes the recordings reached,
|
||||
* which countries they went through. Every answer is an offer to tick, and
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Briefcase, Building2, CalendarDays, ChevronRight, Flame, Map as MapIcon, MapPin, Plane } from 'lucide-react';
|
||||
import { ChevronRight } from 'lucide-react';
|
||||
import React from 'react';
|
||||
import { useNavigate } from 'react-router';
|
||||
import { fs } from '../../components/shared/DialogShell';
|
||||
import { HUB_CARD, HubBar, HubDawarichEntry, HubHero, HubTiles, type HubTileData } from './atlasHubKit';
|
||||
import { WORLD_COUNTRIES, continentCounts } from './atlasHubModel';
|
||||
import { WORLD_COUNTRIES, continentCounts, overviewFigures } from './atlasHubModel';
|
||||
import type { AtlasGlobeState } from './useAtlasGlobe';
|
||||
|
||||
const CARD = HUB_CARD;
|
||||
@@ -25,19 +25,7 @@ export default function AtlasGlobeOverview({ s }: { s: AtlasGlobeState }): React
|
||||
// The server also sends how many days are left, which the shared type does not list yet.
|
||||
const next = d?.nextTrip as { id: number; title: string; daysUntil?: number } | null | undefined;
|
||||
|
||||
const figures: HubTileData[] = [
|
||||
{ Icon: MapIcon, value: s.totals.regions, label: s.t('atlas.regions', { count: s.totals.regions }) },
|
||||
{ Icon: Briefcase, value: st?.totalTrips ?? 0, label: s.t('atlas.trips', { count: st?.totalTrips ?? 0 }) },
|
||||
{ Icon: MapPin, value: st?.totalPlaces ?? 0, label: s.t('atlas.places', { count: st?.totalPlaces ?? 0 }) },
|
||||
{ Icon: Building2, value: st?.totalCities ?? 0, label: s.t('atlas.cities', { count: st?.totalCities ?? 0 }) },
|
||||
{ Icon: CalendarDays, value: st?.totalDays ?? 0, label: s.t('atlas.days', { count: st?.totalDays ?? 0 }) },
|
||||
{ Icon: Flame, value: d?.streak ?? 0, label: s.t('atlas.yearsInRow', { count: d?.streak ?? 0 }) },
|
||||
{
|
||||
Icon: Plane,
|
||||
value: d?.tripsThisYear ?? 0,
|
||||
label: `${s.t('atlas.tripsIn', { count: d?.tripsThisYear ?? 0 })} ${new Date().getFullYear()}`,
|
||||
},
|
||||
];
|
||||
const figures: HubTileData[] = overviewFigures(s.t, s.totals.regions, d);
|
||||
|
||||
return (
|
||||
<div className="grid gap-3 sm:grid-cols-[1fr_1.45fr]">
|
||||
|
||||
@@ -2,14 +2,15 @@ import { ArrowLeft, Globe2, Layers } from 'lucide-react';
|
||||
import React from 'react';
|
||||
import BadgeMedal from '../../components/AtlasGlobe/BadgeMedal';
|
||||
import { DialogHeader, DialogShell, DialogTile, NEUTRAL_TINT, fs } from '../../components/shared/DialogShell';
|
||||
import AtlasGlobeBadges, { medalLabel } from './AtlasGlobeBadges';
|
||||
import AtlasGlobeBadges from './AtlasGlobeBadges';
|
||||
import AtlasGlobeDawarich from './AtlasGlobeDawarich';
|
||||
import AtlasGlobeOverview from './AtlasGlobeOverview';
|
||||
import AtlasGlobeTours from './AtlasGlobeTours';
|
||||
import AtlasGlobeTravellers from './AtlasGlobeTravellers';
|
||||
import AtlasGlobeWishlist from './AtlasGlobeWishlist';
|
||||
import { useHubTabs } from './AtlasHubRail';
|
||||
import { medalLabel } from './atlasHubModel';
|
||||
import type { AtlasGlobeState, AtlasHubTab } from './useAtlasGlobe';
|
||||
import { useHubTabs } from './useHubTabs';
|
||||
|
||||
/** The Passport: badges as glass medals, and the other travellers of this instance. */
|
||||
export default function AtlasGlobePassport({ s }: { s: AtlasGlobeState }): React.ReactElement | null {
|
||||
|
||||
@@ -17,8 +17,6 @@ export default function AtlasGlobeSearch({
|
||||
const inputRef = React.useRef<HTMLInputElement>(null);
|
||||
const results = s.results;
|
||||
|
||||
React.useEffect(() => setActive(0), [s.query]);
|
||||
|
||||
// Asked from outside (the phone dock's search button): focus the field.
|
||||
React.useEffect(() => {
|
||||
if (focusSignal > 0) inputRef.current?.focus();
|
||||
@@ -65,7 +63,10 @@ export default function AtlasGlobeSearch({
|
||||
<input
|
||||
ref={inputRef}
|
||||
value={s.query}
|
||||
onChange={(e) => s.setQuery(e.target.value)}
|
||||
onChange={(e) => {
|
||||
s.setQuery(e.target.value);
|
||||
setActive(0);
|
||||
}}
|
||||
onFocus={s.loadRegionSearch}
|
||||
onKeyDown={onKeyDown}
|
||||
placeholder={s.t('atlas.globe.search')}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Layers, Minus, Plus, X } from 'lucide-react';
|
||||
import React from 'react';
|
||||
import { useNavigate } from 'react-router';
|
||||
import AtlasGlobe from '../../components/AtlasGlobe/AtlasGlobe';
|
||||
import AtlasGlobe, { type AtlasGlobeHandle } from '../../components/AtlasGlobe/AtlasGlobe';
|
||||
import type { GlobeEngine } from '../../components/AtlasGlobe/GlobeEngine';
|
||||
import GlobePins, { type GlobePinsHandle } from '../../components/AtlasGlobe/GlobePins';
|
||||
import GlobeSky from '../../components/AtlasGlobe/GlobeSky';
|
||||
import GlobeSky, { type GlobeSkyHandle } from '../../components/AtlasGlobe/GlobeSky';
|
||||
import GlobeStatsBar from '../../components/AtlasGlobe/GlobeStatsBar';
|
||||
import '../../components/AtlasGlobe/atlasGlobe.css';
|
||||
import Navbar from '../../components/Layout/Navbar';
|
||||
@@ -27,25 +27,26 @@ const PLANNED_DOT = '#818cf8'; // theme-lint-disable: the planned map paint, so
|
||||
|
||||
/** The globe Atlas on desktop. State lives in useAtlasGlobe; this file is layout. */
|
||||
export default function AtlasGlobeView(): React.ReactElement {
|
||||
const s = useAtlasGlobe();
|
||||
const globeRef = React.useRef<AtlasGlobeHandle>(null);
|
||||
const skyRef = React.useRef<GlobeSkyHandle>(null);
|
||||
const s = useAtlasGlobe({ globeRef, skyRef });
|
||||
const rootRef = React.useRef<HTMLDivElement>(null);
|
||||
const [layersOpen, setLayersOpen] = React.useState(false);
|
||||
const stats = useGlobeStats(s);
|
||||
const pinsRef = React.useRef<GlobePinsHandle>(null);
|
||||
const navigate = useNavigate();
|
||||
|
||||
const onFrame = React.useCallback(
|
||||
(e: GlobeEngine) => {
|
||||
s.skyRef.current?.layout(e);
|
||||
pinsRef.current?.layout(e);
|
||||
const root = rootRef.current;
|
||||
if (root) {
|
||||
const moving = e.isMorphing() ? '1' : '0';
|
||||
if (root.dataset.moving !== moving) root.dataset.moving = moving;
|
||||
}
|
||||
},
|
||||
[s.skyRef]
|
||||
);
|
||||
// A plain function: AtlasGlobe reads its props through a ref, so a new one
|
||||
// each render costs nothing.
|
||||
const onFrame = (e: GlobeEngine) => {
|
||||
skyRef.current?.layout(e);
|
||||
pinsRef.current?.layout(e);
|
||||
const root = rootRef.current;
|
||||
if (root) {
|
||||
const moving = e.isMorphing() ? '1' : '0';
|
||||
if (root.dataset.moving !== moving) root.dataset.moving = moving;
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="min-h-screen">
|
||||
@@ -56,7 +57,7 @@ export default function AtlasGlobeView(): React.ReactElement {
|
||||
style={{ top: 'var(--nav-h)', height: 'calc(100dvh - var(--nav-h))' }}
|
||||
>
|
||||
<AtlasGlobe
|
||||
ref={s.globeRef}
|
||||
ref={globeRef}
|
||||
fetchJson={s.fetchJson}
|
||||
dark
|
||||
labelFor={s.labelFor}
|
||||
@@ -70,7 +71,7 @@ export default function AtlasGlobeView(): React.ReactElement {
|
||||
onError={(err) => s.setError(err instanceof Error ? err.message : String(err))}
|
||||
/>
|
||||
<div className="pointer-events-none absolute inset-0">
|
||||
<GlobeSky ref={s.skyRef} dark />
|
||||
<GlobeSky ref={skyRef} dark />
|
||||
</div>
|
||||
<div className="pointer-events-none absolute inset-0 overflow-hidden">
|
||||
<GlobePins ref={pinsRef} pins={s.pins} />
|
||||
@@ -139,33 +140,50 @@ export default function AtlasGlobeView(): React.ReactElement {
|
||||
);
|
||||
}
|
||||
|
||||
type HoverHit = NonNullable<AtlasGlobeState['hover']>['hit'];
|
||||
|
||||
/** What the hover chip says under the name: trips and places and when, or a region's country and places. */
|
||||
function hoverFacts(s: AtlasGlobeState, hit: HoverHit): string[] {
|
||||
const facts: string[] = [];
|
||||
if (hit.kind === 'region') {
|
||||
const regionRow = (s.regions[hit.a2] ?? []).find((r) => r.code === hit.code);
|
||||
facts.push(s.resolveName(hit.a2));
|
||||
if (regionRow?.placeCount)
|
||||
facts.push(`${regionRow.placeCount} ${s.t('atlas.places', { count: regionRow.placeCount })}`);
|
||||
return facts;
|
||||
}
|
||||
const row = s.data?.countries.find((c) => c.code === hit.a2);
|
||||
if (!row || (row.tripCount === 0 && row.placeCount === 0)) return facts;
|
||||
facts.push(
|
||||
`${row.tripCount} ${s.t('atlas.trips', { count: row.tripCount })}, ${row.placeCount} ${s.t('atlas.places', { count: row.placeCount })}`
|
||||
);
|
||||
const first = row.firstVisit?.slice(0, 4);
|
||||
const last = row.lastVisit?.slice(0, 4);
|
||||
if (first) facts.push(first === last || !last ? first : `${first} \u2192 ${last}`);
|
||||
return facts;
|
||||
}
|
||||
|
||||
/** Whether what is under the pointer is visited or planned, and the colour of its dot. */
|
||||
function hoverStatus(s: AtlasGlobeState, hit: HoverHit): { label: string; dot: string | undefined } | null {
|
||||
const row = hit.kind === 'country' ? s.data?.countries.find((c) => c.code === hit.a2) : undefined;
|
||||
const regionRow = hit.kind === 'region' ? (s.regions[hit.a2] ?? []).find((r) => r.code === hit.code) : undefined;
|
||||
const status = row ? countryStatus(row) : regionRow ? (regionRow.status ?? 'visited') : null;
|
||||
if (!status) return null;
|
||||
const a3 = hit.kind === 'country' ? s.manifest?.countries[hit.index]?.a3 : undefined;
|
||||
if (status === 'visited') return { label: s.t('atlas.globe.visited'), dot: a3 ? countryColor(a3) : undefined };
|
||||
return { label: s.t('atlas.planned'), dot: PLANNED_DOT };
|
||||
}
|
||||
|
||||
function HoverChip({ s }: { s: AtlasGlobeState }): React.ReactElement | null {
|
||||
const h = s.hover;
|
||||
if (!h) return null;
|
||||
const hit = h.hit;
|
||||
const name = hit.kind === 'country' ? (hit.a2 ? s.resolveName(hit.a2) : '') : (hit.name ?? '');
|
||||
if (!name) return null;
|
||||
const row = hit.kind === 'country' ? s.data?.countries.find((c) => c.code === hit.a2) : undefined;
|
||||
const regionRow = hit.kind === 'region' ? (s.regions[hit.a2] ?? []).find((r) => r.code === hit.code) : undefined;
|
||||
const status = row ? countryStatus(row) : regionRow ? (regionRow.status ?? 'visited') : null;
|
||||
const statusLabel = status === 'visited' ? s.t('atlas.globe.visited') : status ? s.t('atlas.planned') : null;
|
||||
const a3 = hit.kind === 'country' ? s.manifest?.countries[hit.index]?.a3 : undefined;
|
||||
const dotColor = status === 'visited' && a3 ? countryColor(a3) : status ? PLANNED_DOT : undefined;
|
||||
// What the classic tooltip told: trips and places and when, or the country of a region.
|
||||
const facts: string[] = [];
|
||||
if (row && (row.tripCount > 0 || row.placeCount > 0)) {
|
||||
facts.push(
|
||||
`${row.tripCount} ${s.t('atlas.trips', { count: row.tripCount })}, ${row.placeCount} ${s.t('atlas.places', { count: row.placeCount })}`
|
||||
);
|
||||
const first = row.firstVisit?.slice(0, 4);
|
||||
const last = row.lastVisit?.slice(0, 4);
|
||||
if (first) facts.push(first === last || !last ? first : `${first} \u2192 ${last}`);
|
||||
}
|
||||
if (hit.kind === 'region') {
|
||||
facts.push(s.resolveName(hit.a2));
|
||||
if (regionRow?.placeCount)
|
||||
facts.push(`${regionRow.placeCount} ${s.t('atlas.places', { count: regionRow.placeCount })}`);
|
||||
}
|
||||
const status = hoverStatus(s, hit);
|
||||
const statusLabel = status?.label ?? null;
|
||||
const dotColor = status?.dot;
|
||||
const facts = hoverFacts(s, hit);
|
||||
return (
|
||||
<div
|
||||
className="ag-liquid pointer-events-none absolute z-30 whitespace-nowrap rounded-xl px-3 py-1.5"
|
||||
|
||||
@@ -1,39 +1,8 @@
|
||||
import { Award, BarChart3, Mountain, Star, Trophy } from 'lucide-react';
|
||||
import React from 'react';
|
||||
import { segmentStyle } from '../../components/Map/mapControlShadow';
|
||||
import DawarichIcon from '../../components/shared/DawarichIcon';
|
||||
import { Tooltip } from '../../components/shared/Tooltip';
|
||||
import { useAddonStore } from '../../store/addonStore';
|
||||
import type { AtlasGlobeState, AtlasHubTab } from './useAtlasGlobe';
|
||||
|
||||
export interface HubTabEntry {
|
||||
tab: AtlasHubTab;
|
||||
label: string;
|
||||
/** A symbol of the icon set, or a brand mark that takes the same size. */
|
||||
Icon: React.ComponentType<{ size?: number; strokeWidth?: number }>;
|
||||
}
|
||||
|
||||
/** The tabs of the Atlas hub in their order; the map rail and the hub's tab bar both read this. */
|
||||
export function useHubTabs(s: AtlasGlobeState): HubTabEntry[] {
|
||||
const toursEnabled = useAddonStore((st) => st.isEnabled('tours'));
|
||||
return [
|
||||
{ tab: 'overview', label: s.t('atlas.statsTab'), Icon: BarChart3 },
|
||||
{ tab: 'badges', label: s.t('atlas.globe.badges'), Icon: Award },
|
||||
{ tab: 'wishlist', label: s.t('atlas.bucketTab'), Icon: Star },
|
||||
...(s.dawarichEnabled ? [{ tab: 'dawarich' as const, label: s.t('dawarich.title'), Icon: DawarichMark }] : []),
|
||||
...(toursEnabled ? [{ tab: 'tours' as const, label: s.t('tours.mode.tours'), Icon: Mountain }] : []),
|
||||
...(s.compareEnabled ? [{ tab: 'travellers' as const, label: s.t('atlas.globe.travellers'), Icon: Trophy }] : []),
|
||||
];
|
||||
}
|
||||
|
||||
/** Dawarich's mark at an icon's size, round like the symbols beside it. */
|
||||
function DawarichMark({ size = 16 }: { size?: number }): React.ReactElement {
|
||||
return (
|
||||
<span className="flex flex-none overflow-hidden rounded-full" style={{ width: size + 2, height: size + 2 }}>
|
||||
<DawarichIcon size={size + 2} />
|
||||
</span>
|
||||
);
|
||||
}
|
||||
import type { AtlasGlobeState } from './useAtlasGlobe';
|
||||
import { useHubTabs } from './useHubTabs';
|
||||
|
||||
/**
|
||||
* One way into every tab of the hub, straight from the map: a column of glass
|
||||
|
||||
@@ -196,7 +196,9 @@ export function paintGlobe(engine: GlobeEngine, input: GlobePaintInput): void {
|
||||
export function regionProgress(
|
||||
engine: GlobeEngine,
|
||||
a2: string,
|
||||
rows: AtlasRegionRow[]
|
||||
rows: AtlasRegionRow[],
|
||||
// Which arrival of region files this answer is for; the memo above keys on it.
|
||||
_loaded?: number
|
||||
): { visited: number; total: number } | null {
|
||||
const idx = engine.regionIndex.get(a2);
|
||||
const entry = engine.manifest?.regions[a2];
|
||||
|
||||
@@ -1,4 +1,14 @@
|
||||
import { getIntlLanguage, type Badge } from '@trek/shared';
|
||||
import {
|
||||
Briefcase,
|
||||
Building2,
|
||||
CalendarDays,
|
||||
Flame,
|
||||
Map as MapIcon,
|
||||
MapPin,
|
||||
Plane,
|
||||
type LucideIcon,
|
||||
} from 'lucide-react';
|
||||
import { A2_TO_A3, type AtlasData, type BucketItem } from './atlasModel';
|
||||
|
||||
/**
|
||||
@@ -26,6 +36,31 @@ export function continentCounts(data: AtlasData | null): Array<{ name: string; k
|
||||
);
|
||||
}
|
||||
|
||||
/** The small figures under the headline of the hub's statistics, for both shells. */
|
||||
export function overviewFigures(
|
||||
t: (key: string, params?: Record<string, string | number>) => string,
|
||||
regions: number,
|
||||
data: AtlasData | null
|
||||
): Array<{ Icon: LucideIcon; value: number; label: string }> {
|
||||
const st = data?.stats;
|
||||
const n = (v: number | null | undefined) => v ?? 0;
|
||||
const trips = n(st?.totalTrips);
|
||||
const places = n(st?.totalPlaces);
|
||||
const cities = n(st?.totalCities);
|
||||
const days = n(st?.totalDays);
|
||||
const streak = n(data?.streak);
|
||||
const thisYear = n(data?.tripsThisYear);
|
||||
return [
|
||||
{ Icon: MapIcon, value: regions, label: t('atlas.regions', { count: regions }) },
|
||||
{ Icon: Briefcase, value: trips, label: t('atlas.trips', { count: trips }) },
|
||||
{ Icon: MapPin, value: places, label: t('atlas.places', { count: places }) },
|
||||
{ Icon: Building2, value: cities, label: t('atlas.cities', { count: cities }) },
|
||||
{ Icon: CalendarDays, value: days, label: t('atlas.days', { count: days }) },
|
||||
{ Icon: Flame, value: streak, label: t('atlas.yearsInRow', { count: streak }) },
|
||||
{ Icon: Plane, value: thisYear, label: `${t('atlas.tripsIn', { count: thisYear })} ${new Date().getFullYear()}` },
|
||||
];
|
||||
}
|
||||
|
||||
/** 12400 as "12k", smaller numbers in the reader's grouping. */
|
||||
export function formatNum(n: number): string {
|
||||
return n >= 10000 ? `${Math.round(n / 1000)}k` : n.toLocaleString();
|
||||
@@ -91,3 +126,24 @@ export function badgeHolders(
|
||||
of: people.length + 1,
|
||||
};
|
||||
}
|
||||
|
||||
/** The number a stepped medal carries under its symbol (5, 10, 25 countries; 3/5 regions; five times round). */
|
||||
export function medalLabel(b: Pick<Badge, 'motif' | 'target' | 'current'>): string | undefined {
|
||||
switch (b.motif) {
|
||||
case 'countries':
|
||||
case 'continents':
|
||||
case 'flights':
|
||||
case 'airports':
|
||||
case 'streak':
|
||||
case 'burst':
|
||||
case 'wish':
|
||||
case 'islands':
|
||||
return String(b.target);
|
||||
case 'region':
|
||||
return `${b.current}/${b.target}`;
|
||||
case 'earth':
|
||||
return b.target > 40075 ? `${Math.round(b.target / 40075)}×` : undefined;
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { computeBadges, continentForCountry, crossesDateline, type Badge } from '@trek/shared';
|
||||
import type React from 'react';
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import type { AtlasGlobeHandle } from '../../components/AtlasGlobe/AtlasGlobe';
|
||||
import type { AtlasMeshManifest, GlobeEngine, GlobeHit } from '../../components/AtlasGlobe/GlobeEngine';
|
||||
@@ -59,13 +60,21 @@ interface GlobeHover {
|
||||
* hovered, the layer switches, and the mark/unmark flows. The engine itself
|
||||
* lives in AtlasGlobe; this hook only paints it and reacts to it.
|
||||
*/
|
||||
export function useAtlasGlobe() {
|
||||
/**
|
||||
* The refs of the globe and the sky, made by the view that renders them and
|
||||
* handed in: kept out of the returned state, so reading that state while
|
||||
* rendering never counts as reading a ref.
|
||||
*/
|
||||
export interface AtlasGlobeRefs {
|
||||
globeRef: React.RefObject<AtlasGlobeHandle | null>;
|
||||
skyRef: React.RefObject<GlobeSkyHandle | null>;
|
||||
}
|
||||
|
||||
export function useAtlasGlobe({ globeRef, skyRef }: AtlasGlobeRefs) {
|
||||
const { t, language } = useTranslation();
|
||||
const dark = useIsDark();
|
||||
const toast = useToast();
|
||||
const resolveName = useCountryNames(language);
|
||||
const globeRef = useRef<AtlasGlobeHandle>(null);
|
||||
const skyRef = useRef<GlobeSkyHandle>(null);
|
||||
const [data, setData] = useState<AtlasData | null>(null);
|
||||
const [regions, setRegions] = useState<VisitedRegionMap>({});
|
||||
const placeLang = usePlaceLanguage();
|
||||
@@ -217,7 +226,7 @@ export function useAtlasGlobe() {
|
||||
setHover(hit ? { hit, x, y } : null);
|
||||
}, []);
|
||||
|
||||
const engine = (): GlobeEngine | null => globeRef.current?.engine ?? null;
|
||||
const engine = useCallback((): GlobeEngine | null => globeRef.current?.engine ?? null, [globeRef]);
|
||||
|
||||
// Once the globe and the data are there, fetch in the background the regions
|
||||
// of the countries this user is most likely to zoom into: the visited ones
|
||||
@@ -368,12 +377,13 @@ export function useAtlasGlobe() {
|
||||
return data?.countries.find((c) => c.code === selection.a2) ?? null;
|
||||
}, [selection, data]);
|
||||
|
||||
// regionTick counts the region files arrived: the index of a selected country
|
||||
// can arrive after the selection, and the progress must follow it.
|
||||
const progress = useMemo(() => {
|
||||
const e = engine();
|
||||
if (!selection || !e) return null;
|
||||
return regionProgress(e, selection.a2, regions[selection.a2] ?? []);
|
||||
// regionTick: the index arrives after the selection
|
||||
}, [selection, regions, regionTick]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
return regionProgress(e, selection.a2, regions[selection.a2] ?? [], regionTick);
|
||||
}, [engine, selection, regions, regionTick]);
|
||||
|
||||
const selectedRegionVisited = useMemo(() => {
|
||||
if (selection?.kind !== 'region') return false;
|
||||
@@ -543,7 +553,7 @@ export function useAtlasGlobe() {
|
||||
type Person = AtlasPerson & { username: string; avatar_url: string | null };
|
||||
const [people, setPeople] = useState<Person[] | null>(null);
|
||||
const [compareWith, setCompareWith] = useState<Person | null>(null);
|
||||
const hidden = useSettingsStore((st) => (st.settings as Record<string, unknown>).atlas_hidden === true);
|
||||
const hidden = useSettingsStore((st) => (st.settings as unknown as Record<string, unknown>).atlas_hidden === true);
|
||||
const updateSetting = useSettingsStore((st) => st.updateSetting);
|
||||
const me = useAuthStore((st) => st.user);
|
||||
const compareEnabled = useAuthStore((st) => st.atlasCompareEnabled);
|
||||
@@ -601,8 +611,6 @@ export function useAtlasGlobe() {
|
||||
return {
|
||||
t,
|
||||
dark,
|
||||
globeRef,
|
||||
skyRef,
|
||||
data,
|
||||
regions,
|
||||
bucket,
|
||||
|
||||
@@ -14,23 +14,19 @@ const MAX_HITS = 5;
|
||||
|
||||
/**
|
||||
* Places for the globe's search (#1115), as the classic Atlas had them: from
|
||||
* three characters on, a debounced geocoder lookup; a slow answer for an older
|
||||
* query never overwrites a newer one.
|
||||
* three characters on, a debounced geocoder lookup. The answer is kept with
|
||||
* the query it answers, so what shows (and whether it is still loading) is
|
||||
* derived, and a slow answer for an older query never shows for a newer one.
|
||||
*/
|
||||
export function useGlobePlaceSearch(query: string, lang: string) {
|
||||
const [hits, setHits] = useState<GlobePlaceHit[]>([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [answer, setAnswer] = useState<{ q: string; hits: GlobePlaceHit[] }>({ q: '', hits: [] });
|
||||
const seq = useRef(0);
|
||||
const q = query.trim();
|
||||
const asking = q.length >= MIN_CHARS;
|
||||
|
||||
useEffect(() => {
|
||||
const q = query.trim();
|
||||
const mine = ++seq.current;
|
||||
if (q.length < MIN_CHARS) {
|
||||
setHits([]);
|
||||
setLoading(false);
|
||||
return;
|
||||
}
|
||||
setLoading(true);
|
||||
if (!asking) return;
|
||||
const timer = window.setTimeout(() => {
|
||||
atlasBucketRepo
|
||||
.searchPlaces(q, lang)
|
||||
@@ -42,19 +38,18 @@ export function useGlobePlaceSearch(query: string, lang: string) {
|
||||
out.push({ name: p.name || q, address: p.address || null, lat: p.lat, lng: p.lng });
|
||||
if (out.length === MAX_HITS) break;
|
||||
}
|
||||
setHits(out);
|
||||
setAnswer({ q, hits: out });
|
||||
})
|
||||
.catch(() => {
|
||||
if (mine === seq.current) setHits([]);
|
||||
})
|
||||
.finally(() => {
|
||||
if (mine === seq.current) setLoading(false);
|
||||
// A failed lookup answers with no places; the search box itself stays usable.
|
||||
if (mine === seq.current) setAnswer({ q, hits: [] });
|
||||
});
|
||||
}, DEBOUNCE_MS);
|
||||
return () => window.clearTimeout(timer);
|
||||
}, [query, lang]);
|
||||
}, [q, asking, lang]);
|
||||
|
||||
return { placeHits: hits, placesLoading: loading };
|
||||
const current = asking && answer.q === q;
|
||||
return { placeHits: current ? answer.hits : [], placesLoading: asking && !current };
|
||||
}
|
||||
|
||||
/** Where a picked place lies; null when the lookup fails (the globe has already moved there). */
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import { Award, BarChart3, Mountain, Star, Trophy } from 'lucide-react';
|
||||
import type React from 'react';
|
||||
import DawarichMark from '../../components/AtlasGlobe/DawarichMark';
|
||||
import { useAddonStore } from '../../store/addonStore';
|
||||
import type { AtlasGlobeState, AtlasHubTab } from './useAtlasGlobe';
|
||||
|
||||
export interface HubTabEntry {
|
||||
tab: AtlasHubTab;
|
||||
label: string;
|
||||
/** A symbol of the icon set, or a brand mark that takes the same size. */
|
||||
Icon: React.ComponentType<{ size?: number; strokeWidth?: number }>;
|
||||
}
|
||||
|
||||
/** The tabs of the Atlas hub in their order; the map rail and the hub's tab bar both read this. */
|
||||
export function useHubTabs(s: AtlasGlobeState): HubTabEntry[] {
|
||||
const toursEnabled = useAddonStore((st) => st.isEnabled('tours'));
|
||||
return [
|
||||
{ tab: 'overview', label: s.t('atlas.statsTab'), Icon: BarChart3 },
|
||||
{ tab: 'badges', label: s.t('atlas.globe.badges'), Icon: Award },
|
||||
{ tab: 'wishlist', label: s.t('atlas.bucketTab'), Icon: Star },
|
||||
...(s.dawarichEnabled ? [{ tab: 'dawarich' as const, label: s.t('dawarich.title'), Icon: DawarichMark }] : []),
|
||||
...(toursEnabled ? [{ tab: 'tours' as const, label: s.t('tours.mode.tours'), Icon: Mountain }] : []),
|
||||
...(s.compareEnabled ? [{ tab: 'travellers' as const, label: s.t('atlas.globe.travellers'), Icon: Trophy }] : []),
|
||||
];
|
||||
}
|
||||
@@ -1,38 +1,40 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { render, screen } from '../../../helpers/render';
|
||||
import { describe, it, expect, vi } from 'vitest';
|
||||
import { Award, Flag, Globe, MapIcon, Plane, Star } from 'lucide-react';
|
||||
import { fireEvent, render, screen } from '../../../helpers/render';
|
||||
import MAtlasStatsCard from '../../../../src/mobile/screens/atlas/MAtlasStatsCard';
|
||||
import type { GlobeStat } from '../../../../src/components/AtlasGlobe/GlobeStatsBar';
|
||||
|
||||
// FE-MOB-ATLAS-010 to FE-MOB-ATLAS-012
|
||||
|
||||
const stats = { totalCountries: 3, totalTrips: 2, totalPlaces: 125, totalCities: 31, totalDays: 26 };
|
||||
const stat = (key: string, value: number | string, label: string, icon = Flag): GlobeStat => ({ key, value, label, icon, onClick: vi.fn() });
|
||||
|
||||
const stats: GlobeStat[] = [
|
||||
stat('countries', 37, 'Countries'),
|
||||
stat('continents', 6, 'Continents', Globe),
|
||||
stat('regions', 42, 'Regions', MapIcon),
|
||||
stat('flights', '152k', 'Flight km', Plane),
|
||||
stat('badges', 22, 'Badges', Award),
|
||||
stat('wishlist', 4, 'Wishlist', Star),
|
||||
];
|
||||
|
||||
describe('MAtlasStatsCard', () => {
|
||||
it('FE-MOB-ATLAS-010: renders the five stat columns with their values', () => {
|
||||
it('FE-MOB-ATLAS-010: shows the five phone figures in their order', () => {
|
||||
render(<MAtlasStatsCard stats={stats} />);
|
||||
|
||||
for (const label of ['Countries', 'Trips', 'Places', 'Cities', 'Days']) {
|
||||
expect(screen.getByText(label)).toBeInTheDocument();
|
||||
}
|
||||
for (const value of ['3', '2', '125', '31', '26']) {
|
||||
expect(screen.getByText(value)).toBeInTheDocument();
|
||||
}
|
||||
// No planned countries, no superscript — the column reads as a plain number.
|
||||
expect(screen.getByText('Countries').parentElement).toHaveTextContent(/^3Countries$/);
|
||||
const labels = screen.getAllByRole('button').map((b) => b.textContent);
|
||||
expect(labels).toEqual(['37Countries', '6Continents', '42Regions', '22Badges', '4Wishlist']);
|
||||
});
|
||||
|
||||
it('FE-MOB-ATLAS-011: hangs the planned countries off the country total as a superscript (#1048)', () => {
|
||||
render(<MAtlasStatsCard stats={{ ...stats, totalCountriesPlanned: 4 }} />);
|
||||
it('FE-MOB-ATLAS-011: leaves out the figures the phone card has no room for', () => {
|
||||
render(<MAtlasStatsCard stats={stats} />);
|
||||
|
||||
expect(screen.getByText('+4')).toBeInTheDocument();
|
||||
expect(screen.getByText('Countries').parentElement).toHaveTextContent(/^3\+4Countries$/);
|
||||
// Only the first column carries it — the other four stay untouched.
|
||||
expect(screen.getByText('Trips').parentElement).toHaveTextContent(/^2Trips$/);
|
||||
expect(screen.queryByText('Flight km')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('FE-MOB-ATLAS-012: a zero planned count is left off entirely', () => {
|
||||
render(<MAtlasStatsCard stats={{ ...stats, totalCountriesPlanned: 0 }} />);
|
||||
it('FE-MOB-ATLAS-012: a column opens what it counts', () => {
|
||||
render(<MAtlasStatsCard stats={stats} />);
|
||||
|
||||
expect(screen.queryByText('+0')).not.toBeInTheDocument();
|
||||
expect(screen.getByText('Countries').parentElement).toHaveTextContent(/^3Countries$/);
|
||||
fireEvent.click(screen.getByText('Badges'));
|
||||
expect(stats[4]?.onClick).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -68,12 +68,10 @@ export class AtlasPeopleService {
|
||||
|
||||
async people(ids: number[]): Promise<AtlasPerson[]> {
|
||||
if (!(await this.compareEnabled())) return [];
|
||||
const out: AtlasPerson[] = [];
|
||||
for (const id of [...new Set(ids)].slice(0, ATLAS_PEOPLE_MAX)) {
|
||||
if (await this.isHidden(id)) continue;
|
||||
out.push(await this.person(id));
|
||||
}
|
||||
return out;
|
||||
const asked = [...new Set(ids)].slice(0, ATLAS_PEOPLE_MAX);
|
||||
// Each traveller is read on their own; the order of the answer is the order asked.
|
||||
const answers = await Promise.all(asked.map(async (id) => ((await this.isHidden(id)) ? null : await this.person(id))));
|
||||
return answers.filter((p): p is AtlasPerson => p !== null);
|
||||
}
|
||||
|
||||
/** Every badge of one user, earned or not, the way their Passport judges them. */
|
||||
|
||||
@@ -255,7 +255,7 @@ const TIERS: BadgeTier[] = ['bronze', 'silver', 'gold'];
|
||||
function steps(values: number[]): Array<{ target: number; tier: BadgeTier }> {
|
||||
return values.map((target, i) => ({
|
||||
target,
|
||||
tier: i === values.length - 1 && values.length > 3 ? 'aurora' : TIERS[Math.min(i, 2)],
|
||||
tier: i === values.length - 1 && values.length > 3 ? 'aurora' : (TIERS[Math.min(i, 2)] ?? 'gold'),
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ const atlas: TranslationStrings = {
|
||||
'atlas.badge.regionsAllDesc': '{country} ölkəsinin bütün regionlarını gəz.',
|
||||
'atlas.badge.regionsHalfDesc': '{country} ölkəsinin regionlarının yarısını gəz.',
|
||||
'atlas.badge.regionsN': '{count} region',
|
||||
'atlas.badge.regionsN.one': '{count} region',
|
||||
'atlas.badge.regionsN.one': '{count} region', // same-as-en
|
||||
'atlas.badge.regionsNDesc': '{count} ştat, əyalət və ya region gəz.',
|
||||
'atlas.badge.regionsNDesc.one': '{count} ştat, əyalət və ya region gəz.',
|
||||
'atlas.badge.sevenDesc': 'Antarktida daxil olmaqla yeddi qitənin hamısı.',
|
||||
|
||||
@@ -65,7 +65,7 @@ const atlas: TranslationStrings = {
|
||||
'atlas.globe.continents': 'Continentes',
|
||||
'atlas.globe.colorBy': 'Colorir por',
|
||||
'atlas.globe.colorCountry': 'País',
|
||||
'atlas.globe.colorStatus': 'Status',
|
||||
'atlas.globe.colorStatus': 'Status', // same-as-en
|
||||
'atlas.globe.colorYear': 'Ano',
|
||||
'atlas.globe.visited': 'Visitados',
|
||||
'atlas.globe.flights': 'Voos',
|
||||
@@ -127,7 +127,7 @@ const atlas: TranslationStrings = {
|
||||
'atlas.badge.first': 'Primeiro país',
|
||||
'atlas.badge.firstDesc': 'Marque ou visite seu primeiro país.',
|
||||
'atlas.badge.flightsDesc': 'Faça {count} voos.',
|
||||
'atlas.badge.flightsDesc.one': 'Faça seu primeiro voo.',
|
||||
'atlas.badge.flightsDesc.one': 'Faça {count} voo.',
|
||||
'atlas.badge.hemispheres': 'Leste e oeste',
|
||||
'atlas.badge.hemispheresDesc': 'Visite países dos dois lados de Greenwich.',
|
||||
'atlas.badge.islandsDesc': 'Visite {count} países insulares.',
|
||||
@@ -149,17 +149,17 @@ const atlas: TranslationStrings = {
|
||||
'atlas.badge.ultra': 'Ultra longo curso',
|
||||
'atlas.badge.ultraDesc': 'Um único voo de mais de 13.000 km.',
|
||||
'atlas.badge.wishes': '{count} desejos realizados',
|
||||
'atlas.badge.wishes.one': 'Primeiro desejo realizado',
|
||||
'atlas.badge.wishes.one': '{count} desejo realizado',
|
||||
'atlas.badge.wishesDesc': 'Chegue a {count} lugares da sua lista de desejos.',
|
||||
'atlas.badge.wishesDesc.one': 'Chegue a um lugar da sua lista de desejos.',
|
||||
'atlas.badge.wishesDesc.one': 'Chegue a {count} lugar da sua lista de desejos.',
|
||||
'atlas.badgeCat.collector': 'Colecionador',
|
||||
'atlas.badgeCat.continents': 'Continentes',
|
||||
'atlas.badgeCat.countries': 'Países',
|
||||
'atlas.badgeCat.explorer': 'Explorador',
|
||||
'atlas.badgeCat.flights': 'Voos',
|
||||
'atlas.badgeCat.regions': 'Regiões',
|
||||
'atlas.badgeTier.aurora': 'Aurora',
|
||||
'atlas.badgeTier.bronze': 'Bronze',
|
||||
'atlas.badgeTier.aurora': 'Aurora', // same-as-en
|
||||
'atlas.badgeTier.bronze': 'Bronze', // same-as-en
|
||||
'atlas.badgeTier.gold': 'Ouro',
|
||||
'atlas.badgeTier.silver': 'Prata',
|
||||
'atlas.globe.howTo': 'Como conseguir',
|
||||
|
||||
@@ -62,7 +62,7 @@ const atlas: TranslationStrings = {
|
||||
'atlas.planned': 'Planificat',
|
||||
'atlas.showPlanned': 'Mostra els països planificats',
|
||||
'atlas.antarctica': 'Antàrtida',
|
||||
'atlas.globe.continents': 'Continents',
|
||||
'atlas.globe.continents': 'Continents', // same-as-en
|
||||
'atlas.globe.colorBy': 'Acoloreix per',
|
||||
'atlas.globe.colorCountry': 'País',
|
||||
'atlas.globe.colorStatus': 'Estat',
|
||||
@@ -113,8 +113,8 @@ const atlas: TranslationStrings = {
|
||||
'atlas.badge.burstDesc': 'Arriba a {count} països nous en un any.',
|
||||
'atlas.badge.burstDesc.one': 'Arriba a {count} país nou en un any.',
|
||||
'atlas.badge.continentsDesc': 'Visita els sis continents habitats.',
|
||||
'atlas.badge.continentsN': '{count} continents',
|
||||
'atlas.badge.continentsN.one': '{count} continent',
|
||||
'atlas.badge.continentsN': '{count} continents', // same-as-en
|
||||
'atlas.badge.continentsN.one': '{count} continent', // same-as-en
|
||||
'atlas.badge.continentsNDesc': 'Trepitja {count} continents.',
|
||||
'atlas.badge.continentsNDesc.one': 'Trepitja {count} continent.',
|
||||
'atlas.badge.countriesDesc': 'Visita {count} països.',
|
||||
@@ -137,7 +137,7 @@ const atlas: TranslationStrings = {
|
||||
'atlas.badge.polarDesc': "Visita un país que arriba a l'Àrtic.",
|
||||
'atlas.badge.regionsAllDesc': 'Visita totes les regions de {country}.',
|
||||
'atlas.badge.regionsHalfDesc': 'Visita la meitat de les regions de {country}.',
|
||||
'atlas.badge.regionsN': '{count} regions',
|
||||
'atlas.badge.regionsN': '{count} regions', // same-as-en
|
||||
'atlas.badge.regionsN.one': '{count} regió',
|
||||
'atlas.badge.regionsNDesc': 'Visita {count} estats, províncies o regions.',
|
||||
'atlas.badge.regionsNDesc.one': 'Visita {count} estat, província o regió.',
|
||||
@@ -153,13 +153,13 @@ const atlas: TranslationStrings = {
|
||||
'atlas.badge.wishesDesc': 'Arriba a {count} llocs de la teva llista de desitjos.',
|
||||
'atlas.badge.wishesDesc.one': 'Arriba a un lloc de la teva llista de desitjos.',
|
||||
'atlas.badgeCat.collector': 'Col·leccionista',
|
||||
'atlas.badgeCat.continents': 'Continents',
|
||||
'atlas.badgeCat.continents': 'Continents', // same-as-en
|
||||
'atlas.badgeCat.countries': 'Països',
|
||||
'atlas.badgeCat.explorer': 'Explorador',
|
||||
'atlas.badgeCat.flights': 'Vols',
|
||||
'atlas.badgeCat.regions': 'Regions',
|
||||
'atlas.badgeTier.aurora': 'Aurora',
|
||||
'atlas.badgeTier.bronze': 'Bronze',
|
||||
'atlas.badgeCat.regions': 'Regions', // same-as-en
|
||||
'atlas.badgeTier.aurora': 'Aurora', // same-as-en
|
||||
'atlas.badgeTier.bronze': 'Bronze', // same-as-en
|
||||
'atlas.badgeTier.gold': 'Or',
|
||||
'atlas.badgeTier.silver': 'Plata',
|
||||
'atlas.globe.howTo': 'Com aconseguir-ho',
|
||||
|
||||
@@ -159,7 +159,7 @@ const atlas: TranslationStrings = {
|
||||
'atlas.badge.regionsAllDesc': 'Navštiv každý region: {country}.',
|
||||
'atlas.badge.regionsHalfDesc': 'Navštiv polovinu regionů: {country}.',
|
||||
'atlas.badge.regionsN': '{count} regionů',
|
||||
'atlas.badge.regionsN.one': '{count} region',
|
||||
'atlas.badge.regionsN.one': '{count} region', // same-as-en
|
||||
'atlas.badge.regionsN.few': '{count} regiony',
|
||||
'atlas.badge.regionsNDesc': 'Navštiv {count} států, provincií nebo regionů.',
|
||||
'atlas.badge.regionsNDesc.one': 'Navštiv {count} stát, provincii nebo region.',
|
||||
|
||||
@@ -65,7 +65,7 @@ const atlas: TranslationStrings = {
|
||||
'atlas.globe.continents': 'Kontinente',
|
||||
'atlas.globe.colorBy': 'Färben nach',
|
||||
'atlas.globe.colorCountry': 'Land',
|
||||
'atlas.globe.colorStatus': 'Status',
|
||||
'atlas.globe.colorStatus': 'Status', // same-as-en
|
||||
'atlas.globe.colorYear': 'Jahr',
|
||||
'atlas.globe.visited': 'Besucht',
|
||||
'atlas.globe.flights': 'Flüge',
|
||||
@@ -163,9 +163,9 @@ const atlas: TranslationStrings = {
|
||||
'atlas.badgeCat.collector': 'Sammler',
|
||||
'atlas.globe.howTo': 'So bekommst du es',
|
||||
'atlas.globe.progress': 'Fortschritt',
|
||||
'atlas.badgeTier.bronze': 'Bronze',
|
||||
'atlas.badgeTier.bronze': 'Bronze', // same-as-en
|
||||
'atlas.badgeTier.silver': 'Silber',
|
||||
'atlas.badgeTier.gold': 'Gold',
|
||||
'atlas.badgeTier.gold': 'Gold', // same-as-en
|
||||
'atlas.badgeTier.aurora': 'Polarlicht',
|
||||
'atlas.globe.showOnGlobe': 'Auf dem Globus zeigen',
|
||||
'atlas.globe.reached': 'Erreicht',
|
||||
|
||||
@@ -158,7 +158,7 @@ const atlas: TranslationStrings = {
|
||||
'atlas.badgeCat.explorer': 'Explorador',
|
||||
'atlas.badgeCat.flights': 'Vuelos',
|
||||
'atlas.badgeCat.regions': 'Regiones',
|
||||
'atlas.badgeTier.aurora': 'Aurora',
|
||||
'atlas.badgeTier.aurora': 'Aurora', // same-as-en
|
||||
'atlas.badgeTier.bronze': 'Bronce',
|
||||
'atlas.badgeTier.gold': 'Oro',
|
||||
'atlas.badgeTier.silver': 'Plata',
|
||||
|
||||
+10
-10
@@ -62,7 +62,7 @@ const atlas: TranslationStrings = {
|
||||
'atlas.planned': 'Prévu',
|
||||
'atlas.showPlanned': 'Afficher les pays prévus',
|
||||
'atlas.antarctica': 'Antarctique',
|
||||
'atlas.globe.continents': 'Continents',
|
||||
'atlas.globe.continents': 'Continents', // same-as-en
|
||||
'atlas.globe.colorBy': 'Colorier par',
|
||||
'atlas.globe.colorCountry': 'Pays',
|
||||
'atlas.globe.colorStatus': 'Statut',
|
||||
@@ -89,7 +89,7 @@ const atlas: TranslationStrings = {
|
||||
'atlas.badge.streak.one': '{count} année de suite',
|
||||
'atlas.badge.islands': '{count} pays insulaires',
|
||||
'atlas.badge.islands.one': '{count} pays insulaire',
|
||||
'atlas.globe.badges': 'Badges',
|
||||
'atlas.globe.badges': 'Badges', // same-as-en
|
||||
'atlas.globe.travellers': 'Voyageurs',
|
||||
'atlas.globe.reachedIn': 'Atteint en {year}',
|
||||
'atlas.globe.collected': '{earned} sur {total} collectés',
|
||||
@@ -117,8 +117,8 @@ const atlas: TranslationStrings = {
|
||||
'atlas.badge.burstDesc.one': 'Découvrez {count} nouveau pays en un an.',
|
||||
'atlas.badge.burstDesc.many': 'Découvrez {count} nouveaux pays en un an.',
|
||||
'atlas.badge.continentsDesc': 'Visitez les six continents habités.',
|
||||
'atlas.badge.continentsN': '{count} continents',
|
||||
'atlas.badge.continentsN.one': '{count} continent',
|
||||
'atlas.badge.continentsN': '{count} continents', // same-as-en
|
||||
'atlas.badge.continentsN.one': '{count} continent', // same-as-en
|
||||
'atlas.badge.continentsN.many': '{count} continents',
|
||||
'atlas.badge.continentsNDesc': 'Posez le pied sur {count} continents.',
|
||||
'atlas.badge.continentsNDesc.one': 'Posez le pied sur {count} continent.',
|
||||
@@ -134,7 +134,7 @@ const atlas: TranslationStrings = {
|
||||
'atlas.badge.first': 'Premier pays',
|
||||
'atlas.badge.firstDesc': 'Marquez ou visitez votre premier pays.',
|
||||
'atlas.badge.flightsDesc': 'Effectuez {count} vols.',
|
||||
'atlas.badge.flightsDesc.one': 'Effectuez votre premier vol.',
|
||||
'atlas.badge.flightsDesc.one': 'Effectuez {count} vol.',
|
||||
'atlas.badge.flightsDesc.many': 'Effectuez {count} vols.',
|
||||
'atlas.badge.hemispheres': 'Est et ouest',
|
||||
'atlas.badge.hemispheresDesc': 'Visitez des pays des deux côtés de Greenwich.',
|
||||
@@ -161,19 +161,19 @@ const atlas: TranslationStrings = {
|
||||
'atlas.badge.ultra': 'Ultra long-courrier',
|
||||
'atlas.badge.ultraDesc': 'Effectuez un seul vol de plus de 13 000 km.',
|
||||
'atlas.badge.wishes': '{count} souhaits réalisés',
|
||||
'atlas.badge.wishes.one': 'Premier souhait réalisé',
|
||||
'atlas.badge.wishes.one': '{count} souhait réalisé',
|
||||
'atlas.badge.wishes.many': '{count} souhaits réalisés',
|
||||
'atlas.badge.wishesDesc': 'Atteignez {count} lieux de votre liste d’envies.',
|
||||
'atlas.badge.wishesDesc.one': 'Atteignez un lieu de votre liste d’envies.',
|
||||
'atlas.badge.wishesDesc.one': 'Atteignez {count} lieu de votre liste d’envies.',
|
||||
'atlas.badge.wishesDesc.many': 'Atteignez {count} lieux de votre liste d’envies.',
|
||||
'atlas.badgeCat.collector': 'Collectionneur',
|
||||
'atlas.badgeCat.continents': 'Continents',
|
||||
'atlas.badgeCat.continents': 'Continents', // same-as-en
|
||||
'atlas.badgeCat.countries': 'Pays',
|
||||
'atlas.badgeCat.explorer': 'Explorateur',
|
||||
'atlas.badgeCat.flights': 'Vols',
|
||||
'atlas.badgeCat.regions': 'Régions',
|
||||
'atlas.badgeTier.aurora': 'Aurore',
|
||||
'atlas.badgeTier.bronze': 'Bronze',
|
||||
'atlas.badgeTier.bronze': 'Bronze', // same-as-en
|
||||
'atlas.badgeTier.gold': 'Or',
|
||||
'atlas.badgeTier.silver': 'Argent',
|
||||
'atlas.globe.howTo': 'Comment l’obtenir',
|
||||
@@ -209,7 +209,7 @@ const atlas: TranslationStrings = {
|
||||
'atlas.globe.tourCount.one': '{count} circuit',
|
||||
'atlas.globe.wishJustName': 'Garder « {name} » sans lieu',
|
||||
'atlas.globe.wishNoPlace': 'Aucun lieu sur la carte',
|
||||
'atlas.globe.wishNote': 'Note',
|
||||
'atlas.globe.wishNote': 'Note', // same-as-en
|
||||
'atlas.globe.wishSave': "Ajouter à la liste d'envies",
|
||||
'atlas.globe.wishSearch': 'Chercher un lieu ou saisir un nom',
|
||||
'atlas.globe.wishWhen': 'Quand ?',
|
||||
|
||||
@@ -57,7 +57,7 @@ const atlas: TranslationStrings = {
|
||||
'atlas.globe.continents': 'Benua',
|
||||
'atlas.globe.colorBy': 'Warnai menurut',
|
||||
'atlas.globe.colorCountry': 'Negara',
|
||||
'atlas.globe.colorStatus': 'Status',
|
||||
'atlas.globe.colorStatus': 'Status', // same-as-en
|
||||
'atlas.globe.colorYear': 'Tahun',
|
||||
'atlas.globe.visited': 'Dikunjungi',
|
||||
'atlas.globe.flights': 'Penerbangan',
|
||||
@@ -132,7 +132,7 @@ const atlas: TranslationStrings = {
|
||||
'atlas.badgeCat.explorer': 'Penjelajah',
|
||||
'atlas.badgeCat.flights': 'Penerbangan',
|
||||
'atlas.badgeCat.regions': 'Wilayah',
|
||||
'atlas.badgeTier.aurora': 'Aurora',
|
||||
'atlas.badgeTier.aurora': 'Aurora', // same-as-en
|
||||
'atlas.badgeTier.bronze': 'Perunggu',
|
||||
'atlas.badgeTier.gold': 'Emas',
|
||||
'atlas.badgeTier.silver': 'Perak',
|
||||
|
||||
@@ -172,7 +172,7 @@ const atlas: TranslationStrings = {
|
||||
'atlas.badgeCat.explorer': 'Esploratore',
|
||||
'atlas.badgeCat.flights': 'Voli',
|
||||
'atlas.badgeCat.regions': 'Regioni',
|
||||
'atlas.badgeTier.aurora': 'Aurora',
|
||||
'atlas.badgeTier.aurora': 'Aurora', // same-as-en
|
||||
'atlas.badgeTier.bronze': 'Bronzo',
|
||||
'atlas.badgeTier.gold': 'Oro',
|
||||
'atlas.badgeTier.silver': 'Argento',
|
||||
@@ -206,7 +206,7 @@ const atlas: TranslationStrings = {
|
||||
'atlas.globe.stages': 'Livelli',
|
||||
'atlas.globe.toGo': 'Ancora da fare',
|
||||
'atlas.globe.tourCount': '{count} tour',
|
||||
'atlas.globe.tourCount.one': '{count} tour',
|
||||
'atlas.globe.tourCount.one': '{count} tour', // same-as-en
|
||||
'atlas.globe.wishJustName': 'Usa «{name}» senza luogo',
|
||||
'atlas.globe.wishNoPlace': 'Nessun luogo sulla mappa',
|
||||
'atlas.globe.wishNote': 'Nota',
|
||||
|
||||
@@ -65,7 +65,7 @@ const atlas: TranslationStrings = {
|
||||
'atlas.globe.continents': 'Continenten',
|
||||
'atlas.globe.colorBy': 'Kleur op',
|
||||
'atlas.globe.colorCountry': 'Land',
|
||||
'atlas.globe.colorStatus': 'Status',
|
||||
'atlas.globe.colorStatus': 'Status', // same-as-en
|
||||
'atlas.globe.colorYear': 'Jaar',
|
||||
'atlas.globe.visited': 'Bezocht',
|
||||
'atlas.globe.flights': 'Vluchten',
|
||||
@@ -89,7 +89,7 @@ const atlas: TranslationStrings = {
|
||||
'atlas.badge.streak.one': '{count} jaar op rij',
|
||||
'atlas.badge.islands': '{count} eilandstaten',
|
||||
'atlas.badge.islands.one': '{count} eilandstaat',
|
||||
'atlas.globe.badges': 'Badges',
|
||||
'atlas.globe.badges': 'Badges', // same-as-en
|
||||
'atlas.globe.travellers': 'Reizigers',
|
||||
'atlas.globe.reachedIn': 'Bereikt in {year}',
|
||||
'atlas.globe.collected': '{earned} van {total} verzameld',
|
||||
@@ -114,7 +114,7 @@ const atlas: TranslationStrings = {
|
||||
'atlas.badge.burstDesc.one': 'Bereik {count} nieuw land in één jaar.',
|
||||
'atlas.badge.continentsDesc': 'Bezoek alle zes bewoonde continenten.',
|
||||
'atlas.badge.continentsN': '{count} continenten',
|
||||
'atlas.badge.continentsN.one': '{count} continent',
|
||||
'atlas.badge.continentsN.one': '{count} continent', // same-as-en
|
||||
'atlas.badge.continentsNDesc': 'Zet voet op {count} continenten.',
|
||||
'atlas.badge.continentsNDesc.one': 'Zet voet op {count} continent.',
|
||||
'atlas.badge.countriesDesc': 'Bezoek {count} landen.',
|
||||
@@ -158,7 +158,7 @@ const atlas: TranslationStrings = {
|
||||
'atlas.badgeCat.explorer': 'Ontdekker',
|
||||
'atlas.badgeCat.flights': 'Vluchten',
|
||||
'atlas.badgeCat.regions': 'Regio’s',
|
||||
'atlas.badgeTier.aurora': 'Aurora',
|
||||
'atlas.badgeTier.aurora': 'Aurora', // same-as-en
|
||||
'atlas.badgeTier.bronze': 'Brons',
|
||||
'atlas.badgeTier.gold': 'Goud',
|
||||
'atlas.badgeTier.silver': 'Zilver',
|
||||
@@ -191,8 +191,8 @@ const atlas: TranslationStrings = {
|
||||
'atlas.globe.someday': 'Ooit',
|
||||
'atlas.globe.stages': 'Niveaus',
|
||||
'atlas.globe.toGo': 'Nog te gaan',
|
||||
'atlas.globe.tourCount': '{count} tours',
|
||||
'atlas.globe.tourCount.one': '{count} tour',
|
||||
'atlas.globe.tourCount': '{count} tours', // same-as-en
|
||||
'atlas.globe.tourCount.one': '{count} tour', // same-as-en
|
||||
'atlas.globe.wishJustName': '“{name}” zonder plek gebruiken',
|
||||
'atlas.globe.wishNoPlace': 'Geen plek op de kaart',
|
||||
'atlas.globe.wishNote': 'Notitie',
|
||||
|
||||
@@ -81,7 +81,7 @@ const atlas: TranslationStrings = {
|
||||
'atlas.globe.continents': 'Kontynenty',
|
||||
'atlas.globe.colorBy': 'Koloruj według',
|
||||
'atlas.globe.colorCountry': 'Kraj',
|
||||
'atlas.globe.colorStatus': 'Status',
|
||||
'atlas.globe.colorStatus': 'Status', // same-as-en
|
||||
'atlas.globe.colorYear': 'Rok',
|
||||
'atlas.globe.visited': 'Odwiedzone',
|
||||
'atlas.globe.flights': 'Loty',
|
||||
@@ -125,7 +125,7 @@ const atlas: TranslationStrings = {
|
||||
'atlas.globe.onlyYou': 'tylko ty',
|
||||
'atlas.globe.gaps': 'Gdzie żadne z was jeszcze nie było',
|
||||
'atlas.globe.layers': 'Warstwy',
|
||||
'atlas.globe.ranking': 'Ranking',
|
||||
'atlas.globe.ranking': 'Ranking', // same-as-en
|
||||
'atlas.globe.compareOnGlobe': 'Porównaj na globusie',
|
||||
'atlas.globe.noBadgesYet': 'Jeszcze brak odznak',
|
||||
'atlas.badge.airports': '{count} lotnisk',
|
||||
@@ -180,7 +180,7 @@ const atlas: TranslationStrings = {
|
||||
'atlas.badge.regionsAllDesc': 'Odwiedź wszystkie regiony: {country}.',
|
||||
'atlas.badge.regionsHalfDesc': 'Odwiedź połowę regionów: {country}.',
|
||||
'atlas.badge.regionsN': '{count} regionów',
|
||||
'atlas.badge.regionsN.one': '{count} region',
|
||||
'atlas.badge.regionsN.one': '{count} region', // same-as-en
|
||||
'atlas.badge.regionsN.few': '{count} regiony',
|
||||
'atlas.badge.regionsN.many': '{count} regionów',
|
||||
'atlas.badge.regionsNDesc': 'Odwiedź {count} stanów, prowincji lub regionów.',
|
||||
|
||||
@@ -138,7 +138,7 @@ const atlas: TranslationStrings = {
|
||||
'atlas.badge.regionsAllDesc': 'Besök alla regioner i {country}.',
|
||||
'atlas.badge.regionsHalfDesc': 'Besök hälften av regionerna i {country}.',
|
||||
'atlas.badge.regionsN': '{count} regioner',
|
||||
'atlas.badge.regionsN.one': '{count} region',
|
||||
'atlas.badge.regionsN.one': '{count} region', // same-as-en
|
||||
'atlas.badge.regionsNDesc': 'Besök {count} delstater, provinser eller regioner.',
|
||||
'atlas.badge.regionsNDesc.one': 'Besök {count} delstat, provins eller region.',
|
||||
'atlas.badge.sevenDesc': 'Alla sju världsdelar, Antarktis inräknat.',
|
||||
@@ -161,7 +161,7 @@ const atlas: TranslationStrings = {
|
||||
'atlas.badgeTier.aurora': 'Norrsken',
|
||||
'atlas.badgeTier.bronze': 'Brons',
|
||||
'atlas.badgeTier.gold': 'Guld',
|
||||
'atlas.badgeTier.silver': 'Silver',
|
||||
'atlas.badgeTier.silver': 'Silver', // same-as-en
|
||||
'atlas.globe.howTo': 'Så får du det',
|
||||
'atlas.globe.hub': 'Atlas',
|
||||
'atlas.globe.newBadge': 'Nytt märke',
|
||||
|
||||
@@ -158,7 +158,7 @@ const atlas: TranslationStrings = {
|
||||
'atlas.badgeCat.explorer': 'Kaşif',
|
||||
'atlas.badgeCat.flights': 'Uçuşlar',
|
||||
'atlas.badgeCat.regions': 'Bölgeler',
|
||||
'atlas.badgeTier.aurora': 'Aurora',
|
||||
'atlas.badgeTier.aurora': 'Kutup Işığı',
|
||||
'atlas.badgeTier.bronze': 'Bronz',
|
||||
'atlas.badgeTier.gold': 'Altın',
|
||||
'atlas.badgeTier.silver': 'Gümüş',
|
||||
|
||||
Reference in New Issue
Block a user