-
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
[DOJO-46] ログイン機能・ページを実装 #33
base: main
Are you sure you want to change the base?
Conversation
This reverts commit 30cad1d.
fix: Header を SSR に変更
src/components/primary-button.tsx
Outdated
@@ -2,8 +2,8 @@ import { Button } from '@/components/ui/button'; | |||
import { ReactNode } from 'react'; | |||
|
|||
interface PrimaryButtonProps { | |||
onClick: (e: React.FormEvent) => void; | |||
children: ReactNode; | |||
onClick?: (e: React.FormEvent) => void; |
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.
children
がnullableなのは分かりますが、onClick
がnullableなのは、なにか理由がありますか?ボタンを押しても何もしないなら、そのボタンを置く意味はありますか?
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.
言われてみれば。
Header を SSR にしたくて強引に仕様を変更していたところがあるので、もう一度方法を検討してみます。
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.
修正してみました
ただ、実際に実行や提出を行うフローにどのように繋げるか、
まだ見当がついていません。
7da07f2
strapi/Dockerfile
Outdated
@@ -5,13 +5,13 @@ ARG NODE_ENV=development | |||
ENV NODE_ENV=${NODE_ENV} | |||
|
|||
WORKDIR /opt/ | |||
COPY package.json package-lock.json ./ | |||
COPY package.json ./ |
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.
package-lock.json を再利用しないなら、.gitignore
に定義して、そもそもリポジトリに含まない、としても良さそうですね
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.
修正しました
8e3b6fc
strapi/config/server.ts
Outdated
host: env('HOST', '0.0.0.0'), | ||
port: env.int('PORT', 1337), | ||
host: env('STRAPI_HOST', '0.0.0.0'), | ||
port: env.int('STRAPI_PORT', 1337), |
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.
小さなことですが、1337
にように、説明のない数字のことをマジックナンバーと言い、バグの原因になりやすいです。
例えば1337で言えば、3行目と7行目に使われています。誰かが3行目を変更しても7行目を変更し忘れたら、正しく動かなくなります。
(このような小さなスコープなら問題は起きにくいですが、複数ファイルに渡りマジックナンバーが使用されると、バグになりやすいです。
なので、定数を定義するファイルを作り、そこにexport const STRAPI_PORT = 1337
のように定義すると良いでしょう
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.
マジックナンバー、こういった細かな気遣いがソフトウェアの持続性を向上させるのですね、、、
修正しました
79a0ff9
… に修正" This reverts commit b5bade9.
`/submissions/[id]/edit` 以外のページでヘッダーボダンが表示されないように変更
詳細の記入が遅れてすみません。完了いたしました。
Jira
DOJO-46
やったこと
/login
ページにアクセスし、ログインボタンを押下/login
-> Strapi -> GitHub OAuth へリダイレクト/
HOST
(サーバーのドメイン) で定義src フォルダへの移行に関わる不具合の修正[DOJO-45] フォルダ構成の整理 (修正1) #35 で修正します
shadcn の設定を修正 (components.json
)pnpm dlx shadcn@latest add [xxx]
でコンポーネントを追加できないことがあったのが修正されたESLint の設定を修正 (eslint.config.mjs
)src/*.{tsx,ts}
のファイルに対して全く動作していなかった要検討事項
STRAPI_[XXX]
に変更しているREADME.md
に GitHub OAuth のセットアップ方法を追記すべき以下の 2 つのアクセスが毎回発生する
src/middleware.ts
: サイトを遷移する前に、ログインしているかどうかを確認src/components/my-account.tsx
: ユーザー情報 (名前・メールアドレス) を取得必要な設定
docker compose up strapi
で Strapi を起動してください。初期設定が完了していない場合は、それも行ってください。動作風景
ログインまでの流れ
本当は GitHub での認証を挟みますが、省略しています。
Screen recording 2025-02-09 02.46.37.webm
アカウントメニュー
![image](https://private-user-images.githubusercontent.com/109420050/411257389-d4153e35-7326-45d1-a613-82d434cdaa12.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyOTMxNDksIm5iZiI6MTczOTI5Mjg0OSwicGF0aCI6Ii8xMDk0MjAwNTAvNDExMjU3Mzg5LWQ0MTUzZTM1LTczMjYtNDVkMS1hNjEzLTgyZDQzNGNkYWExMi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjExJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMVQxNjU0MDlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1kMTE0MjMwYmI3Yjc4ZGJjNDc0OGU1YmViMDM3MWNlM2FjYTRiYjAyZDdmODdiZWFiYjVjZGM0OGI5NDFiMjZkJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.vPNCVwwwjV3KHjNWJPqgThu5Hc0uv7XfpLf_2tQa-p4)