fix tampilan html view

This commit is contained in:
2025-04-29 17:25:16 +08:00
parent 480fea026c
commit 0e7c491031
10 changed files with 96 additions and 30 deletions

View File

@@ -13,7 +13,7 @@ export async function GET(
const { name } = params; const { name } = params;
const { searchParams } = new URL(request.url); const { searchParams } = new URL(request.url);
const page = searchParams.get("page"); const page = searchParams.get("page");
const takeData = 6; const takeData = 10;
const skipData = Number(page) * takeData - takeData; const skipData = Number(page) * takeData - takeData;
const userLoginId = await funGetUserIdByToken(); const userLoginId = await funGetUserIdByToken();
@@ -51,7 +51,7 @@ export async function GET(
take: takeData, take: takeData,
skip: skipData, skip: skipData,
orderBy: { orderBy: {
tanggal: "asc", updatedAt: "desc",
}, },
where: { where: {
active: true, active: true,

View File

@@ -4,7 +4,7 @@ import React from "react";
/** /**
* ComponentGlobal_CardStyles * ComponentGlobal_CardStyles
* *
* A React component that renders a customizable card element. * A React component that renders a customizable card element.
* *
* Props: * Props:
@@ -24,6 +24,7 @@ export function ComponentGlobal_CardStyles({
height, height,
color, color,
onClickHandler, onClickHandler,
style,
}: { }: {
children: React.ReactNode; children: React.ReactNode;
backgroundColor?: string; backgroundColor?: string;
@@ -32,11 +33,13 @@ export function ComponentGlobal_CardStyles({
height?: string | number; height?: string | number;
color?: string; color?: string;
onClickHandler?: React.MouseEventHandler<HTMLDivElement>; onClickHandler?: React.MouseEventHandler<HTMLDivElement>;
style?: React.CSSProperties;
}) { }) {
return ( return (
<> <>
<Card <Card
style={{ style={{
...style,
backgroundColor: backgroundColor backgroundColor: backgroundColor
? backgroundColor ? backgroundColor
: AccentColor.darkblue, : AccentColor.darkblue,

View File

@@ -0,0 +1,4 @@
.sticker-content .chat-content img {
max-width: 70px;
max-height: 70px;
}

View File

@@ -1,18 +1,21 @@
export function Comp_V3_SetHtmlWithSticker({ export function Comp_V3_SetHtmlWithSticker({
props, props,
className, className,
color, color,
style,
}: { }: {
props: string; props: string;
className: string; className?: string;
color?: string; color?: string;
style?: React.CSSProperties;
}) { }) {
return ( return (
<> <>
<div className={className} style={{ <div
color: color ? color : "white" className={className}
}} dangerouslySetInnerHTML={{ __html: props }} /> style={{ ...style, color: color ? color : "white" }}
dangerouslySetInnerHTML={{ __html: props }}
/>
</> </>
); );
} }

View File

@@ -1,23 +1,30 @@
import { MainColor } from "../../color"; import { MainColor } from "../../color";
export const Comp_DangerouslySetInnerHTML= ({ export const Comp_DangerouslySetInnerHTML = ({
props, props,
color, color,
style,
}: { }: {
props: string | undefined; props: string | undefined;
color?: string; color?: string;
}) => { style?: React.CSSProperties;
}) => {
const baseStyle: React.CSSProperties = {
color: color ?? MainColor.white,
};
return ( return (
<> <>
<div <div
style={{ style={{
color: color ? color : MainColor.white, ...baseStyle,
...style,
// wordBreak: "break-word",
}} }}
// className="chat-content"
dangerouslySetInnerHTML={{ dangerouslySetInnerHTML={{
__html: props ?? "", __html: props ?? "",
}} }}
/> />
</> </>
); );
} };

View File

@@ -5,7 +5,7 @@ import {
ComponentGlobal_CardLoadingOverlay, ComponentGlobal_CardLoadingOverlay,
ComponentGlobal_CardStyles, ComponentGlobal_CardStyles,
} from "@/app_modules/_global/component"; } from "@/app_modules/_global/component";
import { Group, Stack, Text, Title } from "@mantine/core"; import { Box, Group, Stack, Text, Title } from "@mantine/core";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { useState } from "react"; import { useState } from "react";
import { MODEL_EVENT } from "../_lib/interface"; import { MODEL_EVENT } from "../_lib/interface";
@@ -31,6 +31,11 @@ export default function ComponentEvent_BoxListStatus({
setVisible(true); setVisible(true);
router.push(path + data.id); router.push(path + data.id);
}} }}
// style={{
// maxHeight: 200,
// overflow: "hidden",
// position: "relative",
// }}
> >
<Stack> <Stack>
<Group w={"100%"} position="apart" grow> <Group w={"100%"} position="apart" grow>
@@ -43,17 +48,52 @@ export default function ComponentEvent_BoxListStatus({
}).format(new Date(data.tanggal))} }).format(new Date(data.tanggal))}
</Text> </Text>
</Group> </Group>
<Text fz={"sm"} lineClamp={2}>
<Text c={MainColor.white} fz={"sm"} lineClamp={4}> <Comp_DangerouslySetInnerHTML
<Comp_DangerouslySetInnerHTML props={data.deskripsi} /> props={data.deskripsi}
style={{ height: 50 }}
/>
</Text> </Text>
</Stack> </Stack>
{visible && eventId !== "" ? ( {visible && eventId !== "" && <ComponentGlobal_CardLoadingOverlay />}
<ComponentGlobal_CardLoadingOverlay />
) : (
""
)}
</ComponentGlobal_CardStyles> </ComponentGlobal_CardStyles>
{/* <Box
pos="relative"
mah={200}
mx="auto"
p="md"
bg="#002860"
style={{
overflow: "hidden",
borderRadius: 12,
border: "1px solid #1346a1",
}}
>
<div
style={{
color: "white",
wordBreak: "break-word",
}}
dangerouslySetInnerHTML={{
__html: data.deskripsi.trim(),
}}
/>
<Box
pos="absolute"
bottom={0}
left={0}
right={0}
h={50}
style={{
background:
"linear-gradient(to bottom, rgba(0,0,0,0) 0%, #002860 100%)", // warna fade cocokkan dengan background box
pointerEvents: "none",
}}
/>
</Box> */}
</> </>
); );
} }

