Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Follow btn individual users #1654

Merged
merged 5 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
35 changes: 24 additions & 11 deletions components/ProfilePage/ProfileButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,17 @@

export function ProfileButtonsUser({
isProfilePublic,
onProfilePublicityChanged
onProfilePublicityChanged,
isUser,
profileId
}: {
isProfilePublic: boolean | undefined
onProfilePublicityChanged: (isPublic: boolean) => void
isUser: boolean
profileId: string
}) {
const { t } = useTranslation("editProfile")
const { user } = useAuth()

const actions = useProfile()

Expand All @@ -76,16 +81,24 @@
onProfilePublicityChanged(!isProfilePublic)
}
return (
<div className={`d-grid gap-2 col-12 m-3`}>
<EditProfileButton className={`py-1`} />
<ToggleButton
toggleState={isProfilePublic || false}
stateTrueLabel={t("forms.makePrivate")}
stateFalseLabel={t("forms.makePublic")}
onClick={handleSave}
className={`py-1`}
/>
</div>
<>
{isUser ? (
<div className={`d-grid gap-2 col-12 m-3`}>
<EditProfileButton className={`py-1`} />
<ToggleButton
toggleState={isProfilePublic || false}
stateTrueLabel={t("forms.makePrivate")}
stateFalseLabel={t("forms.makePublic")}
onClick={handleSave}
className={`py-1`}
/>
</div>
) : (
<div className={`d-grid gap-2 col-12 m-3`}>
<FollowButton profileId={profileId} user={user} />

Check failure on line 98 in components/ProfilePage/ProfileButtons.tsx

View workflow job for this annotation

GitHub Actions / Code Quality

Cannot find name 'FollowButton'. Did you mean 'FollowOrgButton'?
aaerhart marked this conversation as resolved.
Show resolved Hide resolved
</div>
)}
</>
)
}

Expand Down
6 changes: 4 additions & 2 deletions components/ProfilePage/ProfileHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,14 @@ export const ProfileHeader = ({
<div className="col-12 col-md-2 d-flex justify-content-center justify-content-md-end align-items-center ms-md-auto ">
{isOrg ? (
<OrgContactInfo profile={profile} />
) : isUser ? (
) : (
<ProfileButtonsUser
isProfilePublic={isProfilePublic}
onProfilePublicityChanged={onProfilePublicityChanged}
isUser={isUser}
profileId={profileId}
/>
) : null}
)}
</div>
</Header>
)
Expand Down
4 changes: 1 addition & 3 deletions components/search/testimony/TestimonyHit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ const TestimonyResult = ({ hit }: { hit: Hit<Testimony> }) => {
<span style={{ flexGrow: 1 }}>
<b>Written by {writtenBy}</b>
</span>
{followOrg && isOrg && user && (
<FollowOrgButton profileId={hit.authorUid} />
)}
{followOrg && user && <FollowOrgButton profileId={hit.authorUid} />}
</div>
<hr />
<div style={{ display: "flex", alignItems: "center" }}>
Expand Down
Loading