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: collect publication without profile 🚀 #92

Merged
merged 8 commits into from
Jul 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 src/components/Comment/NewComment/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ import { Dispatch, FC, useState } from 'react'
import toast from 'react-hot-toast'
import {
APP_NAME,
CONNECT_WALLET,
ERROR_MESSAGE,
ERRORS,
LENSHUB_PROXY,
RELAY_ON
RELAY_ON,
SIGN_WALLET
} from 'src/constants'
import { useAppPersistStore, useAppStore } from 'src/store/app'
import { v4 as uuid } from 'uuid'
Expand Down Expand Up @@ -228,7 +228,7 @@ const NewComment: FC<Props> = ({
)

const createComment = async () => {
if (!isAuthenticated) return toast.error(CONNECT_WALLET)
if (!isAuthenticated) return toast.error(SIGN_WALLET)
if (commentContent.length === 0 && attachments.length === 0) {
return setCommentContentError('Comment should not be empty!')
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/Community/Create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ import React, { ChangeEvent, useState } from 'react'
import toast from 'react-hot-toast'
import {
APP_NAME,
CONNECT_WALLET,
ERROR_MESSAGE,
ERRORS,
LENSHUB_PROXY,
RELAY_ON
RELAY_ON,
SIGN_WALLET
} from 'src/constants'
import Custom404 from 'src/pages/404'
import { useAppPersistStore, useAppStore } from 'src/store/app'
Expand Down Expand Up @@ -157,7 +157,7 @@ const Create: NextPage = () => {
)

const createCommunity = async (name: string, description: string | null) => {
if (!isAuthenticated) return toast.error(CONNECT_WALLET)
if (!isAuthenticated) return toast.error(SIGN_WALLET)

setIsUploading(true)
const { path } = await uploadToIPFS({
Expand Down
6 changes: 3 additions & 3 deletions src/components/Community/Join.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import splitSignature from '@lib/splitSignature'
import React, { Dispatch, FC } from 'react'
import toast from 'react-hot-toast'
import {
CONNECT_WALLET,
ERROR_MESSAGE,
ERRORS,
LENSHUB_PROXY,
RELAY_ON
RELAY_ON,
SIGN_WALLET
} from 'src/constants'
import { useAppPersistStore, useAppStore } from 'src/store/app'
import { useAccount, useContractWrite, useSignTypedData } from 'wagmi'
Expand Down Expand Up @@ -148,7 +148,7 @@ const Join: FC<Props> = ({ community, setJoined, showJoin = true }) => {
)

const createCollect = () => {
if (!isAuthenticated) return toast.error(CONNECT_WALLET)
if (!isAuthenticated) return toast.error(SIGN_WALLET)

createCollectTypedData({
variables: {
Expand Down
6 changes: 3 additions & 3 deletions src/components/Crowdfund/Create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ import React, { ChangeEvent, useState } from 'react'
import toast from 'react-hot-toast'
import {
APP_NAME,
CONNECT_WALLET,
DEFAULT_COLLECT_TOKEN,
ERROR_MESSAGE,
ERRORS,
LENSHUB_PROXY,
RELAY_ON
RELAY_ON,
SIGN_WALLET
} from 'src/constants'
import Custom404 from 'src/pages/404'
import { useAppPersistStore, useAppStore } from 'src/store/app'
Expand Down Expand Up @@ -200,7 +200,7 @@ const Create: NextPage = () => {
referralFee: string,
description: string | null
) => {
if (!isAuthenticated) return toast.error(CONNECT_WALLET)
if (!isAuthenticated) return toast.error(SIGN_WALLET)

setIsUploading(true)
const { path } = await uploadToIPFS({
Expand Down
6 changes: 3 additions & 3 deletions src/components/Post/Actions/Collect/CollectModule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ interface Props {

const CollectModule: FC<Props> = ({ count, setCount, post }) => {
const { userSigNonce, setUserSigNonce } = useAppStore()
const { isAuthenticated, currentUser } = useAppPersistStore()
const { isConnected, isAuthenticated, currentUser } = useAppPersistStore()
const [revenue, setRevenue] = useState<number>(0)
const [showCollectorsModal, setShowCollectorsModal] = useState<boolean>(false)
const [allowed, setAllowed] = useState<boolean>(true)
Expand Down Expand Up @@ -294,7 +294,7 @@ const CollectModule: FC<Props> = ({ count, setCount, post }) => {
)

const createCollect = () => {
if (!isAuthenticated) return toast.error(CONNECT_WALLET)
if (!isConnected) return toast.error(CONNECT_WALLET)

createCollectTypedData({
variables: {
Expand Down Expand Up @@ -503,7 +503,7 @@ const CollectModule: FC<Props> = ({ count, setCount, post }) => {
/>
</div>
) : null}
{currentUser ? (
{isConnected ? (
allowanceLoading || balanceLoading ? (
<div className="mt-5 w-28 rounded-lg h-[34px] shimmer" />
) : allowed || collectModule.type === 'FreeCollectModule' ? (
Expand Down
4 changes: 2 additions & 2 deletions src/components/Post/Actions/Like.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import humanize from '@lib/humanize'
import { motion } from 'framer-motion'
import { FC, useEffect, useState } from 'react'
import toast from 'react-hot-toast'
import { CONNECT_WALLET } from 'src/constants'
import { SIGN_WALLET } from 'src/constants'
import { useAppPersistStore } from 'src/store/app'

const ADD_REACTION_MUTATION = gql`
Expand Down Expand Up @@ -62,7 +62,7 @@ const Like: FC<Props> = ({ post }) => {
})

const createLike = () => {
if (!isAuthenticated) return toast.error(CONNECT_WALLET)
if (!isAuthenticated) return toast.error(SIGN_WALLET)

const variable = {
variables: {
Expand Down
6 changes: 3 additions & 3 deletions src/components/Post/Actions/Mirror.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ import { motion } from 'framer-motion'
import { FC, useEffect, useState } from 'react'
import toast from 'react-hot-toast'
import {
CONNECT_WALLET,
ERROR_MESSAGE,
ERRORS,
LENSHUB_PROXY,
RELAY_ON
RELAY_ON,
SIGN_WALLET
} from 'src/constants'
import { useAppPersistStore, useAppStore } from 'src/store/app'
import { useContractWrite, useSignTypedData } from 'wagmi'
Expand Down Expand Up @@ -178,7 +178,7 @@ const Mirror: FC<Props> = ({ post }) => {
)

const createMirror = () => {
if (!isAuthenticated) return toast.error(CONNECT_WALLET)
if (!isAuthenticated) return toast.error(SIGN_WALLET)

createMirrorTypedData({
variables: {
Expand Down
6 changes: 3 additions & 3 deletions src/components/Post/Crowdfund/Fund.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import splitSignature from '@lib/splitSignature'
import React, { Dispatch, FC, useState } from 'react'
import toast from 'react-hot-toast'
import {
CONNECT_WALLET,
ERROR_MESSAGE,
ERRORS,
LENSHUB_PROXY,
RELAY_ON
RELAY_ON,
SIGN_WALLET
} from 'src/constants'
import { useAppPersistStore, useAppStore } from 'src/store/app'
import {
Expand Down Expand Up @@ -198,7 +198,7 @@ const Fund: FC<Props> = ({ fund, collectModule, setRevenue, revenue }) => {
)

const createCollect = () => {
if (!isAuthenticated) return toast.error(CONNECT_WALLET)
if (!isAuthenticated) return toast.error(SIGN_WALLET)

createCollectTypedData({
variables: {
Expand Down
6 changes: 3 additions & 3 deletions src/components/Post/NewPost/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ import { Dispatch, FC, useState } from 'react'
import toast from 'react-hot-toast'
import {
APP_NAME,
CONNECT_WALLET,
ERROR_MESSAGE,
ERRORS,
LENSHUB_PROXY,
RELAY_ON
RELAY_ON,
SIGN_WALLET
} from 'src/constants'
import { useAppPersistStore, useAppStore } from 'src/store/app'
import { v4 as uuid } from 'uuid'
Expand Down Expand Up @@ -212,7 +212,7 @@ const NewPost: FC<Props> = ({ setShowModal, hideCard = false }) => {
)

const createPost = async () => {
if (!isAuthenticated) return toast.error(CONNECT_WALLET)
if (!isAuthenticated) return toast.error(SIGN_WALLET)
if (postContent.length === 0 && attachments.length === 0) {
return setPostContentError('Post should not be empty!')
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/Settings/Account/SetProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ import React, { FC, useEffect, useState } from 'react'
import toast from 'react-hot-toast'
import {
APP_NAME,
CONNECT_WALLET,
ERROR_MESSAGE,
ERRORS,
LENSHUB_PROXY,
RELAY_ON
RELAY_ON,
SIGN_WALLET
} from 'src/constants'
import Custom404 from 'src/pages/404'
import { useAppPersistStore, useAppStore } from 'src/store/app'
Expand Down Expand Up @@ -155,7 +155,7 @@ const SetProfile: FC = () => {
})

const setDefaultProfile = () => {
if (!isAuthenticated) return toast.error(CONNECT_WALLET)
if (!isAuthenticated) return toast.error(SIGN_WALLET)

createSetDefaultProfileTypedData({
variables: {
Expand Down
6 changes: 3 additions & 3 deletions src/components/Settings/Account/SuperFollow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ import splitSignature from '@lib/splitSignature'
import React, { FC, useState } from 'react'
import toast from 'react-hot-toast'
import {
CONNECT_WALLET,
DEFAULT_COLLECT_TOKEN,
ERROR_MESSAGE,
ERRORS,
LENSHUB_PROXY,
RELAY_ON
RELAY_ON,
SIGN_WALLET
} from 'src/constants'
import { useAppPersistStore, useAppStore } from 'src/store/app'
import { useContractWrite, useSignTypedData } from 'wagmi'
Expand Down Expand Up @@ -182,7 +182,7 @@ const SuperFollow: FC = () => {
})

const setSuperFollow = (amount: string | null, recipient: string | null) => {
if (!isAuthenticated) return toast.error(CONNECT_WALLET)
if (!isAuthenticated) return toast.error(SIGN_WALLET)

createSetFollowModuleTypedData({
variables: {
Expand Down
16 changes: 11 additions & 5 deletions src/components/Settings/Delete/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import React, { FC } from 'react'
import toast from 'react-hot-toast'
import {
APP_NAME,
CONNECT_WALLET,
ERROR_MESSAGE,
LENSHUB_PROXY
LENSHUB_PROXY,
SIGN_WALLET
} from 'src/constants'
import Custom404 from 'src/pages/404'
import { useAppPersistStore, useAppStore } from 'src/store/app'
Expand Down Expand Up @@ -59,8 +59,13 @@ const CREATE_BURN_PROFILE_TYPED_DATA_MUTATION = gql`

const DeleteSettings: FC = () => {
const { userSigNonce, setUserSigNonce } = useAppStore()
const { isAuthenticated, setIsAuthenticated, currentUser, setCurrentUser } =
useAppPersistStore()
const {
setIsConnected,
isAuthenticated,
setIsAuthenticated,
currentUser,
setCurrentUser
} = useAppPersistStore()
const { disconnect } = useDisconnect()
const { isLoading: signLoading, signTypedDataAsync } = useSignTypedData({
onError(error) {
Expand All @@ -70,6 +75,7 @@ const DeleteSettings: FC = () => {

const onCompleted = () => {
setIsAuthenticated(false)
setIsConnected(false)
setCurrentUser(null)
Cookies.remove('accessToken')
Cookies.remove('refreshToken')
Expand Down Expand Up @@ -123,7 +129,7 @@ const DeleteSettings: FC = () => {
})

const handleDelete = () => {
if (!isAuthenticated) return toast.error(CONNECT_WALLET)
if (!isAuthenticated) return toast.error(SIGN_WALLET)

createBurnProfileTypedData({
variables: {
Expand Down
6 changes: 3 additions & 3 deletions src/components/Settings/Profile/NFTPicture.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ import gql from 'graphql-tag'
import React, { FC, useState } from 'react'
import toast from 'react-hot-toast'
import {
CONNECT_WALLET,
ERROR_MESSAGE,
ERRORS,
IS_MAINNET,
LENSHUB_PROXY,
RELAY_ON
RELAY_ON,
SIGN_WALLET
} from 'src/constants'
import { useAppPersistStore, useAppStore } from 'src/store/app'
import {
Expand Down Expand Up @@ -188,7 +188,7 @@ const NFTPicture: FC<Props> = ({ profile }) => {
})

const setAvatar = async (contractAddress: string, tokenId: string) => {
if (!isAuthenticated) return toast.error(CONNECT_WALLET)
if (!isAuthenticated) return toast.error(SIGN_WALLET)

const challengeRes = await loadChallenge({
variables: {
Expand Down
6 changes: 3 additions & 3 deletions src/components/Settings/Profile/Picture.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import uploadAssetsToIPFS from '@lib/uploadAssetsToIPFS'
import React, { ChangeEvent, FC, useEffect, useState } from 'react'
import toast from 'react-hot-toast'
import {
CONNECT_WALLET,
ERROR_MESSAGE,
ERRORS,
LENSHUB_PROXY,
RELAY_ON
RELAY_ON,
SIGN_WALLET
} from 'src/constants'
import { useAppPersistStore, useAppStore } from 'src/store/app'
import { useContractWrite, useSignTypedData } from 'wagmi'
Expand Down Expand Up @@ -171,7 +171,7 @@ const Picture: FC<Props> = ({ profile }) => {
}

const editPicture = (avatar: string | undefined) => {
if (!isAuthenticated) return toast.error(CONNECT_WALLET)
if (!isAuthenticated) return toast.error(SIGN_WALLET)
if (!avatar) return toast.error("Avatar can't be empty!")

createSetProfileImageURITypedData({
Expand Down
6 changes: 3 additions & 3 deletions src/components/Settings/Profile/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ import React, { ChangeEvent, FC, useEffect, useState } from 'react'
import toast from 'react-hot-toast'
import {
APP_NAME,
CONNECT_WALLET,
ERROR_MESSAGE,
ERRORS,
LENS_PERIPHERY,
RELAY_ON
RELAY_ON,
SIGN_WALLET
} from 'src/constants'
import { useAppPersistStore, useAppStore } from 'src/store/app'
import { v4 as uuid } from 'uuid'
Expand Down Expand Up @@ -223,7 +223,7 @@ const Profile: FC<Props> = ({ profile }) => {
twitter: string | null,
bio: string | null
) => {
if (!isAuthenticated) return toast.error(CONNECT_WALLET)
if (!isAuthenticated) return toast.error(SIGN_WALLET)

setIsUploading(true)
const { path } = await uploadToIPFS({
Expand Down
6 changes: 3 additions & 3 deletions src/components/Shared/Follow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import splitSignature from '@lib/splitSignature'
import { Dispatch, FC } from 'react'
import toast from 'react-hot-toast'
import {
CONNECT_WALLET,
ERROR_MESSAGE,
ERRORS,
LENSHUB_PROXY,
RELAY_ON
RELAY_ON,
SIGN_WALLET
} from 'src/constants'
import { useAppPersistStore, useAppStore } from 'src/store/app'
import { useAccount, useContractWrite, useSignTypedData } from 'wagmi'
Expand Down Expand Up @@ -156,7 +156,7 @@ const Follow: FC<Props> = ({
)

const createFollow = () => {
if (!isAuthenticated) return toast.error(CONNECT_WALLET)
if (!isAuthenticated) return toast.error(SIGN_WALLET)

createFollowTypedData({
variables: {
Expand Down
Loading