Skip to content
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

feat(quest-details): add support for individual claim click #29

Merged
merged 38 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
76e3856
feat(quest-details): add support for individual claim click
eliobricenov Oct 28, 2024
9da2eef
fix(quest-detail): use correct can claim logic
eliobricenov Oct 30, 2024
b07b677
tech(quest-details): add on reward and loading spinner
eliobricenov Oct 31, 2024
297665f
fix(quest-details): remove trailing error message
eliobricenov Oct 31, 2024
2765f48
tech(quest-details): show warning instead of disabling button
eliobricenov Oct 31, 2024
9a7a086
fix(quest-details): get address from connectWallet async
eliobricenov Nov 1, 2024
a950bf4
fix(i18n): bad translation
eliobricenov Nov 1, 2024
eabb54c
tech(quest-detail): extend type
eliobricenov Nov 3, 2024
855097b
tech(quest-detail): remove standby prop
eliobricenov Nov 4, 2024
906de4d
tech(quest-detail): make on play click mandatory
eliobricenov Nov 4, 2024
02842ad
tech(quest-detail): remove useMemo
eliobricenov Nov 4, 2024
cf658f6
chore: use alpha package
eliobricenov Nov 5, 2024
3706406
Merge branch 'main' into feat/claim-quest-page
eliobricenov Nov 5, 2024
0323704
chore: prettier
eliobricenov Nov 5, 2024
8947f4a
chore: change port
eliobricenov Nov 5, 2024
ccf1d73
tech(quest-details): add stories
eliobricenov Nov 5, 2024
c09653c
chore: prettier
eliobricenov Nov 5, 2024
a870b43
tech(quest-detail): first pass at revamp
eliobricenov Nov 7, 2024
5262397
feat(quest-detail): finish revamp
eliobricenov Nov 7, 2024
fec58f3
Merge branch 'main' into feat/claim-quest-page
eliobricenov Nov 7, 2024
3ee3260
chore: prettier
eliobricenov Nov 7, 2024
cd1d713
tech(quest-details): add rewards by category to query
eliobricenov Nov 7, 2024
bd1c05b
tech(quest-details): use getPlaystreakQuestStatus for eligibility
eliobricenov Nov 7, 2024
f019d50
tech(quest-details): reuse context values and export it
eliobricenov Nov 7, 2024
7d6b20b
feat(quest-details): add loading states
eliobricenov Nov 7, 2024
66f1fa3
Merge branch 'main' into feat/claim-quest-page
eliobricenov Nov 7, 2024
d191ba2
Merge branch 'main' into feat/claim-quest-page
eliobricenov Nov 8, 2024
f9cb7ea
tech(quest-detail): fix timestamp
eliobricenov Nov 8, 2024
a269312
chore: bump minor version
eliobricenov Nov 8, 2024
970a31c
chore: update lock
eliobricenov Nov 8, 2024
e6b82c1
tech(quest-detail): throw warning error instead of early return
eliobricenov Nov 8, 2024
cc8e54e
tech(quest-detail): allow null selectedQuest
eliobricenov Nov 8, 2024
7ca09ba
tech(quest-detail): add on show metamask
eliobricenov Nov 8, 2024
c4162d3
feat: add claimed reward state toast
eliobricenov Nov 9, 2024
03ec744
feat(quest-claim): add timeout
eliobricenov Nov 12, 2024
d0053c4
Merge branch 'main' into feat/claim-quest-page
eliobricenov Nov 14, 2024
e210687
chore: prettier
eliobricenov Nov 14, 2024
ef7b5c7
chore: remove alpha files
eliobricenov Nov 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
BrettCleary marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you bump the version here by a minor version?

Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "@hyperplay/quests-ui",
"version": "0.0.33",
"version": "0.0.34",
"description": "",
"main": "index.js",
"scripts": {
"build": "vite build",
"lint": "eslint ./src",
"prettier": "prettier --check .",
"prettier-fix": "prettier --write .",
"storybook": "storybook dev -p 6006",
"storybook": "storybook dev -p 6007",
"build-storybook": "storybook build",
"test": "jest"
},
Expand All @@ -30,6 +30,7 @@
"@chromatic-com/storybook": "^1.9.0",
"@mantine/core": "^7.5.1",
"@hyperplay/chains": "^0.3.0",
"@hyperplay/ui": "^1.8.13-alpha.0",
eliobricenov marked this conversation as resolved.
Show resolved Hide resolved
"@storybook/addon-essentials": "^8.3.4",
"@storybook/addon-interactions": "^8.3.4",
"@storybook/addon-links": "^8.3.4",
Expand All @@ -38,7 +39,6 @@
"@storybook/react": "^8.3.4",
"@storybook/react-vite": "^8.3.4",
"@storybook/test": "^8.3.4",
"@hyperplay/ui": "^1.8.4",
"@hyperplay/utils": "^0.2.7",
"@tanstack/query-core": "^5.59.13",
"@tanstack/react-query": "^5.51.23",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

