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:
@@ -111,6 +111,12 @@ interface UpdateWorldData {
|
||||
world: WorldProps;
|
||||
}
|
||||
|
||||
interface UpdateBookToolData {
|
||||
bookId: string;
|
||||
toolName: 'characters' | 'worlds' | 'locations';
|
||||
enabled: boolean;
|
||||
}
|
||||
|
||||
// GET /books - Get all books
|
||||
ipcMain.handle('db:book:books', createHandler<void, BookProps[]>(
|
||||
async function(userId: string, _body: void, lang: 'fr' | 'en'):Promise<BookProps[]> {
|
||||
@@ -412,3 +418,11 @@ ipcMain.handle('db:book:world:update', createHandler<UpdateWorldData, boolean>(
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
// PATCH /book/tool-setting - Update book tool setting
|
||||
ipcMain.handle('db:book:tool:update', createHandler<UpdateBookToolData, boolean>(
|
||||
function(userId: string, data: UpdateBookToolData, lang: 'fr' | 'en') {
|
||||
return Book.updateBookToolSetting(userId, data.bookId, data.toolName, data.enabled, lang);
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user