# fix
- PC: Loader chat - QC: Auth , Profile, portofolio & user search ## No Issuue git commit -m
This commit is contained in:
12
src/app/api/test-scroll/route.ts
Normal file
12
src/app/api/test-scroll/route.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import prisma from "@/app/lib/prisma";
|
||||
|
||||
export async function GET(req: Request) {
|
||||
const page = new URL(req.url).searchParams.get("page");
|
||||
if (!page) return new Response("page require", { status: 400 });
|
||||
const res = await prisma.projectCollaboration_Message.findMany({
|
||||
take: 5,
|
||||
skip: +page * 5 - 5,
|
||||
});
|
||||
|
||||
return Response.json(res);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import { AdminLayout } from "@/app_modules/admin/main_dashboard";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_getOneById } from "@/app_modules/home/fun/get/get_one_user_by_id";
|
||||
import { user_getOneByUserId } from "@/app_modules/home/fun/get/get_one_user_by_id";
|
||||
import React from "react";
|
||||
|
||||
export default async function Layout({
|
||||
@@ -9,7 +9,7 @@ export default async function Layout({
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const userId = await user_getOneUserId()
|
||||
const dataUser = await user_getOneById(userId)
|
||||
const dataUser = await user_getOneByUserId(userId)
|
||||
const userRole = dataUser?.masterUserRoleId
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import adminColab_getOneRoomChatById from "@/app_modules/admin/colab/fun/get/get_one_room_chat_by_id";
|
||||
import { Colab_GroupChatView } from "@/app_modules/colab";
|
||||
import ColabViewChat from "@/app_modules/colab/detail/chat";
|
||||
import colab_V2getListMessageByRoomId from "@/app_modules/colab/fun/chat/get_message_by_room_id";
|
||||
import colab_getMessageByRoomId from "@/app_modules/colab/fun/get/room_chat/get_message_by_room_id";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import _ from "lodash";
|
||||
@@ -7,20 +9,30 @@ import _ from "lodash";
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
const roomId = params.id;
|
||||
const userLoginId = await user_getOneUserId();
|
||||
const dataRoom = (await adminColab_getOneRoomChatById({ roomId: roomId }))
|
||||
const getData = (await adminColab_getOneRoomChatById({ roomId: roomId }))
|
||||
.data;
|
||||
const selectRoom = _.omit(dataRoom, [
|
||||
const dataRoom = _.omit(getData, [
|
||||
"ProjectCollaboration",
|
||||
"ProjectCollaboration_AnggotaRoomChat",
|
||||
]);
|
||||
let listMsg = await colab_getMessageByRoomId({roomId: roomId, page: 1});
|
||||
let listMsg = await colab_getMessageByRoomId({ roomId: roomId, page: 1 });
|
||||
|
||||
// const listMessage = await colab_V2getListMessageByRoomId({
|
||||
// roomId: roomId,
|
||||
// page: 1,
|
||||
// });
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* <ColabViewChat
|
||||
listMsg={listMsg as any}
|
||||
dataRoom={dataRoom as any}
|
||||
userLoginId={userLoginId}
|
||||
/> */}
|
||||
<Colab_GroupChatView
|
||||
userLoginId={userLoginId}
|
||||
listMsg={listMsg}
|
||||
selectRoom={selectRoom as any}
|
||||
selectRoom={dataRoom as any}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { LayoutForum_Forumku } from "@/app_modules/forum";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_getOneById } from "@/app_modules/home/fun/get/get_one_user_by_id";
|
||||
import { user_getOneByUserId } from "@/app_modules/home/fun/get/get_one_user_by_id";
|
||||
import React from "react";
|
||||
|
||||
export default async function Layout({
|
||||
@@ -11,7 +11,7 @@ export default async function Layout({
|
||||
params: { id: string };
|
||||
}) {
|
||||
const authorId = params.id;
|
||||
const dataAuthor = await user_getOneById(authorId);
|
||||
const dataAuthor = await user_getOneByUserId(authorId);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -2,14 +2,14 @@ import { Forum_Forumku } from "@/app_modules/forum";
|
||||
import { forum_getListPostingByAuhtorId } from "@/app_modules/forum/fun/get/get_list_posting_by_author_id";
|
||||
import { forum_countOneTotalKomentarById } from "@/app_modules/forum/fun/count/count_one_total_komentar_by_id";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_getOneById } from "@/app_modules/home/fun/get/get_one_user_by_id";
|
||||
import { user_getOneByUserId } from "@/app_modules/home/fun/get/get_one_user_by_id";
|
||||
import _ from "lodash";
|
||||
import { forum_countPostingByAuthorId } from "@/app_modules/forum/fun/count/count_posting_by_author_id";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
const authorId = params.id;
|
||||
const userLoginId = await user_getOneUserId()
|
||||
const dataAuthor = await user_getOneById(authorId);
|
||||
const dataAuthor = await user_getOneByUserId(authorId);
|
||||
const auhtorSelectedData = _.omit(dataAuthor, [
|
||||
"Profile.email",
|
||||
"Profile.alamat",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { LayoutForum_Main } from "@/app_modules/forum";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_getOneById } from "@/app_modules/home/fun/get/get_one_user_by_id";
|
||||
import { user_getOneByUserId } from "@/app_modules/home/fun/get/get_one_user_by_id";
|
||||
import React from "react";
|
||||
|
||||
export default async function Layout({
|
||||
@@ -9,7 +9,7 @@ export default async function Layout({
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const authorId = await user_getOneUserId();
|
||||
const dataAuthor = await user_getOneById(authorId);
|
||||
const dataAuthor = await user_getOneByUserId(authorId);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { HomeLayout } from "@/app_modules/home";
|
||||
import { user_getOneById } from "@/app_modules/home/fun/get/get_one_user_by_id";
|
||||
import { user_getOneByUserId } from "@/app_modules/home/fun/get/get_one_user_by_id";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
export default async function Layout({ children }: { children: any }) {
|
||||
const userId = await user_getOneUserId();
|
||||
const dataUser = await user_getOneById(userId);
|
||||
const dataUser = await user_getOneByUserId(userId);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -3,22 +3,25 @@ import { cookies } from "next/headers";
|
||||
import { unsealData } from "iron-session";
|
||||
import _ from "lodash";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_getOneById } from "@/app_modules/home/fun/get/get_one_user_by_id";
|
||||
import { user_getOneByUserId } from "@/app_modules/home/fun/get/get_one_user_by_id";
|
||||
import { redirect } from "next/navigation";
|
||||
import { RouterAdminDashboard } from "@/app/lib/router_hipmi/router_admin";
|
||||
import { RouterHome } from "@/app/lib/router_hipmi/router_home";
|
||||
import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2";
|
||||
|
||||
export default async function Page() {
|
||||
const userId = await user_getOneUserId();
|
||||
const dataUser = await user_getOneById(userId);
|
||||
const dataUser = await user_getOneByUserId(userId);
|
||||
|
||||
if (dataUser?.active === false) {
|
||||
return redirect(RouterHome.home_user_non_active);
|
||||
}
|
||||
|
||||
|
||||
if (dataUser?.masterUserRoleId === "2" || dataUser?.masterUserRoleId === "3")
|
||||
return redirect(RouterAdminDashboard.splash_admin);
|
||||
|
||||
// if (dataUser?.Profile === null) return <ComponentGlobal_V2_LoadingPage />;
|
||||
|
||||
// await new Promise((a, b) => {
|
||||
// setTimeout(a, 4000);
|
||||
// });
|
||||
|
||||
@@ -12,13 +12,13 @@ import { funGetListPortofolio } from "@/app_modules/katalog/portofolio/fun/get/g
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { Profile_getOneById } from "@/app_modules/katalog/profile/fun/get/get_one_profile";
|
||||
import { Profile_getOneProfileAndUserById } from "@/app_modules/katalog/profile/fun/get/get_one_user_profile";
|
||||
import { user_getOneById } from "@/app_modules/home/fun/get/get_one_user_by_id";
|
||||
import { user_getOneByUserId } from "@/app_modules/home/fun/get/get_one_user_by_id";
|
||||
const config = yaml.parse(fs.readFileSync("config.yaml").toString());
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
let profileId = params.id;
|
||||
const authorId = await user_getOneUserId();
|
||||
const dataUser = await user_getOneById(authorId)
|
||||
const dataUser = await user_getOneByUserId(authorId)
|
||||
const listPorto = await funGetListPortofolio(profileId);
|
||||
const dataProfile = await Profile_getOneProfileAndUserById(profileId);
|
||||
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { CreateProfile } from "@/app_modules/katalog/profile";
|
||||
|
||||
export default async function Page({params}: {params: {id: string}}) {
|
||||
const userId = await user_getOneUserId()
|
||||
|
||||
return <>
|
||||
<CreateProfile userId={userId}/>
|
||||
</>
|
||||
}
|
||||
12
src/app/dev/profile/create/page.tsx
Normal file
12
src/app/dev/profile/create/page.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { CreateProfile } from "@/app_modules/katalog/profile";
|
||||
|
||||
export default async function Page() {
|
||||
const userId = await user_getOneUserId();
|
||||
|
||||
return (
|
||||
<>
|
||||
<CreateProfile userId={userId} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -2,12 +2,12 @@ import { RouterAdminDashboard } from "@/app/lib/router_hipmi/router_admin";
|
||||
import { RouterHome } from "@/app/lib/router_hipmi/router_home";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { Home_UserNonActive } from "@/app_modules/home";
|
||||
import { user_getOneById } from "@/app_modules/home/fun/get/get_one_user_by_id";
|
||||
import { user_getOneByUserId } from "@/app_modules/home/fun/get/get_one_user_by_id";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
export default async function Page() {
|
||||
const userId = await user_getOneUserId();
|
||||
const dataUser = await user_getOneById(userId);
|
||||
const dataUser = await user_getOneByUserId(userId);
|
||||
|
||||
if (dataUser?.active === true) {
|
||||
return redirect(RouterHome.main_home);
|
||||
|
||||
@@ -2,7 +2,7 @@ import { UserSearch_MainView } from "@/app_modules/user_search";
|
||||
import { UserSearch_getListUser } from "@/app_modules/user_search/fun/get/get_list_user";
|
||||
|
||||
export default async function Page() {
|
||||
const listUser = await UserSearch_getListUser()
|
||||
const listUser = await UserSearch_getListUser({ name: "" });
|
||||
|
||||
return <UserSearch_MainView listUser={listUser as any} />;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ export default function RootStyleRegistry({
|
||||
<body suppressHydrationWarning={true}>
|
||||
<CacheProvider value={cache}>
|
||||
<MantineProvider withGlobalStyles withNormalizeCSS>
|
||||
<Notifications position="top-center" containerWidth="250px" />
|
||||
<Notifications position="top-center" containerWidth={300} />
|
||||
{children}
|
||||
{/* <ToastContainer position="bottom-center" />
|
||||
<AppNotif /> */}
|
||||
|
||||
@@ -2,7 +2,7 @@ export const RouterProfile = {
|
||||
katalog: "/dev/katalog/",
|
||||
|
||||
// create
|
||||
create: "/dev/profile/create/",
|
||||
create: "/dev/profile/create",
|
||||
|
||||
// edit
|
||||
edit: "/dev/profile/edit/",
|
||||
|
||||
@@ -5,34 +5,76 @@ import useInfiniteScroll, {
|
||||
} from "react-easy-infinite-scroll-hook";
|
||||
import { createItems, loadMore } from "./_util";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import { Center, Loader } from "@mantine/core";
|
||||
import { Center, Loader, Text } from "@mantine/core";
|
||||
// Beda Package
|
||||
import InfiniteScroll from "react-infinite-scroll-component";
|
||||
|
||||
export default function App() {
|
||||
const [data, setData] = useState<any[]>([]);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
useShallowEffect(() => {
|
||||
setData(createItems());
|
||||
}, []);
|
||||
const ttlData = Array.from({ length: 21 });
|
||||
const [list, setList] = useState<any[]>(ttlData);
|
||||
|
||||
const next = async (direction: ScrollDirection) => {
|
||||
console.log("next", direction);
|
||||
try {
|
||||
setIsLoading(true);
|
||||
const newData = await loadMore();
|
||||
// useShallowEffect(() => {
|
||||
// setData(createItems());
|
||||
// }, []);
|
||||
|
||||
const d = direction === "up" ? [...newData, ...data] : [];
|
||||
setData(d);
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
// const next = async (direction: ScrollDirection) => {
|
||||
// console.log("next", direction);
|
||||
// try {
|
||||
// setIsLoading(true);
|
||||
// const newData = await loadMore();
|
||||
|
||||
// const d = direction === "up" ? [...newData, ...data] : [];
|
||||
// setData(d);
|
||||
// } finally {
|
||||
// setIsLoading(false);
|
||||
// }
|
||||
// };
|
||||
|
||||
// const ref = useInfiniteScroll({
|
||||
// next,
|
||||
// rowCount: data.length,
|
||||
// hasMore: { up: true },
|
||||
// });
|
||||
|
||||
const fetchMoreData = () => {
|
||||
setTimeout(() => {
|
||||
setList(list.concat(Array.from({ length: 20 })));
|
||||
}, 100);
|
||||
};
|
||||
|
||||
const ref = useInfiniteScroll({
|
||||
next,
|
||||
rowCount: data.length,
|
||||
hasMore: { up: true },
|
||||
});
|
||||
const style = {
|
||||
height: 30,
|
||||
border: "1px solid green",
|
||||
margin: 6,
|
||||
padding: 8,
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<div id="scrollableDiv" style={{ height: "100vh", overflow: "auto" }}>
|
||||
<InfiniteScroll
|
||||
dataLength={list.length}
|
||||
next={fetchMoreData}
|
||||
hasMore={true}
|
||||
loader={
|
||||
<center>
|
||||
<h4>Loading...</h4>
|
||||
</center>
|
||||
}
|
||||
scrollableTarget="scrollableDiv"
|
||||
>
|
||||
{list.map((i, index) => (
|
||||
<div style={style} key={index}>
|
||||
div - #{index}
|
||||
</div>
|
||||
))}
|
||||
</InfiniteScroll>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
||||
return (
|
||||
<Center>
|
||||
@@ -40,7 +82,7 @@ export default function App() {
|
||||
<Center>{isLoading && <Loader />}</Center>
|
||||
|
||||
<div
|
||||
ref={ref as any}
|
||||
// ref={ref as any}
|
||||
className="List"
|
||||
style={{
|
||||
height: 500,
|
||||
|
||||
Reference in New Issue
Block a user