(props: { pathname: string; onNavigate?: () => void })
| 99 | // ── IntegrationList ─────────────────────────────────────────────────────────── |
| 100 | |
| 101 | function IntegrationList(props: { pathname: string; onNavigate?: () => void }) { |
| 102 | const integrations = useAtomValue(integrationsOptimisticAtom); |
| 103 | const integrationPlugins = useIntegrationPlugins(); |
| 104 | |
| 105 | return AsyncResult.match(integrations, { |
| 106 | onInitial: () => <div className="px-2.5 py-2 text-xs text-muted-foreground">Loading…</div>, |
| 107 | onFailure: () => ( |
| 108 | <div className="px-2.5 py-2 text-xs text-muted-foreground">No integrations yet</div> |
| 109 | ), |
| 110 | onSuccess: ({ value }: { readonly value: readonly Integration[] }) => |
| 111 | value.length === 0 ? ( |
| 112 | <div className="px-2.5 py-2 text-sm leading-relaxed text-muted-foreground"> |
| 113 | No integrations yet |
| 114 | </div> |
| 115 | ) : ( |
| 116 | <div className="flex flex-col gap-px"> |
| 117 | {value.map((integration: Integration) => { |
| 118 | const slug = String(integration.slug); |
| 119 | const name = integration.name || slug; |
| 120 | const detailPath = `/integrations/${slug}`; |
| 121 | const active = |
| 122 | props.pathname === detailPath || props.pathname.startsWith(`${detailPath}/`); |
| 123 | return ( |
| 124 | <Link |
| 125 | key={slug} |
| 126 | to="/{-$orgSlug}/integrations/$namespace" |
| 127 | params={{ namespace: slug }} |
| 128 | onClick={props.onNavigate} |
| 129 | className={[ |
| 130 | "group flex items-center gap-2 rounded-md px-2.5 py-1.5 text-xs transition-colors", |
| 131 | active |
| 132 | ? "bg-sidebar-active text-foreground font-medium" |
| 133 | : "text-sidebar-foreground hover:bg-sidebar-active/60 hover:text-foreground", |
| 134 | ].join(" ")} |
| 135 | > |
| 136 | <IntegrationIconWithAccount |
| 137 | icon={integrationPresetIconUrl( |
| 138 | { id: slug, kind: integration.kind }, |
| 139 | integrationPlugins, |
| 140 | )} |
| 141 | integrationId={slug} |
| 142 | size="sm" |
| 143 | /> |
| 144 | <span className="flex-1 truncate">{name}</span> |
| 145 | </Link> |
| 146 | ); |
| 147 | })} |
| 148 | </div> |
| 149 | ), |
| 150 | }); |
| 151 | } |
| 152 | |
| 153 | // ── SidebarContent ─────────────────────────────────────────────────────── |
| 154 |
nothing calls this directly
no test coverage detected