-
Notifications
You must be signed in to change notification settings - Fork 0
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
Create account #47
Create account #47
Conversation
Visit the preview URL for this PR (updated for commit 37acd02): https://todo-real-c28fa--pr47-create-account-p4fqk9dd.web.app (expires Fri, 06 Dec 2024 04:59:53 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: cbf065b4d5e2f44e47cd594ff42f749fc108f410 |
@mana1127
例えば今回であれば
こんな感じです |
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.
ログインしていない場合はどのページに到達しても/loginにリダイレクトさせる
この実装を忘れてそうなので実装お願いします
参考までに
Functions: redirect
【Next.js】App Routerでリダイレクトする方法
これを使って、src\app\page.tsx
のreturnの上とかでユーザーのログイン状況に応じてリダイレクトすればいいかと
ユーザー情報の参照方法は次のコードのようにするとapp以下のディレクトリで参照できます
const { user } = useUser(); |
src/app/account/page.tsx
Outdated
<CenteredToggleButtonGroup | ||
value={formMode} | ||
exclusive | ||
onChange={handleFormModeChange} | ||
aria-label="form mode" | ||
> | ||
<ToggleButton value="register" aria-label="register"> | ||
新規登録 | ||
</ToggleButton> | ||
<ToggleButton value="login" aria-label="login"> | ||
ログイン | ||
</ToggleButton> | ||
</CenteredToggleButtonGroup> |
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.
ログインしている場合はこのボタンも不要なので、こんな感じで演算子で囲っておきましょう
<CenteredToggleButtonGroup | |
value={formMode} | |
exclusive | |
onChange={handleFormModeChange} | |
aria-label="form mode" | |
> | |
<ToggleButton value="register" aria-label="register"> | |
新規登録 | |
</ToggleButton> | |
<ToggleButton value="login" aria-label="login"> | |
ログイン | |
</ToggleButton> | |
</CenteredToggleButtonGroup> | |
{!user && ( | |
<CenteredToggleButtonGroup | |
value={formMode} | |
exclusive | |
onChange={handleFormModeChange} | |
aria-label="form mode" | |
> | |
<ToggleButton value="register" aria-label="register"> | |
新規登録 | |
</ToggleButton> | |
<ToggleButton value="login" aria-label="login"> | |
ログイン | |
</ToggleButton> | |
</CenteredToggleButtonGroup> | |
)} |
#47 (comment) |
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.
コメント漏れと一個だけ確認
src\app\Components\UserForm\UserForm.tsx
も消していい気がしたけど残してるのって何か理由あったっけ?
src/app/account/page.tsx
Outdated
borderRadius: "20px", // 全体を丸角にする | ||
[theme.breakpoints.up("sm")]: { | ||
width: "450px", | ||
}, | ||
})); | ||
|
||
const CenteredToggleButtonGroup = styled(ToggleButtonGroup)({ | ||
display: "flex", | ||
justifyContent: "center", | ||
marginBottom: "16px", | ||
}); | ||
|
||
const RoundedButton = styled(Button)(({ theme }) => ({ | ||
borderRadius: "50px", // ボタンを丸角にする | ||
padding: theme.spacing(1.5, 4), // ボタンの内側余白を調整 |
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.
たぶんこの辺のコメントも消してOKですね
@mana1127 このコメントの修正を入れたので、作業をする前に
をするようにお願いします |
6e96a4d
to
2688993
Compare
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.
LGTM!
Closes ログインしていない場合は
/account
にリダイレクトさせる概要
/account/page.tsxにsrc\app\Components\UserForm\UserForm.tsxの中身を全て移す
ログインしていない場合はどのページに到達しても/loginにリダイレクトさせる
/accountでは各種ログインを選択できるようにする
変更内容
確認方法
チェックリスト