Skip to content

Comments

投稿詳細ページを「手紙らしい」UIにリニューアル#5

Merged
sugiwe merged 14 commits intomainfrom
feature/letter-style-ui
Feb 24, 2026
Merged

投稿詳細ページを「手紙らしい」UIにリニューアル#5
sugiwe merged 14 commits intomainfrom
feature/letter-style-ui

Conversation

@sugiwe
Copy link
Owner

@sugiwe sugiwe commented Feb 23, 2026

Summary

  • Postにタイトル必須化とサムネイル画像機能を追加
  • Thread詳細ページをカード型グリッドレイアウトに変更
  • Post詳細ページを「手紙らしい」デザインに改善
    • 前回/次回投稿のチラ見せ表示(opacity制御)
    • レスポンシブ対応(スマホ/PC両対応)
  • ヘッダー簡素化とナビゲーション改善
  • ユーザーアイコンの左下固定配置

主な変更内容

1. Postモデルの拡張

  • タイトル必須化(既存の空タイトル投稿は「無題」に更新)
  • Active Storageによるサムネイル画像機能
  • 前後の投稿ナビゲーション用メソッド追加

2. Thread詳細ページ

  • 2カラムグリッドレイアウト(モバイルは1カラム)
  • サムネイル画像対応
  • カードホバー時のシャドウエフェクト

3. Post詳細ページ

  • 「手紙」らしい広めのpadding(PC: 4rem、スマホ: 2rem)
  • 行間を2.0に拡大
  • 前回/次回投稿を薄く表示(opacity: 70%)、ホバーで100%
  • メインコンテンツ内に統合された前後ナビゲーション

4. ヘッダー・ナビゲーション

  • ヘッダーのborder削除でシンプルに
  • スレッド戻るリンク「←」をヘッダー内に配置
  • ユーザーアイコンを左下に固定配置

Test plan

  • 新規投稿でタイトル・サムネイル入力が正しく機能する
  • Thread詳細ページでカードレイアウトが表示される
  • Post詳細ページで前回/次回投稿のチラ見せが機能する
  • スマホ/PCでレスポンシブ表示が適切に切り替わる
  • ヘッダーの「←」リンクが正しく機能する
  • ユーザーアイコンのドロップダウンメニューが正しく動作する

🤖 Generated with Claude Code

sugiwe and others added 11 commits February 23, 2026 10:14
- マイグレーション追加: 既存の空タイトル投稿(5件)に「無題」を設定
- Post モデルから `set_default_title` コールバックを削除
  - タイトルは必須化されたため、自動補完は不要
- タイトルバリデーション: presence: true, length: { maximum: 100 }

この変更は「文通」らしさを強調するUI改善の第一歩です。

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- `rails active_storage:install` を実行
- Post モデルに `has_one_attached :thumbnail` を追加
- 次のステップで投稿フォームに画像アップロード機能を実装予定

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- 投稿フォームに thumbnail ファイルアップロードフィールドを追加
- PostsController の strong parameters に :thumbnail を追加
- タイトルと本文のラベルに「必須」を明記
- タイトルのプレースホルダーとヒントテキストを更新
  (自動補完機能は削除済みのため)

次のステップでカード型グリッドレイアウトを実装します。

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
投稿一覧を「チャット風」から「文通・書簡風」のデザインに刷新:

- 2カラムグリッド(PC)/ 1カラム(スマホ)のレスポンシブレイアウト
- カード型デザイン:
  - サムネイル画像(16:9)または絵文字プレースホルダー(📮)
  - タイトルを大きく表示(line-clamp-2)
  - 著者のアバターと表示名、投稿日時
  - 本文プレビュー(line-clamp-3)
  - ホバー時にシャドウ効果

これにより1つ1つの投稿が「手紙」としての重みを持ち、
タイトルと画像で内容が想像できるようになりました。

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Tailwind の aspect-[16/9] クラスは Slim で角括弧が属性として
解釈されるため、インラインスタイル aspect-ratio: 16/9 に変更

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
VerificationError発生時もCRLなしで再試行するように修正。
Google::Auth::IDTokens.verify_oidc 内部で発生するSSLエラーが
VerificationErrorとしてラップされるケースに対応。

