Skip to content

Major Refactor to clean up folder structure#7

Merged
wernerbihl merged 9 commits intomainfrom
feature/2026-04-23
Apr 23, 2026
Merged

Major Refactor to clean up folder structure#7
wernerbihl merged 9 commits intomainfrom
feature/2026-04-23

Conversation

@wernerbihl
Copy link
Copy Markdown
Collaborator

No description provided.

wernerbihl and others added 9 commits April 23, 2026 21:45
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
- Moved import-export types from "@/types/import-export" to "@/features/import-export/types".
- Updated imports in various files to reflect the new path.
- Deleted obsolete files related to import-export types.
- Created new files for file-save, persistence, tiled-json, and tiled-lua types under the new structure.
- Ensured all references to the old import-export types are updated to the new structure.

Co-authored-by: Copilot <copilot@github.com>
- Implement shared utilities for parsing and handling Tiled map properties and layers in `tiled-map-import-shared.ts`.
- Introduce main import logic for Tiled maps in `tiled-map-import.ts`, including support for tilesets, layers, and image assets.
- Add functions to collect missing resources and handle external tileset dependencies.
- Ensure compatibility with both TMX and JSON formats, including validation of map properties and dimensions.
- Enhance image asset handling with dimensions extraction and error management for unsupported features.
- Introduced new types for image editor tools, UI components, and state management.
- Created interfaces for crop functionality, editor toolbar, and save format dialogs.
- Defined types for map canvas interactions, context menus, and panel components.
- Established a comprehensive index for image editor types to streamline imports.
- Implemented type safety for various editor actions and properties, enhancing maintainability.
- Deleted obsolete dialog types from app and editor modules.
- Consolidated editor helper types into map-editor types.
- Introduced new types for image editor and project management.
- Updated index exports to reflect the new structure.

Co-authored-by: Copilot <copilot@github.com>
Copilot AI review requested due to automatic review settings April 23, 2026 22:09
@wernerbihl wernerbihl merged commit 5c48f4a into main Apr 23, 2026
3 of 4 checks passed
@wernerbihl wernerbihl deleted the feature/2026-04-23 branch April 23, 2026 22:10
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR restructures the codebase into feature-oriented directories and updates imports/exports accordingly, while also extracting some editor logic into dedicated hooks/providers.

