MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / useIntegrationIcons

Function useIntegrationIcons

packages/react/src/pages/admin-users.tsx:159–182  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

157};
158
159const useIntegrationIcons = (): IconLookup => {
160 const catalog = useAtomValue(integrationsOptimisticAtom);
161 const integrationPlugins = useIntegrationPlugins();
162 const integrations = Option.getOrElse(
163 AsyncResult.value(catalog),
164 (): readonly Integration[] => [],
165 );
166
167 return (integration) => {
168 const slug = String(integration);
169 const found = integrations.find((row) => String(row.slug) === slug);
170 const name = found?.name || slug;
171 return {
172 icon: found
173 ? integrationPresetIconUrl(
174 { id: slug, kind: found.kind, name, url: found.displayUrl },
175 integrationPlugins,
176 )
177 : null,
178 url: found?.displayUrl ?? integrationInferredUrl({ id: slug, name }) ?? undefined,
179 name,
180 };
181 };
182};
183
184/** The catalog rows this view needs — slug plus kind, since `kind` is what says
185 * whether an integration can be connected at all (see

Callers 1

AdminUsersPageFunction · 0.85

Calls 3

useIntegrationPluginsFunction · 0.90
integrationPresetIconUrlFunction · 0.90
integrationInferredUrlFunction · 0.90

Tested by

no test coverage detected