これにより開発環境でのGoogle認証失敗問題を解決。

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
便箋に書かれた手紙のような落ち着いた雰囲気を演出:

- コンテンツエリアのpadding: 2rem → 4rem(2倍)
- 本文の行間: line-height 2.0(1.5倍)
- タイトルと本文の余白を拡大(mb-12)
- サムネイル画像表示を追加
- 著者情報のアバターサイズとフォントを調整
- 前後ナビゲーションの余白を拡大、ホバーアニメーション追加
- 全体的に余白を増やし、ゆったりとした読書体験を提供

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
## ヘッダー簡素化
- ロゴ + ユーザーアイコンのみの激シンプルデザイン
- ドロップダウンメニュー実装(Stimulus使用)
  - ユーザー名・アイコン表示
  - マイページリンク
  - ログアウトボタン
- クリック外側で自動的に閉じる

## Post詳細ページの前後チラ見せ
- 前回の投稿を上部にチラ見せ(グレー背景)
- 今回の投稿をメインで強調表示
- 次の投稿を下部にチラ見せ(グレー背景)
- チラ見せカードにサムネイル・タイトル・本文抜粋を表示
- ボーダーが連結して一体感のあるデザイン

交換日記の連続性が視覚的にわかりやすくなりました!

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
## ヘッダー簡素化
- ロゴ「oobun」を画面左端に配置(コンテナ幅に依存しない)
- 右上の要素をすべて削除し、激シンプルなデザインに

## ユーザーアイコンを左下固定
- position: fixed で左下に配置
- アイコンサイズ: 12x12(大きめ)
- 白いボーダーと影を追加して目立つように

## ドロップダウンメニュー
- アイコンのすぐ上に表示
- アイコンと4px重なる配置で一体感を演出
- メニュー内容:
  - ユーザー名・@username表示
  - マイページリンク
  - ログアウトボタン
- クリック外側で自動的に閉じる(Stimulus実装)

## ログインボタン
- 左下固定に統一
- 丸みのある白背景ボタン

コンテンツに集中できるミニマルなUIになりました!

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- ヘッダーのborder-bottomを削除してシンプルに
- スレッド戻るリンク「←」をヘッダー内に配置
- content_for :back_linkでページごとにカスタマイズ可能に

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- 前回/次回投稿をメインコンテンツ内に統合(チラ見せ表示)
- 通常時opacity 70%、ホバーで100%表示でメイン投稿を引き立てる
- レスポンシブ対応: スマホp-8、PCp-16でパディング調整
- ページ上部のナビゲーションリンクをヘッダーに移動

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@gemini-code-assist
Copy link

Summary of Changes

Hello @sugiwe, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

このプルリクエストは、ユーザーエクスペリエンスを大幅に向上させるための広範なUI/UX改善を含んでいます。投稿のコンテンツ管理を強化するためにタイトル必須化とサムネイル機能が導入され、投稿一覧と詳細ページのデザインが刷新されました。特に、投稿詳細ページは「手紙」のような読書体験を提供するよう再設計され、全体的なナビゲーションとヘッダーも使いやすさを考慮して見直されています。

Highlights

  • 投稿モデルの拡張: 投稿にタイトルを必須化し、サムネイル画像機能を追加しました。既存の空タイトル投稿は「無題」に更新されます。
  • スレッド詳細ページのUI改善: スレッド詳細ページをカード型のグリッドレイアウトに変更し、サムネイル表示とホバーエフェクトを導入しました。
  • 投稿詳細ページの「手紙らしい」リニューアル: 投稿詳細ページを「手紙」をイメージしたデザインに刷新しました。前後の投稿を薄く表示するチラ見せ機能や、レスポンシブ対応が含まれます。
  • ヘッダーとナビゲーションの改善: ヘッダーを簡素化し、スレッドに戻るリンクを配置しました。また、ユーザーアイコンを左下に固定配置し、ドロップダウンメニューを追加しました。
