Added owners for each room
This commit is contained in:
1 parent
2389033ca4
commit
7a84480d70
2 files changed
+12
-3
No files matched your search
@@ -31,7 +31,7 @@ export default async function RoomDetailPage({
|
||||
|
||||
const { data: room } = await supabase
|
||||
.from("rooms")
|
||||
.select("id, name, created_at")
|
||||
.select("id, name, created_at, owner_id")
|
||||
.eq("id", id)
|
||||
.single();
|
||||
|
||||
@@ -73,7 +73,12 @@ export default async function RoomDetailPage({
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<RoomSettings roomId={id} members={members} currentUserId={user.id} />
|
||||
<RoomSettings
|
||||
roomId={id}
|
||||
members={members}
|
||||
currentUserId={user.id}
|
||||
ownerId={room.owner_id}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Chat */}
|
||||
|
||||
@@ -10,10 +10,12 @@ export function RoomSettings({
|
||||
roomId,
|
||||
members,
|
||||
currentUserId,
|
||||
ownerId,
|
||||
}: Readonly<{
|
||||
roomId: string;
|
||||
members: MemberEntry[];
|
||||
currentUserId: string;
|
||||
ownerId: string;
|
||||
}>) {
|
||||
const [open, setOpen] = useState(false);
|
||||
const [deleting, setDeleting] = useState(false);
|
||||
@@ -89,7 +91,8 @@ export function RoomSettings({
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Danger zone */}
|
||||
{/* Danger zone — only visible to the room owner */}
|
||||
{currentUserId === ownerId && (
|
||||
<div className="mt-5 border-t border-neutral-100 pt-4">
|
||||
<button
|
||||
onClick={handleDeleteRoom}
|
||||
@@ -99,6 +102,7 @@ export function RoomSettings({
|
||||
{deleting ? "Deleting..." : "Delete Room"}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
Reference in new issue
Block a user