+
}
- size="tiny"
type="text"
+ className="px-1"
+ icon={}
onClick={() => onDelete(filterIdx)}
/>
diff --git a/apps/studio/components/grid/components/header/sort/SortPopover.tsx b/apps/studio/components/grid/components/header/sort/SortPopover.tsx
index 80c3ef223ac..c157e7e03f7 100644
--- a/apps/studio/components/grid/components/header/sort/SortPopover.tsx
+++ b/apps/studio/components/grid/components/header/sort/SortPopover.tsx
@@ -1,12 +1,19 @@
import { useUrlState } from 'hooks'
import update from 'immutability-helper'
import { isEqual } from 'lodash'
+import { ChevronDown, List } from 'lucide-react'
import { useCallback, useMemo, useState } from 'react'
-import { Button, IconChevronDown, IconList, Popover } from 'ui'
-import { DropdownControl } from 'components/grid/components/common'
import { formatSortURLParams } from 'components/grid/SupabaseGrid.utils'
+import { DropdownControl } from 'components/grid/components/common'
import type { Sort, SupaTable } from 'components/grid/types'
+import {
+ Button,
+ PopoverContent_Shadcn_,
+ PopoverSeparator_Shadcn_,
+ PopoverTrigger_Shadcn_,
+ Popover_Shadcn_,
+} from 'ui'
import SortRow from './SortRow'
export interface SortPopoverProps {
@@ -16,38 +23,48 @@ export interface SortPopoverProps {
}
const SortPopover = ({ table, sorts, setParams }: SortPopoverProps) => {
+ const [open, setOpen] = useState(false)
+
const btnText =
(sorts || []).length > 0
? `Sorted by ${sorts.length} rule${sorts.length > 1 ? 's' : ''}`
: 'Sort'
+ const onApplySorts = (appliedSorts: Sort[]) => {
+ setParams((prevParams) => {
+ return {
+ ...prevParams,
+ sort: appliedSorts.map((sort) => `${sort.column}:${sort.ascending ? 'asc' : 'desc'}`),
+ }
+ })
+ }
+
return (
-
}
- >
-
-
+
+
+
+
+
+
+
+
)
}
export default SortPopover
-export interface SortOverlayProps extends SortPopoverProps {}
+export interface SortOverlayProps {
+ table: SupaTable
+ sorts: string[]
+ onApplySorts: (sorts: Sort[]) => void
+}
-const SortOverlay = ({ table, sorts: sortsFromUrl, setParams }: SortOverlayProps) => {
+const SortOverlay = ({ table, sorts: sortsFromUrl, onApplySorts }: SortOverlayProps) => {
const initialSorts = useMemo(
() => formatSortURLParams((sortsFromUrl as string[]) ?? []),
[sortsFromUrl]
@@ -68,15 +85,6 @@ const SortOverlay = ({ table, sorts: sortsFromUrl, setParams }: SortOverlayProps
setSorts([...sorts, { column: columnName as string, ascending: true }])
}
- function onApplySort() {
- setParams((prevParams) => {
- return {
- ...prevParams,
- sort: sorts.map((sort) => `${sort.column}:${sort.ascending ? 'asc' : 'desc'}`),
- }
- })
- }
-
const onDeleteSort = useCallback((column: string) => {
setSorts((currentSorts) => currentSorts.filter((sort) => sort.column !== column))
}, [])
@@ -125,7 +133,7 @@ const SortOverlay = ({ table, sorts: sortsFromUrl, setParams }: SortOverlayProps
)}
-
{columns && columns.length > 0 ? (
}
+ iconRight={}
className="sb-grid-dropdown__item-trigger"
>
- {`Pick ${sorts.length > 1 ? 'another' : 'a'} column to sort by`}
+ Pick {sorts.length > 1 ? 'another' : 'a'} column to sort by
) : (
All columns have been added
)}
-
diff --git a/apps/studio/styles/grid.scss b/apps/studio/styles/grid.scss
index a89bea20d98..dd28b121f6e 100644
--- a/apps/studio/styles/grid.scss
+++ b/apps/studio/styles/grid.scss
@@ -562,30 +562,6 @@
@apply block;
}
-/*
- header/filter/FilterDropdown
-*/
-
-.sb-grid-filter-popover {
- @apply overflow-visible;
-}
-
-.sb-grid-filter-popover__misc {
- @apply py-2;
-}
-
-.sb-grid-filter-popover__misc__text {
- @apply block;
-}
-
-/*
-header/filter/FilterRow
-*/
-
-.sb-grid-filter-row {
- @apply flex w-full items-center justify-between space-x-1;
-}
-
/*
header/sort/SortDropdown
*/
diff --git a/packages/ui/index.tsx b/packages/ui/index.tsx
index 95d157c16d3..6af504ed2ca 100644
--- a/packages/ui/index.tsx
+++ b/packages/ui/index.tsx
@@ -120,6 +120,7 @@ export {
PopoverTrigger as PopoverTrigger_Shadcn_,
PopoverContent as PopoverContent_Shadcn_,
PopoverAnchor as PopoverAnchor_Shadcn_,
+ PopoverSeparator as PopoverSeparator_Shadcn_,
} from './src/components/shadcn/ui/popover'
export {
diff --git a/packages/ui/src/components/shadcn/ui/popover.tsx b/packages/ui/src/components/shadcn/ui/popover.tsx
index 1c689228715..444fb8b0f28 100644
--- a/packages/ui/src/components/shadcn/ui/popover.tsx
+++ b/packages/ui/src/components/shadcn/ui/popover.tsx
@@ -53,4 +53,11 @@ const PopoverContent = React.forwardRef<
)
PopoverContent.displayName = 'PopoverContent'
-export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor }
+const PopoverSeparator = React.forwardRef
>(
+ ({ className, children, ...props }, ref) => (
+
+ )
+)
+PopoverSeparator.displayName = 'PopoverSeparator'
+
+export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor, PopoverSeparator }