Changelog
  • app/controllers/sessions_controller.rb
    • Google IDトークン検証失敗時にCRLなしで再試行するロジックを追加しました。
  • app/controllers/threads/posts_controller.rb
    • 投稿パラメータにサムネイルの許可を追加しました。
  • app/javascript/controllers/dropdown_controller.js
    • ドロップダウンメニューの開閉と外部クリックでの閉じる機能を制御するStimulusコントローラーを追加しました。
  • app/models/post.rb
    • 投稿にサムネイル画像を添付するためのhas_one_attached :thumbnailを追加しました。
    • タイトルが空の場合に投稿日時をデフォルトタイトルとするset_default_titleコールバックを削除しました。
  • app/views/layouts/application.html.slim
    • ヘッダーのボーダーを削除し、デザインを簡素化しました。
    • スレッドに戻るリンクを配置するためのyield :back_linkブロックを追加しました。
    • ログインユーザーのアイコンを左下固定で表示し、ドロップダウンメニュー機能を追加しました。
  • app/views/threads/posts/new.html.slim
    • 投稿作成フォームからデフォルトタイトル生成ロジックを削除し、タイトルを必須項目として明示しました。
    • サムネイル画像をアップロードするためのファイルフィールドを追加しました。
  • app/views/threads/posts/show.html.slim
    • 投稿詳細ページの最大幅を広げ、パディングを調整して「手紙らしい」デザインに刷新しました。
    • 前後の投稿を薄く表示する「チラ見せ」機能を追加し、ナビゲーションをメインコンテンツ内に統合しました。
    • 投稿にサムネイル画像があれば表示するように変更しました。
    • 本文の行間を広げ、読みやすさを向上させました。
  • app/views/threads/show.html.slim
    • 投稿一覧をカード型のグリッドレイアウトに変更し、モバイルでは1カラム、PCでは2カラムで表示するようにしました。
    • 各投稿カードにサムネイル画像を表示するように変更しました。
    • カードホバー時にシャドウエフェクトを追加しました。
  • db/migrate/20260223011120_set_default_title_for_empty_posts.rb
    • 既存のタイトルが空の投稿に対して「無題」をデフォルトタイトルとして設定するデータ移行を追加しました。
  • db/migrate/20260223011447_create_active_storage_tables.active_storage.rb
    • Active Storageの機能に必要なactive_storage_blobsactive_storage_attachmentsactive_storage_variant_recordsテーブルを作成するマイグレーションを追加しました。
  • db/schema.rb
    • Active Storage関連のテーブル定義と外部キー制約を追加し、スキーマバージョンを更新しました。
Activity
  • このプルリクエストには、現在記録されている活動はありません。
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@sugiwe sugiwe self-assigned this Feb 23, 2026
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

このプルリクエストは、投稿詳細ページのUIを「手紙らしい」デザインにリニューアルし、全体的なユーザーエクスペリエンスを向上させるための素晴らしい改善です。Postモデルの拡張、カード型レイアウトの導入、レスポンシブ対応など、多岐にわたる変更が実装されています。コード全体として、意図が明確でよく構造化されています。いくつか、保守性をさらに高めるための提案をさせていただきました。主に、インラインスタイルをTailwind CSSのユーティリティクラスに置き換えることに関するものです。また、認証エラーのハンドリングについて、より安全な実装を検討する余地があるかもしれません。これらの変更は、アプリケーションの品質をさらに高めるものと信じています。素晴らしいお仕事です!

Comment on lines 49 to 52
rescue Google::Auth::IDTokens::VerificationError => e
Rails.logger.warn "Google ID token verification failed: #{e.message}"
nil
# CRL エラーの可能性があるため、CRL なしで再試行
verify_google_id_token_without_crl(credential)

Choose a reason for hiding this comment

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

medium

Google::Auth::IDTokens::VerificationError は、CRLエラー以外にもトークンの有効期限切れやオーディエンスの不一致など、様々な理由で発生する可能性があります。すべての場合でCRLチェックなしの再試行を行うと、本来失敗すべき認証が成功してしまうセキュリティリスクや、デバッグが困難になる可能性があります。エラーメッセージ(e.message)の内容をチェックして、CRL関連のエラーが示唆される場合にのみフォールバックするように処理を限定することを強く推奨します。

