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:
@@ -1,7 +1,7 @@
|
||||
import { getUserEncryptionKey } from "../keyManager.js";
|
||||
import System from "../System.js";
|
||||
import { CompleteBook } from "./Book.js";
|
||||
import BookRepo, { EritBooksTable } from "../repositories/book.repository.js";
|
||||
import BookRepo, { EritBooksTable, BookToolsTable } from "../repositories/book.repository.js";
|
||||
import ActRepository, { BookActSummariesTable } from "../repositories/act.repository.js";
|
||||
import GuidelineRepo, { BookAIGuideLineTable, BookGuideLineTable } from "../repositories/guideline.repository.js";
|
||||
import ChapterRepo, {
|
||||
@@ -51,7 +51,8 @@ export default class Upload {
|
||||
encryptedIssues,
|
||||
encryptedLocations,
|
||||
encryptedPlotPoints,
|
||||
encryptedWorlds
|
||||
encryptedWorlds,
|
||||
bookToolsData
|
||||
]: [
|
||||
EritBooksTable[],
|
||||
BookActSummariesTable[],
|
||||
@@ -63,7 +64,8 @@ export default class Upload {
|
||||
BookIssuesTable[],
|
||||
BookLocationTable[],
|
||||
BookPlotPointsTable[],
|
||||
BookWorldTable[]
|
||||
BookWorldTable[],
|
||||
BookToolsTable | null
|
||||
] = await Promise.all([
|
||||
BookRepo.fetchEritBooksTable(userId, bookId, lang),
|
||||
ActRepository.fetchBookActSummaries(userId, bookId, lang),
|
||||
@@ -75,7 +77,8 @@ export default class Upload {
|
||||
IssueRepository.fetchBookIssues(userId, bookId, lang),
|
||||
LocationRepo.fetchBookLocations(userId, bookId, lang),
|
||||
PlotPointRepository.fetchBookPlotPoints(userId, bookId, lang),
|
||||
WorldRepository.fetchBookWorlds(userId, bookId, lang)
|
||||
WorldRepository.fetchBookWorlds(userId, bookId, lang),
|
||||
BookRepo.fetchBookTools(userId, bookId, lang)
|
||||
]);
|
||||
|
||||
const [
|
||||
@@ -234,6 +237,8 @@ export default class Upload {
|
||||
sub_elem_description: locationSubElement.sub_elem_description ? System.decryptDataWithUserKey(locationSubElement.sub_elem_description, userEncryptionKey) : null
|
||||
}));
|
||||
|
||||
const bookTools: BookToolsTable[] = bookToolsData ? [bookToolsData] : [];
|
||||
|
||||
return {
|
||||
eritBooks,
|
||||
actSummaries,
|
||||
@@ -251,7 +256,8 @@ export default class Upload {
|
||||
worlds,
|
||||
worldElements,
|
||||
locationElements,
|
||||
locationSubElements
|
||||
locationSubElements,
|
||||
bookTools
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user