feat: phase 6 refactor

This commit is contained in:
2026-02-21 18:19:26 +01:00
parent d70b13952a
commit f9663b07b1
2 changed files with 10 additions and 22 deletions

20
TODO.md
View File

@@ -26,12 +26,11 @@ Create one shared behavior system for Activity Bar buttons, sidebar ownership, a
### B. Click behavior exceptions ### B. Click behavior exceptions
1. No known per-activity click behavior exceptions in `ActivityBar`. 1. No known per-activity click behavior exceptions in `ActivityBar`.
- Activity buttons now follow one shared posts-style switch/toggle pattern. - Activity buttons now follow one shared posts-style switch/toggle pattern.
2. Remaining coupling is in sidebar section navigation (`SettingsNav`/`TagsNav`) and is planned for unified section activation API migration. 2. Sidebar section navigation (`SettingsNav`/`TagsNav`) now uses the shared section activation API.
### C. Sidebar content exceptions ### C. Sidebar content exceptions
1. **Posts/Pages** sidebars are mounted in wrappers with `display: none` when inactive. 1. Sidebars use global Variant B conditional mounting.
2. **Media/Settings/Tags/Chat/Import/Git** sidebars are conditionally mounted. 2. `SettingsNav`/`TagsNav` section state is persisted for remount-safe UX.
3. **SettingsNav/TagsNav** perform section scrolling and can auto-open corresponding tabs before scroll.
### D. Editor content exceptions ### D. Editor content exceptions
1. Editor is primarily tab-driven for tool views (`settings`, `tags`, `chat`, `import`, etc.). 1. Editor is primarily tab-driven for tool views (`settings`, `tags`, `chat`, `import`, etc.).
@@ -39,8 +38,8 @@ Create one shared behavior system for Activity Bar buttons, sidebar ownership, a
3. Some menu commands open tabs directly without harmonizing sidebar ownership. 3. Some menu commands open tabs directly without harmonizing sidebar ownership.
### E. API shape exceptions ### E. API shape exceptions
1. Multiple places directly implement activity behavior logic instead of shared rules. 1. Activity behavior logic is centralized via shared behavior + execution helpers.
2. Open-tab semantics for singleton activities are duplicated across components. 2. Open-tab semantics are centralized in shared tab policy helpers by tab kind.
--- ---
@@ -221,9 +220,9 @@ Pure tab-policy helpers that decide:
- [x] Reduce drift between keyboard/menu/toolbar interactions. - [x] Reduce drift between keyboard/menu/toolbar interactions.
## Phase 6 — Cleanup + Exception Review ## Phase 6 — Cleanup + Exception Review
- Reassess every exception in this file and decide keep/remove. - [x] Reassess every exception in this file and decide keep/remove.
- Remove dead paths and duplicate helpers. - [x] Remove dead paths and duplicate helpers.
- Update tests and docs. - [x] Update tests and docs.
--- ---
@@ -261,4 +260,5 @@ Pure tab-policy helpers that decide:
- [x] Phase 4 complete: introduced `editorRouting` registry/resolver and migrated `Editor` to declarative route->view rendering. - [x] Phase 4 complete: introduced `editorRouting` registry/resolver and migrated `Editor` to declarative route->view rendering.
- [x] Phase 5 complete: introduced shared activity action executor and reused it in `ActivityBar` and menu view handlers. - [x] Phase 5 complete: introduced shared activity action executor and reused it in `ActivityBar` and menu view handlers.
- [x] Phase 5 complete: `menu:viewPosts` and `menu:viewMedia` now follow the same action pipeline as activity-bar clicks. - [x] Phase 5 complete: `menu:viewPosts` and `menu:viewMedia` now follow the same action pipeline as activity-bar clicks.
- [ ] Next implementation slice: Phase 6 (cleanup + exception review). - [x] Phase 6 complete: removed unused activity behavior metadata/constants and refreshed the exception matrix to current architecture.
- [ ] Next implementation slice: optional follow-up (further simplification/perf tuning only if new drift appears).

View File

