19 Commits

Author SHA1 Message Date
48c5a916d9 Merge pull request 'dev' (#19) from dev into loaf-prod
Reviewed-on: #19
2026-01-26 11:22:19 +00:00
Koncept Kit
002ef5c897 Fixes 2026-01-24 23:56:15 +07:00
7d0c207f1b Merge pull request 'theme-provider' (#18) from theme-provider into dev
Reviewed-on: #18
2026-01-21 04:58:57 +00:00
kayela
8ea486a4f4 feat: enhance date formatting in AdminUserView for improved readability and consistency 2026-01-20 22:51:44 -06:00
kayela
264ee860df feat: add member since date handling in CreateMemberDialog and CreateStaffDialog for improved member tracking 2026-01-20 16:16:23 -06:00
kayela
65c3e3b92d fix: update color styles in AdminSidebar, Register, and CSS files for improved UI consistency 2026-01-20 16:02:54 -06:00
kayela
819062d697 fixed spacing in AdminMembers.js 2026-01-20 14:45:05 -06:00
kayela
c73ebfb6c0 feat: implement StatCard component and integrate it into AdminDashboard and AdminMembers for improved stats display 2026-01-20 14:43:17 -06:00
kayela
3822ba8ffb feat: add member since date handling across admin and member views 2026-01-20 12:33:17 -06:00
Koncept Kit
c79db66739 - Details Column - Expandable chevron button for each row- Expandable Transaction Details - Click chevron to show/hide details- Payment Information Section:- Stripe Transaction IDs Section- Copy to Clipboard - One-click copy for all transaction IDs- Update Stripe webhook event permission on Stripe Config page. 2026-01-20 23:52:35 +07:00
Koncept Kit
57cd18ad9d - Add Settings menu for Stripe configuration- In the Member Profile page, Superadmin can assign new Role to the member- Stripe Configuration is now stored with encryption in Database 2026-01-16 19:07:14 +07:00
56dd9eeb77 Merge pull request 'theme-provider' (#16) from theme-provider into dev
Reviewed-on: #16
2026-01-16 10:40:04 +00:00
1f9e6ea191 Merge pull request 'Remove View Public Site on AdminSidebar' (#14) from dev into loaf-prod
Reviewed-on: #14
2026-01-08 17:24:35 +00:00
66c2bedbed Merge pull request 'Merge from Dev to LOAF Production' (#13) from dev into loaf-prod
Reviewed-on: #13
2026-01-07 08:44:10 +00:00
d94ea7b6d5 Merge pull request 'feat(frontend): Comprehensive RBAC implementation across admin pages' (#10) from dev into loaf-prod
Reviewed-on: #10
2026-01-06 08:35:56 +00:00
24519a7080 Merge pull request 'Improve UX with navigation, attendance management, and calendar fixes' (#9) from dev into loaf-prod
Reviewed-on: #9
2026-01-05 18:08:57 +00:00
b1b9a05d4f Merge pull request 'Merge from Dev' (#8) from dev into loaf-prod
Reviewed-on: #8
2026-01-05 08:49:42 +00:00
a2070b4e4e Merge pull request 'Fix staff invitation acceptance & add delete/deactivate buttons' (#7) from dev into loaf-prod
Reviewed-on: #7
2026-01-04 17:12:03 +00:00
6a21d32319 Merge pull request 'LOAF Prod' (#6) from dev into loaf-prod
Reviewed-on: #6
2026-01-04 12:48:26 +00:00
21 changed files with 1930 additions and 473 deletions

View File

@@ -22,6 +22,7 @@ import AdminUserView from './pages/admin/AdminUserView';
import AdminStaff from './pages/admin/AdminStaff'; import AdminStaff from './pages/admin/AdminStaff';
import AdminMembers from './pages/admin/AdminMembers'; import AdminMembers from './pages/admin/AdminMembers';
import AdminPermissions from './pages/admin/AdminPermissions'; import AdminPermissions from './pages/admin/AdminPermissions';
import AdminSettings from './pages/admin/AdminSettings';
import AdminRoles from './pages/admin/AdminRoles'; import AdminRoles from './pages/admin/AdminRoles';
import AdminEvents from './pages/admin/AdminEvents'; import AdminEvents from './pages/admin/AdminEvents';
import AdminEventAttendance from './pages/admin/AdminEventAttendance'; import AdminEventAttendance from './pages/admin/AdminEventAttendance';
@@ -290,6 +291,13 @@ function App() {
</AdminLayout> </AdminLayout>
</PrivateRoute> </PrivateRoute>
} /> } />
<Route path="/admin/settings" element={
<PrivateRoute adminOnly>
<AdminLayout>
<AdminSettings />
</AdminLayout>
</PrivateRoute>
} />
{/* 404 - Catch all undefined routes */} {/* 404 - Catch all undefined routes */}
<Route path="*" element={<NotFound />} /> <Route path="*" element={<NotFound />} />

View File

@@ -175,17 +175,28 @@ const AdminSidebar = ({ isOpen, onToggle, isMobile }) => {
path: '/admin/permissions', path: '/admin/permissions',
disabled: false, disabled: false,
superadminOnly: true superadminOnly: true
},
{
name: 'Settings',
icon: Settings,
path: '/admin/settings',
disabled: false,
superadminOnly: true
} }
]; ];
// Filter nav items based on user role // Filter nav items based on user role
const filteredNavItems = navItems.filter(item => { const filteredNavItems = navItems.filter(item => {
if (item.superadminOnly && user?.role !== 'superadmin') { if (item.superadminOnly && user?.role !== 'superadmin') {
console.log('Filtering out superadmin-only item:', item.name, 'User role:', user?.role);
return false; return false;
} }
return true; return true;
}); });
// Debug: Log filtered items count
console.log('Total nav items:', navItems.length, 'Filtered items:', filteredNavItems.length, 'User role:', user?.role);
const isActive = (path) => { const isActive = (path) => {
if (path === '/admin') { if (path === '/admin') {
return location.pathname === '/admin'; return location.pathname === '/admin';
@@ -213,7 +224,7 @@ const AdminSidebar = ({ isOpen, onToggle, isMobile }) => {
${item.disabled ${item.disabled
? 'opacity-50 cursor-not-allowed text-brand-purple ' ? 'opacity-50 cursor-not-allowed text-brand-purple '
: active : active
? 'bg-[var(--orange-light)]/10 text-[var(--orange-light)]' ? 'bg-[var(--orange-light)]/10 text-[var(--purple-ink)]'
: 'text-[var(--purple-ink)] hover:bg-[var(--neutral-800)]/20' : 'text-[var(--purple-ink)] hover:bg-[var(--neutral-800)]/20'
} }
`} `}
@@ -243,7 +254,7 @@ const AdminSidebar = ({ isOpen, onToggle, isMobile }) => {
{/* Badge when collapsed */} {/* Badge when collapsed */}
{!isOpen && item.badge > 0 && !item.disabled && ( {!isOpen && item.badge > 0 && !item.disabled && (
<div className="absolute -top-1 -right-1 bg-accent foreground text-xs rounded-full h-5 w-5 flex items-center justify-center font-medium"> <div className="absolute -top-1 -right-1 bg-accent text-white foreground text-xs rounded-full h-5 w-5 flex items-center justify-center font-medium">
{item.badge} {item.badge}
</div> </div>
)} )}
@@ -364,12 +375,22 @@ const AdminSidebar = ({ isOpen, onToggle, isMobile }) => {
{renderNavItem(filteredNavItems.find(item => item.name === 'Bylaws'))} {renderNavItem(filteredNavItems.find(item => item.name === 'Bylaws'))}
</div> </div>
{/* Permissions - Superadmin only (no header) */} {/* SYSTEM Section - Superadmin only */}
{user?.role === 'superadmin' && ( {user?.role === 'superadmin' && (
<div className="mt-6"> <>
{renderNavItem(filteredNavItems.find(item => item.name === 'Permissions'))} {isOpen && (
<div className="px-4 py-2 mt-6">
<h3 className="text-xs font-semibold text-muted-foreground uppercase tracking-wider">
System
</h3>
</div> </div>
)} )}
<div className="space-y-1">
{renderNavItem(filteredNavItems.find(item => item.name === 'Permissions'))}
{renderNavItem(filteredNavItems.find(item => item.name === 'Settings'))}
</div>
</>
)}
</nav> </nav>
{/* User Section */} {/* User Section */}

View File

@@ -0,0 +1,149 @@
import React, { useState, useEffect } from 'react';
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription } from './ui/dialog';
import { Button } from './ui/button';
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from './ui/select';
import { Label } from './ui/label';
import { AlertCircle, Shield } from 'lucide-react';
import api from '../utils/api';
import { toast } from 'sonner';
export default function ChangeRoleDialog({ open, onClose, user, onSuccess }) {
const [roles, setRoles] = useState([]);
const [selectedRole, setSelectedRole] = useState('');
const [selectedRoleId, setSelectedRoleId] = useState(null);
const [loadingRoles, setLoadingRoles] = useState(false);
const [submitting, setSubmitting] = useState(false);
useEffect(() => {
if (open) {
fetchRoles();
// Pre-select current role
setSelectedRole(user.role);
setSelectedRoleId(user.role_id);
}
}, [open, user]);
const fetchRoles = async () => {
setLoadingRoles(true);
try {
// Reuse existing endpoint that returns assignable roles based on privilege
const response = await api.get('/admin/roles/assignable');
// Map API response to format expected by Select component
const mappedRoles = response.data.map(role => ({
value: role.code,
label: role.name,
id: role.id,
description: role.description
}));
setRoles(mappedRoles);
} catch (error) {
console.error('Failed to fetch assignable roles:', error);
toast.error('Failed to load roles. Please try again.');
} finally {
setLoadingRoles(false);
}
};
const handleSubmit = async () => {
if (!selectedRole) {
toast.error('Please select a role');
return;
}
// Don't submit if role hasn't changed
if (selectedRole === user.role && selectedRoleId === user.role_id) {
toast.info('The selected role is the same as current role');
return;
}
setSubmitting(true);
try {
await api.put(`/admin/users/${user.id}/role`, {
role: selectedRole,
role_id: selectedRoleId
});
toast.success(`Role changed to ${selectedRole}`);
onSuccess();
onClose();
} catch (error) {
const message = error.response?.data?.detail || 'Failed to change role';
toast.error(message);
} finally {
setSubmitting(false);
}
};
return (
<Dialog open={open} onOpenChange={onClose}>
<DialogContent className="sm:max-w-[500px]">
<DialogHeader>
<DialogTitle className="flex items-center gap-2">
<Shield className="h-5 w-5 text-[#664fa3]" />
Change User Role
</DialogTitle>
<DialogDescription>
Change role for {user.first_name} {user.last_name} ({user.email})
</DialogDescription>
</DialogHeader>
<div className="space-y-4 py-4">
{/* Current Role Display */}
<div className="p-3 bg-[#f1eef9] rounded-lg border border-[#DDD8EB]">
<p className="text-sm text-gray-600">Current Role</p>
<p className="font-semibold text-[#664fa3] capitalize">{user.role}</p>
</div>
{/* Role Selection */}
<div className="space-y-2">
<Label htmlFor="role">New Role</Label>
<Select value={selectedRole} onValueChange={setSelectedRole} disabled={loadingRoles}>
<SelectTrigger>
<SelectValue placeholder={loadingRoles ? "Loading roles..." : "Select role"} />
</SelectTrigger>
<SelectContent>
{roles.map((role) => (
<SelectItem key={role.value} value={role.value}>
<span className="capitalize">{role.label}</span>
</SelectItem>
))}
</SelectContent>
</Select>
</div>
{/* Warning for privileged roles */}
{(selectedRole === 'admin' || selectedRole === 'superadmin') && (
<div className="flex items-start gap-2 p-3 bg-amber-50 border border-amber-200 rounded-lg">
<AlertCircle className="h-5 w-5 text-amber-600 flex-shrink-0 mt-0.5" />
<div className="text-sm">
<p className="font-semibold text-amber-900">Admin Access Warning</p>
<p className="text-amber-700">
This user will gain full administrative access to the system.
</p>
</div>
</div>
)}
</div>
<div className="flex justify-end gap-3">
<Button
variant="outline"
onClick={onClose}
disabled={submitting}
className="border-2 border-gray-300 rounded-full"
>
Cancel
</Button>
<Button
onClick={handleSubmit}
disabled={submitting || loadingRoles}
className="bg-[#664fa3] hover:bg-[#7d5ec2] text-white rounded-full"
>
{submitting ? 'Changing Role...' : 'Change Role'}
</Button>
</div>
</DialogContent>
</Dialog>
);
}

View File

@@ -31,6 +31,7 @@ const CreateMemberDialog = ({ open, onOpenChange, onSuccess }) => {
}); });
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [errors, setErrors] = useState({}); const [errors, setErrors] = useState({});
const getTodayDate = () => new Date().toISOString().slice(0, 10);
const handleChange = (field, value) => { const handleChange = (field, value) => {
setFormData(prev => ({ ...prev, [field]: value })); setFormData(prev => ({ ...prev, [field]: value }));
@@ -84,8 +85,8 @@ const CreateMemberDialog = ({ open, onOpenChange, onSuccess }) => {
if (payload.date_of_birth === '') { if (payload.date_of_birth === '') {
delete payload.date_of_birth; delete payload.date_of_birth;
} }
if (payload.member_since === '') { if (!payload.member_since) {
delete payload.member_since; payload.member_since = getTodayDate();
} }
await api.post('/admin/users/create', payload); await api.post('/admin/users/create', payload);

View File

@@ -22,10 +22,12 @@ const CreateStaffDialog = ({ open, onOpenChange, onSuccess }) => {
first_name: '', first_name: '',
last_name: '', last_name: '',
phone: '', phone: '',
member_since: '',
role: 'admin' role: 'admin'
}); });
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [errors, setErrors] = useState({}); const [errors, setErrors] = useState({});
const getTodayDate = () => new Date().toISOString().slice(0, 10);
const handleChange = (field, value) => { const handleChange = (field, value) => {
setFormData(prev => ({ ...prev, [field]: value })); setFormData(prev => ({ ...prev, [field]: value }));
@@ -74,7 +76,11 @@ const CreateStaffDialog = ({ open, onOpenChange, onSuccess }) => {
setLoading(true); setLoading(true);
try { try {
await api.post('/admin/users/create', formData); const payload = { ...formData };
if (!payload.member_since) {
payload.member_since = getTodayDate();
}
await api.post('/admin/users/create', payload);
toast.success('Staff member created successfully'); toast.success('Staff member created successfully');
// Reset form // Reset form
@@ -84,6 +90,7 @@ const CreateStaffDialog = ({ open, onOpenChange, onSuccess }) => {
first_name: '', first_name: '',
last_name: '', last_name: '',
phone: '', phone: '',
member_since: '',
role: 'admin' role: 'admin'
}); });
@@ -200,6 +207,20 @@ const CreateStaffDialog = ({ open, onOpenChange, onSuccess }) => {
)} )}
</div> </div>
{/* Member Since */}
<div className="grid gap-2">
<Label htmlFor="member_since" className="text-[var(--purple-ink)]">
Member Since
</Label>
<Input
id="member_since"
type="date"
value={formData.member_since}
onChange={(e) => handleChange('member_since', e.target.value)}
className="rounded-xl border-2 border-[var(--neutral-800)] focus:border-brand-purple "
/>
</div>
{/* Role */} {/* Role */}
<div className="grid gap-2"> <div className="grid gap-2">
<Label htmlFor="role" className="text-[var(--purple-ink)]"> <Label htmlFor="role" className="text-[var(--purple-ink)]">

View File

@@ -0,0 +1,36 @@
import React from "react";
import { Card } from "./ui/card";
export const StatCard = ({
title,
value,
icon: Icon,
iconBgClass,
dataTestId,
}) => (
<Card
className="p-6 flex flex-col justify-between bg-background rounded-2xl border border-[var(--neutral-800)]"
data-testid={dataTestId}
>
<div className="flex items-start gap-4 mb-4 ">
<div className={`${iconBgClass} p-3 rounded-lg `}>
<Icon className="size-8" />
</div>
<div className="space-y-8">
<p
className="text-6xl font-semibold text-[var(--purple-ink)] mb-1"
style={{ fontFamily: "'Inter', sans-serif" }}
>
{value}
</p>
</div>
</div>
<p
className="text-sm text-brand-purple "
style={{ fontFamily: "'Nunito Sans', sans-serif" }}
>
{title}
</p>
</Card>
);

View File

@@ -0,0 +1,252 @@
import React, { useState } from 'react';
import { Card } from './ui/card';
import { Badge } from './ui/badge';
import { Button } from './ui/button';
import { Tabs, TabsContent, TabsList, TabsTrigger } from './ui/tabs';
import { Receipt, CreditCard, Heart, Calendar, ExternalLink, DollarSign } from 'lucide-react';
/**
* TransactionHistory Component
* Displays user transaction history including subscriptions and donations
*
* @param {Object} props
* @param {Array} props.subscriptions - List of subscription transactions
* @param {Array} props.donations - List of donation transactions
* @param {number} props.totalSubscriptionCents - Total subscription amount in cents
* @param {number} props.totalDonationCents - Total donation amount in cents
* @param {boolean} props.loading - Loading state
* @param {boolean} props.isAdmin - Whether viewing as admin (shows extra fields)
*/
const TransactionHistory = ({
subscriptions = [],
donations = [],
totalSubscriptionCents = 0,
totalDonationCents = 0,
loading = false,
isAdmin = false
}) => {
const [activeTab, setActiveTab] = useState('all');
const formatAmount = (cents) => {
if (!cents) return '$0.00';
return `$${(cents / 100).toFixed(2)}`;
};
const formatDate = (dateString) => {
if (!dateString) return 'N/A';
return new Date(dateString).toLocaleDateString('en-US', {
year: 'numeric',
month: 'short',
day: 'numeric'
});
};
const getStatusBadgeClass = (status) => {
switch (status?.toLowerCase()) {
case 'active':
case 'completed':
return 'bg-green-100 text-green-800 border-green-200';
case 'pending':
return 'bg-yellow-100 text-yellow-800 border-yellow-200';
case 'cancelled':
case 'failed':
case 'expired':
return 'bg-red-100 text-red-800 border-red-200';
default:
return 'bg-gray-100 text-gray-800 border-gray-200';
}
};
const allTransactions = [
...subscriptions.map(s => ({ ...s, sortDate: s.created_at })),
...donations.map(d => ({ ...d, sortDate: d.created_at }))
].sort((a, b) => new Date(b.sortDate) - new Date(a.sortDate));
const TransactionRow = ({ transaction }) => {
const isSubscription = transaction.type === 'subscription';
return (
<div className="flex flex-col sm:flex-row sm:items-center justify-between p-4 border-b border-[var(--neutral-800)] last:border-b-0 hover:bg-[var(--lavender-500)] transition-colors">
<div className="flex items-start gap-3 mb-2 sm:mb-0">
<div className={`p-2 rounded-lg ${isSubscription ? 'bg-[var(--purple-lavender)] bg-opacity-20' : 'bg-[var(--orange-light)] bg-opacity-20'}`}>
{isSubscription ? (
<CreditCard className="h-5 w-5 text-[var(--purple-lavender)]" />
) : (
<Heart className="h-5 w-5 text-[var(--orange-light)]" />
)}
</div>
<div className="flex-1">
<div className="flex items-center gap-2 flex-wrap">
<span className="font-medium text-[var(--purple-ink)]" style={{ fontFamily: "'Nunito Sans', sans-serif" }}>
{transaction.description}
</span>
<Badge className={`text-xs ${getStatusBadgeClass(transaction.status)}`}>
{transaction.status}
</Badge>
</div>
<div className="flex items-center gap-2 text-sm text-brand-purple mt-1" style={{ fontFamily: "'Nunito Sans', sans-serif" }}>
<Calendar className="h-3 w-3" />
<span>{formatDate(transaction.payment_completed_at || transaction.created_at)}</span>
{transaction.card_brand && transaction.card_last4 && (
<>
<span className="text-[var(--neutral-800)]"></span>
<span>{transaction.card_brand} ****{transaction.card_last4}</span>
</>
)}
{isSubscription && transaction.billing_cycle && (
<>
<span className="text-[var(--neutral-800)]"></span>
<span className="capitalize">{transaction.billing_cycle}</span>
</>
)}
</div>
{isAdmin && transaction.manual_payment && (
<div className="text-xs text-[var(--orange-light)] mt-1">
Manual Payment {transaction.manual_payment_notes && `- ${transaction.manual_payment_notes}`}
</div>
)}
</div>
</div>
<div className="flex items-center gap-3 pl-10 sm:pl-0">
<div className="text-right">
<div className="font-semibold text-[var(--purple-ink)]" style={{ fontFamily: "'Inter', sans-serif" }}>
{formatAmount(transaction.amount_cents)}
</div>
{isSubscription && transaction.donation_cents > 0 && (
<div className="text-xs text-brand-purple" style={{ fontFamily: "'Nunito Sans', sans-serif" }}>
(incl. {formatAmount(transaction.donation_cents)} donation)
</div>
)}
</div>
{transaction.stripe_receipt_url && (
<a
href={transaction.stripe_receipt_url}
target="_blank"
rel="noopener noreferrer"
className="p-2 text-brand-purple hover:text-[var(--purple-ink)] hover:bg-[var(--lavender-300)] rounded-lg transition-colors"
title="View Receipt"
>
<ExternalLink className="h-4 w-4" />
</a>
)}
</div>
</div>
);
};
const EmptyState = ({ type }) => (
<div className="py-12 text-center">
<div className="mx-auto w-16 h-16 bg-[var(--lavender-300)] rounded-full flex items-center justify-center mb-4">
{type === 'subscription' ? (
<CreditCard className="h-8 w-8 text-brand-purple" />
) : type === 'donation' ? (
<Heart className="h-8 w-8 text-brand-purple" />
) : (
<Receipt className="h-8 w-8 text-brand-purple" />
)}
</div>
<p className="text-brand-purple" style={{ fontFamily: "'Nunito Sans', sans-serif" }}>
{type === 'subscription'
? 'No subscription payments yet'
: type === 'donation'
? 'No donations yet'
: 'No transactions yet'}
</p>
</div>
);
if (loading) {
return (
<Card className="p-8 bg-background rounded-2xl border border-[var(--neutral-800)]">
<div className="flex items-center justify-center py-12">
<div className="animate-spin rounded-full h-8 w-8 border-b-2 border-[var(--purple-lavender)]"></div>
</div>
</Card>
);
}
return (
<Card className="p-6 bg-background rounded-2xl border border-[var(--neutral-800)]">
<div className="flex items-center justify-between mb-6">
<h2 className="text-2xl font-semibold text-[var(--purple-ink)] flex items-center gap-2" style={{ fontFamily: "'Inter', sans-serif" }}>
<Receipt className="h-6 w-6 text-brand-purple" />
Transaction History
</h2>
</div>
{/* Summary Cards */}
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4 mb-6">
<div className="p-4 bg-[var(--lavender-500)] rounded-xl border border-[var(--neutral-800)]">
<div className="flex items-center gap-2 text-brand-purple mb-1" style={{ fontFamily: "'Nunito Sans', sans-serif" }}>
<CreditCard className="h-4 w-4" />
<span className="text-sm">Total Subscriptions</span>
</div>
<div className="text-2xl font-semibold text-[var(--purple-ink)]" style={{ fontFamily: "'Inter', sans-serif" }}>
{formatAmount(totalSubscriptionCents)}
</div>
<div className="text-xs text-brand-purple mt-1">{subscriptions.length} payment(s)</div>
</div>
<div className="p-4 bg-[var(--lavender-500)] rounded-xl border border-[var(--neutral-800)]">
<div className="flex items-center gap-2 text-brand-purple mb-1" style={{ fontFamily: "'Nunito Sans', sans-serif" }}>
<Heart className="h-4 w-4" />
<span className="text-sm">Total Donations</span>
</div>
<div className="text-2xl font-semibold text-[var(--purple-ink)]" style={{ fontFamily: "'Inter', sans-serif" }}>
{formatAmount(totalDonationCents)}
</div>
<div className="text-xs text-brand-purple mt-1">{donations.length} donation(s)</div>
</div>
</div>
{/* Tabs */}
<Tabs value={activeTab} onValueChange={setActiveTab} className="w-full">
<TabsList className="grid w-full grid-cols-3 mb-4">
<TabsTrigger value="all" className="data-[state=active]:bg-[var(--purple-lavender)] data-[state=active]:text-white">
All ({allTransactions.length})
</TabsTrigger>
<TabsTrigger value="subscriptions" className="data-[state=active]:bg-[var(--purple-lavender)] data-[state=active]:text-white">
Subscriptions ({subscriptions.length})
</TabsTrigger>
<TabsTrigger value="donations" className="data-[state=active]:bg-[var(--purple-lavender)] data-[state=active]:text-white">
Donations ({donations.length})
</TabsTrigger>
</TabsList>
<div className="border border-[var(--neutral-800)] rounded-xl overflow-hidden">
<TabsContent value="all" className="m-0">
{allTransactions.length > 0 ? (
allTransactions.map((transaction) => (
<TransactionRow key={transaction.id} transaction={transaction} />
))
) : (
<EmptyState type="all" />
)}
</TabsContent>
<TabsContent value="subscriptions" className="m-0">
{subscriptions.length > 0 ? (
subscriptions.map((transaction) => (
<TransactionRow key={transaction.id} transaction={transaction} />
))
) : (
<EmptyState type="subscription" />
)}
</TabsContent>
<TabsContent value="donations" className="m-0">
{donations.length > 0 ? (
donations.map((transaction) => (
<TransactionRow key={transaction.id} transaction={transaction} />
))
) : (
<EmptyState type="donation" />
)}
</TabsContent>
</div>
</Tabs>
</Card>
);
};
export default TransactionHistory;

View File

@@ -1,50 +1,65 @@
import * as React from "react" import * as React from "react";
import { cn } from "@/lib/utils" import { cn } from "@/lib/utils";
const Card = React.forwardRef(({ className, ...props }, ref) => ( const Card = React.forwardRef(({ className, ...props }, ref) => (
<div <div
ref={ref} ref={ref}
className={cn("rounded-xl border bg-card text-card-foreground shadow", className)} className={cn(
{...props} /> "rounded-xl border bg-card text-card-foreground shadow",
)) className,
Card.displayName = "Card" )}
{...props}
/>
));
Card.displayName = "Card";
const CardHeader = React.forwardRef(({ className, ...props }, ref) => ( const CardHeader = React.forwardRef(({ className, ...props }, ref) => (
<div <div
ref={ref} ref={ref}
className={cn("flex flex-col space-y-1.5 p-6", className)} className={cn("flex flex-col space-y-1.5 p-6", className)}
{...props} /> {...props}
)) />
CardHeader.displayName = "CardHeader" ));
CardHeader.displayName = "CardHeader";
const CardTitle = React.forwardRef(({ className, ...props }, ref) => ( const CardTitle = React.forwardRef(({ className, ...props }, ref) => (
<div <div
ref={ref} ref={ref}
className={cn("font-semibold leading-none tracking-tight", className)} className={cn("font-semibold leading-none tracking-tight", className)}
{...props} /> {...props}
)) />
CardTitle.displayName = "CardTitle" ));
CardTitle.displayName = "CardTitle";
const CardDescription = React.forwardRef(({ className, ...props }, ref) => ( const CardDescription = React.forwardRef(({ className, ...props }, ref) => (
<div <div
ref={ref} ref={ref}
className={cn("text-sm text-muted-foreground", className)} className={cn("text-sm text-muted-foreground", className)}
{...props} /> {...props}
)) />
CardDescription.displayName = "CardDescription" ));
CardDescription.displayName = "CardDescription";
const CardContent = React.forwardRef(({ className, ...props }, ref) => ( const CardContent = React.forwardRef(({ className, ...props }, ref) => (
<div ref={ref} className={cn("p-6 pt-0", className)} {...props} /> <div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
)) ));
CardContent.displayName = "CardContent" CardContent.displayName = "CardContent";
const CardFooter = React.forwardRef(({ className, ...props }, ref) => ( const CardFooter = React.forwardRef(({ className, ...props }, ref) => (
<div <div
ref={ref} ref={ref}
className={cn("flex items-center p-6 pt-0", className)} className={cn("flex items-center p-6 pt-0", className)}
{...props} /> {...props}
)) />
CardFooter.displayName = "CardFooter" ));
CardFooter.displayName = "CardFooter";
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent } export {
Card,
CardHeader,
CardFooter,
CardTitle,
CardDescription,
CardContent,
};

View File

@@ -17,6 +17,7 @@ const Dashboard = () => {
const [resendLoading, setResendLoading] = useState(false); const [resendLoading, setResendLoading] = useState(false);
const [eventActivity, setEventActivity] = useState(null); const [eventActivity, setEventActivity] = useState(null);
const [activityLoading, setActivityLoading] = useState(true); const [activityLoading, setActivityLoading] = useState(true);
const joinedDate = user?.member_since || user?.created_at;
useEffect(() => { useEffect(() => {
fetchUpcomingEvents(); fetchUpcomingEvents();
@@ -197,7 +198,7 @@ const Dashboard = () => {
<div> <div>
<p className="text-sm text-brand-purple " style={{ fontFamily: "'Nunito Sans', sans-serif" }}>Member Since</p> <p className="text-sm text-brand-purple " style={{ fontFamily: "'Nunito Sans', sans-serif" }}>Member Since</p>
<p className="text-[var(--purple-ink)] font-medium" style={{ fontFamily: "'Nunito Sans', sans-serif" }}> <p className="text-[var(--purple-ink)] font-medium" style={{ fontFamily: "'Nunito Sans', sans-serif" }}>
{user?.created_at ? new Date(user.created_at).toLocaleDateString() : 'N/A'} {joinedDate ? new Date(joinedDate).toLocaleDateString() : 'N/A'}
</p> </p>
</div> </div>
{user?.subscription_start_date && user?.subscription_end_date && ( {user?.subscription_start_date && user?.subscription_end_date && (

View File

@@ -12,6 +12,7 @@ import MemberFooter from '../components/MemberFooter';
import { User, Save, Lock, Heart, Users, Mail, BookUser, Camera, Upload, Trash2 } from 'lucide-react'; import { User, Save, Lock, Heart, Users, Mail, BookUser, Camera, Upload, Trash2 } from 'lucide-react';
import { Avatar, AvatarImage, AvatarFallback } from '../components/ui/avatar'; import { Avatar, AvatarImage, AvatarFallback } from '../components/ui/avatar';
import ChangePasswordDialog from '../components/ChangePasswordDialog'; import ChangePasswordDialog from '../components/ChangePasswordDialog';
import TransactionHistory from '../components/TransactionHistory';
const Profile = () => { const Profile = () => {
const { user } = useAuth(); const { user } = useAuth();
@@ -24,6 +25,8 @@ const Profile = () => {
const fileInputRef = useRef(null); const fileInputRef = useRef(null);
const [maxFileSizeMB, setMaxFileSizeMB] = useState(50); // Default 50MB const [maxFileSizeMB, setMaxFileSizeMB] = useState(50); // Default 50MB
const [maxFileSizeBytes, setMaxFileSizeBytes] = useState(52428800); // Default 50MB in bytes const [maxFileSizeBytes, setMaxFileSizeBytes] = useState(52428800); // Default 50MB in bytes
const [transactions, setTransactions] = useState({ subscriptions: [], donations: [] });
const [transactionsLoading, setTransactionsLoading] = useState(true);
const [formData, setFormData] = useState({ const [formData, setFormData] = useState({
// Personal Information // Personal Information
first_name: '', first_name: '',
@@ -58,6 +61,7 @@ const Profile = () => {
useEffect(() => { useEffect(() => {
fetchConfig(); fetchConfig();
fetchProfile(); fetchProfile();
fetchTransactions();
}, []); }, []);
const fetchConfig = async () => { 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 handleInputChange = (e) => {
const { name, value } = e.target; const { name, value } = e.target;
setFormData(prev => ({ ...prev, [name]: value })); setFormData(prev => ({ ...prev, [name]: value }));
@@ -703,6 +720,18 @@ const Profile = () => {
open={passwordDialogOpen} open={passwordDialogOpen}
onOpenChange={setPasswordDialogOpen} 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> </div>
<MemberFooter /> <MemberFooter />
</div> </div>

View File

@@ -258,7 +258,7 @@ const Register = () => {
<Button <Button
type="button" type="button"
onClick={handleNext} onClick={handleNext}
className="bg-[var(--neutral-800)] text-[var(--purple-ink)] hover:bg-background rounded-full px-6 py-6 text-lg font-medium shadow-lg hover:scale-105 transition-transform" className="bg-[var(--neutral-800)] text-[var(--purple-ink)] hover:bg-brand-purple hover:text-background rounded-full px-6 py-6 text-lg font-medium shadow-lg hover:scale-105 transition-transform"
> >
Next Next
<ArrowRight className="ml-2 h-5 w-5" /> <ArrowRight className="ml-2 h-5 w-5" />
@@ -267,7 +267,7 @@ const Register = () => {
<Button <Button
type="submit" type="submit"
disabled={loading} disabled={loading}
className="bg-[var(--neutral-800)] text-[var(--purple-ink)] hover:bg-background rounded-full px-6 py-6 text-lg font-medium shadow-lg hover:scale-105 transition-transform disabled:opacity-50 disabled:cursor-not-allowed" className="bg-[var(--neutral-800)] text-[var(--purple-ink)] hover:bg-brand-purple hover:text-backgroundrounded-full px-6 py-6 text-lg font-medium shadow-lg hover:scale-105 transition-transform disabled:opacity-50 disabled:cursor-not-allowed"
data-testid="submit-register-button" data-testid="submit-register-button"
> >
{loading ? 'Creating Account...' : 'Create Account'} {loading ? 'Creating Account...' : 'Create Account'}

View File

@@ -4,13 +4,16 @@ import api from '../../utils/api';
import { Card } from '../../components/ui/card'; import { Card } from '../../components/ui/card';
import { Button } from '../../components/ui/button'; import { Button } from '../../components/ui/button';
import { Badge } from '../../components/ui/badge'; import { Badge } from '../../components/ui/badge';
import { Users, Calendar, Clock, CheckCircle, Mail, AlertCircle, Globe } from 'lucide-react'; import { Users, Calendar, Clock, CheckCircle, Mail, AlertCircle, Globe, CircleMinus } from 'lucide-react';
import { StatCard } from '../../components/StatCard';
const AdminDashboard = () => { const AdminDashboard = () => {
const [stats, setStats] = useState({ const [stats, setStats] = useState({
totalMembers: 0, totalMembers: 0,
pendingValidations: 0, pendingValidations: 0,
activeMembers: 0 activeMembers: 0,
inactiveMembers: 0
}); });
const [usersNeedingAttention, setUsersNeedingAttention] = useState([]); const [usersNeedingAttention, setUsersNeedingAttention] = useState([]);
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
@@ -29,7 +32,8 @@ const AdminDashboard = () => {
pendingValidations: users.filter(u => pendingValidations: users.filter(u =>
['pending_email', 'pending_validation', 'pre_validated', 'payment_pending'].includes(u.status) ['pending_email', 'pending_validation', 'pre_validated', 'payment_pending'].includes(u.status)
).length, ).length,
activeMembers: users.filter(u => u.status === 'active' && u.role === 'member').length activeMembers: users.filter(u => u.status === 'active' && u.role === 'member').length,
inactiveMembers: users.filter(u => u.status === 'inactive' && u.role === 'member').length
}); });
// Find users who have received 3+ reminders (may need personal outreach) // Find users who have received 3+ reminders (may need personal outreach)
@@ -76,52 +80,42 @@ const AdminDashboard = () => {
</div> </div>
{/* Stats Grid */} {/* Stats Grid */}
<div className="grid md:grid-cols-2 lg:grid-cols-3 gap-6 mb-12">
<Card className="p-6 bg-background rounded-2xl border border-[var(--neutral-800)]" data-testid="stat-total-users"> <div className='rounded-3xl bg-brand-lavender/10 p-8 mb-8'>
<div className='flex items-start justify-between'> <div className=' text-2xl text-[var(--purple-ink)] pb-8 font-semibold'>
<p className="text-3xl font-semibold text-[var(--purple-ink)] mb-1" style={{ fontFamily: "'Inter', sans-serif" }}> Quick Overview
{loading ? '-' : stats.totalMembers}
</p>
<div className="flex items-start justify-between mb-4">
<div className="bg-[var(--neutral-800)]/20 p-3 rounded-lg">
<Users className="h-6 w-6 text-brand-purple" />
</div>
</div> </div>
<div className="grid md:grid-cols-2 lg:grid-cols-4 gap-8 ">
<StatCard
title="Total Members"
value={loading ? '-' : stats.totalMembers}
icon={Users}
iconBgClass="text-brand-purple"
dataTestId="stat-total-users"
/>
<StatCard
title="Pending Validations"
value={loading ? '-' : stats.pendingValidations}
icon={Clock}
iconBgClass="text-brand-light-orange"
dataTestId="stat-total-users"
/>
<StatCard
title="Active Members"
value={loading ? '-' : stats.activeMembers}
icon={CheckCircle}
iconBgClass="text-[var(--green-light)]"
dataTestId="stat-total-users"
/>
<StatCard
title="Inactive Members"
value={loading ? '-' : stats.inactiveMembers}
icon={CircleMinus}
iconBgClass="text-brand-pink"
dataTestId="stat-total-users"
/>
</div> </div>
<p className="text-sm text-brand-purple" style={{ fontFamily: "'Nunito Sans', sans-serif" }}>Total Members</p>
</Card>
<Card className="p-6 bg-background rounded-2xl border border-[var(--neutral-800)]" data-testid="stat-pending-validations">
<div className='flex items-start justify-between'>
<p className="text-3xl font-semibold text-[var(--purple-ink)] mb-1" style={{ fontFamily: "'Inter', sans-serif" }}>
{loading ? '-' : stats.pendingValidations}
</p>
<div className="flex items-start justify-between mb-4">
<div className=" p-3 rounded-lg">
<Clock className="h-6 w-6 text-orange-600" />
</div>
</div>
</div>
<p className="text-sm text-brand-purple" style={{ fontFamily: "'Nunito Sans', sans-serif" }}>Pending Validations</p>
</Card>
<Card className="p-6 bg-background rounded-2xl border border-[var(--neutral-800)]" data-testid="stat-active-members">
<div className='flex items-start justify-between'>
<p className="text-3xl font-semibold text-[var(--purple-ink)] mb-1" style={{ fontFamily: "'Inter', sans-serif" }}>
{loading ? '-' : stats.activeMembers}
</p>
<div className="flex items-start justify-between mb-4">
<div className="bg-[var(--green-light)]/20 p-3 rounded-lg">
<CheckCircle className="h-6 w-6 text-[var(--green-light)]" />
</div>
</div>
</div>
<p className="text-sm text-brand-purple" style={{ fontFamily: "'Nunito Sans', sans-serif" }}>Active Members</p>
</Card>
</div> </div>
{/* Quick Actions */} {/* Quick Actions */}

View File

@@ -28,7 +28,13 @@ import {
Loader2, Loader2,
Download, Download,
FileDown, FileDown,
Calendar Calendar,
ChevronDown,
ChevronUp,
ExternalLink,
Copy,
CreditCard,
Info
} from 'lucide-react'; } from 'lucide-react';
const AdminDonations = () => { const AdminDonations = () => {
@@ -43,6 +49,7 @@ const AdminDonations = () => {
const [statusFilter, setStatusFilter] = useState('all'); const [statusFilter, setStatusFilter] = useState('all');
const [startDate, setStartDate] = useState(''); const [startDate, setStartDate] = useState('');
const [endDate, setEndDate] = useState(''); const [endDate, setEndDate] = useState('');
const [expandedRows, setExpandedRows] = useState(new Set());
useEffect(() => { useEffect(() => {
fetchData(); fetchData();
@@ -157,6 +164,27 @@ const AdminDonations = () => {
}); });
}; };
const toggleRowExpansion = (donationId) => {
setExpandedRows((prev) => {
const newExpanded = new Set(prev);
if (newExpanded.has(donationId)) {
newExpanded.delete(donationId);
} else {
newExpanded.add(donationId);
}
return newExpanded;
});
};
const copyToClipboard = async (text, label) => {
try {
await navigator.clipboard.writeText(text);
toast.success(`${label} copied to clipboard`);
} catch (error) {
toast.error('Failed to copy to clipboard');
}
};
const getStatusBadgeVariant = (status) => { const getStatusBadgeVariant = (status) => {
const variants = { const variants = {
completed: 'default', completed: 'default',
@@ -385,12 +413,15 @@ const AdminDonations = () => {
<th className="px-6 py-4 text-left text-sm font-semibold text-[var(--purple-ink)]" style={{ fontFamily: "'Inter', sans-serif" }}> <th className="px-6 py-4 text-left text-sm font-semibold text-[var(--purple-ink)]" style={{ fontFamily: "'Inter', sans-serif" }}>
Payment Method Payment Method
</th> </th>
<th className="px-6 py-4 text-center text-sm font-semibold text-[var(--purple-ink)]" style={{ fontFamily: "'Inter', sans-serif" }}>
Details
</th>
</tr> </tr>
</thead> </thead>
<tbody className="divide-y divide-[var(--neutral-800)]"> <tbody className="divide-y divide-[var(--neutral-800)]">
{filteredDonations.length === 0 ? ( {filteredDonations.length === 0 ? (
<tr> <tr>
<td colSpan="6" className="px-6 py-12 text-center"> <td colSpan="7" className="px-6 py-12 text-center">
<div className="flex flex-col items-center gap-3"> <div className="flex flex-col items-center gap-3">
<Heart className="h-12 w-12 text-[var(--neutral-800)]" /> <Heart className="h-12 w-12 text-[var(--neutral-800)]" />
<p className="text-brand-purple " style={{ fontFamily: "'Nunito Sans', sans-serif" }}> <p className="text-brand-purple " style={{ fontFamily: "'Nunito Sans', sans-serif" }}>
@@ -400,8 +431,11 @@ const AdminDonations = () => {
</td> </td>
</tr> </tr>
) : ( ) : (
filteredDonations.map((donation) => ( filteredDonations.map((donation) => {
<tr key={donation.id} className="hover:bg-[var(--lavender-400)] transition-colors"> const isExpanded = expandedRows.has(donation.id);
return (
<React.Fragment key={donation.id}>
<tr className="hover:bg-[var(--lavender-400)] transition-colors">
<td className="px-6 py-4"> <td className="px-6 py-4">
<div> <div>
<p className="font-medium text-[var(--purple-ink)]" style={{ fontFamily: "'Inter', sans-serif" }}> <p className="font-medium text-[var(--purple-ink)]" style={{ fontFamily: "'Inter', sans-serif" }}>
@@ -443,8 +477,136 @@ const AdminDonations = () => {
{donation.payment_method || 'N/A'} {donation.payment_method || 'N/A'}
</p> </p>
</td> </td>
<td className="px-6 py-4 text-center">
<Button
size="sm"
variant="ghost"
onClick={() => toggleRowExpansion(donation.id)}
className="text-brand-purple hover:bg-[var(--neutral-800)]"
>
{isExpanded ? <ChevronUp className="h-4 w-4" /> : <ChevronDown className="h-4 w-4" />}
</Button>
</td>
</tr> </tr>
)) {/* Expandable Details Row */}
{isExpanded && (
<tr className="bg-[var(--lavender-400)]/30">
<td colSpan="7" className="px-6 py-6">
<div className="space-y-4">
<h4 className="font-semibold text-[var(--purple-ink)] text-lg mb-4" style={{ fontFamily: "'Inter', sans-serif" }}>
Transaction Details
</h4>
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
{/* Payment Information */}
<div className="space-y-3">
<h5 className="font-medium text-[var(--purple-ink)] flex items-center gap-2" style={{ fontFamily: "'Inter', sans-serif" }}>
<CreditCard className="h-4 w-4" />
Payment Information
</h5>
<div className="space-y-2 text-sm">
{donation.payment_completed_at && (
<div className="flex justify-between">
<span className="text-brand-purple ">Payment Date:</span>
<span className="text-[var(--purple-ink)] font-medium">{formatDate(donation.payment_completed_at)}</span>
</div>
)}
{donation.payment_method && (
<div className="flex justify-between">
<span className="text-brand-purple ">Payment Method:</span>
<span className="text-[var(--purple-ink)] font-medium capitalize">{donation.payment_method}</span>
</div>
)}
{donation.card_brand && donation.card_last4 && (
<div className="flex justify-between">
<span className="text-brand-purple ">Card:</span>
<span className="text-[var(--purple-ink)] font-medium">{donation.card_brand} ****{donation.card_last4}</span>
</div>
)}
</div>
</div>
{/* Stripe Transaction IDs */}
<div className="space-y-3">
<h5 className="font-medium text-[var(--purple-ink)] flex items-center gap-2" style={{ fontFamily: "'Inter', sans-serif" }}>
<Info className="h-4 w-4" />
Stripe Transaction IDs
</h5>
<div className="space-y-2 text-sm">
{donation.stripe_payment_intent_id && (
<div className="flex items-center justify-between gap-2">
<span className="text-brand-purple ">Payment Intent:</span>
<div className="flex items-center gap-1">
<code className="text-xs bg-[var(--neutral-800)]/30 px-2 py-1 rounded text-[var(--purple-ink)]">
{donation.stripe_payment_intent_id.substring(0, 20)}...
</code>
<Button
size="sm"
variant="ghost"
onClick={() => copyToClipboard(donation.stripe_payment_intent_id, 'Payment Intent ID')}
>
<Copy className="h-3 w-3" />
</Button>
</div>
</div>
)}
{donation.stripe_charge_id && (
<div className="flex items-center justify-between gap-2">
<span className="text-brand-purple ">Charge ID:</span>
<div className="flex items-center gap-1">
<code className="text-xs bg-[var(--neutral-800)]/30 px-2 py-1 rounded text-[var(--purple-ink)]">
{donation.stripe_charge_id.substring(0, 20)}...
</code>
<Button
size="sm"
variant="ghost"
onClick={() => copyToClipboard(donation.stripe_charge_id, 'Charge ID')}
>
<Copy className="h-3 w-3" />
</Button>
</div>
</div>
)}
{donation.stripe_customer_id && (
<div className="flex items-center justify-between gap-2">
<span className="text-brand-purple ">Customer ID:</span>
<div className="flex items-center gap-1">
<code className="text-xs bg-[var(--neutral-800)]/30 px-2 py-1 rounded text-[var(--purple-ink)]">
{donation.stripe_customer_id.substring(0, 20)}...
</code>
<Button
size="sm"
variant="ghost"
onClick={() => copyToClipboard(donation.stripe_customer_id, 'Customer ID')}
>
<Copy className="h-3 w-3" />
</Button>
</div>
</div>
)}
{donation.stripe_receipt_url && (
<div className="flex items-center justify-between gap-2">
<span className="text-brand-purple ">Receipt:</span>
<Button
size="sm"
variant="outline"
onClick={() => window.open(donation.stripe_receipt_url, '_blank')}
className="text-brand-purple hover:bg-[var(--neutral-800)]"
>
<ExternalLink className="h-3 w-3 mr-1" />
View Receipt
</Button>
</div>
)}
</div>
</div>
</div>
</div>
</td>
</tr>
)}
</React.Fragment>
);
})
)} )}
</tbody> </tbody>
</table> </table>

View File

@@ -14,12 +14,13 @@ import {
DropdownMenuTrigger, DropdownMenuTrigger,
} from '../../components/ui/dropdown-menu'; } from '../../components/ui/dropdown-menu';
import { toast } from 'sonner'; import { toast } from 'sonner';
import { Users, Search, User, CreditCard, Eye, CheckCircle, Calendar, AlertCircle, Clock, Mail, UserPlus, Upload, Download, FileDown, ChevronDown } from 'lucide-react'; import { Users, Search, User, CreditCard, Eye, CheckCircle, Calendar, AlertCircle, Clock, Mail, UserPlus, Upload, Download, FileDown, ChevronDown, CircleMinus } from 'lucide-react';
import PaymentActivationDialog from '../../components/PaymentActivationDialog'; import PaymentActivationDialog from '../../components/PaymentActivationDialog';
import ConfirmationDialog from '../../components/ConfirmationDialog'; import ConfirmationDialog from '../../components/ConfirmationDialog';
import CreateMemberDialog from '../../components/CreateMemberDialog'; import CreateMemberDialog from '../../components/CreateMemberDialog';
import InviteStaffDialog from '../../components/InviteStaffDialog'; import InviteStaffDialog from '../../components/InviteStaffDialog';
import WordPressImportWizard from '../../components/WordPressImportWizard'; import WordPressImportWizard from '../../components/WordPressImportWizard';
import { StatCard } from '@/components/StatCard';
const AdminMembers = () => { const AdminMembers = () => {
const navigate = useNavigate(); const navigate = useNavigate();
@@ -319,31 +320,45 @@ const AdminMembers = () => {
</div> </div>
{/* Stats */} {/* Stats */}
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-4 gap-4 mb-8"> <div className='rounded-3xl bg-brand-lavender/10 p-8 mb-8'>
<Card className="p-6 bg-background rounded-2xl border border-[var(--neutral-800)]"> <div className=' text-2xl text-[var(--purple-ink)] pb-8 font-semibold'>
<p className="text-sm text-brand-purple dark:text-brand-lavender mb-2" style={{ fontFamily: "'Nunito Sans', sans-serif" }}>Total Members</p> Quick Overview
<p className="text-4xl font-semibold text-[var(--purple-ink)]" style={{ fontFamily: "'Inter', sans-serif" }}> </div>
{users.length} <div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-4 gap-4">
</p>
</Card>
<Card className="p-6 bg-background rounded-2xl border border-[var(--neutral-800)]"> <StatCard
<p className="text-sm text-brand-purple dark:text-brand-lavender mb-2" style={{ fontFamily: "'Nunito Sans', sans-serif" }}>Active</p> title="Total Members"
<p className="text-4xl font-semibold text-[var(--purple-ink)]" style={{ fontFamily: "'Inter', sans-serif" }}> value={users.length}
{users.filter(u => u.status === 'active').length} icon={Users}
</p> iconBgClass="bg-[var(--blue-light)] text-[var(--blue-dark)]"
</Card> dataTestId="stat-total-members"
<Card className="p-6 bg-background rounded-2xl border border-[var(--neutral-800)]"> />
<p className="text-sm text-brand-purple dark:text-brand-lavender mb-2" style={{ fontFamily: "'Nunito Sans', sans-serif" }}>Payment Pending</p> <StatCard
<p className="text-4xl font-semibold text-[var(--purple-ink)]" style={{ fontFamily: "'Inter', sans-serif" }}> title="Active"
{users.filter(u => u.status === 'payment_pending').length} value={users.filter(u => u.status === 'active').length}
</p> icon={CheckCircle}
</Card> iconBgClass="text-[var(--green-light)]"
<Card className="p-6 bg-background rounded-2xl border border-[var(--neutral-800)]"> dataTestId="stat-active-members"
<p className="text-sm text-brand-purple dark:text-brand-lavender mb-2" style={{ fontFamily: "'Nunito Sans', sans-serif" }}>Inactive</p> />
<p className="text-4xl font-semibold text-[var(--purple-ink)]" style={{ fontFamily: "'Inter', sans-serif" }}> <StatCard
{users.filter(u => u.status === 'inactive').length} title="Payment Pending"
</p> value={users.filter(u => u.status === 'payment_pending').length}
</Card> icon={CreditCard}
iconBgClass="text-brand-light-orange"
dataTestId="stat-payment-pending-members"
/>
<StatCard
title="Inactive"
value={users.filter(u => u.status === 'inactive').length}
icon={CircleMinus}
iconBgClass=" text-brand-pink"
dataTestId="stat-inactive-members"
/>
</div>
</div> </div>
{/* Filters */} {/* Filters */}
@@ -385,7 +400,9 @@ const AdminMembers = () => {
</div> </div>
) : filteredUsers.length > 0 ? ( ) : filteredUsers.length > 0 ? (
<div className="space-y-4"> <div className="space-y-4">
{filteredUsers.map((user) => ( {filteredUsers.map((user) => {
const joinedDate = user.member_since || user.created_at;
return (
<Card <Card
key={user.id} key={user.id}
className="p-6 bg-background rounded-2xl border border-[var(--neutral-800)] hover:shadow-md transition-shadow" className="p-6 bg-background rounded-2xl border border-[var(--neutral-800)] hover:shadow-md transition-shadow"
@@ -409,7 +426,7 @@ const AdminMembers = () => {
<div className="grid md:grid-cols-2 gap-2 text-sm text-brand-purple dark:text-brand-lavender " style={{ fontFamily: "'Nunito Sans', sans-serif" }}> <div className="grid md:grid-cols-2 gap-2 text-sm text-brand-purple dark:text-brand-lavender " style={{ fontFamily: "'Nunito Sans', sans-serif" }}>
<p>Email: {user.email}</p> <p>Email: {user.email}</p>
<p>Phone: {user.phone}</p> <p>Phone: {user.phone}</p>
<p>Joined: {new Date(user.created_at).toLocaleDateString()}</p> <p>Joined: {joinedDate ? new Date(joinedDate).toLocaleDateString() : 'N/A'}</p>
{user.referred_by_member_name && ( {user.referred_by_member_name && (
<p>Referred by: {user.referred_by_member_name}</p> <p>Referred by: {user.referred_by_member_name}</p>
)} )}
@@ -523,7 +540,8 @@ const AdminMembers = () => {
</div> </div>
</div> </div>
</Card> </Card>
))} );
})}
</div> </div>
) : ( ) : (
<div className="text-center py-20"> <div className="text-center py-20">

View File

@@ -0,0 +1,506 @@
import React, { useState, useEffect } from 'react';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '../../components/ui/card';
import { Button } from '../../components/ui/button';
import { Input } from '../../components/ui/input';
import { Label } from '../../components/ui/label';
import { AlertCircle, CheckCircle, Settings as SettingsIcon, RefreshCw, Zap, Edit, Save, X, Copy, Eye, EyeOff, ExternalLink } from 'lucide-react';
import api from '../../utils/api';
import { toast } from 'sonner';
export default function AdminSettings() {
const [stripeStatus, setStripeStatus] = useState(null);
const [loadingStatus, setLoadingStatus] = useState(true);
const [testing, setTesting] = useState(false);
const [isEditing, setIsEditing] = useState(false);
const [saving, setSaving] = useState(false);
// Form state
const [formData, setFormData] = useState({
secret_key: '',
webhook_secret: ''
});
// Show/hide sensitive values
const [showSecretKey, setShowSecretKey] = useState(false);
const [showWebhookSecret, setShowWebhookSecret] = useState(false);
useEffect(() => {
fetchStripeStatus();
}, []);
const fetchStripeStatus = async () => {
setLoadingStatus(true);
try {
const response = await api.get('/admin/settings/stripe/status');
setStripeStatus(response.data);
} catch (error) {
console.error('Failed to fetch Stripe status:', error);
toast.error('Failed to load Stripe status');
} finally {
setLoadingStatus(false);
}
};
const handleTestConnection = async () => {
setTesting(true);
try {
const response = await api.post('/admin/settings/stripe/test-connection');
toast.success(response.data.message);
} catch (error) {
const message = error.response?.data?.detail || 'Connection test failed';
toast.error(message);
} finally {
setTesting(false);
}
};
const handleEditClick = () => {
setIsEditing(true);
setFormData({
secret_key: '',
webhook_secret: ''
});
};
const handleCancelEdit = () => {
setIsEditing(false);
setFormData({
secret_key: '',
webhook_secret: ''
});
setShowSecretKey(false);
setShowWebhookSecret(false);
};
const handleSave = async () => {
// Validate inputs
if (!formData.secret_key || !formData.webhook_secret) {
toast.error('Both Secret Key and Webhook Secret are required');
return;
}
if (!formData.secret_key.startsWith('sk_test_') && !formData.secret_key.startsWith('sk_live_')) {
toast.error('Invalid Secret Key format. Must start with sk_test_ or sk_live_');
return;
}
if (!formData.webhook_secret.startsWith('whsec_')) {
toast.error('Invalid Webhook Secret format. Must start with whsec_');
return;
}
setSaving(true);
try {
await api.put('/admin/settings/stripe', formData);
toast.success('Stripe settings updated successfully');
setIsEditing(false);
setFormData({
secret_key: '',
webhook_secret: ''
});
setShowSecretKey(false);
setShowWebhookSecret(false);
// Refresh status
await fetchStripeStatus();
} catch (error) {
const message = error.response?.data?.detail || 'Failed to update Stripe settings';
toast.error(message);
} finally {
setSaving(false);
}
};
const copyToClipboard = (text, label) => {
navigator.clipboard.writeText(text);
toast.success(`${label} copied to clipboard`);
};
if (loadingStatus) {
return (
<div className="container mx-auto p-6">
<div className="flex items-center justify-center py-12">
<RefreshCw className="h-8 w-8 animate-spin text-brand-purple" />
</div>
</div>
);
}
return (
<div className="container mx-auto p-6 max-w-4xl">
{/* Header */}
<div className="mb-8">
<h1 className="text-3xl font-bold text-gray-900 flex items-center gap-3">
<SettingsIcon className="h-8 w-8 text-brand-purple" />
Settings
</h1>
<p className="text-gray-600 mt-2">
Manage system configuration and integrations
</p>
</div>
{/* Stripe Integration Card */}
<Card className="border-2 border-[var(--lavender-200)] shadow-sm">
<CardHeader className="bg-gradient-to-r from-[var(--lavender-100)] to-white border-b-2 border-[var(--lavender-200)]">
<div className="flex justify-between items-start">
<div>
<CardTitle className="flex items-center gap-2">
<Zap className="h-5 w-5 text-brand-purple" />
Stripe Integration
</CardTitle>
<CardDescription>
Payment processing and subscription management
</CardDescription>
</div>
{!isEditing && (
<Button
onClick={handleEditClick}
variant="outline"
className="border-2 border-brand-purple text-brand-purple hover:bg-[#f1eef9] rounded-full"
>
<Edit className="h-4 w-4 mr-2" />
Edit Settings
</Button>
)}
</div>
</CardHeader>
<CardContent className="pt-6 space-y-6">
{isEditing ? (
/* Edit Mode */
<div className="space-y-6">
{/* Secret Key Input */}
<div className="space-y-2">
<Label htmlFor="secret_key">Stripe Secret Key</Label>
<div className="relative">
<Input
id="secret_key"
type={showSecretKey ? 'text' : 'password'}
value={formData.secret_key}
onChange={(e) => setFormData({ ...formData, secret_key: e.target.value })}
placeholder="sk_test_... or sk_live_..."
className="pr-10"
/>
<button
type="button"
onClick={() => setShowSecretKey(!showSecretKey)}
className="absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-gray-700"
>
{showSecretKey ? <EyeOff className="h-4 w-4" /> : <Eye className="h-4 w-4" />}
</button>
</div>
<p className="text-xs text-gray-500">
Get this from your Stripe Dashboard Developers API keys
</p>
</div>
{/* Webhook Secret Input */}
<div className="space-y-2">
<Label htmlFor="webhook_secret">Stripe Webhook Secret</Label>
<div className="relative">
<Input
id="webhook_secret"
type={showWebhookSecret ? 'text' : 'password'}
value={formData.webhook_secret}
onChange={(e) => setFormData({ ...formData, webhook_secret: e.target.value })}
placeholder="whsec_..."
className="pr-10"
/>
<button
type="button"
onClick={() => setShowWebhookSecret(!showWebhookSecret)}
className="absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-gray-700"
>
{showWebhookSecret ? <EyeOff className="h-4 w-4" /> : <Eye className="h-4 w-4" />}
</button>
</div>
<p className="text-xs text-gray-500">
Get this from your Stripe Dashboard Developers Webhooks Add endpoint
</p>
</div>
{/* Action Buttons */}
<div className="flex justify-end gap-3 pt-4 border-t-2 border-gray-100">
<Button
onClick={handleCancelEdit}
variant="outline"
className="border-2 border-gray-300 rounded-full"
disabled={saving}
>
<X className="h-4 w-4 mr-2" />
Cancel
</Button>
<Button
onClick={handleSave}
disabled={saving}
className="bg-brand-purple hover:bg-[var(--purple-dark)] text-white rounded-full"
>
{saving ? (
<>
<RefreshCw className="h-4 w-4 mr-2 animate-spin" />
Saving...
</>
) : (
<>
<Save className="h-4 w-4 mr-2" />
Save Settings
</>
)}
</Button>
</div>
</div>
) : (
/* View Mode */
<>
{/* Status Display */}
<div className="space-y-4">
<div className="flex items-center justify-between p-4 bg-gray-50 rounded-lg">
<div>
<p className="font-semibold text-gray-900">Configuration Status</p>
<p className="text-sm text-gray-600">Credentials stored in database (encrypted)</p>
</div>
<div className="flex items-center gap-2">
{stripeStatus?.configured ? (
<>
<CheckCircle className="h-5 w-5 text-green-600" />
<span className="text-green-600 font-semibold">Configured</span>
</>
) : (
<>
<AlertCircle className="h-5 w-5 text-amber-600" />
<span className="text-amber-600 font-semibold">Not Configured</span>
</>
)}
</div>
</div>
{stripeStatus?.configured && (
<>
<div className="flex items-center justify-between p-4 bg-gray-50 rounded-lg">
<div>
<p className="font-semibold text-gray-900">Environment</p>
<p className="text-sm text-gray-600">Detected from secret key prefix</p>
</div>
<span className={`px-3 py-1 rounded-full text-sm font-semibold ${
stripeStatus.environment === 'live'
? 'bg-green-100 text-green-800 border-2 border-green-300'
: 'bg-blue-100 text-blue-800 border-2 border-blue-300'
}`}>
{stripeStatus.environment === 'live' ? 'Live' : 'Test'}
</span>
</div>
<div className="flex items-center justify-between p-4 bg-gray-50 rounded-lg">
<div>
<p className="font-semibold text-gray-900">Secret Key</p>
<p className="text-sm text-gray-600 font-mono">
{stripeStatus.secret_key_prefix}...
</p>
</div>
<CheckCircle className="h-5 w-5 text-green-600" />
</div>
<div className="flex items-center justify-between p-4 bg-gray-50 rounded-lg">
<div>
<p className="font-semibold text-gray-900">Webhook Secret</p>
<p className="text-sm text-gray-600">Webhook endpoint configuration</p>
</div>
{stripeStatus.webhook_secret_set ? (
<div className="flex items-center gap-2">
<CheckCircle className="h-5 w-5 text-green-600" />
<span className="text-green-600 font-semibold text-sm">Set</span>
</div>
) : (
<div className="flex items-center gap-2">
<AlertCircle className="h-5 w-5 text-amber-600" />
<span className="text-amber-600 font-semibold text-sm">Not Set</span>
</div>
)}
</div>
{/* Webhook URL */}
<div className="p-4 bg-blue-50 border-2 border-blue-200 rounded-lg">
<div className="flex items-start justify-between gap-2">
<div className="flex-1">
<p className="font-semibold text-blue-900 mb-2 flex items-center gap-2">
<ExternalLink className="h-4 w-4" />
Webhook URL
</p>
<p className="text-sm text-blue-700 mb-2">
Configure this webhook endpoint in your Stripe Dashboard:
</p>
<div className="bg-white p-2 rounded border border-blue-300 font-mono text-sm break-all">
{stripeStatus.webhook_url}
</div>
</div>
<Button
onClick={() => copyToClipboard(stripeStatus.webhook_url, 'Webhook URL')}
variant="outline"
size="sm"
className="border-blue-300 text-blue-700 hover:bg-blue-100"
>
<Copy className="h-4 w-4" />
</Button>
</div>
<div className="mt-3 text-xs text-blue-600">
<p className="font-semibold mb-1">Webhook Events to Configure:</p>
<div className="space-y-2">
<div>
<p className="font-medium text-blue-700"> Required (Configure in Stripe):</p>
<ul className="list-disc list-inside ml-2">
<li>checkout.session.completed - Handles subscriptions & donations</li>
</ul>
</div>
<div className="opacity-80">
<p className="font-medium text-blue-700">🔔 Automatically Triggered:</p>
<ul className="list-disc list-inside ml-2 text-xs">
<li>payment_intent.created</li>
<li>payment_intent.succeeded</li>
<li>charge.succeeded</li>
<li>charge.updated</li>
</ul>
<p className="text-xs italic mt-1">These fire automatically with checkout.session.completed</p>
</div>
<div className="opacity-70">
<p className="font-medium text-blue-700">🔄 Coming Soon (Recurring Subscriptions):</p>
<ul className="list-disc list-inside ml-2">
<li>invoice.payment_succeeded</li>
<li>invoice.payment_failed</li>
<li>customer.subscription.updated</li>
<li>customer.subscription.deleted</li>
</ul>
</div>
</div>
</div>
</div>
</>
)}
</div>
{/* Configuration Instructions (Not Configured) */}
{!stripeStatus?.configured && (
<>
<div className="p-4 bg-amber-50 border-2 border-amber-200 rounded-lg">
<div className="flex items-start gap-2">
<AlertCircle className="h-5 w-5 text-amber-600 flex-shrink-0 mt-0.5" />
<div className="text-sm">
<p className="font-semibold text-amber-900 mb-2">Configuration Required</p>
<p className="text-amber-700 mb-2">
Click "Edit Settings" above to configure your Stripe credentials.
</p>
<p className="text-amber-700">
Get your API keys from{' '}
<a
href="https://dashboard.stripe.com/apikeys"
target="_blank"
rel="noopener noreferrer"
className="font-semibold underline"
>
Stripe Dashboard
</a>
</p>
</div>
</div>
</div>
{/* Webhook URL Info (Always visible) */}
<div className="p-4 bg-blue-50 border-2 border-blue-200 rounded-lg">
<div className="flex items-start justify-between gap-2">
<div className="flex-1">
<p className="font-semibold text-blue-900 mb-2 flex items-center gap-2">
<ExternalLink className="h-4 w-4" />
Webhook URL Configuration
</p>
<p className="text-sm text-blue-700 mb-2">
After configuring your API keys, set up this webhook endpoint in your Stripe Dashboard:
</p>
<div className="bg-white p-2 rounded border border-blue-300 font-mono text-sm break-all">
{stripeStatus?.webhook_url || 'http://localhost:8000/api/webhooks/stripe'}
</div>
</div>
<Button
onClick={() => copyToClipboard(stripeStatus?.webhook_url || 'http://localhost:8000/api/webhooks/stripe', 'Webhook URL')}
variant="outline"
size="sm"
className="border-blue-300 text-blue-700 hover:bg-blue-100"
>
<Copy className="h-4 w-4" />
</Button>
</div>
<div className="mt-3 text-xs text-blue-600">
<p className="font-semibold mb-1">Webhook Events to Configure:</p>
<div className="space-y-2">
<div>
<p className="font-medium text-blue-700"> Required (Configure in Stripe):</p>
<ul className="list-disc list-inside ml-2">
<li>checkout.session.completed - Handles subscriptions & donations</li>
</ul>
</div>
<div className="opacity-80">
<p className="font-medium text-blue-700">🔔 Automatically Triggered:</p>
<ul className="list-disc list-inside ml-2 text-xs">
<li>payment_intent.created</li>
<li>payment_intent.succeeded</li>
<li>charge.succeeded</li>
<li>charge.updated</li>
</ul>
<p className="text-xs italic mt-1">These fire automatically with checkout.session.completed</p>
</div>
<div className="opacity-70">
<p className="font-medium text-blue-700">🔄 Coming Soon (Recurring Subscriptions):</p>
<ul className="list-disc list-inside ml-2">
<li>invoice.payment_succeeded</li>
<li>invoice.payment_failed</li>
<li>customer.subscription.updated</li>
<li>customer.subscription.deleted</li>
</ul>
</div>
</div>
</div>
</div>
</>
)}
{/* Test Connection Button */}
{stripeStatus?.configured && (
<div className="flex justify-end gap-3 pt-4 border-t-2 border-gray-100">
<Button
onClick={fetchStripeStatus}
variant="outline"
className="border-2 border-gray-300 rounded-full"
disabled={loadingStatus}
>
<RefreshCw className={`h-4 w-4 mr-2 ${loadingStatus ? 'animate-spin' : ''}`} />
Refresh Status
</Button>
<Button
onClick={handleTestConnection}
disabled={testing}
className="bg-brand-purple hover:bg-[var(--purple-dark)] text-white rounded-full"
>
{testing ? (
<>
<RefreshCw className="h-4 w-4 mr-2 animate-spin" />
Testing...
</>
) : (
<>
<Zap className="h-4 w-4 mr-2" />
Test Connection
</>
)}
</Button>
</div>
)}
</>
)}
</CardContent>
</Card>
{/* Future Settings Sections Placeholder */}
<div className="mt-6 p-6 border-2 border-dashed border-gray-300 rounded-lg text-center text-gray-500">
<p className="text-sm">Additional settings sections will be added here</p>
<p className="text-xs mt-1">(Email, Storage, Notifications, etc.)</p>
</div>
</div>
);
}

View File

@@ -242,7 +242,9 @@ const AdminStaff = () => {
</div> </div>
) : filteredUsers.length > 0 ? ( ) : filteredUsers.length > 0 ? (
<div className="space-y-4"> <div className="space-y-4">
{filteredUsers.map((user) => ( {filteredUsers.map((user) => {
const joinedDate = user.member_since || user.created_at;
return (
<Card <Card
key={user.id} key={user.id}
className="p-6 bg-background rounded-2xl border border-[var(--neutral-800)] hover:shadow-md transition-shadow" className="p-6 bg-background rounded-2xl border border-[var(--neutral-800)] hover:shadow-md transition-shadow"
@@ -267,7 +269,7 @@ const AdminStaff = () => {
<div className="grid md:grid-cols-2 gap-2 text-sm text-brand-purple " style={{ fontFamily: "'Nunito Sans', sans-serif" }}> <div className="grid md:grid-cols-2 gap-2 text-sm text-brand-purple " style={{ fontFamily: "'Nunito Sans', sans-serif" }}>
<p>Email: {user.email}</p> <p>Email: {user.email}</p>
<p>Phone: {user.phone}</p> <p>Phone: {user.phone}</p>
<p>Joined: {new Date(user.created_at).toLocaleDateString()}</p> <p>Joined: {joinedDate ? new Date(joinedDate).toLocaleDateString() : 'N/A'}</p>
{user.last_login && ( {user.last_login && (
<p>Last Login: {new Date(user.last_login).toLocaleDateString()}</p> <p>Last Login: {new Date(user.last_login).toLocaleDateString()}</p>
)} )}
@@ -322,7 +324,8 @@ const AdminStaff = () => {
</div> </div>
</div> </div>
</Card> </Card>
))} );
})}
</div> </div>
) : ( ) : (
<div className="text-center py-20"> <div className="text-center py-20">

View File

@@ -35,7 +35,11 @@ import {
Download, Download,
FileDown, FileDown,
AlertTriangle, AlertTriangle,
Info Info,
ChevronDown,
ChevronUp,
ExternalLink,
Copy
} from 'lucide-react'; } from 'lucide-react';
import { import {
DropdownMenu, DropdownMenu,
@@ -55,6 +59,7 @@ const AdminSubscriptions = () => {
const [statusFilter, setStatusFilter] = useState('all'); const [statusFilter, setStatusFilter] = useState('all');
const [planFilter, setPlanFilter] = useState('all'); const [planFilter, setPlanFilter] = useState('all');
const [exporting, setExporting] = useState(false); const [exporting, setExporting] = useState(false);
const [expandedRows, setExpandedRows] = useState(new Set());
// Edit subscription dialog state // Edit subscription dialog state
const [editDialogOpen, setEditDialogOpen] = useState(false); const [editDialogOpen, setEditDialogOpen] = useState(false);
@@ -265,6 +270,38 @@ Proceed with activation?`;
}); });
}; };
const formatDateTime = (dateString) => {
if (!dateString) return 'N/A';
return new Date(dateString).toLocaleString('en-US', {
year: 'numeric',
month: 'short',
day: 'numeric',
hour: '2-digit',
minute: '2-digit'
});
};
const toggleRowExpansion = (subscriptionId) => {
setExpandedRows((prev) => {
const newExpanded = new Set(prev);
if (newExpanded.has(subscriptionId)) {
newExpanded.delete(subscriptionId);
} else {
newExpanded.add(subscriptionId);
}
return newExpanded;
});
};
const copyToClipboard = async (text, label) => {
try {
await navigator.clipboard.writeText(text);
toast.success(`${label} copied to clipboard`);
} catch (error) {
toast.error('Failed to copy to clipboard');
}
};
const getStatusBadgeVariant = (status) => { const getStatusBadgeVariant = (status) => {
const variants = { const variants = {
active: 'default', active: 'default',
@@ -566,6 +603,9 @@ Proceed with activation?`;
<th className="text-right p-4 text-[var(--purple-ink)] font-semibold" style={{ fontFamily: "'Inter', sans-serif" }}> <th className="text-right p-4 text-[var(--purple-ink)] font-semibold" style={{ fontFamily: "'Inter', sans-serif" }}>
Total Total
</th> </th>
<th className="text-center p-4 text-[var(--purple-ink)] font-semibold" style={{ fontFamily: "'Inter', sans-serif" }}>
Details
</th>
<th className="text-center p-4 text-[var(--purple-ink)] font-semibold" style={{ fontFamily: "'Inter', sans-serif" }}> <th className="text-center p-4 text-[var(--purple-ink)] font-semibold" style={{ fontFamily: "'Inter', sans-serif" }}>
Actions Actions
</th> </th>
@@ -573,8 +613,11 @@ Proceed with activation?`;
</thead> </thead>
<tbody> <tbody>
{filteredSubscriptions.length > 0 ? ( {filteredSubscriptions.length > 0 ? (
filteredSubscriptions.map((sub) => ( filteredSubscriptions.map((sub) => {
<tr key={sub.id} className="border-b border-[var(--neutral-800)] hover:bg-[var(--lavender-400)] transition-colors"> const isExpanded = expandedRows.has(sub.id);
return (
<React.Fragment key={sub.id}>
<tr className="border-b border-[var(--neutral-800)] hover:bg-[var(--lavender-400)] transition-colors">
<td className="p-4"> <td className="p-4">
<div className="font-medium text-[var(--purple-ink)]" style={{ fontFamily: "'Inter', sans-serif" }}> <div className="font-medium text-[var(--purple-ink)]" style={{ fontFamily: "'Inter', sans-serif" }}>
{sub.user.first_name} {sub.user.last_name} {sub.user.first_name} {sub.user.last_name}
@@ -611,6 +654,16 @@ Proceed with activation?`;
<td className="p-4 text-right font-semibold text-[var(--purple-ink)]" style={{ fontFamily: "'Inter', sans-serif" }}> <td className="p-4 text-right font-semibold text-[var(--purple-ink)]" style={{ fontFamily: "'Inter', sans-serif" }}>
{formatPrice(sub.amount_paid_cents || 0)} {formatPrice(sub.amount_paid_cents || 0)}
</td> </td>
<td className="p-4">
<Button
size="sm"
variant="ghost"
onClick={() => toggleRowExpansion(sub.id)}
className="text-brand-purple hover:bg-[var(--neutral-800)]"
>
{isExpanded ? <ChevronUp className="h-4 w-4" /> : <ChevronDown className="h-4 w-4" />}
</Button>
</td>
<td className="p-4"> <td className="p-4">
<div className="flex items-center justify-center gap-2"> <div className="flex items-center justify-center gap-2">
{hasPermission('subscriptions.edit') && ( {hasPermission('subscriptions.edit') && (
@@ -636,10 +689,162 @@ Proceed with activation?`;
</div> </div>
</td> </td>
</tr> </tr>
)) {/* Expandable Details Row */}
{isExpanded && (
<tr className="bg-[var(--lavender-400)]/30">
<td colSpan="9" className="p-6">
<div className="space-y-4">
<h4 className="font-semibold text-[var(--purple-ink)] text-lg mb-4" style={{ fontFamily: "'Inter', sans-serif" }}>
Transaction Details
</h4>
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
{/* Payment Information */}
<div className="space-y-3">
<h5 className="font-medium text-[var(--purple-ink)] flex items-center gap-2" style={{ fontFamily: "'Inter', sans-serif" }}>
<CreditCard className="h-4 w-4" />
Payment Information
</h5>
<div className="space-y-2 text-sm">
{sub.payment_completed_at && (
<div className="flex justify-between">
<span className="text-brand-purple ">Payment Date:</span>
<span className="text-[var(--purple-ink)] font-medium">{formatDateTime(sub.payment_completed_at)}</span>
</div>
)}
{sub.payment_method && (
<div className="flex justify-between">
<span className="text-brand-purple ">Payment Method:</span>
<span className="text-[var(--purple-ink)] font-medium capitalize">{sub.payment_method}</span>
</div>
)}
{sub.card_brand && sub.card_last4 && (
<div className="flex justify-between">
<span className="text-brand-purple ">Card:</span>
<span className="text-[var(--purple-ink)] font-medium">{sub.card_brand} ****{sub.card_last4}</span>
</div>
)}
</div>
</div>
{/* Stripe Transaction IDs */}
<div className="space-y-3">
<h5 className="font-medium text-[var(--purple-ink)] flex items-center gap-2" style={{ fontFamily: "'Inter', sans-serif" }}>
<Info className="h-4 w-4" />
Stripe Transaction IDs
</h5>
<div className="space-y-2 text-sm">
{sub.stripe_payment_intent_id && (
<div className="flex items-center justify-between gap-2">
<span className="text-brand-purple ">Payment Intent:</span>
<div className="flex items-center gap-1">
<code className="text-xs bg-[var(--neutral-800)]/30 px-2 py-1 rounded text-[var(--purple-ink)]">
{sub.stripe_payment_intent_id.substring(0, 20)}...
</code>
<Button
size="sm"
variant="ghost"
onClick={() => copyToClipboard(sub.stripe_payment_intent_id, 'Payment Intent ID')}
>
<Copy className="h-3 w-3" />
</Button>
</div>
</div>
)}
{sub.stripe_charge_id && (
<div className="flex items-center justify-between gap-2">
<span className="text-brand-purple ">Charge ID:</span>
<div className="flex items-center gap-1">
<code className="text-xs bg-[var(--neutral-800)]/30 px-2 py-1 rounded text-[var(--purple-ink)]">
{sub.stripe_charge_id.substring(0, 20)}...
</code>
<Button
size="sm"
variant="ghost"
onClick={() => copyToClipboard(sub.stripe_charge_id, 'Charge ID')}
>
<Copy className="h-3 w-3" />
</Button>
</div>
</div>
)}
{sub.stripe_subscription_id && (
<div className="flex items-center justify-between gap-2">
<span className="text-brand-purple ">Subscription ID:</span>
<div className="flex items-center gap-1">
<code className="text-xs bg-[var(--neutral-800)]/30 px-2 py-1 rounded text-[var(--purple-ink)]">
{sub.stripe_subscription_id.substring(0, 20)}...
</code>
<Button
size="sm"
variant="ghost"
onClick={() => copyToClipboard(sub.stripe_subscription_id, 'Subscription ID')}
>
<Copy className="h-3 w-3" />
</Button>
</div>
</div>
)}
{sub.stripe_invoice_id && (
<div className="flex items-center justify-between gap-2">
<span className="text-brand-purple ">Invoice ID:</span>
<div className="flex items-center gap-1">
<code className="text-xs bg-[var(--neutral-800)]/30 px-2 py-1 rounded text-[var(--purple-ink)]">
{sub.stripe_invoice_id.substring(0, 20)}...
</code>
<Button
size="sm"
variant="ghost"
onClick={() => copyToClipboard(sub.stripe_invoice_id, 'Invoice ID')}
>
<Copy className="h-3 w-3" />
</Button>
</div>
</div>
)}
{sub.stripe_customer_id && (
<div className="flex items-center justify-between gap-2">
<span className="text-brand-purple ">Customer ID:</span>
<div className="flex items-center gap-1">
<code className="text-xs bg-[var(--neutral-800)]/30 px-2 py-1 rounded text-[var(--purple-ink)]">
{sub.stripe_customer_id.substring(0, 20)}...
</code>
<Button
size="sm"
variant="ghost"
onClick={() => copyToClipboard(sub.stripe_customer_id, 'Customer ID')}
>
<Copy className="h-3 w-3" />
</Button>
</div>
</div>
)}
{sub.stripe_receipt_url && (
<div className="flex items-center justify-between gap-2">
<span className="text-brand-purple ">Receipt:</span>
<Button
size="sm"
variant="outline"
onClick={() => window.open(sub.stripe_receipt_url, '_blank')}
className="text-brand-purple hover:bg-[var(--neutral-800)]"
>
<ExternalLink className="h-3 w-3 mr-1" />
View Receipt
</Button>
</div>
)}
</div>
</div>
</div>
</div>
</td>
</tr>
)}
</React.Fragment>
);
})
) : ( ) : (
<tr> <tr>
<td colSpan="8" className="p-12 text-center text-brand-purple " style={{ fontFamily: "'Nunito Sans', sans-serif" }}> <td colSpan="9" className="p-12 text-center text-brand-purple " style={{ fontFamily: "'Nunito Sans', sans-serif" }}>
No subscriptions found No subscriptions found
</td> </td>
</tr> </tr>

View File

@@ -5,9 +5,12 @@ import { Card } from '../../components/ui/card';
import { Button } from '../../components/ui/button'; import { Button } from '../../components/ui/button';
import { Badge } from '../../components/ui/badge'; import { Badge } from '../../components/ui/badge';
import { Avatar, AvatarImage, AvatarFallback } from '../../components/ui/avatar'; import { Avatar, AvatarImage, AvatarFallback } from '../../components/ui/avatar';
import { ArrowLeft, Mail, Phone, MapPin, Calendar, Lock, AlertTriangle, Camera, Upload, Trash2 } from 'lucide-react'; import { Input } from '../../components/ui/input';
import { ArrowLeft, Mail, Phone, MapPin, Calendar, Lock, AlertTriangle, Camera, Upload, Trash2, Shield } from 'lucide-react';
import { toast } from 'sonner'; import { toast } from 'sonner';
import ConfirmationDialog from '../../components/ConfirmationDialog'; import ConfirmationDialog from '../../components/ConfirmationDialog';
import ChangeRoleDialog from '../../components/ChangeRoleDialog';
import TransactionHistory from '../../components/TransactionHistory';
const AdminUserView = () => { const AdminUserView = () => {
const { userId } = useParams(); const { userId } = useParams();
@@ -16,21 +19,65 @@ const AdminUserView = () => {
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
const [resetPasswordLoading, setResetPasswordLoading] = useState(false); const [resetPasswordLoading, setResetPasswordLoading] = useState(false);
const [resendVerificationLoading, setResendVerificationLoading] = useState(false); const [resendVerificationLoading, setResendVerificationLoading] = useState(false);
const [subscriptions, setSubscriptions] = useState([]); const [transactions, setTransactions] = useState({ subscriptions: [], donations: [] });
const [subscriptionsLoading, setSubscriptionsLoading] = useState(true); const [transactionsLoading, setTransactionsLoading] = useState(true);
const [confirmDialogOpen, setConfirmDialogOpen] = useState(false); const [confirmDialogOpen, setConfirmDialogOpen] = useState(false);
const [pendingAction, setPendingAction] = useState(null); const [pendingAction, setPendingAction] = useState(null);
const [uploadingPhoto, setUploadingPhoto] = useState(false); const [uploadingPhoto, setUploadingPhoto] = useState(false);
const [maxFileSizeMB, setMaxFileSizeMB] = useState(50); const [maxFileSizeMB, setMaxFileSizeMB] = useState(50);
const [maxFileSizeBytes, setMaxFileSizeBytes] = useState(52428800); const [maxFileSizeBytes, setMaxFileSizeBytes] = useState(52428800);
const [memberSince, setMemberSince] = useState('');
const [memberSinceSaving, setMemberSinceSaving] = useState(false);
const fileInputRef = useRef(null); const fileInputRef = useRef(null);
const [changeRoleDialogOpen, setChangeRoleDialogOpen] = useState(false);
const formatLocalDateInputValue = (date) => {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
};
const formatDateInputValue = (value) => {
if (!value) return '';
if (typeof value === 'string') {
if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
return value;
}
const parsed = new Date(value);
if (Number.isNaN(parsed.getTime())) {
return value.slice(0, 10);
}
return formatLocalDateInputValue(parsed);
}
const parsed = new Date(value);
if (Number.isNaN(parsed.getTime())) return '';
return formatLocalDateInputValue(parsed);
};
const formatDateDisplayValue = (value) => {
if (!value) return 'N/A';
if (typeof value === 'string' && /^\d{4}-\d{2}-\d{2}$/.test(value)) {
const [year, month, day] = value.split('-').map(Number);
return new Date(year, month - 1, day).toLocaleDateString();
}
const parsed = new Date(value);
if (Number.isNaN(parsed.getTime())) return 'N/A';
return parsed.toLocaleDateString();
};
useEffect(() => { useEffect(() => {
fetchConfig(); fetchConfig();
fetchUserProfile(); fetchUserProfile();
fetchSubscriptions(); fetchTransactions();
}, [userId]); }, [userId]);
useEffect(() => {
if (user) {
setMemberSince(formatDateInputValue(user.member_since));
}
}, [user]);
const fetchUserProfile = async () => { const fetchUserProfile = async () => {
try { try {
const response = await api.get(`/admin/users/${userId}`); const response = await api.get(`/admin/users/${userId}`);
@@ -43,14 +90,15 @@ const AdminUserView = () => {
} }
}; };
const fetchSubscriptions = async () => { const fetchTransactions = async () => {
try { try {
const response = await api.get(`/admin/subscriptions?user_id=${userId}`); setTransactionsLoading(true);
setSubscriptions(response.data); const response = await api.get(`/admin/users/${userId}/transactions`);
setTransactions(response.data);
} catch (error) { } catch (error) {
console.error('Failed to fetch subscriptions:', error); console.error('Failed to fetch transactions:', error);
} finally { } finally {
setSubscriptionsLoading(false); setTransactionsLoading(false);
} }
}; };
@@ -175,6 +223,27 @@ const AdminUserView = () => {
} }
}; };
const handleMemberSinceSave = async () => {
if (!user) return;
setMemberSinceSaving(true);
try {
const payload = {
member_since: memberSince ? memberSince : null
};
const response = await api.put(`/admin/users/${userId}`, payload);
setUser(prev => ({
...prev,
...(response?.data || {}),
member_since: payload.member_since
}));
toast.success('Member since updated successfully');
} catch (error) {
toast.error(error.response?.data?.detail || 'Failed to update member since');
} finally {
setMemberSinceSaving(false);
}
};
const getActionMessage = () => { const getActionMessage = () => {
if (!pendingAction || !user) return {}; if (!pendingAction || !user) return {};
@@ -202,9 +271,18 @@ const AdminUserView = () => {
return {}; return {};
}; };
const handleRoleChanged = () => {
// Refresh user data after role change
fetchUserProfile();
};
if (loading) return <div>Loading...</div>; if (loading) return <div>Loading...</div>;
if (!user) return null; if (!user) return null;
const joinedDate = user.member_since || user.created_at;
const memberSinceBaseline = formatDateInputValue(user.member_since);
const memberSinceHasChanges = memberSince !== memberSinceBaseline;
return ( return (
<> <>
{/* Back Button */} {/* Back Button */}
@@ -255,7 +333,7 @@ const AdminUserView = () => {
</div> </div>
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<Calendar className="h-4 w-4" /> <Calendar className="h-4 w-4" />
<span>Joined {new Date(user.created_at).toLocaleDateString()}</span> <span>Joined {formatDateDisplayValue(joinedDate)}</span>
</div> </div>
</div> </div>
</div> </div>
@@ -278,6 +356,15 @@ const AdminUserView = () => {
{resetPasswordLoading ? 'Resetting...' : 'Reset Password'} {resetPasswordLoading ? 'Resetting...' : 'Reset Password'}
</Button> </Button>
<Button
onClick={() => setChangeRoleDialogOpen(true)}
variant="outline"
className="border-2 border-brand-purple text-brand-purple hover:bg-[var(--lavender-300)] rounded-full px-4 py-2"
>
<Shield className="h-4 w-4 mr-2" />
Change Role
</Button>
{!user.email_verified && ( {!user.email_verified && (
<Button <Button
onClick={handleResendVerificationRequest} onClick={handleResendVerificationRequest}
@@ -343,10 +430,31 @@ const AdminUserView = () => {
<div> <div>
<label className="text-sm font-medium text-brand-purple " style={{ fontFamily: "'Nunito Sans', sans-serif" }}>Date of Birth</label> <label className="text-sm font-medium text-brand-purple " style={{ fontFamily: "'Nunito Sans', sans-serif" }}>Date of Birth</label>
<p className="text-[var(--purple-ink)] mt-1" style={{ fontFamily: "'Nunito Sans', sans-serif" }}> <p className="text-[var(--purple-ink)] mt-1" style={{ fontFamily: "'Nunito Sans', sans-serif" }}>
{new Date(user.date_of_birth).toLocaleDateString()} {formatDateDisplayValue(user.date_of_birth)}
</p> </p>
</div> </div>
<div>
<label className="text-sm font-medium text-brand-purple " style={{ fontFamily: "'Nunito Sans', sans-serif" }}>Member Since</label>
<div className="mt-1 flex flex-wrap items-center gap-2">
<Input
type="date"
value={memberSince}
onChange={(e) => setMemberSince(e.target.value)}
className="max-w-[200px] border-[var(--neutral-800)]"
/>
<Button
type="button"
size="sm"
onClick={handleMemberSinceSave}
disabled={memberSinceSaving || !memberSinceHasChanges}
className="bg-[var(--neutral-800)] text-[var(--purple-ink)] hover:bg-background"
>
{memberSinceSaving ? 'Saving...' : 'Save'}
</Button>
</div>
</div>
{user.partner_first_name && ( {user.partner_first_name && (
<div> <div>
<label className="text-sm font-medium text-brand-purple " style={{ fontFamily: "'Nunito Sans', sans-serif" }}>Partner</label> <label className="text-sm font-medium text-brand-purple " style={{ fontFamily: "'Nunito Sans', sans-serif" }}>Partner</label>
@@ -376,97 +484,17 @@ const AdminUserView = () => {
</div> </div>
</Card> </Card>
{/* Subscription Info (if applicable) */} {/* Transaction History */}
{user.role === 'member' && ( <div className="mt-8">
<Card className="p-8 bg-background rounded-2xl border border-[var(--neutral-800)] mt-8"> <TransactionHistory
<h2 className="text-2xl font-semibold text-[var(--purple-ink)] mb-6" style={{ fontFamily: "'Inter', sans-serif" }}> subscriptions={transactions.subscriptions}
Subscription Information donations={transactions.donations}
</h2> totalSubscriptionCents={transactions.total_subscription_amount_cents}
totalDonationCents={transactions.total_donation_amount_cents}
{subscriptionsLoading ? ( loading={transactionsLoading}
<p className="text-brand-purple " style={{ fontFamily: "'Nunito Sans', sans-serif" }}>Loading subscriptions...</p> isAdmin={true}
) : subscriptions.length === 0 ? ( />
<p className="text-brand-purple " style={{ fontFamily: "'Nunito Sans', sans-serif" }}>No subscriptions found for this member.</p>
) : (
<div className="space-y-6">
{subscriptions.map((sub) => (
<div key={sub.id} className="p-6 bg-[var(--lavender-500)] rounded-xl border border-[var(--neutral-800)]">
<div className="flex items-start justify-between mb-4">
<div>
<h3 className="text-lg font-semibold text-[var(--purple-ink)]" style={{ fontFamily: "'Inter', sans-serif" }}>
{sub.plan.name}
</h3>
<p className="text-sm text-brand-purple " style={{ fontFamily: "'Nunito Sans', sans-serif" }}>
{sub.plan.billing_cycle}
</p>
</div> </div>
<Badge className={
sub.status === 'active' ? 'bg-[var(--green-light)] text-white' :
sub.status === 'expired' ? 'bg-red-500 text-white' :
'bg-gray-400 text-white'
}>
{sub.status}
</Badge>
</div>
<div className="grid md:grid-cols-2 gap-4 text-sm">
<div>
<label className="text-brand-purple font-medium" style={{ fontFamily: "'Nunito Sans', sans-serif" }}>Start Date</label>
<p className="text-[var(--purple-ink)]" style={{ fontFamily: "'Nunito Sans', sans-serif" }}>
{new Date(sub.start_date).toLocaleDateString()}
</p>
</div>
{sub.end_date && (
<div>
<label className="text-brand-purple font-medium" style={{ fontFamily: "'Nunito Sans', sans-serif" }}>End Date</label>
<p className="text-[var(--purple-ink)]" style={{ fontFamily: "'Nunito Sans', sans-serif" }}>
{new Date(sub.end_date).toLocaleDateString()}
</p>
</div>
)}
<div>
<label className="text-brand-purple font-medium" style={{ fontFamily: "'Nunito Sans', sans-serif" }}>Base Amount</label>
<p className="text-[var(--purple-ink)]" style={{ fontFamily: "'Nunito Sans', sans-serif" }}>
${(sub.base_subscription_cents / 100).toFixed(2)}
</p>
</div>
{sub.donation_cents > 0 && (
<div>
<label className="text-brand-purple font-medium" style={{ fontFamily: "'Nunito Sans', sans-serif" }}>Donation</label>
<p className="text-[var(--purple-ink)]" style={{ fontFamily: "'Nunito Sans', sans-serif" }}>
${(sub.donation_cents / 100).toFixed(2)}
</p>
</div>
)}
<div>
<label className="text-brand-purple font-medium" style={{ fontFamily: "'Nunito Sans', sans-serif" }}>Total Paid</label>
<p className="text-[var(--purple-ink)] font-semibold" style={{ fontFamily: "'Nunito Sans', sans-serif" }}>
${(sub.amount_paid_cents / 100).toFixed(2)}
</p>
</div>
{sub.payment_method && (
<div>
<label className="text-brand-purple font-medium" style={{ fontFamily: "'Nunito Sans', sans-serif" }}>Payment Method</label>
<p className="text-[var(--purple-ink)]" style={{ fontFamily: "'Nunito Sans', sans-serif" }}>
{sub.payment_method}
</p>
</div>
)}
{sub.stripe_subscription_id && (
<div className="md:col-span-2">
<label className="text-brand-purple font-medium" style={{ fontFamily: "'Nunito Sans', sans-serif" }}>Stripe Subscription ID</label>
<p className="text-[var(--purple-ink)] text-xs font-mono" style={{ fontFamily: "'Nunito Sans', sans-serif" }}>
{sub.stripe_subscription_id}
</p>
</div>
)}
</div>
</div>
))}
</div>
)}
</Card>
)}
{/* Admin Action Confirmation Dialog */} {/* Admin Action Confirmation Dialog */}
<ConfirmationDialog <ConfirmationDialog
@@ -476,6 +504,14 @@ const AdminUserView = () => {
loading={resetPasswordLoading || resendVerificationLoading} loading={resetPasswordLoading || resendVerificationLoading}
{...getActionMessage()} {...getActionMessage()}
/> />
{/* Change Role Dialog */}
<ChangeRoleDialog
open={changeRoleDialogOpen}
onClose={() => setChangeRoleDialogOpen(false)}
user={user}
onSuccess={handleRoleChanged}
/>
</> </>
); );
}; };

View File

@@ -118,7 +118,9 @@ const MembersDirectory = () => {
: <div className=' border-2 w-full border-brand-purple mb-24' /> : <div className=' border-2 w-full border-brand-purple mb-24' />
) )
} }
const MemberCard = ({ member }) => ( const MemberCard = ({ member }) => {
const joinedDate = member.member_since || member.created_at;
return (
<Card className="p-6 bg-background rounded-3xl border border-[var(--neutral-800)] hover:shadow-lg transition-all h-full"> <Card className="p-6 bg-background rounded-3xl border border-[var(--neutral-800)] hover:shadow-lg transition-all h-full">
{/* Profile Photo */} {/* Profile Photo */}
<div className="flex justify-center mb-4"> <div className="flex justify-center mb-4">
@@ -160,11 +162,11 @@ const MembersDirectory = () => {
)} )}
{/* Member Since */} {/* Member Since */}
{member.created_at && ( {joinedDate && (
<div className="flex items-center justify-center gap-2 mb-4"> <div className="flex items-center justify-center gap-2 mb-4">
<Calendar className="h-4 w-4 text-brand-purple " /> <Calendar className="h-4 w-4 text-brand-purple " />
<span className="text-sm text-brand-purple " style={{ fontFamily: "'Nunito Sans', sans-serif" }}> <span className="text-sm text-brand-purple " style={{ fontFamily: "'Nunito Sans', sans-serif" }}>
Member since {new Date(member.created_at).toLocaleDateString('en-US', { Member since {new Date(joinedDate).toLocaleDateString('en-US', {
month: 'long', month: 'long',
year: 'numeric' year: 'numeric'
})} })}
@@ -277,6 +279,7 @@ const MembersDirectory = () => {
</div> </div>
</Card> </Card>
); );
};
return ( return (
<div className="min-h-screen bg-gradient-to-bl from-[var(--neutral-100:)] to-[var(--neutral-800)]"> <div className="min-h-screen bg-gradient-to-bl from-[var(--neutral-100:)] to-[var(--neutral-800)]">

View File

@@ -17,7 +17,7 @@
} }
.btn-ghost { .btn-ghost {
@apply hover:bg-brand-purple bg-brand-purple/10 rounded-full disabled:opacity-50 px-6 transition-transform text-brand-purple hover:text-[var(--purple-muted)]; @apply hover:bg-brand-purple bg-brand-purple/10 rounded-full disabled:opacity-50 px-6 transition-transform text-brand-purple hover:text-background;
} }
.btn-outline { .btn-outline {
@@ -91,6 +91,4 @@
.bg-light-lavender { .bg-light-lavender {
@apply bg-gradient-to-br from-brand-purple to-[var(--purple-ink)] text-white bg-[var(--neutral-800)] transition-transform dark:bg-brand-lavender dark:text-brand-dark-lavender; @apply bg-gradient-to-br from-brand-purple to-[var(--purple-ink)] text-white bg-[var(--neutral-800)] transition-transform dark:bg-brand-lavender dark:text-brand-dark-lavender;
} }
} }

View File

@@ -78,7 +78,7 @@
--green-muted: #66927e; --green-muted: #66927e;
--green-soft: #6a9680; --green-soft: #6a9680;
--green-eucalyptus: #6a9a83; --green-eucalyptus: #6a9a83;
--green-forest: #5e8EsOkvcwL7472374; --green-forest: #5a7d68;
--green-fern: #6da085; --green-fern: #6da085;
--green-mint: #6fa087; --green-mint: #6fa087;
--green-pastel: #6fa188; --green-pastel: #6fa188;
@@ -243,4 +243,3 @@
--neutral-900: #f4f4ff; /* highest contrast text */ --neutral-900: #f4f4ff; /* highest contrast text */
} }
} }