import React, { useState, useEffect } from "react";
import { __ } from "@wordpress/i18n";
import apiFetch from "@wordpress/api-fetch";
import Skeleton from 'react-loading-skeleton'
import 'react-loading-skeleton/dist/skeleton.css'
const Counts = () => {
const [counts, setCounts] = useState({
created_docs: 0,
published_docs: 0,
created_faq: 0,
published_faq: 0
});
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);
useEffect(() => {
const fetchCounts = async () => {
try {
const response = await apiFetch({
path: "/betterdocs/v1/docs-faq-count"
});
setCounts(response);
setLoading(false);
} catch (err) {
setError(err.message);
setLoading(false);
}
};
fetchCounts();
}, []);
const loader = () => {
return (
<>
{__("Created Docs", "betterdocs")}
{__("Published Docs", "betterdocs")}
{__("Created FAQs", "betterdocs")}
{__("Published FAQs", "betterdocs")}