diff --git a/NUCLEAR_FAMILY_TREE.md b/NUCLEAR_FAMILY_TREE.md new file mode 100644 index 0000000..fab01f5 --- /dev/null +++ b/NUCLEAR_FAMILY_TREE.md @@ -0,0 +1,160 @@ +# Nuclear Family Tree Network View Documentation + +The Nuclear Family Tree Network View provides an interactive visualization of immediate family relationships, showing the current person with their spouse, parents, and children in a connected network layout. + +## Features Overview + +### 🌳 Interactive Nuclear Family Network +- Visual network layout showing immediate family relationships +- Color-coded family members by role (current person, spouse, parents, children) +- Connection lines showing marriage and parent-child relationships +- Clickable nodes to navigate between family members +- Responsive positioning that adapts to screen size + +### 🎯 Key Capabilities +- **Network Visualization:** Positioned family members with connecting lines +- **Role-Based Coloring:** Visual distinction between family roles +- **Interactive Navigation:** Click any family member to select them +- **Connection Types:** Marriage lines (horizontal, green) and parent-child lines (vertical, blue) +- **Mobile Responsive:** Adaptive layout for different screen sizes +- **Visual Legend:** Color-coded legend explaining family member roles + +## Technical Implementation + +### 1. View Toggle System +- **Details View:** Traditional list-based family information +- **Tree View:** Nuclear family network visualization +- Toggle buttons allow switching between views +- View preference maintained during person selection + +### 2. Nuclear Family Network Layout +```javascript +// Responsive positioning system +const positions = { + current: { x: containerWidth * 0.3, y: containerHeight * 0.4 }, + spouse: { x: containerWidth * 0.6, y: containerHeight * 0.4 }, + parent1: { x: containerWidth * 0.2, y: containerHeight * 0.1 }, + parent2: { x: containerWidth * 0.5, y: containerHeight * 0.1 }, + children: [] // Dynamically positioned based on number of children +}; +``` + +### 3. Family Member Roles and Colors +- **Current Person:** Primary blue background with white text +- **Spouse:** Light green background (#e8f5e8) with green border +- **Parents:** Light yellow background (#fff3cd) with yellow border +- **Children:** Light red background (#f8d7da) with red border + +### 4. Connection Line System +```javascript +// Three types of connection lines +- Marriage Lines: Horizontal green lines connecting spouses +- Parent-Child Lines: Vertical blue lines connecting generations +- Dynamic Positioning: Lines calculated based on element positions +``` + +## Network Layout Structure + +### **Family Positioning:** +``` + [Parent 1] [Parent 2] + \ / + \ / + \ / + [Current Person] ——— [Spouse] + | + | + [Child 1] [Child 2] [Child 3] +``` + +### **Connection Types:** +- **Marriage Connection:** Horizontal line between current person and spouse +- **Parent-Child Connections:** Vertical lines from parents to current person +- **Children Connections:** Vertical lines from current person (and spouse) to children + +## User Interface Features + +### **Interactive Elements:** +- **Clickable Nodes:** All family members are clickable for navigation +- **Hover Effects:** Scale and shadow effects on family member hover +- **Role Indicators:** Text labels showing family role (Current, Spouse, Parent, Child) +- **Visual Legend:** Color-coded legend explaining family member types + +### **Responsive Design:** +- **Desktop:** Full 500px height with optimal spacing +- **Mobile:** Reduced to 350px height with compressed layout +- **Adaptive Positioning:** Percentage-based positioning for different screen sizes +- **Scalable Text:** Font sizes adjust for mobile viewing + +## Implementation Details + +### **Family Member Creation:** +```javascript +function createFamilyMember(person, personId, role, position) { + const member = document.createElement('div'); + member.className = `family-member ${role}`; + member.onclick = () => selectPerson(personId); + member.style.left = `${position.x}px`; + member.style.top = `${position.y}px`; + + member.innerHTML = ` +