Skip to content

Commit a84fe13

Browse files
wesbillmanPinky
andauthored
fix(desktop): restore default community join option (#1969)
Signed-off-by: Wes <[email protected]> Co-authored-by: Pinky <44b8e82baa6e0e254e0208d68f335c283c94e7b78dd1fa10d5a49d3f13dd0435@sprout-oss.stage.blox.sqprod.co>
1 parent 001151e commit a84fe13

2 files changed

Lines changed: 44 additions & 0 deletions

File tree

‎desktop/src/features/communities/ui/WelcomeSetup.tsx‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ export function WelcomeSetup({
6464
setPage(nextPage);
6565
}, []);
6666

67+
const handleDefaultCommunity = React.useCallback(() => {
68+
communityOnboarding.start({
69+
source: "first-community",
70+
relayUrl: defaultRelayUrl,
71+
});
72+
}, [communityOnboarding, defaultRelayUrl]);
73+
6774
const handleInviteRedeem = React.useCallback(
6875
(relayWsUrl: string, code: string) => {
6976
communityOnboarding.start({
@@ -107,6 +114,15 @@ export function WelcomeSetup({
107114
Choose how you want to get started.
108115
</p>
109116
<div className="mt-8 flex w-full flex-col gap-3">
117+
{isLocalDevRelayUrl(defaultRelayUrl) ? null : (
118+
<Button
119+
className="h-10 w-full"
120+
onClick={handleDefaultCommunity}
121+
type="button"
122+
>
123+
Join default community
124+
</Button>
125+
)}
110126
<Button
111127
className="h-10 w-full"
112128
onClick={() => showPage("join")}

‎desktop/tests/e2e/onboarding.spec.ts‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,9 @@ test("first-community choices expose npub and invite input", async ({
580580
});
581581
await page.goto("/");
582582

583+
await expect(
584+
page.getByRole("button", { name: "Join default community" }),
585+
).toBeVisible();
583586
await expect(
584587
page.getByRole("button", { name: "Join a community" }),
585588
).toBeVisible();
@@ -620,6 +623,31 @@ test("first-community choices expose npub and invite input", async ({
620623
await expect(page.getByTestId("invite-redeem-input")).toBeVisible();
621624
});
622625

626+
test("first-community hides the default option for localhost", async ({
627+
page,
628+
}) => {
629+
await seedActiveIdentity(page, BLANK_TYLER_IDENTITY);
630+
await page.addInitScript((pubkey) => {
631+
window.localStorage.setItem(
632+
`buzz-machine-onboarding-complete.v2:${pubkey}`,
633+
"true",
634+
);
635+
}, BLANK_TYLER_IDENTITY.pubkey);
636+
await installMockBridge(page, undefined, {
637+
relayWsUrl: "ws://localhost:3000",
638+
skipOnboardingSeed: true,
639+
skipCommunitySeed: true,
640+
});
641+
await page.goto("/");
642+
643+
await expect(
644+
page.getByRole("button", { name: "Join default community" }),
645+
).toHaveCount(0);
646+
await expect(
647+
page.getByRole("button", { name: "Join a community" }),
648+
).toBeVisible();
649+
});
650+
623651
test("identity fallback text does not count as a real onboarding name", async ({
624652
page,
625653
}) => {

0 commit comments

Comments
 (0)