diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index ac7ea11..1d7643f 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom'; +import { BrowserRouter as Router, Navigate, Route, Routes } from 'react-router-dom'; import { AuthProvider, useAuth } from './context/AuthContext'; import { NetworkProvider } from './context/NetworkContext'; import Login from './components/auth/Login'; diff --git a/frontend/src/api/network.ts b/frontend/src/api/network.ts index 60f107e..2e1276c 100644 --- a/frontend/src/api/network.ts +++ b/frontend/src/api/network.ts @@ -44,7 +44,7 @@ export const getUserNetworks = async (): Promise => { export const createNetwork = async (data: CreateNetworkData): Promise => { const response = await axios.post<{ success: boolean; data: Network }>( `${API_URL}/networks`, - data + data, ); return response.data.data; }; @@ -52,7 +52,7 @@ export const createNetwork = async (data: CreateNetworkData): Promise = // Get a specific network export const getNetwork = async (id: string): Promise => { const response = await axios.get<{ success: boolean; data: Network }>( - `${API_URL}/networks/${id}` + `${API_URL}/networks/${id}`, ); return response.data.data; }; @@ -61,7 +61,7 @@ export const getNetwork = async (id: string): Promise => { export const updateNetwork = async (id: string, data: UpdateNetworkData): Promise => { const response = await axios.put<{ success: boolean; data: Network }>( `${API_URL}/networks/${id}`, - data + data, ); return response.data.data; }; diff --git a/frontend/src/api/people.ts b/frontend/src/api/people.ts index c7feb7f..2897a7c 100644 --- a/frontend/src/api/people.ts +++ b/frontend/src/api/people.ts @@ -44,7 +44,7 @@ export interface UpdatePersonData { // Get all people in a network export const getPeople = async (networkId: string): Promise => { const response = await axios.get<{ success: boolean; data: Person[] }>( - `${API_URL}/networks/${networkId}/people` + `${API_URL}/networks/${networkId}/people`, ); return response.data.data; }; @@ -53,7 +53,7 @@ export const getPeople = async (networkId: string): Promise => { export const addPerson = async (networkId: string, data: CreatePersonData): Promise => { const response = await axios.post<{ success: boolean; data: Person }>( `${API_URL}/networks/${networkId}/people`, - data + data, ); return response.data.data; }; @@ -62,11 +62,11 @@ export const addPerson = async (networkId: string, data: CreatePersonData): Prom export const updatePerson = async ( networkId: string, personId: string, - data: UpdatePersonData + data: UpdatePersonData, ): Promise => { const response = await axios.put<{ success: boolean; data: Person }>( `${API_URL}/networks/${networkId}/people/${personId}`, - data + data, ); return response.data.data; }; diff --git a/frontend/src/api/relationships.ts b/frontend/src/api/relationships.ts index 6da87a1..4f90dff 100644 --- a/frontend/src/api/relationships.ts +++ b/frontend/src/api/relationships.ts @@ -33,7 +33,7 @@ export interface UpdateRelationshipData { // Get all relationships in a network export const getRelationships = async (networkId: string): Promise => { const response = await axios.get<{ success: boolean; data: Relationship[] }>( - `${API_URL}/networks/${networkId}/relationships` + `${API_URL}/networks/${networkId}/relationships`, ); return response.data.data; }; @@ -41,11 +41,11 @@ export const getRelationships = async (networkId: string): Promise => { const response = await axios.post<{ success: boolean; data: Relationship }>( `${API_URL}/networks/${networkId}/relationships`, - data + data, ); return response.data.data; }; @@ -54,11 +54,11 @@ export const addRelationship = async ( export const updateRelationship = async ( networkId: string, relationshipId: string, - data: UpdateRelationshipData + data: UpdateRelationshipData, ): Promise => { const response = await axios.put<{ success: boolean; data: Relationship }>( `${API_URL}/networks/${networkId}/relationships/${relationshipId}`, - data + data, ); return response.data.data; }; @@ -66,7 +66,7 @@ export const updateRelationship = async ( // Remove a relationship export const removeRelationship = async ( networkId: string, - relationshipId: string + relationshipId: string, ): Promise => { await axios.delete(`${API_URL}/networks/${networkId}/relationships/${relationshipId}`); }; diff --git a/frontend/src/components/CanvasGraph.tsx b/frontend/src/components/CanvasGraph.tsx index fa3e848..499f80e 100644 --- a/frontend/src/components/CanvasGraph.tsx +++ b/frontend/src/components/CanvasGraph.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useRef, useState, useCallback } from 'react'; +import React, { useCallback, useEffect, useRef, useState } from 'react'; import { GraphData } from 'react-force-graph-2d'; // Define types for graph elements diff --git a/frontend/src/components/FriendshipNetwork.tsx b/frontend/src/components/FriendshipNetwork.tsx index 294b2dc..f27da40 100644 --- a/frontend/src/components/FriendshipNetwork.tsx +++ b/frontend/src/components/FriendshipNetwork.tsx @@ -145,7 +145,7 @@ const FriendshipNetwork: React.FC = () => { refreshNetwork, updatePersonPosition: updatePersonPositionImpl = ( id: string, - position: { x: number; y: number } + position: { x: number; y: number }, ) => { console.warn('updatePersonPosition not implemented'); return Promise.resolve(); @@ -336,7 +336,7 @@ const FriendshipNetwork: React.FC = () => { // Filtered people and relationships const filteredPeople = people.filter(person => - `${person.firstName} ${person.lastName}`.toLowerCase().includes(peopleFilter.toLowerCase()) + `${person.firstName} ${person.lastName}`.toLowerCase().includes(peopleFilter.toLowerCase()), ); const filteredRelationships = relationships.filter(rel => { @@ -430,17 +430,17 @@ const FriendshipNetwork: React.FC = () => { // Create nodes const graphNodes = people.map(person => { const connectionCount = relationships.filter( - r => r.source === person._id || r.target === person._id + r => r.source === person._id || r.target === person._id, ).length; // Determine if node should be highlighted const isSelected = person._id === selectedPersonId; const isConnected = selectedPersonId ? relationships.some( - r => - (r.source === selectedPersonId && r.target === person._id) || - (r.target === selectedPersonId && r.source === person._id) - ) + r => + (r.source === selectedPersonId && r.target === person._id) || + (r.target === selectedPersonId && r.source === person._id), + ) : false; // Determine background color based on connection count or highlight state @@ -540,7 +540,7 @@ const FriendshipNetwork: React.FC = () => { (r.source === relationship.source && r.target === relationship.target) || (relationship.bidirectional && r.source === relationship.target && - r.target === relationship.source) + r.target === relationship.source), ); if (existingRelationship) { @@ -728,7 +728,8 @@ const FriendshipNetwork: React.FC = () => { return (
-
+

