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 }[] {
|
||||
const counts = new Map<string, number>();
|
||||
const bump = (dl: Download) => {
|
||||
const key = dl.folder || '';
|
||||
for (const { value } of this.statusEntries(this.status)) {
|
||||
const key = value.folder || '';
|
||||
counts.set(key, (counts.get(key) || 0) + 1);
|
||||
};
|
||||
this.downloads.queue.forEach(bump);
|
||||
this.downloads.done.forEach(bump);
|
||||
}
|
||||
return Array.from(counts.entries())
|
||||
.map(([name, count]) => ({ name, count }))
|
||||
.sort((a, b) => a.name.localeCompare(b.name, 'zh'));
|
||||
}
|
||||
|
||||
get allCount(): number {
|
||||
return this.downloads.queue.size + this.downloads.done.size;
|
||||
return this.statusEntries(this.status).length;
|
||||
}
|
||||
|
||||
get folderName(): string {
|
||||
|
|
|
|||
Loading…
Reference in New Issue