Merge pull request #177 from bipproduction/join

Fix create profile
This commit is contained in:
Bagasbanuna02
2024-12-10 11:13:04 +08:00
committed by GitHub
11 changed files with 105 additions and 57 deletions

View File

@@ -2,6 +2,8 @@
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines. All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
## [1.2.22](https://github.com/bipproduction/hipmi/compare/v1.2.21...v1.2.22) (2024-12-10)
## [1.2.21](https://github.com/bipproduction/hipmi/compare/v1.2.20...v1.2.21) (2024-12-09) ## [1.2.21](https://github.com/bipproduction/hipmi/compare/v1.2.20...v1.2.21) (2024-12-09)
## [1.2.20](https://github.com/bipproduction/hipmi/compare/v1.2.19...v1.2.20) (2024-12-09) ## [1.2.20](https://github.com/bipproduction/hipmi/compare/v1.2.19...v1.2.20) (2024-12-09)

View File

@@ -1,6 +1,6 @@
{ {
"name": "hipmi", "name": "hipmi",
"version": "1.2.21", "version": "1.2.22",
"private": true, "private": true,
"prisma": { "prisma": {
"seed": "npx tsx prisma/seed.ts --yes" "seed": "npx tsx prisma/seed.ts --yes"

View File

@@ -54,7 +54,7 @@ function TableStatus({ listPublish }: { listPublish: any }) {
useShallowEffect(() => { useShallowEffect(() => {
if (typeof window !== "undefined") { if (typeof window !== "undefined") {
console.log(window.location.origin); // console.log(window.location.origin);
setOrigin(window.location.origin); setOrigin(window.location.origin);
} }
}, [setOrigin]); }, [setOrigin]);

View File

@@ -17,7 +17,7 @@ export default function Colab_Splash() {
setHotMenu(1); setHotMenu(1);
// setStatus("Publish"); // setStatus("Publish");
router.replace(RouterColab.beranda, {scroll: false}); router.replace(RouterColab.beranda, {scroll: false});
}, 1000); }, 500);
}, []); }, []);
return ( return (

View File

@@ -10,7 +10,7 @@ export default function SplashCrowd() {
const router = useRouter(); const router = useRouter();
useShallowEffect(() => { useShallowEffect(() => {
setTimeout(() => router.push(RouterCrowd.main), 1000); setTimeout(() => router.push(RouterCrowd.main), 500);
}, []); }, []);
return ( return (
<> <>

View File

@@ -135,16 +135,6 @@ export default function Ui_Konfirmasi({
); );
} }
// Jika sudah join, sudah konfirmasi dan tanggal mulai acara sudah lewat
// if (isPresent && moment(data?.tanggal).diff(moment(), "minute") < 0)
if (
isPresent &&
isJoin &&
moment(data?.tanggal).diff(moment(), "minute") < 0
) {
return <UserAlreadyConfirm title={data.title} />;
}
if (isPresent == false && data) { if (isPresent == false && data) {
return ( return (
<UserNotConfirm <UserNotConfirm
@@ -154,6 +144,16 @@ export default function Ui_Konfirmasi({
/> />
); );
} }
// Jika sudah join, sudah konfirmasi dan tanggal mulai acara sudah lewat
// if (isPresent && moment(data?.tanggal).diff(moment(), "minute") < 0)
if (
isPresent &&
isJoin &&
moment(data?.tanggal).diff(moment(), "minute") < 0
) {
return <UserAlreadyConfirm title={data.title} />;
}
} }
function DataNotFound() { function DataNotFound() {

View File

@@ -7,6 +7,7 @@ import {
Center, Center,
Grid, Grid,
Group, Group,
Loader,
Skeleton, Skeleton,
Stack, Stack,
Text, Text,
@@ -31,6 +32,8 @@ import moment from "moment";
import { useShallowEffect } from "@mantine/hooks"; import { useShallowEffect } from "@mantine/hooks";
import { API_RouteEvent } from "@/app/lib/api_user_router/route_api_event"; import { API_RouteEvent } from "@/app/lib/api_user_router/route_api_event";
import Event_ComponentSkeletonListPeserta from "../skeleton/comp_skeleton_list_peserta"; import Event_ComponentSkeletonListPeserta from "../skeleton/comp_skeleton_list_peserta";
import { ScrollOnly } from "next-scroll-loader";
import { event_newGetListPesertaById } from "../../fun";
export default function ComponentEvent_ListPeserta({ export default function ComponentEvent_ListPeserta({
total, total,
@@ -43,6 +46,7 @@ export default function ComponentEvent_ListPeserta({
}) { }) {
const router = useRouter(); const router = useRouter();
const [data, setData] = useState<MODEL_EVENT_PESERTA[] | null>(null); const [data, setData] = useState<MODEL_EVENT_PESERTA[] | null>(null);
const [activePage, setActivePage] = useState<number>(1);
useShallowEffect(() => { useShallowEffect(() => {
onLoadPeserta(); onLoadPeserta();
@@ -80,22 +84,53 @@ export default function ComponentEvent_ListPeserta({
</Text> </Text>
</Center> </Center>
) : ( ) : (
<Stack> // <Stack>
{data.map((e, i) => ( // {data.map((e, i) => (
<Stack key={i} spacing={"sm"}> // <Stack key={i} spacing={"sm"}>
// <ComponentEvent_AvatarAndUsername
// profile={e?.User?.Profile as any}
// sizeAvatar={30}
// fontSize={"sm"}
// tanggalMulai={e?.Event?.tanggal}
// tanggalSelesai={e?.Event?.tanggalSelesai}
// isPresent={e?.isPresent}
// />
// {/* <Divider /> */}
// </Stack>
// ))}
// </Stack>
<ScrollOnly
height="90vh"
renderLoading={() => (
<Center mt={"lg"}>
<Loader color={"yellow"} />
</Center>
)}
data={data}
setData={setData as any}
moreData={async () => {
const loadData = await event_newGetListPesertaById({
eventId: eventId as string,
page: activePage + 1,
});
setActivePage((val) => val + 1);
return loadData;
}}
>
{(item) => (
<ComponentEvent_AvatarAndUsername <ComponentEvent_AvatarAndUsername
profile={e?.User?.Profile as any} profile={item?.User?.Profile as any}
sizeAvatar={30} sizeAvatar={30}
fontSize={"sm"} fontSize={"sm"}
tanggalMulai={e?.Event?.tanggal} tanggalMulai={item?.Event?.tanggal}
tanggalSelesai={e?.Event?.tanggalSelesai} tanggalSelesai={item?.Event?.tanggalSelesai}
isPresent={e?.isPresent} isPresent={item?.isPresent}
/> />
)}
{/* <Divider /> */} </ScrollOnly>
</Stack>
))}
</Stack>
)} )}
</Stack> </Stack>
</ComponentGlobal_CardStyles> </ComponentGlobal_CardStyles>
@@ -139,7 +174,6 @@ function ComponentEvent_AvatarAndUsername({
const tglMulai = moment(tanggalMulai).diff(moment(), "minutes") < 0; const tglMulai = moment(tanggalMulai).diff(moment(), "minutes") < 0;
return ( return (
<> <>
<Grid align="flex-start" justify="space-around"> <Grid align="flex-start" justify="space-around">
@@ -180,7 +214,11 @@ function ComponentEvent_AvatarAndUsername({
<Group position="right"> <Group position="right">
<Stack justify="center" h={30}> <Stack justify="center" h={30}>
<Text fw={"bold"} fz={fontSize ? fontSize : "sm"}> <Text fw={"bold"} fz={fontSize ? fontSize : "sm"}>
{isPresent ? <Badge color="green" >Hadir</Badge> : <Badge>-</Badge>} {isPresent ? (
<Badge color="green">Hadir</Badge>
) : (
<Badge>-</Badge>
)}
</Text> </Text>
</Stack> </Stack>
</Group> </Group>

View File

@@ -11,7 +11,7 @@ export default function Forum_Splash() {
useShallowEffect(() => { useShallowEffect(() => {
setTimeout(() => { setTimeout(() => {
router.replace(RouterForum.beranda, { scroll: false }); router.replace(RouterForum.beranda, { scroll: false });
}, 1000); }, 500);
}, []); }, []);
return ( return (

View File

@@ -54,6 +54,7 @@ export function Profile_ComponentCreateNewProfile({
file: filePP, file: filePP,
dirId: DIRECTORY_ID.profile_foto, dirId: DIRECTORY_ID.profile_foto,
}); });
// console.log("ini foto", uploadPhoto);
if (!uploadPhoto.success) { if (!uploadPhoto.success) {
setLoading(false); setLoading(false);
return ComponentGlobal_NotifikasiPeringatan( return ComponentGlobal_NotifikasiPeringatan(
@@ -61,10 +62,12 @@ export function Profile_ComponentCreateNewProfile({
); );
} }
if (uploadPhoto.success) {
const uploadBackground = await funGlobal_UploadToStorage({ const uploadBackground = await funGlobal_UploadToStorage({
file: fileBG, file: fileBG,
dirId: DIRECTORY_ID.profile_background, dirId: DIRECTORY_ID.profile_background,
}); });
// console.log("ini background", uploadBackground);
if (!uploadBackground.success) { if (!uploadBackground.success) {
setLoading(false); setLoading(false);
return ComponentGlobal_NotifikasiPeringatan( return ComponentGlobal_NotifikasiPeringatan(
@@ -72,19 +75,24 @@ export function Profile_ComponentCreateNewProfile({
); );
} }
if (uploadBackground.success) {
const create = await funCreateNewProfile({ const create = await funCreateNewProfile({
data: newData as any, data: newData as any,
imageId: uploadPhoto.data.id, imageId: uploadPhoto.data.id,
imageBackgroundId: uploadBackground.data.id, imageBackgroundId: uploadBackground.data.id,
}); });
if (create.status === 201) { if (create.status === 201) {
ComponentGlobal_NotifikasiBerhasil("Berhasil membuat profile", 3000); ComponentGlobal_NotifikasiBerhasil(
"Berhasil membuat profile",
3000
);
router.push(RouterHome.main_home, { scroll: false }); router.push(RouterHome.main_home, { scroll: false });
} else { } else {
ComponentGlobal_NotifikasiGagal(create.message); ComponentGlobal_NotifikasiGagal(create.message);
setLoading(false); setLoading(false);
} }
}
}
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }

View File

@@ -11,7 +11,7 @@ export function UiMap_SplashView() {
useShallowEffect(() => { useShallowEffect(() => {
setTimeout(() => { setTimeout(() => {
router.replace(RouterMap.main_view, { scroll: false }), 1000; router.replace(RouterMap.main_view, { scroll: false }), 500;
}); });
}, []); }, []);
return ( return (

View File

@@ -24,7 +24,7 @@ export default function Vote_Splash() {
setTabsStatus("Publish"); setTabsStatus("Publish");
setTabsRiwayat("Semua"); setTabsRiwayat("Semua");
router.replace(RouterVote.beranda); router.replace(RouterVote.beranda);
}, 1000); }, 500);
}, []); }, []);
return ( return (