- else
.w-full.h-full.flex.items-center.justify-center.text-gray-400.text-sm = current_user.display_name[0]
/ ドロップダウンメニュー(上に表示)
.absolute.w-48.bg-white.rounded-lg.shadow-lg.border.border-gray-200.py-2.hidden data-dropdown-target="menu" style="left: 10px; bottom: calc(100% - 4px)"

Choose a reason for hiding this comment

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

medium

インラインスタイル style="left: 10px; bottom: calc(100% - 4px)" が使用されています。このプロジェクトではTailwind CSSが全面的に採用されているようですので、スタイルの一貫性と保守性を高めるために、インラインスタイルではなくTailwindのユーティリティクラスを使用することが推奨されます。Tailwind CSSのJITコンパイラ機能を使えば、left-[10px]bottom-[calc(100%-4px)]のように任意の値でクラスを生成できます。

        .absolute.w-48.bg-white.rounded-lg.shadow-lg.border.border-gray-200.py-2.hidden.left-[10px].bottom-[calc(100%-4px)] data-dropdown-target="menu"

h1.text-2xl.font-semibold.text-gray-900.mb-4 = @post.title
/ ヘッダー(タイトル・著者)
header.mb-12
h1.text-2xl.font-semibold.text-gray-900.mb-6 style="line-height: 1.5" = @post.title

Choose a reason for hiding this comment

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

medium

インラインスタイル style="line-height: 1.5" が使用されています。保守性を高めるため、Tailwind CSSのユーティリティクラス leading-9 に置き換えることをお勧めします。(text-2xl のフォントサイズ 1.5rem に対して line-height: 1.52.25rem となり、これは leading-9 に相当します)

      h1.text-2xl.font-semibold.text-gray-900.mb-6.leading-9 = @post.title


.text-sm.text-gray-800.leading-relaxed.whitespace-pre-wrap = @post.body
/ 本文(手紙の内容)
.text-base.text-gray-800.whitespace-pre-wrap style="line-height: 2.0" = @post.body

Choose a reason for hiding this comment

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

medium

インラインスタイル style="line-height: 2.0" が使用されています。保守性を高めるため、Tailwind CSSのユーティリティクラス leading-loose に置き換えることをお勧めします。

    .text-base.text-gray-800.whitespace-pre-wrap.leading-loose = @post.body

span.text-xs.text-gray-500 = "@#{post.user.username}"
= link_to thread_post_path(@thread.slug, post), class: "block border border-gray-200 rounded-lg overflow-hidden hover:shadow-lg transition-shadow group" do
/ サムネイル画像
.bg-gray-100.flex.items-center.justify-center.overflow-hidden style="aspect-ratio: 16/9"

Choose a reason for hiding this comment

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

medium

インラインスタイル style="aspect-ratio: 16/9" が使用されています。保守性を高めるため、Tailwind CSSのユーティリティクラス aspect-video に置き換えることをお勧めします。

          .bg-gray-100.flex.items-center.justify-center.overflow-hidden.aspect-video

sugiwe and others added 3 commits February 23, 2026 18:49
CRL関連エラーのみをフォールバックするよう条件分岐を追加し、
トークンの有効期限切れやオーディエンス不一致などの
本来失敗すべき認証が成功してしまうセキュリティリスクを解消。

- crl_related_error? メソッドを追加してエラーメッセージパターンをチェック
- CRL関連エラーのみ CRLなしで再試行するよう修正
- その他の検証エラーは nil を返して認証失敗とする

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
コードの一貫性と保守性を高めるため、すべてのインラインスタイルを
Tailwind CSSのユーティリティクラスに置き換え。

- application.html.slim: left/bottom → .left-[10px].bottom-[calc(100%-4px)]
- threads/posts/show.html.slim: line-height → .leading-9, .leading-loose
- threads/show.html.slim: aspect-ratio → .aspect-video

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Slimの`.`省略記法と`data=`ハッシュ記法を同じ行で併用すると
パースエラーが発生する問題を修正。

- `.class` 記法から `div class="..."` 明示記法に変更
- `data={"controller" => "dropdown"}` 形式に統一
- invite機能と同じ記述スタイルに揃える

これにより、ドロップダウンメニューが正常に動作するようになった。

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@sugiwe sugiwe merged commit 87184e2 into main Feb 24, 2026
3 checks passed
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