Integration Overview
WikiOnitViewer and WikiPrepareViewer share significant infrastructure through WikiBaseViewer inheritance while serving distinct purposes in the work-wiki workflow.Shared Infrastructure
Base Class Properties
Inherited by both viewers:container: DOM mount pointprojectSlug: Project identifier (e.g., “monolex-006”)category: Wiki category (“onit”, “prepare”)isWip: WIP vs Wiki mode flagsettings: User preferences from localStoragecurrentDocument: Currently selected document path
Base Class Methods
18 protected methods shared: Core Initialization:initBase(): Setup container, projectSlug, settingsloadDocuments(): IPC call to list documentsgetBasePath(): Path calculation (wip vs wiki)loadSettings(): Load from localStorage
loadDocumentContent(): Read file via IPCgraduateDocument(): Move wip → wikitoggleAccordion(): Expand/collapse with cachingrenderDocumentInline(): Markdown rendering
getViewerStyles(): Font, size, opacityrenderHeader(): Title, icon, countrenderToggleButtons(): WIP/Wiki buttonsgetToggleButtonStyle(): Active state styling
Code Reuse Analysis
OnIt Reuse:- Own code: 350 lines
- Reused: ~240 lines from base
- Effective total: ~590 lines
- Reuse ratio: 41%
- Own code: 789 lines
- Reused: ~240 lines from base
- Effective total: ~1029 lines
- Reuse ratio: 23%
Shared Patterns
Initialization Pattern
Both follow identical lifecycle:- OnIt: Single
loadSessions()call - Prepare: Dual
loadProjects()+loadDocuments()calls
Refresh Pattern
Identical refresh implementation:Event Listener Pattern
Both use base class toggle listeners plus viewer-specific handlers: OnIt:attachToggleListeners()(base)- Session accordion headers
attachToggleListeners()(base)- Project card headers
- File accordion headers (with
stopPropagation())
Data Model Comparison
OnIt Session
Prepare Project
Prepare Document
Status Systems
OnIt (3 states, time-based)
| Status | Trigger | Color |
|---|---|---|
| Active | Modified < 24h | Green |
| Completed | Modified > 24h, in WIP | Blue |
| Archived | In wiki folder | Gray |
Prepare Project (4 states, explicit)
| Status | Source | Color |
|---|---|---|
| Ready | Frontmatter | Green |
| In Progress | Frontmatter | Blue |
| Blocked | Frontmatter | Red |
| Completed | Frontmatter | Gray |
Filename Parsing
OnIt: 6-Pattern External Parser
Handles historical variety:- Pattern 1-3: Timestamp variations (with/without seconds)
- Pattern 4: Date only
- Pattern 5: Prefix format
- Pattern 6: Fallback (no date)
Prepare: Single-Pattern Inline
Simple regex:Render Architecture
OnIt (7 methods, flat list)
Hierarchy:Prepare (12 methods, dual mode)
Project Mode Hierarchy:Workflow Transitions
OnIt → Prepare Flow
Stage 1: Active Work (OnIt)Path Calculation
Both use identical base class path logic:- OnIt WIP:
.../monolex-006/wip/onit - OnIt Wiki:
.../monolex-006/wiki/onit - Prepare WIP:
.../monolex-006/wip/prepare - Prepare Wiki:
.../monolex-006/wiki/prepare
Global Registration
Both register on window object for dynamic instantiation:Feature Matrix
| Feature | OnIt | Prepare |
|---|---|---|
| Metrics | ||
| Lines of code | 350 | 789 |
| Data arrays | 1 | 2 |
| Render methods | 7 | 12 |
| Base reuse ratio | 41% | 23% |
| Parsing | ||
| Filename patterns | 6 | 1 |
| Parser location | External | Inline |
| Status | ||
| Status states | 3 | 4 (projects) |
| Determination | Time-based | Frontmatter |
| Display | ||
| Display modes | 1 | 2 |
| Visual hierarchy | 2 levels | 3 levels |
| Default expand | None | First project |
| Features | ||
| Progress tracking | No | Yes |
| Frontmatter parsing | No | Yes |
| Type grouping | No | Yes |
Integration Principles
Shared Infrastructure:- Common base enables consistent UX
- Accordion system preserves content inline
- Toggle mechanism supports document lifecycle
- OnIt: Simple, chronological, session-based
- Prepare: Complex, project-based, progress-tracked
- Shared patterns for common behavior
- Specialized code only where needed
- External parser for OnIt’s complexity
- Inline parser for Prepare’s simplicity
THE CENTER
Integration enables workflow continuity
Technical Credibility
Shared WikiBaseViewer abstract class (580 lines). TypeScript inheritance with protected members. Consistent IPC patterns via Tauri commands. Single source of truth for path calculation. Window global registration for dynamic instantiation.