Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors
TypeScript a2aai-agentsai-gatewayanthropicclaudeclaude-codeclinecodexcopilotcursordeepseekfree-aigeminikimillm-gatewaymcpopenaiopenai-proxyqwentoken-saver
"use client";
import React from "react";
import { type ConnectionRowConnection } from "./ConnectionRow";
import ConnectionRow from "./ConnectionRow";
import { ActionBar, Button, DistributeProxiesButton, FilterPills } from "@/shared/components";
import { pickDisplayValue } from "@/shared/utils/maskEmail";
import { readBooleanToggle, providerCountText } from "../providerPageHelpers";
import { compareTr } from "@/shared/utils/turkishText";
import type { CodexGlobalServiceMode } from "@/lib/providers/codexFastTier";
import { supportsProviderQuota } from "@/shared/utils/providerQuotaVisibility";
import type { ConnectionDeleteConfirmState } from "../hooks/useConnectionDeleteConfirm";
import type { ProviderQuotaCacheEntry } from "../hooks/useProviderQuota";
import { filterConnectionsByQuery } from "../connectionsSearchFilter";
type ConnectionsListPanelProps = {
connections: ConnectionRowConnection[];
providerId: string;
isCcCompatible: boolean;
isOAuth: boolean;
codexGlobalServiceMode: CodexGlobalServiceMode | string;
selectedIds: Set<string>;
batchUpdating: string | null;
batchRetesting: boolean;
batchDeleting: boolean;
batchTesting: boolean;
retestingId: string | null;
refreshingId: string | null;
distributingProxies: boolean;
healthFilter: string;
page: number;
accountSearch: string;
PAGE_SIZE: number;
connProxyMap: Record<
string,
{ proxy?: { host?: string; name?: string }; level?: string } | undefined
>;
proxyConfig: any;
applyingCodexAuthId: string | null;
exportingCodexAuthId: string | null;
applyingClaudeAuthId: string | null;
exportingClaudeAuthId: string | null;
emailsVisible: boolean;
// Setters
setSelectedIds: React.Dispatch<React.SetStateAction<Set<string>>>;
setPage: React.Dispatch<React.SetStateAction<number>>;
setHealthFilter: (v: string) => void;
setAccountSearch: (v: string) => void;
// Callbacks from useProviderConnections
deleteConfirm: ConnectionDeleteConfirmState;
handleUpdateConnectionStatus: (id: string, isActive: boolean) => void;
handleToggleRateLimit: (id: string, enabled: boolean) => void;
handleToggleQuotaVisibility: (id: string, visible: boolean) => void;
handleToggleClaudeExtraUsage: (id: string, enabled: boolean) => void;
handleToggleCodexPaidCredits: (id: string, enabled: boolean) => void;
canAutoSync?: boolean;
handleToggleConnectionAutoSync?: (connectionId: string, enabled: boolean) => void;
handleToggleCliproxyapiMode: (id: string, enabled: boolean) => void;
handleSetUpstreamProxyMode: (
mode: "native" | "cliproxyapi" | "dario" | "fallback",
fallbackBackend?: "cliproxyapi" | "dario"
) => void;
upstreamProxyMode: "native" | "cliproxyapi" | "dario" | "fallback";
upstreamProxyFallbackBackend: "cliproxyapi" | "dario";
handleToggleCodexLimit: (id: string, type: "use5h" | "useWeekly", enabled: boolean) => void;
handleToggleProxyEnabled: (id: string, enabled: boolean) => void;
handleTogglePerKeyProxyEnabled: (id: string, enabled: boolean) => void;
handleRetestConnection: (id: string) => void;
handleRefreshToken: (id: string) => void;
handleSwapPriority: (a: ConnectionRowConnection, b: ConnectionRowConnection) => void;
handleBatchSetActive: (active: boolean) => void;
handleBatchDeleteOpenModal: () => void;
handleBatchRetest: () => void;
handleToggleSelectOne: (id: string) => void;
handleToggleSelectAll: () => void;
handleDistributeProxies: (tag?: string) => void;
cpaProviderEnabled: boolean;
// Per-account quota strip (useProviderQuota) — threaded to every row.
quotaByConnectionId: Record<string, ProviderQuotaCacheEntry>;
quotaRefreshingIds: ReadonlySet<string>;
handleRefreshQuota: (id: string) => void;
// Modal triggers (all pass through from client, no closing over client internals)
onOpenEditModal: (conn: ConnectionRowConnection) => void;
onOpenOAuth: (conn: ConnectionRowConnection) => void;
onSetProxyTarget: (target: { level: string; id: string; label: string }) => void;
onOpenApplyCodexModal: (connId: string) => void;
onExportCodexAuthFile: (connId: string) => void;
onOpenApplyClaudeModal: (connId: string) => void;
onExportClaudeAuthFile: (connId: string) => void;
gateConnectionFlow: (callback: () => void) => void;
t: any; // ProviderMessageTranslator
};
function quotaVisibilityHandler(
supported: boolean,
connectionId: string,
toggle: (id: string, visible: boolean) => void
) {
return supported ? (visible: boolean) => toggle(connectionId, visible) : undefined;
}
// #7643 — extracted so the two ConnectionRow render call sites (already
// oversized map callbacks) don't each pick up a new `||` decision point.
function resolveConnProxyField(
connProxyMap: ConnectionsListPanelProps["connProxyMap"],
connId: string,
field: "host" | "name"
): string | null {
return connProxyMap[connId]?.proxy?.[field] || null;
}
export default function ConnectionsListPanel({
connections,
providerId,
isCcCompatible,
isOAuth,
codexGlobalServiceMode,
selectedIds,
batchUpdating,
batchRetesting,
batchDeleting,
batchTesting,
retestingId,
refreshingId,
distributingProxies,
healthFilter,
page,
accountSearch,
PAGE_SIZE,
connProxyMap,
proxyConfig,
applyingCodexAuthId,
exportingCodexAuthId,
applyingClaudeAuthId,
exportingClaudeAuthId,
emailsVisible,
setSelectedIds,
setPage,
setHealthFilter,
setAccountSearch,
deleteConfirm,
handleUpdateConnectionStatus,
handleToggleRateLimit,
handleToggleQuotaVisibility,
handleToggleClaudeExtraUsage,
handleToggleCodexPaidCredits,
handleToggleConnectionAutoSync,
handleToggleCliproxyapiMode,
handleSetUpstreamProxyMode,
upstreamProxyMode,
upstreamProxyFallbackBackend,
handleToggleCodexLimit,
handleToggleProxyEnabled,
handleTogglePerKeyProxyEnabled,
handleRetestConnection,
handleRefreshToken,
handleSwapPriority,
handleBatchSetActive,
handleBatchDeleteOpenModal,
handleBatchRetest,
handleToggleSelectOne,
handleToggleSelectAll,
handleDistributeProxies,
cpaProviderEnabled,
quotaByConnectionId,
quotaRefreshingIds,
handleRefreshQuota,
canAutoSync,
onOpenEditModal,
onOpenOAuth,
onSetProxyTarget,
onOpenApplyCodexModal,
onExportCodexAuthFile,
onOpenApplyClaudeModal,
onExportClaudeAuthFile,
gateConnectionFlow,
t,
}: ConnectionsListPanelProps) {
const sorted = [...connections].sort((a, b) => (a.priority || 0) - (b.priority || 0));
const quotaSupported = supportsProviderQuota(providerId);
const hasAnyTag = sorted.some((c) => c.providerSpecificData?.tag as string | undefined);
const allSelected = selectedIds.size === connections.length && connections.length > 0;
const someSelected = selectedIds.size > 0 && selectedIds.size < connections.length;
const bulkBusy = batchUpdating !== null || batchRetesting || batchDeleting || batchTesting;
const bulkActions = selectedIds.size > 0 && (
<ActionBar>
<Button
variant="secondary"
size="sm"
icon="toggle_on"
loading={batchUpdating === "activate"}
disabled={bulkBusy && batchUpdating !== "activate"}
onClick={() => handleBatchSetActive(true)}
>
{t("batchActivateSelected")}
</Button>
<Button
variant="secondary"
size="sm"
icon="toggle_off"
loading={batchUpdating === "deactivate"}
disabled={bulkBusy && batchUpdating !== "deactivate"}
onClick={() => handleBatchSetActive(false)}
>
{t("batchDeactivateSelected")}
</Button>
<Button
variant="secondary"
size="sm"
icon="play_arrow"
loading={batchRetesting}
disabled={(bulkBusy && !batchRetesting) || !!retestingId}
onClick={handleBatchRetest}
>
{t("batchRetestSelected")}
</Button>
<Button
variant="danger"
size="sm"
icon="delete"
loading={batchDeleting}
disabled={bulkBusy && !batchDeleting}
onClick={handleBatchDeleteOpenModal}
>
{t("batchDeleteSelected", { count: selectedIds.size })}
</Button>
</ActionBar>
);
const isHealthy = (c: ConnectionRowConnection): boolean => {
const s = c.testStatus;
return c.isActive !== false && (!s || s === "active" || s === "success");
};
const STATUS_FILTER_OPTIONS = [
{ value: "all", label: t("filterAll", "All") },
{ value: "active", label: t("filterActive", "Active") },
{ value: "error", label: t("filterError", "Error") },
{ value: "banned", label: t("filterBanned", "Banned") },
{
value: "credits_exhausted",
label: t("filterCreditsExhausted", "Credits Exhausted"),
},
];
const healthFiltered =
healthFilter === "all"
? sorted
: sorted.filter((c) => {
if (healthFilter === "active") return isHealthy(c);
if (healthFilter === "error")
return (
!isHealthy(c) && c.testStatus !== "banned" && c.testStatus !== "credits_exhausted"
);
return c.testStatus === healthFilter;
});
// #7937 — substring search over id/tag/name/email, applied across the FULL
// in-memory list (not just the current page).
const filtered = filterConnectionsByQuery(accountSearch, healthFiltered);
const totalFilteredPages = Math.max(1, Math.ceil(filtered.length / PAGE_SIZE));
const clampedPage = Math.min(page, totalFilteredPages - 1);
const pageStart = clampedPage * PAGE_SIZE;
const pageEnd = pageStart + PAGE_SIZE;
const accountSearchInput = (
<div className="relative w-full sm:w-auto sm:min-w-[160px] sm:max-w-[220px]">
<span className="material-symbols-outlined pointer-events-none absolute left-2 top-1/2 -translate-y-1/2 text-[15px] text-text-muted">
search
</span>
<input
type="text"
value={accountSearch}
onChange={(e) => setAccountSearch(e.target.value)}
placeholder={t("accountSearchPlaceholder", "Search accounts…")}
aria-label={t("accountSearchPlaceholder", "Search accounts…")}
className="w-full rounded-lg border border-border bg-sidebar/50 py-1.5 pl-7 pr-3 text-xs text-text-main placeholder:text-text-muted focus:outline-none focus:ring-1 focus:ring-primary"
/>
</div>
);
const filterPills = (
<FilterPills
options={STATUS_FILTER_OPTIONS}
value={healthFilter}
onChange={(v) => {
setHealthFilter(v);
setPage(0);
setSelectedIds(new Set());
}}
/>
);
const paginationBar =
totalFilteredPages > 1 ? (
<div className="flex items-center justify-between px-3 py-2 border-t border-border">
<span className="text-xs text-text-muted">
{pageStart + 1}–{Math.min(pageEnd, filtered.length)} / {filtered.length}
</span>
<div className="flex items-center gap-1">
<Button
variant="ghost"
size="sm"
icon="chevron_left"
disabled={clampedPage === 0}
onClick={() => setPage((p) => Math.max(0, p - 1))}
/>
<span className="text-xs text-text-muted min-w-[4rem] text-center">
{clampedPage + 1} / {totalFilteredPages}
</span>
<Button
variant="ghost"
size="sm"
icon="chevron_right"
disabled={clampedPage >= totalFilteredPages - 1}
onClick={() => setPage((p) => Math.min(totalFilteredPages - 1, p + 1))}
/>
</div>
</div>
) : null;
if (!hasAnyTag) {
const pageConnections = filtered.slice(pageStart, pageEnd);
const allSelectedPage =
pageConnections.length > 0 && pageConnections.every((c) => selectedIds.has(c.id));
const someSelectedPage = pageConnections.some((c) => selectedIds.has(c.id));
return (
<>
<div className="flex flex-col sm:flex-row items-start sm:items-center justify-between gap-2 px-3 py-2 bg-muted/50 rounded-t-lg border border-b-0 border-border">
<div className="flex w-full items-center gap-2 flex-wrap sm:w-auto">
<label className="flex items-center gap-2 cursor-pointer select-none">
<input
type="checkbox"
checked={allSelectedPage}
ref={(el) => {
if (el) el.indeterminate = someSelectedPage;
}}
onChange={() => {
if (allSelectedPage) {
const toRemove = new Set(pageConnections.map((c) => c.id));
setSelectedIds((prev) => {
const next = new Set(prev);
for (const id of toRemove) next.delete(id);
return next;
});
} else {
setSelectedIds((prev) => {
const next = new Set(prev);
for (const c of pageConnections) next.add(c.id);
return next;
});
}
}}
className="w-4 h-4 rounded border-border text-primary focus:ring-primary/30 cursor-pointer"
/>
<span className="text-sm font-medium text-text-muted">
{selectedIds.size > 0
? providerCountText(
t,
"selectedCount",
selectedIds.size,
"{count} selected",
"{count} selected"
)
: providerCountText(
t,
"accountsCount",
filtered.length,
"{count} account",
"{count} accounts"
)}
</span>
</label>
{accountSearchInput}
{filterPills}
</div>
{bulkActions}
</div>
{paginationBar}
<div className="flex flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03] border border-t-0 border-border rounded-b-lg overflow-hidden">
{pageConnections.length === 0 ? (
<div className="px-3 py-6 text-center text-sm text-text-muted">
{t("noFilteredConnections", "No connections match the current filter.")}
</div>
) : (
pageConnections.map((conn, index) => (
<ConnectionRow
key={conn.id}
connection={conn}
isOAuth={conn.authType === "oauth"}
isClaude={providerId === "claude"}
codexGlobalServiceMode={codexGlobalServiceMode}
isFirst={index === 0}
isLast={index === pageConnections.length - 1}
isSelected={selectedIds.has(conn.id)}
onToggleSelect={() => handleToggleSelectOne(conn.id)}
onMoveUp={() => handleSwapPriority(conn, sorted[index - 1])}
onMoveDown={() => handleSwapPriority(conn, sorted[index + 1])}
onToggleActive={(isActive) => handleUpdateConnectionStatus(conn.id, isActive)}
onToggleRateLimit={(enabled) => handleToggleRateLimit(conn.id, enabled)}
onToggleQuotaVisibility={quotaVisibilityHandler(
quotaSupported,
conn.id,
handleToggleQuotaVisibility
)}
onToggleClaudeExtraUsage={(enabled) =>
handleToggleClaudeExtraUsage(conn.id, enabled)
}
onToggleCodexPaidCredits={(enabled) =>
handleToggleCodexPaidCredits(conn.id, enabled)
}
onToggleAutoSync={
canAutoSync && handleToggleConnectionAutoSync
? (enabled) => handleToggleConnectionAutoSync(conn.id, enabled)
: undefined
}
isCodex={providerId === "codex" || providerId === "codex-app-server"}
isCcCompatible={isCcCompatible}
cliproxyapiEnabled={cpaProviderEnabled}
onToggleCliproxyapiMode={(enabled) => handleToggleCliproxyapiMode(conn.id, enabled)}
upstreamProxyMode={upstreamProxyMode}
upstreamProxyFallbackBackend={upstreamProxyFallbackBackend}
onSetUpstreamProxyMode={handleSetUpstreamProxyMode}
onToggleCodex5h={(enabled) => handleToggleCodexLimit(conn.id, "use5h", enabled)}
onToggleCodexWeekly={(enabled) =>
handleToggleCodexLimit(conn.id, "useWeekly", enabled)
}
onRetest={() => handleRetestConnection(conn.id)}
isRetesting={retestingId === conn.id}
onEdit={() => onOpenEditModal(conn)}
onDelete={() =>
deleteConfirm.request(
conn.id,
pickDisplayValue([conn.name, conn.email], emailsVisible, conn.id)
)
}
onReauth={
conn.authType === "oauth"
? () => gateConnectionFlow(() => onOpenOAuth(conn))
: undefined
}
onRefreshToken={
conn.authType === "oauth" ? () => handleRefreshToken(conn.id) : undefined
}
isRefreshing={refreshingId === conn.id}
onApplyCodexAuthLocal={
providerId === "codex" ? () => onOpenApplyCodexModal(conn.id) : undefined
}
isApplyingCodexAuthLocal={applyingCodexAuthId === conn.id}
onExportCodexAuthFile={
providerId === "codex" ? () => onExportCodexAuthFile(conn.id) : undefined
}
isExportingCodexAuthFile={exportingCodexAuthId === conn.id}
onApplyClaudeAuthLocal={
providerId === "claude" ? () => onOpenApplyClaudeModal(conn.id) : undefined
}
isApplyingClaudeAuthLocal={applyingClaudeAuthId === conn.id}
onExportClaudeAuthFile={
providerId === "claude" ? () => onExportClaudeAuthFile(conn.id) : undefined
}
isExportingClaudeAuthFile={exportingClaudeAuthId === conn.id}
onProxy={() =>
onSetProxyTarget({
level: "key",
id: conn.id,
label: pickDisplayValue([conn.name, conn.email], emailsVisible, conn.id),
})
}
hasProxy={!!connProxyMap[conn.id]?.proxy}
proxySource={connProxyMap[conn.id]?.level || null}
proxyHost={resolveConnProxyField(connProxyMap, conn.id, "host")}
proxyName={resolveConnProxyField(connProxyMap, conn.id, "name")}
proxyEnabled={readBooleanToggle(conn.proxyEnabled, true)}
onToggleProxyEnabled={(enabled) => handleToggleProxyEnabled(conn.id, enabled)}
perKeyProxyEnabled={readBooleanToggle(conn.perKeyProxyEnabled, false)}
onTogglePerKeyProxyEnabled={(enabled) =>
handleTogglePerKeyProxyEnabled(conn.id, enabled)
}
quotaCache={quotaByConnectionId[conn.id]}
quotaRefreshing={quotaRefreshingIds.has(conn.id)}
onRefreshQuota={() => handleRefreshQuota(conn.id)}
/>
))
)}
</div>
{paginationBar}
</>
);
}
// Build ordered tag groups: untagged first, then alphabetically. Group
// ordering + per-tag totals come from the FULL filtered set so the tag
// order/count stay stable across pages; row rendering below only shows the
// slice that belongs to the current page (#7937 — tagged view pagination).
const groupMap = new Map<string, ConnectionRowConnection[]>();
for (const conn of filtered) {
const tag = (conn.providerSpecificData?.tag as string | undefined)?.trim() || "";
if (!groupMap.has(tag)) groupMap.set(tag, []);
groupMap.get(tag)!.push(conn);
}
const groupKeys = Array.from(groupMap.keys()).sort((a, b) => {
if (a === "") return -1;
if (b === "") return 1;
return compareTr(a, b);
});
const pageConnectionsTagged = filtered.slice(pageStart, pageEnd);
const pagedGroupMap = new Map<string, ConnectionRowConnection[]>();
for (const conn of pageConnectionsTagged) {
const tag = (conn.providerSpecificData?.tag as string | undefined)?.trim() || "";
if (!pagedGroupMap.has(tag)) pagedGroupMap.set(tag, []);
pagedGroupMap.get(tag)!.push(conn);
}
const visibleGroupKeys = groupKeys.filter((tag) => (pagedGroupMap.get(tag)?.length ?? 0) > 0);
return (
<>
{selectedIds.size > 0 || connections.length > 0 ? (
<div className="flex flex-col sm:flex-row items-start sm:items-center justify-between gap-2 px-3 py-2 bg-muted/50 rounded-t-lg border border-b-0 border-border">
<div className="flex w-full items-center gap-2 flex-wrap sm:w-auto">
<label className="flex items-center gap-2 cursor-pointer select-none">
<input
type="checkbox"
checked={allSelected}
ref={(el) => {
if (el) el.indeterminate = someSelected;
}}
onChange={handleToggleSelectAll}
className="w-4 h-4 rounded border-border text-primary focus:ring-primary/30 cursor-pointer"
/>
<span className="text-sm font-medium text-text-muted">
{selectedIds.size > 0
? providerCountText(
t,
"selectedCount",
selectedIds.size,
"{count} selected",
"{count} selected"
)
: providerCountText(
t,
"accountsCount",
filtered.length,
"{count} account",
"{count} accounts"
)}
</span>
</label>
{accountSearchInput}
{filterPills}
</div>
<div className="flex flex-wrap items-center justify-end gap-2">
{/* Distribute Proxies lives in the provider toolbar (top action bar);
removed the duplicate here that rendered simultaneously when nothing
was selected. Per-tag groups keep their own scoped button. */}
{bulkActions}
</div>
</div>
) : null}
{paginationBar}
<div className="flex flex-col gap-0 border border-t-0 border-border rounded-b-lg overflow-hidden">
{visibleGroupKeys.map((tag, gi) => {
const groupConns = pagedGroupMap.get(tag)!;
const groupTotal = groupMap.get(tag)!.length;
return (
<div
key={tag || "__untagged__"}
className={
gi > 0 ? "border-t border-black/[0.06] dark:border-white/[0.06] mt-1 pt-1" : ""
}
>
{tag && (
<div className="flex items-center gap-2 px-3 pt-2 pb-1">
<span className="material-symbols-outlined text-[13px] text-text-muted/50">
label
</span>
<span className="text-[11px] font-semibold uppercase tracking-widest text-text-muted/60 select-none">
{tag}
</span>
<div className="flex-1 h-px bg-black/[0.04] dark:bg-white/[0.04]" />
<DistributeProxiesButton
onDistribute={async () => {
await handleDistributeProxies(tag);
}}
disabled={batchTesting || !!retestingId}
size="sm"
/>
<span className="text-[10px] text-text-muted/40">{groupTotal}</span>
</div>
)}
<div className="flex flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]">
{groupConns.map((conn, index) => (
<ConnectionRow
key={conn.id}
connection={conn}
isOAuth={conn.authType === "oauth"}
isClaude={providerId === "claude"}
codexGlobalServiceMode={codexGlobalServiceMode}
isFirst={gi === 0 && index === 0}
isLast={gi === visibleGroupKeys.length - 1 && index === groupConns.length - 1}
isSelected={selectedIds.has(conn.id)}
onToggleSelect={() => handleToggleSelectOne(conn.id)}
onMoveUp={() => handleSwapPriority(conn, sorted[sorted.indexOf(conn) - 1])}
onMoveDown={() => handleSwapPriority(conn, sorted[sorted.indexOf(conn) + 1])}
onToggleActive={(isActive) => handleUpdateConnectionStatus(conn.id, isActive)}
onToggleRateLimit={(enabled) => handleToggleRateLimit(conn.id, enabled)}
onToggleQuotaVisibility={quotaVisibilityHandler(
quotaSupported,
conn.id,
handleToggleQuotaVisibility
)}
onToggleClaudeExtraUsage={(enabled) =>
handleToggleClaudeExtraUsage(conn.id, enabled)
}
onToggleCodexPaidCredits={(enabled) =>
handleToggleCodexPaidCredits(conn.id, enabled)
}
onToggleAutoSync={
canAutoSync && handleToggleConnectionAutoSync
? (enabled) => handleToggleConnectionAutoSync(conn.id, enabled)
: undefined
}
isCodex={providerId === "codex" || providerId === "codex-app-server"}
isCcCompatible={isCcCompatible}
cliproxyapiEnabled={cpaProviderEnabled}
onToggleCliproxyapiMode={(enabled) =>
handleToggleCliproxyapiMode(conn.id, enabled)
}
upstreamProxyMode={upstreamProxyMode}
upstreamProxyFallbackBackend={upstreamProxyFallbackBackend}
onSetUpstreamProxyMode={handleSetUpstreamProxyMode}
onToggleCodex5h={(enabled) => handleToggleCodexLimit(conn.id, "use5h", enabled)}
onToggleCodexWeekly={(enabled) =>
handleToggleCodexLimit(conn.id, "useWeekly", enabled)
}
onRetest={() => handleRetestConnection(conn.id)}
isRetesting={retestingId === conn.id}
onEdit={() => onOpenEditModal(conn)}
onDelete={() =>
deleteConfirm.request(
conn.id,
pickDisplayValue([conn.name, conn.email], emailsVisible, conn.id)
)
}
onReauth={
conn.authType === "oauth"
? () => gateConnectionFlow(() => onOpenOAuth(conn))
: undefined
}
onRefreshToken={
conn.authType === "oauth" ? () => handleRefreshToken(conn.id) : undefined
}
isRefreshing={refreshingId === conn.id}
onApplyCodexAuthLocal={
providerId === "codex" ? () => onOpenApplyCodexModal(conn.id) : undefined
}
isApplyingCodexAuthLocal={applyingCodexAuthId === conn.id}
onExportCodexAuthFile={
providerId === "codex" ? () => onExportCodexAuthFile(conn.id) : undefined
}
isExportingCodexAuthFile={exportingCodexAuthId === conn.id}
onApplyClaudeAuthLocal={
providerId === "claude" ? () => onOpenApplyClaudeModal(conn.id) : undefined
}
isApplyingClaudeAuthLocal={applyingClaudeAuthId === conn.id}
onExportClaudeAuthFile={
providerId === "claude" ? () => onExportClaudeAuthFile(conn.id) : undefined
}
isExportingClaudeAuthFile={exportingClaudeAuthId === conn.id}
onProxy={() =>
onSetProxyTarget({
level: "key",
id: conn.id,
label: pickDisplayValue([conn.name, conn.email], emailsVisible, conn.id),
})
}
hasProxy={!!connProxyMap[conn.id]?.proxy}
proxySource={connProxyMap[conn.id]?.level || null}
proxyHost={resolveConnProxyField(connProxyMap, conn.id, "host")}
proxyName={resolveConnProxyField(connProxyMap, conn.id, "name")}
proxyEnabled={readBooleanToggle(conn.proxyEnabled, true)}
onToggleProxyEnabled={(enabled) => handleToggleProxyEnabled(conn.id, enabled)}
perKeyProxyEnabled={readBooleanToggle(conn.perKeyProxyEnabled, false)}
onTogglePerKeyProxyEnabled={(enabled) =>
handleTogglePerKeyProxyEnabled(conn.id, enabled)
}
quotaCache={quotaByConnectionId[conn.id]}
quotaRefreshing={quotaRefreshingIds.has(conn.id)}
onRefreshQuota={() => handleRefreshQuota(conn.id)}
/>
))}
</div>
</div>
);
})}
</div>
{paginationBar}
</>
);
}