Spaces:
Running

File size: 2,039 Bytes
69eac06
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Initialize tooltips
document.addEventListener('DOMContentLoaded', function() {
    const tooltipElements = document.querySelectorAll('[data-tooltip]');
    
    tooltipElements.forEach(element => {
        element.addEventListener('mouseenter', function() {
            const tooltipText = this.getAttribute('data-tooltip');
            const tooltip = document.createElement('div');
            tooltip.className = 'absolute z-50 px-3 py-2 text-sm text-white bg-gray-800 rounded-md shadow-lg';
            tooltip.textContent = tooltipText;
            
            const rect = this.getBoundingClientRect();
            tooltip.style.top = `${rect.top - 40}px`;
            tooltip.style.left = `${rect.left + rect.width / 2}px`;
            tooltip.style.transform = 'translateX(-50%)';
            
            tooltip.id = 'dynamic-tooltip';
            document.body.appendChild(tooltip);
        });
        
        element.addEventListener('mouseleave', function() {
            const tooltip = document.getElementById('dynamic-tooltip');
            if (tooltip) {
                tooltip.remove();
            }
        });
    });
    
    // Mock data for demo purposes
    if (typeof localStorage !== 'undefined') {
        if (!localStorage.getItem('healthData')) {
            const mockData = {
                heartRate: 72,
                bloodPressure: '118/76',
                oxygenLevel: 98,
                appointments: [
                    {
                        doctor: 'Dr. Sarah Johnson',
                        type: 'Cardiology Consultation',
                        date: 'Tomorrow',
                        time: '10:30 AM'
                    },
                    {
                        doctor: 'Lab Test',
                        type: 'Blood Work & Analysis',
                        date: 'Jun 15',
                        time: '1:00 PM'
                    }
                ]
            };
            localStorage.setItem('healthData', JSON.stringify(mockData));
        }
    }
});