Skip to content

Commit

Permalink
自身の情報を参照するように修正
Browse files Browse the repository at this point in the history
  • Loading branch information
takecchi committed Dec 13, 2023
1 parent e791a08 commit bbc762e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
import CapsuleButton from '@/app/_components/button/CapsuleButton';
import ProfileSettingModal from '@/app/(menu)/(public)/[username]/_components/layouts/ProfileSettingModal';
import { useState } from 'react';
import { useProfile } from '@/swr/client/auth';

type Props = {
src: string;
displayName: string;
bio: string;
};

export function EditProfileButton({ src, displayName, bio }: Props) {
export function EditProfileButton() {
const text = 'プロフィールを編集';
const [open, setOpen] = useState<boolean>(false);
const { data } = useProfile();

if (!data) {
return <></>;
}

return (
<>
Expand All @@ -28,9 +28,9 @@ export function EditProfileButton({ src, displayName, bio }: Props) {
</CapsuleButton>
<ProfileSettingModal
open={open}
bio={bio}
displayName={displayName}
src={src}
bio={data.bio}
displayName={data.name}
src={data.profileImageUrl}
onClose={() => setOpen(false)}
/>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,7 @@ export default function ProfileCard({
{authId && !isMe && (
<FollowButton isFollowing={false} userId={id} />
)}
{authId && isMe && (
<EditProfileButton
src={profileImageUrl}
displayName={name}
bio={bio}
/>
)}
{authId && isMe && <EditProfileButton />}
</HFlex>
</FillFlex>
</HFlex>
Expand Down

0 comments on commit bbc762e

Please sign in to comment.