1+ import { Coffee , LucideIcon } from "lucide-react" ;
12import * as React from "react" ;
2- import {
3- ArrowUpCircle ,
4- CheckCircle2 ,
5- Circle ,
6- HelpCircle ,
7- LucideIcon ,
8- SignalLowIcon ,
9- XCircle ,
10- } from "lucide-react" ;
113
124import { cn } from "@/shadcn/lib/utils" ;
135import { Button } from "@/shadcn/ui/button" ;
@@ -34,6 +26,7 @@ export function UserCombo({
3426 hideInitial,
3527 showIcon,
3628 disabled,
29+ placeholder,
3730} ) {
3831 const [ open , setOpen ] = React . useState ( false ) ;
3932 const [ selectedStatus , setSelectedStatus ] = React . useState < any | null > ( null ) ;
@@ -83,10 +76,29 @@ export function UserCombo({
8376 </ PopoverTrigger >
8477 < PopoverContent className = "p-0" side = "right" align = "start" >
8578 < Command >
86- { /* <CommandInput placeholder="Change status..." /> */ }
79+ < CommandInput placeholder = { placeholder } />
8780 < CommandList >
8881 < CommandEmpty > No results found.</ CommandEmpty >
8982 < CommandGroup >
83+ < CommandItem
84+ className = " hover:cursor-pointer"
85+ value = { undefined }
86+ onSelect = { ( ) => {
87+ setSelectedStatus ( null ) ;
88+ update ( null ) ;
89+ setOpen ( false ) ;
90+ } }
91+ >
92+ { /* <val.icon
93+ className={cn(
94+ "mr-2 h-4 w-4",
95+ val.value === selectedStatus?.value
96+ ? "opacity-100"
97+ : "opacity-40"
98+ )}
99+ /> */ }
100+ < span > Unassign</ span >
101+ </ CommandItem >
90102 { value . map ( ( val ) => (
91103 < CommandItem
92104 className = " hover:cursor-pointer"
@@ -99,14 +111,6 @@ export function UserCombo({
99111 setOpen ( false ) ;
100112 } }
101113 >
102- { /* <val.icon
103- className={cn(
104- "mr-2 h-4 w-4",
105- val.value === selectedStatus?.value
106- ? "opacity-100"
107- : "opacity-40"
108- )}
109- /> */ }
110114 < span > { val . name } </ span >
111115 </ CommandItem >
112116 ) ) }
@@ -212,3 +216,110 @@ export function IconCombo({
212216 </ div >
213217 ) ;
214218}
219+
220+ export function ClientCombo ( {
221+ value,
222+ update,
223+ defaultName,
224+ hideInitial,
225+ showIcon,
226+ disabled,
227+ } ) {
228+ const [ open , setOpen ] = React . useState ( false ) ;
229+ const [ selectedStatus , setSelectedStatus ] = React . useState < any | null > ( null ) ;
230+
231+ return (
232+ < div className = "flex items-center space-x-4" >
233+ < Popover open = { open } onOpenChange = { setOpen } >
234+ < PopoverTrigger asChild >
235+ < Button
236+ variant = "outline"
237+ size = "sm"
238+ className = "w-[180px] justify-start border-none"
239+ disabled = { disabled }
240+ >
241+ { selectedStatus ? (
242+ < div className = "flex flex-row space-x-2 w-[120px]" >
243+ < div className = "flex-shrink-0" >
244+ < span className = "inline-flex h-6 w-6 pl-2.5 items-center justify-center " >
245+ < span className = "text-xs font-medium leading-none text-foreground uppercase " >
246+ < Coffee className = "mr-2 h-4 w-4 shrink-0 " />
247+ </ span >
248+ </ span >
249+ </ div >
250+ < span className = "mt-[2px]" > { defaultName } </ span >
251+ </ div >
252+ ) : defaultName ? (
253+ < >
254+ < div className = "flex flex-row items-center space-x-2" >
255+ < div className = "flex-shrink-0" >
256+ < span className = "inline-flex h-6 w-6 pl-2.5 items-center justify-center " >
257+ < span className = "text-xs font-medium leading-none text-foreground uppercase " >
258+ < Coffee className = "mr-2 h-4 w-4 shrink-0 " />
259+ </ span >
260+ </ span >
261+ </ div >
262+ < span > { defaultName } </ span >
263+ </ div >
264+ </ >
265+ ) : (
266+ < span > unassigned</ span >
267+ ) }
268+ </ Button >
269+ </ PopoverTrigger >
270+ < PopoverContent className = "p-0" side = "right" align = "start" >
271+ < Command >
272+ < CommandInput placeholder = "Change client..." />
273+ < CommandList >
274+ < CommandEmpty > No results found.</ CommandEmpty >
275+ < CommandGroup >
276+ < CommandItem
277+ className = " hover:cursor-pointer"
278+ value = { undefined }
279+ onSelect = { ( ) => {
280+ setSelectedStatus ( null ) ;
281+ update ( null ) ;
282+ setOpen ( false ) ;
283+ } }
284+ >
285+ { /* <val.icon
286+ className={cn(
287+ "mr-2 h-4 w-4",
288+ val.value === selectedStatus?.value
289+ ? "opacity-100"
290+ : "opacity-40"
291+ )}
292+ /> */ }
293+ < span > Unassign</ span >
294+ </ CommandItem >
295+ { value . map ( ( val ) => (
296+ < CommandItem
297+ className = " hover:cursor-pointer"
298+ key = { val . value }
299+ value = { val }
300+ onSelect = { ( selected ) => {
301+ const user = value . find ( ( k ) => k . name === selected ) ;
302+ setSelectedStatus ( user ) ;
303+ update ( user ) ;
304+ setOpen ( false ) ;
305+ } }
306+ >
307+ { /* <val.icon
308+ className={cn(
309+ "mr-2 h-4 w-4",
310+ val.value === selectedStatus?.value
311+ ? "opacity-100"
312+ : "opacity-40"
313+ )}
314+ /> */ }
315+ < span > { val . name } </ span >
316+ </ CommandItem >
317+ ) ) }
318+ </ CommandGroup >
319+ </ CommandList >
320+ </ Command >
321+ </ PopoverContent >
322+ </ Popover >
323+ </ div >
324+ ) ;
325+ }
0 commit comments