From ee8e93c3501ee266ead497dbe8ba63112595a08b Mon Sep 17 00:00:00 2001 From: imhson Date: Wed, 18 Dec 2024 14:26:11 +0700 Subject: [PATCH 1/6] update to subdomain .app --- public/devConfig.json | 2 +- public/mainConfig.json | 2 +- public/stagingConfig.json | 2 +- src/context/index.tsx | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/public/devConfig.json b/public/devConfig.json index 9e90b7df..ea4807c5 100644 --- a/public/devConfig.json +++ b/public/devConfig.json @@ -1,5 +1,5 @@ { - "REDIRECT_URL": "https://dev.punkga.me", + "REDIRECT_URL": "https://app.dev.punkga.me", "CHAIN_ID": "aura_6321-3", "CHAIN_INFO": { "chainId": "aura_6321-3", diff --git a/public/mainConfig.json b/public/mainConfig.json index b6c3d45a..6d7556b1 100644 --- a/public/mainConfig.json +++ b/public/mainConfig.json @@ -1,5 +1,5 @@ { - "REDIRECT_URL": "https://punkga.me", + "REDIRECT_URL": "https://app.punkga.me", "CHAIN_ID": "aura_6322-2", "CHAIN_INFO": { "chainId": "aura_6322-2", diff --git a/public/stagingConfig.json b/public/stagingConfig.json index 19f45c61..898c624b 100644 --- a/public/stagingConfig.json +++ b/public/stagingConfig.json @@ -1,5 +1,5 @@ { - "REDIRECT_URL": "https://staging.punkga.me", + "REDIRECT_URL": "https://app.staging.punkga.me", "CHAIN_ID": "aura_6321-3", "CHAIN_INFO": { "chainId": "aura_6321-3", diff --git a/src/context/index.tsx b/src/context/index.tsx index 9c59e83b..d146e67f 100644 --- a/src/context/index.tsx +++ b/src/context/index.tsx @@ -483,9 +483,9 @@ function ContextProvider({ children }: any) { } const removeTokenCookie = () => { - removeCookie('token', { path: '/', domain: '.punkga.me' }) - removeCookie('token', { path: '/', domain: '.staging.punkga.me' }) - removeCookie('token', { path: '/', domain: '.dev.punkga.me' }) + removeCookie('token', { path: '/', domain: '.app.punkga.me' }) + removeCookie('token', { path: '/', domain: '.app.staging.punkga.me' }) + removeCookie('token', { path: '/', domain: '.app.dev.punkga.me' }) } if (isSettingUp) { From 18d54c87b93e310bcb0da6ddaa1f2400100af2de Mon Sep 17 00:00:00 2001 From: imhson Date: Thu, 19 Dec 2024 14:34:48 +0700 Subject: [PATCH 2/6] add activities --- src/components/Header/components/Drawer.tsx | 501 ++++++++++-------- .../Header/components/UserDropdown.tsx | 377 +++++++------ src/context/index.tsx | 1 + src/models/user.ts | 1 + 4 files changed, 514 insertions(+), 366 deletions(-) diff --git a/src/components/Header/components/Drawer.tsx b/src/components/Header/components/Drawer.tsx index b15c979c..a6605158 100644 --- a/src/components/Header/components/Drawer.tsx +++ b/src/components/Header/components/Drawer.tsx @@ -23,6 +23,7 @@ import { useAccount, useBalance, useChainId, useSwitchChain } from 'wagmi' export default function Drawer({ openNavigation, setOpenNavigation }) { const config = getConfig() + const [showActivities, setShowActivities] = useState(false) const { t } = useTranslation() const router = useRouter() const { setMigrateWalletOpen } = useContext(ModalContext) @@ -61,7 +62,7 @@ export default function Drawer({ openNavigation, setOpenNavigation }) { <>
@@ -71,6 +72,7 @@ export default function Drawer({ openNavigation, setOpenNavigation }) { className='w-6 h-6 mt-2 relative' onClick={() => { setOpenNavigation(false) + setShowActivities(false) }}> @@ -78,240 +80,307 @@ export default function Drawer({ openNavigation, setOpenNavigation }) {
- {account?.verified && account?.name && ( + {showActivities ? ( <> -
-
-
{account?.name}
-
- dream-point - {formatNumber(+(+dpBalance?.data?.formatted || 0).toFixed(2))} {dpBalance?.data?.symbol || 'AURA'} -
+
+
setShowActivities(false)}> + + + + Activity
-
- Connected chain: {chainId == config.CHAIN_INFO.evmChainId ? 'Aura' : 'Story'} •{' '} - { - switchChain({ - chainId: chainId == config.CHAIN_INFO.evmChainId ? storyChain.id : config.CHAIN_INFO.evmChainId, - }) - }}> - {chainId == config.CHAIN_INFO.evmChainId ? 'Switch to Story' : 'Switch to Aura'} - -
- {account.noncustodialWalletAddress && ( -
-
setShowWalletDetail(!showWalletDetail)}> - - - - {t('My wallet')} -
- {showWalletDetail && ( -
-
-
{`${t('Wallet')}`}
-
-
{`${shorten( - account?.activeWalletAddress, - 8, - 8 - )}`}
-
- +
+ {account.activities.map((act, index) => { + if (act.type == 'SUBMIT_ARTWORK') + return ( +
+ +
+
Submit
+
+
+ {act.story_artwork.name} +
+
+{formatNumber(act.amount)}DP
- - {t('Copied')} -
-
{`${t('Balance')}`}
-
-
- {hideBalance - ? '********' - : `${(+walletBalance?.data?.formatted || 0).toFixed(2)} ${ - walletBalance?.data?.symbol || 'AURA' - }`} -
- - { -
- {hideBalance ? ( - setHideBalance(false)} - className='w-[18px] h-[18px] cursor-pointer' - /> - ) : ( - setHideBalance(true)} - className='w-[18px] h-[18px] cursor-pointer' - /> - )} +
+ ) + return null + })} +
+
+ + ) : ( + <> + {account?.verified && account?.name && ( + <> +
+
+
{account?.name}
+
+
+ dream-point + {formatNumber(+(+dpBalance?.data?.formatted || 0).toFixed(2))}{' '} + {dpBalance?.data?.symbol || 'AURA'} +
+
setShowActivities(true)}> + Activity + + + +
+
+
+
+ Connected chain: {chainId == config.CHAIN_INFO.evmChainId ? 'Aura' : 'Story'} •{' '} + { + switchChain({ + chainId: + chainId == config.CHAIN_INFO.evmChainId ? storyChain.id : config.CHAIN_INFO.evmChainId, + }) + }}> + {chainId == config.CHAIN_INFO.evmChainId ? 'Switch to Story' : 'Switch to Aura'} + +
+ {account.noncustodialWalletAddress && ( +
+
setShowWalletDetail(!showWalletDetail)}> + + + + {t('My wallet')} +
+ {showWalletDetail && ( +
+
+
{`${t('Wallet')}`}
+
+
{`${shorten( + account?.activeWalletAddress, + 8, + 8 + )}`}
+
+
- } - -
- {!account?.noncustodialWalletAddress ? ( - <> - - - ) : null} - {(address != account?.activeWalletAddress || !isConnected) && - account?.noncustodialWalletAddress && ( -
- - - - Wallet not connected + + {t('Copied')} +
- )} -
+
{`${t('Balance')}`}
+
+
+ {hideBalance + ? '********' + : `${(+walletBalance?.data?.formatted || 0).toFixed(2)} ${ + walletBalance?.data?.symbol || 'AURA' + }`} +
+ + { +
+ {hideBalance ? ( + setHideBalance(false)} + className='w-[18px] h-[18px] cursor-pointer' + /> + ) : ( + setHideBalance(true)} + className='w-[18px] h-[18px] cursor-pointer' + /> + )} +
+ } +
+
+ {!account?.noncustodialWalletAddress ? ( + <> + + + ) : null} + {(address != account?.activeWalletAddress || !isConnected) && + account?.noncustodialWalletAddress && ( +
+ + + + Wallet not connected +
+ )} +
+
+ )}
)} -
- )} +
{ + setOpenNavigation(false) + router.push('/profile') + }}> + + {t('My profile')} +
+
+ + )} +
{ setOpenNavigation(false) - router.push('/profile') + router.push('/characters') }}> - - {t('My profile')} + + {t('Characters')}
-
- - )} -
-
{ - setOpenNavigation(false) - router.push('/characters') - }}> - - {t('Characters')} -
-
{ - setOpenNavigation(false) - router.push('/campaigns') - }}> - - {t('Campaign')} -
-
{ - setOpenNavigation(false) - router.push('/events') - }}> - - - - {t('Event')} -
-
{ - setOpenNavigation(false) - router.push('/collections') - }}> - - - - - {t('Collection')} -
-
{ - setOpenNavigation(false) - router.push('/about-us') - }}> - - {t('About Us')} -
-
-
-
- -
{t('Language')}
+
{ + setOpenNavigation(false) + router.push('/campaigns') + }}> + + {t('Campaign')} +
+
{ + setOpenNavigation(false) + router.push('/events') + }}> + + + + {t('Event')} +
+
{ + setOpenNavigation(false) + router.push('/collections') + }}> + + + + + {t('Collection')} +
+
{ + setOpenNavigation(false) + router.push('/about-us') + }}> + + {t('About Us')}
+
+
+
+ +
{t('Language')}
+
-
- {locale == 'en' ? ( -
EN
- ) : ( -
VN
- )} +
+ {locale == 'en' ? ( +
EN
+ ) : ( +
VN
+ )} +
+
+ {account && ( +
{ + setOpenNavigation(false) + logout() + }}> + + {t('Log out')} +
+ )}
-
- {account && ( -
{ - setOpenNavigation(false) - logout() - }}> - - {t('Log out')} -
- )} -
+ + )}
) diff --git a/src/components/Header/components/UserDropdown.tsx b/src/components/Header/components/UserDropdown.tsx index 1af19780..85ad0355 100644 --- a/src/components/Header/components/UserDropdown.tsx +++ b/src/components/Header/components/UserDropdown.tsx @@ -17,6 +17,7 @@ export default function UserDropdown() { const config = getConfig() const { t } = useTranslation() const router = useRouter() + const [showActivities, setShowActivities] = useState(false) const { setMigrateWalletOpen } = useContext(ModalContext) const [isCopied, setIsCopied] = useState(false) const [showWalletDetail, setShowWalletDetail] = useState(false) @@ -66,180 +67,256 @@ export default function UserDropdown() {
-
-
{account?.name}
-
- dream-point - {formatNumber(+(+dpBalance?.data?.formatted || 0).toFixed(2))} {dpBalance?.data?.symbol || 'AURA'} -
-
-
- Connected chain: {chainId == config.CHAIN_INFO.evmChainId ? 'Aura' : 'Story'} •{' '} - { - switchChain({ - chainId: chainId == config.CHAIN_INFO.evmChainId ? storyChain.id : config.CHAIN_INFO.evmChainId, - }) - }}> - {chainId == config.CHAIN_INFO.evmChainId ? 'Switch to Story' : 'Switch to Aura'} - -
-
- {account.noncustodialWalletAddress && ( -
setShowWalletDetail(!showWalletDetail)} - className='flex items-center justify-between py-[18px] cursor-pointer'> -
- + {showActivities ? ( + <> +
+
setShowActivities(false)}> + - {t('My wallet')} + Activity +
+
+ {account.activities.map((act, index) => { + if (act.type == 'SUBMIT_ARTWORK') + return ( +
+ +
+
Submit
+
+
+ {act.story_artwork.name} +
+
+{formatNumber(act.amount)}DP
+
+
+
+ ) + return null + })}
- - -
- )} - {showWalletDetail && ( -
-
-
{`${t('Wallet')}`}
-
-
{`${shorten( - account?.activeWalletAddress, - 8, - 8 - )}`}
-
- + + ) : ( + <> +
+
{account?.name}
+
+
+ dream-point + {formatNumber(+(+dpBalance?.data?.formatted || 0).toFixed(2))} {dpBalance?.data?.symbol || 'AURA'} +
+
setShowActivities(true)}> + Activity + + + +
+
+
+
+ Connected chain: {chainId == config.CHAIN_INFO.evmChainId ? 'Aura' : 'Story'} •{' '} + { + switchChain({ + chainId: chainId == config.CHAIN_INFO.evmChainId ? storyChain.id : config.CHAIN_INFO.evmChainId, + }) + }}> + {chainId == config.CHAIN_INFO.evmChainId ? 'Switch to Story' : 'Switch to Aura'} + +
+
+ {account.noncustodialWalletAddress && ( +
setShowWalletDetail(!showWalletDetail)} + className='flex items-center justify-between py-[18px] cursor-pointer'> +
+ + {t('My wallet')}
- - {t('Copied')} - + + +
-
{`${t('Balance')}`}
-
-
- {hideBalance - ? '********' - : `${formatNumber(+(+walletBalance?.data?.formatted || 0).toFixed(2))} ${ - walletBalance?.data?.symbol || 'AURA' - }`} -
- - { -
- {hideBalance ? ( - - - - ) : ( + )} + {showWalletDetail && ( +
+
+
{`${t('Wallet')}`}
+
+
{`${shorten( + account?.activeWalletAddress, + 8, + 8 + )}`}
+
+ + + +
+ + {t('Copied')} + +
+
{`${t('Balance')}`}
+
+
+ {hideBalance + ? '********' + : `${formatNumber(+(+walletBalance?.data?.formatted || 0).toFixed(2))} ${ + walletBalance?.data?.symbol || 'AURA' + }`} +
+ + { +
+ {hideBalance ? ( + + + + ) : ( + + + + )} +
+ } +
+
+ {!account?.noncustodialWalletAddress ? ( + <> + + + ) : null} + {(address != account?.activeWalletAddress || !isConnected) && + account?.noncustodialWalletAddress && ( +
+ xmlns='http://www.w3.org/2000/svg'> - )} -
- } - -
- {!account?.noncustodialWalletAddress ? ( - <> - - - ) : null} - {(address != account?.activeWalletAddress || !isConnected) && account?.noncustodialWalletAddress && ( -
- - - - Wallet not connected + Wallet not connected +
+ )}
- )} +
+ )} +
router.push('/profile')} + className='py-[18px] cursor-pointer flex items-center gap-3'> + + + + {t('My profile')}
-
- )} -
router.push('/profile')} className='py-[18px] cursor-pointer flex items-center gap-3'> - - - - {t('My profile')} -
-
- - - +
+ + + - {t('Log out')} -
-
+ {t('Log out')} +
+
+ + )}
diff --git a/src/context/index.tsx b/src/context/index.tsx index d146e67f..59c532d4 100644 --- a/src/context/index.tsx +++ b/src/context/index.tsx @@ -335,6 +335,7 @@ function ContextProvider({ children }: any) { activeWalletAddress: res.active_wallet_address, noncustodialWalletAddress: res.wallet_address, tonWalletAddress: res.ton_wallet_address, + activities: res.punkga_wallets[0].punkga_wallet_activities, } as IUser) } if (!res.email_verified_at && res.email) { diff --git a/src/models/user.ts b/src/models/user.ts index 0a9eecfe..6030df69 100644 --- a/src/models/user.ts +++ b/src/models/user.ts @@ -40,4 +40,5 @@ export interface IUser { quests: any rank: number activeWalletAddress: string + activities: any[] } From 186b0e1ea98a5b0a926138bda859c767fae5f5a5 Mon Sep 17 00:00:00 2001 From: imhson Date: Thu, 19 Dec 2024 15:01:32 +0700 Subject: [PATCH 3/6] update activities --- src/components/Header/components/Drawer.tsx | 2 +- src/context/index.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Header/components/Drawer.tsx b/src/components/Header/components/Drawer.tsx index a6605158..c41fa453 100644 --- a/src/components/Header/components/Drawer.tsx +++ b/src/components/Header/components/Drawer.tsx @@ -96,7 +96,7 @@ export default function Drawer({ openNavigation, setOpenNavigation }) { Activity
- {account.activities.map((act, index) => { + {account?.activities?.map((act, index) => { if (act.type == 'SUBMIT_ARTWORK') return (
diff --git a/src/context/index.tsx b/src/context/index.tsx index 59c532d4..9919fdbc 100644 --- a/src/context/index.tsx +++ b/src/context/index.tsx @@ -335,7 +335,7 @@ function ContextProvider({ children }: any) { activeWalletAddress: res.active_wallet_address, noncustodialWalletAddress: res.wallet_address, tonWalletAddress: res.ton_wallet_address, - activities: res.punkga_wallets[0].punkga_wallet_activities, + activities: res?.punkga_wallets?.[0]?.punkga_wallet_activities, } as IUser) } if (!res.email_verified_at && res.email) { From df3d3bfaf9e2683eb67b2f8893fa3c325a4ac32f Mon Sep 17 00:00:00 2001 From: imhson Date: Thu, 19 Dec 2024 15:05:19 +0700 Subject: [PATCH 4/6] update activities --- src/components/Header/components/UserDropdown.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Header/components/UserDropdown.tsx b/src/components/Header/components/UserDropdown.tsx index 85ad0355..a45352b4 100644 --- a/src/components/Header/components/UserDropdown.tsx +++ b/src/components/Header/components/UserDropdown.tsx @@ -83,7 +83,7 @@ export default function UserDropdown() { Activity
- {account.activities.map((act, index) => { + {account?.activities?.map((act, index) => { if (act.type == 'SUBMIT_ARTWORK') return (
From 0428ff69cd8e50b6bbf5e3601e755bf2ac5ffaa7 Mon Sep 17 00:00:00 2001 From: imhson Date: Thu, 19 Dec 2024 16:06:12 +0700 Subject: [PATCH 5/6] fix event end date --- src/components/pages/homepage/manga.tsx | 1 + src/pages/events/your-city/submit/page.tsx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/pages/homepage/manga.tsx b/src/components/pages/homepage/manga.tsx index 78844a5b..c5c708d7 100644 --- a/src/components/pages/homepage/manga.tsx +++ b/src/components/pages/homepage/manga.tsx @@ -21,6 +21,7 @@ export default function Manga(props: IComic) { setLineClamp(res > 3 ? 3 : res) } }, []) + console.log(props) return ( { - if (moment().tz('Asia/Ho_Chi_Minh').isAfter(moment.tz('2025-01-01', 'Asia/Ho_Chi_Minh'))) { + if (moment().tz('Asia/Ho_Chi_Minh').isAfter(moment.tz('2025-01-15', 'Asia/Ho_Chi_Minh'))) { replace('/events/your-city') } }, []) From ce057a557239878221a78db86c18ca7d93df8953 Mon Sep 17 00:00:00 2001 From: imhson Date: Thu, 19 Dec 2024 16:40:08 +0700 Subject: [PATCH 6/6] show add manga --- src/pages/index.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/index.tsx b/src/pages/index.tsx index a1c47367..db5a8c8b 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -147,7 +147,6 @@ function Home() { }) : latestComic.data?.length ? latestComic.data - .filter((data: any) => data.tags.every((lang: any) => lang.en.toLowerCase() != 'invent contest')) .filter((data) => statusFilter.length && !statusFilter.some((s) => s.key == 'All status') ? statusFilter.some((filter) => data.status.text == filter?.key)