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