From 1986a995e62dffd2d34374d129ddb079f75210d3 Mon Sep 17 00:00:00 2001 From: teodorus-nathaniel Date: Fri, 8 Mar 2024 12:23:26 +0700 Subject: [PATCH 1/4] Integrate redirect-hard message to fix suggest feature --- src/components/profile-selector/MyAccountMenu.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/profile-selector/MyAccountMenu.tsx b/src/components/profile-selector/MyAccountMenu.tsx index df660ebb7..fcb3984e5 100644 --- a/src/components/profile-selector/MyAccountMenu.tsx +++ b/src/components/profile-selector/MyAccountMenu.tsx @@ -87,6 +87,9 @@ export const AccountMenu: React.FunctionComponent = ({ address, ow } else if (name === 'redirect') { router.push(value) setIsOpenProfileModal(false) + } else if (name === 'redirect-hard') { + window.location.href = value + setIsOpenProfileModal(false) } } }, []) From 6ee051b1c39654167b5efe3d056249d59c09619b Mon Sep 17 00:00:00 2001 From: teodorus-nathaniel Date: Fri, 8 Mar 2024 12:59:24 +0700 Subject: [PATCH 2/4] Fix parse message --- src/components/profile-selector/MyAccountMenu.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/profile-selector/MyAccountMenu.tsx b/src/components/profile-selector/MyAccountMenu.tsx index fcb3984e5..c42ac0ecd 100644 --- a/src/components/profile-selector/MyAccountMenu.tsx +++ b/src/components/profile-selector/MyAccountMenu.tsx @@ -67,7 +67,12 @@ const MyAccountDrawerContext = createContext(initV export const useMyAccountDrawer = () => useContext(MyAccountDrawerContext) function parseMessage(data: string) { - const [origin, name, value] = data.split(':') + const match = data.match(/^([^:]+):([^:]+):(.+)$/) + if (!match) return null + + const origin = match[1] + const name = match[2] + const value = match[3] if (origin !== 'grill') return null return { name: name ?? '', value: value ?? '' } } From 6a5b40fd085687045e67453d9aeb672bbb0a650f Mon Sep 17 00:00:00 2001 From: teodorus-nathaniel Date: Fri, 8 Mar 2024 13:07:54 +0700 Subject: [PATCH 3/4] Change to use hard navigation --- src/components/profile-selector/MyAccountMenu.tsx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/components/profile-selector/MyAccountMenu.tsx b/src/components/profile-selector/MyAccountMenu.tsx index c42ac0ecd..ad77d1021 100644 --- a/src/components/profile-selector/MyAccountMenu.tsx +++ b/src/components/profile-selector/MyAccountMenu.tsx @@ -1,4 +1,3 @@ -import { useRouter } from 'next/router' import React, { createContext, FC, useContext, useEffect, useRef, useState } from 'react' import { getCurrentUrlOrigin } from 'src/utils/url' import { InfoDetails } from '../profiles/address-views' @@ -79,7 +78,6 @@ function parseMessage(data: string) { export const AccountMenu: React.FunctionComponent = ({ address, owner }) => { const iframeRef = useRef(null) const [isOpenProfileModal, setIsOpenProfileModal] = useState(false) - const router = useRouter() useEffect(() => { window.onmessage = event => { @@ -89,10 +87,8 @@ export const AccountMenu: React.FunctionComponent = ({ address, ow const { name, value } = message if (name === 'profile' && value === 'close') { setIsOpenProfileModal(false) - } else if (name === 'redirect') { - router.push(value) - setIsOpenProfileModal(false) - } else if (name === 'redirect-hard') { + } else if (name === 'redirect' || name === 'redirect-hard') { + // Using router push for redirect don't redirect properly, it just have loading for a bit and changes the url much later window.location.href = value setIsOpenProfileModal(false) } From f20aec118fad707a77557a4467b283a9a1d53353 Mon Sep 17 00:00:00 2001 From: teodorus-nathaniel Date: Fri, 8 Mar 2024 13:10:46 +0700 Subject: [PATCH 4/4] Remove double grill in sitename --- src/config/app/grill/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/app/grill/index.ts b/src/config/app/grill/index.ts index 403a67628..46df7cf5d 100644 --- a/src/config/app/grill/index.ts +++ b/src/config/app/grill/index.ts @@ -9,7 +9,7 @@ const index: AppConfig = { appBaseUrl: 'https://grillapp.net', themeName: undefined, metaTags: { - siteName: 'Grill: Grill: Monetize Every Like, Comment, Post | Web3 Social', + siteName: 'Grill: Monetize Every Like, Comment, Post | Web3 Social', title: 'Grill: Monetize Every Like, Comment, Post | Web3 Social', desc: 'Revolutionary Web3 social finance platform where bloggers and their followers earn together. Blockchain, NFT, and crypto content.', defaultImage: '/images/grill-default-cover.png',