ca317f26a9918c35eba95d6ef8f07de2ca730005
Adds a no-auth star rating system backed by a centralized cross-property
table on supabase01.
Database:
- distribute.article_ratings (id, property, article_slug, rating 1..5,
session_id, ip_hash, user_agent, created_at) with UNIQUE
(property, article_slug, session_id). property column means every RMP
site shares one table; AV Beat writes 'avbeat', BB writes 'bb', etc.
- distribute.article_rating_aggregates view rolls up real_count + real_avg
per (property, slug).
API (/api/articles/rating):
- GET ?slug=X → { avg, count, my_rating } — reads aggregate, plus the
current session's vote if any.
- POST { slug, rating } → inserts the vote; unique_violation on duplicate
is silently swallowed (one vote per session). Returns updated summary.
- Session lives in `av_rate_sid` cookie (uuid, 1y, sameSite=lax). Cookie
is minted by the API on first request, so the client never has to know
about it.
StarRating component:
- Now interactive — hover preview, click to submit, "thanks!" affordance.
- Merges the existing deterministic baseline (slug-hash → 4.0–5.0 + age-
scaled count) with the real aggregate using the baseline as a Bayesian
prior, so a single real rating doesn't crater the displayed average.
- Once the current session has voted, stars show "your rating" and
hover/click are disabled.
- Text colors updated #d0d0d0 → #0F172A so the rating number is readable
on AV Beat's light backgrounds.
Property identifier hardcoded as "avbeat" at the top of the route — when
porting to BB / SNS / BLB / etc., change that constant and keep
everything else identical.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Next.js
A modern Next.js 15 application built with TypeScript and Tailwind CSS.
🚀 Features
- Next.js 15 - Latest version with improved performance and features
- React 19 - Latest React version with enhanced capabilities
- Tailwind CSS - Utility-first CSS framework for rapid UI development
🛠️ Installation
- Install dependencies:
npm install
# or
yarn install
- Start the development server:
npm run dev
# or
yarn dev
- Open http://localhost:4028 with your browser to see the result.
📁 Project Structure
nextjs/
├── public/ # Static assets
├── src/
│ ├── app/ # App router components
│ │ ├── layout.tsx # Root layout component
│ │ └── page.tsx # Main page component
│ ├── components/ # Reusable UI components
│ ├── styles/ # Global styles and Tailwind configuration
├── next.config.mjs # Next.js configuration
├── package.json # Project dependencies and scripts
├── postcss.config.js # PostCSS configuration
└── tailwind.config.js # Tailwind CSS configuration
🧩 Page Editing
You can start editing the page by modifying src/app/page.tsx. The page auto-updates as you edit the file.
🎨 Styling
This project uses Tailwind CSS for styling with the following features:
- Utility-first approach for rapid development
- Custom theme configuration
- Responsive design utilities
- PostCSS and Autoprefixer integration
📦 Available Scripts
npm run dev- Start development server on port 4028npm run build- Build the application for productionnpm run start- Start the development servernpm run serve- Start the production servernpm run lint- Run ESLint to check code qualitynpm run lint:fix- Fix ESLint issues automaticallynpm run format- Format code with Prettier
📱 Deployment
Build the application for production:
npm run build
📚 Learn More
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API
- Learn Next.js - an interactive Next.js tutorial
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!
🙏 Acknowledgments
- Built with Rocket.new
- Powered by Next.js and React
- Styled with Tailwind CSS
Built with ❤️ on Rocket.new
Description
Languages
TypeScript
93.7%
PLpgSQL
4.4%
CSS
1.6%
JavaScript
0.3%