Quickly add Web3 messaging to your app with the Unstoppable Messaging React component. Allow any user with a wallet to connect with their contacts on other XMTP enabled platform such as Coinbase Wallet, Converse, Lens and others.
The full source code for this demo and the included React components can be found here on the official Unstoppable Domains GitHub repo.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import Box from '@mui/material/Box';
import Button from '@mui/material/Button';
import Paper from '@mui/material/Paper';
import React from 'react';
import {
UnstoppableMessaging,
useUnstoppableMessaging,
} from '@unstoppabledomains/ui-components';
const UnstoppableMessagingDemo = () => {
// Hook provides utility methods, such as opening the Unstoppable
// Messaging window by clicking a button
const {isChatReady, setOpenChat} = useUnstoppableMessaging();
// Open a chat window to a specific user
const handleOpenChat = () => {
setOpenChat("quirk.x");
};
return (
<Paper sx={{margin: 5, padding: 5}}>
<Box display="flex" marginTop={2}>
<UnstoppableMessaging />
<Button variant="contained" onClick={handleOpenChat}>
{isChatReady ? 'Open chat with quirk.x' : 'Setup chat'}
</Button>
</Box>
</Paper>
)
};