Fix: Db Profile
Deskripsi: - Menghapus field imagesId dan imagesBackgroundId - Menhapus table backgroundImage - Menghapus component avatar dan header card yang lama ## No Issue
This commit is contained in:
@@ -1,155 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
|
||||
import {
|
||||
Stack,
|
||||
Grid,
|
||||
Avatar,
|
||||
Divider,
|
||||
Text,
|
||||
Group,
|
||||
Badge,
|
||||
Loader,
|
||||
} from "@mantine/core";
|
||||
import { useRouter } from "next/navigation";
|
||||
import moment from "moment";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||
import { RouterForum } from "@/app/lib/router_hipmi/router_forum";
|
||||
import {
|
||||
IconCircleFilled,
|
||||
IconDots,
|
||||
IconEdit,
|
||||
IconFlag3,
|
||||
IconMessageCircle,
|
||||
IconTrash,
|
||||
} from "@tabler/icons-react";
|
||||
import { IconCircle } from "@tabler/icons-react";
|
||||
import { IoIosMore } from "react-icons/io";
|
||||
import { useDisclosure } from "@mantine/hooks";
|
||||
import { useState } from "react";
|
||||
import ComponentForum_PostingButtonMore from "../more_button/posting_button_more";
|
||||
import ComponentGlobal_V2_LoadingPage from "@/app_modules/_global/loading_page_v2";
|
||||
import { data } from "autoprefixer";
|
||||
|
||||
export default function ComponentForum_PostingAuthorNameOnHeader({
|
||||
authorId,
|
||||
postingId,
|
||||
imagesId,
|
||||
authorName,
|
||||
tglPublish,
|
||||
isPembatas,
|
||||
isMoreButton,
|
||||
statusId,
|
||||
userLoginId,
|
||||
setData,
|
||||
}: {
|
||||
authorId?: string;
|
||||
postingId?: string;
|
||||
imagesId?: string;
|
||||
authorName?: string;
|
||||
tglPublish?: Date;
|
||||
isPembatas?: boolean;
|
||||
isMoreButton?: boolean;
|
||||
statusId?: string;
|
||||
userLoginId: string;
|
||||
setData?:any
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack spacing={"xs"}>
|
||||
<Grid>
|
||||
<Grid.Col
|
||||
span={"content"}
|
||||
onClick={() => {
|
||||
if (authorId) {
|
||||
setLoading(true);
|
||||
router.push(RouterForum.forumku + authorId);
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiPeringatan("Id tidak ditemukan");
|
||||
}
|
||||
}}
|
||||
>
|
||||
{loading ? (
|
||||
<Loader color="gray" variant="dots" />
|
||||
) : (
|
||||
<Avatar
|
||||
size={40}
|
||||
sx={{ borderStyle: "solid", borderWidth: "0.5px" }}
|
||||
radius={"xl"}
|
||||
bg={"gray.1"}
|
||||
src={
|
||||
imagesId
|
||||
? RouterProfile.api_foto_profile + imagesId
|
||||
: "/aset/global/avatar.png"
|
||||
}
|
||||
/>
|
||||
)}
|
||||
</Grid.Col>
|
||||
|
||||
<Grid.Col span={"auto"}>
|
||||
<Stack justify="center" h={"100%"} spacing={0}>
|
||||
<Grid>
|
||||
<Grid.Col span={"auto"}>
|
||||
<Text lineClamp={1} fz={"sm"} fw={"bold"}>
|
||||
{authorName ? authorName : "Nama author "}
|
||||
</Text>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={"content"}></Grid.Col>
|
||||
</Grid>
|
||||
<Badge
|
||||
w={70}
|
||||
variant="light"
|
||||
color={(statusId as any) === 1 ? "green" : "red"}
|
||||
>
|
||||
<Text fz={10}>
|
||||
{(statusId as any) === 1 ? "Open" : "Close"}
|
||||
</Text>
|
||||
</Badge>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
|
||||
<Grid.Col span={"content"}>
|
||||
<Group position="center" spacing={"xs"}>
|
||||
<Group spacing={3}>
|
||||
<Text c={"gray"} fz={"sm"}>
|
||||
{tglPublish
|
||||
? tglPublish.toLocaleDateString(["id-ID"], {
|
||||
day: "numeric",
|
||||
month: "short",
|
||||
})
|
||||
: new Date().toLocaleDateString(["id-ID"], {
|
||||
day: "numeric",
|
||||
month: "short",
|
||||
})}
|
||||
<IconCircle
|
||||
size={5}
|
||||
color="gray"
|
||||
style={{ marginLeft: "5px" }}
|
||||
/>
|
||||
</Text>
|
||||
</Group>
|
||||
|
||||
{isMoreButton ? (
|
||||
<Group position="right">
|
||||
<ComponentForum_PostingButtonMore
|
||||
authorId={authorId}
|
||||
postingId={postingId as any}
|
||||
statusId={statusId}
|
||||
userLoginId={userLoginId}
|
||||
setData={setData}
|
||||
/>
|
||||
</Group>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</Group>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
{isPembatas ? <Divider /> : ""}
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import { RouterForum } from "@/app/lib/router_hipmi/router_forum";
|
||||
import { Stack, Card, Group, ActionIcon, Divider, Text } from "@mantine/core";
|
||||
import { IconMessageCircle, IconMessageCircleOff } from "@tabler/icons-react";
|
||||
|
||||
import ComponentForum_PostingAuthorNameOnHeader from "./header/posting_author_header_name";
|
||||
import { MODEL_FORUM_POSTING } from "../model/interface";
|
||||
import { useState } from "react";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useAtom } from "jotai";
|
||||
import { gs_forum_total_komentar } from "../global_state";
|
||||
import { forum_countOneTotalKomentarById } from "../fun/count/count_one_total_komentar_by_id";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||
import { IconMessageCircleX } from "@tabler/icons-react";
|
||||
|
||||
export default function ComponentForum_MainCardView({
|
||||
data,
|
||||
setData,
|
||||
setLoadingKomen,
|
||||
setLoadingDetail,
|
||||
userLoginId,
|
||||
}: {
|
||||
data: MODEL_FORUM_POSTING[];
|
||||
setData: any,
|
||||
setLoadingKomen: any;
|
||||
setLoadingDetail: any;
|
||||
userLoginId: any;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
return (
|
||||
<>
|
||||
<Stack spacing={"xl"}>
|
||||
{data.map((e, i) => (
|
||||
<Card key={i}>
|
||||
<Card.Section>
|
||||
{/* <pre>{JSON.stringify(e.Author.id, null, 2)}</pre>
|
||||
<pre>{JSON.stringify(userLoginId, null, 2)}</pre> */}
|
||||
|
||||
<ComponentForum_PostingAuthorNameOnHeader
|
||||
authorName={e?.Author?.Profile?.name}
|
||||
imagesId={e?.Author?.Profile?.imagesId}
|
||||
tglPublish={e?.createdAt}
|
||||
isMoreButton={true}
|
||||
authorId={e?.Author?.id}
|
||||
postingId={e?.id}
|
||||
statusId={e?.ForumMaster_StatusPosting?.id}
|
||||
userLoginId={userLoginId}
|
||||
setData={setData}
|
||||
/>
|
||||
</Card.Section>
|
||||
<Card.Section
|
||||
sx={{ zIndex: 0 }}
|
||||
p={"lg"}
|
||||
onClick={() => {
|
||||
// console.log("halaman forum");
|
||||
setLoadingDetail(true);
|
||||
router.push(RouterForum.main_detail + e.id);
|
||||
}}
|
||||
>
|
||||
<Text fz={"sm"} lineClamp={4}>
|
||||
<div dangerouslySetInnerHTML={{ __html: e.diskusi }} />
|
||||
</Text>
|
||||
</Card.Section>
|
||||
<Card.Section>
|
||||
<Stack>
|
||||
<Group spacing={"xs"} px={"sm"}>
|
||||
<ActionIcon
|
||||
// loading={loadingKomen ? true : false}
|
||||
variant="transparent"
|
||||
sx={{ zIndex: 1 }}
|
||||
onClick={() => {
|
||||
(e?.ForumMaster_StatusPosting.id as any) === 1
|
||||
? (router.push(RouterForum.komentar + e?.id),
|
||||
setLoadingKomen(true))
|
||||
: router.push(RouterForum.main_detail + e?.id);
|
||||
}}
|
||||
>
|
||||
{(e?.ForumMaster_StatusPosting?.id as any) === 1 ? (
|
||||
<IconMessageCircle color="gray" size={25} />
|
||||
) : (
|
||||
<IconMessageCircleX color="gray" size={25} />
|
||||
)}
|
||||
</ActionIcon>
|
||||
|
||||
{/* <TotalKomentar postingId={e?.id} /> */}
|
||||
|
||||
<Text c={"gray"}>{e?._count}</Text>
|
||||
</Group>
|
||||
<Divider />
|
||||
</Stack>
|
||||
</Card.Section>
|
||||
</Card>
|
||||
))}
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,11 +1,8 @@
|
||||
"use client"
|
||||
|
||||
import ComponentGlobal_V2_LoadingPage from "@/app_modules/_global/loading_page_v2";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import ComponentForum_MainCardView from "../component/main_card_view";
|
||||
import { MODEL_FORUM_POSTING } from "../model/interface";
|
||||
import ComponentForum_ForumkuMainCardView from "../component/forumku_component/forumku_view";
|
||||
|
||||
export default function ComponentForum_PostinganPribadi({
|
||||
dataPosting,
|
||||
|
||||
@@ -7,8 +7,6 @@ import LayoutForum_Create from "./create/layout";
|
||||
import LayoutForum_Forumku from "./forumku/layout";
|
||||
import Forum_MainDetail from "./detail/main_detail";
|
||||
import LayoutForum_Detail from "./detail/layout";
|
||||
import Forum_Komentar from "./komentar";
|
||||
import LayoutForum_Komentar from "./komentar/layout";
|
||||
import Forum_EditPosting from "./edit/posting";
|
||||
import LayoutForum_EditPosting from "./edit/posting/layout";
|
||||
import Forum_ReportPosting from "./report/posting";
|
||||
@@ -32,8 +30,6 @@ export {
|
||||
LayoutForum_Forumku,
|
||||
Forum_MainDetail as Forum_Detail,
|
||||
LayoutForum_Detail,
|
||||
Forum_Komentar,
|
||||
LayoutForum_Komentar,
|
||||
Forum_EditPosting,
|
||||
LayoutForum_EditPosting,
|
||||
Forum_ReportPosting,
|
||||
|
||||
@@ -1,136 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import { RouterForum } from "@/app/lib/router_hipmi/router_forum";
|
||||
import {
|
||||
Button,
|
||||
Card,
|
||||
Group,
|
||||
Paper,
|
||||
Stack,
|
||||
Text
|
||||
} from "@mantine/core";
|
||||
import ComponentForum_PostingAuthorNameOnHeader from "../component/header/posting_author_header_name";
|
||||
|
||||
import ComponentGlobal_InputCountDown from "@/app_modules/_global/component/input_countdown";
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||
import dynamic from "next/dynamic";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import "react-quill/dist/quill.bubble.css";
|
||||
import { forum_funCreateKomentar } from "../fun/create/fun_create_komentar";
|
||||
import { MODEL_FORUM_POSTING } from "../model/interface";
|
||||
const ReactQuill = dynamic(
|
||||
() => {
|
||||
return import("react-quill");
|
||||
},
|
||||
{ ssr: false }
|
||||
);
|
||||
|
||||
export default function Forum_Komentar({
|
||||
dataPosting,
|
||||
userLoginId,
|
||||
}: {
|
||||
dataPosting: MODEL_FORUM_POSTING;
|
||||
userLoginId: any;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Stack px={"sm"}>
|
||||
<Card>
|
||||
<Card.Section>
|
||||
{/* <pre>{JSON.stringify(dataPosting, null, 2)}</pre> */}
|
||||
<ComponentForum_PostingAuthorNameOnHeader
|
||||
authorId={dataPosting?.Author?.id}
|
||||
authorName={dataPosting?.Author?.Profile?.name}
|
||||
imagesId={dataPosting?.Author?.Profile?.imagesId}
|
||||
postingId={dataPosting?.id}
|
||||
tglPublish={dataPosting?.createdAt}
|
||||
statusId={dataPosting?.ForumMaster_StatusPosting?.id}
|
||||
userLoginId={userLoginId}
|
||||
/>
|
||||
</Card.Section>
|
||||
<Card.Section sx={{ zIndex: 0 }} p={"sm"}>
|
||||
<Stack spacing={"xs"}>
|
||||
<Text fz={"sm"}>
|
||||
{dataPosting?.diskusi ? (
|
||||
<div
|
||||
dangerouslySetInnerHTML={{ __html: dataPosting?.diskusi }}
|
||||
/>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</Text>
|
||||
</Stack>
|
||||
</Card.Section>
|
||||
</Card>
|
||||
{dataPosting?.ForumMaster_StatusPosting?.id === "1" ? <CreateKomentar postingId={dataPosting?.id} /> : "" }
|
||||
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function CreateKomentar({ postingId }: { postingId: string }) {
|
||||
const router = useRouter();
|
||||
const [value, setValue] = useState("");
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
async function onComment() {
|
||||
if (value.length > 500) {
|
||||
return null;
|
||||
}
|
||||
|
||||
await forum_funCreateKomentar(postingId, value).then((res) => {
|
||||
if (res.status === 201) {
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
router.replace(RouterForum.main_detail + postingId, { scroll: false });
|
||||
setLoading(true);
|
||||
router.refresh();
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<Paper withBorder shadow="lg">
|
||||
<ReactQuill
|
||||
theme="bubble"
|
||||
placeholder="Ketik komentar anda?"
|
||||
// style={{ height: 150 }}
|
||||
onChange={(val) => {
|
||||
setValue(val);
|
||||
}}
|
||||
/>
|
||||
</Paper>
|
||||
<Group position="right">
|
||||
<ComponentGlobal_InputCountDown
|
||||
maxInput={500}
|
||||
lengthInput={value.length}
|
||||
/>
|
||||
</Group>
|
||||
<Group position="right">
|
||||
<Button
|
||||
disabled={
|
||||
value === "" || value === "<p><br></p>" || value.length > 500
|
||||
? true
|
||||
: false
|
||||
}
|
||||
loaderPosition="center"
|
||||
loading={loading ? true : false}
|
||||
radius={"xl"}
|
||||
style={{
|
||||
transition: "0.5s",
|
||||
}}
|
||||
onClick={() => onComment()}
|
||||
>
|
||||
Balas
|
||||
</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import {
|
||||
ActionIcon,
|
||||
AppShell,
|
||||
Button,
|
||||
Group,
|
||||
Header,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { IconChevronLeft } from "@tabler/icons-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import React from "react";
|
||||
import ComponentForum_HeaderTamplate from "../component/header/header_tamplate";
|
||||
import AppComponentGlobal_LayoutTamplate from "@/app_modules/_global/component_layout_tamplate";
|
||||
|
||||
export default function LayoutForum_Komentar({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
return (
|
||||
<>
|
||||
<AppComponentGlobal_LayoutTamplate
|
||||
header={
|
||||
<Header height={50} sx={{ borderStyle: "none" }}>
|
||||
<Group h={50} px={"md"}>
|
||||
<ActionIcon
|
||||
variant="transparent"
|
||||
onClick={() => {
|
||||
router.back();
|
||||
}}
|
||||
>
|
||||
<IconChevronLeft />
|
||||
</ActionIcon>
|
||||
<Title order={5}>Komentar</Title>
|
||||
</Group>
|
||||
</Header>
|
||||
}
|
||||
// header={<ComponentForum_HeaderTamplate title="Komentar" />}
|
||||
>
|
||||
{children}
|
||||
</AppComponentGlobal_LayoutTamplate>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -2,16 +2,6 @@
|
||||
|
||||
import { RouterForum } from "@/app/lib/router_hipmi/router_forum";
|
||||
import UIGlobal_SplashScreen from "@/app_modules/_global/ui/ui_splash";
|
||||
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
||||
import {
|
||||
Avatar,
|
||||
Center,
|
||||
Image,
|
||||
Loader,
|
||||
Paper,
|
||||
Stack,
|
||||
Text,
|
||||
} from "@mantine/core";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import { IconMessages } from "@tabler/icons-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
Reference in New Issue
Block a user