"use client";
import {
ActionIcon,
AppShell,
Avatar,
Box,
Center,
Flex,
Footer,
Grid,
Group,
Header,
Loader,
SimpleGrid,
Stack,
Text,
ThemeIcon,
Title,
} from "@mantine/core";
import { HomeView } from ".";
import {
IconUserSearch,
IconAward,
IconQrcode,
IconUserCircle,
} from "@tabler/icons-react";
import { Logout } from "../auth";
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
import { MODEL_USER } from "./model/interface";
import React, { useState } from "react";
import { useRouter } from "next/navigation";
import { ComponentGlobal_NotifikasiPeringatan } from "../component_global/notif_global/notifikasi_peringatan";
import { ComponentGlobal_NotifikasiBerhasil } from "../component_global/notif_global/notifikasi_berhasil";
import { RouterUserSearch } from "@/app/lib/router_hipmi/router_user_search";
export default function HomeLayout({
dataUser,
children,
}: {
dataUser: MODEL_USER;
children: React.ReactNode;
}) {
const router = useRouter();
const [user, setUser] = useState(dataUser);
const [loadingProfil, setLoadingProfile] = useState(false);
const [loadingUS, setLoadingUS] = useState(false);
const listFooter = [
{
id: 1,
name: "Temukan user",
icon: ,
link: ``,
},
{
id: 2,
name: "Profile",
icon: ,
link: RouterProfile.katalog,
},
];
const Compo_Footer = (
);
return (
<>
{/* Header */}
HIPMI
{/* Children */}
{children}
{/* Footer */}
{loadingUS ? (
) : (
{
if (user?.Profile === null) {
ComponentGlobal_NotifikasiPeringatan(
"Lengkapi Profile"
);
} else {
setLoadingUS(true);
// router.push(RouterProfile.katalog + `${user.Profile.id}`);
router.push(RouterUserSearch.main);
}
}}
>
Temukan pengguna
)}
{loadingProfil ? (
) : (
{
setLoadingProfile(true);
if (user?.Profile === null) {
router.push(RouterProfile.create + `${user.id}`);
} else {
router.push(
RouterProfile.katalog + `${user.Profile.id}`
);
}
}}
>
{user?.Profile === null ? (
) : (
)}
Profile
)}
>
);
return (
<>
HIPMI
{/* */}
}
footer={
}
>
{children}
>
);
}