import React from "react"; import { useRouter } from "next/router"; import Link from "next/link"; import { observer } from "mobx-react-lite"; // mobx import { useMobxStore } from "lib/mobx/store-provider"; const PROFILE_LINKS: Array<{ key: string; label: string; href: string; }> = [ { key: "profile", label: "Profile", href: `/profile`, }, { key: "change-password", label: "Change password", href: `/profile/change-password`, }, { key: "activity", label: "Activity", href: `/profile/activity`, }, { key: "preferences", label: "Preferences", href: `/profile/preferences`, }, ]; export const ProfileSettingsSidebar = observer(() => { const router = useRouter(); const { appConfig: { envConfig }, } = useMobxStore(); const enableEmailPassword = envConfig && (envConfig?.email_password_login || !( envConfig?.email_password_login || envConfig?.magic_login || envConfig?.google_client_id || envConfig?.github_client_id )); return (
My Account
{PROFILE_LINKS.map((link) => { if (link.key === "change-password" && !enableEmailPassword) return; return (
{link.label}
); })}
); });