Changes:

  • Reworked type exports and module boundaries (e.g., moving map/editor/import-export/image-editor/app-shell types into src/features/* and src/store/*).
  • Updated many imports to new @/features, @/services, @/utils, and @/store locations and introduced AppProviders for app-wide providers.
  • Extracted Image Editor request loading + save/export logic into new feature hooks and moved AI assets UI into feature folders.

Reviewed changes

Copilot reviewed 185 out of 204 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/types/tiled-json.ts Switches type imports to new barrel export.
src/types/text-object.ts Fixes formatting/indentation in type export.
src/types/schema.ts Fixes formatting/indentation at file end.
src/types/persistence.ts Updates schema import path to new map types location.
src/types/map-panel.ts Updates map-related type imports and store type import path.
src/types/map-panel-context-menu.ts Updates schema import path and reorders React type imports.
src/types/map-geometry.ts Fixes formatting/indentation.
src/types/map-canvas.ts Updates schema/text-object type import paths.
src/types/layers-panel.ts Adjusts LayerTreeNode import to local module.
src/types/index.ts Replaces broad barrel exports with new feature-scoped exports.
src/types/import-export.ts Updates import paths and relocates dialog prop types into import-export types.
src/types/image-editor.ts Adds re-exports for image-editor submodules and minor naming cleanup.
src/types/image-editor-ui.ts Switches type imports to new barrel export.
src/types/image-editor-internals.ts Switches type imports to new barrel export.
src/types/image-editor-hook.ts Switches type imports to new barrel export.
src/types/image-editor-hook-internals.ts Switches type imports to new barrel export.
src/types/editor-store.ts Moves editor-store-related types to @/store/types and feature import-export types.
src/types/editor-layout.ts Updates schema import path and renames event params for clarity.
src/types/editor-helpers.ts Moves map schema import and removes image-editor layer tree types (relocated elsewhere).
src/types/dialogs.ts Removes app-shell/import-export dialog prop types (relocated to feature type modules).
src/types/components.ts Removes editor/app-specific prop types, leaving reusable component types only.
src/types/app.ts Removes legacy AppShellProps (moved to feature app-shell types).
src/main.tsx Moves global CSS import, introduces AppProviders wrapper, updates Sentry import.
src/lib/zoom-store.ts Updates imports to new store/types and feature import-export types.
src/lib/tiled-map-import.ts Updates imports to new utils/features structure.
src/lib/tiled-map-import-shared.ts Moves db/ids/xml-utils dependencies to new paths.
src/lib/tiled-map-import-lua.ts Moves import-export implementation dependencies to feature folders.
src/lib/tiled-map-import-json.ts Moves dependencies to new utils/features paths.
src/lib/tiled-lua.ts Moves xml-utils dependency under import-export feature.
src/lib/tiled-lua-format.ts Moves import-export helpers under feature paths.
src/lib/tile-stamp.ts Moves editor helper types into map-editor feature types.
src/lib/tile-editor-context.ts Moves TileEditorContext type under map-editor feature types.
src/lib/tile-clipboard.ts Moves TileClipboard type under map-editor feature types.
src/lib/terrain.ts Moves FillRegionOptions type under map-editor feature types.
src/lib/store.ts Re-homes editor store types/db/project imports to new modules.
src/lib/save-file.ts Moves file-save types under import-export feature types.
src/lib/project.ts Moves text object normalization to map-editor feature lib.
src/lib/project-session.ts Moves db/store/project-prefs imports to new service/store files.
src/lib/project-prefs.ts Moves db/store/zoom/types imports into @/services + @/store + import-export feature types.
src/lib/photoshop-ase.ts Moves image-editor Color type under image-editor feature types.
src/lib/palette-formats.ts Moves image-editor Color type under image-editor feature types.
src/lib/layers.ts Splits map vs image-editor layer tree type imports into feature paths.
src/lib/import-export-tiled.ts Moves import-export implementation dependencies to new utils/features.
src/lib/import-export-tiled-shared.ts Moves db/format/xml-utils dependencies under services/utils/features.
src/lib/import-export-tiled-lua.ts Moves dependencies under import-export feature and utils.
src/lib/import-export-tiled-json.ts Moves dependencies under import-export feature and utils.
src/lib/import-export-raster.ts Moves map-editor rendering/db/ids/map-geometry dependencies under new paths.
src/lib/image-layer-editor-context.ts Moves ImageLayerEditorContext type under image-editor feature types.
src/lib/image-layer-clipboard.ts Moves ImageLayerClipboard type under map-editor feature types.
src/lib/image-editor-tools.ts Moves image-editor types to feature paths.
src/lib/image-editor-tools-shared.ts Moves image-editor types to feature paths.
src/lib/image-editor-store.ts Moves store + types under new store/feature paths.
src/lib/image-editor-shape-tools.ts Moves image-editor types under feature paths.
src/lib/image-editor-selection-tools.ts Moves image-editor internals types under feature paths.
src/lib/image-editor-history.ts Moves image-editor internals types under feature paths.
src/lib/image-editor-document.ts Moves image-editor store/tools/context imports to feature/store paths.
src/lib/image-editor-crop-tools.ts Moves image-editor internal/tool types under feature paths.
src/lib/ids.ts Reorders imported type list and formats file end.
src/lib/format.ts Moves db/project/persistence type imports to services/features/utils.
src/lib/db.ts Moves image-editor Palette type and persistence types to feature paths.
src/lib/ase-palette.ts Moves image-editor Color type under image-editor feature types.
src/lib/api-keys.ts Updates ApiKeyProvider import path.
src/instrument.ts Updates Sentry service import path.
src/index.css Minor formatting (blank line) in drawer animation CSS.
src/hooks/use-text-object-editing.ts Moves text-object helpers under map-editor feature lib.
src/hooks/use-keyboard-shortcuts.ts Moves store/zoom/db imports to new store/services paths.
src/hooks/use-image-editor.ts Moves image-editor hooks/libs/store/types under feature/store paths.
src/hooks/use-image-editor-palette-actions.ts Moves palette helpers/types under image-editor feature and store.
src/hooks/use-image-editor-layer-actions.ts Moves image-editor history/store/types under feature/store paths.
src/hooks/use-image-editor-frame-actions.ts Moves image-editor history/document/types under feature paths.
src/hooks/use-editor-store.ts Moves editor store import to @/store/editor-store.
src/hooks/use-auto-save.ts Moves editor store + db service imports to new locations.
src/features/project-management/types/index.ts Adds feature-local ProjectDialogProps type.
src/features/project-management/index.ts Exposes project-management feature public API.
src/features/project-management/components/index.ts Exposes ProjectDialog component.
src/features/map-editor/types/index.ts Adds map-editor feature types barrel.
src/features/map-editor/types/editor-ui.ts Introduces map-editor UI prop types extracted from global components types.
src/features/map-editor/index.ts Exposes map-editor components and types from feature public API.
src/features/import-export/index.ts Exposes import-export dialogs/hooks/types from feature public API.
src/features/image-editor/types/image-editor-layer-tree.ts Reintroduces ImageEditorLayerTreeNode type under image-editor feature types.
src/features/image-editor/types/image-editor-controller.ts Adds ImageEditorController type based on hook return type.
src/features/image-editor/types/image-editor-context.ts Adds ImageLayerEditorContext type under feature types.
src/features/image-editor/index.ts Exposes image-editor components and types from feature public API.
src/features/image-editor/hooks/use-image-editor-save-actions.ts Extracts image saving/export logic into dedicated hook.
src/features/image-editor/hooks/use-image-editor-request-loader.ts Extracts request loading logic (tile/image-layer) into dedicated hook.
src/features/app-shell/types/index.ts Adds app-shell ToolName, ToolbarProps, AppShellProps and related dialog types.
src/features/app-shell/index.ts Exposes app-shell component and types.
src/features/ai-assets/index.ts Exposes AI assets feature component.
src/features/ai-assets/components/index.ts Exposes AiAssets component.
src/features/ai-assets/components/Generator.tsx Moves AI assets generator UI into feature folder.
src/features/ai-assets/components/ConfigForms.tsx Moves AI assets config forms into feature folder.
src/context/AppProviders.tsx Adds centralized app-wide providers wrapper (ThemeProvider).
src/components/ui/Tooltip.tsx Moves cn helper import under utils.
src/components/ui/Tabs.tsx Moves cn helper import under utils.
src/components/ui/Switch.tsx Moves cn helper import under utils.
src/components/ui/Slider.tsx Moves cn helper import under utils.
src/components/ui/Separator.tsx Moves cn helper import under utils.
src/components/ui/Select.tsx Moves cn helper import under utils.
src/components/ui/ScrollArea.tsx Moves cn helper import under utils.
src/components/ui/Popover.tsx Moves cn helper import under utils.
src/components/ui/Menubar.tsx Moves cn helper import under utils.
src/components/ui/Label.tsx Moves cn helper import under utils.
src/components/ui/Input.tsx Moves cn helper import under utils.
src/components/ui/DropdownMenu.tsx Moves cn helper import under utils.
src/components/ui/Drawer.tsx Moves cn helper import under utils.
src/components/ui/Dialog.tsx Moves cn helper import under utils.
src/components/ui/ContextMenu.tsx Moves cn helper import under utils.
src/components/ui/ColorPicker.tsx Moves component types import and cn helper to new locations.
src/components/ui/Button.tsx Moves cn helper import under utils.
src/components/ui/AlertDialog.tsx Moves cn helper import under utils.
src/components/ui/Accordion.tsx Moves cn helper import under utils.
src/components/tools/ToolDrawer.tsx Updates tool lazy imports to feature entrypoints and moves prop types to app-shell feature.
src/components/tools/ImageEditor/index.tsx Refactors ImageEditor to use extracted request loader + save actions hooks and new imports.
src/components/tools/ImageEditor/ToolSidebar.tsx Moves image-editor types under feature types.
src/components/tools/ImageEditor/TimelinePanel.tsx Moves imports to feature modules and updates cn helper location.
src/components/tools/ImageEditor/SaveFormatDialog.tsx Moves types and cn import paths.
src/components/tools/ImageEditor/PalettePanel.tsx Moves image-editor types under feature types.
src/components/tools/ImageEditor/NewImageDialog.tsx Moves types under feature types.
src/components/tools/ImageEditor/LayersPanel.tsx Moves AddLayerDialog/useImageEditor/layers + fixes boolean guard style.
src/components/tools/ImageEditor/ImageCanvasResizeControls.tsx Moves types under feature types.
src/components/tools/ImageEditor/ImageCanvas.tsx Moves types and tool helpers under feature paths.
src/components/tools/ImageEditor/FramesPanel.tsx Moves types under feature types.
src/components/tools/ImageEditor/ExportDialog.tsx Moves types under feature types.
src/components/tools/ImageEditor/EditorToolbar.tsx Moves types under feature types.
src/components/tools/AiAssets/prompt-builder.ts Updates AI assets type module path and variable naming.
src/components/tools/AiAssets/index.tsx Minor formatting/indentation fix.
src/components/tools/AiAssets/image-utils.ts Removes redundant comment header.
src/components/tools/AiAssets/constants.ts Updates AI assets type module path and tweaks option lists.
src/components/tools/AiAssets/ImageUpload.tsx Replaces dynamic input creation with hidden input + ref and adds ids/names.
src/components/tools/AiAssets/ImageCell.tsx Updates AI assets type module path and improves class ordering/formatting.
src/components/tools/AiAssets/Generator.tsx Removes legacy generator implementation (moved to feature folder).
src/components/tools/AiAssets/ConfigForms.tsx Removes legacy config forms (moved to feature folder).
src/components/layout/Toolbar.tsx Moves cn + store/types imports to new locations.
src/components/editor/TilesetPanel.tsx Moves zoom/db/project/store/ids imports to new paths.
src/components/editor/TilesetCanvas.tsx Moves db import and TilesetCanvasProps type under map-editor feature types.
src/components/editor/TerrainTileSelector.tsx Moves db import and prop type under map-editor feature types.
src/components/editor/ObjectsPanel.tsx Moves manager component, ids, prop types, and cn helper to new locations.
src/components/editor/ObjectPropertiesDialogManager.tsx Moves dialog/component prop types and text-object helpers under map-editor feature.
src/components/editor/MapPanel/use-map-panel-clipboard-actions.ts Moves db/ids/layers/clipboard/stamp/types to feature and service paths.
src/components/editor/MapPanel/use-map-panel-canvas-actions.ts Moves ids/terrain/text-object/editor-context/layers/types to feature paths.
src/components/editor/MapPanel/use-map-canvas-context-menu.ts Moves object hit test + map geometry and types under feature paths.
src/components/editor/MapPanel/MapPanelWorkspace.tsx Loads MapCanvas and types from map-editor feature.
src/components/editor/MapPanel/MapPanelToolbar.tsx Moves toolbar prop types under map-editor feature.
src/components/editor/MapPanel/MapPanelTabs.tsx Moves tabs prop types under map-editor feature.
src/components/editor/MapPanel/MapPanelDialogs.tsx Moves dialogs + manager + prop types under map-editor feature.
src/components/editor/MapPanel/MapCanvasContextMenuContent.tsx Moves context menu prop types under map-editor feature.
src/components/editor/MapPanel.tsx Moves map-editor dependencies (layers/geometry/zoom/types) to new paths.
src/components/editor/MapCanvas/use-scene-interaction.ts Moves types and geometry/terrain/stamp dependencies under map-editor feature.
src/components/editor/MapCanvas/use-map-resize.ts Moves types under map-editor feature.
src/components/editor/MapCanvas/texture-cache.ts Moves asset URL loader under services/db.
src/components/editor/MapCanvas/text-object-rendering.ts Moves text-object helpers under map-editor feature.
src/components/editor/MapCanvas/scene-interaction-handlers.ts Moves types under map-editor feature.
src/components/editor/MapCanvas/object-utils.ts Moves ResizeHandle type under map-editor feature.
src/components/editor/MapCanvas/index.tsx Moves geometry/text-object/types under map-editor feature.
src/components/editor/MapCanvas/image-layer-transform.ts Moves ResizeHandle type under map-editor feature.
src/components/editor/MapCanvas/draw-map-objects.ts Moves UseSceneInteractionReturn type under map-editor feature.
src/components/editor/MapCanvas/TextObjectEditorOverlay.tsx Moves text-object helpers and prop types under map-editor feature.
src/components/editor/MapCanvas/MapResizeControls.tsx Moves resize control props type under map-editor feature.
src/components/editor/Layout/EditorLayouts.tsx Moves layout prop types under map-editor feature.
src/components/editor/LayersPanel/index.tsx Moves dialogs/ids/db/layers/types under map-editor feature + services/utils.
src/components/editor/LayersPanel/LayersTree.tsx Moves LayersTree prop types under map-editor feature.
src/components/editor/LayersPanel/LayerRow.tsx Moves row prop types under map-editor feature and cn helper.
src/components/editor/LayersPanel/GroupRow.tsx Moves row prop types under map-editor feature and cn helper.
src/components/editor/LayersPanel/DeleteLayerDialog.tsx Moves dialog prop types under map-editor feature.
src/components/dialogs/import-export/RasterExportOptionsPanel.tsx Moves raster export lib import under import-export feature.
src/components/dialogs/import-export/ExportAssetPicker.tsx Moves texture/db/geometry/cn dependencies to new paths.
src/components/dialogs/TiledMissingResourcesDialog.tsx Moves prop types under import-export feature.
src/components/dialogs/SettingsDialog.tsx Moves db import to services and dialog prop types under app-shell feature.
src/components/dialogs/ProjectDialog.tsx Moves db/ids/format/session/types under services/utils/features.
src/components/dialogs/ObjectPropertiesDialog.tsx Moves text-object helpers + local-fonts + prop types under services/features.
src/components/dialogs/NewTilesetGroupDialog.tsx Moves prop types under map-editor feature.
src/components/dialogs/NewMapGroupDialog.tsx Moves prop types under map-editor feature and formats button JSX.
src/components/dialogs/NewMapDialog.tsx Moves map-geometry and prop types under map-editor feature.
src/components/dialogs/MapOptionsDialog.tsx Moves prop types under map-editor feature.
src/components/dialogs/KeyboardShortcutsDialog.tsx Moves prop types under app-shell feature.
src/components/dialogs/ImportExportDialog.tsx Moves cn + raster defaults + dialog props under new feature paths.
src/components/dialogs/FindReplaceDialog.tsx Moves TilesetCanvas + layers/db + prop types under new paths.
src/components/dialogs/FillTerrainDialog.tsx Moves TilesetCanvas/Terrain selector/ids/types to feature paths.
src/components/dialogs/BugReportDialog.tsx Moves Sentry service import and dialog props under app-shell feature.
src/components/dialogs/AddLayerDialog.tsx Moves cn import and dialog prop types under map-editor feature.
src/components/dialogs/AboutDialog.tsx Moves dialog prop types under app-shell feature and bumps version display.
src/components/app/use-tiled-map-import.ts Moves tiled import helpers under import-export feature and format util.
src/components/app/use-import-export-actions.ts Moves import/export dependencies under feature/service/utils/store paths.
src/components/app/tiled-map-action-utils.ts Moves helpers under import-export feature and file-system service.
src/components/app/import-export-action-utils.ts Moves layers helper dependency under map-editor feature.
src/components/app/AppShell.tsx Repoints AppShell dependencies to features/services/store and updates lazy imports.
src/App.tsx Moves store/db/prefs imports to new paths and switches ToolName/AppShell to feature exports.
package.json Bumps package version to 0.1.2.
TODO.txt Updates TODO list formatting and adds proposed folder structure notes.
Comments suppressed due to low confidence (4)

src/features/image-editor/hooks/use-image-editor-request-loader.ts:1

  • loadPaletteLibrary is called without await. If it returns a Promise (likely for IndexedDB/Dexie access), editor.initProject will receive a Promise instead of palette data and palette loading errors could become unhandled. Await the call (and handle failures) before passing palettes to initProject.
    src/features/image-editor/hooks/use-image-editor-request-loader.ts:1
  • Same issue as the tile request path: loadPaletteLibrary(projectId) is not awaited. Ensure palettes are loaded (or explicitly handled as unavailable) before calling editor.initProject.
    src/features/ai-assets/components/Generator.tsx:1
  • The model filtering condition only excludes null. If loadAllApiKeys() returns undefined for providers without keys, those models will incorrectly remain selectable. Filter using a nullish check (e.g., keys[provider] != null) and/or verify it’s a non-empty string.
    src/features/ai-assets/components/Generator.tsx:1
  • Logging user prompts can leak potentially sensitive content into shared logs (and browser console recordings). Consider removing this log or gating it behind a development-only flag.

Comment thread src/App.tsx
} from "@/lib/db";
import {} from "@/lib/db";
} from "@/services/db";
import {} from "@/services/db";
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

There is an empty import (import {} ...) which is a no-op and can cause lint/build warnings. Remove the empty import line.

Suggested change
import {} from "@/services/db";

Copilot uses AI. Check for mistakes.
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