# feat:
- Deskripsi: - Notifikasi collaboration ## Issue: Scroll dari chat akan di ubah dengan package yang mas malik buat
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import { Affix, rem, Center, Button } from "@mantine/core";
|
||||
import { useState } from "react";
|
||||
import colab_getListAllProyek from "../../fun/get/get_list_all_proyek";
|
||||
|
||||
export function ComponentColab_ButtonUpdateBeranda({
|
||||
onLoad,
|
||||
setIsNewPost,
|
||||
}: {
|
||||
onLoad: (val: any) => void;
|
||||
setIsNewPost: any;
|
||||
}) {
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
async function onLoadData() {
|
||||
const loadData = await colab_getListAllProyek({ page: 1 });
|
||||
onLoad(loadData);
|
||||
setIsNewPost(false);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Affix position={{ top: rem(70) }} w={"100%"}>
|
||||
<Center>
|
||||
<Button
|
||||
style={{
|
||||
transition: "0.5s",
|
||||
border: `1px solid ${AccentColor.skyblue}`,
|
||||
backgroundColor: AccentColor.softblue,
|
||||
}}
|
||||
loaderPosition="center"
|
||||
loading={isLoading ? true : false}
|
||||
radius={"xl"}
|
||||
opacity={0.8}
|
||||
onClick={() => {
|
||||
onLoadData();
|
||||
}}
|
||||
>
|
||||
Update Beranda
|
||||
</Button>
|
||||
</Center>
|
||||
</Affix>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -128,7 +128,7 @@ export default function ComponentColab_AuthorNameOnListPartisipan({
|
||||
radius={"xl"}
|
||||
variant="transparent"
|
||||
>
|
||||
<IconCaretRight color={opened ? "blue" : "gray"} />
|
||||
<IconCaretRight color={"white"} />
|
||||
</ActionIcon>
|
||||
) : (
|
||||
""
|
||||
|
||||
@@ -19,18 +19,17 @@ import {
|
||||
Stack,
|
||||
Text,
|
||||
Textarea,
|
||||
Title
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { useDisclosure } from "@mantine/hooks";
|
||||
import { IconX } from "@tabler/icons-react";
|
||||
import { useState } from "react";
|
||||
import colab_funCreatePartisipan from "../../fun/create/fun_create_partisipan_by_user_id";
|
||||
import colab_getListPartisipanByColabId from "../../fun/get/get_list_partisipan_by_id";
|
||||
import {
|
||||
MODEL_COLLABORATION_PARTISIPASI
|
||||
} from "../../model/interface";
|
||||
import { MODEL_COLLABORATION_PARTISIPASI } from "../../model/interface";
|
||||
import ComponentColab_AuthorNameOnListPartisipan from "./header_author_list_partisipan";
|
||||
|
||||
import notifikasiToUser_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_user";
|
||||
import mqtt_client from "@/util/mqtt_client";
|
||||
export default function ComponentColab_DetailListPartisipasiUser({
|
||||
listPartisipan,
|
||||
userLoginId,
|
||||
@@ -50,22 +49,43 @@ export default function ComponentColab_DetailListPartisipasiUser({
|
||||
const [deskripsi, setDeskripsi] = useState("");
|
||||
|
||||
async function onJoin() {
|
||||
await colab_funCreatePartisipan(
|
||||
const res = await colab_funCreatePartisipan(
|
||||
colabId as any,
|
||||
userLoginId as any,
|
||||
deskripsi
|
||||
).then(async (res) => {
|
||||
if (res.status === 201) {
|
||||
await colab_getListPartisipanByColabId(colabId as any).then((val) => {
|
||||
setApply(true);
|
||||
close();
|
||||
setData(val as any);
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
});
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
);
|
||||
if (res.status === 201) {
|
||||
const dataNotif = {
|
||||
appId: res?.data?.ProjectCollaboration?.id,
|
||||
userId: res?.data?.ProjectCollaboration?.userId,
|
||||
pesan: res?.data?.ProjectCollaboration?.title,
|
||||
status: "Partisipan Project",
|
||||
kategoriApp: "COLLABORATION",
|
||||
title: "Partisipan baru telah bergabung !",
|
||||
};
|
||||
|
||||
const createNotifikasi = await notifikasiToUser_funCreate({
|
||||
data: dataNotif as any,
|
||||
});
|
||||
|
||||
if (createNotifikasi.status === 201) {
|
||||
mqtt_client.publish(
|
||||
"USER",
|
||||
JSON.stringify({
|
||||
userId: dataNotif.userId,
|
||||
count: 1,
|
||||
})
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
const resList = await colab_getListPartisipanByColabId(colabId as any);
|
||||
setApply(true);
|
||||
close();
|
||||
setData(resList as any);
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -104,7 +124,7 @@ export default function ComponentColab_DetailListPartisipasiUser({
|
||||
</ActionIcon>
|
||||
</Group>
|
||||
<Textarea
|
||||
maxLength={300}
|
||||
maxLength={300}
|
||||
label="Deskripsi Diri"
|
||||
placeholder="Deskripsikan diri anda yang sesuai dengan proyek ini.."
|
||||
minRows={4}
|
||||
@@ -116,7 +136,10 @@ export default function ComponentColab_DetailListPartisipasiUser({
|
||||
{/* <Button radius={"xl"} onClick={() => close()}>
|
||||
Batal
|
||||
</Button> */}
|
||||
<ComponentGlobal_InputCountDown lengthInput={deskripsi?.length} maxInput={300}/>
|
||||
<ComponentGlobal_InputCountDown
|
||||
lengthInput={deskripsi?.length}
|
||||
maxInput={300}
|
||||
/>
|
||||
<Button
|
||||
disabled={!deskripsi}
|
||||
radius={"xl"}
|
||||
@@ -124,7 +147,7 @@ export default function ComponentColab_DetailListPartisipasiUser({
|
||||
bg={MainColor.yellow}
|
||||
onClick={() => onJoin()}
|
||||
style={{
|
||||
transition: "0.5s"
|
||||
transition: "0.5s",
|
||||
}}
|
||||
>
|
||||
Simpan
|
||||
|
||||
Reference in New Issue
Block a user