Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
ok
  • Loading branch information
crlnravel committed Jan 1, 2025
2 parents cfacef1 + 56fe692 commit 71a6f72
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 20 deletions.
1 change: 1 addition & 0 deletions src/hooks/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ export const useUserData:
electric_bill_document_url: userData.electric_bill_document_url,
residence_photo_url: userData.residence_photo_url,
affiliation_code: userData.affiliation_code,
isVerified: userData.is_verified,
} as User;
}
};
2 changes: 2 additions & 0 deletions src/hooks/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export interface GetUserDataResponse extends Response {
electric_bill_document_url: string;
residence_photo_url: string;
affiliation_code: string;
is_verified: boolean;
};
}

Expand Down Expand Up @@ -68,4 +69,5 @@ export interface User {
electric_bill_document_url: string;
residence_photo_url: string;
affiliation_code: string;
isVerified: boolean;
}
4 changes: 2 additions & 2 deletions src/hooks/openReg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export const openRegSchema = z.object({
return files?.size <= MAX_FILE_SIZE;
}, `Max image size is 5MB.`)
.refine(
(files) => ACCEPTED_IMAGE_TYPES.includes(files?.type),
"Only .jpg, .jpeg, .png and .webp formats are supported."
(files) => files?.type === "application/pdf",
"Only .PDF formats are supported."
),
motivationLetter: z
.any()
Expand Down
1 change: 1 addition & 0 deletions src/hooks/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export const getUserData = async () => {
electric_bill_document_url: userData.electric_bill_document_url,
residence_photo_url: userData.residence_photo_url,
affiliation_code: userData.affiliation_code,
isVerified: userData.is_verified,
} as User;
}
};
36 changes: 21 additions & 15 deletions src/modules/ProfilePageModule/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,31 @@ export const ProfilePageModule = ({ user }: { user: User }) => {
<main className="min-h-screen flex items-center justify-center">
<StarryBackground />
<section className="w-[80vw] p-6 lg:p-10 flex flex-col gap-6 bg-[#f8ebf30c] rounded-xl shadow-[4px_4px_12px_0px_rgba(254,245,255,0.40),-4px_-4px_12px_0px_rgba(254,245,255,0.40)] backdrop-blur-md my-40">
<Avatar className="w-40 h-40 mb-6 max-md:mx-auto">
<AvatarImage src="https://upload.wikimedia.org/wikipedia/commons/7/7c/Profile_avatar_placeholder_large.png" alt="profile" />
<AvatarFallback>
{user.fullname.charAt(0).toUpperCase()}
</AvatarFallback>
</Avatar>
<div className="flex md:flex-row flex-col gap-6 items-center">
<Avatar className="w-40 h-40 mb-6 max-md:mx-auto">
<AvatarImage
src="https://upload.wikimedia.org/wikipedia/commons/7/7c/Profile_avatar_placeholder_large.png"
alt="profile"
/>
<AvatarFallback>
{user.fullname.charAt(0).toUpperCase()}
</AvatarFallback>
</Avatar>
<h1 className="md:text-2xl text-base max-md:text-center font-semibold">
{user.fullname} ({user.nickname})
</h1>
</div>
<div className="grid md:grid-cols-2">
<div className="flex flex-col gap-6">
<div>
<h3 className="text-lg font-semibold">Nama Lengkap</h3>
<p className="md:text-base text-sm">{user.fullname}</p>
<h3 className="text-lg font-semibold">Status</h3>
<p className="md:text-base text-sm">
{user.isVerified ? "Peserta BETIS 2025" : "Belum diterima"}
</p>
</div>
<div>
<h3 className="text-lg font-semibold">Nama Panggilan</h3>
<p className="md:text-base text-sm">{user.nickname}</p>
<h3 className="text-lg font-semibold">Metode Belajar</h3>
<p className="md:text-base text-sm">{user.study_method}</p>
</div>
<div>
<h3 className="text-lg font-semibold">Email</h3>
Expand All @@ -47,7 +57,7 @@ export const ProfilePageModule = ({ user }: { user: User }) => {
)}
</div>
{isRegisterPeserta && (
<div className="flex flex-col gap-6">
<div className="flex flex-col gap-6 max-md:mt-6">
<div>
<h3 className="text-lg font-semibold">Nama Sekolah</h3>
<p className="md:text-base text-sm">{user.school_name}</p>
Expand All @@ -56,10 +66,6 @@ export const ProfilePageModule = ({ user }: { user: User }) => {
<h3 className="text-lg font-semibold">Kelas</h3>
<p className="md:text-base text-sm">{user.grade}</p>
</div>
<div>
<h3 className="text-lg font-semibold">Metode Belajar</h3>
<p className="md:text-base text-sm">{user.study_method}</p>
</div>
<div>
<h3 className="text-lg font-semibold">Wakil</h3>
<p className="md:text-base text-sm">
Expand Down
33 changes: 30 additions & 3 deletions src/modules/RegistrationModule/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -723,8 +723,31 @@ const RegistrationModule = () => {
isLoading={isLoading}
type="submit"
onClick={() => {
if (!form.formState.isValid) {
toast.warning("Please fill in all required fields");
if (
form.getValues().fullName === "" ||
form.getValues().username === "" ||
form.getValues().phoneNumber === "" ||
form.getValues().address === "" ||
form.getValues().identityCard === undefined ||
form.getValues().studyMethood === "" ||
form.getValues().parentName === "" ||
form.getValues().relationWithParent === "" ||
form.getValues().parentPhoneNumber === "" ||
form.getValues().highschoolName === "" ||
form.getValues().highschoolClass === "" ||
form.getValues().meanScore === "" ||
form.getValues().studentReport === undefined ||
form.getValues().motivationLetter ===
undefined ||
form.getValues().commitmentLetter ===
undefined ||
form.getValues().proofOfFollowing === undefined ||
form.getValues().proofOfTwibbon === undefined ||
form.getValues().proofOfSg === undefined
) {
toast.warning(
"Please fill in all required fields"
);
}
}}
className="rounded-[20px]"
Expand Down Expand Up @@ -793,7 +816,11 @@ const RegistrationModule = () => {
/>

<Image
src={isHovered || page === 1 ? getAsset("/MascotDewasa.png") : getAsset("/MascotLesu.png")}
src={
isHovered || page === 1
? getAsset("/MascotDewasa.png")
: getAsset("/MascotLesu.png")
}
width={isHovered || page === 1 ? 224 : 216}
height={isHovered || page === 1 ? 590 : 582}
alt="Mascot"
Expand Down

0 comments on commit 71a6f72

Please sign in to comment.