-
Notifications
You must be signed in to change notification settings - Fork 395
Expand file tree
/
Copy pathintegrations-header.tsx
More file actions
72 lines (66 loc) · 2 KB
/
Copy pathintegrations-header.tsx
File metadata and controls
72 lines (66 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
"use client"
import { Link2, Lock, LockKeyhole, Unlink2 } from "lucide-react"
import {
CatalogHeader,
type CatalogHeaderPillOption,
type CatalogHeaderSelectFilter,
} from "@/components/catalog/catalog-header"
export type IntegrationTypeFilter = "oauth" | "custom_oauth"
export type ConnectionFilter = "all" | "connected" | "not_connected"
interface IntegrationsHeaderProps {
searchQuery: string
onSearchChange: (query: string) => void
typeFilters: IntegrationTypeFilter[]
onTypeFilterToggle: (filter: IntegrationTypeFilter) => void
connectionFilter: ConnectionFilter
onConnectionFilterChange: (filter: ConnectionFilter) => void
displayIntegrationCount?: number
}
const TYPE_FILTER_OPTIONS: Array<
CatalogHeaderPillOption<IntegrationTypeFilter>
> = [
{ value: "oauth", label: "OAuth", icon: Lock },
{ value: "custom_oauth", label: "Custom OAuth", icon: LockKeyhole },
]
export function IntegrationsHeader({
searchQuery,
onSearchChange,
typeFilters,
onTypeFilterToggle,
connectionFilter,
onConnectionFilterChange,
displayIntegrationCount = 0,
}: IntegrationsHeaderProps) {
const selectFilters: CatalogHeaderSelectFilter[] = [
{
key: "connection",
value: connectionFilter,
onValueChange: (value) =>
onConnectionFilterChange(value as ConnectionFilter),
placeholder: "Connection",
allValue: "all",
options: [
{ value: "all", label: "All connections" },
{ value: "connected", label: "Connected", icon: Link2 },
{
value: "not_connected",
label: "Not connected",
icon: Unlink2,
},
],
},
]
return (
<CatalogHeader
searchQuery={searchQuery}
onSearchChange={onSearchChange}
searchPlaceholder="Search integrations..."
pillFilters={TYPE_FILTER_OPTIONS}
activePillFilters={typeFilters}
onPillFilterToggle={onTypeFilterToggle}
selectFilters={selectFilters}
displayCount={displayIntegrationCount}
countLabel="integrations"
/>
)
}