Sink firms with no login to the bottom, and name the account type plainly

A firm with no stored Tradovate login can do nothing until someone enters
one, so it no longer interleaves by name with the firms that are actually
running. Sorted at render rather than in /api/firms, which keeps serving the
catalog in the master's own order. Name order is preserved within each group.

The account-type picker showed "Auto — Flex 50k Funded", which put the
mechanism before the answer in the one place the answer is what you are
reading. It shows the type's name now, or Unassigned when nothing matched.
That first entry still clears a manual pin; the dot beside the select is what
says a pin is in effect.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Brandon Li
2026-08-31 23:04:48 -05:00
co-authored by Claude Opus 5
parent 8bdc85080c
commit 3ce14d4928
2 changed files with 9 additions and 3 deletions
+8 -2
View File
@@ -159,7 +159,7 @@ function AccountTypeCell({ account, firm, onAssigned }: {
}`}
>
<option value="">
{account.accountTypeLabel ? `Auto — ${account.accountTypeLabel}` : 'Auto — unassigned'}
{account.accountTypeLabel ?? 'Unassigned'}
</option>
{firm.accounts.map((type) => (
<option key={type.id} value={type.id}>
@@ -604,6 +604,12 @@ export default function Home() {
}
};
// A firm with no stored login can do nothing until someone enters one, so it
// sits below the ones that are actually running rather than interleaving by
// name. Within each group, catalog order (by name) is preserved.
const orderedConfig = [...config].sort((a, b) =>
Number(b.hasCredentials) - Number(a.hasCredentials) || a.firm.localeCompare(b.firm));
// Count dead accounts across all firms for the toggle button label
const deadCount = firms.reduce((total, firmState) => {
const firmCfg = config.find((c) => c.id === firmState.firmId);
@@ -798,7 +804,7 @@ export default function Home() {
</td>
</tr>
) : (
config.map((cfg) => {
orderedConfig.map((cfg) => {
const state = firms.find((f) => f.firmId === cfg.id)
?? { firmId: cfg.id, firm: cfg.firm, connected: false, accounts: [] };
return (