1+ import { Button } from "@/shared/components/ui/button" ;
2+ import {
3+ Card ,
4+ CardDescription ,
5+ CardFooter ,
6+ CardHeader ,
7+ CardTitle ,
8+ } from "@/shared/components/ui/card" ;
19import { Separator } from "@/shared/components/ui/separator" ;
210import { createClient } from "@shared/utils/supabase/server" ;
11+ import { DoorClosed } from "lucide-react" ;
312import Link from "next/link" ;
13+ import { TooltipUtil } from "../../clientUtils" ;
414import { CreateChatroomDialog } from "./_components/create-chatroom-dialog" ;
515
616const ChatroomsPage = async ( {
@@ -25,22 +35,25 @@ const ChatroomsPage = async ({
2535 . from ( "Chatroom_Members" )
2636 . select (
2737 `
28- *,
29- Chatrooms(
30- id,
31- name,
32- classroom_id,
33- creater_user_id,
34- Classrooms(
35- name,
36- chatroom_assistant_id
37- )
38- ),
39- Classroom_Members!inner(
40- user_id,
41- classroom_id
42- )
43- `
38+ *,
39+ Chatrooms(
40+ id,
41+ name,
42+ classroom_id,
43+ creater_user_id,
44+ Classrooms(
45+ name,
46+ chatroom_assistant_id
47+ ),
48+ Users (
49+ full_name
50+ )
51+ ),
52+ Classroom_Members!inner(
53+ user_id,
54+ classroom_id
55+ )
56+ `
4457 )
4558 . eq ( "Classroom_Members.user_id" , currentUser )
4659 . eq ( "Classroom_Members.classroom_id" , parseInt ( classroomId , 10 ) )
@@ -63,20 +76,44 @@ const ChatroomsPage = async ({
6376
6477 < Separator />
6578
66- < div className = "grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3" >
79+ < div className = "mt-10 grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3" >
6780 { chatrooms . length > 0 ? (
6881 chatrooms . map ( ( chatroom ) => (
69- < div key = { chatroom . id } className = "rounded-lg border p-4 shadow-sm" >
70- < h2 className = "mb-2 text-xl font-semibold" > { chatroom . name } </ h2 >
71- < div className = "mt-4 flex gap-2" >
72- < Link
73- href = { `/chatrooms/${ chatroom . id } ` }
74- className = "inline-block rounded bg-blue-600 px-4 py-2 text-white transition-colors hover:bg-blue-700"
75- >
76- Enter Chatroom
77- </ Link >
78- </ div >
79- </ div >
82+ < Card key = { chatroom . id } className = "w-auto min-w-fit" animated >
83+ < CardHeader className = "pb-0" >
84+ < CardTitle animated className = "flex justify-between" >
85+ { chatroom . name }
86+ </ CardTitle >
87+ < CardDescription animated >
88+ < div className = "flex flex-row gap-3" >
89+ Owner: { chatroom . Users . full_name }
90+ </ div >
91+ </ CardDescription >
92+ </ CardHeader >
93+ < CardFooter
94+ animated
95+ className = "m-0 justify-between pb-5 pt-2 align-bottom"
96+ >
97+ < TooltipUtil
98+ trigger = {
99+ < Button
100+ type = "button"
101+ variant = { "ghost" }
102+ size = { "iconLg" }
103+ asChild
104+ >
105+ < Link href = { `/chatrooms/${ chatroom . id } ` } passHref >
106+ < DoorClosed className = "scale-[200%]" />
107+ </ Link >
108+ </ Button >
109+ }
110+ content = { "Enter" }
111+ />
112+ { /* {chatroomMembers && chatroomMembers.length > 0 && ( */ }
113+ { /**/ }
114+ { /* )} */ }
115+ </ CardFooter >
116+ </ Card >
80117 ) )
81118 ) : (
82119 < div className = "col-span-full py-8 text-center" >
0 commit comments