(props: GroupInfoProps)
| 23 | } |
| 24 | |
| 25 | function GroupInfo(props: GroupInfoProps) { |
| 26 | const { visible, onClose, group } = props; |
| 27 | |
| 28 | const action = useAction(); |
| 29 | const hasLinkman = useSelector( |
| 30 | (state: State) => !!state.linkmans[group?._id as string], |
| 31 | ); |
| 32 | const [largerAvatar, toggleLargetAvatar] = useState(false); |
| 33 | |
| 34 | if (!group) { |
| 35 | return null; |
| 36 | } |
| 37 | |
| 38 | async function handleJoinGroup() { |
| 39 | onClose(); |
| 40 | |
| 41 | if (!group) { |
| 42 | return; |
| 43 | } |
| 44 | const groupRes = await joinGroup(group._id); |
| 45 | if (groupRes) { |
| 46 | groupRes.type = 'group'; |
| 47 | action.addLinkman(groupRes, true); |
| 48 | |
| 49 | const messages = await getLinkmanHistoryMessages(group._id, 0); |
| 50 | if (messages) { |
| 51 | action.addLinkmanHistoryMessages(group._id, messages); |
| 52 | } |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | function handleFocusGroup() { |
| 57 | onClose(); |
| 58 | |
| 59 | if (!group) { |
| 60 | return; |
| 61 | } |
| 62 | action.setFocus(group._id); |
| 63 | } |
| 64 | |
| 65 | return ( |
| 66 | <Dialog |
| 67 | className={Style.infoDialog} |
| 68 | visible={visible} |
| 69 | onClose={onClose} |
| 70 | > |
| 71 | <div className={Style.coantainer}> |
| 72 | <div className={Style.header}> |
| 73 | <Avatar |
| 74 | size={60} |
| 75 | src={group.avatar} |
| 76 | onMouseEnter={() => toggleLargetAvatar(true)} |
| 77 | onMouseLeave={() => toggleLargetAvatar(false)} |
| 78 | /> |
| 79 | <img |
| 80 | className={`${Style.largeAvatar} ${ |
| 81 | largerAvatar ? 'show' : 'hide' |
| 82 | }`} |
nothing calls this directly
no test coverage detected