Skip to content

Commit 3881bff

Browse files
cynfrianpub19x6jnl6rhepymwyl2xlltz3ce7rfg2ktllle3g2vu59n3s490k8s9n40l3
andauthored
remove relay field from invite link step (#2131)
Signed-off-by: npub19x6jnl6rhepymwyl2xlltz3ce7rfg2ktllle3g2vu59n3s490k8s9n40l3 <29b529ff43be424db89f51bff58a38cf86942acbffff98a14ce50b38c2a57d8f@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub19x6jnl6rhepymwyl2xlltz3ce7rfg2ktllle3g2vu59n3s490k8s9n40l3 <29b529ff43be424db89f51bff58a38cf86942acbffff98a14ce50b38c2a57d8f@sprout-oss.stage.blox.sqprod.co>
1 parent 46a63a8 commit 3881bff

4 files changed

Lines changed: 39 additions & 16 deletions

File tree

‎desktop/src/app/App.tsx‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,6 @@ function CommunityApp({
410410
// Show welcome setup for first-run users with no communities
411411
appContent = (
412412
<WelcomeSetup
413-
defaultRelayUrl={community.defaultRelayUrl}
414413
initialPage={resumeFirstCommunityJoin ? "join" : undefined}
415414
onBack={onBackToMachineConfig}
416415
/>

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

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,16 @@ type WelcomeSetupPage = "welcome" | "join" | "invite";
3131
type WelcomeTransitionMode = "initial" | OnboardingTransitionDirection;
3232

3333
type WelcomeSetupProps = {
34-
defaultRelayUrl: string;
3534
initialPage?: WelcomeSetupPage;
3635
initialTransitionMode?: WelcomeTransitionMode;
3736
onBack: () => void;
3837
};
3938

4039
const CREATE_COMMUNITY_URL = "https://app.builderlab.xyz/signup?returnTo=/buzz";
41-
const LOCAL_DEV_RELAY_URLS = new Set([
42-
"ws://localhost:3000",
43-
"ws://127.0.0.1:3000",
44-
]);
4540
const COMMUNITY_OPTION_CARD_CLASS =
4641
"flex min-h-24 w-full max-w-[352px] items-center justify-center rounded-xl bg-white/75 px-6 py-4 text-center text-sm font-normal leading-6 text-foreground transition-colors duration-150 ease-out hover:bg-white/85 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-foreground/35";
4742

48-
function isLocalDevRelayUrl(relayUrl: string) {
49-
return LOCAL_DEV_RELAY_URLS.has(relayUrl.trim().replace(/\/$/, ""));
50-
}
51-
5243
export function WelcomeSetup({
53-
defaultRelayUrl,
5444
initialPage = "welcome",
5545
initialTransitionMode = "initial",
5646
onBack,
@@ -324,11 +314,6 @@ export function WelcomeSetup({
324314
</div>
325315
<div className="flex w-full flex-1 items-center justify-center pb-4 pt-12">
326316
<InviteRedeemForm
327-
defaultRelayUrl={
328-
isLocalDevRelayUrl(defaultRelayUrl)
329-
? undefined
330-
: defaultRelayUrl
331-
}
332317
error={null}
333318
isRedeeming={false}
334319
onCancel={() => showPage("welcome")}

‎desktop/src/features/onboarding/ui/InviteRedeemForm.tsx‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ export function InviteRedeemForm({
108108
("relayWsUrl" in parsed ||
109109
(isBareCode && bareCodeRelayUrl.trim().length > 0));
110110
const isOnboardingSpotlight = variant === "onboarding-spotlight";
111+
const showInvalidInviteTip =
112+
isOnboardingSpotlight && inviteInput.trim().length > 0 && !canSubmit;
111113

112114
const handleSubmit = React.useCallback(
113115
async (event: React.FormEvent) => {
@@ -310,6 +312,20 @@ export function InviteRedeemForm({
310312
</div>
311313
)}
312314

315+
{isOnboardingSpotlight ? (
316+
<p
317+
aria-hidden={!showInvalidInviteTip}
318+
aria-live="polite"
319+
className={cn(
320+
"min-h-5 w-full max-w-4xl text-center text-sm text-[#717106] transition-opacity duration-150 ease-out",
321+
showInvalidInviteTip ? "opacity-100" : "opacity-0",
322+
)}
323+
data-testid="invalid-invite-tip"
324+
>
325+
Please enter a valid invite link
326+
</p>
327+
) : null}
328+
313329
{needsRelayField ? (
314330
<div
315331
className={cn(

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,29 @@ test("first-community choices expose npub and invite input", async ({
729729
).toBe(true);
730730
await expect(page.getByTestId("invite-redeem-submit")).toHaveText("Next");
731731
await expect(page.getByTestId("invite-redeem-submit")).toBeDisabled();
732+
const inviteFrame = page.getByTestId("invite-redeem-input-frame");
733+
const initialInviteFrameBox = await inviteFrame.boundingBox();
734+
expect(initialInviteFrameBox).not.toBeNull();
735+
const invalidInviteTip = page.getByTestId("invalid-invite-tip");
736+
await expect(invalidInviteTip).toHaveAttribute("aria-hidden", "true");
737+
await expect(invalidInviteTip).toHaveCSS("opacity", "0");
738+
739+
await inviteInput.fill("awefi");
740+
await expect(page.getByLabel("Relay URL")).toHaveCount(0);
741+
await expect(page.getByTestId("invite-redeem-submit")).toBeDisabled();
742+
await expect(invalidInviteTip).toBeVisible();
743+
await expect(invalidInviteTip).toHaveAttribute("aria-hidden", "false");
744+
await expect(invalidInviteTip).toHaveCSS("opacity", "1");
745+
await expect(invalidInviteTip).toHaveCSS("color", "rgb(113, 113, 6)");
746+
await expect(invalidInviteTip).toHaveCSS("text-align", "center");
747+
const invalidInviteFrameBox = await inviteFrame.boundingBox();
748+
expect(invalidInviteFrameBox?.y).toBe(initialInviteFrameBox?.y);
749+
750+
await inviteInput.fill("https://default.example.com/invite/abc123");
751+
await expect(page.getByLabel("Relay URL")).toHaveCount(0);
752+
await expect(page.getByTestId("invite-redeem-submit")).toBeEnabled();
753+
await expect(invalidInviteTip).toHaveAttribute("aria-hidden", "true");
754+
await expect(invalidInviteTip).toHaveCSS("opacity", "0");
732755
});
733756

734757
test("first-community shows the scenario cards for localhost", async ({

0 commit comments

Comments
 (0)