Add: - app/(application)/(user)/profile/[id]/blocked-list.tsx app/(application)/(user)/profile/[id]/detail-blocked.tsx components/_ShareComponent/ListEmptyComponent.tsx components/_ShareComponent/ListLoaderFooterComponent.tsx components/_ShareComponent/ListSkeletonComponent.tsx hooks/use-paginated-api.ts service/api-client/api-blocked.ts Fix: modified: app/(application)/(user)/profile/_layout.tsx modified: components/_ShareComponent/NewWrapper.tsx modified: components/index.ts modified: screens/Profile/ListPage.tsx modified: styles/global-styles.ts ### No Issue
94 lines
2.5 KiB
TypeScript
94 lines
2.5 KiB
TypeScript
import {
|
|
AlertDefaultSystem,
|
|
AvatarUsernameAndOtherComponent,
|
|
BaseBox,
|
|
BoxButtonOnFooter,
|
|
BoxWithHeaderSection,
|
|
ButtonCustom,
|
|
NewWrapper,
|
|
StackCustom,
|
|
TextCustom,
|
|
} from "@/components";
|
|
import AvatarAndBackground from "@/screens/Profile/AvatarAndBackground";
|
|
import {
|
|
apiGetBlockedById,
|
|
apiUnblock,
|
|
} from "@/service/api-client/api-blocked";
|
|
import { router, useLocalSearchParams } from "expo-router";
|
|
import _ from "lodash";
|
|
import { useEffect, useState } from "react";
|
|
|
|
export default function ProfileDetailBlocked() {
|
|
const { id } = useLocalSearchParams();
|
|
const [data, setData] = useState<any>(null);
|
|
const [isLoading, setIsLoading] = useState<boolean>(false);
|
|
|
|
useEffect(() => {
|
|
fetchData();
|
|
}, [id]);
|
|
|
|
const fetchData = async () => {
|
|
const response = await apiGetBlockedById({ id: String(id) });
|
|
// console.log("[RESPONSE >>]", JSON.stringify(response, null, 2));
|
|
setData(response.data);
|
|
};
|
|
|
|
const handleSubmit = async () => {
|
|
try {
|
|
setIsLoading(true);
|
|
await apiUnblock({ id: String(id) });
|
|
router.back();
|
|
} catch (error) {
|
|
console.log("[ERROR >>]", JSON.stringify(error, null, 2));
|
|
} finally {
|
|
setIsLoading(false);
|
|
}
|
|
};
|
|
|
|
return (
|
|
<>
|
|
<NewWrapper
|
|
footerComponent={
|
|
<BoxButtonOnFooter>
|
|
<ButtonCustom
|
|
isLoading={isLoading}
|
|
onPress={() => {
|
|
AlertDefaultSystem({
|
|
title: "Buka Blokir",
|
|
message: "Apakah anda yakin ingin membuka blokir ini?",
|
|
textLeft: "Tidak",
|
|
textRight: "Ya",
|
|
onPressRight: () => {
|
|
handleSubmit();
|
|
},
|
|
});
|
|
}}
|
|
>
|
|
Buka Blokir
|
|
</ButtonCustom>
|
|
</BoxButtonOnFooter>
|
|
}
|
|
>
|
|
<BoxWithHeaderSection>
|
|
<StackCustom>
|
|
<AvatarUsernameAndOtherComponent
|
|
avatarHref={`/profile/${data?.blocked?.Profile?.id}`}
|
|
avatar={data?.blocked?.Profile?.imageId}
|
|
name={data?.blocked?.username}
|
|
/>
|
|
|
|
<TextCustom align="center">
|
|
Jika anda membuka blokir ini maka semua postingan terkait user ini
|
|
akan muncul kembali di beranda
|
|
<TextCustom bold color="red">
|
|
{" "}
|
|
{_.upperCase(data?.menuFeature?.name)}
|
|
</TextCustom>
|
|
</TextCustom>
|
|
</StackCustom>
|
|
</BoxWithHeaderSection>
|
|
</NewWrapper>
|
|
</>
|
|
);
|
|
}
|