Skip to content

Commit

Permalink
fix: PR fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pt-tsl committed Jan 6, 2025
1 parent 123baf8 commit 861efb4
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const FollowToggleButton: FC<FollowToggleButtonProps> = ({
const environment = useRelayEnvironment()

const toggleFollow = () => {
if (isMutationInFlight || !currentProfileId) {
if (isMutationInFlight || !currentProfileId || !targetId) {
return
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export interface FollowToggleButtonProps {
targetId: string
targetId?: string
isFollowedByMe: boolean | null | undefined
currentProfileId?: string
profileRef?: any
Expand Down
63 changes: 30 additions & 33 deletions packages/components/modules/profiles/ProfileComponent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,42 +69,39 @@ const ProfileComponent: FC<ProfileComponentProps> = ({ profile: profileRef }) =>
}

const renderProfileUpdatesButtons = () => {
if (profile && currentProfile) {
if (profile.id === currentProfile.id) {
return (
<Button
variant="soft"
size="medium"
color="inherit"
startIcon={<OutlinedEditIcon />}
sx={{ maxWidth: smDown ? '100%' : 'fit-content' }}
onClick={() => router.push('/user/settings')}
>
Edit Profile
</Button>
)
}
if (profile?.id === currentProfile?.id) {
return (
<div className="flex flex-row gap-2">
{!profile?.isBlockedByMe && (
<FollowToggleButton
targetId={profile?.id}
isFollowedByMe={profile?.isFollowedByMe}
currentProfileId={currentProfile?.id}
profileRef={profile}
/>
)}
{profile?.isBlockedByMe && (
<BlockButtonWithDialog
target={profile}
handleCloseMenu={handleClose}
currentProfileId={currentProfile?.id}
/>
)}
</div>
<Button
variant="soft"
size="medium"
color="inherit"
startIcon={<OutlinedEditIcon />}
sx={{ maxWidth: smDown ? '100%' : 'fit-content' }}
onClick={() => router.push('/user/settings')}
>
Edit Profile
</Button>
)
}
return <div />
return (
<div className="flex flex-row gap-2">
{!profile?.isBlockedByMe && (
<FollowToggleButton
targetId={profile?.id}
isFollowedByMe={profile?.isFollowedByMe}
currentProfileId={currentProfile?.id}
profileRef={profile}
/>
)}
{profile?.isBlockedByMe && (
<BlockButtonWithDialog
target={profile}
handleCloseMenu={handleClose}
currentProfileId={currentProfile?.id}
/>
)}
</div>
)
}

return (
Expand Down

0 comments on commit 861efb4

Please sign in to comment.