MCPcopy Create free account
hub / github.com/dailydotdev/apps / ProfileHeader

Function ProfileHeader

packages/shared/src/components/profile/ProfileHeader.tsx:55–153  ·  view source on GitHub ↗
({
  user,
  userStats,
  isSameUser: propIsSameUser,
  isPreviewMode,
}: ProfileHeaderProps)

Source from the content-addressed store, hash-verified

53};
54
55const ProfileHeader = ({
56 user,
57 userStats,
58 isSameUser: propIsSameUser,
59 isPreviewMode,
60}: ProfileHeaderProps) => {
61 const { name, username, bio, image, cover, isPlus } = user;
62 const { user: loggedUser } = useAuthContext();
63 const isSameUser = propIsSameUser ?? loggedUser?.id === user.id;
64
65 return (
66 <div className="relative w-full overflow-hidden laptop:rounded-t-16">
67 <ProfileDesktopPwaBackButton className="absolute left-4 top-4 z-1" />
68 <div className="h-36">
69 <Image src={cover} alt="Cover" className="h-full w-full object-cover" />
70 </div>
71 <Image
72 src={image}
73 fallbackSrc={fallbackImages.avatar}
74 alt="Avatar"
75 className="absolute left-6 top-16 h-[7.5rem] w-[7.5rem] rounded-16 object-cover"
76 />
77 <div className="flex flex-col gap-3 px-6">
78 <Link passHref href={`${webappUrl}settings/profile`}>
79 <Button
80 className={classNames(
81 'mb-4 ml-auto mt-2 text-text-secondary',
82 !isSameUser && 'invisible',
83 )}
84 tag="a"
85 disabled={!isSameUser}
86 variant={ButtonVariant.Float}
87 icon={<EditIcon />}
88 aria-label="Edit profile"
89 />
90 </Link>
91 <div className="flex items-center gap-1">
92 <Typography type={TypographyType.Title2} bold>
93 {name}
94 </Typography>
95 {isPlus && (
96 <DevPlusIcon
97 className="text-action-plus-default"
98 size={IconSize.Size16}
99 />
100 )}
101 </div>
102 <div className="flex flex-col gap-2">
103 {bio && <Typography type={TypographyType.Body}>{bio}</Typography>}
104 <div className="flex items-center">
105 {!!user?.companies?.length && (
106 <VerifiedCompanyUserBadge
107 size={ProfileImageSize.XSmall}
108 user={user}
109 showCompanyName
110 showVerified={false}
111 companyNameTypography={{
112 type: TypographyType.Subhead,

Callers

nothing calls this directly

Calls 2

useAuthContextFunction · 0.90
locationToStringFunction · 0.90

Tested by

no test coverage detected