From 74971c923c47bf28c6aa07ed042ea0e23104cf1f Mon Sep 17 00:00:00 2001 From: miteruzo Date: Tue, 1 Jul 2025 20:08:56 +0900 Subject: [PATCH] #73 --- backend/app/controllers/posts_controller.rb | 10 +++++++++- frontend/src/index.css | 6 ++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/backend/app/controllers/posts_controller.rb b/backend/app/controllers/posts_controller.rb index 91cac05..1a86319 100644 --- a/backend/app/controllers/posts_controller.rb +++ b/backend/app/controllers/posts_controller.rb @@ -5,7 +5,15 @@ require 'nokogiri' class PostsController < ApplicationController # GET /posts def index - posts = filtered_posts + latest_id = params[:latest].to_i + offset = params[:offset].to_i + + posts = filtered_posts.order(created_at: :desc) + posts = if posts.first&.id == latest_id + posts.limit(20).offset(offset) + else + posts.limit(offset + 20) + end render json: posts.as_json(include: { tags: { only: [:id, :name, :category, :post_count] } }) end diff --git a/frontend/src/index.css b/frontend/src/index.css index fe8b8ca..1ec8f1c 100644 --- a/frontend/src/index.css +++ b/frontend/src/index.css @@ -2,6 +2,12 @@ @tailwind components; @tailwind utilities; +@layer base { + body { + @apply overflow-x-clip; + } +} + :root { font-family: system-ui, Avenir, Helvetica, Arial, sans-serif; line-height: 1.5;