forked from Shiloh/remnantchat
feat: add button to copy current URL
This commit is contained in:
parent
7fb46bfe27
commit
07cd343b10
@ -33,6 +33,7 @@ import ListItemText from '@mui/material/ListItemText'
|
|||||||
import Home from '@mui/icons-material/Home'
|
import Home from '@mui/icons-material/Home'
|
||||||
import Brightness4Icon from '@mui/icons-material/Brightness4'
|
import Brightness4Icon from '@mui/icons-material/Brightness4'
|
||||||
import Brightness7Icon from '@mui/icons-material/Brightness7'
|
import Brightness7Icon from '@mui/icons-material/Brightness7'
|
||||||
|
import LinkIcon from '@mui/icons-material/Link'
|
||||||
|
|
||||||
import { ShellContext } from 'contexts/ShellContext'
|
import { ShellContext } from 'contexts/ShellContext'
|
||||||
import { SettingsContext } from 'contexts/SettingsContext'
|
import { SettingsContext } from 'contexts/SettingsContext'
|
||||||
@ -168,6 +169,14 @@ export const Shell = ({ children, userPeerId }: ShellProps) => {
|
|||||||
setIsDrawerOpen(false)
|
setIsDrawerOpen(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleLinkButtonClick = async () => {
|
||||||
|
await navigator.clipboard.writeText(window.location.href)
|
||||||
|
|
||||||
|
shellContextValue.showAlert('Current URL copied to clipboard', {
|
||||||
|
severity: 'success',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ShellContext.Provider value={shellContextValue}>
|
<ShellContext.Provider value={shellContextValue}>
|
||||||
<ThemeProvider theme={theme}>
|
<ThemeProvider theme={theme}>
|
||||||
@ -220,9 +229,21 @@ export const Shell = ({ children, userPeerId }: ShellProps) => {
|
|||||||
>
|
>
|
||||||
{title}
|
{title}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
<Tooltip title="Copy current URL">
|
||||||
|
<IconButton
|
||||||
|
size="large"
|
||||||
|
edge="start"
|
||||||
|
color="inherit"
|
||||||
|
aria-label="Copy current URL"
|
||||||
|
sx={{ mr: 1, ml: 'auto' }}
|
||||||
|
onClick={handleLinkButtonClick}
|
||||||
|
>
|
||||||
|
<LinkIcon />
|
||||||
|
</IconButton>
|
||||||
|
</Tooltip>
|
||||||
{doShowPeers ? (
|
{doShowPeers ? (
|
||||||
<Tooltip title="Number of peers in the room">
|
<Tooltip title="Number of peers in the room">
|
||||||
<StepIcon icon={numberOfPeers} sx={{ marginLeft: 'auto' }} />
|
<StepIcon icon={numberOfPeers} />
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
) : null}
|
) : null}
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
|
Loading…
Reference in New Issue
Block a user