fix
Desc: - Penambahan function - Perubahan tampilan
This commit is contained in:
@@ -10,25 +10,24 @@ import { useAtom } from "jotai";
|
||||
import { gs_profile } from "../../profile/state/global_state";
|
||||
import getListPortofolio from "../api/get-portofolio";
|
||||
import { gs_ListPortofolio } from "../state/global_state";
|
||||
import { myConsole } from "@/app/fun/my_console";
|
||||
import { getProfile } from "../../profile";
|
||||
|
||||
export default function PortofolioView({
|
||||
profileId,
|
||||
porto,
|
||||
}: {
|
||||
profileId: any;
|
||||
porto: any;
|
||||
}) {
|
||||
export default function PortofolioView() {
|
||||
const [profile, setProfile] = useAtom(gs_profile);
|
||||
useShallowEffect(() => {
|
||||
loadDataProfile(setProfile);
|
||||
loadProfile();
|
||||
}, []);
|
||||
|
||||
const [listPorto, setListPorto] = useAtom(gs_ListPortofolio)
|
||||
async function loadProfile() {
|
||||
const get = await getProfile();
|
||||
if (!get) return myConsole("Data Kosong");
|
||||
setProfile(get);
|
||||
}
|
||||
const [listPorto, setListPorto] = useAtom(gs_ListPortofolio);
|
||||
useShallowEffect(() => {
|
||||
loadListPortofolio(profile?.id).then((res) => setListPorto(res));
|
||||
}, [profile?.id]);
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* {JSON.stringify(profile.id)}
|
||||
@@ -37,13 +36,13 @@ export default function PortofolioView({
|
||||
<Center>
|
||||
<Title order={4}>Portofolio</Title>
|
||||
</Center>
|
||||
<Box mt={"md"} >
|
||||
<Box mt={"md"}>
|
||||
{(() => {
|
||||
if (listPorto) {
|
||||
return (
|
||||
<>
|
||||
{_.map(listPorto).map((e: any) => (
|
||||
<Paper key={e.id} h={50} bg={"gray"} my={"md"} >
|
||||
<Paper key={e.id} h={50} bg={"gray"} my={"md"}>
|
||||
<Grid h={50} align="center" px={"md"}>
|
||||
<Grid.Col span={10}>
|
||||
<Text fw={"bold"}>{e.namaBisnis}</Text>
|
||||
|
||||
@@ -31,25 +31,39 @@ import { ApiHipmi } from "@/app/lib/api";
|
||||
import { loadDataProfile } from "../fun/fun_get_profile";
|
||||
import { getFotoProfile } from "../api/get-foto-profile";
|
||||
import { gs_fotoProfile, gs_profile } from "../state/global_state";
|
||||
import { getProfile } from "..";
|
||||
import { USER_PROFILE } from "@/app_modules/models/user_profile";
|
||||
import { funGetUserProfile } from "@/app_modules/fun/get_user_profile";
|
||||
|
||||
export default function ProfileView({ data }: { data: any }) {
|
||||
export default function ProfileView({ user }: { user: USER_PROFILE }) {
|
||||
const router = useRouter();
|
||||
const [stateUser, setStateUser] = useState(user);
|
||||
|
||||
//Get data profile
|
||||
const [profile, setProfile] = useAtom(gs_profile);
|
||||
useShallowEffect(() => {
|
||||
loadDataProfile(setProfile);
|
||||
loadProfile();
|
||||
}, []);
|
||||
async function loadProfile() {
|
||||
const get = await getProfile();
|
||||
if (!get) return myConsole("Data Kosong");
|
||||
setProfile(get);
|
||||
}
|
||||
|
||||
const [foto, setFoto] = useAtom(gs_fotoProfile);
|
||||
useShallowEffect(() => {
|
||||
if (profile?.imagesId === undefined) {
|
||||
return myConsole("Waiting data");
|
||||
} else {
|
||||
getFotoProfile(profile?.imagesId).then((v) => setFoto(v?.url));
|
||||
}
|
||||
}, [profile?.imagesId]);
|
||||
// useShallowEffect(() => {
|
||||
// if (profile?.imagesId === undefined) {
|
||||
// return myConsole("Waiting data");
|
||||
// } else {
|
||||
// getFotoProfile(profile?.imagesId).then((v) => setFoto(v?.url));
|
||||
// }
|
||||
// }, [profile?.imagesId]);
|
||||
|
||||
useShallowEffect(() => {
|
||||
funGetUserProfile(user.id ?? "").then(setStateUser as any);
|
||||
}, []);
|
||||
|
||||
if (!stateUser) return <></>;
|
||||
return (
|
||||
<>
|
||||
{/* {JSON.stringify(data)} */}
|
||||
@@ -74,18 +88,21 @@ export default function ProfileView({ data }: { data: any }) {
|
||||
}}
|
||||
>
|
||||
<Center h={101}>
|
||||
<Image
|
||||
src={ApiHipmi.get_foto + foto ?? ""}
|
||||
alt=""
|
||||
radius={100}
|
||||
width={100}
|
||||
height={100}
|
||||
sx={
|
||||
{
|
||||
// position: "fixed",
|
||||
{/* {stateUser.Profile?.ImageProfile?.url} */}
|
||||
{stateUser.Profile?.ImageProfile?.url && (
|
||||
<Image
|
||||
src={"/img/" + stateUser.Profile?.ImageProfile?.url}
|
||||
alt=""
|
||||
radius={100}
|
||||
width={100}
|
||||
height={100}
|
||||
sx={
|
||||
{
|
||||
// position: "fixed",
|
||||
}
|
||||
}
|
||||
}
|
||||
/>
|
||||
/>
|
||||
)}
|
||||
</Center>
|
||||
</Paper>
|
||||
</Center>
|
||||
|
||||
@@ -33,13 +33,14 @@ import { loadDataProfile } from "../profile/fun/fun_get_profile";
|
||||
import { getFotoProfile } from "../profile/api/get-foto-profile";
|
||||
import { ApiHipmi } from "@/app/lib/api";
|
||||
import { PortofolioView } from "../portofolio";
|
||||
import { User } from "@prisma/client";
|
||||
import { USER_PROFILE } from "@/app_modules/models/user_profile";
|
||||
|
||||
export default function KatalogView({ data, porto }: { data: any, porto: any }) {
|
||||
export default function KatalogView({ user }: { user: USER_PROFILE }) {
|
||||
return (
|
||||
<>
|
||||
|
||||
<ProfileView data={data} />
|
||||
<PortofolioView profileId={data.id} porto={porto}/>
|
||||
<ProfileView user={user} />
|
||||
<PortofolioView />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user