From c530639470217dd6029f613bdd97187d330f264e Mon Sep 17 00:00:00 2001 From: Sabda Yagra Date: Thu, 26 Mar 2026 10:55:09 +0700 Subject: [PATCH] feat: add role in create account --- components/form/sign-up.tsx | 10 ++++----- components/form/user/user-form.tsx | 27 +++++++++++++++++++++++- components/main/content/video-detail.tsx | 13 +++++++----- lib/menus.ts | 2 +- 4 files changed, 40 insertions(+), 12 deletions(-) diff --git a/components/form/sign-up.tsx b/components/form/sign-up.tsx index 67d0e86..2c57392 100644 --- a/components/form/sign-up.tsx +++ b/components/form/sign-up.tsx @@ -551,7 +551,7 @@ export default function SignUp() { {/* Radio Buttons */} setRole(val)} >
@@ -562,10 +562,10 @@ export default function SignUp() {
-
+ {/*
-
+
*/}
@@ -592,13 +592,13 @@ export default function SignUp() { /> {/* Email */} - {/* setEmail(e.target.value)} - /> */} + /> {/* Password */}
diff --git a/components/form/user/user-form.tsx b/components/form/user/user-form.tsx index 8c1e88d..e6ec094 100644 --- a/components/form/user/user-form.tsx +++ b/components/form/user/user-form.tsx @@ -46,6 +46,7 @@ const createUserSchema = z.object({ .min(1, { message: "Phone Number wajib diisi" }), userLevelId: z.number({ invalid_type_error: "User Level harus dipilih" }), username: z.string().trim().min(1, { message: "Username wajib diisi" }), + role: z.enum(["approver", "contributor"]), }); const editUserSchema = z.object({ @@ -114,6 +115,7 @@ export default function UserForm({ phoneNumber: "", userLevelId: 0, username: "", + role: "contributor", }, }); @@ -192,7 +194,7 @@ export default function UserForm({ password: data.password || "", phoneNumber: data.phoneNumber, userLevelId: data.userLevelId, - userRoleId: 3, + userRoleId: 3, username: data.username, }; @@ -419,6 +421,29 @@ export default function UserForm({

*/} + {/* Role */} +
+ + ( + + )} + /> +
+ {/* User Level */}
diff --git a/components/main/content/video-detail.tsx b/components/main/content/video-detail.tsx index 19ead0c..1f5e8f7 100644 --- a/components/main/content/video-detail.tsx +++ b/components/main/content/video-detail.tsx @@ -93,9 +93,11 @@ export default function VideoDetail({ id }: { id: number }) { downloadCount: file.download_count, createdAt: file.created_at, updatedAt: file.updated_at, - thumbnailFileUrl: - file.file_thumbnail || articleData.thumbnailUrl, - ...file, + // thumbnailFileUrl: + // file.file_thumbnail || articleData.thumbnailUrl, + // ...file, + // })) || [], + thumbnailFileUrl: articleData.thumbnailUrl || "/notfound.png", })) || [], ...articleData, }; @@ -167,8 +169,8 @@ export default function VideoDetail({ id }: { id: number }) { > {file?.fileName +
))}
diff --git a/lib/menus.ts b/lib/menus.ts index cbc782c..36f718d 100644 --- a/lib/menus.ts +++ b/lib/menus.ts @@ -57,7 +57,7 @@ export function getMenuList(pathname: string, t: any): Group[] { }, ], }, - ...(Number(userRoleId) === 3 + ...(Number(userRoleId) === 3 || Number(userRoleId) === 5 ? [ { groupLabel: "",