import { Avatar, Box, Chip, Grid, Paper, Stack, Typography, useMediaQuery } from '@mui/material'; import { useTheme } from '@mui/material/styles'; import { useQuery } from '@tanstack/react-query'; import { MdBadge, MdPerson, MdLocationOn, MdMail, MdPhone, MdPlace, MdMyLocation, MdLocationCity, MdMap, MdMarkunreadMailbox, MdVerifiedUser } from 'react-icons/md'; import CircularLoader from 'components/CircularLoader'; import Loader from 'components/Loader'; import { getusers } from 'pages/api/api'; // ---- shared design tokens (mirrors the DT block used across the console) ---- const DT = { radiusCard: 16, radiusInner: 12, shadowSoft: '0 14px 40px rgba(15, 23, 42, 0.10)', textPrimary: '#0f172a', textSecondary: '#64748b', textMuted: '#94a3b8', borderSubtle: '#e2e8f0', divider: '#f1f5f9', surface: '#ffffff', surfaceAlt: '#f8fafc' }; const BRAND = '#662582'; const BRAND_LIGHT = '#9255AB'; const tint = (c) => `${c}08`; const soft = (c) => `${c}18`; const initialsOf = (name) => (name || '') .trim() .split(/\s+/) .slice(0, 2) .map((w) => w[0]) .join('') .toUpperCase() || '–'; // A single read-only field rendered as an icon + uppercase label + value. const InfoField = ({ icon: Icon, label, value, accent = BRAND }) => ( {label} {value || '—'} ); // A titled grouping card. const SectionCard = ({ title, icon: Icon, children }) => ( {title} {children} ); const ViewProfile = () => { const theme = useTheme(); const isMobile = useMediaQuery(theme.breakpoints.down('md')); const { data: userData, isLoading } = useQuery({ queryKey: ['getuser'], queryFn: getusers }); const fullname = userData?.fullname || userData?.firstname || 'User Profile'; return ( <> {isLoading && ( <> )} {/* ---- Gradient brand header ---- */} {initialsOf(fullname)} {fullname} {userData?.authname && ( } label={userData.authname} sx={{ bgcolor: soft(BRAND), color: BRAND, fontWeight: 700, border: `1px solid ${BRAND}40`, '& .MuiChip-icon': { ml: '6px' } }} /> )} {userData?.userid != null && userData?.userid !== '' && ( ID #{userData.userid} )} {userData?.applocation && ( {userData.applocation} )} {/* ---- Grouped detail cards ---- */} ); }; export default ViewProfile;