diff --git a/src/ts/content/extensions/author/authorPage/authorUI.ts b/src/ts/content/extensions/author/authorPage/authorUI.ts index 842f8d96..3e254a31 100644 --- a/src/ts/content/extensions/author/authorPage/authorUI.ts +++ b/src/ts/content/extensions/author/authorPage/authorUI.ts @@ -118,7 +118,7 @@ const appendUI = (container: Element, handlers: ButtonHandlers, getTagsCallback: viewExistingTags(); }; -const insertTags = (tags: string[]) => { +const renderAuthorTags = (tags: string[]) => { const list = document.getElementById(TAG_LIST_ID); const input = document.getElementById(AUTHOR_TAG_INPUT_ID) as HTMLInputElement; if (tags.length === 0) { @@ -144,4 +144,4 @@ const getInputElement = () => document.getElementById(AUTHOR_TAG_INPUT_ID) as HT const viewExistingTags = toggleViews(TAG_LIST_CONTAINER_ID, TAG_INPUT_CONTAINER_ID); const viewTagEditor = toggleViews(TAG_INPUT_CONTAINER_ID, TAG_LIST_CONTAINER_ID); -export {appendUI, insertTags, getInput, viewExistingTags, viewTagEditor, AUTHOR_TAG_INPUT_ID}; +export {appendUI, renderAuthorTags, getInput, viewExistingTags, viewTagEditor, AUTHOR_TAG_INPUT_ID}; diff --git a/src/ts/content/extensions/author/authorPage/index.ts b/src/ts/content/extensions/author/authorPage/index.ts index 443bf1c4..2479d1b1 100644 --- a/src/ts/content/extensions/author/authorPage/index.ts +++ b/src/ts/content/extensions/author/authorPage/index.ts @@ -1,5 +1,5 @@ import Author, {AuthorRecord} from "../../../adapters/author"; -import {appendUI, getInput, insertTags, AUTHOR_TAG_INPUT_ID, viewExistingTags, viewTagEditor} from "./authorUI"; +import {appendUI, getInput, renderAuthorTags, AUTHOR_TAG_INPUT_ID, viewExistingTags, viewTagEditor} from "./authorUI"; import {loaderOverlaid} from "../../../../common/ui/loadingIndicator"; import Book from "../../../adapters/book"; import {createPushBookTags, createSyncBookTags} from "../util/bookEditor"; @@ -18,7 +18,7 @@ const onEdit = () => { const onBackToExistingTags = (getAuthor: () => Promise) => () => loaderOverlaid(async () => { const author = await getAuthor(); - author && insertTags(author.tags); + author && renderAuthorTags(author.tags); viewExistingTags(); }); diff --git a/src/ts/content/extensions/author/authorPage/pull.ts b/src/ts/content/extensions/author/authorPage/pull.ts index 4d4e5373..e88747fa 100644 --- a/src/ts/content/extensions/author/authorPage/pull.ts +++ b/src/ts/content/extensions/author/authorPage/pull.ts @@ -1,5 +1,5 @@ import {createModal} from "../../../../common/ui/modal"; -import {getInput, insertTags} from "./authorUI"; +import {getInput, renderAuthorTags} from "./authorUI"; import {showToast, ToastType} from "../../../../common/ui/toast"; import {loaderOverlaid} from "../../../../common/ui/loadingIndicator"; import {authorTagsFromBooksWhere, getAuthorInfo} from "./util"; @@ -30,7 +30,7 @@ const uncertainTagModal = kind: "button", text: `Add${strings.all}`, colour: UIColour.RED, - onClick: async () => insertTags([...certainTags, ...uncertainTags]), + onClick: async () => renderAuthorTags([...certainTags, ...uncertainTags]), }, {kind: "button", text: "Back", colour: UIColour.BLUE}, ], @@ -63,7 +63,7 @@ const onPull = async () => const multiAuthorTags = authorTagsFromBooksWhere(books, (book) => book.authorIds.length !== 1); const certainTags = new Set([...getInput(), ...(author?.tags ?? []), ...singleAuthorTags]); const uncertainTags = new Set(multiAuthorTags.filter((tag) => !certainTags.has(tag))); - insertTags([...certainTags]); + renderAuthorTags([...certainTags]); return {certainTags, uncertainTags, name}; }).then(finishPull); diff --git a/src/ts/content/extensions/author/authorPage/util.ts b/src/ts/content/extensions/author/authorPage/util.ts index 43fe20b3..1cf96c83 100644 --- a/src/ts/content/extensions/author/authorPage/util.ts +++ b/src/ts/content/extensions/author/authorPage/util.ts @@ -1,5 +1,5 @@ import Author from "../../../adapters/author"; -import {insertTags} from "./authorUI"; +import {renderAuthorTags} from "./authorUI"; import {filterAuthorTags} from "../../../util/filterAuthorTags"; import {BookRecord} from "../../../adapters/book"; @@ -11,7 +11,7 @@ const getAuthorInfo = () => { const getTags = async () => { const author = await Author.getAuthor(getAuthorInfo().uuid); - insertTags(author?.tags ?? []); + renderAuthorTags(author?.tags ?? []); }; const authorTagsFromBooksWhere = (books: BookRecord[], where: (book: BookRecord) => boolean) =>