-
Notifications
You must be signed in to change notification settings - Fork 6
Minting page standalone #2140
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
Minting page standalone #2140
Changes from 46 commits
Commits
Show all changes
59 commits
Select commit
Hold shift + click to select a range
f769b32
Standalone Minting page
prxt6529 f36f433
WIP
prxt6529 155fc86
WIP - phase detection from db merkle roots
prxt6529 a29e767
WIP
prxt6529 8690601
WIP
prxt6529 793c31c
WIP
prxt6529 efc3db8
WIP
prxt6529 99afff0
WIP
prxt6529 81f7bec
WIP
prxt6529 eeb8ccf
WIP
prxt6529 dff0636
WIP
prxt6529 07f6ca9
WIP
prxt6529 4933ec9
WIP
prxt6529 b2b2acb
WIP
prxt6529 3f0a17c
WIP
prxt6529 5cb1ecf
WIP
prxt6529 5035ea9
WIP
prxt6529 d092b86
WIP
prxt6529 1166ed0
WIP
prxt6529 91ed875
Merge branch 'main' into minting-page-standalone
prxt6529 29cd8ab
WIP
prxt6529 3c3a8bc
WIP
prxt6529 8a67566
WIP
prxt6529 d6dbf5c
Merge branch 'main' into minting-page-standalone
prxt6529 ae7b95c
WIP
prxt6529 492c414
WIP
prxt6529 278cf4a
WIP
prxt6529 d9e5dac
WIP
prxt6529 28a1f7e
WIP
prxt6529 a5aec50
WIP
prxt6529 b23fe1d
WIP
prxt6529 926685b
WIP
prxt6529 31093d5
WIP
prxt6529 ddd7a95
WIP
prxt6529 48e3ec3
WIP
prxt6529 ca2d125
WIP
prxt6529 dd987e0
WIP
prxt6529 914de6d
Merge branch 'main' into minting-page-standalone
prxt6529 157627a
WIP
prxt6529 8c37a8f
WIP
prxt6529 9df0782
WIP
prxt6529 ca529eb
WIP
prxt6529 baff12f
WIP
prxt6529 8ac8961
Merge branch 'main' into minting-page-standalone
prxt6529 5c83611
WIP
prxt6529 5eb7b4b
WIP
prxt6529 c71c3c4
WIP
prxt6529 330f243
Merge branch 'main' into minting-page-standalone
prxt6529 292595b
WIP
prxt6529 c106d49
WIP
prxt6529 bef0ee8
WIP
prxt6529 f6dd9bc
WIP
prxt6529 fbbe936
WIP
prxt6529 b06a8c8
WIP
prxt6529 240d4f6
WIP
prxt6529 eaaa6be
WIP
prxt6529 d755a0c
WIP
prxt6529 d94e24c
WIP
prxt6529 00bbaf1
WIP
prxt6529 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| name: Build - Upload to S3 - Deploy to Elastic Beanstalk | ||
| name: Web Deploy - PROD | ||
|
|
||
| on: workflow_dispatch | ||
|
|
||
|
|
||
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
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
264 changes: 264 additions & 0 deletions
264
__tests__/components/manifold-minting/ManifoldMintingPhases.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,264 @@ | ||
| import ManifoldMinting from "@/components/manifold-minting/ManifoldMinting"; | ||
| import { render, screen } from "@testing-library/react"; | ||
|
|
||
| const mockUseManifoldClaim = jest.fn(); | ||
|
|
||
| jest.mock("next/image", () => ({ | ||
| __esModule: true, | ||
| default: (props: any) => <img alt={props.alt ?? ""} {...props} />, | ||
| })); | ||
|
|
||
| jest.mock("next/link", () => ({ | ||
| __esModule: true, | ||
| default: ({ href, children, ...props }: any) => ( | ||
| <a href={href} {...props}> | ||
| {children} | ||
| </a> | ||
| ), | ||
| })); | ||
|
|
||
| jest.mock("@reown/appkit/react", () => ({ | ||
| AppKitButton: () => <div data-testid="appkit-button" />, | ||
| })); | ||
|
|
||
| jest.mock("@/components/drop-forge/DropForgeTestnetIndicator", () => ({ | ||
| __esModule: true, | ||
| default: () => <div data-testid="testnet-indicator" />, | ||
| })); | ||
|
|
||
| jest.mock("@/components/home/now-minting/NowMintingCountdown", () => ({ | ||
| __esModule: true, | ||
| default: () => <div data-testid="countdown" />, | ||
| })); | ||
|
|
||
| jest.mock("@/components/manifold-minting/ManifoldMintingWidget", () => ({ | ||
| __esModule: true, | ||
| default: () => <div data-testid="mint-widget" />, | ||
| })); | ||
|
|
||
| jest.mock("@/components/nft-attributes/NFTAttributes", () => ({ | ||
| __esModule: true, | ||
| default: () => <div data-testid="nft-attributes" />, | ||
| })); | ||
|
|
||
| jest.mock("@/components/nft-image/NFTImage", () => ({ | ||
| __esModule: true, | ||
| default: () => <div data-testid="nft-image" />, | ||
| })); | ||
|
|
||
| jest.mock("@/components/nft-marketplace-links/NFTMarketplaceLinks", () => ({ | ||
| __esModule: true, | ||
| default: () => <div data-testid="marketplace-links" />, | ||
| })); | ||
|
|
||
| jest.mock("@/hooks/useIdentity", () => ({ | ||
| useIdentity: () => ({ profile: null }), | ||
| })); | ||
|
|
||
| jest.mock("@/helpers/Helpers", () => ({ | ||
| areEqualAddresses: jest.fn(() => true), | ||
| capitalizeEveryWord: jest.fn((value: string) => value), | ||
| fromGWEI: jest.fn(() => 0), | ||
| getNameForContract: jest.fn(() => "Memes by 6529"), | ||
| getPathForContract: jest.fn(() => "the-memes"), | ||
| numberWithCommas: jest.fn((value: number) => value.toLocaleString()), | ||
| parseNftDescriptionToHtml: jest.fn((value: string) => value), | ||
| })); | ||
|
|
||
| jest.mock("@/constants/constants", () => ({ | ||
| ETHEREUM_ICON_TEXT: "ETH", | ||
| MANIFOLD_LAZY_CLAIM_CONTRACT: "0xproxy", | ||
| MEMES_CONTRACT: "0xmemes", | ||
| })); | ||
|
|
||
| jest.mock("@/helpers/time", () => ({ | ||
| Time: { | ||
| now: jest.fn(() => ({ | ||
| toMillis: () => Date.UTC(2026, 2, 18, 18, 25), | ||
| toSeconds: () => Date.UTC(2026, 2, 18, 18, 25) / 1000, | ||
| toDate: () => new Date(Date.UTC(2026, 2, 18, 18, 25)), | ||
| toLocaleDateTimeString: () => "2026-03-18 18:25", | ||
| toIsoDateString: () => "2026-03-18", | ||
| toIsoTimeString: () => "18:25:00 UTC", | ||
| })), | ||
| seconds: jest.fn((seconds: number) => ({ | ||
| toMillis: () => seconds * 1000, | ||
| toSeconds: () => seconds, | ||
| toDate: () => new Date(seconds * 1000), | ||
| toLocaleDateTimeString: () => `date-${seconds}`, | ||
| toIsoDateString: () => "2026-03-18", | ||
| toIsoTimeString: () => "00:00:00 UTC", | ||
| })), | ||
| }, | ||
| })); | ||
|
|
||
| jest.mock("@/hooks/useManifoldClaim", () => { | ||
| const createPhaseTime = (ms: number) => ({ | ||
| toMillis: () => ms, | ||
| toSeconds: () => ms / 1000, | ||
| toDate: () => new Date(ms), | ||
| toLocaleDateTimeString: () => `time-${ms}`, | ||
| toIsoDateString: () => "2026-03-18", | ||
| toIsoTimeString: () => "00:00:00 UTC", | ||
| lt: (other: { toMillis: () => number }) => ms < other.toMillis(), | ||
| gt: (other: { toMillis: () => number }) => ms > other.toMillis(), | ||
| gte: (other: { toMillis: () => number }) => ms >= other.toMillis(), | ||
| lte: (other: { toMillis: () => number }) => ms <= other.toMillis(), | ||
| }); | ||
|
|
||
| return { | ||
| __esModule: true, | ||
| useManifoldClaim: mockUseManifoldClaim, | ||
| buildMemesPhases: jest.fn(() => [ | ||
| { | ||
| id: "0", | ||
| name: "Phase 0 (Allowlist)", | ||
| type: "Allowlist", | ||
| start: createPhaseTime(Date.UTC(2026, 2, 18, 17, 40)), | ||
| end: createPhaseTime(Date.UTC(2026, 2, 18, 18, 20)), | ||
| }, | ||
| { | ||
| id: "1", | ||
| name: "Phase 1 (Allowlist)", | ||
| type: "Allowlist", | ||
| start: createPhaseTime(Date.UTC(2026, 2, 18, 18, 30)), | ||
| end: createPhaseTime(Date.UTC(2026, 2, 18, 18, 50)), | ||
| }, | ||
| { | ||
| id: "2", | ||
| name: "Phase 2 (Allowlist)", | ||
| type: "Allowlist", | ||
| start: createPhaseTime(Date.UTC(2026, 2, 18, 19, 0)), | ||
| end: createPhaseTime(Date.UTC(2026, 2, 18, 19, 20)), | ||
| }, | ||
| { | ||
| id: "public", | ||
| name: "Public Phase", | ||
| type: "Public Phase", | ||
| start: createPhaseTime(Date.UTC(2026, 2, 18, 19, 20)), | ||
| end: createPhaseTime(Date.UTC(2026, 2, 19, 17, 0)), | ||
| }, | ||
| ]), | ||
| ManifoldClaimStatus: { | ||
| ACTIVE: "active", | ||
| UPCOMING: "upcoming", | ||
| ENDED: "ended", | ||
| }, | ||
| ManifoldPhase: { | ||
| ALLOWLIST: "Allowlist", | ||
| PUBLIC: "Public Phase", | ||
| }, | ||
| }; | ||
| }); | ||
|
|
||
| describe("ManifoldMinting phases", () => { | ||
| beforeEach(() => { | ||
| mockUseManifoldClaim.mockReset(); | ||
| mockUseManifoldClaim.mockReturnValue({ | ||
| claim: { | ||
| instanceId: 1, | ||
| total: 153, | ||
| totalMax: 328, | ||
| remaining: 175, | ||
| costWei: 0n, | ||
| startDate: Date.UTC(2026, 2, 18, 17, 40) / 1000, | ||
| endDate: Date.UTC(2026, 2, 18, 18, 20) / 1000, | ||
| status: "ended", | ||
| phase: "Allowlist", | ||
| memePhase: { id: "0", name: "Phase 0 (Allowlist)" }, | ||
| nextMemePhase: { id: "1", name: "Phase 1 (Allowlist)" }, | ||
| isFetching: false, | ||
| isFinalized: true, | ||
| isDropComplete: false, | ||
| isSoldOut: false, | ||
| isError: false, | ||
| }, | ||
| isFetching: false, | ||
| }); | ||
| }); | ||
|
|
||
| test("shows only elapsed phases as completed during the downtime between memes phases", () => { | ||
| const { container } = render( | ||
| <ManifoldMinting | ||
| title="Test Meme" | ||
| contract="0xmemes" | ||
| chain={{ id: 1 } as any} | ||
| abi={[]} | ||
| mint_date={{ toMillis: () => Date.UTC(2026, 2, 18, 17, 40) } as any} | ||
| mintMetadata={{ | ||
| tokenId: 123, | ||
| metadata: { | ||
| name: "Test NFT", | ||
| description: "Test description", | ||
| attributes: [], | ||
| image_url: "test.jpg", | ||
| }, | ||
| }} | ||
| /> | ||
| ); | ||
|
|
||
| expect(screen.getByText("Phase 0 (Allowlist)")).toBeInTheDocument(); | ||
| expect(screen.getByText("Phase 1 (Allowlist)")).toBeInTheDocument(); | ||
| expect(screen.getByText("Phase 2 (Allowlist)")).toBeInTheDocument(); | ||
| expect(screen.getByText("Public Phase")).toBeInTheDocument(); | ||
| expect(screen.getAllByText("COMPLETED")).toHaveLength(1); | ||
| expect(screen.getAllByText("UPCOMING")).toHaveLength(3); | ||
| expect(screen.getByText("Unlimited spots")).toHaveClass( | ||
| "tw-text-primary-300" | ||
| ); | ||
| expect( | ||
| container.querySelectorAll(".tw-ring-success, .tw-ring-primary-300") | ||
| ).toHaveLength(1); | ||
| }); | ||
|
|
||
| test("highlights only the active phase when a current phase exists", () => { | ||
| mockUseManifoldClaim.mockReturnValue({ | ||
| claim: { | ||
| instanceId: 1, | ||
| total: 153, | ||
| totalMax: 328, | ||
| remaining: 175, | ||
| costWei: 0n, | ||
| startDate: Date.UTC(2026, 2, 18, 19, 0) / 1000, | ||
| endDate: Date.UTC(2026, 2, 18, 19, 20) / 1000, | ||
| status: "active", | ||
| phase: "Allowlist", | ||
| memePhase: { id: "2", name: "Phase 2 (Allowlist)" }, | ||
| nextMemePhase: { id: "public", name: "Public Phase" }, | ||
| isFetching: false, | ||
| isFinalized: false, | ||
| isDropComplete: false, | ||
| isSoldOut: false, | ||
| isError: false, | ||
| }, | ||
| isFetching: false, | ||
| }); | ||
|
|
||
| const { container } = render( | ||
| <ManifoldMinting | ||
| title="Test Meme" | ||
| contract="0xmemes" | ||
| chain={{ id: 1 } as any} | ||
| abi={[]} | ||
| mint_date={{ toMillis: () => Date.UTC(2026, 2, 18, 17, 40) } as any} | ||
| mintMetadata={{ | ||
| tokenId: 123, | ||
| metadata: { | ||
| name: "Test NFT", | ||
| description: "Test description", | ||
| attributes: [], | ||
| image_url: "test.jpg", | ||
| }, | ||
| }} | ||
| /> | ||
| ); | ||
|
|
||
| expect(screen.getByText("ACTIVE")).toBeInTheDocument(); | ||
| expect(screen.getAllByText("UPCOMING")).toHaveLength(1); | ||
| expect(screen.getByText("Unlimited spots")).toHaveClass( | ||
| "tw-text-primary-300" | ||
| ); | ||
| expect(container.querySelectorAll(".tw-ring-success")).toHaveLength(1); | ||
| expect(container.querySelectorAll(".tw-ring-primary-300")).toHaveLength(0); | ||
| }); | ||
| }); |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.