diff --git a/client/scripts/eslint-baseline.json b/client/scripts/eslint-baseline.json index 08666b7f2..343fc5c6d 100644 --- a/client/scripts/eslint-baseline.json +++ b/client/scripts/eslint-baseline.json @@ -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 } diff --git a/client/scripts/rtl-baseline.json b/client/scripts/rtl-baseline.json index d3fb5e621..62b7815b6 100644 --- a/client/scripts/rtl-baseline.json +++ b/client/scripts/rtl-baseline.json @@ -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, diff --git a/client/scripts/rtl-disable-baseline.json b/client/scripts/rtl-disable-baseline.json index e8f5d8afe..3e7341c91 100644 --- a/client/scripts/rtl-disable-baseline.json +++ b/client/scripts/rtl-disable-baseline.json @@ -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 } diff --git a/client/scripts/theme-baseline.json b/client/scripts/theme-baseline.json index 82e739675..dc7819c3b 100644 --- a/client/scripts/theme-baseline.json +++ b/client/scripts/theme-baseline.json @@ -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, diff --git a/client/scripts/theme-disable-baseline.json b/client/scripts/theme-disable-baseline.json index 4a856327b..540b1978d 100644 --- a/client/scripts/theme-disable-baseline.json +++ b/client/scripts/theme-disable-baseline.json @@ -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 } diff --git a/client/src/components/Atlas/tourActivity/tourActivityParts.tsx b/client/src/components/Atlas/tourActivity/tourActivityParts.tsx index 0e92c93a7..bc32c8436 100644 --- a/client/src/components/Atlas/tourActivity/tourActivityParts.tsx +++ b/client/src/components/Atlas/tourActivity/tourActivityParts.tsx @@ -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(); diff --git a/client/src/components/Atlas/tourActivity/tourActivityReading.ts b/client/src/components/Atlas/tourActivity/tourActivityReading.ts index 42704deb3..3a03f8c88 100644 --- a/client/src/components/Atlas/tourActivity/tourActivityReading.ts +++ b/client/src/components/Atlas/tourActivity/tourActivityReading.ts @@ -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; @@ -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)); +} diff --git a/client/src/components/AtlasGlobe/AtlasGlobe.tsx b/client/src/components/AtlasGlobe/AtlasGlobe.tsx index ccd26249e..58c6e39b0 100644 --- a/client/src/components/AtlasGlobe/AtlasGlobe.tsx +++ b/client/src/components/AtlasGlobe/AtlasGlobe.tsx @@ -85,18 +85,20 @@ const AtlasGlobe = forwardRef(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); diff --git a/client/src/components/AtlasGlobe/BadgeMedal.tsx b/client/src/components/AtlasGlobe/BadgeMedal.tsx index a23c3590b..f036b28ec 100644 --- a/client/src/components/AtlasGlobe/BadgeMedal.tsx +++ b/client/src/components/AtlasGlobe/BadgeMedal.tsx @@ -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 = { - 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 diff --git a/client/src/components/AtlasGlobe/DawarichMark.tsx b/client/src/components/AtlasGlobe/DawarichMark.tsx new file mode 100644 index 000000000..7d8f96f25 --- /dev/null +++ b/client/src/components/AtlasGlobe/DawarichMark.tsx @@ -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 ( + + + + ); +} diff --git a/client/src/components/AtlasGlobe/atlasGlobe.css b/client/src/components/AtlasGlobe/atlasGlobe.css index ecd3f7a8a..680e48951 100644 --- a/client/src/components/AtlasGlobe/atlasGlobe.css +++ b/client/src/components/AtlasGlobe/atlasGlobe.css @@ -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; diff --git a/client/src/components/AtlasGlobe/badgeTiers.ts b/client/src/components/AtlasGlobe/badgeTiers.ts new file mode 100644 index 000000000..8c69771d1 --- /dev/null +++ b/client/src/components/AtlasGlobe/badgeTiers.ts @@ -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 = { + 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 +}; diff --git a/client/src/components/AtlasGlobe/globeLabels.ts b/client/src/components/AtlasGlobe/globeLabels.ts index e3acd5c48..6b78ec34b 100644 --- a/client/src/components/AtlasGlobe/globeLabels.ts +++ b/client/src/components/AtlasGlobe/globeLabels.ts @@ -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(); - 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(); + 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 { + const { width, height } = engine.vp; + const focus = centreCountry(engine); + const named = new Set(); + 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, + 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(); diff --git a/client/src/components/Dawarich/useDawarichAtlas.ts b/client/src/components/Dawarich/useDawarichAtlas.ts index 8e39fdf59..f0d35f6af 100644 --- a/client/src/components/Dawarich/useDawarichAtlas.ts +++ b/client/src/components/Dawarich/useDawarichAtlas.ts @@ -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; + +/** 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[] { + 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); +} diff --git a/client/src/mobile/screens/atlas/MAtlasGlobe.tsx b/client/src/mobile/screens/atlas/MAtlasGlobe.tsx index 45eaa254f..55c9df159 100644 --- a/client/src/mobile/screens/atlas/MAtlasGlobe.tsx +++ b/client/src/mobile/screens/atlas/MAtlasGlobe.tsx @@ -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(null); + const skyRef = React.useRef(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).
- +
diff --git a/client/src/mobile/screens/atlas/MAtlasLayersSheet.tsx b/client/src/mobile/screens/atlas/MAtlasLayersSheet.tsx index 1373e5ad7..cbe4a69f2 100644 --- a/client/src/mobile/screens/atlas/MAtlasLayersSheet.tsx +++ b/client/src/mobile/screens/atlas/MAtlasLayersSheet.tsx @@ -89,7 +89,7 @@ export default function MAtlasLayersSheet({
{s.t('atlas.globe.colorBy')}
- + value={s.colorMode} onChange={s.setColorMode} options={modes} />
diff --git a/client/src/mobile/screens/atlas/hub/MAtlasHub.tsx b/client/src/mobile/screens/atlas/hub/MAtlasHub.tsx index b7678365b..d40e0ff5e 100644 --- a/client/src/mobile/screens/atlas/hub/MAtlasHub.tsx +++ b/client/src/mobile/screens/atlas/hub/MAtlasHub.tsx @@ -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'; diff --git a/client/src/mobile/screens/atlas/hub/MHubBadges.tsx b/client/src/mobile/screens/atlas/hub/MHubBadges.tsx index a00bcd929..11b40dc9f 100644 --- a/client/src/mobile/screens/atlas/hub/MHubBadges.tsx +++ b/client/src/mobile/screens/atlas/hub/MHubBadges.tsx @@ -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 {titleOf(s, b)} - + {b.earned ? (b.year ?? '') : `${formatNum(b.current)} / ${formatNum(b.target)}`} @@ -196,7 +197,9 @@ function BadgeSheet({ progress={x.target ? x.current / x.target : 0} label={medalLabel(x)} /> - {titleOf(s, x)} + + {titleOf(s, x)} + ))} diff --git a/client/src/mobile/screens/atlas/hub/MHubDawarich.tsx b/client/src/mobile/screens/atlas/hub/MHubDawarich.tsx index 78ee73683..f9527bbbd 100644 --- a/client/src/mobile/screens/atlas/hub/MHubDawarich.tsx +++ b/client/src/mobile/screens/atlas/hub/MHubDawarich.tsx @@ -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 (
- value={d.tab} onChange={d.setTab} options={[ diff --git a/client/src/mobile/screens/atlas/hub/MHubOverview.tsx b/client/src/mobile/screens/atlas/hub/MHubOverview.tsx index 1368e44c7..3e6318431 100644 --- a/client/src/mobile/screens/atlas/hub/MHubOverview.tsx +++ b/client/src/mobile/screens/atlas/hub/MHubOverview.tsx @@ -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' && ( {next.daysUntil} - {s.t('atlas.daysLeft')} + + {s.t('atlas.daysLeft')} + )} @@ -77,21 +80,7 @@ export default function MHubOverview({ s }: { s: AtlasGlobeState }): React.React /> )} - +
); } diff --git a/client/src/mobile/screens/atlas/hub/MHubTours.tsx b/client/src/mobile/screens/atlas/hub/MHubTours.tsx index ef79b336c..3c02d9109 100644 --- a/client/src/mobile/screens/atlas/hub/MHubTours.tsx +++ b/client/src/mobile/screens/atlas/hub/MHubTours.tsx @@ -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, diff --git a/client/src/mobile/screens/atlas/hub/MHubTravellers.tsx b/client/src/mobile/screens/atlas/hub/MHubTravellers.tsx index a03c79787..9614182f9 100644 --- a/client/src/mobile/screens/atlas/hub/MHubTravellers.tsx +++ b/client/src/mobile/screens/atlas/hub/MHubTravellers.tsx @@ -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 {p.username} {isMe && ( - + {s.t('atlas.globe.you')} )} @@ -100,7 +104,9 @@ export default function MHubTravellers({ s }: { s: AtlasGlobeState }): React.Rea {p.countries} - {s.t('atlas.countries')} + + {s.t('atlas.countries')} +
- {value} + + {value} + {unit && {unit}}
{children &&
{children}
} @@ -60,7 +63,9 @@ export function MHubTiles({ tiles, cols = 2 }: { tiles: MHubTileData[]; cols?: 2 {value} - {label} + + {label} + ); } @@ -73,12 +78,7 @@ export function MHubTiles({ tiles, cols = 2 }: { tiles: MHubTileData[]; cols?: 2 {value} {label}
-