Skip to content

Commit 4b5931f

Browse files
mcintyre94claude
andauthored
Add empty state for Connect page when no accounts exist (#29)
When a dApp requests connection but the user has no accounts, show a helpful message explaining they need to add an account first, instead of showing an empty form with a confusing "Connect 0 Accounts" button. Fixes #8 Co-authored-by: Claude <noreply@anthropic.com>
1 parent 1ba4e04 commit 4b5931f

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

entrypoints/sidepanel/routes/Connect.tsx

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
useLoaderData,
1010
useRouteLoaderData,
1111
} from "react-router-dom";
12-
import { Box, Button, Group, Stack, Title } from "@mantine/core";
12+
import { Box, Button, Group, Stack, Text, Title } from "@mantine/core";
1313
import AccountDisplay from "../components/AccountDisplay";
1414
import TagFilters from "../components/TagFilters";
1515
import { getFilteredAccountsData } from "../utils/filterAccounts";
@@ -274,6 +274,44 @@ export default function Connect() {
274274
);
275275
}, []);
276276

277+
if (allAccounts.length === 0) {
278+
return (
279+
<Stack gap="lg" align="flex-start">
280+
<Title order={3}>
281+
Connect to {forOrigin}
282+
</Title>
283+
284+
<Stack gap="md" py="xl">
285+
<Text size="lg" c="dimmed">
286+
You don't have any accounts yet.
287+
</Text>
288+
<Text size="sm" c="dimmed">
289+
Add an account first, then you can connect it to this app.
290+
</Text>
291+
</Stack>
292+
293+
<Form
294+
method="post"
295+
id="accounts-form"
296+
onReset={() => sendAndClose(tabId, requestId, forOrigin, [])}
297+
>
298+
<input type="hidden" name="tabIdInput" value={tabId} />
299+
<input type="hidden" name="requestIdInput" value={requestId} />
300+
<input type="hidden" name="forOriginInput" value={forOrigin} />
301+
</Form>
302+
303+
<Button
304+
form="accounts-form"
305+
type="reset"
306+
variant="outline"
307+
size="md"
308+
>
309+
Cancel
310+
</Button>
311+
</Stack>
312+
);
313+
}
314+
277315
return (
278316
<Stack gap="lg" align="flex-start">
279317
<Title order={3}>

0 commit comments

Comments
 (0)