MCPcopy Index your code
hub / github.com/coder/coder / useStatusFilterMenu

Function useStatusFilterMenu

site/src/pages/ConnectionLogPage/ConnectionLogFilter.tsx:108–126  ·  view source on GitHub ↗
({
	value,
	onChange,
}: Pick<UseFilterMenuOptions, "value" | "onChange">)

Source from the content-addressed store, hash-verified

106};
107
108export const useStatusFilterMenu = ({
109 value,
110 onChange,
111}: Pick<UseFilterMenuOptions, "value" | "onChange">) => {
112 const statusOptions: SelectFilterOption[] = ConnectionLogStatuses.map(
113 (status) => ({
114 value: status,
115 label: capitalize(status),
116 }),
117 );
118 return useFilterMenu({
119 onChange,
120 value,
121 id: "status",
122 getSelectedOption: async () =>
123 statusOptions.find((option) => option.value === value) ?? null,
124 getOptions: async () => statusOptions,
125 });
126};
127
128type StatusFilterMenu = ReturnType<typeof useStatusFilterMenu>;
129

Callers 1

ConnectionLogPageFunction · 0.90

Calls 3

useFilterMenuFunction · 0.90
capitalizeFunction · 0.85
findMethod · 0.80

Tested by

no test coverage detected