diff --git a/app/learn-more/page.tsx b/app/learn-more/page.tsx index 1d58feeb..a1ea4163 100644 --- a/app/learn-more/page.tsx +++ b/app/learn-more/page.tsx @@ -2,8 +2,22 @@ import Link from "next/link"; import {aColor} from "@/lib/client/constants"; +import {useEffect, useState} from "react"; export default function LearnMorePage() { + + const [totalUsers, setTotalUsers] = useState(0); + useEffect(() => { + const getCount = async () => { + const countResponse = await fetch('/api/profiles/count'); + if (countResponse.ok) { + const {count} = await countResponse.json(); + setTotalUsers(count); + } + }; + + getCount(); + }, []); // <- runs once after initial mount return (
{aColor} @@ -46,6 +60,8 @@ export default function LearnMorePage() {
Source Code

The source code and instructions for development are available on GitHub.

+

Statistics

+

{totalUsers} total users

); diff --git a/app/profiles/page.tsx b/app/profiles/page.tsx index 1c45e628..bf4f350d 100644 --- a/app/profiles/page.tsx +++ b/app/profiles/page.tsx @@ -32,23 +32,9 @@ export default function ProfilePage() { const [loading, setLoading] = useState(true); const [error, setError] = useState(''); const [_, setShowFilters] = useState(true); - const [totalUsers, setTotalUsers] = useState(0); const [images, setImages] = useState([]) const [filters, setFilters] = useState(initialState); - - useEffect(() => { - const getCount = async () => { - const countResponse = await fetch('/api/profiles/count'); - if (countResponse.ok) { - const {count} = await countResponse.json(); - setTotalUsers(count); - } - }; - - getCount(); - }, []); // <- runs once after initial mount - const fetchProfiles = useCallback(async () => { try { setLoading(true);