"use client"; import React, { useEffect, useState } from "react"; import { Link } from "@/i18n/routing"; import { Icon } from "@iconify/react/dist/iconify.js"; import { getInfoProfile, getListPorvinces, getUsersTeams } from "@/service/landing/landing"; import { useParams } from "next/navigation"; import { useTranslations } from "next-intl"; const HeaderManagement = () => { const [profile, setProfile] = useState(); const [province, setProvince] = useState([]); const [, setUser] = useState(); const [selectedTab, setSelectedTab] = useState("video"); const params = useParams(); const t = useTranslations("LandingPage"); // const currentRoute = router.pathname; // const profilePicture = Cookies.get("profile_picture"); useEffect(() => { async function initState() { const response = await getInfoProfile(); setProfile(response?.data?.data); } async function getProvinces() { const response = await getListPorvinces(); // console.log(response?.data?.data); setProvince(response?.data?.data); } // async function getDisticts() { // const response = await getListDistricts(); // console.log(response?.data?.data); // setDistrict(response?.data?.data); // } initState(); getProvinces(); // getDisticts(); }, []); useEffect(() => { async function initState() { if (profile != undefined) { const response = await getUsersTeams(profile?.instituteId); // console.log(response?.data?.data); setUser(response?.data?.data); } } initState(); }, [profile]); function addDefaultProfile(ev: any) { ev.target.src = "/assets/avatar-profile.png"; } const [hasMounted, setHasMounted] = useState(false); // Hooks useEffect(() => { setHasMounted(true); }, []); // Render if (!hasMounted) return null; return (
{/* Header */}
avatar

{profile?.fullname}

{profile?.username}

{t("activeSince", { defaultValue: "Active Since" })}  {`${new Date(profile?.createdAt).getDate()}/${new Date(profile?.createdAt).getMonth() + 1}/${new Date(profile?.createdAt).getFullYear()} ${new Date(profile?.createdAt).getHours()}:${new Date( profile?.createdAt ).getMinutes()}`}

{t("fullProfile", { defaultValue: "Full Profile" })}

); }; export default HeaderManagement;