upd: scroll
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { ScrollProvider, WrapLayout } from "@/module/_global"
|
||||
import { WrapLayout } from "@/module/_global"
|
||||
import { funDetectCookies, funGetUserByCookies } from "@/module/auth"
|
||||
import _ from "lodash"
|
||||
import { redirect } from "next/navigation"
|
||||
@@ -11,9 +11,7 @@ export default async function Layout({ children }: { children: React.ReactNode }
|
||||
return (
|
||||
<>
|
||||
<WrapLayout role={user.idUserRole} theme={user.theme} user={user.id}>
|
||||
<ScrollProvider>
|
||||
{children}
|
||||
</ScrollProvider>
|
||||
{children}
|
||||
</WrapLayout>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
MantineProvider,
|
||||
rem,
|
||||
} from "@mantine/core";
|
||||
import { WARNA } from "@/module/_global";
|
||||
import { ScrollProvider, WARNA } from "@/module/_global";
|
||||
import { Lato } from "next/font/google";
|
||||
import '@mantine/carousel/styles.css';
|
||||
import { Toaster } from 'react-hot-toast';
|
||||
@@ -33,20 +33,23 @@ export default function RootLayout({
|
||||
return (
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
<ColorSchemeScript />
|
||||
</head>
|
||||
<body className={`${LatoFont.className}`} suppressHydrationWarning>
|
||||
<MantineProvider>
|
||||
<Notifications />
|
||||
<Notifications />
|
||||
<Box bg={'#252A2F'} pos={"fixed"} w={"100%"} h={"100%"} style={{
|
||||
overflowY: "auto",
|
||||
}}>
|
||||
<Toaster/>
|
||||
<LayoutBackground>
|
||||
{children}
|
||||
</LayoutBackground>
|
||||
<Toaster />
|
||||
<ScrollProvider>
|
||||
<LayoutBackground>
|
||||
{children}
|
||||
</LayoutBackground>
|
||||
</ScrollProvider>
|
||||
</Box>
|
||||
|
||||
</MantineProvider>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -31,13 +31,11 @@ export default function ListAnnouncement() {
|
||||
setLoading(true)
|
||||
const response = await funGetAllAnnouncement('?search=' + searchQuery + '&page=' + isPage)
|
||||
if (response.success) {
|
||||
// if (response.data.length > 0) {
|
||||
if (isPage == 1) {
|
||||
setIsData(response?.data)
|
||||
} else {
|
||||
setIsData([...isData, ...response?.data])
|
||||
}
|
||||
// }
|
||||
} else {
|
||||
toast.error(response.message);
|
||||
}
|
||||
@@ -79,7 +77,6 @@ export default function ListAnnouncement() {
|
||||
const scrollTop = containerRef.current.scrollTop;
|
||||
const containerHeight = containerRef.current.clientHeight;
|
||||
const scrollHeight = containerRef.current.scrollHeight;
|
||||
|
||||
if (scrollTop + containerHeight >= scrollHeight) {
|
||||
setPage(isPage + 1)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user