View File

@@ -17,7 +17,9 @@ export function ComponentEvent_CardBeranda({ data }: { data: any }) {
return ( return (
<> <>
<ComponentGlobal_CardStyles marginBottom={"15px"}> <ComponentGlobal_CardStyles
marginBottom={"15px"}
>
<Stack> <Stack>
<ComponentGlobal_AvatarAndUsername <ComponentGlobal_AvatarAndUsername
profile={data?.Author?.Profile as any} profile={data?.Author?.Profile as any}
@@ -36,15 +38,13 @@ export function ComponentEvent_CardBeranda({ data }: { data: any }) {
<Title c={MainColor.white} order={5} lineClamp={1}> <Title c={MainColor.white} order={5} lineClamp={1}>
{data.title} {data.title}
</Title> </Title>
{/* <Text align="right" fz={"sm"} lineClamp={1}>
{new Intl.DateTimeFormat("id-ID", {
dateStyle: "medium",
}).format(data?.tanggal)}
</Text> */}
</Group> </Group>
<Text c={MainColor.white} fz={"sm"} lineClamp={4}> <Text c={MainColor.white} fz={"sm"} lineClamp={4}>
<Comp_DangerouslySetInnerHTML props={data.deskripsi} /> <Comp_DangerouslySetInnerHTML
props={data.deskripsi}
style={{ height: 50 }}
/>
</Text> </Text>
</Stack> </Stack>

View File

@@ -44,7 +44,10 @@ export function ComponentEvent_CardRiwayat({ data }: { data: MODEL_EVENT }) {
</Group> </Group>
<Text fz={"sm"} lineClamp={4}> <Text fz={"sm"} lineClamp={4}>
<Comp_DangerouslySetInnerHTML props={data.deskripsi}/> <Comp_DangerouslySetInnerHTML
props={data.deskripsi}
style={{ height: 50 }}
/>
</Text> </Text>
</Stack> </Stack>

View File

@@ -68,6 +68,9 @@ export default function ComponentForum_ForumkuMainCardView({
<Comp_V3_SetHtmlWithSticker <Comp_V3_SetHtmlWithSticker
props={data?.diskusi} props={data?.diskusi}
className="chat-content" className="chat-content"
style={{
height: 100,
}}
/> />
</Text> </Text>
</Box> </Box>

View File

@@ -67,6 +67,9 @@ export default function ComponentForum_BerandaCardView({
<Comp_V3_SetHtmlWithSticker <Comp_V3_SetHtmlWithSticker
props={data?.diskusi} props={data?.diskusi}
className="chat-content" className="chat-content"
style={{
height: 100,
}}
/> />
</Text> </Text>
</Box> </Box>