@@ -7,7 +7,14 @@ import {
77 DialogTrigger ,
88} from "@/components/ui/dialog" ;
99import { useDuckDBStore } from "@/stores/useDuckDBStore" ;
10- import { ChevronLeft , ChevronRight , Filter , Loader2 } from "lucide-react" ;
10+ import {
11+ ChevronLeft ,
12+ ChevronRight ,
13+ Filter ,
14+ Loader2 ,
15+ ChevronsLeft ,
16+ ChevronsRight ,
17+ } from "lucide-react" ;
1118import React , { useState } from "react" ;
1219import { Button } from "./ui/button" ;
1320import {
@@ -21,6 +28,13 @@ import { Input } from "@/components/ui/input";
2128import { Checkbox } from "@/components/ui/checkbox" ;
2229import { usePivotStore } from "@/stores/usePivotStore" ;
2330import { Table as Arrow } from "apache-arrow" ;
31+ import {
32+ Collapsible ,
33+ CollapsibleContent ,
34+ CollapsibleTrigger ,
35+ } from "@/components/ui/collapsible" ;
36+ import { ChevronDown , ChevronUp } from "lucide-react" ;
37+ import { Separator } from "./ui/separator" ;
2438
2539export default function FilterDialog ( {
2640 table,
@@ -40,6 +54,7 @@ export default function FilterDialog({
4054 const [ searchQuery , setSearchQuery ] = useState ( "" ) ;
4155 const [ currentPage , setCurrentPage ] = useState ( 1 ) ;
4256 const [ open , setOpen ] = useState ( false ) ;
57+ const [ isOpen , setIsOpen ] = useState ( true ) ;
4358 const itemsPerPage = 10 ;
4459
4560 const fetchData = async ( ) => {
@@ -113,7 +128,7 @@ export default function FilterDialog({
113128 < DialogTrigger >
114129 < Filter size = { 20 } className = "cursor-pointer hover:text-black" />
115130 </ DialogTrigger >
116- < DialogContent className = "bg-gray-700" >
131+ < DialogContent className = "bg-gray-700 max-h-[90vh] overflow-y-auto " >
117132 < DialogHeader >
118133 < DialogTitle > Add filter</ DialogTitle >
119134 < DialogDescription className = "text-white" >
@@ -177,7 +192,13 @@ export default function FilterDialog({
177192 </ TableBody >
178193 </ Table >
179194 </ div >
180- < div className = "flex justify-between items-center text-white" >
195+ < div className = "flex justify-between items-center text-white gap-2" >
196+ < Button
197+ onClick = { ( ) => setCurrentPage ( 1 ) }
198+ disabled = { currentPage === 1 }
199+ >
200+ < ChevronsLeft />
201+ </ Button >
181202 < Button
182203 onClick = { ( ) => setCurrentPage ( ( prev ) => Math . max ( prev - 1 , 1 ) ) }
183204 disabled = { currentPage === 1 }
@@ -195,13 +216,38 @@ export default function FilterDialog({
195216 >
196217 < ChevronRight />
197218 </ Button >
219+ < Button
220+ onClick = { ( ) => setCurrentPage ( totalPages ) }
221+ disabled = { currentPage === totalPages }
222+ >
223+ < ChevronsRight />
224+ </ Button >
198225 </ div >
199- < p className = "text-wrap break-all" >
200- Selected values: { `[${ selectedValues } ]` }
201- </ p >
202226 < Button onClick = { handleSubmit } className = "mt-4" >
203227 Apply Filter
204228 </ Button >
229+ < Collapsible open = { isOpen } onOpenChange = { setIsOpen } className = "mt-4" >
230+ < CollapsibleTrigger className = "flex items-center justify-between w-full text-white p-2 hover:bg-gray-600 rounded-md" >
231+ < span > Selected values ({ selectedValues . length } )</ span >
232+ { isOpen ? < ChevronUp size = { 16 } /> : < ChevronDown size = { 16 } /> }
233+ </ CollapsibleTrigger >
234+ < CollapsibleContent className = "mt-2" >
235+ < ul className = "space-y-1" >
236+ { selectedValues . map ( ( value , index ) => (
237+ < >
238+ < Separator orientation = "horizontal" />
239+ < li
240+ key = { index }
241+ className = "text-white px-2 py-1 w-full text-ellipsis break-all"
242+ title = { value }
243+ >
244+ { value }
245+ </ li >
246+ </ >
247+ ) ) }
248+ </ ul >
249+ </ CollapsibleContent >
250+ </ Collapsible >
205251 </ div >
206252 </ DialogContent >
207253 </ Dialog >
0 commit comments