mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-25 07:14:00 +08:00
impr(edit result tags): display unkown tags so that they can be removed from results
This commit is contained in:
parent
29c78e8d51
commit
395bfae3aa
1 changed files with 10 additions and 4 deletions
|
@ -71,14 +71,20 @@ function appendButtons(): void {
|
|||
return;
|
||||
}
|
||||
|
||||
const tagIds = new Set([
|
||||
...(DB.getSnapshot()?.tags.map((tag) => tag._id) ?? []),
|
||||
...state.tags,
|
||||
]);
|
||||
|
||||
buttonsEl.innerHTML = "";
|
||||
for (const tag of DB.getSnapshot()?.tags ?? []) {
|
||||
for (const tagId of tagIds) {
|
||||
const tag = DB.getSnapshot()?.tags.find((tag) => tag._id === tagId);
|
||||
const button = document.createElement("button");
|
||||
button.classList.add("toggleTag");
|
||||
button.setAttribute("data-tag-id", tag._id);
|
||||
button.innerHTML = tag.display;
|
||||
button.setAttribute("data-tag-id", tagId);
|
||||
button.innerHTML = tag?.display ?? "unknown tag";
|
||||
button.addEventListener("click", (e) => {
|
||||
toggleTag(tag._id);
|
||||
toggleTag(tagId);
|
||||
updateActiveButtons();
|
||||
});
|
||||
buttonsEl.appendChild(button);
|
||||
|
|
Loading…
Reference in a new issue