diff --git a/components/form/article/edit-article-form.tsx b/components/form/article/edit-article-form.tsx index 0b9316a..7e98aa7 100644 --- a/components/form/article/edit-article-form.tsx +++ b/components/form/article/edit-article-form.tsx @@ -796,16 +796,16 @@ export default function EditArticleForm(props: { isDetail: boolean }) { )) ) : ( <> -
+
main
-
+
{detailfiles?.map((file: any, index: number) => ( ; const { @@ -139,10 +140,10 @@ export default function FormMasterUserEdit() { setValue("fullname", profile?.fullname); setValue("username", profile?.username); setValue("email", profile?.email); - setValue("address", profile?.address); - setValue("identityNumber", profile?.identityNumber); - setValue("genderType", profile?.genderType); - setValue("phoneNumber", profile?.phoneNumber); + setValue("address", profile?.address || ""); + setValue("identityNumber", profile?.identityNumber || ""); + setValue("genderType", profile?.genderType || ""); + setValue("phoneNumber", profile?.phoneNumber || ""); if (findLevel) { setValue("userLevelType", findLevel); } @@ -153,7 +154,12 @@ export default function FormMasterUserEdit() { }; const fetchUserLevel = async () => { - const res = await getAllUserLevels(); + const request = { + limit: 1000, + page: 1, + }; + + const res = await getAllUserLevels(request); if (res?.data?.data) { return setupParent(res?.data?.data, "level"); } diff --git a/components/form/form-master-user.tsx b/components/form/form-master-user.tsx index bf76031..e8bc670 100644 --- a/components/form/form-master-user.tsx +++ b/components/form/form-master-user.tsx @@ -52,10 +52,10 @@ const masterUserSchema = z.object({ }), passwordValidate: z.string().min(1, { message: "Required" }), email: z.string().min(1, { message: "Required" }), - identityNumber: z.string().min(1, { message: "Required" }), - genderType: z.string().min(1, { message: "Required" }), - phoneNumber: z.string().min(1, { message: "Required" }), - address: z.string().min(1, { message: "Required" }), + identityNumber: z.string().optional(), + genderType: z.string().optional(), + phoneNumber: z.string().optional(), + address: z.string().optional(), userLevelType: userSchema, userRoleType: userSchema, }); @@ -237,7 +237,11 @@ export default function FormMasterUser() { return (
-
+ ({}); + + const handleImageLoad = (e: any, index: number) => { + const { naturalWidth, naturalHeight } = e.target; + const isPortrait = naturalHeight > naturalWidth; + + setPortraitMap((prev: any) => ({ + ...prev, + [index]: isPortrait, + })); + }; + return (
-
+
{hotNews?.length > 0 ? ( {hotNews?.map((newsItem: any, index: number) => ( - + - headernews +
+ headernews handleImageLoad(e, index)} + src={ + newsItem?.thumbnailUrl === "" + ? "/no-image.jpg" + : newsItem?.thumbnailUrl + } + className={`!object-cover !rounded-none ${ + portraitMap[index] + ? "!w-auto object-cover mx-auto" + : "!w-[90vw]" + } !h-[200px] md:!h-[400px]`} + /> - -
+
+
+ + +
@@ -141,7 +166,7 @@ export default function HeaderNews() { {convertDateFormat(newsItem.createdAt)} WIB

- + {newsItem.viewCount === null ? 0 : newsItem.viewCount}

@@ -152,13 +177,12 @@ export default function HeaderNews() { ) : ( -
+
)}

- {/* {t("berita")} */} Hot Topik

@@ -257,19 +281,28 @@ export default function HeaderNews() { - headernews +
+ headernews handleImageLoad(e, index)} + src={ + newsItem?.thumbnailUrl === "" + ? "/no-image.jpg" + : newsItem?.thumbnailUrl + } + className={`!object-cover !rounded-none ${ + portraitMap[index] + ? "!w-auto object-cover mx-auto" + : "!w-[90vw]" + } !h-[500px]`} + /> + +
+
@@ -304,8 +337,6 @@ export default function HeaderNews() { )}
- {/* */} - {selectedTab === "media" ? (
diff --git a/components/page/detail-news.tsx b/components/page/detail-news.tsx index 303b7bb..9b98ec8 100644 --- a/components/page/detail-news.tsx +++ b/components/page/detail-news.tsx @@ -167,13 +167,13 @@ export default function DetailNews(props: { data: any; listArticle: any }) { ) : ( data?.files?.length > 0 && ( Main Image ) )}