Skip to content

RegularEvents.jsxを非React化#9526

Merged
komagata merged 9 commits intomainfrom
chore/migrate-regular-event-list-to-rails-view
Mar 12, 2026
Merged

RegularEvents.jsxを非React化#9526
komagata merged 9 commits intomainfrom
chore/migrate-regular-event-list-to-rails-view

Conversation

@kutimiti1234
Copy link
Copy Markdown
Contributor

@kutimiti1234 kutimiti1234 commented Jan 15, 2026

Issue

概要

定期イベント一覧機能をReactから普通のrails viewに移行しました。

変更内容

  • app/controllers/regular_events_controller.rbでイベント一覧のデータ取得処理をするように修正
  • app/javascript/components/RegularEvents.jsxapp/views/regular_events/_regular_events.html.slimに移行。
  • app/views/regular_events/index.html.slim_regular_events.html.slimのrender処理を追加。
  • rails view化に伴い、不要となったファイルを削除、修正。
  • テストを修正

変更確認方法

  1. {chore/migrate-regular-event-list-to-rails-view}をローカルに取り込む
  2. bin/devでアプリを起動する
  3. 後ほど使う WIP定期イベントを作成する(WIPであること以外は条件は特になし)
  4. 定期イベント一覧を表示し、以下を確認
    • 「開催中/全て」のナビゲーションタブが表示される。
    • 「全て」を選択すると、/regular_eventsへ遷移
      • 「WIP」と「終了」を含んだ定期イベントが表示されている。
      • イベント表示の基本内容として以下が表示されていること
        • イベントカテゴリー
        • イベントタイトル
        • 主催(複数)のユーザアイコン
        • 開催日時(例:開催日時毎週日曜日 08:00 〜 09:00 )
      • WIP中のイベントは「WIP」マークがタイトル横に表示されること
      • 終了したイベントは「終了」マークがタイトル横に表示されること
      • コメントがある場合は、開催日時の横に「コメント(x)」が表示されること
      • イベントタイトルをクリックすると、イベント詳細ページ: /regular_events/{id} に遷移すること
      • ユーザーアイコンをクリックすると、ユーザ詳細ページ: /users/{id} に遷移すること
      • ページネーションが表示されること
    • 「開催中」を選択すると、/regular_events?target=not_finishedへ遷移
      • 「終了」を含まない定期イベントのみを表示する。
      • (※イベント表示の基本内容は「全て」と同様のため確認不要)

Screenshot

画面の変更はありませんが、動作確認時の参考としてスクリーンショットを添付いたします。

image image image

Summary by CodeRabbit

リリースノート

  • 新機能

    • 通常イベント一覧表示をRailsビューテンプレートで実装。フィルタリング(未完了/全て)とページネーション機能を追加。
    • Cloud Buildのリンク検証ジョブを新規構成。
    • GitHubアクションでPR作成者の自動割り当て機能を追加。
  • 削除

    • APIエンドポイント(通常イベント一覧)を廃止。
  • スタイル

    • ページレイアウト、リアクション、カード、ファイル入力、リンク、グローバルナビゲーションなどのCSS更新。
    • ペアワーク関連の新しいスタイルシートを追加。
  • その他

    • 開発ドキュメントの更新。

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jan 15, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

RegularEventsコントローラーのAPIエンドポイントを削除し、その機能を従来型のRailsコントローラーに統合しました。React コンポーネントを削除して Rails ビューに置き換え、link-checker用のCloudBuild設定を追加し、複数のCSS更新を行いました。

Changes

Cohort / File(s) Summary
RegularEvents API廃止
app/controllers/api/regular_events_controller.rb, app/views/api/regular_events/...
API コントローラーと JSON ビューを削除。API エンドポイントによる regular_events 機能を廃止。
RegularEvents Rails化
app/controllers/regular_events_controller.rb, app/views/regular_events/...
サーバーサイドレンダリングへの移行:fetch_target_eventsメソッド追加、定数 PAGER_NUMBER 導入、 Slim ビューテンプレート新規追加。
React コンポーネント削除
app/javascript/components/RegularEvent.jsx, app/javascript/components/RegularEvents.jsx
RegularEvents とそのサブコンポーネント(RegularEvent.jsx など)の削除。
API ルート削除
config/routes/api.rb
API 名前空間内の regular_events リソースルートを削除。
CloudBuild link-checker設定
.cloudbuild/cloudbuild-link-checker-job.yaml, .cloudbuild/cloudbuild.yaml
Google CloudRunジョブ「link-checker」用の設定ファイルおよびステップを新規追加。
GitHub Actions ワークフロー
.github/workflows/assign-pr-author-if-writable.yml
PR 作成時に著者を自動割り当てするワークフローを新規追加。
CSS スタイル更新
app/assets/stylesheets/application.css, app/assets/stylesheets/atoms/..., app/assets/stylesheets/application/blocks/..., app/assets/stylesheets/lp/blocks/..., app/assets/stylesheets/shared/blocks/...
Pair-work関連CSSの追加、イベント関連スタイルの調整、ナビゲーション等の多数のスタイル変更・最適化。
ドキュメント
README.md
Docker開発方法のリンクを削除。

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

