Fixes
This commit is contained in:
@@ -12,6 +12,7 @@ import MemberFooter from '../components/MemberFooter';
|
||||
import { User, Save, Lock, Heart, Users, Mail, BookUser, Camera, Upload, Trash2 } from 'lucide-react';
|
||||
import { Avatar, AvatarImage, AvatarFallback } from '../components/ui/avatar';
|
||||
import ChangePasswordDialog from '../components/ChangePasswordDialog';
|
||||
import TransactionHistory from '../components/TransactionHistory';
|
||||
|
||||
const Profile = () => {
|
||||
const { user } = useAuth();
|
||||
@@ -24,6 +25,8 @@ const Profile = () => {
|
||||
const fileInputRef = useRef(null);
|
||||
const [maxFileSizeMB, setMaxFileSizeMB] = useState(50); // Default 50MB
|
||||
const [maxFileSizeBytes, setMaxFileSizeBytes] = useState(52428800); // Default 50MB in bytes
|
||||
const [transactions, setTransactions] = useState({ subscriptions: [], donations: [] });
|
||||
const [transactionsLoading, setTransactionsLoading] = useState(true);
|
||||
const [formData, setFormData] = useState({
|
||||
// Personal Information
|
||||
first_name: '',
|
||||
@@ -58,6 +61,7 @@ const Profile = () => {
|
||||
useEffect(() => {
|
||||
fetchConfig();
|
||||
fetchProfile();
|
||||
fetchTransactions();
|
||||
}, []);
|
||||
|
||||
const fetchConfig = async () => {
|
||||
@@ -112,6 +116,19 @@ const Profile = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const fetchTransactions = async () => {
|
||||
try {
|
||||
setTransactionsLoading(true);
|
||||
const response = await api.get('/members/transactions');
|
||||
setTransactions(response.data);
|
||||
} catch (error) {
|
||||
console.error('Failed to load transactions:', error);
|
||||
// Don't show error toast - transactions are optional
|
||||
} finally {
|
||||
setTransactionsLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleInputChange = (e) => {
|
||||
const { name, value } = e.target;
|
||||
setFormData(prev => ({ ...prev, [name]: value }));
|
||||
@@ -703,6 +720,18 @@ const Profile = () => {
|
||||
open={passwordDialogOpen}
|
||||
onOpenChange={setPasswordDialogOpen}
|
||||
/>
|
||||
|
||||
{/* Transaction History Section */}
|
||||
<div className="mt-8">
|
||||
<TransactionHistory
|
||||
subscriptions={transactions.subscriptions}
|
||||
donations={transactions.donations}
|
||||
totalSubscriptionCents={transactions.total_subscription_amount_cents}
|
||||
totalDonationCents={transactions.total_donation_amount_cents}
|
||||
loading={transactionsLoading}
|
||||
isAdmin={false}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<MemberFooter />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user