-
Notifications
You must be signed in to change notification settings - Fork 50
feat(web): warn mobile users and present waitlist #1433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
packages/web/src/components/MobileGate/MobileGate.test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| import "@testing-library/jest-dom"; | ||
| import { screen } from "@testing-library/react"; | ||
| import userEvent from "@testing-library/user-event"; | ||
| import { render } from "@web/__tests__/__mocks__/mock.render"; | ||
| import { MobileGate } from "./MobileGate"; | ||
|
|
||
| describe("MobileGate", () => { | ||
| const mockWindowOpen = jest.fn(); | ||
|
|
||
| beforeEach(() => { | ||
| jest.clearAllMocks(); | ||
| window.open = mockWindowOpen; | ||
| }); | ||
|
|
||
| describe("Component Rendering", () => { | ||
| it("renders the title message", () => { | ||
| render(<MobileGate />); | ||
|
|
||
| expect( | ||
| screen.getByText("Compass isn't built for mobile yet"), | ||
| ).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it("renders the descriptive message", () => { | ||
| render(<MobileGate />); | ||
|
|
||
| expect( | ||
| screen.getByText( | ||
| /We're focusing on perfecting the web experience first/, | ||
| ), | ||
| ).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it("renders the Join Mobile Waitlist button", () => { | ||
| render(<MobileGate />); | ||
|
|
||
| const waitlistButton = screen.getByRole("button", { | ||
| name: /join mobile waitlist/i, | ||
| }); | ||
| expect(waitlistButton).toBeInTheDocument(); | ||
| }); | ||
| }); | ||
|
|
||
| describe("Waitlist Button Behavior", () => { | ||
| it("opens waitlist URL in new tab when clicked", async () => { | ||
| const user = userEvent.setup(); | ||
| render(<MobileGate />); | ||
|
|
||
| const waitlistButton = screen.getByRole("button", { | ||
| name: /join mobile waitlist/i, | ||
| }); | ||
| await user.click(waitlistButton); | ||
|
|
||
| expect(mockWindowOpen).toHaveBeenCalledTimes(1); | ||
| expect(mockWindowOpen).toHaveBeenCalledWith( | ||
| "https://tylerdane.kit.com/compass-mobile", | ||
| "_blank", | ||
| "noopener,noreferrer", | ||
| ); | ||
| }); | ||
| }); | ||
|
|
||
| describe("Accessibility", () => { | ||
| it("has proper button role", () => { | ||
| render(<MobileGate />); | ||
|
|
||
| const button = screen.getByRole("button"); | ||
| expect(button).toBeInTheDocument(); | ||
| expect(button).toHaveTextContent("Join Mobile Waitlist"); | ||
| }); | ||
|
|
||
| it("renders heading for the title", () => { | ||
| render(<MobileGate />); | ||
|
|
||
| const heading = screen.getByRole("heading", { level: 1 }); | ||
| expect(heading).toBeInTheDocument(); | ||
| expect(heading).toHaveTextContent("Compass isn't built for mobile yet"); | ||
| }); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import React from "react"; | ||
|
|
||
| const WAITLIST_URL = "https://tylerdane.kit.com/compass-mobile"; | ||
|
|
||
| export const MobileGate: React.FC = () => { | ||
| const handleJoinWaitlist = () => { | ||
| window.open(WAITLIST_URL, "_blank", "noopener,noreferrer"); | ||
| }; | ||
|
|
||
| return ( | ||
| <div className="bg-bg-primary flex min-h-dvh items-center justify-center p-4"> | ||
| <div className="border-border-primary bg-bg-secondary flex w-[400px] max-w-[90vw] flex-col items-center rounded border p-8 text-center"> | ||
| <h1 className="mb-6 font-sans text-2xl font-medium text-white"> | ||
| Compass isn't built for mobile yet | ||
| </h1> | ||
| <p className="text-text-light-inactive mb-8 font-sans text-base leading-relaxed"> | ||
| We're focusing on perfecting the web experience first. Join our | ||
| mobile waitlist to be the first to know when we launch. | ||
| </p> | ||
| <button | ||
| onClick={handleJoinWaitlist} | ||
| className="bg-accent-primary focus:outline-accent-primary min-h-[44px] cursor-pointer rounded border-none px-8 py-2 font-sans text-base font-medium text-white transition-opacity duration-300 hover:opacity-90 focus:outline focus:outline-2 focus:outline-offset-2" | ||
| > | ||
| Join Mobile Waitlist | ||
| </button> | ||
| </div> | ||
| </div> | ||
| ); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot update this component to use tailwind, not styled-components