Possibly related PRs

Suggested reviewers

  • komagata

Poem

🐰 React を削除して Rails に統一し
サーバーで描く イベント一覧
API は眠り、ビューが踊る
CloudBuild も一緒に参加して
コードの庭に新しい花咲く 🌸

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed プルリクエストのタイトル「RegularEvents.jsxを非React化」は、ReactコンポーネントをRailsビューに移行するという主要な変更を明確かつ簡潔に説明しており、変更内容と完全に一致しています。
Description check ✅ Passed プルリクエストの説明は、Issue参照、概要、変更内容、変更確認方法、スクリーンショットを含む必要なセクションが全て揃っており、テンプレートの要件を満たしています。

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/migrate-regular-event-list-to-rails-view

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kutimiti1234 kutimiti1234 force-pushed the chore/migrate-regular-event-list-to-rails-view branch from bc497d5 to 0431823 Compare January 15, 2026 18:36
@github-project-automation github-project-automation bot moved this to 作業中 in bootcamp Jan 15, 2026
@kutimiti1234 kutimiti1234 force-pushed the chore/migrate-regular-event-list-to-rails-view branch 2 times, most recently from c5b0cce to ad05293 Compare January 19, 2026 13:34
@kutimiti1234 kutimiti1234 marked this pull request as ready for review January 19, 2026 13:39
@github-actions github-actions bot requested a review from komagata January 19, 2026 13:39
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@app/models/regular_event.rb`:
- Around line 160-167: Add unit tests for the new class method
RegularEvent.fetch_target_events to cover both branches: when target ==
'not_finished' it should call/return RegularEvent.not_finished (assert it
returns only not-finished records or that the scope is invoked), and for any
other target it should return RegularEvent.all; create tests in the model spec
(or corresponding test file) that set up sample RegularEvent records (finished
and not finished), call RegularEvent.fetch_target_events('not_finished') and
verify only not-finished records are returned, then call
RegularEvent.fetch_target_events('any_other') and verify all records are
returned or that RegularEvent.all is used.
🧹 Nitpick comments (2)
app/controllers/regular_events_controller.rb (1)

4-14: event.user のN+1を回避できているか確認してください

ビュー側で event.user を参照しているため、with_avatar:user を preload していない場合はN+1になります。with_avatar の挙動を確認し、必要なら includes(:user) を追加してください。

♻️ 追加する場合の例
-                  .includes(:comments, :users)
+                  .includes(:comments, :users, :user)
app/views/regular_events/_regular_events.html.slim (1)

1-8: タブの class 末尾の空白を除去すると読みやすいです

params[:target] が nil 以外の時に ' ' を付けているので、不要な空白が残ります。空文字にすると意図が明確になります。

✨ 例
-      = link_to regular_events_path, class: "pill-nav__item-link#{params[:target].nil? ? ' is-active' : ' '}" do
+      = link_to regular_events_path, class: "pill-nav__item-link#{params[:target].nil? ? ' is-active' : ''}" do

@kutimiti1234 kutimiti1234 self-assigned this Jan 19, 2026
@kutimiti1234 kutimiti1234 requested a review from yokomaru January 19, 2026 13:47
@kutimiti1234
Copy link
Copy Markdown
Contributor Author

kutimiti1234 commented Jan 19, 2026

@yokomaru
お疲れ様です。

こちら以前ミーティングでも話させていただいたのですが、コントローラーapp/controllers/regular_events_controller.rbがクラスとして行数を超過しているため、RuboCopの警告を受けている状態です。
こちら別途リファクタリングのissueを作成いただけるとのことだったのですが、現状どういった形でしたでしょうか?場合によっては、こちらで作成させていただくことも可能です。

@kutimiti1234 kutimiti1234 force-pushed the chore/migrate-regular-event-list-to-rails-view branch from ad05293 to 638b193 Compare January 19, 2026 14:05
@yokomaru
Copy link
Copy Markdown
Contributor

@kutimiti1234
お疲れ様です。
先にdisableをマージした後にIssueを作成しようと思っていたのですが、一旦以下Issueに状況を整理いたしました!

暫定対応として以下の形で進められればと思います。

  • 両者のPRで以下を追加しておく
class RegularEventsController < ApplicationController # rubocop:disable Metrics/ClassLength
  • 先にマージされた方をmainに取り込み、もう片方はその後rebaseして差分を解消して取り込む

@kutimiti1234
Copy link
Copy Markdown
Contributor Author

@yokomaru
ご対応ありがとうございます。
こちらでも一旦、警告無視のためのcommitを積ませていただきました。
もし、こちらが先にマージされた場合連絡させていただきたいと思います。

@kutimiti1234 kutimiti1234 force-pushed the chore/migrate-regular-event-list-to-rails-view branch from 95e94e2 to 7f032a8 Compare January 21, 2026 13:21
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@app/views/regular_events/_regular_events.html.slim`:
- Around line 48-51: The time element's datetime attribute should be an ISO 8601
string; update the template so the datetime uses event.start_at.iso8601 (or
.utc.iso8601 if you want UTC) instead of passing the raw Time object (look for
the time.a-meta element and the datetime=event.start_at usage) to ensure valid
HTML and proper machine-readable timestamps.

