Skip to content

feat: application improvement#74

Merged
drduhe merged 1 commit intomainfrom
feat/package-improvements
Feb 13, 2026
Merged

feat: application improvement#74
drduhe merged 1 commit intomainfrom
feat/package-improvements

Conversation

@drduhe
Copy link
Copy Markdown
Collaborator

@drduhe drduhe commented Feb 13, 2026

Issue #, if available: n/a

Summary

Major refactoring pass to improve code organization, type safety, and maintainability across the Cesium globe application.

Changes

Project Structure & Tooling

  • Renamed src/util/ to src/utils/ with more descriptive file names (smHelpersagemakerHelper, mrHelpermodelRunnerHelper)
  • Added Jest test infrastructure (jest.config.js, @types/jest, test/test:watch scripts)
  • Added initial unit tests for cesiumFormatters, config, handleAwsError, logger, and shared types

Module Decomposition

  • cesiumHelper.ts (722 LOC monolith → 4 focused modules):
    • cesiumFeatures.ts — GeoJSON loading & feature click handling
    • cesiumImagery.ts — Image/tile loading & Docker-based tile creation
    • cesiumFormatters.ts — Feature property formatting for popups
    • cesiumHelper.ts — Barrel re-export preserving existing import paths
  • FormControls.tsx (506 LOC → 6 files):
    • DarkAutosuggest.tsx, DarkSelect.tsx, DarkMultiselect.tsx, DarkInput.tsx, DarkFormField.tsx, types.ts
    • FormControls.tsx becomes a barrel re-export for backward compatibility
  • ExpandSection extracted from ImageRequestModal into its own component

New Custom Hooks

  • useS3Browser — Shared S3 bucket/object browsing logic (replaces duplicated code in LoadImageModal, LoadDataModal, ImageRequestModal)
  • useImageRequestResults — Auto-loads processing results on job success (extracted from ImageRequestModal)

Type Safety

  • Added src/types.ts with shared types: ImageRequestState, ImageRequestData, ImageRequestOutput (discriminated union), ImageProcessor, FeatureDistillationConfig, PostProcessingStep
  • Replaced any types across modal props, model runner interfaces, and status handlers with proper typed signatures
  • Used strict equality (===) instead of loose (==) in output comparisons

Structured Logging

  • Added src/utils/logger.ts with level-aware logging (debug/info/warn/error); suppresses debug in production
  • Replaced all console.log/console.error calls with logger.* throughout the codebase

CSS & Design Tokens

  • Introduced CSS custom properties for z-index layering (--z-vignette, --z-tray, --z-popup, --z-modal, --z-dropdown) and scrollbar styling
  • Replaced hardcoded z-index values across all CSS files
  • Fixed gap: 12gap: 12px bug in ImageRequestStatus.css

Imagery Pipeline Fix

  • cesiumImagery.ts now warps images to EPSG:4326 via gdalwarp before tiling, correctly handling projected CRS and rotated rasters
  • Added cleanupWarpedFile() for temp file cleanup
  • calculate_extents.py updated to use the full GeoTransform formula (handles rotation via gt[2]/gt[4])

Config Centralization

  • Extracted magic numbers into named constants: VIEWER_INIT_MAX_RETRIES, CAMERA_FLY_DURATION_SECONDS, POPUP_WIDTH, JOB_NAME_PREFIX, FALLBACK_DEV_URL, etc.

ResourceContext

  • Fixed stale closure in zoomTo by using the state-setter pattern to read current resources
  • Removed resources from the zoomTo dependency array

Checklist

Before you submit a pull request, please make sure you have the following:

  • Code changes are compact and well-structured to facilitate easy review
  • Changes are documented in the README.md and other relevant documentation pages
  • PR title and description accurately reflect the changes and are detailed enough for historical tracking
  • PR contains tests that cover all new code and the code has been manual tested
  • All new dependencies are declared (if any), and no unnecessary libraries are added
  • Performance impacts (if any) of the changes are evaluated and documented
  • Security implications of the changes (if any) are reviewed and addressed
  • I have read the Contributing Guidelines and agree to follow the Code of Conduct

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link
Copy Markdown

@devinglauner devinglauner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@drduhe drduhe merged commit 825c0a6 into main Feb 13, 2026
3 checks passed
@drduhe drduhe deleted the feat/package-improvements branch February 25, 2026 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants