@@ -8,12 +8,18 @@ import {
88 CardHeader ,
99 CardTitle ,
1010} from '@/components/ui/card' ;
11+ import {
12+ Tooltip ,
13+ TooltipContent ,
14+ TooltipTrigger ,
15+ } from '@/components/ui/tooltip' ;
1116import { useWorkspaceSelector } from '@/hooks/useWorkspaceSelector' ;
1217import {
1318 useWorkspacesControllerGetWorkspaces ,
19+ WorkspaceResponseDtoRole ,
1420 type WorkspaceResponseDto ,
1521} from '@/services/apis/gen/queries' ;
16- import { Plus , Target , Users } from 'lucide-react' ;
22+ import { Crown , Plus , Target , Users } from 'lucide-react' ;
1723import { useNavigate } from 'react-router-dom' ;
1824
1925const PAGE_SIZE = 12 ;
@@ -54,7 +60,7 @@ export default function Workspaces() {
5460 }
5561 >
5662 < div className = "space-y-4" >
57- < div className = "grid grid-cols-1 gap-4 sm :grid-cols-2 md :grid-cols-3 lg :grid-cols-4" >
63+ < div className = "grid grid-cols-1 gap-4 md :grid-cols-2 lg :grid-cols-3 xl :grid-cols-4" >
5864 { isLoading
5965 ? Array . from ( { length : PAGE_SIZE } ) . map ( ( _ , index ) => (
6066 < Card key = { index } className = "animate-pulse" >
@@ -67,53 +73,67 @@ export default function Workspaces() {
6773 </ CardContent >
6874 </ Card >
6975 ) )
70- : data ?. data . map ( ( workspace : WorkspaceResponseDto ) => (
71- < Card
72- key = { workspace . id }
73- className = "cursor-pointer transition-colors hover:bg-accent/50"
74- onClick = { ( ) => onSelectWorkspace ( workspace . id ) }
75- >
76- < CardHeader >
77- < div className = "flex items-start justify-between" >
78- < CardTitle className = "text-lg" >
79- { workspace . name }
80- </ CardTitle >
81- < Badge
82- className = {
83- workspace . archivedAt
84- ? 'bg-gray-500 text-white'
85- : 'bg-green-500 text-white'
86- }
87- >
88- { workspace . archivedAt ? 'Archived' : 'Active' }
89- </ Badge >
90- </ div >
91- < div className = "flex gap-4 pt-2 text-sm text-muted-foreground" >
92- < div className = "flex items-center gap-1.5" >
93- < Users size = { 14 } className = "text-muted-foreground" />
94- < span className = "font-medium" >
95- { workspace . memberCount }
96- </ span >
97- < span > members</ span >
76+ : data ?. data . map ( ( workspace : WorkspaceResponseDto ) => {
77+ const isOwner =
78+ workspace . role === WorkspaceResponseDtoRole . owner ;
79+ return (
80+ < Card
81+ key = { workspace . id }
82+ className = "cursor-pointer transition-colors hover:bg-accent/50"
83+ onClick = { ( ) => onSelectWorkspace ( workspace . id ) }
84+ >
85+ < CardHeader >
86+ < div className = "flex items-start justify-between" >
87+ < CardTitle className = "text-lg flex items-center gap-2" >
88+ { workspace . name }
89+ { isOwner && (
90+ < Tooltip >
91+ < TooltipTrigger >
92+ < Crown size = { 20 } className = "text-yellow-500" />
93+ </ TooltipTrigger >
94+ < TooltipContent >
95+ < p > Owner</ p >
96+ </ TooltipContent >
97+ </ Tooltip >
98+ ) }
99+ </ CardTitle >
100+ < Badge
101+ className = {
102+ workspace . archivedAt
103+ ? 'bg-gray-500 text-white'
104+ : 'bg-green-500 text-white'
105+ }
106+ >
107+ { workspace . archivedAt ? 'Archived' : 'Active' }
108+ </ Badge >
98109 </ div >
99- < div className = "flex items-center gap-1.5" >
100- < Target size = { 14 } className = "text-muted-foreground" />
101- < span className = "font-medium" >
102- { workspace . targetCount }
103- </ span >
104- < span > targets</ span >
110+ < div className = "flex gap-4 pt-2 text-sm text-muted-foreground" >
111+ < div className = "flex items-center gap-1.5" >
112+ < Users size = { 14 } className = "text-muted-foreground" />
113+ < span className = "font-medium" >
114+ { workspace . memberCount }
115+ </ span >
116+ < span > members</ span >
117+ </ div >
118+ < div className = "flex items-center gap-1.5" >
119+ < Target size = { 14 } className = "text-muted-foreground" />
120+ < span className = "font-medium" >
121+ { workspace . targetCount }
122+ </ span >
123+ < span > targets</ span >
124+ </ div >
105125 </ div >
106- </ div >
107- </ CardHeader >
108- < CardContent >
109- < CardDescription className = "line-clamp-2" >
110- { typeof workspace . description === 'string'
111- ? workspace . description
112- : 'No description' }
113- </ CardDescription >
114- </ CardContent >
115- </ Card >
116- ) ) }
126+ </ CardHeader >
127+ < CardContent >
128+ < CardDescription className = "line-clamp-2" >
129+ { typeof workspace . description === 'string'
130+ ? workspace . description
131+ : 'No description' }
132+ </ CardDescription >
133+ </ CardContent >
134+ </ Card >
135+ ) ;
136+ } ) }
117137 </ div >
118138 </ div >
119139 </ Page >
0 commit comments