forked from DimensionDev/Maskbook
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: instagram nft avater (DimensionDev#5718)
* feat: instagram nft avtar * fix: bugfix * fix: bugfix * fix: bugfix * fix: bugfix * chore: ui style * fix: web3 tab bugfix * fix: bugfix * chore: reply review
- Loading branch information
1 parent
a89e311
commit ce52461
Showing
21 changed files
with
656 additions
and
74 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import './communicate' | ||
import './locationChange' | ||
import './user-agent' | ||
|
||
if (document.currentScript) document.currentScript.remove() |
This file was deleted.
Oops, something went wrong.
This file contains 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 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 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 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 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 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 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 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
...ages/mask/src/social-network-adaptor/instagram.com/injection/NFT/NFTAvatarEditProfile.tsx
This file contains 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 { MutationObserverWatcher } from '@dimensiondev/holoflows-kit' | ||
import { searchInstagramAvatarSettingDialog, searchInstagramProfileAvatarButtonSelector } from '../../utils/selector' | ||
import { createReactRootShadowed, MaskMessages, startWatch } from '../../../../utils' | ||
import { useCallback } from 'react' | ||
import { makeStyles } from '@masknet/theme' | ||
import { NFTAvatarButton } from '../../../../plugins/Avatar/SNSAdaptor/NFTAvatarButton' | ||
import { NFTAvatarSettingDialog } from './NFTAvatarSettingDialog' | ||
import { useLocation } from 'react-use' | ||
|
||
export function injectOpenNFTAvatarEditProfileButton(signal: AbortSignal) { | ||
const watcher = new MutationObserverWatcher(searchInstagramProfileAvatarButtonSelector()) | ||
startWatch(watcher, signal) | ||
createReactRootShadowed(watcher.firstDOMProxy.afterShadow, { signal }).render( | ||
<OpenNFTAvatarEditProfileButtonInInstagram />, | ||
) | ||
|
||
const dialogWatcher = new MutationObserverWatcher(searchInstagramAvatarSettingDialog()) | ||
startWatch(dialogWatcher, signal) | ||
createReactRootShadowed(dialogWatcher.firstDOMProxy.afterShadow, { signal }).render(<NFTAvatarSettingDialog />) | ||
} | ||
|
||
const useStyles = makeStyles()(() => ({ | ||
root: { | ||
marginTop: 5, | ||
marginLeft: 'auto', | ||
marginRight: 'auto', | ||
background: '#262626', | ||
borderRadius: '4px !important', | ||
height: 30, | ||
width: 104, | ||
}, | ||
text: { | ||
fontSize: 12, | ||
color: '#ffffff', | ||
lineHeight: '12px', | ||
}, | ||
})) | ||
|
||
function OpenNFTAvatarEditProfileButtonInInstagram() { | ||
const location = useLocation() | ||
const onClick = useCallback(() => { | ||
MaskMessages.events.nftAvatarSettingDialogUpdated.sendToLocal({ open: true }) | ||
}, []) | ||
|
||
const { classes } = useStyles() | ||
|
||
if (location.pathname?.includes('/edit')) return null | ||
|
||
return <NFTAvatarButton onClick={onClick} classes={classes} /> | ||
} |
Oops, something went wrong.