Add enable/disable management for book tools (characters, worlds, and locations)

- Introduced toggling functionality for managing `characters`, `worlds`, and `locations` tool availability per book.
- Updated `CharacterComponent`, `WorldSetting`, and `LocationComponent` with toggle switches for tool enablement.
- Added `book_tools` database table and related schema migration for storing tool settings.
- Extended API calls, models, and IPC handlers to support tool enablement states.
- Localized new strings for English with supporting descriptions and messages.
- Adjusted conditional rendering logic across components to respect tool enablement.
This commit is contained in:
natreex
2026-01-14 17:42:59 -05:00
parent 7215ac5c4f
commit e45a15225b
19 changed files with 782 additions and 341 deletions

View File

@@ -156,13 +156,13 @@ export default function ComposerRightBar() {
<QuillSense/>
)}
{currentPanel?.id === 2 && (
<WorldSetting ref={worldRef}/>
<WorldSetting ref={worldRef} showToggle={false}/>
)}
{currentPanel?.id === 3 && (
<LocationComponent ref={locationRef}/>
<LocationComponent ref={locationRef} showToggle={false}/>
)}
{currentPanel?.id === 4 && (
<CharacterComponent ref={characterRef}/>
<CharacterComponent ref={characterRef} showToggle={false}/>
)}
</div>
</div>
@@ -180,6 +180,18 @@ export default function ComposerRightBar() {
return false;
}
}
// Filter Worlds if tools.worlds is disabled
if (component.id === 2 && !book?.tools?.worlds) {
return false;
}
// Filter Locations if tools.locations is disabled
if (component.id === 3 && !book?.tools?.locations) {
return false;
}
// Filter Characters if tools.characters is disabled
if (component.id === 4 && !book?.tools?.characters) {
return false;
}
return true;
})
.map((component: PanelComponent) => (