()
| 157 | }; |
| 158 | |
| 159 | const 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 |
no test coverage detected