Skip to content

Fix terrain and furniture deconstruction tool details#143

Merged
ushkinaz merged 2 commits intomainfrom
feat/120-adv-deconstruction
Mar 22, 2026
Merged

Fix terrain and furniture deconstruction tool details#143
ushkinaz merged 2 commits intomainfrom
feat/120-adv-deconstruction

Conversation

@ushkinaz
Copy link
Owner

Summary

  • add deconstruction sections to terrain and furniture pages for explicit check_deconstruct constructions
  • reuse Construction rendering while hiding redundant prerequisite links on these pages
  • render none when a construction has no required skills instead of leaving the field empty
  • add focused tests for advanced furniture and terrain deconstruction tool requirements

Testing

  • pnpm vitest run --no-color src/types/Furniture.test.ts src/types/Terrain.test.ts src/types/Construction.test.ts

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 22, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: e22d300a-3872-4137-9695-15c1a541d282

📥 Commits

Reviewing files that changed from the base of the PR and between 245f0d8 and f750b1a.

📒 Files selected for processing (3)
  • src/types/Construction.svelte
  • src/types/Furniture.test.ts
  • src/types/Terrain.test.ts

Summary by CodeRabbit

  • New Features

    • Added Deconstruction sections for furniture and terrain, showing required tools and skills.
    • Construction display gains an option to hide the “Requires” block, and “Required Skills” now shows “none” when empty.
  • Tests

    • Added tests verifying Deconstruction display and the ability to suppress the “Requires” section.

Walkthrough

Construction gained an optional includeRequires prop to control rendering of prerequisites. Furniture and Terrain now surface "Deconstruction" by filtering constructions with pre_special === "check_deconstruct" and matching pre_furniture/pre_terrain. Tests added/updated to assert deconstruction and tool requirements rendering.

Changes

Cohort / File(s) Summary
Construction Component
src/types/Construction.svelte
Added optional includeRequires?: boolean prop (default true). "Requires" section now rendered only when includeRequires && prerequisites.length. "Required Skills" shows list when present, otherwise localized t("none").
Furniture: deconstruction UI
src/types/Furniture.svelte
Introduced deconstructions derived from data.byType("construction") filtering pre_special === "check_deconstruct" and pre_furniture === item.id. Renders new "Deconstruction" block using Construction with includeTitle={false}, includeRequires={false}; existing Construction calls now explicit includeTitle={true}, includeRequires={false}.
Terrain: deconstruction UI
src/types/Terrain.svelte
Added deconstructions from data.byType("construction") filtering pre_special === "check_deconstruct" and pre_terrain === item.id. Renders "Deconstruction" list with Construction (includeTitle={false}, includeRequires={false}).
Tests: Furniture & Terrain
src/types/Furniture.test.ts, src/types/Terrain.test.ts
Furniture test updated to assert "Deconstruction" presence, "Tools Required", and specific tool labels; re-renders with includeRequires: false to confirm "Requires" suppression. New Terrain test verifies deconstruction rendering and tool requirement display, and checks includeRequires suppression.

Possibly related issues

Possibly related PRs

Poem

Construct and pry, the pipelines hum, 🔧
Filters engage where deconstructions come,
Props assert control, requirements fall away,
Tests confirm the signals — no stray display.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed Title accurately identifies the primary change: adding deconstruction tool details to terrain and furniture components.
Description check ✅ Passed Description directly correlates with changeset: deconstruction sections, prerequisite hiding, required_skills rendering, and corresponding test coverage.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/120-adv-deconstruction

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

You can disable poems in the walkthrough.

Disable the reviews.poem setting to disable the poems in the walkthrough.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/types/Construction.svelte`:
- Around line 75-81: The code redundantly uses the null-coalescing fallback when
iterating required_skills even though the outer guard checks
construction.required_skills?.length; update the {`#each`} to iterate directly
over construction.required_skills (e.g., {`#each` construction.required_skills as
[id, level], i}) and remove the ?? [] so ItemLink and the surrounding logic use
the confirmed array instead of an unreachable fallback.

In `@src/types/Furniture.test.ts`:
- Around line 132-137: Update the test to also assert the negative case when
includeRequires is false: render the component (WithData) with
includeRequires={false} and use queryByText (instead of getByText) to assert
that the "Requires" heading and/or "Tools Required" entries (e.g., "hammering",
"chiseling", "prying", "screw driving") are absent by expecting queryByText(...)
toBeNull(); this verifies the includeRequires prop on the component is honored.

In `@src/types/Terrain.test.ts`:
- Around line 48-51: Add a negative assertion to the test to verify the
includeRequires={false} prop hides the "Requires" section: destructure
queryByText from the render result (alongside getByText), render the component
with includeRequires={false}, and assert
expect(queryByText("Requires")).toBeNull(); so the test confirms the absence of
the "Requires" section (reference render result destructuring and the
includeRequires prop in the test).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 062140dd-f518-4acd-8555-76f42b8e2eea

📥 Commits

Reviewing files that changed from the base of the PR and between f99a845 and 245f0d8.

📒 Files selected for processing (5)
  • src/types/Construction.svelte
  • src/types/Furniture.svelte
  • src/types/Furniture.test.ts
  • src/types/Terrain.svelte
  • src/types/Terrain.test.ts

…ements logic

- Removed redundant nullish coalescing operator in `required_skills` iteration.
- Added tests for "hidden requirements" in Terrain and Furniture components.
@ushkinaz ushkinaz merged commit 554a0d1 into main Mar 22, 2026
6 checks passed
@ushkinaz ushkinaz deleted the feat/120-adv-deconstruction branch March 22, 2026 18:33
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.

Furniture/Terrain pages missing required tools for "advanced object deconstruction"

1 participant