fix: navigation to profile page from username component

This commit is contained in:
SwiftHawk 2024-07-05 14:04:20 +05:00
parent 08baf5dedd
commit d5024745f1

View File

@ -65,13 +65,14 @@ export const UserComponent = ({ pubkey, name, image }: UserProps) => {
const npub = hexToNpub(pubkey) const npub = hexToNpub(pubkey)
const roboImage = `https://robohash.org/${npub}.png?set=set3` const roboImage = `https://robohash.org/${npub}.png?set=set3`
const handleClick = (e: React.MouseEvent<HTMLElement, MouseEvent>) => {
e.stopPropagation()
navigate(getProfileRoute(pubkey))
}
return ( return (
<Box <Box
sx={{ display: 'flex', alignItems: 'center', gap: '10px', flexGrow: 1 }} sx={{ display: 'flex', alignItems: 'center', gap: '10px', flexGrow: 1 }}
onClick={(e) => {
e.stopPropagation()
navigate(getProfileRoute(pubkey))
}}
> >
<img <img
src={image || roboImage} src={image || roboImage}
@ -82,6 +83,7 @@ export const UserComponent = ({ pubkey, name, image }: UserProps) => {
borderStyle: 'solid', borderStyle: 'solid',
borderColor: `#${pubkey.substring(0, 6)}` borderColor: `#${pubkey.substring(0, 6)}`
}} }}
onClick={handleClick}
/> />
<Typography <Typography
component="label" component="label"
@ -90,6 +92,7 @@ export const UserComponent = ({ pubkey, name, image }: UserProps) => {
cursor: 'pointer', cursor: 'pointer',
color: theme.palette.text.primary color: theme.palette.text.primary
}} }}
onClick={handleClick}
> >
{name} {name}
</Typography> </Typography>