@@ -17,7 +17,6 @@ interface ActivityConfig {
id: ActivityId; id: ActivityId;
view: SidebarView; view: SidebarView;
labelKey: string; labelKey: string;
placement: 'top' | 'bottom';
activeStrategy: ActiveStrategy; activeStrategy: ActiveStrategy;
clickStrategy: ClickStrategy; clickStrategy: ClickStrategy;
} }
@@ -27,7 +26,6 @@ const ACTIVITY_CONFIG: Record<ActivityId, ActivityConfig> = {
id: 'posts', id: 'posts',
view: 'posts', view: 'posts',
labelKey: 'activity.posts', labelKey: 'activity.posts',
placement: 'top',
activeStrategy: 'sidebar-owner', activeStrategy: 'sidebar-owner',
clickStrategy: 'sidebar-toggle', clickStrategy: 'sidebar-toggle',
}, },
@@ -35,7 +33,6 @@ const ACTIVITY_CONFIG: Record<ActivityId, ActivityConfig> = {
id: 'pages', id: 'pages',
view: 'pages', view: 'pages',
labelKey: 'activity.pages', labelKey: 'activity.pages',
placement: 'top',
activeStrategy: 'sidebar-owner', activeStrategy: 'sidebar-owner',
clickStrategy: 'sidebar-toggle', clickStrategy: 'sidebar-toggle',
}, },
@@ -43,7 +40,6 @@ const ACTIVITY_CONFIG: Record<ActivityId, ActivityConfig> = {
id: 'media', id: 'media',
view: 'media', view: 'media',
labelKey: 'activity.media', labelKey: 'activity.media',
placement: 'top',
activeStrategy: 'sidebar-owner', activeStrategy: 'sidebar-owner',
clickStrategy: 'sidebar-toggle', clickStrategy: 'sidebar-toggle',
}, },
@@ -51,7 +47,6 @@ const ACTIVITY_CONFIG: Record<ActivityId, ActivityConfig> = {
id: 'tags', id: 'tags',
view: 'tags', view: 'tags',
labelKey: 'activity.tags', labelKey: 'activity.tags',
placement: 'top',
activeStrategy: 'sidebar-owner', activeStrategy: 'sidebar-owner',
clickStrategy: 'sidebar-toggle', clickStrategy: 'sidebar-toggle',
}, },
@@ -59,7 +54,6 @@ const ACTIVITY_CONFIG: Record<ActivityId, ActivityConfig> = {
id: 'chat', id: 'chat',
view: 'chat', view: 'chat',
labelKey: 'activity.aiAssistant', labelKey: 'activity.aiAssistant',
placement: 'top',
activeStrategy: 'sidebar-owner', activeStrategy: 'sidebar-owner',
clickStrategy: 'sidebar-toggle', clickStrategy: 'sidebar-toggle',
}, },
@@ -67,7 +61,6 @@ const ACTIVITY_CONFIG: Record<ActivityId, ActivityConfig> = {
id: 'import', id: 'import',
view: 'import', view: 'import',
labelKey: 'activity.import', labelKey: 'activity.import',
placement: 'top',
activeStrategy: 'sidebar-owner', activeStrategy: 'sidebar-owner',
clickStrategy: 'sidebar-toggle', clickStrategy: 'sidebar-toggle',
}, },
@@ -75,7 +68,6 @@ const ACTIVITY_CONFIG: Record<ActivityId, ActivityConfig> = {
id: 'git', id: 'git',
view: 'git', view: 'git',
labelKey: 'activity.sourceControl', labelKey: 'activity.sourceControl',
placement: 'bottom',
activeStrategy: 'sidebar-owner', activeStrategy: 'sidebar-owner',
clickStrategy: 'sidebar-toggle', clickStrategy: 'sidebar-toggle',
}, },
@@ -83,15 +75,11 @@ const ACTIVITY_CONFIG: Record<ActivityId, ActivityConfig> = {
id: 'settings', id: 'settings',
view: 'settings', view: 'settings',
labelKey: 'common.settings', labelKey: 'common.settings',
placement: 'bottom',
activeStrategy: 'sidebar-owner', activeStrategy: 'sidebar-owner',
clickStrategy: 'sidebar-toggle', clickStrategy: 'sidebar-toggle',
}, },
}; };
export const TOP_ACTIVITY_IDS: ActivityId[] = ['posts', 'pages', 'media', 'tags', 'chat', 'import'];
export const BOTTOM_ACTIVITY_IDS: ActivityId[] = ['git', 'settings'];
export function getActivityConfig(activityId: ActivityId): ActivityConfig { export function getActivityConfig(activityId: ActivityId): ActivityConfig {
return ACTIVITY_CONFIG[activityId]; return ACTIVITY_CONFIG[activityId];
} }