From 7706d719a9eeb2781b52c6f4d497e3a765387cad Mon Sep 17 00:00:00 2001 From: teodorus-nathaniel Date: Fri, 22 Dec 2023 23:22:47 +0700 Subject: [PATCH 1/2] chore: change eth icon to ens in profile --- src/assets/icons/ens-dynamic-size.svg | 14 ++++++++++++++ src/utils/profile.ts | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 src/assets/icons/ens-dynamic-size.svg diff --git a/src/assets/icons/ens-dynamic-size.svg b/src/assets/icons/ens-dynamic-size.svg new file mode 100644 index 000000000..8fdb2f04c --- /dev/null +++ b/src/assets/icons/ens-dynamic-size.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/utils/profile.ts b/src/utils/profile.ts index 98a5c8e82..42ee929bf 100644 --- a/src/utils/profile.ts +++ b/src/utils/profile.ts @@ -1,4 +1,4 @@ -import EthIcon from '@/assets/icons/eth-dynamic-size.svg' +import EnsIcon from '@/assets/icons/ens-dynamic-size.svg' import KiltIcon from '@/assets/icons/kilt-dynamic-size.svg' import KusamaIcon from '@/assets/icons/kusama-dynamic-size.svg' import PolkadotIcon from '@/assets/icons/polkadot-dynamic-size.svg' @@ -72,7 +72,7 @@ export const profileSourceData: { link: () => '', }, ens: { - icon: EthIcon, + icon: EnsIcon, tooltip: 'ENS', link: (id) => `https://app.ens.domains/${id}`, }, From b7b56829e250f778534895d0b54b23c09810b894 Mon Sep 17 00:00:00 2001 From: teodorus-nathaniel Date: Fri, 22 Dec 2023 23:31:15 +0700 Subject: [PATCH 2/2] feat: show got it button instead of disconnect after enabling notif --- .../notifications/PushNotificationContent.tsx | 27 +++++++++--- .../TelegramNotificationContent.tsx | 41 +++++++++++++------ 2 files changed, 51 insertions(+), 17 deletions(-) diff --git a/src/components/auth/ProfileModal/contents/notifications/PushNotificationContent.tsx b/src/components/auth/ProfileModal/contents/notifications/PushNotificationContent.tsx index 8c729b8b2..0679d26bc 100644 --- a/src/components/auth/ProfileModal/contents/notifications/PushNotificationContent.tsx +++ b/src/components/auth/ProfileModal/contents/notifications/PushNotificationContent.tsx @@ -34,6 +34,7 @@ export default function PushNotificationContent( ) { const myAddress = useMyAccount((state) => state.address) const [isRegistered, setIsRegistered] = useState(false) + const [isAfterRegister, setIsAfterRegister] = useState(false) useEffect(() => { if (!myAddress) return @@ -62,16 +63,32 @@ export default function PushNotificationContent( return (
Push Notifications Enabled - + {isAfterRegister ? ( + + ) : ( + + )}
) } return ( - + { + setIsAfterRegister(true) + setIsRegistered(v) + }} + {...props} + /> ) } diff --git a/src/components/auth/ProfileModal/contents/notifications/TelegramNotificationContent.tsx b/src/components/auth/ProfileModal/contents/notifications/TelegramNotificationContent.tsx index 16d3a2f2d..b7be1cb61 100644 --- a/src/components/auth/ProfileModal/contents/notifications/TelegramNotificationContent.tsx +++ b/src/components/auth/ProfileModal/contents/notifications/TelegramNotificationContent.tsx @@ -16,6 +16,7 @@ export default function TelegramNotificationContent( ) { const { address } = props const [isAfterDisconnect, setIsAfterDisconnect] = useState(false) + const [isAfterConnect, setIsAfterConnect] = useState(false) const { data: linkedAccounts, @@ -26,9 +27,9 @@ export default function TelegramNotificationContent( }) const isLoadingAccount = isLoading || isFetching const { IntegratedSkeleton } = useIntegratedSkeleton(isLoadingAccount) - const firstLinkedAccount = !isLoadingAccount ? linkedAccounts?.[0] : null + const hasLinkedAccount = !isLoadingAccount ? linkedAccounts?.[0] : null - if (!isLoadingAccount && !firstLinkedAccount) { + if (!isLoadingAccount && !hasLinkedAccount) { return ( <> {isAfterDisconnect && ( @@ -36,7 +37,10 @@ export default function TelegramNotificationContent( You have disconnected your account from Grill's telegram bot. )} - + setIsAfterConnect(true)} + /> ) } @@ -45,7 +49,7 @@ export default function TelegramNotificationContent(
{(userName) => ( @@ -55,7 +59,7 @@ export default function TelegramNotificationContent( )} {() => ( @@ -71,12 +75,21 @@ export default function TelegramNotificationContent( )} - {firstLinkedAccount && ( - setIsAfterDisconnect(true)} - /> - )} + {hasLinkedAccount && + (isAfterConnect ? ( + + ) : ( + setIsAfterDisconnect(true)} + /> + ))}
) } @@ -108,7 +121,10 @@ function DisconnectButton({ ) } -function ConnectTelegramButton({ address }: ProfileModalContentProps) { +function ConnectTelegramButton({ + address, + afterConnect, +}: ProfileModalContentProps & { afterConnect?: () => void }) { const queryClient = useQueryClient() const { isFetching: isFetchingAccount } = getLinkedTelegramAccountsQuery.useQuery({ @@ -138,6 +154,7 @@ function ConnectTelegramButton({ address }: ProfileModalContentProps) { const handleClickReload = () => { getLinkedTelegramAccountsQuery.invalidate(queryClient, { address }) + afterConnect?.() } return url ? (