Loading your network...

@@ -953,7 +954,7 @@ const FriendshipNetwork: React.FC = () => { {sortedPeople.length > 0 ? ( sortedPeople.map(person => { const connectionCount = relationships.filter( - r => r.source === person._id || r.target === person._id + r => r.source === person._id || r.target === person._id, ).length; return ( @@ -1668,7 +1669,7 @@ const FriendshipNetwork: React.FC = () => {

Connections

{relationships.filter( - r => r.source === editPerson._id || r.target === editPerson._id + r => r.source === editPerson._id || r.target === editPerson._id, ).length > 0 ? ( relationships .filter(r => r.source === editPerson._id || r.target === editPerson._id) diff --git a/frontend/src/components/FriendshipNetworkComponents.tsx b/frontend/src/components/FriendshipNetworkComponents.tsx index 13836c4..4f7291c 100644 --- a/frontend/src/components/FriendshipNetworkComponents.tsx +++ b/frontend/src/components/FriendshipNetworkComponents.tsx @@ -1,4 +1,4 @@ -import React, { useState, useEffect } from 'react'; +import React, { useEffect, useState } from 'react'; import { Transition } from '@headlessui/react'; import { FaTimes } from 'react-icons/fa'; @@ -48,11 +48,11 @@ export interface NetworkStatsProps { // Enhanced Tooltip with animation and positioning export const Tooltip: React.FC = ({ - children, - text, - position = 'top', - delay = 300, -}) => { + children, + text, + position = 'top', + delay = 300, + }) => { const [show, setShow] = useState(false); const [timeoutId, setTimeoutId] = useState(null); @@ -218,15 +218,15 @@ export const Modal: React.FC = ({ isOpen, onClose, title, children, // Enhanced Confirmation dialog export const ConfirmDialog: React.FC = ({ - isOpen, - onClose, - onConfirm, - title, - message, - confirmText = 'Confirm', - cancelText = 'Cancel', - variant = 'danger', -}) => { + isOpen, + onClose, + onConfirm, + title, + message, + confirmText = 'Confirm', + cancelText = 'Cancel', + variant = 'danger', + }) => { const variantClasses = { danger: 'bg-red-600 hover:bg-red-700 focus:ring-red-500', warning: 'bg-amber-600 hover:bg-amber-700 focus:ring-amber-500', @@ -274,7 +274,7 @@ export const NetworkStats: React.FC = ({ people, relationship people.length > 0 ? (relationships.length / people.length).toFixed(1) : '0.0'; const isolatedPeople = people.filter( - person => !relationships.some(r => r.source === person._id || r.target === person._id) + person => !relationships.some(r => r.source === person._id || r.target === person._id), ).length; // Find most connected person @@ -286,8 +286,8 @@ export const NetworkStats: React.FC = ({ people, relationship const mostConnected = personConnectionCounts.length > 0 ? personConnectionCounts.reduce((prev, current) => - prev.count > current.count ? prev : current - ) + prev.count > current.count ? prev : current, + ) : null; return ( @@ -351,12 +351,12 @@ export const NetworkStats: React.FC = ({ people, relationship // Enhanced Toast notification component export const Toast: React.FC = ({ - message, - type, - onClose, - autoClose = true, - duration = 3000, -}) => { + message, + type, + onClose, + autoClose = true, + duration = 3000, + }) => { useEffect(() => { if (autoClose) { const timer = setTimeout(() => { @@ -423,16 +423,16 @@ export interface ButtonProps { } export const Button: React.FC = ({ - children, - onClick, - type = 'button', - variant = 'primary', - size = 'md', - icon, - className = '', - disabled = false, - fullWidth = false, -}) => { + children, + onClick, + type = 'button', + variant = 'primary', + size = 'md', + icon, + className = '', + disabled = false, + fullWidth = false, + }) => { const variantClasses = { primary: 'bg-indigo-600 hover:bg-indigo-700 text-white focus:ring-indigo-500', secondary: 'bg-slate-700 hover:bg-slate-600 text-white focus:ring-slate-500', @@ -481,14 +481,14 @@ export interface FormFieldProps { } export const FormField: React.FC = ({ - label, - id, - error, - required = false, - className = '', - children, - labelClassName = '', -}) => { + label, + id, + error, + required = false, + className = '', + children, + labelClassName = '', + }) => { return (
-
+