MCPcopy Create free account
hub / github.com/coder/coder / useStatusFilterMenu

Function useStatusFilterMenu

site/src/components/Filter/UsersFilter.tsx:24–53  ·  view source on GitHub ↗
({
	value,
	onChange,
}: Pick<UseFilterMenuOptions, "value" | "onChange">)

Source from the content-addressed store, hash-verified

22};
23
24export const useStatusFilterMenu = ({
25 value,
26 onChange,
27}: Pick<UseFilterMenuOptions, "value" | "onChange">) => {
28 const statusOptions: SelectFilterOption[] = [
29 {
30 value: "active",
31 label: "Active",
32 startIcon: <StatusIndicatorDot variant="success" />,
33 },
34 {
35 value: "dormant",
36 label: "Dormant",
37 startIcon: <StatusIndicatorDot variant="warning" />,
38 },
39 {
40 value: "suspended",
41 label: "Suspended",
42 startIcon: <StatusIndicatorDot variant="inactive" />,
43 },
44 ];
45 return useFilterMenu({
46 onChange,
47 value,
48 id: "status",
49 getSelectedOption: async () =>
50 statusOptions.find((option) => option.value === value) ?? null,
51 getOptions: async () => statusOptions,
52 });
53};
54
55type StatusFilterMenu = ReturnType<typeof useStatusFilterMenu>;
56

Callers 1

UsersPageFunction · 0.90

Calls 2

useFilterMenuFunction · 0.90
findMethod · 0.80

Tested by

no test coverage detected