@kutimiti1234 kutimiti1234 force-pushed the chore/migrate-regular-event-list-to-rails-view branch 3 times, most recently from 611736f to 3690a6f Compare January 23, 2026 17:26
@kutimiti1234
Copy link
Copy Markdown
Contributor Author

@yokomaru
お疲れ様です。
こちら急ぎではないのですが、レビュー対応をお願いできますでしょうか?

@kutimiti1234 kutimiti1234 moved this from 作業中 to レビュー中 in bootcamp Jan 24, 2026
@yokomaru
Copy link
Copy Markdown
Contributor

@kutimiti1234
お疲れ様です。申し訳ありません、Github上でのメンションが飛んでこず気づくのに遅れてしまいました。
私情により少し稼働の時間が取りづらくなっており、2~3週間ほど見ていただいてもよろしいでしょうか?
よろしくお願いいたします。

@kutimiti1234
Copy link
Copy Markdown
Contributor Author

@yokomaru
はい、特に問題ないです。よろしくお願いします

@yokomaru
Copy link
Copy Markdown
Contributor

yokomaru commented Feb 3, 2026

@kutimiti1234
お疲れ様です。
こちらのPRのコンフリクトの解消をお願いできますでしょうか?🙏
お手隙で大丈夫ですので、よろしくお願いいたします。

@kutimiti1234 kutimiti1234 force-pushed the chore/migrate-regular-event-list-to-rails-view branch from 3690a6f to 57be93e Compare February 5, 2026 13:08
@kutimiti1234
Copy link
Copy Markdown
Contributor Author

@yokomaru
ご連絡ありがとうございます。
こちら再度対応のほどよろしくお願いいたします。

@fjordllc fjordllc deleted a comment from coderabbitai bot Mar 11, 2026
@fjordllc fjordllc deleted a comment from coderabbitai bot Mar 11, 2026
@fjordllc fjordllc deleted a comment from coderabbitai bot Mar 11, 2026
@fjordllc fjordllc deleted a comment from coderabbitai bot Mar 11, 2026
@fjordllc fjordllc deleted a comment from coderabbitai bot Mar 11, 2026
@fjordllc fjordllc deleted a comment from coderabbitai bot Mar 11, 2026
@fjordllc fjordllc deleted a comment from coderabbitai bot Mar 11, 2026
@fjordllc fjordllc deleted a comment from coderabbitai bot Mar 11, 2026
@fjordllc fjordllc deleted a comment from coderabbitai bot Mar 11, 2026
@fjordllc fjordllc deleted a comment from coderabbitai bot Mar 11, 2026
@kutimiti1234 kutimiti1234 force-pushed the chore/migrate-regular-event-list-to-rails-view branch 2 times, most recently from 176fb46 to eaad554 Compare March 11, 2026 12:13
`test/system/regular_events_test.rb`の変更の詳細:
`regular_events`は41個存在するので、1ページに25個表示された場合、2ページ目には16個表示されるはず。つまり、mainの既存実装が誤っている
mainでテストが通過していたのは、現状はJSで実装されているため、JSが非同期で表示を切り替える前に、テストがplaceholder(8個のカードが存在する)の表示をassertしてしまい通過している
コントローラーのサイズが肥大化してしまったが、別issueで対応するため
kaminariのデフォルトpager_numberが25なので情報量が増えていないことから
@kutimiti1234 kutimiti1234 force-pushed the chore/migrate-regular-event-list-to-rails-view branch 2 times, most recently from 7dfa6a3 to 4676806 Compare March 11, 2026 12:32
@fjordllc fjordllc deleted a comment from coderabbitai bot Mar 11, 2026
@fjordllc fjordllc deleted a comment from coderabbitai bot Mar 11, 2026
@kutimiti1234
Copy link
Copy Markdown
Contributor Author

@komagata
ご指摘の事項対応しましたので、再レビューをお願い致します

Copy link
Copy Markdown
Member

@komagata komagata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

確認させていただきました。OKです〜🙆‍♂️

@komagata komagata merged commit 874caae into main Mar 12, 2026
4 checks passed
@komagata komagata deleted the chore/migrate-regular-event-list-to-rails-view branch March 12, 2026 07:48
@github-actions github-actions bot mentioned this pull request Mar 12, 2026
27 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants