Skip to content

Commit

Permalink
fix: initialize new users with leaderboard data
Browse files Browse the repository at this point in the history
  • Loading branch information
AryanVBW committed Jan 6, 2025
1 parent a4a91ab commit 225a018
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/services/localStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ const initializeStore = () => {
github: 'aryanvbw',
role: 'super_admin',
avatar: `https://avatars.githubusercontent.com/aryanvbw`,
devCoins: 100
devCoins: 100,
contributions: [],
joinedAt: new Date().toISOString()
};
setUsers([superAdmin]);
}
Expand Down Expand Up @@ -46,10 +48,13 @@ export const addUser = (userData: SignUpData): User => {
linkedin: userData.linkedin,
role: 'user',
avatar: `https://avatars.githubusercontent.com/${userData.github}`,
devCoins: 0
devCoins: 10,
contributions: [],
joinedAt: new Date().toISOString()
};

setUsers([...users, newUser]);
users.push(newUser);
setUsers(users);
return newUser;
};

Expand Down
11 changes: 11 additions & 0 deletions src/types/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ export interface User {
role: 'user' | 'admin' | 'super_admin';
avatar?: string;
devCoins: number;
contributions: Contribution[];
joinedAt: string;
}

export interface Contribution {
id: string;
type: 'PR' | 'COLLAB' | 'EVENT' | 'OTHER';
description: string;
coins: number;
date: string;
verified: boolean;
}

export interface SignUpData {
Expand Down

0 comments on commit 225a018

Please sign in to comment.