From 8e19ec866a3279cc3a91afa15e97f8aac6f9ab2b Mon Sep 17 00:00:00 2001 From: Ken Goldfarb Date: Fri, 3 Mar 2023 23:54:18 -0700 Subject: [PATCH 1/2] feat: show magic wallet --- src/components/Header/Header.tsx | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/components/Header/Header.tsx b/src/components/Header/Header.tsx index 43243c1..049deb9 100644 --- a/src/components/Header/Header.tsx +++ b/src/components/Header/Header.tsx @@ -8,11 +8,11 @@ import { Avatar, Divider } from '@mantine/core' -import { useWallet } from '@meemproject/react' +import { useAuth } from '@meemproject/react' import Link from 'next/link' import { useRouter } from 'next/router' import React, { useState } from 'react' -import { Logout, ChevronDown, Dots } from 'tabler-icons-react' +import { Logout, ChevronDown, Dots, Wallet } from 'tabler-icons-react' import { quickTruncate } from '../../utils/truncated_wallet' import { ChainSelect } from '../Atoms/ChainSelect' import { Logo } from '../Atoms/Logo' @@ -162,7 +162,7 @@ export const HeaderMenu: React.FC = () => { const [isUserMenuOpened, setUserMenuOpened] = useState(false) const { classes, cx } = useStyles() const router = useRouter() - const wallet = useWallet() + const wallet = useAuth() const navigateHome = () => { router.push({ pathname: '/' }) @@ -222,6 +222,22 @@ export const HeaderMenu: React.FC = () => { } > + {wallet.walletType === 'magic' && ( + { + try { + wallet.magic?.wallet.showUI() + } catch (e) { + // eslint-disable-next-line no-console + console.log(e) + } + }} + icon={} + > + Wallet + + )} { From abd7853483fe4710c57a6a917930e27495a239a4 Mon Sep 17 00:00:00 2001 From: Ken Goldfarb Date: Sat, 4 Mar 2023 00:05:09 -0700 Subject: [PATCH 2/2] bundle permissions --- src/components/Atoms/FacetList.tsx | 7 ++++-- src/components/Bundles/BundleContainer.tsx | 26 +++++++++++++--------- src/components/Bundles/BundleForm.tsx | 21 ++++++++++------- 3 files changed, 34 insertions(+), 20 deletions(-) diff --git a/src/components/Atoms/FacetList.tsx b/src/components/Atoms/FacetList.tsx index 5df5df1..dde36e2 100644 --- a/src/components/Atoms/FacetList.tsx +++ b/src/components/Atoms/FacetList.tsx @@ -36,6 +36,7 @@ export interface IProps { contracts?: Contracts[] isLoading?: boolean isEnabled?: boolean + isDisabled?: boolean } export const FacetList: React.FC = ({ @@ -44,6 +45,7 @@ export const FacetList: React.FC = ({ contractInstances, contracts, isEnabled, + isDisabled, proxyContract }) => { const { classes } = useStyles() @@ -227,7 +229,8 @@ export const FacetList: React.FC = ({ = ({ )} - {isEnabled && ( + {isEnabled && !isDisabled && (
{ const { anonClient } = useMeemApollo() const { classes } = useStyles() const bundleId = router.query.bundleId as string - const { chainId } = useWallet() + const { chainId, accounts } = useWallet() const form = useForm({ initialValues: { @@ -253,17 +253,23 @@ export const BundleContainer: React.FC = () => { form={form} isLoading={isLoading} contracts={contracts} + isDisabled={ + data?.Bundles[0].Creator?.address !== + accounts[0] + } /> -
- -
+ {data?.Bundles[0].Creator?.address === accounts[0] && ( +
+ +
+ )} )} diff --git a/src/components/Bundles/BundleForm.tsx b/src/components/Bundles/BundleForm.tsx index c917265..a3c64f0 100644 --- a/src/components/Bundles/BundleForm.tsx +++ b/src/components/Bundles/BundleForm.tsx @@ -38,11 +38,13 @@ export interface IProps { form: UseFormReturnType contracts: Contracts[] isLoading?: boolean + isDisabled?: boolean } export const BundleForm: React.FC = ({ form, - isLoading: isParentLoading + isLoading: isParentLoading, + isDisabled }) => { const { anonClient } = useMeemApollo() const { classes } = useStyles() @@ -125,13 +127,15 @@ export const BundleForm: React.FC = ({
Facets - + {!isDisabled && ( + + )}
= ({ contracts={data?.Contracts as Contracts[]} isLoading={isLoading} isEnabled + isDisabled={isDisabled} />