Skip to content

スマホでも他人の進捗を消す機能が使えるようにした。スマホでコメントにユーザーロールが表示されないバグも修正#9121

Merged
machida merged 1 commit intomainfrom
switch-and-icon-role
Sep 3, 2025
Merged

Conversation

@machida
Copy link
Copy Markdown
Member

@machida machida commented Sep 3, 2025

#9118
#9119

Summary by CodeRabbit

  • Style
    • スイッチの見た目・ホバー挙動を調整し、カーソル/トランジションを追加。小画面での整列を最適化。
    • カードのメインアクションのブレークポイントを整理し、幅・配置の一貫性を向上。
    • コメント/回答のアバターを役割クラス付きラッパーで囲み、ロール別のスタイル適用を可能に。
    • プラクティス一覧の「みんなの進捗」トグルを小画面でも表示し、視認性を改善。

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Sep 3, 2025

Walkthrough

Sassでスイッチとカードアクションのブレークポイント/レイアウトを調整。コメントと回答のアバター画像を役割用のラッパー要素で包むマークアップ変更。プラクティス一覧ヘッダーの一部アクションの小画面での非表示制限を解除。

Changes

Cohort / File(s) Change summary
Styles: Switch layout/responsiveness
app/javascript/stylesheets/atoms/_a-switch.sass
md-up条件を撤廃し、.a-switch/.a-switch__labelのレイアウト・テキストスタイルをベースに昇格。.a-switchにdisplay:flex, align-items, cursor, transitionを追加。小画面向けの調整は維持。.a-helpの位置指定と背景色ルールを分離配置。
Styles: Card main actions
app/javascript/stylesheets/shared/blocks/card/_card-main-actions.sass
.card-main-actions__itemで一部コンテナクエリのmin-widthブロックを削除(flex/max-widthやis-subのabsolute指定)。既存の他ブレークポイントルールは維持。
Views: Avatar wrapper for role styling
app/views/comments/_comment.html.slim, app/views/questions/_answer.html.slim
アバターimgを役割クラス付きspanでラップ。回答部分では動的クラス属性を文字列補間に統一。表示ロジックは不変。
Views: Practices header visibility
app/views/courses/practices/index.html.slim
ヘッダーアクションの「みんなの進捗」項目からis-hidden-sm-downを削除し、小画面でも表示。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • komagata
  • kushimegu
  • sharoa119

Poem

ぴょんと跳ねて、CSSを整え
役割の輪でアイコンきらり
小さな画面も、もう隠れんぼなし
スイッチすべらか、カードはすっきり
コードの畑で、にんじん印のLGTM 🥕

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch switch-and-icon-role

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@machida machida self-assigned this Sep 3, 2025
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: 0

🧹 Nitpick comments (7)
app/javascript/stylesheets/atoms/_a-switch.sass (3)

2-5: transition: all は対象を絞り、低モーション対応を入れてください

不要なプロパティまでアニメーションしないようにし、prefers-reduced-motion を考慮しましょう。

-  transition: all .2s ease-out
+  transition: color .2s ease-out, background-color .2s ease-out, transform .2s ease-out
+  @media (prefers-reduced-motion: reduce)
+    transition: none

6-7: 子孫セレクタ「*」での cursor: pointer は過剰適用

無効化された要素やアクセシビリティ補助に影響する可能性。対象を限定しましょう。

-  *
-    cursor: pointer
+  label, input[type='checkbox'], .a-help, .a-switch__label-text
+    cursor: pointer

19-24: ホバー時の装飾はキーボード操作でも反映させる

:focus-visible / :focus-within でも同等の見た目にしてください。

   &:hover
     .a-switch__label-text
       color: var(--main-text)
       text-decoration: underline
     .a-help
       background-color: var(--main)
+  &:focus-within, &:focus-visible
+    .a-switch__label-text
+      color: var(--main-text)
+      text-decoration: underline
+    .a-help
+      background-color: var(--main)
app/views/courses/practices/index.html.slim (1)

27-32: モーダル起動に label[for] を使うのは非推奨(非フォーム要素)

ボタンに置き換えるとセマンティクスとアクセシビリティが改善します。

-                label.a-switch__label(for='modal-progress')
+                button.a-switch__label type='button' data-action='click->modal#open' data-target='modal-progress'
app/views/comments/_comment.html.slim (2)

16-17: ロール用クラス付与を answer 側と統一(helper 経由)

answer は user_icon_frame_class を使っています。comment も同一ヘルパを使うと分岐・nil対策が一元化できます。

-              span class="a-user-role is-#{comment.user.primary_role}"
+              span class="#{comment.user.user_icon_frame_class}"

6-6: アバター画像に alt を追加(装飾なら空、代替が必要ならユーザー名)

SR 対応のため alt を明示してください。

-        img.thread-comment__user-icon.a-user-icon src="#{comment.user.avatar_url}"
+        img.thread-comment__user-icon.a-user-icon src="#{comment.user.avatar_url}" alt="#{comment.user.login_name}のアバター"

(装飾目的なら alt="")

Also applies to: 17-17

app/views/questions/_answer.html.slim (1)

5-5: アバター画像の alt を追加

コメント側と同様に alt を付けてください。

-        img.thread-comment__user-icon.a-user-icon src="#{answer.user.avatar_url}"
+        img.thread-comment__user-icon.a-user-icon src="#{answer.user.avatar_url}" alt="#{answer.user.login_name}のアバター"

(装飾目的なら alt="")

Also applies to: 22-22

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between c2f55d2 and e12c926.

📒 Files selected for processing (5)
  • app/javascript/stylesheets/atoms/_a-switch.sass (1 hunks)
  • app/javascript/stylesheets/shared/blocks/card/_card-main-actions.sass (0 hunks)
  • app/views/comments/_comment.html.slim (1 hunks)
  • app/views/courses/practices/index.html.slim (1 hunks)
  • app/views/questions/_answer.html.slim (2 hunks)
💤 Files with no reviewable changes (1)
  • app/javascript/stylesheets/shared/blocks/card/_card-main-actions.sass
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build_and_test
🔇 Additional comments (5)
app/views/courses/practices/index.html.slim (1)

25-35: スマホで「みんなの進捗」トグルを表示する変更は妥当

要件達成のための最小変更で副作用リスクも低いです。

app/views/comments/_comment.html.slim (2)

16-17: モバイルでの役割表示(ラッパー追加)は良い修正

ロール別スタイル適用のための構造が揃いました。


27-29: .adviser.adviser? の混在は問題ありません
Rails の boolean カラムでは foo? が同義エイリアスとして自動定義されるため、user.adviseruser.adviser? に未定義メソッドや真偽のずれは発生しません (karolgalanciak.com, stackoverflow.com)

app/views/questions/_answer.html.slim (2)

4-4: user_icon_frame_class への置換は適切

クラス値の引用も統一され、意図が明確です。

Also applies to: 21-22


29-31: adviser? メソッドの存在と意図を確認
現状 answer.user.adviser(association取得)が使われています。boolean判定として adviser? を呼ぶ意図がある場合は、Userモデルに adviser? が定義されているか・boolean属性かを確認し、必要に応じて呼び出しを切り替えてください。

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.

1 participant