(props: { pathname: string; onNavigate?: () => void })
| 182 | |
| 183 | // `pathname` is scope-relative (org-slug prefix already stripped). |
| 184 | function IntegrationList(props: { pathname: string; onNavigate?: () => void }) { |
| 185 | const integrations = useAtomValue(integrationsOptimisticAtom); |
| 186 | const integrationPlugins = useIntegrationPlugins(); |
| 187 | |
| 188 | return AsyncResult.match(integrations, { |
| 189 | onInitial: () => ( |
| 190 | <div className="flex flex-col gap-1 px-2.5 py-1"> |
| 191 | {[80, 65, 72, 58, 68].map((w, i) => ( |
| 192 | <div key={i} className="flex items-center gap-2 rounded-md py-1.5"> |
| 193 | <Skeleton className="size-3.5 shrink-0 rounded" /> |
| 194 | <Skeleton className="h-3" style={{ width: `${w}%` }} /> |
| 195 | </div> |
| 196 | ))} |
| 197 | </div> |
| 198 | ), |
| 199 | onFailure: () => ( |
| 200 | <div className="px-2.5 py-2 text-xs text-muted-foreground">No integrations yet</div> |
| 201 | ), |
| 202 | onSuccess: ({ value }) => |
| 203 | value.length === 0 ? ( |
| 204 | <div className="px-2.5 py-2 text-sm leading-relaxed text-muted-foreground"> |
| 205 | No integrations yet |
| 206 | </div> |
| 207 | ) : ( |
| 208 | <div className="flex flex-col gap-px"> |
| 209 | {value.map((integration: Integration) => { |
| 210 | const slug = String(integration.slug); |
| 211 | const name = integration.name || slug; |
| 212 | const detailPath = `/integrations/${slug}`; |
| 213 | const active = |
| 214 | props.pathname === detailPath || props.pathname.startsWith(`${detailPath}/`); |
| 215 | return ( |
| 216 | <Link |
| 217 | key={slug} |
| 218 | to="/{-$orgSlug}/integrations/$namespace" |
| 219 | params={{ namespace: slug }} |
| 220 | onClick={props.onNavigate} |
| 221 | className={[ |
| 222 | "group flex items-center gap-2 rounded-md px-2.5 py-1.5 text-xs transition-colors", |
| 223 | active |
| 224 | ? "bg-sidebar-active text-foreground font-medium" |
| 225 | : "text-sidebar-foreground hover:bg-sidebar-active/60 hover:text-foreground", |
| 226 | ].join(" ")} |
| 227 | > |
| 228 | <IntegrationFavicon |
| 229 | icon={integrationPresetIconUrl( |
| 230 | { id: slug, kind: integration.kind, name, url: integration.displayUrl }, |
| 231 | integrationPlugins, |
| 232 | )} |
| 233 | integrationId={slug} |
| 234 | url={ |
| 235 | integration.displayUrl ?? |
| 236 | integrationInferredUrl({ id: slug, name }) ?? |
| 237 | undefined |
| 238 | } |
| 239 | /> |
| 240 | <span className="flex-1 truncate">{name}</span> |
| 241 | </Link> |
nothing calls this directly
no test coverage detected