-
Notifications
You must be signed in to change notification settings - Fork 1
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
プロフィール編集画面 #121
プロフィール編集画面 #121
Changes from 20 commits
1d98fd5
383b327
d598eb1
c70461c
39ec26b
d226e15
56e51cb
007ce65
03bda89
5f0c14f
5da63e5
bc28f22
d934705
0088316
e791a08
bbc762e
2de912e
ebd92bb
7294462
27ff0fa
d074365
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,29 +12,15 @@ type Props = { | |
}; | ||
export default function ProfilePage({ fallbackData }: Props) { | ||
const { data, isLoading } = useUser(fallbackData.username, fallbackData); | ||
const { data: authId, isLoading: authorizing } = useAuth(); | ||
const { data: authId } = useAuth(); | ||
if (!data) { | ||
// FIXME 読み込み中 | ||
return <></>; | ||
} | ||
Comment on lines
+15
to
19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
const { data: authId } = useAuth();
if (!data) {
+16: const { data: authId, isLoading: authLoading } = useAuth();
+17: if (!data || authLoading) {
// FIXME 読み込み中
return <></>;
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ロード中の場合、dataはundefinedで返却されるため、isLoadingの確認はしていません。 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @takecchi あなたの説明を理解しました。しかし、 この一時的な未定義状態が問題を引き起こすかどうかは、 ただし、あなたのコードの文脈では、 |
||
|
||
return ( | ||
<PrimaryColumn columnName={data.name} showBack> | ||
<ProfileCard | ||
name={data.name} | ||
username={data.username} | ||
id={data.id} | ||
protected={data._protected} | ||
followingCount={data.followingCount} | ||
followersCount={data.followersCount} | ||
createdAt={data.createdAt} | ||
bio={data.bio} | ||
profileImageUrl={data.profileImageUrl} | ||
url={data.url} | ||
verified={data.verified} | ||
authId={authId} | ||
authorizing={authorizing} | ||
/> | ||
<ProfileCard authId={authId} {...data} /> | ||
Comment on lines
22
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 型が正しいかという意味合いでいうと、tscで確認が取れるため問題ないかと。 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @takecchi ご返信いただきありがとうございます。TypeScriptの型チェックが行われているとのことで安心しました。私のコメントは、 しかし、あなたのコメントを読む限りでは、既に適切な型チェックが行われているようですので、特に問題はないと思います。引き続き良いコードの書き方を維持してください。 |
||
{!isLoading && <UserTimeline user={data} />} | ||
</PrimaryColumn> | ||
); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use client'; | ||
|
||
import { styled } from '@mui/material'; | ||
|
||
const HeaderImage = styled('div')<{ | ||
image?: string; | ||
}>` | ||
display: block; | ||
background-size: cover; | ||
background-repeat: no-repeat; | ||
background-position: center; | ||
aspect-ratio: 3 / 1; | ||
background-color: ${({ theme }) => theme.palette.primary.light}; | ||
background-image: ${({ image }) => (image ? `url(${image})` : 'none')}; | ||
`; | ||
|
||
export default HeaderImage; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
'use client'; | ||
|
||
import { Avatar, styled } from '@mui/material'; | ||
|
||
const UserIcon = styled(Avatar)` | ||
width: 120px; | ||
height: 120px; | ||
|
||
margin-top: -80px; | ||
border-color: ${({ theme }) => theme.palette.background.paper}; | ||
border-style: solid; | ||
|
||
${({ theme }) => theme.breakpoints.down('tablet')} { | ||
width: 92px; | ||
height: 92px; | ||
margin-top: -61px; | ||
} | ||
`; | ||
|
||
export default UserIcon; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
'use client'; | ||
|
||
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'; | ||
|
||
export function EditProfileButton() { | ||
const text = 'プロフィールを編集'; | ||
const [open, setOpen] = useState<boolean>(false); | ||
const { data } = useProfile(); | ||
|
||
if (!data) { | ||
return <></>; | ||
} | ||
|
||
return ( | ||
<> | ||
<CapsuleButton | ||
aria-label={text} | ||
color="primary" | ||
onClick={() => { | ||
setOpen(true); | ||
}} | ||
variant="outlined" | ||
> | ||
{text} | ||
</CapsuleButton> | ||
<ProfileSettingModal | ||
open={open} | ||
bio={data.bio} | ||
displayName={data.name} | ||
src={data.profileImageUrl} | ||
onClose={() => setOpen(false)} | ||
/> | ||
</> | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CodeRabbit
インポートパスが変更されていますが、これは意図したものでしょうか? 以前のパスは絶対パスを使用していましたが、新しいパスは相対パスになっています。これにより、ファイル構造が変更された場合に影響を受ける可能性があります。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
意図した変更になります!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CodeRabbit
@takecchi 理解しました、ありがとうございます。ただし、絶対パスを使用することで、ファイル構造の変更による影響を最小限に抑えることができます。そのため、可能であれば絶対パスを使用することをお勧めします。