-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from deepsingh132/development
Fixes the profile route on mobile devices
- Loading branch information
Showing
7 changed files
with
91 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
"use client"; | ||
|
||
import { useQuery } from "convex/react"; | ||
|
||
import EmptyState from "@/components/EmptyState"; | ||
import LoaderSpinner from "@/components/LoaderSpinner"; | ||
import PodcastCard from "@/components/PodcastCard"; | ||
import ProfileCard from "@/components/ProfileCard"; | ||
import { api } from "@/convex/_generated/api"; | ||
import { ProfilePodcastProps } from "@/types"; | ||
import { useClerk } from "@clerk/nextjs"; | ||
|
||
const MyProfilePage = () => { | ||
|
||
const { user } = useClerk(); | ||
|
||
const podcastsData = useQuery(api.podcasts.getPodcastByAuthorId, { | ||
authorId: user?.id!, | ||
}) as ProfilePodcastProps; | ||
|
||
if (!user || !podcastsData) return <LoaderSpinner />; | ||
|
||
return ( | ||
<section className="mt-9 flex flex-col"> | ||
<h1 className="text-20 font-bold text-white-1 max-md:text-center"> | ||
My Profile | ||
</h1> | ||
<div className="mt-6 flex flex-col gap-6 max-md:items-center md:flex-row"> | ||
<ProfileCard | ||
profileId={user.id} | ||
podcastData={podcastsData} | ||
imageUrl={user?.imageUrl!} | ||
userFirstName={user.firstName!} | ||
/> | ||
</div> | ||
<section className="mt-9 flex flex-col gap-5"> | ||
<h1 className="text-20 font-bold text-white-1">All Podcasts</h1> | ||
{podcastsData && podcastsData.podcasts.length > 0 ? ( | ||
<div className="podcast_grid"> | ||
{podcastsData?.podcasts | ||
?.slice(0, 4) | ||
.map((podcast) => ( | ||
<PodcastCard | ||
key={podcast._id} | ||
imgUrl={podcast.imageUrl!} | ||
title={podcast.podcastTitle!} | ||
description={podcast.podcastDescription} | ||
podcastId={podcast._id} | ||
/> | ||
))} | ||
</div> | ||
) : ( | ||
<EmptyState | ||
title="You have not created any podcasts yet" | ||
buttonLink="/create-podcast" | ||
buttonText="Create Podcast" | ||
/> | ||
)} | ||
</section> | ||
</section> | ||
); | ||
}; | ||
|
||
export default MyProfilePage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters