-
Notifications
You must be signed in to change notification settings - Fork 316
feat(twitter): add an NFT tab in profile page #3804
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
Merged
Merged
Changes from all commits
Commits
Show all changes
64 commits
Select commit
Hold shift + click to select a range
639e9a3
fix: enhance tab list on the profile page
lelenei fab30d4
fix: recover file
lelenei 799d433
fix: tab list style
lelenei 7d361a4
feat: add collective list
UncleBill c3639e7
fix: tab style
lelenei 512c2cb
fix: conflict files
lelenei 3b4782e
fix: tab style
lelenei 9937bfc
feat: get user address from profile page
UncleBill 8af0957
feat(web3-shared): add useResolveEns for resolving ens
UncleBill 9ee2e0c
fixup! feat(web3-shared): add useResolveEns for resolving ens
UncleBill 4b26ae9
feat: resolve ens
UncleBill e376917
fix: improve layout of CollectiableList
UncleBill 89c03d2
fix: replace auto-fit with auto-fill
UncleBill 00a6f7b
Update packages/maskbook/src/social-network/types.ts
UncleBill c75d418
fix: eslint warning
UncleBill edb80b4
fix: eslint warning
UncleBill e5499bb
fix: move useEthereumName to individual file
UncleBill 34013d4
fix: missing useState
UncleBill baf1d23
fix: eslint warning
UncleBill 9f3224b
fix: show nfts list page
lelenei 3f47c11
fix: use MaskMessage
lelenei f539985
Update packages/web3-shared/src/hooks/useResolveEns.ts
UncleBill 33ed78a
fix: useEthereumName check twitterId
UncleBill d4db2d7
fix: style in My Wallets
lelenei a09366c
fix: ens address error
lelenei 7be268c
fix: apply review
lelenei 06aee93
fix: apply review
lelenei 8b7015c
fix: apply review
lelenei 546d8d2
fix: apply review
lelenei 93a45f7
fix: apply review
lelenei b37f0be
fix: no fallback
lelenei d087523
refactor: remove unused code
lelenei 1edcf2f
fix: inject nfts in search
lelenei 3024229
fix: remove dependency wallet
lelenei 187e20b
refactor: css style
lelenei 5e1c1bd
fix: improve code
lelenei d71b65c
fix: apply review
lelenei 7c8394d
refactor: useLocationChange
guanbinrui 81306e3
fix: prettier
guanbinrui 0379c47
fix: add profileNFTTabUpdated event
lelenei 1713573
fix: eslint error
lelenei 1b11e85
refactor: code style
lelenei 6eeafc0
fix: broken lockfile
Jack-Works c43fd01
Merge branch 'fix-lockfile' into lelenei/fix-3751
Jack-Works 6cec77a
chore: migrate enhanced profile tab to new makeStyles
Jack-Works 285f694
fix: refresh nft list
lelenei 95782d9
refactor: improve code
lelenei 3135f37
fix: change the chainnet, not update the nft list
lelenei 1e00ffd
fix: recovery code
lelenei a37b623
fix: ens resolve
lelenei 342dd42
fix: css breaks
Jack-Works c54300c
fix: hide retry button
lelenei 221ab5c
Merge remote-tracking branch 'origin/fix-css' into lelenei/fix-3751
lelenei 0ca51c6
refactor: use makeStyles
lelenei a919964
fix: review
lelenei 8e03a7c
fix: pnpm-lock.yaml conflict
lelenei 877a7aa
Merge remote-tracking branch 'origin/develop' into lelenei/fix-3751
lelenei 3812044
refactor: reply review
lelenei e3e52a6
fix: update pnpm-lock.yaml
lelenei 52536af
fix: hover selector
lelenei b8f2892
fix: hint font
lelenei 6319b6d
fix: style problem
Jack-Works f2dfdc6
Merge branch 'lelenei/fix-3751' of https://github.com/DimensionDev/Ma…
lelenei 3a4c978
fix: css error
lelenei File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
packages/maskbook/src/components/InjectedComponents/EnhancedProfile.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| import { useStylesExtends } from '@masknet/shared' | ||
| import { getMaskColor, makeStyles } from '@masknet/theme' | ||
| import { useState, useEffect } from 'react' | ||
| import { CollectibleListAddress } from '../../extension/options-page/DashboardComponents/CollectibleList' | ||
| import { useEthereumAddress } from '../../social-network-adaptor/twitter.com/injection/useEthereumName' | ||
| import { MaskMessage } from '../../utils' | ||
| import { useLocationChange } from '../../utils/hooks/useLocationChange' | ||
|
|
||
| const useStyles = makeStyles()((theme) => ({ | ||
| text: { | ||
| paddingTop: 36, | ||
| paddingBottom: 36, | ||
| '& > p': { | ||
| color: getMaskColor(theme).textPrimary, | ||
| }, | ||
| }, | ||
| button: {}, | ||
| })) | ||
|
|
||
| interface EnhancedProfileaPageProps extends withClasses<'text' | 'button'> { | ||
| bioDescription: string | ||
| nickname: string | ||
| twitterId: string | ||
| onUpdated: () => void | ||
| } | ||
|
|
||
| export function EnhancedProfileaPage(props: EnhancedProfileaPageProps) { | ||
| const [show, setShow] = useState(false) | ||
| const classes = useStylesExtends(useStyles(), props) | ||
| const { bioDescription, nickname, twitterId, onUpdated } = props | ||
|
|
||
| useLocationChange(() => { | ||
| MaskMessage.events.profileNFTsTabUpdated.sendToLocal('reset') | ||
| }) | ||
|
|
||
| useEffect(() => { | ||
| return MaskMessage.events.profileNFTsTabUpdated.on((data) => { | ||
| onUpdated() | ||
| }) | ||
| }, []) | ||
|
|
||
| useEffect(() => { | ||
| return MaskMessage.events.profileNFTsPageUpdated.on((data) => { | ||
| setShow(data.show) | ||
| }) | ||
| }, []) | ||
|
|
||
| const resolvedAddress = useEthereumAddress(nickname, twitterId, bioDescription) | ||
| return <>{show ? <CollectibleListAddress classes={classes} address={resolvedAddress ?? ''} /> : null}</> | ||
| } | ||
45 changes: 45 additions & 0 deletions
45
packages/maskbook/src/components/InjectedComponents/EnhancedProfileTab.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| import classnames from 'classnames' | ||
| import { ReactElement, useCallback, useEffect, useState } from 'react' | ||
|
|
||
| import { MaskMessage } from '../../utils' | ||
|
|
||
| export interface EnhancedProfileTabProps extends withClasses<'tab' | 'button' | 'selected'> { | ||
| clear(): void | ||
| reset(): void | ||
| children?: ReactElement | ||
| // Required! This component don't have it own style. | ||
| classes: Record<'tab' | 'button' | 'selected', string> | ||
| } | ||
|
|
||
| export function EnhancedProfileTab(props: EnhancedProfileTabProps) { | ||
| const { reset, clear, children, classes } = props | ||
| const [active, setActive] = useState(false) | ||
|
|
||
| const onClose = () => { | ||
| setActive(false) | ||
| MaskMessage.events.profileNFTsPageUpdated.sendToLocal({ show: false }) | ||
| reset() | ||
| } | ||
| const onOpen = () => { | ||
| MaskMessage.events.profileNFTsPageUpdated.sendToLocal({ show: true }) | ||
| setActive(true) | ||
| } | ||
|
|
||
| useEffect(() => { | ||
| return MaskMessage.events.profileNFTsTabUpdated.on(onClose) | ||
| }, []) | ||
|
|
||
| const onClick = useCallback(() => { | ||
| onOpen() | ||
| clear() | ||
| }, [clear, onOpen]) | ||
|
|
||
| return ( | ||
| <div key="nfts" className={classes.tab}> | ||
| <div className={classnames(classes.button, active ? classes.selected : '')} onClick={onClick}> | ||
| NFTs | ||
| {active && children ? children : null} | ||
| </div> | ||
| </div> | ||
| ) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.