$73 GRAYBYTE WORDPRESS FILE MANAGER $84

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.217.254 | ADMIN IP 216.73.216.180
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : mail

/home/bravrvjk/dantho.rw/wp-content/plugins/extendify/src/Library/components/

HOME
Current File : /home/bravrvjk/dantho.rw/wp-content/plugins/extendify/src/Library/components//ModalContent.jsx
import { Spinner } from '@wordpress/components';
import { useState, useEffect } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { useInView } from 'react-intersection-observer';
import Masonry from 'react-masonry-css';
import { BlockPreviewButton } from '@library/components/BlockPreviewButton';
import { usePatterns } from '@library/hooks/usePatterns';

export const ModalContent = ({ insertPattern, siteType, category }) => {
	const { data, isLoading, setSize } = usePatterns({
		siteType: siteType?.slug,
		category,
	});
	const [showLoading, setShowLoading] = useState(true);
	const [loadMoreRef, inView] = useInView();
	const noMore = data?.at(-1)?.length < 9; // hard coded for now

	useEffect(() => {
		if (isLoading) {
			return setShowLoading(true);
		}
		const id = setTimeout(() => {
			setShowLoading(false);
		}, 750);
		return () => clearTimeout(id);
	}, [isLoading]);

	useEffect(() => {
		if (!inView || isLoading) return;
		setSize((size) => size + 1);
	}, [inView, isLoading, setSize]);

	if (isLoading || !data?.length) {
		return (
			<div className="absolute inset-0 flex flex-col items-center justify-center text-center">
				<Spinner />
				<span className="sr-only">
					{__('Loading Patterns...', 'extendify-local')}
				</span>
			</div>
		);
	}

	return (
		<>
			<Masonry
				breakpointCols={{
					default: 3,
					1600: 2,
					1000: 1,
					783: 2,
					600: 1,
				}}
				columnClassName=""
				className="relative flex w-full gap-6 p-8 pt-2">
				{data.map((p) =>
					p.map(({ id, code, patternReplacementCode }) => (
						<BlockPreviewButton
							key={id}
							insertPattern={insertPattern}
							code={patternReplacementCode ?? code}
						/>
					)),
				)}
			</Masonry>
			{showLoading ? (
				<div className="absolute inset-0 z-0 flex flex-col items-center justify-center text-center">
					<Spinner />
					<span className="sr-only">
						{__('Loading Patterns...', 'extendify-local')}
					</span>
				</div>
			) : null}
			{showLoading || noMore ? null : (
				<div
					ref={loadMoreRef}
					className="mb-6 mt-6 flex w-full justify-center md:mt-2">
					<Spinner />
					<span className="sr-only">
						{__('Loading more patterns...', 'extendify-local')}
					</span>
				</div>
			)}
		</>
	);
};


Current_dir [ WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
6 Nov 2025 10.43 AM
bravrvjk / bravrvjk
0755
sidebar
--
6 Nov 2025 10.43 AM
bravrvjk / bravrvjk
0755
topbar
--
6 Nov 2025 10.43 AM
bravrvjk / bravrvjk
0755
BlockPreviewButton.jsx
1.561 KB
27 Aug 2025 5.47 PM
bravrvjk / bravrvjk
0644
MainButton.jsx
0.883 KB
22 Apr 2025 9.31 PM
bravrvjk / bravrvjk
0644
Modal.jsx
4.223 KB
28 Mar 2025 7.25 PM
bravrvjk / bravrvjk
0644
ModalContent.jsx
2.225 KB
13 Mar 2025 9.10 PM
bravrvjk / bravrvjk
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF