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

Function IntegrationGrid

packages/react/src/pages/integrations.tsx:155–234  ·  view source on GitHub ↗
(props: { integrations: readonly Integration[] })

Source from the content-addressed store, hash-verified

153// ---------------------------------------------------------------------------
154
155function IntegrationGrid(props: { integrations: readonly Integration[] }) {
156 const integrationPlugins = useIntegrationPlugins();
157 const pluginByKind = useMemo(() => {
158 const out = new Map<string, IntegrationPlugin>();
159 for (const p of integrationPlugins) out.set(p.key, p);
160 return out;
161 }, [integrationPlugins]);
162
163 const items = useMemo(() => groupIntegrations(props.integrations), [props.integrations]);
164
165 const renderEntry = (integration: Integration) => {
166 const pluginKey = KIND_TO_PLUGIN_KEY[integration.kind] ?? integration.kind;
167 const plugin = pluginByKind.get(pluginKey);
168 const SummaryComponent = plugin?.summary;
169 const slug = String(integration.slug);
170 const name = integration.name || slug;
171 return (
172 <CardStackEntry key={slug} asChild searchText={`${name} ${slug} ${integration.kind}`}>
173 <Link
174 to="/{-$orgSlug}/integrations/$namespace"
175 params={{ namespace: slug }}
176 data-testid={`integration-entry-${slug}`}
177 >
178 <IntegrationIconWithAccount
179 icon={integrationPresetIconUrl(
180 { id: slug, kind: integration.kind, name, url: integration.displayUrl },
181 integrationPlugins,
182 )}
183 integrationId={slug}
184 url={integration.displayUrl ?? integrationInferredUrl({ id: slug, name }) ?? undefined}
185 />
186 <CardStackEntryContent>
187 <CardStackEntryTitle>{name}</CardStackEntryTitle>
188 <CardStackEntryDescription>{slug}</CardStackEntryDescription>
189 </CardStackEntryContent>
190 <CardStackEntryActions>
191 {SummaryComponent && (
192 <Suspense fallback={null}>
193 <SummaryComponent integrationId={slug} />
194 </Suspense>
195 )}
196 <IntegrationHealthSummary integration={integration.slug} />
197 </CardStackEntryActions>
198 </Link>
199 </CardStackEntry>
200 );
201 };
202
203 const rendered: ReactNode[] = [];
204 let flatRun: Integration[] = [];
205 const flushFlat = () => {
206 if (flatRun.length === 0) return;
207 const run = flatRun;
208 flatRun = [];
209 rendered.push(
210 <CardStack key={`flat-${String(run[0]!.slug)}`} searchable>
211 <CardStackContent>{run.map(renderEntry)}</CardStackContent>
212 </CardStack>,

Callers

nothing calls this directly

Calls 6

useIntegrationPluginsFunction · 0.90
groupIntegrationsFunction · 0.90
flushFlatFunction · 0.85
pushMethod · 0.80
setMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected