Skip to content

Commit

Permalink
profiles loading view
Browse files Browse the repository at this point in the history
  • Loading branch information
bmorrisondev committed Apr 30, 2024
1 parent be9fff6 commit be75718
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/app/profiles/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ import React, { useEffect, useState } from 'react'
import { getPublicProfiles } from '../lib/actions'
import { UserInfo } from '../lib/models'
import UserProfileCard from '../lib/components/UserProfileCard'
import LoadingView from '../views/LoadingView'

function Profiles() {
const [profiles, setProfiles] = useState<UserInfo[]>([])
const [isLoading, setIsLoading] = useState<boolean>(true)

useEffect(() => {
async function fetchData() {
let p = await getPublicProfiles()
setProfiles([...p])
setIsLoading(false)
}
fetchData()
}, [])
Expand All @@ -19,6 +22,7 @@ function Profiles() {
<div className='flex flex-col gap-4'>
<h1>Profiles</h1>
<div>Members of our amazing community:</div>
{isLoading && <LoadingView />}
<div className='grid grid-cols-3 gap-4'>
{profiles.map((p, i) => <UserProfileCard key={i} userInfo={p} />)}
</div>
Expand Down

0 comments on commit be75718

Please sign in to comment.