Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
fix: replace the broken FSQ Places example and show tileset errors (#3796)
Igor Dykhta87fa5fd914da
diff --git a/AGENTS.md b/AGENTS.mdindex 3c902e89e..19b32d974 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -16,9 +16,10 @@ Never claim a task is complete if `yarn agent:verify` fails.If verification fails:- Investigate the failure.-- Fix failures caused by the change.+- Make the smallest change that addresses that failure.- Rerun verification.-- Continue until it passes.++Stop editing when the same failure repeats, or the next edit would reach files the failure does not point at, replace a working approach, or clean up unrelated code. Report the failure and what you changed.If a failure appears unrelated or pre-existing:@@ -33,7 +34,7 @@ Before changing code:2. Read nearby tests.3. Search for similar patterns elsewhere in kepler.gl.4. Prefer existing abstractions over introducing new ones.-5. Avoid unrelated refactoring.+5. Avoid unrelated refactoring. Do not rename public symbols, reformat unrelated files, or upgrade dependencies unless the task requires it.## Testing@@ -45,6 +46,8 @@ Before handing work to a human, always run:yarn agent:verify```+Report each command as `PASS`, `FAILED`, or `NOT RUN`. Do not report a command you did not run.+`agent:verify` is the blocking Node.js CI gates that pass on a clean tree:- `yarn check-circular-deps`@@ -72,16 +75,26 @@ When behavior is visible in the UI:3. Check the browser console for errors.4. Capture screenshots showing the result where useful.+## Decisions++Proceed on local choices: naming, test layout, an existing pattern, an obvious type fix.++Ask first for a public API change, saved-config compatibility, product behavior, or a new architectural abstraction.+## Pull requests-PR descriptions must contain:+PR descriptions must be short and contain:- What changed- Why- Important implementation details-- Tests added or changed-- Verification commands and results-- Screenshots for visual changes+- Verification results (`PASS`, `FAILED`, or `NOT RUN`)- Remaining uncertainties or decisions+- A checklist of what to review++Optional contents:++- Screenshots for visual changes+Do not hide uncertainty. If product or architectural judgment is required, explicitly mark it for human review.diff --git a/src/components/src/modals/load-data-modal.tsx b/src/components/src/modals/load-data-modal.tsxindex c762cc2d5..29696d4aa 100644--- a/src/components/src/modals/load-data-modal.tsx+++ b/src/components/src/modals/load-data-modal.tsx@@ -3,12 +3,13 @@import React, {useCallback, useEffect, useRef, useState} from 'react';import styled, {keyframes} from 'styled-components';+import copy from 'copy-to-clipboard';import get from 'es-toolkit/compat/get';import {IntlShape, useIntl} from 'react-intl';import {Button} from '../common';import Checkbox from '../common/checkbox';-import {Docs} from '../common/icons';+import {Checkmark, Copy, Docs} from '../common/icons';import TippyTooltip from '../common/tippy-tooltip';import FileUploadFactory from '../common/file-uploader/file-upload';import {selectedStagedDatasets} from '../common/file-uploader/upload-file-list';@@ -27,6 +28,7 @@ const StyledLoadDataModal = styled.div.attrs({})<{$withFooter?: boolean}>`padding: 10px 0 ${props => (props.$withFooter ? 0 : '50px')};min-height: 360px;+ max-height: calc(100vh - 180px);display: flex;flex-direction: column;@@ -42,6 +44,8 @@ const AddDataBar = styled.div.attrs({className: 'add-data-bar'})`display: flex;+ flex-wrap: nowrap;+ flex-shrink: 0;align-items: center;gap: 16px;box-sizing: border-box;@@ -68,15 +72,82 @@ const StagedLabel = styled.div`font-size: 12px;`;-const FooterError = styled.div`- color: ${props => props.theme.negativeBtnColor};+const FooterErrorRow = styled.div`+ display: flex;+ align-items: center;+ gap: 8px;+ flex: 1;+ min-width: 0;+ color: ${props => props.theme.errorColor};+`;++const FooterErrorText = styled.div`+ flex: 0 1 auto;+ min-width: 0;font-size: 12px;- max-width: 220px;+ line-height: 1.4;overflow: hidden;- text-overflow: ellipsis;- white-space: nowrap;+ overflow-wrap: anywhere;+ display: -webkit-box;+ -webkit-box-orient: vertical;+ -webkit-line-clamp: 2;+ line-clamp: 2;+`;++const CopyErrorButton = styled.button`+ flex-shrink: 0;+ display: inline-flex;+ align-items: center;+ justify-content: center;+ padding: 0;+ border: 0;+ background: transparent;+ color: inherit;+ cursor: pointer;++ &:hover {+ opacity: 0.7;+ }`;+function FooterErrorMessage({message}: {message: string}) {+ const intl = useIntl();+ const [copied, setCopied] = useState(false);++ useEffect(() => {+ setCopied(false);+ }, [message]);++ useEffect(() => {+ if (!copied) {+ return;+ }+ const timer = window.setTimeout(() => setCopied(false), 1500);+ return () => window.clearTimeout(timer);+ }, [copied]);++ const onCopy = useCallback(() => {+ copy(message);+ setCopied(true);+ }, [message]);++ const copyLabel = intl.formatMessage({+ id: copied ? 'modal.loadData.copied' : 'modal.loadData.copyError',+ defaultMessage: copied ? 'Copied' : 'Copy error'+ });++ return (+ <FooterErrorRow>+ <FooterErrorText role="alert">{message}</FooterErrorText>+ <TippyTooltip placement="top" isLightTheme render={() => <div>{copyLabel}</div>}>+ <CopyErrorButton type="button" aria-label={copyLabel} onClick={onCopy}>+ {copied ? <Checkmark height="14px" /> : <Copy height="14px" />}+ </CopyErrorButton>+ </TippyTooltip>+ </FooterErrorRow>+ );+}+const AddDataActions = styled.div`display: flex;align-items: center;@@ -95,6 +166,7 @@ const ModalMain = styled(Dimmed)`flex-direction: column;flex: 1;min-height: 0;+ overflow-y: auto;`;const spin = keyframes`@@ -388,6 +460,7 @@ export function LoadDataModalFactory(]);const uploadError = !fileLoading && isUpload ? progressErrors(fileLoadingProgress)[0] : '';const tilesetError = isTileset ? tilesetDraft?.error : '';+ const footerError = uploadError || tilesetError || '';const currentModalProps = {...restProps,@@ -466,10 +539,7 @@ export function LoadDataModalFactory(/>)}</Dimmed>- <StagedLabel />- {uploadError || tilesetError ? (- <FooterError>{uploadError || tilesetError}</FooterError>- ) : null}+ {footerError ? <FooterErrorMessage message={footerError} /> : <StagedLabel />}{preparingLayers ? (<ProcessingStatusaria-label={intl.formatMessage({id: 'modal.loadData.processingLayers'})}diff --git a/src/components/src/modals/tilesets-modals/load-tileset.tsx b/src/components/src/modals/tilesets-modals/load-tileset.tsxindex b3629d25a..ae15af18a 100644--- a/src/components/src/modals/tilesets-modals/load-tileset.tsx+++ b/src/components/src/modals/tilesets-modals/load-tileset.tsx@@ -16,6 +16,7 @@ import {} from '@kepler.gl/layers';import {getError, getApplicationConfig} from '@kepler.gl/utils';+import LoadingSpinner from '../../common/loading-spinner';import {MetaResponse} from './common';import LoadDataFooter from './load-data-footer';import TilesetIcon from './tileset-icon';@@ -52,6 +53,17 @@ const MetaContainer = styled.div`background-color: ${({theme}) => theme.editorBackground};`;+const MetaLoading = styled.div.attrs({+ role: 'status'+})`+ display: flex;+ align-items: center;+ justify-content: center;+ width: 100%;+ flex: 1;+ min-height: 160px;+`;+const BitmapPreviewContainer = styled.div`display: flex;align-items: center;@@ -224,7 +236,11 @@ function LoadTilesetTabFactory() {</div></div><MetaContainer>- {data && 'imagePreviewUrl' in data ? (+ {loading ? (+ <MetaLoading>+ <LoadingSpinner />+ </MetaLoading>+ ) : data && 'imagePreviewUrl' in data ? (<BitmapPreviewContainer><img src={(data as any).imagePreviewUrl} alt="Bitmap preview" /></BitmapPreviewContainer>diff --git a/src/components/src/modals/tilesets-modals/tileset-vector-form.tsx b/src/components/src/modals/tilesets-modals/tileset-vector-form.tsxindex 3f0ae966a..8673639fe 100644--- a/src/components/src/modals/tilesets-modals/tileset-vector-form.tsx+++ b/src/components/src/modals/tilesets-modals/tileset-vector-form.tsx@@ -46,15 +46,18 @@ const ExampleTabs = styled.div`gap: 6px;margin-top: 6px;margin-bottom: 6px;- flex-wrap: wrap;+ flex-wrap: nowrap;`;const ExampleTab = styled.div<{active: boolean}>`- padding: 3px 8px;+ flex: 1 1 0;+ min-width: 0;+ padding: 3px 6px;border-radius: 3px;cursor: pointer;font-size: 11px;- white-space: nowrap;+ line-height: 1.3;+ text-align: center;background: ${props => (props.active ? props.theme.AZURE400 : 'transparent')};color: ${props => (props.active ? props.theme.WHITE : props.theme.AZURE200)};border: 1px solid ${props => props.theme.AZURE400};@@ -78,8 +81,13 @@ const VECTOR_TILE_EXAMPLES = [},{label: 'PMTiles',- name: 'FSQ Places',- url: 'https://fsq-os-places-us-east-1.s3.us-east-1.amazonaws.com/release/vector-tiles/latest/fsq-os-places.pmtiles'+ name: 'New Zealand buildings',+ url: 'https://r2-public.protomaps.com/protomaps-sample-datasets/nz-buildings-v3.pmtiles'+ },+ {+ label: 'PMTiles',+ name: 'US Zip Codes',+ url: 'https://r2-public.protomaps.com/protomaps-sample-datasets/cb_2018_us_zcta510_500k.pmtiles'},{label: 'PMTiles',diff --git a/src/localization/src/translations/en.ts b/src/localization/src/translations/en.tsindex 7244c2863..c9d19e0c3 100644--- a/src/localization/src/translations/en.ts+++ b/src/localization/src/translations/en.ts@@ -829,7 +829,9 @@ export default {autoCreateLayersInfo:'kepler.gl will auto detect layers if the column names in your file follow certain naming conventions.',processingLayers: 'Processing data for layers',- readyToAdd: 'Ready to add'+ readyToAdd: 'Ready to add',+ copyError: 'Copy error',+ copied: 'Copied'},tripInfo: {title: 'Create trips from GeoJson',