feat: 分类显示书籍数量并发布 v2.1.2
构建与发布 / 单测与集成测试 (push) Waiting to run
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (arm64, linux, ubuntu-24.04-arm) (push) Blocked by required conditions
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (arm64, macos, macos-15) (push) Blocked by required conditions
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (x64, linux, ubuntu-24.04) (push) Blocked by required conditions
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (x64, windows, windows-2025) (push) Blocked by required conditions
构建与发布 / 发布 GitHub Release (push) Blocked by required conditions
构建与发布 / 单测与集成测试 (push) Waiting to run
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (arm64, linux, ubuntu-24.04-arm) (push) Blocked by required conditions
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (arm64, macos, macos-15) (push) Blocked by required conditions
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (x64, linux, ubuntu-24.04) (push) Blocked by required conditions
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (x64, windows, windows-2025) (push) Blocked by required conditions
构建与发布 / 发布 GitHub Release (push) Blocked by required conditions
This commit is contained in:
+17
-5
@@ -372,10 +372,10 @@ const Library = (() => {
|
||||
if (selectedShelf && selectedShelf !== '__uncategorized__'
|
||||
&& !shelves.some((shelf) => shelf.id === selectedShelf)) selectedShelf = '';
|
||||
if (selectedTag && !libraryTags.some((tag) => tag.name === selectedTag)) selectedTag = '';
|
||||
renderOrganizationSidebar();
|
||||
const allItems = res.data.slice();
|
||||
renderOrganizationSidebar(allItems);
|
||||
const noteCounts = noteCountsOf(noteCountResult);
|
||||
const annotationCounts = noteCountsOf(annotationCountResult);
|
||||
const allItems = res.data.slice();
|
||||
const scopedItems = allItems.filter((item) => {
|
||||
if (selectedShelf === '__uncategorized__' && item.shelfId) return false;
|
||||
if (selectedShelf && selectedShelf !== '__uncategorized__' && item.shelfId !== selectedShelf) return false;
|
||||
@@ -424,12 +424,19 @@ const Library = (() => {
|
||||
refresh(true);
|
||||
}
|
||||
|
||||
function renderOrganizationSidebar() {
|
||||
function renderOrganizationSidebar(items) {
|
||||
document.querySelectorAll('#libraryTab .library-filter[data-shelf]').forEach((button) => {
|
||||
const shelfId = button.dataset.shelf || '';
|
||||
button.classList.toggle(
|
||||
'active',
|
||||
!selectedTag && (button.dataset.shelf || '') === selectedShelf
|
||||
!selectedTag && shelfId === selectedShelf
|
||||
);
|
||||
const count = button.querySelector('.library-filter-count');
|
||||
if (count) {
|
||||
count.textContent = String(shelfId === '__uncategorized__'
|
||||
? items.filter((item) => !item.shelfId).length
|
||||
: items.length);
|
||||
}
|
||||
});
|
||||
const shelfList = $('libraryShelfList');
|
||||
shelfList.textContent = '';
|
||||
@@ -440,8 +447,13 @@ const Library = (() => {
|
||||
filter.type = 'button';
|
||||
filter.className = 'library-filter';
|
||||
filter.classList.toggle('active', !selectedTag && selectedShelf === shelf.id);
|
||||
filter.textContent = shelf.name;
|
||||
filter.title = shelf.name;
|
||||
const name = document.createElement('span');
|
||||
name.textContent = shelf.name;
|
||||
const count = document.createElement('span');
|
||||
count.className = 'library-filter-count';
|
||||
count.textContent = String(shelf.count || 0);
|
||||
filter.append(name, count);
|
||||
filter.onclick = () => selectShelf(shelf.id);
|
||||
|
||||
const actions = document.createElement('div');
|
||||
|
||||
Reference in New Issue
Block a user