fix: 侧边栏文件夹计数跟随状态筛选变化
This commit is contained in:
parent
33424409d5
commit
e7ec875a32
|
|
@ -185,19 +185,17 @@ export class AppComponent implements OnInit {
|
||||||
|
|
||||||
get folderNavs(): { name: string; count: number }[] {
|
get folderNavs(): { name: string; count: number }[] {
|
||||||
const counts = new Map<string, number>();
|
const counts = new Map<string, number>();
|
||||||
const bump = (dl: Download) => {
|
for (const { value } of this.statusEntries(this.status)) {
|
||||||
const key = dl.folder || '';
|
const key = value.folder || '';
|
||||||
counts.set(key, (counts.get(key) || 0) + 1);
|
counts.set(key, (counts.get(key) || 0) + 1);
|
||||||
};
|
}
|
||||||
this.downloads.queue.forEach(bump);
|
|
||||||
this.downloads.done.forEach(bump);
|
|
||||||
return Array.from(counts.entries())
|
return Array.from(counts.entries())
|
||||||
.map(([name, count]) => ({ name, count }))
|
.map(([name, count]) => ({ name, count }))
|
||||||
.sort((a, b) => a.name.localeCompare(b.name, 'zh'));
|
.sort((a, b) => a.name.localeCompare(b.name, 'zh'));
|
||||||
}
|
}
|
||||||
|
|
||||||
get allCount(): number {
|
get allCount(): number {
|
||||||
return this.downloads.queue.size + this.downloads.done.size;
|
return this.statusEntries(this.status).length;
|
||||||
}
|
}
|
||||||
|
|
||||||
get folderName(): string {
|
get folderName(): string {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue