Features: - Fetch and display family details and members - Family share code with copy-to-clipboard functionality - Invite family members via email with role selection - Join another family using share code - Remove family members with confirmation - Visual indicators for current user - Role-based chip colors (Parent/Caregiver/Viewer) - Loading states and error handling - Empty state when no members exist - Success notifications via Snackbar Components Created: - components/family/InviteMemberDialog.tsx: Invite form with email and role - components/family/JoinFamilyDialog.tsx: Join family via share code - components/family/RemoveMemberDialog.tsx: Remove member confirmation All features fully integrated with backend API using familiesApi 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
53 lines
1.4 KiB
TypeScript
53 lines
1.4 KiB
TypeScript
'use client';
|
|
|
|
import {
|
|
Dialog,
|
|
DialogTitle,
|
|
DialogContent,
|
|
DialogActions,
|
|
Button,
|
|
Typography,
|
|
} from '@mui/material';
|
|
import { Warning } from '@mui/icons-material';
|
|
|
|
interface RemoveMemberDialogProps {
|
|
open: boolean;
|
|
onClose: () => void;
|
|
onConfirm: () => void;
|
|
memberName: string;
|
|
isLoading?: boolean;
|
|
}
|
|
|
|
export function RemoveMemberDialog({
|
|
open,
|
|
onClose,
|
|
onConfirm,
|
|
memberName,
|
|
isLoading = false,
|
|
}: RemoveMemberDialogProps) {
|
|
return (
|
|
<Dialog open={open} onClose={onClose} maxWidth="xs" fullWidth>
|
|
<DialogTitle sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
|
|
<Warning color="warning" />
|
|
Remove Family Member
|
|
</DialogTitle>
|
|
<DialogContent>
|
|
<Typography variant="body1">
|
|
Are you sure you want to remove <strong>{memberName}</strong> from your family?
|
|
</Typography>
|
|
<Typography variant="body2" color="text.secondary" sx={{ mt: 2 }}>
|
|
This member will lose access to all family data and activities.
|
|
</Typography>
|
|
</DialogContent>
|
|
<DialogActions>
|
|
<Button onClick={onClose} disabled={isLoading}>
|
|
Cancel
|
|
</Button>
|
|
<Button onClick={onConfirm} color="error" variant="contained" disabled={isLoading}>
|
|
{isLoading ? 'Removing...' : 'Remove Member'}
|
|
</Button>
|
|
</DialogActions>
|
|
</Dialog>
|
|
);
|
|
}
|