Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion frontend/src/components/pages/ProfilePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,30 @@ import { AppWrapper } from "@/components/AppWrapper";
import ProfileHeader from "@/components/profiles/profile-page/ProfileHeader";
import ProfileActions from "@/components/profiles/profile-page/ProfileActions";
import ProfileAttestations from "@/components/profiles/profile-page/ProfileAttestations";
import ProfileDescription from "@/components/profiles/profile-page/ProfileDescription";
import { useMemo } from "react";
import { useGetProfiles } from "@/hooks/profiles/use-get-profiles";
import ProfileIssuedAttestations from "../profiles/profile-page/ProfileIssuedAttestations";

type Props = { address?: string };

export default function ProfilePage({ address }: Props) {
const profilesQuery = useGetProfiles();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok so this won't work because AppWrapper, which injects query client is in this component. Instead, you should create a new component ProfileMain.tsx in components/profiles/profile-page with the content of AppWrapper here and then use the hook at this level.
OR
move AppWrapper to frontend/src/pages/profiles/[address].astro (probable better? if that works?)

So while you are at it, please remove the same logic in ProfileHeader and inject name and description into ProfileHeader from ProfileMain using props

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ProfileMain was implemented in #98 so please rebase with main

const profile = useMemo(() => {
const list = profilesQuery.data ?? [];
return list.find(
(x) => x.address.toLowerCase() === (address || "").toLowerCase()
);
}, [profilesQuery.data, address]);

return (
<AppWrapper>
<section className="max-w-5xl mx-auto px-4 sm:px-6 lg:px-8 py-10">
<ProfileHeader address={address || ""} />

<ProfileActions address={address || ""} />
<ProfileActions address={address || ""} name={profile?.name} description={profile?.description} />

<ProfileDescription description={profile?.description} />

<ProfileAttestations address={address || ""} />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ export function CreateProfileButton() {
<FormItem>
<FormLabel>Description</FormLabel>
<FormControl>
<Input
<textarea
className="w-full min-h-[80px] rounded-md border border-input bg-background px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
placeholder="Write a short introduction..."
{...field}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ export function EditProfileDialog({
<FormItem>
<FormLabel>Description</FormLabel>
<FormControl>
<Input
<textarea
className="w-full min-h-[80px] rounded-md border border-input bg-background px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
placeholder="Write a short introduction..."
{...field}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from "react";

interface ProfileDescriptionProps {
description?: string;
}

export const ProfileDescription: React.FC<ProfileDescriptionProps> = ({ description }) => {
if (!description) return null;
return (
<div className="my-6">
<p className="text-lg text-gray-700 whitespace-pre-line">{description}</p>
</div>
);
};

export default ProfileDescription;
Loading