icons from extensions, settings-based tab ordering, static context tabs
Icons now declared on TabContribution via the icon field — the hardcoded switch in _BottomRail is a fallback only. All sidebar and context extensions set their Phosphor icon explicitly. PanelRegistry supports setTabOrder(slot, List<String>) — tabs render in the order specified by project.layout.sidebar.order / context.order in settings.yaml. Falls back to registration order. Priority field removed from all contributions. Context tabs are static again — persist with their last content, selection just loads new data and switches focus. No spawn/despawn. Tickets sidebar priority set to -200 (leftmost, default open). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,11 +1,8 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:clide/builtin/decisions/src/decision_detail_view.dart';
|
||||
import 'package:clide/builtin/decisions/src/decisions_view.dart';
|
||||
import 'package:clide/extension/extension.dart';
|
||||
import 'package:clide/kernel/kernel.dart';
|
||||
import 'package:clide/kernel/src/events/message_bus.dart';
|
||||
import 'package:flutter/foundation.dart' show VoidCallback;
|
||||
import 'package:clide/widgets/widgets.dart';
|
||||
|
||||
class DecisionsExtension extends ClideExtension {
|
||||
@override
|
||||
@@ -13,15 +10,10 @@ class DecisionsExtension extends ClideExtension {
|
||||
@override
|
||||
String get title => 'Decisions';
|
||||
@override
|
||||
String get version => '0.3.0';
|
||||
String get version => '0.5.0';
|
||||
@override
|
||||
List<String> get dependsOn => const [];
|
||||
|
||||
ClideExtensionContext? _ctx;
|
||||
StreamSubscription<Message>? _selectionSub;
|
||||
VoidCallback? _panelListener;
|
||||
bool _detailSpawned = false;
|
||||
|
||||
@override
|
||||
List<ContributionPoint> get contributions => [
|
||||
TabContribution(
|
||||
@@ -30,54 +22,15 @@ class DecisionsExtension extends ClideExtension {
|
||||
title: 'Decisions',
|
||||
titleKey: 'tab.title',
|
||||
i18nNamespace: id,
|
||||
priority: -20,
|
||||
icon: PhosphorIcons.lightbulb,
|
||||
build: (_) => const DecisionsView(),
|
||||
),
|
||||
TabContribution(
|
||||
id: 'decisions.detail',
|
||||
slot: Slots.contextPanel,
|
||||
title: 'Decision',
|
||||
icon: PhosphorIcons.lightbulb,
|
||||
build: (_) => const DecisionDetailView(),
|
||||
),
|
||||
];
|
||||
|
||||
@override
|
||||
Future<void> activate(ClideExtensionContext ctx) async {
|
||||
_ctx = ctx;
|
||||
_selectionSub = ctx.messages.subscribe(publisher: id, channel: 'selection').listen(_onSelection);
|
||||
_panelListener = () {
|
||||
if (_detailSpawned && ctx.panels.activeTabIn(Slots.contextPanel) != 'decisions.detail') {
|
||||
_despawnDetail();
|
||||
}
|
||||
};
|
||||
ctx.panels.addListener(_panelListener!);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> deactivate() async {
|
||||
_selectionSub?.cancel();
|
||||
if (_panelListener != null) _ctx?.panels.removeListener(_panelListener!);
|
||||
_despawnDetail();
|
||||
}
|
||||
|
||||
void _onSelection(Message msg) {
|
||||
final ctx = _ctx;
|
||||
if (ctx == null) return;
|
||||
final selectedId = msg.data['id'] as String?;
|
||||
if (selectedId == null) return;
|
||||
|
||||
if (_detailSpawned) {
|
||||
_despawnDetail();
|
||||
}
|
||||
ctx.panels.contribute(TabContribution(
|
||||
id: 'decisions.detail',
|
||||
slot: Slots.contextPanel,
|
||||
title: 'Decision',
|
||||
priority: -50,
|
||||
build: (_) => DecisionDetailView(initialId: selectedId),
|
||||
));
|
||||
_detailSpawned = true;
|
||||
ctx.panels.activateTab(Slots.contextPanel, 'decisions.detail');
|
||||
}
|
||||
|
||||
void _despawnDetail() {
|
||||
if (_detailSpawned) {
|
||||
_ctx?.panels.uncontribute('decisions.detail');
|
||||
_detailSpawned = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user