Skip to content

Commit

Permalink
feat: página de todas as pessoas com conta
Browse files Browse the repository at this point in the history
  • Loading branch information
hdoro committed Jan 2, 2025
1 parent 24c69e7 commit 7dc0216
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
42 changes: 42 additions & 0 deletions src/app/pessoas/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import RainbowIcon from '@/components/icons/RainbowIcon'
import ProfilesGrid from '@/components/ProfilesGrid'
import SectionTitle from '@/components/SectionTitle'
import { Text } from '@/components/ui/text'
import { auth, client } from '@/edgedb'
import { peopleIndexQuery } from '@/queries'
import { buildTraceAndMetrics, runServerEffect } from '@/services/runtime'
import { Effect, pipe } from 'effect'
import { notFound } from 'next/navigation'

export default async function PeopleIndexRoute() {
const session = await auth.getSession()
if (!(await session.isSignedIn())) {
return notFound()
}

const data = await runServerEffect(
pipe(
Effect.tryPromise({
try: () => peopleIndexQuery.run(client),
catch: (error) => console.log(error),
}),
...buildTraceAndMetrics('people_index'),
Effect.catchAll(() => Effect.succeed(null)),
),
)

if (!data?.length) {
return null
}

return (
<section className="mb-32 mt-12">
<SectionTitle Icon={RainbowIcon}>Quem se envolve</SectionTitle>
<Text level="h3" className="px-pageX font-normal">
Cultivando sabedoria e compartilhando experiências para agroecologizar o
mundo ✨
</Text>
<ProfilesGrid profiles={data} className="mt-8 px-pageX" />
</section>
)
}
4 changes: 4 additions & 0 deletions src/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1059,3 +1059,7 @@ export const getMentionsDataQuery = e.params(
}),
})),
)

export const peopleIndexQuery = e.select(e.UserProfile, userProfileForAvatar)

export type PeopleIndexData = Exclude<$infer<typeof peopleIndexQuery>, null>

0 comments on commit 7dc0216

Please sign in to comment.