fix: load tasks via TasksApi in Knowledge view, remove tab counts
Tasks are not part of the knowledge API (backend rejects type=task). When the Tasks tab is selected, fetch from /api/tasks and convert to KnowledgeItem. Also removes per-type counts from tab labels to prevent tabs from awkwardly resizing when counts load. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -74,15 +74,7 @@ class _KnowledgeScreenState extends ConsumerState<KnowledgeScreen>
|
||||
});
|
||||
}
|
||||
|
||||
String _tabLabel(int index, Map<String, int> counts) {
|
||||
final tab = _kTabs[index];
|
||||
if (tab.type == null) {
|
||||
final total = counts.values.fold(0, (a, b) => a + b);
|
||||
return total > 0 ? 'All ($total)' : 'All';
|
||||
}
|
||||
final count = counts[tab.type];
|
||||
return count != null && count > 0 ? '${tab.label} ($count)' : tab.label;
|
||||
}
|
||||
String _tabLabel(int index) => _kTabs[index].label;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -119,7 +111,7 @@ class _KnowledgeScreenState extends ConsumerState<KnowledgeScreen>
|
||||
tabAlignment: TabAlignment.start,
|
||||
tabs: List.generate(
|
||||
_kTabs.length,
|
||||
(i) => Tab(text: _tabLabel(i, state.counts)),
|
||||
(i) => Tab(text: _tabLabel(i)),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user