mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-16 13:14:58 +08:00
Use hooks better
This commit is contained in:
parent
4cb7381d03
commit
8862b8298c
@ -40,7 +40,8 @@ import TextWithTooltip from "../elements/TextWithTooltip";
|
||||
import BaseAvatar from "../avatars/BaseAvatar";
|
||||
import AccessibleTooltipButton from "../elements/AccessibleTooltipButton";
|
||||
import WidgetStore, {IApp} from "../../../stores/WidgetStore";
|
||||
import { E2EStatus, shieldStatusForRoom } from "../../../utils/ShieldUtils";
|
||||
import { E2EStatus } from "../../../utils/ShieldUtils";
|
||||
import RoomContext from "../../../contexts/RoomContext";
|
||||
|
||||
interface IProps {
|
||||
room: Room;
|
||||
@ -200,13 +201,8 @@ const RoomSummaryCard: React.FC<IProps> = ({ room, onClose }) => {
|
||||
};
|
||||
|
||||
const isRoomEncrypted = useIsEncrypted(cli, room);
|
||||
|
||||
const [e2eStatus, setE2eStatus] = useState<E2EStatus>();
|
||||
useEffect(() => {
|
||||
if (isRoomEncrypted) {
|
||||
shieldStatusForRoom(cli, room).then(e => setE2eStatus(e));
|
||||
}
|
||||
});
|
||||
const roomContext = useContext(RoomContext);
|
||||
const e2eStatus = roomContext.e2eStatus;
|
||||
|
||||
const alias = room.getCanonicalAlias() || room.getAltAliases()[0] || "";
|
||||
const header = <React.Fragment>
|
||||
|
Loading…
Reference in New Issue
Block a user