File size: 1,145 Bytes
e9a8d0a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import { Influencer } from '../types';

// Get all influencers from localStorage (approved ones only)
export const getInfluencers = (): Influencer[] => {
  try {
    const approvedInfluencers = JSON.parse(localStorage.getItem('approved_influencers') || '[]');
    
    // Convert approved registrations to Influencer format
    const approvedAsInfluencers: Influencer[] = approvedInfluencers.map((reg: any) => ({
      id: reg.id,
      name: reg.name,
      avatar: reg.avatar || reg.name.charAt(0).toUpperCase(),
      bio: reg.bio || '',
      socialLinks: reg.socialLinks?.twitter || reg.socialLinks?.youtube || '',
      isPrivate: reg.isPrivate,
      accessCode: reg.accessCode || '',
      stats: {
        winRate: 0,
        totalPnlPercent: 0,
        activePositions: 0,
        netWorthAllocation: '$0'
      }
    }));

    return approvedAsInfluencers;
  } catch (error) {
    console.error('Error loading approved influencers:', error);
    return [];
  }
};

// Empty array for backward compatibility
export const influencers: Influencer[] = [];

// Empty initial data object
export const initialData: Record<string, any> = {};