feat: add room likes feature

- Users can like/unlike rooms
- Like count displayed on room cards
- LikeButton component with heart icon
- room_likes table with unique constraint
This commit is contained in:
2026-06-30 21:57:28 -05:00
parent 7eae73eefb
commit 2353198924
3 changed files with 161 additions and 32 deletions
+6 -2
View File
@@ -3,6 +3,7 @@
import { useEffect, useState, useRef } from 'react';
import { formatDisplayDate } from '@/lib/date';
import RoomCalendar from '@/components/RoomCalendar';
import LikeButton from '@/components/LikeButton';
interface Room {
id: number;
@@ -420,8 +421,11 @@ export default function RoomsPage() {
{/* ─── Room Info ─── */}
<div style={{ padding: '1.5rem', flex: 1, display: 'flex', flexDirection: 'column' }}>
<h2 style={{ margin: '0 0 0.5rem', color: navy, fontSize: '24px' }}>{room.name}</h2>
<p style={{ color: '#555', lineHeight: 1.5, flex: 1 }}>{room.description}</p>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start' }}>
<h2 style={{ margin: 0, color: navy, fontSize: '24px' }}>{room.name}</h2>
<LikeButton roomId={room.id} />
</div>
<p style={{ color: '#555', lineHeight: 1.5, flex: 1, marginTop: '0.5rem' }}>{room.description}</p>
{/* ─── Amenity Icons ─── */}
{room.amenities && room.amenities.length > 0 && (