Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | 1x 10x 1x 2x 2x | import React from "react";
import SubPage from "@/components/page/SubPage/SubPage";
import { useAuth } from "@/hooks/useAuth";
import { APP_ROUTES } from "@/routes/const";
import { Link, useLocation } from "react-router-dom";
import {
CircleUserRound,
Mail,
ShieldCheck,
ShieldAlert,
Hash,
User,
} from "lucide-react";
import { SettingsTabs } from "./SettingsTabs";
const Field: React.FC<{
icon: React.ElementType;
label: string;
value: React.ReactNode;
}> = ({ icon: Icon, label, value }) => (
<div className="flex items-start gap-4 py-4 border-b border-gray-100 dark:border-gray-700 last:border-0">
<div className="p-2 rounded-lg bg-gray-100 dark:bg-gray-700 mt-0.5 shrink-0">
<Icon className="size-4 text-gray-500 dark:text-gray-400" />
</div>
<div className="flex-1 min-w-0">
<div className="text-xs font-medium text-gray-400 dark:text-gray-500 uppercase tracking-wide mb-0.5">
{label}
</div>
<div className="text-sm text-gray-800 dark:text-gray-200 break-all">
{value}
</div>
</div>
</div>
);
const SettingsProfile: React.FC = () => {
const { user } = useAuth();
return (
<SubPage title="Profile" links={[<SettingsTabs key="tabs" active="profile" />]}>
<div className="max-w-xl space-y-6">
{/* Avatar + identity */}
<div className="flex items-center gap-5">
{user?.picture ? (
<img
src={user.picture}
alt={user.name}
className="size-20 rounded-full object-cover ring-2 ring-gray-200 dark:ring-gray-600"
/>
) : (
<div className="size-20 rounded-full bg-gray-200 dark:bg-gray-700 flex items-center justify-center ring-2 ring-gray-300 dark:ring-gray-600">
<User className="size-8 text-gray-400" />
</div>
)}
<div>
<h2 className="text-xl font-semibold text-gray-900 dark:text-gray-100">
{user?.name ?? "—"}
</h2>
<p className="text-sm text-gray-500 dark:text-gray-400">
{user?.email ?? "—"}
</p>
</div>
</div>
{/* Fields */}
<div className="rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 px-5 shadow-sm">
<Field
icon={User}
label="Display name"
value={user?.name ?? "—"}
/>
<Field
icon={Mail}
label="Email address"
value={user?.email ?? "—"}
/>
<Field
icon={
user?.email_verified ? ShieldCheck : ShieldAlert
}
label="Email verification"
value={
user?.email_verified ? (
<span className="inline-flex items-center gap-1.5 text-emerald-600 dark:text-emerald-400 font-medium">
<ShieldCheck className="size-3.5" />
Verified
</span>
) : (
<span className="inline-flex items-center gap-1.5 text-amber-600 dark:text-amber-400 font-medium">
<ShieldAlert className="size-3.5" />
Not verified
</span>
)
}
/>
<Field
icon={Hash}
label="User ID"
value={
<code className="text-xs bg-gray-100 dark:bg-gray-700 px-2 py-0.5 rounded font-mono">
{user?.sub ?? "—"}
</code>
}
/>
<Field
icon={CircleUserRound}
label="Nickname"
value={user?.nickname ?? "—"}
/>
</div>
<p className="text-xs text-gray-400 dark:text-gray-500">
Profile information is managed through your identity provider. Contact
your administrator to make changes.
</p>
</div>
</SubPage>
);
};
export default SettingsProfile;
|