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

Function useIntegrationIcons

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

Source from the content-addressed store, hash-verified

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