ProfileMenuButton: fix the lost profile info
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				/ depoly (push) Successful in 1m19s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	/ depoly (push) Successful in 1m19s
				
			This commit is contained in:
		
							parent
							
								
									6705b754d1
								
							
						
					
					
						commit
						9d720d31b4
					
				
					 1 changed files with 20 additions and 11 deletions
				
			
		| 
						 | 
				
			
			@ -25,8 +25,15 @@ import { A } from "@solidjs/router";
 | 
			
		|||
 | 
			
		||||
const ProfileMenuButton: ParentComponent<{
 | 
			
		||||
  profile?: {
 | 
			
		||||
    account: { site: string };
 | 
			
		||||
    inf?: { displayName: string; avatar: string; username: string; id: string };
 | 
			
		||||
    account: {
 | 
			
		||||
      site: string;
 | 
			
		||||
      inf?: {
 | 
			
		||||
        displayName: string;
 | 
			
		||||
        avatar: string;
 | 
			
		||||
        username: string;
 | 
			
		||||
        id: string;
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
  onClick?: () => void;
 | 
			
		||||
  onClose?: () => void;
 | 
			
		||||
| 
						 | 
				
			
			@ -44,6 +51,8 @@ const ProfileMenuButton: ParentComponent<{
 | 
			
		|||
    props.onClick?.();
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  const inf = () => props.profile?.account.inf
 | 
			
		||||
 | 
			
		||||
  const onClose = () => {
 | 
			
		||||
    props.onClick?.();
 | 
			
		||||
    setAnchor(null);
 | 
			
		||||
| 
						 | 
				
			
			@ -60,8 +69,8 @@ const ProfileMenuButton: ParentComponent<{
 | 
			
		|||
        aria-expanded={open() ? "true" : undefined}
 | 
			
		||||
      >
 | 
			
		||||
        <Avatar
 | 
			
		||||
          alt={`${props.profile?.inf?.displayName}'s avatar`}
 | 
			
		||||
          src={props.profile?.inf?.avatar}
 | 
			
		||||
          alt={`${inf()?.displayName}'s avatar`}
 | 
			
		||||
          src={inf()?.avatar}
 | 
			
		||||
        ></Avatar>
 | 
			
		||||
      </ButtonBase>
 | 
			
		||||
      <Menu
 | 
			
		||||
| 
						 | 
				
			
			@ -86,31 +95,31 @@ const ProfileMenuButton: ParentComponent<{
 | 
			
		|||
      >
 | 
			
		||||
        <MenuItem
 | 
			
		||||
          component={A}
 | 
			
		||||
          href={`/${encodeURIComponent(`${props.profile?.inf?.username}@${props.profile?.account.site}`)}/profile/${props.profile?.inf?.id}`}
 | 
			
		||||
          href={`/${encodeURIComponent(`${inf()?.username}@${props.profile?.account.site}`)}/profile/${inf()?.id}`}
 | 
			
		||||
          disabled={!props.profile}
 | 
			
		||||
        >
 | 
			
		||||
          <ListItemAvatar>
 | 
			
		||||
            <Avatar src={props.profile?.inf?.avatar}></Avatar>
 | 
			
		||||
            <Avatar src={inf()?.avatar}></Avatar>
 | 
			
		||||
          </ListItemAvatar>
 | 
			
		||||
          <ListItemText
 | 
			
		||||
            primary={props.profile?.inf?.displayName}
 | 
			
		||||
            secondary={`@${props.profile?.inf?.username}`}
 | 
			
		||||
            primary={inf()?.displayName}
 | 
			
		||||
            secondary={`@${inf()?.username}`}
 | 
			
		||||
          ></ListItemText>
 | 
			
		||||
        </MenuItem>
 | 
			
		||||
 | 
			
		||||
        <MenuItem>
 | 
			
		||||
        <MenuItem disabled>
 | 
			
		||||
          <ListItemIcon>
 | 
			
		||||
            <BookmarkIcon />
 | 
			
		||||
          </ListItemIcon>
 | 
			
		||||
          <ListItemText>Bookmarks</ListItemText>
 | 
			
		||||
        </MenuItem>
 | 
			
		||||
        <MenuItem>
 | 
			
		||||
        <MenuItem disabled>
 | 
			
		||||
          <ListItemIcon>
 | 
			
		||||
            <LikeIcon />
 | 
			
		||||
          </ListItemIcon>
 | 
			
		||||
          <ListItemText>Likes</ListItemText>
 | 
			
		||||
        </MenuItem>
 | 
			
		||||
        <MenuItem>
 | 
			
		||||
        <MenuItem disabled>
 | 
			
		||||
          <ListItemIcon>
 | 
			
		||||
            <ListIcon />
 | 
			
		||||
          </ListItemIcon>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue