Skip to content

Commit 5902100

Browse files
committed
feat: enhance Friends page with group breakdown and loading states
- Refactored Friends component to include group breakdown for each friend. - Added loading skeletons while fetching friends data. - Implemented expandable friend rows to show detailed group balances. - Improved error handling and user feedback during data fetching. feat: improve GroupDetails with member management and settings tabs - Added functionality to leave groups and kick members with confirmation prompts. - Introduced settings tabs for group information, members, and danger actions. - Enhanced UI for inviting members and managing group settings. feat: create Profile page for user account management - Implemented profile editing functionality with image upload and name change. - Added modal for editing profile details and handling image selection. - Integrated logout functionality and menu items for account settings. feat: update API service with new endpoints for profile and group management - Added API calls for updating user profiles and managing group memberships. - Included Google login functionality in the authentication service. chore: add Firebase service for Google authentication - Set up Firebase configuration and authentication methods for Google sign-in.
1 parent 13ac19d commit 5902100

File tree

11 files changed

+1840
-159
lines changed

11 files changed

+1840
-159
lines changed

web/App.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import React from 'react';
2-
import { HashRouter, Routes, Route, Navigate } from 'react-router-dom';
2+
import { HashRouter, Navigate, Route, Routes } from 'react-router-dom';
3+
import { Layout } from './components/layout/Layout';
4+
import { ThemeWrapper } from './components/layout/ThemeWrapper';
35
import { AuthProvider, useAuth } from './contexts/AuthContext';
46
import { ThemeProvider } from './contexts/ThemeContext';
57
import { Auth } from './pages/Auth';
68
import { Dashboard } from './pages/Dashboard';
7-
import { Groups } from './pages/Groups';
8-
import { GroupDetails } from './pages/GroupDetails';
99
import { Friends } from './pages/Friends';
10-
import { Layout } from './components/layout/Layout';
11-
import { ThemeWrapper } from './components/layout/ThemeWrapper';
10+
import { GroupDetails } from './pages/GroupDetails';
11+
import { Groups } from './pages/Groups';
12+
import { Profile } from './pages/Profile';
1213

1314
// Protected Route Wrapper
1415
const ProtectedRoute = ({ children }: { children: React.ReactElement }) => {
@@ -35,7 +36,7 @@ const AppRoutes = () => {
3536
<Route path="/groups" element={<ProtectedRoute><Groups /></ProtectedRoute>} />
3637
<Route path="/groups/:id" element={<ProtectedRoute><GroupDetails /></ProtectedRoute>} />
3738
<Route path="/friends" element={<ProtectedRoute><Friends /></ProtectedRoute>} />
38-
<Route path="/profile" element={<ProtectedRoute><div className="p-8 text-center text-xl">Profile Management Coming Soon</div></ProtectedRoute>} />
39+
<Route path="/profile" element={<ProtectedRoute><Profile /></ProtectedRoute>} />
3940

4041
<Route path="*" element={<Navigate to={isAuthenticated ? "/dashboard" : "/login"} />} />
4142
</Routes>

web/components/layout/Sidebar.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import React from 'react';
1+
import { CreditCard, Layers, LayoutDashboard, LogOut, Moon, Sun, UserCircle, Users } from 'lucide-react';
22
import { Link, useLocation } from 'react-router-dom';
3-
import { useTheme } from '../../contexts/ThemeContext';
4-
import { useAuth } from '../../contexts/AuthContext';
53
import { THEMES } from '../../constants';
6-
import { LayoutDashboard, Users, UserCircle, LogOut, Sun, Moon, Layers, CreditCard, UserPlus } from 'lucide-react';
4+
import { useAuth } from '../../contexts/AuthContext';
5+
import { useTheme } from '../../contexts/ThemeContext';
76
import { Button } from '../ui/Button';
87

98
export const Sidebar = () => {
@@ -56,9 +55,13 @@ export const Sidebar = () => {
5655
<div className="mt-auto flex flex-col gap-4">
5756
{user && (
5857
<div className={`p-4 flex items-center gap-3 ${style === THEMES.NEOBRUTALISM ? 'border-2 border-black bg-white text-black' : 'rounded-xl bg-black/20 text-white'}`}>
59-
<div className="w-8 h-8 rounded-full bg-gradient-to-br from-yellow-400 to-orange-500 flex items-center justify-center font-bold text-white">
60-
{user.name.charAt(0)}
61-
</div>
58+
{user.imageUrl && /^(https?:|data:image)/.test(user.imageUrl) ? (
59+
<img src={user.imageUrl} alt={user.name} className="w-8 h-8 rounded-full object-cover" />
60+
) : (
61+
<div className="w-8 h-8 rounded-full bg-gradient-to-br from-yellow-400 to-orange-500 flex items-center justify-center font-bold text-white">
62+
{user.name.charAt(0)}
63+
</div>
64+
)}
6265
<div className="flex-1 overflow-hidden">
6366
<p className="font-bold truncate">{user.name}</p>
6467
</div>

web/contexts/AuthContext.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react';
2-
import { User } from '../types';
1+
import { createContext, ReactNode, useContext, useEffect, useState } from 'react';
32
import { getProfile } from '../services/api';
3+
import { User } from '../types';
44

55
interface AuthContextType {
66
user: User | null;
77
isAuthenticated: boolean;
88
isLoading: boolean;
99
login: (token: string, user: User) => void;
1010
logout: () => void;
11+
updateUserInContext: (userData: User) => void;
1112
}
1213

1314
const AuthContext = createContext<AuthContextType | undefined>(undefined);
@@ -47,8 +48,12 @@ export const AuthProvider = ({ children }: { children: ReactNode }) => {
4748
setUser(null);
4849
};
4950

51+
const updateUserInContext = (userData: User) => {
52+
setUser(userData);
53+
};
54+
5055
return (
51-
<AuthContext.Provider value={{ user, isAuthenticated: !!user, isLoading, login, logout }}>
56+
<AuthContext.Provider value={{ user, isAuthenticated: !!user, isLoading, login, logout, updateUserInContext }}>
5257
{children}
5358
</AuthContext.Provider>
5459
);

0 commit comments

Comments
 (0)