diff --git a/frontend/components/PersonPage.tsx b/frontend/components/PersonPage.tsx index 79ec351..633a24d 100644 --- a/frontend/components/PersonPage.tsx +++ b/frontend/components/PersonPage.tsx @@ -1,5 +1,5 @@ import Head from "next/head"; -import { Field, Name, Person, Pronoun, User, WordStatus } from "../lib/types"; +import { Field, Member, Name, PartialPerson, Person, Pronoun, User, WordStatus } from "../lib/types"; import ReactMarkdown from "react-markdown"; import { userState } from "../lib/state"; import { useRecoilValue } from "recoil"; @@ -41,7 +41,10 @@ export default function PersonPage({ person }: { person: Person }) { - {!("user" in person) && } + {"user" in person + ? {`< ${person.user.display_name}`} + : + } ); @@ -65,7 +68,7 @@ function personUser(person: Person) { } /** The (relative) URL pointing to a person. */ -function personURL(person: Person) { +function personURL(person: PartialPerson | Member) { const domain = typeof window !== "undefined" ? window.location.origin : process.env.DOMAIN; return `${domain}/u/${"user" in person ? `${person.user.name}/` : ""}${ @@ -199,16 +202,10 @@ function PersonInfo({ person }: { person: Person }) { const { display_name, name, bio, links } = person; return (
- {/* display name */} - {display_name &&

{display_name}

} {/* name */} -

+

{display_name === null ? name : display_name}

+ {/* handle */} +

{personFullHandle(person)}

{/* bio */} diff --git a/frontend/pages/u/[user]/[member].tsx b/frontend/pages/u/[user]/[member].tsx index d139ada..03c2398 100644 --- a/frontend/pages/u/[user]/[member].tsx +++ b/frontend/pages/u/[user]/[member].tsx @@ -1,23 +1,14 @@ import { GetServerSideProps } from "next"; import fetchAPI from "../../../lib/fetch"; -import { Member, User } from "../../../lib/types"; -import { userState } from "../../../lib/state"; -import { useRecoilValue } from "recoil"; +import { Member } from "../../../lib/types"; +import PersonPage from "../../../components/PersonPage"; interface Props { member: Member; } export default function MemberPage({ member }: Props) { - const isOwnMember = useRecoilValue(userState)?.id === member.user?.id; - - return ( - <> -
hi! this is {isOwnMember ? "" : "not "}your own member.
-

name: {member.name}

-

{member.bio}

- - ); + return ; } export const getServerSideProps: GetServerSideProps = async (context) => {