eliobricenov marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Meta, StoryObj } from '@storybook/react'
import { QuestDetailsWrapper, QuestDetailsWrapperProps } from './index'
import styles from './story-styles.module.scss'

const meta: Meta<typeof QuestDetailsWrapper> = {
component: QuestDetailsWrapper,
Expand All @@ -11,24 +12,25 @@ export default meta
type Story = StoryObj<typeof QuestDetailsWrapper>

const mockProps: QuestDetailsWrapperProps = {
className: styles.root,
selectedQuestId: 1,
projectId: 'test-project',
flags: {
rewardTypeClaimEnabled: {
ERC20: false,
ERC721: false,
ERC1155: false,
POINTS: false,
'EXTERNAL-TASKS': false
ERC20: true,
ERC721: true,
ERC1155: true,
POINTS: true,
'EXTERNAL-TASKS': true
},
questsOverlayClaimCtaEnabled: false
},
onPlayClick: () => alert('onPlayClick'),
getQuest: async () => {
return {
id: 1,
project_id: 'test-project',
name: '🦖 Craft World’s Ultimate Play Streak Quest 🔥 🚀',
type: 'PLAY-STREAK',
type: 'PLAYSTREAK',
status: 'ACTIVE',
description: `Embrace the Ultimate Play Streak Quest by Craft World! 🎮 Play daily to earn rewards, contribute to the Masterpiece, and climb the leaderboard. 🏆

Expand All @@ -49,6 +51,17 @@ Rise among Craft World's top ranks. 🚀 Join now and make your mark before the
amount_per_user: '200000000000000000000000',
chain_id: 84532,
reward_type: 'ERC20'
},
{
id: 2,
name: 'G7 Credits',
contract_address: '0x0000000000000000000000000000000000000000',
decimals: 18,
image_url: 'https://gateway-b3.valist.io/hyperplay/game7passport.png',
token_ids: [],
amount_per_user: '100000000000000000000000',
chain_id: 84532,
reward_type: 'EXTERNAL-TASKS'
}
],
deposit_contracts: [],
Expand All @@ -72,13 +85,15 @@ Rise among Craft World's top ranks. 🚀 Join now and make your mark before the
capsule_image: 'https://test.com/image.png'
}
},
isSignedIn: true,
isSignedIn: false,
trackEvent: () => {},
signInWithSteamAccount: () => {},
openSignInModal: () => {},
openSignInModal: () => alert('openSignInModal'),
logError: () => {},
claimPoints: async () => {},
completeExternalTask: async () => {},
completeExternalTask: async () => {
alert('complete external task')
},
getQuestRewardSignature: async () => {
return {
signature: `0x123`,
Expand All @@ -87,13 +102,19 @@ Rise among Craft World's top ranks. 🚀 Join now and make your mark before the
tokenIds: []
}
},
confirmRewardClaim: async () => {},
resyncExternalTask: async () => {},
confirmRewardClaim: async () => {
alert('confirm reward claim')
},
resyncExternalTask: async () => {
console.log('resync external task')
},
getExternalTaskCredits: async () => {
return '100'
},
syncPlaySession: async () => {},
logInfo: () => {},
syncPlaySession: async () => {
console.log('sync play session')
},
logInfo: () => console.log,
openDiscordLink: () => {},
getDepositContracts: async () => {
return []
Expand All @@ -109,6 +130,68 @@ Rise among Craft World's top ranks. 🚀 Join now and make your mark before the
}
}

export const PlayStreakQuest: Story = {
args: mockProps
export const QuestPageNotSignedIn: Story = {
args: {
...mockProps,
isQuestsPage: true
}
}

export const QuestPageSignedIn: Story = {
args: {
...mockProps,
isQuestsPage: true,
isSignedIn: true
}
}

export const QuestPageSignedInEligible: Story = {
args: {
...mockProps,
isQuestsPage: true,
isSignedIn: true,
getUserPlayStreak: async () => {
return {
current_playstreak_in_days: 5
}
},
checkG7ConnectionStatus: async () => {
return true
}
}
}

export const OverlayNotSignedIn: Story = {
args: {
...mockProps
}
}

export const OverlaySignedIn: Story = {
args: {
...mockProps,
isSignedIn: true
}
}

export const OverlaySignedInEligible: Story = {
args: {
...mockProps,
isSignedIn: true,
getUserPlayStreak: async () => {
return {
current_playstreak_in_days: 5
}
}
}
}

export const PendingExternalSync: Story = {
args: {
...mockProps,
isSignedIn: true,
getPendingExternalSync: async () => {
return true
}
}
}
Loading