mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
update message button in profile
This commit is contained in:
parent
3d057f942b
commit
9bdaaa781e
@ -2,6 +2,13 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sendMessage {
|
||||||
|
display: flex;
|
||||||
|
position: justify-end;
|
||||||
|
background-color: white;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
.account p {
|
.account p {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ export default function Account({
|
|||||||
<Jellyfish className={styles.image} />
|
<Jellyfish className={styles.image} />
|
||||||
)}
|
)}
|
||||||
</figure>
|
</figure>
|
||||||
|
{/* <div>aaa</div> */}
|
||||||
<div>
|
<div>
|
||||||
<h3 className={styles.name}>{profile?.name}</h3>
|
<h3 className={styles.name}>{profile?.name}</h3>
|
||||||
{accountId && (
|
{accountId && (
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import React, { ReactElement, useState } from 'react'
|
import React, { ReactElement, useEffect, useState } from 'react'
|
||||||
import PublisherLinks from './PublisherLinks'
|
import PublisherLinks from './PublisherLinks'
|
||||||
import Markdown from '@shared/Markdown'
|
import Markdown from '@shared/Markdown'
|
||||||
import Stats from './Stats'
|
import Stats from './Stats'
|
||||||
import Account from './Account'
|
import Account from './Account'
|
||||||
import styles from './index.module.css'
|
import styles from './index.module.css'
|
||||||
import { useProfile } from '@context/Profile'
|
import { useProfile } from '@context/Profile'
|
||||||
|
import { useOrbis } from '@context/Orbis'
|
||||||
|
|
||||||
const isDescriptionTextClamped = () => {
|
const isDescriptionTextClamped = () => {
|
||||||
const el = document.getElementById('description')
|
const el = document.getElementById('description')
|
||||||
@ -25,12 +26,49 @@ export default function AccountHeader({
|
|||||||
accountId: string
|
accountId: string
|
||||||
}): ReactElement {
|
}): ReactElement {
|
||||||
const { profile } = useProfile()
|
const { profile } = useProfile()
|
||||||
|
const { orbis, account } = useOrbis()
|
||||||
const [isShowMore, setIsShowMore] = useState(false)
|
const [isShowMore, setIsShowMore] = useState(false)
|
||||||
|
const [userDid, setUserDid] = useState<string>()
|
||||||
|
|
||||||
const toogleShowMore = () => {
|
const toogleShowMore = () => {
|
||||||
setIsShowMore(!isShowMore)
|
setIsShowMore(!isShowMore)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getDid = async () => {
|
||||||
|
const { data, error } = await orbis.getDids(accountId)
|
||||||
|
if (data) {
|
||||||
|
if (data.length > 0) {
|
||||||
|
setUserDid(data[0])
|
||||||
|
} else {
|
||||||
|
setUserDid('did:pkh:eip155:1:' + accountId.toLocaleLowerCase())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
console.log(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const createConversation = async () => {
|
||||||
|
const res = await orbis.createConversation({
|
||||||
|
recipients: [userDid]
|
||||||
|
})
|
||||||
|
if (res.status === 200) {
|
||||||
|
console.log(res)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
console.log(userDid)
|
||||||
|
}, [userDid])
|
||||||
|
|
||||||
|
const clickHandler = () => {
|
||||||
|
console.log(accountId)
|
||||||
|
console.log(account)
|
||||||
|
getDid()
|
||||||
|
createConversation()
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.grid}>
|
<div className={styles.grid}>
|
||||||
<div>
|
<div>
|
||||||
@ -53,6 +91,9 @@ export default function AccountHeader({
|
|||||||
{profile?.links?.length > 0 && (
|
{profile?.links?.length > 0 && (
|
||||||
<PublisherLinks className={styles.publisherLinks} />
|
<PublisherLinks className={styles.publisherLinks} />
|
||||||
)}
|
)}
|
||||||
|
<button className="sendMessage" onClick={clickHandler}>
|
||||||
|
Send Messages
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.meta}>
|
<div className={styles.meta}>
|
||||||
Profile data from{' '}
|
Profile data from{' '}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user